aclocal.h 42 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300
  1. /******************************************************************************
  2. *
  3. * Name: aclocal.h - Internal data types used across the ACPI subsystem
  4. *
  5. *****************************************************************************/
  6. /*
  7. * Copyright (C) 2000 - 2017, 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:struct_defs -- for acpisrc conversion */
  45. #define ACPI_SERIALIZED 0xFF
  46. typedef u32 acpi_mutex_handle;
  47. #define ACPI_GLOBAL_LOCK (acpi_semaphore) (-1)
  48. /* Total number of aml opcodes defined */
  49. #define AML_NUM_OPCODES 0x83
  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 acpi_ut_mutex_initialize.
  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 acpi_gbl_mutex_names
  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. struct acpi_rw_lock {
  79. acpi_mutex writer_mutex;
  80. acpi_mutex reader_mutex;
  81. u32 num_readers;
  82. };
  83. /*
  84. * Predefined handles for spinlocks used within the subsystem.
  85. * These spinlocks are created by acpi_ut_mutex_initialize
  86. */
  87. #define ACPI_LOCK_GPES 0
  88. #define ACPI_LOCK_HARDWARE 1
  89. #define ACPI_MAX_LOCK 1
  90. #define ACPI_NUM_LOCK (ACPI_MAX_LOCK+1)
  91. /* This Thread ID means that the mutex is not in use (unlocked) */
  92. #define ACPI_MUTEX_NOT_ACQUIRED ((acpi_thread_id) 0)
  93. /* This Thread ID means an invalid thread ID */
  94. #ifdef ACPI_OS_INVALID_THREAD_ID
  95. #define ACPI_INVALID_THREAD_ID ACPI_OS_INVALID_THREAD_ID
  96. #else
  97. #define ACPI_INVALID_THREAD_ID ((acpi_thread_id) 0xFFFFFFFF)
  98. #endif
  99. /* Table for the global mutexes */
  100. struct acpi_mutex_info {
  101. acpi_mutex mutex;
  102. u32 use_count;
  103. acpi_thread_id thread_id;
  104. };
  105. /* Lock flag parameter for various interfaces */
  106. #define ACPI_MTX_DO_NOT_LOCK 0
  107. #define ACPI_MTX_LOCK 1
  108. /* Field access granularities */
  109. #define ACPI_FIELD_BYTE_GRANULARITY 1
  110. #define ACPI_FIELD_WORD_GRANULARITY 2
  111. #define ACPI_FIELD_DWORD_GRANULARITY 4
  112. #define ACPI_FIELD_QWORD_GRANULARITY 8
  113. #define ACPI_ENTRY_NOT_FOUND NULL
  114. /*****************************************************************************
  115. *
  116. * Namespace typedefs and structs
  117. *
  118. ****************************************************************************/
  119. /* Operational modes of the AML interpreter/scanner */
  120. typedef enum {
  121. ACPI_IMODE_LOAD_PASS1 = 0x01,
  122. ACPI_IMODE_LOAD_PASS2 = 0x02,
  123. ACPI_IMODE_EXECUTE = 0x03
  124. } acpi_interpreter_mode;
  125. /*
  126. * The Namespace Node describes a named object that appears in the AML.
  127. * descriptor_type is used to differentiate between internal descriptors.
  128. *
  129. * The node is optimized for both 32-bit and 64-bit platforms:
  130. * 20 bytes for the 32-bit case, 32 bytes for the 64-bit case.
  131. *
  132. * Note: The descriptor_type and Type fields must appear in the identical
  133. * position in both the struct acpi_namespace_node and union acpi_operand_object
  134. * structures.
  135. */
  136. struct acpi_namespace_node {
  137. union acpi_operand_object *object; /* Interpreter object */
  138. u8 descriptor_type; /* Differentiate object descriptor types */
  139. u8 type; /* ACPI Type associated with this name */
  140. u8 flags; /* Miscellaneous flags */
  141. acpi_owner_id owner_id; /* Node creator */
  142. union acpi_name_union name; /* ACPI Name, always 4 chars per ACPI spec */
  143. struct acpi_namespace_node *parent; /* Parent node */
  144. struct acpi_namespace_node *child; /* First child */
  145. struct acpi_namespace_node *peer; /* First peer */
  146. /*
  147. * The following fields are used by the ASL compiler and disassembler only
  148. */
  149. #ifdef ACPI_LARGE_NAMESPACE_NODE
  150. union acpi_parse_object *op;
  151. void *method_locals;
  152. void *method_args;
  153. u32 value;
  154. u32 length;
  155. u8 arg_count;
  156. #endif
  157. };
  158. /* Namespace Node flags */
  159. #define ANOBJ_RESERVED 0x01 /* Available for use */
  160. #define ANOBJ_TEMPORARY 0x02 /* Node is create by a method and is temporary */
  161. #define ANOBJ_METHOD_ARG 0x04 /* Node is a method argument */
  162. #define ANOBJ_METHOD_LOCAL 0x08 /* Node is a method local */
  163. #define ANOBJ_SUBTREE_HAS_INI 0x10 /* Used to optimize device initialization */
  164. #define ANOBJ_EVALUATED 0x20 /* Set on first evaluation of node */
  165. #define ANOBJ_ALLOCATED_BUFFER 0x40 /* Method AML buffer is dynamic (install_method) */
  166. #define ANOBJ_IS_EXTERNAL 0x08 /* iASL only: This object created via External() */
  167. #define ANOBJ_METHOD_NO_RETVAL 0x10 /* iASL only: Method has no return value */
  168. #define ANOBJ_METHOD_SOME_NO_RETVAL 0x20 /* iASL only: Method has at least one return value */
  169. #define ANOBJ_IS_REFERENCED 0x80 /* iASL only: Object was referenced */
  170. /* Internal ACPI table management - master table list */
  171. struct acpi_table_list {
  172. struct acpi_table_desc *tables; /* Table descriptor array */
  173. u32 current_table_count; /* Tables currently in the array */
  174. u32 max_table_count; /* Max tables array will hold */
  175. u8 flags;
  176. };
  177. /* Flags for above */
  178. #define ACPI_ROOT_ORIGIN_UNKNOWN (0) /* ~ORIGIN_ALLOCATED */
  179. #define ACPI_ROOT_ORIGIN_ALLOCATED (1)
  180. #define ACPI_ROOT_ALLOW_RESIZE (2)
  181. /* List to manage incoming ACPI tables */
  182. struct acpi_new_table_desc {
  183. struct acpi_table_header *table;
  184. struct acpi_new_table_desc *next;
  185. };
  186. /* Predefined table indexes */
  187. #define ACPI_INVALID_TABLE_INDEX (0xFFFFFFFF)
  188. struct acpi_find_context {
  189. char *search_for;
  190. acpi_handle *list;
  191. u32 *count;
  192. };
  193. struct acpi_ns_search_data {
  194. struct acpi_namespace_node *node;
  195. };
  196. /* Object types used during package copies */
  197. #define ACPI_COPY_TYPE_SIMPLE 0
  198. #define ACPI_COPY_TYPE_PACKAGE 1
  199. /* Info structure used to convert external<->internal namestrings */
  200. struct acpi_namestring_info {
  201. const char *external_name;
  202. const char *next_external_char;
  203. char *internal_name;
  204. u32 length;
  205. u32 num_segments;
  206. u32 num_carats;
  207. u8 fully_qualified;
  208. };
  209. /* Field creation info */
  210. struct acpi_create_field_info {
  211. struct acpi_namespace_node *region_node;
  212. struct acpi_namespace_node *field_node;
  213. struct acpi_namespace_node *register_node;
  214. struct acpi_namespace_node *data_register_node;
  215. struct acpi_namespace_node *connection_node;
  216. u8 *resource_buffer;
  217. u32 bank_value;
  218. u32 field_bit_position;
  219. u32 field_bit_length;
  220. u16 resource_length;
  221. u16 pin_number_index;
  222. u8 field_flags;
  223. u8 attribute;
  224. u8 field_type;
  225. u8 access_length;
  226. };
  227. typedef
  228. acpi_status (*acpi_internal_method) (struct acpi_walk_state * walk_state);
  229. /*
  230. * Bitmapped ACPI types. Used internally only
  231. */
  232. #define ACPI_BTYPE_ANY 0x00000000
  233. #define ACPI_BTYPE_INTEGER 0x00000001
  234. #define ACPI_BTYPE_STRING 0x00000002
  235. #define ACPI_BTYPE_BUFFER 0x00000004
  236. #define ACPI_BTYPE_PACKAGE 0x00000008
  237. #define ACPI_BTYPE_FIELD_UNIT 0x00000010
  238. #define ACPI_BTYPE_DEVICE 0x00000020
  239. #define ACPI_BTYPE_EVENT 0x00000040
  240. #define ACPI_BTYPE_METHOD 0x00000080
  241. #define ACPI_BTYPE_MUTEX 0x00000100
  242. #define ACPI_BTYPE_REGION 0x00000200
  243. #define ACPI_BTYPE_POWER 0x00000400
  244. #define ACPI_BTYPE_PROCESSOR 0x00000800
  245. #define ACPI_BTYPE_THERMAL 0x00001000
  246. #define ACPI_BTYPE_BUFFER_FIELD 0x00002000
  247. #define ACPI_BTYPE_DDB_HANDLE 0x00004000
  248. #define ACPI_BTYPE_DEBUG_OBJECT 0x00008000
  249. #define ACPI_BTYPE_REFERENCE_OBJECT 0x00010000 /* From Index(), ref_of(), etc (type6_opcodes) */
  250. #define ACPI_BTYPE_RESOURCE 0x00020000
  251. #define ACPI_BTYPE_NAMED_REFERENCE 0x00040000 /* Generic unresolved Name or Namepath */
  252. #define ACPI_BTYPE_COMPUTE_DATA (ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING | ACPI_BTYPE_BUFFER)
  253. #define ACPI_BTYPE_DATA (ACPI_BTYPE_COMPUTE_DATA | ACPI_BTYPE_PACKAGE)
  254. /* Used by Copy, de_ref_of, Store, Printf, Fprintf */
  255. #define ACPI_BTYPE_DATA_REFERENCE (ACPI_BTYPE_DATA | ACPI_BTYPE_REFERENCE_OBJECT | ACPI_BTYPE_DDB_HANDLE)
  256. #define ACPI_BTYPE_DEVICE_OBJECTS (ACPI_BTYPE_DEVICE | ACPI_BTYPE_THERMAL | ACPI_BTYPE_PROCESSOR)
  257. #define ACPI_BTYPE_OBJECTS_AND_REFS 0x0001FFFF /* ARG or LOCAL */
  258. #define ACPI_BTYPE_ALL_OBJECTS 0x0000FFFF
  259. #pragma pack(1)
  260. /*
  261. * Information structure for ACPI predefined names.
  262. * Each entry in the table contains the following items:
  263. *
  264. * name - The ACPI reserved name
  265. * param_count - Number of arguments to the method
  266. * expected_return_btypes - Allowed type(s) for the return value
  267. */
  268. struct acpi_name_info {
  269. char name[ACPI_NAME_SIZE];
  270. u16 argument_list;
  271. u8 expected_btypes;
  272. };
  273. /*
  274. * Secondary information structures for ACPI predefined objects that return
  275. * package objects. This structure appears as the next entry in the table
  276. * after the NAME_INFO structure above.
  277. *
  278. * The reason for this is to minimize the size of the predefined name table.
  279. */
  280. /*
  281. * Used for ACPI_PTYPE1_FIXED, ACPI_PTYPE1_VAR, ACPI_PTYPE2,
  282. * ACPI_PTYPE2_MIN, ACPI_PTYPE2_PKG_COUNT, ACPI_PTYPE2_COUNT,
  283. * ACPI_PTYPE2_FIX_VAR
  284. */
  285. struct acpi_package_info {
  286. u8 type;
  287. u8 object_type1;
  288. u8 count1;
  289. u8 object_type2;
  290. u8 count2;
  291. u16 reserved;
  292. };
  293. /* Used for ACPI_PTYPE2_FIXED */
  294. struct acpi_package_info2 {
  295. u8 type;
  296. u8 count;
  297. u8 object_type[4];
  298. u8 reserved;
  299. };
  300. /* Used for ACPI_PTYPE1_OPTION */
  301. struct acpi_package_info3 {
  302. u8 type;
  303. u8 count;
  304. u8 object_type[2];
  305. u8 tail_object_type;
  306. u16 reserved;
  307. };
  308. struct acpi_package_info4 {
  309. u8 type;
  310. u8 object_type1;
  311. u8 count1;
  312. u8 sub_object_types;
  313. u8 pkg_count;
  314. u16 reserved;
  315. };
  316. union acpi_predefined_info {
  317. struct acpi_name_info info;
  318. struct acpi_package_info ret_info;
  319. struct acpi_package_info2 ret_info2;
  320. struct acpi_package_info3 ret_info3;
  321. struct acpi_package_info4 ret_info4;
  322. };
  323. /* Reset to default packing */
  324. #pragma pack()
  325. /* Return object auto-repair info */
  326. typedef acpi_status (*acpi_object_converter) (struct acpi_namespace_node *
  327. scope,
  328. union acpi_operand_object *
  329. original_object,
  330. union acpi_operand_object **
  331. converted_object);
  332. struct acpi_simple_repair_info {
  333. char name[ACPI_NAME_SIZE];
  334. u32 unexpected_btypes;
  335. u32 package_index;
  336. acpi_object_converter object_converter;
  337. };
  338. /*
  339. * Bitmapped return value types
  340. * Note: the actual data types must be contiguous, a loop in nspredef.c
  341. * depends on this.
  342. */
  343. #define ACPI_RTYPE_ANY 0x00
  344. #define ACPI_RTYPE_NONE 0x01
  345. #define ACPI_RTYPE_INTEGER 0x02
  346. #define ACPI_RTYPE_STRING 0x04
  347. #define ACPI_RTYPE_BUFFER 0x08
  348. #define ACPI_RTYPE_PACKAGE 0x10
  349. #define ACPI_RTYPE_REFERENCE 0x20
  350. #define ACPI_RTYPE_ALL 0x3F
  351. #define ACPI_NUM_RTYPES 5 /* Number of actual object types */
  352. /* Info for running the _REG methods */
  353. struct acpi_reg_walk_info {
  354. acpi_adr_space_type space_id;
  355. u32 function;
  356. u32 reg_run_count;
  357. };
  358. /*****************************************************************************
  359. *
  360. * Event typedefs and structs
  361. *
  362. ****************************************************************************/
  363. /* Dispatch info for each host-installed SCI handler */
  364. struct acpi_sci_handler_info {
  365. struct acpi_sci_handler_info *next;
  366. acpi_sci_handler address; /* Address of handler */
  367. void *context; /* Context to be passed to handler */
  368. };
  369. /* Dispatch info for each GPE -- either a method or handler, cannot be both */
  370. struct acpi_gpe_handler_info {
  371. acpi_gpe_handler address; /* Address of handler, if any */
  372. void *context; /* Context to be passed to handler */
  373. struct acpi_namespace_node *method_node; /* Method node for this GPE level (saved) */
  374. u8 original_flags; /* Original (pre-handler) GPE info */
  375. u8 originally_enabled; /* True if GPE was originally enabled */
  376. };
  377. /* Notify info for implicit notify, multiple device objects */
  378. struct acpi_gpe_notify_info {
  379. struct acpi_namespace_node *device_node; /* Device to be notified */
  380. struct acpi_gpe_notify_info *next;
  381. };
  382. /*
  383. * GPE dispatch info. At any time, the GPE can have at most one type
  384. * of dispatch - Method, Handler, or Implicit Notify.
  385. */
  386. union acpi_gpe_dispatch_info {
  387. struct acpi_namespace_node *method_node; /* Method node for this GPE level */
  388. struct acpi_gpe_handler_info *handler; /* Installed GPE handler */
  389. struct acpi_gpe_notify_info *notify_list; /* List of _PRW devices for implicit notifies */
  390. };
  391. /*
  392. * Information about a GPE, one per each GPE in an array.
  393. * NOTE: Important to keep this struct as small as possible.
  394. */
  395. struct acpi_gpe_event_info {
  396. union acpi_gpe_dispatch_info dispatch; /* Either Method, Handler, or notify_list */
  397. struct acpi_gpe_register_info *register_info; /* Backpointer to register info */
  398. u8 flags; /* Misc info about this GPE */
  399. u8 gpe_number; /* This GPE */
  400. u8 runtime_count; /* References to a run GPE */
  401. u8 disable_for_dispatch; /* Masked during dispatching */
  402. };
  403. /* Information about a GPE register pair, one per each status/enable pair in an array */
  404. struct acpi_gpe_register_info {
  405. struct acpi_generic_address status_address; /* Address of status reg */
  406. struct acpi_generic_address enable_address; /* Address of enable reg */
  407. u16 base_gpe_number; /* Base GPE number for this register */
  408. u8 enable_for_wake; /* GPEs to keep enabled when sleeping */
  409. u8 enable_for_run; /* GPEs to keep enabled when running */
  410. u8 mask_for_run; /* GPEs to keep masked when running */
  411. u8 enable_mask; /* Current mask of enabled GPEs */
  412. };
  413. /*
  414. * Information about a GPE register block, one per each installed block --
  415. * GPE0, GPE1, and one per each installed GPE Block Device.
  416. */
  417. struct acpi_gpe_block_info {
  418. struct acpi_namespace_node *node;
  419. struct acpi_gpe_block_info *previous;
  420. struct acpi_gpe_block_info *next;
  421. struct acpi_gpe_xrupt_info *xrupt_block; /* Backpointer to interrupt block */
  422. struct acpi_gpe_register_info *register_info; /* One per GPE register pair */
  423. struct acpi_gpe_event_info *event_info; /* One for each GPE */
  424. u64 address; /* Base address of the block */
  425. u32 register_count; /* Number of register pairs in block */
  426. u16 gpe_count; /* Number of individual GPEs in block */
  427. u16 block_base_number; /* Base GPE number for this block */
  428. u8 space_id;
  429. u8 initialized; /* TRUE if this block is initialized */
  430. };
  431. /* Information about GPE interrupt handlers, one per each interrupt level used for GPEs */
  432. struct acpi_gpe_xrupt_info {
  433. struct acpi_gpe_xrupt_info *previous;
  434. struct acpi_gpe_xrupt_info *next;
  435. struct acpi_gpe_block_info *gpe_block_list_head; /* List of GPE blocks for this xrupt */
  436. u32 interrupt_number; /* System interrupt number */
  437. };
  438. struct acpi_gpe_walk_info {
  439. struct acpi_namespace_node *gpe_device;
  440. struct acpi_gpe_block_info *gpe_block;
  441. u16 count;
  442. acpi_owner_id owner_id;
  443. u8 execute_by_owner_id;
  444. };
  445. struct acpi_gpe_device_info {
  446. u32 index;
  447. u32 next_block_base_index;
  448. acpi_status status;
  449. struct acpi_namespace_node *gpe_device;
  450. };
  451. typedef acpi_status (*acpi_gpe_callback) (struct acpi_gpe_xrupt_info *
  452. gpe_xrupt_info,
  453. struct acpi_gpe_block_info *
  454. gpe_block, void *context);
  455. /* Information about each particular fixed event */
  456. struct acpi_fixed_event_handler {
  457. acpi_event_handler handler; /* Address of handler. */
  458. void *context; /* Context to be passed to handler */
  459. };
  460. struct acpi_fixed_event_info {
  461. u8 status_register_id;
  462. u8 enable_register_id;
  463. u16 status_bit_mask;
  464. u16 enable_bit_mask;
  465. };
  466. /* Information used during field processing */
  467. struct acpi_field_info {
  468. u8 skip_field;
  469. u8 field_flag;
  470. u32 pkg_length;
  471. };
  472. /*****************************************************************************
  473. *
  474. * Generic "state" object for stacks
  475. *
  476. ****************************************************************************/
  477. #define ACPI_CONTROL_NORMAL 0xC0
  478. #define ACPI_CONTROL_CONDITIONAL_EXECUTING 0xC1
  479. #define ACPI_CONTROL_PREDICATE_EXECUTING 0xC2
  480. #define ACPI_CONTROL_PREDICATE_FALSE 0xC3
  481. #define ACPI_CONTROL_PREDICATE_TRUE 0xC4
  482. #define ACPI_STATE_COMMON \
  483. void *next; \
  484. u8 descriptor_type; /* To differentiate various internal objs */\
  485. u8 flags; \
  486. u16 value; \
  487. u16 state;
  488. /* There are 2 bytes available here until the next natural alignment boundary */
  489. struct acpi_common_state {
  490. ACPI_STATE_COMMON};
  491. /*
  492. * Update state - used to traverse complex objects such as packages
  493. */
  494. struct acpi_update_state {
  495. ACPI_STATE_COMMON union acpi_operand_object *object;
  496. };
  497. /*
  498. * Pkg state - used to traverse nested package structures
  499. */
  500. struct acpi_pkg_state {
  501. ACPI_STATE_COMMON u16 index;
  502. union acpi_operand_object *source_object;
  503. union acpi_operand_object *dest_object;
  504. struct acpi_walk_state *walk_state;
  505. void *this_target_obj;
  506. u32 num_packages;
  507. };
  508. /*
  509. * Control state - one per if/else and while constructs.
  510. * Allows nesting of these constructs
  511. */
  512. struct acpi_control_state {
  513. ACPI_STATE_COMMON u16 opcode;
  514. union acpi_parse_object *predicate_op;
  515. u8 *aml_predicate_start; /* Start of if/while predicate */
  516. u8 *package_end; /* End of if/while block */
  517. u32 loop_count; /* While() loop counter */
  518. };
  519. /*
  520. * Scope state - current scope during namespace lookups
  521. */
  522. struct acpi_scope_state {
  523. ACPI_STATE_COMMON struct acpi_namespace_node *node;
  524. };
  525. struct acpi_pscope_state {
  526. ACPI_STATE_COMMON u32 arg_count; /* Number of fixed arguments */
  527. union acpi_parse_object *op; /* Current op being parsed */
  528. u8 *arg_end; /* Current argument end */
  529. u8 *pkg_end; /* Current package end */
  530. u32 arg_list; /* Next argument to parse */
  531. };
  532. /*
  533. * Thread state - one per thread across multiple walk states. Multiple walk
  534. * states are created when there are nested control methods executing.
  535. */
  536. struct acpi_thread_state {
  537. ACPI_STATE_COMMON u8 current_sync_level; /* Mutex Sync (nested acquire) level */
  538. struct acpi_walk_state *walk_state_list; /* Head of list of walk_states for this thread */
  539. union acpi_operand_object *acquired_mutex_list; /* List of all currently acquired mutexes */
  540. acpi_thread_id thread_id; /* Running thread ID */
  541. };
  542. /*
  543. * Result values - used to accumulate the results of nested
  544. * AML arguments
  545. */
  546. struct acpi_result_values {
  547. ACPI_STATE_COMMON
  548. union acpi_operand_object *obj_desc[ACPI_RESULTS_FRAME_OBJ_NUM];
  549. };
  550. typedef
  551. acpi_status (*acpi_parse_downwards) (struct acpi_walk_state * walk_state,
  552. union acpi_parse_object ** out_op);
  553. typedef
  554. acpi_status (*acpi_parse_upwards) (struct acpi_walk_state * walk_state);
  555. /* Global handlers for AML Notifies */
  556. struct acpi_global_notify_handler {
  557. acpi_notify_handler handler;
  558. void *context;
  559. };
  560. /*
  561. * Notify info - used to pass info to the deferred notify
  562. * handler/dispatcher.
  563. */
  564. struct acpi_notify_info {
  565. ACPI_STATE_COMMON u8 handler_list_id;
  566. struct acpi_namespace_node *node;
  567. union acpi_operand_object *handler_list_head;
  568. struct acpi_global_notify_handler *global;
  569. };
  570. /* Generic state is union of structs above */
  571. union acpi_generic_state {
  572. struct acpi_common_state common;
  573. struct acpi_control_state control;
  574. struct acpi_update_state update;
  575. struct acpi_scope_state scope;
  576. struct acpi_pscope_state parse_scope;
  577. struct acpi_pkg_state pkg;
  578. struct acpi_thread_state thread;
  579. struct acpi_result_values results;
  580. struct acpi_notify_info notify;
  581. };
  582. /*****************************************************************************
  583. *
  584. * Interpreter typedefs and structs
  585. *
  586. ****************************************************************************/
  587. typedef
  588. acpi_status (*acpi_execute_op) (struct acpi_walk_state * walk_state);
  589. /* Address Range info block */
  590. struct acpi_address_range {
  591. struct acpi_address_range *next;
  592. struct acpi_namespace_node *region_node;
  593. acpi_physical_address start_address;
  594. acpi_physical_address end_address;
  595. };
  596. /*****************************************************************************
  597. *
  598. * Parser typedefs and structs
  599. *
  600. ****************************************************************************/
  601. /*
  602. * AML opcode, name, and argument layout
  603. */
  604. struct acpi_opcode_info {
  605. #if defined(ACPI_DISASSEMBLER) || defined(ACPI_DEBUG_OUTPUT)
  606. char *name; /* Opcode name (disassembler/debug only) */
  607. #endif
  608. u32 parse_args; /* Grammar/Parse time arguments */
  609. u32 runtime_args; /* Interpret time arguments */
  610. u16 flags; /* Misc flags */
  611. u8 object_type; /* Corresponding internal object type */
  612. u8 class; /* Opcode class */
  613. u8 type; /* Opcode type */
  614. };
  615. /* Value associated with the parse object */
  616. union acpi_parse_value {
  617. u64 integer; /* Integer constant (Up to 64 bits) */
  618. u32 size; /* bytelist or field size */
  619. char *string; /* NULL terminated string */
  620. u8 *buffer; /* buffer or string */
  621. char *name; /* NULL terminated string */
  622. union acpi_parse_object *arg; /* arguments and contained ops */
  623. };
  624. #if defined(ACPI_DISASSEMBLER) || defined(ACPI_DEBUG_OUTPUT)
  625. #define ACPI_DISASM_ONLY_MEMBERS(a) a;
  626. #else
  627. #define ACPI_DISASM_ONLY_MEMBERS(a)
  628. #endif
  629. #if defined(ACPI_ASL_COMPILER)
  630. #define ACPI_CONVERTER_ONLY_MEMBERS(a) a;
  631. #else
  632. #define ACPI_CONVERTER_ONLY_MEMBERS(a)
  633. #endif
  634. #define ACPI_PARSE_COMMON \
  635. union acpi_parse_object *parent; /* Parent op */\
  636. u8 descriptor_type; /* To differentiate various internal objs */\
  637. u8 flags; /* Type of Op */\
  638. u16 aml_opcode; /* AML opcode */\
  639. u8 *aml; /* Address of declaration in AML */\
  640. union acpi_parse_object *next; /* Next op */\
  641. struct acpi_namespace_node *node; /* For use by interpreter */\
  642. union acpi_parse_value value; /* Value or args associated with the opcode */\
  643. u8 arg_list_length; /* Number of elements in the arg list */\
  644. ACPI_DISASM_ONLY_MEMBERS (\
  645. u16 disasm_flags; /* Used during AML disassembly */\
  646. u8 disasm_opcode; /* Subtype used for disassembly */\
  647. char *operator_symbol; /* Used for C-style operator name strings */\
  648. char aml_op_name[16]) /* Op name (debug only) */\
  649. ACPI_CONVERTER_ONLY_MEMBERS (\
  650. char *inline_comment; /* Inline comment */\
  651. char *end_node_comment; /* End of node comment */\
  652. char *name_comment; /* Comment associated with the first parameter of the name node */\
  653. char *close_brace_comment; /* Comments that come after } on the same as } */\
  654. struct acpi_comment_node *comment_list; /* comments that appears before this node */\
  655. struct acpi_comment_node *end_blk_comment; /* comments that at the end of a block but before ) or } */\
  656. char *cv_filename; /* Filename associated with this node. Used for ASL/ASL+ converter */\
  657. char *cv_parent_filename) /* Parent filename associated with this node. Used for ASL/ASL+ converter */
  658. /* categories of comments */
  659. typedef enum {
  660. STANDARD_COMMENT = 1,
  661. INLINE_COMMENT,
  662. ENDNODE_COMMENT,
  663. OPENBRACE_COMMENT,
  664. CLOSE_BRACE_COMMENT,
  665. STD_DEFBLK_COMMENT,
  666. END_DEFBLK_COMMENT,
  667. FILENAME_COMMENT,
  668. PARENTFILENAME_COMMENT,
  669. ENDBLK_COMMENT,
  670. INCLUDE_COMMENT
  671. } asl_comment_types;
  672. /* Internal opcodes for disasm_opcode field above */
  673. #define ACPI_DASM_BUFFER 0x00 /* Buffer is a simple data buffer */
  674. #define ACPI_DASM_RESOURCE 0x01 /* Buffer is a Resource Descriptor */
  675. #define ACPI_DASM_STRING 0x02 /* Buffer is a ASCII string */
  676. #define ACPI_DASM_UNICODE 0x03 /* Buffer is a Unicode string */
  677. #define ACPI_DASM_PLD_METHOD 0x04 /* Buffer is a _PLD method bit-packed buffer */
  678. #define ACPI_DASM_UUID 0x05 /* Buffer is a UUID/GUID */
  679. #define ACPI_DASM_EISAID 0x06 /* Integer is an EISAID */
  680. #define ACPI_DASM_MATCHOP 0x07 /* Parent opcode is a Match() operator */
  681. #define ACPI_DASM_LNOT_PREFIX 0x08 /* Start of a Lnot_equal (etc.) pair of opcodes */
  682. #define ACPI_DASM_LNOT_SUFFIX 0x09 /* End of a Lnot_equal (etc.) pair of opcodes */
  683. #define ACPI_DASM_HID_STRING 0x0A /* String is a _HID or _CID */
  684. #define ACPI_DASM_IGNORE_SINGLE 0x0B /* Ignore the opcode but not it's children */
  685. #define ACPI_DASM_SWITCH 0x0C /* While is a Switch */
  686. #define ACPI_DASM_SWITCH_PREDICATE 0x0D /* Object is a predicate for a Switch or Case block */
  687. #define ACPI_DASM_CASE 0x0E /* If/Else is a Case in a Switch/Case block */
  688. #define ACPI_DASM_DEFAULT 0x0F /* Else is a Default in a Switch/Case block */
  689. /*
  690. * List struct used in the -ca option
  691. */
  692. struct acpi_comment_node {
  693. char *comment;
  694. struct acpi_comment_node *next;
  695. };
  696. struct acpi_comment_addr_node {
  697. u8 *addr;
  698. struct acpi_comment_addr_node *next;
  699. };
  700. /*
  701. * File node - used for "Include" operator file stack and
  702. * depdendency tree for the -ca option
  703. */
  704. struct acpi_file_node {
  705. void *file;
  706. char *filename;
  707. char *file_start; /* Points to AML and indicates when the AML for this particular file starts. */
  708. char *file_end; /* Points to AML and indicates when the AML for this particular file ends. */
  709. struct acpi_file_node *next;
  710. struct acpi_file_node *parent;
  711. u8 include_written;
  712. struct acpi_comment_node *include_comment;
  713. };
  714. /*
  715. * Generic operation (for example: If, While, Store)
  716. */
  717. struct acpi_parse_obj_common {
  718. ACPI_PARSE_COMMON};
  719. /*
  720. * Extended Op for named ops (Scope, Method, etc.), deferred ops (Methods and op_regions),
  721. * and bytelists.
  722. */
  723. struct acpi_parse_obj_named {
  724. ACPI_PARSE_COMMON u8 *path;
  725. u8 *data; /* AML body or bytelist data */
  726. u32 length; /* AML length */
  727. u32 name; /* 4-byte name or zero if no name */
  728. };
  729. /* This version is used by the iASL compiler only */
  730. #define ACPI_MAX_PARSEOP_NAME 20
  731. struct acpi_parse_obj_asl {
  732. ACPI_PARSE_COMMON union acpi_parse_object *child;
  733. union acpi_parse_object *parent_method;
  734. char *filename;
  735. u8 file_changed;
  736. char *parent_filename;
  737. char *external_name;
  738. char *namepath;
  739. char name_seg[4];
  740. u32 extra_value;
  741. u32 column;
  742. u32 line_number;
  743. u32 logical_line_number;
  744. u32 logical_byte_offset;
  745. u32 end_line;
  746. u32 end_logical_line;
  747. u32 acpi_btype;
  748. u32 aml_length;
  749. u32 aml_subtree_length;
  750. u32 final_aml_length;
  751. u32 final_aml_offset;
  752. u32 compile_flags;
  753. u16 parse_opcode;
  754. u8 aml_opcode_length;
  755. u8 aml_pkg_len_bytes;
  756. u8 extra;
  757. char parse_op_name[ACPI_MAX_PARSEOP_NAME];
  758. };
  759. union acpi_parse_object {
  760. struct acpi_parse_obj_common common;
  761. struct acpi_parse_obj_named named;
  762. struct acpi_parse_obj_asl asl;
  763. };
  764. struct asl_comment_state {
  765. u8 comment_type;
  766. u32 spaces_before;
  767. union acpi_parse_object *latest_parse_node;
  768. union acpi_parse_object *parsing_paren_brace_node;
  769. u8 capture_comments;
  770. };
  771. /*
  772. * Parse state - one state per parser invocation and each control
  773. * method.
  774. */
  775. struct acpi_parse_state {
  776. u8 *aml_start; /* First AML byte */
  777. u8 *aml; /* Next AML byte */
  778. u8 *aml_end; /* (last + 1) AML byte */
  779. u8 *pkg_start; /* Current package begin */
  780. u8 *pkg_end; /* Current package end */
  781. union acpi_parse_object *start_op; /* Root of parse tree */
  782. struct acpi_namespace_node *start_node;
  783. union acpi_generic_state *scope; /* Current scope */
  784. union acpi_parse_object *start_scope;
  785. u32 aml_size;
  786. };
  787. /* Parse object flags */
  788. #define ACPI_PARSEOP_GENERIC 0x01
  789. #define ACPI_PARSEOP_NAMED_OBJECT 0x02
  790. #define ACPI_PARSEOP_DEFERRED 0x04
  791. #define ACPI_PARSEOP_BYTELIST 0x08
  792. #define ACPI_PARSEOP_IN_STACK 0x10
  793. #define ACPI_PARSEOP_TARGET 0x20
  794. #define ACPI_PARSEOP_IN_CACHE 0x80
  795. /* Parse object disasm_flags */
  796. #define ACPI_PARSEOP_IGNORE 0x0001
  797. #define ACPI_PARSEOP_PARAMETER_LIST 0x0002
  798. #define ACPI_PARSEOP_EMPTY_TERMLIST 0x0004
  799. #define ACPI_PARSEOP_PREDEFINED_CHECKED 0x0008
  800. #define ACPI_PARSEOP_CLOSING_PAREN 0x0010
  801. #define ACPI_PARSEOP_COMPOUND_ASSIGNMENT 0x0020
  802. #define ACPI_PARSEOP_ASSIGNMENT 0x0040
  803. #define ACPI_PARSEOP_ELSEIF 0x0080
  804. #define ACPI_PARSEOP_LEGACY_ASL_ONLY 0x0100
  805. /*****************************************************************************
  806. *
  807. * Hardware (ACPI registers) and PNP
  808. *
  809. ****************************************************************************/
  810. struct acpi_bit_register_info {
  811. u8 parent_register;
  812. u8 bit_position;
  813. u16 access_bit_mask;
  814. };
  815. /*
  816. * Some ACPI registers have bits that must be ignored -- meaning that they
  817. * must be preserved.
  818. */
  819. #define ACPI_PM1_STATUS_PRESERVED_BITS 0x0800 /* Bit 11 */
  820. /* Write-only bits must be zeroed by software */
  821. #define ACPI_PM1_CONTROL_WRITEONLY_BITS 0x2004 /* Bits 13, 2 */
  822. /* For control registers, both ignored and reserved bits must be preserved */
  823. /*
  824. * For PM1 control, the SCI enable bit (bit 0, SCI_EN) is defined by the
  825. * ACPI specification to be a "preserved" bit - "OSPM always preserves this
  826. * bit position", section 4.7.3.2.1. However, on some machines the OS must
  827. * write a one to this bit after resume for the machine to work properly.
  828. * To enable this, we no longer attempt to preserve this bit. No machines
  829. * are known to fail if the bit is not preserved. (May 2009)
  830. */
  831. #define ACPI_PM1_CONTROL_IGNORED_BITS 0x0200 /* Bit 9 */
  832. #define ACPI_PM1_CONTROL_RESERVED_BITS 0xC1F8 /* Bits 14-15, 3-8 */
  833. #define ACPI_PM1_CONTROL_PRESERVED_BITS \
  834. (ACPI_PM1_CONTROL_IGNORED_BITS | ACPI_PM1_CONTROL_RESERVED_BITS)
  835. #define ACPI_PM2_CONTROL_PRESERVED_BITS 0xFFFFFFFE /* All except bit 0 */
  836. /*
  837. * Register IDs
  838. * These are the full ACPI registers
  839. */
  840. #define ACPI_REGISTER_PM1_STATUS 0x01
  841. #define ACPI_REGISTER_PM1_ENABLE 0x02
  842. #define ACPI_REGISTER_PM1_CONTROL 0x03
  843. #define ACPI_REGISTER_PM2_CONTROL 0x04
  844. #define ACPI_REGISTER_PM_TIMER 0x05
  845. #define ACPI_REGISTER_PROCESSOR_BLOCK 0x06
  846. #define ACPI_REGISTER_SMI_COMMAND_BLOCK 0x07
  847. /* Masks used to access the bit_registers */
  848. #define ACPI_BITMASK_TIMER_STATUS 0x0001
  849. #define ACPI_BITMASK_BUS_MASTER_STATUS 0x0010
  850. #define ACPI_BITMASK_GLOBAL_LOCK_STATUS 0x0020
  851. #define ACPI_BITMASK_POWER_BUTTON_STATUS 0x0100
  852. #define ACPI_BITMASK_SLEEP_BUTTON_STATUS 0x0200
  853. #define ACPI_BITMASK_RT_CLOCK_STATUS 0x0400
  854. #define ACPI_BITMASK_PCIEXP_WAKE_STATUS 0x4000 /* ACPI 3.0 */
  855. #define ACPI_BITMASK_WAKE_STATUS 0x8000
  856. #define ACPI_BITMASK_ALL_FIXED_STATUS (\
  857. ACPI_BITMASK_TIMER_STATUS | \
  858. ACPI_BITMASK_BUS_MASTER_STATUS | \
  859. ACPI_BITMASK_GLOBAL_LOCK_STATUS | \
  860. ACPI_BITMASK_POWER_BUTTON_STATUS | \
  861. ACPI_BITMASK_SLEEP_BUTTON_STATUS | \
  862. ACPI_BITMASK_RT_CLOCK_STATUS | \
  863. ACPI_BITMASK_PCIEXP_WAKE_STATUS | \
  864. ACPI_BITMASK_WAKE_STATUS)
  865. #define ACPI_BITMASK_TIMER_ENABLE 0x0001
  866. #define ACPI_BITMASK_GLOBAL_LOCK_ENABLE 0x0020
  867. #define ACPI_BITMASK_POWER_BUTTON_ENABLE 0x0100
  868. #define ACPI_BITMASK_SLEEP_BUTTON_ENABLE 0x0200
  869. #define ACPI_BITMASK_RT_CLOCK_ENABLE 0x0400
  870. #define ACPI_BITMASK_PCIEXP_WAKE_DISABLE 0x4000 /* ACPI 3.0 */
  871. #define ACPI_BITMASK_SCI_ENABLE 0x0001
  872. #define ACPI_BITMASK_BUS_MASTER_RLD 0x0002
  873. #define ACPI_BITMASK_GLOBAL_LOCK_RELEASE 0x0004
  874. #define ACPI_BITMASK_SLEEP_TYPE 0x1C00
  875. #define ACPI_BITMASK_SLEEP_ENABLE 0x2000
  876. #define ACPI_BITMASK_ARB_DISABLE 0x0001
  877. /* Raw bit position of each bit_register */
  878. #define ACPI_BITPOSITION_TIMER_STATUS 0x00
  879. #define ACPI_BITPOSITION_BUS_MASTER_STATUS 0x04
  880. #define ACPI_BITPOSITION_GLOBAL_LOCK_STATUS 0x05
  881. #define ACPI_BITPOSITION_POWER_BUTTON_STATUS 0x08
  882. #define ACPI_BITPOSITION_SLEEP_BUTTON_STATUS 0x09
  883. #define ACPI_BITPOSITION_RT_CLOCK_STATUS 0x0A
  884. #define ACPI_BITPOSITION_PCIEXP_WAKE_STATUS 0x0E /* ACPI 3.0 */
  885. #define ACPI_BITPOSITION_WAKE_STATUS 0x0F
  886. #define ACPI_BITPOSITION_TIMER_ENABLE 0x00
  887. #define ACPI_BITPOSITION_GLOBAL_LOCK_ENABLE 0x05
  888. #define ACPI_BITPOSITION_POWER_BUTTON_ENABLE 0x08
  889. #define ACPI_BITPOSITION_SLEEP_BUTTON_ENABLE 0x09
  890. #define ACPI_BITPOSITION_RT_CLOCK_ENABLE 0x0A
  891. #define ACPI_BITPOSITION_PCIEXP_WAKE_DISABLE 0x0E /* ACPI 3.0 */
  892. #define ACPI_BITPOSITION_SCI_ENABLE 0x00
  893. #define ACPI_BITPOSITION_BUS_MASTER_RLD 0x01
  894. #define ACPI_BITPOSITION_GLOBAL_LOCK_RELEASE 0x02
  895. #define ACPI_BITPOSITION_SLEEP_TYPE 0x0A
  896. #define ACPI_BITPOSITION_SLEEP_ENABLE 0x0D
  897. #define ACPI_BITPOSITION_ARB_DISABLE 0x00
  898. /* Structs and definitions for _OSI support and I/O port validation */
  899. #define ACPI_ALWAYS_ILLEGAL 0x00
  900. struct acpi_interface_info {
  901. char *name;
  902. struct acpi_interface_info *next;
  903. u8 flags;
  904. u8 value;
  905. };
  906. #define ACPI_OSI_INVALID 0x01
  907. #define ACPI_OSI_DYNAMIC 0x02
  908. #define ACPI_OSI_FEATURE 0x04
  909. #define ACPI_OSI_DEFAULT_INVALID 0x08
  910. #define ACPI_OSI_OPTIONAL_FEATURE (ACPI_OSI_FEATURE | ACPI_OSI_DEFAULT_INVALID | ACPI_OSI_INVALID)
  911. struct acpi_port_info {
  912. char *name;
  913. u16 start;
  914. u16 end;
  915. u8 osi_dependency;
  916. };
  917. /*****************************************************************************
  918. *
  919. * Resource descriptors
  920. *
  921. ****************************************************************************/
  922. /* resource_type values */
  923. #define ACPI_ADDRESS_TYPE_MEMORY_RANGE 0
  924. #define ACPI_ADDRESS_TYPE_IO_RANGE 1
  925. #define ACPI_ADDRESS_TYPE_BUS_NUMBER_RANGE 2
  926. /* Resource descriptor types and masks */
  927. #define ACPI_RESOURCE_NAME_LARGE 0x80
  928. #define ACPI_RESOURCE_NAME_SMALL 0x00
  929. #define ACPI_RESOURCE_NAME_SMALL_MASK 0x78 /* Bits 6:3 contain the type */
  930. #define ACPI_RESOURCE_NAME_SMALL_LENGTH_MASK 0x07 /* Bits 2:0 contain the length */
  931. #define ACPI_RESOURCE_NAME_LARGE_MASK 0x7F /* Bits 6:0 contain the type */
  932. /*
  933. * Small resource descriptor "names" as defined by the ACPI specification.
  934. * Note: Bits 2:0 are used for the descriptor length
  935. */
  936. #define ACPI_RESOURCE_NAME_IRQ 0x20
  937. #define ACPI_RESOURCE_NAME_DMA 0x28
  938. #define ACPI_RESOURCE_NAME_START_DEPENDENT 0x30
  939. #define ACPI_RESOURCE_NAME_END_DEPENDENT 0x38
  940. #define ACPI_RESOURCE_NAME_IO 0x40
  941. #define ACPI_RESOURCE_NAME_FIXED_IO 0x48
  942. #define ACPI_RESOURCE_NAME_FIXED_DMA 0x50
  943. #define ACPI_RESOURCE_NAME_RESERVED_S2 0x58
  944. #define ACPI_RESOURCE_NAME_RESERVED_S3 0x60
  945. #define ACPI_RESOURCE_NAME_RESERVED_S4 0x68
  946. #define ACPI_RESOURCE_NAME_VENDOR_SMALL 0x70
  947. #define ACPI_RESOURCE_NAME_END_TAG 0x78
  948. /*
  949. * Large resource descriptor "names" as defined by the ACPI specification.
  950. * Note: includes the Large Descriptor bit in bit[7]
  951. */
  952. #define ACPI_RESOURCE_NAME_MEMORY24 0x81
  953. #define ACPI_RESOURCE_NAME_GENERIC_REGISTER 0x82
  954. #define ACPI_RESOURCE_NAME_RESERVED_L1 0x83
  955. #define ACPI_RESOURCE_NAME_VENDOR_LARGE 0x84
  956. #define ACPI_RESOURCE_NAME_MEMORY32 0x85
  957. #define ACPI_RESOURCE_NAME_FIXED_MEMORY32 0x86
  958. #define ACPI_RESOURCE_NAME_ADDRESS32 0x87
  959. #define ACPI_RESOURCE_NAME_ADDRESS16 0x88
  960. #define ACPI_RESOURCE_NAME_EXTENDED_IRQ 0x89
  961. #define ACPI_RESOURCE_NAME_ADDRESS64 0x8A
  962. #define ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64 0x8B
  963. #define ACPI_RESOURCE_NAME_GPIO 0x8C
  964. #define ACPI_RESOURCE_NAME_SERIAL_BUS 0x8E
  965. #define ACPI_RESOURCE_NAME_LARGE_MAX 0x8E
  966. /*****************************************************************************
  967. *
  968. * Miscellaneous
  969. *
  970. ****************************************************************************/
  971. #define ACPI_ASCII_ZERO 0x30
  972. /*****************************************************************************
  973. *
  974. * Disassembler
  975. *
  976. ****************************************************************************/
  977. struct acpi_external_list {
  978. char *path;
  979. char *internal_path;
  980. struct acpi_external_list *next;
  981. u32 value;
  982. u16 length;
  983. u16 flags;
  984. u8 type;
  985. };
  986. /* Values for Flags field above */
  987. #define ACPI_EXT_RESOLVED_REFERENCE 0x01 /* Object was resolved during cross ref */
  988. #define ACPI_EXT_ORIGIN_FROM_FILE 0x02 /* External came from a file */
  989. #define ACPI_EXT_INTERNAL_PATH_ALLOCATED 0x04 /* Deallocate internal path on completion */
  990. #define ACPI_EXT_EXTERNAL_EMITTED 0x08 /* External() statement has been emitted */
  991. #define ACPI_EXT_ORIGIN_FROM_OPCODE 0x10 /* External came from a External() opcode */
  992. struct acpi_external_file {
  993. char *path;
  994. struct acpi_external_file *next;
  995. };
  996. /*****************************************************************************
  997. *
  998. * Debugger
  999. *
  1000. ****************************************************************************/
  1001. struct acpi_db_method_info {
  1002. acpi_handle method;
  1003. acpi_handle main_thread_gate;
  1004. acpi_handle thread_complete_gate;
  1005. acpi_handle info_gate;
  1006. acpi_thread_id *threads;
  1007. u32 num_threads;
  1008. u32 num_created;
  1009. u32 num_completed;
  1010. char *name;
  1011. u32 flags;
  1012. u32 num_loops;
  1013. char pathname[ACPI_DB_LINE_BUFFER_SIZE];
  1014. char **args;
  1015. acpi_object_type *types;
  1016. /*
  1017. * Arguments to be passed to method for the command
  1018. * Threads -
  1019. * the Number of threads, ID of current thread and
  1020. * Index of current thread inside all them created.
  1021. */
  1022. char init_args;
  1023. #ifdef ACPI_DEBUGGER
  1024. acpi_object_type arg_types[4];
  1025. #endif
  1026. char *arguments[4];
  1027. char num_threads_str[11];
  1028. char id_of_thread_str[11];
  1029. char index_of_thread_str[11];
  1030. };
  1031. struct acpi_integrity_info {
  1032. u32 nodes;
  1033. u32 objects;
  1034. };
  1035. #define ACPI_DB_DISABLE_OUTPUT 0x00
  1036. #define ACPI_DB_REDIRECTABLE_OUTPUT 0x01
  1037. #define ACPI_DB_CONSOLE_OUTPUT 0x02
  1038. #define ACPI_DB_DUPLICATE_OUTPUT 0x03
  1039. struct acpi_object_info {
  1040. u32 types[ACPI_TOTAL_TYPES];
  1041. };
  1042. /*****************************************************************************
  1043. *
  1044. * Debug
  1045. *
  1046. ****************************************************************************/
  1047. /* Entry for a memory allocation (debug only) */
  1048. #define ACPI_MEM_MALLOC 0
  1049. #define ACPI_MEM_CALLOC 1
  1050. #define ACPI_MAX_MODULE_NAME 16
  1051. #define ACPI_COMMON_DEBUG_MEM_HEADER \
  1052. struct acpi_debug_mem_block *previous; \
  1053. struct acpi_debug_mem_block *next; \
  1054. u32 size; \
  1055. u32 component; \
  1056. u32 line; \
  1057. char module[ACPI_MAX_MODULE_NAME]; \
  1058. u8 alloc_type;
  1059. struct acpi_debug_mem_header {
  1060. ACPI_COMMON_DEBUG_MEM_HEADER};
  1061. struct acpi_debug_mem_block {
  1062. ACPI_COMMON_DEBUG_MEM_HEADER u64 user_space;
  1063. };
  1064. #define ACPI_MEM_LIST_GLOBAL 0
  1065. #define ACPI_MEM_LIST_NSNODE 1
  1066. #define ACPI_MEM_LIST_MAX 1
  1067. #define ACPI_NUM_MEM_LISTS 2
  1068. /*****************************************************************************
  1069. *
  1070. * Info/help support
  1071. *
  1072. ****************************************************************************/
  1073. struct ah_predefined_name {
  1074. char *name;
  1075. char *description;
  1076. #ifndef ACPI_ASL_COMPILER
  1077. char *action;
  1078. #endif
  1079. };
  1080. struct ah_device_id {
  1081. char *name;
  1082. char *description;
  1083. };
  1084. struct ah_uuid {
  1085. char *description;
  1086. char *string;
  1087. };
  1088. struct ah_table {
  1089. char *signature;
  1090. char *description;
  1091. };
  1092. #endif /* __ACLOCAL_H__ */