diff options
62 files changed, 2411 insertions, 690 deletions
diff --git a/drivers/acpi/acpi_memhotplug.c b/drivers/acpi/acpi_memhotplug.c index 5f1127ad5a95..bbad9b6c2c88 100644 --- a/drivers/acpi/acpi_memhotplug.c +++ b/drivers/acpi/acpi_memhotplug.c | |||
@@ -454,8 +454,8 @@ static int acpi_memory_device_start (struct acpi_device *device) | |||
454 | /* call add_memory func */ | 454 | /* call add_memory func */ |
455 | result = acpi_memory_enable_device(mem_device); | 455 | result = acpi_memory_enable_device(mem_device); |
456 | if (result) | 456 | if (result) |
457 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 457 | printk(KERN_ERR PREFIX |
458 | "Error in acpi_memory_enable_device\n")); | 458 | "Error in acpi_memory_enable_device\n"); |
459 | } | 459 | } |
460 | return result; | 460 | return result; |
461 | } | 461 | } |
diff --git a/drivers/acpi/cm_sbs.c b/drivers/acpi/cm_sbs.c index f9db4f444bd0..4441e84b28a9 100644 --- a/drivers/acpi/cm_sbs.c +++ b/drivers/acpi/cm_sbs.c | |||
@@ -52,8 +52,8 @@ struct proc_dir_entry *acpi_lock_ac_dir(void) | |||
52 | if (acpi_ac_dir) { | 52 | if (acpi_ac_dir) { |
53 | lock_ac_dir_cnt++; | 53 | lock_ac_dir_cnt++; |
54 | } else { | 54 | } else { |
55 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 55 | printk(KERN_ERR PREFIX |
56 | "Cannot create %s\n", ACPI_AC_CLASS)); | 56 | "Cannot create %s\n", ACPI_AC_CLASS); |
57 | } | 57 | } |
58 | mutex_unlock(&cm_sbs_mutex); | 58 | mutex_unlock(&cm_sbs_mutex); |
59 | return acpi_ac_dir; | 59 | return acpi_ac_dir; |
@@ -83,8 +83,8 @@ struct proc_dir_entry *acpi_lock_battery_dir(void) | |||
83 | if (acpi_battery_dir) { | 83 | if (acpi_battery_dir) { |
84 | lock_battery_dir_cnt++; | 84 | lock_battery_dir_cnt++; |
85 | } else { | 85 | } else { |
86 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 86 | printk(KERN_ERR PREFIX |
87 | "Cannot create %s\n", ACPI_BATTERY_CLASS)); | 87 | "Cannot create %s\n", ACPI_BATTERY_CLASS); |
88 | } | 88 | } |
89 | mutex_unlock(&cm_sbs_mutex); | 89 | mutex_unlock(&cm_sbs_mutex); |
90 | return acpi_battery_dir; | 90 | return acpi_battery_dir; |
diff --git a/drivers/acpi/debug.c b/drivers/acpi/debug.c index 6df564f4ca6e..abf36b4b1d1d 100644 --- a/drivers/acpi/debug.c +++ b/drivers/acpi/debug.c | |||
@@ -47,8 +47,6 @@ static const struct acpi_dlayer acpi_debug_layers[] = { | |||
47 | }; | 47 | }; |
48 | 48 | ||
49 | static const struct acpi_dlevel acpi_debug_levels[] = { | 49 | static const struct acpi_dlevel acpi_debug_levels[] = { |
50 | ACPI_DEBUG_INIT(ACPI_LV_ERROR), | ||
51 | ACPI_DEBUG_INIT(ACPI_LV_WARN), | ||
52 | ACPI_DEBUG_INIT(ACPI_LV_INIT), | 50 | ACPI_DEBUG_INIT(ACPI_LV_INIT), |
53 | ACPI_DEBUG_INIT(ACPI_LV_DEBUG_OBJECT), | 51 | ACPI_DEBUG_INIT(ACPI_LV_DEBUG_OBJECT), |
54 | ACPI_DEBUG_INIT(ACPI_LV_INFO), | 52 | ACPI_DEBUG_INIT(ACPI_LV_INFO), |
diff --git a/drivers/acpi/dispatcher/dsmethod.c b/drivers/acpi/dispatcher/dsmethod.c index 4613b9ca5792..279a5a60a0dd 100644 --- a/drivers/acpi/dispatcher/dsmethod.c +++ b/drivers/acpi/dispatcher/dsmethod.c | |||
@@ -103,6 +103,9 @@ acpi_ds_method_error(acpi_status status, struct acpi_walk_state *walk_state) | |||
103 | NULL); | 103 | NULL); |
104 | acpi_ex_enter_interpreter(); | 104 | acpi_ex_enter_interpreter(); |
105 | } | 105 | } |
106 | |||
107 | acpi_ds_clear_implicit_return(walk_state); | ||
108 | |||
106 | #ifdef ACPI_DISASSEMBLER | 109 | #ifdef ACPI_DISASSEMBLER |
107 | if (ACPI_FAILURE(status)) { | 110 | if (ACPI_FAILURE(status)) { |
108 | 111 | ||
diff --git a/drivers/acpi/dispatcher/dsmthdat.c b/drivers/acpi/dispatcher/dsmthdat.c index 13c43eac35db..d03f81bd1bcb 100644 --- a/drivers/acpi/dispatcher/dsmthdat.c +++ b/drivers/acpi/dispatcher/dsmthdat.c | |||
@@ -43,7 +43,6 @@ | |||
43 | 43 | ||
44 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
45 | #include <acpi/acdispat.h> | 45 | #include <acpi/acdispat.h> |
46 | #include <acpi/amlcode.h> | ||
47 | #include <acpi/acnamesp.h> | 46 | #include <acpi/acnamesp.h> |
48 | #include <acpi/acinterp.h> | 47 | #include <acpi/acinterp.h> |
49 | 48 | ||
@@ -52,11 +51,11 @@ ACPI_MODULE_NAME("dsmthdat") | |||
52 | 51 | ||
53 | /* Local prototypes */ | 52 | /* Local prototypes */ |
54 | static void | 53 | static void |
55 | acpi_ds_method_data_delete_value(u16 opcode, | 54 | acpi_ds_method_data_delete_value(u8 type, |
56 | u32 index, struct acpi_walk_state *walk_state); | 55 | u32 index, struct acpi_walk_state *walk_state); |
57 | 56 | ||
58 | static acpi_status | 57 | static acpi_status |
59 | acpi_ds_method_data_set_value(u16 opcode, | 58 | acpi_ds_method_data_set_value(u8 type, |
60 | u32 index, | 59 | u32 index, |
61 | union acpi_operand_object *object, | 60 | union acpi_operand_object *object, |
62 | struct acpi_walk_state *walk_state); | 61 | struct acpi_walk_state *walk_state); |
@@ -216,7 +215,7 @@ acpi_ds_method_data_init_args(union acpi_operand_object **params, | |||
216 | * Store the argument in the method/walk descriptor. | 215 | * Store the argument in the method/walk descriptor. |
217 | * Do not copy the arg in order to implement call by reference | 216 | * Do not copy the arg in order to implement call by reference |
218 | */ | 217 | */ |
219 | status = acpi_ds_method_data_set_value(AML_ARG_OP, index, | 218 | status = acpi_ds_method_data_set_value(ACPI_REFCLASS_ARG, index, |
220 | params[index], | 219 | params[index], |
221 | walk_state); | 220 | walk_state); |
222 | if (ACPI_FAILURE(status)) { | 221 | if (ACPI_FAILURE(status)) { |
@@ -234,7 +233,8 @@ acpi_ds_method_data_init_args(union acpi_operand_object **params, | |||
234 | * | 233 | * |
235 | * FUNCTION: acpi_ds_method_data_get_node | 234 | * FUNCTION: acpi_ds_method_data_get_node |
236 | * | 235 | * |
237 | * PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP | 236 | * PARAMETERS: Type - Either ACPI_REFCLASS_LOCAL or |
237 | * ACPI_REFCLASS_ARG | ||
238 | * Index - Which Local or Arg whose type to get | 238 | * Index - Which Local or Arg whose type to get |
239 | * walk_state - Current walk state object | 239 | * walk_state - Current walk state object |
240 | * Node - Where the node is returned. | 240 | * Node - Where the node is returned. |
@@ -246,7 +246,7 @@ acpi_ds_method_data_init_args(union acpi_operand_object **params, | |||
246 | ******************************************************************************/ | 246 | ******************************************************************************/ |
247 | 247 | ||
248 | acpi_status | 248 | acpi_status |
249 | acpi_ds_method_data_get_node(u16 opcode, | 249 | acpi_ds_method_data_get_node(u8 type, |
250 | u32 index, | 250 | u32 index, |
251 | struct acpi_walk_state *walk_state, | 251 | struct acpi_walk_state *walk_state, |
252 | struct acpi_namespace_node **node) | 252 | struct acpi_namespace_node **node) |
@@ -256,8 +256,8 @@ acpi_ds_method_data_get_node(u16 opcode, | |||
256 | /* | 256 | /* |
257 | * Method Locals and Arguments are supported | 257 | * Method Locals and Arguments are supported |
258 | */ | 258 | */ |
259 | switch (opcode) { | 259 | switch (type) { |
260 | case AML_LOCAL_OP: | 260 | case ACPI_REFCLASS_LOCAL: |
261 | 261 | ||
262 | if (index > ACPI_METHOD_MAX_LOCAL) { | 262 | if (index > ACPI_METHOD_MAX_LOCAL) { |
263 | ACPI_ERROR((AE_INFO, | 263 | ACPI_ERROR((AE_INFO, |
@@ -271,7 +271,7 @@ acpi_ds_method_data_get_node(u16 opcode, | |||
271 | *node = &walk_state->local_variables[index]; | 271 | *node = &walk_state->local_variables[index]; |
272 | break; | 272 | break; |
273 | 273 | ||
274 | case AML_ARG_OP: | 274 | case ACPI_REFCLASS_ARG: |
275 | 275 | ||
276 | if (index > ACPI_METHOD_MAX_ARG) { | 276 | if (index > ACPI_METHOD_MAX_ARG) { |
277 | ACPI_ERROR((AE_INFO, | 277 | ACPI_ERROR((AE_INFO, |
@@ -286,8 +286,8 @@ acpi_ds_method_data_get_node(u16 opcode, | |||
286 | break; | 286 | break; |
287 | 287 | ||
288 | default: | 288 | default: |
289 | ACPI_ERROR((AE_INFO, "Opcode %d is invalid", opcode)); | 289 | ACPI_ERROR((AE_INFO, "Type %d is invalid", type)); |
290 | return_ACPI_STATUS(AE_AML_BAD_OPCODE); | 290 | return_ACPI_STATUS(AE_TYPE); |
291 | } | 291 | } |
292 | 292 | ||
293 | return_ACPI_STATUS(AE_OK); | 293 | return_ACPI_STATUS(AE_OK); |
@@ -297,7 +297,8 @@ acpi_ds_method_data_get_node(u16 opcode, | |||
297 | * | 297 | * |
298 | * FUNCTION: acpi_ds_method_data_set_value | 298 | * FUNCTION: acpi_ds_method_data_set_value |
299 | * | 299 | * |
300 | * PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP | 300 | * PARAMETERS: Type - Either ACPI_REFCLASS_LOCAL or |
301 | * ACPI_REFCLASS_ARG | ||
301 | * Index - Which Local or Arg to get | 302 | * Index - Which Local or Arg to get |
302 | * Object - Object to be inserted into the stack entry | 303 | * Object - Object to be inserted into the stack entry |
303 | * walk_state - Current walk state object | 304 | * walk_state - Current walk state object |
@@ -310,7 +311,7 @@ acpi_ds_method_data_get_node(u16 opcode, | |||
310 | ******************************************************************************/ | 311 | ******************************************************************************/ |
311 | 312 | ||
312 | static acpi_status | 313 | static acpi_status |
313 | acpi_ds_method_data_set_value(u16 opcode, | 314 | acpi_ds_method_data_set_value(u8 type, |
314 | u32 index, | 315 | u32 index, |
315 | union acpi_operand_object *object, | 316 | union acpi_operand_object *object, |
316 | struct acpi_walk_state *walk_state) | 317 | struct acpi_walk_state *walk_state) |
@@ -321,13 +322,13 @@ acpi_ds_method_data_set_value(u16 opcode, | |||
321 | ACPI_FUNCTION_TRACE(ds_method_data_set_value); | 322 | ACPI_FUNCTION_TRACE(ds_method_data_set_value); |
322 | 323 | ||
323 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | 324 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
324 | "NewObj %p Opcode %X, Refs=%d [%s]\n", object, | 325 | "NewObj %p Type %2.2X, Refs=%d [%s]\n", object, |
325 | opcode, object->common.reference_count, | 326 | type, object->common.reference_count, |
326 | acpi_ut_get_type_name(object->common.type))); | 327 | acpi_ut_get_type_name(object->common.type))); |
327 | 328 | ||
328 | /* Get the namespace node for the arg/local */ | 329 | /* Get the namespace node for the arg/local */ |
329 | 330 | ||
330 | status = acpi_ds_method_data_get_node(opcode, index, walk_state, &node); | 331 | status = acpi_ds_method_data_get_node(type, index, walk_state, &node); |
331 | if (ACPI_FAILURE(status)) { | 332 | if (ACPI_FAILURE(status)) { |
332 | return_ACPI_STATUS(status); | 333 | return_ACPI_STATUS(status); |
333 | } | 334 | } |
@@ -350,7 +351,8 @@ acpi_ds_method_data_set_value(u16 opcode, | |||
350 | * | 351 | * |
351 | * FUNCTION: acpi_ds_method_data_get_value | 352 | * FUNCTION: acpi_ds_method_data_get_value |
352 | * | 353 | * |
353 | * PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP | 354 | * PARAMETERS: Type - Either ACPI_REFCLASS_LOCAL or |
355 | * ACPI_REFCLASS_ARG | ||
354 | * Index - Which local_var or argument to get | 356 | * Index - Which local_var or argument to get |
355 | * walk_state - Current walk state object | 357 | * walk_state - Current walk state object |
356 | * dest_desc - Where Arg or Local value is returned | 358 | * dest_desc - Where Arg or Local value is returned |
@@ -363,7 +365,7 @@ acpi_ds_method_data_set_value(u16 opcode, | |||
363 | ******************************************************************************/ | 365 | ******************************************************************************/ |
364 | 366 | ||
365 | acpi_status | 367 | acpi_status |
366 | acpi_ds_method_data_get_value(u16 opcode, | 368 | acpi_ds_method_data_get_value(u8 type, |
367 | u32 index, | 369 | u32 index, |
368 | struct acpi_walk_state *walk_state, | 370 | struct acpi_walk_state *walk_state, |
369 | union acpi_operand_object **dest_desc) | 371 | union acpi_operand_object **dest_desc) |
@@ -383,7 +385,7 @@ acpi_ds_method_data_get_value(u16 opcode, | |||
383 | 385 | ||
384 | /* Get the namespace node for the arg/local */ | 386 | /* Get the namespace node for the arg/local */ |
385 | 387 | ||
386 | status = acpi_ds_method_data_get_node(opcode, index, walk_state, &node); | 388 | status = acpi_ds_method_data_get_node(type, index, walk_state, &node); |
387 | if (ACPI_FAILURE(status)) { | 389 | if (ACPI_FAILURE(status)) { |
388 | return_ACPI_STATUS(status); | 390 | return_ACPI_STATUS(status); |
389 | } | 391 | } |
@@ -419,8 +421,8 @@ acpi_ds_method_data_get_value(u16 opcode, | |||
419 | /* Otherwise, return the error */ | 421 | /* Otherwise, return the error */ |
420 | 422 | ||
421 | else | 423 | else |
422 | switch (opcode) { | 424 | switch (type) { |
423 | case AML_ARG_OP: | 425 | case ACPI_REFCLASS_ARG: |
424 | 426 | ||
425 | ACPI_ERROR((AE_INFO, | 427 | ACPI_ERROR((AE_INFO, |
426 | "Uninitialized Arg[%d] at node %p", | 428 | "Uninitialized Arg[%d] at node %p", |
@@ -428,7 +430,7 @@ acpi_ds_method_data_get_value(u16 opcode, | |||
428 | 430 | ||
429 | return_ACPI_STATUS(AE_AML_UNINITIALIZED_ARG); | 431 | return_ACPI_STATUS(AE_AML_UNINITIALIZED_ARG); |
430 | 432 | ||
431 | case AML_LOCAL_OP: | 433 | case ACPI_REFCLASS_LOCAL: |
432 | 434 | ||
433 | ACPI_ERROR((AE_INFO, | 435 | ACPI_ERROR((AE_INFO, |
434 | "Uninitialized Local[%d] at node %p", | 436 | "Uninitialized Local[%d] at node %p", |
@@ -437,9 +439,10 @@ acpi_ds_method_data_get_value(u16 opcode, | |||
437 | return_ACPI_STATUS(AE_AML_UNINITIALIZED_LOCAL); | 439 | return_ACPI_STATUS(AE_AML_UNINITIALIZED_LOCAL); |
438 | 440 | ||
439 | default: | 441 | default: |
442 | |||
440 | ACPI_ERROR((AE_INFO, | 443 | ACPI_ERROR((AE_INFO, |
441 | "Not a Arg/Local opcode: %X", | 444 | "Not a Arg/Local opcode: %X", |
442 | opcode)); | 445 | type)); |
443 | return_ACPI_STATUS(AE_AML_INTERNAL); | 446 | return_ACPI_STATUS(AE_AML_INTERNAL); |
444 | } | 447 | } |
445 | } | 448 | } |
@@ -458,7 +461,8 @@ acpi_ds_method_data_get_value(u16 opcode, | |||
458 | * | 461 | * |
459 | * FUNCTION: acpi_ds_method_data_delete_value | 462 | * FUNCTION: acpi_ds_method_data_delete_value |
460 | * | 463 | * |
461 | * PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP | 464 | * PARAMETERS: Type - Either ACPI_REFCLASS_LOCAL or |
465 | * ACPI_REFCLASS_ARG | ||
462 | * Index - Which local_var or argument to delete | 466 | * Index - Which local_var or argument to delete |
463 | * walk_state - Current walk state object | 467 | * walk_state - Current walk state object |
464 | * | 468 | * |
@@ -470,7 +474,7 @@ acpi_ds_method_data_get_value(u16 opcode, | |||
470 | ******************************************************************************/ | 474 | ******************************************************************************/ |
471 | 475 | ||
472 | static void | 476 | static void |
473 | acpi_ds_method_data_delete_value(u16 opcode, | 477 | acpi_ds_method_data_delete_value(u8 type, |
474 | u32 index, struct acpi_walk_state *walk_state) | 478 | u32 index, struct acpi_walk_state *walk_state) |
475 | { | 479 | { |
476 | acpi_status status; | 480 | acpi_status status; |
@@ -481,7 +485,7 @@ acpi_ds_method_data_delete_value(u16 opcode, | |||
481 | 485 | ||
482 | /* Get the namespace node for the arg/local */ | 486 | /* Get the namespace node for the arg/local */ |
483 | 487 | ||
484 | status = acpi_ds_method_data_get_node(opcode, index, walk_state, &node); | 488 | status = acpi_ds_method_data_get_node(type, index, walk_state, &node); |
485 | if (ACPI_FAILURE(status)) { | 489 | if (ACPI_FAILURE(status)) { |
486 | return_VOID; | 490 | return_VOID; |
487 | } | 491 | } |
@@ -514,7 +518,8 @@ acpi_ds_method_data_delete_value(u16 opcode, | |||
514 | * | 518 | * |
515 | * FUNCTION: acpi_ds_store_object_to_local | 519 | * FUNCTION: acpi_ds_store_object_to_local |
516 | * | 520 | * |
517 | * PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP | 521 | * PARAMETERS: Type - Either ACPI_REFCLASS_LOCAL or |
522 | * ACPI_REFCLASS_ARG | ||
518 | * Index - Which Local or Arg to set | 523 | * Index - Which Local or Arg to set |
519 | * obj_desc - Value to be stored | 524 | * obj_desc - Value to be stored |
520 | * walk_state - Current walk state | 525 | * walk_state - Current walk state |
@@ -528,7 +533,7 @@ acpi_ds_method_data_delete_value(u16 opcode, | |||
528 | ******************************************************************************/ | 533 | ******************************************************************************/ |
529 | 534 | ||
530 | acpi_status | 535 | acpi_status |
531 | acpi_ds_store_object_to_local(u16 opcode, | 536 | acpi_ds_store_object_to_local(u8 type, |
532 | u32 index, | 537 | u32 index, |
533 | union acpi_operand_object *obj_desc, | 538 | union acpi_operand_object *obj_desc, |
534 | struct acpi_walk_state *walk_state) | 539 | struct acpi_walk_state *walk_state) |
@@ -539,8 +544,8 @@ acpi_ds_store_object_to_local(u16 opcode, | |||
539 | union acpi_operand_object *new_obj_desc; | 544 | union acpi_operand_object *new_obj_desc; |
540 | 545 | ||
541 | ACPI_FUNCTION_TRACE(ds_store_object_to_local); | 546 | ACPI_FUNCTION_TRACE(ds_store_object_to_local); |
542 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Opcode=%X Index=%d Obj=%p\n", | 547 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Type=%2.2X Index=%d Obj=%p\n", |
543 | opcode, index, obj_desc)); | 548 | type, index, obj_desc)); |
544 | 549 | ||
545 | /* Parameter validation */ | 550 | /* Parameter validation */ |
546 | 551 | ||
@@ -550,7 +555,7 @@ acpi_ds_store_object_to_local(u16 opcode, | |||
550 | 555 | ||
551 | /* Get the namespace node for the arg/local */ | 556 | /* Get the namespace node for the arg/local */ |
552 | 557 | ||
553 | status = acpi_ds_method_data_get_node(opcode, index, walk_state, &node); | 558 | status = acpi_ds_method_data_get_node(type, index, walk_state, &node); |
554 | if (ACPI_FAILURE(status)) { | 559 | if (ACPI_FAILURE(status)) { |
555 | return_ACPI_STATUS(status); | 560 | return_ACPI_STATUS(status); |
556 | } | 561 | } |
@@ -602,7 +607,7 @@ acpi_ds_store_object_to_local(u16 opcode, | |||
602 | * | 607 | * |
603 | * Weird, but true. | 608 | * Weird, but true. |
604 | */ | 609 | */ |
605 | if (opcode == AML_ARG_OP) { | 610 | if (type == ACPI_REFCLASS_ARG) { |
606 | /* | 611 | /* |
607 | * If we have a valid reference object that came from ref_of(), | 612 | * If we have a valid reference object that came from ref_of(), |
608 | * do the indirect store | 613 | * do the indirect store |
@@ -611,8 +616,8 @@ acpi_ds_store_object_to_local(u16 opcode, | |||
611 | ACPI_DESC_TYPE_OPERAND) | 616 | ACPI_DESC_TYPE_OPERAND) |
612 | && (current_obj_desc->common.type == | 617 | && (current_obj_desc->common.type == |
613 | ACPI_TYPE_LOCAL_REFERENCE) | 618 | ACPI_TYPE_LOCAL_REFERENCE) |
614 | && (current_obj_desc->reference.opcode == | 619 | && (current_obj_desc->reference.class == |
615 | AML_REF_OF_OP)) { | 620 | ACPI_REFCLASS_REFOF)) { |
616 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | 621 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
617 | "Arg (%p) is an ObjRef(Node), storing in node %p\n", | 622 | "Arg (%p) is an ObjRef(Node), storing in node %p\n", |
618 | new_obj_desc, | 623 | new_obj_desc, |
@@ -640,11 +645,9 @@ acpi_ds_store_object_to_local(u16 opcode, | |||
640 | } | 645 | } |
641 | } | 646 | } |
642 | 647 | ||
643 | /* | 648 | /* Delete the existing object before storing the new one */ |
644 | * Delete the existing object | 649 | |
645 | * before storing the new one | 650 | acpi_ds_method_data_delete_value(type, index, walk_state); |
646 | */ | ||
647 | acpi_ds_method_data_delete_value(opcode, index, walk_state); | ||
648 | } | 651 | } |
649 | 652 | ||
650 | /* | 653 | /* |
@@ -653,7 +656,7 @@ acpi_ds_store_object_to_local(u16 opcode, | |||
653 | * (increments the object reference count by one) | 656 | * (increments the object reference count by one) |
654 | */ | 657 | */ |
655 | status = | 658 | status = |
656 | acpi_ds_method_data_set_value(opcode, index, new_obj_desc, | 659 | acpi_ds_method_data_set_value(type, index, new_obj_desc, |
657 | walk_state); | 660 | walk_state); |
658 | 661 | ||
659 | /* Remove local reference if we copied the object above */ | 662 | /* Remove local reference if we copied the object above */ |
diff --git a/drivers/acpi/dispatcher/dsobject.c b/drivers/acpi/dispatcher/dsobject.c index 0f2805899210..4f08e599d07e 100644 --- a/drivers/acpi/dispatcher/dsobject.c +++ b/drivers/acpi/dispatcher/dsobject.c | |||
@@ -731,54 +731,70 @@ acpi_ds_init_object_from_op(struct acpi_walk_state *walk_state, | |||
731 | switch (op_info->type) { | 731 | switch (op_info->type) { |
732 | case AML_TYPE_LOCAL_VARIABLE: | 732 | case AML_TYPE_LOCAL_VARIABLE: |
733 | 733 | ||
734 | /* Split the opcode into a base opcode + offset */ | 734 | /* Local ID (0-7) is (AML opcode - base AML_LOCAL_OP) */ |
735 | 735 | ||
736 | obj_desc->reference.opcode = AML_LOCAL_OP; | 736 | obj_desc->reference.value = opcode - AML_LOCAL_OP; |
737 | obj_desc->reference.offset = opcode - AML_LOCAL_OP; | 737 | obj_desc->reference.class = ACPI_REFCLASS_LOCAL; |
738 | 738 | ||
739 | #ifndef ACPI_NO_METHOD_EXECUTION | 739 | #ifndef ACPI_NO_METHOD_EXECUTION |
740 | status = acpi_ds_method_data_get_node(AML_LOCAL_OP, | 740 | status = |
741 | obj_desc-> | 741 | acpi_ds_method_data_get_node(ACPI_REFCLASS_LOCAL, |
742 | reference.offset, | 742 | obj_desc->reference. |
743 | walk_state, | 743 | value, walk_state, |
744 | (struct | 744 | ACPI_CAST_INDIRECT_PTR |
745 | acpi_namespace_node | 745 | (struct |
746 | **)&obj_desc-> | 746 | acpi_namespace_node, |
747 | reference.object); | 747 | &obj_desc->reference. |
748 | object)); | ||
748 | #endif | 749 | #endif |
749 | break; | 750 | break; |
750 | 751 | ||
751 | case AML_TYPE_METHOD_ARGUMENT: | 752 | case AML_TYPE_METHOD_ARGUMENT: |
752 | 753 | ||
753 | /* Split the opcode into a base opcode + offset */ | 754 | /* Arg ID (0-6) is (AML opcode - base AML_ARG_OP) */ |
754 | 755 | ||
755 | obj_desc->reference.opcode = AML_ARG_OP; | 756 | obj_desc->reference.value = opcode - AML_ARG_OP; |
756 | obj_desc->reference.offset = opcode - AML_ARG_OP; | 757 | obj_desc->reference.class = ACPI_REFCLASS_ARG; |
757 | 758 | ||
758 | #ifndef ACPI_NO_METHOD_EXECUTION | 759 | #ifndef ACPI_NO_METHOD_EXECUTION |
759 | status = acpi_ds_method_data_get_node(AML_ARG_OP, | 760 | status = acpi_ds_method_data_get_node(ACPI_REFCLASS_ARG, |
760 | obj_desc-> | 761 | obj_desc-> |
761 | reference.offset, | 762 | reference.value, |
762 | walk_state, | 763 | walk_state, |
764 | ACPI_CAST_INDIRECT_PTR | ||
763 | (struct | 765 | (struct |
764 | acpi_namespace_node | 766 | acpi_namespace_node, |
765 | **)&obj_desc-> | 767 | &obj_desc-> |
766 | reference.object); | 768 | reference. |
769 | object)); | ||
767 | #endif | 770 | #endif |
768 | break; | 771 | break; |
769 | 772 | ||
770 | default: /* Other literals, etc.. */ | 773 | default: /* Object name or Debug object */ |
771 | 774 | ||
772 | if (op->common.aml_opcode == AML_INT_NAMEPATH_OP) { | 775 | switch (op->common.aml_opcode) { |
776 | case AML_INT_NAMEPATH_OP: | ||
773 | 777 | ||
774 | /* Node was saved in Op */ | 778 | /* Node was saved in Op */ |
775 | 779 | ||
776 | obj_desc->reference.node = op->common.node; | 780 | obj_desc->reference.node = op->common.node; |
777 | obj_desc->reference.object = | 781 | obj_desc->reference.object = |
778 | op->common.node->object; | 782 | op->common.node->object; |
779 | } | 783 | obj_desc->reference.class = ACPI_REFCLASS_NAME; |
784 | break; | ||
785 | |||
786 | case AML_DEBUG_OP: | ||
780 | 787 | ||
781 | obj_desc->reference.opcode = opcode; | 788 | obj_desc->reference.class = ACPI_REFCLASS_DEBUG; |
789 | break; | ||
790 | |||
791 | default: | ||
792 | |||
793 | ACPI_ERROR((AE_INFO, | ||
794 | "Unimplemented reference type for AML opcode: %4.4X", | ||
795 | opcode)); | ||
796 | return_ACPI_STATUS(AE_AML_OPERAND_TYPE); | ||
797 | } | ||
782 | break; | 798 | break; |
783 | } | 799 | } |
784 | break; | 800 | break; |
diff --git a/drivers/acpi/dispatcher/dsopcode.c b/drivers/acpi/dispatcher/dsopcode.c index 6a81c4400edf..69fae5905bb8 100644 --- a/drivers/acpi/dispatcher/dsopcode.c +++ b/drivers/acpi/dispatcher/dsopcode.c | |||
@@ -1330,7 +1330,7 @@ acpi_ds_exec_end_control_op(struct acpi_walk_state * walk_state, | |||
1330 | (walk_state->results->results.obj_desc[0]) == | 1330 | (walk_state->results->results.obj_desc[0]) == |
1331 | ACPI_TYPE_LOCAL_REFERENCE) | 1331 | ACPI_TYPE_LOCAL_REFERENCE) |
1332 | && ((walk_state->results->results.obj_desc[0])-> | 1332 | && ((walk_state->results->results.obj_desc[0])-> |
1333 | reference.opcode != AML_INDEX_OP)) { | 1333 | reference.class != ACPI_REFCLASS_INDEX)) { |
1334 | status = | 1334 | status = |
1335 | acpi_ex_resolve_to_value(&walk_state-> | 1335 | acpi_ex_resolve_to_value(&walk_state-> |
1336 | results->results. | 1336 | results->results. |
diff --git a/drivers/acpi/dispatcher/dswexec.c b/drivers/acpi/dispatcher/dswexec.c index b5072fa9c920..396fe12078cd 100644 --- a/drivers/acpi/dispatcher/dswexec.c +++ b/drivers/acpi/dispatcher/dswexec.c | |||
@@ -166,6 +166,10 @@ acpi_ds_get_predicate_value(struct acpi_walk_state *walk_state, | |||
166 | status = AE_CTRL_FALSE; | 166 | status = AE_CTRL_FALSE; |
167 | } | 167 | } |
168 | 168 | ||
169 | /* Predicate can be used for an implicit return value */ | ||
170 | |||
171 | (void)acpi_ds_do_implicit_return(local_obj_desc, walk_state, TRUE); | ||
172 | |||
169 | cleanup: | 173 | cleanup: |
170 | 174 | ||
171 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Completed a predicate eval=%X Op=%p\n", | 175 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Completed a predicate eval=%X Op=%p\n", |
@@ -429,10 +433,10 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state) | |||
429 | ACPI_TYPE_LOCAL_REFERENCE) | 433 | ACPI_TYPE_LOCAL_REFERENCE) |
430 | && (walk_state->operands[1]->common.type == | 434 | && (walk_state->operands[1]->common.type == |
431 | ACPI_TYPE_LOCAL_REFERENCE) | 435 | ACPI_TYPE_LOCAL_REFERENCE) |
432 | && (walk_state->operands[0]->reference.opcode == | 436 | && (walk_state->operands[0]->reference.class == |
433 | walk_state->operands[1]->reference.opcode) | 437 | walk_state->operands[1]->reference.class) |
434 | && (walk_state->operands[0]->reference.offset == | 438 | && (walk_state->operands[0]->reference.value == |
435 | walk_state->operands[1]->reference.offset)) { | 439 | walk_state->operands[1]->reference.value)) { |
436 | status = AE_OK; | 440 | status = AE_OK; |
437 | } else { | 441 | } else { |
438 | ACPI_EXCEPTION((AE_INFO, status, | 442 | ACPI_EXCEPTION((AE_INFO, status, |
diff --git a/drivers/acpi/executer/exconfig.c b/drivers/acpi/executer/exconfig.c index 8892b9824fae..74da6fa52ef1 100644 --- a/drivers/acpi/executer/exconfig.c +++ b/drivers/acpi/executer/exconfig.c | |||
@@ -43,7 +43,6 @@ | |||
43 | 43 | ||
44 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
45 | #include <acpi/acinterp.h> | 45 | #include <acpi/acinterp.h> |
46 | #include <acpi/amlcode.h> | ||
47 | #include <acpi/acnamesp.h> | 46 | #include <acpi/acnamesp.h> |
48 | #include <acpi/actables.h> | 47 | #include <acpi/actables.h> |
49 | #include <acpi/acdispat.h> | 48 | #include <acpi/acdispat.h> |
@@ -91,13 +90,12 @@ acpi_ex_add_table(u32 table_index, | |||
91 | 90 | ||
92 | /* Init the table handle */ | 91 | /* Init the table handle */ |
93 | 92 | ||
94 | obj_desc->reference.opcode = AML_LOAD_OP; | 93 | obj_desc->reference.class = ACPI_REFCLASS_TABLE; |
95 | *ddb_handle = obj_desc; | 94 | *ddb_handle = obj_desc; |
96 | 95 | ||
97 | /* Install the new table into the local data structures */ | 96 | /* Install the new table into the local data structures */ |
98 | 97 | ||
99 | obj_desc->reference.object = ACPI_CAST_PTR(void, | 98 | obj_desc->reference.value = table_index; |
100 | (unsigned long)table_index); | ||
101 | 99 | ||
102 | /* Add the table to the namespace */ | 100 | /* Add the table to the namespace */ |
103 | 101 | ||
@@ -280,6 +278,7 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc, | |||
280 | struct acpi_walk_state *walk_state) | 278 | struct acpi_walk_state *walk_state) |
281 | { | 279 | { |
282 | union acpi_operand_object *ddb_handle; | 280 | union acpi_operand_object *ddb_handle; |
281 | struct acpi_table_header *table; | ||
283 | struct acpi_table_desc table_desc; | 282 | struct acpi_table_desc table_desc; |
284 | u32 table_index; | 283 | u32 table_index; |
285 | acpi_status status; | 284 | acpi_status status; |
@@ -294,9 +293,8 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc, | |||
294 | switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { | 293 | switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { |
295 | case ACPI_TYPE_REGION: | 294 | case ACPI_TYPE_REGION: |
296 | 295 | ||
297 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Load from Region %p %s\n", | 296 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
298 | obj_desc, | 297 | "Load table from Region %p\n", obj_desc)); |
299 | acpi_ut_get_object_type_name(obj_desc))); | ||
300 | 298 | ||
301 | /* Region must be system_memory (from ACPI spec) */ | 299 | /* Region must be system_memory (from ACPI spec) */ |
302 | 300 | ||
@@ -316,61 +314,112 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc, | |||
316 | } | 314 | } |
317 | 315 | ||
318 | /* | 316 | /* |
319 | * We will simply map the memory region for the table. However, the | 317 | * Map the table header and get the actual table length. The region |
320 | * memory region is technically not guaranteed to remain stable and | 318 | * length is not guaranteed to be the same as the table length. |
321 | * we may eventually have to copy the table to a local buffer. | 319 | */ |
320 | table = acpi_os_map_memory(obj_desc->region.address, | ||
321 | sizeof(struct acpi_table_header)); | ||
322 | if (!table) { | ||
323 | return_ACPI_STATUS(AE_NO_MEMORY); | ||
324 | } | ||
325 | |||
326 | length = table->length; | ||
327 | acpi_os_unmap_memory(table, sizeof(struct acpi_table_header)); | ||
328 | |||
329 | /* Must have at least an ACPI table header */ | ||
330 | |||
331 | if (length < sizeof(struct acpi_table_header)) { | ||
332 | return_ACPI_STATUS(AE_INVALID_TABLE_LENGTH); | ||
333 | } | ||
334 | |||
335 | /* | ||
336 | * The memory region is not guaranteed to remain stable and we must | ||
337 | * copy the table to a local buffer. For example, the memory region | ||
338 | * is corrupted after suspend on some machines. Dynamically loaded | ||
339 | * tables are usually small, so this overhead is minimal. | ||
322 | */ | 340 | */ |
341 | |||
342 | /* Allocate a buffer for the table */ | ||
343 | |||
344 | table_desc.pointer = ACPI_ALLOCATE(length); | ||
345 | if (!table_desc.pointer) { | ||
346 | return_ACPI_STATUS(AE_NO_MEMORY); | ||
347 | } | ||
348 | |||
349 | /* Map the entire table and copy it */ | ||
350 | |||
351 | table = acpi_os_map_memory(obj_desc->region.address, length); | ||
352 | if (!table) { | ||
353 | ACPI_FREE(table_desc.pointer); | ||
354 | return_ACPI_STATUS(AE_NO_MEMORY); | ||
355 | } | ||
356 | |||
357 | ACPI_MEMCPY(table_desc.pointer, table, length); | ||
358 | acpi_os_unmap_memory(table, length); | ||
359 | |||
323 | table_desc.address = obj_desc->region.address; | 360 | table_desc.address = obj_desc->region.address; |
324 | table_desc.length = obj_desc->region.length; | ||
325 | table_desc.flags = ACPI_TABLE_ORIGIN_MAPPED; | ||
326 | break; | 361 | break; |
327 | 362 | ||
328 | case ACPI_TYPE_BUFFER: /* Buffer or resolved region_field */ | 363 | case ACPI_TYPE_BUFFER: /* Buffer or resolved region_field */ |
329 | 364 | ||
330 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | 365 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
331 | "Load from Buffer or Field %p %s\n", obj_desc, | 366 | "Load table from Buffer or Field %p\n", |
332 | acpi_ut_get_object_type_name(obj_desc))); | 367 | obj_desc)); |
333 | |||
334 | length = obj_desc->buffer.length; | ||
335 | 368 | ||
336 | /* Must have at least an ACPI table header */ | 369 | /* Must have at least an ACPI table header */ |
337 | 370 | ||
338 | if (length < sizeof(struct acpi_table_header)) { | 371 | if (obj_desc->buffer.length < sizeof(struct acpi_table_header)) { |
339 | return_ACPI_STATUS(AE_INVALID_TABLE_LENGTH); | 372 | return_ACPI_STATUS(AE_INVALID_TABLE_LENGTH); |
340 | } | 373 | } |
341 | 374 | ||
342 | /* Validate checksum here. It won't get validated in tb_add_table */ | 375 | /* Get the actual table length from the table header */ |
343 | 376 | ||
344 | status = | 377 | table = |
345 | acpi_tb_verify_checksum(ACPI_CAST_PTR | 378 | ACPI_CAST_PTR(struct acpi_table_header, |
346 | (struct acpi_table_header, | 379 | obj_desc->buffer.pointer); |
347 | obj_desc->buffer.pointer), length); | 380 | length = table->length; |
348 | if (ACPI_FAILURE(status)) { | 381 | |
349 | return_ACPI_STATUS(status); | 382 | /* Table cannot extend beyond the buffer */ |
383 | |||
384 | if (length > obj_desc->buffer.length) { | ||
385 | return_ACPI_STATUS(AE_AML_BUFFER_LIMIT); | ||
386 | } | ||
387 | if (length < sizeof(struct acpi_table_header)) { | ||
388 | return_ACPI_STATUS(AE_INVALID_TABLE_LENGTH); | ||
350 | } | 389 | } |
351 | 390 | ||
352 | /* | 391 | /* |
353 | * We need to copy the buffer since the original buffer could be | 392 | * Copy the table from the buffer because the buffer could be modified |
354 | * changed or deleted in the future | 393 | * or even deleted in the future |
355 | */ | 394 | */ |
356 | table_desc.pointer = ACPI_ALLOCATE(length); | 395 | table_desc.pointer = ACPI_ALLOCATE(length); |
357 | if (!table_desc.pointer) { | 396 | if (!table_desc.pointer) { |
358 | return_ACPI_STATUS(AE_NO_MEMORY); | 397 | return_ACPI_STATUS(AE_NO_MEMORY); |
359 | } | 398 | } |
360 | 399 | ||
361 | ACPI_MEMCPY(table_desc.pointer, obj_desc->buffer.pointer, | 400 | ACPI_MEMCPY(table_desc.pointer, table, length); |
362 | length); | 401 | table_desc.address = ACPI_TO_INTEGER(table_desc.pointer); |
363 | table_desc.length = length; | ||
364 | table_desc.flags = ACPI_TABLE_ORIGIN_ALLOCATED; | ||
365 | break; | 402 | break; |
366 | 403 | ||
367 | default: | 404 | default: |
368 | return_ACPI_STATUS(AE_AML_OPERAND_TYPE); | 405 | return_ACPI_STATUS(AE_AML_OPERAND_TYPE); |
369 | } | 406 | } |
370 | 407 | ||
371 | /* | 408 | /* Validate table checksum (will not get validated in tb_add_table) */ |
372 | * Install the new table into the local data structures | 409 | |
373 | */ | 410 | status = acpi_tb_verify_checksum(table_desc.pointer, length); |
411 | if (ACPI_FAILURE(status)) { | ||
412 | ACPI_FREE(table_desc.pointer); | ||
413 | return_ACPI_STATUS(status); | ||
414 | } | ||
415 | |||
416 | /* Complete the table descriptor */ | ||
417 | |||
418 | table_desc.length = length; | ||
419 | table_desc.flags = ACPI_TABLE_ORIGIN_ALLOCATED; | ||
420 | |||
421 | /* Install the new table into the local data structures */ | ||
422 | |||
374 | status = acpi_tb_add_table(&table_desc, &table_index); | 423 | status = acpi_tb_add_table(&table_desc, &table_index); |
375 | if (ACPI_FAILURE(status)) { | 424 | if (ACPI_FAILURE(status)) { |
376 | goto cleanup; | 425 | goto cleanup; |
@@ -379,7 +428,7 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc, | |||
379 | /* | 428 | /* |
380 | * Add the table to the namespace. | 429 | * Add the table to the namespace. |
381 | * | 430 | * |
382 | * Note: We load the table objects relative to the root of the namespace. | 431 | * Note: Load the table objects relative to the root of the namespace. |
383 | * This appears to go against the ACPI specification, but we do it for | 432 | * This appears to go against the ACPI specification, but we do it for |
384 | * compatibility with other ACPI implementations. | 433 | * compatibility with other ACPI implementations. |
385 | */ | 434 | */ |
@@ -415,7 +464,7 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc, | |||
415 | cleanup: | 464 | cleanup: |
416 | if (ACPI_FAILURE(status)) { | 465 | if (ACPI_FAILURE(status)) { |
417 | 466 | ||
418 | /* Delete allocated buffer or mapping */ | 467 | /* Delete allocated table buffer */ |
419 | 468 | ||
420 | acpi_tb_delete_table(&table_desc); | 469 | acpi_tb_delete_table(&table_desc); |
421 | } | 470 | } |
@@ -455,9 +504,9 @@ acpi_status acpi_ex_unload_table(union acpi_operand_object *ddb_handle) | |||
455 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 504 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
456 | } | 505 | } |
457 | 506 | ||
458 | /* Get the table index from the ddb_handle (acpi_size for 64-bit case) */ | 507 | /* Get the table index from the ddb_handle */ |
459 | 508 | ||
460 | table_index = (u32) (acpi_size) table_desc->reference.object; | 509 | table_index = table_desc->reference.value; |
461 | 510 | ||
462 | /* Invoke table handler if present */ | 511 | /* Invoke table handler if present */ |
463 | 512 | ||
diff --git a/drivers/acpi/executer/exconvrt.c b/drivers/acpi/executer/exconvrt.c index 261d97516d9b..1d1f35adddde 100644 --- a/drivers/acpi/executer/exconvrt.c +++ b/drivers/acpi/executer/exconvrt.c | |||
@@ -57,7 +57,7 @@ acpi_ex_convert_to_ascii(acpi_integer integer, | |||
57 | * | 57 | * |
58 | * FUNCTION: acpi_ex_convert_to_integer | 58 | * FUNCTION: acpi_ex_convert_to_integer |
59 | * | 59 | * |
60 | * PARAMETERS: obj_desc - Object to be converted. Must be an | 60 | * PARAMETERS: obj_desc - Object to be converted. Must be an |
61 | * Integer, Buffer, or String | 61 | * Integer, Buffer, or String |
62 | * result_desc - Where the new Integer object is returned | 62 | * result_desc - Where the new Integer object is returned |
63 | * Flags - Used for string conversion | 63 | * Flags - Used for string conversion |
@@ -103,7 +103,7 @@ acpi_ex_convert_to_integer(union acpi_operand_object *obj_desc, | |||
103 | } | 103 | } |
104 | 104 | ||
105 | /* | 105 | /* |
106 | * Convert the buffer/string to an integer. Note that both buffers and | 106 | * Convert the buffer/string to an integer. Note that both buffers and |
107 | * strings are treated as raw data - we don't convert ascii to hex for | 107 | * strings are treated as raw data - we don't convert ascii to hex for |
108 | * strings. | 108 | * strings. |
109 | * | 109 | * |
@@ -120,7 +120,7 @@ acpi_ex_convert_to_integer(union acpi_operand_object *obj_desc, | |||
120 | 120 | ||
121 | /* | 121 | /* |
122 | * Convert string to an integer - for most cases, the string must be | 122 | * Convert string to an integer - for most cases, the string must be |
123 | * hexadecimal as per the ACPI specification. The only exception (as | 123 | * hexadecimal as per the ACPI specification. The only exception (as |
124 | * of ACPI 3.0) is that the to_integer() operator allows both decimal | 124 | * of ACPI 3.0) is that the to_integer() operator allows both decimal |
125 | * and hexadecimal strings (hex prefixed with "0x"). | 125 | * and hexadecimal strings (hex prefixed with "0x"). |
126 | */ | 126 | */ |
@@ -159,6 +159,7 @@ acpi_ex_convert_to_integer(union acpi_operand_object *obj_desc, | |||
159 | break; | 159 | break; |
160 | 160 | ||
161 | default: | 161 | default: |
162 | |||
162 | /* No other types can get here */ | 163 | /* No other types can get here */ |
163 | break; | 164 | break; |
164 | } | 165 | } |
@@ -185,7 +186,7 @@ acpi_ex_convert_to_integer(union acpi_operand_object *obj_desc, | |||
185 | * | 186 | * |
186 | * FUNCTION: acpi_ex_convert_to_buffer | 187 | * FUNCTION: acpi_ex_convert_to_buffer |
187 | * | 188 | * |
188 | * PARAMETERS: obj_desc - Object to be converted. Must be an | 189 | * PARAMETERS: obj_desc - Object to be converted. Must be an |
189 | * Integer, Buffer, or String | 190 | * Integer, Buffer, or String |
190 | * result_desc - Where the new buffer object is returned | 191 | * result_desc - Where the new buffer object is returned |
191 | * | 192 | * |
@@ -365,7 +366,7 @@ acpi_ex_convert_to_ascii(acpi_integer integer, | |||
365 | } | 366 | } |
366 | 367 | ||
367 | /* | 368 | /* |
368 | * Since leading zeros are supressed, we must check for the case where | 369 | * Since leading zeros are suppressed, we must check for the case where |
369 | * the integer equals 0 | 370 | * the integer equals 0 |
370 | * | 371 | * |
371 | * Finally, null terminate the string and return the length | 372 | * Finally, null terminate the string and return the length |
@@ -383,7 +384,7 @@ acpi_ex_convert_to_ascii(acpi_integer integer, | |||
383 | * | 384 | * |
384 | * FUNCTION: acpi_ex_convert_to_string | 385 | * FUNCTION: acpi_ex_convert_to_string |
385 | * | 386 | * |
386 | * PARAMETERS: obj_desc - Object to be converted. Must be an | 387 | * PARAMETERS: obj_desc - Object to be converted. Must be an |
387 | * Integer, Buffer, or String | 388 | * Integer, Buffer, or String |
388 | * result_desc - Where the string object is returned | 389 | * result_desc - Where the string object is returned |
389 | * Type - String flags (base and conversion type) | 390 | * Type - String flags (base and conversion type) |
@@ -472,7 +473,7 @@ acpi_ex_convert_to_string(union acpi_operand_object * obj_desc, | |||
472 | base = 10; | 473 | base = 10; |
473 | 474 | ||
474 | /* | 475 | /* |
475 | * Calculate the final string length. Individual string values | 476 | * Calculate the final string length. Individual string values |
476 | * are variable length (include separator for each) | 477 | * are variable length (include separator for each) |
477 | */ | 478 | */ |
478 | for (i = 0; i < obj_desc->buffer.length; i++) { | 479 | for (i = 0; i < obj_desc->buffer.length; i++) { |
@@ -511,9 +512,14 @@ acpi_ex_convert_to_string(union acpi_operand_object * obj_desc, | |||
511 | /* | 512 | /* |
512 | * Create a new string object and string buffer | 513 | * Create a new string object and string buffer |
513 | * (-1 because of extra separator included in string_length from above) | 514 | * (-1 because of extra separator included in string_length from above) |
515 | * Allow creation of zero-length strings from zero-length buffers. | ||
514 | */ | 516 | */ |
517 | if (string_length) { | ||
518 | string_length--; | ||
519 | } | ||
520 | |||
515 | return_desc = acpi_ut_create_string_object((acpi_size) | 521 | return_desc = acpi_ut_create_string_object((acpi_size) |
516 | (string_length - 1)); | 522 | string_length); |
517 | if (!return_desc) { | 523 | if (!return_desc) { |
518 | return_ACPI_STATUS(AE_NO_MEMORY); | 524 | return_ACPI_STATUS(AE_NO_MEMORY); |
519 | } | 525 | } |
@@ -536,7 +542,9 @@ acpi_ex_convert_to_string(union acpi_operand_object * obj_desc, | |||
536 | * Null terminate the string | 542 | * Null terminate the string |
537 | * (overwrites final comma/space from above) | 543 | * (overwrites final comma/space from above) |
538 | */ | 544 | */ |
539 | new_buf--; | 545 | if (obj_desc->buffer.length) { |
546 | new_buf--; | ||
547 | } | ||
540 | *new_buf = 0; | 548 | *new_buf = 0; |
541 | break; | 549 | break; |
542 | 550 | ||
@@ -617,7 +625,7 @@ acpi_ex_convert_to_target_type(acpi_object_type destination_type, | |||
617 | case ACPI_TYPE_LOCAL_BANK_FIELD: | 625 | case ACPI_TYPE_LOCAL_BANK_FIELD: |
618 | case ACPI_TYPE_LOCAL_INDEX_FIELD: | 626 | case ACPI_TYPE_LOCAL_INDEX_FIELD: |
619 | /* | 627 | /* |
620 | * These types require an Integer operand. We can convert | 628 | * These types require an Integer operand. We can convert |
621 | * a Buffer or a String to an Integer if necessary. | 629 | * a Buffer or a String to an Integer if necessary. |
622 | */ | 630 | */ |
623 | status = | 631 | status = |
@@ -627,7 +635,7 @@ acpi_ex_convert_to_target_type(acpi_object_type destination_type, | |||
627 | 635 | ||
628 | case ACPI_TYPE_STRING: | 636 | case ACPI_TYPE_STRING: |
629 | /* | 637 | /* |
630 | * The operand must be a String. We can convert an | 638 | * The operand must be a String. We can convert an |
631 | * Integer or Buffer if necessary | 639 | * Integer or Buffer if necessary |
632 | */ | 640 | */ |
633 | status = | 641 | status = |
@@ -637,7 +645,7 @@ acpi_ex_convert_to_target_type(acpi_object_type destination_type, | |||
637 | 645 | ||
638 | case ACPI_TYPE_BUFFER: | 646 | case ACPI_TYPE_BUFFER: |
639 | /* | 647 | /* |
640 | * The operand must be a Buffer. We can convert an | 648 | * The operand must be a Buffer. We can convert an |
641 | * Integer or String if necessary | 649 | * Integer or String if necessary |
642 | */ | 650 | */ |
643 | status = | 651 | status = |
diff --git a/drivers/acpi/executer/exdump.c b/drivers/acpi/executer/exdump.c index 2be2e2bf95bf..d087a7d28aa5 100644 --- a/drivers/acpi/executer/exdump.c +++ b/drivers/acpi/executer/exdump.c | |||
@@ -45,7 +45,6 @@ | |||
45 | #include <acpi/acinterp.h> | 45 | #include <acpi/acinterp.h> |
46 | #include <acpi/amlcode.h> | 46 | #include <acpi/amlcode.h> |
47 | #include <acpi/acnamesp.h> | 47 | #include <acpi/acnamesp.h> |
48 | #include <acpi/acparser.h> | ||
49 | 48 | ||
50 | #define _COMPONENT ACPI_EXECUTER | 49 | #define _COMPONENT ACPI_EXECUTER |
51 | ACPI_MODULE_NAME("exdump") | 50 | ACPI_MODULE_NAME("exdump") |
@@ -214,10 +213,11 @@ static struct acpi_exdump_info acpi_ex_dump_index_field[5] = { | |||
214 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(index_field.data_obj), "Data Object"} | 213 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(index_field.data_obj), "Data Object"} |
215 | }; | 214 | }; |
216 | 215 | ||
217 | static struct acpi_exdump_info acpi_ex_dump_reference[7] = { | 216 | static struct acpi_exdump_info acpi_ex_dump_reference[8] = { |
218 | {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_reference), NULL}, | 217 | {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_reference), NULL}, |
218 | {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(reference.class), "Class"}, | ||
219 | {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(reference.target_type), "Target Type"}, | 219 | {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(reference.target_type), "Target Type"}, |
220 | {ACPI_EXD_UINT32, ACPI_EXD_OFFSET(reference.offset), "Offset"}, | 220 | {ACPI_EXD_UINT32, ACPI_EXD_OFFSET(reference.value), "Value"}, |
221 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(reference.object), "Object Desc"}, | 221 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(reference.object), "Object Desc"}, |
222 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(reference.node), "Node"}, | 222 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(reference.node), "Node"}, |
223 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(reference.where), "Where"}, | 223 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(reference.where), "Where"}, |
@@ -413,10 +413,10 @@ acpi_ex_dump_object(union acpi_operand_object *obj_desc, | |||
413 | 413 | ||
414 | case ACPI_EXD_REFERENCE: | 414 | case ACPI_EXD_REFERENCE: |
415 | 415 | ||
416 | acpi_ex_out_string("Opcode", | 416 | acpi_ex_out_string("Class Name", |
417 | (acpi_ps_get_opcode_info | 417 | (char *) |
418 | (obj_desc->reference.opcode))-> | 418 | acpi_ut_get_reference_name |
419 | name); | 419 | (obj_desc)); |
420 | acpi_ex_dump_reference_obj(obj_desc); | 420 | acpi_ex_dump_reference_obj(obj_desc); |
421 | break; | 421 | break; |
422 | 422 | ||
@@ -494,40 +494,41 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth) | |||
494 | switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { | 494 | switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { |
495 | case ACPI_TYPE_LOCAL_REFERENCE: | 495 | case ACPI_TYPE_LOCAL_REFERENCE: |
496 | 496 | ||
497 | switch (obj_desc->reference.opcode) { | 497 | acpi_os_printf("Reference: [%s] ", |
498 | case AML_DEBUG_OP: | 498 | acpi_ut_get_reference_name(obj_desc)); |
499 | |||
500 | switch (obj_desc->reference.class) { | ||
501 | case ACPI_REFCLASS_DEBUG: | ||
499 | 502 | ||
500 | acpi_os_printf("Reference: Debug\n"); | 503 | acpi_os_printf("\n"); |
501 | break; | 504 | break; |
502 | 505 | ||
503 | case AML_INDEX_OP: | 506 | case ACPI_REFCLASS_INDEX: |
504 | 507 | ||
505 | acpi_os_printf("Reference: Index %p\n", | 508 | acpi_os_printf("%p\n", obj_desc->reference.object); |
506 | obj_desc->reference.object); | ||
507 | break; | 509 | break; |
508 | 510 | ||
509 | case AML_LOAD_OP: | 511 | case ACPI_REFCLASS_TABLE: |
510 | 512 | ||
511 | acpi_os_printf("Reference: [DdbHandle] TableIndex %p\n", | 513 | acpi_os_printf("Table Index %X\n", |
512 | obj_desc->reference.object); | 514 | obj_desc->reference.value); |
513 | break; | 515 | break; |
514 | 516 | ||
515 | case AML_REF_OF_OP: | 517 | case ACPI_REFCLASS_REFOF: |
516 | 518 | ||
517 | acpi_os_printf("Reference: (RefOf) %p [%s]\n", | 519 | acpi_os_printf("%p [%s]\n", obj_desc->reference.object, |
518 | obj_desc->reference.object, | ||
519 | acpi_ut_get_type_name(((union | 520 | acpi_ut_get_type_name(((union |
520 | acpi_operand_object | 521 | acpi_operand_object |
521 | *)obj_desc-> | 522 | *) |
523 | obj_desc-> | ||
522 | reference. | 524 | reference. |
523 | object)->common. | 525 | object)->common. |
524 | type)); | 526 | type)); |
525 | break; | 527 | break; |
526 | 528 | ||
527 | case AML_ARG_OP: | 529 | case ACPI_REFCLASS_ARG: |
528 | 530 | ||
529 | acpi_os_printf("Reference: Arg%d", | 531 | acpi_os_printf("%X", obj_desc->reference.value); |
530 | obj_desc->reference.offset); | ||
531 | 532 | ||
532 | if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) { | 533 | if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) { |
533 | 534 | ||
@@ -542,10 +543,9 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth) | |||
542 | acpi_os_printf("\n"); | 543 | acpi_os_printf("\n"); |
543 | break; | 544 | break; |
544 | 545 | ||
545 | case AML_LOCAL_OP: | 546 | case ACPI_REFCLASS_LOCAL: |
546 | 547 | ||
547 | acpi_os_printf("Reference: Local%d", | 548 | acpi_os_printf("%X", obj_desc->reference.value); |
548 | obj_desc->reference.offset); | ||
549 | 549 | ||
550 | if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) { | 550 | if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) { |
551 | 551 | ||
@@ -560,21 +560,16 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth) | |||
560 | acpi_os_printf("\n"); | 560 | acpi_os_printf("\n"); |
561 | break; | 561 | break; |
562 | 562 | ||
563 | case AML_INT_NAMEPATH_OP: | 563 | case ACPI_REFCLASS_NAME: |
564 | 564 | ||
565 | acpi_os_printf("Reference: Namepath %X [%4.4s]\n", | 565 | acpi_os_printf("- [%4.4s]\n", |
566 | obj_desc->reference.node->name.integer, | ||
567 | obj_desc->reference.node->name.ascii); | 566 | obj_desc->reference.node->name.ascii); |
568 | break; | 567 | break; |
569 | 568 | ||
570 | default: | 569 | default: /* Unknown reference class */ |
571 | |||
572 | /* Unknown opcode */ | ||
573 | 570 | ||
574 | acpi_os_printf("Unknown Reference opcode=%X\n", | 571 | acpi_os_printf("%2.2X\n", obj_desc->reference.class); |
575 | obj_desc->reference.opcode); | ||
576 | break; | 572 | break; |
577 | |||
578 | } | 573 | } |
579 | break; | 574 | break; |
580 | 575 | ||
@@ -865,8 +860,8 @@ static void acpi_ex_dump_reference_obj(union acpi_operand_object *obj_desc) | |||
865 | 860 | ||
866 | ret_buf.length = ACPI_ALLOCATE_LOCAL_BUFFER; | 861 | ret_buf.length = ACPI_ALLOCATE_LOCAL_BUFFER; |
867 | 862 | ||
868 | if (obj_desc->reference.opcode == AML_INT_NAMEPATH_OP) { | 863 | if (obj_desc->reference.class == ACPI_REFCLASS_NAME) { |
869 | acpi_os_printf(" Named Object %p ", obj_desc->reference.node); | 864 | acpi_os_printf(" %p ", obj_desc->reference.node); |
870 | 865 | ||
871 | status = | 866 | status = |
872 | acpi_ns_handle_to_pathname(obj_desc->reference.node, | 867 | acpi_ns_handle_to_pathname(obj_desc->reference.node, |
@@ -882,14 +877,12 @@ static void acpi_ex_dump_reference_obj(union acpi_operand_object *obj_desc) | |||
882 | ACPI_DESC_TYPE_OPERAND) { | 877 | ACPI_DESC_TYPE_OPERAND) { |
883 | acpi_os_printf(" Target: %p", | 878 | acpi_os_printf(" Target: %p", |
884 | obj_desc->reference.object); | 879 | obj_desc->reference.object); |
885 | if (obj_desc->reference.opcode == AML_LOAD_OP) { | 880 | if (obj_desc->reference.class == ACPI_REFCLASS_TABLE) { |
886 | /* | 881 | acpi_os_printf(" Table Index: %X\n", |
887 | * For DDBHandle reference, | 882 | obj_desc->reference.value); |
888 | * obj_desc->Reference.Object is the table index | ||
889 | */ | ||
890 | acpi_os_printf(" [DDBHandle]\n"); | ||
891 | } else { | 883 | } else { |
892 | acpi_os_printf(" [%s]\n", | 884 | acpi_os_printf(" Target: %p [%s]\n", |
885 | obj_desc->reference.object, | ||
893 | acpi_ut_get_type_name(((union | 886 | acpi_ut_get_type_name(((union |
894 | acpi_operand_object | 887 | acpi_operand_object |
895 | *) | 888 | *) |
@@ -988,9 +981,9 @@ acpi_ex_dump_package_obj(union acpi_operand_object *obj_desc, | |||
988 | 981 | ||
989 | case ACPI_TYPE_LOCAL_REFERENCE: | 982 | case ACPI_TYPE_LOCAL_REFERENCE: |
990 | 983 | ||
991 | acpi_os_printf("[Object Reference] %s", | 984 | acpi_os_printf("[Object Reference] Type [%s] %2.2X", |
992 | (acpi_ps_get_opcode_info | 985 | acpi_ut_get_reference_name(obj_desc), |
993 | (obj_desc->reference.opcode))->name); | 986 | obj_desc->reference.class); |
994 | acpi_ex_dump_reference_obj(obj_desc); | 987 | acpi_ex_dump_reference_obj(obj_desc); |
995 | break; | 988 | break; |
996 | 989 | ||
diff --git a/drivers/acpi/executer/exmisc.c b/drivers/acpi/executer/exmisc.c index 731414a581a6..efb191340059 100644 --- a/drivers/acpi/executer/exmisc.c +++ b/drivers/acpi/executer/exmisc.c | |||
@@ -86,10 +86,10 @@ acpi_ex_get_object_reference(union acpi_operand_object *obj_desc, | |||
86 | /* | 86 | /* |
87 | * Must be a reference to a Local or Arg | 87 | * Must be a reference to a Local or Arg |
88 | */ | 88 | */ |
89 | switch (obj_desc->reference.opcode) { | 89 | switch (obj_desc->reference.class) { |
90 | case AML_LOCAL_OP: | 90 | case ACPI_REFCLASS_LOCAL: |
91 | case AML_ARG_OP: | 91 | case ACPI_REFCLASS_ARG: |
92 | case AML_DEBUG_OP: | 92 | case ACPI_REFCLASS_DEBUG: |
93 | 93 | ||
94 | /* The referenced object is the pseudo-node for the local/arg */ | 94 | /* The referenced object is the pseudo-node for the local/arg */ |
95 | 95 | ||
@@ -98,8 +98,8 @@ acpi_ex_get_object_reference(union acpi_operand_object *obj_desc, | |||
98 | 98 | ||
99 | default: | 99 | default: |
100 | 100 | ||
101 | ACPI_ERROR((AE_INFO, "Unknown Reference opcode %X", | 101 | ACPI_ERROR((AE_INFO, "Unknown Reference Class %2.2X", |
102 | obj_desc->reference.opcode)); | 102 | obj_desc->reference.class)); |
103 | return_ACPI_STATUS(AE_AML_INTERNAL); | 103 | return_ACPI_STATUS(AE_AML_INTERNAL); |
104 | } | 104 | } |
105 | break; | 105 | break; |
@@ -127,7 +127,7 @@ acpi_ex_get_object_reference(union acpi_operand_object *obj_desc, | |||
127 | return_ACPI_STATUS(AE_NO_MEMORY); | 127 | return_ACPI_STATUS(AE_NO_MEMORY); |
128 | } | 128 | } |
129 | 129 | ||
130 | reference_obj->reference.opcode = AML_REF_OF_OP; | 130 | reference_obj->reference.class = ACPI_REFCLASS_REFOF; |
131 | reference_obj->reference.object = referenced_obj; | 131 | reference_obj->reference.object = referenced_obj; |
132 | *return_desc = reference_obj; | 132 | *return_desc = reference_obj; |
133 | 133 | ||
diff --git a/drivers/acpi/executer/exoparg1.c b/drivers/acpi/executer/exoparg1.c index 7c3bea575e02..f622f9eac8a1 100644 --- a/drivers/acpi/executer/exoparg1.c +++ b/drivers/acpi/executer/exoparg1.c | |||
@@ -825,16 +825,16 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) | |||
825 | * | 825 | * |
826 | * Must resolve/dereference the local/arg reference first | 826 | * Must resolve/dereference the local/arg reference first |
827 | */ | 827 | */ |
828 | switch (operand[0]->reference.opcode) { | 828 | switch (operand[0]->reference.class) { |
829 | case AML_LOCAL_OP: | 829 | case ACPI_REFCLASS_LOCAL: |
830 | case AML_ARG_OP: | 830 | case ACPI_REFCLASS_ARG: |
831 | 831 | ||
832 | /* Set Operand[0] to the value of the local/arg */ | 832 | /* Set Operand[0] to the value of the local/arg */ |
833 | 833 | ||
834 | status = | 834 | status = |
835 | acpi_ds_method_data_get_value | 835 | acpi_ds_method_data_get_value |
836 | (operand[0]->reference.opcode, | 836 | (operand[0]->reference.class, |
837 | operand[0]->reference.offset, | 837 | operand[0]->reference.value, |
838 | walk_state, &temp_desc); | 838 | walk_state, &temp_desc); |
839 | if (ACPI_FAILURE(status)) { | 839 | if (ACPI_FAILURE(status)) { |
840 | goto cleanup; | 840 | goto cleanup; |
@@ -848,7 +848,7 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) | |||
848 | operand[0] = temp_desc; | 848 | operand[0] = temp_desc; |
849 | break; | 849 | break; |
850 | 850 | ||
851 | case AML_REF_OF_OP: | 851 | case ACPI_REFCLASS_REFOF: |
852 | 852 | ||
853 | /* Get the object to which the reference refers */ | 853 | /* Get the object to which the reference refers */ |
854 | 854 | ||
@@ -928,8 +928,8 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) | |||
928 | * This must be a reference object produced by either the | 928 | * This must be a reference object produced by either the |
929 | * Index() or ref_of() operator | 929 | * Index() or ref_of() operator |
930 | */ | 930 | */ |
931 | switch (operand[0]->reference.opcode) { | 931 | switch (operand[0]->reference.class) { |
932 | case AML_INDEX_OP: | 932 | case ACPI_REFCLASS_INDEX: |
933 | 933 | ||
934 | /* | 934 | /* |
935 | * The target type for the Index operator must be | 935 | * The target type for the Index operator must be |
@@ -965,7 +965,7 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) | |||
965 | return_desc->integer.value = | 965 | return_desc->integer.value = |
966 | temp_desc->buffer. | 966 | temp_desc->buffer. |
967 | pointer[operand[0]->reference. | 967 | pointer[operand[0]->reference. |
968 | offset]; | 968 | value]; |
969 | break; | 969 | break; |
970 | 970 | ||
971 | case ACPI_TYPE_PACKAGE: | 971 | case ACPI_TYPE_PACKAGE: |
@@ -985,7 +985,7 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) | |||
985 | default: | 985 | default: |
986 | 986 | ||
987 | ACPI_ERROR((AE_INFO, | 987 | ACPI_ERROR((AE_INFO, |
988 | "Unknown Index TargetType %X in obj %p", | 988 | "Unknown Index TargetType %X in reference object %p", |
989 | operand[0]->reference. | 989 | operand[0]->reference. |
990 | target_type, operand[0])); | 990 | target_type, operand[0])); |
991 | status = AE_AML_OPERAND_TYPE; | 991 | status = AE_AML_OPERAND_TYPE; |
@@ -993,7 +993,7 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) | |||
993 | } | 993 | } |
994 | break; | 994 | break; |
995 | 995 | ||
996 | case AML_REF_OF_OP: | 996 | case ACPI_REFCLASS_REFOF: |
997 | 997 | ||
998 | return_desc = operand[0]->reference.object; | 998 | return_desc = operand[0]->reference.object; |
999 | 999 | ||
@@ -1013,9 +1013,9 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) | |||
1013 | 1013 | ||
1014 | default: | 1014 | default: |
1015 | ACPI_ERROR((AE_INFO, | 1015 | ACPI_ERROR((AE_INFO, |
1016 | "Unknown opcode in reference(%p) - %X", | 1016 | "Unknown class in reference(%p) - %2.2X", |
1017 | operand[0], | 1017 | operand[0], |
1018 | operand[0]->reference.opcode)); | 1018 | operand[0]->reference.class)); |
1019 | 1019 | ||
1020 | status = AE_TYPE; | 1020 | status = AE_TYPE; |
1021 | goto cleanup; | 1021 | goto cleanup; |
diff --git a/drivers/acpi/executer/exoparg2.c b/drivers/acpi/executer/exoparg2.c index 8e8bbb6ccebd..368def5dffce 100644 --- a/drivers/acpi/executer/exoparg2.c +++ b/drivers/acpi/executer/exoparg2.c | |||
@@ -391,8 +391,8 @@ acpi_status acpi_ex_opcode_2A_1T_1R(struct acpi_walk_state *walk_state) | |||
391 | /* Initialize the Index reference object */ | 391 | /* Initialize the Index reference object */ |
392 | 392 | ||
393 | index = operand[1]->integer.value; | 393 | index = operand[1]->integer.value; |
394 | return_desc->reference.offset = (u32) index; | 394 | return_desc->reference.value = (u32) index; |
395 | return_desc->reference.opcode = AML_INDEX_OP; | 395 | return_desc->reference.class = ACPI_REFCLASS_INDEX; |
396 | 396 | ||
397 | /* | 397 | /* |
398 | * At this point, the Source operand is a String, Buffer, or Package. | 398 | * At this point, the Source operand is a String, Buffer, or Package. |
diff --git a/drivers/acpi/executer/exresnte.c b/drivers/acpi/executer/exresnte.c index 5596f42c9676..423ad3635f3d 100644 --- a/drivers/acpi/executer/exresnte.c +++ b/drivers/acpi/executer/exresnte.c | |||
@@ -46,8 +46,6 @@ | |||
46 | #include <acpi/acdispat.h> | 46 | #include <acpi/acdispat.h> |
47 | #include <acpi/acinterp.h> | 47 | #include <acpi/acinterp.h> |
48 | #include <acpi/acnamesp.h> | 48 | #include <acpi/acnamesp.h> |
49 | #include <acpi/acparser.h> | ||
50 | #include <acpi/amlcode.h> | ||
51 | 49 | ||
52 | #define _COMPONENT ACPI_EXECUTER | 50 | #define _COMPONENT ACPI_EXECUTER |
53 | ACPI_MODULE_NAME("exresnte") | 51 | ACPI_MODULE_NAME("exresnte") |
@@ -238,10 +236,10 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr, | |||
238 | 236 | ||
239 | case ACPI_TYPE_LOCAL_REFERENCE: | 237 | case ACPI_TYPE_LOCAL_REFERENCE: |
240 | 238 | ||
241 | switch (source_desc->reference.opcode) { | 239 | switch (source_desc->reference.class) { |
242 | case AML_LOAD_OP: /* This is a ddb_handle */ | 240 | case ACPI_REFCLASS_TABLE: /* This is a ddb_handle */ |
243 | case AML_REF_OF_OP: | 241 | case ACPI_REFCLASS_REFOF: |
244 | case AML_INDEX_OP: | 242 | case ACPI_REFCLASS_INDEX: |
245 | 243 | ||
246 | /* Return an additional reference to the object */ | 244 | /* Return an additional reference to the object */ |
247 | 245 | ||
@@ -253,10 +251,8 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr, | |||
253 | /* No named references are allowed here */ | 251 | /* No named references are allowed here */ |
254 | 252 | ||
255 | ACPI_ERROR((AE_INFO, | 253 | ACPI_ERROR((AE_INFO, |
256 | "Unsupported Reference opcode %X (%s)", | 254 | "Unsupported Reference type %X", |
257 | source_desc->reference.opcode, | 255 | source_desc->reference.class)); |
258 | acpi_ps_get_opcode_name(source_desc-> | ||
259 | reference.opcode))); | ||
260 | 256 | ||
261 | return_ACPI_STATUS(AE_AML_OPERAND_TYPE); | 257 | return_ACPI_STATUS(AE_AML_OPERAND_TYPE); |
262 | } | 258 | } |
diff --git a/drivers/acpi/executer/exresolv.c b/drivers/acpi/executer/exresolv.c index b35f7c817acf..89571b92a522 100644 --- a/drivers/acpi/executer/exresolv.c +++ b/drivers/acpi/executer/exresolv.c | |||
@@ -47,7 +47,6 @@ | |||
47 | #include <acpi/acdispat.h> | 47 | #include <acpi/acdispat.h> |
48 | #include <acpi/acinterp.h> | 48 | #include <acpi/acinterp.h> |
49 | #include <acpi/acnamesp.h> | 49 | #include <acpi/acnamesp.h> |
50 | #include <acpi/acparser.h> | ||
51 | 50 | ||
52 | #define _COMPONENT ACPI_EXECUTER | 51 | #define _COMPONENT ACPI_EXECUTER |
53 | ACPI_MODULE_NAME("exresolv") | 52 | ACPI_MODULE_NAME("exresolv") |
@@ -141,7 +140,7 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr, | |||
141 | acpi_status status = AE_OK; | 140 | acpi_status status = AE_OK; |
142 | union acpi_operand_object *stack_desc; | 141 | union acpi_operand_object *stack_desc; |
143 | union acpi_operand_object *obj_desc = NULL; | 142 | union acpi_operand_object *obj_desc = NULL; |
144 | u16 opcode; | 143 | u8 ref_type; |
145 | 144 | ||
146 | ACPI_FUNCTION_TRACE(ex_resolve_object_to_value); | 145 | ACPI_FUNCTION_TRACE(ex_resolve_object_to_value); |
147 | 146 | ||
@@ -152,19 +151,19 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr, | |||
152 | switch (ACPI_GET_OBJECT_TYPE(stack_desc)) { | 151 | switch (ACPI_GET_OBJECT_TYPE(stack_desc)) { |
153 | case ACPI_TYPE_LOCAL_REFERENCE: | 152 | case ACPI_TYPE_LOCAL_REFERENCE: |
154 | 153 | ||
155 | opcode = stack_desc->reference.opcode; | 154 | ref_type = stack_desc->reference.class; |
156 | 155 | ||
157 | switch (opcode) { | 156 | switch (ref_type) { |
158 | case AML_LOCAL_OP: | 157 | case ACPI_REFCLASS_LOCAL: |
159 | case AML_ARG_OP: | 158 | case ACPI_REFCLASS_ARG: |
160 | 159 | ||
161 | /* | 160 | /* |
162 | * Get the local from the method's state info | 161 | * Get the local from the method's state info |
163 | * Note: this increments the local's object reference count | 162 | * Note: this increments the local's object reference count |
164 | */ | 163 | */ |
165 | status = acpi_ds_method_data_get_value(opcode, | 164 | status = acpi_ds_method_data_get_value(ref_type, |
166 | stack_desc-> | 165 | stack_desc-> |
167 | reference.offset, | 166 | reference.value, |
168 | walk_state, | 167 | walk_state, |
169 | &obj_desc); | 168 | &obj_desc); |
170 | if (ACPI_FAILURE(status)) { | 169 | if (ACPI_FAILURE(status)) { |
@@ -173,7 +172,7 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr, | |||
173 | 172 | ||
174 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | 173 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
175 | "[Arg/Local %X] ValueObj is %p\n", | 174 | "[Arg/Local %X] ValueObj is %p\n", |
176 | stack_desc->reference.offset, | 175 | stack_desc->reference.value, |
177 | obj_desc)); | 176 | obj_desc)); |
178 | 177 | ||
179 | /* | 178 | /* |
@@ -184,7 +183,7 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr, | |||
184 | *stack_ptr = obj_desc; | 183 | *stack_ptr = obj_desc; |
185 | break; | 184 | break; |
186 | 185 | ||
187 | case AML_INDEX_OP: | 186 | case ACPI_REFCLASS_INDEX: |
188 | 187 | ||
189 | switch (stack_desc->reference.target_type) { | 188 | switch (stack_desc->reference.target_type) { |
190 | case ACPI_TYPE_BUFFER_FIELD: | 189 | case ACPI_TYPE_BUFFER_FIELD: |
@@ -239,15 +238,15 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr, | |||
239 | } | 238 | } |
240 | break; | 239 | break; |
241 | 240 | ||
242 | case AML_REF_OF_OP: | 241 | case ACPI_REFCLASS_REFOF: |
243 | case AML_DEBUG_OP: | 242 | case ACPI_REFCLASS_DEBUG: |
244 | case AML_LOAD_OP: | 243 | case ACPI_REFCLASS_TABLE: |
245 | 244 | ||
246 | /* Just leave the object as-is, do not dereference */ | 245 | /* Just leave the object as-is, do not dereference */ |
247 | 246 | ||
248 | break; | 247 | break; |
249 | 248 | ||
250 | case AML_INT_NAMEPATH_OP: /* Reference to a named object */ | 249 | case ACPI_REFCLASS_NAME: /* Reference to a named object */ |
251 | 250 | ||
252 | /* Dereference the name */ | 251 | /* Dereference the name */ |
253 | 252 | ||
@@ -273,8 +272,7 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr, | |||
273 | default: | 272 | default: |
274 | 273 | ||
275 | ACPI_ERROR((AE_INFO, | 274 | ACPI_ERROR((AE_INFO, |
276 | "Unknown Reference opcode %X (%s) in %p", | 275 | "Unknown Reference type %X in %p", ref_type, |
277 | opcode, acpi_ps_get_opcode_name(opcode), | ||
278 | stack_desc)); | 276 | stack_desc)); |
279 | status = AE_AML_INTERNAL; | 277 | status = AE_AML_INTERNAL; |
280 | break; | 278 | break; |
@@ -388,13 +386,13 @@ acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state, | |||
388 | * traversing the list of possibly many nested references. | 386 | * traversing the list of possibly many nested references. |
389 | */ | 387 | */ |
390 | while (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_LOCAL_REFERENCE) { | 388 | while (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_LOCAL_REFERENCE) { |
391 | switch (obj_desc->reference.opcode) { | 389 | switch (obj_desc->reference.class) { |
392 | case AML_REF_OF_OP: | 390 | case ACPI_REFCLASS_REFOF: |
393 | case AML_INT_NAMEPATH_OP: | 391 | case ACPI_REFCLASS_NAME: |
394 | 392 | ||
395 | /* Dereference the reference pointer */ | 393 | /* Dereference the reference pointer */ |
396 | 394 | ||
397 | if (obj_desc->reference.opcode == AML_REF_OF_OP) { | 395 | if (obj_desc->reference.class == ACPI_REFCLASS_REFOF) { |
398 | node = obj_desc->reference.object; | 396 | node = obj_desc->reference.object; |
399 | } else { /* AML_INT_NAMEPATH_OP */ | 397 | } else { /* AML_INT_NAMEPATH_OP */ |
400 | 398 | ||
@@ -429,7 +427,7 @@ acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state, | |||
429 | } | 427 | } |
430 | break; | 428 | break; |
431 | 429 | ||
432 | case AML_INDEX_OP: | 430 | case ACPI_REFCLASS_INDEX: |
433 | 431 | ||
434 | /* Get the type of this reference (index into another object) */ | 432 | /* Get the type of this reference (index into another object) */ |
435 | 433 | ||
@@ -455,22 +453,22 @@ acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state, | |||
455 | } | 453 | } |
456 | break; | 454 | break; |
457 | 455 | ||
458 | case AML_LOAD_OP: | 456 | case ACPI_REFCLASS_TABLE: |
459 | 457 | ||
460 | type = ACPI_TYPE_DDB_HANDLE; | 458 | type = ACPI_TYPE_DDB_HANDLE; |
461 | goto exit; | 459 | goto exit; |
462 | 460 | ||
463 | case AML_LOCAL_OP: | 461 | case ACPI_REFCLASS_LOCAL: |
464 | case AML_ARG_OP: | 462 | case ACPI_REFCLASS_ARG: |
465 | 463 | ||
466 | if (return_desc) { | 464 | if (return_desc) { |
467 | status = | 465 | status = |
468 | acpi_ds_method_data_get_value(obj_desc-> | 466 | acpi_ds_method_data_get_value(obj_desc-> |
469 | reference. | 467 | reference. |
470 | opcode, | 468 | class, |
471 | obj_desc-> | 469 | obj_desc-> |
472 | reference. | 470 | reference. |
473 | offset, | 471 | value, |
474 | walk_state, | 472 | walk_state, |
475 | &obj_desc); | 473 | &obj_desc); |
476 | if (ACPI_FAILURE(status)) { | 474 | if (ACPI_FAILURE(status)) { |
@@ -481,10 +479,10 @@ acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state, | |||
481 | status = | 479 | status = |
482 | acpi_ds_method_data_get_node(obj_desc-> | 480 | acpi_ds_method_data_get_node(obj_desc-> |
483 | reference. | 481 | reference. |
484 | opcode, | 482 | class, |
485 | obj_desc-> | 483 | obj_desc-> |
486 | reference. | 484 | reference. |
487 | offset, | 485 | value, |
488 | walk_state, | 486 | walk_state, |
489 | &node); | 487 | &node); |
490 | if (ACPI_FAILURE(status)) { | 488 | if (ACPI_FAILURE(status)) { |
@@ -499,7 +497,7 @@ acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state, | |||
499 | } | 497 | } |
500 | break; | 498 | break; |
501 | 499 | ||
502 | case AML_DEBUG_OP: | 500 | case ACPI_REFCLASS_DEBUG: |
503 | 501 | ||
504 | /* The Debug Object is of type "DebugObject" */ | 502 | /* The Debug Object is of type "DebugObject" */ |
505 | 503 | ||
@@ -509,8 +507,8 @@ acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state, | |||
509 | default: | 507 | default: |
510 | 508 | ||
511 | ACPI_ERROR((AE_INFO, | 509 | ACPI_ERROR((AE_INFO, |
512 | "Unknown Reference subtype %X", | 510 | "Unknown Reference Class %2.2X", |
513 | obj_desc->reference.opcode)); | 511 | obj_desc->reference.class)); |
514 | return_ACPI_STATUS(AE_AML_INTERNAL); | 512 | return_ACPI_STATUS(AE_AML_INTERNAL); |
515 | } | 513 | } |
516 | } | 514 | } |
diff --git a/drivers/acpi/executer/exresop.c b/drivers/acpi/executer/exresop.c index 54085f16ec28..0bb82593da72 100644 --- a/drivers/acpi/executer/exresop.c +++ b/drivers/acpi/executer/exresop.c | |||
@@ -225,41 +225,36 @@ acpi_ex_resolve_operands(u16 opcode, | |||
225 | 225 | ||
226 | if (object_type == (u8) ACPI_TYPE_LOCAL_REFERENCE) { | 226 | if (object_type == (u8) ACPI_TYPE_LOCAL_REFERENCE) { |
227 | 227 | ||
228 | /* Decode the Reference */ | 228 | /* Validate the Reference */ |
229 | 229 | ||
230 | op_info = acpi_ps_get_opcode_info(opcode); | 230 | switch (obj_desc->reference.class) { |
231 | if (op_info->class == AML_CLASS_UNKNOWN) { | 231 | case ACPI_REFCLASS_DEBUG: |
232 | return_ACPI_STATUS(AE_AML_BAD_OPCODE); | ||
233 | } | ||
234 | 232 | ||
235 | switch (obj_desc->reference.opcode) { | ||
236 | case AML_DEBUG_OP: | ||
237 | target_op = AML_DEBUG_OP; | 233 | target_op = AML_DEBUG_OP; |
238 | 234 | ||
239 | /*lint -fallthrough */ | 235 | /*lint -fallthrough */ |
240 | 236 | ||
241 | case AML_INDEX_OP: | 237 | case ACPI_REFCLASS_ARG: |
242 | case AML_REF_OF_OP: | 238 | case ACPI_REFCLASS_LOCAL: |
243 | case AML_ARG_OP: | 239 | case ACPI_REFCLASS_INDEX: |
244 | case AML_LOCAL_OP: | 240 | case ACPI_REFCLASS_REFOF: |
245 | case AML_LOAD_OP: /* ddb_handle from LOAD_OP or LOAD_TABLE_OP */ | 241 | case ACPI_REFCLASS_TABLE: /* ddb_handle from LOAD_OP or LOAD_TABLE_OP */ |
246 | case AML_INT_NAMEPATH_OP: /* Reference to a named object */ | 242 | case ACPI_REFCLASS_NAME: /* Reference to a named object */ |
247 | 243 | ||
248 | ACPI_DEBUG_ONLY_MEMBERS(ACPI_DEBUG_PRINT | 244 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
249 | ((ACPI_DB_EXEC, | 245 | "Operand is a Reference, Class [%s] %2.2X\n", |
250 | "Operand is a Reference, RefOpcode [%s]\n", | 246 | acpi_ut_get_reference_name |
251 | (acpi_ps_get_opcode_info | 247 | (obj_desc), |
252 | (obj_desc-> | 248 | obj_desc->reference. |
253 | reference. | 249 | class)); |
254 | opcode))-> | ||
255 | name))); | ||
256 | break; | 250 | break; |
257 | 251 | ||
258 | default: | 252 | default: |
253 | |||
259 | ACPI_ERROR((AE_INFO, | 254 | ACPI_ERROR((AE_INFO, |
260 | "Operand is a Reference, Unknown Reference Opcode: %X", | 255 | "Unknown Reference Class %2.2X in %p", |
261 | obj_desc->reference. | 256 | obj_desc->reference.class, |
262 | opcode)); | 257 | obj_desc)); |
263 | 258 | ||
264 | return_ACPI_STATUS(AE_AML_OPERAND_TYPE); | 259 | return_ACPI_STATUS(AE_AML_OPERAND_TYPE); |
265 | } | 260 | } |
@@ -270,8 +265,7 @@ acpi_ex_resolve_operands(u16 opcode, | |||
270 | 265 | ||
271 | /* Invalid descriptor */ | 266 | /* Invalid descriptor */ |
272 | 267 | ||
273 | ACPI_ERROR((AE_INFO, | 268 | ACPI_ERROR((AE_INFO, "Invalid descriptor %p [%s]", |
274 | "Invalid descriptor %p [%s]", | ||
275 | obj_desc, | 269 | obj_desc, |
276 | acpi_ut_get_descriptor_name(obj_desc))); | 270 | acpi_ut_get_descriptor_name(obj_desc))); |
277 | 271 | ||
@@ -343,7 +337,7 @@ acpi_ex_resolve_operands(u16 opcode, | |||
343 | if ((opcode == AML_STORE_OP) && | 337 | if ((opcode == AML_STORE_OP) && |
344 | (ACPI_GET_OBJECT_TYPE(*stack_ptr) == | 338 | (ACPI_GET_OBJECT_TYPE(*stack_ptr) == |
345 | ACPI_TYPE_LOCAL_REFERENCE) | 339 | ACPI_TYPE_LOCAL_REFERENCE) |
346 | && ((*stack_ptr)->reference.opcode == AML_INDEX_OP)) { | 340 | && ((*stack_ptr)->reference.class == ACPI_REFCLASS_INDEX)) { |
347 | goto next_operand; | 341 | goto next_operand; |
348 | } | 342 | } |
349 | break; | 343 | break; |
diff --git a/drivers/acpi/executer/exstore.c b/drivers/acpi/executer/exstore.c index 38b55e352495..3318df4cbd98 100644 --- a/drivers/acpi/executer/exstore.c +++ b/drivers/acpi/executer/exstore.c | |||
@@ -47,7 +47,6 @@ | |||
47 | #include <acpi/acinterp.h> | 47 | #include <acpi/acinterp.h> |
48 | #include <acpi/amlcode.h> | 48 | #include <acpi/amlcode.h> |
49 | #include <acpi/acnamesp.h> | 49 | #include <acpi/acnamesp.h> |
50 | #include <acpi/acparser.h> | ||
51 | 50 | ||
52 | #define _COMPONENT ACPI_EXECUTER | 51 | #define _COMPONENT ACPI_EXECUTER |
53 | ACPI_MODULE_NAME("exstore") | 52 | ACPI_MODULE_NAME("exstore") |
@@ -179,22 +178,26 @@ acpi_ex_do_debug_object(union acpi_operand_object *source_desc, | |||
179 | 178 | ||
180 | case ACPI_TYPE_LOCAL_REFERENCE: | 179 | case ACPI_TYPE_LOCAL_REFERENCE: |
181 | 180 | ||
182 | if (source_desc->reference.opcode == AML_INDEX_OP) { | 181 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "[%s] ", |
183 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, | 182 | acpi_ut_get_reference_name(source_desc))); |
184 | "[%s, 0x%X]\n", | 183 | |
185 | acpi_ps_get_opcode_name | 184 | /* Decode the reference */ |
186 | (source_desc->reference.opcode), | 185 | |
187 | source_desc->reference.offset)); | 186 | switch (source_desc->reference.class) { |
188 | } else { | 187 | case ACPI_REFCLASS_INDEX: |
189 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "[%s]", | 188 | |
190 | acpi_ps_get_opcode_name | 189 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "0x%X\n", |
191 | (source_desc->reference.opcode))); | 190 | source_desc->reference.value)); |
192 | } | 191 | break; |
192 | |||
193 | case ACPI_REFCLASS_TABLE: | ||
193 | 194 | ||
194 | if (source_desc->reference.opcode == AML_LOAD_OP) { /* Load and load_table */ | ||
195 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, | 195 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, |
196 | " Table OwnerId %p\n", | 196 | "Table Index 0x%X\n", |
197 | source_desc->reference.object)); | 197 | source_desc->reference.value)); |
198 | break; | ||
199 | |||
200 | default: | ||
198 | break; | 201 | break; |
199 | } | 202 | } |
200 | 203 | ||
@@ -347,15 +350,15 @@ acpi_ex_store(union acpi_operand_object *source_desc, | |||
347 | } | 350 | } |
348 | 351 | ||
349 | /* | 352 | /* |
350 | * Examine the Reference opcode. These cases are handled: | 353 | * Examine the Reference class. These cases are handled: |
351 | * | 354 | * |
352 | * 1) Store to Name (Change the object associated with a name) | 355 | * 1) Store to Name (Change the object associated with a name) |
353 | * 2) Store to an indexed area of a Buffer or Package | 356 | * 2) Store to an indexed area of a Buffer or Package |
354 | * 3) Store to a Method Local or Arg | 357 | * 3) Store to a Method Local or Arg |
355 | * 4) Store to the debug object | 358 | * 4) Store to the debug object |
356 | */ | 359 | */ |
357 | switch (ref_desc->reference.opcode) { | 360 | switch (ref_desc->reference.class) { |
358 | case AML_REF_OF_OP: | 361 | case ACPI_REFCLASS_REFOF: |
359 | 362 | ||
360 | /* Storing an object into a Name "container" */ | 363 | /* Storing an object into a Name "container" */ |
361 | 364 | ||
@@ -365,7 +368,7 @@ acpi_ex_store(union acpi_operand_object *source_desc, | |||
365 | ACPI_IMPLICIT_CONVERSION); | 368 | ACPI_IMPLICIT_CONVERSION); |
366 | break; | 369 | break; |
367 | 370 | ||
368 | case AML_INDEX_OP: | 371 | case ACPI_REFCLASS_INDEX: |
369 | 372 | ||
370 | /* Storing to an Index (pointer into a packager or buffer) */ | 373 | /* Storing to an Index (pointer into a packager or buffer) */ |
371 | 374 | ||
@@ -374,18 +377,18 @@ acpi_ex_store(union acpi_operand_object *source_desc, | |||
374 | walk_state); | 377 | walk_state); |
375 | break; | 378 | break; |
376 | 379 | ||
377 | case AML_LOCAL_OP: | 380 | case ACPI_REFCLASS_LOCAL: |
378 | case AML_ARG_OP: | 381 | case ACPI_REFCLASS_ARG: |
379 | 382 | ||
380 | /* Store to a method local/arg */ | 383 | /* Store to a method local/arg */ |
381 | 384 | ||
382 | status = | 385 | status = |
383 | acpi_ds_store_object_to_local(ref_desc->reference.opcode, | 386 | acpi_ds_store_object_to_local(ref_desc->reference.class, |
384 | ref_desc->reference.offset, | 387 | ref_desc->reference.value, |
385 | source_desc, walk_state); | 388 | source_desc, walk_state); |
386 | break; | 389 | break; |
387 | 390 | ||
388 | case AML_DEBUG_OP: | 391 | case ACPI_REFCLASS_DEBUG: |
389 | 392 | ||
390 | /* | 393 | /* |
391 | * Storing to the Debug object causes the value stored to be | 394 | * Storing to the Debug object causes the value stored to be |
@@ -401,9 +404,9 @@ acpi_ex_store(union acpi_operand_object *source_desc, | |||
401 | 404 | ||
402 | default: | 405 | default: |
403 | 406 | ||
404 | ACPI_ERROR((AE_INFO, "Unknown Reference opcode %X", | 407 | ACPI_ERROR((AE_INFO, "Unknown Reference Class %2.2X", |
405 | ref_desc->reference.opcode)); | 408 | ref_desc->reference.class)); |
406 | ACPI_DUMP_ENTRY(ref_desc, ACPI_LV_ERROR); | 409 | ACPI_DUMP_ENTRY(ref_desc, ACPI_LV_INFO); |
407 | 410 | ||
408 | status = AE_AML_INTERNAL; | 411 | status = AE_AML_INTERNAL; |
409 | break; | 412 | break; |
@@ -458,7 +461,7 @@ acpi_ex_store_object_to_index(union acpi_operand_object *source_desc, | |||
458 | 461 | ||
459 | if (ACPI_GET_OBJECT_TYPE(source_desc) == | 462 | if (ACPI_GET_OBJECT_TYPE(source_desc) == |
460 | ACPI_TYPE_LOCAL_REFERENCE | 463 | ACPI_TYPE_LOCAL_REFERENCE |
461 | && source_desc->reference.opcode == AML_LOAD_OP) { | 464 | && source_desc->reference.class == ACPI_REFCLASS_TABLE) { |
462 | 465 | ||
463 | /* This is a DDBHandle, just add a reference to it */ | 466 | /* This is a DDBHandle, just add a reference to it */ |
464 | 467 | ||
@@ -553,7 +556,7 @@ acpi_ex_store_object_to_index(union acpi_operand_object *source_desc, | |||
553 | 556 | ||
554 | /* Store the source value into the target buffer byte */ | 557 | /* Store the source value into the target buffer byte */ |
555 | 558 | ||
556 | obj_desc->buffer.pointer[index_desc->reference.offset] = value; | 559 | obj_desc->buffer.pointer[index_desc->reference.value] = value; |
557 | break; | 560 | break; |
558 | 561 | ||
559 | default: | 562 | default: |
diff --git a/drivers/acpi/executer/exstoren.c b/drivers/acpi/executer/exstoren.c index a6d2168b81f9..eef61a00803e 100644 --- a/drivers/acpi/executer/exstoren.c +++ b/drivers/acpi/executer/exstoren.c | |||
@@ -121,7 +121,8 @@ acpi_ex_resolve_object(union acpi_operand_object **source_desc_ptr, | |||
121 | (ACPI_GET_OBJECT_TYPE(source_desc) != ACPI_TYPE_STRING) && | 121 | (ACPI_GET_OBJECT_TYPE(source_desc) != ACPI_TYPE_STRING) && |
122 | !((ACPI_GET_OBJECT_TYPE(source_desc) == | 122 | !((ACPI_GET_OBJECT_TYPE(source_desc) == |
123 | ACPI_TYPE_LOCAL_REFERENCE) | 123 | ACPI_TYPE_LOCAL_REFERENCE) |
124 | && (source_desc->reference.opcode == AML_LOAD_OP))) { | 124 | && (source_desc->reference.class == |
125 | ACPI_REFCLASS_TABLE))) { | ||
125 | 126 | ||
126 | /* Conversion successful but still not a valid type */ | 127 | /* Conversion successful but still not a valid type */ |
127 | 128 | ||
diff --git a/drivers/acpi/fan.c b/drivers/acpi/fan.c index 2655bc1b4eeb..dfc0486ffaff 100644 --- a/drivers/acpi/fan.c +++ b/drivers/acpi/fan.c | |||
@@ -327,8 +327,8 @@ static int acpi_fan_resume(struct acpi_device *device) | |||
327 | 327 | ||
328 | result = acpi_bus_get_power(device->handle, &power_state); | 328 | result = acpi_bus_get_power(device->handle, &power_state); |
329 | if (result) { | 329 | if (result) { |
330 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 330 | printk(KERN_ERR PREFIX |
331 | "Error reading fan power state\n")); | 331 | "Error reading fan power state\n"); |
332 | return result; | 332 | return result; |
333 | } | 333 | } |
334 | 334 | ||
diff --git a/drivers/acpi/namespace/Makefile b/drivers/acpi/namespace/Makefile index 3f63d3640696..371a2daf837f 100644 --- a/drivers/acpi/namespace/Makefile +++ b/drivers/acpi/namespace/Makefile | |||
@@ -5,7 +5,7 @@ | |||
5 | obj-y := nsaccess.o nsload.o nssearch.o nsxfeval.o \ | 5 | obj-y := nsaccess.o nsload.o nssearch.o nsxfeval.o \ |
6 | nsalloc.o nseval.o nsnames.o nsutils.o nsxfname.o \ | 6 | nsalloc.o nseval.o nsnames.o nsutils.o nsxfname.o \ |
7 | nsdump.o nsinit.o nsobject.o nswalk.o nsxfobj.o \ | 7 | nsdump.o nsinit.o nsobject.o nswalk.o nsxfobj.o \ |
8 | nsparse.o | 8 | nsparse.o nspredef.o |
9 | 9 | ||
10 | obj-$(ACPI_FUTURE_USAGE) += nsdumpdv.o | 10 | obj-$(ACPI_FUTURE_USAGE) += nsdumpdv.o |
11 | 11 | ||
diff --git a/drivers/acpi/namespace/nsdump.c b/drivers/acpi/namespace/nsdump.c index 0ab22004728a..cc0ae39440e4 100644 --- a/drivers/acpi/namespace/nsdump.c +++ b/drivers/acpi/namespace/nsdump.c | |||
@@ -43,7 +43,6 @@ | |||
43 | 43 | ||
44 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
45 | #include <acpi/acnamesp.h> | 45 | #include <acpi/acnamesp.h> |
46 | #include <acpi/acparser.h> | ||
47 | 46 | ||
48 | #define _COMPONENT ACPI_NAMESPACE | 47 | #define _COMPONENT ACPI_NAMESPACE |
49 | ACPI_MODULE_NAME("nsdump") | 48 | ACPI_MODULE_NAME("nsdump") |
@@ -334,9 +333,7 @@ acpi_ns_dump_one_object(acpi_handle obj_handle, | |||
334 | case ACPI_TYPE_LOCAL_REFERENCE: | 333 | case ACPI_TYPE_LOCAL_REFERENCE: |
335 | 334 | ||
336 | acpi_os_printf("[%s]\n", | 335 | acpi_os_printf("[%s]\n", |
337 | acpi_ps_get_opcode_name(obj_desc-> | 336 | acpi_ut_get_reference_name(obj_desc)); |
338 | reference. | ||
339 | opcode)); | ||
340 | break; | 337 | break; |
341 | 338 | ||
342 | case ACPI_TYPE_BUFFER_FIELD: | 339 | case ACPI_TYPE_BUFFER_FIELD: |
diff --git a/drivers/acpi/namespace/nseval.c b/drivers/acpi/namespace/nseval.c index d369164e00b0..4cdf03ac2b46 100644 --- a/drivers/acpi/namespace/nseval.c +++ b/drivers/acpi/namespace/nseval.c | |||
@@ -78,6 +78,7 @@ ACPI_MODULE_NAME("nseval") | |||
78 | acpi_status acpi_ns_evaluate(struct acpi_evaluate_info * info) | 78 | acpi_status acpi_ns_evaluate(struct acpi_evaluate_info * info) |
79 | { | 79 | { |
80 | acpi_status status; | 80 | acpi_status status; |
81 | struct acpi_namespace_node *node; | ||
81 | 82 | ||
82 | ACPI_FUNCTION_TRACE(ns_evaluate); | 83 | ACPI_FUNCTION_TRACE(ns_evaluate); |
83 | 84 | ||
@@ -117,6 +118,8 @@ acpi_status acpi_ns_evaluate(struct acpi_evaluate_info * info) | |||
117 | info->resolved_node, | 118 | info->resolved_node, |
118 | acpi_ns_get_attached_object(info->resolved_node))); | 119 | acpi_ns_get_attached_object(info->resolved_node))); |
119 | 120 | ||
121 | node = info->resolved_node; | ||
122 | |||
120 | /* | 123 | /* |
121 | * Two major cases here: | 124 | * Two major cases here: |
122 | * | 125 | * |
@@ -148,21 +151,22 @@ acpi_status acpi_ns_evaluate(struct acpi_evaluate_info * info) | |||
148 | info->param_count++; | 151 | info->param_count++; |
149 | } | 152 | } |
150 | 153 | ||
151 | /* Error if too few arguments were passed in */ | 154 | /* |
155 | * Warning if too few or too many arguments have been passed by the | ||
156 | * caller. We don't want to abort here with an error because an | ||
157 | * incorrect number of arguments may not cause the method to fail. | ||
158 | * However, the method will fail if there are too few arguments passed | ||
159 | * and the method attempts to use one of the missing ones. | ||
160 | */ | ||
152 | 161 | ||
153 | if (info->param_count < info->obj_desc->method.param_count) { | 162 | if (info->param_count < info->obj_desc->method.param_count) { |
154 | ACPI_ERROR((AE_INFO, | 163 | ACPI_WARNING((AE_INFO, |
155 | "Insufficient arguments - " | 164 | "Insufficient arguments - " |
156 | "method [%4.4s] needs %d, found %d", | 165 | "method [%4.4s] needs %d, found %d", |
157 | acpi_ut_get_node_name(info->resolved_node), | 166 | acpi_ut_get_node_name(info->resolved_node), |
158 | info->obj_desc->method.param_count, | 167 | info->obj_desc->method.param_count, |
159 | info->param_count)); | 168 | info->param_count)); |
160 | return_ACPI_STATUS(AE_MISSING_ARGUMENTS); | 169 | } else if (info->param_count > |
161 | } | ||
162 | |||
163 | /* Just a warning if too many arguments */ | ||
164 | |||
165 | else if (info->param_count > | ||
166 | info->obj_desc->method.param_count) { | 170 | info->obj_desc->method.param_count) { |
167 | ACPI_WARNING((AE_INFO, | 171 | ACPI_WARNING((AE_INFO, |
168 | "Excess arguments - " | 172 | "Excess arguments - " |
@@ -195,7 +199,28 @@ acpi_status acpi_ns_evaluate(struct acpi_evaluate_info * info) | |||
195 | } else { | 199 | } else { |
196 | /* | 200 | /* |
197 | * 2) Object is not a method, return its current value | 201 | * 2) Object is not a method, return its current value |
202 | * | ||
203 | * Disallow certain object types. For these, "evaluation" is undefined. | ||
198 | */ | 204 | */ |
205 | switch (info->resolved_node->type) { | ||
206 | case ACPI_TYPE_DEVICE: | ||
207 | case ACPI_TYPE_EVENT: | ||
208 | case ACPI_TYPE_MUTEX: | ||
209 | case ACPI_TYPE_REGION: | ||
210 | case ACPI_TYPE_THERMAL: | ||
211 | case ACPI_TYPE_LOCAL_SCOPE: | ||
212 | |||
213 | ACPI_ERROR((AE_INFO, | ||
214 | "[%4.4s] Evaluation of object type [%s] is not supported", | ||
215 | info->resolved_node->name.ascii, | ||
216 | acpi_ut_get_type_name(info->resolved_node-> | ||
217 | type))); | ||
218 | |||
219 | return_ACPI_STATUS(AE_TYPE); | ||
220 | |||
221 | default: | ||
222 | break; | ||
223 | } | ||
199 | 224 | ||
200 | /* | 225 | /* |
201 | * Objects require additional resolution steps (e.g., the Node may be | 226 | * Objects require additional resolution steps (e.g., the Node may be |
@@ -239,9 +264,35 @@ acpi_status acpi_ns_evaluate(struct acpi_evaluate_info * info) | |||
239 | } | 264 | } |
240 | } | 265 | } |
241 | 266 | ||
242 | /* | 267 | /* Validation of return values for ACPI-predefined methods and objects */ |
243 | * Check if there is a return value that must be dealt with | 268 | |
244 | */ | 269 | if ((status == AE_OK) || (status == AE_CTRL_RETURN_VALUE)) { |
270 | /* | ||
271 | * If this is the first evaluation, check the return value. This | ||
272 | * ensures that any warnings will only be emitted during the very | ||
273 | * first evaluation of the object. | ||
274 | */ | ||
275 | if (!(node->flags & ANOBJ_EVALUATED)) { | ||
276 | /* | ||
277 | * Check for a predefined ACPI name. If found, validate the | ||
278 | * returned object. | ||
279 | * | ||
280 | * Note: Ignore return status for now, emit warnings if there are | ||
281 | * problems with the returned object. May change later to abort | ||
282 | * the method on invalid return object. | ||
283 | */ | ||
284 | (void)acpi_ns_check_predefined_names(node, | ||
285 | info-> | ||
286 | return_object); | ||
287 | } | ||
288 | |||
289 | /* Mark the node as having been evaluated */ | ||
290 | |||
291 | node->flags |= ANOBJ_EVALUATED; | ||
292 | } | ||
293 | |||
294 | /* Check if there is a return value that must be dealt with */ | ||
295 | |||
245 | if (status == AE_CTRL_RETURN_VALUE) { | 296 | if (status == AE_CTRL_RETURN_VALUE) { |
246 | 297 | ||
247 | /* If caller does not want the return value, delete it */ | 298 | /* If caller does not want the return value, delete it */ |
diff --git a/drivers/acpi/namespace/nsnames.c b/drivers/acpi/namespace/nsnames.c index bd5773878009..42a39a7c96e9 100644 --- a/drivers/acpi/namespace/nsnames.c +++ b/drivers/acpi/namespace/nsnames.c | |||
@@ -115,7 +115,6 @@ acpi_ns_build_external_path(struct acpi_namespace_node *node, | |||
115 | return (AE_OK); | 115 | return (AE_OK); |
116 | } | 116 | } |
117 | 117 | ||
118 | #ifdef ACPI_DEBUG_OUTPUT | ||
119 | /******************************************************************************* | 118 | /******************************************************************************* |
120 | * | 119 | * |
121 | * FUNCTION: acpi_ns_get_external_pathname | 120 | * FUNCTION: acpi_ns_get_external_pathname |
@@ -142,7 +141,7 @@ char *acpi_ns_get_external_pathname(struct acpi_namespace_node *node) | |||
142 | 141 | ||
143 | size = acpi_ns_get_pathname_length(node); | 142 | size = acpi_ns_get_pathname_length(node); |
144 | if (!size) { | 143 | if (!size) { |
145 | return (NULL); | 144 | return_PTR(NULL); |
146 | } | 145 | } |
147 | 146 | ||
148 | /* Allocate a buffer to be returned to caller */ | 147 | /* Allocate a buffer to be returned to caller */ |
@@ -157,12 +156,12 @@ char *acpi_ns_get_external_pathname(struct acpi_namespace_node *node) | |||
157 | 156 | ||
158 | status = acpi_ns_build_external_path(node, size, name_buffer); | 157 | status = acpi_ns_build_external_path(node, size, name_buffer); |
159 | if (ACPI_FAILURE(status)) { | 158 | if (ACPI_FAILURE(status)) { |
160 | return (NULL); | 159 | ACPI_FREE(name_buffer); |
160 | return_PTR(NULL); | ||
161 | } | 161 | } |
162 | 162 | ||
163 | return_PTR(name_buffer); | 163 | return_PTR(name_buffer); |
164 | } | 164 | } |
165 | #endif | ||
166 | 165 | ||
167 | /******************************************************************************* | 166 | /******************************************************************************* |
168 | * | 167 | * |
diff --git a/drivers/acpi/namespace/nspredef.c b/drivers/acpi/namespace/nspredef.c new file mode 100644 index 000000000000..0f17cf0898c9 --- /dev/null +++ b/drivers/acpi/namespace/nspredef.c | |||
@@ -0,0 +1,900 @@ | |||
1 | /****************************************************************************** | ||
2 | * | ||
3 | * Module Name: nspredef - Validation of ACPI predefined methods and objects | ||
4 | * $Revision: 1.1 $ | ||
5 | * | ||
6 | *****************************************************************************/ | ||
7 | |||
8 | /* | ||
9 | * Copyright (C) 2000 - 2008, Intel Corp. | ||
10 | * All rights reserved. | ||
11 | * | ||
12 | * Redistribution and use in source and binary forms, with or without | ||
13 | * modification, are permitted provided that the following conditions | ||
14 | * are met: | ||
15 | * 1. Redistributions of source code must retain the above copyright | ||
16 | * notice, this list of conditions, and the following disclaimer, | ||
17 | * without modification. | ||
18 | * 2. Redistributions in binary form must reproduce at minimum a disclaimer | ||
19 | * substantially similar to the "NO WARRANTY" disclaimer below | ||
20 | * ("Disclaimer") and any redistribution must be conditioned upon | ||
21 | * including a substantially similar Disclaimer requirement for further | ||
22 | * binary redistribution. | ||
23 | * 3. Neither the names of the above-listed copyright holders nor the names | ||
24 | * of any contributors may be used to endorse or promote products derived | ||
25 | * from this software without specific prior written permission. | ||
26 | * | ||
27 | * Alternatively, this software may be distributed under the terms of the | ||
28 | * GNU General Public License ("GPL") version 2 as published by the Free | ||
29 | * Software Foundation. | ||
30 | * | ||
31 | * NO WARRANTY | ||
32 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
33 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
34 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR | ||
35 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
36 | * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
37 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
38 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
39 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
40 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | ||
41 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
42 | * POSSIBILITY OF SUCH DAMAGES. | ||
43 | */ | ||
44 | |||
45 | #include <acpi/acpi.h> | ||
46 | #include <acpi/acnamesp.h> | ||
47 | #include <acpi/acpredef.h> | ||
48 | |||
49 | #define _COMPONENT ACPI_NAMESPACE | ||
50 | ACPI_MODULE_NAME("nspredef") | ||
51 | |||
52 | /******************************************************************************* | ||
53 | * | ||
54 | * This module validates predefined ACPI objects that appear in the namespace, | ||
55 | * at the time they are evaluated (via acpi_evaluate_object). The purpose of this | ||
56 | * validation is to detect problems with BIOS-exposed predefined ACPI objects | ||
57 | * before the results are returned to the ACPI-related drivers. | ||
58 | * | ||
59 | * There are several areas that are validated: | ||
60 | * | ||
61 | * 1) The number of input arguments as defined by the method/object in the | ||
62 | * ASL is validated against the ACPI specification. | ||
63 | * 2) The type of the return object (if any) is validated against the ACPI | ||
64 | * specification. | ||
65 | * 3) For returned package objects, the count of package elements is | ||
66 | * validated, as well as the type of each package element. Nested | ||
67 | * packages are supported. | ||
68 | * | ||
69 | * For any problems found, a warning message is issued. | ||
70 | * | ||
71 | ******************************************************************************/ | ||
72 | /* Local prototypes */ | ||
73 | static acpi_status | ||
74 | acpi_ns_check_package(char *pathname, | ||
75 | union acpi_operand_object *return_object, | ||
76 | const union acpi_predefined_info *predefined); | ||
77 | |||
78 | static acpi_status | ||
79 | acpi_ns_check_package_elements(char *pathname, | ||
80 | union acpi_operand_object **elements, | ||
81 | u8 type1, u32 count1, u8 type2, u32 count2); | ||
82 | |||
83 | static acpi_status | ||
84 | acpi_ns_check_object_type(char *pathname, | ||
85 | union acpi_operand_object *return_object, | ||
86 | u32 expected_btypes, u32 package_index); | ||
87 | |||
88 | static acpi_status | ||
89 | acpi_ns_check_reference(char *pathname, | ||
90 | union acpi_operand_object *return_object); | ||
91 | |||
92 | /* | ||
93 | * Names for the types that can be returned by the predefined objects. | ||
94 | * Used for warning messages. Must be in the same order as the ACPI_RTYPEs | ||
95 | */ | ||
96 | static const char *acpi_rtype_names[] = { | ||
97 | "/Integer", | ||
98 | "/String", | ||
99 | "/Buffer", | ||
100 | "/Package", | ||
101 | "/Reference", | ||
102 | }; | ||
103 | |||
104 | #define ACPI_NOT_PACKAGE ACPI_UINT32_MAX | ||
105 | |||
106 | /******************************************************************************* | ||
107 | * | ||
108 | * FUNCTION: acpi_ns_check_predefined_names | ||
109 | * | ||
110 | * PARAMETERS: Node - Namespace node for the method/object | ||
111 | * return_object - Object returned from the evaluation of this | ||
112 | * method/object | ||
113 | * | ||
114 | * RETURN: Status | ||
115 | * | ||
116 | * DESCRIPTION: Check an ACPI name for a match in the predefined name list. | ||
117 | * | ||
118 | ******************************************************************************/ | ||
119 | |||
120 | acpi_status | ||
121 | acpi_ns_check_predefined_names(struct acpi_namespace_node *node, | ||
122 | union acpi_operand_object *return_object) | ||
123 | { | ||
124 | acpi_status status = AE_OK; | ||
125 | const union acpi_predefined_info *predefined; | ||
126 | char *pathname; | ||
127 | |||
128 | /* Match the name for this method/object against the predefined list */ | ||
129 | |||
130 | predefined = acpi_ns_check_for_predefined_name(node); | ||
131 | if (!predefined) { | ||
132 | |||
133 | /* Name was not one of the predefined names */ | ||
134 | |||
135 | return (AE_OK); | ||
136 | } | ||
137 | |||
138 | /* Get the full pathname to the object, for use in error messages */ | ||
139 | |||
140 | pathname = acpi_ns_get_external_pathname(node); | ||
141 | if (!pathname) { | ||
142 | pathname = ACPI_CAST_PTR(char, predefined->info.name); | ||
143 | } | ||
144 | |||
145 | /* | ||
146 | * Check that the parameter count for this method is in accordance | ||
147 | * with the ACPI specification. | ||
148 | */ | ||
149 | acpi_ns_check_parameter_count(pathname, node, predefined); | ||
150 | |||
151 | /* | ||
152 | * If there is no return value, check if we require a return value for | ||
153 | * this predefined name. Either one return value is expected, or none, | ||
154 | * for both methods and other objects. | ||
155 | * | ||
156 | * Exit now if there is no return object. Warning if one was expected. | ||
157 | */ | ||
158 | if (!return_object) { | ||
159 | if ((predefined->info.expected_btypes) && | ||
160 | (!(predefined->info.expected_btypes & ACPI_RTYPE_NONE))) { | ||
161 | ACPI_ERROR((AE_INFO, | ||
162 | "%s: Missing expected return value", | ||
163 | pathname)); | ||
164 | |||
165 | status = AE_AML_NO_RETURN_VALUE; | ||
166 | } | ||
167 | goto exit; | ||
168 | } | ||
169 | |||
170 | /* | ||
171 | * We have a return value, but if one wasn't expected, just exit, this is | ||
172 | * not a problem | ||
173 | * | ||
174 | * For example, if "Implicit return value" is enabled, methods will | ||
175 | * always return a value | ||
176 | */ | ||
177 | if (!predefined->info.expected_btypes) { | ||
178 | goto exit; | ||
179 | } | ||
180 | |||
181 | /* | ||
182 | * Check that the type of the return object is what is expected for | ||
183 | * this predefined name | ||
184 | */ | ||
185 | status = acpi_ns_check_object_type(pathname, return_object, | ||
186 | predefined->info.expected_btypes, | ||
187 | ACPI_NOT_PACKAGE); | ||
188 | if (ACPI_FAILURE(status)) { | ||
189 | goto exit; | ||
190 | } | ||
191 | |||
192 | /* For returned Package objects, check the type of all sub-objects */ | ||
193 | |||
194 | if (ACPI_GET_OBJECT_TYPE(return_object) == ACPI_TYPE_PACKAGE) { | ||
195 | status = | ||
196 | acpi_ns_check_package(pathname, return_object, predefined); | ||
197 | } | ||
198 | |||
199 | exit: | ||
200 | if (pathname) { | ||
201 | ACPI_FREE(pathname); | ||
202 | } | ||
203 | |||
204 | return (status); | ||
205 | } | ||
206 | |||
207 | /******************************************************************************* | ||
208 | * | ||
209 | * FUNCTION: acpi_ns_check_parameter_count | ||
210 | * | ||
211 | * PARAMETERS: Pathname - Full pathname to the node (for error msgs) | ||
212 | * Node - Namespace node for the method/object | ||
213 | * Predefined - Pointer to entry in predefined name table | ||
214 | * | ||
215 | * RETURN: None | ||
216 | * | ||
217 | * DESCRIPTION: Check that the declared (in ASL/AML) parameter count for a | ||
218 | * predefined name is what is expected (i.e., what is defined in | ||
219 | * the ACPI specification for this predefined name.) | ||
220 | * | ||
221 | ******************************************************************************/ | ||
222 | |||
223 | void | ||
224 | acpi_ns_check_parameter_count(char *pathname, | ||
225 | struct acpi_namespace_node *node, | ||
226 | const union acpi_predefined_info *predefined) | ||
227 | { | ||
228 | u32 param_count; | ||
229 | u32 required_params_current; | ||
230 | u32 required_params_old; | ||
231 | |||
232 | /* | ||
233 | * Check that the ASL-defined parameter count is what is expected for | ||
234 | * this predefined name. | ||
235 | * | ||
236 | * Methods have 0-7 parameters. All other types have zero. | ||
237 | */ | ||
238 | param_count = 0; | ||
239 | if (node->type == ACPI_TYPE_METHOD) { | ||
240 | param_count = node->object->method.param_count; | ||
241 | } | ||
242 | |||
243 | /* Validate parameter count - allow two different legal counts (_SCP) */ | ||
244 | |||
245 | required_params_current = predefined->info.param_count & 0x0F; | ||
246 | required_params_old = predefined->info.param_count >> 4; | ||
247 | |||
248 | if ((param_count != required_params_current) && | ||
249 | (param_count != required_params_old)) { | ||
250 | ACPI_WARNING((AE_INFO, | ||
251 | "%s: Parameter count mismatch - ASL declared %d, expected %d", | ||
252 | pathname, param_count, required_params_current)); | ||
253 | } | ||
254 | } | ||
255 | |||
256 | /******************************************************************************* | ||
257 | * | ||
258 | * FUNCTION: acpi_ns_check_for_predefined_name | ||
259 | * | ||
260 | * PARAMETERS: Node - Namespace node for the method/object | ||
261 | * | ||
262 | * RETURN: Pointer to entry in predefined table. NULL indicates not found. | ||
263 | * | ||
264 | * DESCRIPTION: Check an object name against the predefined object list. | ||
265 | * | ||
266 | ******************************************************************************/ | ||
267 | |||
268 | const union acpi_predefined_info *acpi_ns_check_for_predefined_name(struct | ||
269 | acpi_namespace_node | ||
270 | *node) | ||
271 | { | ||
272 | const union acpi_predefined_info *this_name; | ||
273 | |||
274 | /* Quick check for a predefined name, first character must be underscore */ | ||
275 | |||
276 | if (node->name.ascii[0] != '_') { | ||
277 | return (NULL); | ||
278 | } | ||
279 | |||
280 | /* Search info table for a predefined method/object name */ | ||
281 | |||
282 | this_name = predefined_names; | ||
283 | while (this_name->info.name[0]) { | ||
284 | if (ACPI_COMPARE_NAME(node->name.ascii, this_name->info.name)) { | ||
285 | |||
286 | /* Return pointer to this table entry */ | ||
287 | |||
288 | return (this_name); | ||
289 | } | ||
290 | |||
291 | /* | ||
292 | * Skip next entry in the table if this name returns a Package | ||
293 | * (next entry contains the package info) | ||
294 | */ | ||
295 | if (this_name->info.expected_btypes & ACPI_RTYPE_PACKAGE) { | ||
296 | this_name++; | ||
297 | } | ||
298 | |||
299 | this_name++; | ||
300 | } | ||
301 | |||
302 | return (NULL); | ||
303 | } | ||
304 | |||
305 | /******************************************************************************* | ||
306 | * | ||
307 | * FUNCTION: acpi_ns_check_package | ||
308 | * | ||
309 | * PARAMETERS: Pathname - Full pathname to the node (for error msgs) | ||
310 | * return_object - Object returned from the evaluation of a | ||
311 | * method or object | ||
312 | * Predefined - Pointer to entry in predefined name table | ||
313 | * | ||
314 | * RETURN: Status | ||
315 | * | ||
316 | * DESCRIPTION: Check a returned package object for the correct count and | ||
317 | * correct type of all sub-objects. | ||
318 | * | ||
319 | ******************************************************************************/ | ||
320 | |||
321 | static acpi_status | ||
322 | acpi_ns_check_package(char *pathname, | ||
323 | union acpi_operand_object *return_object, | ||
324 | const union acpi_predefined_info *predefined) | ||
325 | { | ||
326 | const union acpi_predefined_info *package; | ||
327 | union acpi_operand_object *sub_package; | ||
328 | union acpi_operand_object **elements; | ||
329 | union acpi_operand_object **sub_elements; | ||
330 | acpi_status status; | ||
331 | u32 expected_count; | ||
332 | u32 count; | ||
333 | u32 i; | ||
334 | u32 j; | ||
335 | |||
336 | ACPI_FUNCTION_NAME(ns_check_package); | ||
337 | |||
338 | /* The package info for this name is in the next table entry */ | ||
339 | |||
340 | package = predefined + 1; | ||
341 | |||
342 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, | ||
343 | "%s Validating return Package of Type %X, Count %X\n", | ||
344 | pathname, package->ret_info.type, | ||
345 | return_object->package.count)); | ||
346 | |||
347 | /* Extract package count and elements array */ | ||
348 | |||
349 | elements = return_object->package.elements; | ||
350 | count = return_object->package.count; | ||
351 | |||
352 | /* The package must have at least one element, else invalid */ | ||
353 | |||
354 | if (!count) { | ||
355 | ACPI_WARNING((AE_INFO, | ||
356 | "%s: Return Package has no elements (empty)", | ||
357 | pathname)); | ||
358 | |||
359 | return (AE_AML_OPERAND_VALUE); | ||
360 | } | ||
361 | |||
362 | /* | ||
363 | * Decode the type of the expected package contents | ||
364 | * | ||
365 | * PTYPE1 packages contain no subpackages | ||
366 | * PTYPE2 packages contain sub-packages | ||
367 | */ | ||
368 | switch (package->ret_info.type) { | ||
369 | case ACPI_PTYPE1_FIXED: | ||
370 | |||
371 | /* | ||
372 | * The package count is fixed and there are no sub-packages | ||
373 | * | ||
374 | * If package is too small, exit. | ||
375 | * If package is larger than expected, issue warning but continue | ||
376 | */ | ||
377 | expected_count = | ||
378 | package->ret_info.count1 + package->ret_info.count2; | ||
379 | if (count < expected_count) { | ||
380 | goto package_too_small; | ||
381 | } else if (count > expected_count) { | ||
382 | ACPI_WARNING((AE_INFO, | ||
383 | "%s: Return Package is larger than needed - " | ||
384 | "found %u, expected %u", pathname, count, | ||
385 | expected_count)); | ||
386 | } | ||
387 | |||
388 | /* Validate all elements of the returned package */ | ||
389 | |||
390 | status = acpi_ns_check_package_elements(pathname, elements, | ||
391 | package->ret_info. | ||
392 | object_type1, | ||
393 | package->ret_info. | ||
394 | count1, | ||
395 | package->ret_info. | ||
396 | object_type2, | ||
397 | package->ret_info. | ||
398 | count2); | ||
399 | if (ACPI_FAILURE(status)) { | ||
400 | return (status); | ||
401 | } | ||
402 | break; | ||
403 | |||
404 | case ACPI_PTYPE1_VAR: | ||
405 | |||
406 | /* | ||
407 | * The package count is variable, there are no sub-packages, and all | ||
408 | * elements must be of the same type | ||
409 | */ | ||
410 | for (i = 0; i < count; i++) { | ||
411 | status = acpi_ns_check_object_type(pathname, *elements, | ||
412 | package->ret_info. | ||
413 | object_type1, i); | ||
414 | if (ACPI_FAILURE(status)) { | ||
415 | return (status); | ||
416 | } | ||
417 | elements++; | ||
418 | } | ||
419 | break; | ||
420 | |||
421 | case ACPI_PTYPE1_OPTION: | ||
422 | |||
423 | /* | ||
424 | * The package count is variable, there are no sub-packages. There are | ||
425 | * a fixed number of required elements, and a variable number of | ||
426 | * optional elements. | ||
427 | * | ||
428 | * Check if package is at least as large as the minimum required | ||
429 | */ | ||
430 | expected_count = package->ret_info3.count; | ||
431 | if (count < expected_count) { | ||
432 | goto package_too_small; | ||
433 | } | ||
434 | |||
435 | /* Variable number of sub-objects */ | ||
436 | |||
437 | for (i = 0; i < count; i++) { | ||
438 | if (i < package->ret_info3.count) { | ||
439 | |||
440 | /* These are the required package elements (0, 1, or 2) */ | ||
441 | |||
442 | status = | ||
443 | acpi_ns_check_object_type(pathname, | ||
444 | *elements, | ||
445 | package-> | ||
446 | ret_info3. | ||
447 | object_type[i], | ||
448 | i); | ||
449 | if (ACPI_FAILURE(status)) { | ||
450 | return (status); | ||
451 | } | ||
452 | } else { | ||
453 | /* These are the optional package elements */ | ||
454 | |||
455 | status = | ||
456 | acpi_ns_check_object_type(pathname, | ||
457 | *elements, | ||
458 | package-> | ||
459 | ret_info3. | ||
460 | tail_object_type, | ||
461 | i); | ||
462 | if (ACPI_FAILURE(status)) { | ||
463 | return (status); | ||
464 | } | ||
465 | } | ||
466 | elements++; | ||
467 | } | ||
468 | break; | ||
469 | |||
470 | case ACPI_PTYPE2_PKG_COUNT: | ||
471 | |||
472 | /* First element is the (Integer) count of sub-packages to follow */ | ||
473 | |||
474 | status = acpi_ns_check_object_type(pathname, *elements, | ||
475 | ACPI_RTYPE_INTEGER, 0); | ||
476 | if (ACPI_FAILURE(status)) { | ||
477 | return (status); | ||
478 | } | ||
479 | |||
480 | /* | ||
481 | * Count cannot be larger than the parent package length, but allow it | ||
482 | * to be smaller. The >= accounts for the Integer above. | ||
483 | */ | ||
484 | expected_count = (u32) (*elements)->integer.value; | ||
485 | if (expected_count >= count) { | ||
486 | goto package_too_small; | ||
487 | } | ||
488 | |||
489 | count = expected_count; | ||
490 | elements++; | ||
491 | |||
492 | /* Now we can walk the sub-packages */ | ||
493 | |||
494 | /*lint -fallthrough */ | ||
495 | |||
496 | case ACPI_PTYPE2: | ||
497 | case ACPI_PTYPE2_FIXED: | ||
498 | case ACPI_PTYPE2_MIN: | ||
499 | case ACPI_PTYPE2_COUNT: | ||
500 | |||
501 | /* | ||
502 | * These types all return a single package that consists of a variable | ||
503 | * number of sub-packages | ||
504 | */ | ||
505 | for (i = 0; i < count; i++) { | ||
506 | sub_package = *elements; | ||
507 | sub_elements = sub_package->package.elements; | ||
508 | |||
509 | /* Each sub-object must be of type Package */ | ||
510 | |||
511 | status = | ||
512 | acpi_ns_check_object_type(pathname, sub_package, | ||
513 | ACPI_RTYPE_PACKAGE, i); | ||
514 | if (ACPI_FAILURE(status)) { | ||
515 | return (status); | ||
516 | } | ||
517 | |||
518 | /* Examine the different types of sub-packages */ | ||
519 | |||
520 | switch (package->ret_info.type) { | ||
521 | case ACPI_PTYPE2: | ||
522 | case ACPI_PTYPE2_PKG_COUNT: | ||
523 | |||
524 | /* Each subpackage has a fixed number of elements */ | ||
525 | |||
526 | expected_count = | ||
527 | package->ret_info.count1 + | ||
528 | package->ret_info.count2; | ||
529 | if (sub_package->package.count != | ||
530 | expected_count) { | ||
531 | count = sub_package->package.count; | ||
532 | goto package_too_small; | ||
533 | } | ||
534 | |||
535 | status = | ||
536 | acpi_ns_check_package_elements(pathname, | ||
537 | sub_elements, | ||
538 | package-> | ||
539 | ret_info. | ||
540 | object_type1, | ||
541 | package-> | ||
542 | ret_info. | ||
543 | count1, | ||
544 | package-> | ||
545 | ret_info. | ||
546 | object_type2, | ||
547 | package-> | ||
548 | ret_info. | ||
549 | count2); | ||
550 | if (ACPI_FAILURE(status)) { | ||
551 | return (status); | ||
552 | } | ||
553 | break; | ||
554 | |||
555 | case ACPI_PTYPE2_FIXED: | ||
556 | |||
557 | /* Each sub-package has a fixed length */ | ||
558 | |||
559 | expected_count = package->ret_info2.count; | ||
560 | if (sub_package->package.count < expected_count) { | ||
561 | count = sub_package->package.count; | ||
562 | goto package_too_small; | ||
563 | } | ||
564 | |||
565 | /* Check the type of each sub-package element */ | ||
566 | |||
567 | for (j = 0; j < expected_count; j++) { | ||
568 | status = | ||
569 | acpi_ns_check_object_type(pathname, | ||
570 | sub_elements | ||
571 | [j], | ||
572 | package-> | ||
573 | ret_info2. | ||
574 | object_type | ||
575 | [j], j); | ||
576 | if (ACPI_FAILURE(status)) { | ||
577 | return (status); | ||
578 | } | ||
579 | } | ||
580 | break; | ||
581 | |||
582 | case ACPI_PTYPE2_MIN: | ||
583 | |||
584 | /* Each sub-package has a variable but minimum length */ | ||
585 | |||
586 | expected_count = package->ret_info.count1; | ||
587 | if (sub_package->package.count < expected_count) { | ||
588 | count = sub_package->package.count; | ||
589 | goto package_too_small; | ||
590 | } | ||
591 | |||
592 | /* Check the type of each sub-package element */ | ||
593 | |||
594 | status = | ||
595 | acpi_ns_check_package_elements(pathname, | ||
596 | sub_elements, | ||
597 | package-> | ||
598 | ret_info. | ||
599 | object_type1, | ||
600 | sub_package-> | ||
601 | package. | ||
602 | count, 0, 0); | ||
603 | if (ACPI_FAILURE(status)) { | ||
604 | return (status); | ||
605 | } | ||
606 | break; | ||
607 | |||
608 | case ACPI_PTYPE2_COUNT: | ||
609 | |||
610 | /* First element is the (Integer) count of elements to follow */ | ||
611 | |||
612 | status = | ||
613 | acpi_ns_check_object_type(pathname, | ||
614 | *sub_elements, | ||
615 | ACPI_RTYPE_INTEGER, | ||
616 | 0); | ||
617 | if (ACPI_FAILURE(status)) { | ||
618 | return (status); | ||
619 | } | ||
620 | |||
621 | /* Make sure package is large enough for the Count */ | ||
622 | |||
623 | expected_count = | ||
624 | (u32) (*sub_elements)->integer.value; | ||
625 | if (sub_package->package.count < expected_count) { | ||
626 | count = sub_package->package.count; | ||
627 | goto package_too_small; | ||
628 | } | ||
629 | |||
630 | /* Check the type of each sub-package element */ | ||
631 | |||
632 | status = | ||
633 | acpi_ns_check_package_elements(pathname, | ||
634 | (sub_elements | ||
635 | + 1), | ||
636 | package-> | ||
637 | ret_info. | ||
638 | object_type1, | ||
639 | (expected_count | ||
640 | - 1), 0, 0); | ||
641 | if (ACPI_FAILURE(status)) { | ||
642 | return (status); | ||
643 | } | ||
644 | break; | ||
645 | |||
646 | default: | ||
647 | break; | ||
648 | } | ||
649 | |||
650 | elements++; | ||
651 | } | ||
652 | break; | ||
653 | |||
654 | default: | ||
655 | |||
656 | /* Should not get here if predefined info table is correct */ | ||
657 | |||
658 | ACPI_WARNING((AE_INFO, | ||
659 | "%s: Invalid internal return type in table entry: %X", | ||
660 | pathname, package->ret_info.type)); | ||
661 | |||
662 | return (AE_AML_INTERNAL); | ||
663 | } | ||
664 | |||
665 | return (AE_OK); | ||
666 | |||
667 | package_too_small: | ||
668 | |||
669 | /* Error exit for the case with an incorrect package count */ | ||
670 | |||
671 | ACPI_WARNING((AE_INFO, "%s: Return Package is too small - " | ||
672 | "found %u, expected %u", pathname, count, | ||
673 | expected_count)); | ||
674 | |||
675 | return (AE_AML_OPERAND_VALUE); | ||
676 | } | ||
677 | |||
678 | /******************************************************************************* | ||
679 | * | ||
680 | * FUNCTION: acpi_ns_check_package_elements | ||
681 | * | ||
682 | * PARAMETERS: Pathname - Full pathname to the node (for error msgs) | ||
683 | * Elements - Pointer to the package elements array | ||
684 | * Type1 - Object type for first group | ||
685 | * Count1 - Count for first group | ||
686 | * Type2 - Object type for second group | ||
687 | * Count2 - Count for second group | ||
688 | * | ||
689 | * RETURN: Status | ||
690 | * | ||
691 | * DESCRIPTION: Check that all elements of a package are of the correct object | ||
692 | * type. Supports up to two groups of different object types. | ||
693 | * | ||
694 | ******************************************************************************/ | ||
695 | |||
696 | static acpi_status | ||
697 | acpi_ns_check_package_elements(char *pathname, | ||
698 | union acpi_operand_object **elements, | ||
699 | u8 type1, u32 count1, u8 type2, u32 count2) | ||
700 | { | ||
701 | union acpi_operand_object **this_element = elements; | ||
702 | acpi_status status; | ||
703 | u32 i; | ||
704 | |||
705 | /* | ||
706 | * Up to two groups of package elements are supported by the data | ||
707 | * structure. All elements in each group must be of the same type. | ||
708 | * The second group can have a count of zero. | ||
709 | */ | ||
710 | for (i = 0; i < count1; i++) { | ||
711 | status = acpi_ns_check_object_type(pathname, *this_element, | ||
712 | type1, i); | ||
713 | if (ACPI_FAILURE(status)) { | ||
714 | return (status); | ||
715 | } | ||
716 | this_element++; | ||
717 | } | ||
718 | |||
719 | for (i = 0; i < count2; i++) { | ||
720 | status = acpi_ns_check_object_type(pathname, *this_element, | ||
721 | type2, (i + count1)); | ||
722 | if (ACPI_FAILURE(status)) { | ||
723 | return (status); | ||
724 | } | ||
725 | this_element++; | ||
726 | } | ||
727 | |||
728 | return (AE_OK); | ||
729 | } | ||
730 | |||
731 | /******************************************************************************* | ||
732 | * | ||
733 | * FUNCTION: acpi_ns_check_object_type | ||
734 | * | ||
735 | * PARAMETERS: Pathname - Full pathname to the node (for error msgs) | ||
736 | * return_object - Object return from the execution of this | ||
737 | * method/object | ||
738 | * expected_btypes - Bitmap of expected return type(s) | ||
739 | * package_index - Index of object within parent package (if | ||
740 | * applicable - ACPI_NOT_PACKAGE otherwise) | ||
741 | * | ||
742 | * RETURN: Status | ||
743 | * | ||
744 | * DESCRIPTION: Check the type of the return object against the expected object | ||
745 | * type(s). Use of Btype allows multiple expected object types. | ||
746 | * | ||
747 | ******************************************************************************/ | ||
748 | |||
749 | static acpi_status | ||
750 | acpi_ns_check_object_type(char *pathname, | ||
751 | union acpi_operand_object *return_object, | ||
752 | u32 expected_btypes, u32 package_index) | ||
753 | { | ||
754 | acpi_status status = AE_OK; | ||
755 | u32 return_btype; | ||
756 | char type_buffer[48]; /* Room for 5 types */ | ||
757 | u32 this_rtype; | ||
758 | u32 i; | ||
759 | u32 j; | ||
760 | |||
761 | /* | ||
762 | * If we get a NULL return_object here, it is a NULL package element, | ||
763 | * and this is always an error. | ||
764 | */ | ||
765 | if (!return_object) { | ||
766 | goto type_error_exit; | ||
767 | } | ||
768 | |||
769 | /* A Namespace node should not get here, but make sure */ | ||
770 | |||
771 | if (ACPI_GET_DESCRIPTOR_TYPE(return_object) == ACPI_DESC_TYPE_NAMED) { | ||
772 | ACPI_WARNING((AE_INFO, | ||
773 | "%s: Invalid return type - Found a Namespace node [%4.4s] type %s", | ||
774 | pathname, return_object->node.name.ascii, | ||
775 | acpi_ut_get_type_name(return_object->node.type))); | ||
776 | return (AE_AML_OPERAND_TYPE); | ||
777 | } | ||
778 | |||
779 | /* | ||
780 | * Convert the object type (ACPI_TYPE_xxx) to a bitmapped object type. | ||
781 | * The bitmapped type allows multiple possible return types. | ||
782 | * | ||
783 | * Note, the cases below must handle all of the possible types returned | ||
784 | * from all of the predefined names (including elements of returned | ||
785 | * packages) | ||
786 | */ | ||
787 | switch (ACPI_GET_OBJECT_TYPE(return_object)) { | ||
788 | case ACPI_TYPE_INTEGER: | ||
789 | return_btype = ACPI_RTYPE_INTEGER; | ||
790 | break; | ||
791 | |||
792 | case ACPI_TYPE_BUFFER: | ||
793 | return_btype = ACPI_RTYPE_BUFFER; | ||
794 | break; | ||
795 | |||
796 | case ACPI_TYPE_STRING: | ||
797 | return_btype = ACPI_RTYPE_STRING; | ||
798 | break; | ||
799 | |||
800 | case ACPI_TYPE_PACKAGE: | ||
801 | return_btype = ACPI_RTYPE_PACKAGE; | ||
802 | break; | ||
803 | |||
804 | case ACPI_TYPE_LOCAL_REFERENCE: | ||
805 | return_btype = ACPI_RTYPE_REFERENCE; | ||
806 | break; | ||
807 | |||
808 | default: | ||
809 | /* Not one of the supported objects, must be incorrect */ | ||
810 | |||
811 | goto type_error_exit; | ||
812 | } | ||
813 | |||
814 | /* Is the object one of the expected types? */ | ||
815 | |||
816 | if (!(return_btype & expected_btypes)) { | ||
817 | goto type_error_exit; | ||
818 | } | ||
819 | |||
820 | /* For reference objects, check that the reference type is correct */ | ||
821 | |||
822 | if (ACPI_GET_OBJECT_TYPE(return_object) == ACPI_TYPE_LOCAL_REFERENCE) { | ||
823 | status = acpi_ns_check_reference(pathname, return_object); | ||
824 | } | ||
825 | |||
826 | return (status); | ||
827 | |||
828 | type_error_exit: | ||
829 | |||
830 | /* Create a string with all expected types for this predefined object */ | ||
831 | |||
832 | j = 1; | ||
833 | type_buffer[0] = 0; | ||
834 | this_rtype = ACPI_RTYPE_INTEGER; | ||
835 | |||
836 | for (i = 0; i < ACPI_NUM_RTYPES; i++) { | ||
837 | |||
838 | /* If one of the expected types, concatenate the name of this type */ | ||
839 | |||
840 | if (expected_btypes & this_rtype) { | ||
841 | ACPI_STRCAT(type_buffer, &acpi_rtype_names[i][j]); | ||
842 | j = 0; /* Use name separator from now on */ | ||
843 | } | ||
844 | this_rtype <<= 1; /* Next Rtype */ | ||
845 | } | ||
846 | |||
847 | if (package_index == ACPI_NOT_PACKAGE) { | ||
848 | ACPI_WARNING((AE_INFO, | ||
849 | "%s: Return type mismatch - found %s, expected %s", | ||
850 | pathname, | ||
851 | acpi_ut_get_object_type_name(return_object), | ||
852 | type_buffer)); | ||
853 | } else { | ||
854 | ACPI_WARNING((AE_INFO, | ||
855 | "%s: Return Package type mismatch at index %u - " | ||
856 | "found %s, expected %s", pathname, package_index, | ||
857 | acpi_ut_get_object_type_name(return_object), | ||
858 | type_buffer)); | ||
859 | } | ||
860 | |||
861 | return (AE_AML_OPERAND_TYPE); | ||
862 | } | ||
863 | |||
864 | /******************************************************************************* | ||
865 | * | ||
866 | * FUNCTION: acpi_ns_check_reference | ||
867 | * | ||
868 | * PARAMETERS: Pathname - Full pathname to the node (for error msgs) | ||
869 | * return_object - Object returned from the evaluation of a | ||
870 | * method or object | ||
871 | * | ||
872 | * RETURN: Status | ||
873 | * | ||
874 | * DESCRIPTION: Check a returned reference object for the correct reference | ||
875 | * type. The only reference type that can be returned from a | ||
876 | * predefined method is a named reference. All others are invalid. | ||
877 | * | ||
878 | ******************************************************************************/ | ||
879 | |||
880 | static acpi_status | ||
881 | acpi_ns_check_reference(char *pathname, | ||
882 | union acpi_operand_object *return_object) | ||
883 | { | ||
884 | |||
885 | /* | ||
886 | * Check the reference object for the correct reference type (opcode). | ||
887 | * The only type of reference that can be converted to an union acpi_object is | ||
888 | * a reference to a named object (reference class: NAME) | ||
889 | */ | ||
890 | if (return_object->reference.class == ACPI_REFCLASS_NAME) { | ||
891 | return (AE_OK); | ||
892 | } | ||
893 | |||
894 | ACPI_WARNING((AE_INFO, | ||
895 | "%s: Return type mismatch - unexpected reference object type [%s] %2.2X", | ||
896 | pathname, acpi_ut_get_reference_name(return_object), | ||
897 | return_object->reference.class)); | ||
898 | |||
899 | return (AE_AML_OPERAND_TYPE); | ||
900 | } | ||
diff --git a/drivers/acpi/namespace/nssearch.c b/drivers/acpi/namespace/nssearch.c index 8399276cba1e..a9a80bf811b3 100644 --- a/drivers/acpi/namespace/nssearch.c +++ b/drivers/acpi/namespace/nssearch.c | |||
@@ -331,7 +331,7 @@ acpi_ns_search_and_enter(u32 target_name, | |||
331 | "Found bad character(s) in name, repaired: [%4.4s]\n", | 331 | "Found bad character(s) in name, repaired: [%4.4s]\n", |
332 | ACPI_CAST_PTR(char, &target_name))); | 332 | ACPI_CAST_PTR(char, &target_name))); |
333 | } else { | 333 | } else { |
334 | ACPI_DEBUG_PRINT((ACPI_DB_WARN, | 334 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
335 | "Found bad character(s) in name, repaired: [%4.4s]\n", | 335 | "Found bad character(s) in name, repaired: [%4.4s]\n", |
336 | ACPI_CAST_PTR(char, &target_name))); | 336 | ACPI_CAST_PTR(char, &target_name))); |
337 | } | 337 | } |
diff --git a/drivers/acpi/namespace/nsxfeval.c b/drivers/acpi/namespace/nsxfeval.c index 38be5865d95d..a085cc39c055 100644 --- a/drivers/acpi/namespace/nsxfeval.c +++ b/drivers/acpi/namespace/nsxfeval.c | |||
@@ -48,6 +48,10 @@ | |||
48 | 48 | ||
49 | #define _COMPONENT ACPI_NAMESPACE | 49 | #define _COMPONENT ACPI_NAMESPACE |
50 | ACPI_MODULE_NAME("nsxfeval") | 50 | ACPI_MODULE_NAME("nsxfeval") |
51 | |||
52 | /* Local prototypes */ | ||
53 | static void acpi_ns_resolve_references(struct acpi_evaluate_info *info); | ||
54 | |||
51 | #ifdef ACPI_FUTURE_USAGE | 55 | #ifdef ACPI_FUTURE_USAGE |
52 | /******************************************************************************* | 56 | /******************************************************************************* |
53 | * | 57 | * |
@@ -69,6 +73,7 @@ ACPI_MODULE_NAME("nsxfeval") | |||
69 | * be valid (non-null) | 73 | * be valid (non-null) |
70 | * | 74 | * |
71 | ******************************************************************************/ | 75 | ******************************************************************************/ |
76 | |||
72 | acpi_status | 77 | acpi_status |
73 | acpi_evaluate_object_typed(acpi_handle handle, | 78 | acpi_evaluate_object_typed(acpi_handle handle, |
74 | acpi_string pathname, | 79 | acpi_string pathname, |
@@ -283,6 +288,10 @@ acpi_evaluate_object(acpi_handle handle, | |||
283 | 288 | ||
284 | if (ACPI_SUCCESS(status)) { | 289 | if (ACPI_SUCCESS(status)) { |
285 | 290 | ||
291 | /* Dereference Index and ref_of references */ | ||
292 | |||
293 | acpi_ns_resolve_references(info); | ||
294 | |||
286 | /* Get the size of the returned object */ | 295 | /* Get the size of the returned object */ |
287 | 296 | ||
288 | status = | 297 | status = |
@@ -352,6 +361,74 @@ ACPI_EXPORT_SYMBOL(acpi_evaluate_object) | |||
352 | 361 | ||
353 | /******************************************************************************* | 362 | /******************************************************************************* |
354 | * | 363 | * |
364 | * FUNCTION: acpi_ns_resolve_references | ||
365 | * | ||
366 | * PARAMETERS: Info - Evaluation info block | ||
367 | * | ||
368 | * RETURN: Info->return_object is replaced with the dereferenced object | ||
369 | * | ||
370 | * DESCRIPTION: Dereference certain reference objects. Called before an | ||
371 | * internal return object is converted to an external union acpi_object. | ||
372 | * | ||
373 | * Performs an automatic dereference of Index and ref_of reference objects. | ||
374 | * These reference objects are not supported by the union acpi_object, so this is a | ||
375 | * last resort effort to return something useful. Also, provides compatibility | ||
376 | * with other ACPI implementations. | ||
377 | * | ||
378 | * NOTE: does not handle references within returned package objects or nested | ||
379 | * references, but this support could be added later if found to be necessary. | ||
380 | * | ||
381 | ******************************************************************************/ | ||
382 | static void acpi_ns_resolve_references(struct acpi_evaluate_info *info) | ||
383 | { | ||
384 | union acpi_operand_object *obj_desc = NULL; | ||
385 | struct acpi_namespace_node *node; | ||
386 | |||
387 | /* We are interested in reference objects only */ | ||
388 | |||
389 | if (ACPI_GET_OBJECT_TYPE(info->return_object) != | ||
390 | ACPI_TYPE_LOCAL_REFERENCE) { | ||
391 | return; | ||
392 | } | ||
393 | |||
394 | /* | ||
395 | * Two types of references are supported - those created by Index and | ||
396 | * ref_of operators. A name reference (AML_NAMEPATH_OP) can be converted | ||
397 | * to an union acpi_object, so it is not dereferenced here. A ddb_handle | ||
398 | * (AML_LOAD_OP) cannot be dereferenced, nor can it be converted to | ||
399 | * an union acpi_object. | ||
400 | */ | ||
401 | switch (info->return_object->reference.class) { | ||
402 | case ACPI_REFCLASS_INDEX: | ||
403 | |||
404 | obj_desc = *(info->return_object->reference.where); | ||
405 | break; | ||
406 | |||
407 | case ACPI_REFCLASS_REFOF: | ||
408 | |||
409 | node = info->return_object->reference.object; | ||
410 | if (node) { | ||
411 | obj_desc = node->object; | ||
412 | } | ||
413 | break; | ||
414 | |||
415 | default: | ||
416 | return; | ||
417 | } | ||
418 | |||
419 | /* Replace the existing reference object */ | ||
420 | |||
421 | if (obj_desc) { | ||
422 | acpi_ut_add_reference(obj_desc); | ||
423 | acpi_ut_remove_reference(info->return_object); | ||
424 | info->return_object = obj_desc; | ||
425 | } | ||
426 | |||
427 | return; | ||
428 | } | ||
429 | |||
430 | /******************************************************************************* | ||
431 | * | ||
355 | * FUNCTION: acpi_walk_namespace | 432 | * FUNCTION: acpi_walk_namespace |
356 | * | 433 | * |
357 | * PARAMETERS: Type - acpi_object_type to search for | 434 | * PARAMETERS: Type - acpi_object_type to search for |
@@ -379,6 +456,7 @@ ACPI_EXPORT_SYMBOL(acpi_evaluate_object) | |||
379 | * function, etc. | 456 | * function, etc. |
380 | * | 457 | * |
381 | ******************************************************************************/ | 458 | ******************************************************************************/ |
459 | |||
382 | acpi_status | 460 | acpi_status |
383 | acpi_walk_namespace(acpi_object_type type, | 461 | acpi_walk_namespace(acpi_object_type type, |
384 | acpi_handle start_object, | 462 | acpi_handle start_object, |
diff --git a/drivers/acpi/namespace/nsxfname.c b/drivers/acpi/namespace/nsxfname.c index a287ed550f54..5efa4e7ddb0b 100644 --- a/drivers/acpi/namespace/nsxfname.c +++ b/drivers/acpi/namespace/nsxfname.c | |||
@@ -253,6 +253,7 @@ acpi_get_object_info(acpi_handle handle, struct acpi_buffer * buffer) | |||
253 | node = acpi_ns_map_handle_to_node(handle); | 253 | node = acpi_ns_map_handle_to_node(handle); |
254 | if (!node) { | 254 | if (!node) { |
255 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); | 255 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); |
256 | status = AE_BAD_PARAMETER; | ||
256 | goto cleanup; | 257 | goto cleanup; |
257 | } | 258 | } |
258 | 259 | ||
@@ -264,6 +265,10 @@ acpi_get_object_info(acpi_handle handle, struct acpi_buffer * buffer) | |||
264 | info->name = node->name.integer; | 265 | info->name = node->name.integer; |
265 | info->valid = 0; | 266 | info->valid = 0; |
266 | 267 | ||
268 | if (node->type == ACPI_TYPE_METHOD) { | ||
269 | info->param_count = node->object->method.param_count; | ||
270 | } | ||
271 | |||
267 | status = acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); | 272 | status = acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); |
268 | if (ACPI_FAILURE(status)) { | 273 | if (ACPI_FAILURE(status)) { |
269 | goto cleanup; | 274 | goto cleanup; |
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index 235a1386888a..1420a9f69e5d 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c | |||
@@ -729,8 +729,8 @@ acpi_status acpi_os_execute(acpi_execute_type type, | |||
729 | INIT_WORK(&dpc->work, acpi_os_execute_deferred); | 729 | INIT_WORK(&dpc->work, acpi_os_execute_deferred); |
730 | queue = (type == OSL_NOTIFY_HANDLER) ? kacpi_notify_wq : kacpid_wq; | 730 | queue = (type == OSL_NOTIFY_HANDLER) ? kacpi_notify_wq : kacpid_wq; |
731 | if (!queue_work(queue, &dpc->work)) { | 731 | if (!queue_work(queue, &dpc->work)) { |
732 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 732 | printk(KERN_ERR PREFIX |
733 | "Call to queue_work() failed.\n")); | 733 | "Call to queue_work() failed.\n"); |
734 | status = AE_ERROR; | 734 | status = AE_ERROR; |
735 | kfree(dpc); | 735 | kfree(dpc); |
736 | } | 736 | } |
diff --git a/drivers/acpi/parser/psloop.c b/drivers/acpi/parser/psloop.c index c06238e55d98..4647039a0d8a 100644 --- a/drivers/acpi/parser/psloop.c +++ b/drivers/acpi/parser/psloop.c | |||
@@ -719,6 +719,8 @@ acpi_ps_complete_op(struct acpi_walk_state *walk_state, | |||
719 | *op = NULL; | 719 | *op = NULL; |
720 | } | 720 | } |
721 | 721 | ||
722 | ACPI_PREEMPTION_POINT(); | ||
723 | |||
722 | return_ACPI_STATUS(AE_OK); | 724 | return_ACPI_STATUS(AE_OK); |
723 | } | 725 | } |
724 | 726 | ||
diff --git a/drivers/acpi/parser/psparse.c b/drivers/acpi/parser/psparse.c index 15e1702e48d6..68e932f215ea 100644 --- a/drivers/acpi/parser/psparse.c +++ b/drivers/acpi/parser/psparse.c | |||
@@ -137,6 +137,7 @@ acpi_ps_complete_this_op(struct acpi_walk_state * walk_state, | |||
137 | union acpi_parse_object *next; | 137 | union acpi_parse_object *next; |
138 | const struct acpi_opcode_info *parent_info; | 138 | const struct acpi_opcode_info *parent_info; |
139 | union acpi_parse_object *replacement_op = NULL; | 139 | union acpi_parse_object *replacement_op = NULL; |
140 | acpi_status status = AE_OK; | ||
140 | 141 | ||
141 | ACPI_FUNCTION_TRACE_PTR(ps_complete_this_op, op); | 142 | ACPI_FUNCTION_TRACE_PTR(ps_complete_this_op, op); |
142 | 143 | ||
@@ -186,7 +187,7 @@ acpi_ps_complete_this_op(struct acpi_walk_state * walk_state, | |||
186 | replacement_op = | 187 | replacement_op = |
187 | acpi_ps_alloc_op(AML_INT_RETURN_VALUE_OP); | 188 | acpi_ps_alloc_op(AML_INT_RETURN_VALUE_OP); |
188 | if (!replacement_op) { | 189 | if (!replacement_op) { |
189 | goto allocate_error; | 190 | status = AE_NO_MEMORY; |
190 | } | 191 | } |
191 | break; | 192 | break; |
192 | 193 | ||
@@ -211,7 +212,7 @@ acpi_ps_complete_this_op(struct acpi_walk_state * walk_state, | |||
211 | replacement_op = | 212 | replacement_op = |
212 | acpi_ps_alloc_op(AML_INT_RETURN_VALUE_OP); | 213 | acpi_ps_alloc_op(AML_INT_RETURN_VALUE_OP); |
213 | if (!replacement_op) { | 214 | if (!replacement_op) { |
214 | goto allocate_error; | 215 | status = AE_NO_MEMORY; |
215 | } | 216 | } |
216 | } else | 217 | } else |
217 | if ((op->common.parent->common.aml_opcode == | 218 | if ((op->common.parent->common.aml_opcode == |
@@ -226,13 +227,13 @@ acpi_ps_complete_this_op(struct acpi_walk_state * walk_state, | |||
226 | acpi_ps_alloc_op(op->common. | 227 | acpi_ps_alloc_op(op->common. |
227 | aml_opcode); | 228 | aml_opcode); |
228 | if (!replacement_op) { | 229 | if (!replacement_op) { |
229 | goto allocate_error; | 230 | status = AE_NO_MEMORY; |
231 | } else { | ||
232 | replacement_op->named.data = | ||
233 | op->named.data; | ||
234 | replacement_op->named.length = | ||
235 | op->named.length; | ||
230 | } | 236 | } |
231 | |||
232 | replacement_op->named.data = | ||
233 | op->named.data; | ||
234 | replacement_op->named.length = | ||
235 | op->named.length; | ||
236 | } | 237 | } |
237 | } | 238 | } |
238 | break; | 239 | break; |
@@ -242,7 +243,7 @@ acpi_ps_complete_this_op(struct acpi_walk_state * walk_state, | |||
242 | replacement_op = | 243 | replacement_op = |
243 | acpi_ps_alloc_op(AML_INT_RETURN_VALUE_OP); | 244 | acpi_ps_alloc_op(AML_INT_RETURN_VALUE_OP); |
244 | if (!replacement_op) { | 245 | if (!replacement_op) { |
245 | goto allocate_error; | 246 | status = AE_NO_MEMORY; |
246 | } | 247 | } |
247 | } | 248 | } |
248 | 249 | ||
@@ -302,14 +303,7 @@ acpi_ps_complete_this_op(struct acpi_walk_state * walk_state, | |||
302 | /* Now we can actually delete the subtree rooted at Op */ | 303 | /* Now we can actually delete the subtree rooted at Op */ |
303 | 304 | ||
304 | acpi_ps_delete_parse_tree(op); | 305 | acpi_ps_delete_parse_tree(op); |
305 | return_ACPI_STATUS(AE_OK); | 306 | return_ACPI_STATUS(status); |
306 | |||
307 | allocate_error: | ||
308 | |||
309 | /* Always delete the subtree, even on error */ | ||
310 | |||
311 | acpi_ps_delete_parse_tree(op); | ||
312 | return_ACPI_STATUS(AE_NO_MEMORY); | ||
313 | } | 307 | } |
314 | 308 | ||
315 | /******************************************************************************* | 309 | /******************************************************************************* |
@@ -641,10 +635,12 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state) | |||
641 | ACPI_WALK_METHOD_RESTART; | 635 | ACPI_WALK_METHOD_RESTART; |
642 | } | 636 | } |
643 | } else { | 637 | } else { |
644 | /* On error, delete any return object */ | 638 | /* On error, delete any return object or implicit return */ |
645 | 639 | ||
646 | acpi_ut_remove_reference(previous_walk_state-> | 640 | acpi_ut_remove_reference(previous_walk_state-> |
647 | return_desc); | 641 | return_desc); |
642 | acpi_ds_clear_implicit_return | ||
643 | (previous_walk_state); | ||
648 | } | 644 | } |
649 | } | 645 | } |
650 | 646 | ||
diff --git a/drivers/acpi/processor_perflib.c b/drivers/acpi/processor_perflib.c index 242f8143008a..b0614f379470 100644 --- a/drivers/acpi/processor_perflib.c +++ b/drivers/acpi/processor_perflib.c | |||
@@ -536,13 +536,13 @@ static int acpi_processor_get_psd(struct acpi_processor *pr) | |||
536 | 536 | ||
537 | psd = buffer.pointer; | 537 | psd = buffer.pointer; |
538 | if (!psd || (psd->type != ACPI_TYPE_PACKAGE)) { | 538 | if (!psd || (psd->type != ACPI_TYPE_PACKAGE)) { |
539 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid _PSD data\n")); | 539 | printk(KERN_ERR PREFIX "Invalid _PSD data\n"); |
540 | result = -EFAULT; | 540 | result = -EFAULT; |
541 | goto end; | 541 | goto end; |
542 | } | 542 | } |
543 | 543 | ||
544 | if (psd->package.count != 1) { | 544 | if (psd->package.count != 1) { |
545 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid _PSD data\n")); | 545 | printk(KERN_ERR PREFIX "Invalid _PSD data\n"); |
546 | result = -EFAULT; | 546 | result = -EFAULT; |
547 | goto end; | 547 | goto end; |
548 | } | 548 | } |
@@ -555,19 +555,19 @@ static int acpi_processor_get_psd(struct acpi_processor *pr) | |||
555 | status = acpi_extract_package(&(psd->package.elements[0]), | 555 | status = acpi_extract_package(&(psd->package.elements[0]), |
556 | &format, &state); | 556 | &format, &state); |
557 | if (ACPI_FAILURE(status)) { | 557 | if (ACPI_FAILURE(status)) { |
558 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid _PSD data\n")); | 558 | printk(KERN_ERR PREFIX "Invalid _PSD data\n"); |
559 | result = -EFAULT; | 559 | result = -EFAULT; |
560 | goto end; | 560 | goto end; |
561 | } | 561 | } |
562 | 562 | ||
563 | if (pdomain->num_entries != ACPI_PSD_REV0_ENTRIES) { | 563 | if (pdomain->num_entries != ACPI_PSD_REV0_ENTRIES) { |
564 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unknown _PSD:num_entries\n")); | 564 | printk(KERN_ERR PREFIX "Unknown _PSD:num_entries\n"); |
565 | result = -EFAULT; | 565 | result = -EFAULT; |
566 | goto end; | 566 | goto end; |
567 | } | 567 | } |
568 | 568 | ||
569 | if (pdomain->revision != ACPI_PSD_REV0_REVISION) { | 569 | if (pdomain->revision != ACPI_PSD_REV0_REVISION) { |
570 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unknown _PSD:revision\n")); | 570 | printk(KERN_ERR PREFIX "Unknown _PSD:revision\n"); |
571 | result = -EFAULT; | 571 | result = -EFAULT; |
572 | goto end; | 572 | goto end; |
573 | } | 573 | } |
diff --git a/drivers/acpi/processor_throttling.c b/drivers/acpi/processor_throttling.c index a56fc6c4394b..e89a25824f2a 100644 --- a/drivers/acpi/processor_throttling.c +++ b/drivers/acpi/processor_throttling.c | |||
@@ -528,13 +528,13 @@ static int acpi_processor_get_tsd(struct acpi_processor *pr) | |||
528 | 528 | ||
529 | tsd = buffer.pointer; | 529 | tsd = buffer.pointer; |
530 | if (!tsd || (tsd->type != ACPI_TYPE_PACKAGE)) { | 530 | if (!tsd || (tsd->type != ACPI_TYPE_PACKAGE)) { |
531 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid _TSD data\n")); | 531 | printk(KERN_ERR PREFIX "Invalid _TSD data\n"); |
532 | result = -EFAULT; | 532 | result = -EFAULT; |
533 | goto end; | 533 | goto end; |
534 | } | 534 | } |
535 | 535 | ||
536 | if (tsd->package.count != 1) { | 536 | if (tsd->package.count != 1) { |
537 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid _TSD data\n")); | 537 | printk(KERN_ERR PREFIX "Invalid _TSD data\n"); |
538 | result = -EFAULT; | 538 | result = -EFAULT; |
539 | goto end; | 539 | goto end; |
540 | } | 540 | } |
@@ -547,19 +547,19 @@ static int acpi_processor_get_tsd(struct acpi_processor *pr) | |||
547 | status = acpi_extract_package(&(tsd->package.elements[0]), | 547 | status = acpi_extract_package(&(tsd->package.elements[0]), |
548 | &format, &state); | 548 | &format, &state); |
549 | if (ACPI_FAILURE(status)) { | 549 | if (ACPI_FAILURE(status)) { |
550 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid _TSD data\n")); | 550 | printk(KERN_ERR PREFIX "Invalid _TSD data\n"); |
551 | result = -EFAULT; | 551 | result = -EFAULT; |
552 | goto end; | 552 | goto end; |
553 | } | 553 | } |
554 | 554 | ||
555 | if (pdomain->num_entries != ACPI_TSD_REV0_ENTRIES) { | 555 | if (pdomain->num_entries != ACPI_TSD_REV0_ENTRIES) { |
556 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unknown _TSD:num_entries\n")); | 556 | printk(KERN_ERR PREFIX "Unknown _TSD:num_entries\n"); |
557 | result = -EFAULT; | 557 | result = -EFAULT; |
558 | goto end; | 558 | goto end; |
559 | } | 559 | } |
560 | 560 | ||
561 | if (pdomain->revision != ACPI_TSD_REV0_REVISION) { | 561 | if (pdomain->revision != ACPI_TSD_REV0_REVISION) { |
562 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unknown _TSD:revision\n")); | 562 | printk(KERN_ERR PREFIX "Unknown _TSD:revision\n"); |
563 | result = -EFAULT; | 563 | result = -EFAULT; |
564 | goto end; | 564 | goto end; |
565 | } | 565 | } |
diff --git a/drivers/acpi/resources/rscalc.c b/drivers/acpi/resources/rscalc.c index d9063ea414e3..8eaaecf92009 100644 --- a/drivers/acpi/resources/rscalc.c +++ b/drivers/acpi/resources/rscalc.c | |||
@@ -43,7 +43,6 @@ | |||
43 | 43 | ||
44 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
45 | #include <acpi/acresrc.h> | 45 | #include <acpi/acresrc.h> |
46 | #include <acpi/amlcode.h> | ||
47 | #include <acpi/acnamesp.h> | 46 | #include <acpi/acnamesp.h> |
48 | 47 | ||
49 | #define _COMPONENT ACPI_RESOURCES | 48 | #define _COMPONENT ACPI_RESOURCES |
@@ -560,8 +559,8 @@ acpi_rs_get_pci_routing_table_length(union acpi_operand_object *package_object, | |||
560 | ACPI_GET_OBJECT_TYPE(*sub_object_list)) || | 559 | ACPI_GET_OBJECT_TYPE(*sub_object_list)) || |
561 | ((ACPI_TYPE_LOCAL_REFERENCE == | 560 | ((ACPI_TYPE_LOCAL_REFERENCE == |
562 | ACPI_GET_OBJECT_TYPE(*sub_object_list)) && | 561 | ACPI_GET_OBJECT_TYPE(*sub_object_list)) && |
563 | ((*sub_object_list)->reference.opcode == | 562 | ((*sub_object_list)->reference.class == |
564 | AML_INT_NAMEPATH_OP)))) { | 563 | ACPI_REFCLASS_NAME)))) { |
565 | name_found = TRUE; | 564 | name_found = TRUE; |
566 | } else { | 565 | } else { |
567 | /* Look at the next element */ | 566 | /* Look at the next element */ |
diff --git a/drivers/acpi/resources/rscreate.c b/drivers/acpi/resources/rscreate.c index 7804a8c40e7a..c0bbfa2c4193 100644 --- a/drivers/acpi/resources/rscreate.c +++ b/drivers/acpi/resources/rscreate.c | |||
@@ -43,7 +43,6 @@ | |||
43 | 43 | ||
44 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
45 | #include <acpi/acresrc.h> | 45 | #include <acpi/acresrc.h> |
46 | #include <acpi/amlcode.h> | ||
47 | #include <acpi/acnamesp.h> | 46 | #include <acpi/acnamesp.h> |
48 | 47 | ||
49 | #define _COMPONENT ACPI_RESOURCES | 48 | #define _COMPONENT ACPI_RESOURCES |
@@ -310,13 +309,12 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, | |||
310 | switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { | 309 | switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { |
311 | case ACPI_TYPE_LOCAL_REFERENCE: | 310 | case ACPI_TYPE_LOCAL_REFERENCE: |
312 | 311 | ||
313 | if (obj_desc->reference.opcode != | 312 | if (obj_desc->reference.class != |
314 | AML_INT_NAMEPATH_OP) { | 313 | ACPI_REFCLASS_NAME) { |
315 | ACPI_ERROR((AE_INFO, | 314 | ACPI_ERROR((AE_INFO, |
316 | "(PRT[%X].Source) Need name, found reference op %X", | 315 | "(PRT[%X].Source) Need name, found Reference Class %X", |
317 | index, | 316 | index, |
318 | obj_desc->reference. | 317 | obj_desc->reference.class)); |
319 | opcode)); | ||
320 | return_ACPI_STATUS(AE_BAD_DATA); | 318 | return_ACPI_STATUS(AE_BAD_DATA); |
321 | } | 319 | } |
322 | 320 | ||
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index 91fed422bae8..1f98103b53c3 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c | |||
@@ -113,16 +113,16 @@ static int acpi_bus_hot_remove_device(void *context) | |||
113 | 113 | ||
114 | 114 | ||
115 | if (acpi_bus_trim(device, 1)) { | 115 | if (acpi_bus_trim(device, 1)) { |
116 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 116 | printk(KERN_ERR PREFIX |
117 | "Removing device failed\n")); | 117 | "Removing device failed\n"); |
118 | return -1; | 118 | return -1; |
119 | } | 119 | } |
120 | 120 | ||
121 | /* power off device */ | 121 | /* power off device */ |
122 | status = acpi_evaluate_object(handle, "_PS3", NULL, NULL); | 122 | status = acpi_evaluate_object(handle, "_PS3", NULL, NULL); |
123 | if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) | 123 | if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) |
124 | ACPI_DEBUG_PRINT((ACPI_DB_WARN, | 124 | printk(KERN_WARNING PREFIX |
125 | "Power-off device failed\n")); | 125 | "Power-off device failed\n"); |
126 | 126 | ||
127 | if (device->flags.lockable) { | 127 | if (device->flags.lockable) { |
128 | arg_list.count = 1; | 128 | arg_list.count = 1; |
@@ -484,7 +484,7 @@ static int acpi_device_register(struct acpi_device *device, | |||
484 | 484 | ||
485 | result = acpi_device_setup_files(device); | 485 | result = acpi_device_setup_files(device); |
486 | if(result) | 486 | if(result) |
487 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error creating sysfs interface for device %s\n", device->dev.bus_id)); | 487 | printk(KERN_ERR PREFIX "Error creating sysfs interface for device %s\n", device->dev.bus_id); |
488 | 488 | ||
489 | device->removal_type = ACPI_BUS_REMOVAL_NORMAL; | 489 | device->removal_type = ACPI_BUS_REMOVAL_NORMAL; |
490 | return 0; | 490 | return 0; |
diff --git a/drivers/acpi/system.c b/drivers/acpi/system.c index 91dec448b3ed..3eefd6d029f9 100644 --- a/drivers/acpi/system.c +++ b/drivers/acpi/system.c | |||
@@ -387,8 +387,8 @@ static ssize_t counter_set(struct kobject *kobj, | |||
387 | goto end; | 387 | goto end; |
388 | 388 | ||
389 | if (!(all_counters[index].flags & ACPI_EVENT_VALID)) { | 389 | if (!(all_counters[index].flags & ACPI_EVENT_VALID)) { |
390 | ACPI_DEBUG_PRINT((ACPI_DB_WARN, | 390 | printk(KERN_WARNING PREFIX |
391 | "Can not change Invalid GPE/Fixed Event status\n")); | 391 | "Can not change Invalid GPE/Fixed Event status\n"); |
392 | return -EINVAL; | 392 | return -EINVAL; |
393 | } | 393 | } |
394 | 394 | ||
diff --git a/drivers/acpi/tables/tbinstal.c b/drivers/acpi/tables/tbinstal.c index b22185f55a16..18747ce8dd2f 100644 --- a/drivers/acpi/tables/tbinstal.c +++ b/drivers/acpi/tables/tbinstal.c | |||
@@ -110,7 +110,6 @@ acpi_status | |||
110 | acpi_tb_add_table(struct acpi_table_desc *table_desc, u32 *table_index) | 110 | acpi_tb_add_table(struct acpi_table_desc *table_desc, u32 *table_index) |
111 | { | 111 | { |
112 | u32 i; | 112 | u32 i; |
113 | u32 length; | ||
114 | acpi_status status = AE_OK; | 113 | acpi_status status = AE_OK; |
115 | 114 | ||
116 | ACPI_FUNCTION_TRACE(tb_add_table); | 115 | ACPI_FUNCTION_TRACE(tb_add_table); |
@@ -145,25 +144,64 @@ acpi_tb_add_table(struct acpi_table_desc *table_desc, u32 *table_index) | |||
145 | } | 144 | } |
146 | } | 145 | } |
147 | 146 | ||
148 | length = ACPI_MIN(table_desc->length, | 147 | /* |
149 | acpi_gbl_root_table_list.tables[i].length); | 148 | * Check for a table match on the entire table length, |
149 | * not just the header. | ||
150 | */ | ||
151 | if (table_desc->length != | ||
152 | acpi_gbl_root_table_list.tables[i].length) { | ||
153 | continue; | ||
154 | } | ||
155 | |||
150 | if (ACPI_MEMCMP(table_desc->pointer, | 156 | if (ACPI_MEMCMP(table_desc->pointer, |
151 | acpi_gbl_root_table_list.tables[i].pointer, | 157 | acpi_gbl_root_table_list.tables[i].pointer, |
152 | length)) { | 158 | acpi_gbl_root_table_list.tables[i].length)) { |
153 | continue; | 159 | continue; |
154 | } | 160 | } |
155 | 161 | ||
156 | /* Table is already registered */ | 162 | /* |
157 | 163 | * Note: the current mechanism does not unregister a table if it is | |
164 | * dynamically unloaded. The related namespace entries are deleted, | ||
165 | * but the table remains in the root table list. | ||
166 | * | ||
167 | * The assumption here is that the number of different tables that | ||
168 | * will be loaded is actually small, and there is minimal overhead | ||
169 | * in just keeping the table in case it is needed again. | ||
170 | * | ||
171 | * If this assumption changes in the future (perhaps on large | ||
172 | * machines with many table load/unload operations), tables will | ||
173 | * need to be unregistered when they are unloaded, and slots in the | ||
174 | * root table list should be reused when empty. | ||
175 | */ | ||
176 | |||
177 | /* | ||
178 | * Table is already registered. | ||
179 | * We can delete the table that was passed as a parameter. | ||
180 | */ | ||
158 | acpi_tb_delete_table(table_desc); | 181 | acpi_tb_delete_table(table_desc); |
159 | *table_index = i; | 182 | *table_index = i; |
160 | status = AE_ALREADY_EXISTS; | 183 | |
161 | goto release; | 184 | if (acpi_gbl_root_table_list.tables[i]. |
185 | flags & ACPI_TABLE_IS_LOADED) { | ||
186 | |||
187 | /* Table is still loaded, this is an error */ | ||
188 | |||
189 | status = AE_ALREADY_EXISTS; | ||
190 | goto release; | ||
191 | } else { | ||
192 | /* Table was unloaded, allow it to be reloaded */ | ||
193 | |||
194 | table_desc->pointer = | ||
195 | acpi_gbl_root_table_list.tables[i].pointer; | ||
196 | table_desc->address = | ||
197 | acpi_gbl_root_table_list.tables[i].address; | ||
198 | status = AE_OK; | ||
199 | goto print_header; | ||
200 | } | ||
162 | } | 201 | } |
163 | 202 | ||
164 | /* | 203 | /* Add the table to the global root table list */ |
165 | * Add the table to the global table list | 204 | |
166 | */ | ||
167 | status = acpi_tb_store_table(table_desc->address, table_desc->pointer, | 205 | status = acpi_tb_store_table(table_desc->address, table_desc->pointer, |
168 | table_desc->length, table_desc->flags, | 206 | table_desc->length, table_desc->flags, |
169 | table_index); | 207 | table_index); |
@@ -171,6 +209,7 @@ acpi_tb_add_table(struct acpi_table_desc *table_desc, u32 *table_index) | |||
171 | goto release; | 209 | goto release; |
172 | } | 210 | } |
173 | 211 | ||
212 | print_header: | ||
174 | acpi_tb_print_table_header(table_desc->address, table_desc->pointer); | 213 | acpi_tb_print_table_header(table_desc->address, table_desc->pointer); |
175 | 214 | ||
176 | release: | 215 | release: |
diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c index 912703691d36..263ec08a9011 100644 --- a/drivers/acpi/thermal.c +++ b/drivers/acpi/thermal.c | |||
@@ -1213,8 +1213,8 @@ static int acpi_thermal_register_thermal_zone(struct acpi_thermal *tz) | |||
1213 | acpi_bus_private_data_handler, | 1213 | acpi_bus_private_data_handler, |
1214 | tz->thermal_zone); | 1214 | tz->thermal_zone); |
1215 | if (ACPI_FAILURE(status)) { | 1215 | if (ACPI_FAILURE(status)) { |
1216 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 1216 | printk(KERN_ERR PREFIX |
1217 | "Error attaching device data\n")); | 1217 | "Error attaching device data\n"); |
1218 | return -ENODEV; | 1218 | return -ENODEV; |
1219 | } | 1219 | } |
1220 | 1220 | ||
diff --git a/drivers/acpi/utilities/utalloc.c b/drivers/acpi/utilities/utalloc.c index 7dcb67e0b215..241c535c1753 100644 --- a/drivers/acpi/utilities/utalloc.c +++ b/drivers/acpi/utilities/utalloc.c | |||
@@ -232,7 +232,7 @@ acpi_status acpi_ut_validate_buffer(struct acpi_buffer * buffer) | |||
232 | * RETURN: Status | 232 | * RETURN: Status |
233 | * | 233 | * |
234 | * DESCRIPTION: Validate that the buffer is of the required length or | 234 | * DESCRIPTION: Validate that the buffer is of the required length or |
235 | * allocate a new buffer. Returned buffer is always zeroed. | 235 | * allocate a new buffer. Returned buffer is always zeroed. |
236 | * | 236 | * |
237 | ******************************************************************************/ | 237 | ******************************************************************************/ |
238 | 238 | ||
@@ -240,7 +240,7 @@ acpi_status | |||
240 | acpi_ut_initialize_buffer(struct acpi_buffer * buffer, | 240 | acpi_ut_initialize_buffer(struct acpi_buffer * buffer, |
241 | acpi_size required_length) | 241 | acpi_size required_length) |
242 | { | 242 | { |
243 | acpi_status status = AE_OK; | 243 | acpi_size input_buffer_length; |
244 | 244 | ||
245 | /* Parameter validation */ | 245 | /* Parameter validation */ |
246 | 246 | ||
@@ -248,55 +248,58 @@ acpi_ut_initialize_buffer(struct acpi_buffer * buffer, | |||
248 | return (AE_BAD_PARAMETER); | 248 | return (AE_BAD_PARAMETER); |
249 | } | 249 | } |
250 | 250 | ||
251 | switch (buffer->length) { | 251 | /* |
252 | * Buffer->Length is used as both an input and output parameter. Get the | ||
253 | * input actual length and set the output required buffer length. | ||
254 | */ | ||
255 | input_buffer_length = buffer->length; | ||
256 | buffer->length = required_length; | ||
257 | |||
258 | /* | ||
259 | * The input buffer length contains the actual buffer length, or the type | ||
260 | * of buffer to be allocated by this routine. | ||
261 | */ | ||
262 | switch (input_buffer_length) { | ||
252 | case ACPI_NO_BUFFER: | 263 | case ACPI_NO_BUFFER: |
253 | 264 | ||
254 | /* Set the exception and returned the required length */ | 265 | /* Return the exception (and the required buffer length) */ |
255 | 266 | ||
256 | status = AE_BUFFER_OVERFLOW; | 267 | return (AE_BUFFER_OVERFLOW); |
257 | break; | ||
258 | 268 | ||
259 | case ACPI_ALLOCATE_BUFFER: | 269 | case ACPI_ALLOCATE_BUFFER: |
260 | 270 | ||
261 | /* Allocate a new buffer */ | 271 | /* Allocate a new buffer */ |
262 | 272 | ||
263 | buffer->pointer = acpi_os_allocate(required_length); | 273 | buffer->pointer = acpi_os_allocate(required_length); |
264 | if (!buffer->pointer) { | ||
265 | return (AE_NO_MEMORY); | ||
266 | } | ||
267 | |||
268 | /* Clear the buffer */ | ||
269 | |||
270 | ACPI_MEMSET(buffer->pointer, 0, required_length); | ||
271 | break; | 274 | break; |
272 | 275 | ||
273 | case ACPI_ALLOCATE_LOCAL_BUFFER: | 276 | case ACPI_ALLOCATE_LOCAL_BUFFER: |
274 | 277 | ||
275 | /* Allocate a new buffer with local interface to allow tracking */ | 278 | /* Allocate a new buffer with local interface to allow tracking */ |
276 | 279 | ||
277 | buffer->pointer = ACPI_ALLOCATE_ZEROED(required_length); | 280 | buffer->pointer = ACPI_ALLOCATE(required_length); |
278 | if (!buffer->pointer) { | ||
279 | return (AE_NO_MEMORY); | ||
280 | } | ||
281 | break; | 281 | break; |
282 | 282 | ||
283 | default: | 283 | default: |
284 | 284 | ||
285 | /* Existing buffer: Validate the size of the buffer */ | 285 | /* Existing buffer: Validate the size of the buffer */ |
286 | 286 | ||
287 | if (buffer->length < required_length) { | 287 | if (input_buffer_length < required_length) { |
288 | status = AE_BUFFER_OVERFLOW; | 288 | return (AE_BUFFER_OVERFLOW); |
289 | break; | ||
290 | } | 289 | } |
290 | break; | ||
291 | } | ||
291 | 292 | ||
292 | /* Clear the buffer */ | 293 | /* Validate allocation from above or input buffer pointer */ |
293 | 294 | ||
294 | ACPI_MEMSET(buffer->pointer, 0, required_length); | 295 | if (!buffer->pointer) { |
295 | break; | 296 | return (AE_NO_MEMORY); |
296 | } | 297 | } |
297 | 298 | ||
298 | buffer->length = required_length; | 299 | /* Have a valid buffer, clear it */ |
299 | return (status); | 300 | |
301 | ACPI_MEMSET(buffer->pointer, 0, required_length); | ||
302 | return (AE_OK); | ||
300 | } | 303 | } |
301 | 304 | ||
302 | #ifdef NOT_USED_BY_LINUX | 305 | #ifdef NOT_USED_BY_LINUX |
diff --git a/drivers/acpi/utilities/utcopy.c b/drivers/acpi/utilities/utcopy.c index 53499ac90988..5b2f7c27b705 100644 --- a/drivers/acpi/utilities/utcopy.c +++ b/drivers/acpi/utilities/utcopy.c | |||
@@ -42,7 +42,6 @@ | |||
42 | */ | 42 | */ |
43 | 43 | ||
44 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
45 | #include <acpi/amlcode.h> | ||
46 | #include <acpi/acnamesp.h> | 45 | #include <acpi/acnamesp.h> |
47 | 46 | ||
48 | 47 | ||
@@ -176,20 +175,24 @@ acpi_ut_copy_isimple_to_esimple(union acpi_operand_object *internal_object, | |||
176 | 175 | ||
177 | /* This is an object reference. */ | 176 | /* This is an object reference. */ |
178 | 177 | ||
179 | switch (internal_object->reference.opcode) { | 178 | switch (internal_object->reference.class) { |
180 | case AML_INT_NAMEPATH_OP: | 179 | case ACPI_REFCLASS_NAME: |
181 | |||
182 | /* For namepath, return the object handle ("reference") */ | ||
183 | |||
184 | default: | ||
185 | |||
186 | /* We are referring to the namespace node */ | ||
187 | 180 | ||
181 | /* | ||
182 | * For namepath, return the object handle ("reference") | ||
183 | * We are referring to the namespace node | ||
184 | */ | ||
188 | external_object->reference.handle = | 185 | external_object->reference.handle = |
189 | internal_object->reference.node; | 186 | internal_object->reference.node; |
190 | external_object->reference.actual_type = | 187 | external_object->reference.actual_type = |
191 | acpi_ns_get_type(internal_object->reference.node); | 188 | acpi_ns_get_type(internal_object->reference.node); |
192 | break; | 189 | break; |
190 | |||
191 | default: | ||
192 | |||
193 | /* All other reference types are unsupported */ | ||
194 | |||
195 | return_ACPI_STATUS(AE_TYPE); | ||
193 | } | 196 | } |
194 | break; | 197 | break; |
195 | 198 | ||
@@ -533,7 +536,7 @@ acpi_ut_copy_esimple_to_isimple(union acpi_object *external_object, | |||
533 | 536 | ||
534 | /* TBD: should validate incoming handle */ | 537 | /* TBD: should validate incoming handle */ |
535 | 538 | ||
536 | internal_object->reference.opcode = AML_INT_NAMEPATH_OP; | 539 | internal_object->reference.class = ACPI_REFCLASS_NAME; |
537 | internal_object->reference.node = | 540 | internal_object->reference.node = |
538 | external_object->reference.handle; | 541 | external_object->reference.handle; |
539 | break; | 542 | break; |
@@ -743,11 +746,11 @@ acpi_ut_copy_simple_object(union acpi_operand_object *source_desc, | |||
743 | * We copied the reference object, so we now must add a reference | 746 | * We copied the reference object, so we now must add a reference |
744 | * to the object pointed to by the reference | 747 | * to the object pointed to by the reference |
745 | * | 748 | * |
746 | * DDBHandle reference (from Load/load_table is a special reference, | 749 | * DDBHandle reference (from Load/load_table) is a special reference, |
747 | * it's Reference.Object is the table index, so does not need to | 750 | * it does not have a Reference.Object, so does not need to |
748 | * increase the reference count | 751 | * increase the reference count |
749 | */ | 752 | */ |
750 | if (source_desc->reference.opcode == AML_LOAD_OP) { | 753 | if (source_desc->reference.class == ACPI_REFCLASS_TABLE) { |
751 | break; | 754 | break; |
752 | } | 755 | } |
753 | 756 | ||
diff --git a/drivers/acpi/utilities/utdelete.c b/drivers/acpi/utilities/utdelete.c index 42609d3a8aa9..d197c6b29e17 100644 --- a/drivers/acpi/utilities/utdelete.c +++ b/drivers/acpi/utilities/utdelete.c | |||
@@ -45,7 +45,6 @@ | |||
45 | #include <acpi/acinterp.h> | 45 | #include <acpi/acinterp.h> |
46 | #include <acpi/acnamesp.h> | 46 | #include <acpi/acnamesp.h> |
47 | #include <acpi/acevents.h> | 47 | #include <acpi/acevents.h> |
48 | #include <acpi/amlcode.h> | ||
49 | 48 | ||
50 | #define _COMPONENT ACPI_UTILITIES | 49 | #define _COMPONENT ACPI_UTILITIES |
51 | ACPI_MODULE_NAME("utdelete") | 50 | ACPI_MODULE_NAME("utdelete") |
@@ -548,8 +547,8 @@ acpi_ut_update_object_reference(union acpi_operand_object *object, u16 action) | |||
548 | * reference must track changes to the ref count of the index or | 547 | * reference must track changes to the ref count of the index or |
549 | * target object. | 548 | * target object. |
550 | */ | 549 | */ |
551 | if ((object->reference.opcode == AML_INDEX_OP) || | 550 | if ((object->reference.class == ACPI_REFCLASS_INDEX) || |
552 | (object->reference.opcode == AML_INT_NAMEPATH_OP)) { | 551 | (object->reference.class == ACPI_REFCLASS_NAME)) { |
553 | next_object = object->reference.object; | 552 | next_object = object->reference.object; |
554 | } | 553 | } |
555 | break; | 554 | break; |
@@ -586,6 +585,13 @@ acpi_ut_update_object_reference(union acpi_operand_object *object, u16 action) | |||
586 | ACPI_EXCEPTION((AE_INFO, status, | 585 | ACPI_EXCEPTION((AE_INFO, status, |
587 | "Could not update object reference count")); | 586 | "Could not update object reference count")); |
588 | 587 | ||
588 | /* Free any stacked Update State objects */ | ||
589 | |||
590 | while (state_list) { | ||
591 | state = acpi_ut_pop_generic_state(&state_list); | ||
592 | acpi_ut_delete_generic_state(state); | ||
593 | } | ||
594 | |||
589 | return_ACPI_STATUS(status); | 595 | return_ACPI_STATUS(status); |
590 | } | 596 | } |
591 | 597 | ||
diff --git a/drivers/acpi/utilities/utglobal.c b/drivers/acpi/utilities/utglobal.c index a6e71b801d2d..670551b95e56 100644 --- a/drivers/acpi/utilities/utglobal.c +++ b/drivers/acpi/utilities/utglobal.c | |||
@@ -281,7 +281,6 @@ struct acpi_bit_register_info acpi_gbl_bit_register_info[ACPI_NUM_BITREG] = { | |||
281 | /* ACPI_BITREG_RT_CLOCK_ENABLE */ {ACPI_REGISTER_PM1_ENABLE, | 281 | /* ACPI_BITREG_RT_CLOCK_ENABLE */ {ACPI_REGISTER_PM1_ENABLE, |
282 | ACPI_BITPOSITION_RT_CLOCK_ENABLE, | 282 | ACPI_BITPOSITION_RT_CLOCK_ENABLE, |
283 | ACPI_BITMASK_RT_CLOCK_ENABLE}, | 283 | ACPI_BITMASK_RT_CLOCK_ENABLE}, |
284 | /* ACPI_BITREG_WAKE_ENABLE */ {ACPI_REGISTER_PM1_ENABLE, 0, 0}, | ||
285 | /* ACPI_BITREG_PCIEXP_WAKE_DISABLE */ {ACPI_REGISTER_PM1_ENABLE, | 284 | /* ACPI_BITREG_PCIEXP_WAKE_DISABLE */ {ACPI_REGISTER_PM1_ENABLE, |
286 | ACPI_BITPOSITION_PCIEXP_WAKE_DISABLE, | 285 | ACPI_BITPOSITION_PCIEXP_WAKE_DISABLE, |
287 | ACPI_BITMASK_PCIEXP_WAKE_DISABLE}, | 286 | ACPI_BITMASK_PCIEXP_WAKE_DISABLE}, |
@@ -575,6 +574,47 @@ char *acpi_ut_get_descriptor_name(void *object) | |||
575 | 574 | ||
576 | } | 575 | } |
577 | 576 | ||
577 | /******************************************************************************* | ||
578 | * | ||
579 | * FUNCTION: acpi_ut_get_reference_name | ||
580 | * | ||
581 | * PARAMETERS: Object - An ACPI reference object | ||
582 | * | ||
583 | * RETURN: Pointer to a string | ||
584 | * | ||
585 | * DESCRIPTION: Decode a reference object sub-type to a string. | ||
586 | * | ||
587 | ******************************************************************************/ | ||
588 | |||
589 | /* Printable names of reference object sub-types */ | ||
590 | |||
591 | static const char *acpi_gbl_ref_class_names[] = { | ||
592 | /* 00 */ "Local", | ||
593 | /* 01 */ "Argument", | ||
594 | /* 02 */ "RefOf", | ||
595 | /* 03 */ "Index", | ||
596 | /* 04 */ "DdbHandle", | ||
597 | /* 05 */ "Named Object", | ||
598 | /* 06 */ "Debug" | ||
599 | }; | ||
600 | |||
601 | const char *acpi_ut_get_reference_name(union acpi_operand_object *object) | ||
602 | { | ||
603 | if (!object) | ||
604 | return "NULL Object"; | ||
605 | |||
606 | if (ACPI_GET_DESCRIPTOR_TYPE(object) != ACPI_DESC_TYPE_OPERAND) | ||
607 | return "Not an Operand object"; | ||
608 | |||
609 | if (object->common.type != ACPI_TYPE_LOCAL_REFERENCE) | ||
610 | return "Not a Reference object"; | ||
611 | |||
612 | if (object->reference.class > ACPI_REFCLASS_MAX) | ||
613 | return "Unknown Reference class"; | ||
614 | |||
615 | return acpi_gbl_ref_class_names[object->reference.class]; | ||
616 | } | ||
617 | |||
578 | #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) | 618 | #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) |
579 | /* | 619 | /* |
580 | * Strings and procedures used for debug only | 620 | * Strings and procedures used for debug only |
@@ -677,14 +717,14 @@ u8 acpi_ut_valid_object_type(acpi_object_type type) | |||
677 | * | 717 | * |
678 | * PARAMETERS: None | 718 | * PARAMETERS: None |
679 | * | 719 | * |
680 | * RETURN: None | 720 | * RETURN: Status |
681 | * | 721 | * |
682 | * DESCRIPTION: Init library globals. All globals that require specific | 722 | * DESCRIPTION: Init library globals. All globals that require specific |
683 | * initialization should be initialized here! | 723 | * initialization should be initialized here! |
684 | * | 724 | * |
685 | ******************************************************************************/ | 725 | ******************************************************************************/ |
686 | 726 | ||
687 | void acpi_ut_init_globals(void) | 727 | acpi_status acpi_ut_init_globals(void) |
688 | { | 728 | { |
689 | acpi_status status; | 729 | acpi_status status; |
690 | u32 i; | 730 | u32 i; |
@@ -695,7 +735,7 @@ void acpi_ut_init_globals(void) | |||
695 | 735 | ||
696 | status = acpi_ut_create_caches(); | 736 | status = acpi_ut_create_caches(); |
697 | if (ACPI_FAILURE(status)) { | 737 | if (ACPI_FAILURE(status)) { |
698 | return; | 738 | return_ACPI_STATUS(status); |
699 | } | 739 | } |
700 | 740 | ||
701 | /* Mutex locked flags */ | 741 | /* Mutex locked flags */ |
@@ -772,8 +812,8 @@ void acpi_ut_init_globals(void) | |||
772 | acpi_gbl_display_final_mem_stats = FALSE; | 812 | acpi_gbl_display_final_mem_stats = FALSE; |
773 | #endif | 813 | #endif |
774 | 814 | ||
775 | return_VOID; | 815 | return_ACPI_STATUS(AE_OK); |
776 | } | 816 | } |
777 | 817 | ||
778 | ACPI_EXPORT_SYMBOL(acpi_dbg_level) | 818 | ACPI_EXPORT_SYMBOL(acpi_dbg_level) |
779 | ACPI_EXPORT_SYMBOL(acpi_dbg_layer) | 819 | ACPI_EXPORT_SYMBOL(acpi_dbg_layer) |
diff --git a/drivers/acpi/utilities/utmisc.c b/drivers/acpi/utilities/utmisc.c index f34be6773556..9089a158a874 100644 --- a/drivers/acpi/utilities/utmisc.c +++ b/drivers/acpi/utilities/utmisc.c | |||
@@ -995,6 +995,15 @@ acpi_ut_walk_package_tree(union acpi_operand_object * source_object, | |||
995 | state->pkg. | 995 | state->pkg. |
996 | this_target_obj, 0); | 996 | this_target_obj, 0); |
997 | if (!state) { | 997 | if (!state) { |
998 | |||
999 | /* Free any stacked Update State objects */ | ||
1000 | |||
1001 | while (state_list) { | ||
1002 | state = | ||
1003 | acpi_ut_pop_generic_state | ||
1004 | (&state_list); | ||
1005 | acpi_ut_delete_generic_state(state); | ||
1006 | } | ||
998 | return_ACPI_STATUS(AE_NO_MEMORY); | 1007 | return_ACPI_STATUS(AE_NO_MEMORY); |
999 | } | 1008 | } |
1000 | } | 1009 | } |
diff --git a/drivers/acpi/utilities/utobject.c b/drivers/acpi/utilities/utobject.c index 916eff399eb3..c354e7a42bcd 100644 --- a/drivers/acpi/utilities/utobject.c +++ b/drivers/acpi/utilities/utobject.c | |||
@@ -43,7 +43,6 @@ | |||
43 | 43 | ||
44 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
45 | #include <acpi/acnamesp.h> | 45 | #include <acpi/acnamesp.h> |
46 | #include <acpi/amlcode.h> | ||
47 | 46 | ||
48 | #define _COMPONENT ACPI_UTILITIES | 47 | #define _COMPONENT ACPI_UTILITIES |
49 | ACPI_MODULE_NAME("utobject") | 48 | ACPI_MODULE_NAME("utobject") |
@@ -478,8 +477,8 @@ acpi_ut_get_simple_object_size(union acpi_operand_object *internal_object, | |||
478 | 477 | ||
479 | case ACPI_TYPE_LOCAL_REFERENCE: | 478 | case ACPI_TYPE_LOCAL_REFERENCE: |
480 | 479 | ||
481 | switch (internal_object->reference.opcode) { | 480 | switch (internal_object->reference.class) { |
482 | case AML_INT_NAMEPATH_OP: | 481 | case ACPI_REFCLASS_NAME: |
483 | 482 | ||
484 | /* | 483 | /* |
485 | * Get the actual length of the full pathname to this object. | 484 | * Get the actual length of the full pathname to this object. |
@@ -503,8 +502,10 @@ acpi_ut_get_simple_object_size(union acpi_operand_object *internal_object, | |||
503 | * required eventually. | 502 | * required eventually. |
504 | */ | 503 | */ |
505 | ACPI_ERROR((AE_INFO, | 504 | ACPI_ERROR((AE_INFO, |
506 | "Unsupported Reference opcode=%X in object %p", | 505 | "Cannot convert to external object - " |
507 | internal_object->reference.opcode, | 506 | "unsupported Reference Class [%s] %X in object %p", |
507 | acpi_ut_get_reference_name(internal_object), | ||
508 | internal_object->reference.class, | ||
508 | internal_object)); | 509 | internal_object)); |
509 | status = AE_TYPE; | 510 | status = AE_TYPE; |
510 | break; | 511 | break; |
@@ -513,7 +514,9 @@ acpi_ut_get_simple_object_size(union acpi_operand_object *internal_object, | |||
513 | 514 | ||
514 | default: | 515 | default: |
515 | 516 | ||
516 | ACPI_ERROR((AE_INFO, "Unsupported type=%X in object %p", | 517 | ACPI_ERROR((AE_INFO, "Cannot convert to external object - " |
518 | "unsupported type [%s] %X in object %p", | ||
519 | acpi_ut_get_object_type_name(internal_object), | ||
517 | ACPI_GET_OBJECT_TYPE(internal_object), | 520 | ACPI_GET_OBJECT_TYPE(internal_object), |
518 | internal_object)); | 521 | internal_object)); |
519 | status = AE_TYPE; | 522 | status = AE_TYPE; |
diff --git a/drivers/acpi/utilities/utxface.c b/drivers/acpi/utilities/utxface.c index f8bdadf3c32f..c198a4d40583 100644 --- a/drivers/acpi/utilities/utxface.c +++ b/drivers/acpi/utilities/utxface.c | |||
@@ -81,7 +81,12 @@ acpi_status __init acpi_initialize_subsystem(void) | |||
81 | 81 | ||
82 | /* Initialize all globals used by the subsystem */ | 82 | /* Initialize all globals used by the subsystem */ |
83 | 83 | ||
84 | acpi_ut_init_globals(); | 84 | status = acpi_ut_init_globals(); |
85 | if (ACPI_FAILURE(status)) { | ||
86 | ACPI_EXCEPTION((AE_INFO, status, | ||
87 | "During initialization of globals")); | ||
88 | return_ACPI_STATUS(status); | ||
89 | } | ||
85 | 90 | ||
86 | /* Create the default mutex objects */ | 91 | /* Create the default mutex objects */ |
87 | 92 | ||
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index e8a51a1700f7..4ae39ee8cdef 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c | |||
@@ -1530,8 +1530,8 @@ acpi_video_bus_get_one_device(struct acpi_device *device, | |||
1530 | acpi_video_device_notify, | 1530 | acpi_video_device_notify, |
1531 | data); | 1531 | data); |
1532 | if (ACPI_FAILURE(status)) { | 1532 | if (ACPI_FAILURE(status)) { |
1533 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 1533 | printk(KERN_ERR PREFIX |
1534 | "Error installing notify handler\n")); | 1534 | "Error installing notify handler\n"); |
1535 | if(data->brightness) | 1535 | if(data->brightness) |
1536 | kfree(data->brightness->levels); | 1536 | kfree(data->brightness->levels); |
1537 | kfree(data->brightness); | 1537 | kfree(data->brightness); |
@@ -1745,8 +1745,8 @@ acpi_video_bus_get_devices(struct acpi_video_bus *video, | |||
1745 | 1745 | ||
1746 | status = acpi_video_bus_get_one_device(dev, video); | 1746 | status = acpi_video_bus_get_one_device(dev, video); |
1747 | if (ACPI_FAILURE(status)) { | 1747 | if (ACPI_FAILURE(status)) { |
1748 | ACPI_DEBUG_PRINT((ACPI_DB_WARN, | 1748 | printk(KERN_WARNING PREFIX |
1749 | "Cant attach device")); | 1749 | "Cant attach device"); |
1750 | continue; | 1750 | continue; |
1751 | } | 1751 | } |
1752 | } | 1752 | } |
@@ -2003,8 +2003,8 @@ static int acpi_video_bus_add(struct acpi_device *device) | |||
2003 | ACPI_DEVICE_NOTIFY, | 2003 | ACPI_DEVICE_NOTIFY, |
2004 | acpi_video_bus_notify, video); | 2004 | acpi_video_bus_notify, video); |
2005 | if (ACPI_FAILURE(status)) { | 2005 | if (ACPI_FAILURE(status)) { |
2006 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 2006 | printk(KERN_ERR PREFIX |
2007 | "Error installing notify handler\n")); | 2007 | "Error installing notify handler\n"); |
2008 | error = -ENODEV; | 2008 | error = -ENODEV; |
2009 | goto err_stop_video; | 2009 | goto err_stop_video; |
2010 | } | 2010 | } |
diff --git a/include/acpi/acconfig.h b/include/acpi/acconfig.h index 4eb75a88795a..29feee27f0ea 100644 --- a/include/acpi/acconfig.h +++ b/include/acpi/acconfig.h | |||
@@ -63,7 +63,7 @@ | |||
63 | 63 | ||
64 | /* Current ACPICA subsystem version in YYYYMMDD format */ | 64 | /* Current ACPICA subsystem version in YYYYMMDD format */ |
65 | 65 | ||
66 | #define ACPI_CA_VERSION 0x20080609 | 66 | #define ACPI_CA_VERSION 0x20080926 |
67 | 67 | ||
68 | /* | 68 | /* |
69 | * OS name, used for the _OS object. The _OS object is essentially obsolete, | 69 | * OS name, used for the _OS object. The _OS object is essentially obsolete, |
diff --git a/include/acpi/acdebug.h b/include/acpi/acdebug.h index c5a1b50d8d94..62c59df3b86c 100644 --- a/include/acpi/acdebug.h +++ b/include/acpi/acdebug.h | |||
@@ -123,6 +123,10 @@ void acpi_db_check_integrity(void); | |||
123 | 123 | ||
124 | void acpi_db_generate_gpe(char *gpe_arg, char *block_arg); | 124 | void acpi_db_generate_gpe(char *gpe_arg, char *block_arg); |
125 | 125 | ||
126 | void acpi_db_check_predefined_names(void); | ||
127 | |||
128 | void acpi_db_batch_execute(void); | ||
129 | |||
126 | /* | 130 | /* |
127 | * dbdisply - debug display commands | 131 | * dbdisply - debug display commands |
128 | */ | 132 | */ |
@@ -150,6 +154,10 @@ void | |||
150 | acpi_db_display_argument_object(union acpi_operand_object *obj_desc, | 154 | acpi_db_display_argument_object(union acpi_operand_object *obj_desc, |
151 | struct acpi_walk_state *walk_state); | 155 | struct acpi_walk_state *walk_state); |
152 | 156 | ||
157 | void acpi_db_check_predefined_names(void); | ||
158 | |||
159 | void acpi_db_batch_execute(void); | ||
160 | |||
153 | /* | 161 | /* |
154 | * dbexec - debugger control method execution | 162 | * dbexec - debugger control method execution |
155 | */ | 163 | */ |
diff --git a/include/acpi/acdisasm.h b/include/acpi/acdisasm.h index f53faca8ec80..0c1ed387073c 100644 --- a/include/acpi/acdisasm.h +++ b/include/acpi/acdisasm.h | |||
@@ -186,6 +186,8 @@ extern struct acpi_dmtable_info acpi_dm_table_info_madt5[]; | |||
186 | extern struct acpi_dmtable_info acpi_dm_table_info_madt6[]; | 186 | extern struct acpi_dmtable_info acpi_dm_table_info_madt6[]; |
187 | extern struct acpi_dmtable_info acpi_dm_table_info_madt7[]; | 187 | extern struct acpi_dmtable_info acpi_dm_table_info_madt7[]; |
188 | extern struct acpi_dmtable_info acpi_dm_table_info_madt8[]; | 188 | extern struct acpi_dmtable_info acpi_dm_table_info_madt8[]; |
189 | extern struct acpi_dmtable_info acpi_dm_table_info_madt9[]; | ||
190 | extern struct acpi_dmtable_info acpi_dm_table_info_madt10[]; | ||
189 | extern struct acpi_dmtable_info acpi_dm_table_info_madt_hdr[]; | 191 | extern struct acpi_dmtable_info acpi_dm_table_info_madt_hdr[]; |
190 | extern struct acpi_dmtable_info acpi_dm_table_info_mcfg[]; | 192 | extern struct acpi_dmtable_info acpi_dm_table_info_mcfg[]; |
191 | extern struct acpi_dmtable_info acpi_dm_table_info_mcfg0[]; | 193 | extern struct acpi_dmtable_info acpi_dm_table_info_mcfg0[]; |
@@ -197,8 +199,10 @@ extern struct acpi_dmtable_info acpi_dm_table_info_slit[]; | |||
197 | extern struct acpi_dmtable_info acpi_dm_table_info_spcr[]; | 199 | extern struct acpi_dmtable_info acpi_dm_table_info_spcr[]; |
198 | extern struct acpi_dmtable_info acpi_dm_table_info_spmi[]; | 200 | extern struct acpi_dmtable_info acpi_dm_table_info_spmi[]; |
199 | extern struct acpi_dmtable_info acpi_dm_table_info_srat[]; | 201 | extern struct acpi_dmtable_info acpi_dm_table_info_srat[]; |
202 | extern struct acpi_dmtable_info acpi_dm_table_info_srat_hdr[]; | ||
200 | extern struct acpi_dmtable_info acpi_dm_table_info_srat0[]; | 203 | extern struct acpi_dmtable_info acpi_dm_table_info_srat0[]; |
201 | extern struct acpi_dmtable_info acpi_dm_table_info_srat1[]; | 204 | extern struct acpi_dmtable_info acpi_dm_table_info_srat1[]; |
205 | extern struct acpi_dmtable_info acpi_dm_table_info_srat2[]; | ||
202 | extern struct acpi_dmtable_info acpi_dm_table_info_tcpa[]; | 206 | extern struct acpi_dmtable_info acpi_dm_table_info_tcpa[]; |
203 | extern struct acpi_dmtable_info acpi_dm_table_info_wdrt[]; | 207 | extern struct acpi_dmtable_info acpi_dm_table_info_wdrt[]; |
204 | 208 | ||
diff --git a/include/acpi/acdispat.h b/include/acpi/acdispat.h index 21a73a105d0a..6291904be01e 100644 --- a/include/acpi/acdispat.h +++ b/include/acpi/acdispat.h | |||
@@ -157,7 +157,7 @@ acpi_ds_init_callbacks(struct acpi_walk_state *walk_state, u32 pass_number); | |||
157 | * dsmthdat - method data (locals/args) | 157 | * dsmthdat - method data (locals/args) |
158 | */ | 158 | */ |
159 | acpi_status | 159 | acpi_status |
160 | acpi_ds_store_object_to_local(u16 opcode, | 160 | acpi_ds_store_object_to_local(u8 type, |
161 | u32 index, | 161 | u32 index, |
162 | union acpi_operand_object *src_desc, | 162 | union acpi_operand_object *src_desc, |
163 | struct acpi_walk_state *walk_state); | 163 | struct acpi_walk_state *walk_state); |
@@ -173,7 +173,7 @@ void acpi_ds_method_data_delete_all(struct acpi_walk_state *walk_state); | |||
173 | u8 acpi_ds_is_method_value(union acpi_operand_object *obj_desc); | 173 | u8 acpi_ds_is_method_value(union acpi_operand_object *obj_desc); |
174 | 174 | ||
175 | acpi_status | 175 | acpi_status |
176 | acpi_ds_method_data_get_value(u16 opcode, | 176 | acpi_ds_method_data_get_value(u8 type, |
177 | u32 index, | 177 | u32 index, |
178 | struct acpi_walk_state *walk_state, | 178 | struct acpi_walk_state *walk_state, |
179 | union acpi_operand_object **dest_desc); | 179 | union acpi_operand_object **dest_desc); |
@@ -184,7 +184,7 @@ acpi_ds_method_data_init_args(union acpi_operand_object **params, | |||
184 | struct acpi_walk_state *walk_state); | 184 | struct acpi_walk_state *walk_state); |
185 | 185 | ||
186 | acpi_status | 186 | acpi_status |
187 | acpi_ds_method_data_get_node(u16 opcode, | 187 | acpi_ds_method_data_get_node(u8 type, |
188 | u32 index, | 188 | u32 index, |
189 | struct acpi_walk_state *walk_state, | 189 | struct acpi_walk_state *walk_state, |
190 | struct acpi_namespace_node **node); | 190 | struct acpi_namespace_node **node); |
diff --git a/include/acpi/acexcep.h b/include/acpi/acexcep.h index e5a890ffeb02..84f5cb242863 100644 --- a/include/acpi/acexcep.h +++ b/include/acpi/acexcep.h | |||
@@ -76,25 +76,21 @@ | |||
76 | #define AE_STACK_OVERFLOW (acpi_status) (0x000C | AE_CODE_ENVIRONMENTAL) | 76 | #define AE_STACK_OVERFLOW (acpi_status) (0x000C | AE_CODE_ENVIRONMENTAL) |
77 | #define AE_STACK_UNDERFLOW (acpi_status) (0x000D | AE_CODE_ENVIRONMENTAL) | 77 | #define AE_STACK_UNDERFLOW (acpi_status) (0x000D | AE_CODE_ENVIRONMENTAL) |
78 | #define AE_NOT_IMPLEMENTED (acpi_status) (0x000E | AE_CODE_ENVIRONMENTAL) | 78 | #define AE_NOT_IMPLEMENTED (acpi_status) (0x000E | AE_CODE_ENVIRONMENTAL) |
79 | #define AE_VERSION_MISMATCH (acpi_status) (0x000F | AE_CODE_ENVIRONMENTAL) | 79 | #define AE_SUPPORT (acpi_status) (0x000F | AE_CODE_ENVIRONMENTAL) |
80 | #define AE_SUPPORT (acpi_status) (0x0010 | AE_CODE_ENVIRONMENTAL) | 80 | #define AE_LIMIT (acpi_status) (0x0010 | AE_CODE_ENVIRONMENTAL) |
81 | #define AE_SHARE (acpi_status) (0x0011 | AE_CODE_ENVIRONMENTAL) | 81 | #define AE_TIME (acpi_status) (0x0011 | AE_CODE_ENVIRONMENTAL) |
82 | #define AE_LIMIT (acpi_status) (0x0012 | AE_CODE_ENVIRONMENTAL) | 82 | #define AE_ACQUIRE_DEADLOCK (acpi_status) (0x0012 | AE_CODE_ENVIRONMENTAL) |
83 | #define AE_TIME (acpi_status) (0x0013 | AE_CODE_ENVIRONMENTAL) | 83 | #define AE_RELEASE_DEADLOCK (acpi_status) (0x0013 | AE_CODE_ENVIRONMENTAL) |
84 | #define AE_UNKNOWN_STATUS (acpi_status) (0x0014 | AE_CODE_ENVIRONMENTAL) | 84 | #define AE_NOT_ACQUIRED (acpi_status) (0x0014 | AE_CODE_ENVIRONMENTAL) |
85 | #define AE_ACQUIRE_DEADLOCK (acpi_status) (0x0015 | AE_CODE_ENVIRONMENTAL) | 85 | #define AE_ALREADY_ACQUIRED (acpi_status) (0x0015 | AE_CODE_ENVIRONMENTAL) |
86 | #define AE_RELEASE_DEADLOCK (acpi_status) (0x0016 | AE_CODE_ENVIRONMENTAL) | 86 | #define AE_NO_HARDWARE_RESPONSE (acpi_status) (0x0016 | AE_CODE_ENVIRONMENTAL) |
87 | #define AE_NOT_ACQUIRED (acpi_status) (0x0017 | AE_CODE_ENVIRONMENTAL) | 87 | #define AE_NO_GLOBAL_LOCK (acpi_status) (0x0017 | AE_CODE_ENVIRONMENTAL) |
88 | #define AE_ALREADY_ACQUIRED (acpi_status) (0x0018 | AE_CODE_ENVIRONMENTAL) | 88 | #define AE_ABORT_METHOD (acpi_status) (0x0018 | AE_CODE_ENVIRONMENTAL) |
89 | #define AE_NO_HARDWARE_RESPONSE (acpi_status) (0x0019 | AE_CODE_ENVIRONMENTAL) | 89 | #define AE_SAME_HANDLER (acpi_status) (0x0019 | AE_CODE_ENVIRONMENTAL) |
90 | #define AE_NO_GLOBAL_LOCK (acpi_status) (0x001A | AE_CODE_ENVIRONMENTAL) | 90 | #define AE_WAKE_ONLY_GPE (acpi_status) (0x001A | AE_CODE_ENVIRONMENTAL) |
91 | #define AE_LOGICAL_ADDRESS (acpi_status) (0x001B | AE_CODE_ENVIRONMENTAL) | 91 | #define AE_OWNER_ID_LIMIT (acpi_status) (0x001B | AE_CODE_ENVIRONMENTAL) |
92 | #define AE_ABORT_METHOD (acpi_status) (0x001C | AE_CODE_ENVIRONMENTAL) | ||
93 | #define AE_SAME_HANDLER (acpi_status) (0x001D | AE_CODE_ENVIRONMENTAL) | ||
94 | #define AE_WAKE_ONLY_GPE (acpi_status) (0x001E | AE_CODE_ENVIRONMENTAL) | ||
95 | #define AE_OWNER_ID_LIMIT (acpi_status) (0x001F | AE_CODE_ENVIRONMENTAL) | ||
96 | 92 | ||
97 | #define AE_CODE_ENV_MAX 0x001F | 93 | #define AE_CODE_ENV_MAX 0x001B |
98 | 94 | ||
99 | /* | 95 | /* |
100 | * Programmer exceptions | 96 | * Programmer exceptions |
@@ -103,14 +99,12 @@ | |||
103 | #define AE_BAD_CHARACTER (acpi_status) (0x0002 | AE_CODE_PROGRAMMER) | 99 | #define AE_BAD_CHARACTER (acpi_status) (0x0002 | AE_CODE_PROGRAMMER) |
104 | #define AE_BAD_PATHNAME (acpi_status) (0x0003 | AE_CODE_PROGRAMMER) | 100 | #define AE_BAD_PATHNAME (acpi_status) (0x0003 | AE_CODE_PROGRAMMER) |
105 | #define AE_BAD_DATA (acpi_status) (0x0004 | AE_CODE_PROGRAMMER) | 101 | #define AE_BAD_DATA (acpi_status) (0x0004 | AE_CODE_PROGRAMMER) |
106 | #define AE_BAD_ADDRESS (acpi_status) (0x0005 | AE_CODE_PROGRAMMER) | 102 | #define AE_BAD_HEX_CONSTANT (acpi_status) (0x0005 | AE_CODE_PROGRAMMER) |
107 | #define AE_ALIGNMENT (acpi_status) (0x0006 | AE_CODE_PROGRAMMER) | 103 | #define AE_BAD_OCTAL_CONSTANT (acpi_status) (0x0006 | AE_CODE_PROGRAMMER) |
108 | #define AE_BAD_HEX_CONSTANT (acpi_status) (0x0007 | AE_CODE_PROGRAMMER) | 104 | #define AE_BAD_DECIMAL_CONSTANT (acpi_status) (0x0007 | AE_CODE_PROGRAMMER) |
109 | #define AE_BAD_OCTAL_CONSTANT (acpi_status) (0x0008 | AE_CODE_PROGRAMMER) | 105 | #define AE_MISSING_ARGUMENTS (acpi_status) (0x0008 | AE_CODE_PROGRAMMER) |
110 | #define AE_BAD_DECIMAL_CONSTANT (acpi_status) (0x0009 | AE_CODE_PROGRAMMER) | ||
111 | #define AE_MISSING_ARGUMENTS (acpi_status) (0x000A | AE_CODE_PROGRAMMER) | ||
112 | 106 | ||
113 | #define AE_CODE_PGM_MAX 0x000A | 107 | #define AE_CODE_PGM_MAX 0x0008 |
114 | 108 | ||
115 | /* | 109 | /* |
116 | * Acpi table exceptions | 110 | * Acpi table exceptions |
@@ -119,51 +113,48 @@ | |||
119 | #define AE_BAD_HEADER (acpi_status) (0x0002 | AE_CODE_ACPI_TABLES) | 113 | #define AE_BAD_HEADER (acpi_status) (0x0002 | AE_CODE_ACPI_TABLES) |
120 | #define AE_BAD_CHECKSUM (acpi_status) (0x0003 | AE_CODE_ACPI_TABLES) | 114 | #define AE_BAD_CHECKSUM (acpi_status) (0x0003 | AE_CODE_ACPI_TABLES) |
121 | #define AE_BAD_VALUE (acpi_status) (0x0004 | AE_CODE_ACPI_TABLES) | 115 | #define AE_BAD_VALUE (acpi_status) (0x0004 | AE_CODE_ACPI_TABLES) |
122 | #define AE_TABLE_NOT_SUPPORTED (acpi_status) (0x0005 | AE_CODE_ACPI_TABLES) | 116 | #define AE_INVALID_TABLE_LENGTH (acpi_status) (0x0005 | AE_CODE_ACPI_TABLES) |
123 | #define AE_INVALID_TABLE_LENGTH (acpi_status) (0x0006 | AE_CODE_ACPI_TABLES) | ||
124 | 117 | ||
125 | #define AE_CODE_TBL_MAX 0x0006 | 118 | #define AE_CODE_TBL_MAX 0x0005 |
126 | 119 | ||
127 | /* | 120 | /* |
128 | * AML exceptions. These are caused by problems with | 121 | * AML exceptions. These are caused by problems with |
129 | * the actual AML byte stream | 122 | * the actual AML byte stream |
130 | */ | 123 | */ |
131 | #define AE_AML_ERROR (acpi_status) (0x0001 | AE_CODE_AML) | 124 | #define AE_AML_BAD_OPCODE (acpi_status) (0x0001 | AE_CODE_AML) |
132 | #define AE_AML_PARSE (acpi_status) (0x0002 | AE_CODE_AML) | 125 | #define AE_AML_NO_OPERAND (acpi_status) (0x0002 | AE_CODE_AML) |
133 | #define AE_AML_BAD_OPCODE (acpi_status) (0x0003 | AE_CODE_AML) | 126 | #define AE_AML_OPERAND_TYPE (acpi_status) (0x0003 | AE_CODE_AML) |
134 | #define AE_AML_NO_OPERAND (acpi_status) (0x0004 | AE_CODE_AML) | 127 | #define AE_AML_OPERAND_VALUE (acpi_status) (0x0004 | AE_CODE_AML) |
135 | #define AE_AML_OPERAND_TYPE (acpi_status) (0x0005 | AE_CODE_AML) | 128 | #define AE_AML_UNINITIALIZED_LOCAL (acpi_status) (0x0005 | AE_CODE_AML) |
136 | #define AE_AML_OPERAND_VALUE (acpi_status) (0x0006 | AE_CODE_AML) | 129 | #define AE_AML_UNINITIALIZED_ARG (acpi_status) (0x0006 | AE_CODE_AML) |
137 | #define AE_AML_UNINITIALIZED_LOCAL (acpi_status) (0x0007 | AE_CODE_AML) | 130 | #define AE_AML_UNINITIALIZED_ELEMENT (acpi_status) (0x0007 | AE_CODE_AML) |
138 | #define AE_AML_UNINITIALIZED_ARG (acpi_status) (0x0008 | AE_CODE_AML) | 131 | #define AE_AML_NUMERIC_OVERFLOW (acpi_status) (0x0008 | AE_CODE_AML) |
139 | #define AE_AML_UNINITIALIZED_ELEMENT (acpi_status) (0x0009 | AE_CODE_AML) | 132 | #define AE_AML_REGION_LIMIT (acpi_status) (0x0009 | AE_CODE_AML) |
140 | #define AE_AML_NUMERIC_OVERFLOW (acpi_status) (0x000A | AE_CODE_AML) | 133 | #define AE_AML_BUFFER_LIMIT (acpi_status) (0x000A | AE_CODE_AML) |
141 | #define AE_AML_REGION_LIMIT (acpi_status) (0x000B | AE_CODE_AML) | 134 | #define AE_AML_PACKAGE_LIMIT (acpi_status) (0x000B | AE_CODE_AML) |
142 | #define AE_AML_BUFFER_LIMIT (acpi_status) (0x000C | AE_CODE_AML) | 135 | #define AE_AML_DIVIDE_BY_ZERO (acpi_status) (0x000C | AE_CODE_AML) |
143 | #define AE_AML_PACKAGE_LIMIT (acpi_status) (0x000D | AE_CODE_AML) | 136 | #define AE_AML_BAD_NAME (acpi_status) (0x000D | AE_CODE_AML) |
144 | #define AE_AML_DIVIDE_BY_ZERO (acpi_status) (0x000E | AE_CODE_AML) | 137 | #define AE_AML_NAME_NOT_FOUND (acpi_status) (0x000E | AE_CODE_AML) |
145 | #define AE_AML_BAD_NAME (acpi_status) (0x000F | AE_CODE_AML) | 138 | #define AE_AML_INTERNAL (acpi_status) (0x000F | AE_CODE_AML) |
146 | #define AE_AML_NAME_NOT_FOUND (acpi_status) (0x0010 | AE_CODE_AML) | 139 | #define AE_AML_INVALID_SPACE_ID (acpi_status) (0x0010 | AE_CODE_AML) |
147 | #define AE_AML_INTERNAL (acpi_status) (0x0011 | AE_CODE_AML) | 140 | #define AE_AML_STRING_LIMIT (acpi_status) (0x0011 | AE_CODE_AML) |
148 | #define AE_AML_INVALID_SPACE_ID (acpi_status) (0x0012 | AE_CODE_AML) | 141 | #define AE_AML_NO_RETURN_VALUE (acpi_status) (0x0012 | AE_CODE_AML) |
149 | #define AE_AML_STRING_LIMIT (acpi_status) (0x0013 | AE_CODE_AML) | 142 | #define AE_AML_METHOD_LIMIT (acpi_status) (0x0013 | AE_CODE_AML) |
150 | #define AE_AML_NO_RETURN_VALUE (acpi_status) (0x0014 | AE_CODE_AML) | 143 | #define AE_AML_NOT_OWNER (acpi_status) (0x0014 | AE_CODE_AML) |
151 | #define AE_AML_METHOD_LIMIT (acpi_status) (0x0015 | AE_CODE_AML) | 144 | #define AE_AML_MUTEX_ORDER (acpi_status) (0x0015 | AE_CODE_AML) |
152 | #define AE_AML_NOT_OWNER (acpi_status) (0x0016 | AE_CODE_AML) | 145 | #define AE_AML_MUTEX_NOT_ACQUIRED (acpi_status) (0x0016 | AE_CODE_AML) |
153 | #define AE_AML_MUTEX_ORDER (acpi_status) (0x0017 | AE_CODE_AML) | 146 | #define AE_AML_INVALID_RESOURCE_TYPE (acpi_status) (0x0017 | AE_CODE_AML) |
154 | #define AE_AML_MUTEX_NOT_ACQUIRED (acpi_status) (0x0018 | AE_CODE_AML) | 147 | #define AE_AML_INVALID_INDEX (acpi_status) (0x0018 | AE_CODE_AML) |
155 | #define AE_AML_INVALID_RESOURCE_TYPE (acpi_status) (0x0019 | AE_CODE_AML) | 148 | #define AE_AML_REGISTER_LIMIT (acpi_status) (0x0019 | AE_CODE_AML) |
156 | #define AE_AML_INVALID_INDEX (acpi_status) (0x001A | AE_CODE_AML) | 149 | #define AE_AML_NO_WHILE (acpi_status) (0x001A | AE_CODE_AML) |
157 | #define AE_AML_REGISTER_LIMIT (acpi_status) (0x001B | AE_CODE_AML) | 150 | #define AE_AML_ALIGNMENT (acpi_status) (0x001B | AE_CODE_AML) |
158 | #define AE_AML_NO_WHILE (acpi_status) (0x001C | AE_CODE_AML) | 151 | #define AE_AML_NO_RESOURCE_END_TAG (acpi_status) (0x001C | AE_CODE_AML) |
159 | #define AE_AML_ALIGNMENT (acpi_status) (0x001D | AE_CODE_AML) | 152 | #define AE_AML_BAD_RESOURCE_VALUE (acpi_status) (0x001D | AE_CODE_AML) |
160 | #define AE_AML_NO_RESOURCE_END_TAG (acpi_status) (0x001E | AE_CODE_AML) | 153 | #define AE_AML_CIRCULAR_REFERENCE (acpi_status) (0x001E | AE_CODE_AML) |
161 | #define AE_AML_BAD_RESOURCE_VALUE (acpi_status) (0x001F | AE_CODE_AML) | 154 | #define AE_AML_BAD_RESOURCE_LENGTH (acpi_status) (0x001F | AE_CODE_AML) |
162 | #define AE_AML_CIRCULAR_REFERENCE (acpi_status) (0x0020 | AE_CODE_AML) | 155 | #define AE_AML_ILLEGAL_ADDRESS (acpi_status) (0x0020 | AE_CODE_AML) |
163 | #define AE_AML_BAD_RESOURCE_LENGTH (acpi_status) (0x0021 | AE_CODE_AML) | ||
164 | #define AE_AML_ILLEGAL_ADDRESS (acpi_status) (0x0022 | AE_CODE_AML) | ||
165 | 156 | ||
166 | #define AE_CODE_AML_MAX 0x0022 | 157 | #define AE_CODE_AML_MAX 0x0020 |
167 | 158 | ||
168 | /* | 159 | /* |
169 | * Internal exceptions used for control | 160 | * Internal exceptions used for control |
@@ -206,19 +197,15 @@ char const *acpi_gbl_exception_names_env[] = { | |||
206 | "AE_STACK_OVERFLOW", | 197 | "AE_STACK_OVERFLOW", |
207 | "AE_STACK_UNDERFLOW", | 198 | "AE_STACK_UNDERFLOW", |
208 | "AE_NOT_IMPLEMENTED", | 199 | "AE_NOT_IMPLEMENTED", |
209 | "AE_VERSION_MISMATCH", | ||
210 | "AE_SUPPORT", | 200 | "AE_SUPPORT", |
211 | "AE_SHARE", | ||
212 | "AE_LIMIT", | 201 | "AE_LIMIT", |
213 | "AE_TIME", | 202 | "AE_TIME", |
214 | "AE_UNKNOWN_STATUS", | ||
215 | "AE_ACQUIRE_DEADLOCK", | 203 | "AE_ACQUIRE_DEADLOCK", |
216 | "AE_RELEASE_DEADLOCK", | 204 | "AE_RELEASE_DEADLOCK", |
217 | "AE_NOT_ACQUIRED", | 205 | "AE_NOT_ACQUIRED", |
218 | "AE_ALREADY_ACQUIRED", | 206 | "AE_ALREADY_ACQUIRED", |
219 | "AE_NO_HARDWARE_RESPONSE", | 207 | "AE_NO_HARDWARE_RESPONSE", |
220 | "AE_NO_GLOBAL_LOCK", | 208 | "AE_NO_GLOBAL_LOCK", |
221 | "AE_LOGICAL_ADDRESS", | ||
222 | "AE_ABORT_METHOD", | 209 | "AE_ABORT_METHOD", |
223 | "AE_SAME_HANDLER", | 210 | "AE_SAME_HANDLER", |
224 | "AE_WAKE_ONLY_GPE", | 211 | "AE_WAKE_ONLY_GPE", |
@@ -231,8 +218,6 @@ char const *acpi_gbl_exception_names_pgm[] = { | |||
231 | "AE_BAD_CHARACTER", | 218 | "AE_BAD_CHARACTER", |
232 | "AE_BAD_PATHNAME", | 219 | "AE_BAD_PATHNAME", |
233 | "AE_BAD_DATA", | 220 | "AE_BAD_DATA", |
234 | "AE_BAD_ADDRESS", | ||
235 | "AE_ALIGNMENT", | ||
236 | "AE_BAD_HEX_CONSTANT", | 221 | "AE_BAD_HEX_CONSTANT", |
237 | "AE_BAD_OCTAL_CONSTANT", | 222 | "AE_BAD_OCTAL_CONSTANT", |
238 | "AE_BAD_DECIMAL_CONSTANT", | 223 | "AE_BAD_DECIMAL_CONSTANT", |
@@ -245,14 +230,11 @@ char const *acpi_gbl_exception_names_tbl[] = { | |||
245 | "AE_BAD_HEADER", | 230 | "AE_BAD_HEADER", |
246 | "AE_BAD_CHECKSUM", | 231 | "AE_BAD_CHECKSUM", |
247 | "AE_BAD_VALUE", | 232 | "AE_BAD_VALUE", |
248 | "AE_TABLE_NOT_SUPPORTED", | ||
249 | "AE_INVALID_TABLE_LENGTH" | 233 | "AE_INVALID_TABLE_LENGTH" |
250 | }; | 234 | }; |
251 | 235 | ||
252 | char const *acpi_gbl_exception_names_aml[] = { | 236 | char const *acpi_gbl_exception_names_aml[] = { |
253 | NULL, | 237 | NULL, |
254 | "AE_AML_ERROR", | ||
255 | "AE_AML_PARSE", | ||
256 | "AE_AML_BAD_OPCODE", | 238 | "AE_AML_BAD_OPCODE", |
257 | "AE_AML_NO_OPERAND", | 239 | "AE_AML_NO_OPERAND", |
258 | "AE_AML_OPERAND_TYPE", | 240 | "AE_AML_OPERAND_TYPE", |
@@ -284,7 +266,7 @@ char const *acpi_gbl_exception_names_aml[] = { | |||
284 | "AE_AML_BAD_RESOURCE_VALUE", | 266 | "AE_AML_BAD_RESOURCE_VALUE", |
285 | "AE_AML_CIRCULAR_REFERENCE", | 267 | "AE_AML_CIRCULAR_REFERENCE", |
286 | "AE_AML_BAD_RESOURCE_LENGTH", | 268 | "AE_AML_BAD_RESOURCE_LENGTH", |
287 | "AE_AML_ILLEGAL_ADDRESS" | 269 | "AE_AML_ILLEGAL_ADDRESS", |
288 | }; | 270 | }; |
289 | 271 | ||
290 | char const *acpi_gbl_exception_names_ctrl[] = { | 272 | char const *acpi_gbl_exception_names_ctrl[] = { |
diff --git a/include/acpi/aclocal.h b/include/acpi/aclocal.h index b221c8583ddd..ecab527cf78e 100644 --- a/include/acpi/aclocal.h +++ b/include/acpi/aclocal.h | |||
@@ -208,6 +208,7 @@ struct acpi_namespace_node { | |||
208 | #define ANOBJ_METHOD_ARG 0x04 /* Node is a method argument */ | 208 | #define ANOBJ_METHOD_ARG 0x04 /* Node is a method argument */ |
209 | #define ANOBJ_METHOD_LOCAL 0x08 /* Node is a method local */ | 209 | #define ANOBJ_METHOD_LOCAL 0x08 /* Node is a method local */ |
210 | #define ANOBJ_SUBTREE_HAS_INI 0x10 /* Used to optimize device initialization */ | 210 | #define ANOBJ_SUBTREE_HAS_INI 0x10 /* Used to optimize device initialization */ |
211 | #define ANOBJ_EVALUATED 0x20 /* Set on first evaluation of node */ | ||
211 | 212 | ||
212 | #define ANOBJ_IS_EXTERNAL 0x08 /* i_aSL only: This object created via External() */ | 213 | #define ANOBJ_IS_EXTERNAL 0x08 /* i_aSL only: This object created via External() */ |
213 | #define ANOBJ_METHOD_NO_RETVAL 0x10 /* i_aSL only: Method has no return value */ | 214 | #define ANOBJ_METHOD_NO_RETVAL 0x10 /* i_aSL only: Method has no return value */ |
@@ -340,6 +341,82 @@ acpi_status(*ACPI_INTERNAL_METHOD) (struct acpi_walk_state * walk_state); | |||
340 | #define ACPI_BTYPE_OBJECTS_AND_REFS 0x0001FFFF /* ARG or LOCAL */ | 341 | #define ACPI_BTYPE_OBJECTS_AND_REFS 0x0001FFFF /* ARG or LOCAL */ |
341 | #define ACPI_BTYPE_ALL_OBJECTS 0x0000FFFF | 342 | #define ACPI_BTYPE_ALL_OBJECTS 0x0000FFFF |
342 | 343 | ||
344 | /* | ||
345 | * Information structure for ACPI predefined names. | ||
346 | * Each entry in the table contains the following items: | ||
347 | * | ||
348 | * Name - The ACPI reserved name | ||
349 | * param_count - Number of arguments to the method | ||
350 | * expected_return_btypes - Allowed type(s) for the return value | ||
351 | */ | ||
352 | struct acpi_name_info { | ||
353 | char name[ACPI_NAME_SIZE]; | ||
354 | u8 param_count; | ||
355 | u8 expected_btypes; | ||
356 | }; | ||
357 | |||
358 | /* | ||
359 | * Secondary information structures for ACPI predefined objects that return | ||
360 | * package objects. This structure appears as the next entry in the table | ||
361 | * after the NAME_INFO structure above. | ||
362 | * | ||
363 | * The reason for this is to minimize the size of the predefined name table. | ||
364 | */ | ||
365 | |||
366 | /* | ||
367 | * Used for ACPI_PTYPE1_FIXED, ACPI_PTYPE1_VAR, ACPI_PTYPE2, | ||
368 | * ACPI_PTYPE2_MIN, ACPI_PTYPE2_PKG_COUNT, ACPI_PTYPE2_COUNT | ||
369 | */ | ||
370 | struct acpi_package_info { | ||
371 | u8 type; | ||
372 | u8 object_type1; | ||
373 | u8 count1; | ||
374 | u8 object_type2; | ||
375 | u8 count2; | ||
376 | u8 reserved; | ||
377 | }; | ||
378 | |||
379 | /* Used for ACPI_PTYPE2_FIXED */ | ||
380 | |||
381 | struct acpi_package_info2 { | ||
382 | u8 type; | ||
383 | u8 count; | ||
384 | u8 object_type[4]; | ||
385 | }; | ||
386 | |||
387 | /* Used for ACPI_PTYPE1_OPTION */ | ||
388 | |||
389 | struct acpi_package_info3 { | ||
390 | u8 type; | ||
391 | u8 count; | ||
392 | u8 object_type[2]; | ||
393 | u8 tail_object_type; | ||
394 | u8 reserved; | ||
395 | }; | ||
396 | |||
397 | union acpi_predefined_info { | ||
398 | struct acpi_name_info info; | ||
399 | struct acpi_package_info ret_info; | ||
400 | struct acpi_package_info2 ret_info2; | ||
401 | struct acpi_package_info3 ret_info3; | ||
402 | }; | ||
403 | |||
404 | /* | ||
405 | * Bitmapped return value types | ||
406 | * Note: the actual data types must be contiguous, a loop in nspredef.c | ||
407 | * depends on this. | ||
408 | */ | ||
409 | #define ACPI_RTYPE_ANY 0x00 | ||
410 | #define ACPI_RTYPE_NONE 0x01 | ||
411 | #define ACPI_RTYPE_INTEGER 0x02 | ||
412 | #define ACPI_RTYPE_STRING 0x04 | ||
413 | #define ACPI_RTYPE_BUFFER 0x08 | ||
414 | #define ACPI_RTYPE_PACKAGE 0x10 | ||
415 | #define ACPI_RTYPE_REFERENCE 0x20 | ||
416 | #define ACPI_RTYPE_ALL 0x3F | ||
417 | |||
418 | #define ACPI_NUM_RTYPES 5 /* Number of actual object types */ | ||
419 | |||
343 | /***************************************************************************** | 420 | /***************************************************************************** |
344 | * | 421 | * |
345 | * Event typedefs and structs | 422 | * Event typedefs and structs |
diff --git a/include/acpi/acmacros.h b/include/acpi/acmacros.h index 57ab9e9d7593..a1e3240bf460 100644 --- a/include/acpi/acmacros.h +++ b/include/acpi/acmacros.h | |||
@@ -62,7 +62,7 @@ | |||
62 | #define ACPI_ARRAY_LENGTH(x) (sizeof(x) / sizeof((x)[0])) | 62 | #define ACPI_ARRAY_LENGTH(x) (sizeof(x) / sizeof((x)[0])) |
63 | 63 | ||
64 | /* | 64 | /* |
65 | * Extract data using a pointer. Any more than a byte and we | 65 | * Extract data using a pointer. Any more than a byte and we |
66 | * get into potential aligment issues -- see the STORE macros below. | 66 | * get into potential aligment issues -- see the STORE macros below. |
67 | * Use with care. | 67 | * Use with care. |
68 | */ | 68 | */ |
@@ -80,21 +80,21 @@ | |||
80 | */ | 80 | */ |
81 | #define ACPI_CAST_PTR(t, p) ((t *) (acpi_uintptr_t) (p)) | 81 | #define ACPI_CAST_PTR(t, p) ((t *) (acpi_uintptr_t) (p)) |
82 | #define ACPI_CAST_INDIRECT_PTR(t, p) ((t **) (acpi_uintptr_t) (p)) | 82 | #define ACPI_CAST_INDIRECT_PTR(t, p) ((t **) (acpi_uintptr_t) (p)) |
83 | #define ACPI_ADD_PTR(t, a, b) ACPI_CAST_PTR (t, (ACPI_CAST_PTR (u8,(a)) + (acpi_size)(b))) | 83 | #define ACPI_ADD_PTR(t, a, b) ACPI_CAST_PTR (t, (ACPI_CAST_PTR (u8, (a)) + (acpi_size)(b))) |
84 | #define ACPI_PTR_DIFF(a, b) (acpi_size) (ACPI_CAST_PTR (u8,(a)) - ACPI_CAST_PTR (u8,(b))) | 84 | #define ACPI_PTR_DIFF(a, b) (acpi_size) (ACPI_CAST_PTR (u8, (a)) - ACPI_CAST_PTR (u8, (b))) |
85 | 85 | ||
86 | /* Pointer/Integer type conversions */ | 86 | /* Pointer/Integer type conversions */ |
87 | 87 | ||
88 | #define ACPI_TO_POINTER(i) ACPI_ADD_PTR (void, (void *) NULL, (acpi_size) i) | 88 | #define ACPI_TO_POINTER(i) ACPI_ADD_PTR (void, (void *) NULL, (acpi_size) i) |
89 | #define ACPI_TO_INTEGER(p) ACPI_PTR_DIFF (p,(void *) NULL) | 89 | #define ACPI_TO_INTEGER(p) ACPI_PTR_DIFF (p, (void *) NULL) |
90 | #define ACPI_OFFSET(d,f) (acpi_size) ACPI_PTR_DIFF (&(((d *)0)->f),(void *) NULL) | 90 | #define ACPI_OFFSET(d, f) (acpi_size) ACPI_PTR_DIFF (&(((d *)0)->f), (void *) NULL) |
91 | #define ACPI_PHYSADDR_TO_PTR(i) ACPI_TO_POINTER(i) | 91 | #define ACPI_PHYSADDR_TO_PTR(i) ACPI_TO_POINTER(i) |
92 | #define ACPI_PTR_TO_PHYSADDR(i) ACPI_TO_INTEGER(i) | 92 | #define ACPI_PTR_TO_PHYSADDR(i) ACPI_TO_INTEGER(i) |
93 | 93 | ||
94 | #ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED | 94 | #ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED |
95 | #define ACPI_COMPARE_NAME(a,b) (*ACPI_CAST_PTR (u32,(a)) == *ACPI_CAST_PTR (u32,(b))) | 95 | #define ACPI_COMPARE_NAME(a, b) (*ACPI_CAST_PTR (u32, (a)) == *ACPI_CAST_PTR (u32, (b))) |
96 | #else | 96 | #else |
97 | #define ACPI_COMPARE_NAME(a,b) (!ACPI_STRNCMP (ACPI_CAST_PTR (char,(a)), ACPI_CAST_PTR (char,(b)), ACPI_NAME_SIZE)) | 97 | #define ACPI_COMPARE_NAME(a, b) (!ACPI_STRNCMP (ACPI_CAST_PTR (char, (a)), ACPI_CAST_PTR (char, (b)), ACPI_NAME_SIZE)) |
98 | #endif | 98 | #endif |
99 | 99 | ||
100 | /* | 100 | /* |
@@ -114,7 +114,7 @@ struct acpi_integer_overlay { | |||
114 | 114 | ||
115 | /* Split 64-bit integer into two 32-bit values. Use with %8.8_x%8.8_x */ | 115 | /* Split 64-bit integer into two 32-bit values. Use with %8.8_x%8.8_x */ |
116 | 116 | ||
117 | #define ACPI_FORMAT_UINT64(i) ACPI_HIDWORD(i),ACPI_LODWORD(i) | 117 | #define ACPI_FORMAT_UINT64(i) ACPI_HIDWORD(i), ACPI_LODWORD(i) |
118 | 118 | ||
119 | #if ACPI_MACHINE_WIDTH == 64 | 119 | #if ACPI_MACHINE_WIDTH == 64 |
120 | #define ACPI_FORMAT_NATIVE_UINT(i) ACPI_FORMAT_UINT64(i) | 120 | #define ACPI_FORMAT_NATIVE_UINT(i) ACPI_FORMAT_UINT64(i) |
@@ -132,37 +132,33 @@ struct acpi_integer_overlay { | |||
132 | * Macros for big-endian machines | 132 | * Macros for big-endian machines |
133 | */ | 133 | */ |
134 | 134 | ||
135 | /* This macro sets a buffer index, starting from the end of the buffer */ | ||
136 | |||
137 | #define ACPI_BUFFER_INDEX(buf_len,buf_offset,byte_gran) ((buf_len) - (((buf_offset)+1) * (byte_gran))) | ||
138 | |||
139 | /* These macros reverse the bytes during the move, converting little-endian to big endian */ | 135 | /* These macros reverse the bytes during the move, converting little-endian to big endian */ |
140 | 136 | ||
141 | /* Big Endian <== Little Endian */ | 137 | /* Big Endian <== Little Endian */ |
142 | /* Hi...Lo Lo...Hi */ | 138 | /* Hi...Lo Lo...Hi */ |
143 | /* 16-bit source, 16/32/64 destination */ | 139 | /* 16-bit source, 16/32/64 destination */ |
144 | 140 | ||
145 | #define ACPI_MOVE_16_TO_16(d,s) {(( u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[1];\ | 141 | #define ACPI_MOVE_16_TO_16(d, s) {(( u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[1];\ |
146 | (( u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[0];} | 142 | (( u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[0];} |
147 | 143 | ||
148 | #define ACPI_MOVE_16_TO_32(d,s) {(*(u32 *)(void *)(d))=0;\ | 144 | #define ACPI_MOVE_16_TO_32(d, s) {(*(u32 *)(void *)(d))=0;\ |
149 | ((u8 *)(void *)(d))[2] = ((u8 *)(void *)(s))[1];\ | 145 | ((u8 *)(void *)(d))[2] = ((u8 *)(void *)(s))[1];\ |
150 | ((u8 *)(void *)(d))[3] = ((u8 *)(void *)(s))[0];} | 146 | ((u8 *)(void *)(d))[3] = ((u8 *)(void *)(s))[0];} |
151 | 147 | ||
152 | #define ACPI_MOVE_16_TO_64(d,s) {(*(u64 *)(void *)(d))=0;\ | 148 | #define ACPI_MOVE_16_TO_64(d, s) {(*(u64 *)(void *)(d))=0;\ |
153 | ((u8 *)(void *)(d))[6] = ((u8 *)(void *)(s))[1];\ | 149 | ((u8 *)(void *)(d))[6] = ((u8 *)(void *)(s))[1];\ |
154 | ((u8 *)(void *)(d))[7] = ((u8 *)(void *)(s))[0];} | 150 | ((u8 *)(void *)(d))[7] = ((u8 *)(void *)(s))[0];} |
155 | 151 | ||
156 | /* 32-bit source, 16/32/64 destination */ | 152 | /* 32-bit source, 16/32/64 destination */ |
157 | 153 | ||
158 | #define ACPI_MOVE_32_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */ | 154 | #define ACPI_MOVE_32_TO_16(d, s) ACPI_MOVE_16_TO_16(d, s) /* Truncate to 16 */ |
159 | 155 | ||
160 | #define ACPI_MOVE_32_TO_32(d,s) {(( u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[3];\ | 156 | #define ACPI_MOVE_32_TO_32(d, s) {(( u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[3];\ |
161 | (( u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[2];\ | 157 | (( u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[2];\ |
162 | (( u8 *)(void *)(d))[2] = ((u8 *)(void *)(s))[1];\ | 158 | (( u8 *)(void *)(d))[2] = ((u8 *)(void *)(s))[1];\ |
163 | (( u8 *)(void *)(d))[3] = ((u8 *)(void *)(s))[0];} | 159 | (( u8 *)(void *)(d))[3] = ((u8 *)(void *)(s))[0];} |
164 | 160 | ||
165 | #define ACPI_MOVE_32_TO_64(d,s) {(*(u64 *)(void *)(d))=0;\ | 161 | #define ACPI_MOVE_32_TO_64(d, s) {(*(u64 *)(void *)(d))=0;\ |
166 | ((u8 *)(void *)(d))[4] = ((u8 *)(void *)(s))[3];\ | 162 | ((u8 *)(void *)(d))[4] = ((u8 *)(void *)(s))[3];\ |
167 | ((u8 *)(void *)(d))[5] = ((u8 *)(void *)(s))[2];\ | 163 | ((u8 *)(void *)(d))[5] = ((u8 *)(void *)(s))[2];\ |
168 | ((u8 *)(void *)(d))[6] = ((u8 *)(void *)(s))[1];\ | 164 | ((u8 *)(void *)(d))[6] = ((u8 *)(void *)(s))[1];\ |
@@ -170,11 +166,11 @@ struct acpi_integer_overlay { | |||
170 | 166 | ||
171 | /* 64-bit source, 16/32/64 destination */ | 167 | /* 64-bit source, 16/32/64 destination */ |
172 | 168 | ||
173 | #define ACPI_MOVE_64_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */ | 169 | #define ACPI_MOVE_64_TO_16(d, s) ACPI_MOVE_16_TO_16(d, s) /* Truncate to 16 */ |
174 | 170 | ||
175 | #define ACPI_MOVE_64_TO_32(d,s) ACPI_MOVE_32_TO_32(d,s) /* Truncate to 32 */ | 171 | #define ACPI_MOVE_64_TO_32(d, s) ACPI_MOVE_32_TO_32(d, s) /* Truncate to 32 */ |
176 | 172 | ||
177 | #define ACPI_MOVE_64_TO_64(d,s) {(( u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[7];\ | 173 | #define ACPI_MOVE_64_TO_64(d, s) {(( u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[7];\ |
178 | (( u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[6];\ | 174 | (( u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[6];\ |
179 | (( u8 *)(void *)(d))[2] = ((u8 *)(void *)(s))[5];\ | 175 | (( u8 *)(void *)(d))[2] = ((u8 *)(void *)(s))[5];\ |
180 | (( u8 *)(void *)(d))[3] = ((u8 *)(void *)(s))[4];\ | 176 | (( u8 *)(void *)(d))[3] = ((u8 *)(void *)(s))[4];\ |
@@ -187,63 +183,59 @@ struct acpi_integer_overlay { | |||
187 | * Macros for little-endian machines | 183 | * Macros for little-endian machines |
188 | */ | 184 | */ |
189 | 185 | ||
190 | /* This macro sets a buffer index, starting from the beginning of the buffer */ | ||
191 | |||
192 | #define ACPI_BUFFER_INDEX(buf_len,buf_offset,byte_gran) (buf_offset) | ||
193 | |||
194 | #ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED | 186 | #ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED |
195 | 187 | ||
196 | /* The hardware supports unaligned transfers, just do the little-endian move */ | 188 | /* The hardware supports unaligned transfers, just do the little-endian move */ |
197 | 189 | ||
198 | /* 16-bit source, 16/32/64 destination */ | 190 | /* 16-bit source, 16/32/64 destination */ |
199 | 191 | ||
200 | #define ACPI_MOVE_16_TO_16(d,s) *(u16 *)(void *)(d) = *(u16 *)(void *)(s) | 192 | #define ACPI_MOVE_16_TO_16(d, s) *(u16 *)(void *)(d) = *(u16 *)(void *)(s) |
201 | #define ACPI_MOVE_16_TO_32(d,s) *(u32 *)(void *)(d) = *(u16 *)(void *)(s) | 193 | #define ACPI_MOVE_16_TO_32(d, s) *(u32 *)(void *)(d) = *(u16 *)(void *)(s) |
202 | #define ACPI_MOVE_16_TO_64(d,s) *(u64 *)(void *)(d) = *(u16 *)(void *)(s) | 194 | #define ACPI_MOVE_16_TO_64(d, s) *(u64 *)(void *)(d) = *(u16 *)(void *)(s) |
203 | 195 | ||
204 | /* 32-bit source, 16/32/64 destination */ | 196 | /* 32-bit source, 16/32/64 destination */ |
205 | 197 | ||
206 | #define ACPI_MOVE_32_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */ | 198 | #define ACPI_MOVE_32_TO_16(d, s) ACPI_MOVE_16_TO_16(d, s) /* Truncate to 16 */ |
207 | #define ACPI_MOVE_32_TO_32(d,s) *(u32 *)(void *)(d) = *(u32 *)(void *)(s) | 199 | #define ACPI_MOVE_32_TO_32(d, s) *(u32 *)(void *)(d) = *(u32 *)(void *)(s) |
208 | #define ACPI_MOVE_32_TO_64(d,s) *(u64 *)(void *)(d) = *(u32 *)(void *)(s) | 200 | #define ACPI_MOVE_32_TO_64(d, s) *(u64 *)(void *)(d) = *(u32 *)(void *)(s) |
209 | 201 | ||
210 | /* 64-bit source, 16/32/64 destination */ | 202 | /* 64-bit source, 16/32/64 destination */ |
211 | 203 | ||
212 | #define ACPI_MOVE_64_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */ | 204 | #define ACPI_MOVE_64_TO_16(d, s) ACPI_MOVE_16_TO_16(d, s) /* Truncate to 16 */ |
213 | #define ACPI_MOVE_64_TO_32(d,s) ACPI_MOVE_32_TO_32(d,s) /* Truncate to 32 */ | 205 | #define ACPI_MOVE_64_TO_32(d, s) ACPI_MOVE_32_TO_32(d, s) /* Truncate to 32 */ |
214 | #define ACPI_MOVE_64_TO_64(d,s) *(u64 *)(void *)(d) = *(u64 *)(void *)(s) | 206 | #define ACPI_MOVE_64_TO_64(d, s) *(u64 *)(void *)(d) = *(u64 *)(void *)(s) |
215 | 207 | ||
216 | #else | 208 | #else |
217 | /* | 209 | /* |
218 | * The hardware does not support unaligned transfers. We must move the | 210 | * The hardware does not support unaligned transfers. We must move the |
219 | * data one byte at a time. These macros work whether the source or | 211 | * data one byte at a time. These macros work whether the source or |
220 | * the destination (or both) is/are unaligned. (Little-endian move) | 212 | * the destination (or both) is/are unaligned. (Little-endian move) |
221 | */ | 213 | */ |
222 | 214 | ||
223 | /* 16-bit source, 16/32/64 destination */ | 215 | /* 16-bit source, 16/32/64 destination */ |
224 | 216 | ||
225 | #define ACPI_MOVE_16_TO_16(d,s) {(( u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[0];\ | 217 | #define ACPI_MOVE_16_TO_16(d, s) {(( u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[0];\ |
226 | (( u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[1];} | 218 | (( u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[1];} |
227 | 219 | ||
228 | #define ACPI_MOVE_16_TO_32(d,s) {(*(u32 *)(void *)(d)) = 0; ACPI_MOVE_16_TO_16(d,s);} | 220 | #define ACPI_MOVE_16_TO_32(d, s) {(*(u32 *)(void *)(d)) = 0; ACPI_MOVE_16_TO_16(d, s);} |
229 | #define ACPI_MOVE_16_TO_64(d,s) {(*(u64 *)(void *)(d)) = 0; ACPI_MOVE_16_TO_16(d,s);} | 221 | #define ACPI_MOVE_16_TO_64(d, s) {(*(u64 *)(void *)(d)) = 0; ACPI_MOVE_16_TO_16(d, s);} |
230 | 222 | ||
231 | /* 32-bit source, 16/32/64 destination */ | 223 | /* 32-bit source, 16/32/64 destination */ |
232 | 224 | ||
233 | #define ACPI_MOVE_32_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */ | 225 | #define ACPI_MOVE_32_TO_16(d, s) ACPI_MOVE_16_TO_16(d, s) /* Truncate to 16 */ |
234 | 226 | ||
235 | #define ACPI_MOVE_32_TO_32(d,s) {(( u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[0];\ | 227 | #define ACPI_MOVE_32_TO_32(d, s) {(( u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[0];\ |
236 | (( u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[1];\ | 228 | (( u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[1];\ |
237 | (( u8 *)(void *)(d))[2] = ((u8 *)(void *)(s))[2];\ | 229 | (( u8 *)(void *)(d))[2] = ((u8 *)(void *)(s))[2];\ |
238 | (( u8 *)(void *)(d))[3] = ((u8 *)(void *)(s))[3];} | 230 | (( u8 *)(void *)(d))[3] = ((u8 *)(void *)(s))[3];} |
239 | 231 | ||
240 | #define ACPI_MOVE_32_TO_64(d,s) {(*(u64 *)(void *)(d)) = 0; ACPI_MOVE_32_TO_32(d,s);} | 232 | #define ACPI_MOVE_32_TO_64(d, s) {(*(u64 *)(void *)(d)) = 0; ACPI_MOVE_32_TO_32(d, s);} |
241 | 233 | ||
242 | /* 64-bit source, 16/32/64 destination */ | 234 | /* 64-bit source, 16/32/64 destination */ |
243 | 235 | ||
244 | #define ACPI_MOVE_64_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */ | 236 | #define ACPI_MOVE_64_TO_16(d, s) ACPI_MOVE_16_TO_16(d, s) /* Truncate to 16 */ |
245 | #define ACPI_MOVE_64_TO_32(d,s) ACPI_MOVE_32_TO_32(d,s) /* Truncate to 32 */ | 237 | #define ACPI_MOVE_64_TO_32(d, s) ACPI_MOVE_32_TO_32(d, s) /* Truncate to 32 */ |
246 | #define ACPI_MOVE_64_TO_64(d,s) {(( u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[0];\ | 238 | #define ACPI_MOVE_64_TO_64(d, s) {(( u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[0];\ |
247 | (( u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[1];\ | 239 | (( u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[1];\ |
248 | (( u8 *)(void *)(d))[2] = ((u8 *)(void *)(s))[2];\ | 240 | (( u8 *)(void *)(d))[2] = ((u8 *)(void *)(s))[2];\ |
249 | (( u8 *)(void *)(d))[3] = ((u8 *)(void *)(s))[3];\ | 241 | (( u8 *)(void *)(d))[3] = ((u8 *)(void *)(s))[3];\ |
@@ -257,10 +249,10 @@ struct acpi_integer_overlay { | |||
257 | /* Macros based on machine integer width */ | 249 | /* Macros based on machine integer width */ |
258 | 250 | ||
259 | #if ACPI_MACHINE_WIDTH == 32 | 251 | #if ACPI_MACHINE_WIDTH == 32 |
260 | #define ACPI_MOVE_SIZE_TO_16(d,s) ACPI_MOVE_32_TO_16(d,s) | 252 | #define ACPI_MOVE_SIZE_TO_16(d, s) ACPI_MOVE_32_TO_16(d, s) |
261 | 253 | ||
262 | #elif ACPI_MACHINE_WIDTH == 64 | 254 | #elif ACPI_MACHINE_WIDTH == 64 |
263 | #define ACPI_MOVE_SIZE_TO_16(d,s) ACPI_MOVE_64_TO_16(d,s) | 255 | #define ACPI_MOVE_SIZE_TO_16(d, s) ACPI_MOVE_64_TO_16(d, s) |
264 | 256 | ||
265 | #else | 257 | #else |
266 | #error unknown ACPI_MACHINE_WIDTH | 258 | #error unknown ACPI_MACHINE_WIDTH |
@@ -269,29 +261,29 @@ struct acpi_integer_overlay { | |||
269 | /* | 261 | /* |
270 | * Fast power-of-two math macros for non-optimized compilers | 262 | * Fast power-of-two math macros for non-optimized compilers |
271 | */ | 263 | */ |
272 | #define _ACPI_DIV(value,power_of2) ((u32) ((value) >> (power_of2))) | 264 | #define _ACPI_DIV(value, power_of2) ((u32) ((value) >> (power_of2))) |
273 | #define _ACPI_MUL(value,power_of2) ((u32) ((value) << (power_of2))) | 265 | #define _ACPI_MUL(value, power_of2) ((u32) ((value) << (power_of2))) |
274 | #define _ACPI_MOD(value,divisor) ((u32) ((value) & ((divisor) -1))) | 266 | #define _ACPI_MOD(value, divisor) ((u32) ((value) & ((divisor) -1))) |
275 | 267 | ||
276 | #define ACPI_DIV_2(a) _ACPI_DIV(a,1) | 268 | #define ACPI_DIV_2(a) _ACPI_DIV(a, 1) |
277 | #define ACPI_MUL_2(a) _ACPI_MUL(a,1) | 269 | #define ACPI_MUL_2(a) _ACPI_MUL(a, 1) |
278 | #define ACPI_MOD_2(a) _ACPI_MOD(a,2) | 270 | #define ACPI_MOD_2(a) _ACPI_MOD(a, 2) |
279 | 271 | ||
280 | #define ACPI_DIV_4(a) _ACPI_DIV(a,2) | 272 | #define ACPI_DIV_4(a) _ACPI_DIV(a, 2) |
281 | #define ACPI_MUL_4(a) _ACPI_MUL(a,2) | 273 | #define ACPI_MUL_4(a) _ACPI_MUL(a, 2) |
282 | #define ACPI_MOD_4(a) _ACPI_MOD(a,4) | 274 | #define ACPI_MOD_4(a) _ACPI_MOD(a, 4) |
283 | 275 | ||
284 | #define ACPI_DIV_8(a) _ACPI_DIV(a,3) | 276 | #define ACPI_DIV_8(a) _ACPI_DIV(a, 3) |
285 | #define ACPI_MUL_8(a) _ACPI_MUL(a,3) | 277 | #define ACPI_MUL_8(a) _ACPI_MUL(a, 3) |
286 | #define ACPI_MOD_8(a) _ACPI_MOD(a,8) | 278 | #define ACPI_MOD_8(a) _ACPI_MOD(a, 8) |
287 | 279 | ||
288 | #define ACPI_DIV_16(a) _ACPI_DIV(a,4) | 280 | #define ACPI_DIV_16(a) _ACPI_DIV(a, 4) |
289 | #define ACPI_MUL_16(a) _ACPI_MUL(a,4) | 281 | #define ACPI_MUL_16(a) _ACPI_MUL(a, 4) |
290 | #define ACPI_MOD_16(a) _ACPI_MOD(a,16) | 282 | #define ACPI_MOD_16(a) _ACPI_MOD(a, 16) |
291 | 283 | ||
292 | #define ACPI_DIV_32(a) _ACPI_DIV(a,5) | 284 | #define ACPI_DIV_32(a) _ACPI_DIV(a, 5) |
293 | #define ACPI_MUL_32(a) _ACPI_MUL(a,5) | 285 | #define ACPI_MUL_32(a) _ACPI_MUL(a, 5) |
294 | #define ACPI_MOD_32(a) _ACPI_MOD(a,32) | 286 | #define ACPI_MOD_32(a) _ACPI_MOD(a, 32) |
295 | 287 | ||
296 | /* | 288 | /* |
297 | * Rounding macros (Power of two boundaries only) | 289 | * Rounding macros (Power of two boundaries only) |
@@ -305,13 +297,13 @@ struct acpi_integer_overlay { | |||
305 | 297 | ||
306 | /* Note: sizeof(acpi_size) evaluates to either 4 or 8 (32- vs 64-bit mode) */ | 298 | /* Note: sizeof(acpi_size) evaluates to either 4 or 8 (32- vs 64-bit mode) */ |
307 | 299 | ||
308 | #define ACPI_ROUND_DOWN_TO_32BIT(a) ACPI_ROUND_DOWN(a,4) | 300 | #define ACPI_ROUND_DOWN_TO_32BIT(a) ACPI_ROUND_DOWN(a, 4) |
309 | #define ACPI_ROUND_DOWN_TO_64BIT(a) ACPI_ROUND_DOWN(a,8) | 301 | #define ACPI_ROUND_DOWN_TO_64BIT(a) ACPI_ROUND_DOWN(a, 8) |
310 | #define ACPI_ROUND_DOWN_TO_NATIVE_WORD(a) ACPI_ROUND_DOWN(a,sizeof(acpi_size)) | 302 | #define ACPI_ROUND_DOWN_TO_NATIVE_WORD(a) ACPI_ROUND_DOWN(a, sizeof(acpi_size)) |
311 | 303 | ||
312 | #define ACPI_ROUND_UP_TO_32BIT(a) ACPI_ROUND_UP(a,4) | 304 | #define ACPI_ROUND_UP_TO_32BIT(a) ACPI_ROUND_UP(a, 4) |
313 | #define ACPI_ROUND_UP_TO_64BIT(a) ACPI_ROUND_UP(a,8) | 305 | #define ACPI_ROUND_UP_TO_64BIT(a) ACPI_ROUND_UP(a, 8) |
314 | #define ACPI_ROUND_UP_TO_NATIVE_WORD(a) ACPI_ROUND_UP(a,sizeof(acpi_size)) | 306 | #define ACPI_ROUND_UP_TO_NATIVE_WORD(a) ACPI_ROUND_UP(a, sizeof(acpi_size)) |
315 | 307 | ||
316 | #define ACPI_ROUND_BITS_UP_TO_BYTES(a) ACPI_DIV_8((a) + 7) | 308 | #define ACPI_ROUND_BITS_UP_TO_BYTES(a) ACPI_DIV_8((a) + 7) |
317 | #define ACPI_ROUND_BITS_DOWN_TO_BYTES(a) ACPI_DIV_8((a)) | 309 | #define ACPI_ROUND_BITS_DOWN_TO_BYTES(a) ACPI_DIV_8((a)) |
@@ -320,9 +312,9 @@ struct acpi_integer_overlay { | |||
320 | 312 | ||
321 | /* Generic (non-power-of-two) rounding */ | 313 | /* Generic (non-power-of-two) rounding */ |
322 | 314 | ||
323 | #define ACPI_ROUND_UP_TO(value,boundary) (((value) + ((boundary)-1)) / (boundary)) | 315 | #define ACPI_ROUND_UP_TO(value, boundary) (((value) + ((boundary)-1)) / (boundary)) |
324 | 316 | ||
325 | #define ACPI_IS_MISALIGNED(value) (((acpi_size)value) & (sizeof(acpi_size)-1)) | 317 | #define ACPI_IS_MISALIGNED(value) (((acpi_size) value) & (sizeof(acpi_size)-1)) |
326 | 318 | ||
327 | /* | 319 | /* |
328 | * Bitmask creation | 320 | * Bitmask creation |
@@ -333,8 +325,6 @@ struct acpi_integer_overlay { | |||
333 | #define ACPI_MASK_BITS_ABOVE(position) (~((ACPI_INTEGER_MAX) << ((u32) (position)))) | 325 | #define ACPI_MASK_BITS_ABOVE(position) (~((ACPI_INTEGER_MAX) << ((u32) (position)))) |
334 | #define ACPI_MASK_BITS_BELOW(position) ((ACPI_INTEGER_MAX) << ((u32) (position))) | 326 | #define ACPI_MASK_BITS_BELOW(position) ((ACPI_INTEGER_MAX) << ((u32) (position))) |
335 | 327 | ||
336 | #define ACPI_IS_OCTAL_DIGIT(d) (((char)(d) >= '0') && ((char)(d) <= '7')) | ||
337 | |||
338 | /* Bitfields within ACPI registers */ | 328 | /* Bitfields within ACPI registers */ |
339 | 329 | ||
340 | #define ACPI_REGISTER_PREPARE_BITS(val, pos, mask) ((val << pos) & mask) | 330 | #define ACPI_REGISTER_PREPARE_BITS(val, pos, mask) ((val << pos) & mask) |
@@ -342,39 +332,29 @@ struct acpi_integer_overlay { | |||
342 | 332 | ||
343 | #define ACPI_INSERT_BITS(target, mask, source) target = ((target & (~(mask))) | (source & mask)) | 333 | #define ACPI_INSERT_BITS(target, mask, source) target = ((target & (~(mask))) | (source & mask)) |
344 | 334 | ||
345 | /* Generate a UUID */ | ||
346 | |||
347 | #define ACPI_INIT_UUID(a,b,c,d0,d1,d2,d3,d4,d5,d6,d7) \ | ||
348 | (a) & 0xFF, ((a) >> 8) & 0xFF, ((a) >> 16) & 0xFF, ((a) >> 24) & 0xFF, \ | ||
349 | (b) & 0xFF, ((b) >> 8) & 0xFF, \ | ||
350 | (c) & 0xFF, ((c) >> 8) & 0xFF, \ | ||
351 | (d0), (d1), (d2), (d3), (d4), (d5), (d6), (d7) | ||
352 | |||
353 | /* | 335 | /* |
354 | * An struct acpi_namespace_node * can appear in some contexts, | 336 | * An struct acpi_namespace_node can appear in some contexts |
355 | * where a pointer to an union acpi_operand_object can also | 337 | * where a pointer to an union acpi_operand_object can also |
356 | * appear. This macro is used to distinguish them. | 338 | * appear. This macro is used to distinguish them. |
357 | * | 339 | * |
358 | * The "Descriptor" field is the first field in both structures. | 340 | * The "Descriptor" field is the first field in both structures. |
359 | */ | 341 | */ |
360 | #define ACPI_GET_DESCRIPTOR_TYPE(d) (((union acpi_descriptor *)(void *)(d))->common.descriptor_type) | 342 | #define ACPI_GET_DESCRIPTOR_TYPE(d) (((union acpi_descriptor *)(void *)(d))->common.descriptor_type) |
361 | #define ACPI_SET_DESCRIPTOR_TYPE(d,t) (((union acpi_descriptor *)(void *)(d))->common.descriptor_type = t) | 343 | #define ACPI_SET_DESCRIPTOR_TYPE(d, t) (((union acpi_descriptor *)(void *)(d))->common.descriptor_type = t) |
362 | 344 | ||
363 | /* Macro to test the object type */ | 345 | /* Macro to test the object type */ |
364 | 346 | ||
365 | #define ACPI_GET_OBJECT_TYPE(d) (((union acpi_operand_object *)(void *)(d))->common.type) | 347 | #define ACPI_GET_OBJECT_TYPE(d) (((union acpi_operand_object *)(void *)(d))->common.type) |
366 | 348 | ||
367 | /* Macro to check the table flags for SINGLE or MULTIPLE tables are allowed */ | ||
368 | |||
369 | #define ACPI_IS_SINGLE_TABLE(x) (((x) & 0x01) == ACPI_TABLE_SINGLE ? 1 : 0) | ||
370 | |||
371 | /* | 349 | /* |
372 | * Macros for the master AML opcode table | 350 | * Macros for the master AML opcode table |
373 | */ | 351 | */ |
374 | #if defined(ACPI_DISASSEMBLER) || defined (ACPI_DEBUG_OUTPUT) | 352 | #if defined (ACPI_DISASSEMBLER) || defined (ACPI_DEBUG_OUTPUT) |
375 | #define ACPI_OP(name,Pargs,Iargs,obj_type,class,type,flags) {name,(u32)(Pargs),(u32)(Iargs),(u32)(flags),obj_type,class,type} | 353 | #define ACPI_OP(name, Pargs, Iargs, obj_type, class, type, flags) \ |
354 | {name, (u32)(Pargs), (u32)(Iargs), (u32)(flags), obj_type, class, type} | ||
376 | #else | 355 | #else |
377 | #define ACPI_OP(name,Pargs,Iargs,obj_type,class,type,flags) {(u32)(Pargs),(u32)(Iargs),(u32)(flags),obj_type,class,type} | 356 | #define ACPI_OP(name, Pargs, Iargs, obj_type, class, type, flags) \ |
357 | {(u32)(Pargs), (u32)(Iargs), (u32)(flags), obj_type, class, type} | ||
378 | #endif | 358 | #endif |
379 | 359 | ||
380 | #ifdef ACPI_DISASSEMBLER | 360 | #ifdef ACPI_DISASSEMBLER |
@@ -392,18 +372,18 @@ struct acpi_integer_overlay { | |||
392 | #define ARG_6(x) ((u32)(x) << (5 * ARG_TYPE_WIDTH)) | 372 | #define ARG_6(x) ((u32)(x) << (5 * ARG_TYPE_WIDTH)) |
393 | 373 | ||
394 | #define ARGI_LIST1(a) (ARG_1(a)) | 374 | #define ARGI_LIST1(a) (ARG_1(a)) |
395 | #define ARGI_LIST2(a,b) (ARG_1(b)|ARG_2(a)) | 375 | #define ARGI_LIST2(a, b) (ARG_1(b)|ARG_2(a)) |
396 | #define ARGI_LIST3(a,b,c) (ARG_1(c)|ARG_2(b)|ARG_3(a)) | 376 | #define ARGI_LIST3(a, b, c) (ARG_1(c)|ARG_2(b)|ARG_3(a)) |
397 | #define ARGI_LIST4(a,b,c,d) (ARG_1(d)|ARG_2(c)|ARG_3(b)|ARG_4(a)) | 377 | #define ARGI_LIST4(a, b, c, d) (ARG_1(d)|ARG_2(c)|ARG_3(b)|ARG_4(a)) |
398 | #define ARGI_LIST5(a,b,c,d,e) (ARG_1(e)|ARG_2(d)|ARG_3(c)|ARG_4(b)|ARG_5(a)) | 378 | #define ARGI_LIST5(a, b, c, d, e) (ARG_1(e)|ARG_2(d)|ARG_3(c)|ARG_4(b)|ARG_5(a)) |
399 | #define ARGI_LIST6(a,b,c,d,e,f) (ARG_1(f)|ARG_2(e)|ARG_3(d)|ARG_4(c)|ARG_5(b)|ARG_6(a)) | 379 | #define ARGI_LIST6(a, b, c, d, e, f) (ARG_1(f)|ARG_2(e)|ARG_3(d)|ARG_4(c)|ARG_5(b)|ARG_6(a)) |
400 | 380 | ||
401 | #define ARGP_LIST1(a) (ARG_1(a)) | 381 | #define ARGP_LIST1(a) (ARG_1(a)) |
402 | #define ARGP_LIST2(a,b) (ARG_1(a)|ARG_2(b)) | 382 | #define ARGP_LIST2(a, b) (ARG_1(a)|ARG_2(b)) |
403 | #define ARGP_LIST3(a,b,c) (ARG_1(a)|ARG_2(b)|ARG_3(c)) | 383 | #define ARGP_LIST3(a, b, c) (ARG_1(a)|ARG_2(b)|ARG_3(c)) |
404 | #define ARGP_LIST4(a,b,c,d) (ARG_1(a)|ARG_2(b)|ARG_3(c)|ARG_4(d)) | 384 | #define ARGP_LIST4(a, b, c, d) (ARG_1(a)|ARG_2(b)|ARG_3(c)|ARG_4(d)) |
405 | #define ARGP_LIST5(a,b,c,d,e) (ARG_1(a)|ARG_2(b)|ARG_3(c)|ARG_4(d)|ARG_5(e)) | 385 | #define ARGP_LIST5(a, b, c, d, e) (ARG_1(a)|ARG_2(b)|ARG_3(c)|ARG_4(d)|ARG_5(e)) |
406 | #define ARGP_LIST6(a,b,c,d,e,f) (ARG_1(a)|ARG_2(b)|ARG_3(c)|ARG_4(d)|ARG_5(e)|ARG_6(f)) | 386 | #define ARGP_LIST6(a, b, c, d, e, f) (ARG_1(a)|ARG_2(b)|ARG_3(c)|ARG_4(d)|ARG_5(e)|ARG_6(f)) |
407 | 387 | ||
408 | #define GET_CURRENT_ARG_TYPE(list) (list & ((u32) 0x1F)) | 388 | #define GET_CURRENT_ARG_TYPE(list) (list & ((u32) 0x1F)) |
409 | #define INCREMENT_ARG_LIST(list) (list >>= ((u32) ARG_TYPE_WIDTH)) | 389 | #define INCREMENT_ARG_LIST(list) (list >>= ((u32) ARG_TYPE_WIDTH)) |
@@ -434,8 +414,8 @@ struct acpi_integer_overlay { | |||
434 | #define ACPI_WARNING(plist) acpi_ut_warning plist | 414 | #define ACPI_WARNING(plist) acpi_ut_warning plist |
435 | #define ACPI_EXCEPTION(plist) acpi_ut_exception plist | 415 | #define ACPI_EXCEPTION(plist) acpi_ut_exception plist |
436 | #define ACPI_ERROR(plist) acpi_ut_error plist | 416 | #define ACPI_ERROR(plist) acpi_ut_error plist |
437 | #define ACPI_ERROR_NAMESPACE(s,e) acpi_ns_report_error (AE_INFO, s, e); | 417 | #define ACPI_ERROR_NAMESPACE(s, e) acpi_ns_report_error (AE_INFO, s, e); |
438 | #define ACPI_ERROR_METHOD(s,n,p,e) acpi_ns_report_method_error (AE_INFO, s, n, p, e); | 418 | #define ACPI_ERROR_METHOD(s, n, p, e) acpi_ns_report_method_error (AE_INFO, s, n, p, e); |
439 | 419 | ||
440 | #else | 420 | #else |
441 | 421 | ||
@@ -445,8 +425,8 @@ struct acpi_integer_overlay { | |||
445 | #define ACPI_WARNING(plist) | 425 | #define ACPI_WARNING(plist) |
446 | #define ACPI_EXCEPTION(plist) | 426 | #define ACPI_EXCEPTION(plist) |
447 | #define ACPI_ERROR(plist) | 427 | #define ACPI_ERROR(plist) |
448 | #define ACPI_ERROR_NAMESPACE(s,e) | 428 | #define ACPI_ERROR_NAMESPACE(s, e) |
449 | #define ACPI_ERROR_METHOD(s,n,p,e) | 429 | #define ACPI_ERROR_METHOD(s, n, p, e) |
450 | #endif | 430 | #endif |
451 | 431 | ||
452 | /* | 432 | /* |
@@ -489,18 +469,18 @@ struct acpi_integer_overlay { | |||
489 | 469 | ||
490 | #define ACPI_FUNCTION_TRACE(a) ACPI_FUNCTION_NAME(a) \ | 470 | #define ACPI_FUNCTION_TRACE(a) ACPI_FUNCTION_NAME(a) \ |
491 | acpi_ut_trace(ACPI_DEBUG_PARAMETERS) | 471 | acpi_ut_trace(ACPI_DEBUG_PARAMETERS) |
492 | #define ACPI_FUNCTION_TRACE_PTR(a,b) ACPI_FUNCTION_NAME(a) \ | 472 | #define ACPI_FUNCTION_TRACE_PTR(a, b) ACPI_FUNCTION_NAME(a) \ |
493 | acpi_ut_trace_ptr(ACPI_DEBUG_PARAMETERS,(void *)b) | 473 | acpi_ut_trace_ptr(ACPI_DEBUG_PARAMETERS, (void *)b) |
494 | #define ACPI_FUNCTION_TRACE_U32(a,b) ACPI_FUNCTION_NAME(a) \ | 474 | #define ACPI_FUNCTION_TRACE_U32(a, b) ACPI_FUNCTION_NAME(a) \ |
495 | acpi_ut_trace_u32(ACPI_DEBUG_PARAMETERS,(u32)b) | 475 | acpi_ut_trace_u32(ACPI_DEBUG_PARAMETERS, (u32)b) |
496 | #define ACPI_FUNCTION_TRACE_STR(a,b) ACPI_FUNCTION_NAME(a) \ | 476 | #define ACPI_FUNCTION_TRACE_STR(a, b) ACPI_FUNCTION_NAME(a) \ |
497 | acpi_ut_trace_str(ACPI_DEBUG_PARAMETERS,(char *)b) | 477 | acpi_ut_trace_str(ACPI_DEBUG_PARAMETERS, (char *)b) |
498 | 478 | ||
499 | #define ACPI_FUNCTION_ENTRY() acpi_ut_track_stack_ptr() | 479 | #define ACPI_FUNCTION_ENTRY() acpi_ut_track_stack_ptr() |
500 | 480 | ||
501 | /* | 481 | /* |
502 | * Function exit tracing. | 482 | * Function exit tracing. |
503 | * WARNING: These macros include a return statement. This is usually considered | 483 | * WARNING: These macros include a return statement. This is usually considered |
504 | * bad form, but having a separate exit macro is very ugly and difficult to maintain. | 484 | * bad form, but having a separate exit macro is very ugly and difficult to maintain. |
505 | * One of the FUNCTION_TRACE macros above must be used in conjunction with these macros | 485 | * One of the FUNCTION_TRACE macros above must be used in conjunction with these macros |
506 | * so that "_AcpiFunctionName" is defined. | 486 | * so that "_AcpiFunctionName" is defined. |
@@ -596,13 +576,13 @@ struct acpi_integer_overlay { | |||
596 | 576 | ||
597 | /* Stack and buffer dumping */ | 577 | /* Stack and buffer dumping */ |
598 | 578 | ||
599 | #define ACPI_DUMP_STACK_ENTRY(a) acpi_ex_dump_operand((a),0) | 579 | #define ACPI_DUMP_STACK_ENTRY(a) acpi_ex_dump_operand((a), 0) |
600 | #define ACPI_DUMP_OPERANDS(a,b,c) acpi_ex_dump_operands(a,b,c) | 580 | #define ACPI_DUMP_OPERANDS(a, b, c) acpi_ex_dump_operands(a, b, c) |
601 | 581 | ||
602 | #define ACPI_DUMP_ENTRY(a,b) acpi_ns_dump_entry (a,b) | 582 | #define ACPI_DUMP_ENTRY(a, b) acpi_ns_dump_entry (a, b) |
603 | #define ACPI_DUMP_PATHNAME(a,b,c,d) acpi_ns_dump_pathname(a,b,c,d) | 583 | #define ACPI_DUMP_PATHNAME(a, b, c, d) acpi_ns_dump_pathname(a, b, c, d) |
604 | #define ACPI_DUMP_RESOURCE_LIST(a) acpi_rs_dump_resource_list(a) | 584 | #define ACPI_DUMP_RESOURCE_LIST(a) acpi_rs_dump_resource_list(a) |
605 | #define ACPI_DUMP_BUFFER(a,b) acpi_ut_dump_buffer((u8 *)a,b,DB_BYTE_DISPLAY,_COMPONENT) | 585 | #define ACPI_DUMP_BUFFER(a, b) acpi_ut_dump_buffer((u8 *) a, b, DB_BYTE_DISPLAY, _COMPONENT) |
606 | 586 | ||
607 | /* | 587 | /* |
608 | * Master debug print macros | 588 | * Master debug print macros |
@@ -625,20 +605,20 @@ struct acpi_integer_overlay { | |||
625 | #define ACPI_DEBUG_ONLY_MEMBERS(a) do { } while(0) | 605 | #define ACPI_DEBUG_ONLY_MEMBERS(a) do { } while(0) |
626 | #define ACPI_FUNCTION_NAME(a) do { } while(0) | 606 | #define ACPI_FUNCTION_NAME(a) do { } while(0) |
627 | #define ACPI_FUNCTION_TRACE(a) do { } while(0) | 607 | #define ACPI_FUNCTION_TRACE(a) do { } while(0) |
628 | #define ACPI_FUNCTION_TRACE_PTR(a,b) do { } while(0) | 608 | #define ACPI_FUNCTION_TRACE_PTR(a, b) do { } while(0) |
629 | #define ACPI_FUNCTION_TRACE_U32(a,b) do { } while(0) | 609 | #define ACPI_FUNCTION_TRACE_U32(a, b) do { } while(0) |
630 | #define ACPI_FUNCTION_TRACE_STR(a,b) do { } while(0) | 610 | #define ACPI_FUNCTION_TRACE_STR(a, b) do { } while(0) |
631 | #define ACPI_FUNCTION_EXIT do { } while(0) | 611 | #define ACPI_FUNCTION_EXIT do { } while(0) |
632 | #define ACPI_FUNCTION_STATUS_EXIT(s) do { } while(0) | 612 | #define ACPI_FUNCTION_STATUS_EXIT(s) do { } while(0) |
633 | #define ACPI_FUNCTION_VALUE_EXIT(s) do { } while(0) | 613 | #define ACPI_FUNCTION_VALUE_EXIT(s) do { } while(0) |
634 | #define ACPI_FUNCTION_ENTRY() do { } while(0) | 614 | #define ACPI_FUNCTION_ENTRY() do { } while(0) |
635 | #define ACPI_DUMP_STACK_ENTRY(a) do { } while(0) | 615 | #define ACPI_DUMP_STACK_ENTRY(a) do { } while(0) |
636 | #define ACPI_DUMP_OPERANDS(a,b,c) do { } while(0) | 616 | #define ACPI_DUMP_OPERANDS(a, b, c) do { } while(0) |
637 | #define ACPI_DUMP_ENTRY(a,b) do { } while(0) | 617 | #define ACPI_DUMP_ENTRY(a, b) do { } while(0) |
638 | #define ACPI_DUMP_TABLES(a,b) do { } while(0) | 618 | #define ACPI_DUMP_TABLES(a, b) do { } while(0) |
639 | #define ACPI_DUMP_PATHNAME(a,b,c,d) do { } while(0) | 619 | #define ACPI_DUMP_PATHNAME(a, b, c, d) do { } while(0) |
640 | #define ACPI_DUMP_RESOURCE_LIST(a) do { } while(0) | 620 | #define ACPI_DUMP_RESOURCE_LIST(a) do { } while(0) |
641 | #define ACPI_DUMP_BUFFER(a,b) do { } while(0) | 621 | #define ACPI_DUMP_BUFFER(a, b) do { } while(0) |
642 | #define ACPI_DEBUG_PRINT(pl) do { } while(0) | 622 | #define ACPI_DEBUG_PRINT(pl) do { } while(0) |
643 | #define ACPI_DEBUG_PRINT_RAW(pl) do { } while(0) | 623 | #define ACPI_DEBUG_PRINT_RAW(pl) do { } while(0) |
644 | 624 | ||
@@ -677,15 +657,17 @@ struct acpi_integer_overlay { | |||
677 | /* | 657 | /* |
678 | * Memory allocation tracking (DEBUG ONLY) | 658 | * Memory allocation tracking (DEBUG ONLY) |
679 | */ | 659 | */ |
660 | #define ACPI_MEM_PARAMETERS _COMPONENT, _acpi_module_name, __LINE__ | ||
661 | |||
680 | #ifndef ACPI_DBG_TRACK_ALLOCATIONS | 662 | #ifndef ACPI_DBG_TRACK_ALLOCATIONS |
681 | 663 | ||
682 | /* Memory allocation */ | 664 | /* Memory allocation */ |
683 | 665 | ||
684 | #ifndef ACPI_ALLOCATE | 666 | #ifndef ACPI_ALLOCATE |
685 | #define ACPI_ALLOCATE(a) acpi_ut_allocate((acpi_size)(a),_COMPONENT,_acpi_module_name,__LINE__) | 667 | #define ACPI_ALLOCATE(a) acpi_ut_allocate((acpi_size)(a), ACPI_MEM_PARAMETERS) |
686 | #endif | 668 | #endif |
687 | #ifndef ACPI_ALLOCATE_ZEROED | 669 | #ifndef ACPI_ALLOCATE_ZEROED |
688 | #define ACPI_ALLOCATE_ZEROED(a) acpi_ut_allocate_zeroed((acpi_size)(a), _COMPONENT,_acpi_module_name,__LINE__) | 670 | #define ACPI_ALLOCATE_ZEROED(a) acpi_ut_allocate_zeroed((acpi_size)(a), ACPI_MEM_PARAMETERS) |
689 | #endif | 671 | #endif |
690 | #ifndef ACPI_FREE | 672 | #ifndef ACPI_FREE |
691 | #define ACPI_FREE(a) acpio_os_free(a) | 673 | #define ACPI_FREE(a) acpio_os_free(a) |
@@ -696,11 +678,16 @@ struct acpi_integer_overlay { | |||
696 | 678 | ||
697 | /* Memory allocation */ | 679 | /* Memory allocation */ |
698 | 680 | ||
699 | #define ACPI_ALLOCATE(a) acpi_ut_allocate_and_track((acpi_size)(a),_COMPONENT,_acpi_module_name,__LINE__) | 681 | #define ACPI_ALLOCATE(a) acpi_ut_allocate_and_track((acpi_size)(a), ACPI_MEM_PARAMETERS) |
700 | #define ACPI_ALLOCATE_ZEROED(a) acpi_ut_allocate_zeroed_and_track((acpi_size)(a), _COMPONENT,_acpi_module_name,__LINE__) | 682 | #define ACPI_ALLOCATE_ZEROED(a) acpi_ut_allocate_zeroed_and_track((acpi_size)(a), ACPI_MEM_PARAMETERS) |
701 | #define ACPI_FREE(a) acpi_ut_free_and_track(a,_COMPONENT,_acpi_module_name,__LINE__) | 683 | #define ACPI_FREE(a) acpi_ut_free_and_track(a, ACPI_MEM_PARAMETERS) |
702 | #define ACPI_MEM_TRACKING(a) a | 684 | #define ACPI_MEM_TRACKING(a) a |
703 | 685 | ||
704 | #endif /* ACPI_DBG_TRACK_ALLOCATIONS */ | 686 | #endif /* ACPI_DBG_TRACK_ALLOCATIONS */ |
705 | 687 | ||
688 | /* Preemption point */ | ||
689 | #ifndef ACPI_PREEMPTION_POINT | ||
690 | #define ACPI_PREEMPTION_POINT() /* no preemption */ | ||
691 | #endif | ||
692 | |||
706 | #endif /* ACMACROS_H */ | 693 | #endif /* ACMACROS_H */ |
diff --git a/include/acpi/acnamesp.h b/include/acpi/acnamesp.h index c34008507b69..db4e6f677855 100644 --- a/include/acpi/acnamesp.h +++ b/include/acpi/acnamesp.h | |||
@@ -178,6 +178,22 @@ acpi_ns_dump_objects(acpi_object_type type, | |||
178 | acpi_status acpi_ns_evaluate(struct acpi_evaluate_info *info); | 178 | acpi_status acpi_ns_evaluate(struct acpi_evaluate_info *info); |
179 | 179 | ||
180 | /* | 180 | /* |
181 | * nspredef - Support for predefined/reserved names | ||
182 | */ | ||
183 | acpi_status | ||
184 | acpi_ns_check_predefined_names(struct acpi_namespace_node *node, | ||
185 | union acpi_operand_object *return_object); | ||
186 | |||
187 | const union acpi_predefined_info *acpi_ns_check_for_predefined_name(struct | ||
188 | acpi_namespace_node | ||
189 | *node); | ||
190 | |||
191 | void | ||
192 | acpi_ns_check_parameter_count(char *pathname, | ||
193 | struct acpi_namespace_node *node, | ||
194 | const union acpi_predefined_info *info); | ||
195 | |||
196 | /* | ||
181 | * nsnames - Name and Scope manipulation | 197 | * nsnames - Name and Scope manipulation |
182 | */ | 198 | */ |
183 | u32 acpi_ns_opens_scope(acpi_object_type type); | 199 | u32 acpi_ns_opens_scope(acpi_object_type type); |
diff --git a/include/acpi/acobject.h b/include/acpi/acobject.h index e9657dac69b7..eb6f038b03d9 100644 --- a/include/acpi/acobject.h +++ b/include/acpi/acobject.h | |||
@@ -308,18 +308,34 @@ struct acpi_object_addr_handler { | |||
308 | *****************************************************************************/ | 308 | *****************************************************************************/ |
309 | 309 | ||
310 | /* | 310 | /* |
311 | * The Reference object type is used for these opcodes: | 311 | * The Reference object is used for these opcodes: |
312 | * Arg[0-6], Local[0-7], index_op, name_op, zero_op, one_op, ones_op, debug_op | 312 | * Arg[0-6], Local[0-7], index_op, name_op, ref_of_op, load_op, load_table_op, debug_op |
313 | * The Reference.Class differentiates these types. | ||
313 | */ | 314 | */ |
314 | struct acpi_object_reference { | 315 | struct acpi_object_reference { |
315 | ACPI_OBJECT_COMMON_HEADER u8 target_type; /* Used for index_op */ | 316 | ACPI_OBJECT_COMMON_HEADER u8 class; /* Reference Class */ |
316 | u16 opcode; | 317 | u8 target_type; /* Used for Index Op */ |
318 | u8 reserved; | ||
317 | void *object; /* name_op=>HANDLE to obj, index_op=>union acpi_operand_object */ | 319 | void *object; /* name_op=>HANDLE to obj, index_op=>union acpi_operand_object */ |
318 | struct acpi_namespace_node *node; | 320 | struct acpi_namespace_node *node; /* ref_of or Namepath */ |
319 | union acpi_operand_object **where; | 321 | union acpi_operand_object **where; /* Target of Index */ |
320 | u32 offset; /* Used for arg_op, local_op, and index_op */ | 322 | u32 value; /* Used for Local/Arg/Index/ddb_handle */ |
321 | }; | 323 | }; |
322 | 324 | ||
325 | /* Values for Reference.Class above */ | ||
326 | |||
327 | typedef enum { | ||
328 | ACPI_REFCLASS_LOCAL = 0, /* Method local */ | ||
329 | ACPI_REFCLASS_ARG = 1, /* Method argument */ | ||
330 | ACPI_REFCLASS_REFOF = 2, /* Result of ref_of() TBD: Split to Ref/Node and Ref/operand_obj? */ | ||
331 | ACPI_REFCLASS_INDEX = 3, /* Result of Index() */ | ||
332 | ACPI_REFCLASS_TABLE = 4, /* ddb_handle - Load(), load_table() */ | ||
333 | ACPI_REFCLASS_NAME = 5, /* Reference to a named object */ | ||
334 | ACPI_REFCLASS_DEBUG = 6, /* Debug object */ | ||
335 | |||
336 | ACPI_REFCLASS_MAX = 6 | ||
337 | } ACPI_REFERENCE_CLASSES; | ||
338 | |||
323 | /* | 339 | /* |
324 | * Extra object is used as additional storage for types that | 340 | * Extra object is used as additional storage for types that |
325 | * have AML code in their declarations (term_args) that must be | 341 | * have AML code in their declarations (term_args) that must be |
@@ -379,6 +395,13 @@ union acpi_operand_object { | |||
379 | struct acpi_object_extra extra; | 395 | struct acpi_object_extra extra; |
380 | struct acpi_object_data data; | 396 | struct acpi_object_data data; |
381 | struct acpi_object_cache_list cache; | 397 | struct acpi_object_cache_list cache; |
398 | |||
399 | /* | ||
400 | * Add namespace node to union in order to simplify code that accepts both | ||
401 | * ACPI_OPERAND_OBJECTs and ACPI_NAMESPACE_NODEs. The structures share | ||
402 | * a common descriptor_type field in order to differentiate them. | ||
403 | */ | ||
404 | struct acpi_namespace_node node; | ||
382 | }; | 405 | }; |
383 | 406 | ||
384 | /****************************************************************************** | 407 | /****************************************************************************** |
diff --git a/include/acpi/acoutput.h b/include/acpi/acoutput.h index e17873defcec..09d33c7740f0 100644 --- a/include/acpi/acoutput.h +++ b/include/acpi/acoutput.h | |||
@@ -80,12 +80,10 @@ | |||
80 | /* | 80 | /* |
81 | * Raw debug output levels, do not use these in the DEBUG_PRINT macros | 81 | * Raw debug output levels, do not use these in the DEBUG_PRINT macros |
82 | */ | 82 | */ |
83 | #define ACPI_LV_ERROR 0x00000001 | 83 | #define ACPI_LV_INIT 0x00000001 |
84 | #define ACPI_LV_WARN 0x00000002 | 84 | #define ACPI_LV_DEBUG_OBJECT 0x00000002 |
85 | #define ACPI_LV_INIT 0x00000004 | 85 | #define ACPI_LV_INFO 0x00000004 |
86 | #define ACPI_LV_DEBUG_OBJECT 0x00000008 | 86 | #define ACPI_LV_ALL_EXCEPTIONS 0x00000007 |
87 | #define ACPI_LV_INFO 0x00000010 | ||
88 | #define ACPI_LV_ALL_EXCEPTIONS 0x0000001F | ||
89 | 87 | ||
90 | /* Trace verbosity level 1 [Standard Trace Level] */ | 88 | /* Trace verbosity level 1 [Standard Trace Level] */ |
91 | 89 | ||
@@ -127,7 +125,6 @@ | |||
127 | #define ACPI_LV_VERBOSE_INFO 0x20000000 | 125 | #define ACPI_LV_VERBOSE_INFO 0x20000000 |
128 | #define ACPI_LV_FULL_TABLES 0x40000000 | 126 | #define ACPI_LV_FULL_TABLES 0x40000000 |
129 | #define ACPI_LV_EVENTS 0x80000000 | 127 | #define ACPI_LV_EVENTS 0x80000000 |
130 | |||
131 | #define ACPI_LV_VERBOSE 0xF0000000 | 128 | #define ACPI_LV_VERBOSE 0xF0000000 |
132 | 129 | ||
133 | /* | 130 | /* |
@@ -135,21 +132,17 @@ | |||
135 | */ | 132 | */ |
136 | #define ACPI_DEBUG_LEVEL(dl) (u32) dl,ACPI_DEBUG_PARAMETERS | 133 | #define ACPI_DEBUG_LEVEL(dl) (u32) dl,ACPI_DEBUG_PARAMETERS |
137 | 134 | ||
138 | /* Exception level -- used in the global "DebugLevel" */ | 135 | /* |
139 | 136 | * Exception level -- used in the global "DebugLevel" | |
137 | * | ||
138 | * Note: For errors, use the ACPI_ERROR or ACPI_EXCEPTION interfaces. | ||
139 | * For warnings, use ACPI_WARNING. | ||
140 | */ | ||
140 | #define ACPI_DB_INIT ACPI_DEBUG_LEVEL (ACPI_LV_INIT) | 141 | #define ACPI_DB_INIT ACPI_DEBUG_LEVEL (ACPI_LV_INIT) |
141 | #define ACPI_DB_DEBUG_OBJECT ACPI_DEBUG_LEVEL (ACPI_LV_DEBUG_OBJECT) | 142 | #define ACPI_DB_DEBUG_OBJECT ACPI_DEBUG_LEVEL (ACPI_LV_DEBUG_OBJECT) |
142 | #define ACPI_DB_INFO ACPI_DEBUG_LEVEL (ACPI_LV_INFO) | 143 | #define ACPI_DB_INFO ACPI_DEBUG_LEVEL (ACPI_LV_INFO) |
143 | #define ACPI_DB_ALL_EXCEPTIONS ACPI_DEBUG_LEVEL (ACPI_LV_ALL_EXCEPTIONS) | 144 | #define ACPI_DB_ALL_EXCEPTIONS ACPI_DEBUG_LEVEL (ACPI_LV_ALL_EXCEPTIONS) |
144 | 145 | ||
145 | /* | ||
146 | * These two levels are essentially obsolete, all instances in the | ||
147 | * ACPICA core code have been replaced by ACPI_ERROR and ACPI_WARNING | ||
148 | * (Kept here because some drivers may still use them) | ||
149 | */ | ||
150 | #define ACPI_DB_ERROR ACPI_DEBUG_LEVEL (ACPI_LV_ERROR) | ||
151 | #define ACPI_DB_WARN ACPI_DEBUG_LEVEL (ACPI_LV_WARN) | ||
152 | |||
153 | /* Trace level -- also used in the global "DebugLevel" */ | 146 | /* Trace level -- also used in the global "DebugLevel" */ |
154 | 147 | ||
155 | #define ACPI_DB_INIT_NAMES ACPI_DEBUG_LEVEL (ACPI_LV_INIT_NAMES) | 148 | #define ACPI_DB_INIT_NAMES ACPI_DEBUG_LEVEL (ACPI_LV_INIT_NAMES) |
@@ -173,13 +166,14 @@ | |||
173 | #define ACPI_DB_USER_REQUESTS ACPI_DEBUG_LEVEL (ACPI_LV_USER_REQUESTS) | 166 | #define ACPI_DB_USER_REQUESTS ACPI_DEBUG_LEVEL (ACPI_LV_USER_REQUESTS) |
174 | #define ACPI_DB_PACKAGE ACPI_DEBUG_LEVEL (ACPI_LV_PACKAGE) | 167 | #define ACPI_DB_PACKAGE ACPI_DEBUG_LEVEL (ACPI_LV_PACKAGE) |
175 | #define ACPI_DB_MUTEX ACPI_DEBUG_LEVEL (ACPI_LV_MUTEX) | 168 | #define ACPI_DB_MUTEX ACPI_DEBUG_LEVEL (ACPI_LV_MUTEX) |
169 | #define ACPI_DB_EVENTS ACPI_DEBUG_LEVEL (ACPI_LV_EVENTS) | ||
176 | 170 | ||
177 | #define ACPI_DB_ALL ACPI_DEBUG_LEVEL (ACPI_LV_ALL) | 171 | #define ACPI_DB_ALL ACPI_DEBUG_LEVEL (ACPI_LV_ALL) |
178 | 172 | ||
179 | /* Defaults for debug_level, debug and normal */ | 173 | /* Defaults for debug_level, debug and normal */ |
180 | 174 | ||
181 | #define ACPI_DEBUG_DEFAULT (ACPI_LV_INIT | ACPI_LV_WARN | ACPI_LV_ERROR) | 175 | #define ACPI_DEBUG_DEFAULT (ACPI_LV_INIT | ACPI_LV_DEBUG_OBJECT) |
182 | #define ACPI_NORMAL_DEFAULT (ACPI_LV_INIT | ACPI_LV_WARN | ACPI_LV_ERROR) | 176 | #define ACPI_NORMAL_DEFAULT (ACPI_LV_INIT | ACPI_LV_DEBUG_OBJECT) |
183 | #define ACPI_DEBUG_ALL (ACPI_LV_AML_DISASSEMBLE | ACPI_LV_ALL_EXCEPTIONS | ACPI_LV_ALL) | 177 | #define ACPI_DEBUG_ALL (ACPI_LV_AML_DISASSEMBLE | ACPI_LV_ALL_EXCEPTIONS | ACPI_LV_ALL) |
184 | 178 | ||
185 | #endif /* __ACOUTPUT_H__ */ | 179 | #endif /* __ACOUTPUT_H__ */ |
diff --git a/include/acpi/acpredef.h b/include/acpi/acpredef.h new file mode 100644 index 000000000000..619fb75f8861 --- /dev/null +++ b/include/acpi/acpredef.h | |||
@@ -0,0 +1,371 @@ | |||
1 | /****************************************************************************** | ||
2 | * | ||
3 | * Name: acpredef - Information table for ACPI predefined methods and objects | ||
4 | * $Revision: 1.1 $ | ||
5 | * | ||
6 | *****************************************************************************/ | ||
7 | |||
8 | /* | ||
9 | * Copyright (C) 2000 - 2008, Intel Corp. | ||
10 | * All rights reserved. | ||
11 | * | ||
12 | * Redistribution and use in source and binary forms, with or without | ||
13 | * modification, are permitted provided that the following conditions | ||
14 | * are met: | ||
15 | * 1. Redistributions of source code must retain the above copyright | ||
16 | * notice, this list of conditions, and the following disclaimer, | ||
17 | * without modification. | ||
18 | * 2. Redistributions in binary form must reproduce at minimum a disclaimer | ||
19 | * substantially similar to the "NO WARRANTY" disclaimer below | ||
20 | * ("Disclaimer") and any redistribution must be conditioned upon | ||
21 | * including a substantially similar Disclaimer requirement for further | ||
22 | * binary redistribution. | ||
23 | * 3. Neither the names of the above-listed copyright holders nor the names | ||
24 | * of any contributors may be used to endorse or promote products derived | ||
25 | * from this software without specific prior written permission. | ||
26 | * | ||
27 | * Alternatively, this software may be distributed under the terms of the | ||
28 | * GNU General Public License ("GPL") version 2 as published by the Free | ||
29 | * Software Foundation. | ||
30 | * | ||
31 | * NO WARRANTY | ||
32 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
33 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
34 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR | ||
35 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
36 | * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
37 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
38 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
39 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
40 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | ||
41 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
42 | * POSSIBILITY OF SUCH DAMAGES. | ||
43 | */ | ||
44 | |||
45 | #ifndef __ACPREDEF_H__ | ||
46 | #define __ACPREDEF_H__ | ||
47 | |||
48 | /****************************************************************************** | ||
49 | * | ||
50 | * Return Package types | ||
51 | * | ||
52 | * 1) PTYPE1 packages do not contain sub-packages. | ||
53 | * | ||
54 | * ACPI_PTYPE1_FIXED: Fixed length, 1 or 2 object types: | ||
55 | * object type | ||
56 | * count | ||
57 | * object type | ||
58 | * count | ||
59 | * | ||
60 | * ACPI_PTYPE1_VAR: Variable length: | ||
61 | * object type (Int/Buf/Ref) | ||
62 | * | ||
63 | * ACPI_PTYPE1_OPTION: Package has some required and some optional elements: | ||
64 | * Used for _PRW | ||
65 | * | ||
66 | * | ||
67 | * 2) PTYPE2 packages contain a variable number of sub-packages. Each of the | ||
68 | * different types describe the contents of each of the sub-packages. | ||
69 | * | ||
70 | * ACPI_PTYPE2: Each subpackage contains 1 or 2 object types: | ||
71 | * object type | ||
72 | * count | ||
73 | * object type | ||
74 | * count | ||
75 | * | ||
76 | * ACPI_PTYPE2_COUNT: Each subpackage has a count as first element: | ||
77 | * object type | ||
78 | * | ||
79 | * ACPI_PTYPE2_PKG_COUNT: Count of subpackages at start, 1 or 2 object types: | ||
80 | * object type | ||
81 | * count | ||
82 | * object type | ||
83 | * count | ||
84 | * | ||
85 | * ACPI_PTYPE2_FIXED: Each subpackage is of fixed length: | ||
86 | * Used for _PRT | ||
87 | * | ||
88 | * ACPI_PTYPE2_MIN: Each subpackage has a variable but minimum length | ||
89 | * Used for _HPX | ||
90 | * | ||
91 | *****************************************************************************/ | ||
92 | |||
93 | enum acpi_return_package_types { | ||
94 | ACPI_PTYPE1_FIXED = 1, | ||
95 | ACPI_PTYPE1_VAR = 2, | ||
96 | ACPI_PTYPE1_OPTION = 3, | ||
97 | ACPI_PTYPE2 = 4, | ||
98 | ACPI_PTYPE2_COUNT = 5, | ||
99 | ACPI_PTYPE2_PKG_COUNT = 6, | ||
100 | ACPI_PTYPE2_FIXED = 7, | ||
101 | ACPI_PTYPE2_MIN = 8 | ||
102 | }; | ||
103 | |||
104 | /* | ||
105 | * Predefined method/object information table. | ||
106 | * | ||
107 | * These are the names that can actually be evaluated via acpi_evaluate_object. | ||
108 | * Not present in this table are the following: | ||
109 | * | ||
110 | * 1) Predefined/Reserved names that are never evaluated via acpi_evaluate_object: | ||
111 | * _Lxx and _Exx GPE methods | ||
112 | * _Qxx EC methods | ||
113 | * _T_x compiler temporary variables | ||
114 | * | ||
115 | * 2) Predefined names that never actually exist within the AML code: | ||
116 | * Predefined resource descriptor field names | ||
117 | * | ||
118 | * 3) Predefined names that are implemented within ACPICA: | ||
119 | * _OSI | ||
120 | * | ||
121 | * 4) Some predefined names that are not documented within the ACPI spec. | ||
122 | * _WDG, _WED | ||
123 | * | ||
124 | * The main entries in the table each contain the following items: | ||
125 | * | ||
126 | * Name - The ACPI reserved name | ||
127 | * param_count - Number of arguments to the method | ||
128 | * expected_btypes - Allowed type(s) for the return value. | ||
129 | * 0 means that no return value is expected. | ||
130 | * | ||
131 | * For methods that return packages, the next entry in the table contains | ||
132 | * information about the expected structure of the package. This information | ||
133 | * is saved here (rather than in a separate table) in order to minimize the | ||
134 | * overall size of the stored data. | ||
135 | */ | ||
136 | static const union acpi_predefined_info predefined_names[] = { | ||
137 | {.info = {"_AC0", 0, ACPI_RTYPE_INTEGER}}, | ||
138 | {.info = {"_AC1", 0, ACPI_RTYPE_INTEGER}}, | ||
139 | {.info = {"_AC2", 0, ACPI_RTYPE_INTEGER}}, | ||
140 | {.info = {"_AC3", 0, ACPI_RTYPE_INTEGER}}, | ||
141 | {.info = {"_AC4", 0, ACPI_RTYPE_INTEGER}}, | ||
142 | {.info = {"_AC5", 0, ACPI_RTYPE_INTEGER}}, | ||
143 | {.info = {"_AC6", 0, ACPI_RTYPE_INTEGER}}, | ||
144 | {.info = {"_AC7", 0, ACPI_RTYPE_INTEGER}}, | ||
145 | {.info = {"_AC8", 0, ACPI_RTYPE_INTEGER}}, | ||
146 | {.info = {"_AC9", 0, ACPI_RTYPE_INTEGER}}, | ||
147 | {.info = {"_ADR", 0, ACPI_RTYPE_INTEGER}}, | ||
148 | {.info = {"_AL0", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}}, /* variable (Refs) */ | ||
149 | {.info = {"_AL1", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}}, /* variable (Refs) */ | ||
150 | {.info = {"_AL2", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}}, /* variable (Refs) */ | ||
151 | {.info = {"_AL3", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}}, /* variable (Refs) */ | ||
152 | {.info = {"_AL4", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}}, /* variable (Refs) */ | ||
153 | {.info = {"_AL5", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}}, /* variable (Refs) */ | ||
154 | {.info = {"_AL6", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}}, /* variable (Refs) */ | ||
155 | {.info = {"_AL7", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}}, /* variable (Refs) */ | ||
156 | {.info = {"_AL8", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}}, /* variable (Refs) */ | ||
157 | {.info = {"_AL9", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}}, /* variable (Refs) */ | ||
158 | {.info = {"_ALC", 0, ACPI_RTYPE_INTEGER}}, | ||
159 | {.info = {"_ALI", 0, ACPI_RTYPE_INTEGER}}, | ||
160 | {.info = {"_ALP", 0, ACPI_RTYPE_INTEGER}}, | ||
161 | {.info = {"_ALR", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE2, ACPI_RTYPE_INTEGER, 2, 0, 0, 0}}, /* variable (Pkgs) each 2 (Ints) */ | ||
162 | {.info = {"_ALT", 0, ACPI_RTYPE_INTEGER}}, | ||
163 | {.info = {"_BBN", 0, ACPI_RTYPE_INTEGER}}, | ||
164 | {.info = {"_BCL", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 0, 0, 0, 0}}, /* variable (Ints) */ | ||
165 | {.info = {"_BCM", 1, 0}}, | ||
166 | {.info = {"_BDN", 0, ACPI_RTYPE_INTEGER}}, | ||
167 | {.info = {"_BFS", 1, 0}}, | ||
168 | {.info = {"_BIF", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, | ||
169 | 9, | ||
170 | ACPI_RTYPE_STRING, 4, 0}}, /* fixed (9 Int),(4 Str) */ | ||
171 | {.info = {"_BLT", 3, 0}}, | ||
172 | {.info = {"_BMC", 1, 0}}, | ||
173 | {.info = {"_BMD", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 5, 0, 0, 0}}, /* fixed (5 Int) */ | ||
174 | {.info = {"_BQC", 0, ACPI_RTYPE_INTEGER}}, | ||
175 | {.info = {"_BST", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 4, 0, 0, 0}}, /* fixed (4 Int) */ | ||
176 | {.info = {"_BTM", 1, ACPI_RTYPE_INTEGER}}, | ||
177 | {.info = {"_BTP", 1, 0}}, | ||
178 | {.info = {"_CBA", 0, ACPI_RTYPE_INTEGER}}, /* see PCI firmware spec 3.0 */ | ||
179 | {.info = {"_CID", 0, | ||
180 | ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING | ACPI_RTYPE_PACKAGE}}, | ||
181 | {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING, 0, 0, 0, 0}}, /* variable (Ints/Strs) */ | ||
182 | {.info = {"_CRS", 0, ACPI_RTYPE_BUFFER}}, | ||
183 | {.info = {"_CRT", 0, ACPI_RTYPE_INTEGER}}, | ||
184 | {.info = {"_CSD", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE2_COUNT, ACPI_RTYPE_INTEGER, 0, 0, 0, 0}}, /* variable (1 Int(n), n-1 Int) */ | ||
185 | {.info = {"_CST", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE2_PKG_COUNT, | ||
186 | ACPI_RTYPE_BUFFER, 1, | ||
187 | ACPI_RTYPE_INTEGER, 3, 0}}, /* variable (1 Int(n), n Pkg (1 Buf/3 Int) */ | ||
188 | {.info = {"_DCK", 1, ACPI_RTYPE_INTEGER}}, | ||
189 | {.info = {"_DCS", 0, ACPI_RTYPE_INTEGER}}, | ||
190 | {.info = {"_DDC", 1, ACPI_RTYPE_INTEGER | ACPI_RTYPE_BUFFER}}, | ||
191 | {.info = {"_DDN", 0, ACPI_RTYPE_STRING}}, | ||
192 | {.info = {"_DGS", 0, ACPI_RTYPE_INTEGER}}, | ||
193 | {.info = {"_DIS", 0, 0}}, | ||
194 | {.info = {"_DMA", 0, ACPI_RTYPE_BUFFER}}, | ||
195 | {.info = {"_DOD", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 0, 0, 0, 0}}, /* variable (Ints) */ | ||
196 | {.info = {"_DOS", 1, 0}}, | ||
197 | {.info = {"_DSM", 4, ACPI_RTYPE_ALL}}, /* Must return a type, but it can be of any type */ | ||
198 | {.info = {"_DSS", 1, 0}}, | ||
199 | {.info = {"_DSW", 3, 0}}, | ||
200 | {.info = {"_EC_", 0, ACPI_RTYPE_INTEGER}}, | ||
201 | {.info = {"_EDL", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}}, /* variable (Refs) */ | ||
202 | {.info = {"_EJ0", 1, 0}}, | ||
203 | {.info = {"_EJ1", 1, 0}}, | ||
204 | {.info = {"_EJ2", 1, 0}}, | ||
205 | {.info = {"_EJ3", 1, 0}}, | ||
206 | {.info = {"_EJ4", 1, 0}}, | ||
207 | {.info = {"_EJD", 0, ACPI_RTYPE_STRING}}, | ||
208 | {.info = {"_FDE", 0, ACPI_RTYPE_BUFFER}}, | ||
209 | {.info = {"_FDI", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 16, 0, 0, 0}}, /* fixed (16 Int) */ | ||
210 | {.info = {"_FDM", 1, 0}}, | ||
211 | {.info = {"_FIX", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 0, 0, 0, 0}}, /* variable (Ints) */ | ||
212 | {.info = {"_GLK", 0, ACPI_RTYPE_INTEGER}}, | ||
213 | {.info = {"_GPD", 0, ACPI_RTYPE_INTEGER}}, | ||
214 | {.info = {"_GPE", 0, ACPI_RTYPE_INTEGER}}, /* _GPE method, not _GPE scope */ | ||
215 | {.info = {"_GSB", 0, ACPI_RTYPE_INTEGER}}, | ||
216 | {.info = {"_GTF", 0, ACPI_RTYPE_BUFFER}}, | ||
217 | {.info = {"_GTM", 0, ACPI_RTYPE_BUFFER}}, | ||
218 | {.info = {"_GTS", 1, 0}}, | ||
219 | {.info = {"_HID", 0, ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING}}, | ||
220 | {.info = {"_HOT", 0, ACPI_RTYPE_INTEGER}}, | ||
221 | {.info = {"_HPP", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 4, 0, 0, 0}}, /* fixed (4 Int) */ | ||
222 | |||
223 | /* | ||
224 | * For _HPX, a single package is returned, containing a variable number of sub-packages. | ||
225 | * Each sub-package contains a PCI record setting. There are several different type of | ||
226 | * record settings, of different lengths, but all elements of all settings are Integers. | ||
227 | */ | ||
228 | {.info = {"_HPX", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE2_MIN, ACPI_RTYPE_INTEGER, 5, 0, 0, 0}}, /* variable (Pkgs) each (var Ints) */ | ||
229 | {.info = {"_IFT", 0, ACPI_RTYPE_INTEGER}}, /* see IPMI spec */ | ||
230 | {.info = {"_INI", 0, 0}}, | ||
231 | {.info = {"_IRC", 0, 0}}, | ||
232 | {.info = {"_LCK", 1, 0}}, | ||
233 | {.info = {"_LID", 0, ACPI_RTYPE_INTEGER}}, | ||
234 | {.info = {"_MAT", 0, ACPI_RTYPE_BUFFER}}, | ||
235 | {.info = {"_MLS", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE2, ACPI_RTYPE_STRING, 2, 0, 0, 0}}, /* variable (Pkgs) each (2 Str) */ | ||
236 | {.info = {"_MSG", 1, 0}}, | ||
237 | {.info = {"_OFF", 0, 0}}, | ||
238 | {.info = {"_ON_", 0, 0}}, | ||
239 | {.info = {"_OS_", 0, ACPI_RTYPE_STRING}}, | ||
240 | {.info = {"_OSC", 4, ACPI_RTYPE_BUFFER}}, | ||
241 | {.info = {"_OST", 3, 0}}, | ||
242 | {.info = {"_PCL", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}}, /* variable (Refs) */ | ||
243 | {.info = {"_PCT", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_FIXED, ACPI_RTYPE_BUFFER, 2, 0, 0, 0}}, /* fixed (2 Buf) */ | ||
244 | {.info = {"_PDC", 1, 0}}, | ||
245 | {.info = {"_PIC", 1, 0}}, | ||
246 | {.info = {"_PLD", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_BUFFER, 0, 0, 0, 0}}, /* variable (Bufs) */ | ||
247 | {.info = {"_PPC", 0, ACPI_RTYPE_INTEGER}}, | ||
248 | {.info = {"_PPE", 0, ACPI_RTYPE_INTEGER}}, /* see dig64 spec */ | ||
249 | {.info = {"_PR0", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}}, /* variable (Refs) */ | ||
250 | {.info = {"_PR1", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}}, /* variable (Refs) */ | ||
251 | {.info = {"_PR2", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}}, /* variable (Refs) */ | ||
252 | {.info = {"_PRS", 0, ACPI_RTYPE_BUFFER}}, | ||
253 | |||
254 | /* | ||
255 | * For _PRT, many BIOSs reverse the 2nd and 3rd Package elements. This bug is so prevalent that there | ||
256 | * is code in the ACPICA Resource Manager to detect this and switch them back. For now, do not allow | ||
257 | * and issue a warning. To allow this and eliminate the warning, add the ACPI_RTYPE_REFERENCE | ||
258 | * type to the 2nd element (index 1) in the statement below. | ||
259 | */ | ||
260 | {.info = {"_PRT", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE2_FIXED, 4, | ||
261 | ACPI_RTYPE_INTEGER, | ||
262 | ACPI_RTYPE_INTEGER, | ||
263 | ACPI_RTYPE_INTEGER | ACPI_RTYPE_REFERENCE, ACPI_RTYPE_INTEGER}}, /* variable (Pkgs) each (4): Int,Int,Int/Ref,Int */ | ||
264 | |||
265 | {.info = {"_PRW", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_OPTION, 2, | ||
266 | ACPI_RTYPE_INTEGER | | ||
267 | ACPI_RTYPE_PACKAGE, | ||
268 | ACPI_RTYPE_INTEGER, ACPI_RTYPE_REFERENCE, 0}}, /* variable (Pkgs) each: Pkg/Int,Int,[variable Refs] (Pkg is Ref/Int) */ | ||
269 | |||
270 | {.info = {"_PS0", 0, 0}}, | ||
271 | {.info = {"_PS1", 0, 0}}, | ||
272 | {.info = {"_PS2", 0, 0}}, | ||
273 | {.info = {"_PS3", 0, 0}}, | ||
274 | {.info = {"_PSC", 0, ACPI_RTYPE_INTEGER}}, | ||
275 | {.info = {"_PSD", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE2_COUNT, ACPI_RTYPE_INTEGER, 0, 0, 0, 0}}, /* variable (Pkgs) each (5 Int) with count */ | ||
276 | {.info = {"_PSL", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}}, /* variable (Refs) */ | ||
277 | {.info = {"_PSR", 0, ACPI_RTYPE_INTEGER}}, | ||
278 | {.info = {"_PSS", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE2, ACPI_RTYPE_INTEGER, 6, 0, 0, 0}}, /* variable (Pkgs) each (6 Int) */ | ||
279 | {.info = {"_PSV", 0, ACPI_RTYPE_INTEGER}}, | ||
280 | {.info = {"_PSW", 1, 0}}, | ||
281 | {.info = {"_PTC", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_FIXED, ACPI_RTYPE_BUFFER, 2, 0, 0, 0}}, /* fixed (2 Buf) */ | ||
282 | {.info = {"_PTS", 1, 0}}, | ||
283 | {.info = {"_PXM", 0, ACPI_RTYPE_INTEGER}}, | ||
284 | {.info = {"_REG", 2, 0}}, | ||
285 | {.info = {"_REV", 0, ACPI_RTYPE_INTEGER}}, | ||
286 | {.info = {"_RMV", 0, ACPI_RTYPE_INTEGER}}, | ||
287 | {.info = {"_ROM", 2, ACPI_RTYPE_BUFFER}}, | ||
288 | {.info = {"_RTV", 0, ACPI_RTYPE_INTEGER}}, | ||
289 | |||
290 | /* | ||
291 | * For _S0_ through _S5_, the ACPI spec defines a return Package containing 1 Integer, | ||
292 | * but most DSDTs have it wrong - 2,3, or 4 integers. Allow this by making the objects "variable length", | ||
293 | * but all elements must be Integers. | ||
294 | */ | ||
295 | {.info = {"_S0_", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 1, 0, 0, 0}}, /* fixed (1 Int) */ | ||
296 | {.info = {"_S1_", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 1, 0, 0, 0}}, /* fixed (1 Int) */ | ||
297 | {.info = {"_S2_", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 1, 0, 0, 0}}, /* fixed (1 Int) */ | ||
298 | {.info = {"_S3_", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 1, 0, 0, 0}}, /* fixed (1 Int) */ | ||
299 | {.info = {"_S4_", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 1, 0, 0, 0}}, /* fixed (1 Int) */ | ||
300 | {.info = {"_S5_", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 1, 0, 0, 0}}, /* fixed (1 Int) */ | ||
301 | |||
302 | {.info = {"_S1D", 0, ACPI_RTYPE_INTEGER}}, | ||
303 | {.info = {"_S2D", 0, ACPI_RTYPE_INTEGER}}, | ||
304 | {.info = {"_S3D", 0, ACPI_RTYPE_INTEGER}}, | ||
305 | {.info = {"_S4D", 0, ACPI_RTYPE_INTEGER}}, | ||
306 | {.info = {"_S0W", 0, ACPI_RTYPE_INTEGER}}, | ||
307 | {.info = {"_S1W", 0, ACPI_RTYPE_INTEGER}}, | ||
308 | {.info = {"_S2W", 0, ACPI_RTYPE_INTEGER}}, | ||
309 | {.info = {"_S3W", 0, ACPI_RTYPE_INTEGER}}, | ||
310 | {.info = {"_S4W", 0, ACPI_RTYPE_INTEGER}}, | ||
311 | {.info = {"_SBS", 0, ACPI_RTYPE_INTEGER}}, | ||
312 | {.info = {"_SCP", 0x13, 0}}, /* Acpi 1.0 allowed 1 arg. Acpi 3.0 expanded to 3 args. Allow both. */ | ||
313 | /* Note: the 3-arg definition may be removed for ACPI 4.0 */ | ||
314 | {.info = {"_SDD", 1, 0}}, | ||
315 | {.info = {"_SEG", 0, ACPI_RTYPE_INTEGER}}, | ||
316 | {.info = {"_SLI", 0, ACPI_RTYPE_BUFFER}}, | ||
317 | {.info = {"_SPD", 1, ACPI_RTYPE_INTEGER}}, | ||
318 | {.info = {"_SRS", 1, 0}}, | ||
319 | {.info = {"_SRV", 0, ACPI_RTYPE_INTEGER}}, /* see IPMI spec */ | ||
320 | {.info = {"_SST", 1, 0}}, | ||
321 | {.info = {"_STA", 0, ACPI_RTYPE_INTEGER}}, | ||
322 | {.info = {"_STM", 3, 0}}, | ||
323 | {.info = {"_STR", 0, ACPI_RTYPE_BUFFER}}, | ||
324 | {.info = {"_SUN", 0, ACPI_RTYPE_INTEGER}}, | ||
325 | {.info = {"_SWS", 0, ACPI_RTYPE_INTEGER}}, | ||
326 | {.info = {"_TC1", 0, ACPI_RTYPE_INTEGER}}, | ||
327 | {.info = {"_TC2", 0, ACPI_RTYPE_INTEGER}}, | ||
328 | {.info = {"_TMP", 0, ACPI_RTYPE_INTEGER}}, | ||
329 | {.info = {"_TPC", 0, ACPI_RTYPE_INTEGER}}, | ||
330 | {.info = {"_TPT", 1, 0}}, | ||
331 | {.info = {"_TRT", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE2, ACPI_RTYPE_REFERENCE, 2, | ||
332 | ACPI_RTYPE_INTEGER, 6, 0}}, /* variable (Pkgs) each 2_ref/6_int */ | ||
333 | {.info = {"_TSD", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE2_COUNT, ACPI_RTYPE_INTEGER, 5, 0, 0, 0}}, /* variable (Pkgs) each 5_int with count */ | ||
334 | {.info = {"_TSP", 0, ACPI_RTYPE_INTEGER}}, | ||
335 | {.info = {"_TSS", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE2, ACPI_RTYPE_INTEGER, 5, 0, 0, 0}}, /* variable (Pkgs) each 5_int */ | ||
336 | {.info = {"_TST", 0, ACPI_RTYPE_INTEGER}}, | ||
337 | {.info = {"_TTS", 1, 0}}, | ||
338 | {.info = {"_TZD", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}}, /* variable (Refs) */ | ||
339 | {.info = {"_TZM", 0, ACPI_RTYPE_REFERENCE}}, | ||
340 | {.info = {"_TZP", 0, ACPI_RTYPE_INTEGER}}, | ||
341 | {.info = {"_UID", 0, ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING}}, | ||
342 | {.info = {"_UPC", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 4, 0, 0, 0}}, /* fixed (4 Int) */ | ||
343 | {.info = {"_UPD", 0, ACPI_RTYPE_INTEGER}}, | ||
344 | {.info = {"_UPP", 0, ACPI_RTYPE_INTEGER}}, | ||
345 | {.info = {"_VPO", 0, ACPI_RTYPE_INTEGER}}, | ||
346 | |||
347 | /* Acpi 1.0 defined _WAK with no return value. Later, it was changed to return a package */ | ||
348 | |||
349 | {.info = {"_WAK", 1, ACPI_RTYPE_NONE | ACPI_RTYPE_PACKAGE}}, | ||
350 | {.ret_info = {ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 2, 0, 0, 0}}, /* fixed (2 Int), but is optional */ | ||
351 | {.ret_info = {0, 0, 0, 0, 0, 0}} /* Table terminator */ | ||
352 | }; | ||
353 | |||
354 | #if 0 | ||
355 | /* Not implemented */ | ||
356 | |||
357 | { | ||
358 | "_WDG", 0, ACPI_RTYPE_BUFFER}, /* MS Extension */ | ||
359 | |||
360 | { | ||
361 | "_WED", 1, ACPI_RTYPE_PACKAGE}, /* MS Extension */ | ||
362 | |||
363 | /* This is an internally implemented control method, no need to check */ | ||
364 | { | ||
365 | "_OSI", 1, ACPI_RTYPE_INTEGER}, | ||
366 | |||
367 | /* TBD: */ | ||
368 | _PRT - currently ignore reversed entries.attempt to fix here ? | ||
369 | think about code that attempts to fix package elements like _BIF, etc. | ||
370 | #endif | ||
371 | #endif | ||
diff --git a/include/acpi/actbl1.h b/include/acpi/actbl1.h index d38f9be2f6ee..63f5b4cf4de1 100644 --- a/include/acpi/actbl1.h +++ b/include/acpi/actbl1.h | |||
@@ -908,7 +908,9 @@ enum acpi_madt_type { | |||
908 | ACPI_MADT_TYPE_IO_SAPIC = 6, | 908 | ACPI_MADT_TYPE_IO_SAPIC = 6, |
909 | ACPI_MADT_TYPE_LOCAL_SAPIC = 7, | 909 | ACPI_MADT_TYPE_LOCAL_SAPIC = 7, |
910 | ACPI_MADT_TYPE_INTERRUPT_SOURCE = 8, | 910 | ACPI_MADT_TYPE_INTERRUPT_SOURCE = 8, |
911 | ACPI_MADT_TYPE_RESERVED = 9 /* 9 and greater are reserved */ | 911 | ACPI_MADT_TYPE_LOCAL_X2APIC = 9, |
912 | ACPI_MADT_TYPE_LOCAL_X2APIC_NMI = 10, | ||
913 | ACPI_MADT_TYPE_RESERVED = 11 /* 11 and greater are reserved */ | ||
912 | }; | 914 | }; |
913 | 915 | ||
914 | /* | 916 | /* |
@@ -1009,6 +1011,26 @@ struct acpi_madt_interrupt_source { | |||
1009 | 1011 | ||
1010 | #define ACPI_MADT_CPEI_OVERRIDE (1) | 1012 | #define ACPI_MADT_CPEI_OVERRIDE (1) |
1011 | 1013 | ||
1014 | /* 9: Processor Local X2_APIC (07/2008) */ | ||
1015 | |||
1016 | struct acpi_madt_local_x2apic { | ||
1017 | struct acpi_subtable_header header; | ||
1018 | u16 reserved; /* Reserved - must be zero */ | ||
1019 | u32 local_apic_id; /* Processor X2_APIC ID */ | ||
1020 | u32 lapic_flags; | ||
1021 | u32 uid; /* Extended X2_APIC processor ID */ | ||
1022 | }; | ||
1023 | |||
1024 | /* 10: Local X2APIC NMI (07/2008) */ | ||
1025 | |||
1026 | struct acpi_madt_local_x2apic_nmi { | ||
1027 | struct acpi_subtable_header header; | ||
1028 | u16 inti_flags; | ||
1029 | u32 uid; /* Processor X2_APIC ID */ | ||
1030 | u8 lint; /* LINTn to which NMI is connected */ | ||
1031 | u8 reserved[3]; | ||
1032 | }; | ||
1033 | |||
1012 | /* | 1034 | /* |
1013 | * Common flags fields for MADT subtables | 1035 | * Common flags fields for MADT subtables |
1014 | */ | 1036 | */ |
@@ -1150,10 +1172,15 @@ struct acpi_table_srat { | |||
1150 | enum acpi_srat_type { | 1172 | enum acpi_srat_type { |
1151 | ACPI_SRAT_TYPE_CPU_AFFINITY = 0, | 1173 | ACPI_SRAT_TYPE_CPU_AFFINITY = 0, |
1152 | ACPI_SRAT_TYPE_MEMORY_AFFINITY = 1, | 1174 | ACPI_SRAT_TYPE_MEMORY_AFFINITY = 1, |
1153 | ACPI_SRAT_TYPE_RESERVED = 2 | 1175 | ACPI_SRAT_TYPE_X2APIC_CPU_AFFINITY = 2, |
1176 | ACPI_SRAT_TYPE_RESERVED = 3 /* 3 and greater are reserved */ | ||
1154 | }; | 1177 | }; |
1155 | 1178 | ||
1156 | /* SRAT sub-tables */ | 1179 | /* |
1180 | * SRAT Sub-tables, correspond to Type in struct acpi_subtable_header | ||
1181 | */ | ||
1182 | |||
1183 | /* 0: Processor Local APIC/SAPIC Affinity */ | ||
1157 | 1184 | ||
1158 | struct acpi_srat_cpu_affinity { | 1185 | struct acpi_srat_cpu_affinity { |
1159 | struct acpi_subtable_header header; | 1186 | struct acpi_subtable_header header; |
@@ -1165,9 +1192,7 @@ struct acpi_srat_cpu_affinity { | |||
1165 | u32 reserved; /* Reserved, must be zero */ | 1192 | u32 reserved; /* Reserved, must be zero */ |
1166 | }; | 1193 | }; |
1167 | 1194 | ||
1168 | /* Flags */ | 1195 | /* 1: Memory Affinity */ |
1169 | |||
1170 | #define ACPI_SRAT_CPU_ENABLED (1) /* 00: Use affinity structure */ | ||
1171 | 1196 | ||
1172 | struct acpi_srat_mem_affinity { | 1197 | struct acpi_srat_mem_affinity { |
1173 | struct acpi_subtable_header header; | 1198 | struct acpi_subtable_header header; |
@@ -1186,6 +1211,20 @@ struct acpi_srat_mem_affinity { | |||
1186 | #define ACPI_SRAT_MEM_HOT_PLUGGABLE (1<<1) /* 01: Memory region is hot pluggable */ | 1211 | #define ACPI_SRAT_MEM_HOT_PLUGGABLE (1<<1) /* 01: Memory region is hot pluggable */ |
1187 | #define ACPI_SRAT_MEM_NON_VOLATILE (1<<2) /* 02: Memory region is non-volatile */ | 1212 | #define ACPI_SRAT_MEM_NON_VOLATILE (1<<2) /* 02: Memory region is non-volatile */ |
1188 | 1213 | ||
1214 | /* 2: Processor Local X2_APIC Affinity (07/2008) */ | ||
1215 | |||
1216 | struct acpi_srat_x2apic_cpu_affinity { | ||
1217 | struct acpi_subtable_header header; | ||
1218 | u16 reserved; /* Reserved, must be zero */ | ||
1219 | u32 proximity_domain; | ||
1220 | u32 apic_id; | ||
1221 | u32 flags; | ||
1222 | }; | ||
1223 | |||
1224 | /* Flags for struct acpi_srat_cpu_affinity and struct acpi_srat_x2apic_cpu_affinity */ | ||
1225 | |||
1226 | #define ACPI_SRAT_CPU_ENABLED (1) /* 00: Use affinity structure */ | ||
1227 | |||
1189 | /******************************************************************************* | 1228 | /******************************************************************************* |
1190 | * | 1229 | * |
1191 | * TCPA - Trusted Computing Platform Alliance table | 1230 | * TCPA - Trusted Computing Platform Alliance table |
diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h index 4ea4f40bf894..e8936ab59627 100644 --- a/include/acpi/actypes.h +++ b/include/acpi/actypes.h | |||
@@ -607,8 +607,15 @@ typedef u8 acpi_adr_space_type; | |||
607 | 607 | ||
608 | /* | 608 | /* |
609 | * bit_register IDs | 609 | * bit_register IDs |
610 | * These are bitfields defined within the full ACPI registers | 610 | * |
611 | * These values are intended to be used by the hardware interfaces | ||
612 | * and are mapped to individual bitfields defined within the ACPI | ||
613 | * registers. See the acpi_gbl_bit_register_info global table in utglobal.c | ||
614 | * for this mapping. | ||
611 | */ | 615 | */ |
616 | |||
617 | /* PM1 Status register */ | ||
618 | |||
612 | #define ACPI_BITREG_TIMER_STATUS 0x00 | 619 | #define ACPI_BITREG_TIMER_STATUS 0x00 |
613 | #define ACPI_BITREG_BUS_MASTER_STATUS 0x01 | 620 | #define ACPI_BITREG_BUS_MASTER_STATUS 0x01 |
614 | #define ACPI_BITREG_GLOBAL_LOCK_STATUS 0x02 | 621 | #define ACPI_BITREG_GLOBAL_LOCK_STATUS 0x02 |
@@ -618,24 +625,29 @@ typedef u8 acpi_adr_space_type; | |||
618 | #define ACPI_BITREG_WAKE_STATUS 0x06 | 625 | #define ACPI_BITREG_WAKE_STATUS 0x06 |
619 | #define ACPI_BITREG_PCIEXP_WAKE_STATUS 0x07 | 626 | #define ACPI_BITREG_PCIEXP_WAKE_STATUS 0x07 |
620 | 627 | ||
628 | /* PM1 Enable register */ | ||
629 | |||
621 | #define ACPI_BITREG_TIMER_ENABLE 0x08 | 630 | #define ACPI_BITREG_TIMER_ENABLE 0x08 |
622 | #define ACPI_BITREG_GLOBAL_LOCK_ENABLE 0x09 | 631 | #define ACPI_BITREG_GLOBAL_LOCK_ENABLE 0x09 |
623 | #define ACPI_BITREG_POWER_BUTTON_ENABLE 0x0A | 632 | #define ACPI_BITREG_POWER_BUTTON_ENABLE 0x0A |
624 | #define ACPI_BITREG_SLEEP_BUTTON_ENABLE 0x0B | 633 | #define ACPI_BITREG_SLEEP_BUTTON_ENABLE 0x0B |
625 | #define ACPI_BITREG_RT_CLOCK_ENABLE 0x0C | 634 | #define ACPI_BITREG_RT_CLOCK_ENABLE 0x0C |
626 | #define ACPI_BITREG_WAKE_ENABLE 0x0D | 635 | #define ACPI_BITREG_PCIEXP_WAKE_DISABLE 0x0D |
627 | #define ACPI_BITREG_PCIEXP_WAKE_DISABLE 0x0E | 636 | |
637 | /* PM1 Control register */ | ||
638 | |||
639 | #define ACPI_BITREG_SCI_ENABLE 0x0E | ||
640 | #define ACPI_BITREG_BUS_MASTER_RLD 0x0F | ||
641 | #define ACPI_BITREG_GLOBAL_LOCK_RELEASE 0x10 | ||
642 | #define ACPI_BITREG_SLEEP_TYPE_A 0x11 | ||
643 | #define ACPI_BITREG_SLEEP_TYPE_B 0x12 | ||
644 | #define ACPI_BITREG_SLEEP_ENABLE 0x13 | ||
628 | 645 | ||
629 | #define ACPI_BITREG_SCI_ENABLE 0x0F | 646 | /* PM2 Control register */ |
630 | #define ACPI_BITREG_BUS_MASTER_RLD 0x10 | ||
631 | #define ACPI_BITREG_GLOBAL_LOCK_RELEASE 0x11 | ||
632 | #define ACPI_BITREG_SLEEP_TYPE_A 0x12 | ||
633 | #define ACPI_BITREG_SLEEP_TYPE_B 0x13 | ||
634 | #define ACPI_BITREG_SLEEP_ENABLE 0x14 | ||
635 | 647 | ||
636 | #define ACPI_BITREG_ARB_DISABLE 0x15 | 648 | #define ACPI_BITREG_ARB_DISABLE 0x14 |
637 | 649 | ||
638 | #define ACPI_BITREG_MAX 0x15 | 650 | #define ACPI_BITREG_MAX 0x14 |
639 | #define ACPI_NUM_BITREG ACPI_BITREG_MAX + 1 | 651 | #define ACPI_NUM_BITREG ACPI_BITREG_MAX + 1 |
640 | 652 | ||
641 | /* | 653 | /* |
@@ -859,6 +871,7 @@ struct acpi_obj_info_header { | |||
859 | struct acpi_device_info { | 871 | struct acpi_device_info { |
860 | ACPI_COMMON_OBJ_INFO; | 872 | ACPI_COMMON_OBJ_INFO; |
861 | 873 | ||
874 | u32 param_count; /* If a method, required parameter count */ | ||
862 | u32 valid; /* Indicates which fields below are valid */ | 875 | u32 valid; /* Indicates which fields below are valid */ |
863 | u32 current_status; /* _STA value */ | 876 | u32 current_status; /* _STA value */ |
864 | acpi_integer address; /* _ADR value if any */ | 877 | acpi_integer address; /* _ADR value if any */ |
@@ -1225,8 +1238,8 @@ struct acpi_resource { | |||
1225 | 1238 | ||
1226 | #pragma pack() | 1239 | #pragma pack() |
1227 | 1240 | ||
1228 | #define ACPI_RS_SIZE_MIN 12 | ||
1229 | #define ACPI_RS_SIZE_NO_DATA 8 /* Id + Length fields */ | 1241 | #define ACPI_RS_SIZE_NO_DATA 8 /* Id + Length fields */ |
1242 | #define ACPI_RS_SIZE_MIN (u32) ACPI_ROUND_UP_TO_NATIVE_WORD (12) | ||
1230 | #define ACPI_RS_SIZE(type) (u32) (ACPI_RS_SIZE_NO_DATA + sizeof (type)) | 1243 | #define ACPI_RS_SIZE(type) (u32) (ACPI_RS_SIZE_NO_DATA + sizeof (type)) |
1231 | 1244 | ||
1232 | #define ACPI_NEXT_RESOURCE(res) (struct acpi_resource *)((u8 *) res + res->length) | 1245 | #define ACPI_NEXT_RESOURCE(res) (struct acpi_resource *)((u8 *) res + res->length) |
diff --git a/include/acpi/acutils.h b/include/acpi/acutils.h index 69f8888771ff..d8307b2987e3 100644 --- a/include/acpi/acutils.h +++ b/include/acpi/acutils.h | |||
@@ -110,7 +110,7 @@ struct acpi_pkg_info { | |||
110 | /* | 110 | /* |
111 | * utglobal - Global data structures and procedures | 111 | * utglobal - Global data structures and procedures |
112 | */ | 112 | */ |
113 | void acpi_ut_init_globals(void); | 113 | acpi_status acpi_ut_init_globals(void); |
114 | 114 | ||
115 | #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) | 115 | #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) |
116 | 116 | ||
@@ -126,6 +126,8 @@ char *acpi_ut_get_node_name(void *object); | |||
126 | 126 | ||
127 | char *acpi_ut_get_descriptor_name(void *object); | 127 | char *acpi_ut_get_descriptor_name(void *object); |
128 | 128 | ||
129 | const char *acpi_ut_get_reference_name(union acpi_operand_object *object); | ||
130 | |||
129 | char *acpi_ut_get_object_type_name(union acpi_operand_object *obj_desc); | 131 | char *acpi_ut_get_object_type_name(union acpi_operand_object *obj_desc); |
130 | 132 | ||
131 | char *acpi_ut_get_region_name(u8 space_id); | 133 | char *acpi_ut_get_region_name(u8 space_id); |
diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h index 9af464598682..029c8c06c151 100644 --- a/include/acpi/platform/aclinux.h +++ b/include/acpi/platform/aclinux.h | |||
@@ -53,6 +53,7 @@ | |||
53 | #include <linux/kernel.h> | 53 | #include <linux/kernel.h> |
54 | #include <linux/module.h> | 54 | #include <linux/module.h> |
55 | #include <linux/ctype.h> | 55 | #include <linux/ctype.h> |
56 | #include <linux/sched.h> | ||
56 | #include <asm/system.h> | 57 | #include <asm/system.h> |
57 | #include <asm/atomic.h> | 58 | #include <asm/atomic.h> |
58 | #include <asm/div64.h> | 59 | #include <asm/div64.h> |
@@ -137,4 +138,9 @@ static inline void *acpi_os_acquire_object(acpi_cache_t * cache) | |||
137 | #define ACPI_ALLOCATE_ZEROED(a) acpi_os_allocate_zeroed(a) | 138 | #define ACPI_ALLOCATE_ZEROED(a) acpi_os_allocate_zeroed(a) |
138 | #define ACPI_FREE(a) kfree(a) | 139 | #define ACPI_FREE(a) kfree(a) |
139 | 140 | ||
141 | /* | ||
142 | * We need to show where it is safe to preempt execution of ACPICA | ||
143 | */ | ||
144 | #define ACPI_PREEMPTION_POINT() cond_resched() | ||
145 | |||
140 | #endif /* __ACLINUX_H__ */ | 146 | #endif /* __ACLINUX_H__ */ |