1 /******************************************************************************
3 * Name: acinterp.h - Interpreter subcomponent prototypes and defines
5 *****************************************************************************/
8 * Copyright (C) 2000 - 2013, Intel Corp.
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions, and the following disclaimer,
16 * without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 * substantially similar to the "NO WARRANTY" disclaimer below
19 * ("Disclaimer") and any redistribution must be conditioned upon
20 * including a substantially similar Disclaimer requirement for further
21 * binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 * of any contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGES.
44 #ifndef __ACINTERP_H__
45 #define __ACINTERP_H__
48 #define ACPI_WALK_OPERANDS (&(WalkState->Operands [WalkState->NumOperands -1]))
50 /* Macros for tables used for debug output */
52 #define ACPI_EXD_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_OPERAND_OBJECT,f)
53 #define ACPI_EXD_NSOFFSET(f) (UINT8) ACPI_OFFSET (ACPI_NAMESPACE_NODE,f)
54 #define ACPI_EXD_TABLE_SIZE(name) (sizeof(name) / sizeof (ACPI_EXDUMP_INFO))
57 * If possible, pack the following structures to byte alignment, since we
58 * don't care about performance for debug output. Two cases where we cannot
59 * pack the structures:
61 * 1) Hardware does not support misaligned memory transfers
62 * 2) Compiler does not support pointers within packed structures
64 #if (!defined(ACPI_MISALIGNMENT_NOT_SUPPORTED) && !defined(ACPI_PACKED_POINTERS_NOT_SUPPORTED))
68 typedef const struct acpi_exdump_info
76 /* Values for the Opcode field above */
78 #define ACPI_EXD_INIT 0
79 #define ACPI_EXD_TYPE 1
80 #define ACPI_EXD_UINT8 2
81 #define ACPI_EXD_UINT16 3
82 #define ACPI_EXD_UINT32 4
83 #define ACPI_EXD_UINT64 5
84 #define ACPI_EXD_LITERAL 6
85 #define ACPI_EXD_POINTER 7
86 #define ACPI_EXD_ADDRESS 8
87 #define ACPI_EXD_STRING 9
88 #define ACPI_EXD_BUFFER 10
89 #define ACPI_EXD_PACKAGE 11
90 #define ACPI_EXD_FIELD 12
91 #define ACPI_EXD_REFERENCE 13
93 /* restore default alignment */
99 * exconvrt - object conversion
102 AcpiExConvertToInteger (
103 ACPI_OPERAND_OBJECT
*ObjDesc
,
104 ACPI_OPERAND_OBJECT
**ResultDesc
,
108 AcpiExConvertToBuffer (
109 ACPI_OPERAND_OBJECT
*ObjDesc
,
110 ACPI_OPERAND_OBJECT
**ResultDesc
);
113 AcpiExConvertToString (
114 ACPI_OPERAND_OBJECT
*ObjDesc
,
115 ACPI_OPERAND_OBJECT
**ResultDesc
,
118 /* Types for ->String conversion */
120 #define ACPI_EXPLICIT_BYTE_COPY 0x00000000
121 #define ACPI_EXPLICIT_CONVERT_HEX 0x00000001
122 #define ACPI_IMPLICIT_CONVERT_HEX 0x00000002
123 #define ACPI_EXPLICIT_CONVERT_DECIMAL 0x00000003
126 AcpiExConvertToTargetType (
127 ACPI_OBJECT_TYPE DestinationType
,
128 ACPI_OPERAND_OBJECT
*SourceDesc
,
129 ACPI_OPERAND_OBJECT
**ResultDesc
,
130 ACPI_WALK_STATE
*WalkState
);
134 * exdebug - AML debug object
137 AcpiExDoDebugObject (
138 ACPI_OPERAND_OBJECT
*SourceDesc
,
144 * exfield - ACPI AML (p-code) execution - field manipulation
147 AcpiExCommonBufferSetup (
148 ACPI_OPERAND_OBJECT
*ObjDesc
,
153 AcpiExWriteWithUpdateRule (
154 ACPI_OPERAND_OBJECT
*ObjDesc
,
157 UINT32 FieldDatumByteOffset
);
160 AcpiExGetBufferDatum(
164 UINT32 ByteGranularity
,
165 UINT32 BufferOffset
);
168 AcpiExSetBufferDatum (
172 UINT32 ByteGranularity
,
173 UINT32 BufferOffset
);
176 AcpiExReadDataFromField (
177 ACPI_WALK_STATE
*WalkState
,
178 ACPI_OPERAND_OBJECT
*ObjDesc
,
179 ACPI_OPERAND_OBJECT
**RetBufferDesc
);
182 AcpiExWriteDataToField (
183 ACPI_OPERAND_OBJECT
*SourceDesc
,
184 ACPI_OPERAND_OBJECT
*ObjDesc
,
185 ACPI_OPERAND_OBJECT
**ResultDesc
);
189 * exfldio - low level field I/O
192 AcpiExExtractFromField (
193 ACPI_OPERAND_OBJECT
*ObjDesc
,
195 UINT32 BufferLength
);
198 AcpiExInsertIntoField (
199 ACPI_OPERAND_OBJECT
*ObjDesc
,
201 UINT32 BufferLength
);
205 ACPI_OPERAND_OBJECT
*ObjDesc
,
206 UINT32 FieldDatumByteOffset
,
212 * exmisc - misc support routines
215 AcpiExGetObjectReference (
216 ACPI_OPERAND_OBJECT
*ObjDesc
,
217 ACPI_OPERAND_OBJECT
**ReturnDesc
,
218 ACPI_WALK_STATE
*WalkState
);
221 AcpiExConcatTemplate (
222 ACPI_OPERAND_OBJECT
*ObjDesc
,
223 ACPI_OPERAND_OBJECT
*ObjDesc2
,
224 ACPI_OPERAND_OBJECT
**ActualReturnDesc
,
225 ACPI_WALK_STATE
*WalkState
);
228 AcpiExDoConcatenate (
229 ACPI_OPERAND_OBJECT
*ObjDesc
,
230 ACPI_OPERAND_OBJECT
*ObjDesc2
,
231 ACPI_OPERAND_OBJECT
**ActualReturnDesc
,
232 ACPI_WALK_STATE
*WalkState
);
235 AcpiExDoLogicalNumericOp (
239 BOOLEAN
*LogicalResult
);
244 ACPI_OPERAND_OBJECT
*Operand0
,
245 ACPI_OPERAND_OBJECT
*Operand1
,
246 BOOLEAN
*LogicalResult
);
256 ACPI_WALK_STATE
*WalkState
);
259 AcpiExCreateProcessor (
260 ACPI_WALK_STATE
*WalkState
);
263 AcpiExCreatePowerResource (
264 ACPI_WALK_STATE
*WalkState
);
271 ACPI_WALK_STATE
*WalkState
);
275 ACPI_WALK_STATE
*WalkState
);
279 ACPI_WALK_STATE
*WalkState
);
285 ACPI_WALK_STATE
*WalkState
);
289 * exconfig - dynamic table load/unload
293 ACPI_OPERAND_OBJECT
*ObjDesc
,
294 ACPI_OPERAND_OBJECT
*Target
,
295 ACPI_WALK_STATE
*WalkState
);
299 ACPI_WALK_STATE
*WalkState
,
300 ACPI_OPERAND_OBJECT
**ReturnDesc
);
304 ACPI_OPERAND_OBJECT
*DdbHandle
);
308 * exmutex - mutex support
312 ACPI_OPERAND_OBJECT
*TimeDesc
,
313 ACPI_OPERAND_OBJECT
*ObjDesc
,
314 ACPI_WALK_STATE
*WalkState
);
317 AcpiExAcquireMutexObject (
319 ACPI_OPERAND_OBJECT
*ObjDesc
,
320 ACPI_THREAD_ID ThreadId
);
324 ACPI_OPERAND_OBJECT
*ObjDesc
,
325 ACPI_WALK_STATE
*WalkState
);
328 AcpiExReleaseMutexObject (
329 ACPI_OPERAND_OBJECT
*ObjDesc
);
332 AcpiExReleaseAllMutexes (
333 ACPI_THREAD_STATE
*Thread
);
337 ACPI_OPERAND_OBJECT
*ObjDesc
);
341 * exprep - ACPI AML execution - prep utilities
344 AcpiExPrepCommonFieldObject (
345 ACPI_OPERAND_OBJECT
*ObjDesc
,
347 UINT8 FieldAttribute
,
348 UINT32 FieldBitPosition
,
349 UINT32 FieldBitLength
);
352 AcpiExPrepFieldValue (
353 ACPI_CREATE_FIELD_INFO
*Info
);
357 * exsystem - Interface to OS services
360 AcpiExSystemDoNotifyOp (
361 ACPI_OPERAND_OBJECT
*Value
,
362 ACPI_OPERAND_OBJECT
*ObjDesc
);
369 AcpiExSystemDoStall (
373 AcpiExSystemSignalEvent(
374 ACPI_OPERAND_OBJECT
*ObjDesc
);
377 AcpiExSystemWaitEvent(
378 ACPI_OPERAND_OBJECT
*Time
,
379 ACPI_OPERAND_OBJECT
*ObjDesc
);
382 AcpiExSystemResetEvent(
383 ACPI_OPERAND_OBJECT
*ObjDesc
);
386 AcpiExSystemWaitSemaphore (
387 ACPI_SEMAPHORE Semaphore
,
391 AcpiExSystemWaitMutex (
396 * exoparg1 - ACPI AML execution, 1 operand
399 AcpiExOpcode_0A_0T_1R (
400 ACPI_WALK_STATE
*WalkState
);
403 AcpiExOpcode_1A_0T_0R (
404 ACPI_WALK_STATE
*WalkState
);
407 AcpiExOpcode_1A_0T_1R (
408 ACPI_WALK_STATE
*WalkState
);
411 AcpiExOpcode_1A_1T_1R (
412 ACPI_WALK_STATE
*WalkState
);
415 AcpiExOpcode_1A_1T_0R (
416 ACPI_WALK_STATE
*WalkState
);
419 * exoparg2 - ACPI AML execution, 2 operands
422 AcpiExOpcode_2A_0T_0R (
423 ACPI_WALK_STATE
*WalkState
);
426 AcpiExOpcode_2A_0T_1R (
427 ACPI_WALK_STATE
*WalkState
);
430 AcpiExOpcode_2A_1T_1R (
431 ACPI_WALK_STATE
*WalkState
);
434 AcpiExOpcode_2A_2T_1R (
435 ACPI_WALK_STATE
*WalkState
);
439 * exoparg3 - ACPI AML execution, 3 operands
442 AcpiExOpcode_3A_0T_0R (
443 ACPI_WALK_STATE
*WalkState
);
446 AcpiExOpcode_3A_1T_1R (
447 ACPI_WALK_STATE
*WalkState
);
451 * exoparg6 - ACPI AML execution, 6 operands
454 AcpiExOpcode_6A_0T_1R (
455 ACPI_WALK_STATE
*WalkState
);
459 * exresolv - Object resolution and get value functions
462 AcpiExResolveToValue (
463 ACPI_OPERAND_OBJECT
**StackPtr
,
464 ACPI_WALK_STATE
*WalkState
);
467 AcpiExResolveMultiple (
468 ACPI_WALK_STATE
*WalkState
,
469 ACPI_OPERAND_OBJECT
*Operand
,
470 ACPI_OBJECT_TYPE
*ReturnType
,
471 ACPI_OPERAND_OBJECT
**ReturnDesc
);
475 * exresnte - resolve namespace node
478 AcpiExResolveNodeToValue (
479 ACPI_NAMESPACE_NODE
**StackPtr
,
480 ACPI_WALK_STATE
*WalkState
);
484 * exresop - resolve operand to value
487 AcpiExResolveOperands (
489 ACPI_OPERAND_OBJECT
**StackPtr
,
490 ACPI_WALK_STATE
*WalkState
);
494 * exdump - Interpreter debug output routines
498 ACPI_OPERAND_OBJECT
*ObjDesc
,
503 ACPI_OPERAND_OBJECT
**Operands
,
504 const char *OpcodeName
,
508 AcpiExDumpObjectDescriptor (
509 ACPI_OPERAND_OBJECT
*Object
,
513 AcpiExDumpNamespaceNode (
514 ACPI_NAMESPACE_NODE
*Node
,
519 * exnames - AML namestring support
522 AcpiExGetNameString (
523 ACPI_OBJECT_TYPE DataType
,
525 char **OutNameString
,
526 UINT32
*OutNameLength
);
530 * exstore - Object store support
534 ACPI_OPERAND_OBJECT
*ValDesc
,
535 ACPI_OPERAND_OBJECT
*DestDesc
,
536 ACPI_WALK_STATE
*WalkState
);
539 AcpiExStoreObjectToNode (
540 ACPI_OPERAND_OBJECT
*SourceDesc
,
541 ACPI_NAMESPACE_NODE
*Node
,
542 ACPI_WALK_STATE
*WalkState
,
543 UINT8 ImplicitConversion
);
545 #define ACPI_IMPLICIT_CONVERSION TRUE
546 #define ACPI_NO_IMPLICIT_CONVERSION FALSE
550 * exstoren - resolve/store object
553 AcpiExResolveObject (
554 ACPI_OPERAND_OBJECT
**SourceDescPtr
,
555 ACPI_OBJECT_TYPE TargetType
,
556 ACPI_WALK_STATE
*WalkState
);
559 AcpiExStoreObjectToObject (
560 ACPI_OPERAND_OBJECT
*SourceDesc
,
561 ACPI_OPERAND_OBJECT
*DestDesc
,
562 ACPI_OPERAND_OBJECT
**NewDesc
,
563 ACPI_WALK_STATE
*WalkState
);
567 * exstorob - store object - buffer/string
570 AcpiExStoreBufferToBuffer (
571 ACPI_OPERAND_OBJECT
*SourceDesc
,
572 ACPI_OPERAND_OBJECT
*TargetDesc
);
575 AcpiExStoreStringToString (
576 ACPI_OPERAND_OBJECT
*SourceDesc
,
577 ACPI_OPERAND_OBJECT
*TargetDesc
);
581 * excopy - object copy
584 AcpiExCopyIntegerToIndexField (
585 ACPI_OPERAND_OBJECT
*SourceDesc
,
586 ACPI_OPERAND_OBJECT
*TargetDesc
);
589 AcpiExCopyIntegerToBankField (
590 ACPI_OPERAND_OBJECT
*SourceDesc
,
591 ACPI_OPERAND_OBJECT
*TargetDesc
);
594 AcpiExCopyDataToNamedField (
595 ACPI_OPERAND_OBJECT
*SourceDesc
,
596 ACPI_NAMESPACE_NODE
*Node
);
599 AcpiExCopyIntegerToBufferField (
600 ACPI_OPERAND_OBJECT
*SourceDesc
,
601 ACPI_OPERAND_OBJECT
*TargetDesc
);
605 * exutils - interpreter/scanner utilities
608 AcpiExEnterInterpreter (
612 AcpiExExitInterpreter (
616 AcpiExReacquireInterpreter (
620 AcpiExRelinquishInterpreter (
624 AcpiExTruncateFor32bitTable (
625 ACPI_OPERAND_OBJECT
*ObjDesc
);
628 AcpiExAcquireGlobalLock (
632 AcpiExReleaseGlobalLock (
636 AcpiExEisaIdToString (
638 UINT64 CompressedId
);
641 AcpiExIntegerToString (
651 * exregion - default OpRegion handlers
654 AcpiExSystemMemorySpaceHandler (
656 ACPI_PHYSICAL_ADDRESS Address
,
659 void *HandlerContext
,
660 void *RegionContext
);
663 AcpiExSystemIoSpaceHandler (
665 ACPI_PHYSICAL_ADDRESS Address
,
668 void *HandlerContext
,
669 void *RegionContext
);
672 AcpiExPciConfigSpaceHandler (
674 ACPI_PHYSICAL_ADDRESS Address
,
677 void *HandlerContext
,
678 void *RegionContext
);
681 AcpiExCmosSpaceHandler (
683 ACPI_PHYSICAL_ADDRESS Address
,
686 void *HandlerContext
,
687 void *RegionContext
);
690 AcpiExPciBarSpaceHandler (
692 ACPI_PHYSICAL_ADDRESS Address
,
695 void *HandlerContext
,
696 void *RegionContext
);
699 AcpiExEmbeddedControllerSpaceHandler (
701 ACPI_PHYSICAL_ADDRESS Address
,
704 void *HandlerContext
,
705 void *RegionContext
);
708 AcpiExSmBusSpaceHandler (
710 ACPI_PHYSICAL_ADDRESS Address
,
713 void *HandlerContext
,
714 void *RegionContext
);
718 AcpiExDataTableSpaceHandler (
720 ACPI_PHYSICAL_ADDRESS Address
,
723 void *HandlerContext
,
724 void *RegionContext
);
726 #endif /* __INTERP_H__ */