acobject.h 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703
  1. /******************************************************************************
  2. *
  3. * Name: acobject.h - Definition of ACPI_OPERAND_OBJECT (Internal object only)
  4. *
  5. *****************************************************************************/
  6. /******************************************************************************
  7. *
  8. * 1. Copyright Notice
  9. *
  10. * Some or all of this work - Copyright (c) 1999 - 2018, Intel Corp.
  11. * All rights reserved.
  12. *
  13. * 2. License
  14. *
  15. * 2.1. This is your license from Intel Corp. under its intellectual property
  16. * rights. You may have additional license terms from the party that provided
  17. * you this software, covering your right to use that party's intellectual
  18. * property rights.
  19. *
  20. * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
  21. * copy of the source code appearing in this file ("Covered Code") an
  22. * irrevocable, perpetual, worldwide license under Intel's copyrights in the
  23. * base code distributed originally by Intel ("Original Intel Code") to copy,
  24. * make derivatives, distribute, use and display any portion of the Covered
  25. * Code in any form, with the right to sublicense such rights; and
  26. *
  27. * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
  28. * license (with the right to sublicense), under only those claims of Intel
  29. * 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 thereof
  31. * solely to the minimum extent necessary to exercise the above copyright
  32. * license, and in no event shall the patent license extend to any additions
  33. * to or modifications of the Original Intel Code. No other license or right
  34. * is granted directly or by implication, estoppel or otherwise;
  35. *
  36. * The above copyright and patent license is granted only if the following
  37. * conditions are met:
  38. *
  39. * 3. Conditions
  40. *
  41. * 3.1. Redistribution of Source with Rights to Further Distribute Source.
  42. * Redistribution of source code of any substantial portion of the Covered
  43. * Code or modification with rights to further distribute source must include
  44. * 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 to
  47. * contain a file documenting the changes Licensee made to create that Covered
  48. * Code and the date of any change. Licensee must include in that file the
  49. * documentation of any changes made by any predecessor Licensee. Licensee
  50. * 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 Covered
  55. * Code or modification without rights to further distribute source must
  56. * include the following Disclaimer and Export Compliance provision in the
  57. * documentation and/or other materials provided with distribution. In
  58. * addition, Licensee may not authorize further sublicense of source of any
  59. * portion of the Covered Code, and must include terms to the effect that the
  60. * license from Licensee to its licensee is limited to the intellectual
  61. * property embodied in the software Licensee provides to its licensee, and
  62. * not to intellectual property embodied in modifications its licensee may
  63. * make.
  64. *
  65. * 3.3. Redistribution of Executable. Redistribution in executable form of any
  66. * substantial portion of the Covered Code or modification must reproduce the
  67. * above Copyright Notice, and the following Disclaimer and Export Compliance
  68. * provision in the documentation and/or other materials provided with the
  69. * distribution.
  70. *
  71. * 3.4. Intel retains all right, title, and interest in and to the Original
  72. * Intel Code.
  73. *
  74. * 3.5. Neither the name Intel nor any other trademark owned or controlled by
  75. * Intel shall be used in advertising or otherwise to promote the sale, use or
  76. * other dealings in products derived from or relating to the Covered Code
  77. * without prior written authorization from Intel.
  78. *
  79. * 4. Disclaimer and Export Compliance
  80. *
  81. * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
  82. * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
  83. * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
  84. * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
  85. * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
  86. * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
  87. * PARTICULAR PURPOSE.
  88. *
  89. * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
  90. * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
  91. * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
  92. * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
  93. * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
  94. * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
  95. * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
  96. * LIMITED REMEDY.
  97. *
  98. * 4.3. Licensee shall not export, either directly or indirectly, any of this
  99. * software or system incorporating such software without first obtaining any
  100. * required license or other approval from the U. S. Department of Commerce or
  101. * any other agency or department of the United States Government. In the
  102. * event Licensee exports any such software from the United States or
  103. * re-exports any such software from a foreign destination, Licensee shall
  104. * ensure that the distribution and export/re-export of the software is in
  105. * compliance with all laws, regulations, orders, or other restrictions of the
  106. * U.S. Export Administration Regulations. Licensee agrees that neither it nor
  107. * any of its subsidiaries will export/re-export any technical data, process,
  108. * software, or service, directly or indirectly, to any country for which the
  109. * United States government or any agency thereof requires an export license,
  110. * other governmental approval, or letter of assurance, without first obtaining
  111. * such license, approval or letter.
  112. *
  113. *****************************************************************************
  114. *
  115. * Alternatively, you may choose to be licensed under the terms of the
  116. * following license:
  117. *
  118. * Redistribution and use in source and binary forms, with or without
  119. * modification, are permitted provided that the following conditions
  120. * are met:
  121. * 1. Redistributions of source code must retain the above copyright
  122. * notice, this list of conditions, and the following disclaimer,
  123. * without modification.
  124. * 2. Redistributions in binary form must reproduce at minimum a disclaimer
  125. * substantially similar to the "NO WARRANTY" disclaimer below
  126. * ("Disclaimer") and any redistribution must be conditioned upon
  127. * including a substantially similar Disclaimer requirement for further
  128. * binary redistribution.
  129. * 3. Neither the names of the above-listed copyright holders nor the names
  130. * of any contributors may be used to endorse or promote products derived
  131. * from this software without specific prior written permission.
  132. *
  133. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  134. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  135. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  136. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  137. * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  138. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  139. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  140. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  141. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  142. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  143. * 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 the
  146. * GNU General Public License ("GPL") version 2 as published by the Free
  147. * Software Foundation.
  148. *
  149. *****************************************************************************/
  150. #ifndef _ACOBJECT_H
  151. #define _ACOBJECT_H
  152. /* acpisrc:StructDefs -- for acpisrc conversion */
  153. /*
  154. * The ACPI_OPERAND_OBJECT is used to pass AML operands from the dispatcher
  155. * to the interpreter, and to keep track of the various handlers such as
  156. * address space handlers and notify handlers. The object is a constant
  157. * size in order to allow it to be cached and reused.
  158. *
  159. * Note: The object is optimized to be aligned and will not work if it is
  160. * byte-packed.
  161. */
  162. #if ACPI_MACHINE_WIDTH == 64
  163. #pragma pack(8)
  164. #else
  165. #pragma pack(4)
  166. #endif
  167. /*******************************************************************************
  168. *
  169. * Common Descriptors
  170. *
  171. ******************************************************************************/
  172. /*
  173. * Common area for all objects.
  174. *
  175. * DescriptorType is used to differentiate between internal descriptors, and
  176. * must be in the same place across all descriptors
  177. *
  178. * Note: The DescriptorType and Type fields must appear in the identical
  179. * position in both the ACPI_NAMESPACE_NODE and ACPI_OPERAND_OBJECT
  180. * structures.
  181. */
  182. #define ACPI_OBJECT_COMMON_HEADER \
  183. union acpi_operand_object *NextObject; /* Objects linked to parent NS node */\
  184. UINT8 DescriptorType; /* To differentiate various internal objs */\
  185. UINT8 Type; /* ACPI_OBJECT_TYPE */\
  186. UINT16 ReferenceCount; /* For object deletion management */\
  187. UINT8 Flags;
  188. /*
  189. * Note: There are 3 bytes available here before the
  190. * next natural alignment boundary (for both 32/64 cases)
  191. */
  192. /* Values for Flag byte above */
  193. #define AOPOBJ_AML_CONSTANT 0x01 /* Integer is an AML constant */
  194. #define AOPOBJ_STATIC_POINTER 0x02 /* Data is part of an ACPI table, don't delete */
  195. #define AOPOBJ_DATA_VALID 0x04 /* Object is initialized and data is valid */
  196. #define AOPOBJ_OBJECT_INITIALIZED 0x08 /* Region is initialized */
  197. #define AOPOBJ_REG_CONNECTED 0x10 /* _REG was run */
  198. #define AOPOBJ_SETUP_COMPLETE 0x20 /* Region setup is complete */
  199. #define AOPOBJ_INVALID 0x40 /* Host OS won't allow a Region address */
  200. /******************************************************************************
  201. *
  202. * Basic data types
  203. *
  204. *****************************************************************************/
  205. typedef struct acpi_object_common
  206. {
  207. ACPI_OBJECT_COMMON_HEADER
  208. } ACPI_OBJECT_COMMON;
  209. typedef struct acpi_object_integer
  210. {
  211. ACPI_OBJECT_COMMON_HEADER
  212. UINT8 Fill[3]; /* Prevent warning on some compilers */
  213. UINT64 Value;
  214. } ACPI_OBJECT_INTEGER;
  215. /*
  216. * Note: The String and Buffer object must be identical through the
  217. * pointer and length elements. There is code that depends on this.
  218. *
  219. * Fields common to both Strings and Buffers
  220. */
  221. #define ACPI_COMMON_BUFFER_INFO(_Type) \
  222. _Type *Pointer; \
  223. UINT32 Length;
  224. /* Null terminated, ASCII characters only */
  225. typedef struct acpi_object_string
  226. {
  227. ACPI_OBJECT_COMMON_HEADER
  228. ACPI_COMMON_BUFFER_INFO (char) /* String in AML stream or allocated string */
  229. } ACPI_OBJECT_STRING;
  230. typedef struct acpi_object_buffer
  231. {
  232. ACPI_OBJECT_COMMON_HEADER
  233. ACPI_COMMON_BUFFER_INFO (UINT8) /* Buffer in AML stream or allocated buffer */
  234. UINT32 AmlLength;
  235. UINT8 *AmlStart;
  236. ACPI_NAMESPACE_NODE *Node; /* Link back to parent node */
  237. } ACPI_OBJECT_BUFFER;
  238. typedef struct acpi_object_package
  239. {
  240. ACPI_OBJECT_COMMON_HEADER
  241. ACPI_NAMESPACE_NODE *Node; /* Link back to parent node */
  242. union acpi_operand_object **Elements; /* Array of pointers to AcpiObjects */
  243. UINT8 *AmlStart;
  244. UINT32 AmlLength;
  245. UINT32 Count; /* # of elements in package */
  246. } ACPI_OBJECT_PACKAGE;
  247. /******************************************************************************
  248. *
  249. * Complex data types
  250. *
  251. *****************************************************************************/
  252. typedef struct acpi_object_event
  253. {
  254. ACPI_OBJECT_COMMON_HEADER
  255. ACPI_SEMAPHORE OsSemaphore; /* Actual OS synchronization object */
  256. } ACPI_OBJECT_EVENT;
  257. typedef struct acpi_object_mutex
  258. {
  259. ACPI_OBJECT_COMMON_HEADER
  260. UINT8 SyncLevel; /* 0-15, specified in Mutex() call */
  261. UINT16 AcquisitionDepth; /* Allow multiple Acquires, same thread */
  262. ACPI_MUTEX OsMutex; /* Actual OS synchronization object */
  263. ACPI_THREAD_ID ThreadId; /* Current owner of the mutex */
  264. struct acpi_thread_state *OwnerThread; /* Current owner of the mutex */
  265. union acpi_operand_object *Prev; /* Link for list of acquired mutexes */
  266. union acpi_operand_object *Next; /* Link for list of acquired mutexes */
  267. ACPI_NAMESPACE_NODE *Node; /* Containing namespace node */
  268. UINT8 OriginalSyncLevel; /* Owner's original sync level (0-15) */
  269. } ACPI_OBJECT_MUTEX;
  270. typedef struct acpi_object_region
  271. {
  272. ACPI_OBJECT_COMMON_HEADER
  273. UINT8 SpaceId;
  274. ACPI_NAMESPACE_NODE *Node; /* Containing namespace node */
  275. union acpi_operand_object *Handler; /* Handler for region access */
  276. union acpi_operand_object *Next;
  277. ACPI_PHYSICAL_ADDRESS Address;
  278. UINT32 Length;
  279. } ACPI_OBJECT_REGION;
  280. typedef struct acpi_object_method
  281. {
  282. ACPI_OBJECT_COMMON_HEADER
  283. UINT8 InfoFlags;
  284. UINT8 ParamCount;
  285. UINT8 SyncLevel;
  286. union acpi_operand_object *Mutex;
  287. union acpi_operand_object *Node;
  288. UINT8 *AmlStart;
  289. union
  290. {
  291. ACPI_INTERNAL_METHOD Implementation;
  292. union acpi_operand_object *Handler;
  293. } Dispatch;
  294. UINT32 AmlLength;
  295. UINT8 ThreadCount;
  296. ACPI_OWNER_ID OwnerId;
  297. } ACPI_OBJECT_METHOD;
  298. /* Flags for InfoFlags field above */
  299. #define ACPI_METHOD_MODULE_LEVEL 0x01 /* Method is actually module-level code */
  300. #define ACPI_METHOD_INTERNAL_ONLY 0x02 /* Method is implemented internally (_OSI) */
  301. #define ACPI_METHOD_SERIALIZED 0x04 /* Method is serialized */
  302. #define ACPI_METHOD_SERIALIZED_PENDING 0x08 /* Method is to be marked serialized */
  303. #define ACPI_METHOD_IGNORE_SYNC_LEVEL 0x10 /* Method was auto-serialized at table load time */
  304. #define ACPI_METHOD_MODIFIED_NAMESPACE 0x20 /* Method modified the namespace */
  305. /******************************************************************************
  306. *
  307. * Objects that can be notified. All share a common NotifyInfo area.
  308. *
  309. *****************************************************************************/
  310. /*
  311. * Common fields for objects that support ASL notifications
  312. */
  313. #define ACPI_COMMON_NOTIFY_INFO \
  314. union acpi_operand_object *NotifyList[2]; /* Handlers for system/device notifies */\
  315. union acpi_operand_object *Handler; /* Handler for Address space */
  316. /* COMMON NOTIFY for POWER, PROCESSOR, DEVICE, and THERMAL */
  317. typedef struct acpi_object_notify_common
  318. {
  319. ACPI_OBJECT_COMMON_HEADER
  320. ACPI_COMMON_NOTIFY_INFO
  321. } ACPI_OBJECT_NOTIFY_COMMON;
  322. typedef struct acpi_object_device
  323. {
  324. ACPI_OBJECT_COMMON_HEADER
  325. ACPI_COMMON_NOTIFY_INFO
  326. ACPI_GPE_BLOCK_INFO *GpeBlock;
  327. } ACPI_OBJECT_DEVICE;
  328. typedef struct acpi_object_power_resource
  329. {
  330. ACPI_OBJECT_COMMON_HEADER
  331. ACPI_COMMON_NOTIFY_INFO
  332. UINT32 SystemLevel;
  333. UINT32 ResourceOrder;
  334. } ACPI_OBJECT_POWER_RESOURCE;
  335. typedef struct acpi_object_processor
  336. {
  337. ACPI_OBJECT_COMMON_HEADER
  338. /* The next two fields take advantage of the 3-byte space before NOTIFY_INFO */
  339. UINT8 ProcId;
  340. UINT8 Length;
  341. ACPI_COMMON_NOTIFY_INFO
  342. ACPI_IO_ADDRESS Address;
  343. } ACPI_OBJECT_PROCESSOR;
  344. typedef struct acpi_object_thermal_zone
  345. {
  346. ACPI_OBJECT_COMMON_HEADER
  347. ACPI_COMMON_NOTIFY_INFO
  348. } ACPI_OBJECT_THERMAL_ZONE;
  349. /******************************************************************************
  350. *
  351. * Fields. All share a common header/info field.
  352. *
  353. *****************************************************************************/
  354. /*
  355. * Common bitfield for the field objects
  356. * "Field Datum" -- a datum from the actual field object
  357. * "Buffer Datum" -- a datum from a user buffer, read from or to be written to the field
  358. */
  359. #define ACPI_COMMON_FIELD_INFO \
  360. UINT8 FieldFlags; /* Access, update, and lock bits */\
  361. UINT8 Attribute; /* From AccessAs keyword */\
  362. UINT8 AccessByteWidth; /* Read/Write size in bytes */\
  363. ACPI_NAMESPACE_NODE *Node; /* Link back to parent node */\
  364. UINT32 BitLength; /* Length of field in bits */\
  365. UINT32 BaseByteOffset; /* Byte offset within containing object */\
  366. UINT32 Value; /* Value to store into the Bank or Index register */\
  367. UINT8 StartFieldBitOffset;/* Bit offset within first field datum (0-63) */\
  368. UINT8 AccessLength; /* For serial regions/fields */
  369. /* COMMON FIELD (for BUFFER, REGION, BANK, and INDEX fields) */
  370. typedef struct acpi_object_field_common
  371. {
  372. ACPI_OBJECT_COMMON_HEADER
  373. ACPI_COMMON_FIELD_INFO
  374. union acpi_operand_object *RegionObj; /* Parent Operation Region object (REGION/BANK fields only) */
  375. } ACPI_OBJECT_FIELD_COMMON;
  376. typedef struct acpi_object_region_field
  377. {
  378. ACPI_OBJECT_COMMON_HEADER
  379. ACPI_COMMON_FIELD_INFO
  380. UINT16 ResourceLength;
  381. union acpi_operand_object *RegionObj; /* Containing OpRegion object */
  382. UINT8 *ResourceBuffer; /* ResourceTemplate for serial regions/fields */
  383. UINT16 PinNumberIndex; /* Index relative to previous Connection/Template */
  384. } ACPI_OBJECT_REGION_FIELD;
  385. typedef struct acpi_object_bank_field
  386. {
  387. ACPI_OBJECT_COMMON_HEADER
  388. ACPI_COMMON_FIELD_INFO
  389. union acpi_operand_object *RegionObj; /* Containing OpRegion object */
  390. union acpi_operand_object *BankObj; /* BankSelect Register object */
  391. } ACPI_OBJECT_BANK_FIELD;
  392. typedef struct acpi_object_index_field
  393. {
  394. ACPI_OBJECT_COMMON_HEADER
  395. ACPI_COMMON_FIELD_INFO
  396. /*
  397. * No "RegionObj" pointer needed since the Index and Data registers
  398. * are each field definitions unto themselves.
  399. */
  400. union acpi_operand_object *IndexObj; /* Index register */
  401. union acpi_operand_object *DataObj; /* Data register */
  402. } ACPI_OBJECT_INDEX_FIELD;
  403. /* The BufferField is different in that it is part of a Buffer, not an OpRegion */
  404. typedef struct acpi_object_buffer_field
  405. {
  406. ACPI_OBJECT_COMMON_HEADER
  407. ACPI_COMMON_FIELD_INFO
  408. union acpi_operand_object *BufferObj; /* Containing Buffer object */
  409. } ACPI_OBJECT_BUFFER_FIELD;
  410. /******************************************************************************
  411. *
  412. * Objects for handlers
  413. *
  414. *****************************************************************************/
  415. typedef struct acpi_object_notify_handler
  416. {
  417. ACPI_OBJECT_COMMON_HEADER
  418. ACPI_NAMESPACE_NODE *Node; /* Parent device */
  419. UINT32 HandlerType; /* Type: Device/System/Both */
  420. ACPI_NOTIFY_HANDLER Handler; /* Handler address */
  421. void *Context;
  422. union acpi_operand_object *Next[2]; /* Device and System handler lists */
  423. } ACPI_OBJECT_NOTIFY_HANDLER;
  424. typedef struct acpi_object_addr_handler
  425. {
  426. ACPI_OBJECT_COMMON_HEADER
  427. UINT8 SpaceId;
  428. UINT8 HandlerFlags;
  429. ACPI_ADR_SPACE_HANDLER Handler;
  430. ACPI_NAMESPACE_NODE *Node; /* Parent device */
  431. void *Context;
  432. ACPI_ADR_SPACE_SETUP Setup;
  433. union acpi_operand_object *RegionList; /* Regions using this handler */
  434. union acpi_operand_object *Next;
  435. } ACPI_OBJECT_ADDR_HANDLER;
  436. /* Flags for address handler (HandlerFlags) */
  437. #define ACPI_ADDR_HANDLER_DEFAULT_INSTALLED 0x01
  438. /******************************************************************************
  439. *
  440. * Special internal objects
  441. *
  442. *****************************************************************************/
  443. /*
  444. * The Reference object is used for these opcodes:
  445. * Arg[0-6], Local[0-7], IndexOp, NameOp, RefOfOp, LoadOp, LoadTableOp, DebugOp
  446. * The Reference.Class differentiates these types.
  447. */
  448. typedef struct acpi_object_reference
  449. {
  450. ACPI_OBJECT_COMMON_HEADER
  451. UINT8 Class; /* Reference Class */
  452. UINT8 TargetType; /* Used for Index Op */
  453. UINT8 Resolved; /* Reference has been resolved to a value */
  454. void *Object; /* NameOp=>HANDLE to obj, IndexOp=>ACPI_OPERAND_OBJECT */
  455. ACPI_NAMESPACE_NODE *Node; /* RefOf or Namepath */
  456. union acpi_operand_object **Where; /* Target of Index */
  457. UINT8 *IndexPointer; /* Used for Buffers and Strings */
  458. UINT8 *Aml; /* Used for deferred resolution of the ref */
  459. UINT32 Value; /* Used for Local/Arg/Index/DdbHandle */
  460. } ACPI_OBJECT_REFERENCE;
  461. /* Values for Reference.Class above */
  462. typedef enum
  463. {
  464. ACPI_REFCLASS_LOCAL = 0, /* Method local */
  465. ACPI_REFCLASS_ARG = 1, /* Method argument */
  466. ACPI_REFCLASS_REFOF = 2, /* Result of RefOf() TBD: Split to Ref/Node and Ref/OperandObj? */
  467. ACPI_REFCLASS_INDEX = 3, /* Result of Index() */
  468. ACPI_REFCLASS_TABLE = 4, /* DdbHandle - Load(), LoadTable() */
  469. ACPI_REFCLASS_NAME = 5, /* Reference to a named object */
  470. ACPI_REFCLASS_DEBUG = 6, /* Debug object */
  471. ACPI_REFCLASS_MAX = 6
  472. } ACPI_REFERENCE_CLASSES;
  473. /*
  474. * Extra object is used as additional storage for types that
  475. * have AML code in their declarations (TermArgs) that must be
  476. * evaluated at run time.
  477. *
  478. * Currently: Region and FieldUnit types
  479. */
  480. typedef struct acpi_object_extra
  481. {
  482. ACPI_OBJECT_COMMON_HEADER
  483. ACPI_NAMESPACE_NODE *Method_REG; /* _REG method for this region (if any) */
  484. ACPI_NAMESPACE_NODE *ScopeNode;
  485. void *RegionContext; /* Region-specific data */
  486. UINT8 *AmlStart;
  487. UINT32 AmlLength;
  488. } ACPI_OBJECT_EXTRA;
  489. /* Additional data that can be attached to namespace nodes */
  490. typedef struct acpi_object_data
  491. {
  492. ACPI_OBJECT_COMMON_HEADER
  493. ACPI_OBJECT_HANDLER Handler;
  494. void *Pointer;
  495. } ACPI_OBJECT_DATA;
  496. /* Structure used when objects are cached for reuse */
  497. typedef struct acpi_object_cache_list
  498. {
  499. ACPI_OBJECT_COMMON_HEADER
  500. union acpi_operand_object *Next; /* Link for object cache and internal lists*/
  501. } ACPI_OBJECT_CACHE_LIST;
  502. /******************************************************************************
  503. *
  504. * ACPI_OPERAND_OBJECT Descriptor - a giant union of all of the above
  505. *
  506. *****************************************************************************/
  507. typedef union acpi_operand_object
  508. {
  509. ACPI_OBJECT_COMMON Common;
  510. ACPI_OBJECT_INTEGER Integer;
  511. ACPI_OBJECT_STRING String;
  512. ACPI_OBJECT_BUFFER Buffer;
  513. ACPI_OBJECT_PACKAGE Package;
  514. ACPI_OBJECT_EVENT Event;
  515. ACPI_OBJECT_METHOD Method;
  516. ACPI_OBJECT_MUTEX Mutex;
  517. ACPI_OBJECT_REGION Region;
  518. ACPI_OBJECT_NOTIFY_COMMON CommonNotify;
  519. ACPI_OBJECT_DEVICE Device;
  520. ACPI_OBJECT_POWER_RESOURCE PowerResource;
  521. ACPI_OBJECT_PROCESSOR Processor;
  522. ACPI_OBJECT_THERMAL_ZONE ThermalZone;
  523. ACPI_OBJECT_FIELD_COMMON CommonField;
  524. ACPI_OBJECT_REGION_FIELD Field;
  525. ACPI_OBJECT_BUFFER_FIELD BufferField;
  526. ACPI_OBJECT_BANK_FIELD BankField;
  527. ACPI_OBJECT_INDEX_FIELD IndexField;
  528. ACPI_OBJECT_NOTIFY_HANDLER Notify;
  529. ACPI_OBJECT_ADDR_HANDLER AddressSpace;
  530. ACPI_OBJECT_REFERENCE Reference;
  531. ACPI_OBJECT_EXTRA Extra;
  532. ACPI_OBJECT_DATA Data;
  533. ACPI_OBJECT_CACHE_LIST Cache;
  534. /*
  535. * Add namespace node to union in order to simplify code that accepts both
  536. * ACPI_OPERAND_OBJECTs and ACPI_NAMESPACE_NODEs. The structures share
  537. * a common DescriptorType field in order to differentiate them.
  538. */
  539. ACPI_NAMESPACE_NODE Node;
  540. } ACPI_OPERAND_OBJECT;
  541. /******************************************************************************
  542. *
  543. * ACPI_DESCRIPTOR - objects that share a common descriptor identifier
  544. *
  545. *****************************************************************************/
  546. /* Object descriptor types */
  547. #define ACPI_DESC_TYPE_CACHED 0x01 /* Used only when object is cached */
  548. #define ACPI_DESC_TYPE_STATE 0x02
  549. #define ACPI_DESC_TYPE_STATE_UPDATE 0x03
  550. #define ACPI_DESC_TYPE_STATE_PACKAGE 0x04
  551. #define ACPI_DESC_TYPE_STATE_CONTROL 0x05
  552. #define ACPI_DESC_TYPE_STATE_RPSCOPE 0x06
  553. #define ACPI_DESC_TYPE_STATE_PSCOPE 0x07
  554. #define ACPI_DESC_TYPE_STATE_WSCOPE 0x08
  555. #define ACPI_DESC_TYPE_STATE_RESULT 0x09
  556. #define ACPI_DESC_TYPE_STATE_NOTIFY 0x0A
  557. #define ACPI_DESC_TYPE_STATE_THREAD 0x0B
  558. #define ACPI_DESC_TYPE_WALK 0x0C
  559. #define ACPI_DESC_TYPE_PARSER 0x0D
  560. #define ACPI_DESC_TYPE_OPERAND 0x0E
  561. #define ACPI_DESC_TYPE_NAMED 0x0F
  562. #define ACPI_DESC_TYPE_MAX 0x0F
  563. typedef struct acpi_common_descriptor
  564. {
  565. void *CommonPointer;
  566. UINT8 DescriptorType; /* To differentiate various internal objs */
  567. } ACPI_COMMON_DESCRIPTOR;
  568. typedef union acpi_descriptor
  569. {
  570. ACPI_COMMON_DESCRIPTOR Common;
  571. ACPI_OPERAND_OBJECT Object;
  572. ACPI_NAMESPACE_NODE Node;
  573. ACPI_PARSE_OBJECT Op;
  574. } ACPI_DESCRIPTOR;
  575. #pragma pack()
  576. #endif /* _ACOBJECT_H */