1 /******************************************************************************
3 * Name: aclocal.h - Internal data types used across the ACPI subsystem
6 *****************************************************************************/
8 /******************************************************************************
12 * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
13 * All rights reserved.
17 * 2.1. This is your license from Intel Corp. under its intellectual property
18 * rights. You may have additional license terms from the party that provided
19 * you this software, covering your right to use that party's intellectual
22 * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
23 * copy of the source code appearing in this file ("Covered Code") an
24 * irrevocable, perpetual, worldwide license under Intel's copyrights in the
25 * base code distributed originally by Intel ("Original Intel Code") to copy,
26 * make derivatives, distribute, use and display any portion of the Covered
27 * Code in any form, with the right to sublicense such rights; and
29 * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
30 * license (with the right to sublicense), under only those claims of Intel
31 * patents that are infringed by the Original Intel Code, to make, use, sell,
32 * offer to sell, and import the Covered Code and derivative works thereof
33 * solely to the minimum extent necessary to exercise the above copyright
34 * license, and in no event shall the patent license extend to any additions
35 * to or modifications of the Original Intel Code. No other license or right
36 * is granted directly or by implication, estoppel or otherwise;
38 * The above copyright and patent license is granted only if the following
43 * 3.1. Redistribution of Source with Rights to Further Distribute Source.
44 * Redistribution of source code of any substantial portion of the Covered
45 * Code or modification with rights to further distribute source must include
46 * the above Copyright Notice, the above License, this list of Conditions,
47 * and the following Disclaimer and Export Compliance provision. In addition,
48 * Licensee must cause all Covered Code to which Licensee contributes to
49 * contain a file documenting the changes Licensee made to create that Covered
50 * Code and the date of any change. Licensee must include in that file the
51 * documentation of any changes made by any predecessor Licensee. Licensee
52 * must include a prominent statement that the modification is derived,
53 * directly or indirectly, from Original Intel Code.
55 * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
56 * Redistribution of source code of any substantial portion of the Covered
57 * Code or modification without rights to further distribute source must
58 * include the following Disclaimer and Export Compliance provision in the
59 * documentation and/or other materials provided with distribution. In
60 * addition, Licensee may not authorize further sublicense of source of any
61 * portion of the Covered Code, and must include terms to the effect that the
62 * license from Licensee to its licensee is limited to the intellectual
63 * property embodied in the software Licensee provides to its licensee, and
64 * not to intellectual property embodied in modifications its licensee may
67 * 3.3. Redistribution of Executable. Redistribution in executable form of any
68 * substantial portion of the Covered Code or modification must reproduce the
69 * above Copyright Notice, and the following Disclaimer and Export Compliance
70 * provision in the documentation and/or other materials provided with the
73 * 3.4. Intel retains all right, title, and interest in and to the Original
76 * 3.5. Neither the name Intel nor any other trademark owned or controlled by
77 * Intel shall be used in advertising or otherwise to promote the sale, use or
78 * other dealings in products derived from or relating to the Covered Code
79 * without prior written authorization from Intel.
81 * 4. Disclaimer and Export Compliance
83 * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
84 * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
85 * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
86 * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
87 * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
88 * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
91 * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
92 * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
93 * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
94 * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
95 * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
96 * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
97 * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
100 * 4.3. Licensee shall not export, either directly or indirectly, any of this
101 * software or system incorporating such software without first obtaining any
102 * required license or other approval from the U. S. Department of Commerce or
103 * any other agency or department of the United States Government. In the
104 * event Licensee exports any such software from the United States or
105 * re-exports any such software from a foreign destination, Licensee shall
106 * ensure that the distribution and export/re-export of the software is in
107 * compliance with all laws, regulations, orders, or other restrictions of the
108 * U.S. Export Administration Regulations. Licensee agrees that neither it nor
109 * any of its subsidiaries will export/re-export any technical data, process,
110 * software, or service, directly or indirectly, to any country for which the
111 * United States government or any agency thereof requires an export license,
112 * other governmental approval, or letter of assurance, without first obtaining
113 * such license, approval or letter.
115 *****************************************************************************/
117 #ifndef __ACLOCAL_H__
118 #define __ACLOCAL_H__
120 /* acpisrc:StructDefs -- for acpisrc conversion */
122 #define ACPI_WAIT_FOREVER 0xFFFF /* UINT16, as per ACPI spec */
123 #define ACPI_DO_NOT_WAIT 0
124 #define ACPI_SERIALIZED 0xFF
126 typedef UINT32 ACPI_MUTEX_HANDLE;
127 #define ACPI_GLOBAL_LOCK (ACPI_SEMAPHORE) (-1)
129 /* Total number of aml opcodes defined */
131 #define AML_NUM_OPCODES 0x7F
134 /* Forward declarations */
136 struct acpi_walk_state;
137 struct acpi_obj_mutex;
138 union acpi_parse_object;
141 /*****************************************************************************
143 * Mutex typedefs and structs
145 ****************************************************************************/
149 * Predefined handles for the mutex objects used within the subsystem
150 * All mutex objects are automatically created by AcpiUtMutexInitialize.
152 * The acquire/release ordering protocol is implied via this list. Mutexes
153 * with a lower value must be acquired before mutexes with a higher value.
155 * NOTE: any changes here must be reflected in the AcpiGbl_MutexNames
158 #define ACPI_MTX_INTERPRETER 0 /* AML Interpreter, main lock */
159 #define ACPI_MTX_NAMESPACE 1 /* ACPI Namespace */
160 #define ACPI_MTX_TABLES 2 /* Data for ACPI tables */
161 #define ACPI_MTX_EVENTS 3 /* Data for ACPI events */
162 #define ACPI_MTX_CACHES 4 /* Internal caches, general purposes */
163 #define ACPI_MTX_MEMORY 5 /* Debug memory tracking lists */
164 #define ACPI_MTX_DEBUG_CMD_COMPLETE 6 /* AML debugger */
165 #define ACPI_MTX_DEBUG_CMD_READY 7 /* AML debugger */
167 #define ACPI_MAX_MUTEX 7
168 #define ACPI_NUM_MUTEX ACPI_MAX_MUTEX+1
170 #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
171 #ifdef DEFINE_ACPI_GLOBALS
173 /* Debug names for the mutexes above */
175 static char *AcpiGbl_MutexNames[ACPI_NUM_MUTEX] =
177 "ACPI_MTX_Interpreter",
179 "ACPI_MTX_Namespace",
183 "ACPI_MTX_CommandComplete",
184 "ACPI_MTX_CommandReady"
192 * Predefined handles for spinlocks used within the subsystem.
193 * These spinlocks are created by AcpiUtMutexInitialize
195 #define ACPI_LOCK_GPES 0
196 #define ACPI_LOCK_HARDWARE 1
198 #define ACPI_MAX_LOCK 1
199 #define ACPI_NUM_LOCK ACPI_MAX_LOCK+1
202 /* Owner IDs are used to track namespace nodes for selective deletion */
204 typedef UINT8 ACPI_OWNER_ID;
205 #define ACPI_OWNER_ID_MAX 0xFF
207 /* This Thread ID means that the mutex is not in use (unlocked) */
209 #define ACPI_MUTEX_NOT_ACQUIRED (UINT32) -1
211 /* Table for the global mutexes */
213 typedef struct acpi_mutex_info
217 ACPI_THREAD_ID ThreadId;
222 /* Lock flag parameter for various interfaces */
224 #define ACPI_MTX_DO_NOT_LOCK 0
225 #define ACPI_MTX_LOCK 1
228 /* Field access granularities */
230 #define ACPI_FIELD_BYTE_GRANULARITY 1
231 #define ACPI_FIELD_WORD_GRANULARITY 2
232 #define ACPI_FIELD_DWORD_GRANULARITY 4
233 #define ACPI_FIELD_QWORD_GRANULARITY 8
236 #define ACPI_ENTRY_NOT_FOUND NULL
239 /*****************************************************************************
241 * Namespace typedefs and structs
243 ****************************************************************************/
245 /* Operational modes of the AML interpreter/scanner */
249 ACPI_IMODE_LOAD_PASS1 = 0x01,
250 ACPI_IMODE_LOAD_PASS2 = 0x02,
251 ACPI_IMODE_EXECUTE = 0x03
253 } ACPI_INTERPRETER_MODE;
255 typedef union acpi_name_union
264 * The Namespace Node describes a named object that appears in the AML.
265 * DescriptorType is used to differentiate between internal descriptors.
267 * The node is optimized for both 32-bit and 64-bit platforms:
268 * 20 bytes for the 32-bit case, 32 bytes for the 64-bit case.
270 * Note: The DescriptorType and Type fields must appear in the identical
271 * position in both the ACPI_NAMESPACE_NODE and ACPI_OPERAND_OBJECT
274 typedef struct acpi_namespace_node
276 union acpi_operand_object *Object; /* Interpreter object */
277 UINT8 DescriptorType; /* Differentiate object descriptor types */
278 UINT8 Type; /* ACPI Type associated with this name */
279 UINT8 Flags; /* Miscellaneous flags */
280 ACPI_OWNER_ID OwnerId; /* Node creator */
281 ACPI_NAME_UNION Name; /* ACPI Name, always 4 chars per ACPI spec */
282 struct acpi_namespace_node *Child; /* First child */
283 struct acpi_namespace_node *Peer; /* Peer. Parent if ANOBJ_END_OF_PEER_LIST set */
286 * The following fields are used by the ASL compiler and disassembler only
288 #ifdef ACPI_LARGE_NAMESPACE_NODE
289 union acpi_parse_object *Op;
294 } ACPI_NAMESPACE_NODE;
297 /* Namespace Node flags */
299 #define ANOBJ_END_OF_PEER_LIST 0x01 /* End-of-list, Peer field points to parent */
300 #define ANOBJ_TEMPORARY 0x02 /* Node is create by a method and is temporary */
301 #define ANOBJ_METHOD_ARG 0x04 /* Node is a method argument */
302 #define ANOBJ_METHOD_LOCAL 0x08 /* Node is a method local */
303 #define ANOBJ_SUBTREE_HAS_INI 0x10 /* Used to optimize device initialization */
305 #define ANOBJ_IS_EXTERNAL 0x08 /* iASL only: This object created via External() */
306 #define ANOBJ_METHOD_NO_RETVAL 0x10 /* iASL only: Method has no return value */
307 #define ANOBJ_METHOD_SOME_NO_RETVAL 0x20 /* iASL only: Method has at least one return value */
308 #define ANOBJ_IS_BIT_OFFSET 0x40 /* iASL only: Reference is a bit offset */
309 #define ANOBJ_IS_REFERENCED 0x80 /* iASL only: Object was referenced */
312 * ACPI Table Descriptor. One per ACPI table
314 typedef struct acpi_table_desc
316 ACPI_PHYSICAL_ADDRESS Address;
317 ACPI_TABLE_HEADER *Pointer;
318 UINT32 Length; /* Length fixed at 32 bits */
319 ACPI_NAME_UNION Signature;
320 ACPI_OWNER_ID OwnerId;
325 /* Flags for above */
327 #define ACPI_TABLE_ORIGIN_UNKNOWN (0)
328 #define ACPI_TABLE_ORIGIN_MAPPED (1)
329 #define ACPI_TABLE_ORIGIN_ALLOCATED (2)
330 #define ACPI_TABLE_ORIGIN_MASK (3)
331 #define ACPI_TABLE_IS_LOADED (4)
333 /* One internal RSDT for table management */
335 typedef struct acpi_internal_rsdt
337 ACPI_TABLE_DESC *Tables;
342 } ACPI_INTERNAL_RSDT;
344 /* Flags for above */
346 #define ACPI_ROOT_ORIGIN_UNKNOWN (0) /* ~ORIGIN_ALLOCATED */
347 #define ACPI_ROOT_ORIGIN_ALLOCATED (1)
348 #define ACPI_ROOT_ALLOW_RESIZE (2)
351 /* Predefined (fixed) table indexes */
353 #define ACPI_TABLE_INDEX_DSDT (0)
354 #define ACPI_TABLE_INDEX_FACS (1)
357 typedef struct acpi_find_context
366 typedef struct acpi_ns_search_data
368 ACPI_NAMESPACE_NODE *Node;
370 } ACPI_NS_SEARCH_DATA;
374 * Predefined Namespace items
376 typedef struct acpi_predefined_names
382 } ACPI_PREDEFINED_NAMES;
385 /* Object types used during package copies */
387 #define ACPI_COPY_TYPE_SIMPLE 0
388 #define ACPI_COPY_TYPE_PACKAGE 1
391 /* Info structure used to convert external<->internal namestrings */
393 typedef struct acpi_namestring_info
396 char *NextExternalChar;
401 BOOLEAN FullyQualified;
403 } ACPI_NAMESTRING_INFO;
406 /* Field creation info */
408 typedef struct acpi_create_field_info
410 ACPI_NAMESPACE_NODE *RegionNode;
411 ACPI_NAMESPACE_NODE *FieldNode;
412 ACPI_NAMESPACE_NODE *RegisterNode;
413 ACPI_NAMESPACE_NODE *DataRegisterNode;
415 UINT32 FieldBitPosition;
416 UINT32 FieldBitLength;
421 } ACPI_CREATE_FIELD_INFO;
425 ACPI_STATUS (*ACPI_INTERNAL_METHOD) (
426 struct acpi_walk_state *WalkState);
430 * Bitmapped ACPI types. Used internally only
432 #define ACPI_BTYPE_ANY 0x00000000
433 #define ACPI_BTYPE_INTEGER 0x00000001
434 #define ACPI_BTYPE_STRING 0x00000002
435 #define ACPI_BTYPE_BUFFER 0x00000004
436 #define ACPI_BTYPE_PACKAGE 0x00000008
437 #define ACPI_BTYPE_FIELD_UNIT 0x00000010
438 #define ACPI_BTYPE_DEVICE 0x00000020
439 #define ACPI_BTYPE_EVENT 0x00000040
440 #define ACPI_BTYPE_METHOD 0x00000080
441 #define ACPI_BTYPE_MUTEX 0x00000100
442 #define ACPI_BTYPE_REGION 0x00000200
443 #define ACPI_BTYPE_POWER 0x00000400
444 #define ACPI_BTYPE_PROCESSOR 0x00000800
445 #define ACPI_BTYPE_THERMAL 0x00001000
446 #define ACPI_BTYPE_BUFFER_FIELD 0x00002000
447 #define ACPI_BTYPE_DDB_HANDLE 0x00004000
448 #define ACPI_BTYPE_DEBUG_OBJECT 0x00008000
449 #define ACPI_BTYPE_REFERENCE 0x00010000
450 #define ACPI_BTYPE_RESOURCE 0x00020000
452 #define ACPI_BTYPE_COMPUTE_DATA (ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING | ACPI_BTYPE_BUFFER)
454 #define ACPI_BTYPE_DATA (ACPI_BTYPE_COMPUTE_DATA | ACPI_BTYPE_PACKAGE)
455 #define ACPI_BTYPE_DATA_REFERENCE (ACPI_BTYPE_DATA | ACPI_BTYPE_REFERENCE | ACPI_BTYPE_DDB_HANDLE)
456 #define ACPI_BTYPE_DEVICE_OBJECTS (ACPI_BTYPE_DEVICE | ACPI_BTYPE_THERMAL | ACPI_BTYPE_PROCESSOR)
457 #define ACPI_BTYPE_OBJECTS_AND_REFS 0x0001FFFF /* ARG or LOCAL */
458 #define ACPI_BTYPE_ALL_OBJECTS 0x0000FFFF
461 /*****************************************************************************
463 * Event typedefs and structs
465 ****************************************************************************/
467 /* Dispatch info for each GPE -- either a method or handler, cannot be both */
469 typedef struct acpi_handler_info
471 ACPI_EVENT_HANDLER Address; /* Address of handler, if any */
472 void *Context; /* Context to be passed to handler */
473 ACPI_NAMESPACE_NODE *MethodNode; /* Method node for this GPE level (saved) */
477 typedef union acpi_gpe_dispatch_info
479 ACPI_NAMESPACE_NODE *MethodNode; /* Method node for this GPE level */
480 struct acpi_handler_info *Handler;
482 } ACPI_GPE_DISPATCH_INFO;
485 * Information about a GPE, one per each GPE in an array.
486 * NOTE: Important to keep this struct as small as possible.
488 typedef struct acpi_gpe_event_info
490 union acpi_gpe_dispatch_info Dispatch; /* Either Method or Handler */
491 struct acpi_gpe_register_info *RegisterInfo; /* Backpointer to register info */
492 UINT8 Flags; /* Misc info about this GPE */
493 UINT8 GpeNumber; /* This GPE */
495 } ACPI_GPE_EVENT_INFO;
497 /* Information about a GPE register pair, one per each status/enable pair in an array */
499 typedef struct acpi_gpe_register_info
501 ACPI_GENERIC_ADDRESS StatusAddress; /* Address of status reg */
502 ACPI_GENERIC_ADDRESS EnableAddress; /* Address of enable reg */
503 UINT8 EnableForWake; /* GPEs to keep enabled when sleeping */
504 UINT8 EnableForRun; /* GPEs to keep enabled when running */
505 UINT8 BaseGpeNumber; /* Base GPE number for this register */
507 } ACPI_GPE_REGISTER_INFO;
510 * Information about a GPE register block, one per each installed block --
511 * GPE0, GPE1, and one per each installed GPE Block Device.
513 typedef struct acpi_gpe_block_info
515 ACPI_NAMESPACE_NODE *Node;
516 struct acpi_gpe_block_info *Previous;
517 struct acpi_gpe_block_info *Next;
518 struct acpi_gpe_xrupt_info *XruptBlock; /* Backpointer to interrupt block */
519 ACPI_GPE_REGISTER_INFO *RegisterInfo; /* One per GPE register pair */
520 ACPI_GPE_EVENT_INFO *EventInfo; /* One for each GPE */
521 ACPI_GENERIC_ADDRESS BlockAddress; /* Base address of the block */
522 UINT32 RegisterCount; /* Number of register pairs in block */
523 UINT8 BlockBaseNumber;/* Base GPE number for this block */
525 } ACPI_GPE_BLOCK_INFO;
527 /* Information about GPE interrupt handlers, one per each interrupt level used for GPEs */
529 typedef struct acpi_gpe_xrupt_info
531 struct acpi_gpe_xrupt_info *Previous;
532 struct acpi_gpe_xrupt_info *Next;
533 ACPI_GPE_BLOCK_INFO *GpeBlockListHead; /* List of GPE blocks for this xrupt */
534 UINT32 InterruptNumber; /* System interrupt number */
536 } ACPI_GPE_XRUPT_INFO;
539 typedef struct acpi_gpe_walk_info
541 ACPI_NAMESPACE_NODE *GpeDevice;
542 ACPI_GPE_BLOCK_INFO *GpeBlock;
544 } ACPI_GPE_WALK_INFO;
547 typedef ACPI_STATUS (*ACPI_GPE_CALLBACK) (
548 ACPI_GPE_XRUPT_INFO *GpeXruptInfo,
549 ACPI_GPE_BLOCK_INFO *GpeBlock);
552 /* Information about each particular fixed event */
554 typedef struct acpi_fixed_event_handler
556 ACPI_EVENT_HANDLER Handler; /* Address of handler. */
557 void *Context; /* Context to be passed to handler */
559 } ACPI_FIXED_EVENT_HANDLER;
561 typedef struct acpi_fixed_event_info
563 UINT8 StatusRegisterId;
564 UINT8 EnableRegisterId;
565 UINT16 StatusBitMask;
566 UINT16 EnableBitMask;
568 } ACPI_FIXED_EVENT_INFO;
570 /* Information used during field processing */
572 typedef struct acpi_field_info
581 /*****************************************************************************
583 * Generic "state" object for stacks
585 ****************************************************************************/
587 #define ACPI_CONTROL_NORMAL 0xC0
588 #define ACPI_CONTROL_CONDITIONAL_EXECUTING 0xC1
589 #define ACPI_CONTROL_PREDICATE_EXECUTING 0xC2
590 #define ACPI_CONTROL_PREDICATE_FALSE 0xC3
591 #define ACPI_CONTROL_PREDICATE_TRUE 0xC4
594 #define ACPI_STATE_COMMON \
596 UINT8 DescriptorType; /* To differentiate various internal objs */\
601 /* There are 2 bytes available here until the next natural alignment boundary */
603 typedef struct acpi_common_state
610 * Update state - used to traverse complex objects such as packages
612 typedef struct acpi_update_state
615 union acpi_operand_object *Object;
621 * Pkg state - used to traverse nested package structures
623 typedef struct acpi_pkg_state
627 union acpi_operand_object *SourceObject;
628 union acpi_operand_object *DestObject;
629 struct acpi_walk_state *WalkState;
637 * Control state - one per if/else and while constructs.
638 * Allows nesting of these constructs
640 typedef struct acpi_control_state
644 union acpi_parse_object *PredicateOp;
645 UINT8 *AmlPredicateStart; /* Start of if/while predicate */
646 UINT8 *PackageEnd; /* End of if/while block */
648 } ACPI_CONTROL_STATE;
652 * Scope state - current scope during namespace lookups
654 typedef struct acpi_scope_state
657 ACPI_NAMESPACE_NODE *Node;
662 typedef struct acpi_pscope_state
665 UINT32 ArgCount; /* Number of fixed arguments */
666 union acpi_parse_object *Op; /* Current op being parsed */
667 UINT8 *ArgEnd; /* Current argument end */
668 UINT8 *PkgEnd; /* Current package end */
669 UINT32 ArgList; /* Next argument to parse */
675 * Thread state - one per thread across multiple walk states. Multiple walk
676 * states are created when there are nested control methods executing.
678 typedef struct acpi_thread_state
681 UINT8 CurrentSyncLevel; /* Mutex Sync (nested acquire) level */
682 struct acpi_walk_state *WalkStateList; /* Head of list of WalkStates for this thread */
683 union acpi_operand_object *AcquiredMutexList; /* List of all currently acquired mutexes */
684 ACPI_THREAD_ID ThreadId; /* Running thread ID */
690 * Result values - used to accumulate the results of nested
693 typedef struct acpi_result_values
696 union acpi_operand_object *ObjDesc [ACPI_RESULTS_FRAME_OBJ_NUM];
698 } ACPI_RESULT_VALUES;
702 ACPI_STATUS (*ACPI_PARSE_DOWNWARDS) (
703 struct acpi_walk_state *WalkState,
704 union acpi_parse_object **OutOp);
707 ACPI_STATUS (*ACPI_PARSE_UPWARDS) (
708 struct acpi_walk_state *WalkState);
712 * Notify info - used to pass info to the deferred notify
713 * handler/dispatcher.
715 typedef struct acpi_notify_info
718 ACPI_NAMESPACE_NODE *Node;
719 union acpi_operand_object *HandlerObj;
724 /* Generic state is union of structs above */
726 typedef union acpi_generic_state
728 ACPI_COMMON_STATE Common;
729 ACPI_CONTROL_STATE Control;
730 ACPI_UPDATE_STATE Update;
731 ACPI_SCOPE_STATE Scope;
732 ACPI_PSCOPE_STATE ParseScope;
734 ACPI_THREAD_STATE Thread;
735 ACPI_RESULT_VALUES Results;
736 ACPI_NOTIFY_INFO Notify;
738 } ACPI_GENERIC_STATE;
741 /*****************************************************************************
743 * Interpreter typedefs and structs
745 ****************************************************************************/
748 ACPI_STATUS (*ACPI_EXECUTE_OP) (
749 struct acpi_walk_state *WalkState);
752 /*****************************************************************************
754 * Parser typedefs and structs
756 ****************************************************************************/
759 * AML opcode, name, and argument layout
761 typedef struct acpi_opcode_info
763 #if defined(ACPI_DISASSEMBLER) || defined(ACPI_DEBUG_OUTPUT)
764 char *Name; /* Opcode name (disassembler/debug only) */
766 UINT32 ParseArgs; /* Grammar/Parse time arguments */
767 UINT32 RuntimeArgs; /* Interpret time arguments */
768 UINT16 Flags; /* Misc flags */
769 UINT8 ObjectType; /* Corresponding internal object type */
770 UINT8 Class; /* Opcode class */
771 UINT8 Type; /* Opcode type */
775 typedef union acpi_parse_value
777 ACPI_INTEGER Integer; /* Integer constant (Up to 64 bits) */
778 UINT64_STRUCT Integer64; /* Structure overlay for 2 32-bit Dwords */
779 UINT32 Size; /* bytelist or field size */
780 char *String; /* NULL terminated string */
781 UINT8 *Buffer; /* buffer or string */
782 char *Name; /* NULL terminated string */
783 union acpi_parse_object *Arg; /* arguments and contained ops */
787 #define ACPI_PARSE_COMMON \
788 union acpi_parse_object *Parent; /* Parent op */\
789 UINT8 DescriptorType; /* To differentiate various internal objs */\
790 UINT8 Flags; /* Type of Op */\
791 UINT16 AmlOpcode; /* AML opcode */\
792 UINT32 AmlOffset; /* Offset of declaration in AML */\
793 union acpi_parse_object *Next; /* Next op */\
794 ACPI_NAMESPACE_NODE *Node; /* For use by interpreter */\
795 ACPI_PARSE_VALUE Value; /* Value or args associated with the opcode */\
796 UINT8 ArgListLength; /* Number of elements in the arg list */\
797 ACPI_DISASM_ONLY_MEMBERS (\
798 UINT8 DisasmFlags; /* Used during AML disassembly */\
799 UINT8 DisasmOpcode; /* Subtype used for disassembly */\
800 char AmlOpName[16]) /* Op name (debug only) */
803 #define ACPI_DASM_BUFFER 0x00
804 #define ACPI_DASM_RESOURCE 0x01
805 #define ACPI_DASM_STRING 0x02
806 #define ACPI_DASM_UNICODE 0x03
807 #define ACPI_DASM_EISAID 0x04
808 #define ACPI_DASM_MATCHOP 0x05
809 #define ACPI_DASM_LNOT_PREFIX 0x06
810 #define ACPI_DASM_LNOT_SUFFIX 0x07
811 #define ACPI_DASM_IGNORE 0x08
814 * Generic operation (for example: If, While, Store)
816 typedef struct acpi_parse_obj_common
819 } ACPI_PARSE_OBJ_COMMON;
823 * Extended Op for named ops (Scope, Method, etc.), deferred ops (Methods and OpRegions),
826 typedef struct acpi_parse_obj_named
830 UINT8 *Data; /* AML body or bytelist data */
831 UINT32 Length; /* AML length */
832 UINT32 Name; /* 4-byte name or zero if no name */
834 } ACPI_PARSE_OBJ_NAMED;
837 /* This version is used by the iASL compiler only */
839 #define ACPI_MAX_PARSEOP_NAME 20
841 typedef struct acpi_parse_obj_asl
844 union acpi_parse_object *Child;
845 union acpi_parse_object *ParentMethod;
853 UINT32 LogicalLineNumber;
854 UINT32 LogicalByteOffset;
856 UINT32 EndLogicalLine;
859 UINT32 AmlSubtreeLength;
860 UINT32 FinalAmlLength;
861 UINT32 FinalAmlOffset;
864 UINT8 AmlOpcodeLength;
865 UINT8 AmlPkgLenBytes;
867 char ParseOpName[ACPI_MAX_PARSEOP_NAME];
869 } ACPI_PARSE_OBJ_ASL;
871 typedef union acpi_parse_object
873 ACPI_PARSE_OBJ_COMMON Common;
874 ACPI_PARSE_OBJ_NAMED Named;
875 ACPI_PARSE_OBJ_ASL Asl;
881 * Parse state - one state per parser invocation and each control
884 typedef struct acpi_parse_state
886 UINT8 *AmlStart; /* First AML byte */
887 UINT8 *Aml; /* Next AML byte */
888 UINT8 *AmlEnd; /* (last + 1) AML byte */
889 UINT8 *PkgStart; /* Current package begin */
890 UINT8 *PkgEnd; /* Current package end */
891 union acpi_parse_object *StartOp; /* Root of parse tree */
892 struct acpi_namespace_node *StartNode;
893 union acpi_generic_state *Scope; /* Current scope */
894 union acpi_parse_object *StartScope;
900 /* Parse object flags */
902 #define ACPI_PARSEOP_GENERIC 0x01
903 #define ACPI_PARSEOP_NAMED 0x02
904 #define ACPI_PARSEOP_DEFERRED 0x04
905 #define ACPI_PARSEOP_BYTELIST 0x08
906 #define ACPI_PARSEOP_IN_STACK 0x10
907 #define ACPI_PARSEOP_TARGET 0x20
908 #define ACPI_PARSEOP_IN_CACHE 0x80
910 /* Parse object DisasmFlags */
912 #define ACPI_PARSEOP_IGNORE 0x01
913 #define ACPI_PARSEOP_PARAMLIST 0x02
914 #define ACPI_PARSEOP_EMPTY_TERMLIST 0x04
915 #define ACPI_PARSEOP_SPECIAL 0x10
918 /*****************************************************************************
920 * Hardware (ACPI registers) and PNP
922 ****************************************************************************/
924 #define PCI_ROOT_HID_STRING "PNP0A03"
925 #define PCI_EXPRESS_ROOT_HID_STRING "PNP0A08"
927 typedef struct acpi_bit_register_info
929 UINT8 ParentRegister;
931 UINT16 AccessBitMask;
933 } ACPI_BIT_REGISTER_INFO;
937 * Some ACPI registers have bits that must be ignored -- meaning that they
940 #define ACPI_PM1_STATUS_PRESERVED_BITS 0x0800 /* Bit 11 */
941 #define ACPI_PM1_CONTROL_PRESERVED_BITS 0x0201 /* Bit 9, Bit 0 (SCI_EN) */
946 * These are the full ACPI registers
948 #define ACPI_REGISTER_PM1_STATUS 0x01
949 #define ACPI_REGISTER_PM1_ENABLE 0x02
950 #define ACPI_REGISTER_PM1_CONTROL 0x03
951 #define ACPI_REGISTER_PM1A_CONTROL 0x04
952 #define ACPI_REGISTER_PM1B_CONTROL 0x05
953 #define ACPI_REGISTER_PM2_CONTROL 0x06
954 #define ACPI_REGISTER_PM_TIMER 0x07
955 #define ACPI_REGISTER_PROCESSOR_BLOCK 0x08
956 #define ACPI_REGISTER_SMI_COMMAND_BLOCK 0x09
959 /* Masks used to access the BitRegisters */
961 #define ACPI_BITMASK_TIMER_STATUS 0x0001
962 #define ACPI_BITMASK_BUS_MASTER_STATUS 0x0010
963 #define ACPI_BITMASK_GLOBAL_LOCK_STATUS 0x0020
964 #define ACPI_BITMASK_POWER_BUTTON_STATUS 0x0100
965 #define ACPI_BITMASK_SLEEP_BUTTON_STATUS 0x0200
966 #define ACPI_BITMASK_RT_CLOCK_STATUS 0x0400
967 #define ACPI_BITMASK_PCIEXP_WAKE_STATUS 0x4000 /* ACPI 3.0 */
968 #define ACPI_BITMASK_WAKE_STATUS 0x8000
970 #define ACPI_BITMASK_ALL_FIXED_STATUS (\
971 ACPI_BITMASK_TIMER_STATUS | \
972 ACPI_BITMASK_BUS_MASTER_STATUS | \
973 ACPI_BITMASK_GLOBAL_LOCK_STATUS | \
974 ACPI_BITMASK_POWER_BUTTON_STATUS | \
975 ACPI_BITMASK_SLEEP_BUTTON_STATUS | \
976 ACPI_BITMASK_RT_CLOCK_STATUS | \
977 ACPI_BITMASK_WAKE_STATUS)
979 #define ACPI_BITMASK_TIMER_ENABLE 0x0001
980 #define ACPI_BITMASK_GLOBAL_LOCK_ENABLE 0x0020
981 #define ACPI_BITMASK_POWER_BUTTON_ENABLE 0x0100
982 #define ACPI_BITMASK_SLEEP_BUTTON_ENABLE 0x0200
983 #define ACPI_BITMASK_RT_CLOCK_ENABLE 0x0400
984 #define ACPI_BITMASK_PCIEXP_WAKE_DISABLE 0x4000 /* ACPI 3.0 */
986 #define ACPI_BITMASK_SCI_ENABLE 0x0001
987 #define ACPI_BITMASK_BUS_MASTER_RLD 0x0002
988 #define ACPI_BITMASK_GLOBAL_LOCK_RELEASE 0x0004
989 #define ACPI_BITMASK_SLEEP_TYPE_X 0x1C00
990 #define ACPI_BITMASK_SLEEP_ENABLE 0x2000
992 #define ACPI_BITMASK_ARB_DISABLE 0x0001
995 /* Raw bit position of each BitRegister */
997 #define ACPI_BITPOSITION_TIMER_STATUS 0x00
998 #define ACPI_BITPOSITION_BUS_MASTER_STATUS 0x04
999 #define ACPI_BITPOSITION_GLOBAL_LOCK_STATUS 0x05
1000 #define ACPI_BITPOSITION_POWER_BUTTON_STATUS 0x08
1001 #define ACPI_BITPOSITION_SLEEP_BUTTON_STATUS 0x09
1002 #define ACPI_BITPOSITION_RT_CLOCK_STATUS 0x0A
1003 #define ACPI_BITPOSITION_PCIEXP_WAKE_STATUS 0x0E /* ACPI 3.0 */
1004 #define ACPI_BITPOSITION_WAKE_STATUS 0x0F
1006 #define ACPI_BITPOSITION_TIMER_ENABLE 0x00
1007 #define ACPI_BITPOSITION_GLOBAL_LOCK_ENABLE 0x05
1008 #define ACPI_BITPOSITION_POWER_BUTTON_ENABLE 0x08
1009 #define ACPI_BITPOSITION_SLEEP_BUTTON_ENABLE 0x09
1010 #define ACPI_BITPOSITION_RT_CLOCK_ENABLE 0x0A
1011 #define ACPI_BITPOSITION_PCIEXP_WAKE_DISABLE 0x0E /* ACPI 3.0 */
1013 #define ACPI_BITPOSITION_SCI_ENABLE 0x00
1014 #define ACPI_BITPOSITION_BUS_MASTER_RLD 0x01
1015 #define ACPI_BITPOSITION_GLOBAL_LOCK_RELEASE 0x02
1016 #define ACPI_BITPOSITION_SLEEP_TYPE_X 0x0A
1017 #define ACPI_BITPOSITION_SLEEP_ENABLE 0x0D
1019 #define ACPI_BITPOSITION_ARB_DISABLE 0x00
1022 /*****************************************************************************
1024 * Resource descriptors
1026 ****************************************************************************/
1028 /* ResourceType values */
1030 #define ACPI_ADDRESS_TYPE_MEMORY_RANGE 0
1031 #define ACPI_ADDRESS_TYPE_IO_RANGE 1
1032 #define ACPI_ADDRESS_TYPE_BUS_NUMBER_RANGE 2
1034 /* Resource descriptor types and masks */
1036 #define ACPI_RESOURCE_NAME_LARGE 0x80
1037 #define ACPI_RESOURCE_NAME_SMALL 0x00
1039 #define ACPI_RESOURCE_NAME_SMALL_MASK 0x78 /* Bits 6:3 contain the type */
1040 #define ACPI_RESOURCE_NAME_SMALL_LENGTH_MASK 0x07 /* Bits 2:0 contain the length */
1041 #define ACPI_RESOURCE_NAME_LARGE_MASK 0x7F /* Bits 6:0 contain the type */
1045 * Small resource descriptor "names" as defined by the ACPI specification.
1046 * Note: Bits 2:0 are used for the descriptor length
1048 #define ACPI_RESOURCE_NAME_IRQ 0x20
1049 #define ACPI_RESOURCE_NAME_DMA 0x28
1050 #define ACPI_RESOURCE_NAME_START_DEPENDENT 0x30
1051 #define ACPI_RESOURCE_NAME_END_DEPENDENT 0x38
1052 #define ACPI_RESOURCE_NAME_IO 0x40
1053 #define ACPI_RESOURCE_NAME_FIXED_IO 0x48
1054 #define ACPI_RESOURCE_NAME_RESERVED_S1 0x50
1055 #define ACPI_RESOURCE_NAME_RESERVED_S2 0x58
1056 #define ACPI_RESOURCE_NAME_RESERVED_S3 0x60
1057 #define ACPI_RESOURCE_NAME_RESERVED_S4 0x68
1058 #define ACPI_RESOURCE_NAME_VENDOR_SMALL 0x70
1059 #define ACPI_RESOURCE_NAME_END_TAG 0x78
1062 * Large resource descriptor "names" as defined by the ACPI specification.
1063 * Note: includes the Large Descriptor bit in bit[7]
1065 #define ACPI_RESOURCE_NAME_MEMORY24 0x81
1066 #define ACPI_RESOURCE_NAME_GENERIC_REGISTER 0x82
1067 #define ACPI_RESOURCE_NAME_RESERVED_L1 0x83
1068 #define ACPI_RESOURCE_NAME_VENDOR_LARGE 0x84
1069 #define ACPI_RESOURCE_NAME_MEMORY32 0x85
1070 #define ACPI_RESOURCE_NAME_FIXED_MEMORY32 0x86
1071 #define ACPI_RESOURCE_NAME_ADDRESS32 0x87
1072 #define ACPI_RESOURCE_NAME_ADDRESS16 0x88
1073 #define ACPI_RESOURCE_NAME_EXTENDED_IRQ 0x89
1074 #define ACPI_RESOURCE_NAME_ADDRESS64 0x8A
1075 #define ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64 0x8B
1076 #define ACPI_RESOURCE_NAME_LARGE_MAX 0x8B
1079 /*****************************************************************************
1083 ****************************************************************************/
1085 #define ACPI_ASCII_ZERO 0x30
1088 /*****************************************************************************
1092 ****************************************************************************/
1094 typedef struct acpi_db_method_info
1096 ACPI_HANDLE MainThreadGate;
1097 ACPI_HANDLE ThreadCompleteGate;
1101 UINT32 NumCompleted;
1110 * Arguments to be passed to method for the command
1112 * the Number of threads, ID of current thread and
1113 * Index of current thread inside all them created.
1117 char NumThreadsStr[11];
1118 char IdOfThreadStr[11];
1119 char IndexOfThreadStr[11];
1121 } ACPI_DB_METHOD_INFO;
1123 typedef struct acpi_integrity_info
1128 } ACPI_INTEGRITY_INFO;
1131 #define ACPI_DB_REDIRECTABLE_OUTPUT 0x01
1132 #define ACPI_DB_CONSOLE_OUTPUT 0x02
1133 #define ACPI_DB_DUPLICATE_OUTPUT 0x03
1136 /*****************************************************************************
1140 ****************************************************************************/
1142 /* Entry for a memory allocation (debug only) */
1144 #define ACPI_MEM_MALLOC 0
1145 #define ACPI_MEM_CALLOC 1
1146 #define ACPI_MAX_MODULE_NAME 16
1148 #define ACPI_COMMON_DEBUG_MEM_HEADER \
1149 struct acpi_debug_mem_block *Previous; \
1150 struct acpi_debug_mem_block *Next; \
1154 char Module[ACPI_MAX_MODULE_NAME]; \
1157 typedef struct acpi_debug_mem_header
1159 ACPI_COMMON_DEBUG_MEM_HEADER
1161 } ACPI_DEBUG_MEM_HEADER;
1163 typedef struct acpi_debug_mem_block
1165 ACPI_COMMON_DEBUG_MEM_HEADER
1168 } ACPI_DEBUG_MEM_BLOCK;
1171 #define ACPI_MEM_LIST_GLOBAL 0
1172 #define ACPI_MEM_LIST_NSNODE 1
1173 #define ACPI_MEM_LIST_MAX 1
1174 #define ACPI_NUM_MEM_LISTS 2
1177 typedef struct acpi_memory_list
1183 UINT16 CurrentDepth;
1186 #ifdef ACPI_DBG_TRACK_ALLOCATIONS
1188 /* Statistics for debug memory tracking only */
1190 UINT32 TotalAllocated;
1194 UINT32 CurrentTotalSize;
1202 #endif /* __ACLOCAL_H__ */