aclocal.h 48 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438
  1. /******************************************************************************
  2. *
  3. * Name: aclocal.h - Internal data types used across the ACPI subsystem
  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 __ACLOCAL_H__
  43. #define __ACLOCAL_H__
  44. /* acpisrc:StructDefs -- for acpisrc conversion */
  45. #define ACPI_SERIALIZED 0xFF
  46. typedef UINT32 ACPI_MUTEX_HANDLE;
  47. #define ACPI_GLOBAL_LOCK (ACPI_SEMAPHORE) (-1)
  48. /* Total number of aml opcodes defined */
  49. #define AML_NUM_OPCODES 0x82
  50. /* Forward declarations */
  51. struct acpi_walk_state;
  52. struct acpi_obj_mutex;
  53. union acpi_parse_object;
  54. /*****************************************************************************
  55. *
  56. * Mutex typedefs and structs
  57. *
  58. ****************************************************************************/
  59. /*
  60. * Predefined handles for the mutex objects used within the subsystem
  61. * All mutex objects are automatically created by AcpiUtMutexInitialize.
  62. *
  63. * The acquire/release ordering protocol is implied via this list. Mutexes
  64. * with a lower value must be acquired before mutexes with a higher value.
  65. *
  66. * NOTE: any changes here must be reflected in the AcpiGbl_MutexNames
  67. * table below also!
  68. */
  69. #define ACPI_MTX_INTERPRETER 0 /* AML Interpreter, main lock */
  70. #define ACPI_MTX_NAMESPACE 1 /* ACPI Namespace */
  71. #define ACPI_MTX_TABLES 2 /* Data for ACPI tables */
  72. #define ACPI_MTX_EVENTS 3 /* Data for ACPI events */
  73. #define ACPI_MTX_CACHES 4 /* Internal caches, general purposes */
  74. #define ACPI_MTX_MEMORY 5 /* Debug memory tracking lists */
  75. #define ACPI_MAX_MUTEX 5
  76. #define ACPI_NUM_MUTEX ACPI_MAX_MUTEX+1
  77. /* Lock structure for reader/writer interfaces */
  78. typedef struct acpi_rw_lock
  79. {
  80. ACPI_MUTEX WriterMutex;
  81. ACPI_MUTEX ReaderMutex;
  82. UINT32 NumReaders;
  83. } ACPI_RW_LOCK;
  84. /*
  85. * Predefined handles for spinlocks used within the subsystem.
  86. * These spinlocks are created by AcpiUtMutexInitialize
  87. */
  88. #define ACPI_LOCK_GPES 0
  89. #define ACPI_LOCK_HARDWARE 1
  90. #define ACPI_MAX_LOCK 1
  91. #define ACPI_NUM_LOCK ACPI_MAX_LOCK+1
  92. /* This Thread ID means that the mutex is not in use (unlocked) */
  93. #define ACPI_MUTEX_NOT_ACQUIRED (ACPI_THREAD_ID) -1
  94. /* This Thread ID means an invalid thread ID */
  95. #ifdef ACPI_OS_INVALID_THREAD_ID
  96. #define ACPI_INVALID_THREAD_ID ACPI_OS_INVALID_THREAD_ID
  97. #else
  98. #define ACPI_INVALID_THREAD_ID ((ACPI_THREAD_ID) 0xFFFFFFFF)
  99. #endif
  100. /* Table for the global mutexes */
  101. typedef struct acpi_mutex_info
  102. {
  103. ACPI_MUTEX Mutex;
  104. UINT32 UseCount;
  105. ACPI_THREAD_ID ThreadId;
  106. } ACPI_MUTEX_INFO;
  107. /* Lock flag parameter for various interfaces */
  108. #define ACPI_MTX_DO_NOT_LOCK 0
  109. #define ACPI_MTX_LOCK 1
  110. /* Field access granularities */
  111. #define ACPI_FIELD_BYTE_GRANULARITY 1
  112. #define ACPI_FIELD_WORD_GRANULARITY 2
  113. #define ACPI_FIELD_DWORD_GRANULARITY 4
  114. #define ACPI_FIELD_QWORD_GRANULARITY 8
  115. #define ACPI_ENTRY_NOT_FOUND NULL
  116. /*****************************************************************************
  117. *
  118. * Namespace typedefs and structs
  119. *
  120. ****************************************************************************/
  121. /* Operational modes of the AML interpreter/scanner */
  122. typedef enum
  123. {
  124. ACPI_IMODE_LOAD_PASS1 = 0x01,
  125. ACPI_IMODE_LOAD_PASS2 = 0x02,
  126. ACPI_IMODE_EXECUTE = 0x03
  127. } ACPI_INTERPRETER_MODE;
  128. /*
  129. * The Namespace Node describes a named object that appears in the AML.
  130. * DescriptorType is used to differentiate between internal descriptors.
  131. *
  132. * The node is optimized for both 32-bit and 64-bit platforms:
  133. * 20 bytes for the 32-bit case, 32 bytes for the 64-bit case.
  134. *
  135. * Note: The DescriptorType and Type fields must appear in the identical
  136. * position in both the ACPI_NAMESPACE_NODE and ACPI_OPERAND_OBJECT
  137. * structures.
  138. */
  139. typedef struct acpi_namespace_node
  140. {
  141. union acpi_operand_object *Object; /* Interpreter object */
  142. UINT8 DescriptorType; /* Differentiate object descriptor types */
  143. UINT8 Type; /* ACPI Type associated with this name */
  144. UINT8 Flags; /* Miscellaneous flags */
  145. ACPI_OWNER_ID OwnerId; /* Node creator */
  146. ACPI_NAME_UNION Name; /* ACPI Name, always 4 chars per ACPI spec */
  147. struct acpi_namespace_node *Parent; /* Parent node */
  148. struct acpi_namespace_node *Child; /* First child */
  149. struct acpi_namespace_node *Peer; /* First peer */
  150. /*
  151. * The following fields are used by the ASL compiler and disassembler only
  152. */
  153. #ifdef ACPI_LARGE_NAMESPACE_NODE
  154. union acpi_parse_object *Op;
  155. void *MethodLocals;
  156. void *MethodArgs;
  157. UINT32 Value;
  158. UINT32 Length;
  159. UINT8 ArgCount;
  160. #endif
  161. } ACPI_NAMESPACE_NODE;
  162. /* Namespace Node flags */
  163. #define ANOBJ_RESERVED 0x01 /* Available for use */
  164. #define ANOBJ_TEMPORARY 0x02 /* Node is create by a method and is temporary */
  165. #define ANOBJ_METHOD_ARG 0x04 /* Node is a method argument */
  166. #define ANOBJ_METHOD_LOCAL 0x08 /* Node is a method local */
  167. #define ANOBJ_SUBTREE_HAS_INI 0x10 /* Used to optimize device initialization */
  168. #define ANOBJ_EVALUATED 0x20 /* Set on first evaluation of node */
  169. #define ANOBJ_ALLOCATED_BUFFER 0x40 /* Method AML buffer is dynamic (InstallMethod) */
  170. #define ANOBJ_IS_EXTERNAL 0x08 /* iASL only: This object created via External() */
  171. #define ANOBJ_METHOD_NO_RETVAL 0x10 /* iASL only: Method has no return value */
  172. #define ANOBJ_METHOD_SOME_NO_RETVAL 0x20 /* iASL only: Method has at least one return value */
  173. #define ANOBJ_IS_REFERENCED 0x80 /* iASL only: Object was referenced */
  174. /* Internal ACPI table management - master table list */
  175. typedef struct acpi_table_list
  176. {
  177. ACPI_TABLE_DESC *Tables; /* Table descriptor array */
  178. UINT32 CurrentTableCount; /* Tables currently in the array */
  179. UINT32 MaxTableCount; /* Max tables array will hold */
  180. UINT8 Flags;
  181. } ACPI_TABLE_LIST;
  182. /* Flags for above */
  183. #define ACPI_ROOT_ORIGIN_UNKNOWN (0) /* ~ORIGIN_ALLOCATED */
  184. #define ACPI_ROOT_ORIGIN_ALLOCATED (1)
  185. #define ACPI_ROOT_ALLOW_RESIZE (2)
  186. /* List to manage incoming ACPI tables */
  187. typedef struct acpi_new_table_desc
  188. {
  189. ACPI_TABLE_HEADER *Table;
  190. struct acpi_new_table_desc *Next;
  191. } ACPI_NEW_TABLE_DESC;
  192. /* Predefined table indexes */
  193. #define ACPI_INVALID_TABLE_INDEX (0xFFFFFFFF)
  194. typedef struct acpi_find_context
  195. {
  196. char *SearchFor;
  197. ACPI_HANDLE *List;
  198. UINT32 *Count;
  199. } ACPI_FIND_CONTEXT;
  200. typedef struct acpi_ns_search_data
  201. {
  202. ACPI_NAMESPACE_NODE *Node;
  203. } ACPI_NS_SEARCH_DATA;
  204. /* Object types used during package copies */
  205. #define ACPI_COPY_TYPE_SIMPLE 0
  206. #define ACPI_COPY_TYPE_PACKAGE 1
  207. /* Info structure used to convert external<->internal namestrings */
  208. typedef struct acpi_namestring_info
  209. {
  210. const char *ExternalName;
  211. const char *NextExternalChar;
  212. char *InternalName;
  213. UINT32 Length;
  214. UINT32 NumSegments;
  215. UINT32 NumCarats;
  216. BOOLEAN FullyQualified;
  217. } ACPI_NAMESTRING_INFO;
  218. /* Field creation info */
  219. typedef struct acpi_create_field_info
  220. {
  221. ACPI_NAMESPACE_NODE *RegionNode;
  222. ACPI_NAMESPACE_NODE *FieldNode;
  223. ACPI_NAMESPACE_NODE *RegisterNode;
  224. ACPI_NAMESPACE_NODE *DataRegisterNode;
  225. ACPI_NAMESPACE_NODE *ConnectionNode;
  226. UINT8 *ResourceBuffer;
  227. UINT32 BankValue;
  228. UINT32 FieldBitPosition;
  229. UINT32 FieldBitLength;
  230. UINT16 ResourceLength;
  231. UINT16 PinNumberIndex;
  232. UINT8 FieldFlags;
  233. UINT8 Attribute;
  234. UINT8 FieldType;
  235. UINT8 AccessLength;
  236. } ACPI_CREATE_FIELD_INFO;
  237. typedef
  238. ACPI_STATUS (*ACPI_INTERNAL_METHOD) (
  239. struct acpi_walk_state *WalkState);
  240. /*
  241. * Bitmapped ACPI types. Used internally only
  242. */
  243. #define ACPI_BTYPE_ANY 0x00000000
  244. #define ACPI_BTYPE_INTEGER 0x00000001
  245. #define ACPI_BTYPE_STRING 0x00000002
  246. #define ACPI_BTYPE_BUFFER 0x00000004
  247. #define ACPI_BTYPE_PACKAGE 0x00000008
  248. #define ACPI_BTYPE_FIELD_UNIT 0x00000010
  249. #define ACPI_BTYPE_DEVICE 0x00000020
  250. #define ACPI_BTYPE_EVENT 0x00000040
  251. #define ACPI_BTYPE_METHOD 0x00000080
  252. #define ACPI_BTYPE_MUTEX 0x00000100
  253. #define ACPI_BTYPE_REGION 0x00000200
  254. #define ACPI_BTYPE_POWER 0x00000400
  255. #define ACPI_BTYPE_PROCESSOR 0x00000800
  256. #define ACPI_BTYPE_THERMAL 0x00001000
  257. #define ACPI_BTYPE_BUFFER_FIELD 0x00002000
  258. #define ACPI_BTYPE_DDB_HANDLE 0x00004000
  259. #define ACPI_BTYPE_DEBUG_OBJECT 0x00008000
  260. #define ACPI_BTYPE_REFERENCE_OBJECT 0x00010000 /* From Index(), RefOf(), etc (Type6Opcodes) */
  261. #define ACPI_BTYPE_RESOURCE 0x00020000
  262. #define ACPI_BTYPE_NAMED_REFERENCE 0x00040000 /* Generic unresolved Name or Namepath */
  263. #define ACPI_BTYPE_COMPUTE_DATA (ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING | ACPI_BTYPE_BUFFER)
  264. #define ACPI_BTYPE_DATA (ACPI_BTYPE_COMPUTE_DATA | ACPI_BTYPE_PACKAGE)
  265. /* Used by Copy, DeRefOf, Store, Printf, Fprintf */
  266. #define ACPI_BTYPE_DATA_REFERENCE (ACPI_BTYPE_DATA | ACPI_BTYPE_REFERENCE_OBJECT | ACPI_BTYPE_DDB_HANDLE)
  267. #define ACPI_BTYPE_DEVICE_OBJECTS (ACPI_BTYPE_DEVICE | ACPI_BTYPE_THERMAL | ACPI_BTYPE_PROCESSOR)
  268. #define ACPI_BTYPE_OBJECTS_AND_REFS 0x0001FFFF /* ARG or LOCAL */
  269. #define ACPI_BTYPE_ALL_OBJECTS 0x0000FFFF
  270. #pragma pack(1)
  271. /*
  272. * Information structure for ACPI predefined names.
  273. * Each entry in the table contains the following items:
  274. *
  275. * Name - The ACPI reserved name
  276. * ParamCount - Number of arguments to the method
  277. * ExpectedReturnBtypes - Allowed type(s) for the return value
  278. */
  279. typedef struct acpi_name_info
  280. {
  281. char Name[ACPI_NAME_SIZE];
  282. UINT16 ArgumentList;
  283. UINT8 ExpectedBtypes;
  284. } ACPI_NAME_INFO;
  285. /*
  286. * Secondary information structures for ACPI predefined objects that return
  287. * package objects. This structure appears as the next entry in the table
  288. * after the NAME_INFO structure above.
  289. *
  290. * The reason for this is to minimize the size of the predefined name table.
  291. */
  292. /*
  293. * Used for ACPI_PTYPE1_FIXED, ACPI_PTYPE1_VAR, ACPI_PTYPE2,
  294. * ACPI_PTYPE2_MIN, ACPI_PTYPE2_PKG_COUNT, ACPI_PTYPE2_COUNT,
  295. * ACPI_PTYPE2_FIX_VAR
  296. */
  297. typedef struct acpi_package_info
  298. {
  299. UINT8 Type;
  300. UINT8 ObjectType1;
  301. UINT8 Count1;
  302. UINT8 ObjectType2;
  303. UINT8 Count2;
  304. UINT16 Reserved;
  305. } ACPI_PACKAGE_INFO;
  306. /* Used for ACPI_PTYPE2_FIXED */
  307. typedef struct acpi_package_info2
  308. {
  309. UINT8 Type;
  310. UINT8 Count;
  311. UINT8 ObjectType[4];
  312. UINT8 Reserved;
  313. } ACPI_PACKAGE_INFO2;
  314. /* Used for ACPI_PTYPE1_OPTION */
  315. typedef struct acpi_package_info3
  316. {
  317. UINT8 Type;
  318. UINT8 Count;
  319. UINT8 ObjectType[2];
  320. UINT8 TailObjectType;
  321. UINT16 Reserved;
  322. } ACPI_PACKAGE_INFO3;
  323. typedef struct acpi_package_info4
  324. {
  325. UINT8 Type;
  326. UINT8 ObjectType1;
  327. UINT8 Count1;
  328. UINT8 SubObjectTypes;
  329. UINT8 PkgCount;
  330. UINT16 Reserved;
  331. } ACPI_PACKAGE_INFO4;
  332. typedef union acpi_predefined_info
  333. {
  334. ACPI_NAME_INFO Info;
  335. ACPI_PACKAGE_INFO RetInfo;
  336. ACPI_PACKAGE_INFO2 RetInfo2;
  337. ACPI_PACKAGE_INFO3 RetInfo3;
  338. ACPI_PACKAGE_INFO4 RetInfo4;
  339. } ACPI_PREDEFINED_INFO;
  340. /* Reset to default packing */
  341. #pragma pack()
  342. /* Return object auto-repair info */
  343. typedef ACPI_STATUS (*ACPI_OBJECT_CONVERTER) (
  344. struct acpi_namespace_node *Scope,
  345. union acpi_operand_object *OriginalObject,
  346. union acpi_operand_object **ConvertedObject);
  347. typedef struct acpi_simple_repair_info
  348. {
  349. char Name[ACPI_NAME_SIZE];
  350. UINT32 UnexpectedBtypes;
  351. UINT32 PackageIndex;
  352. ACPI_OBJECT_CONVERTER ObjectConverter;
  353. } ACPI_SIMPLE_REPAIR_INFO;
  354. /*
  355. * Bitmapped return value types
  356. * Note: the actual data types must be contiguous, a loop in nspredef.c
  357. * depends on this.
  358. */
  359. #define ACPI_RTYPE_ANY 0x00
  360. #define ACPI_RTYPE_NONE 0x01
  361. #define ACPI_RTYPE_INTEGER 0x02
  362. #define ACPI_RTYPE_STRING 0x04
  363. #define ACPI_RTYPE_BUFFER 0x08
  364. #define ACPI_RTYPE_PACKAGE 0x10
  365. #define ACPI_RTYPE_REFERENCE 0x20
  366. #define ACPI_RTYPE_ALL 0x3F
  367. #define ACPI_NUM_RTYPES 5 /* Number of actual object types */
  368. /* Info for running the _REG methods */
  369. typedef struct acpi_reg_walk_info
  370. {
  371. ACPI_ADR_SPACE_TYPE SpaceId;
  372. UINT32 Function;
  373. UINT32 RegRunCount;
  374. } ACPI_REG_WALK_INFO;
  375. /*****************************************************************************
  376. *
  377. * Event typedefs and structs
  378. *
  379. ****************************************************************************/
  380. /* Dispatch info for each host-installed SCI handler */
  381. typedef struct acpi_sci_handler_info
  382. {
  383. struct acpi_sci_handler_info *Next;
  384. ACPI_SCI_HANDLER Address; /* Address of handler */
  385. void *Context; /* Context to be passed to handler */
  386. } ACPI_SCI_HANDLER_INFO;
  387. /* Dispatch info for each GPE -- either a method or handler, cannot be both */
  388. typedef struct acpi_gpe_handler_info
  389. {
  390. ACPI_GPE_HANDLER Address; /* Address of handler, if any */
  391. void *Context; /* Context to be passed to handler */
  392. ACPI_NAMESPACE_NODE *MethodNode; /* Method node for this GPE level (saved) */
  393. UINT8 OriginalFlags; /* Original (pre-handler) GPE info */
  394. BOOLEAN OriginallyEnabled; /* True if GPE was originally enabled */
  395. } ACPI_GPE_HANDLER_INFO;
  396. /* Notify info for implicit notify, multiple device objects */
  397. typedef struct acpi_gpe_notify_info
  398. {
  399. ACPI_NAMESPACE_NODE *DeviceNode; /* Device to be notified */
  400. struct acpi_gpe_notify_info *Next;
  401. } ACPI_GPE_NOTIFY_INFO;
  402. /*
  403. * GPE dispatch info. At any time, the GPE can have at most one type
  404. * of dispatch - Method, Handler, or Implicit Notify.
  405. */
  406. typedef union acpi_gpe_dispatch_info
  407. {
  408. ACPI_NAMESPACE_NODE *MethodNode; /* Method node for this GPE level */
  409. ACPI_GPE_HANDLER_INFO *Handler; /* Installed GPE handler */
  410. ACPI_GPE_NOTIFY_INFO *NotifyList; /* List of _PRW devices for implicit notifies */
  411. } ACPI_GPE_DISPATCH_INFO;
  412. /*
  413. * Information about a GPE, one per each GPE in an array.
  414. * NOTE: Important to keep this struct as small as possible.
  415. */
  416. typedef struct acpi_gpe_event_info
  417. {
  418. union acpi_gpe_dispatch_info Dispatch; /* Either Method, Handler, or NotifyList */
  419. struct acpi_gpe_register_info *RegisterInfo; /* Backpointer to register info */
  420. UINT8 Flags; /* Misc info about this GPE */
  421. UINT8 GpeNumber; /* This GPE */
  422. UINT8 RuntimeCount; /* References to a run GPE */
  423. } ACPI_GPE_EVENT_INFO;
  424. /* Information about a GPE register pair, one per each status/enable pair in an array */
  425. typedef struct acpi_gpe_register_info
  426. {
  427. ACPI_GENERIC_ADDRESS StatusAddress; /* Address of status reg */
  428. ACPI_GENERIC_ADDRESS EnableAddress; /* Address of enable reg */
  429. UINT16 BaseGpeNumber; /* Base GPE number for this register */
  430. UINT8 EnableForWake; /* GPEs to keep enabled when sleeping */
  431. UINT8 EnableForRun; /* GPEs to keep enabled when running */
  432. UINT8 EnableMask; /* Current mask of enabled GPEs */
  433. } ACPI_GPE_REGISTER_INFO;
  434. /*
  435. * Information about a GPE register block, one per each installed block --
  436. * GPE0, GPE1, and one per each installed GPE Block Device.
  437. */
  438. typedef struct acpi_gpe_block_info
  439. {
  440. ACPI_NAMESPACE_NODE *Node;
  441. struct acpi_gpe_block_info *Previous;
  442. struct acpi_gpe_block_info *Next;
  443. struct acpi_gpe_xrupt_info *XruptBlock; /* Backpointer to interrupt block */
  444. ACPI_GPE_REGISTER_INFO *RegisterInfo; /* One per GPE register pair */
  445. ACPI_GPE_EVENT_INFO *EventInfo; /* One for each GPE */
  446. UINT64 Address; /* Base address of the block */
  447. UINT32 RegisterCount; /* Number of register pairs in block */
  448. UINT16 GpeCount; /* Number of individual GPEs in block */
  449. UINT16 BlockBaseNumber;/* Base GPE number for this block */
  450. UINT8 SpaceId;
  451. BOOLEAN Initialized; /* TRUE if this block is initialized */
  452. } ACPI_GPE_BLOCK_INFO;
  453. /* Information about GPE interrupt handlers, one per each interrupt level used for GPEs */
  454. typedef struct acpi_gpe_xrupt_info
  455. {
  456. struct acpi_gpe_xrupt_info *Previous;
  457. struct acpi_gpe_xrupt_info *Next;
  458. ACPI_GPE_BLOCK_INFO *GpeBlockListHead; /* List of GPE blocks for this xrupt */
  459. UINT32 InterruptNumber; /* System interrupt number */
  460. } ACPI_GPE_XRUPT_INFO;
  461. typedef struct acpi_gpe_walk_info
  462. {
  463. ACPI_NAMESPACE_NODE *GpeDevice;
  464. ACPI_GPE_BLOCK_INFO *GpeBlock;
  465. UINT16 Count;
  466. ACPI_OWNER_ID OwnerId;
  467. BOOLEAN ExecuteByOwnerId;
  468. } ACPI_GPE_WALK_INFO;
  469. typedef struct acpi_gpe_device_info
  470. {
  471. UINT32 Index;
  472. UINT32 NextBlockBaseIndex;
  473. ACPI_STATUS Status;
  474. ACPI_NAMESPACE_NODE *GpeDevice;
  475. } ACPI_GPE_DEVICE_INFO;
  476. typedef ACPI_STATUS (*ACPI_GPE_CALLBACK) (
  477. ACPI_GPE_XRUPT_INFO *GpeXruptInfo,
  478. ACPI_GPE_BLOCK_INFO *GpeBlock,
  479. void *Context);
  480. /* Information about each particular fixed event */
  481. typedef struct acpi_fixed_event_handler
  482. {
  483. ACPI_EVENT_HANDLER Handler; /* Address of handler. */
  484. void *Context; /* Context to be passed to handler */
  485. } ACPI_FIXED_EVENT_HANDLER;
  486. typedef struct acpi_fixed_event_info
  487. {
  488. UINT8 StatusRegisterId;
  489. UINT8 EnableRegisterId;
  490. UINT16 StatusBitMask;
  491. UINT16 EnableBitMask;
  492. } ACPI_FIXED_EVENT_INFO;
  493. /* Information used during field processing */
  494. typedef struct acpi_field_info
  495. {
  496. UINT8 SkipField;
  497. UINT8 FieldFlag;
  498. UINT32 PkgLength;
  499. } ACPI_FIELD_INFO;
  500. /*****************************************************************************
  501. *
  502. * Generic "state" object for stacks
  503. *
  504. ****************************************************************************/
  505. #define ACPI_CONTROL_NORMAL 0xC0
  506. #define ACPI_CONTROL_CONDITIONAL_EXECUTING 0xC1
  507. #define ACPI_CONTROL_PREDICATE_EXECUTING 0xC2
  508. #define ACPI_CONTROL_PREDICATE_FALSE 0xC3
  509. #define ACPI_CONTROL_PREDICATE_TRUE 0xC4
  510. #define ACPI_STATE_COMMON \
  511. void *Next; \
  512. UINT8 DescriptorType; /* To differentiate various internal objs */\
  513. UINT8 Flags; \
  514. UINT16 Value; \
  515. UINT16 State;
  516. /* There are 2 bytes available here until the next natural alignment boundary */
  517. typedef struct acpi_common_state
  518. {
  519. ACPI_STATE_COMMON
  520. } ACPI_COMMON_STATE;
  521. /*
  522. * Update state - used to traverse complex objects such as packages
  523. */
  524. typedef struct acpi_update_state
  525. {
  526. ACPI_STATE_COMMON
  527. union acpi_operand_object *Object;
  528. } ACPI_UPDATE_STATE;
  529. /*
  530. * Pkg state - used to traverse nested package structures
  531. */
  532. typedef struct acpi_pkg_state
  533. {
  534. ACPI_STATE_COMMON
  535. UINT16 Index;
  536. union acpi_operand_object *SourceObject;
  537. union acpi_operand_object *DestObject;
  538. struct acpi_walk_state *WalkState;
  539. void *ThisTargetObj;
  540. UINT32 NumPackages;
  541. } ACPI_PKG_STATE;
  542. /*
  543. * Control state - one per if/else and while constructs.
  544. * Allows nesting of these constructs
  545. */
  546. typedef struct acpi_control_state
  547. {
  548. ACPI_STATE_COMMON
  549. UINT16 Opcode;
  550. union acpi_parse_object *PredicateOp;
  551. UINT8 *AmlPredicateStart; /* Start of if/while predicate */
  552. UINT8 *PackageEnd; /* End of if/while block */
  553. UINT32 LoopCount; /* While() loop counter */
  554. } ACPI_CONTROL_STATE;
  555. /*
  556. * Scope state - current scope during namespace lookups
  557. */
  558. typedef struct acpi_scope_state
  559. {
  560. ACPI_STATE_COMMON
  561. ACPI_NAMESPACE_NODE *Node;
  562. } ACPI_SCOPE_STATE;
  563. typedef struct acpi_pscope_state
  564. {
  565. ACPI_STATE_COMMON
  566. UINT32 ArgCount; /* Number of fixed arguments */
  567. union acpi_parse_object *Op; /* Current op being parsed */
  568. UINT8 *ArgEnd; /* Current argument end */
  569. UINT8 *PkgEnd; /* Current package end */
  570. UINT32 ArgList; /* Next argument to parse */
  571. } ACPI_PSCOPE_STATE;
  572. /*
  573. * Thread state - one per thread across multiple walk states. Multiple walk
  574. * states are created when there are nested control methods executing.
  575. */
  576. typedef struct acpi_thread_state
  577. {
  578. ACPI_STATE_COMMON
  579. UINT8 CurrentSyncLevel; /* Mutex Sync (nested acquire) level */
  580. struct acpi_walk_state *WalkStateList; /* Head of list of WalkStates for this thread */
  581. union acpi_operand_object *AcquiredMutexList; /* List of all currently acquired mutexes */
  582. ACPI_THREAD_ID ThreadId; /* Running thread ID */
  583. } ACPI_THREAD_STATE;
  584. /*
  585. * Result values - used to accumulate the results of nested
  586. * AML arguments
  587. */
  588. typedef struct acpi_result_values
  589. {
  590. ACPI_STATE_COMMON
  591. union acpi_operand_object *ObjDesc [ACPI_RESULTS_FRAME_OBJ_NUM];
  592. } ACPI_RESULT_VALUES;
  593. typedef
  594. ACPI_STATUS (*ACPI_PARSE_DOWNWARDS) (
  595. struct acpi_walk_state *WalkState,
  596. union acpi_parse_object **OutOp);
  597. typedef
  598. ACPI_STATUS (*ACPI_PARSE_UPWARDS) (
  599. struct acpi_walk_state *WalkState);
  600. /* Global handlers for AML Notifies */
  601. typedef struct acpi_global_notify_handler
  602. {
  603. ACPI_NOTIFY_HANDLER Handler;
  604. void *Context;
  605. } ACPI_GLOBAL_NOTIFY_HANDLER;
  606. /*
  607. * Notify info - used to pass info to the deferred notify
  608. * handler/dispatcher.
  609. */
  610. typedef struct acpi_notify_info
  611. {
  612. ACPI_STATE_COMMON
  613. UINT8 HandlerListId;
  614. ACPI_NAMESPACE_NODE *Node;
  615. union acpi_operand_object *HandlerListHead;
  616. ACPI_GLOBAL_NOTIFY_HANDLER *Global;
  617. } ACPI_NOTIFY_INFO;
  618. /* Generic state is union of structs above */
  619. typedef union acpi_generic_state
  620. {
  621. ACPI_COMMON_STATE Common;
  622. ACPI_CONTROL_STATE Control;
  623. ACPI_UPDATE_STATE Update;
  624. ACPI_SCOPE_STATE Scope;
  625. ACPI_PSCOPE_STATE ParseScope;
  626. ACPI_PKG_STATE Pkg;
  627. ACPI_THREAD_STATE Thread;
  628. ACPI_RESULT_VALUES Results;
  629. ACPI_NOTIFY_INFO Notify;
  630. } ACPI_GENERIC_STATE;
  631. /*****************************************************************************
  632. *
  633. * Interpreter typedefs and structs
  634. *
  635. ****************************************************************************/
  636. typedef
  637. ACPI_STATUS (*ACPI_EXECUTE_OP) (
  638. struct acpi_walk_state *WalkState);
  639. /* Address Range info block */
  640. typedef struct acpi_address_range
  641. {
  642. struct acpi_address_range *Next;
  643. ACPI_NAMESPACE_NODE *RegionNode;
  644. ACPI_PHYSICAL_ADDRESS StartAddress;
  645. ACPI_PHYSICAL_ADDRESS EndAddress;
  646. } ACPI_ADDRESS_RANGE;
  647. /*****************************************************************************
  648. *
  649. * Parser typedefs and structs
  650. *
  651. ****************************************************************************/
  652. /*
  653. * AML opcode, name, and argument layout
  654. */
  655. typedef struct acpi_opcode_info
  656. {
  657. #if defined(ACPI_DISASSEMBLER) || defined(ACPI_DEBUG_OUTPUT)
  658. char *Name; /* Opcode name (disassembler/debug only) */
  659. #endif
  660. UINT32 ParseArgs; /* Grammar/Parse time arguments */
  661. UINT32 RuntimeArgs; /* Interpret time arguments */
  662. UINT16 Flags; /* Misc flags */
  663. UINT8 ObjectType; /* Corresponding internal object type */
  664. UINT8 Class; /* Opcode class */
  665. UINT8 Type; /* Opcode type */
  666. } ACPI_OPCODE_INFO;
  667. /* Structure for Resource Tag information */
  668. typedef struct acpi_tag_info
  669. {
  670. UINT32 BitOffset;
  671. UINT32 BitLength;
  672. } ACPI_TAG_INFO;
  673. /* Value associated with the parse object */
  674. typedef union acpi_parse_value
  675. {
  676. UINT64 Integer; /* Integer constant (Up to 64 bits) */
  677. UINT32 Size; /* bytelist or field size */
  678. char *String; /* NULL terminated string */
  679. UINT8 *Buffer; /* buffer or string */
  680. char *Name; /* NULL terminated string */
  681. union acpi_parse_object *Arg; /* arguments and contained ops */
  682. ACPI_TAG_INFO Tag; /* Resource descriptor tag info */
  683. } ACPI_PARSE_VALUE;
  684. #if defined(ACPI_DISASSEMBLER) || defined(ACPI_DEBUG_OUTPUT)
  685. #define ACPI_DISASM_ONLY_MEMBERS(a) a;
  686. #else
  687. #define ACPI_DISASM_ONLY_MEMBERS(a)
  688. #endif
  689. #define ACPI_PARSE_COMMON \
  690. union acpi_parse_object *Parent; /* Parent op */\
  691. UINT8 DescriptorType; /* To differentiate various internal objs */\
  692. UINT8 Flags; /* Type of Op */\
  693. UINT16 AmlOpcode; /* AML opcode */\
  694. UINT8 *Aml; /* Address of declaration in AML */\
  695. union acpi_parse_object *Next; /* Next op */\
  696. ACPI_NAMESPACE_NODE *Node; /* For use by interpreter */\
  697. ACPI_PARSE_VALUE Value; /* Value or args associated with the opcode */\
  698. UINT8 ArgListLength; /* Number of elements in the arg list */\
  699. ACPI_DISASM_ONLY_MEMBERS (\
  700. UINT8 DisasmFlags; /* Used during AML disassembly */\
  701. UINT8 DisasmOpcode; /* Subtype used for disassembly */\
  702. char *OperatorSymbol;/* Used for C-style operator name strings */\
  703. char AmlOpName[16]) /* Op name (debug only) */
  704. /* Flags for DisasmFlags field above */
  705. #define ACPI_DASM_BUFFER 0x00 /* Buffer is a simple data buffer */
  706. #define ACPI_DASM_RESOURCE 0x01 /* Buffer is a Resource Descriptor */
  707. #define ACPI_DASM_STRING 0x02 /* Buffer is a ASCII string */
  708. #define ACPI_DASM_UNICODE 0x03 /* Buffer is a Unicode string */
  709. #define ACPI_DASM_PLD_METHOD 0x04 /* Buffer is a _PLD method bit-packed buffer */
  710. #define ACPI_DASM_UUID 0x05 /* Buffer is a UUID/GUID */
  711. #define ACPI_DASM_EISAID 0x06 /* Integer is an EISAID */
  712. #define ACPI_DASM_MATCHOP 0x07 /* Parent opcode is a Match() operator */
  713. #define ACPI_DASM_LNOT_PREFIX 0x08 /* Start of a LNotEqual (etc.) pair of opcodes */
  714. #define ACPI_DASM_LNOT_SUFFIX 0x09 /* End of a LNotEqual (etc.) pair of opcodes */
  715. #define ACPI_DASM_HID_STRING 0x0A /* String is a _HID or _CID */
  716. #define ACPI_DASM_IGNORE 0x0B /* Not used at this time */
  717. /*
  718. * Generic operation (for example: If, While, Store)
  719. */
  720. typedef struct acpi_parse_obj_common
  721. {
  722. ACPI_PARSE_COMMON
  723. } ACPI_PARSE_OBJ_COMMON;
  724. /*
  725. * Extended Op for named ops (Scope, Method, etc.), deferred ops (Methods and OpRegions),
  726. * and bytelists.
  727. */
  728. typedef struct acpi_parse_obj_named
  729. {
  730. ACPI_PARSE_COMMON
  731. UINT8 *Path;
  732. UINT8 *Data; /* AML body or bytelist data */
  733. UINT32 Length; /* AML length */
  734. UINT32 Name; /* 4-byte name or zero if no name */
  735. } ACPI_PARSE_OBJ_NAMED;
  736. /* This version is used by the iASL compiler only */
  737. #define ACPI_MAX_PARSEOP_NAME 20
  738. typedef struct acpi_parse_obj_asl
  739. {
  740. ACPI_PARSE_COMMON
  741. union acpi_parse_object *Child;
  742. union acpi_parse_object *ParentMethod;
  743. char *Filename;
  744. char *ExternalName;
  745. char *Namepath;
  746. char NameSeg[4];
  747. UINT32 ExtraValue;
  748. UINT32 Column;
  749. UINT32 LineNumber;
  750. UINT32 LogicalLineNumber;
  751. UINT32 LogicalByteOffset;
  752. UINT32 EndLine;
  753. UINT32 EndLogicalLine;
  754. UINT32 AcpiBtype;
  755. UINT32 AmlLength;
  756. UINT32 AmlSubtreeLength;
  757. UINT32 FinalAmlLength;
  758. UINT32 FinalAmlOffset;
  759. UINT32 CompileFlags;
  760. UINT16 ParseOpcode;
  761. UINT8 AmlOpcodeLength;
  762. UINT8 AmlPkgLenBytes;
  763. UINT8 Extra;
  764. char ParseOpName[ACPI_MAX_PARSEOP_NAME];
  765. } ACPI_PARSE_OBJ_ASL;
  766. typedef union acpi_parse_object
  767. {
  768. ACPI_PARSE_OBJ_COMMON Common;
  769. ACPI_PARSE_OBJ_NAMED Named;
  770. ACPI_PARSE_OBJ_ASL Asl;
  771. } ACPI_PARSE_OBJECT;
  772. /*
  773. * Parse state - one state per parser invocation and each control
  774. * method.
  775. */
  776. typedef struct acpi_parse_state
  777. {
  778. UINT8 *AmlStart; /* First AML byte */
  779. UINT8 *Aml; /* Next AML byte */
  780. UINT8 *AmlEnd; /* (last + 1) AML byte */
  781. UINT8 *PkgStart; /* Current package begin */
  782. UINT8 *PkgEnd; /* Current package end */
  783. union acpi_parse_object *StartOp; /* Root of parse tree */
  784. struct acpi_namespace_node *StartNode;
  785. union acpi_generic_state *Scope; /* Current scope */
  786. union acpi_parse_object *StartScope;
  787. UINT32 AmlSize;
  788. } ACPI_PARSE_STATE;
  789. /* Parse object flags */
  790. #define ACPI_PARSEOP_GENERIC 0x01
  791. #define ACPI_PARSEOP_NAMED 0x02
  792. #define ACPI_PARSEOP_DEFERRED 0x04
  793. #define ACPI_PARSEOP_BYTELIST 0x08
  794. #define ACPI_PARSEOP_IN_STACK 0x10
  795. #define ACPI_PARSEOP_TARGET 0x20
  796. #define ACPI_PARSEOP_IN_CACHE 0x80
  797. /* Parse object DisasmFlags */
  798. #define ACPI_PARSEOP_IGNORE 0x01
  799. #define ACPI_PARSEOP_PARAMLIST 0x02
  800. #define ACPI_PARSEOP_EMPTY_TERMLIST 0x04
  801. #define ACPI_PARSEOP_PREDEF_CHECKED 0x08
  802. #define ACPI_PARSEOP_CLOSING_PAREN 0x10
  803. #define ACPI_PARSEOP_COMPOUND 0x20
  804. #define ACPI_PARSEOP_ASSIGNMENT 0x40
  805. #define ACPI_PARSEOP_ELSEIF 0x80
  806. /*****************************************************************************
  807. *
  808. * Hardware (ACPI registers) and PNP
  809. *
  810. ****************************************************************************/
  811. typedef struct acpi_bit_register_info
  812. {
  813. UINT8 ParentRegister;
  814. UINT8 BitPosition;
  815. UINT16 AccessBitMask;
  816. } ACPI_BIT_REGISTER_INFO;
  817. /*
  818. * Some ACPI registers have bits that must be ignored -- meaning that they
  819. * must be preserved.
  820. */
  821. #define ACPI_PM1_STATUS_PRESERVED_BITS 0x0800 /* Bit 11 */
  822. /* Write-only bits must be zeroed by software */
  823. #define ACPI_PM1_CONTROL_WRITEONLY_BITS 0x2004 /* Bits 13, 2 */
  824. /* For control registers, both ignored and reserved bits must be preserved */
  825. /*
  826. * For PM1 control, the SCI enable bit (bit 0, SCI_EN) is defined by the
  827. * ACPI specification to be a "preserved" bit - "OSPM always preserves this
  828. * bit position", section 4.7.3.2.1. However, on some machines the OS must
  829. * write a one to this bit after resume for the machine to work properly.
  830. * To enable this, we no longer attempt to preserve this bit. No machines
  831. * are known to fail if the bit is not preserved. (May 2009)
  832. */
  833. #define ACPI_PM1_CONTROL_IGNORED_BITS 0x0200 /* Bit 9 */
  834. #define ACPI_PM1_CONTROL_RESERVED_BITS 0xC1F8 /* Bits 14-15, 3-8 */
  835. #define ACPI_PM1_CONTROL_PRESERVED_BITS \
  836. (ACPI_PM1_CONTROL_IGNORED_BITS | ACPI_PM1_CONTROL_RESERVED_BITS)
  837. #define ACPI_PM2_CONTROL_PRESERVED_BITS 0xFFFFFFFE /* All except bit 0 */
  838. /*
  839. * Register IDs
  840. * These are the full ACPI registers
  841. */
  842. #define ACPI_REGISTER_PM1_STATUS 0x01
  843. #define ACPI_REGISTER_PM1_ENABLE 0x02
  844. #define ACPI_REGISTER_PM1_CONTROL 0x03
  845. #define ACPI_REGISTER_PM2_CONTROL 0x04
  846. #define ACPI_REGISTER_PM_TIMER 0x05
  847. #define ACPI_REGISTER_PROCESSOR_BLOCK 0x06
  848. #define ACPI_REGISTER_SMI_COMMAND_BLOCK 0x07
  849. /* Masks used to access the BitRegisters */
  850. #define ACPI_BITMASK_TIMER_STATUS 0x0001
  851. #define ACPI_BITMASK_BUS_MASTER_STATUS 0x0010
  852. #define ACPI_BITMASK_GLOBAL_LOCK_STATUS 0x0020
  853. #define ACPI_BITMASK_POWER_BUTTON_STATUS 0x0100
  854. #define ACPI_BITMASK_SLEEP_BUTTON_STATUS 0x0200
  855. #define ACPI_BITMASK_RT_CLOCK_STATUS 0x0400
  856. #define ACPI_BITMASK_PCIEXP_WAKE_STATUS 0x4000 /* ACPI 3.0 */
  857. #define ACPI_BITMASK_WAKE_STATUS 0x8000
  858. #define ACPI_BITMASK_ALL_FIXED_STATUS (\
  859. ACPI_BITMASK_TIMER_STATUS | \
  860. ACPI_BITMASK_BUS_MASTER_STATUS | \
  861. ACPI_BITMASK_GLOBAL_LOCK_STATUS | \
  862. ACPI_BITMASK_POWER_BUTTON_STATUS | \
  863. ACPI_BITMASK_SLEEP_BUTTON_STATUS | \
  864. ACPI_BITMASK_RT_CLOCK_STATUS | \
  865. ACPI_BITMASK_PCIEXP_WAKE_STATUS | \
  866. ACPI_BITMASK_WAKE_STATUS)
  867. #define ACPI_BITMASK_TIMER_ENABLE 0x0001
  868. #define ACPI_BITMASK_GLOBAL_LOCK_ENABLE 0x0020
  869. #define ACPI_BITMASK_POWER_BUTTON_ENABLE 0x0100
  870. #define ACPI_BITMASK_SLEEP_BUTTON_ENABLE 0x0200
  871. #define ACPI_BITMASK_RT_CLOCK_ENABLE 0x0400
  872. #define ACPI_BITMASK_PCIEXP_WAKE_DISABLE 0x4000 /* ACPI 3.0 */
  873. #define ACPI_BITMASK_SCI_ENABLE 0x0001
  874. #define ACPI_BITMASK_BUS_MASTER_RLD 0x0002
  875. #define ACPI_BITMASK_GLOBAL_LOCK_RELEASE 0x0004
  876. #define ACPI_BITMASK_SLEEP_TYPE 0x1C00
  877. #define ACPI_BITMASK_SLEEP_ENABLE 0x2000
  878. #define ACPI_BITMASK_ARB_DISABLE 0x0001
  879. /* Raw bit position of each BitRegister */
  880. #define ACPI_BITPOSITION_TIMER_STATUS 0x00
  881. #define ACPI_BITPOSITION_BUS_MASTER_STATUS 0x04
  882. #define ACPI_BITPOSITION_GLOBAL_LOCK_STATUS 0x05
  883. #define ACPI_BITPOSITION_POWER_BUTTON_STATUS 0x08
  884. #define ACPI_BITPOSITION_SLEEP_BUTTON_STATUS 0x09
  885. #define ACPI_BITPOSITION_RT_CLOCK_STATUS 0x0A
  886. #define ACPI_BITPOSITION_PCIEXP_WAKE_STATUS 0x0E /* ACPI 3.0 */
  887. #define ACPI_BITPOSITION_WAKE_STATUS 0x0F
  888. #define ACPI_BITPOSITION_TIMER_ENABLE 0x00
  889. #define ACPI_BITPOSITION_GLOBAL_LOCK_ENABLE 0x05
  890. #define ACPI_BITPOSITION_POWER_BUTTON_ENABLE 0x08
  891. #define ACPI_BITPOSITION_SLEEP_BUTTON_ENABLE 0x09
  892. #define ACPI_BITPOSITION_RT_CLOCK_ENABLE 0x0A
  893. #define ACPI_BITPOSITION_PCIEXP_WAKE_DISABLE 0x0E /* ACPI 3.0 */
  894. #define ACPI_BITPOSITION_SCI_ENABLE 0x00
  895. #define ACPI_BITPOSITION_BUS_MASTER_RLD 0x01
  896. #define ACPI_BITPOSITION_GLOBAL_LOCK_RELEASE 0x02
  897. #define ACPI_BITPOSITION_SLEEP_TYPE 0x0A
  898. #define ACPI_BITPOSITION_SLEEP_ENABLE 0x0D
  899. #define ACPI_BITPOSITION_ARB_DISABLE 0x00
  900. /* Structs and definitions for _OSI support and I/O port validation */
  901. #define ACPI_ALWAYS_ILLEGAL 0x00
  902. typedef struct acpi_interface_info
  903. {
  904. char *Name;
  905. struct acpi_interface_info *Next;
  906. UINT8 Flags;
  907. UINT8 Value;
  908. } ACPI_INTERFACE_INFO;
  909. #define ACPI_OSI_INVALID 0x01
  910. #define ACPI_OSI_DYNAMIC 0x02
  911. #define ACPI_OSI_FEATURE 0x04
  912. #define ACPI_OSI_DEFAULT_INVALID 0x08
  913. #define ACPI_OSI_OPTIONAL_FEATURE (ACPI_OSI_FEATURE | ACPI_OSI_DEFAULT_INVALID | ACPI_OSI_INVALID)
  914. typedef struct acpi_port_info
  915. {
  916. char *Name;
  917. UINT16 Start;
  918. UINT16 End;
  919. UINT8 OsiDependency;
  920. } ACPI_PORT_INFO;
  921. /*****************************************************************************
  922. *
  923. * Resource descriptors
  924. *
  925. ****************************************************************************/
  926. /* ResourceType values */
  927. #define ACPI_ADDRESS_TYPE_MEMORY_RANGE 0
  928. #define ACPI_ADDRESS_TYPE_IO_RANGE 1
  929. #define ACPI_ADDRESS_TYPE_BUS_NUMBER_RANGE 2
  930. /* Resource descriptor types and masks */
  931. #define ACPI_RESOURCE_NAME_LARGE 0x80
  932. #define ACPI_RESOURCE_NAME_SMALL 0x00
  933. #define ACPI_RESOURCE_NAME_SMALL_MASK 0x78 /* Bits 6:3 contain the type */
  934. #define ACPI_RESOURCE_NAME_SMALL_LENGTH_MASK 0x07 /* Bits 2:0 contain the length */
  935. #define ACPI_RESOURCE_NAME_LARGE_MASK 0x7F /* Bits 6:0 contain the type */
  936. /*
  937. * Small resource descriptor "names" as defined by the ACPI specification.
  938. * Note: Bits 2:0 are used for the descriptor length
  939. */
  940. #define ACPI_RESOURCE_NAME_IRQ 0x20
  941. #define ACPI_RESOURCE_NAME_DMA 0x28
  942. #define ACPI_RESOURCE_NAME_START_DEPENDENT 0x30
  943. #define ACPI_RESOURCE_NAME_END_DEPENDENT 0x38
  944. #define ACPI_RESOURCE_NAME_IO 0x40
  945. #define ACPI_RESOURCE_NAME_FIXED_IO 0x48
  946. #define ACPI_RESOURCE_NAME_FIXED_DMA 0x50
  947. #define ACPI_RESOURCE_NAME_RESERVED_S2 0x58
  948. #define ACPI_RESOURCE_NAME_RESERVED_S3 0x60
  949. #define ACPI_RESOURCE_NAME_RESERVED_S4 0x68
  950. #define ACPI_RESOURCE_NAME_VENDOR_SMALL 0x70
  951. #define ACPI_RESOURCE_NAME_END_TAG 0x78
  952. /*
  953. * Large resource descriptor "names" as defined by the ACPI specification.
  954. * Note: includes the Large Descriptor bit in bit[7]
  955. */
  956. #define ACPI_RESOURCE_NAME_MEMORY24 0x81
  957. #define ACPI_RESOURCE_NAME_GENERIC_REGISTER 0x82
  958. #define ACPI_RESOURCE_NAME_RESERVED_L1 0x83
  959. #define ACPI_RESOURCE_NAME_VENDOR_LARGE 0x84
  960. #define ACPI_RESOURCE_NAME_MEMORY32 0x85
  961. #define ACPI_RESOURCE_NAME_FIXED_MEMORY32 0x86
  962. #define ACPI_RESOURCE_NAME_ADDRESS32 0x87
  963. #define ACPI_RESOURCE_NAME_ADDRESS16 0x88
  964. #define ACPI_RESOURCE_NAME_EXTENDED_IRQ 0x89
  965. #define ACPI_RESOURCE_NAME_ADDRESS64 0x8A
  966. #define ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64 0x8B
  967. #define ACPI_RESOURCE_NAME_GPIO 0x8C
  968. #define ACPI_RESOURCE_NAME_SERIAL_BUS 0x8E
  969. #define ACPI_RESOURCE_NAME_LARGE_MAX 0x8E
  970. /*****************************************************************************
  971. *
  972. * Miscellaneous
  973. *
  974. ****************************************************************************/
  975. #define ACPI_ASCII_ZERO 0x30
  976. /*****************************************************************************
  977. *
  978. * Disassembler
  979. *
  980. ****************************************************************************/
  981. typedef struct acpi_external_list
  982. {
  983. char *Path;
  984. char *InternalPath;
  985. struct acpi_external_list *Next;
  986. UINT32 Value;
  987. UINT16 Length;
  988. UINT16 Flags;
  989. UINT8 Type;
  990. } ACPI_EXTERNAL_LIST;
  991. /* Values for Flags field above */
  992. #define ACPI_EXT_RESOLVED_REFERENCE 0x01 /* Object was resolved during cross ref */
  993. #define ACPI_EXT_ORIGIN_FROM_FILE 0x02 /* External came from a file */
  994. #define ACPI_EXT_INTERNAL_PATH_ALLOCATED 0x04 /* Deallocate internal path on completion */
  995. #define ACPI_EXT_EXTERNAL_EMITTED 0x08 /* External() statement has been emitted */
  996. typedef struct acpi_external_file
  997. {
  998. char *Path;
  999. struct acpi_external_file *Next;
  1000. } ACPI_EXTERNAL_FILE;
  1001. /*****************************************************************************
  1002. *
  1003. * Debugger
  1004. *
  1005. ****************************************************************************/
  1006. typedef struct acpi_db_method_info
  1007. {
  1008. ACPI_HANDLE Method;
  1009. ACPI_HANDLE MainThreadGate;
  1010. ACPI_HANDLE ThreadCompleteGate;
  1011. ACPI_HANDLE InfoGate;
  1012. ACPI_THREAD_ID *Threads;
  1013. UINT32 NumThreads;
  1014. UINT32 NumCreated;
  1015. UINT32 NumCompleted;
  1016. char *Name;
  1017. UINT32 Flags;
  1018. UINT32 NumLoops;
  1019. char Pathname[ACPI_DB_LINE_BUFFER_SIZE];
  1020. char **Args;
  1021. ACPI_OBJECT_TYPE *Types;
  1022. /*
  1023. * Arguments to be passed to method for the command
  1024. * Threads -
  1025. * the Number of threads, ID of current thread and
  1026. * Index of current thread inside all them created.
  1027. */
  1028. char InitArgs;
  1029. #ifdef ACPI_DEBUGGER
  1030. ACPI_OBJECT_TYPE ArgTypes[4];
  1031. #endif
  1032. char *Arguments[4];
  1033. char NumThreadsStr[11];
  1034. char IdOfThreadStr[11];
  1035. char IndexOfThreadStr[11];
  1036. } ACPI_DB_METHOD_INFO;
  1037. typedef struct acpi_integrity_info
  1038. {
  1039. UINT32 Nodes;
  1040. UINT32 Objects;
  1041. } ACPI_INTEGRITY_INFO;
  1042. #define ACPI_DB_DISABLE_OUTPUT 0x00
  1043. #define ACPI_DB_REDIRECTABLE_OUTPUT 0x01
  1044. #define ACPI_DB_CONSOLE_OUTPUT 0x02
  1045. #define ACPI_DB_DUPLICATE_OUTPUT 0x03
  1046. typedef struct acpi_object_info
  1047. {
  1048. UINT32 Types[ACPI_TOTAL_TYPES];
  1049. } ACPI_OBJECT_INFO;
  1050. /*****************************************************************************
  1051. *
  1052. * Debug
  1053. *
  1054. ****************************************************************************/
  1055. /* Entry for a memory allocation (debug only) */
  1056. #define ACPI_MEM_MALLOC 0
  1057. #define ACPI_MEM_CALLOC 1
  1058. #define ACPI_MAX_MODULE_NAME 16
  1059. #define ACPI_COMMON_DEBUG_MEM_HEADER \
  1060. struct acpi_debug_mem_block *Previous; \
  1061. struct acpi_debug_mem_block *Next; \
  1062. UINT32 Size; \
  1063. UINT32 Component; \
  1064. UINT32 Line; \
  1065. char Module[ACPI_MAX_MODULE_NAME]; \
  1066. UINT8 AllocType;
  1067. typedef struct acpi_debug_mem_header
  1068. {
  1069. ACPI_COMMON_DEBUG_MEM_HEADER
  1070. } ACPI_DEBUG_MEM_HEADER;
  1071. typedef struct acpi_debug_mem_block
  1072. {
  1073. ACPI_COMMON_DEBUG_MEM_HEADER
  1074. UINT64 UserSpace;
  1075. } ACPI_DEBUG_MEM_BLOCK;
  1076. #define ACPI_MEM_LIST_GLOBAL 0
  1077. #define ACPI_MEM_LIST_NSNODE 1
  1078. #define ACPI_MEM_LIST_MAX 1
  1079. #define ACPI_NUM_MEM_LISTS 2
  1080. /*****************************************************************************
  1081. *
  1082. * Info/help support
  1083. *
  1084. ****************************************************************************/
  1085. typedef struct ah_predefined_name
  1086. {
  1087. char *Name;
  1088. char *Description;
  1089. #ifndef ACPI_ASL_COMPILER
  1090. char *Action;
  1091. #endif
  1092. } AH_PREDEFINED_NAME;
  1093. typedef struct ah_device_id
  1094. {
  1095. char *Name;
  1096. char *Description;
  1097. } AH_DEVICE_ID;
  1098. typedef struct ah_uuid
  1099. {
  1100. char *Description;
  1101. char *String;
  1102. } AH_UUID;
  1103. typedef struct ah_table
  1104. {
  1105. char *Signature;
  1106. char *Description;
  1107. } AH_TABLE;
  1108. #endif /* __ACLOCAL_H__ */