1 /******************************************************************************
3 * Name: aclocal.h - Internal data types used across the ACPI subsystem
5 *****************************************************************************/
8 * Copyright (C) 2000 - 2008, Intel Corp.
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
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.
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.
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.
47 /* acpisrc:struct_defs -- for acpisrc conversion */
49 #define ACPI_SERIALIZED 0xFF
51 typedef u32 acpi_mutex_handle;
52 #define ACPI_GLOBAL_LOCK (acpi_semaphore) (-1)
54 /* Total number of aml opcodes defined */
56 #define AML_NUM_OPCODES 0x7F
58 /* Forward declarations */
60 struct acpi_walk_state;
61 struct acpi_obj_mutex;
62 union acpi_parse_object;
64 /*****************************************************************************
66 * Mutex typedefs and structs
68 ****************************************************************************/
71 * Predefined handles for the mutex objects used within the subsystem
72 * All mutex objects are automatically created by acpi_ut_mutex_initialize.
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.
77 * NOTE: any changes here must be reflected in the acpi_gbl_mutex_names
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 */
89 #define ACPI_MAX_MUTEX 7
90 #define ACPI_NUM_MUTEX ACPI_MAX_MUTEX+1
92 #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
93 #ifdef DEFINE_ACPI_GLOBALS
95 /* Debug names for the mutexes above */
97 static char *acpi_gbl_mutex_names[ACPI_NUM_MUTEX] = {
98 "ACPI_MTX_Interpreter",
104 "ACPI_MTX_CommandComplete",
105 "ACPI_MTX_CommandReady"
112 * Predefined handles for spinlocks used within the subsystem.
113 * These spinlocks are created by acpi_ut_mutex_initialize
115 #define ACPI_LOCK_GPES 0
116 #define ACPI_LOCK_HARDWARE 1
118 #define ACPI_MAX_LOCK 1
119 #define ACPI_NUM_LOCK ACPI_MAX_LOCK+1
121 /* This Thread ID means that the mutex is not in use (unlocked) */
123 #define ACPI_MUTEX_NOT_ACQUIRED (acpi_thread_id) 0
125 /* Table for the global mutexes */
127 struct acpi_mutex_info {
130 acpi_thread_id thread_id;
133 /* Lock flag parameter for various interfaces */
135 #define ACPI_MTX_DO_NOT_LOCK 0
136 #define ACPI_MTX_LOCK 1
138 /* Field access granularities */
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
145 #define ACPI_ENTRY_NOT_FOUND NULL
147 /*****************************************************************************
149 * Namespace typedefs and structs
151 ****************************************************************************/
153 /* Operational modes of the AML interpreter/scanner */
156 ACPI_IMODE_LOAD_PASS1 = 0x01,
157 ACPI_IMODE_LOAD_PASS2 = 0x02,
158 ACPI_IMODE_EXECUTE = 0x03
159 } acpi_interpreter_mode;
162 * The Namespace Node describes a named object that appears in the AML.
163 * descriptor_type is used to differentiate between internal descriptors.
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.
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
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 */
183 * The following fields are used by the ASL compiler and disassembler only
185 #ifdef ACPI_LARGE_NAMESPACE_NODE
186 union acpi_parse_object *op;
192 /* Namespace Node flags */
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 */
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 */
207 /* One internal RSDT for table management */
209 struct acpi_internal_rsdt {
210 struct acpi_table_desc *tables;
216 /* Flags for above */
218 #define ACPI_ROOT_ORIGIN_UNKNOWN (0) /* ~ORIGIN_ALLOCATED */
219 #define ACPI_ROOT_ORIGIN_ALLOCATED (1)
220 #define ACPI_ROOT_ALLOW_RESIZE (2)
222 /* Predefined (fixed) table indexes */
224 #define ACPI_TABLE_INDEX_DSDT (0)
225 #define ACPI_TABLE_INDEX_FACS (1)
227 struct acpi_find_context {
233 struct acpi_ns_search_data {
234 struct acpi_namespace_node *node;
237 /* Object types used during package copies */
239 #define ACPI_COPY_TYPE_SIMPLE 0
240 #define ACPI_COPY_TYPE_PACKAGE 1
242 /* Info structure used to convert external<->internal namestrings */
244 struct acpi_namestring_info {
245 const char *external_name;
246 const char *next_external_char;
254 /* Field creation info */
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;
262 u32 field_bit_position;
263 u32 field_bit_length;
270 acpi_status(*ACPI_INTERNAL_METHOD) (struct acpi_walk_state * walk_state);
273 * Bitmapped ACPI types. Used internally only
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
295 #define ACPI_BTYPE_COMPUTE_DATA (ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING | ACPI_BTYPE_BUFFER)
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
304 * Information structure for ACPI predefined names.
305 * Each entry in the table contains the following items:
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
311 struct acpi_name_info {
312 char name[ACPI_NAME_SIZE];
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.
322 * The reason for this is to minimize the size of the predefined name table.
326 * Used for ACPI_PTYPE1_FIXED, ACPI_PTYPE1_VAR, ACPI_PTYPE2,
327 * ACPI_PTYPE2_MIN, ACPI_PTYPE2_PKG_COUNT, ACPI_PTYPE2_COUNT
329 struct acpi_package_info {
338 /* Used for ACPI_PTYPE2_FIXED */
340 struct acpi_package_info2 {
346 /* Used for ACPI_PTYPE1_OPTION */
348 struct acpi_package_info3 {
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;
364 * Bitmapped return value types
365 * Note: the actual data types must be contiguous, a loop in nspredef.c
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
377 #define ACPI_NUM_RTYPES 5 /* Number of actual object types */
379 /*****************************************************************************
381 * Event typedefs and structs
383 ****************************************************************************/
385 /* Dispatch info for each GPE -- either a method or handler, cannot be both */
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) */
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;
399 * Information about a GPE, one per each GPE in an array.
400 * NOTE: Important to keep this struct as small as possible.
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 */
409 /* Information about a GPE register pair, one per each status/enable pair in an array */
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 */
420 * Information about a GPE register block, one per each installed block --
421 * GPE0, GPE1, and one per each installed GPE Block Device.
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 */
435 /* Information about GPE interrupt handlers, one per each interrupt level used for GPEs */
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 */
444 struct acpi_gpe_walk_info {
445 struct acpi_namespace_node *gpe_device;
446 struct acpi_gpe_block_info *gpe_block;
449 struct acpi_gpe_device_info {
451 u32 next_block_base_index;
453 struct acpi_namespace_node *gpe_device;
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);
459 /* Information about each particular fixed event */
461 struct acpi_fixed_event_handler {
462 acpi_event_handler handler; /* Address of handler. */
463 void *context; /* Context to be passed to handler */
466 struct acpi_fixed_event_info {
467 u8 status_register_id;
468 u8 enable_register_id;
473 /* Information used during field processing */
475 struct acpi_field_info {
481 /*****************************************************************************
483 * Generic "state" object for stacks
485 ****************************************************************************/
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
493 #define ACPI_STATE_COMMON \
495 u8 descriptor_type; /* To differentiate various internal objs */\
500 /* There are 2 bytes available here until the next natural alignment boundary */
502 struct acpi_common_state {
506 * Update state - used to traverse complex objects such as packages
508 struct acpi_update_state {
509 ACPI_STATE_COMMON union acpi_operand_object *object;
513 * Pkg state - used to traverse nested package structures
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;
525 * Control state - one per if/else and while constructs.
526 * Allows nesting of these constructs
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 */
537 * Scope state - current scope during namespace lookups
539 struct acpi_scope_state {
540 ACPI_STATE_COMMON struct acpi_namespace_node *node;
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 */
552 * Thread state - one per thread across multiple walk states. Multiple walk
553 * states are created when there are nested control methods executing.
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 */
563 * Result values - used to accumulate the results of nested
566 struct acpi_result_values {
568 union acpi_operand_object *obj_desc[ACPI_RESULTS_FRAME_OBJ_NUM];
572 acpi_status(*acpi_parse_downwards) (struct acpi_walk_state * walk_state,
573 union acpi_parse_object ** out_op);
575 typedef acpi_status(*acpi_parse_upwards) (struct acpi_walk_state * walk_state);
578 * Notify info - used to pass info to the deferred notify
579 * handler/dispatcher.
581 struct acpi_notify_info {
582 ACPI_STATE_COMMON struct acpi_namespace_node *node;
583 union acpi_operand_object *handler_obj;
586 /* Generic state is union of structs above */
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;
600 /*****************************************************************************
602 * Interpreter typedefs and structs
604 ****************************************************************************/
606 typedef acpi_status(*ACPI_EXECUTE_OP) (struct acpi_walk_state * walk_state);
608 /*****************************************************************************
610 * Parser typedefs and structs
612 ****************************************************************************/
615 * AML opcode, name, and argument layout
617 struct acpi_opcode_info {
618 #if defined(ACPI_DISASSEMBLER) || defined(ACPI_DEBUG_OUTPUT)
619 char *name; /* Opcode name (disassembler/debug only) */
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 */
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 */
639 #ifdef ACPI_DISASSEMBLER
640 #define ACPI_DISASM_ONLY_MEMBERS(a) a;
642 #define ACPI_DISASM_ONLY_MEMBERS(a)
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) */
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
671 * Generic operation (for example: If, While, Store)
673 struct acpi_parse_obj_common {
677 * Extended Op for named ops (Scope, Method, etc.), deferred ops (Methods and op_regions),
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 */
687 /* This version is used by the i_aSL compiler only */
689 #define ACPI_MAX_PARSEOP_NAME 20
691 struct acpi_parse_obj_asl {
692 ACPI_PARSE_COMMON union acpi_parse_object *child;
693 union acpi_parse_object *parent_method;
701 u32 logical_line_number;
702 u32 logical_byte_offset;
704 u32 end_logical_line;
707 u32 aml_subtree_length;
708 u32 final_aml_length;
709 u32 final_aml_offset;
712 u8 aml_opcode_length;
713 u8 aml_pkg_len_bytes;
715 char parse_op_name[ACPI_MAX_PARSEOP_NAME];
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;
725 * Parse state - one state per parser invocation and each control
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;
741 /* Parse object flags */
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
751 /* Parse object disasm_flags */
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
758 /*****************************************************************************
760 * Hardware (ACPI registers) and PNP
762 ****************************************************************************/
764 struct acpi_bit_register_info {
771 * Some ACPI registers have bits that must be ignored -- meaning that they
774 #define ACPI_PM1_STATUS_PRESERVED_BITS 0x0800 /* Bit 11 */
775 #define ACPI_PM1_CONTROL_PRESERVED_BITS 0x0200 /* Bit 9 (whatever) */
779 * These are the full ACPI registers
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
791 /* Masks used to access the bit_registers */
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
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)
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 */
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
824 #define ACPI_BITMASK_ARB_DISABLE 0x0001
826 /* Raw bit position of each bit_register */
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
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 */
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
850 #define ACPI_BITPOSITION_ARB_DISABLE 0x00
852 /*****************************************************************************
854 * Resource descriptors
856 ****************************************************************************/
858 /* resource_type values */
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
864 /* Resource descriptor types and masks */
866 #define ACPI_RESOURCE_NAME_LARGE 0x80
867 #define ACPI_RESOURCE_NAME_SMALL 0x00
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 */
874 * Small resource descriptor "names" as defined by the ACPI specification.
875 * Note: Bits 2:0 are used for the descriptor length
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
891 * Large resource descriptor "names" as defined by the ACPI specification.
892 * Note: includes the Large Descriptor bit in bit[7]
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
907 /*****************************************************************************
911 ****************************************************************************/
913 #define ACPI_ASCII_ZERO 0x30
915 /*****************************************************************************
919 ****************************************************************************/
921 struct acpi_db_method_info {
922 acpi_handle main_thread_gate;
923 acpi_handle thread_complete_gate;
936 * Arguments to be passed to method for the command
938 * the Number of threads, ID of current thread and
939 * Index of current thread inside all them created.
943 char num_threads_str[11];
944 char id_of_thread_str[11];
945 char index_of_thread_str[11];
948 struct acpi_integrity_info {
953 #define ACPI_DB_REDIRECTABLE_OUTPUT 0x01
954 #define ACPI_DB_CONSOLE_OUTPUT 0x02
955 #define ACPI_DB_DUPLICATE_OUTPUT 0x03
957 /*****************************************************************************
961 ****************************************************************************/
963 /* Entry for a memory allocation (debug only) */
965 #define ACPI_MEM_MALLOC 0
966 #define ACPI_MEM_CALLOC 1
967 #define ACPI_MAX_MODULE_NAME 16
969 #define ACPI_COMMON_DEBUG_MEM_HEADER \
970 struct acpi_debug_mem_block *previous; \
971 struct acpi_debug_mem_block *next; \
975 char module[ACPI_MAX_MODULE_NAME]; \
978 struct acpi_debug_mem_header {
979 ACPI_COMMON_DEBUG_MEM_HEADER};
981 struct acpi_debug_mem_block {
982 ACPI_COMMON_DEBUG_MEM_HEADER u64 user_space;
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
990 #endif /* __ACLOCAL_H__ */