aclocal.h 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994
  1. /******************************************************************************
  2. *
  3. * Name: aclocal.h - Internal data types used across the ACPI subsystem
  4. *
  5. *****************************************************************************/
  6. /*
  7. * Copyright (C) 2000 - 2005, R. Byron Moore
  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. #define ACPI_WAIT_FOREVER 0xFFFF /* u16, as per ACPI spec */
  45. typedef void * acpi_mutex;
  46. typedef u32 acpi_mutex_handle;
  47. /* Total number of aml opcodes defined */
  48. #define AML_NUM_OPCODES 0x7F
  49. /*****************************************************************************
  50. *
  51. * Mutex typedefs and structs
  52. *
  53. ****************************************************************************/
  54. /*
  55. * Predefined handles for the mutex objects used within the subsystem
  56. * All mutex objects are automatically created by acpi_ut_mutex_initialize.
  57. *
  58. * The acquire/release ordering protocol is implied via this list. Mutexes
  59. * with a lower value must be acquired before mutexes with a higher value.
  60. *
  61. * NOTE: any changes here must be reflected in the acpi_gbl_mutex_names table also!
  62. */
  63. #define ACPI_MTX_EXECUTE 0
  64. #define ACPI_MTX_INTERPRETER 1
  65. #define ACPI_MTX_PARSER 2
  66. #define ACPI_MTX_DISPATCHER 3
  67. #define ACPI_MTX_TABLES 4
  68. #define ACPI_MTX_OP_REGIONS 5
  69. #define ACPI_MTX_NAMESPACE 6
  70. #define ACPI_MTX_EVENTS 7
  71. #define ACPI_MTX_HARDWARE 8
  72. #define ACPI_MTX_CACHES 9
  73. #define ACPI_MTX_MEMORY 10
  74. #define ACPI_MTX_DEBUG_CMD_COMPLETE 11
  75. #define ACPI_MTX_DEBUG_CMD_READY 12
  76. #define MAX_MUTEX 12
  77. #define NUM_MUTEX MAX_MUTEX+1
  78. #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
  79. #ifdef DEFINE_ACPI_GLOBALS
  80. /* Names for the mutexes used in the subsystem */
  81. static char *acpi_gbl_mutex_names[] =
  82. {
  83. "ACPI_MTX_Execute",
  84. "ACPI_MTX_Interpreter",
  85. "ACPI_MTX_Parser",
  86. "ACPI_MTX_Dispatcher",
  87. "ACPI_MTX_Tables",
  88. "ACPI_MTX_op_regions",
  89. "ACPI_MTX_Namespace",
  90. "ACPI_MTX_Events",
  91. "ACPI_MTX_Hardware",
  92. "ACPI_MTX_Caches",
  93. "ACPI_MTX_Memory",
  94. "ACPI_MTX_debug_cmd_complete",
  95. "ACPI_MTX_debug_cmd_ready",
  96. };
  97. #endif
  98. #endif
  99. /* Table for the global mutexes */
  100. struct acpi_mutex_info
  101. {
  102. acpi_mutex mutex;
  103. u32 use_count;
  104. u32 owner_id;
  105. };
  106. /* This owner ID means that the mutex is not in use (unlocked) */
  107. #define ACPI_MUTEX_NOT_ACQUIRED (u32) (-1)
  108. /* Lock flag parameter for various interfaces */
  109. #define ACPI_MTX_DO_NOT_LOCK 0
  110. #define ACPI_MTX_LOCK 1
  111. typedef u16 acpi_owner_id;
  112. #define ACPI_OWNER_TYPE_TABLE 0x0
  113. #define ACPI_OWNER_TYPE_METHOD 0x1
  114. #define ACPI_FIRST_METHOD_ID 0x0001
  115. #define ACPI_FIRST_TABLE_ID 0xF000
  116. /* Field access granularities */
  117. #define ACPI_FIELD_BYTE_GRANULARITY 1
  118. #define ACPI_FIELD_WORD_GRANULARITY 2
  119. #define ACPI_FIELD_DWORD_GRANULARITY 4
  120. #define ACPI_FIELD_QWORD_GRANULARITY 8
  121. /*****************************************************************************
  122. *
  123. * Namespace typedefs and structs
  124. *
  125. ****************************************************************************/
  126. /* Operational modes of the AML interpreter/scanner */
  127. typedef enum
  128. {
  129. ACPI_IMODE_LOAD_PASS1 = 0x01,
  130. ACPI_IMODE_LOAD_PASS2 = 0x02,
  131. ACPI_IMODE_EXECUTE = 0x0E
  132. } acpi_interpreter_mode;
  133. /*
  134. * The Node describes a named object that appears in the AML
  135. * An acpi_node is used to store Nodes.
  136. *
  137. * data_type is used to differentiate between internal descriptors, and MUST
  138. * be the first byte in this structure.
  139. */
  140. union acpi_name_union
  141. {
  142. u32 integer;
  143. char ascii[4];
  144. };
  145. struct acpi_namespace_node
  146. {
  147. u8 descriptor; /* Used to differentiate object descriptor types */
  148. u8 type; /* Type associated with this name */
  149. u16 owner_id;
  150. union acpi_name_union name; /* ACPI Name, always 4 chars per ACPI spec */
  151. union acpi_operand_object *object; /* Pointer to attached ACPI object (optional) */
  152. struct acpi_namespace_node *child; /* First child */
  153. struct acpi_namespace_node *peer; /* Next peer*/
  154. u16 reference_count; /* Current count of references and children */
  155. u8 flags;
  156. };
  157. #define ACPI_ENTRY_NOT_FOUND NULL
  158. /* Node flags */
  159. #define ANOBJ_RESERVED 0x01
  160. #define ANOBJ_END_OF_PEER_LIST 0x02
  161. #define ANOBJ_DATA_WIDTH_32 0x04 /* Parent table is 64-bits */
  162. #define ANOBJ_METHOD_ARG 0x08
  163. #define ANOBJ_METHOD_LOCAL 0x10
  164. #define ANOBJ_METHOD_NO_RETVAL 0x20
  165. #define ANOBJ_METHOD_SOME_NO_RETVAL 0x40
  166. #define ANOBJ_IS_BIT_OFFSET 0x80
  167. /*
  168. * ACPI Table Descriptor. One per ACPI table
  169. */
  170. struct acpi_table_desc
  171. {
  172. struct acpi_table_desc *prev;
  173. struct acpi_table_desc *next;
  174. struct acpi_table_desc *installed_desc;
  175. struct acpi_table_header *pointer;
  176. u8 *aml_start;
  177. u64 physical_address;
  178. u32 aml_length;
  179. acpi_size length;
  180. acpi_owner_id table_id;
  181. u8 type;
  182. u8 allocation;
  183. u8 loaded_into_namespace;
  184. };
  185. struct acpi_table_list
  186. {
  187. struct acpi_table_desc *next;
  188. u32 count;
  189. };
  190. struct acpi_find_context
  191. {
  192. char *search_for;
  193. acpi_handle *list;
  194. u32 *count;
  195. };
  196. struct acpi_ns_search_data
  197. {
  198. struct acpi_namespace_node *node;
  199. };
  200. /*
  201. * Predefined Namespace items
  202. */
  203. struct acpi_predefined_names
  204. {
  205. char *name;
  206. u8 type;
  207. char *val;
  208. };
  209. /* Object types used during package copies */
  210. #define ACPI_COPY_TYPE_SIMPLE 0
  211. #define ACPI_COPY_TYPE_PACKAGE 1
  212. /* Info structure used to convert external<->internal namestrings */
  213. struct acpi_namestring_info
  214. {
  215. char *external_name;
  216. char *next_external_char;
  217. char *internal_name;
  218. u32 length;
  219. u32 num_segments;
  220. u32 num_carats;
  221. u8 fully_qualified;
  222. };
  223. /* Field creation info */
  224. struct acpi_create_field_info
  225. {
  226. struct acpi_namespace_node *region_node;
  227. struct acpi_namespace_node *field_node;
  228. struct acpi_namespace_node *register_node;
  229. struct acpi_namespace_node *data_register_node;
  230. u32 bank_value;
  231. u32 field_bit_position;
  232. u32 field_bit_length;
  233. u8 field_flags;
  234. u8 attribute;
  235. u8 field_type;
  236. };
  237. /*****************************************************************************
  238. *
  239. * Event typedefs and structs
  240. *
  241. ****************************************************************************/
  242. /* Dispatch info for each GPE -- either a method or handler, cannot be both */
  243. struct acpi_handler_info
  244. {
  245. acpi_event_handler address; /* Address of handler, if any */
  246. void *context; /* Context to be passed to handler */
  247. struct acpi_namespace_node *method_node; /* Method node for this GPE level (saved) */
  248. };
  249. union acpi_gpe_dispatch_info
  250. {
  251. struct acpi_namespace_node *method_node; /* Method node for this GPE level */
  252. struct acpi_handler_info *handler;
  253. };
  254. /*
  255. * Information about a GPE, one per each GPE in an array.
  256. * NOTE: Important to keep this struct as small as possible.
  257. */
  258. struct acpi_gpe_event_info
  259. {
  260. union acpi_gpe_dispatch_info dispatch; /* Either Method or Handler */
  261. struct acpi_gpe_register_info *register_info; /* Backpointer to register info */
  262. u8 flags; /* Misc info about this GPE */
  263. u8 register_bit; /* This GPE bit within the register */
  264. };
  265. /* Information about a GPE register pair, one per each status/enable pair in an array */
  266. struct acpi_gpe_register_info
  267. {
  268. struct acpi_generic_address status_address; /* Address of status reg */
  269. struct acpi_generic_address enable_address; /* Address of enable reg */
  270. u8 enable_for_wake; /* GPEs to keep enabled when sleeping */
  271. u8 enable_for_run; /* GPEs to keep enabled when running */
  272. u8 base_gpe_number; /* Base GPE number for this register */
  273. };
  274. /*
  275. * Information about a GPE register block, one per each installed block --
  276. * GPE0, GPE1, and one per each installed GPE Block Device.
  277. */
  278. struct acpi_gpe_block_info
  279. {
  280. struct acpi_namespace_node *node;
  281. struct acpi_gpe_block_info *previous;
  282. struct acpi_gpe_block_info *next;
  283. struct acpi_gpe_xrupt_info *xrupt_block; /* Backpointer to interrupt block */
  284. struct acpi_gpe_register_info *register_info; /* One per GPE register pair */
  285. struct acpi_gpe_event_info *event_info; /* One for each GPE */
  286. struct acpi_generic_address block_address; /* Base address of the block */
  287. u32 register_count; /* Number of register pairs in block */
  288. u8 block_base_number;/* Base GPE number for this block */
  289. };
  290. /* Information about GPE interrupt handlers, one per each interrupt level used for GPEs */
  291. struct acpi_gpe_xrupt_info
  292. {
  293. struct acpi_gpe_xrupt_info *previous;
  294. struct acpi_gpe_xrupt_info *next;
  295. struct acpi_gpe_block_info *gpe_block_list_head; /* List of GPE blocks for this xrupt */
  296. u32 interrupt_level; /* System interrupt level */
  297. };
  298. struct acpi_gpe_walk_info
  299. {
  300. struct acpi_namespace_node *gpe_device;
  301. struct acpi_gpe_block_info *gpe_block;
  302. };
  303. typedef acpi_status (*ACPI_GPE_CALLBACK) (
  304. struct acpi_gpe_xrupt_info *gpe_xrupt_info,
  305. struct acpi_gpe_block_info *gpe_block);
  306. /* Information about each particular fixed event */
  307. struct acpi_fixed_event_handler
  308. {
  309. acpi_event_handler handler; /* Address of handler. */
  310. void *context; /* Context to be passed to handler */
  311. };
  312. struct acpi_fixed_event_info
  313. {
  314. u8 status_register_id;
  315. u8 enable_register_id;
  316. u16 status_bit_mask;
  317. u16 enable_bit_mask;
  318. };
  319. /* Information used during field processing */
  320. struct acpi_field_info
  321. {
  322. u8 skip_field;
  323. u8 field_flag;
  324. u32 pkg_length;
  325. };
  326. /*****************************************************************************
  327. *
  328. * Generic "state" object for stacks
  329. *
  330. ****************************************************************************/
  331. #define ACPI_CONTROL_NORMAL 0xC0
  332. #define ACPI_CONTROL_CONDITIONAL_EXECUTING 0xC1
  333. #define ACPI_CONTROL_PREDICATE_EXECUTING 0xC2
  334. #define ACPI_CONTROL_PREDICATE_FALSE 0xC3
  335. #define ACPI_CONTROL_PREDICATE_TRUE 0xC4
  336. /* Forward declarations */
  337. struct acpi_walk_state ;
  338. struct acpi_obj_mutex;
  339. union acpi_parse_object ;
  340. #define ACPI_STATE_COMMON /* Two 32-bit fields and a pointer */\
  341. u8 data_type; /* To differentiate various internal objs */\
  342. u8 flags; \
  343. u16 value; \
  344. u16 state; \
  345. u16 reserved; \
  346. void *next; \
  347. struct acpi_common_state
  348. {
  349. ACPI_STATE_COMMON
  350. };
  351. /*
  352. * Update state - used to traverse complex objects such as packages
  353. */
  354. struct acpi_update_state
  355. {
  356. ACPI_STATE_COMMON
  357. union acpi_operand_object *object;
  358. };
  359. /*
  360. * Pkg state - used to traverse nested package structures
  361. */
  362. struct acpi_pkg_state
  363. {
  364. ACPI_STATE_COMMON
  365. union acpi_operand_object *source_object;
  366. union acpi_operand_object *dest_object;
  367. struct acpi_walk_state *walk_state;
  368. void *this_target_obj;
  369. u32 num_packages;
  370. u16 index;
  371. };
  372. /*
  373. * Control state - one per if/else and while constructs.
  374. * Allows nesting of these constructs
  375. */
  376. struct acpi_control_state
  377. {
  378. ACPI_STATE_COMMON
  379. union acpi_parse_object *predicate_op;
  380. u8 *aml_predicate_start; /* Start of if/while predicate */
  381. u8 *package_end; /* End of if/while block */
  382. u16 opcode;
  383. };
  384. /*
  385. * Scope state - current scope during namespace lookups
  386. */
  387. struct acpi_scope_state
  388. {
  389. ACPI_STATE_COMMON
  390. struct acpi_namespace_node *node;
  391. };
  392. struct acpi_pscope_state
  393. {
  394. ACPI_STATE_COMMON
  395. union acpi_parse_object *op; /* Current op being parsed */
  396. u8 *arg_end; /* Current argument end */
  397. u8 *pkg_end; /* Current package end */
  398. u32 arg_list; /* Next argument to parse */
  399. u32 arg_count; /* Number of fixed arguments */
  400. };
  401. /*
  402. * Thread state - one per thread across multiple walk states. Multiple walk
  403. * states are created when there are nested control methods executing.
  404. */
  405. struct acpi_thread_state
  406. {
  407. ACPI_STATE_COMMON
  408. struct acpi_walk_state *walk_state_list; /* Head of list of walk_states for this thread */
  409. union acpi_operand_object *acquired_mutex_list; /* List of all currently acquired mutexes */
  410. u32 thread_id; /* Running thread ID */
  411. u8 current_sync_level; /* Mutex Sync (nested acquire) level */
  412. };
  413. /*
  414. * Result values - used to accumulate the results of nested
  415. * AML arguments
  416. */
  417. struct acpi_result_values
  418. {
  419. ACPI_STATE_COMMON
  420. union acpi_operand_object *obj_desc [ACPI_OBJ_NUM_OPERANDS];
  421. u8 num_results;
  422. u8 last_insert;
  423. };
  424. typedef
  425. acpi_status (*acpi_parse_downwards) (
  426. struct acpi_walk_state *walk_state,
  427. union acpi_parse_object **out_op);
  428. typedef
  429. acpi_status (*acpi_parse_upwards) (
  430. struct acpi_walk_state *walk_state);
  431. /*
  432. * Notify info - used to pass info to the deferred notify
  433. * handler/dispatcher.
  434. */
  435. struct acpi_notify_info
  436. {
  437. ACPI_STATE_COMMON
  438. struct acpi_namespace_node *node;
  439. union acpi_operand_object *handler_obj;
  440. };
  441. /* Generic state is union of structs above */
  442. union acpi_generic_state
  443. {
  444. struct acpi_common_state common;
  445. struct acpi_control_state control;
  446. struct acpi_update_state update;
  447. struct acpi_scope_state scope;
  448. struct acpi_pscope_state parse_scope;
  449. struct acpi_pkg_state pkg;
  450. struct acpi_thread_state thread;
  451. struct acpi_result_values results;
  452. struct acpi_notify_info notify;
  453. };
  454. /*****************************************************************************
  455. *
  456. * Interpreter typedefs and structs
  457. *
  458. ****************************************************************************/
  459. typedef
  460. acpi_status (*ACPI_EXECUTE_OP) (
  461. struct acpi_walk_state *walk_state);
  462. /*****************************************************************************
  463. *
  464. * Parser typedefs and structs
  465. *
  466. ****************************************************************************/
  467. /*
  468. * AML opcode, name, and argument layout
  469. */
  470. struct acpi_opcode_info
  471. {
  472. #if defined(ACPI_DISASSEMBLER) || defined(ACPI_DEBUG_OUTPUT)
  473. char *name; /* Opcode name (disassembler/debug only) */
  474. #endif
  475. u32 parse_args; /* Grammar/Parse time arguments */
  476. u32 runtime_args; /* Interpret time arguments */
  477. u32 flags; /* Misc flags */
  478. u8 object_type; /* Corresponding internal object type */
  479. u8 class; /* Opcode class */
  480. u8 type; /* Opcode type */
  481. };
  482. union acpi_parse_value
  483. {
  484. acpi_integer integer; /* Integer constant (Up to 64 bits) */
  485. struct uint64_struct integer64; /* Structure overlay for 2 32-bit Dwords */
  486. u32 size; /* bytelist or field size */
  487. char *string; /* NULL terminated string */
  488. u8 *buffer; /* buffer or string */
  489. char *name; /* NULL terminated string */
  490. union acpi_parse_object *arg; /* arguments and contained ops */
  491. };
  492. #define ACPI_PARSE_COMMON \
  493. u8 data_type; /* To differentiate various internal objs */\
  494. u8 flags; /* Type of Op */\
  495. u16 aml_opcode; /* AML opcode */\
  496. u32 aml_offset; /* Offset of declaration in AML */\
  497. union acpi_parse_object *parent; /* Parent op */\
  498. union acpi_parse_object *next; /* Next op */\
  499. ACPI_DISASM_ONLY_MEMBERS (\
  500. u8 disasm_flags; /* Used during AML disassembly */\
  501. u8 disasm_opcode; /* Subtype used for disassembly */\
  502. char aml_op_name[16]) /* Op name (debug only) */\
  503. /* NON-DEBUG members below: */\
  504. struct acpi_namespace_node *node; /* For use by interpreter */\
  505. union acpi_parse_value value; /* Value or args associated with the opcode */\
  506. #define ACPI_DASM_BUFFER 0x00
  507. #define ACPI_DASM_RESOURCE 0x01
  508. #define ACPI_DASM_STRING 0x02
  509. #define ACPI_DASM_UNICODE 0x03
  510. #define ACPI_DASM_EISAID 0x04
  511. #define ACPI_DASM_MATCHOP 0x05
  512. /*
  513. * generic operation (for example: If, While, Store)
  514. */
  515. struct acpi_parse_obj_common
  516. {
  517. ACPI_PARSE_COMMON
  518. };
  519. /*
  520. * Extended Op for named ops (Scope, Method, etc.), deferred ops (Methods and op_regions),
  521. * and bytelists.
  522. */
  523. struct acpi_parse_obj_named
  524. {
  525. ACPI_PARSE_COMMON
  526. u8 *path;
  527. u8 *data; /* AML body or bytelist data */
  528. u32 length; /* AML length */
  529. u32 name; /* 4-byte name or zero if no name */
  530. };
  531. /* The parse node is the fundamental element of the parse tree */
  532. struct acpi_parse_obj_asl
  533. {
  534. ACPI_PARSE_COMMON
  535. union acpi_parse_object *child;
  536. union acpi_parse_object *parent_method;
  537. char *filename;
  538. char *external_name;
  539. char *namepath;
  540. char name_seg[4];
  541. u32 extra_value;
  542. u32 column;
  543. u32 line_number;
  544. u32 logical_line_number;
  545. u32 logical_byte_offset;
  546. u32 end_line;
  547. u32 end_logical_line;
  548. u32 acpi_btype;
  549. u32 aml_length;
  550. u32 aml_subtree_length;
  551. u32 final_aml_length;
  552. u32 final_aml_offset;
  553. u32 compile_flags;
  554. u16 parse_opcode;
  555. u8 aml_opcode_length;
  556. u8 aml_pkg_len_bytes;
  557. u8 extra;
  558. char parse_op_name[12];
  559. };
  560. union acpi_parse_object
  561. {
  562. struct acpi_parse_obj_common common;
  563. struct acpi_parse_obj_named named;
  564. struct acpi_parse_obj_asl asl;
  565. };
  566. /*
  567. * Parse state - one state per parser invocation and each control
  568. * method.
  569. */
  570. struct acpi_parse_state
  571. {
  572. u32 aml_size;
  573. u8 *aml_start; /* First AML byte */
  574. u8 *aml; /* Next AML byte */
  575. u8 *aml_end; /* (last + 1) AML byte */
  576. u8 *pkg_start; /* Current package begin */
  577. u8 *pkg_end; /* Current package end */
  578. union acpi_parse_object *start_op; /* Root of parse tree */
  579. struct acpi_namespace_node *start_node;
  580. union acpi_generic_state *scope; /* Current scope */
  581. union acpi_parse_object *start_scope;
  582. };
  583. /* Parse object flags */
  584. #define ACPI_PARSEOP_GENERIC 0x01
  585. #define ACPI_PARSEOP_NAMED 0x02
  586. #define ACPI_PARSEOP_DEFERRED 0x04
  587. #define ACPI_PARSEOP_BYTELIST 0x08
  588. #define ACPI_PARSEOP_IN_CACHE 0x80
  589. /* Parse object disasm_flags */
  590. #define ACPI_PARSEOP_IGNORE 0x01
  591. #define ACPI_PARSEOP_PARAMLIST 0x02
  592. #define ACPI_PARSEOP_EMPTY_TERMLIST 0x04
  593. #define ACPI_PARSEOP_SPECIAL 0x10
  594. /*****************************************************************************
  595. *
  596. * Hardware (ACPI registers) and PNP
  597. *
  598. ****************************************************************************/
  599. #define PCI_ROOT_HID_STRING "PNP0A03"
  600. struct acpi_bit_register_info
  601. {
  602. u8 parent_register;
  603. u8 bit_position;
  604. u16 access_bit_mask;
  605. };
  606. /*
  607. * Register IDs
  608. * These are the full ACPI registers
  609. */
  610. #define ACPI_REGISTER_PM1_STATUS 0x01
  611. #define ACPI_REGISTER_PM1_ENABLE 0x02
  612. #define ACPI_REGISTER_PM1_CONTROL 0x03
  613. #define ACPI_REGISTER_PM1A_CONTROL 0x04
  614. #define ACPI_REGISTER_PM1B_CONTROL 0x05
  615. #define ACPI_REGISTER_PM2_CONTROL 0x06
  616. #define ACPI_REGISTER_PM_TIMER 0x07
  617. #define ACPI_REGISTER_PROCESSOR_BLOCK 0x08
  618. #define ACPI_REGISTER_SMI_COMMAND_BLOCK 0x09
  619. /* Masks used to access the bit_registers */
  620. #define ACPI_BITMASK_TIMER_STATUS 0x0001
  621. #define ACPI_BITMASK_BUS_MASTER_STATUS 0x0010
  622. #define ACPI_BITMASK_GLOBAL_LOCK_STATUS 0x0020
  623. #define ACPI_BITMASK_POWER_BUTTON_STATUS 0x0100
  624. #define ACPI_BITMASK_SLEEP_BUTTON_STATUS 0x0200
  625. #define ACPI_BITMASK_RT_CLOCK_STATUS 0x0400
  626. #define ACPI_BITMASK_PCIEXP_WAKE_STATUS 0x4000 /* ACPI 3.0 */
  627. #define ACPI_BITMASK_WAKE_STATUS 0x8000
  628. #define ACPI_BITMASK_ALL_FIXED_STATUS (ACPI_BITMASK_TIMER_STATUS | \
  629. ACPI_BITMASK_BUS_MASTER_STATUS | \
  630. ACPI_BITMASK_GLOBAL_LOCK_STATUS | \
  631. ACPI_BITMASK_POWER_BUTTON_STATUS | \
  632. ACPI_BITMASK_SLEEP_BUTTON_STATUS | \
  633. ACPI_BITMASK_RT_CLOCK_STATUS | \
  634. ACPI_BITMASK_WAKE_STATUS)
  635. #define ACPI_BITMASK_TIMER_ENABLE 0x0001
  636. #define ACPI_BITMASK_GLOBAL_LOCK_ENABLE 0x0020
  637. #define ACPI_BITMASK_POWER_BUTTON_ENABLE 0x0100
  638. #define ACPI_BITMASK_SLEEP_BUTTON_ENABLE 0x0200
  639. #define ACPI_BITMASK_RT_CLOCK_ENABLE 0x0400
  640. #define ACPI_BITMASK_PCIEXP_WAKE_DISABLE 0x4000 /* ACPI 3.0 */
  641. #define ACPI_BITMASK_SCI_ENABLE 0x0001
  642. #define ACPI_BITMASK_BUS_MASTER_RLD 0x0002
  643. #define ACPI_BITMASK_GLOBAL_LOCK_RELEASE 0x0004
  644. #define ACPI_BITMASK_SLEEP_TYPE_X 0x1C00
  645. #define ACPI_BITMASK_SLEEP_ENABLE 0x2000
  646. #define ACPI_BITMASK_ARB_DISABLE 0x0001
  647. /* Raw bit position of each bit_register */
  648. #define ACPI_BITPOSITION_TIMER_STATUS 0x00
  649. #define ACPI_BITPOSITION_BUS_MASTER_STATUS 0x04
  650. #define ACPI_BITPOSITION_GLOBAL_LOCK_STATUS 0x05
  651. #define ACPI_BITPOSITION_POWER_BUTTON_STATUS 0x08
  652. #define ACPI_BITPOSITION_SLEEP_BUTTON_STATUS 0x09
  653. #define ACPI_BITPOSITION_RT_CLOCK_STATUS 0x0A
  654. #define ACPI_BITPOSITION_PCIEXP_WAKE_STATUS 0x0E /* ACPI 3.0 */
  655. #define ACPI_BITPOSITION_WAKE_STATUS 0x0F
  656. #define ACPI_BITPOSITION_TIMER_ENABLE 0x00
  657. #define ACPI_BITPOSITION_GLOBAL_LOCK_ENABLE 0x05
  658. #define ACPI_BITPOSITION_POWER_BUTTON_ENABLE 0x08
  659. #define ACPI_BITPOSITION_SLEEP_BUTTON_ENABLE 0x09
  660. #define ACPI_BITPOSITION_RT_CLOCK_ENABLE 0x0A
  661. #define ACPI_BITPOSITION_PCIEXP_WAKE_DISABLE 0x0E /* ACPI 3.0 */
  662. #define ACPI_BITPOSITION_SCI_ENABLE 0x00
  663. #define ACPI_BITPOSITION_BUS_MASTER_RLD 0x01
  664. #define ACPI_BITPOSITION_GLOBAL_LOCK_RELEASE 0x02
  665. #define ACPI_BITPOSITION_SLEEP_TYPE_X 0x0A
  666. #define ACPI_BITPOSITION_SLEEP_ENABLE 0x0D
  667. #define ACPI_BITPOSITION_ARB_DISABLE 0x00
  668. /*****************************************************************************
  669. *
  670. * Resource descriptors
  671. *
  672. ****************************************************************************/
  673. /* resource_type values */
  674. #define ACPI_RESOURCE_TYPE_MEMORY_RANGE 0
  675. #define ACPI_RESOURCE_TYPE_IO_RANGE 1
  676. #define ACPI_RESOURCE_TYPE_BUS_NUMBER_RANGE 2
  677. /* Resource descriptor types and masks */
  678. #define ACPI_RDESC_TYPE_LARGE 0x80
  679. #define ACPI_RDESC_TYPE_SMALL 0x00
  680. #define ACPI_RDESC_TYPE_MASK 0x80
  681. #define ACPI_RDESC_SMALL_MASK 0x78 /* Only bits 6:3 contain the type */
  682. /*
  683. * Small resource descriptor types
  684. * Note: The 3 length bits (2:0) must be zero
  685. */
  686. #define ACPI_RDESC_TYPE_IRQ_FORMAT 0x20
  687. #define ACPI_RDESC_TYPE_DMA_FORMAT 0x28
  688. #define ACPI_RDESC_TYPE_START_DEPENDENT 0x30
  689. #define ACPI_RDESC_TYPE_END_DEPENDENT 0x38
  690. #define ACPI_RDESC_TYPE_IO_PORT 0x40
  691. #define ACPI_RDESC_TYPE_FIXED_IO_PORT 0x48
  692. #define ACPI_RDESC_TYPE_SMALL_VENDOR 0x70
  693. #define ACPI_RDESC_TYPE_END_TAG 0x78
  694. /*
  695. * Large resource descriptor types
  696. */
  697. #define ACPI_RDESC_TYPE_MEMORY_24 0x81
  698. #define ACPI_RDESC_TYPE_GENERAL_REGISTER 0x82
  699. #define ACPI_RDESC_TYPE_LARGE_VENDOR 0x84
  700. #define ACPI_RDESC_TYPE_MEMORY_32 0x85
  701. #define ACPI_RDESC_TYPE_FIXED_MEMORY_32 0x86
  702. #define ACPI_RDESC_TYPE_DWORD_ADDRESS_SPACE 0x87
  703. #define ACPI_RDESC_TYPE_WORD_ADDRESS_SPACE 0x88
  704. #define ACPI_RDESC_TYPE_EXTENDED_XRUPT 0x89
  705. #define ACPI_RDESC_TYPE_QWORD_ADDRESS_SPACE 0x8A
  706. #define ACPI_RDESC_TYPE_EXTENDED_ADDRESS_SPACE 0x8B
  707. /*****************************************************************************
  708. *
  709. * Miscellaneous
  710. *
  711. ****************************************************************************/
  712. #define ACPI_ASCII_ZERO 0x30
  713. /*****************************************************************************
  714. *
  715. * Debugger
  716. *
  717. ****************************************************************************/
  718. struct acpi_db_method_info
  719. {
  720. acpi_handle thread_gate;
  721. char *name;
  722. char **args;
  723. u32 flags;
  724. u32 num_loops;
  725. char pathname[128];
  726. };
  727. struct acpi_integrity_info
  728. {
  729. u32 nodes;
  730. u32 objects;
  731. };
  732. #define ACPI_DB_REDIRECTABLE_OUTPUT 0x01
  733. #define ACPI_DB_CONSOLE_OUTPUT 0x02
  734. #define ACPI_DB_DUPLICATE_OUTPUT 0x03
  735. /*****************************************************************************
  736. *
  737. * Debug
  738. *
  739. ****************************************************************************/
  740. struct acpi_debug_print_info
  741. {
  742. u32 component_id;
  743. char *proc_name;
  744. char *module_name;
  745. };
  746. /* Entry for a memory allocation (debug only) */
  747. #define ACPI_MEM_MALLOC 0
  748. #define ACPI_MEM_CALLOC 1
  749. #define ACPI_MAX_MODULE_NAME 16
  750. #define ACPI_COMMON_DEBUG_MEM_HEADER \
  751. struct acpi_debug_mem_block *previous; \
  752. struct acpi_debug_mem_block *next; \
  753. u32 size; \
  754. u32 component; \
  755. u32 line; \
  756. char module[ACPI_MAX_MODULE_NAME]; \
  757. u8 alloc_type;
  758. struct acpi_debug_mem_header
  759. {
  760. ACPI_COMMON_DEBUG_MEM_HEADER
  761. };
  762. struct acpi_debug_mem_block
  763. {
  764. ACPI_COMMON_DEBUG_MEM_HEADER
  765. u64 user_space;
  766. };
  767. #define ACPI_MEM_LIST_GLOBAL 0
  768. #define ACPI_MEM_LIST_NSNODE 1
  769. #define ACPI_MEM_LIST_FIRST_CACHE_LIST 2
  770. #define ACPI_MEM_LIST_STATE 2
  771. #define ACPI_MEM_LIST_PSNODE 3
  772. #define ACPI_MEM_LIST_PSNODE_EXT 4
  773. #define ACPI_MEM_LIST_OPERAND 5
  774. #define ACPI_MEM_LIST_WALK 6
  775. #define ACPI_MEM_LIST_MAX 6
  776. #define ACPI_NUM_MEM_LISTS 7
  777. struct acpi_memory_list
  778. {
  779. void *list_head;
  780. u16 link_offset;
  781. u16 max_cache_depth;
  782. u16 cache_depth;
  783. u16 object_size;
  784. #ifdef ACPI_DBG_TRACK_ALLOCATIONS
  785. /* Statistics for debug memory tracking only */
  786. u32 total_allocated;
  787. u32 total_freed;
  788. u32 current_total_size;
  789. u32 cache_requests;
  790. u32 cache_hits;
  791. char *list_name;
  792. #endif
  793. };
  794. #endif /* __ACLOCAL_H__ */