• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /******************************************************************************
2  *
3  * Name: aclocal.h - Internal data types used across the ACPI subsystem
4  *
5  *****************************************************************************/
6 
7 /*
8  * Copyright (C) 2000 - 2008, Intel Corp.
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 /* acpisrc:struct_defs -- for acpisrc conversion */
48 
49 #define ACPI_SERIALIZED                 0xFF
50 
51 typedef u32 acpi_mutex_handle;
52 #define ACPI_GLOBAL_LOCK                (acpi_semaphore) (-1)
53 
54 /* Total number of aml opcodes defined */
55 
56 #define AML_NUM_OPCODES                 0x7F
57 
58 /* Forward declarations */
59 
60 struct acpi_walk_state;
61 struct acpi_obj_mutex;
62 union acpi_parse_object;
63 
64 /*****************************************************************************
65  *
66  * Mutex typedefs and structs
67  *
68  ****************************************************************************/
69 
70 /*
71  * Predefined handles for the mutex objects used within the subsystem
72  * All mutex objects are automatically created by acpi_ut_mutex_initialize.
73  *
74  * The acquire/release ordering protocol is implied via this list. Mutexes
75  * with a lower value must be acquired before mutexes with a higher value.
76  *
77  * NOTE: any changes here must be reflected in the acpi_gbl_mutex_names
78  * table below also!
79  */
80 #define ACPI_MTX_INTERPRETER            0	/* AML Interpreter, main lock */
81 #define ACPI_MTX_NAMESPACE              1	/* ACPI Namespace */
82 #define ACPI_MTX_TABLES                 2	/* Data for ACPI tables */
83 #define ACPI_MTX_EVENTS                 3	/* Data for ACPI events */
84 #define ACPI_MTX_CACHES                 4	/* Internal caches, general purposes */
85 #define ACPI_MTX_MEMORY                 5	/* Debug memory tracking lists */
86 #define ACPI_MTX_DEBUG_CMD_COMPLETE     6	/* AML debugger */
87 #define ACPI_MTX_DEBUG_CMD_READY        7	/* AML debugger */
88 
89 #define ACPI_MAX_MUTEX                  7
90 #define ACPI_NUM_MUTEX                  ACPI_MAX_MUTEX+1
91 
92 #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
93 #ifdef DEFINE_ACPI_GLOBALS
94 
95 /* Debug names for the mutexes above */
96 
97 static char *acpi_gbl_mutex_names[ACPI_NUM_MUTEX] = {
98 	"ACPI_MTX_Interpreter",
99 	"ACPI_MTX_Namespace",
100 	"ACPI_MTX_Tables",
101 	"ACPI_MTX_Events",
102 	"ACPI_MTX_Caches",
103 	"ACPI_MTX_Memory",
104 	"ACPI_MTX_CommandComplete",
105 	"ACPI_MTX_CommandReady"
106 };
107 
108 #endif
109 #endif
110 
111 /*
112  * Predefined handles for spinlocks used within the subsystem.
113  * These spinlocks are created by acpi_ut_mutex_initialize
114  */
115 #define ACPI_LOCK_GPES                  0
116 #define ACPI_LOCK_HARDWARE              1
117 
118 #define ACPI_MAX_LOCK                   1
119 #define ACPI_NUM_LOCK                   ACPI_MAX_LOCK+1
120 
121 /* This Thread ID means that the mutex is not in use (unlocked) */
122 
123 #define ACPI_MUTEX_NOT_ACQUIRED         (acpi_thread_id) 0
124 
125 /* Table for the global mutexes */
126 
127 struct acpi_mutex_info {
128 	acpi_mutex mutex;
129 	u32 use_count;
130 	acpi_thread_id thread_id;
131 };
132 
133 /* Lock flag parameter for various interfaces */
134 
135 #define ACPI_MTX_DO_NOT_LOCK            0
136 #define ACPI_MTX_LOCK                   1
137 
138 /* Field access granularities */
139 
140 #define ACPI_FIELD_BYTE_GRANULARITY     1
141 #define ACPI_FIELD_WORD_GRANULARITY     2
142 #define ACPI_FIELD_DWORD_GRANULARITY    4
143 #define ACPI_FIELD_QWORD_GRANULARITY    8
144 
145 #define ACPI_ENTRY_NOT_FOUND            NULL
146 
147 /*****************************************************************************
148  *
149  * Namespace typedefs and structs
150  *
151  ****************************************************************************/
152 
153 /* Operational modes of the AML interpreter/scanner */
154 
155 typedef enum {
156 	ACPI_IMODE_LOAD_PASS1 = 0x01,
157 	ACPI_IMODE_LOAD_PASS2 = 0x02,
158 	ACPI_IMODE_EXECUTE = 0x03
159 } acpi_interpreter_mode;
160 
161 /*
162  * The Namespace Node describes a named object that appears in the AML.
163  * descriptor_type is used to differentiate between internal descriptors.
164  *
165  * The node is optimized for both 32-bit and 64-bit platforms:
166  * 20 bytes for the 32-bit case, 32 bytes for the 64-bit case.
167  *
168  * Note: The descriptor_type and Type fields must appear in the identical
169  * position in both the struct acpi_namespace_node and union acpi_operand_object
170  * structures.
171  */
172 struct acpi_namespace_node {
173 	union acpi_operand_object *object;	/* Interpreter object */
174 	u8 descriptor_type;	/* Differentiate object descriptor types */
175 	u8 type;		/* ACPI Type associated with this name */
176 	u8 flags;		/* Miscellaneous flags */
177 	acpi_owner_id owner_id;	/* Node creator */
178 	union acpi_name_union name;	/* ACPI Name, always 4 chars per ACPI spec */
179 	struct acpi_namespace_node *child;	/* First child */
180 	struct acpi_namespace_node *peer;	/* Peer. Parent if ANOBJ_END_OF_PEER_LIST set */
181 
182 	/*
183 	 * The following fields are used by the ASL compiler and disassembler only
184 	 */
185 #ifdef ACPI_LARGE_NAMESPACE_NODE
186 	union acpi_parse_object *op;
187 	u32 value;
188 	u32 length;
189 #endif
190 };
191 
192 /* Namespace Node flags */
193 
194 #define ANOBJ_END_OF_PEER_LIST          0x01	/* End-of-list, Peer field points to parent */
195 #define ANOBJ_TEMPORARY                 0x02	/* Node is create by a method and is temporary */
196 #define ANOBJ_METHOD_ARG                0x04	/* Node is a method argument */
197 #define ANOBJ_METHOD_LOCAL              0x08	/* Node is a method local */
198 #define ANOBJ_SUBTREE_HAS_INI           0x10	/* Used to optimize device initialization */
199 #define ANOBJ_EVALUATED                 0x20	/* Set on first evaluation of node */
200 
201 #define ANOBJ_IS_EXTERNAL               0x08	/* i_aSL only: This object created via External() */
202 #define ANOBJ_METHOD_NO_RETVAL          0x10	/* i_aSL only: Method has no return value */
203 #define ANOBJ_METHOD_SOME_NO_RETVAL     0x20	/* i_aSL only: Method has at least one return value */
204 #define ANOBJ_IS_BIT_OFFSET             0x40	/* i_aSL only: Reference is a bit offset */
205 #define ANOBJ_IS_REFERENCED             0x80	/* i_aSL only: Object was referenced */
206 
207 /* One internal RSDT for table management */
208 
209 struct acpi_internal_rsdt {
210 	struct acpi_table_desc *tables;
211 	u32 count;
212 	u32 size;
213 	u8 flags;
214 };
215 
216 /* Flags for above */
217 
218 #define ACPI_ROOT_ORIGIN_UNKNOWN        (0)	/* ~ORIGIN_ALLOCATED */
219 #define ACPI_ROOT_ORIGIN_ALLOCATED      (1)
220 #define ACPI_ROOT_ALLOW_RESIZE          (2)
221 
222 /* Predefined (fixed) table indexes */
223 
224 #define ACPI_TABLE_INDEX_DSDT           (0)
225 #define ACPI_TABLE_INDEX_FACS           (1)
226 
227 struct acpi_find_context {
228 	char *search_for;
229 	acpi_handle *list;
230 	u32 *count;
231 };
232 
233 struct acpi_ns_search_data {
234 	struct acpi_namespace_node *node;
235 };
236 
237 /* Object types used during package copies */
238 
239 #define ACPI_COPY_TYPE_SIMPLE           0
240 #define ACPI_COPY_TYPE_PACKAGE          1
241 
242 /* Info structure used to convert external<->internal namestrings */
243 
244 struct acpi_namestring_info {
245 	const char *external_name;
246 	const char *next_external_char;
247 	char *internal_name;
248 	u32 length;
249 	u32 num_segments;
250 	u32 num_carats;
251 	u8 fully_qualified;
252 };
253 
254 /* Field creation info */
255 
256 struct acpi_create_field_info {
257 	struct acpi_namespace_node *region_node;
258 	struct acpi_namespace_node *field_node;
259 	struct acpi_namespace_node *register_node;
260 	struct acpi_namespace_node *data_register_node;
261 	u32 bank_value;
262 	u32 field_bit_position;
263 	u32 field_bit_length;
264 	u8 field_flags;
265 	u8 attribute;
266 	u8 field_type;
267 };
268 
269 typedef
270 acpi_status(*ACPI_INTERNAL_METHOD) (struct acpi_walk_state * walk_state);
271 
272 /*
273  * Bitmapped ACPI types.  Used internally only
274  */
275 #define ACPI_BTYPE_ANY                  0x00000000
276 #define ACPI_BTYPE_INTEGER              0x00000001
277 #define ACPI_BTYPE_STRING               0x00000002
278 #define ACPI_BTYPE_BUFFER               0x00000004
279 #define ACPI_BTYPE_PACKAGE              0x00000008
280 #define ACPI_BTYPE_FIELD_UNIT           0x00000010
281 #define ACPI_BTYPE_DEVICE               0x00000020
282 #define ACPI_BTYPE_EVENT                0x00000040
283 #define ACPI_BTYPE_METHOD               0x00000080
284 #define ACPI_BTYPE_MUTEX                0x00000100
285 #define ACPI_BTYPE_REGION               0x00000200
286 #define ACPI_BTYPE_POWER                0x00000400
287 #define ACPI_BTYPE_PROCESSOR            0x00000800
288 #define ACPI_BTYPE_THERMAL              0x00001000
289 #define ACPI_BTYPE_BUFFER_FIELD         0x00002000
290 #define ACPI_BTYPE_DDB_HANDLE           0x00004000
291 #define ACPI_BTYPE_DEBUG_OBJECT         0x00008000
292 #define ACPI_BTYPE_REFERENCE            0x00010000
293 #define ACPI_BTYPE_RESOURCE             0x00020000
294 
295 #define ACPI_BTYPE_COMPUTE_DATA         (ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING | ACPI_BTYPE_BUFFER)
296 
297 #define ACPI_BTYPE_DATA                 (ACPI_BTYPE_COMPUTE_DATA  | ACPI_BTYPE_PACKAGE)
298 #define ACPI_BTYPE_DATA_REFERENCE       (ACPI_BTYPE_DATA | ACPI_BTYPE_REFERENCE | ACPI_BTYPE_DDB_HANDLE)
299 #define ACPI_BTYPE_DEVICE_OBJECTS       (ACPI_BTYPE_DEVICE | ACPI_BTYPE_THERMAL | ACPI_BTYPE_PROCESSOR)
300 #define ACPI_BTYPE_OBJECTS_AND_REFS     0x0001FFFF	/* ARG or LOCAL */
301 #define ACPI_BTYPE_ALL_OBJECTS          0x0000FFFF
302 
303 /*
304  * Information structure for ACPI predefined names.
305  * Each entry in the table contains the following items:
306  *
307  * Name                 - The ACPI reserved name
308  * param_count          - Number of arguments to the method
309  * expected_return_btypes - Allowed type(s) for the return value
310  */
311 struct acpi_name_info {
312 	char name[ACPI_NAME_SIZE];
313 	u8 param_count;
314 	u8 expected_btypes;
315 };
316 
317 /*
318  * Secondary information structures for ACPI predefined objects that return
319  * package objects. This structure appears as the next entry in the table
320  * after the NAME_INFO structure above.
321  *
322  * The reason for this is to minimize the size of the predefined name table.
323  */
324 
325 /*
326  * Used for ACPI_PTYPE1_FIXED, ACPI_PTYPE1_VAR, ACPI_PTYPE2,
327  * ACPI_PTYPE2_MIN, ACPI_PTYPE2_PKG_COUNT, ACPI_PTYPE2_COUNT
328  */
329 struct acpi_package_info {
330 	u8 type;
331 	u8 object_type1;
332 	u8 count1;
333 	u8 object_type2;
334 	u8 count2;
335 	u8 reserved;
336 };
337 
338 /* Used for ACPI_PTYPE2_FIXED */
339 
340 struct acpi_package_info2 {
341 	u8 type;
342 	u8 count;
343 	u8 object_type[4];
344 };
345 
346 /* Used for ACPI_PTYPE1_OPTION */
347 
348 struct acpi_package_info3 {
349 	u8 type;
350 	u8 count;
351 	u8 object_type[2];
352 	u8 tail_object_type;
353 	u8 reserved;
354 };
355 
356 union acpi_predefined_info {
357 	struct acpi_name_info info;
358 	struct acpi_package_info ret_info;
359 	struct acpi_package_info2 ret_info2;
360 	struct acpi_package_info3 ret_info3;
361 };
362 
363 /*
364  * Bitmapped return value types
365  * Note: the actual data types must be contiguous, a loop in nspredef.c
366  * depends on this.
367  */
368 #define ACPI_RTYPE_ANY                  0x00
369 #define ACPI_RTYPE_NONE                 0x01
370 #define ACPI_RTYPE_INTEGER              0x02
371 #define ACPI_RTYPE_STRING               0x04
372 #define ACPI_RTYPE_BUFFER               0x08
373 #define ACPI_RTYPE_PACKAGE              0x10
374 #define ACPI_RTYPE_REFERENCE            0x20
375 #define ACPI_RTYPE_ALL                  0x3F
376 
377 #define ACPI_NUM_RTYPES                 5	/* Number of actual object types */
378 
379 /*****************************************************************************
380  *
381  * Event typedefs and structs
382  *
383  ****************************************************************************/
384 
385 /* Dispatch info for each GPE -- either a method or handler, cannot be both */
386 
387 struct acpi_handler_info {
388 	acpi_event_handler address;	/* Address of handler, if any */
389 	void *context;		/* Context to be passed to handler */
390 	struct acpi_namespace_node *method_node;	/* Method node for this GPE level (saved) */
391 };
392 
393 union acpi_gpe_dispatch_info {
394 	struct acpi_namespace_node *method_node;	/* Method node for this GPE level */
395 	struct acpi_handler_info *handler;
396 };
397 
398 /*
399  * Information about a GPE, one per each GPE in an array.
400  * NOTE: Important to keep this struct as small as possible.
401  */
402 struct acpi_gpe_event_info {
403 	union acpi_gpe_dispatch_info dispatch;	/* Either Method or Handler */
404 	struct acpi_gpe_register_info *register_info;	/* Backpointer to register info */
405 	u8 flags;		/* Misc info about this GPE */
406 	u8 gpe_number;		/* This GPE */
407 };
408 
409 /* Information about a GPE register pair, one per each status/enable pair in an array */
410 
411 struct acpi_gpe_register_info {
412 	struct acpi_generic_address status_address;	/* Address of status reg */
413 	struct acpi_generic_address enable_address;	/* Address of enable reg */
414 	u8 enable_for_wake;	/* GPEs to keep enabled when sleeping */
415 	u8 enable_for_run;	/* GPEs to keep enabled when running */
416 	u8 base_gpe_number;	/* Base GPE number for this register */
417 };
418 
419 /*
420  * Information about a GPE register block, one per each installed block --
421  * GPE0, GPE1, and one per each installed GPE Block Device.
422  */
423 struct acpi_gpe_block_info {
424 	struct acpi_namespace_node *node;
425 	struct acpi_gpe_block_info *previous;
426 	struct acpi_gpe_block_info *next;
427 	struct acpi_gpe_xrupt_info *xrupt_block;	/* Backpointer to interrupt block */
428 	struct acpi_gpe_register_info *register_info;	/* One per GPE register pair */
429 	struct acpi_gpe_event_info *event_info;	/* One for each GPE */
430 	struct acpi_generic_address block_address;	/* Base address of the block */
431 	u32 register_count;	/* Number of register pairs in block */
432 	u8 block_base_number;	/* Base GPE number for this block */
433 };
434 
435 /* Information about GPE interrupt handlers, one per each interrupt level used for GPEs */
436 
437 struct acpi_gpe_xrupt_info {
438 	struct acpi_gpe_xrupt_info *previous;
439 	struct acpi_gpe_xrupt_info *next;
440 	struct acpi_gpe_block_info *gpe_block_list_head;	/* List of GPE blocks for this xrupt */
441 	u32 interrupt_number;	/* System interrupt number */
442 };
443 
444 struct acpi_gpe_walk_info {
445 	struct acpi_namespace_node *gpe_device;
446 	struct acpi_gpe_block_info *gpe_block;
447 };
448 
449 struct acpi_gpe_device_info {
450 	u32 index;
451 	u32 next_block_base_index;
452 	acpi_status status;
453 	struct acpi_namespace_node *gpe_device;
454 };
455 
456 typedef acpi_status(*acpi_gpe_callback) (struct acpi_gpe_xrupt_info *gpe_xrupt_info,
457 		struct acpi_gpe_block_info *gpe_block, void *context);
458 
459 /* Information about each particular fixed event */
460 
461 struct acpi_fixed_event_handler {
462 	acpi_event_handler handler;	/* Address of handler. */
463 	void *context;		/* Context to be passed to handler */
464 };
465 
466 struct acpi_fixed_event_info {
467 	u8 status_register_id;
468 	u8 enable_register_id;
469 	u16 status_bit_mask;
470 	u16 enable_bit_mask;
471 };
472 
473 /* Information used during field processing */
474 
475 struct acpi_field_info {
476 	u8 skip_field;
477 	u8 field_flag;
478 	u32 pkg_length;
479 };
480 
481 /*****************************************************************************
482  *
483  * Generic "state" object for stacks
484  *
485  ****************************************************************************/
486 
487 #define ACPI_CONTROL_NORMAL                  0xC0
488 #define ACPI_CONTROL_CONDITIONAL_EXECUTING   0xC1
489 #define ACPI_CONTROL_PREDICATE_EXECUTING     0xC2
490 #define ACPI_CONTROL_PREDICATE_FALSE         0xC3
491 #define ACPI_CONTROL_PREDICATE_TRUE          0xC4
492 
493 #define ACPI_STATE_COMMON \
494 	void                            *next; \
495 	u8                              descriptor_type; /* To differentiate various internal objs */\
496 	u8                              flags; \
497 	u16                             value; \
498 	u16                             state;
499 
500 	/* There are 2 bytes available here until the next natural alignment boundary */
501 
502 struct acpi_common_state {
503 ACPI_STATE_COMMON};
504 
505 /*
506  * Update state - used to traverse complex objects such as packages
507  */
508 struct acpi_update_state {
509 	ACPI_STATE_COMMON union acpi_operand_object *object;
510 };
511 
512 /*
513  * Pkg state - used to traverse nested package structures
514  */
515 struct acpi_pkg_state {
516 	ACPI_STATE_COMMON u16 index;
517 	union acpi_operand_object *source_object;
518 	union acpi_operand_object *dest_object;
519 	struct acpi_walk_state *walk_state;
520 	void *this_target_obj;
521 	u32 num_packages;
522 };
523 
524 /*
525  * Control state - one per if/else and while constructs.
526  * Allows nesting of these constructs
527  */
528 struct acpi_control_state {
529 	ACPI_STATE_COMMON u16 opcode;
530 	union acpi_parse_object *predicate_op;
531 	u8 *aml_predicate_start;	/* Start of if/while predicate */
532 	u8 *package_end;	/* End of if/while block */
533 	u32 loop_count;		/* While() loop counter */
534 };
535 
536 /*
537  * Scope state - current scope during namespace lookups
538  */
539 struct acpi_scope_state {
540 	ACPI_STATE_COMMON struct acpi_namespace_node *node;
541 };
542 
543 struct acpi_pscope_state {
544 	ACPI_STATE_COMMON u32 arg_count;	/* Number of fixed arguments */
545 	union acpi_parse_object *op;	/* Current op being parsed */
546 	u8 *arg_end;		/* Current argument end */
547 	u8 *pkg_end;		/* Current package end */
548 	u32 arg_list;		/* Next argument to parse */
549 };
550 
551 /*
552  * Thread state - one per thread across multiple walk states.  Multiple walk
553  * states are created when there are nested control methods executing.
554  */
555 struct acpi_thread_state {
556 	ACPI_STATE_COMMON u8 current_sync_level;	/* Mutex Sync (nested acquire) level */
557 	struct acpi_walk_state *walk_state_list;	/* Head of list of walk_states for this thread */
558 	union acpi_operand_object *acquired_mutex_list;	/* List of all currently acquired mutexes */
559 	acpi_thread_id thread_id;	/* Running thread ID */
560 };
561 
562 /*
563  * Result values - used to accumulate the results of nested
564  * AML arguments
565  */
566 struct acpi_result_values {
567 	ACPI_STATE_COMMON
568 	    union acpi_operand_object *obj_desc[ACPI_RESULTS_FRAME_OBJ_NUM];
569 };
570 
571 typedef
572 acpi_status(*acpi_parse_downwards) (struct acpi_walk_state * walk_state,
573 				    union acpi_parse_object ** out_op);
574 
575 typedef acpi_status(*acpi_parse_upwards) (struct acpi_walk_state * walk_state);
576 
577 /*
578  * Notify info - used to pass info to the deferred notify
579  * handler/dispatcher.
580  */
581 struct acpi_notify_info {
582 	ACPI_STATE_COMMON struct acpi_namespace_node *node;
583 	union acpi_operand_object *handler_obj;
584 };
585 
586 /* Generic state is union of structs above */
587 
588 union acpi_generic_state {
589 	struct acpi_common_state common;
590 	struct acpi_control_state control;
591 	struct acpi_update_state update;
592 	struct acpi_scope_state scope;
593 	struct acpi_pscope_state parse_scope;
594 	struct acpi_pkg_state pkg;
595 	struct acpi_thread_state thread;
596 	struct acpi_result_values results;
597 	struct acpi_notify_info notify;
598 };
599 
600 /*****************************************************************************
601  *
602  * Interpreter typedefs and structs
603  *
604  ****************************************************************************/
605 
606 typedef acpi_status(*ACPI_EXECUTE_OP) (struct acpi_walk_state * walk_state);
607 
608 /*****************************************************************************
609  *
610  * Parser typedefs and structs
611  *
612  ****************************************************************************/
613 
614 /*
615  * AML opcode, name, and argument layout
616  */
617 struct acpi_opcode_info {
618 #if defined(ACPI_DISASSEMBLER) || defined(ACPI_DEBUG_OUTPUT)
619 	char *name;		/* Opcode name (disassembler/debug only) */
620 #endif
621 	u32 parse_args;		/* Grammar/Parse time arguments */
622 	u32 runtime_args;	/* Interpret time arguments */
623 	u16 flags;		/* Misc flags */
624 	u8 object_type;		/* Corresponding internal object type */
625 	u8 class;		/* Opcode class */
626 	u8 type;		/* Opcode type */
627 };
628 
629 union acpi_parse_value {
630 	acpi_integer integer;	/* Integer constant (Up to 64 bits) */
631 	struct uint64_struct integer64;	/* Structure overlay for 2 32-bit Dwords */
632 	u32 size;		/* bytelist or field size */
633 	char *string;		/* NULL terminated string */
634 	u8 *buffer;		/* buffer or string */
635 	char *name;		/* NULL terminated string */
636 	union acpi_parse_object *arg;	/* arguments and contained ops */
637 };
638 
639 #ifdef ACPI_DISASSEMBLER
640 #define ACPI_DISASM_ONLY_MEMBERS(a)     a;
641 #else
642 #define ACPI_DISASM_ONLY_MEMBERS(a)
643 #endif
644 
645 #define ACPI_PARSE_COMMON \
646 	union acpi_parse_object         *parent;        /* Parent op */\
647 	u8                              descriptor_type; /* To differentiate various internal objs */\
648 	u8                              flags;          /* Type of Op */\
649 	u16                             aml_opcode;     /* AML opcode */\
650 	u32                             aml_offset;     /* Offset of declaration in AML */\
651 	union acpi_parse_object         *next;          /* Next op */\
652 	struct acpi_namespace_node      *node;          /* For use by interpreter */\
653 	union acpi_parse_value          value;          /* Value or args associated with the opcode */\
654 	u8                              arg_list_length; /* Number of elements in the arg list */\
655 	ACPI_DISASM_ONLY_MEMBERS (\
656 	u8                              disasm_flags;   /* Used during AML disassembly */\
657 	u8                              disasm_opcode;  /* Subtype used for disassembly */\
658 	char                            aml_op_name[16])	/* Op name (debug only) */
659 
660 #define ACPI_DASM_BUFFER                0x00
661 #define ACPI_DASM_RESOURCE              0x01
662 #define ACPI_DASM_STRING                0x02
663 #define ACPI_DASM_UNICODE               0x03
664 #define ACPI_DASM_EISAID                0x04
665 #define ACPI_DASM_MATCHOP               0x05
666 #define ACPI_DASM_LNOT_PREFIX           0x06
667 #define ACPI_DASM_LNOT_SUFFIX           0x07
668 #define ACPI_DASM_IGNORE                0x08
669 
670 /*
671  * Generic operation (for example:  If, While, Store)
672  */
673 struct acpi_parse_obj_common {
674 ACPI_PARSE_COMMON};
675 
676 /*
677  * Extended Op for named ops (Scope, Method, etc.), deferred ops (Methods and op_regions),
678  * and bytelists.
679  */
680 struct acpi_parse_obj_named {
681 	ACPI_PARSE_COMMON u8 *path;
682 	u8 *data;		/* AML body or bytelist data */
683 	u32 length;		/* AML length */
684 	u32 name;		/* 4-byte name or zero if no name */
685 };
686 
687 /* This version is used by the i_aSL compiler only */
688 
689 #define ACPI_MAX_PARSEOP_NAME   20
690 
691 struct acpi_parse_obj_asl {
692 	ACPI_PARSE_COMMON union acpi_parse_object *child;
693 	union acpi_parse_object *parent_method;
694 	char *filename;
695 	char *external_name;
696 	char *namepath;
697 	char name_seg[4];
698 	u32 extra_value;
699 	u32 column;
700 	u32 line_number;
701 	u32 logical_line_number;
702 	u32 logical_byte_offset;
703 	u32 end_line;
704 	u32 end_logical_line;
705 	u32 acpi_btype;
706 	u32 aml_length;
707 	u32 aml_subtree_length;
708 	u32 final_aml_length;
709 	u32 final_aml_offset;
710 	u32 compile_flags;
711 	u16 parse_opcode;
712 	u8 aml_opcode_length;
713 	u8 aml_pkg_len_bytes;
714 	u8 extra;
715 	char parse_op_name[ACPI_MAX_PARSEOP_NAME];
716 };
717 
718 union acpi_parse_object {
719 	struct acpi_parse_obj_common common;
720 	struct acpi_parse_obj_named named;
721 	struct acpi_parse_obj_asl asl;
722 };
723 
724 /*
725  * Parse state - one state per parser invocation and each control
726  * method.
727  */
728 struct acpi_parse_state {
729 	u8 *aml_start;		/* First AML byte */
730 	u8 *aml;		/* Next AML byte */
731 	u8 *aml_end;		/* (last + 1) AML byte */
732 	u8 *pkg_start;		/* Current package begin */
733 	u8 *pkg_end;		/* Current package end */
734 	union acpi_parse_object *start_op;	/* Root of parse tree */
735 	struct acpi_namespace_node *start_node;
736 	union acpi_generic_state *scope;	/* Current scope */
737 	union acpi_parse_object *start_scope;
738 	u32 aml_size;
739 };
740 
741 /* Parse object flags */
742 
743 #define ACPI_PARSEOP_GENERIC            0x01
744 #define ACPI_PARSEOP_NAMED              0x02
745 #define ACPI_PARSEOP_DEFERRED           0x04
746 #define ACPI_PARSEOP_BYTELIST           0x08
747 #define ACPI_PARSEOP_IN_STACK           0x10
748 #define ACPI_PARSEOP_TARGET             0x20
749 #define ACPI_PARSEOP_IN_CACHE           0x80
750 
751 /* Parse object disasm_flags */
752 
753 #define ACPI_PARSEOP_IGNORE             0x01
754 #define ACPI_PARSEOP_PARAMLIST          0x02
755 #define ACPI_PARSEOP_EMPTY_TERMLIST     0x04
756 #define ACPI_PARSEOP_SPECIAL            0x10
757 
758 /*****************************************************************************
759  *
760  * Hardware (ACPI registers) and PNP
761  *
762  ****************************************************************************/
763 
764 struct acpi_bit_register_info {
765 	u8 parent_register;
766 	u8 bit_position;
767 	u16 access_bit_mask;
768 };
769 
770 /*
771  * Some ACPI registers have bits that must be ignored -- meaning that they
772  * must be preserved.
773  */
774 #define ACPI_PM1_STATUS_PRESERVED_BITS          0x0800	/* Bit 11 */
775 #define ACPI_PM1_CONTROL_PRESERVED_BITS         0x0200	/* Bit 9 (whatever) */
776 
777 /*
778  * Register IDs
779  * These are the full ACPI registers
780  */
781 #define ACPI_REGISTER_PM1_STATUS                0x01
782 #define ACPI_REGISTER_PM1_ENABLE                0x02
783 #define ACPI_REGISTER_PM1_CONTROL               0x03
784 #define ACPI_REGISTER_PM1A_CONTROL              0x04
785 #define ACPI_REGISTER_PM1B_CONTROL              0x05
786 #define ACPI_REGISTER_PM2_CONTROL               0x06
787 #define ACPI_REGISTER_PM_TIMER                  0x07
788 #define ACPI_REGISTER_PROCESSOR_BLOCK           0x08
789 #define ACPI_REGISTER_SMI_COMMAND_BLOCK         0x09
790 
791 /* Masks used to access the bit_registers */
792 
793 #define ACPI_BITMASK_TIMER_STATUS               0x0001
794 #define ACPI_BITMASK_BUS_MASTER_STATUS          0x0010
795 #define ACPI_BITMASK_GLOBAL_LOCK_STATUS         0x0020
796 #define ACPI_BITMASK_POWER_BUTTON_STATUS        0x0100
797 #define ACPI_BITMASK_SLEEP_BUTTON_STATUS        0x0200
798 #define ACPI_BITMASK_RT_CLOCK_STATUS            0x0400
799 #define ACPI_BITMASK_PCIEXP_WAKE_STATUS         0x4000	/* ACPI 3.0 */
800 #define ACPI_BITMASK_WAKE_STATUS                0x8000
801 
802 #define ACPI_BITMASK_ALL_FIXED_STATUS           (\
803 	ACPI_BITMASK_TIMER_STATUS          | \
804 	ACPI_BITMASK_BUS_MASTER_STATUS     | \
805 	ACPI_BITMASK_GLOBAL_LOCK_STATUS    | \
806 	ACPI_BITMASK_POWER_BUTTON_STATUS   | \
807 	ACPI_BITMASK_SLEEP_BUTTON_STATUS   | \
808 	ACPI_BITMASK_RT_CLOCK_STATUS       | \
809 	ACPI_BITMASK_WAKE_STATUS)
810 
811 #define ACPI_BITMASK_TIMER_ENABLE               0x0001
812 #define ACPI_BITMASK_GLOBAL_LOCK_ENABLE         0x0020
813 #define ACPI_BITMASK_POWER_BUTTON_ENABLE        0x0100
814 #define ACPI_BITMASK_SLEEP_BUTTON_ENABLE        0x0200
815 #define ACPI_BITMASK_RT_CLOCK_ENABLE            0x0400
816 #define ACPI_BITMASK_PCIEXP_WAKE_DISABLE        0x4000	/* ACPI 3.0 */
817 
818 #define ACPI_BITMASK_SCI_ENABLE                 0x0001
819 #define ACPI_BITMASK_BUS_MASTER_RLD             0x0002
820 #define ACPI_BITMASK_GLOBAL_LOCK_RELEASE        0x0004
821 #define ACPI_BITMASK_SLEEP_TYPE_X               0x1C00
822 #define ACPI_BITMASK_SLEEP_ENABLE               0x2000
823 
824 #define ACPI_BITMASK_ARB_DISABLE                0x0001
825 
826 /* Raw bit position of each bit_register */
827 
828 #define ACPI_BITPOSITION_TIMER_STATUS           0x00
829 #define ACPI_BITPOSITION_BUS_MASTER_STATUS      0x04
830 #define ACPI_BITPOSITION_GLOBAL_LOCK_STATUS     0x05
831 #define ACPI_BITPOSITION_POWER_BUTTON_STATUS    0x08
832 #define ACPI_BITPOSITION_SLEEP_BUTTON_STATUS    0x09
833 #define ACPI_BITPOSITION_RT_CLOCK_STATUS        0x0A
834 #define ACPI_BITPOSITION_PCIEXP_WAKE_STATUS     0x0E	/* ACPI 3.0 */
835 #define ACPI_BITPOSITION_WAKE_STATUS            0x0F
836 
837 #define ACPI_BITPOSITION_TIMER_ENABLE           0x00
838 #define ACPI_BITPOSITION_GLOBAL_LOCK_ENABLE     0x05
839 #define ACPI_BITPOSITION_POWER_BUTTON_ENABLE    0x08
840 #define ACPI_BITPOSITION_SLEEP_BUTTON_ENABLE    0x09
841 #define ACPI_BITPOSITION_RT_CLOCK_ENABLE        0x0A
842 #define ACPI_BITPOSITION_PCIEXP_WAKE_DISABLE    0x0E	/* ACPI 3.0 */
843 
844 #define ACPI_BITPOSITION_SCI_ENABLE             0x00
845 #define ACPI_BITPOSITION_BUS_MASTER_RLD         0x01
846 #define ACPI_BITPOSITION_GLOBAL_LOCK_RELEASE    0x02
847 #define ACPI_BITPOSITION_SLEEP_TYPE_X           0x0A
848 #define ACPI_BITPOSITION_SLEEP_ENABLE           0x0D
849 
850 #define ACPI_BITPOSITION_ARB_DISABLE            0x00
851 
852 /*****************************************************************************
853  *
854  * Resource descriptors
855  *
856  ****************************************************************************/
857 
858 /* resource_type values */
859 
860 #define ACPI_ADDRESS_TYPE_MEMORY_RANGE          0
861 #define ACPI_ADDRESS_TYPE_IO_RANGE              1
862 #define ACPI_ADDRESS_TYPE_BUS_NUMBER_RANGE      2
863 
864 /* Resource descriptor types and masks */
865 
866 #define ACPI_RESOURCE_NAME_LARGE                0x80
867 #define ACPI_RESOURCE_NAME_SMALL                0x00
868 
869 #define ACPI_RESOURCE_NAME_SMALL_MASK           0x78	/* Bits 6:3 contain the type */
870 #define ACPI_RESOURCE_NAME_SMALL_LENGTH_MASK    0x07	/* Bits 2:0 contain the length */
871 #define ACPI_RESOURCE_NAME_LARGE_MASK           0x7F	/* Bits 6:0 contain the type */
872 
873 /*
874  * Small resource descriptor "names" as defined by the ACPI specification.
875  * Note: Bits 2:0 are used for the descriptor length
876  */
877 #define ACPI_RESOURCE_NAME_IRQ                  0x20
878 #define ACPI_RESOURCE_NAME_DMA                  0x28
879 #define ACPI_RESOURCE_NAME_START_DEPENDENT      0x30
880 #define ACPI_RESOURCE_NAME_END_DEPENDENT        0x38
881 #define ACPI_RESOURCE_NAME_IO                   0x40
882 #define ACPI_RESOURCE_NAME_FIXED_IO             0x48
883 #define ACPI_RESOURCE_NAME_RESERVED_S1          0x50
884 #define ACPI_RESOURCE_NAME_RESERVED_S2          0x58
885 #define ACPI_RESOURCE_NAME_RESERVED_S3          0x60
886 #define ACPI_RESOURCE_NAME_RESERVED_S4          0x68
887 #define ACPI_RESOURCE_NAME_VENDOR_SMALL         0x70
888 #define ACPI_RESOURCE_NAME_END_TAG              0x78
889 
890 /*
891  * Large resource descriptor "names" as defined by the ACPI specification.
892  * Note: includes the Large Descriptor bit in bit[7]
893  */
894 #define ACPI_RESOURCE_NAME_MEMORY24             0x81
895 #define ACPI_RESOURCE_NAME_GENERIC_REGISTER     0x82
896 #define ACPI_RESOURCE_NAME_RESERVED_L1          0x83
897 #define ACPI_RESOURCE_NAME_VENDOR_LARGE         0x84
898 #define ACPI_RESOURCE_NAME_MEMORY32             0x85
899 #define ACPI_RESOURCE_NAME_FIXED_MEMORY32       0x86
900 #define ACPI_RESOURCE_NAME_ADDRESS32            0x87
901 #define ACPI_RESOURCE_NAME_ADDRESS16            0x88
902 #define ACPI_RESOURCE_NAME_EXTENDED_IRQ         0x89
903 #define ACPI_RESOURCE_NAME_ADDRESS64            0x8A
904 #define ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64   0x8B
905 #define ACPI_RESOURCE_NAME_LARGE_MAX            0x8B
906 
907 /*****************************************************************************
908  *
909  * Miscellaneous
910  *
911  ****************************************************************************/
912 
913 #define ACPI_ASCII_ZERO                 0x30
914 
915 /*****************************************************************************
916  *
917  * Debugger
918  *
919  ****************************************************************************/
920 
921 struct acpi_db_method_info {
922 	acpi_handle main_thread_gate;
923 	acpi_handle thread_complete_gate;
924 	u32 *threads;
925 	u32 num_threads;
926 	u32 num_created;
927 	u32 num_completed;
928 
929 	char *name;
930 	u32 flags;
931 	u32 num_loops;
932 	char pathname[128];
933 	char **args;
934 
935 	/*
936 	 * Arguments to be passed to method for the command
937 	 * Threads -
938 	 *   the Number of threads, ID of current thread and
939 	 *   Index of current thread inside all them created.
940 	 */
941 	char init_args;
942 	char *arguments[4];
943 	char num_threads_str[11];
944 	char id_of_thread_str[11];
945 	char index_of_thread_str[11];
946 };
947 
948 struct acpi_integrity_info {
949 	u32 nodes;
950 	u32 objects;
951 };
952 
953 #define ACPI_DB_REDIRECTABLE_OUTPUT     0x01
954 #define ACPI_DB_CONSOLE_OUTPUT          0x02
955 #define ACPI_DB_DUPLICATE_OUTPUT        0x03
956 
957 /*****************************************************************************
958  *
959  * Debug
960  *
961  ****************************************************************************/
962 
963 /* Entry for a memory allocation (debug only) */
964 
965 #define ACPI_MEM_MALLOC                 0
966 #define ACPI_MEM_CALLOC                 1
967 #define ACPI_MAX_MODULE_NAME            16
968 
969 #define ACPI_COMMON_DEBUG_MEM_HEADER \
970 	struct acpi_debug_mem_block     *previous; \
971 	struct acpi_debug_mem_block     *next; \
972 	u32                             size; \
973 	u32                             component; \
974 	u32                             line; \
975 	char                            module[ACPI_MAX_MODULE_NAME]; \
976 	u8                              alloc_type;
977 
978 struct acpi_debug_mem_header {
979 ACPI_COMMON_DEBUG_MEM_HEADER};
980 
981 struct acpi_debug_mem_block {
982 	ACPI_COMMON_DEBUG_MEM_HEADER u64 user_space;
983 };
984 
985 #define ACPI_MEM_LIST_GLOBAL            0
986 #define ACPI_MEM_LIST_NSNODE            1
987 #define ACPI_MEM_LIST_MAX               1
988 #define ACPI_NUM_MEM_LISTS              2
989 
990 #endif				/* __ACLOCAL_H__ */
991