Path: blob/main/sys/contrib/dev/acpica/include/acstruct.h
48287 views
/******************************************************************************1*2* Name: acstruct.h - Internal structs3*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 __ACSTRUCT_H__152#define __ACSTRUCT_H__153154/* acpisrc:StructDefs -- for acpisrc conversion */155156/*****************************************************************************157*158* Tree walking typedefs and structs159*160****************************************************************************/161162163/*164* Walk state - current state of a parse tree walk. Used for both a leisurely165* stroll through the tree (for whatever reason), and for control method166* execution.167*/168#define ACPI_NEXT_OP_DOWNWARD 1169#define ACPI_NEXT_OP_UPWARD 2170171/*172* Groups of definitions for WalkType used for different implementations of173* walkers (never simultaneously) - flags for interpreter:174*/175#define ACPI_WALK_NON_METHOD 0176#define ACPI_WALK_METHOD 0x01177#define ACPI_WALK_METHOD_RESTART 0x02178179180typedef struct acpi_walk_state181{182struct acpi_walk_state *Next; /* Next WalkState in list */183UINT8 DescriptorType; /* To differentiate various internal objs */184UINT8 WalkType;185UINT16 Opcode; /* Current AML opcode */186UINT8 NextOpInfo; /* Info about NextOp */187UINT8 NumOperands; /* Stack pointer for Operands[] array */188UINT8 OperandIndex; /* Index into operand stack, to be used by AcpiDsObjStackPush */189ACPI_OWNER_ID OwnerId; /* Owner of objects created during the walk */190BOOLEAN LastPredicate; /* Result of last predicate */191UINT8 CurrentResult;192UINT8 ReturnUsed;193UINT8 ScopeDepth;194UINT8 PassNumber; /* Parse pass during table load */195BOOLEAN NamespaceOverride; /* Override existing objects */196UINT8 ResultSize; /* Total elements for the result stack */197UINT8 ResultCount; /* Current number of occupied elements of result stack */198UINT8 *Aml;199UINT32 ArgTypes;200UINT32 MethodBreakpoint; /* For single stepping */201UINT32 UserBreakpoint; /* User AML breakpoint */202UINT32 ParseFlags;203204ACPI_PARSE_STATE ParserState; /* Current state of parser */205UINT32 PrevArgTypes;206UINT32 ArgCount; /* push for fixed or var args */207UINT16 MethodNestingDepth;208UINT8 MethodIsNested;209210struct acpi_namespace_node Arguments[ACPI_METHOD_NUM_ARGS]; /* Control method arguments */211struct acpi_namespace_node LocalVariables[ACPI_METHOD_NUM_LOCALS]; /* Control method locals */212union acpi_operand_object *Operands[ACPI_OBJ_NUM_OPERANDS + 1]; /* Operands passed to the interpreter (+1 for NULL terminator) */213union acpi_operand_object **Params;214215UINT8 *AmlLastWhile;216union acpi_operand_object **CallerReturnDesc;217ACPI_GENERIC_STATE *ControlState; /* List of control states (nested IFs) */218struct acpi_namespace_node *DeferredNode; /* Used when executing deferred opcodes */219union acpi_operand_object *ImplicitReturnObj;220struct acpi_namespace_node *MethodCallNode; /* Called method Node*/221ACPI_PARSE_OBJECT *MethodCallOp; /* MethodCall Op if running a method */222union acpi_operand_object *MethodDesc; /* Method descriptor if running a method */223struct acpi_namespace_node *MethodNode; /* Method node if running a method */224char *MethodPathname; /* Full pathname of running method */225ACPI_PARSE_OBJECT *Op; /* Current parser op */226const ACPI_OPCODE_INFO *OpInfo; /* Info on current opcode */227ACPI_PARSE_OBJECT *Origin; /* Start of walk [Obsolete] */228union acpi_operand_object *ResultObj;229ACPI_GENERIC_STATE *Results; /* Stack of accumulated results */230union acpi_operand_object *ReturnDesc; /* Return object, if any */231ACPI_GENERIC_STATE *ScopeInfo; /* Stack of nested scopes */232ACPI_PARSE_OBJECT *PrevOp; /* Last op that was processed */233ACPI_PARSE_OBJECT *NextOp; /* next op to be processed */234ACPI_THREAD_STATE *Thread;235ACPI_PARSE_DOWNWARDS DescendingCallback;236ACPI_PARSE_UPWARDS AscendingCallback;237238} ACPI_WALK_STATE;239240241/* Info used by AcpiNsInitializeObjects and AcpiDsInitializeObjects */242243typedef struct acpi_init_walk_info244{245UINT32 TableIndex;246UINT32 ObjectCount;247UINT32 MethodCount;248UINT32 SerialMethodCount;249UINT32 NonSerialMethodCount;250UINT32 SerializedMethodCount;251UINT32 DeviceCount;252UINT32 OpRegionCount;253UINT32 FieldCount;254UINT32 BufferCount;255UINT32 PackageCount;256UINT32 OpRegionInit;257UINT32 FieldInit;258UINT32 BufferInit;259UINT32 PackageInit;260ACPI_OWNER_ID OwnerId;261262} ACPI_INIT_WALK_INFO;263264265typedef struct acpi_get_devices_info266{267ACPI_WALK_CALLBACK UserFunction;268void *Context;269char *Hid;270271} ACPI_GET_DEVICES_INFO;272273274typedef union acpi_aml_operands275{276ACPI_OPERAND_OBJECT *Operands[7];277278struct279{280ACPI_OBJECT_INTEGER *Type;281ACPI_OBJECT_INTEGER *Code;282ACPI_OBJECT_INTEGER *Argument;283284} Fatal;285286struct287{288ACPI_OPERAND_OBJECT *Source;289ACPI_OBJECT_INTEGER *Index;290ACPI_OPERAND_OBJECT *Target;291292} Index;293294struct295{296ACPI_OPERAND_OBJECT *Source;297ACPI_OBJECT_INTEGER *Index;298ACPI_OBJECT_INTEGER *Length;299ACPI_OPERAND_OBJECT *Target;300301} Mid;302303} ACPI_AML_OPERANDS;304305306/*307* Structure used to pass object evaluation information and parameters.308* Purpose is to reduce CPU stack use.309*/310typedef struct acpi_evaluate_info311{312/* The first 3 elements are passed by the caller to AcpiNsEvaluate */313314ACPI_NAMESPACE_NODE *PrefixNode; /* Input: starting node */315const char *RelativePathname; /* Input: path relative to PrefixNode */316ACPI_OPERAND_OBJECT **Parameters; /* Input: argument list */317318ACPI_NAMESPACE_NODE *Node; /* Resolved node (PrefixNode:RelativePathname) */319ACPI_OPERAND_OBJECT *ObjDesc; /* Object attached to the resolved node */320char *FullPathname; /* Full pathname of the resolved node */321322const ACPI_PREDEFINED_INFO *Predefined; /* Used if Node is a predefined name */323ACPI_OPERAND_OBJECT *ReturnObject; /* Object returned from the evaluation */324union acpi_operand_object *ParentPackage; /* Used if return object is a Package */325326UINT32 ReturnFlags; /* Used for return value analysis */327UINT32 ReturnBtype; /* Bitmapped type of the returned object */328UINT16 ParamCount; /* Count of the input argument list */329UINT16 NodeFlags; /* Same as Node->Flags */330UINT8 PassNumber; /* Parser pass number */331UINT8 ReturnObjectType; /* Object type of the returned object */332UINT8 Flags; /* General flags */333334} ACPI_EVALUATE_INFO;335336/* Values for Flags above */337338#define ACPI_IGNORE_RETURN_VALUE 1339340/* Defines for ReturnFlags field above */341342#define ACPI_OBJECT_REPAIRED 1343#define ACPI_OBJECT_WRAPPED 2344345346/* Info used by AcpiNsInitializeDevices */347348typedef struct acpi_device_walk_info349{350ACPI_TABLE_DESC *TableDesc;351ACPI_EVALUATE_INFO *EvaluateInfo;352UINT32 DeviceCount;353UINT32 Num_STA;354UINT32 Num_INI;355356} ACPI_DEVICE_WALK_INFO;357358359/* Info used by Acpi AcpiDbDisplayFields */360361typedef struct acpi_region_walk_info362{363UINT32 DebugLevel;364UINT32 Count;365ACPI_OWNER_ID OwnerId;366UINT8 DisplayType;367UINT32 AddressSpaceId;368369} ACPI_REGION_WALK_INFO;370371372/* TBD: [Restructure] Merge with struct above */373374typedef struct acpi_walk_info375{376UINT32 DebugLevel;377UINT32 Count;378ACPI_OWNER_ID OwnerId;379UINT8 DisplayType;380381} ACPI_WALK_INFO;382383/* Display Types */384385#define ACPI_DISPLAY_SUMMARY (UINT8) 0386#define ACPI_DISPLAY_OBJECTS (UINT8) 1387#define ACPI_DISPLAY_MASK (UINT8) 1388389#define ACPI_DISPLAY_SHORT (UINT8) 2390391392#endif393394395