ACPICA: Restructure includes into public/private
[deliverable/linux.git] / include / acpi / aclocal.h
CommitLineData
1da177e4
LT
1/******************************************************************************
2 *
3 * Name: aclocal.h - Internal data types used across the ACPI subsystem
4 *
5 *****************************************************************************/
6
7/*
75a44ce0 8 * Copyright (C) 2000 - 2008, Intel Corp.
1da177e4
LT
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
61686124
BM
47/* acpisrc:struct_defs -- for acpisrc conversion */
48
967440e3 49#define ACPI_SERIALIZED 0xFF
1da177e4 50
4be44fcd 51typedef u32 acpi_mutex_handle;
f3d2e786 52#define ACPI_GLOBAL_LOCK (acpi_semaphore) (-1)
1da177e4
LT
53
54/* Total number of aml opcodes defined */
55
56#define AML_NUM_OPCODES 0x7F
57
f9f4601f
RM
58/* Forward declarations */
59
4be44fcd 60struct acpi_walk_state;
f9f4601f 61struct acpi_obj_mutex;
4be44fcd 62union acpi_parse_object;
f9f4601f 63
1da177e4
LT
64/*****************************************************************************
65 *
66 * Mutex typedefs and structs
67 *
68 ****************************************************************************/
69
1da177e4
LT
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 *
4c90ece2 74 * The acquire/release ordering protocol is implied via this list. Mutexes
1da177e4
LT
75 * with a lower value must be acquired before mutexes with a higher value.
76 *
4c90ece2
BM
77 * NOTE: any changes here must be reflected in the acpi_gbl_mutex_names
78 * table below also!
1da177e4 79 */
4c90ece2 80#define ACPI_MTX_INTERPRETER 0 /* AML Interpreter, main lock */
f3d2e786
BM
81#define ACPI_MTX_NAMESPACE 1 /* ACPI Namespace */
82#define ACPI_MTX_TABLES 2 /* Data for ACPI tables */
967440e3
BM
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
4c90ece2 90#define ACPI_NUM_MUTEX ACPI_MAX_MUTEX+1
1da177e4 91
1da177e4
LT
92#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
93#ifdef DEFINE_ACPI_GLOBALS
94
4c90ece2 95/* Debug names for the mutexes above */
1da177e4 96
4c90ece2 97static char *acpi_gbl_mutex_names[ACPI_NUM_MUTEX] = {
1da177e4 98 "ACPI_MTX_Interpreter",
1da177e4 99 "ACPI_MTX_Namespace",
47c00d2b 100 "ACPI_MTX_Tables",
1da177e4 101 "ACPI_MTX_Events",
1da177e4
LT
102 "ACPI_MTX_Caches",
103 "ACPI_MTX_Memory",
967440e3
BM
104 "ACPI_MTX_CommandComplete",
105 "ACPI_MTX_CommandReady"
1da177e4
LT
106};
107
108#endif
109#endif
110
4c90ece2
BM
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
f9f4601f
RM
121/* This Thread ID means that the mutex is not in use (unlocked) */
122
ab8aa06a 123#define ACPI_MUTEX_NOT_ACQUIRED (acpi_thread_id) 0
f9f4601f 124
1da177e4
LT
125/* Table for the global mutexes */
126
4be44fcd
LB
127struct acpi_mutex_info {
128 acpi_mutex mutex;
129 u32 use_count;
8313524a 130 acpi_thread_id thread_id;
1da177e4
LT
131};
132
1da177e4
LT
133/* Lock flag parameter for various interfaces */
134
135#define ACPI_MTX_DO_NOT_LOCK 0
136#define ACPI_MTX_LOCK 1
137
1da177e4
LT
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
61686124
BM
145#define ACPI_ENTRY_NOT_FOUND NULL
146
1da177e4
LT
147/*****************************************************************************
148 *
149 * Namespace typedefs and structs
150 *
151 ****************************************************************************/
152
1da177e4
LT
153/* Operational modes of the AML interpreter/scanner */
154
4be44fcd
LB
155typedef enum {
156 ACPI_IMODE_LOAD_PASS1 = 0x01,
157 ACPI_IMODE_LOAD_PASS2 = 0x02,
ec3153fb 158 ACPI_IMODE_EXECUTE = 0x03
1da177e4
LT
159} acpi_interpreter_mode;
160
61686124
BM
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.
793c2388
BM
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.
61686124 171 */
4be44fcd 172struct acpi_namespace_node {
61686124
BM
173 union acpi_operand_object *object; /* Interpreter object */
174 u8 descriptor_type; /* Differentiate object descriptor types */
793c2388 175 u8 type; /* ACPI Type associated with this name */
61686124
BM
176 u8 flags; /* Miscellaneous flags */
177 acpi_owner_id owner_id; /* Node creator */
4be44fcd 178 union acpi_name_union name; /* ACPI Name, always 4 chars per ACPI spec */
4be44fcd 179 struct acpi_namespace_node *child; /* First child */
61686124 180 struct acpi_namespace_node *peer; /* Peer. Parent if ANOBJ_END_OF_PEER_LIST set */
f9f4601f 181
793c2388
BM
182 /*
183 * The following fields are used by the ASL compiler and disassembler only
184 */
8313524a 185#ifdef ACPI_LARGE_NAMESPACE_NODE
4be44fcd 186 union acpi_parse_object *op;
61686124 187 u32 value;
793c2388 188 u32 length;
f9f4601f 189#endif
1da177e4
LT
190};
191
61686124 192/* Namespace Node flags */
1da177e4 193
61686124 194#define ANOBJ_END_OF_PEER_LIST 0x01 /* End-of-list, Peer field points to parent */
d1fdda83 195#define ANOBJ_TEMPORARY 0x02 /* Node is create by a method and is temporary */
61686124
BM
196#define ANOBJ_METHOD_ARG 0x04 /* Node is a method argument */
197#define ANOBJ_METHOD_LOCAL 0x08 /* Node is a method local */
b229cf92 198#define ANOBJ_SUBTREE_HAS_INI 0x10 /* Used to optimize device initialization */
e8707b34 199#define ANOBJ_EVALUATED 0x20 /* Set on first evaluation of node */
b229cf92 200
958dd242
BM
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 */
1da177e4 206
c5fc42ac
BM
207/* One internal RSDT for table management */
208
f3d2e786
BM
209struct acpi_internal_rsdt {
210 struct acpi_table_desc *tables;
4be44fcd 211 u32 count;
f3d2e786
BM
212 u32 size;
213 u8 flags;
1da177e4
LT
214};
215
c5fc42ac 216/* Flags for above */
f3d2e786 217
c5fc42ac
BM
218#define ACPI_ROOT_ORIGIN_UNKNOWN (0) /* ~ORIGIN_ALLOCATED */
219#define ACPI_ROOT_ORIGIN_ALLOCATED (1)
220#define ACPI_ROOT_ALLOW_RESIZE (2)
f3d2e786
BM
221
222/* Predefined (fixed) table indexes */
223
224#define ACPI_TABLE_INDEX_DSDT (0)
225#define ACPI_TABLE_INDEX_FACS (1)
226
4be44fcd
LB
227struct acpi_find_context {
228 char *search_for;
229 acpi_handle *list;
230 u32 *count;
1da177e4
LT
231};
232
4be44fcd
LB
233struct acpi_ns_search_data {
234 struct acpi_namespace_node *node;
1da177e4
LT
235};
236
1da177e4
LT
237/* Object types used during package copies */
238
1da177e4
LT
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
4be44fcd 244struct acpi_namestring_info {
4b8ed631
BM
245 const char *external_name;
246 const char *next_external_char;
4be44fcd
LB
247 char *internal_name;
248 u32 length;
249 u32 num_segments;
250 u32 num_carats;
251 u8 fully_qualified;
1da177e4
LT
252};
253
1da177e4
LT
254/* Field creation info */
255
4be44fcd
LB
256struct 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;
1da177e4
LT
267};
268
61686124
BM
269typedef
270acpi_status(*ACPI_INTERNAL_METHOD) (struct acpi_walk_state * walk_state);
271
defba1d8
BM
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
e8707b34
BM
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 */
311struct 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 */
329struct 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
340struct acpi_package_info2 {
341 u8 type;
342 u8 count;
343 u8 object_type[4];
344};
345
346/* Used for ACPI_PTYPE1_OPTION */
347
348struct acpi_package_info3 {
349 u8 type;
350 u8 count;
351 u8 object_type[2];
352 u8 tail_object_type;
353 u8 reserved;
354};
355
356union 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
1da177e4
LT
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
4be44fcd
LB
387struct 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) */
1da177e4
LT
391};
392
4be44fcd
LB
393union acpi_gpe_dispatch_info {
394 struct acpi_namespace_node *method_node; /* Method node for this GPE level */
395 struct acpi_handler_info *handler;
1da177e4
LT
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 */
4be44fcd
LB
402struct 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 */
69874165 406 u8 gpe_number; /* This GPE */
1da177e4
LT
407};
408
409/* Information about a GPE register pair, one per each status/enable pair in an array */
410
4be44fcd
LB
411struct 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 */
1da177e4
LT
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 */
4be44fcd
LB
423struct 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 */
1da177e4
LT
433};
434
435/* Information about GPE interrupt handlers, one per each interrupt level used for GPEs */
436
4be44fcd
LB
437struct 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 */
1da177e4
LT
442};
443
4be44fcd
LB
444struct acpi_gpe_walk_info {
445 struct acpi_namespace_node *gpe_device;
446 struct acpi_gpe_block_info *gpe_block;
1da177e4
LT
447};
448
e97d6bf1
BM
449struct 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
456typedef acpi_status(*acpi_gpe_callback) (struct acpi_gpe_xrupt_info *gpe_xrupt_info,
457 struct acpi_gpe_block_info *gpe_block, void *context);
1da177e4
LT
458
459/* Information about each particular fixed event */
460
4be44fcd
LB
461struct acpi_fixed_event_handler {
462 acpi_event_handler handler; /* Address of handler. */
463 void *context; /* Context to be passed to handler */
1da177e4
LT
464};
465
4be44fcd
LB
466struct acpi_fixed_event_info {
467 u8 status_register_id;
468 u8 enable_register_id;
469 u16 status_bit_mask;
470 u16 enable_bit_mask;
1da177e4
LT
471};
472
473/* Information used during field processing */
474
4be44fcd
LB
475struct acpi_field_info {
476 u8 skip_field;
477 u8 field_flag;
478 u32 pkg_length;
1da177e4
LT
479};
480
1da177e4
LT
481/*****************************************************************************
482 *
483 * Generic "state" object for stacks
484 *
485 ****************************************************************************/
486
1da177e4
LT
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
61686124
BM
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 */
1da177e4 501
4be44fcd
LB
502struct acpi_common_state {
503ACPI_STATE_COMMON};
1da177e4
LT
504
505/*
506 * Update state - used to traverse complex objects such as packages
507 */
4be44fcd
LB
508struct acpi_update_state {
509 ACPI_STATE_COMMON union acpi_operand_object *object;
1da177e4
LT
510};
511
1da177e4
LT
512/*
513 * Pkg state - used to traverse nested package structures
514 */
4be44fcd 515struct acpi_pkg_state {
61686124
BM
516 ACPI_STATE_COMMON u16 index;
517 union acpi_operand_object *source_object;
4be44fcd
LB
518 union acpi_operand_object *dest_object;
519 struct acpi_walk_state *walk_state;
520 void *this_target_obj;
521 u32 num_packages;
1da177e4
LT
522};
523
1da177e4
LT
524/*
525 * Control state - one per if/else and while constructs.
526 * Allows nesting of these constructs
527 */
4be44fcd 528struct acpi_control_state {
61686124
BM
529 ACPI_STATE_COMMON u16 opcode;
530 union acpi_parse_object *predicate_op;
4be44fcd
LB
531 u8 *aml_predicate_start; /* Start of if/while predicate */
532 u8 *package_end; /* End of if/while block */
fc374457 533 u32 loop_count; /* While() loop counter */
1da177e4
LT
534};
535
1da177e4
LT
536/*
537 * Scope state - current scope during namespace lookups
538 */
4be44fcd
LB
539struct acpi_scope_state {
540 ACPI_STATE_COMMON struct acpi_namespace_node *node;
1da177e4
LT
541};
542
4be44fcd 543struct acpi_pscope_state {
793c2388 544 ACPI_STATE_COMMON u32 arg_count; /* Number of fixed arguments */
61686124 545 union acpi_parse_object *op; /* Current op being parsed */
4be44fcd
LB
546 u8 *arg_end; /* Current argument end */
547 u8 *pkg_end; /* Current package end */
548 u32 arg_list; /* Next argument to parse */
1da177e4
LT
549};
550
1da177e4
LT
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 */
4be44fcd 555struct acpi_thread_state {
61686124
BM
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 */
4be44fcd 558 union acpi_operand_object *acquired_mutex_list; /* List of all currently acquired mutexes */
8313524a 559 acpi_thread_id thread_id; /* Running thread ID */
1da177e4
LT
560};
561
1da177e4
LT
562/*
563 * Result values - used to accumulate the results of nested
564 * AML arguments
565 */
4be44fcd 566struct acpi_result_values {
773069d4
BM
567 ACPI_STATE_COMMON
568 union acpi_operand_object *obj_desc[ACPI_RESULTS_FRAME_OBJ_NUM];
1da177e4
LT
569};
570
1da177e4 571typedef
4be44fcd
LB
572acpi_status(*acpi_parse_downwards) (struct acpi_walk_state * walk_state,
573 union acpi_parse_object ** out_op);
1da177e4 574
4be44fcd 575typedef acpi_status(*acpi_parse_upwards) (struct acpi_walk_state * walk_state);
1da177e4
LT
576
577/*
578 * Notify info - used to pass info to the deferred notify
579 * handler/dispatcher.
580 */
4be44fcd
LB
581struct acpi_notify_info {
582 ACPI_STATE_COMMON struct acpi_namespace_node *node;
583 union acpi_operand_object *handler_obj;
1da177e4
LT
584};
585
1da177e4
LT
586/* Generic state is union of structs above */
587
4be44fcd
LB
588union 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;
1da177e4
LT
598};
599
1da177e4
LT
600/*****************************************************************************
601 *
602 * Interpreter typedefs and structs
603 *
604 ****************************************************************************/
605
4be44fcd 606typedef acpi_status(*ACPI_EXECUTE_OP) (struct acpi_walk_state * walk_state);
1da177e4
LT
607
608/*****************************************************************************
609 *
610 * Parser typedefs and structs
611 *
612 ****************************************************************************/
613
614/*
615 * AML opcode, name, and argument layout
616 */
4be44fcd 617struct acpi_opcode_info {
1da177e4 618#if defined(ACPI_DISASSEMBLER) || defined(ACPI_DEBUG_OUTPUT)
4be44fcd 619 char *name; /* Opcode name (disassembler/debug only) */
1da177e4 620#endif
4be44fcd
LB
621 u32 parse_args; /* Grammar/Parse time arguments */
622 u32 runtime_args; /* Interpret time arguments */
61686124 623 u16 flags; /* Misc flags */
4be44fcd
LB
624 u8 object_type; /* Corresponding internal object type */
625 u8 class; /* Opcode class */
626 u8 type; /* Opcode type */
1da177e4
LT
627};
628
4be44fcd
LB
629union 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 */
1da177e4
LT
637};
638
50df4d8b
BM
639#ifdef ACPI_DISASSEMBLER
640#define ACPI_DISASM_ONLY_MEMBERS(a) a;
641#else
642#define ACPI_DISASM_ONLY_MEMBERS(a)
643#endif
644
1da177e4 645#define ACPI_PARSE_COMMON \
61686124
BM
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 */\
4e3156b1 654 u8 arg_list_length; /* Number of elements in the arg list */\
1da177e4 655 ACPI_DISASM_ONLY_MEMBERS (\
61686124
BM
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
958dd242
BM
666#define ACPI_DASM_LNOT_PREFIX 0x06
667#define ACPI_DASM_LNOT_SUFFIX 0x07
668#define ACPI_DASM_IGNORE 0x08
1da177e4
LT
669
670/*
61686124 671 * Generic operation (for example: If, While, Store)
1da177e4 672 */
4be44fcd
LB
673struct acpi_parse_obj_common {
674ACPI_PARSE_COMMON};
1da177e4
LT
675
676/*
677 * Extended Op for named ops (Scope, Method, etc.), deferred ops (Methods and op_regions),
678 * and bytelists.
679 */
4be44fcd 680struct acpi_parse_obj_named {
fd350943 681 ACPI_PARSE_COMMON u8 *path;
4be44fcd
LB
682 u8 *data; /* AML body or bytelist data */
683 u32 length; /* AML length */
684 u32 name; /* 4-byte name or zero if no name */
1da177e4
LT
685};
686
958dd242 687/* This version is used by the i_aSL compiler only */
1da177e4 688
c51a4de8
BM
689#define ACPI_MAX_PARSEOP_NAME 20
690
4be44fcd
LB
691struct 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;
c51a4de8 715 char parse_op_name[ACPI_MAX_PARSEOP_NAME];
4be44fcd
LB
716};
717
718union acpi_parse_object {
719 struct acpi_parse_obj_common common;
720 struct acpi_parse_obj_named named;
721 struct acpi_parse_obj_asl asl;
1da177e4
LT
722};
723
1da177e4
LT
724/*
725 * Parse state - one state per parser invocation and each control
726 * method.
727 */
4be44fcd 728struct acpi_parse_state {
4be44fcd
LB
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;
61686124 738 u32 aml_size;
1da177e4
LT
739};
740
1da177e4
LT
741/* Parse object flags */
742
61686124
BM
743#define ACPI_PARSEOP_GENERIC 0x01
744#define ACPI_PARSEOP_NAMED 0x02
745#define ACPI_PARSEOP_DEFERRED 0x04
746#define ACPI_PARSEOP_BYTELIST 0x08
4e3156b1
BM
747#define ACPI_PARSEOP_IN_STACK 0x10
748#define ACPI_PARSEOP_TARGET 0x20
61686124 749#define ACPI_PARSEOP_IN_CACHE 0x80
1da177e4
LT
750
751/* Parse object disasm_flags */
752
61686124
BM
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
1da177e4 757
1da177e4
LT
758/*****************************************************************************
759 *
760 * Hardware (ACPI registers) and PNP
761 *
762 ****************************************************************************/
763
4be44fcd
LB
764struct acpi_bit_register_info {
765 u8 parent_register;
766 u8 bit_position;
767 u16 access_bit_mask;
1da177e4
LT
768};
769
967440e3
BM
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 */
53a5fbdc 775#define ACPI_PM1_CONTROL_PRESERVED_BITS 0x0200 /* Bit 9 (whatever) */
967440e3 776
1da177e4
LT
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
1da177e4
LT
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
4be44fcd 799#define ACPI_BITMASK_PCIEXP_WAKE_STATUS 0x4000 /* ACPI 3.0 */
1da177e4
LT
800#define ACPI_BITMASK_WAKE_STATUS 0x8000
801
61686124
BM
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)
1da177e4
LT
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
4be44fcd 816#define ACPI_BITMASK_PCIEXP_WAKE_DISABLE 0x4000 /* ACPI 3.0 */
1da177e4
LT
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
1da177e4
LT
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
4be44fcd 834#define ACPI_BITPOSITION_PCIEXP_WAKE_STATUS 0x0E /* ACPI 3.0 */
1da177e4
LT
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
4be44fcd 842#define ACPI_BITPOSITION_PCIEXP_WAKE_DISABLE 0x0E /* ACPI 3.0 */
1da177e4
LT
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
1da177e4
LT
852/*****************************************************************************
853 *
854 * Resource descriptors
855 *
856 ****************************************************************************/
857
1da177e4
LT
858/* resource_type values */
859
50eca3eb
BM
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
1da177e4
LT
863
864/* Resource descriptor types and masks */
865
50eca3eb
BM
866#define ACPI_RESOURCE_NAME_LARGE 0x80
867#define ACPI_RESOURCE_NAME_SMALL 0x00
1da177e4 868
50eca3eb
BM
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 */
1da177e4
LT
872
873/*
50eca3eb 874 * Small resource descriptor "names" as defined by the ACPI specification.
bda663d3 875 * Note: Bits 2:0 are used for the descriptor length
1da177e4 876 */
50eca3eb
BM
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
1da177e4
LT
889
890/*
50eca3eb
BM
891 * Large resource descriptor "names" as defined by the ACPI specification.
892 * Note: includes the Large Descriptor bit in bit[7]
1da177e4 893 */
50eca3eb
BM
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
1da177e4 906
1da177e4
LT
907/*****************************************************************************
908 *
909 * Miscellaneous
910 *
911 ****************************************************************************/
912
61686124 913#define ACPI_ASCII_ZERO 0x30
1da177e4 914
1da177e4
LT
915/*****************************************************************************
916 *
917 * Debugger
918 *
919 ****************************************************************************/
920
4be44fcd 921struct acpi_db_method_info {
2e23f851
BM
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
4be44fcd 929 char *name;
4be44fcd
LB
930 u32 flags;
931 u32 num_loops;
932 char pathname[128];
2e23f851
BM
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];
1da177e4
LT
946};
947
4be44fcd
LB
948struct acpi_integrity_info {
949 u32 nodes;
950 u32 objects;
1da177e4
LT
951};
952
61686124
BM
953#define ACPI_DB_REDIRECTABLE_OUTPUT 0x01
954#define ACPI_DB_CONSOLE_OUTPUT 0x02
955#define ACPI_DB_DUPLICATE_OUTPUT 0x03
1da177e4 956
1da177e4
LT
957/*****************************************************************************
958 *
959 * Debug
960 *
961 ****************************************************************************/
962
1da177e4
LT
963/* Entry for a memory allocation (debug only) */
964
61686124
BM
965#define ACPI_MEM_MALLOC 0
966#define ACPI_MEM_CALLOC 1
967#define ACPI_MAX_MODULE_NAME 16
1da177e4
LT
968
969#define ACPI_COMMON_DEBUG_MEM_HEADER \
61686124
BM
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;
1da177e4 977
4be44fcd
LB
978struct acpi_debug_mem_header {
979ACPI_COMMON_DEBUG_MEM_HEADER};
1da177e4 980
4be44fcd
LB
981struct acpi_debug_mem_block {
982 ACPI_COMMON_DEBUG_MEM_HEADER u64 user_space;
1da177e4
LT
983};
984
1da177e4
LT
985#define ACPI_MEM_LIST_GLOBAL 0
986#define ACPI_MEM_LIST_NSNODE 1
73459f73
RM
987#define ACPI_MEM_LIST_MAX 1
988#define ACPI_NUM_MEM_LISTS 2
1da177e4 989
4be44fcd 990#endif /* __ACLOCAL_H__ */
This page took 0.501092 seconds and 5 git commands to generate.