acstruct.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269
  1. /******************************************************************************
  2. *
  3. * Name: acstruct.h - Internal structs
  4. *
  5. *****************************************************************************/
  6. /*
  7. * Copyright (C) 2000 - 2015, Intel Corp.
  8. * All rights reserved.
  9. *
  10. * Redistribution and use in source and binary forms, with or without
  11. * modification, are permitted provided that the following conditions
  12. * are met:
  13. * 1. Redistributions of source code must retain the above copyright
  14. * notice, this list of conditions, and the following disclaimer,
  15. * without modification.
  16. * 2. Redistributions in binary form must reproduce at minimum a disclaimer
  17. * substantially similar to the "NO WARRANTY" disclaimer below
  18. * ("Disclaimer") and any redistribution must be conditioned upon
  19. * including a substantially similar Disclaimer requirement for further
  20. * binary redistribution.
  21. * 3. Neither the names of the above-listed copyright holders nor the names
  22. * of any contributors may be used to endorse or promote products derived
  23. * from this software without specific prior written permission.
  24. *
  25. * Alternatively, this software may be distributed under the terms of the
  26. * GNU General Public License ("GPL") version 2 as published by the Free
  27. * Software Foundation.
  28. *
  29. * NO WARRANTY
  30. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  31. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  32. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
  33. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  34. * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  35. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  36. * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  37. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
  38. * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
  39. * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  40. * POSSIBILITY OF SUCH DAMAGES.
  41. */
  42. #ifndef __ACSTRUCT_H__
  43. #define __ACSTRUCT_H__
  44. /* acpisrc:StructDefs -- for acpisrc conversion */
  45. /*****************************************************************************
  46. *
  47. * Tree walking typedefs and structs
  48. *
  49. ****************************************************************************/
  50. /*
  51. * Walk state - current state of a parse tree walk. Used for both a leisurely
  52. * stroll through the tree (for whatever reason), and for control method
  53. * execution.
  54. */
  55. #define ACPI_NEXT_OP_DOWNWARD 1
  56. #define ACPI_NEXT_OP_UPWARD 2
  57. /*
  58. * Groups of definitions for WalkType used for different implementations of
  59. * walkers (never simultaneously) - flags for interpreter:
  60. */
  61. #define ACPI_WALK_NON_METHOD 0
  62. #define ACPI_WALK_METHOD 0x01
  63. #define ACPI_WALK_METHOD_RESTART 0x02
  64. typedef struct acpi_walk_state
  65. {
  66. struct acpi_walk_state *Next; /* Next WalkState in list */
  67. UINT8 DescriptorType; /* To differentiate various internal objs */
  68. UINT8 WalkType;
  69. UINT16 Opcode; /* Current AML opcode */
  70. UINT8 NextOpInfo; /* Info about NextOp */
  71. UINT8 NumOperands; /* Stack pointer for Operands[] array */
  72. UINT8 OperandIndex; /* Index into operand stack, to be used by AcpiDsObjStackPush */
  73. ACPI_OWNER_ID OwnerId; /* Owner of objects created during the walk */
  74. BOOLEAN LastPredicate; /* Result of last predicate */
  75. UINT8 CurrentResult;
  76. UINT8 ReturnUsed;
  77. UINT8 ScopeDepth;
  78. UINT8 PassNumber; /* Parse pass during table load */
  79. BOOLEAN NamespaceOverride; /* Override existing objects */
  80. UINT8 ResultSize; /* Total elements for the result stack */
  81. UINT8 ResultCount; /* Current number of occupied elements of result stack */
  82. UINT8 *Aml;
  83. UINT32 ArgTypes;
  84. UINT32 MethodBreakpoint; /* For single stepping */
  85. UINT32 UserBreakpoint; /* User AML breakpoint */
  86. UINT32 ParseFlags;
  87. ACPI_PARSE_STATE ParserState; /* Current state of parser */
  88. UINT32 PrevArgTypes;
  89. UINT32 ArgCount; /* push for fixed or var args */
  90. struct acpi_namespace_node Arguments[ACPI_METHOD_NUM_ARGS]; /* Control method arguments */
  91. struct acpi_namespace_node LocalVariables[ACPI_METHOD_NUM_LOCALS]; /* Control method locals */
  92. union acpi_operand_object *Operands[ACPI_OBJ_NUM_OPERANDS + 1]; /* Operands passed to the interpreter (+1 for NULL terminator) */
  93. union acpi_operand_object **Params;
  94. UINT8 *AmlLastWhile;
  95. union acpi_operand_object **CallerReturnDesc;
  96. ACPI_GENERIC_STATE *ControlState; /* List of control states (nested IFs) */
  97. struct acpi_namespace_node *DeferredNode; /* Used when executing deferred opcodes */
  98. union acpi_operand_object *ImplicitReturnObj;
  99. struct acpi_namespace_node *MethodCallNode; /* Called method Node*/
  100. ACPI_PARSE_OBJECT *MethodCallOp; /* MethodCall Op if running a method */
  101. union acpi_operand_object *MethodDesc; /* Method descriptor if running a method */
  102. struct acpi_namespace_node *MethodNode; /* Method node if running a method. */
  103. ACPI_PARSE_OBJECT *Op; /* Current parser op */
  104. const ACPI_OPCODE_INFO *OpInfo; /* Info on current opcode */
  105. ACPI_PARSE_OBJECT *Origin; /* Start of walk [Obsolete] */
  106. union acpi_operand_object *ResultObj;
  107. ACPI_GENERIC_STATE *Results; /* Stack of accumulated results */
  108. union acpi_operand_object *ReturnDesc; /* Return object, if any */
  109. ACPI_GENERIC_STATE *ScopeInfo; /* Stack of nested scopes */
  110. ACPI_PARSE_OBJECT *PrevOp; /* Last op that was processed */
  111. ACPI_PARSE_OBJECT *NextOp; /* next op to be processed */
  112. ACPI_THREAD_STATE *Thread;
  113. ACPI_PARSE_DOWNWARDS DescendingCallback;
  114. ACPI_PARSE_UPWARDS AscendingCallback;
  115. } ACPI_WALK_STATE;
  116. /* Info used by AcpiNsInitializeObjects and AcpiDsInitializeObjects */
  117. typedef struct acpi_init_walk_info
  118. {
  119. UINT32 TableIndex;
  120. UINT32 ObjectCount;
  121. UINT32 MethodCount;
  122. UINT32 SerialMethodCount;
  123. UINT32 NonSerialMethodCount;
  124. UINT32 SerializedMethodCount;
  125. UINT32 DeviceCount;
  126. UINT32 OpRegionCount;
  127. UINT32 FieldCount;
  128. UINT32 BufferCount;
  129. UINT32 PackageCount;
  130. UINT32 OpRegionInit;
  131. UINT32 FieldInit;
  132. UINT32 BufferInit;
  133. UINT32 PackageInit;
  134. ACPI_OWNER_ID OwnerId;
  135. } ACPI_INIT_WALK_INFO;
  136. typedef struct acpi_get_devices_info
  137. {
  138. ACPI_WALK_CALLBACK UserFunction;
  139. void *Context;
  140. char *Hid;
  141. } ACPI_GET_DEVICES_INFO;
  142. typedef union acpi_aml_operands
  143. {
  144. ACPI_OPERAND_OBJECT *Operands[7];
  145. struct
  146. {
  147. ACPI_OBJECT_INTEGER *Type;
  148. ACPI_OBJECT_INTEGER *Code;
  149. ACPI_OBJECT_INTEGER *Argument;
  150. } Fatal;
  151. struct
  152. {
  153. ACPI_OPERAND_OBJECT *Source;
  154. ACPI_OBJECT_INTEGER *Index;
  155. ACPI_OPERAND_OBJECT *Target;
  156. } Index;
  157. struct
  158. {
  159. ACPI_OPERAND_OBJECT *Source;
  160. ACPI_OBJECT_INTEGER *Index;
  161. ACPI_OBJECT_INTEGER *Length;
  162. ACPI_OPERAND_OBJECT *Target;
  163. } Mid;
  164. } ACPI_AML_OPERANDS;
  165. /*
  166. * Structure used to pass object evaluation information and parameters.
  167. * Purpose is to reduce CPU stack use.
  168. */
  169. typedef struct acpi_evaluate_info
  170. {
  171. /* The first 3 elements are passed by the caller to AcpiNsEvaluate */
  172. ACPI_NAMESPACE_NODE *PrefixNode; /* Input: starting node */
  173. char *RelativePathname; /* Input: path relative to PrefixNode */
  174. ACPI_OPERAND_OBJECT **Parameters; /* Input: argument list */
  175. ACPI_NAMESPACE_NODE *Node; /* Resolved node (PrefixNode:RelativePathname) */
  176. ACPI_OPERAND_OBJECT *ObjDesc; /* Object attached to the resolved node */
  177. char *FullPathname; /* Full pathname of the resolved node */
  178. const ACPI_PREDEFINED_INFO *Predefined; /* Used if Node is a predefined name */
  179. ACPI_OPERAND_OBJECT *ReturnObject; /* Object returned from the evaluation */
  180. union acpi_operand_object *ParentPackage; /* Used if return object is a Package */
  181. UINT32 ReturnFlags; /* Used for return value analysis */
  182. UINT32 ReturnBtype; /* Bitmapped type of the returned object */
  183. UINT16 ParamCount; /* Count of the input argument list */
  184. UINT8 PassNumber; /* Parser pass number */
  185. UINT8 ReturnObjectType; /* Object type of the returned object */
  186. UINT8 NodeFlags; /* Same as Node->Flags */
  187. UINT8 Flags; /* General flags */
  188. } ACPI_EVALUATE_INFO;
  189. /* Values for Flags above */
  190. #define ACPI_IGNORE_RETURN_VALUE 1
  191. /* Defines for ReturnFlags field above */
  192. #define ACPI_OBJECT_REPAIRED 1
  193. #define ACPI_OBJECT_WRAPPED 2
  194. /* Info used by AcpiNsInitializeDevices */
  195. typedef struct acpi_device_walk_info
  196. {
  197. ACPI_TABLE_DESC *TableDesc;
  198. ACPI_EVALUATE_INFO *EvaluateInfo;
  199. UINT32 DeviceCount;
  200. UINT32 Num_STA;
  201. UINT32 Num_INI;
  202. } ACPI_DEVICE_WALK_INFO;
  203. /* TBD: [Restructure] Merge with struct above */
  204. typedef struct acpi_walk_info
  205. {
  206. UINT32 DebugLevel;
  207. UINT32 Count;
  208. ACPI_OWNER_ID OwnerId;
  209. UINT8 DisplayType;
  210. } ACPI_WALK_INFO;
  211. /* Display Types */
  212. #define ACPI_DISPLAY_SUMMARY (UINT8) 0
  213. #define ACPI_DISPLAY_OBJECTS (UINT8) 1
  214. #define ACPI_DISPLAY_MASK (UINT8) 1
  215. #define ACPI_DISPLAY_SHORT (UINT8) 2
  216. #endif