aboutsummaryrefslogtreecommitdiffstats
path: root/include/acpi/aclocal.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/acpi/aclocal.h')
-rw-r--r--include/acpi/aclocal.h722
1 files changed, 298 insertions, 424 deletions
diff --git a/include/acpi/aclocal.h b/include/acpi/aclocal.h
index 030e641115cb..9fba0fddda90 100644
--- a/include/acpi/aclocal.h
+++ b/include/acpi/aclocal.h
@@ -44,17 +44,20 @@
44#ifndef __ACLOCAL_H__ 44#ifndef __ACLOCAL_H__
45#define __ACLOCAL_H__ 45#define __ACLOCAL_H__
46 46
47#define ACPI_WAIT_FOREVER 0xFFFF /* u16, as per ACPI spec */
47 48
48#define ACPI_WAIT_FOREVER 0xFFFF /* u16, as per ACPI spec */ 49typedef void *acpi_mutex;
49 50typedef u32 acpi_mutex_handle;
50typedef void * acpi_mutex;
51typedef u32 acpi_mutex_handle;
52
53 51
54/* Total number of aml opcodes defined */ 52/* Total number of aml opcodes defined */
55 53
56#define AML_NUM_OPCODES 0x7F 54#define AML_NUM_OPCODES 0x7F
57 55
56/* Forward declarations */
57
58struct acpi_walk_state;
59struct acpi_obj_mutex;
60union acpi_parse_object;
58 61
59/***************************************************************************** 62/*****************************************************************************
60 * 63 *
@@ -62,7 +65,6 @@ typedef u32 acpi_mutex_handle;
62 * 65 *
63 ****************************************************************************/ 66 ****************************************************************************/
64 67
65
66/* 68/*
67 * Predefined handles for the mutex objects used within the subsystem 69 * Predefined handles for the mutex objects used within the subsystem
68 * All mutex objects are automatically created by acpi_ut_mutex_initialize. 70 * All mutex objects are automatically created by acpi_ut_mutex_initialize.
@@ -89,14 +91,12 @@ typedef u32 acpi_mutex_handle;
89#define MAX_MUTEX 12 91#define MAX_MUTEX 12
90#define NUM_MUTEX MAX_MUTEX+1 92#define NUM_MUTEX MAX_MUTEX+1
91 93
92
93#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) 94#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
94#ifdef DEFINE_ACPI_GLOBALS 95#ifdef DEFINE_ACPI_GLOBALS
95 96
96/* Names for the mutexes used in the subsystem */ 97/* Names for the mutexes used in the subsystem */
97 98
98static char *acpi_gbl_mutex_names[] = 99static char *acpi_gbl_mutex_names[] = {
99{
100 "ACPI_MTX_Execute", 100 "ACPI_MTX_Execute",
101 "ACPI_MTX_Interpreter", 101 "ACPI_MTX_Interpreter",
102 "ACPI_MTX_Parser", 102 "ACPI_MTX_Parser",
@@ -115,34 +115,28 @@ static char *acpi_gbl_mutex_names[] =
115#endif 115#endif
116#endif 116#endif
117 117
118/* Owner IDs are used to track namespace nodes for selective deletion */
118 119
119/* Table for the global mutexes */ 120typedef u8 acpi_owner_id;
121#define ACPI_OWNER_ID_MAX 0xFF
120 122
121struct acpi_mutex_info 123/* This Thread ID means that the mutex is not in use (unlocked) */
122{
123 acpi_mutex mutex;
124 u32 use_count;
125 u32 owner_id;
126};
127 124
128/* This owner ID means that the mutex is not in use (unlocked) */ 125#define ACPI_MUTEX_NOT_ACQUIRED (u32) -1
129 126
130#define ACPI_MUTEX_NOT_ACQUIRED (u32) (-1) 127/* Table for the global mutexes */
131 128
129struct acpi_mutex_info {
130 acpi_mutex mutex;
131 u32 use_count;
132 u32 thread_id;
133};
132 134
133/* Lock flag parameter for various interfaces */ 135/* Lock flag parameter for various interfaces */
134 136
135#define ACPI_MTX_DO_NOT_LOCK 0 137#define ACPI_MTX_DO_NOT_LOCK 0
136#define ACPI_MTX_LOCK 1 138#define ACPI_MTX_LOCK 1
137 139
138
139typedef u16 acpi_owner_id;
140#define ACPI_OWNER_TYPE_TABLE 0x0
141#define ACPI_OWNER_TYPE_METHOD 0x1
142#define ACPI_FIRST_METHOD_ID 0x0001
143#define ACPI_FIRST_TABLE_ID 0xF000
144
145
146/* Field access granularities */ 140/* Field access granularities */
147 141
148#define ACPI_FIELD_BYTE_GRANULARITY 1 142#define ACPI_FIELD_BYTE_GRANULARITY 1
@@ -150,7 +144,6 @@ typedef u16 acpi_owner_id;
150#define ACPI_FIELD_DWORD_GRANULARITY 4 144#define ACPI_FIELD_DWORD_GRANULARITY 4
151#define ACPI_FIELD_QWORD_GRANULARITY 8 145#define ACPI_FIELD_QWORD_GRANULARITY 8
152 146
153
154/***************************************************************************** 147/*****************************************************************************
155 * 148 *
156 * Namespace typedefs and structs 149 * Namespace typedefs and structs
@@ -159,15 +152,12 @@ typedef u16 acpi_owner_id;
159 152
160/* Operational modes of the AML interpreter/scanner */ 153/* Operational modes of the AML interpreter/scanner */
161 154
162typedef enum 155typedef enum {
163{ 156 ACPI_IMODE_LOAD_PASS1 = 0x01,
164 ACPI_IMODE_LOAD_PASS1 = 0x01, 157 ACPI_IMODE_LOAD_PASS2 = 0x02,
165 ACPI_IMODE_LOAD_PASS2 = 0x02, 158 ACPI_IMODE_EXECUTE = 0x0E
166 ACPI_IMODE_EXECUTE = 0x0E
167
168} acpi_interpreter_mode; 159} acpi_interpreter_mode;
169 160
170
171/* 161/*
172 * The Node describes a named object that appears in the AML 162 * The Node describes a named object that appears in the AML
173 * An acpi_node is used to store Nodes. 163 * An acpi_node is used to store Nodes.
@@ -175,34 +165,37 @@ typedef enum
175 * data_type is used to differentiate between internal descriptors, and MUST 165 * data_type is used to differentiate between internal descriptors, and MUST
176 * be the first byte in this structure. 166 * be the first byte in this structure.
177 */ 167 */
178union acpi_name_union 168union acpi_name_union {
179{ 169 u32 integer;
180 u32 integer; 170 char ascii[4];
181 char ascii[4]; 171};
182}; 172
183 173struct acpi_namespace_node {
184struct acpi_namespace_node 174 u8 descriptor; /* Used to differentiate object descriptor types */
185{ 175 u8 type; /* Type associated with this name */
186 u8 descriptor; /* Used to differentiate object descriptor types */ 176 u16 reference_count; /* Current count of references and children */
187 u8 type; /* Type associated with this name */ 177 union acpi_name_union name; /* ACPI Name, always 4 chars per ACPI spec */
188 u16 owner_id; 178 union acpi_operand_object *object; /* Pointer to attached ACPI object (optional) */
189 union acpi_name_union name; /* ACPI Name, always 4 chars per ACPI spec */ 179 struct acpi_namespace_node *child; /* First child */
190 union acpi_operand_object *object; /* Pointer to attached ACPI object (optional) */ 180 struct acpi_namespace_node *peer; /* Next peer */
191 struct acpi_namespace_node *child; /* First child */ 181 u8 owner_id; /* Who created this node */
192 struct acpi_namespace_node *peer; /* Next peer*/ 182 u8 flags;
193 u16 reference_count; /* Current count of references and children */ 183
194 u8 flags; 184 /* Fields used by the ASL compiler only */
185
186#ifdef ACPI_ASL_COMPILER
187 u32 value;
188 union acpi_parse_object *op;
189#endif
195}; 190};
196 191
197
198#define ACPI_ENTRY_NOT_FOUND NULL 192#define ACPI_ENTRY_NOT_FOUND NULL
199 193
200
201/* Node flags */ 194/* Node flags */
202 195
203#define ANOBJ_RESERVED 0x01 196#define ANOBJ_RESERVED 0x01
204#define ANOBJ_END_OF_PEER_LIST 0x02 197#define ANOBJ_END_OF_PEER_LIST 0x02
205#define ANOBJ_DATA_WIDTH_32 0x04 /* Parent table is 64-bits */ 198#define ANOBJ_DATA_WIDTH_32 0x04 /* Parent table is 64-bits */
206#define ANOBJ_METHOD_ARG 0x08 199#define ANOBJ_METHOD_ARG 0x08
207#define ANOBJ_METHOD_LOCAL 0x10 200#define ANOBJ_METHOD_LOCAL 0x10
208#define ANOBJ_METHOD_NO_RETVAL 0x20 201#define ANOBJ_METHOD_NO_RETVAL 0x20
@@ -212,91 +205,77 @@ struct acpi_namespace_node
212/* 205/*
213 * ACPI Table Descriptor. One per ACPI table 206 * ACPI Table Descriptor. One per ACPI table
214 */ 207 */
215struct acpi_table_desc 208struct acpi_table_desc {
216{ 209 struct acpi_table_desc *prev;
217 struct acpi_table_desc *prev; 210 struct acpi_table_desc *next;
218 struct acpi_table_desc *next; 211 struct acpi_table_desc *installed_desc;
219 struct acpi_table_desc *installed_desc; 212 struct acpi_table_header *pointer;
220 struct acpi_table_header *pointer; 213 u8 *aml_start;
221 u8 *aml_start; 214 u64 physical_address;
222 u64 physical_address; 215 u32 aml_length;
223 u32 aml_length; 216 acpi_size length;
224 acpi_size length; 217 acpi_owner_id owner_id;
225 acpi_owner_id table_id; 218 u8 type;
226 u8 type; 219 u8 allocation;
227 u8 allocation; 220 u8 loaded_into_namespace;
228 u8 loaded_into_namespace;
229}; 221};
230 222
231struct acpi_table_list 223struct acpi_table_list {
232{ 224 struct acpi_table_desc *next;
233 struct acpi_table_desc *next; 225 u32 count;
234 u32 count;
235}; 226};
236 227
237 228struct acpi_find_context {
238struct acpi_find_context 229 char *search_for;
239{ 230 acpi_handle *list;
240 char *search_for; 231 u32 *count;
241 acpi_handle *list;
242 u32 *count;
243}; 232};
244 233
245 234struct acpi_ns_search_data {
246struct acpi_ns_search_data 235 struct acpi_namespace_node *node;
247{
248 struct acpi_namespace_node *node;
249}; 236};
250 237
251
252/* 238/*
253 * Predefined Namespace items 239 * Predefined Namespace items
254 */ 240 */
255struct acpi_predefined_names 241struct acpi_predefined_names {
256{ 242 char *name;
257 char *name; 243 u8 type;
258 u8 type; 244 char *val;
259 char *val;
260}; 245};
261 246
262
263/* Object types used during package copies */ 247/* Object types used during package copies */
264 248
265
266#define ACPI_COPY_TYPE_SIMPLE 0 249#define ACPI_COPY_TYPE_SIMPLE 0
267#define ACPI_COPY_TYPE_PACKAGE 1 250#define ACPI_COPY_TYPE_PACKAGE 1
268 251
269/* Info structure used to convert external<->internal namestrings */ 252/* Info structure used to convert external<->internal namestrings */
270 253
271struct acpi_namestring_info 254struct acpi_namestring_info {
272{ 255 char *external_name;
273 char *external_name; 256 char *next_external_char;
274 char *next_external_char; 257 char *internal_name;
275 char *internal_name; 258 u32 length;
276 u32 length; 259 u32 num_segments;
277 u32 num_segments; 260 u32 num_carats;
278 u32 num_carats; 261 u8 fully_qualified;
279 u8 fully_qualified;
280}; 262};
281 263
282
283/* Field creation info */ 264/* Field creation info */
284 265
285struct acpi_create_field_info 266struct acpi_create_field_info {
286{ 267 struct acpi_namespace_node *region_node;
287 struct acpi_namespace_node *region_node; 268 struct acpi_namespace_node *field_node;
288 struct acpi_namespace_node *field_node; 269 struct acpi_namespace_node *register_node;
289 struct acpi_namespace_node *register_node; 270 struct acpi_namespace_node *data_register_node;
290 struct acpi_namespace_node *data_register_node; 271 u32 bank_value;
291 u32 bank_value; 272 u32 field_bit_position;
292 u32 field_bit_position; 273 u32 field_bit_length;
293 u32 field_bit_length; 274 u8 field_flags;
294 u8 field_flags; 275 u8 attribute;
295 u8 attribute; 276 u8 field_type;
296 u8 field_type;
297}; 277};
298 278
299
300/***************************************************************************** 279/*****************************************************************************
301 * 280 *
302 * Event typedefs and structs 281 * Event typedefs and structs
@@ -305,108 +284,95 @@ struct acpi_create_field_info
305 284
306/* Dispatch info for each GPE -- either a method or handler, cannot be both */ 285/* Dispatch info for each GPE -- either a method or handler, cannot be both */
307 286
308struct acpi_handler_info 287struct acpi_handler_info {
309{ 288 acpi_event_handler address; /* Address of handler, if any */
310 acpi_event_handler address; /* Address of handler, if any */ 289 void *context; /* Context to be passed to handler */
311 void *context; /* Context to be passed to handler */ 290 struct acpi_namespace_node *method_node; /* Method node for this GPE level (saved) */
312 struct acpi_namespace_node *method_node; /* Method node for this GPE level (saved) */
313}; 291};
314 292
315union acpi_gpe_dispatch_info 293union acpi_gpe_dispatch_info {
316{ 294 struct acpi_namespace_node *method_node; /* Method node for this GPE level */
317 struct acpi_namespace_node *method_node; /* Method node for this GPE level */ 295 struct acpi_handler_info *handler;
318 struct acpi_handler_info *handler;
319}; 296};
320 297
321/* 298/*
322 * Information about a GPE, one per each GPE in an array. 299 * Information about a GPE, one per each GPE in an array.
323 * NOTE: Important to keep this struct as small as possible. 300 * NOTE: Important to keep this struct as small as possible.
324 */ 301 */
325struct acpi_gpe_event_info 302struct acpi_gpe_event_info {
326{ 303 union acpi_gpe_dispatch_info dispatch; /* Either Method or Handler */
327 union acpi_gpe_dispatch_info dispatch; /* Either Method or Handler */ 304 struct acpi_gpe_register_info *register_info; /* Backpointer to register info */
328 struct acpi_gpe_register_info *register_info; /* Backpointer to register info */ 305 u8 flags; /* Misc info about this GPE */
329 u8 flags; /* Misc info about this GPE */ 306 u8 register_bit; /* This GPE bit within the register */
330 u8 register_bit; /* This GPE bit within the register */
331}; 307};
332 308
333/* Information about a GPE register pair, one per each status/enable pair in an array */ 309/* Information about a GPE register pair, one per each status/enable pair in an array */
334 310
335struct acpi_gpe_register_info 311struct acpi_gpe_register_info {
336{ 312 struct acpi_generic_address status_address; /* Address of status reg */
337 struct acpi_generic_address status_address; /* Address of status reg */ 313 struct acpi_generic_address enable_address; /* Address of enable reg */
338 struct acpi_generic_address enable_address; /* Address of enable reg */ 314 u8 enable_for_wake; /* GPEs to keep enabled when sleeping */
339 u8 enable_for_wake; /* GPEs to keep enabled when sleeping */ 315 u8 enable_for_run; /* GPEs to keep enabled when running */
340 u8 enable_for_run; /* GPEs to keep enabled when running */ 316 u8 base_gpe_number; /* Base GPE number for this register */
341 u8 base_gpe_number; /* Base GPE number for this register */
342}; 317};
343 318
344/* 319/*
345 * Information about a GPE register block, one per each installed block -- 320 * Information about a GPE register block, one per each installed block --
346 * GPE0, GPE1, and one per each installed GPE Block Device. 321 * GPE0, GPE1, and one per each installed GPE Block Device.
347 */ 322 */
348struct acpi_gpe_block_info 323struct acpi_gpe_block_info {
349{ 324 struct acpi_namespace_node *node;
350 struct acpi_namespace_node *node; 325 struct acpi_gpe_block_info *previous;
351 struct acpi_gpe_block_info *previous; 326 struct acpi_gpe_block_info *next;
352 struct acpi_gpe_block_info *next; 327 struct acpi_gpe_xrupt_info *xrupt_block; /* Backpointer to interrupt block */
353 struct acpi_gpe_xrupt_info *xrupt_block; /* Backpointer to interrupt block */ 328 struct acpi_gpe_register_info *register_info; /* One per GPE register pair */
354 struct acpi_gpe_register_info *register_info; /* One per GPE register pair */ 329 struct acpi_gpe_event_info *event_info; /* One for each GPE */
355 struct acpi_gpe_event_info *event_info; /* One for each GPE */ 330 struct acpi_generic_address block_address; /* Base address of the block */
356 struct acpi_generic_address block_address; /* Base address of the block */ 331 u32 register_count; /* Number of register pairs in block */
357 u32 register_count; /* Number of register pairs in block */ 332 u8 block_base_number; /* Base GPE number for this block */
358 u8 block_base_number;/* Base GPE number for this block */
359}; 333};
360 334
361/* Information about GPE interrupt handlers, one per each interrupt level used for GPEs */ 335/* Information about GPE interrupt handlers, one per each interrupt level used for GPEs */
362 336
363struct acpi_gpe_xrupt_info 337struct acpi_gpe_xrupt_info {
364{ 338 struct acpi_gpe_xrupt_info *previous;
365 struct acpi_gpe_xrupt_info *previous; 339 struct acpi_gpe_xrupt_info *next;
366 struct acpi_gpe_xrupt_info *next; 340 struct acpi_gpe_block_info *gpe_block_list_head; /* List of GPE blocks for this xrupt */
367 struct acpi_gpe_block_info *gpe_block_list_head; /* List of GPE blocks for this xrupt */ 341 u32 interrupt_number; /* System interrupt number */
368 u32 interrupt_level; /* System interrupt level */
369}; 342};
370 343
371 344struct acpi_gpe_walk_info {
372struct acpi_gpe_walk_info 345 struct acpi_namespace_node *gpe_device;
373{ 346 struct acpi_gpe_block_info *gpe_block;
374 struct acpi_namespace_node *gpe_device;
375 struct acpi_gpe_block_info *gpe_block;
376}; 347};
377 348
378 349typedef acpi_status(*ACPI_GPE_CALLBACK) (struct acpi_gpe_xrupt_info *
379typedef acpi_status (*ACPI_GPE_CALLBACK) ( 350 gpe_xrupt_info,
380 struct acpi_gpe_xrupt_info *gpe_xrupt_info, 351 struct acpi_gpe_block_info *
381 struct acpi_gpe_block_info *gpe_block); 352 gpe_block);
382
383 353
384/* Information about each particular fixed event */ 354/* Information about each particular fixed event */
385 355
386struct acpi_fixed_event_handler 356struct acpi_fixed_event_handler {
387{ 357 acpi_event_handler handler; /* Address of handler. */
388 acpi_event_handler handler; /* Address of handler. */ 358 void *context; /* Context to be passed to handler */
389 void *context; /* Context to be passed to handler */
390}; 359};
391 360
392struct acpi_fixed_event_info 361struct acpi_fixed_event_info {
393{ 362 u8 status_register_id;
394 u8 status_register_id; 363 u8 enable_register_id;
395 u8 enable_register_id; 364 u16 status_bit_mask;
396 u16 status_bit_mask; 365 u16 enable_bit_mask;
397 u16 enable_bit_mask;
398}; 366};
399 367
400/* Information used during field processing */ 368/* Information used during field processing */
401 369
402struct acpi_field_info 370struct acpi_field_info {
403{ 371 u8 skip_field;
404 u8 skip_field; 372 u8 field_flag;
405 u8 field_flag; 373 u32 pkg_length;
406 u32 pkg_length;
407}; 374};
408 375
409
410/***************************************************************************** 376/*****************************************************************************
411 * 377 *
412 * Generic "state" object for stacks 378 * Generic "state" object for stacks
@@ -419,14 +385,6 @@ struct acpi_field_info
419#define ACPI_CONTROL_PREDICATE_FALSE 0xC3 385#define ACPI_CONTROL_PREDICATE_FALSE 0xC3
420#define ACPI_CONTROL_PREDICATE_TRUE 0xC4 386#define ACPI_CONTROL_PREDICATE_TRUE 0xC4
421 387
422
423/* Forward declarations */
424
425struct acpi_walk_state ;
426struct acpi_obj_mutex;
427union acpi_parse_object ;
428
429
430#define ACPI_STATE_COMMON /* Two 32-bit fields and a pointer */\ 388#define ACPI_STATE_COMMON /* Two 32-bit fields and a pointer */\
431 u8 data_type; /* To differentiate various internal objs */\ 389 u8 data_type; /* To differentiate various internal objs */\
432 u8 flags; \ 390 u8 flags; \
@@ -435,147 +393,112 @@ union acpi_parse_object ;
435 u16 reserved; \ 393 u16 reserved; \
436 void *next; \ 394 void *next; \
437 395
438struct acpi_common_state 396struct acpi_common_state {
439{ 397ACPI_STATE_COMMON};
440 ACPI_STATE_COMMON
441};
442
443 398
444/* 399/*
445 * Update state - used to traverse complex objects such as packages 400 * Update state - used to traverse complex objects such as packages
446 */ 401 */
447struct acpi_update_state 402struct acpi_update_state {
448{ 403 ACPI_STATE_COMMON union acpi_operand_object *object;
449 ACPI_STATE_COMMON
450 union acpi_operand_object *object;
451}; 404};
452 405
453
454/* 406/*
455 * Pkg state - used to traverse nested package structures 407 * Pkg state - used to traverse nested package structures
456 */ 408 */
457struct acpi_pkg_state 409struct acpi_pkg_state {
458{ 410 ACPI_STATE_COMMON union acpi_operand_object *source_object;
459 ACPI_STATE_COMMON 411 union acpi_operand_object *dest_object;
460 union acpi_operand_object *source_object; 412 struct acpi_walk_state *walk_state;
461 union acpi_operand_object *dest_object; 413 void *this_target_obj;
462 struct acpi_walk_state *walk_state; 414 u32 num_packages;
463 void *this_target_obj; 415 u16 index;
464 u32 num_packages;
465 u16 index;
466}; 416};
467 417
468
469/* 418/*
470 * Control state - one per if/else and while constructs. 419 * Control state - one per if/else and while constructs.
471 * Allows nesting of these constructs 420 * Allows nesting of these constructs
472 */ 421 */
473struct acpi_control_state 422struct acpi_control_state {
474{ 423 ACPI_STATE_COMMON union acpi_parse_object *predicate_op;
475 ACPI_STATE_COMMON 424 u8 *aml_predicate_start; /* Start of if/while predicate */
476 union acpi_parse_object *predicate_op; 425 u8 *package_end; /* End of if/while block */
477 u8 *aml_predicate_start; /* Start of if/while predicate */ 426 u16 opcode;
478 u8 *package_end; /* End of if/while block */
479 u16 opcode;
480}; 427};
481 428
482
483/* 429/*
484 * Scope state - current scope during namespace lookups 430 * Scope state - current scope during namespace lookups
485 */ 431 */
486struct acpi_scope_state 432struct acpi_scope_state {
487{ 433 ACPI_STATE_COMMON struct acpi_namespace_node *node;
488 ACPI_STATE_COMMON
489 struct acpi_namespace_node *node;
490}; 434};
491 435
492 436struct acpi_pscope_state {
493struct acpi_pscope_state 437 ACPI_STATE_COMMON union acpi_parse_object *op; /* Current op being parsed */
494{ 438 u8 *arg_end; /* Current argument end */
495 ACPI_STATE_COMMON 439 u8 *pkg_end; /* Current package end */
496 union acpi_parse_object *op; /* Current op being parsed */ 440 u32 arg_list; /* Next argument to parse */
497 u8 *arg_end; /* Current argument end */ 441 u32 arg_count; /* Number of fixed arguments */
498 u8 *pkg_end; /* Current package end */
499 u32 arg_list; /* Next argument to parse */
500 u32 arg_count; /* Number of fixed arguments */
501}; 442};
502 443
503
504/* 444/*
505 * Thread state - one per thread across multiple walk states. Multiple walk 445 * Thread state - one per thread across multiple walk states. Multiple walk
506 * states are created when there are nested control methods executing. 446 * states are created when there are nested control methods executing.
507 */ 447 */
508struct acpi_thread_state 448struct acpi_thread_state {
509{ 449 ACPI_STATE_COMMON struct acpi_walk_state *walk_state_list; /* Head of list of walk_states for this thread */
510 ACPI_STATE_COMMON 450 union acpi_operand_object *acquired_mutex_list; /* List of all currently acquired mutexes */
511 struct acpi_walk_state *walk_state_list; /* Head of list of walk_states for this thread */ 451 u32 thread_id; /* Running thread ID */
512 union acpi_operand_object *acquired_mutex_list; /* List of all currently acquired mutexes */ 452 u8 current_sync_level; /* Mutex Sync (nested acquire) level */
513 u32 thread_id; /* Running thread ID */
514 u8 current_sync_level; /* Mutex Sync (nested acquire) level */
515}; 453};
516 454
517
518/* 455/*
519 * Result values - used to accumulate the results of nested 456 * Result values - used to accumulate the results of nested
520 * AML arguments 457 * AML arguments
521 */ 458 */
522struct acpi_result_values 459struct acpi_result_values {
523{
524 ACPI_STATE_COMMON 460 ACPI_STATE_COMMON
525 union acpi_operand_object *obj_desc [ACPI_OBJ_NUM_OPERANDS]; 461 union acpi_operand_object *obj_desc[ACPI_OBJ_NUM_OPERANDS];
526 u8 num_results; 462 u8 num_results;
527 u8 last_insert; 463 u8 last_insert;
528}; 464};
529 465
530
531typedef
532acpi_status (*acpi_parse_downwards) (
533 struct acpi_walk_state *walk_state,
534 union acpi_parse_object **out_op);
535
536typedef 466typedef
537acpi_status (*acpi_parse_upwards) ( 467acpi_status(*acpi_parse_downwards) (struct acpi_walk_state * walk_state,
538 struct acpi_walk_state *walk_state); 468 union acpi_parse_object ** out_op);
539 469
470typedef acpi_status(*acpi_parse_upwards) (struct acpi_walk_state * walk_state);
540 471
541/* 472/*
542 * Notify info - used to pass info to the deferred notify 473 * Notify info - used to pass info to the deferred notify
543 * handler/dispatcher. 474 * handler/dispatcher.
544 */ 475 */
545struct acpi_notify_info 476struct acpi_notify_info {
546{ 477 ACPI_STATE_COMMON struct acpi_namespace_node *node;
547 ACPI_STATE_COMMON 478 union acpi_operand_object *handler_obj;
548 struct acpi_namespace_node *node;
549 union acpi_operand_object *handler_obj;
550}; 479};
551 480
552
553/* Generic state is union of structs above */ 481/* Generic state is union of structs above */
554 482
555union acpi_generic_state 483union acpi_generic_state {
556{ 484 struct acpi_common_state common;
557 struct acpi_common_state common; 485 struct acpi_control_state control;
558 struct acpi_control_state control; 486 struct acpi_update_state update;
559 struct acpi_update_state update; 487 struct acpi_scope_state scope;
560 struct acpi_scope_state scope; 488 struct acpi_pscope_state parse_scope;
561 struct acpi_pscope_state parse_scope; 489 struct acpi_pkg_state pkg;
562 struct acpi_pkg_state pkg; 490 struct acpi_thread_state thread;
563 struct acpi_thread_state thread; 491 struct acpi_result_values results;
564 struct acpi_result_values results; 492 struct acpi_notify_info notify;
565 struct acpi_notify_info notify;
566}; 493};
567 494
568
569/***************************************************************************** 495/*****************************************************************************
570 * 496 *
571 * Interpreter typedefs and structs 497 * Interpreter typedefs and structs
572 * 498 *
573 ****************************************************************************/ 499 ****************************************************************************/
574 500
575typedef 501typedef acpi_status(*ACPI_EXECUTE_OP) (struct acpi_walk_state * walk_state);
576acpi_status (*ACPI_EXECUTE_OP) (
577 struct acpi_walk_state *walk_state);
578
579 502
580/***************************************************************************** 503/*****************************************************************************
581 * 504 *
@@ -586,28 +509,26 @@ acpi_status (*ACPI_EXECUTE_OP) (
586/* 509/*
587 * AML opcode, name, and argument layout 510 * AML opcode, name, and argument layout
588 */ 511 */
589struct acpi_opcode_info 512struct acpi_opcode_info {
590{
591#if defined(ACPI_DISASSEMBLER) || defined(ACPI_DEBUG_OUTPUT) 513#if defined(ACPI_DISASSEMBLER) || defined(ACPI_DEBUG_OUTPUT)
592 char *name; /* Opcode name (disassembler/debug only) */ 514 char *name; /* Opcode name (disassembler/debug only) */
593#endif 515#endif
594 u32 parse_args; /* Grammar/Parse time arguments */ 516 u32 parse_args; /* Grammar/Parse time arguments */
595 u32 runtime_args; /* Interpret time arguments */ 517 u32 runtime_args; /* Interpret time arguments */
596 u32 flags; /* Misc flags */ 518 u32 flags; /* Misc flags */
597 u8 object_type; /* Corresponding internal object type */ 519 u8 object_type; /* Corresponding internal object type */
598 u8 class; /* Opcode class */ 520 u8 class; /* Opcode class */
599 u8 type; /* Opcode type */ 521 u8 type; /* Opcode type */
600}; 522};
601 523
602union acpi_parse_value 524union acpi_parse_value {
603{ 525 acpi_integer integer; /* Integer constant (Up to 64 bits) */
604 acpi_integer integer; /* Integer constant (Up to 64 bits) */ 526 struct uint64_struct integer64; /* Structure overlay for 2 32-bit Dwords */
605 struct uint64_struct integer64; /* Structure overlay for 2 32-bit Dwords */ 527 u32 size; /* bytelist or field size */
606 u32 size; /* bytelist or field size */ 528 char *string; /* NULL terminated string */
607 char *string; /* NULL terminated string */ 529 u8 *buffer; /* buffer or string */
608 u8 *buffer; /* buffer or string */ 530 char *name; /* NULL terminated string */
609 char *name; /* NULL terminated string */ 531 union acpi_parse_object *arg; /* arguments and contained ops */
610 union acpi_parse_object *arg; /* arguments and contained ops */
611}; 532};
612 533
613#define ACPI_PARSE_COMMON \ 534#define ACPI_PARSE_COMMON \
@@ -636,84 +557,72 @@ union acpi_parse_value
636/* 557/*
637 * generic operation (for example: If, While, Store) 558 * generic operation (for example: If, While, Store)
638 */ 559 */
639struct acpi_parse_obj_common 560struct acpi_parse_obj_common {
640{ 561ACPI_PARSE_COMMON};
641 ACPI_PARSE_COMMON
642};
643
644 562
645/* 563/*
646 * Extended Op for named ops (Scope, Method, etc.), deferred ops (Methods and op_regions), 564 * Extended Op for named ops (Scope, Method, etc.), deferred ops (Methods and op_regions),
647 * and bytelists. 565 * and bytelists.
648 */ 566 */
649struct acpi_parse_obj_named 567struct acpi_parse_obj_named {
650{ 568 ACPI_PARSE_COMMON u8 * path;
651 ACPI_PARSE_COMMON 569 u8 *data; /* AML body or bytelist data */
652 u8 *path; 570 u32 length; /* AML length */
653 u8 *data; /* AML body or bytelist data */ 571 u32 name; /* 4-byte name or zero if no name */
654 u32 length; /* AML length */
655 u32 name; /* 4-byte name or zero if no name */
656}; 572};
657 573
658
659/* The parse node is the fundamental element of the parse tree */ 574/* The parse node is the fundamental element of the parse tree */
660 575
661struct acpi_parse_obj_asl 576struct acpi_parse_obj_asl {
662{ 577 ACPI_PARSE_COMMON union acpi_parse_object *child;
663 ACPI_PARSE_COMMON 578 union acpi_parse_object *parent_method;
664 union acpi_parse_object *child; 579 char *filename;
665 union acpi_parse_object *parent_method; 580 char *external_name;
666 char *filename; 581 char *namepath;
667 char *external_name; 582 char name_seg[4];
668 char *namepath; 583 u32 extra_value;
669 char name_seg[4]; 584 u32 column;
670 u32 extra_value; 585 u32 line_number;
671 u32 column; 586 u32 logical_line_number;
672 u32 line_number; 587 u32 logical_byte_offset;
673 u32 logical_line_number; 588 u32 end_line;
674 u32 logical_byte_offset; 589 u32 end_logical_line;
675 u32 end_line; 590 u32 acpi_btype;
676 u32 end_logical_line; 591 u32 aml_length;
677 u32 acpi_btype; 592 u32 aml_subtree_length;
678 u32 aml_length; 593 u32 final_aml_length;
679 u32 aml_subtree_length; 594 u32 final_aml_offset;
680 u32 final_aml_length; 595 u32 compile_flags;
681 u32 final_aml_offset; 596 u16 parse_opcode;
682 u32 compile_flags; 597 u8 aml_opcode_length;
683 u16 parse_opcode; 598 u8 aml_pkg_len_bytes;
684 u8 aml_opcode_length; 599 u8 extra;
685 u8 aml_pkg_len_bytes; 600 char parse_op_name[12];
686 u8 extra; 601};
687 char parse_op_name[12]; 602
688}; 603union acpi_parse_object {
689 604 struct acpi_parse_obj_common common;
690union acpi_parse_object 605 struct acpi_parse_obj_named named;
691{ 606 struct acpi_parse_obj_asl asl;
692 struct acpi_parse_obj_common common;
693 struct acpi_parse_obj_named named;
694 struct acpi_parse_obj_asl asl;
695}; 607};
696 608
697
698/* 609/*
699 * Parse state - one state per parser invocation and each control 610 * Parse state - one state per parser invocation and each control
700 * method. 611 * method.
701 */ 612 */
702struct acpi_parse_state 613struct acpi_parse_state {
703{ 614 u32 aml_size;
704 u32 aml_size; 615 u8 *aml_start; /* First AML byte */
705 u8 *aml_start; /* First AML byte */ 616 u8 *aml; /* Next AML byte */
706 u8 *aml; /* Next AML byte */ 617 u8 *aml_end; /* (last + 1) AML byte */
707 u8 *aml_end; /* (last + 1) AML byte */ 618 u8 *pkg_start; /* Current package begin */
708 u8 *pkg_start; /* Current package begin */ 619 u8 *pkg_end; /* Current package end */
709 u8 *pkg_end; /* Current package end */ 620 union acpi_parse_object *start_op; /* Root of parse tree */
710 union acpi_parse_object *start_op; /* Root of parse tree */ 621 struct acpi_namespace_node *start_node;
711 struct acpi_namespace_node *start_node; 622 union acpi_generic_state *scope; /* Current scope */
712 union acpi_generic_state *scope; /* Current scope */ 623 union acpi_parse_object *start_scope;
713 union acpi_parse_object *start_scope;
714}; 624};
715 625
716
717/* Parse object flags */ 626/* Parse object flags */
718 627
719#define ACPI_PARSEOP_GENERIC 0x01 628#define ACPI_PARSEOP_GENERIC 0x01
@@ -729,7 +638,6 @@ struct acpi_parse_state
729#define ACPI_PARSEOP_EMPTY_TERMLIST 0x04 638#define ACPI_PARSEOP_EMPTY_TERMLIST 0x04
730#define ACPI_PARSEOP_SPECIAL 0x10 639#define ACPI_PARSEOP_SPECIAL 0x10
731 640
732
733/***************************************************************************** 641/*****************************************************************************
734 * 642 *
735 * Hardware (ACPI registers) and PNP 643 * Hardware (ACPI registers) and PNP
@@ -737,15 +645,14 @@ struct acpi_parse_state
737 ****************************************************************************/ 645 ****************************************************************************/
738 646
739#define PCI_ROOT_HID_STRING "PNP0A03" 647#define PCI_ROOT_HID_STRING "PNP0A03"
648#define PCI_EXPRESS_ROOT_HID_STRING "PNP0A08"
740 649
741struct acpi_bit_register_info 650struct acpi_bit_register_info {
742{ 651 u8 parent_register;
743 u8 parent_register; 652 u8 bit_position;
744 u8 bit_position; 653 u16 access_bit_mask;
745 u16 access_bit_mask;
746}; 654};
747 655
748
749/* 656/*
750 * Register IDs 657 * Register IDs
751 * These are the full ACPI registers 658 * These are the full ACPI registers
@@ -760,7 +667,6 @@ struct acpi_bit_register_info
760#define ACPI_REGISTER_PROCESSOR_BLOCK 0x08 667#define ACPI_REGISTER_PROCESSOR_BLOCK 0x08
761#define ACPI_REGISTER_SMI_COMMAND_BLOCK 0x09 668#define ACPI_REGISTER_SMI_COMMAND_BLOCK 0x09
762 669
763
764/* Masks used to access the bit_registers */ 670/* Masks used to access the bit_registers */
765 671
766#define ACPI_BITMASK_TIMER_STATUS 0x0001 672#define ACPI_BITMASK_TIMER_STATUS 0x0001
@@ -769,7 +675,7 @@ struct acpi_bit_register_info
769#define ACPI_BITMASK_POWER_BUTTON_STATUS 0x0100 675#define ACPI_BITMASK_POWER_BUTTON_STATUS 0x0100
770#define ACPI_BITMASK_SLEEP_BUTTON_STATUS 0x0200 676#define ACPI_BITMASK_SLEEP_BUTTON_STATUS 0x0200
771#define ACPI_BITMASK_RT_CLOCK_STATUS 0x0400 677#define ACPI_BITMASK_RT_CLOCK_STATUS 0x0400
772#define ACPI_BITMASK_PCIEXP_WAKE_STATUS 0x4000 /* ACPI 3.0 */ 678#define ACPI_BITMASK_PCIEXP_WAKE_STATUS 0x4000 /* ACPI 3.0 */
773#define ACPI_BITMASK_WAKE_STATUS 0x8000 679#define ACPI_BITMASK_WAKE_STATUS 0x8000
774 680
775#define ACPI_BITMASK_ALL_FIXED_STATUS (ACPI_BITMASK_TIMER_STATUS | \ 681#define ACPI_BITMASK_ALL_FIXED_STATUS (ACPI_BITMASK_TIMER_STATUS | \
@@ -785,7 +691,7 @@ struct acpi_bit_register_info
785#define ACPI_BITMASK_POWER_BUTTON_ENABLE 0x0100 691#define ACPI_BITMASK_POWER_BUTTON_ENABLE 0x0100
786#define ACPI_BITMASK_SLEEP_BUTTON_ENABLE 0x0200 692#define ACPI_BITMASK_SLEEP_BUTTON_ENABLE 0x0200
787#define ACPI_BITMASK_RT_CLOCK_ENABLE 0x0400 693#define ACPI_BITMASK_RT_CLOCK_ENABLE 0x0400
788#define ACPI_BITMASK_PCIEXP_WAKE_DISABLE 0x4000 /* ACPI 3.0 */ 694#define ACPI_BITMASK_PCIEXP_WAKE_DISABLE 0x4000 /* ACPI 3.0 */
789 695
790#define ACPI_BITMASK_SCI_ENABLE 0x0001 696#define ACPI_BITMASK_SCI_ENABLE 0x0001
791#define ACPI_BITMASK_BUS_MASTER_RLD 0x0002 697#define ACPI_BITMASK_BUS_MASTER_RLD 0x0002
@@ -795,7 +701,6 @@ struct acpi_bit_register_info
795 701
796#define ACPI_BITMASK_ARB_DISABLE 0x0001 702#define ACPI_BITMASK_ARB_DISABLE 0x0001
797 703
798
799/* Raw bit position of each bit_register */ 704/* Raw bit position of each bit_register */
800 705
801#define ACPI_BITPOSITION_TIMER_STATUS 0x00 706#define ACPI_BITPOSITION_TIMER_STATUS 0x00
@@ -804,7 +709,7 @@ struct acpi_bit_register_info
804#define ACPI_BITPOSITION_POWER_BUTTON_STATUS 0x08 709#define ACPI_BITPOSITION_POWER_BUTTON_STATUS 0x08
805#define ACPI_BITPOSITION_SLEEP_BUTTON_STATUS 0x09 710#define ACPI_BITPOSITION_SLEEP_BUTTON_STATUS 0x09
806#define ACPI_BITPOSITION_RT_CLOCK_STATUS 0x0A 711#define ACPI_BITPOSITION_RT_CLOCK_STATUS 0x0A
807#define ACPI_BITPOSITION_PCIEXP_WAKE_STATUS 0x0E /* ACPI 3.0 */ 712#define ACPI_BITPOSITION_PCIEXP_WAKE_STATUS 0x0E /* ACPI 3.0 */
808#define ACPI_BITPOSITION_WAKE_STATUS 0x0F 713#define ACPI_BITPOSITION_WAKE_STATUS 0x0F
809 714
810#define ACPI_BITPOSITION_TIMER_ENABLE 0x00 715#define ACPI_BITPOSITION_TIMER_ENABLE 0x00
@@ -812,7 +717,7 @@ struct acpi_bit_register_info
812#define ACPI_BITPOSITION_POWER_BUTTON_ENABLE 0x08 717#define ACPI_BITPOSITION_POWER_BUTTON_ENABLE 0x08
813#define ACPI_BITPOSITION_SLEEP_BUTTON_ENABLE 0x09 718#define ACPI_BITPOSITION_SLEEP_BUTTON_ENABLE 0x09
814#define ACPI_BITPOSITION_RT_CLOCK_ENABLE 0x0A 719#define ACPI_BITPOSITION_RT_CLOCK_ENABLE 0x0A
815#define ACPI_BITPOSITION_PCIEXP_WAKE_DISABLE 0x0E /* ACPI 3.0 */ 720#define ACPI_BITPOSITION_PCIEXP_WAKE_DISABLE 0x0E /* ACPI 3.0 */
816 721
817#define ACPI_BITPOSITION_SCI_ENABLE 0x00 722#define ACPI_BITPOSITION_SCI_ENABLE 0x00
818#define ACPI_BITPOSITION_BUS_MASTER_RLD 0x01 723#define ACPI_BITPOSITION_BUS_MASTER_RLD 0x01
@@ -822,7 +727,6 @@ struct acpi_bit_register_info
822 727
823#define ACPI_BITPOSITION_ARB_DISABLE 0x00 728#define ACPI_BITPOSITION_ARB_DISABLE 0x00
824 729
825
826/***************************************************************************** 730/*****************************************************************************
827 * 731 *
828 * Resource descriptors 732 * Resource descriptors
@@ -841,8 +745,7 @@ struct acpi_bit_register_info
841#define ACPI_RDESC_TYPE_SMALL 0x00 745#define ACPI_RDESC_TYPE_SMALL 0x00
842 746
843#define ACPI_RDESC_TYPE_MASK 0x80 747#define ACPI_RDESC_TYPE_MASK 0x80
844#define ACPI_RDESC_SMALL_MASK 0x78 /* Only bits 6:3 contain the type */ 748#define ACPI_RDESC_SMALL_MASK 0x78 /* Only bits 6:3 contain the type */
845
846 749
847/* 750/*
848 * Small resource descriptor types 751 * Small resource descriptor types
@@ -871,7 +774,6 @@ struct acpi_bit_register_info
871#define ACPI_RDESC_TYPE_QWORD_ADDRESS_SPACE 0x8A 774#define ACPI_RDESC_TYPE_QWORD_ADDRESS_SPACE 0x8A
872#define ACPI_RDESC_TYPE_EXTENDED_ADDRESS_SPACE 0x8B 775#define ACPI_RDESC_TYPE_EXTENDED_ADDRESS_SPACE 0x8B
873 776
874
875/***************************************************************************** 777/*****************************************************************************
876 * 778 *
877 * Miscellaneous 779 * Miscellaneous
@@ -880,49 +782,36 @@ struct acpi_bit_register_info
880 782
881#define ACPI_ASCII_ZERO 0x30 783#define ACPI_ASCII_ZERO 0x30
882 784
883
884/***************************************************************************** 785/*****************************************************************************
885 * 786 *
886 * Debugger 787 * Debugger
887 * 788 *
888 ****************************************************************************/ 789 ****************************************************************************/
889 790
890struct acpi_db_method_info 791struct acpi_db_method_info {
891{ 792 acpi_handle thread_gate;
892 acpi_handle thread_gate; 793 char *name;
893 char *name; 794 char **args;
894 char **args; 795 u32 flags;
895 u32 flags; 796 u32 num_loops;
896 u32 num_loops; 797 char pathname[128];
897 char pathname[128];
898}; 798};
899 799
900struct acpi_integrity_info 800struct acpi_integrity_info {
901{ 801 u32 nodes;
902 u32 nodes; 802 u32 objects;
903 u32 objects;
904}; 803};
905 804
906
907#define ACPI_DB_REDIRECTABLE_OUTPUT 0x01 805#define ACPI_DB_REDIRECTABLE_OUTPUT 0x01
908#define ACPI_DB_CONSOLE_OUTPUT 0x02 806#define ACPI_DB_CONSOLE_OUTPUT 0x02
909#define ACPI_DB_DUPLICATE_OUTPUT 0x03 807#define ACPI_DB_DUPLICATE_OUTPUT 0x03
910 808
911
912/***************************************************************************** 809/*****************************************************************************
913 * 810 *
914 * Debug 811 * Debug
915 * 812 *
916 ****************************************************************************/ 813 ****************************************************************************/
917 814
918struct acpi_debug_print_info
919{
920 u32 component_id;
921 char *proc_name;
922 char *module_name;
923};
924
925
926/* Entry for a memory allocation (debug only) */ 815/* Entry for a memory allocation (debug only) */
927 816
928#define ACPI_MEM_MALLOC 0 817#define ACPI_MEM_MALLOC 0
@@ -938,51 +827,36 @@ struct acpi_debug_print_info
938 char module[ACPI_MAX_MODULE_NAME]; \ 827 char module[ACPI_MAX_MODULE_NAME]; \
939 u8 alloc_type; 828 u8 alloc_type;
940 829
941struct acpi_debug_mem_header 830struct acpi_debug_mem_header {
942{ 831ACPI_COMMON_DEBUG_MEM_HEADER};
943 ACPI_COMMON_DEBUG_MEM_HEADER
944};
945 832
946struct acpi_debug_mem_block 833struct acpi_debug_mem_block {
947{ 834 ACPI_COMMON_DEBUG_MEM_HEADER u64 user_space;
948 ACPI_COMMON_DEBUG_MEM_HEADER
949 u64 user_space;
950}; 835};
951 836
952
953#define ACPI_MEM_LIST_GLOBAL 0 837#define ACPI_MEM_LIST_GLOBAL 0
954#define ACPI_MEM_LIST_NSNODE 1 838#define ACPI_MEM_LIST_NSNODE 1
839#define ACPI_MEM_LIST_MAX 1
840#define ACPI_NUM_MEM_LISTS 2
955 841
956#define ACPI_MEM_LIST_FIRST_CACHE_LIST 2 842struct acpi_memory_list {
957#define ACPI_MEM_LIST_STATE 2 843 char *list_name;
958#define ACPI_MEM_LIST_PSNODE 3 844 void *list_head;
959#define ACPI_MEM_LIST_PSNODE_EXT 4 845 u16 object_size;
960#define ACPI_MEM_LIST_OPERAND 5 846 u16 max_depth;
961#define ACPI_MEM_LIST_WALK 6 847 u16 current_depth;
962#define ACPI_MEM_LIST_MAX 6 848 u16 link_offset;
963#define ACPI_NUM_MEM_LISTS 7
964
965
966struct acpi_memory_list
967{
968 void *list_head;
969 u16 link_offset;
970 u16 max_cache_depth;
971 u16 cache_depth;
972 u16 object_size;
973 849
974#ifdef ACPI_DBG_TRACK_ALLOCATIONS 850#ifdef ACPI_DBG_TRACK_ALLOCATIONS
975 851
976 /* Statistics for debug memory tracking only */ 852 /* Statistics for debug memory tracking only */
977 853
978 u32 total_allocated; 854 u32 total_allocated;
979 u32 total_freed; 855 u32 total_freed;
980 u32 current_total_size; 856 u32 current_total_size;
981 u32 cache_requests; 857 u32 requests;
982 u32 cache_hits; 858 u32 hits;
983 char *list_name;
984#endif 859#endif
985}; 860};
986 861
987 862#endif /* __ACLOCAL_H__ */
988#endif /* __ACLOCAL_H__ */