diff options
author | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
commit | 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch) | |
tree | 0bba044c4ce775e45a88a51686b5d9f90697ea9d /include/acpi/aclocal.h |
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history,
even though we have it. We can create a separate "historical" git
archive of that later if we want to, and in the meantime it's about
3.2GB when imported into git - space that would just make the early
git days unnecessarily complicated, when we don't have a lot of good
infrastructure for it.
Let it rip!
Diffstat (limited to 'include/acpi/aclocal.h')
-rw-r--r-- | include/acpi/aclocal.h | 994 |
1 files changed, 994 insertions, 0 deletions
diff --git a/include/acpi/aclocal.h b/include/acpi/aclocal.h new file mode 100644 index 000000000000..01d3b4bc0c85 --- /dev/null +++ b/include/acpi/aclocal.h | |||
@@ -0,0 +1,994 @@ | |||
1 | /****************************************************************************** | ||
2 | * | ||
3 | * Name: aclocal.h - Internal data types used across the ACPI subsystem | ||
4 | * | ||
5 | *****************************************************************************/ | ||
6 | |||
7 | /* | ||
8 | * Copyright (C) 2000 - 2005, R. Byron Moore | ||
9 | * All rights reserved. | ||
10 | * | ||
11 | * Redistribution and use in source and binary forms, with or without | ||
12 | * modification, are permitted provided that the following conditions | ||
13 | * are met: | ||
14 | * 1. Redistributions of source code must retain the above copyright | ||
15 | * notice, this list of conditions, and the following disclaimer, | ||
16 | * without modification. | ||
17 | * 2. Redistributions in binary form must reproduce at minimum a disclaimer | ||
18 | * substantially similar to the "NO WARRANTY" disclaimer below | ||
19 | * ("Disclaimer") and any redistribution must be conditioned upon | ||
20 | * including a substantially similar Disclaimer requirement for further | ||
21 | * binary redistribution. | ||
22 | * 3. Neither the names of the above-listed copyright holders nor the names | ||
23 | * of any contributors may be used to endorse or promote products derived | ||
24 | * from this software without specific prior written permission. | ||
25 | * | ||
26 | * Alternatively, this software may be distributed under the terms of the | ||
27 | * GNU General Public License ("GPL") version 2 as published by the Free | ||
28 | * Software Foundation. | ||
29 | * | ||
30 | * NO WARRANTY | ||
31 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
32 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
33 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR | ||
34 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
35 | * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
36 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
37 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
38 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
39 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | ||
40 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
41 | * POSSIBILITY OF SUCH DAMAGES. | ||
42 | */ | ||
43 | |||
44 | #ifndef __ACLOCAL_H__ | ||
45 | #define __ACLOCAL_H__ | ||
46 | |||
47 | |||
48 | #define ACPI_WAIT_FOREVER 0xFFFF /* u16, as per ACPI spec */ | ||
49 | |||
50 | typedef void * acpi_mutex; | ||
51 | typedef u32 acpi_mutex_handle; | ||
52 | |||
53 | |||
54 | /* Total number of aml opcodes defined */ | ||
55 | |||
56 | #define AML_NUM_OPCODES 0x7F | ||
57 | |||
58 | |||
59 | /***************************************************************************** | ||
60 | * | ||
61 | * Mutex typedefs and structs | ||
62 | * | ||
63 | ****************************************************************************/ | ||
64 | |||
65 | |||
66 | /* | ||
67 | * Predefined handles for the mutex objects used within the subsystem | ||
68 | * All mutex objects are automatically created by acpi_ut_mutex_initialize. | ||
69 | * | ||
70 | * The acquire/release ordering protocol is implied via this list. Mutexes | ||
71 | * with a lower value must be acquired before mutexes with a higher value. | ||
72 | * | ||
73 | * NOTE: any changes here must be reflected in the acpi_gbl_mutex_names table also! | ||
74 | */ | ||
75 | |||
76 | #define ACPI_MTX_EXECUTE 0 | ||
77 | #define ACPI_MTX_INTERPRETER 1 | ||
78 | #define ACPI_MTX_PARSER 2 | ||
79 | #define ACPI_MTX_DISPATCHER 3 | ||
80 | #define ACPI_MTX_TABLES 4 | ||
81 | #define ACPI_MTX_OP_REGIONS 5 | ||
82 | #define ACPI_MTX_NAMESPACE 6 | ||
83 | #define ACPI_MTX_EVENTS 7 | ||
84 | #define ACPI_MTX_HARDWARE 8 | ||
85 | #define ACPI_MTX_CACHES 9 | ||
86 | #define ACPI_MTX_MEMORY 10 | ||
87 | #define ACPI_MTX_DEBUG_CMD_COMPLETE 11 | ||
88 | #define ACPI_MTX_DEBUG_CMD_READY 12 | ||
89 | |||
90 | #define MAX_MUTEX 12 | ||
91 | #define NUM_MUTEX MAX_MUTEX+1 | ||
92 | |||
93 | |||
94 | #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) | ||
95 | #ifdef DEFINE_ACPI_GLOBALS | ||
96 | |||
97 | /* Names for the mutexes used in the subsystem */ | ||
98 | |||
99 | static char *acpi_gbl_mutex_names[] = | ||
100 | { | ||
101 | "ACPI_MTX_Execute", | ||
102 | "ACPI_MTX_Interpreter", | ||
103 | "ACPI_MTX_Parser", | ||
104 | "ACPI_MTX_Dispatcher", | ||
105 | "ACPI_MTX_Tables", | ||
106 | "ACPI_MTX_op_regions", | ||
107 | "ACPI_MTX_Namespace", | ||
108 | "ACPI_MTX_Events", | ||
109 | "ACPI_MTX_Hardware", | ||
110 | "ACPI_MTX_Caches", | ||
111 | "ACPI_MTX_Memory", | ||
112 | "ACPI_MTX_debug_cmd_complete", | ||
113 | "ACPI_MTX_debug_cmd_ready", | ||
114 | }; | ||
115 | |||
116 | #endif | ||
117 | #endif | ||
118 | |||
119 | |||
120 | /* Table for the global mutexes */ | ||
121 | |||
122 | struct acpi_mutex_info | ||
123 | { | ||
124 | acpi_mutex mutex; | ||
125 | u32 use_count; | ||
126 | u32 owner_id; | ||
127 | }; | ||
128 | |||
129 | /* This owner ID means that the mutex is not in use (unlocked) */ | ||
130 | |||
131 | #define ACPI_MUTEX_NOT_ACQUIRED (u32) (-1) | ||
132 | |||
133 | |||
134 | /* Lock flag parameter for various interfaces */ | ||
135 | |||
136 | #define ACPI_MTX_DO_NOT_LOCK 0 | ||
137 | #define ACPI_MTX_LOCK 1 | ||
138 | |||
139 | |||
140 | typedef u16 acpi_owner_id; | ||
141 | #define ACPI_OWNER_TYPE_TABLE 0x0 | ||
142 | #define ACPI_OWNER_TYPE_METHOD 0x1 | ||
143 | #define ACPI_FIRST_METHOD_ID 0x0001 | ||
144 | #define ACPI_FIRST_TABLE_ID 0xF000 | ||
145 | |||
146 | |||
147 | /* Field access granularities */ | ||
148 | |||
149 | #define ACPI_FIELD_BYTE_GRANULARITY 1 | ||
150 | #define ACPI_FIELD_WORD_GRANULARITY 2 | ||
151 | #define ACPI_FIELD_DWORD_GRANULARITY 4 | ||
152 | #define ACPI_FIELD_QWORD_GRANULARITY 8 | ||
153 | |||
154 | /***************************************************************************** | ||
155 | * | ||
156 | * Namespace typedefs and structs | ||
157 | * | ||
158 | ****************************************************************************/ | ||
159 | |||
160 | |||
161 | /* Operational modes of the AML interpreter/scanner */ | ||
162 | |||
163 | typedef enum | ||
164 | { | ||
165 | ACPI_IMODE_LOAD_PASS1 = 0x01, | ||
166 | ACPI_IMODE_LOAD_PASS2 = 0x02, | ||
167 | ACPI_IMODE_EXECUTE = 0x0E | ||
168 | |||
169 | } acpi_interpreter_mode; | ||
170 | |||
171 | |||
172 | /* | ||
173 | * The Node describes a named object that appears in the AML | ||
174 | * An acpi_node is used to store Nodes. | ||
175 | * | ||
176 | * data_type is used to differentiate between internal descriptors, and MUST | ||
177 | * be the first byte in this structure. | ||
178 | */ | ||
179 | |||
180 | union acpi_name_union | ||
181 | { | ||
182 | u32 integer; | ||
183 | char ascii[4]; | ||
184 | }; | ||
185 | |||
186 | struct acpi_namespace_node | ||
187 | { | ||
188 | u8 descriptor; /* Used to differentiate object descriptor types */ | ||
189 | u8 type; /* Type associated with this name */ | ||
190 | u16 owner_id; | ||
191 | union acpi_name_union name; /* ACPI Name, always 4 chars per ACPI spec */ | ||
192 | union acpi_operand_object *object; /* Pointer to attached ACPI object (optional) */ | ||
193 | struct acpi_namespace_node *child; /* First child */ | ||
194 | struct acpi_namespace_node *peer; /* Next peer*/ | ||
195 | u16 reference_count; /* Current count of references and children */ | ||
196 | u8 flags; | ||
197 | }; | ||
198 | |||
199 | |||
200 | #define ACPI_ENTRY_NOT_FOUND NULL | ||
201 | |||
202 | |||
203 | /* Node flags */ | ||
204 | |||
205 | #define ANOBJ_RESERVED 0x01 | ||
206 | #define ANOBJ_END_OF_PEER_LIST 0x02 | ||
207 | #define ANOBJ_DATA_WIDTH_32 0x04 /* Parent table is 64-bits */ | ||
208 | #define ANOBJ_METHOD_ARG 0x08 | ||
209 | #define ANOBJ_METHOD_LOCAL 0x10 | ||
210 | #define ANOBJ_METHOD_NO_RETVAL 0x20 | ||
211 | #define ANOBJ_METHOD_SOME_NO_RETVAL 0x40 | ||
212 | #define ANOBJ_IS_BIT_OFFSET 0x80 | ||
213 | |||
214 | /* | ||
215 | * ACPI Table Descriptor. One per ACPI table | ||
216 | */ | ||
217 | struct acpi_table_desc | ||
218 | { | ||
219 | struct acpi_table_desc *prev; | ||
220 | struct acpi_table_desc *next; | ||
221 | struct acpi_table_desc *installed_desc; | ||
222 | struct acpi_table_header *pointer; | ||
223 | u8 *aml_start; | ||
224 | u64 physical_address; | ||
225 | u32 aml_length; | ||
226 | acpi_size length; | ||
227 | acpi_owner_id table_id; | ||
228 | u8 type; | ||
229 | u8 allocation; | ||
230 | u8 loaded_into_namespace; | ||
231 | }; | ||
232 | |||
233 | struct acpi_table_list | ||
234 | { | ||
235 | struct acpi_table_desc *next; | ||
236 | u32 count; | ||
237 | }; | ||
238 | |||
239 | |||
240 | struct acpi_find_context | ||
241 | { | ||
242 | char *search_for; | ||
243 | acpi_handle *list; | ||
244 | u32 *count; | ||
245 | }; | ||
246 | |||
247 | |||
248 | struct acpi_ns_search_data | ||
249 | { | ||
250 | struct acpi_namespace_node *node; | ||
251 | }; | ||
252 | |||
253 | |||
254 | /* | ||
255 | * Predefined Namespace items | ||
256 | */ | ||
257 | struct acpi_predefined_names | ||
258 | { | ||
259 | char *name; | ||
260 | u8 type; | ||
261 | char *val; | ||
262 | }; | ||
263 | |||
264 | |||
265 | /* Object types used during package copies */ | ||
266 | |||
267 | |||
268 | #define ACPI_COPY_TYPE_SIMPLE 0 | ||
269 | #define ACPI_COPY_TYPE_PACKAGE 1 | ||
270 | |||
271 | /* Info structure used to convert external<->internal namestrings */ | ||
272 | |||
273 | struct acpi_namestring_info | ||
274 | { | ||
275 | char *external_name; | ||
276 | char *next_external_char; | ||
277 | char *internal_name; | ||
278 | u32 length; | ||
279 | u32 num_segments; | ||
280 | u32 num_carats; | ||
281 | u8 fully_qualified; | ||
282 | }; | ||
283 | |||
284 | |||
285 | /* Field creation info */ | ||
286 | |||
287 | struct acpi_create_field_info | ||
288 | { | ||
289 | struct acpi_namespace_node *region_node; | ||
290 | struct acpi_namespace_node *field_node; | ||
291 | struct acpi_namespace_node *register_node; | ||
292 | struct acpi_namespace_node *data_register_node; | ||
293 | u32 bank_value; | ||
294 | u32 field_bit_position; | ||
295 | u32 field_bit_length; | ||
296 | u8 field_flags; | ||
297 | u8 attribute; | ||
298 | u8 field_type; | ||
299 | }; | ||
300 | |||
301 | |||
302 | /***************************************************************************** | ||
303 | * | ||
304 | * Event typedefs and structs | ||
305 | * | ||
306 | ****************************************************************************/ | ||
307 | |||
308 | /* Dispatch info for each GPE -- either a method or handler, cannot be both */ | ||
309 | |||
310 | struct acpi_handler_info | ||
311 | { | ||
312 | acpi_event_handler address; /* Address of handler, if any */ | ||
313 | void *context; /* Context to be passed to handler */ | ||
314 | struct acpi_namespace_node *method_node; /* Method node for this GPE level (saved) */ | ||
315 | }; | ||
316 | |||
317 | union acpi_gpe_dispatch_info | ||
318 | { | ||
319 | struct acpi_namespace_node *method_node; /* Method node for this GPE level */ | ||
320 | struct acpi_handler_info *handler; | ||
321 | }; | ||
322 | |||
323 | /* | ||
324 | * Information about a GPE, one per each GPE in an array. | ||
325 | * NOTE: Important to keep this struct as small as possible. | ||
326 | */ | ||
327 | struct acpi_gpe_event_info | ||
328 | { | ||
329 | union acpi_gpe_dispatch_info dispatch; /* Either Method or Handler */ | ||
330 | struct acpi_gpe_register_info *register_info; /* Backpointer to register info */ | ||
331 | u8 flags; /* Misc info about this GPE */ | ||
332 | u8 register_bit; /* This GPE bit within the register */ | ||
333 | }; | ||
334 | |||
335 | /* Information about a GPE register pair, one per each status/enable pair in an array */ | ||
336 | |||
337 | struct acpi_gpe_register_info | ||
338 | { | ||
339 | struct acpi_generic_address status_address; /* Address of status reg */ | ||
340 | struct acpi_generic_address enable_address; /* Address of enable reg */ | ||
341 | u8 enable_for_wake; /* GPEs to keep enabled when sleeping */ | ||
342 | u8 enable_for_run; /* GPEs to keep enabled when running */ | ||
343 | u8 base_gpe_number; /* Base GPE number for this register */ | ||
344 | }; | ||
345 | |||
346 | /* | ||
347 | * Information about a GPE register block, one per each installed block -- | ||
348 | * GPE0, GPE1, and one per each installed GPE Block Device. | ||
349 | */ | ||
350 | struct acpi_gpe_block_info | ||
351 | { | ||
352 | struct acpi_namespace_node *node; | ||
353 | struct acpi_gpe_block_info *previous; | ||
354 | struct acpi_gpe_block_info *next; | ||
355 | struct acpi_gpe_xrupt_info *xrupt_block; /* Backpointer to interrupt block */ | ||
356 | struct acpi_gpe_register_info *register_info; /* One per GPE register pair */ | ||
357 | struct acpi_gpe_event_info *event_info; /* One for each GPE */ | ||
358 | struct acpi_generic_address block_address; /* Base address of the block */ | ||
359 | u32 register_count; /* Number of register pairs in block */ | ||
360 | u8 block_base_number;/* Base GPE number for this block */ | ||
361 | }; | ||
362 | |||
363 | /* Information about GPE interrupt handlers, one per each interrupt level used for GPEs */ | ||
364 | |||
365 | struct acpi_gpe_xrupt_info | ||
366 | { | ||
367 | struct acpi_gpe_xrupt_info *previous; | ||
368 | struct acpi_gpe_xrupt_info *next; | ||
369 | struct acpi_gpe_block_info *gpe_block_list_head; /* List of GPE blocks for this xrupt */ | ||
370 | u32 interrupt_level; /* System interrupt level */ | ||
371 | }; | ||
372 | |||
373 | |||
374 | struct acpi_gpe_walk_info | ||
375 | { | ||
376 | struct acpi_namespace_node *gpe_device; | ||
377 | struct acpi_gpe_block_info *gpe_block; | ||
378 | }; | ||
379 | |||
380 | |||
381 | typedef acpi_status (*ACPI_GPE_CALLBACK) ( | ||
382 | struct acpi_gpe_xrupt_info *gpe_xrupt_info, | ||
383 | struct acpi_gpe_block_info *gpe_block); | ||
384 | |||
385 | |||
386 | /* Information about each particular fixed event */ | ||
387 | |||
388 | struct acpi_fixed_event_handler | ||
389 | { | ||
390 | acpi_event_handler handler; /* Address of handler. */ | ||
391 | void *context; /* Context to be passed to handler */ | ||
392 | }; | ||
393 | |||
394 | struct acpi_fixed_event_info | ||
395 | { | ||
396 | u8 status_register_id; | ||
397 | u8 enable_register_id; | ||
398 | u16 status_bit_mask; | ||
399 | u16 enable_bit_mask; | ||
400 | }; | ||
401 | |||
402 | /* Information used during field processing */ | ||
403 | |||
404 | struct acpi_field_info | ||
405 | { | ||
406 | u8 skip_field; | ||
407 | u8 field_flag; | ||
408 | u32 pkg_length; | ||
409 | }; | ||
410 | |||
411 | |||
412 | /***************************************************************************** | ||
413 | * | ||
414 | * Generic "state" object for stacks | ||
415 | * | ||
416 | ****************************************************************************/ | ||
417 | |||
418 | |||
419 | #define ACPI_CONTROL_NORMAL 0xC0 | ||
420 | #define ACPI_CONTROL_CONDITIONAL_EXECUTING 0xC1 | ||
421 | #define ACPI_CONTROL_PREDICATE_EXECUTING 0xC2 | ||
422 | #define ACPI_CONTROL_PREDICATE_FALSE 0xC3 | ||
423 | #define ACPI_CONTROL_PREDICATE_TRUE 0xC4 | ||
424 | |||
425 | |||
426 | /* Forward declarations */ | ||
427 | struct acpi_walk_state ; | ||
428 | struct acpi_obj_mutex; | ||
429 | union acpi_parse_object ; | ||
430 | |||
431 | |||
432 | #define ACPI_STATE_COMMON /* Two 32-bit fields and a pointer */\ | ||
433 | u8 data_type; /* To differentiate various internal objs */\ | ||
434 | u8 flags; \ | ||
435 | u16 value; \ | ||
436 | u16 state; \ | ||
437 | u16 reserved; \ | ||
438 | void *next; \ | ||
439 | |||
440 | struct acpi_common_state | ||
441 | { | ||
442 | ACPI_STATE_COMMON | ||
443 | }; | ||
444 | |||
445 | |||
446 | /* | ||
447 | * Update state - used to traverse complex objects such as packages | ||
448 | */ | ||
449 | struct acpi_update_state | ||
450 | { | ||
451 | ACPI_STATE_COMMON | ||
452 | union acpi_operand_object *object; | ||
453 | }; | ||
454 | |||
455 | |||
456 | /* | ||
457 | * Pkg state - used to traverse nested package structures | ||
458 | */ | ||
459 | struct acpi_pkg_state | ||
460 | { | ||
461 | ACPI_STATE_COMMON | ||
462 | union acpi_operand_object *source_object; | ||
463 | union acpi_operand_object *dest_object; | ||
464 | struct acpi_walk_state *walk_state; | ||
465 | void *this_target_obj; | ||
466 | u32 num_packages; | ||
467 | u16 index; | ||
468 | }; | ||
469 | |||
470 | |||
471 | /* | ||
472 | * Control state - one per if/else and while constructs. | ||
473 | * Allows nesting of these constructs | ||
474 | */ | ||
475 | struct acpi_control_state | ||
476 | { | ||
477 | ACPI_STATE_COMMON | ||
478 | union acpi_parse_object *predicate_op; | ||
479 | u8 *aml_predicate_start; /* Start of if/while predicate */ | ||
480 | u8 *package_end; /* End of if/while block */ | ||
481 | u16 opcode; | ||
482 | }; | ||
483 | |||
484 | |||
485 | /* | ||
486 | * Scope state - current scope during namespace lookups | ||
487 | */ | ||
488 | struct acpi_scope_state | ||
489 | { | ||
490 | ACPI_STATE_COMMON | ||
491 | struct acpi_namespace_node *node; | ||
492 | }; | ||
493 | |||
494 | |||
495 | struct acpi_pscope_state | ||
496 | { | ||
497 | ACPI_STATE_COMMON | ||
498 | union acpi_parse_object *op; /* Current op being parsed */ | ||
499 | u8 *arg_end; /* Current argument end */ | ||
500 | u8 *pkg_end; /* Current package end */ | ||
501 | u32 arg_list; /* Next argument to parse */ | ||
502 | u32 arg_count; /* Number of fixed arguments */ | ||
503 | }; | ||
504 | |||
505 | |||
506 | /* | ||
507 | * Thread state - one per thread across multiple walk states. Multiple walk | ||
508 | * states are created when there are nested control methods executing. | ||
509 | */ | ||
510 | struct acpi_thread_state | ||
511 | { | ||
512 | ACPI_STATE_COMMON | ||
513 | struct acpi_walk_state *walk_state_list; /* Head of list of walk_states for this thread */ | ||
514 | union acpi_operand_object *acquired_mutex_list; /* List of all currently acquired mutexes */ | ||
515 | u32 thread_id; /* Running thread ID */ | ||
516 | u8 current_sync_level; /* Mutex Sync (nested acquire) level */ | ||
517 | }; | ||
518 | |||
519 | |||
520 | /* | ||
521 | * Result values - used to accumulate the results of nested | ||
522 | * AML arguments | ||
523 | */ | ||
524 | struct acpi_result_values | ||
525 | { | ||
526 | ACPI_STATE_COMMON | ||
527 | union acpi_operand_object *obj_desc [ACPI_OBJ_NUM_OPERANDS]; | ||
528 | u8 num_results; | ||
529 | u8 last_insert; | ||
530 | }; | ||
531 | |||
532 | |||
533 | typedef | ||
534 | acpi_status (*acpi_parse_downwards) ( | ||
535 | struct acpi_walk_state *walk_state, | ||
536 | union acpi_parse_object **out_op); | ||
537 | |||
538 | typedef | ||
539 | acpi_status (*acpi_parse_upwards) ( | ||
540 | struct acpi_walk_state *walk_state); | ||
541 | |||
542 | |||
543 | /* | ||
544 | * Notify info - used to pass info to the deferred notify | ||
545 | * handler/dispatcher. | ||
546 | */ | ||
547 | struct acpi_notify_info | ||
548 | { | ||
549 | ACPI_STATE_COMMON | ||
550 | struct acpi_namespace_node *node; | ||
551 | union acpi_operand_object *handler_obj; | ||
552 | }; | ||
553 | |||
554 | |||
555 | /* Generic state is union of structs above */ | ||
556 | |||
557 | union acpi_generic_state | ||
558 | { | ||
559 | struct acpi_common_state common; | ||
560 | struct acpi_control_state control; | ||
561 | struct acpi_update_state update; | ||
562 | struct acpi_scope_state scope; | ||
563 | struct acpi_pscope_state parse_scope; | ||
564 | struct acpi_pkg_state pkg; | ||
565 | struct acpi_thread_state thread; | ||
566 | struct acpi_result_values results; | ||
567 | struct acpi_notify_info notify; | ||
568 | }; | ||
569 | |||
570 | |||
571 | /***************************************************************************** | ||
572 | * | ||
573 | * Interpreter typedefs and structs | ||
574 | * | ||
575 | ****************************************************************************/ | ||
576 | |||
577 | typedef | ||
578 | acpi_status (*ACPI_EXECUTE_OP) ( | ||
579 | struct acpi_walk_state *walk_state); | ||
580 | |||
581 | |||
582 | /***************************************************************************** | ||
583 | * | ||
584 | * Parser typedefs and structs | ||
585 | * | ||
586 | ****************************************************************************/ | ||
587 | |||
588 | /* | ||
589 | * AML opcode, name, and argument layout | ||
590 | */ | ||
591 | struct acpi_opcode_info | ||
592 | { | ||
593 | #if defined(ACPI_DISASSEMBLER) || defined(ACPI_DEBUG_OUTPUT) | ||
594 | char *name; /* Opcode name (disassembler/debug only) */ | ||
595 | #endif | ||
596 | u32 parse_args; /* Grammar/Parse time arguments */ | ||
597 | u32 runtime_args; /* Interpret time arguments */ | ||
598 | u32 flags; /* Misc flags */ | ||
599 | u8 object_type; /* Corresponding internal object type */ | ||
600 | u8 class; /* Opcode class */ | ||
601 | u8 type; /* Opcode type */ | ||
602 | }; | ||
603 | |||
604 | |||
605 | union acpi_parse_value | ||
606 | { | ||
607 | acpi_integer integer; /* Integer constant (Up to 64 bits) */ | ||
608 | struct uint64_struct integer64; /* Structure overlay for 2 32-bit Dwords */ | ||
609 | u32 size; /* bytelist or field size */ | ||
610 | char *string; /* NULL terminated string */ | ||
611 | u8 *buffer; /* buffer or string */ | ||
612 | char *name; /* NULL terminated string */ | ||
613 | union acpi_parse_object *arg; /* arguments and contained ops */ | ||
614 | }; | ||
615 | |||
616 | |||
617 | #define ACPI_PARSE_COMMON \ | ||
618 | u8 data_type; /* To differentiate various internal objs */\ | ||
619 | u8 flags; /* Type of Op */\ | ||
620 | u16 aml_opcode; /* AML opcode */\ | ||
621 | u32 aml_offset; /* Offset of declaration in AML */\ | ||
622 | union acpi_parse_object *parent; /* Parent op */\ | ||
623 | union acpi_parse_object *next; /* Next op */\ | ||
624 | ACPI_DISASM_ONLY_MEMBERS (\ | ||
625 | u8 disasm_flags; /* Used during AML disassembly */\ | ||
626 | u8 disasm_opcode; /* Subtype used for disassembly */\ | ||
627 | char aml_op_name[16]) /* Op name (debug only) */\ | ||
628 | /* NON-DEBUG members below: */\ | ||
629 | struct acpi_namespace_node *node; /* For use by interpreter */\ | ||
630 | union acpi_parse_value value; /* Value or args associated with the opcode */\ | ||
631 | |||
632 | |||
633 | #define ACPI_DASM_BUFFER 0x00 | ||
634 | #define ACPI_DASM_RESOURCE 0x01 | ||
635 | #define ACPI_DASM_STRING 0x02 | ||
636 | #define ACPI_DASM_UNICODE 0x03 | ||
637 | #define ACPI_DASM_EISAID 0x04 | ||
638 | #define ACPI_DASM_MATCHOP 0x05 | ||
639 | |||
640 | /* | ||
641 | * generic operation (for example: If, While, Store) | ||
642 | */ | ||
643 | struct acpi_parse_obj_common | ||
644 | { | ||
645 | ACPI_PARSE_COMMON | ||
646 | }; | ||
647 | |||
648 | |||
649 | /* | ||
650 | * Extended Op for named ops (Scope, Method, etc.), deferred ops (Methods and op_regions), | ||
651 | * and bytelists. | ||
652 | */ | ||
653 | struct acpi_parse_obj_named | ||
654 | { | ||
655 | ACPI_PARSE_COMMON | ||
656 | u8 *path; | ||
657 | u8 *data; /* AML body or bytelist data */ | ||
658 | u32 length; /* AML length */ | ||
659 | u32 name; /* 4-byte name or zero if no name */ | ||
660 | }; | ||
661 | |||
662 | |||
663 | /* The parse node is the fundamental element of the parse tree */ | ||
664 | |||
665 | struct acpi_parse_obj_asl | ||
666 | { | ||
667 | ACPI_PARSE_COMMON | ||
668 | union acpi_parse_object *child; | ||
669 | union acpi_parse_object *parent_method; | ||
670 | char *filename; | ||
671 | char *external_name; | ||
672 | char *namepath; | ||
673 | char name_seg[4]; | ||
674 | u32 extra_value; | ||
675 | u32 column; | ||
676 | u32 line_number; | ||
677 | u32 logical_line_number; | ||
678 | u32 logical_byte_offset; | ||
679 | u32 end_line; | ||
680 | u32 end_logical_line; | ||
681 | u32 acpi_btype; | ||
682 | u32 aml_length; | ||
683 | u32 aml_subtree_length; | ||
684 | u32 final_aml_length; | ||
685 | u32 final_aml_offset; | ||
686 | u32 compile_flags; | ||
687 | u16 parse_opcode; | ||
688 | u8 aml_opcode_length; | ||
689 | u8 aml_pkg_len_bytes; | ||
690 | u8 extra; | ||
691 | char parse_op_name[12]; | ||
692 | }; | ||
693 | |||
694 | |||
695 | union acpi_parse_object | ||
696 | { | ||
697 | struct acpi_parse_obj_common common; | ||
698 | struct acpi_parse_obj_named named; | ||
699 | struct acpi_parse_obj_asl asl; | ||
700 | }; | ||
701 | |||
702 | |||
703 | /* | ||
704 | * Parse state - one state per parser invocation and each control | ||
705 | * method. | ||
706 | */ | ||
707 | struct acpi_parse_state | ||
708 | { | ||
709 | u32 aml_size; | ||
710 | u8 *aml_start; /* First AML byte */ | ||
711 | u8 *aml; /* Next AML byte */ | ||
712 | u8 *aml_end; /* (last + 1) AML byte */ | ||
713 | u8 *pkg_start; /* Current package begin */ | ||
714 | u8 *pkg_end; /* Current package end */ | ||
715 | union acpi_parse_object *start_op; /* Root of parse tree */ | ||
716 | struct acpi_namespace_node *start_node; | ||
717 | union acpi_generic_state *scope; /* Current scope */ | ||
718 | union acpi_parse_object *start_scope; | ||
719 | }; | ||
720 | |||
721 | |||
722 | /* Parse object flags */ | ||
723 | |||
724 | #define ACPI_PARSEOP_GENERIC 0x01 | ||
725 | #define ACPI_PARSEOP_NAMED 0x02 | ||
726 | #define ACPI_PARSEOP_DEFERRED 0x04 | ||
727 | #define ACPI_PARSEOP_BYTELIST 0x08 | ||
728 | #define ACPI_PARSEOP_IN_CACHE 0x80 | ||
729 | |||
730 | /* Parse object disasm_flags */ | ||
731 | |||
732 | #define ACPI_PARSEOP_IGNORE 0x01 | ||
733 | #define ACPI_PARSEOP_PARAMLIST 0x02 | ||
734 | #define ACPI_PARSEOP_EMPTY_TERMLIST 0x04 | ||
735 | #define ACPI_PARSEOP_SPECIAL 0x10 | ||
736 | |||
737 | |||
738 | /***************************************************************************** | ||
739 | * | ||
740 | * Hardware (ACPI registers) and PNP | ||
741 | * | ||
742 | ****************************************************************************/ | ||
743 | |||
744 | #define PCI_ROOT_HID_STRING "PNP0A03" | ||
745 | |||
746 | struct acpi_bit_register_info | ||
747 | { | ||
748 | u8 parent_register; | ||
749 | u8 bit_position; | ||
750 | u16 access_bit_mask; | ||
751 | }; | ||
752 | |||
753 | |||
754 | /* | ||
755 | * Register IDs | ||
756 | * These are the full ACPI registers | ||
757 | */ | ||
758 | #define ACPI_REGISTER_PM1_STATUS 0x01 | ||
759 | #define ACPI_REGISTER_PM1_ENABLE 0x02 | ||
760 | #define ACPI_REGISTER_PM1_CONTROL 0x03 | ||
761 | #define ACPI_REGISTER_PM1A_CONTROL 0x04 | ||
762 | #define ACPI_REGISTER_PM1B_CONTROL 0x05 | ||
763 | #define ACPI_REGISTER_PM2_CONTROL 0x06 | ||
764 | #define ACPI_REGISTER_PM_TIMER 0x07 | ||
765 | #define ACPI_REGISTER_PROCESSOR_BLOCK 0x08 | ||
766 | #define ACPI_REGISTER_SMI_COMMAND_BLOCK 0x09 | ||
767 | |||
768 | |||
769 | /* Masks used to access the bit_registers */ | ||
770 | |||
771 | #define ACPI_BITMASK_TIMER_STATUS 0x0001 | ||
772 | #define ACPI_BITMASK_BUS_MASTER_STATUS 0x0010 | ||
773 | #define ACPI_BITMASK_GLOBAL_LOCK_STATUS 0x0020 | ||
774 | #define ACPI_BITMASK_POWER_BUTTON_STATUS 0x0100 | ||
775 | #define ACPI_BITMASK_SLEEP_BUTTON_STATUS 0x0200 | ||
776 | #define ACPI_BITMASK_RT_CLOCK_STATUS 0x0400 | ||
777 | #define ACPI_BITMASK_PCIEXP_WAKE_STATUS 0x4000 /* ACPI 3.0 */ | ||
778 | #define ACPI_BITMASK_WAKE_STATUS 0x8000 | ||
779 | |||
780 | #define ACPI_BITMASK_ALL_FIXED_STATUS (ACPI_BITMASK_TIMER_STATUS | \ | ||
781 | ACPI_BITMASK_BUS_MASTER_STATUS | \ | ||
782 | ACPI_BITMASK_GLOBAL_LOCK_STATUS | \ | ||
783 | ACPI_BITMASK_POWER_BUTTON_STATUS | \ | ||
784 | ACPI_BITMASK_SLEEP_BUTTON_STATUS | \ | ||
785 | ACPI_BITMASK_RT_CLOCK_STATUS | \ | ||
786 | ACPI_BITMASK_WAKE_STATUS) | ||
787 | |||
788 | #define ACPI_BITMASK_TIMER_ENABLE 0x0001 | ||
789 | #define ACPI_BITMASK_GLOBAL_LOCK_ENABLE 0x0020 | ||
790 | #define ACPI_BITMASK_POWER_BUTTON_ENABLE 0x0100 | ||
791 | #define ACPI_BITMASK_SLEEP_BUTTON_ENABLE 0x0200 | ||
792 | #define ACPI_BITMASK_RT_CLOCK_ENABLE 0x0400 | ||
793 | #define ACPI_BITMASK_PCIEXP_WAKE_DISABLE 0x4000 /* ACPI 3.0 */ | ||
794 | |||
795 | #define ACPI_BITMASK_SCI_ENABLE 0x0001 | ||
796 | #define ACPI_BITMASK_BUS_MASTER_RLD 0x0002 | ||
797 | #define ACPI_BITMASK_GLOBAL_LOCK_RELEASE 0x0004 | ||
798 | #define ACPI_BITMASK_SLEEP_TYPE_X 0x1C00 | ||
799 | #define ACPI_BITMASK_SLEEP_ENABLE 0x2000 | ||
800 | |||
801 | #define ACPI_BITMASK_ARB_DISABLE 0x0001 | ||
802 | |||
803 | |||
804 | /* Raw bit position of each bit_register */ | ||
805 | |||
806 | #define ACPI_BITPOSITION_TIMER_STATUS 0x00 | ||
807 | #define ACPI_BITPOSITION_BUS_MASTER_STATUS 0x04 | ||
808 | #define ACPI_BITPOSITION_GLOBAL_LOCK_STATUS 0x05 | ||
809 | #define ACPI_BITPOSITION_POWER_BUTTON_STATUS 0x08 | ||
810 | #define ACPI_BITPOSITION_SLEEP_BUTTON_STATUS 0x09 | ||
811 | #define ACPI_BITPOSITION_RT_CLOCK_STATUS 0x0A | ||
812 | #define ACPI_BITPOSITION_PCIEXP_WAKE_STATUS 0x0E /* ACPI 3.0 */ | ||
813 | #define ACPI_BITPOSITION_WAKE_STATUS 0x0F | ||
814 | |||
815 | #define ACPI_BITPOSITION_TIMER_ENABLE 0x00 | ||
816 | #define ACPI_BITPOSITION_GLOBAL_LOCK_ENABLE 0x05 | ||
817 | #define ACPI_BITPOSITION_POWER_BUTTON_ENABLE 0x08 | ||
818 | #define ACPI_BITPOSITION_SLEEP_BUTTON_ENABLE 0x09 | ||
819 | #define ACPI_BITPOSITION_RT_CLOCK_ENABLE 0x0A | ||
820 | #define ACPI_BITPOSITION_PCIEXP_WAKE_DISABLE 0x0E /* ACPI 3.0 */ | ||
821 | |||
822 | #define ACPI_BITPOSITION_SCI_ENABLE 0x00 | ||
823 | #define ACPI_BITPOSITION_BUS_MASTER_RLD 0x01 | ||
824 | #define ACPI_BITPOSITION_GLOBAL_LOCK_RELEASE 0x02 | ||
825 | #define ACPI_BITPOSITION_SLEEP_TYPE_X 0x0A | ||
826 | #define ACPI_BITPOSITION_SLEEP_ENABLE 0x0D | ||
827 | |||
828 | #define ACPI_BITPOSITION_ARB_DISABLE 0x00 | ||
829 | |||
830 | |||
831 | /***************************************************************************** | ||
832 | * | ||
833 | * Resource descriptors | ||
834 | * | ||
835 | ****************************************************************************/ | ||
836 | |||
837 | |||
838 | /* resource_type values */ | ||
839 | |||
840 | #define ACPI_RESOURCE_TYPE_MEMORY_RANGE 0 | ||
841 | #define ACPI_RESOURCE_TYPE_IO_RANGE 1 | ||
842 | #define ACPI_RESOURCE_TYPE_BUS_NUMBER_RANGE 2 | ||
843 | |||
844 | /* Resource descriptor types and masks */ | ||
845 | |||
846 | #define ACPI_RDESC_TYPE_LARGE 0x80 | ||
847 | #define ACPI_RDESC_TYPE_SMALL 0x00 | ||
848 | |||
849 | #define ACPI_RDESC_TYPE_MASK 0x80 | ||
850 | #define ACPI_RDESC_SMALL_MASK 0x78 /* Only bits 6:3 contain the type */ | ||
851 | |||
852 | |||
853 | /* | ||
854 | * Small resource descriptor types | ||
855 | * Note: The 3 length bits (2:0) must be zero | ||
856 | */ | ||
857 | #define ACPI_RDESC_TYPE_IRQ_FORMAT 0x20 | ||
858 | #define ACPI_RDESC_TYPE_DMA_FORMAT 0x28 | ||
859 | #define ACPI_RDESC_TYPE_START_DEPENDENT 0x30 | ||
860 | #define ACPI_RDESC_TYPE_END_DEPENDENT 0x38 | ||
861 | #define ACPI_RDESC_TYPE_IO_PORT 0x40 | ||
862 | #define ACPI_RDESC_TYPE_FIXED_IO_PORT 0x48 | ||
863 | #define ACPI_RDESC_TYPE_SMALL_VENDOR 0x70 | ||
864 | #define ACPI_RDESC_TYPE_END_TAG 0x78 | ||
865 | |||
866 | /* | ||
867 | * Large resource descriptor types | ||
868 | */ | ||
869 | #define ACPI_RDESC_TYPE_MEMORY_24 0x81 | ||
870 | #define ACPI_RDESC_TYPE_GENERAL_REGISTER 0x82 | ||
871 | #define ACPI_RDESC_TYPE_LARGE_VENDOR 0x84 | ||
872 | #define ACPI_RDESC_TYPE_MEMORY_32 0x85 | ||
873 | #define ACPI_RDESC_TYPE_FIXED_MEMORY_32 0x86 | ||
874 | #define ACPI_RDESC_TYPE_DWORD_ADDRESS_SPACE 0x87 | ||
875 | #define ACPI_RDESC_TYPE_WORD_ADDRESS_SPACE 0x88 | ||
876 | #define ACPI_RDESC_TYPE_EXTENDED_XRUPT 0x89 | ||
877 | #define ACPI_RDESC_TYPE_QWORD_ADDRESS_SPACE 0x8A | ||
878 | #define ACPI_RDESC_TYPE_EXTENDED_ADDRESS_SPACE 0x8B | ||
879 | |||
880 | |||
881 | /***************************************************************************** | ||
882 | * | ||
883 | * Miscellaneous | ||
884 | * | ||
885 | ****************************************************************************/ | ||
886 | |||
887 | #define ACPI_ASCII_ZERO 0x30 | ||
888 | |||
889 | |||
890 | /***************************************************************************** | ||
891 | * | ||
892 | * Debugger | ||
893 | * | ||
894 | ****************************************************************************/ | ||
895 | |||
896 | struct acpi_db_method_info | ||
897 | { | ||
898 | acpi_handle thread_gate; | ||
899 | char *name; | ||
900 | char **args; | ||
901 | u32 flags; | ||
902 | u32 num_loops; | ||
903 | char pathname[128]; | ||
904 | }; | ||
905 | |||
906 | struct acpi_integrity_info | ||
907 | { | ||
908 | u32 nodes; | ||
909 | u32 objects; | ||
910 | }; | ||
911 | |||
912 | |||
913 | #define ACPI_DB_REDIRECTABLE_OUTPUT 0x01 | ||
914 | #define ACPI_DB_CONSOLE_OUTPUT 0x02 | ||
915 | #define ACPI_DB_DUPLICATE_OUTPUT 0x03 | ||
916 | |||
917 | |||
918 | /***************************************************************************** | ||
919 | * | ||
920 | * Debug | ||
921 | * | ||
922 | ****************************************************************************/ | ||
923 | |||
924 | struct acpi_debug_print_info | ||
925 | { | ||
926 | u32 component_id; | ||
927 | char *proc_name; | ||
928 | char *module_name; | ||
929 | }; | ||
930 | |||
931 | |||
932 | /* Entry for a memory allocation (debug only) */ | ||
933 | |||
934 | #define ACPI_MEM_MALLOC 0 | ||
935 | #define ACPI_MEM_CALLOC 1 | ||
936 | #define ACPI_MAX_MODULE_NAME 16 | ||
937 | |||
938 | #define ACPI_COMMON_DEBUG_MEM_HEADER \ | ||
939 | struct acpi_debug_mem_block *previous; \ | ||
940 | struct acpi_debug_mem_block *next; \ | ||
941 | u32 size; \ | ||
942 | u32 component; \ | ||
943 | u32 line; \ | ||
944 | char module[ACPI_MAX_MODULE_NAME]; \ | ||
945 | u8 alloc_type; | ||
946 | |||
947 | struct acpi_debug_mem_header | ||
948 | { | ||
949 | ACPI_COMMON_DEBUG_MEM_HEADER | ||
950 | }; | ||
951 | |||
952 | struct acpi_debug_mem_block | ||
953 | { | ||
954 | ACPI_COMMON_DEBUG_MEM_HEADER | ||
955 | u64 user_space; | ||
956 | }; | ||
957 | |||
958 | |||
959 | #define ACPI_MEM_LIST_GLOBAL 0 | ||
960 | #define ACPI_MEM_LIST_NSNODE 1 | ||
961 | |||
962 | #define ACPI_MEM_LIST_FIRST_CACHE_LIST 2 | ||
963 | #define ACPI_MEM_LIST_STATE 2 | ||
964 | #define ACPI_MEM_LIST_PSNODE 3 | ||
965 | #define ACPI_MEM_LIST_PSNODE_EXT 4 | ||
966 | #define ACPI_MEM_LIST_OPERAND 5 | ||
967 | #define ACPI_MEM_LIST_WALK 6 | ||
968 | #define ACPI_MEM_LIST_MAX 6 | ||
969 | #define ACPI_NUM_MEM_LISTS 7 | ||
970 | |||
971 | |||
972 | struct acpi_memory_list | ||
973 | { | ||
974 | void *list_head; | ||
975 | u16 link_offset; | ||
976 | u16 max_cache_depth; | ||
977 | u16 cache_depth; | ||
978 | u16 object_size; | ||
979 | |||
980 | #ifdef ACPI_DBG_TRACK_ALLOCATIONS | ||
981 | |||
982 | /* Statistics for debug memory tracking only */ | ||
983 | |||
984 | u32 total_allocated; | ||
985 | u32 total_freed; | ||
986 | u32 current_total_size; | ||
987 | u32 cache_requests; | ||
988 | u32 cache_hits; | ||
989 | char *list_name; | ||
990 | #endif | ||
991 | }; | ||
992 | |||
993 | |||
994 | #endif /* __ACLOCAL_H__ */ | ||