Path: blob/main/sys/contrib/dev/acpica/include/aclocal.h
48286 views
/******************************************************************************1*2* Name: aclocal.h - Internal data types used across the ACPI subsystem3*4*****************************************************************************/56/******************************************************************************7*8* 1. Copyright Notice9*10* Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp.11* All rights reserved.12*13* 2. License14*15* 2.1. This is your license from Intel Corp. under its intellectual property16* rights. You may have additional license terms from the party that provided17* you this software, covering your right to use that party's intellectual18* property rights.19*20* 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a21* copy of the source code appearing in this file ("Covered Code") an22* irrevocable, perpetual, worldwide license under Intel's copyrights in the23* base code distributed originally by Intel ("Original Intel Code") to copy,24* make derivatives, distribute, use and display any portion of the Covered25* Code in any form, with the right to sublicense such rights; and26*27* 2.3. Intel grants Licensee a non-exclusive and non-transferable patent28* license (with the right to sublicense), under only those claims of Intel29* patents that are infringed by the Original Intel Code, to make, use, sell,30* offer to sell, and import the Covered Code and derivative works thereof31* solely to the minimum extent necessary to exercise the above copyright32* license, and in no event shall the patent license extend to any additions33* to or modifications of the Original Intel Code. No other license or right34* is granted directly or by implication, estoppel or otherwise;35*36* The above copyright and patent license is granted only if the following37* conditions are met:38*39* 3. Conditions40*41* 3.1. Redistribution of Source with Rights to Further Distribute Source.42* Redistribution of source code of any substantial portion of the Covered43* Code or modification with rights to further distribute source must include44* the above Copyright Notice, the above License, this list of Conditions,45* and the following Disclaimer and Export Compliance provision. In addition,46* Licensee must cause all Covered Code to which Licensee contributes to47* contain a file documenting the changes Licensee made to create that Covered48* Code and the date of any change. Licensee must include in that file the49* documentation of any changes made by any predecessor Licensee. Licensee50* must include a prominent statement that the modification is derived,51* directly or indirectly, from Original Intel Code.52*53* 3.2. Redistribution of Source with no Rights to Further Distribute Source.54* Redistribution of source code of any substantial portion of the Covered55* Code or modification without rights to further distribute source must56* include the following Disclaimer and Export Compliance provision in the57* documentation and/or other materials provided with distribution. In58* addition, Licensee may not authorize further sublicense of source of any59* portion of the Covered Code, and must include terms to the effect that the60* license from Licensee to its licensee is limited to the intellectual61* property embodied in the software Licensee provides to its licensee, and62* not to intellectual property embodied in modifications its licensee may63* make.64*65* 3.3. Redistribution of Executable. Redistribution in executable form of any66* substantial portion of the Covered Code or modification must reproduce the67* above Copyright Notice, and the following Disclaimer and Export Compliance68* provision in the documentation and/or other materials provided with the69* distribution.70*71* 3.4. Intel retains all right, title, and interest in and to the Original72* Intel Code.73*74* 3.5. Neither the name Intel nor any other trademark owned or controlled by75* Intel shall be used in advertising or otherwise to promote the sale, use or76* other dealings in products derived from or relating to the Covered Code77* without prior written authorization from Intel.78*79* 4. Disclaimer and Export Compliance80*81* 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED82* HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE83* IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,84* INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY85* UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY86* IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A87* PARTICULAR PURPOSE.88*89* 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES90* OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR91* COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,92* SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY93* CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL94* HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS95* SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY96* LIMITED REMEDY.97*98* 4.3. Licensee shall not export, either directly or indirectly, any of this99* software or system incorporating such software without first obtaining any100* required license or other approval from the U. S. Department of Commerce or101* any other agency or department of the United States Government. In the102* event Licensee exports any such software from the United States or103* re-exports any such software from a foreign destination, Licensee shall104* ensure that the distribution and export/re-export of the software is in105* compliance with all laws, regulations, orders, or other restrictions of the106* U.S. Export Administration Regulations. Licensee agrees that neither it nor107* any of its subsidiaries will export/re-export any technical data, process,108* software, or service, directly or indirectly, to any country for which the109* United States government or any agency thereof requires an export license,110* other governmental approval, or letter of assurance, without first obtaining111* such license, approval or letter.112*113*****************************************************************************114*115* Alternatively, you may choose to be licensed under the terms of the116* following license:117*118* Redistribution and use in source and binary forms, with or without119* modification, are permitted provided that the following conditions120* are met:121* 1. Redistributions of source code must retain the above copyright122* notice, this list of conditions, and the following disclaimer,123* without modification.124* 2. Redistributions in binary form must reproduce at minimum a disclaimer125* substantially similar to the "NO WARRANTY" disclaimer below126* ("Disclaimer") and any redistribution must be conditioned upon127* including a substantially similar Disclaimer requirement for further128* binary redistribution.129* 3. Neither the names of the above-listed copyright holders nor the names130* of any contributors may be used to endorse or promote products derived131* from this software without specific prior written permission.132*133* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS134* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT135* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR136* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT137* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,138* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT139* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,140* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY141* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT142* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE143* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.144*145* Alternatively, you may choose to be licensed under the terms of the146* GNU General Public License ("GPL") version 2 as published by the Free147* Software Foundation.148*149*****************************************************************************/150151#ifndef __ACLOCAL_H__152#define __ACLOCAL_H__153154155/* acpisrc:StructDefs -- for acpisrc conversion */156157#define ACPI_SERIALIZED 0xFF158159typedef UINT32 ACPI_MUTEX_HANDLE;160#define ACPI_GLOBAL_LOCK (ACPI_SEMAPHORE) (-1)161162/* Total number of aml opcodes defined */163164#define AML_NUM_OPCODES 0x83165166167/* Forward declarations */168169struct acpi_walk_state;170struct acpi_obj_mutex;171union acpi_parse_object;172173174/*****************************************************************************175*176* Mutex typedefs and structs177*178****************************************************************************/179180181/*182* Predefined handles for the mutex objects used within the subsystem183* All mutex objects are automatically created by AcpiUtMutexInitialize.184*185* The acquire/release ordering protocol is implied via this list. Mutexes186* with a lower value must be acquired before mutexes with a higher value.187*188* NOTE: any changes here must be reflected in the AcpiGbl_MutexNames189* table below also!190*/191#define ACPI_MTX_INTERPRETER 0 /* AML Interpreter, main lock */192#define ACPI_MTX_NAMESPACE 1 /* ACPI Namespace */193#define ACPI_MTX_TABLES 2 /* Data for ACPI tables */194#define ACPI_MTX_EVENTS 3 /* Data for ACPI events */195#define ACPI_MTX_CACHES 4 /* Internal caches, general purposes */196#define ACPI_MTX_MEMORY 5 /* Debug memory tracking lists */197198#define ACPI_MAX_MUTEX 5199#define ACPI_NUM_MUTEX (ACPI_MAX_MUTEX+1)200201202/* Lock structure for reader/writer interfaces */203204typedef struct acpi_rw_lock205{206ACPI_MUTEX WriterMutex;207ACPI_MUTEX ReaderMutex;208UINT32 NumReaders;209210} ACPI_RW_LOCK;211212213/*214* Predefined handles for spinlocks used within the subsystem.215* These spinlocks are created by AcpiUtMutexInitialize216*/217#define ACPI_LOCK_GPES 0218#define ACPI_LOCK_HARDWARE 1219220#define ACPI_MAX_LOCK 1221#define ACPI_NUM_LOCK (ACPI_MAX_LOCK+1)222223224/* This Thread ID means that the mutex is not in use (unlocked) */225226#define ACPI_MUTEX_NOT_ACQUIRED ((ACPI_THREAD_ID) -1)227228/* This Thread ID means an invalid thread ID */229230#ifdef ACPI_OS_INVALID_THREAD_ID231#define ACPI_INVALID_THREAD_ID ACPI_OS_INVALID_THREAD_ID232#else233#define ACPI_INVALID_THREAD_ID ((ACPI_THREAD_ID) 0xFFFFFFFF)234#endif235236/* Table for the global mutexes */237238typedef struct acpi_mutex_info239{240ACPI_MUTEX Mutex;241UINT32 UseCount;242ACPI_THREAD_ID ThreadId;243244} ACPI_MUTEX_INFO;245246247/* Lock flag parameter for various interfaces */248249#define ACPI_MTX_DO_NOT_LOCK 0250#define ACPI_MTX_LOCK 1251252253/* Field access granularities */254255#define ACPI_FIELD_BYTE_GRANULARITY 1256#define ACPI_FIELD_WORD_GRANULARITY 2257#define ACPI_FIELD_DWORD_GRANULARITY 4258#define ACPI_FIELD_QWORD_GRANULARITY 8259260261#define ACPI_ENTRY_NOT_FOUND NULL262263264/*****************************************************************************265*266* Namespace typedefs and structs267*268****************************************************************************/269270/* Operational modes of the AML interpreter/scanner */271272typedef enum273{274ACPI_IMODE_LOAD_PASS1 = 0x01,275ACPI_IMODE_LOAD_PASS2 = 0x02,276ACPI_IMODE_EXECUTE = 0x03277278} ACPI_INTERPRETER_MODE;279280281/*282* The Namespace Node describes a named object that appears in the AML.283* DescriptorType is used to differentiate between internal descriptors.284*285* The node is optimized for both 32-bit and 64-bit platforms:286* 20 bytes for the 32-bit case, 32 bytes for the 64-bit case.287*288* Note: The DescriptorType and Type fields must appear in the identical289* position in both the ACPI_NAMESPACE_NODE and ACPI_OPERAND_OBJECT290* structures.291*/292typedef struct acpi_namespace_node293{294union acpi_operand_object *Object; /* Interpreter object */295UINT8 DescriptorType; /* Differentiate object descriptor types */296UINT8 Type; /* ACPI Type associated with this name */297UINT16 Flags; /* Miscellaneous flags */298ACPI_NAME_UNION Name; /* ACPI Name, always 4 chars per ACPI spec */299struct acpi_namespace_node *Parent; /* Parent node */300struct acpi_namespace_node *Child; /* First child */301struct acpi_namespace_node *Peer; /* First peer */302ACPI_OWNER_ID OwnerId; /* Node creator */303304/*305* The following fields are used by the ASL compiler and disassembler only306*/307#ifdef ACPI_LARGE_NAMESPACE_NODE308union acpi_parse_object *Op;309void *MethodLocals;310void *MethodArgs;311UINT32 Value;312UINT32 Length;313UINT8 ArgCount;314315#endif316317} ACPI_NAMESPACE_NODE;318319320/* Namespace Node flags */321322#define ANOBJ_RESERVED 0x01 /* Available for use */323#define ANOBJ_TEMPORARY 0x02 /* Node is create by a method and is temporary */324#define ANOBJ_METHOD_ARG 0x04 /* Node is a method argument */325#define ANOBJ_METHOD_LOCAL 0x08 /* Node is a method local */326#define ANOBJ_SUBTREE_HAS_INI 0x10 /* Used to optimize device initialization */327#define ANOBJ_EVALUATED 0x20 /* Set on first evaluation of node */328#define ANOBJ_ALLOCATED_BUFFER 0x40 /* Method AML buffer is dynamic (InstallMethod) */329#define ANOBJ_NODE_EARLY_INIT 0x80 /* AcpiExec only: Node was create via init file (-fi) */330331#define ANOBJ_IS_EXTERNAL 0x08 /* iASL only: This object created via External() */332#define ANOBJ_METHOD_NO_RETVAL 0x10 /* iASL only: Method has no return value */333#define ANOBJ_METHOD_SOME_NO_RETVAL 0x20 /* iASL only: Method has at least one return value */334#define ANOBJ_IS_REFERENCED 0x80 /* iASL only: Object was referenced */335336337/* Internal ACPI table management - master table list */338339typedef struct acpi_table_list340{341ACPI_TABLE_DESC *Tables; /* Table descriptor array */342UINT32 CurrentTableCount; /* Tables currently in the array */343UINT32 MaxTableCount; /* Max tables array will hold */344UINT8 Flags;345346} ACPI_TABLE_LIST;347348/* Flags for above */349350#define ACPI_ROOT_ORIGIN_UNKNOWN (0) /* ~ORIGIN_ALLOCATED */351#define ACPI_ROOT_ORIGIN_ALLOCATED (1)352#define ACPI_ROOT_ALLOW_RESIZE (2)353354355/* List to manage incoming ACPI tables */356357typedef struct acpi_new_table_desc358{359ACPI_TABLE_HEADER *Table;360struct acpi_new_table_desc *Next;361362} ACPI_NEW_TABLE_DESC;363364365/* Predefined table indexes */366367#define ACPI_INVALID_TABLE_INDEX (0xFFFFFFFF)368369370typedef struct acpi_find_context371{372char *SearchFor;373ACPI_HANDLE *List;374UINT32 *Count;375376} ACPI_FIND_CONTEXT;377378379typedef struct acpi_ns_search_data380{381ACPI_NAMESPACE_NODE *Node;382383} ACPI_NS_SEARCH_DATA;384385386/* Object types used during package copies */387388#define ACPI_COPY_TYPE_SIMPLE 0389#define ACPI_COPY_TYPE_PACKAGE 1390391392/* Info structure used to convert external<->internal namestrings */393394typedef struct acpi_namestring_info395{396const char *ExternalName;397const char *NextExternalChar;398char *InternalName;399UINT32 Length;400UINT32 NumSegments;401UINT32 NumCarats;402BOOLEAN FullyQualified;403404} ACPI_NAMESTRING_INFO;405406407/* Field creation info */408409typedef struct acpi_create_field_info410{411ACPI_NAMESPACE_NODE *RegionNode;412ACPI_NAMESPACE_NODE *FieldNode;413ACPI_NAMESPACE_NODE *RegisterNode;414ACPI_NAMESPACE_NODE *DataRegisterNode;415ACPI_NAMESPACE_NODE *ConnectionNode;416UINT8 *ResourceBuffer;417UINT32 BankValue;418UINT32 FieldBitPosition;419UINT32 FieldBitLength;420UINT16 ResourceLength;421UINT16 PinNumberIndex;422UINT8 FieldFlags;423UINT8 Attribute;424UINT8 FieldType;425UINT8 AccessLength;426427} ACPI_CREATE_FIELD_INFO;428429430typedef431ACPI_STATUS (*ACPI_INTERNAL_METHOD) (432struct acpi_walk_state *WalkState);433434435/*436* Bitmapped ACPI types. Used internally only437*/438#define ACPI_BTYPE_ANY 0x00000000439#define ACPI_BTYPE_INTEGER 0x00000001440#define ACPI_BTYPE_STRING 0x00000002441#define ACPI_BTYPE_BUFFER 0x00000004442#define ACPI_BTYPE_PACKAGE 0x00000008443#define ACPI_BTYPE_FIELD_UNIT 0x00000010444#define ACPI_BTYPE_DEVICE 0x00000020445#define ACPI_BTYPE_EVENT 0x00000040446#define ACPI_BTYPE_METHOD 0x00000080447#define ACPI_BTYPE_MUTEX 0x00000100448#define ACPI_BTYPE_REGION 0x00000200449#define ACPI_BTYPE_POWER 0x00000400450#define ACPI_BTYPE_PROCESSOR 0x00000800451#define ACPI_BTYPE_THERMAL 0x00001000452#define ACPI_BTYPE_BUFFER_FIELD 0x00002000453#define ACPI_BTYPE_DDB_HANDLE 0x00004000454#define ACPI_BTYPE_DEBUG_OBJECT 0x00008000455#define ACPI_BTYPE_REFERENCE_OBJECT 0x00010000 /* From Index(), RefOf(), etc (Type6Opcodes) */456#define ACPI_BTYPE_RESOURCE 0x00020000457#define ACPI_BTYPE_NAMED_REFERENCE 0x00040000 /* Generic unresolved Name or Namepath */458459#define ACPI_BTYPE_COMPUTE_DATA (ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING | ACPI_BTYPE_BUFFER)460461#define ACPI_BTYPE_DATA (ACPI_BTYPE_COMPUTE_DATA | ACPI_BTYPE_PACKAGE)462463/* Used by Copy, DeRefOf, Store, Printf, Fprintf */464465#define ACPI_BTYPE_DATA_REFERENCE (ACPI_BTYPE_DATA | ACPI_BTYPE_REFERENCE_OBJECT | ACPI_BTYPE_DDB_HANDLE)466#define ACPI_BTYPE_DEVICE_OBJECTS (ACPI_BTYPE_DEVICE | ACPI_BTYPE_THERMAL | ACPI_BTYPE_PROCESSOR)467#define ACPI_BTYPE_OBJECTS_AND_REFS 0x0001FFFF /* ARG or LOCAL */468#define ACPI_BTYPE_ALL_OBJECTS 0x0000FFFF469470#pragma pack(1)471472/*473* Information structure for ACPI predefined names.474* Each entry in the table contains the following items:475*476* Name - The ACPI reserved name477* ParamCount - Number of arguments to the method478* ExpectedReturnBtypes - Allowed type(s) for the return value479*/480typedef struct acpi_name_info481{482char Name[ACPI_NAMESEG_SIZE] ACPI_NONSTRING;483UINT16 ArgumentList;484UINT8 ExpectedBtypes;485486} ACPI_NAME_INFO;487488/*489* Secondary information structures for ACPI predefined objects that return490* package objects. This structure appears as the next entry in the table491* after the NAME_INFO structure above.492*493* The reason for this is to minimize the size of the predefined name table.494*/495496/*497* Used for ACPI_PTYPE1_FIXED, ACPI_PTYPE1_VAR, ACPI_PTYPE2,498* ACPI_PTYPE2_MIN, ACPI_PTYPE2_PKG_COUNT, ACPI_PTYPE2_COUNT,499* ACPI_PTYPE2_FIX_VAR500*/501typedef struct acpi_package_info502{503UINT8 Type;504UINT8 ObjectType1;505UINT8 Count1;506UINT8 ObjectType2;507UINT8 Count2;508UINT16 Reserved;509510} ACPI_PACKAGE_INFO;511512/* Used for ACPI_PTYPE2_FIXED */513514typedef struct acpi_package_info2515{516UINT8 Type;517UINT8 Count;518UINT8 ObjectType[4];519UINT8 Reserved;520521} ACPI_PACKAGE_INFO2;522523/* Used for ACPI_PTYPE1_OPTION */524525typedef struct acpi_package_info3526{527UINT8 Type;528UINT8 Count;529UINT8 ObjectType[2];530UINT8 TailObjectType;531UINT16 Reserved;532533} ACPI_PACKAGE_INFO3;534535typedef struct acpi_package_info4536{537UINT8 Type;538UINT8 ObjectType1;539UINT8 Count1;540UINT8 SubObjectTypes;541UINT8 PkgCount;542UINT16 Reserved;543544} ACPI_PACKAGE_INFO4;545546typedef union acpi_predefined_info547{548ACPI_NAME_INFO Info;549ACPI_PACKAGE_INFO RetInfo;550ACPI_PACKAGE_INFO2 RetInfo2;551ACPI_PACKAGE_INFO3 RetInfo3;552ACPI_PACKAGE_INFO4 RetInfo4;553554} ACPI_PREDEFINED_INFO;555556/* Reset to default packing */557558#pragma pack()559560561/* Return object auto-repair info */562563typedef ACPI_STATUS (*ACPI_OBJECT_CONVERTER) (564struct acpi_namespace_node *Scope,565union acpi_operand_object *OriginalObject,566union acpi_operand_object **ConvertedObject);567568typedef struct acpi_simple_repair_info569{570char Name[ACPI_NAMESEG_SIZE] ACPI_NONSTRING;571UINT32 UnexpectedBtypes;572UINT32 PackageIndex;573ACPI_OBJECT_CONVERTER ObjectConverter;574575} ACPI_SIMPLE_REPAIR_INFO;576577578/*579* Bitmapped return value types580* Note: the actual data types must be contiguous, a loop in nspredef.c581* depends on this.582*/583#define ACPI_RTYPE_ANY 0x00584#define ACPI_RTYPE_NONE 0x01585#define ACPI_RTYPE_INTEGER 0x02586#define ACPI_RTYPE_STRING 0x04587#define ACPI_RTYPE_BUFFER 0x08588#define ACPI_RTYPE_PACKAGE 0x10589#define ACPI_RTYPE_REFERENCE 0x20590#define ACPI_RTYPE_ALL 0x3F591592#define ACPI_NUM_RTYPES 5 /* Number of actual object types */593594595/* Info for running the _REG methods */596597typedef struct acpi_reg_walk_info598{599UINT32 Function;600UINT32 RegRunCount;601ACPI_ADR_SPACE_TYPE SpaceId;602603} ACPI_REG_WALK_INFO;604605606/*****************************************************************************607*608* Event typedefs and structs609*610****************************************************************************/611612/* Dispatch info for each host-installed SCI handler */613614typedef struct acpi_sci_handler_info615{616struct acpi_sci_handler_info *Next;617ACPI_SCI_HANDLER Address; /* Address of handler */618void *Context; /* Context to be passed to handler */619620} ACPI_SCI_HANDLER_INFO;621622/* Dispatch info for each GPE -- either a method or handler, cannot be both */623624typedef struct acpi_gpe_handler_info625{626ACPI_GPE_HANDLER Address; /* Address of handler, if any */627void *Context; /* Context to be passed to handler */628ACPI_NAMESPACE_NODE *MethodNode; /* Method node for this GPE level (saved) */629UINT8 OriginalFlags; /* Original (pre-handler) GPE info */630BOOLEAN OriginallyEnabled; /* True if GPE was originally enabled */631632} ACPI_GPE_HANDLER_INFO;633634/* Notify info for implicit notify, multiple device objects */635636typedef struct acpi_gpe_notify_info637{638ACPI_NAMESPACE_NODE *DeviceNode; /* Device to be notified */639struct acpi_gpe_notify_info *Next;640641} ACPI_GPE_NOTIFY_INFO;642643/*644* GPE dispatch info. At any time, the GPE can have at most one type645* of dispatch - Method, Handler, or Implicit Notify.646*/647typedef union acpi_gpe_dispatch_info648{649ACPI_NAMESPACE_NODE *MethodNode; /* Method node for this GPE level */650ACPI_GPE_HANDLER_INFO *Handler; /* Installed GPE handler */651ACPI_GPE_NOTIFY_INFO *NotifyList; /* List of _PRW devices for implicit notifies */652653} ACPI_GPE_DISPATCH_INFO;654655/*656* Information about a GPE, one per each GPE in an array.657* NOTE: Important to keep this struct as small as possible.658*/659typedef struct acpi_gpe_event_info660{661union acpi_gpe_dispatch_info Dispatch; /* Either Method, Handler, or NotifyList */662struct acpi_gpe_register_info *RegisterInfo; /* Backpointer to register info */663UINT8 Flags; /* Misc info about this GPE */664UINT8 GpeNumber; /* This GPE */665UINT8 RuntimeCount; /* References to a run GPE */666BOOLEAN DisableForDispatch; /* Masked during dispatching */667668} ACPI_GPE_EVENT_INFO;669670/* Information about a GPE register pair, one per each status/enable pair in an array */671672typedef struct acpi_gpe_register_info673{674ACPI_GENERIC_ADDRESS StatusAddress; /* Address of status reg */675ACPI_GENERIC_ADDRESS EnableAddress; /* Address of enable reg */676UINT16 BaseGpeNumber; /* Base GPE number for this register */677UINT8 EnableForWake; /* GPEs to keep enabled when sleeping */678UINT8 EnableForRun; /* GPEs to keep enabled when running */679UINT8 MaskForRun; /* GPEs to keep masked when running */680UINT8 EnableMask; /* Current mask of enabled GPEs */681682} ACPI_GPE_REGISTER_INFO;683684/*685* Information about a GPE register block, one per each installed block --686* GPE0, GPE1, and one per each installed GPE Block Device.687*/688typedef struct acpi_gpe_block_info689{690ACPI_NAMESPACE_NODE *Node;691struct acpi_gpe_block_info *Previous;692struct acpi_gpe_block_info *Next;693struct acpi_gpe_xrupt_info *XruptBlock; /* Backpointer to interrupt block */694ACPI_GPE_REGISTER_INFO *RegisterInfo; /* One per GPE register pair */695ACPI_GPE_EVENT_INFO *EventInfo; /* One for each GPE */696UINT64 Address; /* Base address of the block */697UINT32 RegisterCount; /* Number of register pairs in block */698UINT16 GpeCount; /* Number of individual GPEs in block */699UINT16 BlockBaseNumber;/* Base GPE number for this block */700UINT8 SpaceId;701BOOLEAN Initialized; /* TRUE if this block is initialized */702703} ACPI_GPE_BLOCK_INFO;704705/* Information about GPE interrupt handlers, one per each interrupt level used for GPEs */706707typedef struct acpi_gpe_xrupt_info708{709struct acpi_gpe_xrupt_info *Previous;710struct acpi_gpe_xrupt_info *Next;711ACPI_GPE_BLOCK_INFO *GpeBlockListHead; /* List of GPE blocks for this xrupt */712UINT32 InterruptNumber; /* System interrupt number */713714} ACPI_GPE_XRUPT_INFO;715716typedef struct acpi_gpe_walk_info717{718ACPI_NAMESPACE_NODE *GpeDevice;719ACPI_GPE_BLOCK_INFO *GpeBlock;720UINT16 Count;721ACPI_OWNER_ID OwnerId;722BOOLEAN ExecuteByOwnerId;723724} ACPI_GPE_WALK_INFO;725726typedef struct acpi_gpe_device_info727{728UINT32 Index;729UINT32 NextBlockBaseIndex;730ACPI_STATUS Status;731ACPI_NAMESPACE_NODE *GpeDevice;732733} ACPI_GPE_DEVICE_INFO;734735typedef ACPI_STATUS (*ACPI_GPE_CALLBACK) (736ACPI_GPE_XRUPT_INFO *GpeXruptInfo,737ACPI_GPE_BLOCK_INFO *GpeBlock,738void *Context);739740741/* Information about each particular fixed event */742743typedef struct acpi_fixed_event_handler744{745ACPI_EVENT_HANDLER Handler; /* Address of handler. */746void *Context; /* Context to be passed to handler */747748} ACPI_FIXED_EVENT_HANDLER;749750typedef struct acpi_fixed_event_info751{752UINT8 StatusRegisterId;753UINT8 EnableRegisterId;754UINT16 StatusBitMask;755UINT16 EnableBitMask;756757} ACPI_FIXED_EVENT_INFO;758759/* Information used during field processing */760761typedef struct acpi_field_info762{763UINT8 SkipField;764UINT8 FieldFlag;765UINT32 PkgLength;766767} ACPI_FIELD_INFO;768769/* Information about the interrupt ID and _EVT of a GED device */770771typedef struct acpi_ged_handler_info772{773struct acpi_ged_handler_info *Next;774UINT32 IntId; /* The interrupt ID that triggers the execution of the EvtMethod. */775ACPI_NAMESPACE_NODE *EvtMethod; /* The _EVT method to be executed when an interrupt with ID = IntID is received */776777} ACPI_GED_HANDLER_INFO;778779/*****************************************************************************780*781* Generic "state" object for stacks782*783****************************************************************************/784785#define ACPI_CONTROL_NORMAL 0xC0786#define ACPI_CONTROL_CONDITIONAL_EXECUTING 0xC1787#define ACPI_CONTROL_PREDICATE_EXECUTING 0xC2788#define ACPI_CONTROL_PREDICATE_FALSE 0xC3789#define ACPI_CONTROL_PREDICATE_TRUE 0xC4790791792#define ACPI_STATE_COMMON \793void *Next; \794UINT8 DescriptorType; /* To differentiate various internal objs */\795UINT8 Flags; \796UINT16 Value; \797UINT16 State798799/* There are 2 bytes available here until the next natural alignment boundary */800801typedef struct acpi_common_state802{803ACPI_STATE_COMMON;804} ACPI_COMMON_STATE;805806807/*808* Update state - used to traverse complex objects such as packages809*/810typedef struct acpi_update_state811{812ACPI_STATE_COMMON;813union acpi_operand_object *Object;814815} ACPI_UPDATE_STATE;816817818/*819* Pkg state - used to traverse nested package structures820*/821typedef struct acpi_pkg_state822{823ACPI_STATE_COMMON;824UINT32 Index;825union acpi_operand_object *SourceObject;826union acpi_operand_object *DestObject;827struct acpi_walk_state *WalkState;828void *ThisTargetObj;829UINT32 NumPackages;830831} ACPI_PKG_STATE;832833834/*835* Control state - one per if/else and while constructs.836* Allows nesting of these constructs837*/838typedef struct acpi_control_state839{840ACPI_STATE_COMMON;841UINT16 Opcode;842union acpi_parse_object *PredicateOp;843UINT8 *AmlPredicateStart; /* Start of if/while predicate */844UINT8 *PackageEnd; /* End of if/while block */845UINT64 LoopTimeout; /* While() loop timeout */846847} ACPI_CONTROL_STATE;848849850/*851* Scope state - current scope during namespace lookups852*/853typedef struct acpi_scope_state854{855ACPI_STATE_COMMON;856ACPI_NAMESPACE_NODE *Node;857858} ACPI_SCOPE_STATE;859860861typedef struct acpi_pscope_state862{863ACPI_STATE_COMMON;864UINT32 ArgCount; /* Number of fixed arguments */865union acpi_parse_object *Op; /* Current op being parsed */866UINT8 *ArgEnd; /* Current argument end */867UINT8 *PkgEnd; /* Current package end */868UINT32 ArgList; /* Next argument to parse */869870} ACPI_PSCOPE_STATE;871872873/*874* Thread state - one per thread across multiple walk states. Multiple walk875* states are created when there are nested control methods executing.876*/877typedef struct acpi_thread_state878{879ACPI_STATE_COMMON;880UINT8 CurrentSyncLevel; /* Mutex Sync (nested acquire) level */881struct acpi_walk_state *WalkStateList; /* Head of list of WalkStates for this thread */882union acpi_operand_object *AcquiredMutexList; /* List of all currently acquired mutexes */883ACPI_THREAD_ID ThreadId; /* Running thread ID */884885} ACPI_THREAD_STATE;886887888/*889* Result values - used to accumulate the results of nested890* AML arguments891*/892typedef struct acpi_result_values893{894ACPI_STATE_COMMON;895union acpi_operand_object *ObjDesc [ACPI_RESULTS_FRAME_OBJ_NUM];896897} ACPI_RESULT_VALUES;898899900typedef901ACPI_STATUS (*ACPI_PARSE_DOWNWARDS) (902struct acpi_walk_state *WalkState,903union acpi_parse_object **OutOp);904905typedef906ACPI_STATUS (*ACPI_PARSE_UPWARDS) (907struct acpi_walk_state *WalkState);908909910/* Global handlers for AML Notifies */911912typedef struct acpi_global_notify_handler913{914ACPI_NOTIFY_HANDLER Handler;915void *Context;916917} ACPI_GLOBAL_NOTIFY_HANDLER;918919/*920* Notify info - used to pass info to the deferred notify921* handler/dispatcher.922*/923typedef struct acpi_notify_info924{925ACPI_STATE_COMMON;926UINT8 HandlerListId;927ACPI_NAMESPACE_NODE *Node;928union acpi_operand_object *HandlerListHead;929ACPI_GLOBAL_NOTIFY_HANDLER *Global;930931} ACPI_NOTIFY_INFO;932933934/* Generic state is union of structs above */935936typedef union acpi_generic_state937{938ACPI_COMMON_STATE Common;939ACPI_CONTROL_STATE Control;940ACPI_UPDATE_STATE Update;941ACPI_SCOPE_STATE Scope;942ACPI_PSCOPE_STATE ParseScope;943ACPI_PKG_STATE Pkg;944ACPI_THREAD_STATE Thread;945ACPI_RESULT_VALUES Results;946ACPI_NOTIFY_INFO Notify;947948} ACPI_GENERIC_STATE;949950951/*****************************************************************************952*953* Interpreter typedefs and structs954*955****************************************************************************/956957typedef958ACPI_STATUS (*ACPI_EXECUTE_OP) (959struct acpi_walk_state *WalkState);960961/* Address Range info block */962963typedef struct acpi_address_range964{965struct acpi_address_range *Next;966ACPI_NAMESPACE_NODE *RegionNode;967ACPI_PHYSICAL_ADDRESS StartAddress;968ACPI_PHYSICAL_ADDRESS EndAddress;969970} ACPI_ADDRESS_RANGE;971972973/*****************************************************************************974*975* Parser typedefs and structs976*977****************************************************************************/978979/*980* AML opcode, name, and argument layout981*/982typedef struct acpi_opcode_info983{984#if defined(ACPI_DISASSEMBLER) || defined(ACPI_DEBUG_OUTPUT)985char *Name; /* Opcode name (disassembler/debug only) */986#endif987UINT32 ParseArgs; /* Grammar/Parse time arguments */988UINT32 RuntimeArgs; /* Interpret time arguments */989UINT16 Flags; /* Misc flags */990UINT8 ObjectType; /* Corresponding internal object type */991UINT8 Class; /* Opcode class */992UINT8 Type; /* Opcode type */993994} ACPI_OPCODE_INFO;995996/* Structure for Resource Tag information */997998typedef struct acpi_tag_info999{1000UINT32 BitOffset;1001UINT32 BitLength;10021003} ACPI_TAG_INFO;10041005/* Value associated with the parse object */10061007typedef union acpi_parse_value1008{1009UINT64 Integer; /* Integer constant (Up to 64 bits) */1010UINT32 Size; /* bytelist or field size */1011char *String; /* NULL terminated string */1012UINT8 *Buffer; /* buffer or string */1013char *Name; /* NULL terminated string */1014union acpi_parse_object *Arg; /* arguments and contained ops */1015ACPI_TAG_INFO Tag; /* Resource descriptor tag info */10161017} ACPI_PARSE_VALUE;101810191020#if defined(ACPI_DISASSEMBLER) || defined(ACPI_DEBUG_OUTPUT)1021#define ACPI_DISASM_ONLY_MEMBERS(a) a;1022#else1023#define ACPI_DISASM_ONLY_MEMBERS(a)1024#endif10251026#if defined(ACPI_ASL_COMPILER)1027#define ACPI_CONVERTER_ONLY_MEMBERS(a) a;1028#else1029#define ACPI_CONVERTER_ONLY_MEMBERS(a)1030#endif10311032#define ACPI_PARSE_COMMON \1033union acpi_parse_object *Parent; /* Parent op */\1034UINT8 DescriptorType; /* To differentiate various internal objs */\1035UINT8 Flags; /* Type of Op */\1036UINT16 AmlOpcode; /* AML opcode */\1037UINT8 *Aml; /* Address of declaration in AML */\1038union acpi_parse_object *Next; /* Next op */\1039ACPI_NAMESPACE_NODE *Node; /* For use by interpreter */\1040ACPI_PARSE_VALUE Value; /* Value or args associated with the opcode */\1041UINT8 ArgListLength; /* Number of elements in the arg list */\1042ACPI_DISASM_ONLY_MEMBERS (\1043UINT16 DisasmFlags; /* Used during AML disassembly */\1044UINT8 DisasmOpcode; /* Subtype used for disassembly */\1045char *OperatorSymbol; /* Used for C-style operator name strings */\1046char AmlOpName[16]) /* Op name (debug only) */\1047ACPI_CONVERTER_ONLY_MEMBERS (\1048char *InlineComment; /* Inline comment */\1049char *EndNodeComment; /* End of node comment */\1050char *NameComment; /* Comment associated with the first parameter of the name node */\1051char *CloseBraceComment; /* Comments that come after } on the same as } */\1052ACPI_COMMENT_NODE *CommentList; /* comments that appears before this node */\1053ACPI_COMMENT_NODE *EndBlkComment; /* comments that at the end of a block but before ) or } */\1054char *CvFilename; /* Filename associated with this node. Used for ASL/ASL+ converter */\1055char *CvParentFilename) /* Parent filename associated with this node. Used for ASL/ASL+ converter */105610571058/* categories of comments */10591060typedef enum1061{1062STANDARD_COMMENT = 1,1063INLINE_COMMENT,1064ENDNODE_COMMENT,1065OPENBRACE_COMMENT,1066CLOSE_BRACE_COMMENT,1067STD_DEFBLK_COMMENT,1068END_DEFBLK_COMMENT,1069FILENAME_COMMENT,1070PARENTFILENAME_COMMENT,1071ENDBLK_COMMENT,1072INCLUDE_COMMENT10731074} ASL_COMMENT_TYPES;107510761077/* Internal opcodes for DisasmOpcode field above */10781079#define ACPI_DASM_BUFFER 0x00 /* Buffer is a simple data buffer */1080#define ACPI_DASM_RESOURCE 0x01 /* Buffer is a Resource Descriptor */1081#define ACPI_DASM_STRING 0x02 /* Buffer is a ASCII string */1082#define ACPI_DASM_UNICODE 0x03 /* Buffer is a Unicode string */1083#define ACPI_DASM_PLD_METHOD 0x04 /* Buffer is a _PLD method bit-packed buffer */1084#define ACPI_DASM_UUID 0x05 /* Buffer is a UUID/GUID */1085#define ACPI_DASM_EISAID 0x06 /* Integer is an EISAID */1086#define ACPI_DASM_MATCHOP 0x07 /* Parent opcode is a Match() operator */1087#define ACPI_DASM_LNOT_PREFIX 0x08 /* Start of a LNotEqual (etc.) pair of opcodes */1088#define ACPI_DASM_LNOT_SUFFIX 0x09 /* End of a LNotEqual (etc.) pair of opcodes */1089#define ACPI_DASM_HID_STRING 0x0A /* String is a _HID or _CID */1090#define ACPI_DASM_IGNORE_SINGLE 0x0B /* Ignore the opcode but not it's children */1091#define ACPI_DASM_SWITCH 0x0C /* While is a Switch */1092#define ACPI_DASM_SWITCH_PREDICATE 0x0D /* Object is a predicate for a Switch or Case block */1093#define ACPI_DASM_CASE 0x0E /* If/Else is a Case in a Switch/Case block */1094#define ACPI_DASM_DEFAULT 0x0F /* Else is a Default in a Switch/Case block */109510961097/*1098* List struct used in the -ca option1099*/1100typedef struct acpi_comment_node1101{1102char *Comment;1103struct acpi_comment_node *Next;11041105} ACPI_COMMENT_NODE;110611071108typedef struct acpi_comment_addr_node1109{1110UINT8 *Addr;1111struct acpi_comment_addr_node *Next;1112} ACPI_COMMENT_ADDR_NODE;11131114/*1115* File node - used for "Include" operator file stack and1116* dependency tree for the -ca option1117*/1118typedef struct acpi_file_node1119{1120void *File;1121char *Filename;1122char *FileStart; /* Points to AML and indicates when the AML for this particular file starts. */1123char *FileEnd; /* Points to AML and indicates when the AML for this particular file ends. */1124struct acpi_file_node *Next;1125struct acpi_file_node *Parent;1126BOOLEAN IncludeWritten;1127ACPI_COMMENT_NODE *IncludeComment;11281129} ACPI_FILE_NODE;113011311132/*1133* Generic operation (for example: If, While, Store)1134*/1135typedef struct acpi_parse_obj_common1136{1137ACPI_PARSE_COMMON1138} ACPI_PARSE_OBJ_COMMON;113911401141/*1142* Extended Op for named ops (Scope, Method, etc.), deferred ops (Methods and OpRegions),1143* and bytelists.1144*/1145typedef struct acpi_parse_obj_named1146{1147ACPI_PARSE_COMMON1148char *Path;1149UINT8 *Data; /* AML body or bytelist data */1150UINT32 Length; /* AML length */1151UINT32 Name; /* 4-byte name or zero if no name */11521153} ACPI_PARSE_OBJ_NAMED;115411551156/* This version is used by the iASL compiler only */11571158#define ACPI_MAX_PARSEOP_NAME 2011591160typedef struct acpi_parse_obj_asl1161{1162ACPI_PARSE_COMMON1163union acpi_parse_object *Child;1164union acpi_parse_object *ParentMethod;1165char *Filename;1166BOOLEAN FileChanged;1167char *ParentFilename;1168char *ExternalName;1169char *Namepath;1170char NameSeg[4];1171UINT32 ExtraValue;1172UINT32 Column;1173UINT32 LineNumber;1174UINT32 LogicalLineNumber;1175UINT32 LogicalByteOffset;1176UINT32 EndLine;1177UINT32 EndLogicalLine;1178UINT32 AcpiBtype;1179UINT32 AmlLength;1180UINT32 AmlSubtreeLength;1181UINT32 FinalAmlLength;1182UINT32 FinalAmlOffset;1183UINT32 CompileFlags;1184UINT16 ParseOpcode;1185UINT8 AmlOpcodeLength;1186UINT8 AmlPkgLenBytes;1187UINT8 Extra;1188char ParseOpName[ACPI_MAX_PARSEOP_NAME];11891190} ACPI_PARSE_OBJ_ASL;11911192typedef union acpi_parse_object1193{1194ACPI_PARSE_OBJ_COMMON Common;1195ACPI_PARSE_OBJ_NAMED Named;1196ACPI_PARSE_OBJ_ASL Asl;11971198} ACPI_PARSE_OBJECT;11991200typedef struct asl_comment_state1201{1202UINT8 CommentType;1203UINT32 SpacesBefore;1204ACPI_PARSE_OBJECT *LatestParseOp;1205ACPI_PARSE_OBJECT *ParsingParenBraceNode;1206BOOLEAN CaptureComments;12071208} ASL_COMMENT_STATE;120912101211/*1212* Parse state - one state per parser invocation and each control1213* method.1214*/1215typedef struct acpi_parse_state1216{1217UINT8 *AmlStart; /* First AML byte */1218UINT8 *Aml; /* Next AML byte */1219UINT8 *AmlEnd; /* (last + 1) AML byte */1220UINT8 *PkgStart; /* Current package begin */1221UINT8 *PkgEnd; /* Current package end */1222union acpi_parse_object *StartOp; /* Root of parse tree */1223struct acpi_namespace_node *StartNode;1224union acpi_generic_state *Scope; /* Current scope */1225union acpi_parse_object *StartScope;1226UINT32 AmlSize;12271228} ACPI_PARSE_STATE;122912301231/* Parse object flags */12321233#define ACPI_PARSEOP_GENERIC 0x011234#define ACPI_PARSEOP_NAMED_OBJECT 0x021235#define ACPI_PARSEOP_DEFERRED 0x041236#define ACPI_PARSEOP_BYTELIST 0x081237#define ACPI_PARSEOP_IN_STACK 0x101238#define ACPI_PARSEOP_TARGET 0x201239#define ACPI_PARSEOP_IN_CACHE 0x8012401241/* Parse object DisasmFlags */12421243#define ACPI_PARSEOP_IGNORE 0x00011244#define ACPI_PARSEOP_PARAMETER_LIST 0x00021245#define ACPI_PARSEOP_EMPTY_TERMLIST 0x00041246#define ACPI_PARSEOP_PREDEFINED_CHECKED 0x00081247#define ACPI_PARSEOP_CLOSING_PAREN 0x00101248#define ACPI_PARSEOP_COMPOUND_ASSIGNMENT 0x00201249#define ACPI_PARSEOP_ASSIGNMENT 0x00401250#define ACPI_PARSEOP_ELSEIF 0x00801251#define ACPI_PARSEOP_LEGACY_ASL_ONLY 0x0100125212531254/*****************************************************************************1255*1256* Hardware (ACPI registers) and PNP1257*1258****************************************************************************/12591260typedef struct acpi_bit_register_info1261{1262UINT8 ParentRegister;1263UINT8 BitPosition;1264UINT16 AccessBitMask;12651266} ACPI_BIT_REGISTER_INFO;126712681269/*1270* Some ACPI registers have bits that must be ignored -- meaning that they1271* must be preserved.1272*/1273#define ACPI_PM1_STATUS_PRESERVED_BITS 0x0800 /* Bit 11 */12741275/* Write-only bits must be zeroed by software */12761277#define ACPI_PM1_CONTROL_WRITEONLY_BITS 0x2004 /* Bits 13, 2 */12781279/* For control registers, both ignored and reserved bits must be preserved */12801281/*1282* For PM1 control, the SCI enable bit (bit 0, SCI_EN) is defined by the1283* ACPI specification to be a "preserved" bit - "OSPM always preserves this1284* bit position", section 4.7.3.2.1. However, on some machines the OS must1285* write a one to this bit after resume for the machine to work properly.1286* To enable this, we no longer attempt to preserve this bit. No machines1287* are known to fail if the bit is not preserved. (May 2009)1288*/1289#define ACPI_PM1_CONTROL_IGNORED_BITS 0x0200 /* Bit 9 */1290#define ACPI_PM1_CONTROL_RESERVED_BITS 0xC1F8 /* Bits 14-15, 3-8 */1291#define ACPI_PM1_CONTROL_PRESERVED_BITS \1292(ACPI_PM1_CONTROL_IGNORED_BITS | ACPI_PM1_CONTROL_RESERVED_BITS)12931294#define ACPI_PM2_CONTROL_PRESERVED_BITS 0xFFFFFFFE /* All except bit 0 */12951296/*1297* Register IDs1298* These are the full ACPI registers1299*/1300#define ACPI_REGISTER_PM1_STATUS 0x011301#define ACPI_REGISTER_PM1_ENABLE 0x021302#define ACPI_REGISTER_PM1_CONTROL 0x031303#define ACPI_REGISTER_PM2_CONTROL 0x041304#define ACPI_REGISTER_PM_TIMER 0x051305#define ACPI_REGISTER_PROCESSOR_BLOCK 0x061306#define ACPI_REGISTER_SMI_COMMAND_BLOCK 0x07130713081309/* Masks used to access the BitRegisters */13101311#define ACPI_BITMASK_TIMER_STATUS 0x00011312#define ACPI_BITMASK_BUS_MASTER_STATUS 0x00101313#define ACPI_BITMASK_GLOBAL_LOCK_STATUS 0x00201314#define ACPI_BITMASK_POWER_BUTTON_STATUS 0x01001315#define ACPI_BITMASK_SLEEP_BUTTON_STATUS 0x02001316#define ACPI_BITMASK_RT_CLOCK_STATUS 0x04001317#define ACPI_BITMASK_PCIEXP_WAKE_STATUS 0x4000 /* ACPI 3.0 */1318#define ACPI_BITMASK_WAKE_STATUS 0x800013191320#define ACPI_BITMASK_ALL_FIXED_STATUS (\1321ACPI_BITMASK_TIMER_STATUS | \1322ACPI_BITMASK_BUS_MASTER_STATUS | \1323ACPI_BITMASK_GLOBAL_LOCK_STATUS | \1324ACPI_BITMASK_POWER_BUTTON_STATUS | \1325ACPI_BITMASK_SLEEP_BUTTON_STATUS | \1326ACPI_BITMASK_RT_CLOCK_STATUS | \1327ACPI_BITMASK_PCIEXP_WAKE_STATUS | \1328ACPI_BITMASK_WAKE_STATUS)13291330#define ACPI_BITMASK_TIMER_ENABLE 0x00011331#define ACPI_BITMASK_GLOBAL_LOCK_ENABLE 0x00201332#define ACPI_BITMASK_POWER_BUTTON_ENABLE 0x01001333#define ACPI_BITMASK_SLEEP_BUTTON_ENABLE 0x02001334#define ACPI_BITMASK_RT_CLOCK_ENABLE 0x04001335#define ACPI_BITMASK_PCIEXP_WAKE_DISABLE 0x4000 /* ACPI 3.0 */13361337#define ACPI_BITMASK_SCI_ENABLE 0x00011338#define ACPI_BITMASK_BUS_MASTER_RLD 0x00021339#define ACPI_BITMASK_GLOBAL_LOCK_RELEASE 0x00041340#define ACPI_BITMASK_SLEEP_TYPE 0x1C001341#define ACPI_BITMASK_SLEEP_ENABLE 0x200013421343#define ACPI_BITMASK_ARB_DISABLE 0x0001134413451346/* Raw bit position of each BitRegister */13471348#define ACPI_BITPOSITION_TIMER_STATUS 0x001349#define ACPI_BITPOSITION_BUS_MASTER_STATUS 0x041350#define ACPI_BITPOSITION_GLOBAL_LOCK_STATUS 0x051351#define ACPI_BITPOSITION_POWER_BUTTON_STATUS 0x081352#define ACPI_BITPOSITION_SLEEP_BUTTON_STATUS 0x091353#define ACPI_BITPOSITION_RT_CLOCK_STATUS 0x0A1354#define ACPI_BITPOSITION_PCIEXP_WAKE_STATUS 0x0E /* ACPI 3.0 */1355#define ACPI_BITPOSITION_WAKE_STATUS 0x0F13561357#define ACPI_BITPOSITION_TIMER_ENABLE 0x001358#define ACPI_BITPOSITION_GLOBAL_LOCK_ENABLE 0x051359#define ACPI_BITPOSITION_POWER_BUTTON_ENABLE 0x081360#define ACPI_BITPOSITION_SLEEP_BUTTON_ENABLE 0x091361#define ACPI_BITPOSITION_RT_CLOCK_ENABLE 0x0A1362#define ACPI_BITPOSITION_PCIEXP_WAKE_DISABLE 0x0E /* ACPI 3.0 */13631364#define ACPI_BITPOSITION_SCI_ENABLE 0x001365#define ACPI_BITPOSITION_BUS_MASTER_RLD 0x011366#define ACPI_BITPOSITION_GLOBAL_LOCK_RELEASE 0x021367#define ACPI_BITPOSITION_SLEEP_TYPE 0x0A1368#define ACPI_BITPOSITION_SLEEP_ENABLE 0x0D13691370#define ACPI_BITPOSITION_ARB_DISABLE 0x00137113721373/* Structs and definitions for _OSI support and I/O port validation */13741375#define ACPI_ALWAYS_ILLEGAL 0x0013761377typedef struct acpi_interface_info1378{1379char *Name;1380struct acpi_interface_info *Next;1381UINT8 Flags;1382UINT8 Value;13831384} ACPI_INTERFACE_INFO;13851386#define ACPI_OSI_INVALID 0x011387#define ACPI_OSI_DYNAMIC 0x021388#define ACPI_OSI_FEATURE 0x041389#define ACPI_OSI_DEFAULT_INVALID 0x081390#define ACPI_OSI_OPTIONAL_FEATURE (ACPI_OSI_FEATURE | ACPI_OSI_DEFAULT_INVALID | ACPI_OSI_INVALID)13911392typedef struct acpi_port_info1393{1394char *Name;1395UINT16 Start;1396UINT16 End;1397UINT8 OsiDependency;13981399} ACPI_PORT_INFO;140014011402/*****************************************************************************1403*1404* Resource descriptors1405*1406****************************************************************************/14071408/* ResourceType values */14091410#define ACPI_ADDRESS_TYPE_MEMORY_RANGE 01411#define ACPI_ADDRESS_TYPE_IO_RANGE 11412#define ACPI_ADDRESS_TYPE_BUS_NUMBER_RANGE 214131414#define ACPI_ADDRESS_TYPE_PCC_NUMBER 0xA14151416/* Resource descriptor types and masks */14171418#define ACPI_RESOURCE_NAME_LARGE 0x801419#define ACPI_RESOURCE_NAME_SMALL 0x0014201421#define ACPI_RESOURCE_NAME_SMALL_MASK 0x78 /* Bits 6:3 contain the type */1422#define ACPI_RESOURCE_NAME_SMALL_LENGTH_MASK 0x07 /* Bits 2:0 contain the length */1423#define ACPI_RESOURCE_NAME_LARGE_MASK 0x7F /* Bits 6:0 contain the type */142414251426/*1427* Small resource descriptor "names" as defined by the ACPI specification.1428* Note: Bits 2:0 are used for the descriptor length1429*/1430#define ACPI_RESOURCE_NAME_IRQ 0x201431#define ACPI_RESOURCE_NAME_DMA 0x281432#define ACPI_RESOURCE_NAME_START_DEPENDENT 0x301433#define ACPI_RESOURCE_NAME_END_DEPENDENT 0x381434#define ACPI_RESOURCE_NAME_IO 0x401435#define ACPI_RESOURCE_NAME_FIXED_IO 0x481436#define ACPI_RESOURCE_NAME_FIXED_DMA 0x501437#define ACPI_RESOURCE_NAME_RESERVED_S2 0x581438#define ACPI_RESOURCE_NAME_RESERVED_S3 0x601439#define ACPI_RESOURCE_NAME_RESERVED_S4 0x681440#define ACPI_RESOURCE_NAME_VENDOR_SMALL 0x701441#define ACPI_RESOURCE_NAME_END_TAG 0x7814421443/*1444* Large resource descriptor "names" as defined by the ACPI specification.1445* Note: includes the Large Descriptor bit in bit[7]1446*/1447#define ACPI_RESOURCE_NAME_MEMORY24 0x811448#define ACPI_RESOURCE_NAME_GENERIC_REGISTER 0x821449#define ACPI_RESOURCE_NAME_RESERVED_L1 0x831450#define ACPI_RESOURCE_NAME_VENDOR_LARGE 0x841451#define ACPI_RESOURCE_NAME_MEMORY32 0x851452#define ACPI_RESOURCE_NAME_FIXED_MEMORY32 0x861453#define ACPI_RESOURCE_NAME_ADDRESS32 0x871454#define ACPI_RESOURCE_NAME_ADDRESS16 0x881455#define ACPI_RESOURCE_NAME_EXTENDED_IRQ 0x891456#define ACPI_RESOURCE_NAME_ADDRESS64 0x8A1457#define ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64 0x8B1458#define ACPI_RESOURCE_NAME_GPIO 0x8C1459#define ACPI_RESOURCE_NAME_PIN_FUNCTION 0x8D1460#define ACPI_RESOURCE_NAME_SERIAL_BUS 0x8E1461#define ACPI_RESOURCE_NAME_PIN_CONFIG 0x8F1462#define ACPI_RESOURCE_NAME_PIN_GROUP 0x901463#define ACPI_RESOURCE_NAME_PIN_GROUP_FUNCTION 0x911464#define ACPI_RESOURCE_NAME_PIN_GROUP_CONFIG 0x921465#define ACPI_RESOURCE_NAME_CLOCK_INPUT 0x931466#define ACPI_RESOURCE_NAME_LARGE_MAX 0x94146714681469/*****************************************************************************1470*1471* Miscellaneous1472*1473****************************************************************************/14741475#define ACPI_ASCII_ZERO 0x30147614771478/*****************************************************************************1479*1480* Disassembler1481*1482****************************************************************************/14831484typedef struct acpi_external_list1485{1486char *Path;1487char *InternalPath;1488struct acpi_external_list *Next;1489UINT32 Value;1490UINT16 Length;1491UINT16 Flags;1492UINT8 Type;14931494} ACPI_EXTERNAL_LIST;14951496/* Values for Flags field above */14971498#define ACPI_EXT_RESOLVED_REFERENCE 0x01 /* Object was resolved during cross ref */1499#define ACPI_EXT_ORIGIN_FROM_FILE 0x02 /* External came from a file */1500#define ACPI_EXT_INTERNAL_PATH_ALLOCATED 0x04 /* Deallocate internal path on completion */1501#define ACPI_EXT_EXTERNAL_EMITTED 0x08 /* External() statement has been emitted */1502#define ACPI_EXT_ORIGIN_FROM_OPCODE 0x10 /* External came from a External() opcode */1503#define ACPI_EXT_CONFLICTING_DECLARATION 0x20 /* External has a conflicting declaration within AML */150415051506typedef struct acpi_external_file1507{1508char *Path;1509struct acpi_external_file *Next;15101511} ACPI_EXTERNAL_FILE;151215131514typedef struct acpi_parse_object_list1515{1516ACPI_PARSE_OBJECT *Op;1517struct acpi_parse_object_list *Next;15181519} ACPI_PARSE_OBJECT_LIST;15201521/*****************************************************************************1522*1523* Debugger1524*1525****************************************************************************/15261527typedef struct acpi_db_method_info1528{1529ACPI_HANDLE Method;1530ACPI_HANDLE MainThreadGate;1531ACPI_HANDLE ThreadCompleteGate;1532ACPI_HANDLE InfoGate;1533ACPI_THREAD_ID *Threads;1534UINT32 NumThreads;1535UINT32 NumCreated;1536UINT32 NumCompleted;15371538char *Name;1539UINT32 Flags;1540UINT32 NumLoops;1541char Pathname[ACPI_DB_LINE_BUFFER_SIZE];1542char **Args;1543ACPI_OBJECT_TYPE *Types;15441545/*1546* Arguments to be passed to method for the commands Threads and1547* Background. Note, ACPI specifies a maximum of 7 arguments (0 - 6).1548*1549* For the Threads command, the Number of threads, ID of current1550* thread and Index of current thread inside all them created.1551*/1552char InitArgs;1553#ifdef ACPI_DEBUGGER1554ACPI_OBJECT_TYPE ArgTypes[ACPI_METHOD_NUM_ARGS];1555#endif1556char *Arguments[ACPI_METHOD_NUM_ARGS];1557char NumThreadsStr[11];1558char IdOfThreadStr[11];1559char IndexOfThreadStr[11];15601561} ACPI_DB_METHOD_INFO;15621563typedef struct acpi_integrity_info1564{1565UINT32 Nodes;1566UINT32 Objects;15671568} ACPI_INTEGRITY_INFO;156915701571#define ACPI_DB_DISABLE_OUTPUT 0x001572#define ACPI_DB_REDIRECTABLE_OUTPUT 0x011573#define ACPI_DB_CONSOLE_OUTPUT 0x021574#define ACPI_DB_DUPLICATE_OUTPUT 0x03157515761577typedef struct acpi_object_info1578{1579UINT32 Types[ACPI_TOTAL_TYPES];15801581} ACPI_OBJECT_INFO;158215831584/*****************************************************************************1585*1586* Debug1587*1588****************************************************************************/15891590/* Entry for a memory allocation (debug only) */15911592#define ACPI_MEM_MALLOC 01593#define ACPI_MEM_CALLOC 11594#define ACPI_MAX_MODULE_NAME 1615951596#define ACPI_COMMON_DEBUG_MEM_HEADER \1597struct acpi_debug_mem_block *Previous; \1598struct acpi_debug_mem_block *Next; \1599UINT32 Size; \1600UINT32 Component; \1601UINT32 Line; \1602char Module[ACPI_MAX_MODULE_NAME]; \1603UINT8 AllocType;16041605typedef struct acpi_debug_mem_header1606{1607ACPI_COMMON_DEBUG_MEM_HEADER16081609} ACPI_DEBUG_MEM_HEADER;16101611typedef struct acpi_debug_mem_block1612{1613ACPI_COMMON_DEBUG_MEM_HEADER1614UINT64 UserSpace;16151616} ACPI_DEBUG_MEM_BLOCK;161716181619#define ACPI_MEM_LIST_GLOBAL 01620#define ACPI_MEM_LIST_NSNODE 11621#define ACPI_MEM_LIST_MAX 11622#define ACPI_NUM_MEM_LISTS 2162316241625/*****************************************************************************1626*1627* Info/help support1628*1629****************************************************************************/16301631typedef struct ah_predefined_name1632{1633char *Name;1634char *Description;1635#ifndef ACPI_ASL_COMPILER1636char *Action;1637#endif16381639} AH_PREDEFINED_NAME;16401641typedef struct ah_device_id1642{1643char *Name;1644char *Description;16451646} AH_DEVICE_ID;16471648typedef struct ah_uuid1649{1650char *Description;1651char *String;16521653} AH_UUID;16541655typedef struct ah_table1656{1657char *Signature;1658char *Description;16591660} AH_TABLE;16611662#endif /* __ACLOCAL_H__ */166316641665