aclocal.h 41 KB

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