17c478bd9Sstevel@tonic-gate /****************************************************************************** 27c478bd9Sstevel@tonic-gate * 37c478bd9Sstevel@tonic-gate * Name: acstruct.h - Internal structs 47c478bd9Sstevel@tonic-gate * 57c478bd9Sstevel@tonic-gate *****************************************************************************/ 67c478bd9Sstevel@tonic-gate 726f3cdf0SGordon Ross /* 8*385cc6b4SJerry Jelinek * Copyright (C) 2000 - 2016, Intel Corp. 97c478bd9Sstevel@tonic-gate * All rights reserved. 107c478bd9Sstevel@tonic-gate * 1126f3cdf0SGordon Ross * Redistribution and use in source and binary forms, with or without 1226f3cdf0SGordon Ross * modification, are permitted provided that the following conditions 1326f3cdf0SGordon Ross * are met: 1426f3cdf0SGordon Ross * 1. Redistributions of source code must retain the above copyright 1526f3cdf0SGordon Ross * notice, this list of conditions, and the following disclaimer, 1626f3cdf0SGordon Ross * without modification. 1726f3cdf0SGordon Ross * 2. Redistributions in binary form must reproduce at minimum a disclaimer 1826f3cdf0SGordon Ross * substantially similar to the "NO WARRANTY" disclaimer below 1926f3cdf0SGordon Ross * ("Disclaimer") and any redistribution must be conditioned upon 2026f3cdf0SGordon Ross * including a substantially similar Disclaimer requirement for further 2126f3cdf0SGordon Ross * binary redistribution. 2226f3cdf0SGordon Ross * 3. Neither the names of the above-listed copyright holders nor the names 2326f3cdf0SGordon Ross * of any contributors may be used to endorse or promote products derived 2426f3cdf0SGordon Ross * from this software without specific prior written permission. 257c478bd9Sstevel@tonic-gate * 2626f3cdf0SGordon Ross * Alternatively, this software may be distributed under the terms of the 2726f3cdf0SGordon Ross * GNU General Public License ("GPL") version 2 as published by the Free 2826f3cdf0SGordon Ross * Software Foundation. 297c478bd9Sstevel@tonic-gate * 3026f3cdf0SGordon Ross * NO WARRANTY 3126f3cdf0SGordon Ross * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 3226f3cdf0SGordon Ross * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 3326f3cdf0SGordon Ross * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR 3426f3cdf0SGordon Ross * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 3526f3cdf0SGordon Ross * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 3626f3cdf0SGordon Ross * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 3726f3cdf0SGordon Ross * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 3826f3cdf0SGordon Ross * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 3926f3cdf0SGordon Ross * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 4026f3cdf0SGordon Ross * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 4126f3cdf0SGordon Ross * POSSIBILITY OF SUCH DAMAGES. 4226f3cdf0SGordon Ross */ 437c478bd9Sstevel@tonic-gate 447c478bd9Sstevel@tonic-gate #ifndef __ACSTRUCT_H__ 457c478bd9Sstevel@tonic-gate #define __ACSTRUCT_H__ 467c478bd9Sstevel@tonic-gate 4727f7c583Smyers /* acpisrc:StructDefs -- for acpisrc conversion */ 487c478bd9Sstevel@tonic-gate 497c478bd9Sstevel@tonic-gate /***************************************************************************** 507c478bd9Sstevel@tonic-gate * 517c478bd9Sstevel@tonic-gate * Tree walking typedefs and structs 527c478bd9Sstevel@tonic-gate * 537c478bd9Sstevel@tonic-gate ****************************************************************************/ 547c478bd9Sstevel@tonic-gate 557c478bd9Sstevel@tonic-gate 567c478bd9Sstevel@tonic-gate /* 5727f7c583Smyers * Walk state - current state of a parse tree walk. Used for both a leisurely 5827f7c583Smyers * stroll through the tree (for whatever reason), and for control method 5927f7c583Smyers * execution. 607c478bd9Sstevel@tonic-gate */ 617c478bd9Sstevel@tonic-gate #define ACPI_NEXT_OP_DOWNWARD 1 627c478bd9Sstevel@tonic-gate #define ACPI_NEXT_OP_UPWARD 2 637c478bd9Sstevel@tonic-gate 6427f7c583Smyers /* 6527f7c583Smyers * Groups of definitions for WalkType used for different implementations of 6627f7c583Smyers * walkers (never simultaneously) - flags for interpreter: 6727f7c583Smyers */ 687c478bd9Sstevel@tonic-gate #define ACPI_WALK_NON_METHOD 0 6927f7c583Smyers #define ACPI_WALK_METHOD 0x01 7027f7c583Smyers #define ACPI_WALK_METHOD_RESTART 0x02 7127f7c583Smyers 727c478bd9Sstevel@tonic-gate 737c478bd9Sstevel@tonic-gate typedef struct acpi_walk_state 747c478bd9Sstevel@tonic-gate { 7527f7c583Smyers struct acpi_walk_state *Next; /* Next WalkState in list */ 7627f7c583Smyers UINT8 DescriptorType; /* To differentiate various internal objs */ 777c478bd9Sstevel@tonic-gate UINT8 WalkType; 7827f7c583Smyers UINT16 Opcode; /* Current AML opcode */ 797c478bd9Sstevel@tonic-gate UINT8 NextOpInfo; /* Info about NextOp */ 807c478bd9Sstevel@tonic-gate UINT8 NumOperands; /* Stack pointer for Operands[] array */ 81db2bae30SDana Myers UINT8 OperandIndex; /* Index into operand stack, to be used by AcpiDsObjStackPush */ 8227f7c583Smyers ACPI_OWNER_ID OwnerId; /* Owner of objects created during the walk */ 8327f7c583Smyers BOOLEAN LastPredicate; /* Result of last predicate */ 8427f7c583Smyers UINT8 CurrentResult; 857c478bd9Sstevel@tonic-gate UINT8 ReturnUsed; 867c478bd9Sstevel@tonic-gate UINT8 ScopeDepth; 87450d6964Smyers UINT8 PassNumber; /* Parse pass during table load */ 88*385cc6b4SJerry Jelinek BOOLEAN NamespaceOverride; /* Override existing objects */ 89db2bae30SDana Myers UINT8 ResultSize; /* Total elements for the result stack */ 90db2bae30SDana Myers UINT8 ResultCount; /* Current number of occupied elements of result stack */ 91*385cc6b4SJerry Jelinek UINT8 *Aml; 927c478bd9Sstevel@tonic-gate UINT32 ArgTypes; 937c478bd9Sstevel@tonic-gate UINT32 MethodBreakpoint; /* For single stepping */ 947c478bd9Sstevel@tonic-gate UINT32 UserBreakpoint; /* User AML breakpoint */ 957c478bd9Sstevel@tonic-gate UINT32 ParseFlags; 9627f7c583Smyers 9727f7c583Smyers ACPI_PARSE_STATE ParserState; /* Current state of parser */ 987c478bd9Sstevel@tonic-gate UINT32 PrevArgTypes; 9927f7c583Smyers UINT32 ArgCount; /* push for fixed or var args */ 10027f7c583Smyers 10127f7c583Smyers struct acpi_namespace_node Arguments[ACPI_METHOD_NUM_ARGS]; /* Control method arguments */ 10227f7c583Smyers struct acpi_namespace_node LocalVariables[ACPI_METHOD_NUM_LOCALS]; /* Control method locals */ 10327f7c583Smyers union acpi_operand_object *Operands[ACPI_OBJ_NUM_OPERANDS + 1]; /* Operands passed to the interpreter (+1 for NULL terminator) */ 10427f7c583Smyers union acpi_operand_object **Params; 1057c478bd9Sstevel@tonic-gate 1067c478bd9Sstevel@tonic-gate UINT8 *AmlLastWhile; 1077c478bd9Sstevel@tonic-gate union acpi_operand_object **CallerReturnDesc; 1087c478bd9Sstevel@tonic-gate ACPI_GENERIC_STATE *ControlState; /* List of control states (nested IFs) */ 1097c478bd9Sstevel@tonic-gate struct acpi_namespace_node *DeferredNode; /* Used when executing deferred opcodes */ 1107c478bd9Sstevel@tonic-gate union acpi_operand_object *ImplicitReturnObj; 1117c478bd9Sstevel@tonic-gate struct acpi_namespace_node *MethodCallNode; /* Called method Node*/ 1127c478bd9Sstevel@tonic-gate ACPI_PARSE_OBJECT *MethodCallOp; /* MethodCall Op if running a method */ 1137c478bd9Sstevel@tonic-gate union acpi_operand_object *MethodDesc; /* Method descriptor if running a method */ 1147c478bd9Sstevel@tonic-gate struct acpi_namespace_node *MethodNode; /* Method node if running a method. */ 1157c478bd9Sstevel@tonic-gate ACPI_PARSE_OBJECT *Op; /* Current parser op */ 1167c478bd9Sstevel@tonic-gate const ACPI_OPCODE_INFO *OpInfo; /* Info on current opcode */ 1177c478bd9Sstevel@tonic-gate ACPI_PARSE_OBJECT *Origin; /* Start of walk [Obsolete] */ 1187c478bd9Sstevel@tonic-gate union acpi_operand_object *ResultObj; 1197c478bd9Sstevel@tonic-gate ACPI_GENERIC_STATE *Results; /* Stack of accumulated results */ 1207c478bd9Sstevel@tonic-gate union acpi_operand_object *ReturnDesc; /* Return object, if any */ 1217c478bd9Sstevel@tonic-gate ACPI_GENERIC_STATE *ScopeInfo; /* Stack of nested scopes */ 1227c478bd9Sstevel@tonic-gate ACPI_PARSE_OBJECT *PrevOp; /* Last op that was processed */ 1237c478bd9Sstevel@tonic-gate ACPI_PARSE_OBJECT *NextOp; /* next op to be processed */ 12427f7c583Smyers ACPI_THREAD_STATE *Thread; 1257c478bd9Sstevel@tonic-gate ACPI_PARSE_DOWNWARDS DescendingCallback; 1267c478bd9Sstevel@tonic-gate ACPI_PARSE_UPWARDS AscendingCallback; 1277c478bd9Sstevel@tonic-gate 1287c478bd9Sstevel@tonic-gate } ACPI_WALK_STATE; 1297c478bd9Sstevel@tonic-gate 1307c478bd9Sstevel@tonic-gate 13126f3cdf0SGordon Ross /* Info used by AcpiNsInitializeObjects and AcpiDsInitializeObjects */ 1327c478bd9Sstevel@tonic-gate 1337c478bd9Sstevel@tonic-gate typedef struct acpi_init_walk_info 1347c478bd9Sstevel@tonic-gate { 135db2bae30SDana Myers UINT32 TableIndex; 13626f3cdf0SGordon Ross UINT32 ObjectCount; 13726f3cdf0SGordon Ross UINT32 MethodCount; 138*385cc6b4SJerry Jelinek UINT32 SerialMethodCount; 139*385cc6b4SJerry Jelinek UINT32 NonSerialMethodCount; 140*385cc6b4SJerry Jelinek UINT32 SerializedMethodCount; 14126f3cdf0SGordon Ross UINT32 DeviceCount; 14226f3cdf0SGordon Ross UINT32 OpRegionCount; 14326f3cdf0SGordon Ross UINT32 FieldCount; 14426f3cdf0SGordon Ross UINT32 BufferCount; 14526f3cdf0SGordon Ross UINT32 PackageCount; 14626f3cdf0SGordon Ross UINT32 OpRegionInit; 14726f3cdf0SGordon Ross UINT32 FieldInit; 14826f3cdf0SGordon Ross UINT32 BufferInit; 14926f3cdf0SGordon Ross UINT32 PackageInit; 15026f3cdf0SGordon Ross ACPI_OWNER_ID OwnerId; 1517c478bd9Sstevel@tonic-gate 1527c478bd9Sstevel@tonic-gate } ACPI_INIT_WALK_INFO; 1537c478bd9Sstevel@tonic-gate 1547c478bd9Sstevel@tonic-gate 1557c478bd9Sstevel@tonic-gate typedef struct acpi_get_devices_info 1567c478bd9Sstevel@tonic-gate { 1577c478bd9Sstevel@tonic-gate ACPI_WALK_CALLBACK UserFunction; 1587c478bd9Sstevel@tonic-gate void *Context; 1597c478bd9Sstevel@tonic-gate char *Hid; 1607c478bd9Sstevel@tonic-gate 1617c478bd9Sstevel@tonic-gate } ACPI_GET_DEVICES_INFO; 1627c478bd9Sstevel@tonic-gate 1637c478bd9Sstevel@tonic-gate 1647c478bd9Sstevel@tonic-gate typedef union acpi_aml_operands 1657c478bd9Sstevel@tonic-gate { 1667c478bd9Sstevel@tonic-gate ACPI_OPERAND_OBJECT *Operands[7]; 1677c478bd9Sstevel@tonic-gate 1687c478bd9Sstevel@tonic-gate struct 1697c478bd9Sstevel@tonic-gate { 1707c478bd9Sstevel@tonic-gate ACPI_OBJECT_INTEGER *Type; 1717c478bd9Sstevel@tonic-gate ACPI_OBJECT_INTEGER *Code; 1727c478bd9Sstevel@tonic-gate ACPI_OBJECT_INTEGER *Argument; 1737c478bd9Sstevel@tonic-gate 1747c478bd9Sstevel@tonic-gate } Fatal; 1757c478bd9Sstevel@tonic-gate 1767c478bd9Sstevel@tonic-gate struct 1777c478bd9Sstevel@tonic-gate { 1787c478bd9Sstevel@tonic-gate ACPI_OPERAND_OBJECT *Source; 1797c478bd9Sstevel@tonic-gate ACPI_OBJECT_INTEGER *Index; 1807c478bd9Sstevel@tonic-gate ACPI_OPERAND_OBJECT *Target; 1817c478bd9Sstevel@tonic-gate 1827c478bd9Sstevel@tonic-gate } Index; 1837c478bd9Sstevel@tonic-gate 1847c478bd9Sstevel@tonic-gate struct 1857c478bd9Sstevel@tonic-gate { 1867c478bd9Sstevel@tonic-gate ACPI_OPERAND_OBJECT *Source; 1877c478bd9Sstevel@tonic-gate ACPI_OBJECT_INTEGER *Index; 1887c478bd9Sstevel@tonic-gate ACPI_OBJECT_INTEGER *Length; 1897c478bd9Sstevel@tonic-gate ACPI_OPERAND_OBJECT *Target; 1907c478bd9Sstevel@tonic-gate 1917c478bd9Sstevel@tonic-gate } Mid; 1927c478bd9Sstevel@tonic-gate 1937c478bd9Sstevel@tonic-gate } ACPI_AML_OPERANDS; 1947c478bd9Sstevel@tonic-gate 1957c478bd9Sstevel@tonic-gate 19627f7c583Smyers /* 197*385cc6b4SJerry Jelinek * Structure used to pass object evaluation information and parameters. 19827f7c583Smyers * Purpose is to reduce CPU stack use. 19927f7c583Smyers */ 20027f7c583Smyers typedef struct acpi_evaluate_info 2017c478bd9Sstevel@tonic-gate { 202*385cc6b4SJerry Jelinek /* The first 3 elements are passed by the caller to AcpiNsEvaluate */ 203*385cc6b4SJerry Jelinek 204*385cc6b4SJerry Jelinek ACPI_NAMESPACE_NODE *PrefixNode; /* Input: starting node */ 205*385cc6b4SJerry Jelinek const char *RelativePathname; /* Input: path relative to PrefixNode */ 206*385cc6b4SJerry Jelinek ACPI_OPERAND_OBJECT **Parameters; /* Input: argument list */ 207*385cc6b4SJerry Jelinek 208*385cc6b4SJerry Jelinek ACPI_NAMESPACE_NODE *Node; /* Resolved node (PrefixNode:RelativePathname) */ 209*385cc6b4SJerry Jelinek ACPI_OPERAND_OBJECT *ObjDesc; /* Object attached to the resolved node */ 210*385cc6b4SJerry Jelinek char *FullPathname; /* Full pathname of the resolved node */ 211*385cc6b4SJerry Jelinek 212*385cc6b4SJerry Jelinek const ACPI_PREDEFINED_INFO *Predefined; /* Used if Node is a predefined name */ 213*385cc6b4SJerry Jelinek ACPI_OPERAND_OBJECT *ReturnObject; /* Object returned from the evaluation */ 214*385cc6b4SJerry Jelinek union acpi_operand_object *ParentPackage; /* Used if return object is a Package */ 215*385cc6b4SJerry Jelinek 216*385cc6b4SJerry Jelinek UINT32 ReturnFlags; /* Used for return value analysis */ 217*385cc6b4SJerry Jelinek UINT32 ReturnBtype; /* Bitmapped type of the returned object */ 218*385cc6b4SJerry Jelinek UINT16 ParamCount; /* Count of the input argument list */ 219*385cc6b4SJerry Jelinek UINT8 PassNumber; /* Parser pass number */ 220*385cc6b4SJerry Jelinek UINT8 ReturnObjectType; /* Object type of the returned object */ 221*385cc6b4SJerry Jelinek UINT8 NodeFlags; /* Same as Node->Flags */ 222*385cc6b4SJerry Jelinek UINT8 Flags; /* General flags */ 2237c478bd9Sstevel@tonic-gate 22427f7c583Smyers } ACPI_EVALUATE_INFO; 2257c478bd9Sstevel@tonic-gate 22627f7c583Smyers /* Values for Flags above */ 22727f7c583Smyers 22827f7c583Smyers #define ACPI_IGNORE_RETURN_VALUE 1 22927f7c583Smyers 230*385cc6b4SJerry Jelinek /* Defines for ReturnFlags field above */ 231*385cc6b4SJerry Jelinek 232*385cc6b4SJerry Jelinek #define ACPI_OBJECT_REPAIRED 1 233*385cc6b4SJerry Jelinek #define ACPI_OBJECT_WRAPPED 2 234*385cc6b4SJerry Jelinek 23527f7c583Smyers 23627f7c583Smyers /* Info used by AcpiNsInitializeDevices */ 23727f7c583Smyers 23827f7c583Smyers typedef struct acpi_device_walk_info 23927f7c583Smyers { 24027f7c583Smyers ACPI_TABLE_DESC *TableDesc; 24127f7c583Smyers ACPI_EVALUATE_INFO *EvaluateInfo; 24226f3cdf0SGordon Ross UINT32 DeviceCount; 24326f3cdf0SGordon Ross UINT32 Num_STA; 24426f3cdf0SGordon Ross UINT32 Num_INI; 24527f7c583Smyers 24627f7c583Smyers } ACPI_DEVICE_WALK_INFO; 24727f7c583Smyers 24827f7c583Smyers 24927f7c583Smyers /* TBD: [Restructure] Merge with struct above */ 25027f7c583Smyers 25127f7c583Smyers typedef struct acpi_walk_info 25227f7c583Smyers { 25327f7c583Smyers UINT32 DebugLevel; 25427f7c583Smyers UINT32 Count; 25527f7c583Smyers ACPI_OWNER_ID OwnerId; 25627f7c583Smyers UINT8 DisplayType; 25727f7c583Smyers 25827f7c583Smyers } ACPI_WALK_INFO; 25927f7c583Smyers 26027f7c583Smyers /* Display Types */ 26127f7c583Smyers 26227f7c583Smyers #define ACPI_DISPLAY_SUMMARY (UINT8) 0 26327f7c583Smyers #define ACPI_DISPLAY_OBJECTS (UINT8) 1 26427f7c583Smyers #define ACPI_DISPLAY_MASK (UINT8) 1 26527f7c583Smyers 26627f7c583Smyers #define ACPI_DISPLAY_SHORT (UINT8) 2 26727f7c583Smyers 2687c478bd9Sstevel@tonic-gate 2697c478bd9Sstevel@tonic-gate #endif 270