Home | History | Annotate | Line # | Download | only in include
aclocal.h revision 1.5
      1 /******************************************************************************
      2  *
      3  * Name: aclocal.h - Internal data types used across the ACPI subsystem
      4  *
      5  *****************************************************************************/
      6 
      7 /*
      8  * Copyright (C) 2000 - 2013, Intel Corp.
      9  * All rights reserved.
     10  *
     11  * Redistribution and use in source and binary forms, with or without
     12  * modification, are permitted provided that the following conditions
     13  * are met:
     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.
     25  *
     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.
     29  *
     30  * NO WARRANTY
     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.
     42  */
     43 
     44 #ifndef __ACLOCAL_H__
     45 #define __ACLOCAL_H__
     46 
     47 
     48 /* acpisrc:StructDefs -- for acpisrc conversion */
     49 
     50 #define ACPI_SERIALIZED                 0xFF
     51 
     52 typedef UINT32                          ACPI_MUTEX_HANDLE;
     53 #define ACPI_GLOBAL_LOCK                (ACPI_SEMAPHORE) (-1)
     54 
     55 /* Total number of aml opcodes defined */
     56 
     57 #define AML_NUM_OPCODES                 0x81
     58 
     59 
     60 /* Forward declarations */
     61 
     62 struct acpi_walk_state;
     63 struct acpi_obj_mutex;
     64 union acpi_parse_object;
     65 
     66 
     67 /*****************************************************************************
     68  *
     69  * Mutex typedefs and structs
     70  *
     71  ****************************************************************************/
     72 
     73 
     74 /*
     75  * Predefined handles for the mutex objects used within the subsystem
     76  * All mutex objects are automatically created by AcpiUtMutexInitialize.
     77  *
     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.
     80  *
     81  * NOTE: any changes here must be reflected in the AcpiGbl_MutexNames
     82  * table below also!
     83  */
     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 */
     92 
     93 #define ACPI_MAX_MUTEX                  7
     94 #define ACPI_NUM_MUTEX                  ACPI_MAX_MUTEX+1
     95 
     96 /* Lock structure for reader/writer interfaces */
     97 
     98 typedef struct acpi_rw_lock
     99 {
    100     ACPI_MUTEX              WriterMutex;
    101     ACPI_MUTEX              ReaderMutex;
    102     UINT32                  NumReaders;
    103 
    104 } ACPI_RW_LOCK;
    105 
    106 
    107 /*
    108  * Predefined handles for spinlocks used within the subsystem.
    109  * These spinlocks are created by AcpiUtMutexInitialize
    110  */
    111 #define ACPI_LOCK_GPES                  0
    112 #define ACPI_LOCK_HARDWARE              1
    113 
    114 #define ACPI_MAX_LOCK                   1
    115 #define ACPI_NUM_LOCK                   ACPI_MAX_LOCK+1
    116 
    117 
    118 /* This Thread ID means that the mutex is not in use (unlocked) */
    119 
    120 #define ACPI_MUTEX_NOT_ACQUIRED         (ACPI_THREAD_ID) -1
    121 
    122 /* Table for the global mutexes */
    123 
    124 typedef struct acpi_mutex_info
    125 {
    126     ACPI_MUTEX                      Mutex;
    127     UINT32                          UseCount;
    128     ACPI_THREAD_ID                  ThreadId;
    129 
    130 } ACPI_MUTEX_INFO;
    131 
    132 
    133 /* Lock flag parameter for various interfaces */
    134 
    135 #define ACPI_MTX_DO_NOT_LOCK            0
    136 #define ACPI_MTX_LOCK                   1
    137 
    138 
    139 /* Field access granularities */
    140 
    141 #define ACPI_FIELD_BYTE_GRANULARITY     1
    142 #define ACPI_FIELD_WORD_GRANULARITY     2
    143 #define ACPI_FIELD_DWORD_GRANULARITY    4
    144 #define ACPI_FIELD_QWORD_GRANULARITY    8
    145 
    146 
    147 #define ACPI_ENTRY_NOT_FOUND            NULL
    148 
    149 
    150 /*****************************************************************************
    151  *
    152  * Namespace typedefs and structs
    153  *
    154  ****************************************************************************/
    155 
    156 /* Operational modes of the AML interpreter/scanner */
    157 
    158 typedef enum
    159 {
    160     ACPI_IMODE_LOAD_PASS1           = 0x01,
    161     ACPI_IMODE_LOAD_PASS2           = 0x02,
    162     ACPI_IMODE_EXECUTE              = 0x03
    163 
    164 } ACPI_INTERPRETER_MODE;
    165 
    166 
    167 /*
    168  * The Namespace Node describes a named object that appears in the AML.
    169  * DescriptorType is used to differentiate between internal descriptors.
    170  *
    171  * The node is optimized for both 32-bit and 64-bit platforms:
    172  * 20 bytes for the 32-bit case, 32 bytes for the 64-bit case.
    173  *
    174  * Note: The DescriptorType and Type fields must appear in the identical
    175  * position in both the ACPI_NAMESPACE_NODE and ACPI_OPERAND_OBJECT
    176  * structures.
    177  */
    178 typedef struct acpi_namespace_node
    179 {
    180     union acpi_operand_object       *Object;        /* Interpreter object */
    181     UINT8                           DescriptorType; /* Differentiate object descriptor types */
    182     UINT8                           Type;           /* ACPI Type associated with this name */
    183     UINT8                           Flags;          /* Miscellaneous flags */
    184     ACPI_OWNER_ID                   OwnerId;        /* Node creator */
    185     ACPI_NAME_UNION                 Name;           /* ACPI Name, always 4 chars per ACPI spec */
    186     struct acpi_namespace_node      *Parent;        /* Parent node */
    187     struct acpi_namespace_node      *Child;         /* First child */
    188     struct acpi_namespace_node      *Peer;          /* First peer */
    189 
    190     /*
    191      * The following fields are used by the ASL compiler and disassembler only
    192      */
    193 #ifdef ACPI_LARGE_NAMESPACE_NODE
    194     union acpi_parse_object         *Op;
    195     UINT32                          Value;
    196     UINT32                          Length;
    197 #endif
    198 
    199 } ACPI_NAMESPACE_NODE;
    200 
    201 
    202 /* Namespace Node flags */
    203 
    204 #define ANOBJ_RESERVED                  0x01    /* Available for use */
    205 #define ANOBJ_TEMPORARY                 0x02    /* Node is create by a method and is temporary */
    206 #define ANOBJ_METHOD_ARG                0x04    /* Node is a method argument */
    207 #define ANOBJ_METHOD_LOCAL              0x08    /* Node is a method local */
    208 #define ANOBJ_SUBTREE_HAS_INI           0x10    /* Used to optimize device initialization */
    209 #define ANOBJ_EVALUATED                 0x20    /* Set on first evaluation of node */
    210 #define ANOBJ_ALLOCATED_BUFFER          0x40    /* Method AML buffer is dynamic (InstallMethod) */
    211 
    212 #define ANOBJ_IS_EXTERNAL               0x08    /* iASL only: This object created via External() */
    213 #define ANOBJ_METHOD_NO_RETVAL          0x10    /* iASL only: Method has no return value */
    214 #define ANOBJ_METHOD_SOME_NO_RETVAL     0x20    /* iASL only: Method has at least one return value */
    215 #define ANOBJ_IS_REFERENCED             0x80    /* iASL only: Object was referenced */
    216 
    217 
    218 /* Internal ACPI table management - master table list */
    219 
    220 typedef struct acpi_table_list
    221 {
    222     ACPI_TABLE_DESC                 *Tables;            /* Table descriptor array */
    223     UINT32                          CurrentTableCount;  /* Tables currently in the array */
    224     UINT32                          MaxTableCount;      /* Max tables array will hold */
    225     UINT8                           Flags;
    226 
    227 } ACPI_TABLE_LIST;
    228 
    229 /* Flags for above */
    230 
    231 #define ACPI_ROOT_ORIGIN_UNKNOWN        (0)     /* ~ORIGIN_ALLOCATED */
    232 #define ACPI_ROOT_ORIGIN_ALLOCATED      (1)
    233 #define ACPI_ROOT_ALLOW_RESIZE          (2)
    234 
    235 
    236 /* Predefined (fixed) table indexes */
    237 
    238 #define ACPI_TABLE_INDEX_DSDT           (0)
    239 #define ACPI_TABLE_INDEX_FACS           (1)
    240 
    241 
    242 typedef struct acpi_find_context
    243 {
    244     char                            *SearchFor;
    245     ACPI_HANDLE                     *List;
    246     UINT32                          *Count;
    247 
    248 } ACPI_FIND_CONTEXT;
    249 
    250 
    251 typedef struct acpi_ns_search_data
    252 {
    253     ACPI_NAMESPACE_NODE             *Node;
    254 
    255 } ACPI_NS_SEARCH_DATA;
    256 
    257 
    258 /* Object types used during package copies */
    259 
    260 #define ACPI_COPY_TYPE_SIMPLE           0
    261 #define ACPI_COPY_TYPE_PACKAGE          1
    262 
    263 
    264 /* Info structure used to convert external<->internal namestrings */
    265 
    266 typedef struct acpi_namestring_info
    267 {
    268     const char                      *ExternalName;
    269     const char                      *NextExternalChar;
    270     char                            *InternalName;
    271     UINT32                          Length;
    272     UINT32                          NumSegments;
    273     UINT32                          NumCarats;
    274     BOOLEAN                         FullyQualified;
    275 
    276 } ACPI_NAMESTRING_INFO;
    277 
    278 
    279 /* Field creation info */
    280 
    281 typedef struct acpi_create_field_info
    282 {
    283     ACPI_NAMESPACE_NODE             *RegionNode;
    284     ACPI_NAMESPACE_NODE             *FieldNode;
    285     ACPI_NAMESPACE_NODE             *RegisterNode;
    286     ACPI_NAMESPACE_NODE             *DataRegisterNode;
    287     ACPI_NAMESPACE_NODE             *ConnectionNode;
    288     UINT8                           *ResourceBuffer;
    289     UINT32                          BankValue;
    290     UINT32                          FieldBitPosition;
    291     UINT32                          FieldBitLength;
    292     UINT16                          ResourceLength;
    293     UINT8                           FieldFlags;
    294     UINT8                           Attribute;
    295     UINT8                           FieldType;
    296     UINT8                           AccessLength;
    297 
    298 } ACPI_CREATE_FIELD_INFO;
    299 
    300 
    301 typedef
    302 ACPI_STATUS (*ACPI_INTERNAL_METHOD) (
    303     struct acpi_walk_state          *WalkState);
    304 
    305 
    306 /*
    307  * Bitmapped ACPI types. Used internally only
    308  */
    309 #define ACPI_BTYPE_ANY                  0x00000000
    310 #define ACPI_BTYPE_INTEGER              0x00000001
    311 #define ACPI_BTYPE_STRING               0x00000002
    312 #define ACPI_BTYPE_BUFFER               0x00000004
    313 #define ACPI_BTYPE_PACKAGE              0x00000008
    314 #define ACPI_BTYPE_FIELD_UNIT           0x00000010
    315 #define ACPI_BTYPE_DEVICE               0x00000020
    316 #define ACPI_BTYPE_EVENT                0x00000040
    317 #define ACPI_BTYPE_METHOD               0x00000080
    318 #define ACPI_BTYPE_MUTEX                0x00000100
    319 #define ACPI_BTYPE_REGION               0x00000200
    320 #define ACPI_BTYPE_POWER                0x00000400
    321 #define ACPI_BTYPE_PROCESSOR            0x00000800
    322 #define ACPI_BTYPE_THERMAL              0x00001000
    323 #define ACPI_BTYPE_BUFFER_FIELD         0x00002000
    324 #define ACPI_BTYPE_DDB_HANDLE           0x00004000
    325 #define ACPI_BTYPE_DEBUG_OBJECT         0x00008000
    326 #define ACPI_BTYPE_REFERENCE            0x00010000
    327 #define ACPI_BTYPE_RESOURCE             0x00020000
    328 
    329 #define ACPI_BTYPE_COMPUTE_DATA         (ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING | ACPI_BTYPE_BUFFER)
    330 
    331 #define ACPI_BTYPE_DATA                 (ACPI_BTYPE_COMPUTE_DATA  | ACPI_BTYPE_PACKAGE)
    332 #define ACPI_BTYPE_DATA_REFERENCE       (ACPI_BTYPE_DATA | ACPI_BTYPE_REFERENCE | ACPI_BTYPE_DDB_HANDLE)
    333 #define ACPI_BTYPE_DEVICE_OBJECTS       (ACPI_BTYPE_DEVICE | ACPI_BTYPE_THERMAL | ACPI_BTYPE_PROCESSOR)
    334 #define ACPI_BTYPE_OBJECTS_AND_REFS     0x0001FFFF  /* ARG or LOCAL */
    335 #define ACPI_BTYPE_ALL_OBJECTS          0x0000FFFF
    336 
    337 #pragma pack(1)
    338 
    339 /*
    340  * Information structure for ACPI predefined names.
    341  * Each entry in the table contains the following items:
    342  *
    343  * Name                 - The ACPI reserved name
    344  * ParamCount           - Number of arguments to the method
    345  * ExpectedReturnBtypes - Allowed type(s) for the return value
    346  */
    347 typedef struct acpi_name_info
    348 {
    349     char                        Name[ACPI_NAME_SIZE];
    350     UINT16                      ArgumentList;
    351     UINT8                       ExpectedBtypes;
    352 
    353 } ACPI_NAME_INFO;
    354 
    355 /*
    356  * Secondary information structures for ACPI predefined objects that return
    357  * package objects. This structure appears as the next entry in the table
    358  * after the NAME_INFO structure above.
    359  *
    360  * The reason for this is to minimize the size of the predefined name table.
    361  */
    362 
    363 /*
    364  * Used for ACPI_PTYPE1_FIXED, ACPI_PTYPE1_VAR, ACPI_PTYPE2,
    365  * ACPI_PTYPE2_MIN, ACPI_PTYPE2_PKG_COUNT, ACPI_PTYPE2_COUNT,
    366  * ACPI_PTYPE2_FIX_VAR
    367  */
    368 typedef struct acpi_package_info
    369 {
    370     UINT8                       Type;
    371     UINT8                       ObjectType1;
    372     UINT8                       Count1;
    373     UINT8                       ObjectType2;
    374     UINT8                       Count2;
    375     UINT16                      Reserved;
    376 
    377 } ACPI_PACKAGE_INFO;
    378 
    379 /* Used for ACPI_PTYPE2_FIXED */
    380 
    381 typedef struct acpi_package_info2
    382 {
    383     UINT8                       Type;
    384     UINT8                       Count;
    385     UINT8                       ObjectType[4];
    386     UINT8                       Reserved;
    387 
    388 } ACPI_PACKAGE_INFO2;
    389 
    390 /* Used for ACPI_PTYPE1_OPTION */
    391 
    392 typedef struct acpi_package_info3
    393 {
    394     UINT8                       Type;
    395     UINT8                       Count;
    396     UINT8                       ObjectType[2];
    397     UINT8                       TailObjectType;
    398     UINT16                      Reserved;
    399 
    400 } ACPI_PACKAGE_INFO3;
    401 
    402 typedef union acpi_predefined_info
    403 {
    404     ACPI_NAME_INFO              Info;
    405     ACPI_PACKAGE_INFO           RetInfo;
    406     ACPI_PACKAGE_INFO2          RetInfo2;
    407     ACPI_PACKAGE_INFO3          RetInfo3;
    408 
    409 } ACPI_PREDEFINED_INFO;
    410 
    411 /* Reset to default packing */
    412 
    413 #pragma pack()
    414 
    415 
    416 /* Return object auto-repair info */
    417 
    418 typedef ACPI_STATUS (*ACPI_OBJECT_CONVERTER) (
    419     union acpi_operand_object   *OriginalObject,
    420     union acpi_operand_object   **ConvertedObject);
    421 
    422 typedef struct acpi_simple_repair_info
    423 {
    424     char                        Name[ACPI_NAME_SIZE];
    425     UINT32                      UnexpectedBtypes;
    426     UINT32                      PackageIndex;
    427     ACPI_OBJECT_CONVERTER       ObjectConverter;
    428 
    429 } ACPI_SIMPLE_REPAIR_INFO;
    430 
    431 
    432 /*
    433  * Bitmapped return value types
    434  * Note: the actual data types must be contiguous, a loop in nspredef.c
    435  * depends on this.
    436  */
    437 #define ACPI_RTYPE_ANY                  0x00
    438 #define ACPI_RTYPE_NONE                 0x01
    439 #define ACPI_RTYPE_INTEGER              0x02
    440 #define ACPI_RTYPE_STRING               0x04
    441 #define ACPI_RTYPE_BUFFER               0x08
    442 #define ACPI_RTYPE_PACKAGE              0x10
    443 #define ACPI_RTYPE_REFERENCE            0x20
    444 #define ACPI_RTYPE_ALL                  0x3F
    445 
    446 #define ACPI_NUM_RTYPES                 5   /* Number of actual object types */
    447 
    448 
    449 /*****************************************************************************
    450  *
    451  * Event typedefs and structs
    452  *
    453  ****************************************************************************/
    454 
    455 /* Dispatch info for each host-installed SCI handler */
    456 
    457 typedef struct acpi_sci_handler_info
    458 {
    459     struct acpi_sci_handler_info    *Next;
    460     ACPI_SCI_HANDLER                Address;        /* Address of handler */
    461     void                            *Context;       /* Context to be passed to handler */
    462 
    463 } ACPI_SCI_HANDLER_INFO;
    464 
    465 /* Dispatch info for each GPE -- either a method or handler, cannot be both */
    466 
    467 typedef struct acpi_gpe_handler_info
    468 {
    469     ACPI_GPE_HANDLER                Address;        /* Address of handler, if any */
    470     void                            *Context;       /* Context to be passed to handler */
    471     ACPI_NAMESPACE_NODE             *MethodNode;    /* Method node for this GPE level (saved) */
    472     UINT8                           OriginalFlags;  /* Original (pre-handler) GPE info */
    473     BOOLEAN                         OriginallyEnabled; /* True if GPE was originally enabled */
    474 
    475 } ACPI_GPE_HANDLER_INFO;
    476 
    477 /* Notify info for implicit notify, multiple device objects */
    478 
    479 typedef struct acpi_gpe_notify_info
    480 {
    481     ACPI_NAMESPACE_NODE             *DeviceNode;    /* Device to be notified */
    482     struct acpi_gpe_notify_info     *Next;
    483 
    484 } ACPI_GPE_NOTIFY_INFO;
    485 
    486 /*
    487  * GPE dispatch info. At any time, the GPE can have at most one type
    488  * of dispatch - Method, Handler, or Implicit Notify.
    489  */
    490 typedef union acpi_gpe_dispatch_info
    491 {
    492     ACPI_NAMESPACE_NODE             *MethodNode;    /* Method node for this GPE level */
    493     ACPI_GPE_HANDLER_INFO           *Handler;       /* Installed GPE handler */
    494     ACPI_GPE_NOTIFY_INFO            *NotifyList;    /* List of _PRW devices for implicit notifies */
    495 
    496 } ACPI_GPE_DISPATCH_INFO;
    497 
    498 /*
    499  * Information about a GPE, one per each GPE in an array.
    500  * NOTE: Important to keep this struct as small as possible.
    501  */
    502 typedef struct acpi_gpe_event_info
    503 {
    504     union acpi_gpe_dispatch_info    Dispatch;       /* Either Method, Handler, or NotifyList */
    505     struct acpi_gpe_register_info   *RegisterInfo;  /* Backpointer to register info */
    506     UINT8                           Flags;          /* Misc info about this GPE */
    507     UINT8                           GpeNumber;      /* This GPE */
    508     UINT8                           RuntimeCount;   /* References to a run GPE */
    509 
    510 } ACPI_GPE_EVENT_INFO;
    511 
    512 /* Information about a GPE register pair, one per each status/enable pair in an array */
    513 
    514 typedef struct acpi_gpe_register_info
    515 {
    516     ACPI_GENERIC_ADDRESS            StatusAddress;  /* Address of status reg */
    517     ACPI_GENERIC_ADDRESS            EnableAddress;  /* Address of enable reg */
    518     UINT8                           EnableForWake;  /* GPEs to keep enabled when sleeping */
    519     UINT8                           EnableForRun;   /* GPEs to keep enabled when running */
    520     UINT8                           BaseGpeNumber;  /* Base GPE number for this register */
    521 
    522 } ACPI_GPE_REGISTER_INFO;
    523 
    524 /*
    525  * Information about a GPE register block, one per each installed block --
    526  * GPE0, GPE1, and one per each installed GPE Block Device.
    527  */
    528 typedef struct acpi_gpe_block_info
    529 {
    530     ACPI_NAMESPACE_NODE             *Node;
    531     struct acpi_gpe_block_info      *Previous;
    532     struct acpi_gpe_block_info      *Next;
    533     struct acpi_gpe_xrupt_info      *XruptBlock;    /* Backpointer to interrupt block */
    534     ACPI_GPE_REGISTER_INFO          *RegisterInfo;  /* One per GPE register pair */
    535     ACPI_GPE_EVENT_INFO             *EventInfo;     /* One for each GPE */
    536     ACPI_GENERIC_ADDRESS            BlockAddress;   /* Base address of the block */
    537     UINT32                          RegisterCount;  /* Number of register pairs in block */
    538     UINT16                          GpeCount;       /* Number of individual GPEs in block */
    539     UINT8                           BlockBaseNumber;/* Base GPE number for this block */
    540     BOOLEAN                         Initialized;    /* TRUE if this block is initialized */
    541 
    542 } ACPI_GPE_BLOCK_INFO;
    543 
    544 /* Information about GPE interrupt handlers, one per each interrupt level used for GPEs */
    545 
    546 typedef struct acpi_gpe_xrupt_info
    547 {
    548     struct acpi_gpe_xrupt_info      *Previous;
    549     struct acpi_gpe_xrupt_info      *Next;
    550     ACPI_GPE_BLOCK_INFO             *GpeBlockListHead;  /* List of GPE blocks for this xrupt */
    551     UINT32                          InterruptNumber;    /* System interrupt number */
    552 
    553 } ACPI_GPE_XRUPT_INFO;
    554 
    555 typedef struct acpi_gpe_walk_info
    556 {
    557     ACPI_NAMESPACE_NODE             *GpeDevice;
    558     ACPI_GPE_BLOCK_INFO             *GpeBlock;
    559     UINT16                          Count;
    560     ACPI_OWNER_ID                   OwnerId;
    561     BOOLEAN                         ExecuteByOwnerId;
    562 
    563 } ACPI_GPE_WALK_INFO;
    564 
    565 typedef struct acpi_gpe_device_info
    566 {
    567     UINT32                          Index;
    568     UINT32                          NextBlockBaseIndex;
    569     ACPI_STATUS                     Status;
    570     ACPI_NAMESPACE_NODE             *GpeDevice;
    571 
    572 } ACPI_GPE_DEVICE_INFO;
    573 
    574 typedef ACPI_STATUS (*ACPI_GPE_CALLBACK) (
    575     ACPI_GPE_XRUPT_INFO             *GpeXruptInfo,
    576     ACPI_GPE_BLOCK_INFO             *GpeBlock,
    577     void                            *Context);
    578 
    579 
    580 /* Information about each particular fixed event */
    581 
    582 typedef struct acpi_fixed_event_handler
    583 {
    584     ACPI_EVENT_HANDLER              Handler;        /* Address of handler. */
    585     void                            *Context;       /* Context to be passed to handler */
    586 
    587 } ACPI_FIXED_EVENT_HANDLER;
    588 
    589 typedef struct acpi_fixed_event_info
    590 {
    591     UINT8                           StatusRegisterId;
    592     UINT8                           EnableRegisterId;
    593     UINT16                          StatusBitMask;
    594     UINT16                          EnableBitMask;
    595 
    596 } ACPI_FIXED_EVENT_INFO;
    597 
    598 /* Information used during field processing */
    599 
    600 typedef struct acpi_field_info
    601 {
    602     UINT8                           SkipField;
    603     UINT8                           FieldFlag;
    604     UINT32                          PkgLength;
    605 
    606 } ACPI_FIELD_INFO;
    607 
    608 
    609 /*****************************************************************************
    610  *
    611  * Generic "state" object for stacks
    612  *
    613  ****************************************************************************/
    614 
    615 #define ACPI_CONTROL_NORMAL                  0xC0
    616 #define ACPI_CONTROL_CONDITIONAL_EXECUTING   0xC1
    617 #define ACPI_CONTROL_PREDICATE_EXECUTING     0xC2
    618 #define ACPI_CONTROL_PREDICATE_FALSE         0xC3
    619 #define ACPI_CONTROL_PREDICATE_TRUE          0xC4
    620 
    621 
    622 #define ACPI_STATE_COMMON \
    623     void                            *Next; \
    624     UINT8                           DescriptorType; /* To differentiate various internal objs */\
    625     UINT8                           Flags; \
    626     UINT16                          Value; \
    627     UINT16                          State;
    628 
    629     /* There are 2 bytes available here until the next natural alignment boundary */
    630 
    631 typedef struct acpi_common_state
    632 {
    633     ACPI_STATE_COMMON
    634 } ACPI_COMMON_STATE;
    635 
    636 
    637 /*
    638  * Update state - used to traverse complex objects such as packages
    639  */
    640 typedef struct acpi_update_state
    641 {
    642     ACPI_STATE_COMMON
    643     union acpi_operand_object       *Object;
    644 
    645 } ACPI_UPDATE_STATE;
    646 
    647 
    648 /*
    649  * Pkg state - used to traverse nested package structures
    650  */
    651 typedef struct acpi_pkg_state
    652 {
    653     ACPI_STATE_COMMON
    654     UINT16                          Index;
    655     union acpi_operand_object       *SourceObject;
    656     union acpi_operand_object       *DestObject;
    657     struct acpi_walk_state          *WalkState;
    658     void                            *ThisTargetObj;
    659     UINT32                          NumPackages;
    660 
    661 } ACPI_PKG_STATE;
    662 
    663 
    664 /*
    665  * Control state - one per if/else and while constructs.
    666  * Allows nesting of these constructs
    667  */
    668 typedef struct acpi_control_state
    669 {
    670     ACPI_STATE_COMMON
    671     UINT16                          Opcode;
    672     union acpi_parse_object         *PredicateOp;
    673     UINT8                           *AmlPredicateStart;     /* Start of if/while predicate */
    674     UINT8                           *PackageEnd;            /* End of if/while block */
    675     UINT32                          LoopCount;              /* While() loop counter */
    676 
    677 } ACPI_CONTROL_STATE;
    678 
    679 
    680 /*
    681  * Scope state - current scope during namespace lookups
    682  */
    683 typedef struct acpi_scope_state
    684 {
    685     ACPI_STATE_COMMON
    686     ACPI_NAMESPACE_NODE             *Node;
    687 
    688 } ACPI_SCOPE_STATE;
    689 
    690 
    691 typedef struct acpi_pscope_state
    692 {
    693     ACPI_STATE_COMMON
    694     UINT32                          ArgCount;               /* Number of fixed arguments */
    695     union acpi_parse_object         *Op;                    /* Current op being parsed */
    696     UINT8                           *ArgEnd;                /* Current argument end */
    697     UINT8                           *PkgEnd;                /* Current package end */
    698     UINT32                          ArgList;                /* Next argument to parse */
    699 
    700 } ACPI_PSCOPE_STATE;
    701 
    702 
    703 /*
    704  * Thread state - one per thread across multiple walk states. Multiple walk
    705  * states are created when there are nested control methods executing.
    706  */
    707 typedef struct acpi_thread_state
    708 {
    709     ACPI_STATE_COMMON
    710     UINT8                           CurrentSyncLevel;       /* Mutex Sync (nested acquire) level */
    711     struct acpi_walk_state          *WalkStateList;         /* Head of list of WalkStates for this thread */
    712     union acpi_operand_object       *AcquiredMutexList;     /* List of all currently acquired mutexes */
    713     ACPI_THREAD_ID                  ThreadId;               /* Running thread ID */
    714 
    715 } ACPI_THREAD_STATE;
    716 
    717 
    718 /*
    719  * Result values - used to accumulate the results of nested
    720  * AML arguments
    721  */
    722 typedef struct acpi_result_values
    723 {
    724     ACPI_STATE_COMMON
    725     union acpi_operand_object       *ObjDesc [ACPI_RESULTS_FRAME_OBJ_NUM];
    726 
    727 } ACPI_RESULT_VALUES;
    728 
    729 
    730 typedef
    731 ACPI_STATUS (*ACPI_PARSE_DOWNWARDS) (
    732     struct acpi_walk_state          *WalkState,
    733     union acpi_parse_object         **OutOp);
    734 
    735 typedef
    736 ACPI_STATUS (*ACPI_PARSE_UPWARDS) (
    737     struct acpi_walk_state          *WalkState);
    738 
    739 
    740 /* Global handlers for AML Notifies */
    741 
    742 typedef struct acpi_global_notify_handler
    743 {
    744     ACPI_NOTIFY_HANDLER             Handler;
    745     void                            *Context;
    746 
    747 } ACPI_GLOBAL_NOTIFY_HANDLER;
    748 
    749 /*
    750  * Notify info - used to pass info to the deferred notify
    751  * handler/dispatcher.
    752  */
    753 typedef struct acpi_notify_info
    754 {
    755     ACPI_STATE_COMMON
    756     UINT8                           HandlerListId;
    757     ACPI_NAMESPACE_NODE             *Node;
    758     union acpi_operand_object       *HandlerListHead;
    759     ACPI_GLOBAL_NOTIFY_HANDLER      *Global;
    760 
    761 } ACPI_NOTIFY_INFO;
    762 
    763 
    764 /* Generic state is union of structs above */
    765 
    766 typedef union acpi_generic_state
    767 {
    768     ACPI_COMMON_STATE               Common;
    769     ACPI_CONTROL_STATE              Control;
    770     ACPI_UPDATE_STATE               Update;
    771     ACPI_SCOPE_STATE                Scope;
    772     ACPI_PSCOPE_STATE               ParseScope;
    773     ACPI_PKG_STATE                  Pkg;
    774     ACPI_THREAD_STATE               Thread;
    775     ACPI_RESULT_VALUES              Results;
    776     ACPI_NOTIFY_INFO                Notify;
    777 
    778 } ACPI_GENERIC_STATE;
    779 
    780 
    781 /*****************************************************************************
    782  *
    783  * Interpreter typedefs and structs
    784  *
    785  ****************************************************************************/
    786 
    787 typedef
    788 ACPI_STATUS (*ACPI_EXECUTE_OP) (
    789     struct acpi_walk_state          *WalkState);
    790 
    791 /* Address Range info block */
    792 
    793 typedef struct acpi_address_range
    794 {
    795     struct acpi_address_range   *Next;
    796     ACPI_NAMESPACE_NODE         *RegionNode;
    797     ACPI_PHYSICAL_ADDRESS       StartAddress;
    798     ACPI_PHYSICAL_ADDRESS       EndAddress;
    799 
    800 } ACPI_ADDRESS_RANGE;
    801 
    802 
    803 /*****************************************************************************
    804  *
    805  * Parser typedefs and structs
    806  *
    807  ****************************************************************************/
    808 
    809 /*
    810  * AML opcode, name, and argument layout
    811  */
    812 typedef struct acpi_opcode_info
    813 {
    814 #if defined(ACPI_DISASSEMBLER) || defined(ACPI_DEBUG_OUTPUT)
    815     const char                      *Name;          /* Opcode name (disassembler/debug only) */
    816 #endif
    817     UINT32                          ParseArgs;      /* Grammar/Parse time arguments */
    818     UINT32                          RuntimeArgs;    /* Interpret time arguments */
    819     UINT16                          Flags;          /* Misc flags */
    820     UINT8                           ObjectType;     /* Corresponding internal object type */
    821     UINT8                           Class;          /* Opcode class */
    822     UINT8                           Type;           /* Opcode type */
    823 
    824 } ACPI_OPCODE_INFO;
    825 
    826 /* Structure for Resource Tag information */
    827 
    828 typedef struct acpi_tag_info
    829 {
    830     UINT32                          BitOffset;
    831     UINT32                          BitLength;
    832 
    833 } ACPI_TAG_INFO;
    834 
    835 /* Value associated with the parse object */
    836 
    837 typedef union acpi_parse_value
    838 {
    839     UINT64                          Integer;        /* Integer constant (Up to 64 bits) */
    840     UINT32                          Size;           /* bytelist or field size */
    841     char                            *String;        /* NULL terminated string */
    842     UINT8                           *Buffer;        /* buffer or string */
    843     char                            *Name;          /* NULL terminated string */
    844     union acpi_parse_object         *Arg;           /* arguments and contained ops */
    845     ACPI_TAG_INFO                   Tag;            /* Resource descriptor tag info  */
    846 
    847 } ACPI_PARSE_VALUE;
    848 
    849 
    850 #ifdef ACPI_DISASSEMBLER
    851 #define ACPI_DISASM_ONLY_MEMBERS(a)     a;
    852 #else
    853 #define ACPI_DISASM_ONLY_MEMBERS(a)
    854 #endif
    855 
    856 #define ACPI_PARSE_COMMON \
    857     union acpi_parse_object         *Parent;        /* Parent op */\
    858     UINT8                           DescriptorType; /* To differentiate various internal objs */\
    859     UINT8                           Flags;          /* Type of Op */\
    860     UINT16                          AmlOpcode;      /* AML opcode */\
    861     UINT32                          AmlOffset;      /* Offset of declaration in AML */\
    862     union acpi_parse_object         *Next;          /* Next op */\
    863     ACPI_NAMESPACE_NODE             *Node;          /* For use by interpreter */\
    864     ACPI_PARSE_VALUE                Value;          /* Value or args associated with the opcode */\
    865     UINT8                           ArgListLength;  /* Number of elements in the arg list */\
    866     ACPI_DISASM_ONLY_MEMBERS (\
    867     UINT8                           DisasmFlags;    /* Used during AML disassembly */\
    868     UINT8                           DisasmOpcode;   /* Subtype used for disassembly */\
    869     char                            AmlOpName[16])  /* Op name (debug only) */
    870 
    871 
    872 /* Flags for DisasmFlags field  above */
    873 
    874 #define ACPI_DASM_BUFFER                0x00        /* Buffer is a simple data buffer */
    875 #define ACPI_DASM_RESOURCE              0x01        /* Buffer is a Resource Descriptor */
    876 #define ACPI_DASM_STRING                0x02        /* Buffer is a ASCII string */
    877 #define ACPI_DASM_UNICODE               0x03        /* Buffer is a Unicode string */
    878 #define ACPI_DASM_PLD_METHOD            0x04        /* Buffer is a _PLD method bit-packed buffer */
    879 #define ACPI_DASM_EISAID                0x05        /* Integer is an EISAID */
    880 #define ACPI_DASM_MATCHOP               0x06        /* Parent opcode is a Match() operator */
    881 #define ACPI_DASM_LNOT_PREFIX           0x07        /* Start of a LNotEqual (etc.) pair of opcodes */
    882 #define ACPI_DASM_LNOT_SUFFIX           0x08        /* End  of a LNotEqual (etc.) pair of opcodes */
    883 #define ACPI_DASM_IGNORE                0x09        /* Not used at this time */
    884 
    885 /*
    886  * Generic operation (for example:  If, While, Store)
    887  */
    888 typedef struct acpi_parse_obj_common
    889 {
    890     ACPI_PARSE_COMMON
    891 } ACPI_PARSE_OBJ_COMMON;
    892 
    893 
    894 /*
    895  * Extended Op for named ops (Scope, Method, etc.), deferred ops (Methods and OpRegions),
    896  * and bytelists.
    897  */
    898 typedef struct acpi_parse_obj_named
    899 {
    900     ACPI_PARSE_COMMON
    901     UINT8                           *Path;
    902     UINT8                           *Data;          /* AML body or bytelist data */
    903     UINT32                          Length;         /* AML length */
    904     UINT32                          Name;           /* 4-byte name or zero if no name */
    905 
    906 } ACPI_PARSE_OBJ_NAMED;
    907 
    908 
    909 /* This version is used by the iASL compiler only */
    910 
    911 #define ACPI_MAX_PARSEOP_NAME   20
    912 
    913 typedef struct acpi_parse_obj_asl
    914 {
    915     ACPI_PARSE_COMMON
    916     union acpi_parse_object         *Child;
    917     union acpi_parse_object         *ParentMethod;
    918     char                            *Filename;
    919     char                            *ExternalName;
    920     char                            *Namepath;
    921     char                            NameSeg[4];
    922     UINT32                          ExtraValue;
    923     UINT32                          Column;
    924     UINT32                          LineNumber;
    925     UINT32                          LogicalLineNumber;
    926     UINT32                          LogicalByteOffset;
    927     UINT32                          EndLine;
    928     UINT32                          EndLogicalLine;
    929     UINT32                          AcpiBtype;
    930     UINT32                          AmlLength;
    931     UINT32                          AmlSubtreeLength;
    932     UINT32                          FinalAmlLength;
    933     UINT32                          FinalAmlOffset;
    934     UINT32                          CompileFlags;
    935     UINT16                          ParseOpcode;
    936     UINT8                           AmlOpcodeLength;
    937     UINT8                           AmlPkgLenBytes;
    938     UINT8                           Extra;
    939     char                            ParseOpName[ACPI_MAX_PARSEOP_NAME];
    940 
    941 } ACPI_PARSE_OBJ_ASL;
    942 
    943 typedef union acpi_parse_object
    944 {
    945     ACPI_PARSE_OBJ_COMMON           Common;
    946     ACPI_PARSE_OBJ_NAMED            Named;
    947     ACPI_PARSE_OBJ_ASL              Asl;
    948 
    949 } ACPI_PARSE_OBJECT;
    950 
    951 
    952 /*
    953  * Parse state - one state per parser invocation and each control
    954  * method.
    955  */
    956 typedef struct acpi_parse_state
    957 {
    958     UINT8                           *AmlStart;      /* First AML byte */
    959     UINT8                           *Aml;           /* Next AML byte */
    960     UINT8                           *AmlEnd;        /* (last + 1) AML byte */
    961     UINT8                           *PkgStart;      /* Current package begin */
    962     UINT8                           *PkgEnd;        /* Current package end */
    963     union acpi_parse_object         *StartOp;       /* Root of parse tree */
    964     struct acpi_namespace_node      *StartNode;
    965     union acpi_generic_state        *Scope;         /* Current scope */
    966     union acpi_parse_object         *StartScope;
    967     UINT32                          AmlSize;
    968 
    969 } ACPI_PARSE_STATE;
    970 
    971 
    972 /* Parse object flags */
    973 
    974 #define ACPI_PARSEOP_GENERIC            0x01
    975 #define ACPI_PARSEOP_NAMED              0x02
    976 #define ACPI_PARSEOP_DEFERRED           0x04
    977 #define ACPI_PARSEOP_BYTELIST           0x08
    978 #define ACPI_PARSEOP_IN_STACK           0x10
    979 #define ACPI_PARSEOP_TARGET             0x20
    980 #define ACPI_PARSEOP_IN_CACHE           0x80
    981 
    982 /* Parse object DisasmFlags */
    983 
    984 #define ACPI_PARSEOP_IGNORE             0x01
    985 #define ACPI_PARSEOP_PARAMLIST          0x02
    986 #define ACPI_PARSEOP_EMPTY_TERMLIST     0x04
    987 #define ACPI_PARSEOP_PREDEF_CHECKED     0x08
    988 #define ACPI_PARSEOP_SPECIAL            0x10
    989 
    990 
    991 /*****************************************************************************
    992  *
    993  * Hardware (ACPI registers) and PNP
    994  *
    995  ****************************************************************************/
    996 
    997 typedef struct acpi_bit_register_info
    998 {
    999     UINT8                           ParentRegister;
   1000     UINT8                           BitPosition;
   1001     UINT16                          AccessBitMask;
   1002 
   1003 } ACPI_BIT_REGISTER_INFO;
   1004 
   1005 
   1006 /*
   1007  * Some ACPI registers have bits that must be ignored -- meaning that they
   1008  * must be preserved.
   1009  */
   1010 #define ACPI_PM1_STATUS_PRESERVED_BITS          0x0800  /* Bit 11 */
   1011 
   1012 /* Write-only bits must be zeroed by software */
   1013 
   1014 #define ACPI_PM1_CONTROL_WRITEONLY_BITS         0x2004  /* Bits 13, 2 */
   1015 
   1016 /* For control registers, both ignored and reserved bits must be preserved */
   1017 
   1018 /*
   1019  * For PM1 control, the SCI enable bit (bit 0, SCI_EN) is defined by the
   1020  * ACPI specification to be a "preserved" bit - "OSPM always preserves this
   1021  * bit position", section 4.7.3.2.1. However, on some machines the OS must
   1022  * write a one to this bit after resume for the machine to work properly.
   1023  * To enable this, we no longer attempt to preserve this bit. No machines
   1024  * are known to fail if the bit is not preserved. (May 2009)
   1025  */
   1026 #define ACPI_PM1_CONTROL_IGNORED_BITS           0x0200  /* Bit 9 */
   1027 #define ACPI_PM1_CONTROL_RESERVED_BITS          0xC1F8  /* Bits 14-15, 3-8 */
   1028 #define ACPI_PM1_CONTROL_PRESERVED_BITS \
   1029          (ACPI_PM1_CONTROL_IGNORED_BITS | ACPI_PM1_CONTROL_RESERVED_BITS)
   1030 
   1031 #define ACPI_PM2_CONTROL_PRESERVED_BITS         0xFFFFFFFE /* All except bit 0 */
   1032 
   1033 /*
   1034  * Register IDs
   1035  * These are the full ACPI registers
   1036  */
   1037 #define ACPI_REGISTER_PM1_STATUS                0x01
   1038 #define ACPI_REGISTER_PM1_ENABLE                0x02
   1039 #define ACPI_REGISTER_PM1_CONTROL               0x03
   1040 #define ACPI_REGISTER_PM2_CONTROL               0x04
   1041 #define ACPI_REGISTER_PM_TIMER                  0x05
   1042 #define ACPI_REGISTER_PROCESSOR_BLOCK           0x06
   1043 #define ACPI_REGISTER_SMI_COMMAND_BLOCK         0x07
   1044 
   1045 
   1046 /* Masks used to access the BitRegisters */
   1047 
   1048 #define ACPI_BITMASK_TIMER_STATUS               0x0001
   1049 #define ACPI_BITMASK_BUS_MASTER_STATUS          0x0010
   1050 #define ACPI_BITMASK_GLOBAL_LOCK_STATUS         0x0020
   1051 #define ACPI_BITMASK_POWER_BUTTON_STATUS        0x0100
   1052 #define ACPI_BITMASK_SLEEP_BUTTON_STATUS        0x0200
   1053 #define ACPI_BITMASK_RT_CLOCK_STATUS            0x0400
   1054 #define ACPI_BITMASK_PCIEXP_WAKE_STATUS         0x4000    /* ACPI 3.0 */
   1055 #define ACPI_BITMASK_WAKE_STATUS                0x8000
   1056 
   1057 #define ACPI_BITMASK_ALL_FIXED_STATUS           (\
   1058     ACPI_BITMASK_TIMER_STATUS          | \
   1059     ACPI_BITMASK_BUS_MASTER_STATUS     | \
   1060     ACPI_BITMASK_GLOBAL_LOCK_STATUS    | \
   1061     ACPI_BITMASK_POWER_BUTTON_STATUS   | \
   1062     ACPI_BITMASK_SLEEP_BUTTON_STATUS   | \
   1063     ACPI_BITMASK_RT_CLOCK_STATUS       | \
   1064     ACPI_BITMASK_PCIEXP_WAKE_STATUS    | \
   1065     ACPI_BITMASK_WAKE_STATUS)
   1066 
   1067 #define ACPI_BITMASK_TIMER_ENABLE               0x0001
   1068 #define ACPI_BITMASK_GLOBAL_LOCK_ENABLE         0x0020
   1069 #define ACPI_BITMASK_POWER_BUTTON_ENABLE        0x0100
   1070 #define ACPI_BITMASK_SLEEP_BUTTON_ENABLE        0x0200
   1071 #define ACPI_BITMASK_RT_CLOCK_ENABLE            0x0400
   1072 #define ACPI_BITMASK_PCIEXP_WAKE_DISABLE        0x4000    /* ACPI 3.0 */
   1073 
   1074 #define ACPI_BITMASK_SCI_ENABLE                 0x0001
   1075 #define ACPI_BITMASK_BUS_MASTER_RLD             0x0002
   1076 #define ACPI_BITMASK_GLOBAL_LOCK_RELEASE        0x0004
   1077 #define ACPI_BITMASK_SLEEP_TYPE                 0x1C00
   1078 #define ACPI_BITMASK_SLEEP_ENABLE               0x2000
   1079 
   1080 #define ACPI_BITMASK_ARB_DISABLE                0x0001
   1081 
   1082 
   1083 /* Raw bit position of each BitRegister */
   1084 
   1085 #define ACPI_BITPOSITION_TIMER_STATUS           0x00
   1086 #define ACPI_BITPOSITION_BUS_MASTER_STATUS      0x04
   1087 #define ACPI_BITPOSITION_GLOBAL_LOCK_STATUS     0x05
   1088 #define ACPI_BITPOSITION_POWER_BUTTON_STATUS    0x08
   1089 #define ACPI_BITPOSITION_SLEEP_BUTTON_STATUS    0x09
   1090 #define ACPI_BITPOSITION_RT_CLOCK_STATUS        0x0A
   1091 #define ACPI_BITPOSITION_PCIEXP_WAKE_STATUS     0x0E    /* ACPI 3.0 */
   1092 #define ACPI_BITPOSITION_WAKE_STATUS            0x0F
   1093 
   1094 #define ACPI_BITPOSITION_TIMER_ENABLE           0x00
   1095 #define ACPI_BITPOSITION_GLOBAL_LOCK_ENABLE     0x05
   1096 #define ACPI_BITPOSITION_POWER_BUTTON_ENABLE    0x08
   1097 #define ACPI_BITPOSITION_SLEEP_BUTTON_ENABLE    0x09
   1098 #define ACPI_BITPOSITION_RT_CLOCK_ENABLE        0x0A
   1099 #define ACPI_BITPOSITION_PCIEXP_WAKE_DISABLE    0x0E    /* ACPI 3.0 */
   1100 
   1101 #define ACPI_BITPOSITION_SCI_ENABLE             0x00
   1102 #define ACPI_BITPOSITION_BUS_MASTER_RLD         0x01
   1103 #define ACPI_BITPOSITION_GLOBAL_LOCK_RELEASE    0x02
   1104 #define ACPI_BITPOSITION_SLEEP_TYPE             0x0A
   1105 #define ACPI_BITPOSITION_SLEEP_ENABLE           0x0D
   1106 
   1107 #define ACPI_BITPOSITION_ARB_DISABLE            0x00
   1108 
   1109 
   1110 /* Structs and definitions for _OSI support and I/O port validation */
   1111 
   1112 #define ACPI_ALWAYS_ILLEGAL             0x00
   1113 
   1114 typedef struct acpi_interface_info
   1115 {
   1116     char                        *Name;
   1117     struct acpi_interface_info  *Next;
   1118     UINT8                       Flags;
   1119     UINT8                       Value;
   1120 
   1121 } ACPI_INTERFACE_INFO;
   1122 
   1123 #define ACPI_OSI_INVALID                0x01
   1124 #define ACPI_OSI_DYNAMIC                0x02
   1125 #define ACPI_OSI_FEATURE                0x04
   1126 #define ACPI_OSI_DEFAULT_INVALID        0x08
   1127 #define ACPI_OSI_OPTIONAL_FEATURE       (ACPI_OSI_FEATURE | ACPI_OSI_DEFAULT_INVALID | ACPI_OSI_INVALID)
   1128 
   1129 typedef struct acpi_port_info
   1130 {
   1131     const char              *Name;
   1132     UINT16                  Start;
   1133     UINT16                  End;
   1134     UINT8                   OsiDependency;
   1135 
   1136 } ACPI_PORT_INFO;
   1137 
   1138 
   1139 /*****************************************************************************
   1140  *
   1141  * Resource descriptors
   1142  *
   1143  ****************************************************************************/
   1144 
   1145 /* ResourceType values */
   1146 
   1147 #define ACPI_ADDRESS_TYPE_MEMORY_RANGE          0
   1148 #define ACPI_ADDRESS_TYPE_IO_RANGE              1
   1149 #define ACPI_ADDRESS_TYPE_BUS_NUMBER_RANGE      2
   1150 
   1151 /* Resource descriptor types and masks */
   1152 
   1153 #define ACPI_RESOURCE_NAME_LARGE                0x80
   1154 #define ACPI_RESOURCE_NAME_SMALL                0x00
   1155 
   1156 #define ACPI_RESOURCE_NAME_SMALL_MASK           0x78 /* Bits 6:3 contain the type */
   1157 #define ACPI_RESOURCE_NAME_SMALL_LENGTH_MASK    0x07 /* Bits 2:0 contain the length */
   1158 #define ACPI_RESOURCE_NAME_LARGE_MASK           0x7F /* Bits 6:0 contain the type */
   1159 
   1160 
   1161 /*
   1162  * Small resource descriptor "names" as defined by the ACPI specification.
   1163  * Note: Bits 2:0 are used for the descriptor length
   1164  */
   1165 #define ACPI_RESOURCE_NAME_IRQ                  0x20
   1166 #define ACPI_RESOURCE_NAME_DMA                  0x28
   1167 #define ACPI_RESOURCE_NAME_START_DEPENDENT      0x30
   1168 #define ACPI_RESOURCE_NAME_END_DEPENDENT        0x38
   1169 #define ACPI_RESOURCE_NAME_IO                   0x40
   1170 #define ACPI_RESOURCE_NAME_FIXED_IO             0x48
   1171 #define ACPI_RESOURCE_NAME_FIXED_DMA            0x50
   1172 #define ACPI_RESOURCE_NAME_RESERVED_S2          0x58
   1173 #define ACPI_RESOURCE_NAME_RESERVED_S3          0x60
   1174 #define ACPI_RESOURCE_NAME_RESERVED_S4          0x68
   1175 #define ACPI_RESOURCE_NAME_VENDOR_SMALL         0x70
   1176 #define ACPI_RESOURCE_NAME_END_TAG              0x78
   1177 
   1178 /*
   1179  * Large resource descriptor "names" as defined by the ACPI specification.
   1180  * Note: includes the Large Descriptor bit in bit[7]
   1181  */
   1182 #define ACPI_RESOURCE_NAME_MEMORY24             0x81
   1183 #define ACPI_RESOURCE_NAME_GENERIC_REGISTER     0x82
   1184 #define ACPI_RESOURCE_NAME_RESERVED_L1          0x83
   1185 #define ACPI_RESOURCE_NAME_VENDOR_LARGE         0x84
   1186 #define ACPI_RESOURCE_NAME_MEMORY32             0x85
   1187 #define ACPI_RESOURCE_NAME_FIXED_MEMORY32       0x86
   1188 #define ACPI_RESOURCE_NAME_ADDRESS32            0x87
   1189 #define ACPI_RESOURCE_NAME_ADDRESS16            0x88
   1190 #define ACPI_RESOURCE_NAME_EXTENDED_IRQ         0x89
   1191 #define ACPI_RESOURCE_NAME_ADDRESS64            0x8A
   1192 #define ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64   0x8B
   1193 #define ACPI_RESOURCE_NAME_GPIO                 0x8C
   1194 #define ACPI_RESOURCE_NAME_SERIAL_BUS           0x8E
   1195 #define ACPI_RESOURCE_NAME_LARGE_MAX            0x8E
   1196 
   1197 
   1198 /*****************************************************************************
   1199  *
   1200  * Miscellaneous
   1201  *
   1202  ****************************************************************************/
   1203 
   1204 #define ACPI_ASCII_ZERO                 0x30
   1205 
   1206 
   1207 /*****************************************************************************
   1208  *
   1209  * Disassembler
   1210  *
   1211  ****************************************************************************/
   1212 
   1213 typedef struct acpi_external_list
   1214 {
   1215     char                        *Path;
   1216     char                        *InternalPath;
   1217     struct acpi_external_list   *Next;
   1218     UINT32                      Value;
   1219     UINT16                      Length;
   1220     UINT16                      Flags;
   1221     UINT8                       Type;
   1222 
   1223 } ACPI_EXTERNAL_LIST;
   1224 
   1225 /* Values for Flags field above */
   1226 
   1227 #define ACPI_EXT_RESOLVED_REFERENCE         0x01    /* Object was resolved during cross ref */
   1228 #define ACPI_EXT_ORIGIN_FROM_FILE           0x02    /* External came from a file */
   1229 #define ACPI_EXT_INTERNAL_PATH_ALLOCATED    0x04    /* Deallocate internal path on completion */
   1230 #define ACPI_EXT_EXTERNAL_EMITTED           0x08    /* External() statement has been emitted */
   1231 
   1232 
   1233 typedef struct acpi_external_file
   1234 {
   1235     char                        *Path;
   1236     struct acpi_external_file   *Next;
   1237 
   1238 } ACPI_EXTERNAL_FILE;
   1239 
   1240 
   1241 /*****************************************************************************
   1242  *
   1243  * Debugger
   1244  *
   1245  ****************************************************************************/
   1246 
   1247 typedef struct acpi_db_method_info
   1248 {
   1249     ACPI_HANDLE                     Method;
   1250     ACPI_HANDLE                     MainThreadGate;
   1251     ACPI_HANDLE                     ThreadCompleteGate;
   1252     ACPI_HANDLE                     InfoGate;
   1253     ACPI_THREAD_ID                  *Threads;
   1254     UINT32                          NumThreads;
   1255     UINT32                          NumCreated;
   1256     UINT32                          NumCompleted;
   1257 
   1258     char                            *Name;
   1259     UINT32                          Flags;
   1260     UINT32                          NumLoops;
   1261     char                            Pathname[ACPI_DB_LINE_BUFFER_SIZE];
   1262     char                            **Args;
   1263     ACPI_OBJECT_TYPE                *Types;
   1264 
   1265     /*
   1266      * Arguments to be passed to method for the command
   1267      * Threads -
   1268      *   the Number of threads, ID of current thread and
   1269      *   Index of current thread inside all them created.
   1270      */
   1271     char                            InitArgs;
   1272     ACPI_OBJECT_TYPE                ArgTypes[4];
   1273     char                            *Arguments[4];
   1274     char                            NumThreadsStr[11];
   1275     char                            IdOfThreadStr[11];
   1276     char                            IndexOfThreadStr[11];
   1277 
   1278 } ACPI_DB_METHOD_INFO;
   1279 
   1280 typedef struct acpi_integrity_info
   1281 {
   1282     UINT32                          Nodes;
   1283     UINT32                          Objects;
   1284 
   1285 } ACPI_INTEGRITY_INFO;
   1286 
   1287 
   1288 #define ACPI_DB_DISABLE_OUTPUT          0x00
   1289 #define ACPI_DB_REDIRECTABLE_OUTPUT     0x01
   1290 #define ACPI_DB_CONSOLE_OUTPUT          0x02
   1291 #define ACPI_DB_DUPLICATE_OUTPUT        0x03
   1292 
   1293 
   1294 /*****************************************************************************
   1295  *
   1296  * Debug
   1297  *
   1298  ****************************************************************************/
   1299 
   1300 /* Entry for a memory allocation (debug only) */
   1301 
   1302 #define ACPI_MEM_MALLOC                 0
   1303 #define ACPI_MEM_CALLOC                 1
   1304 #define ACPI_MAX_MODULE_NAME            16
   1305 
   1306 #define ACPI_COMMON_DEBUG_MEM_HEADER \
   1307     struct acpi_debug_mem_block     *Previous; \
   1308     struct acpi_debug_mem_block     *Next; \
   1309     UINT32                          Size; \
   1310     UINT32                          Component; \
   1311     UINT32                          Line; \
   1312     char                            Module[ACPI_MAX_MODULE_NAME]; \
   1313     UINT8                           AllocType;
   1314 
   1315 typedef struct acpi_debug_mem_header
   1316 {
   1317     ACPI_COMMON_DEBUG_MEM_HEADER
   1318 
   1319 } ACPI_DEBUG_MEM_HEADER;
   1320 
   1321 typedef struct acpi_debug_mem_block
   1322 {
   1323     ACPI_COMMON_DEBUG_MEM_HEADER
   1324     UINT64                          UserSpace;
   1325 
   1326 } ACPI_DEBUG_MEM_BLOCK;
   1327 
   1328 
   1329 #define ACPI_MEM_LIST_GLOBAL            0
   1330 #define ACPI_MEM_LIST_NSNODE            1
   1331 #define ACPI_MEM_LIST_MAX               1
   1332 #define ACPI_NUM_MEM_LISTS              2
   1333 
   1334 
   1335 /*****************************************************************************
   1336  *
   1337  * Info/help support
   1338  *
   1339  ****************************************************************************/
   1340 
   1341 typedef struct ah_predefined_name
   1342 {
   1343     char            *Name;
   1344     char            *Description;
   1345 #ifndef ACPI_ASL_COMPILER
   1346     char            *Action;
   1347 #endif
   1348 
   1349 } AH_PREDEFINED_NAME;
   1350 
   1351 #endif /* __ACLOCAL_H__ */
   1352