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