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