1 /******************************************************************************
3 * Name: aclocal.h - Internal data types used across the ACPI subsystem
5 *****************************************************************************/
8 * Copyright (C) 2000 - 2011, 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.
48 /* acpisrc:StructDefs -- for acpisrc conversion */
50 #define ACPI_SERIALIZED 0xFF
52 typedef UINT32 ACPI_MUTEX_HANDLE;
53 #define ACPI_GLOBAL_LOCK (ACPI_SEMAPHORE) (-1)
55 /* Total number of aml opcodes defined */
57 #define AML_NUM_OPCODES 0x7F
60 /* Forward declarations */
62 struct acpi_walk_state;
63 struct acpi_obj_mutex;
64 union acpi_parse_object;
67 /*****************************************************************************
69 * Mutex typedefs and structs
71 ****************************************************************************/
75 * Predefined handles for the mutex objects used within the subsystem
76 * All mutex objects are automatically created by AcpiUtMutexInitialize.
78 * The acquire/release ordering protocol is implied via this list. Mutexes
79 * with a lower value must be acquired before mutexes with a higher value.
81 * NOTE: any changes here must be reflected in the AcpiGbl_MutexNames
84 #define ACPI_MTX_INTERPRETER 0 /* AML Interpreter, main lock */
85 #define ACPI_MTX_NAMESPACE 1 /* ACPI Namespace */
86 #define ACPI_MTX_TABLES 2 /* Data for ACPI tables */
87 #define ACPI_MTX_EVENTS 3 /* Data for ACPI events */
88 #define ACPI_MTX_CACHES 4 /* Internal caches, general purposes */
89 #define ACPI_MTX_MEMORY 5 /* Debug memory tracking lists */
90 #define ACPI_MTX_DEBUG_CMD_COMPLETE 6 /* AML debugger */
91 #define ACPI_MTX_DEBUG_CMD_READY 7 /* AML debugger */
93 #define ACPI_MAX_MUTEX 7
94 #define ACPI_NUM_MUTEX ACPI_MAX_MUTEX+1
97 /* Lock structure for reader/writer interfaces */
99 typedef struct acpi_rw_lock
101 ACPI_MUTEX WriterMutex;
102 ACPI_MUTEX ReaderMutex;
109 * Predefined handles for spinlocks used within the subsystem.
110 * These spinlocks are created by AcpiUtMutexInitialize
112 #define ACPI_LOCK_GPES 0
113 #define ACPI_LOCK_HARDWARE 1
115 #define ACPI_MAX_LOCK 1
116 #define ACPI_NUM_LOCK ACPI_MAX_LOCK+1
119 /* This Thread ID means that the mutex is not in use (unlocked) */
121 #define ACPI_MUTEX_NOT_ACQUIRED (ACPI_THREAD_ID) -1
123 /* Table for the global mutexes */
125 typedef struct acpi_mutex_info
129 ACPI_THREAD_ID ThreadId;
134 /* Lock flag parameter for various interfaces */
136 #define ACPI_MTX_DO_NOT_LOCK 0
137 #define ACPI_MTX_LOCK 1
140 /* Field access granularities */
142 #define ACPI_FIELD_BYTE_GRANULARITY 1
143 #define ACPI_FIELD_WORD_GRANULARITY 2
144 #define ACPI_FIELD_DWORD_GRANULARITY 4
145 #define ACPI_FIELD_QWORD_GRANULARITY 8
148 #define ACPI_ENTRY_NOT_FOUND NULL
151 /*****************************************************************************
153 * Namespace typedefs and structs
155 ****************************************************************************/
157 /* Operational modes of the AML interpreter/scanner */
161 ACPI_IMODE_LOAD_PASS1 = 0x01,
162 ACPI_IMODE_LOAD_PASS2 = 0x02,
163 ACPI_IMODE_EXECUTE = 0x03
165 } ACPI_INTERPRETER_MODE;
169 * The Namespace Node describes a named object that appears in the AML.
170 * DescriptorType is used to differentiate between internal descriptors.
172 * The node is optimized for both 32-bit and 64-bit platforms:
173 * 20 bytes for the 32-bit case, 32 bytes for the 64-bit case.
175 * Note: The DescriptorType and Type fields must appear in the identical
176 * position in both the ACPI_NAMESPACE_NODE and ACPI_OPERAND_OBJECT
179 typedef struct acpi_namespace_node
181 union acpi_operand_object *Object; /* Interpreter object */
182 UINT8 DescriptorType; /* Differentiate object descriptor types */
183 UINT8 Type; /* ACPI Type associated with this name */
184 UINT8 Flags; /* Miscellaneous flags */
185 ACPI_OWNER_ID OwnerId; /* Node creator */
186 ACPI_NAME_UNION Name; /* ACPI Name, always 4 chars per ACPI spec */
187 struct acpi_namespace_node *Parent; /* Parent node */
188 struct acpi_namespace_node *Child; /* First child */
189 struct acpi_namespace_node *Peer; /* First peer */
192 * The following fields are used by the ASL compiler and disassembler only
194 #ifdef ACPI_LARGE_NAMESPACE_NODE
195 union acpi_parse_object *Op;
200 } ACPI_NAMESPACE_NODE;
203 /* Namespace Node flags */
205 #define ANOBJ_RESERVED 0x01 /* Available for use */
206 #define ANOBJ_TEMPORARY 0x02 /* Node is create by a method and is temporary */
207 #define ANOBJ_METHOD_ARG 0x04 /* Node is a method argument */
208 #define ANOBJ_METHOD_LOCAL 0x08 /* Node is a method local */
209 #define ANOBJ_SUBTREE_HAS_INI 0x10 /* Used to optimize device initialization */
210 #define ANOBJ_EVALUATED 0x20 /* Set on first evaluation of node */
211 #define ANOBJ_ALLOCATED_BUFFER 0x40 /* Method AML buffer is dynamic (InstallMethod) */
213 #define ANOBJ_IS_EXTERNAL 0x08 /* iASL only: This object created via External() */
214 #define ANOBJ_METHOD_NO_RETVAL 0x10 /* iASL only: Method has no return value */
215 #define ANOBJ_METHOD_SOME_NO_RETVAL 0x20 /* iASL only: Method has at least one return value */
216 #define ANOBJ_IS_BIT_OFFSET 0x40 /* iASL only: Reference is a bit offset */
217 #define ANOBJ_IS_REFERENCED 0x80 /* iASL only: Object was referenced */
220 /* Internal ACPI table management - master table list */
222 typedef struct acpi_table_list
224 ACPI_TABLE_DESC *Tables; /* Table descriptor array */
225 UINT32 CurrentTableCount; /* Tables currently in the array */
226 UINT32 MaxTableCount; /* Max tables array will hold */
231 /* Flags for above */
233 #define ACPI_ROOT_ORIGIN_UNKNOWN (0) /* ~ORIGIN_ALLOCATED */
234 #define ACPI_ROOT_ORIGIN_ALLOCATED (1)
235 #define ACPI_ROOT_ALLOW_RESIZE (2)
238 /* Predefined (fixed) table indexes */
240 #define ACPI_TABLE_INDEX_DSDT (0)
241 #define ACPI_TABLE_INDEX_FACS (1)
244 typedef struct acpi_find_context
253 typedef struct acpi_ns_search_data
255 ACPI_NAMESPACE_NODE *Node;
257 } ACPI_NS_SEARCH_DATA;
260 /* Object types used during package copies */
262 #define ACPI_COPY_TYPE_SIMPLE 0
263 #define ACPI_COPY_TYPE_PACKAGE 1
266 /* Info structure used to convert external<->internal namestrings */
268 typedef struct acpi_namestring_info
270 const char *ExternalName;
271 const char *NextExternalChar;
276 BOOLEAN FullyQualified;
278 } ACPI_NAMESTRING_INFO;
281 /* Field creation info */
283 typedef struct acpi_create_field_info
285 ACPI_NAMESPACE_NODE *RegionNode;
286 ACPI_NAMESPACE_NODE *FieldNode;
287 ACPI_NAMESPACE_NODE *RegisterNode;
288 ACPI_NAMESPACE_NODE *DataRegisterNode;
290 UINT32 FieldBitPosition;
291 UINT32 FieldBitLength;
296 } ACPI_CREATE_FIELD_INFO;
300 ACPI_STATUS (*ACPI_INTERNAL_METHOD) (
301 struct acpi_walk_state *WalkState);
305 * Bitmapped ACPI types. Used internally only
307 #define ACPI_BTYPE_ANY 0x00000000
308 #define ACPI_BTYPE_INTEGER 0x00000001
309 #define ACPI_BTYPE_STRING 0x00000002
310 #define ACPI_BTYPE_BUFFER 0x00000004
311 #define ACPI_BTYPE_PACKAGE 0x00000008
312 #define ACPI_BTYPE_FIELD_UNIT 0x00000010
313 #define ACPI_BTYPE_DEVICE 0x00000020
314 #define ACPI_BTYPE_EVENT 0x00000040
315 #define ACPI_BTYPE_METHOD 0x00000080
316 #define ACPI_BTYPE_MUTEX 0x00000100
317 #define ACPI_BTYPE_REGION 0x00000200
318 #define ACPI_BTYPE_POWER 0x00000400
319 #define ACPI_BTYPE_PROCESSOR 0x00000800
320 #define ACPI_BTYPE_THERMAL 0x00001000
321 #define ACPI_BTYPE_BUFFER_FIELD 0x00002000
322 #define ACPI_BTYPE_DDB_HANDLE 0x00004000
323 #define ACPI_BTYPE_DEBUG_OBJECT 0x00008000
324 #define ACPI_BTYPE_REFERENCE 0x00010000
325 #define ACPI_BTYPE_RESOURCE 0x00020000
327 #define ACPI_BTYPE_COMPUTE_DATA (ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING | ACPI_BTYPE_BUFFER)
329 #define ACPI_BTYPE_DATA (ACPI_BTYPE_COMPUTE_DATA | ACPI_BTYPE_PACKAGE)
330 #define ACPI_BTYPE_DATA_REFERENCE (ACPI_BTYPE_DATA | ACPI_BTYPE_REFERENCE | ACPI_BTYPE_DDB_HANDLE)
331 #define ACPI_BTYPE_DEVICE_OBJECTS (ACPI_BTYPE_DEVICE | ACPI_BTYPE_THERMAL | ACPI_BTYPE_PROCESSOR)
332 #define ACPI_BTYPE_OBJECTS_AND_REFS 0x0001FFFF /* ARG or LOCAL */
333 #define ACPI_BTYPE_ALL_OBJECTS 0x0000FFFF
337 * Information structure for ACPI predefined names.
338 * Each entry in the table contains the following items:
340 * Name - The ACPI reserved name
341 * ParamCount - Number of arguments to the method
342 * ExpectedReturnBtypes - Allowed type(s) for the return value
344 typedef struct acpi_name_info
346 char Name[ACPI_NAME_SIZE];
348 UINT8 ExpectedBtypes;
353 * Secondary information structures for ACPI predefined objects that return
354 * package objects. This structure appears as the next entry in the table
355 * after the NAME_INFO structure above.
357 * The reason for this is to minimize the size of the predefined name table.
361 * Used for ACPI_PTYPE1_FIXED, ACPI_PTYPE1_VAR, ACPI_PTYPE2,
362 * ACPI_PTYPE2_MIN, ACPI_PTYPE2_PKG_COUNT, ACPI_PTYPE2_COUNT
364 typedef struct acpi_package_info
375 /* Used for ACPI_PTYPE2_FIXED */
377 typedef struct acpi_package_info2
383 } ACPI_PACKAGE_INFO2;
385 /* Used for ACPI_PTYPE1_OPTION */
387 typedef struct acpi_package_info3
392 UINT8 TailObjectType;
395 } ACPI_PACKAGE_INFO3;
397 typedef union acpi_predefined_info
400 ACPI_PACKAGE_INFO RetInfo;
401 ACPI_PACKAGE_INFO2 RetInfo2;
402 ACPI_PACKAGE_INFO3 RetInfo3;
404 } ACPI_PREDEFINED_INFO;
407 /* Data block used during object validation */
409 typedef struct acpi_predefined_data
412 const ACPI_PREDEFINED_INFO *Predefined;
413 union acpi_operand_object *ParentPackage;
417 } ACPI_PREDEFINED_DATA;
419 /* Defines for Flags field above */
421 #define ACPI_OBJECT_REPAIRED 1
425 * Bitmapped return value types
426 * Note: the actual data types must be contiguous, a loop in nspredef.c
429 #define ACPI_RTYPE_ANY 0x00
430 #define ACPI_RTYPE_NONE 0x01
431 #define ACPI_RTYPE_INTEGER 0x02
432 #define ACPI_RTYPE_STRING 0x04
433 #define ACPI_RTYPE_BUFFER 0x08
434 #define ACPI_RTYPE_PACKAGE 0x10
435 #define ACPI_RTYPE_REFERENCE 0x20
436 #define ACPI_RTYPE_ALL 0x3F
438 #define ACPI_NUM_RTYPES 5 /* Number of actual object types */
441 /*****************************************************************************
443 * Event typedefs and structs
445 ****************************************************************************/
447 /* Dispatch info for each GPE -- either a method or handler, cannot be both */
449 typedef struct acpi_gpe_handler_info
451 ACPI_GPE_HANDLER Address; /* Address of handler, if any */
452 void *Context; /* Context to be passed to handler */
453 ACPI_NAMESPACE_NODE *MethodNode; /* Method node for this GPE level (saved) */
454 UINT8 OriginalFlags; /* Original (pre-handler) GPE info */
455 BOOLEAN OriginallyEnabled; /* True if GPE was originally enabled */
457 } ACPI_GPE_HANDLER_INFO;
460 * GPE dispatch info. At any time, the GPE can have at most one type
461 * of dispatch - Method, Handler, or Implicit Notify.
463 typedef union acpi_gpe_dispatch_info
465 ACPI_NAMESPACE_NODE *MethodNode; /* Method node for this GPE level */
466 struct acpi_gpe_handler_info *Handler; /* Installed GPE handler */
467 ACPI_NAMESPACE_NODE *DeviceNode; /* Parent _PRW device for implicit notify */
469 } ACPI_GPE_DISPATCH_INFO;
472 * Information about a GPE, one per each GPE in an array.
473 * NOTE: Important to keep this struct as small as possible.
475 typedef struct acpi_gpe_event_info
477 union acpi_gpe_dispatch_info Dispatch; /* Either Method or Handler */
478 struct acpi_gpe_register_info *RegisterInfo; /* Backpointer to register info */
479 UINT8 Flags; /* Misc info about this GPE */
480 UINT8 GpeNumber; /* This GPE */
481 UINT8 RuntimeCount; /* References to a run GPE */
483 } ACPI_GPE_EVENT_INFO;
485 /* Information about a GPE register pair, one per each status/enable pair in an array */
487 typedef struct acpi_gpe_register_info
489 ACPI_GENERIC_ADDRESS StatusAddress; /* Address of status reg */
490 ACPI_GENERIC_ADDRESS EnableAddress; /* Address of enable reg */
491 UINT8 EnableForWake; /* GPEs to keep enabled when sleeping */
492 UINT8 EnableForRun; /* GPEs to keep enabled when running */
493 UINT8 BaseGpeNumber; /* Base GPE number for this register */
495 } ACPI_GPE_REGISTER_INFO;
498 * Information about a GPE register block, one per each installed block --
499 * GPE0, GPE1, and one per each installed GPE Block Device.
501 typedef struct acpi_gpe_block_info
503 ACPI_NAMESPACE_NODE *Node;
504 struct acpi_gpe_block_info *Previous;
505 struct acpi_gpe_block_info *Next;
506 struct acpi_gpe_xrupt_info *XruptBlock; /* Backpointer to interrupt block */
507 ACPI_GPE_REGISTER_INFO *RegisterInfo; /* One per GPE register pair */
508 ACPI_GPE_EVENT_INFO *EventInfo; /* One for each GPE */
509 ACPI_GENERIC_ADDRESS BlockAddress; /* Base address of the block */
510 UINT32 RegisterCount; /* Number of register pairs in block */
511 UINT16 GpeCount; /* Number of individual GPEs in block */
512 UINT8 BlockBaseNumber;/* Base GPE number for this block */
513 BOOLEAN Initialized; /* TRUE if this block is initialized */
515 } ACPI_GPE_BLOCK_INFO;
517 /* Information about GPE interrupt handlers, one per each interrupt level used for GPEs */
519 typedef struct acpi_gpe_xrupt_info
521 struct acpi_gpe_xrupt_info *Previous;
522 struct acpi_gpe_xrupt_info *Next;
523 ACPI_GPE_BLOCK_INFO *GpeBlockListHead; /* List of GPE blocks for this xrupt */
524 UINT32 InterruptNumber; /* System interrupt number */
526 } ACPI_GPE_XRUPT_INFO;
528 typedef struct acpi_gpe_walk_info
530 ACPI_NAMESPACE_NODE *GpeDevice;
531 ACPI_GPE_BLOCK_INFO *GpeBlock;
533 ACPI_OWNER_ID OwnerId;
534 BOOLEAN ExecuteByOwnerId;
536 } ACPI_GPE_WALK_INFO;
538 typedef struct acpi_gpe_device_info
541 UINT32 NextBlockBaseIndex;
543 ACPI_NAMESPACE_NODE *GpeDevice;
545 } ACPI_GPE_DEVICE_INFO;
547 typedef ACPI_STATUS (*ACPI_GPE_CALLBACK) (
548 ACPI_GPE_XRUPT_INFO *GpeXruptInfo,
549 ACPI_GPE_BLOCK_INFO *GpeBlock,
553 /* Information about each particular fixed event */
555 typedef struct acpi_fixed_event_handler
557 ACPI_EVENT_HANDLER Handler; /* Address of handler. */
558 void *Context; /* Context to be passed to handler */
560 } ACPI_FIXED_EVENT_HANDLER;
562 typedef struct acpi_fixed_event_info
564 UINT8 StatusRegisterId;
565 UINT8 EnableRegisterId;
566 UINT16 StatusBitMask;
567 UINT16 EnableBitMask;
569 } ACPI_FIXED_EVENT_INFO;
571 /* Information used during field processing */
573 typedef struct acpi_field_info
582 /*****************************************************************************
584 * Generic "state" object for stacks
586 ****************************************************************************/
588 #define ACPI_CONTROL_NORMAL 0xC0
589 #define ACPI_CONTROL_CONDITIONAL_EXECUTING 0xC1
590 #define ACPI_CONTROL_PREDICATE_EXECUTING 0xC2
591 #define ACPI_CONTROL_PREDICATE_FALSE 0xC3
592 #define ACPI_CONTROL_PREDICATE_TRUE 0xC4
595 #define ACPI_STATE_COMMON \
597 UINT8 DescriptorType; /* To differentiate various internal objs */\
602 /* There are 2 bytes available here until the next natural alignment boundary */
604 typedef struct acpi_common_state
611 * Update state - used to traverse complex objects such as packages
613 typedef struct acpi_update_state
616 union acpi_operand_object *Object;
622 * Pkg state - used to traverse nested package structures
624 typedef struct acpi_pkg_state
628 union acpi_operand_object *SourceObject;
629 union acpi_operand_object *DestObject;
630 struct acpi_walk_state *WalkState;
638 * Control state - one per if/else and while constructs.
639 * Allows nesting of these constructs
641 typedef struct acpi_control_state
645 union acpi_parse_object *PredicateOp;
646 UINT8 *AmlPredicateStart; /* Start of if/while predicate */
647 UINT8 *PackageEnd; /* End of if/while block */
648 UINT32 LoopCount; /* While() loop counter */
650 } ACPI_CONTROL_STATE;
654 * Scope state - current scope during namespace lookups
656 typedef struct acpi_scope_state
659 ACPI_NAMESPACE_NODE *Node;
664 typedef struct acpi_pscope_state
667 UINT32 ArgCount; /* Number of fixed arguments */
668 union acpi_parse_object *Op; /* Current op being parsed */
669 UINT8 *ArgEnd; /* Current argument end */
670 UINT8 *PkgEnd; /* Current package end */
671 UINT32 ArgList; /* Next argument to parse */
677 * Thread state - one per thread across multiple walk states. Multiple walk
678 * states are created when there are nested control methods executing.
680 typedef struct acpi_thread_state
683 UINT8 CurrentSyncLevel; /* Mutex Sync (nested acquire) level */
684 struct acpi_walk_state *WalkStateList; /* Head of list of WalkStates for this thread */
685 union acpi_operand_object *AcquiredMutexList; /* List of all currently acquired mutexes */
686 ACPI_THREAD_ID ThreadId; /* Running thread ID */
692 * Result values - used to accumulate the results of nested
695 typedef struct acpi_result_values
698 union acpi_operand_object *ObjDesc [ACPI_RESULTS_FRAME_OBJ_NUM];
700 } ACPI_RESULT_VALUES;
704 ACPI_STATUS (*ACPI_PARSE_DOWNWARDS) (
705 struct acpi_walk_state *WalkState,
706 union acpi_parse_object **OutOp);
709 ACPI_STATUS (*ACPI_PARSE_UPWARDS) (
710 struct acpi_walk_state *WalkState);
714 * Notify info - used to pass info to the deferred notify
715 * handler/dispatcher.
717 typedef struct acpi_notify_info
720 ACPI_NAMESPACE_NODE *Node;
721 union acpi_operand_object *HandlerObj;
726 /* Generic state is union of structs above */
728 typedef union acpi_generic_state
730 ACPI_COMMON_STATE Common;
731 ACPI_CONTROL_STATE Control;
732 ACPI_UPDATE_STATE Update;
733 ACPI_SCOPE_STATE Scope;
734 ACPI_PSCOPE_STATE ParseScope;
736 ACPI_THREAD_STATE Thread;
737 ACPI_RESULT_VALUES Results;
738 ACPI_NOTIFY_INFO Notify;
740 } ACPI_GENERIC_STATE;
743 /*****************************************************************************
745 * Interpreter typedefs and structs
747 ****************************************************************************/
750 ACPI_STATUS (*ACPI_EXECUTE_OP) (
751 struct acpi_walk_state *WalkState);
754 /*****************************************************************************
756 * Parser typedefs and structs
758 ****************************************************************************/
761 * AML opcode, name, and argument layout
763 typedef struct acpi_opcode_info
765 #if defined(ACPI_DISASSEMBLER) || defined(ACPI_DEBUG_OUTPUT)
766 char *Name; /* Opcode name (disassembler/debug only) */
768 UINT32 ParseArgs; /* Grammar/Parse time arguments */
769 UINT32 RuntimeArgs; /* Interpret time arguments */
770 UINT16 Flags; /* Misc flags */
771 UINT8 ObjectType; /* Corresponding internal object type */
772 UINT8 Class; /* Opcode class */
773 UINT8 Type; /* Opcode type */
777 typedef union acpi_parse_value
779 UINT64 Integer; /* Integer constant (Up to 64 bits) */
780 UINT32 Size; /* bytelist or field size */
781 char *String; /* NULL terminated string */
782 UINT8 *Buffer; /* buffer or string */
783 char *Name; /* NULL terminated string */
784 union acpi_parse_object *Arg; /* arguments and contained ops */
789 #ifdef ACPI_DISASSEMBLER
790 #define ACPI_DISASM_ONLY_MEMBERS(a) a;
792 #define ACPI_DISASM_ONLY_MEMBERS(a)
795 #define ACPI_PARSE_COMMON \
796 union acpi_parse_object *Parent; /* Parent op */\
797 UINT8 DescriptorType; /* To differentiate various internal objs */\
798 UINT8 Flags; /* Type of Op */\
799 UINT16 AmlOpcode; /* AML opcode */\
800 UINT32 AmlOffset; /* Offset of declaration in AML */\
801 union acpi_parse_object *Next; /* Next op */\
802 ACPI_NAMESPACE_NODE *Node; /* For use by interpreter */\
803 ACPI_PARSE_VALUE Value; /* Value or args associated with the opcode */\
804 UINT8 ArgListLength; /* Number of elements in the arg list */\
805 ACPI_DISASM_ONLY_MEMBERS (\
806 UINT8 DisasmFlags; /* Used during AML disassembly */\
807 UINT8 DisasmOpcode; /* Subtype used for disassembly */\
808 char AmlOpName[16]) /* Op name (debug only) */
811 #define ACPI_DASM_BUFFER 0x00
812 #define ACPI_DASM_RESOURCE 0x01
813 #define ACPI_DASM_STRING 0x02
814 #define ACPI_DASM_UNICODE 0x03
815 #define ACPI_DASM_EISAID 0x04
816 #define ACPI_DASM_MATCHOP 0x05
817 #define ACPI_DASM_LNOT_PREFIX 0x06
818 #define ACPI_DASM_LNOT_SUFFIX 0x07
819 #define ACPI_DASM_IGNORE 0x08
822 * Generic operation (for example: If, While, Store)
824 typedef struct acpi_parse_obj_common
827 } ACPI_PARSE_OBJ_COMMON;
831 * Extended Op for named ops (Scope, Method, etc.), deferred ops (Methods and OpRegions),
834 typedef struct acpi_parse_obj_named
838 UINT8 *Data; /* AML body or bytelist data */
839 UINT32 Length; /* AML length */
840 UINT32 Name; /* 4-byte name or zero if no name */
842 } ACPI_PARSE_OBJ_NAMED;
845 /* This version is used by the iASL compiler only */
847 #define ACPI_MAX_PARSEOP_NAME 20
849 typedef struct acpi_parse_obj_asl
852 union acpi_parse_object *Child;
853 union acpi_parse_object *ParentMethod;
861 UINT32 LogicalLineNumber;
862 UINT32 LogicalByteOffset;
864 UINT32 EndLogicalLine;
867 UINT32 AmlSubtreeLength;
868 UINT32 FinalAmlLength;
869 UINT32 FinalAmlOffset;
872 UINT8 AmlOpcodeLength;
873 UINT8 AmlPkgLenBytes;
875 char ParseOpName[ACPI_MAX_PARSEOP_NAME];
877 } ACPI_PARSE_OBJ_ASL;
879 typedef union acpi_parse_object
881 ACPI_PARSE_OBJ_COMMON Common;
882 ACPI_PARSE_OBJ_NAMED Named;
883 ACPI_PARSE_OBJ_ASL Asl;
889 * Parse state - one state per parser invocation and each control
892 typedef struct acpi_parse_state
894 UINT8 *AmlStart; /* First AML byte */
895 UINT8 *Aml; /* Next AML byte */
896 UINT8 *AmlEnd; /* (last + 1) AML byte */
897 UINT8 *PkgStart; /* Current package begin */
898 UINT8 *PkgEnd; /* Current package end */
899 union acpi_parse_object *StartOp; /* Root of parse tree */
900 struct acpi_namespace_node *StartNode;
901 union acpi_generic_state *Scope; /* Current scope */
902 union acpi_parse_object *StartScope;
908 /* Parse object flags */
910 #define ACPI_PARSEOP_GENERIC 0x01
911 #define ACPI_PARSEOP_NAMED 0x02
912 #define ACPI_PARSEOP_DEFERRED 0x04
913 #define ACPI_PARSEOP_BYTELIST 0x08
914 #define ACPI_PARSEOP_IN_STACK 0x10
915 #define ACPI_PARSEOP_TARGET 0x20
916 #define ACPI_PARSEOP_IN_CACHE 0x80
918 /* Parse object DisasmFlags */
920 #define ACPI_PARSEOP_IGNORE 0x01
921 #define ACPI_PARSEOP_PARAMLIST 0x02
922 #define ACPI_PARSEOP_EMPTY_TERMLIST 0x04
923 #define ACPI_PARSEOP_SPECIAL 0x10
926 /*****************************************************************************
928 * Hardware (ACPI registers) and PNP
930 ****************************************************************************/
932 typedef struct acpi_bit_register_info
934 UINT8 ParentRegister;
936 UINT16 AccessBitMask;
938 } ACPI_BIT_REGISTER_INFO;
942 * Some ACPI registers have bits that must be ignored -- meaning that they
945 #define ACPI_PM1_STATUS_PRESERVED_BITS 0x0800 /* Bit 11 */
947 /* Write-only bits must be zeroed by software */
949 #define ACPI_PM1_CONTROL_WRITEONLY_BITS 0x2004 /* Bits 13, 2 */
951 /* For control registers, both ignored and reserved bits must be preserved */
954 * For PM1 control, the SCI enable bit (bit 0, SCI_EN) is defined by the
955 * ACPI specification to be a "preserved" bit - "OSPM always preserves this
956 * bit position", section 4.7.3.2.1. However, on some machines the OS must
957 * write a one to this bit after resume for the machine to work properly.
958 * To enable this, we no longer attempt to preserve this bit. No machines
959 * are known to fail if the bit is not preserved. (May 2009)
961 #define ACPI_PM1_CONTROL_IGNORED_BITS 0x0200 /* Bit 9 */
962 #define ACPI_PM1_CONTROL_RESERVED_BITS 0xC1F8 /* Bits 14-15, 3-8 */
963 #define ACPI_PM1_CONTROL_PRESERVED_BITS \
964 (ACPI_PM1_CONTROL_IGNORED_BITS | ACPI_PM1_CONTROL_RESERVED_BITS)
966 #define ACPI_PM2_CONTROL_PRESERVED_BITS 0xFFFFFFFE /* All except bit 0 */
970 * These are the full ACPI registers
972 #define ACPI_REGISTER_PM1_STATUS 0x01
973 #define ACPI_REGISTER_PM1_ENABLE 0x02
974 #define ACPI_REGISTER_PM1_CONTROL 0x03
975 #define ACPI_REGISTER_PM2_CONTROL 0x04
976 #define ACPI_REGISTER_PM_TIMER 0x05
977 #define ACPI_REGISTER_PROCESSOR_BLOCK 0x06
978 #define ACPI_REGISTER_SMI_COMMAND_BLOCK 0x07
981 /* Masks used to access the BitRegisters */
983 #define ACPI_BITMASK_TIMER_STATUS 0x0001
984 #define ACPI_BITMASK_BUS_MASTER_STATUS 0x0010
985 #define ACPI_BITMASK_GLOBAL_LOCK_STATUS 0x0020
986 #define ACPI_BITMASK_POWER_BUTTON_STATUS 0x0100
987 #define ACPI_BITMASK_SLEEP_BUTTON_STATUS 0x0200
988 #define ACPI_BITMASK_RT_CLOCK_STATUS 0x0400
989 #define ACPI_BITMASK_PCIEXP_WAKE_STATUS 0x4000 /* ACPI 3.0 */
990 #define ACPI_BITMASK_WAKE_STATUS 0x8000
992 #define ACPI_BITMASK_ALL_FIXED_STATUS (\
993 ACPI_BITMASK_TIMER_STATUS | \
994 ACPI_BITMASK_BUS_MASTER_STATUS | \
995 ACPI_BITMASK_GLOBAL_LOCK_STATUS | \
996 ACPI_BITMASK_POWER_BUTTON_STATUS | \
997 ACPI_BITMASK_SLEEP_BUTTON_STATUS | \
998 ACPI_BITMASK_RT_CLOCK_STATUS | \
999 ACPI_BITMASK_PCIEXP_WAKE_STATUS | \
1000 ACPI_BITMASK_WAKE_STATUS)
1002 #define ACPI_BITMASK_TIMER_ENABLE 0x0001
1003 #define ACPI_BITMASK_GLOBAL_LOCK_ENABLE 0x0020
1004 #define ACPI_BITMASK_POWER_BUTTON_ENABLE 0x0100
1005 #define ACPI_BITMASK_SLEEP_BUTTON_ENABLE 0x0200
1006 #define ACPI_BITMASK_RT_CLOCK_ENABLE 0x0400
1007 #define ACPI_BITMASK_PCIEXP_WAKE_DISABLE 0x4000 /* ACPI 3.0 */
1009 #define ACPI_BITMASK_SCI_ENABLE 0x0001
1010 #define ACPI_BITMASK_BUS_MASTER_RLD 0x0002
1011 #define ACPI_BITMASK_GLOBAL_LOCK_RELEASE 0x0004
1012 #define ACPI_BITMASK_SLEEP_TYPE 0x1C00
1013 #define ACPI_BITMASK_SLEEP_ENABLE 0x2000
1015 #define ACPI_BITMASK_ARB_DISABLE 0x0001
1018 /* Raw bit position of each BitRegister */
1020 #define ACPI_BITPOSITION_TIMER_STATUS 0x00
1021 #define ACPI_BITPOSITION_BUS_MASTER_STATUS 0x04
1022 #define ACPI_BITPOSITION_GLOBAL_LOCK_STATUS 0x05
1023 #define ACPI_BITPOSITION_POWER_BUTTON_STATUS 0x08
1024 #define ACPI_BITPOSITION_SLEEP_BUTTON_STATUS 0x09
1025 #define ACPI_BITPOSITION_RT_CLOCK_STATUS 0x0A
1026 #define ACPI_BITPOSITION_PCIEXP_WAKE_STATUS 0x0E /* ACPI 3.0 */
1027 #define ACPI_BITPOSITION_WAKE_STATUS 0x0F
1029 #define ACPI_BITPOSITION_TIMER_ENABLE 0x00
1030 #define ACPI_BITPOSITION_GLOBAL_LOCK_ENABLE 0x05
1031 #define ACPI_BITPOSITION_POWER_BUTTON_ENABLE 0x08
1032 #define ACPI_BITPOSITION_SLEEP_BUTTON_ENABLE 0x09
1033 #define ACPI_BITPOSITION_RT_CLOCK_ENABLE 0x0A
1034 #define ACPI_BITPOSITION_PCIEXP_WAKE_DISABLE 0x0E /* ACPI 3.0 */
1036 #define ACPI_BITPOSITION_SCI_ENABLE 0x00
1037 #define ACPI_BITPOSITION_BUS_MASTER_RLD 0x01
1038 #define ACPI_BITPOSITION_GLOBAL_LOCK_RELEASE 0x02
1039 #define ACPI_BITPOSITION_SLEEP_TYPE 0x0A
1040 #define ACPI_BITPOSITION_SLEEP_ENABLE 0x0D
1042 #define ACPI_BITPOSITION_ARB_DISABLE 0x00
1045 /* Structs and definitions for _OSI support and I/O port validation */
1047 #define ACPI_OSI_WIN_2000 0x01
1048 #define ACPI_OSI_WIN_XP 0x02
1049 #define ACPI_OSI_WIN_XP_SP1 0x03
1050 #define ACPI_OSI_WINSRV_2003 0x04
1051 #define ACPI_OSI_WIN_XP_SP2 0x05
1052 #define ACPI_OSI_WINSRV_2003_SP1 0x06
1053 #define ACPI_OSI_WIN_VISTA 0x07
1054 #define ACPI_OSI_WINSRV_2008 0x08
1055 #define ACPI_OSI_WIN_VISTA_SP1 0x09
1056 #define ACPI_OSI_WIN_VISTA_SP2 0x0A
1057 #define ACPI_OSI_WIN_7 0x0B
1059 #define ACPI_ALWAYS_ILLEGAL 0x00
1061 typedef struct acpi_interface_info
1064 struct acpi_interface_info *Next;
1068 } ACPI_INTERFACE_INFO;
1070 #define ACPI_OSI_INVALID 0x01
1071 #define ACPI_OSI_DYNAMIC 0x02
1073 typedef struct acpi_port_info
1078 UINT8 OsiDependency;
1083 /*****************************************************************************
1085 * Resource descriptors
1087 ****************************************************************************/
1089 /* ResourceType values */
1091 #define ACPI_ADDRESS_TYPE_MEMORY_RANGE 0
1092 #define ACPI_ADDRESS_TYPE_IO_RANGE 1
1093 #define ACPI_ADDRESS_TYPE_BUS_NUMBER_RANGE 2
1095 /* Resource descriptor types and masks */
1097 #define ACPI_RESOURCE_NAME_LARGE 0x80
1098 #define ACPI_RESOURCE_NAME_SMALL 0x00
1100 #define ACPI_RESOURCE_NAME_SMALL_MASK 0x78 /* Bits 6:3 contain the type */
1101 #define ACPI_RESOURCE_NAME_SMALL_LENGTH_MASK 0x07 /* Bits 2:0 contain the length */
1102 #define ACPI_RESOURCE_NAME_LARGE_MASK 0x7F /* Bits 6:0 contain the type */
1106 * Small resource descriptor "names" as defined by the ACPI specification.
1107 * Note: Bits 2:0 are used for the descriptor length
1109 #define ACPI_RESOURCE_NAME_IRQ 0x20
1110 #define ACPI_RESOURCE_NAME_DMA 0x28
1111 #define ACPI_RESOURCE_NAME_START_DEPENDENT 0x30
1112 #define ACPI_RESOURCE_NAME_END_DEPENDENT 0x38
1113 #define ACPI_RESOURCE_NAME_IO 0x40
1114 #define ACPI_RESOURCE_NAME_FIXED_IO 0x48
1115 #define ACPI_RESOURCE_NAME_RESERVED_S1 0x50
1116 #define ACPI_RESOURCE_NAME_RESERVED_S2 0x58
1117 #define ACPI_RESOURCE_NAME_RESERVED_S3 0x60
1118 #define ACPI_RESOURCE_NAME_RESERVED_S4 0x68
1119 #define ACPI_RESOURCE_NAME_VENDOR_SMALL 0x70
1120 #define ACPI_RESOURCE_NAME_END_TAG 0x78
1123 * Large resource descriptor "names" as defined by the ACPI specification.
1124 * Note: includes the Large Descriptor bit in bit[7]
1126 #define ACPI_RESOURCE_NAME_MEMORY24 0x81
1127 #define ACPI_RESOURCE_NAME_GENERIC_REGISTER 0x82
1128 #define ACPI_RESOURCE_NAME_RESERVED_L1 0x83
1129 #define ACPI_RESOURCE_NAME_VENDOR_LARGE 0x84
1130 #define ACPI_RESOURCE_NAME_MEMORY32 0x85
1131 #define ACPI_RESOURCE_NAME_FIXED_MEMORY32 0x86
1132 #define ACPI_RESOURCE_NAME_ADDRESS32 0x87
1133 #define ACPI_RESOURCE_NAME_ADDRESS16 0x88
1134 #define ACPI_RESOURCE_NAME_EXTENDED_IRQ 0x89
1135 #define ACPI_RESOURCE_NAME_ADDRESS64 0x8A
1136 #define ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64 0x8B
1137 #define ACPI_RESOURCE_NAME_LARGE_MAX 0x8B
1140 /*****************************************************************************
1144 ****************************************************************************/
1146 #define ACPI_ASCII_ZERO 0x30
1149 /*****************************************************************************
1153 ****************************************************************************/
1155 typedef struct acpi_external_list
1159 struct acpi_external_list *Next;
1165 } ACPI_EXTERNAL_LIST;
1167 /* Values for Flags field above */
1169 #define ACPI_IPATH_ALLOCATED 0x01
1172 typedef struct acpi_external_file
1175 struct acpi_external_file *Next;
1177 } ACPI_EXTERNAL_FILE;
1180 /*****************************************************************************
1184 ****************************************************************************/
1186 typedef struct acpi_db_method_info
1188 ACPI_HANDLE MainThreadGate;
1189 ACPI_HANDLE ThreadCompleteGate;
1190 ACPI_HANDLE InfoGate;
1191 ACPI_THREAD_ID *Threads;
1194 UINT32 NumCompleted;
1201 ACPI_OBJECT_TYPE *Types;
1204 * Arguments to be passed to method for the command
1206 * the Number of threads, ID of current thread and
1207 * Index of current thread inside all them created.
1210 ACPI_OBJECT_TYPE ArgTypes[4];
1212 char NumThreadsStr[11];
1213 char IdOfThreadStr[11];
1214 char IndexOfThreadStr[11];
1216 } ACPI_DB_METHOD_INFO;
1218 typedef struct acpi_integrity_info
1223 } ACPI_INTEGRITY_INFO;
1226 #define ACPI_DB_REDIRECTABLE_OUTPUT 0x01
1227 #define ACPI_DB_CONSOLE_OUTPUT 0x02
1228 #define ACPI_DB_DUPLICATE_OUTPUT 0x03
1231 /*****************************************************************************
1235 ****************************************************************************/
1237 /* Entry for a memory allocation (debug only) */
1239 #define ACPI_MEM_MALLOC 0
1240 #define ACPI_MEM_CALLOC 1
1241 #define ACPI_MAX_MODULE_NAME 16
1243 #define ACPI_COMMON_DEBUG_MEM_HEADER \
1244 struct acpi_debug_mem_block *Previous; \
1245 struct acpi_debug_mem_block *Next; \
1249 char Module[ACPI_MAX_MODULE_NAME]; \
1252 typedef struct acpi_debug_mem_header
1254 ACPI_COMMON_DEBUG_MEM_HEADER
1256 } ACPI_DEBUG_MEM_HEADER;
1258 typedef struct acpi_debug_mem_block
1260 ACPI_COMMON_DEBUG_MEM_HEADER
1263 } ACPI_DEBUG_MEM_BLOCK;
1266 #define ACPI_MEM_LIST_GLOBAL 0
1267 #define ACPI_MEM_LIST_NSNODE 1
1268 #define ACPI_MEM_LIST_MAX 1
1269 #define ACPI_NUM_MEM_LISTS 2
1272 #endif /* __ACLOCAL_H__ */