1 /******************************************************************************
3 * Name: acinterp.h - Interpreter subcomponent prototypes and defines
5 *****************************************************************************/
8 * Copyright (C) 2000 - 2016, 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
92 #define ACPI_EXD_LIST 14 /* Operand object list */
93 #define ACPI_EXD_HDLR_LIST 15 /* Address Handler list */
94 #define ACPI_EXD_RGN_LIST 16 /* Region list */
95 #define ACPI_EXD_NODE 17 /* Namespace Node */
97 /* restore default alignment */
103 * exconvrt - object conversion
106 AcpiExConvertToInteger (
107 ACPI_OPERAND_OBJECT
*ObjDesc
,
108 ACPI_OPERAND_OBJECT
**ResultDesc
,
112 AcpiExConvertToBuffer (
113 ACPI_OPERAND_OBJECT
*ObjDesc
,
114 ACPI_OPERAND_OBJECT
**ResultDesc
);
117 AcpiExConvertToString (
118 ACPI_OPERAND_OBJECT
*ObjDesc
,
119 ACPI_OPERAND_OBJECT
**ResultDesc
,
122 /* Types for ->String conversion */
124 #define ACPI_EXPLICIT_BYTE_COPY 0x00000000
125 #define ACPI_EXPLICIT_CONVERT_HEX 0x00000001
126 #define ACPI_IMPLICIT_CONVERT_HEX 0x00000002
127 #define ACPI_EXPLICIT_CONVERT_DECIMAL 0x00000003
130 AcpiExConvertToTargetType (
131 ACPI_OBJECT_TYPE DestinationType
,
132 ACPI_OPERAND_OBJECT
*SourceDesc
,
133 ACPI_OPERAND_OBJECT
**ResultDesc
,
134 ACPI_WALK_STATE
*WalkState
);
138 * exdebug - AML debug object
141 AcpiExDoDebugObject (
142 ACPI_OPERAND_OBJECT
*SourceDesc
,
147 AcpiExStartTraceMethod (
148 ACPI_NAMESPACE_NODE
*MethodNode
,
149 ACPI_OPERAND_OBJECT
*ObjDesc
,
150 ACPI_WALK_STATE
*WalkState
);
153 AcpiExStopTraceMethod (
154 ACPI_NAMESPACE_NODE
*MethodNode
,
155 ACPI_OPERAND_OBJECT
*ObjDesc
,
156 ACPI_WALK_STATE
*WalkState
);
159 AcpiExStartTraceOpcode (
160 ACPI_PARSE_OBJECT
*Op
,
161 ACPI_WALK_STATE
*WalkState
);
164 AcpiExStopTraceOpcode (
165 ACPI_PARSE_OBJECT
*Op
,
166 ACPI_WALK_STATE
*WalkState
);
170 ACPI_TRACE_EVENT_TYPE Type
,
177 * exfield - ACPI AML (p-code) execution - field manipulation
180 AcpiExCommonBufferSetup (
181 ACPI_OPERAND_OBJECT
*ObjDesc
,
186 AcpiExWriteWithUpdateRule (
187 ACPI_OPERAND_OBJECT
*ObjDesc
,
190 UINT32 FieldDatumByteOffset
);
193 AcpiExGetBufferDatum(
197 UINT32 ByteGranularity
,
198 UINT32 BufferOffset
);
201 AcpiExSetBufferDatum (
205 UINT32 ByteGranularity
,
206 UINT32 BufferOffset
);
209 AcpiExReadDataFromField (
210 ACPI_WALK_STATE
*WalkState
,
211 ACPI_OPERAND_OBJECT
*ObjDesc
,
212 ACPI_OPERAND_OBJECT
**RetBufferDesc
);
215 AcpiExWriteDataToField (
216 ACPI_OPERAND_OBJECT
*SourceDesc
,
217 ACPI_OPERAND_OBJECT
*ObjDesc
,
218 ACPI_OPERAND_OBJECT
**ResultDesc
);
222 * exfldio - low level field I/O
225 AcpiExExtractFromField (
226 ACPI_OPERAND_OBJECT
*ObjDesc
,
228 UINT32 BufferLength
);
231 AcpiExInsertIntoField (
232 ACPI_OPERAND_OBJECT
*ObjDesc
,
234 UINT32 BufferLength
);
238 ACPI_OPERAND_OBJECT
*ObjDesc
,
239 UINT32 FieldDatumByteOffset
,
245 * exmisc - misc support routines
248 AcpiExGetObjectReference (
249 ACPI_OPERAND_OBJECT
*ObjDesc
,
250 ACPI_OPERAND_OBJECT
**ReturnDesc
,
251 ACPI_WALK_STATE
*WalkState
);
254 AcpiExConcatTemplate (
255 ACPI_OPERAND_OBJECT
*ObjDesc
,
256 ACPI_OPERAND_OBJECT
*ObjDesc2
,
257 ACPI_OPERAND_OBJECT
**ActualReturnDesc
,
258 ACPI_WALK_STATE
*WalkState
);
261 AcpiExDoConcatenate (
262 ACPI_OPERAND_OBJECT
*ObjDesc
,
263 ACPI_OPERAND_OBJECT
*ObjDesc2
,
264 ACPI_OPERAND_OBJECT
**ActualReturnDesc
,
265 ACPI_WALK_STATE
*WalkState
);
268 AcpiExDoLogicalNumericOp (
272 BOOLEAN
*LogicalResult
);
277 ACPI_OPERAND_OBJECT
*Operand0
,
278 ACPI_OPERAND_OBJECT
*Operand1
,
279 BOOLEAN
*LogicalResult
);
289 ACPI_WALK_STATE
*WalkState
);
292 AcpiExCreateProcessor (
293 ACPI_WALK_STATE
*WalkState
);
296 AcpiExCreatePowerResource (
297 ACPI_WALK_STATE
*WalkState
);
304 ACPI_WALK_STATE
*WalkState
);
308 ACPI_WALK_STATE
*WalkState
);
312 ACPI_WALK_STATE
*WalkState
);
318 ACPI_WALK_STATE
*WalkState
);
322 * exconfig - dynamic table load/unload
326 ACPI_OPERAND_OBJECT
*ObjDesc
,
327 ACPI_OPERAND_OBJECT
*Target
,
328 ACPI_WALK_STATE
*WalkState
);
332 ACPI_WALK_STATE
*WalkState
,
333 ACPI_OPERAND_OBJECT
**ReturnDesc
);
337 ACPI_OPERAND_OBJECT
*DdbHandle
);
341 * exmutex - mutex support
345 ACPI_OPERAND_OBJECT
*TimeDesc
,
346 ACPI_OPERAND_OBJECT
*ObjDesc
,
347 ACPI_WALK_STATE
*WalkState
);
350 AcpiExAcquireMutexObject (
352 ACPI_OPERAND_OBJECT
*ObjDesc
,
353 ACPI_THREAD_ID ThreadId
);
357 ACPI_OPERAND_OBJECT
*ObjDesc
,
358 ACPI_WALK_STATE
*WalkState
);
361 AcpiExReleaseMutexObject (
362 ACPI_OPERAND_OBJECT
*ObjDesc
);
365 AcpiExReleaseAllMutexes (
366 ACPI_THREAD_STATE
*Thread
);
370 ACPI_OPERAND_OBJECT
*ObjDesc
);
374 * exprep - ACPI AML execution - prep utilities
377 AcpiExPrepCommonFieldObject (
378 ACPI_OPERAND_OBJECT
*ObjDesc
,
380 UINT8 FieldAttribute
,
381 UINT32 FieldBitPosition
,
382 UINT32 FieldBitLength
);
385 AcpiExPrepFieldValue (
386 ACPI_CREATE_FIELD_INFO
*Info
);
390 * exsystem - Interface to OS services
393 AcpiExSystemDoNotifyOp (
394 ACPI_OPERAND_OBJECT
*Value
,
395 ACPI_OPERAND_OBJECT
*ObjDesc
);
402 AcpiExSystemDoStall (
406 AcpiExSystemSignalEvent(
407 ACPI_OPERAND_OBJECT
*ObjDesc
);
410 AcpiExSystemWaitEvent(
411 ACPI_OPERAND_OBJECT
*Time
,
412 ACPI_OPERAND_OBJECT
*ObjDesc
);
415 AcpiExSystemResetEvent(
416 ACPI_OPERAND_OBJECT
*ObjDesc
);
419 AcpiExSystemWaitSemaphore (
420 ACPI_SEMAPHORE Semaphore
,
424 AcpiExSystemWaitMutex (
429 * exoparg1 - ACPI AML execution, 1 operand
432 AcpiExOpcode_0A_0T_1R (
433 ACPI_WALK_STATE
*WalkState
);
436 AcpiExOpcode_1A_0T_0R (
437 ACPI_WALK_STATE
*WalkState
);
440 AcpiExOpcode_1A_0T_1R (
441 ACPI_WALK_STATE
*WalkState
);
444 AcpiExOpcode_1A_1T_1R (
445 ACPI_WALK_STATE
*WalkState
);
448 AcpiExOpcode_1A_1T_0R (
449 ACPI_WALK_STATE
*WalkState
);
452 * exoparg2 - ACPI AML execution, 2 operands
455 AcpiExOpcode_2A_0T_0R (
456 ACPI_WALK_STATE
*WalkState
);
459 AcpiExOpcode_2A_0T_1R (
460 ACPI_WALK_STATE
*WalkState
);
463 AcpiExOpcode_2A_1T_1R (
464 ACPI_WALK_STATE
*WalkState
);
467 AcpiExOpcode_2A_2T_1R (
468 ACPI_WALK_STATE
*WalkState
);
472 * exoparg3 - ACPI AML execution, 3 operands
475 AcpiExOpcode_3A_0T_0R (
476 ACPI_WALK_STATE
*WalkState
);
479 AcpiExOpcode_3A_1T_1R (
480 ACPI_WALK_STATE
*WalkState
);
484 * exoparg6 - ACPI AML execution, 6 operands
487 AcpiExOpcode_6A_0T_1R (
488 ACPI_WALK_STATE
*WalkState
);
492 * exresolv - Object resolution and get value functions
495 AcpiExResolveToValue (
496 ACPI_OPERAND_OBJECT
**StackPtr
,
497 ACPI_WALK_STATE
*WalkState
);
500 AcpiExResolveMultiple (
501 ACPI_WALK_STATE
*WalkState
,
502 ACPI_OPERAND_OBJECT
*Operand
,
503 ACPI_OBJECT_TYPE
*ReturnType
,
504 ACPI_OPERAND_OBJECT
**ReturnDesc
);
508 * exresnte - resolve namespace node
511 AcpiExResolveNodeToValue (
512 ACPI_NAMESPACE_NODE
**StackPtr
,
513 ACPI_WALK_STATE
*WalkState
);
517 * exresop - resolve operand to value
520 AcpiExResolveOperands (
522 ACPI_OPERAND_OBJECT
**StackPtr
,
523 ACPI_WALK_STATE
*WalkState
);
527 * exdump - Interpreter debug output routines
531 ACPI_OPERAND_OBJECT
*ObjDesc
,
536 ACPI_OPERAND_OBJECT
**Operands
,
537 const char *OpcodeName
,
541 AcpiExDumpObjectDescriptor (
542 ACPI_OPERAND_OBJECT
*Object
,
546 AcpiExDumpNamespaceNode (
547 ACPI_NAMESPACE_NODE
*Node
,
552 * exnames - AML namestring support
555 AcpiExGetNameString (
556 ACPI_OBJECT_TYPE DataType
,
558 char **OutNameString
,
559 UINT32
*OutNameLength
);
563 * exstore - Object store support
567 ACPI_OPERAND_OBJECT
*ValDesc
,
568 ACPI_OPERAND_OBJECT
*DestDesc
,
569 ACPI_WALK_STATE
*WalkState
);
572 AcpiExStoreObjectToNode (
573 ACPI_OPERAND_OBJECT
*SourceDesc
,
574 ACPI_NAMESPACE_NODE
*Node
,
575 ACPI_WALK_STATE
*WalkState
,
576 UINT8 ImplicitConversion
);
578 #define ACPI_IMPLICIT_CONVERSION TRUE
579 #define ACPI_NO_IMPLICIT_CONVERSION FALSE
583 * exstoren - resolve/store object
586 AcpiExResolveObject (
587 ACPI_OPERAND_OBJECT
**SourceDescPtr
,
588 ACPI_OBJECT_TYPE TargetType
,
589 ACPI_WALK_STATE
*WalkState
);
592 AcpiExStoreObjectToObject (
593 ACPI_OPERAND_OBJECT
*SourceDesc
,
594 ACPI_OPERAND_OBJECT
*DestDesc
,
595 ACPI_OPERAND_OBJECT
**NewDesc
,
596 ACPI_WALK_STATE
*WalkState
);
600 * exstorob - store object - buffer/string
603 AcpiExStoreBufferToBuffer (
604 ACPI_OPERAND_OBJECT
*SourceDesc
,
605 ACPI_OPERAND_OBJECT
*TargetDesc
);
608 AcpiExStoreStringToString (
609 ACPI_OPERAND_OBJECT
*SourceDesc
,
610 ACPI_OPERAND_OBJECT
*TargetDesc
);
614 * excopy - object copy
617 AcpiExCopyIntegerToIndexField (
618 ACPI_OPERAND_OBJECT
*SourceDesc
,
619 ACPI_OPERAND_OBJECT
*TargetDesc
);
622 AcpiExCopyIntegerToBankField (
623 ACPI_OPERAND_OBJECT
*SourceDesc
,
624 ACPI_OPERAND_OBJECT
*TargetDesc
);
627 AcpiExCopyDataToNamedField (
628 ACPI_OPERAND_OBJECT
*SourceDesc
,
629 ACPI_NAMESPACE_NODE
*Node
);
632 AcpiExCopyIntegerToBufferField (
633 ACPI_OPERAND_OBJECT
*SourceDesc
,
634 ACPI_OPERAND_OBJECT
*TargetDesc
);
638 * exutils - interpreter/scanner utilities
641 AcpiExEnterInterpreter (
645 AcpiExExitInterpreter (
649 AcpiExTruncateFor32bitTable (
650 ACPI_OPERAND_OBJECT
*ObjDesc
);
653 AcpiExAcquireGlobalLock (
657 AcpiExReleaseGlobalLock (
661 AcpiExEisaIdToString (
663 UINT64 CompressedId
);
666 AcpiExIntegerToString (
671 AcpiExPciClsToString (
681 * exregion - default OpRegion handlers
684 AcpiExSystemMemorySpaceHandler (
686 ACPI_PHYSICAL_ADDRESS Address
,
689 void *HandlerContext
,
690 void *RegionContext
);
693 AcpiExSystemIoSpaceHandler (
695 ACPI_PHYSICAL_ADDRESS Address
,
698 void *HandlerContext
,
699 void *RegionContext
);
702 AcpiExPciConfigSpaceHandler (
704 ACPI_PHYSICAL_ADDRESS Address
,
707 void *HandlerContext
,
708 void *RegionContext
);
711 AcpiExCmosSpaceHandler (
713 ACPI_PHYSICAL_ADDRESS Address
,
716 void *HandlerContext
,
717 void *RegionContext
);
720 AcpiExPciBarSpaceHandler (
722 ACPI_PHYSICAL_ADDRESS Address
,
725 void *HandlerContext
,
726 void *RegionContext
);
729 AcpiExEmbeddedControllerSpaceHandler (
731 ACPI_PHYSICAL_ADDRESS Address
,
734 void *HandlerContext
,
735 void *RegionContext
);
738 AcpiExSmBusSpaceHandler (
740 ACPI_PHYSICAL_ADDRESS Address
,
743 void *HandlerContext
,
744 void *RegionContext
);
748 AcpiExDataTableSpaceHandler (
750 ACPI_PHYSICAL_ADDRESS Address
,
753 void *HandlerContext
,
754 void *RegionContext
);
756 #endif /* __INTERP_H__ */