aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/executer/exresop.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/executer/exresop.c')
-rw-r--r--drivers/acpi/executer/exresop.c143
1 files changed, 77 insertions, 66 deletions
diff --git a/drivers/acpi/executer/exresop.c b/drivers/acpi/executer/exresop.c
index ff064e79ab90..a1c000f5a415 100644
--- a/drivers/acpi/executer/exresop.c
+++ b/drivers/acpi/executer/exresop.c
@@ -6,7 +6,7 @@
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2005, R. Byron Moore 9 * Copyright (C) 2000 - 2006, R. Byron Moore
10 * All rights reserved. 10 * All rights reserved.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
@@ -46,6 +46,7 @@
46#include <acpi/amlcode.h> 46#include <acpi/amlcode.h>
47#include <acpi/acparser.h> 47#include <acpi/acparser.h>
48#include <acpi/acinterp.h> 48#include <acpi/acinterp.h>
49#include <acpi/acnamesp.h>
49 50
50#define _COMPONENT ACPI_EXECUTER 51#define _COMPONENT ACPI_EXECUTER
51ACPI_MODULE_NAME("exresop") 52ACPI_MODULE_NAME("exresop")
@@ -73,7 +74,7 @@ static acpi_status
73acpi_ex_check_object_type(acpi_object_type type_needed, 74acpi_ex_check_object_type(acpi_object_type type_needed,
74 acpi_object_type this_type, void *object) 75 acpi_object_type this_type, void *object)
75{ 76{
76 ACPI_FUNCTION_NAME("ex_check_object_type"); 77 ACPI_FUNCTION_ENTRY();
77 78
78 if (type_needed == ACPI_TYPE_ANY) { 79 if (type_needed == ACPI_TYPE_ANY) {
79 /* All types OK, so we don't perform any typechecks */ 80 /* All types OK, so we don't perform any typechecks */
@@ -95,10 +96,10 @@ acpi_ex_check_object_type(acpi_object_type type_needed,
95 } 96 }
96 97
97 if (type_needed != this_type) { 98 if (type_needed != this_type) {
98 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 99 ACPI_ERROR((AE_INFO,
99 "Needed [%s], found [%s] %p\n", 100 "Needed type [%s], found [%s] %p",
100 acpi_ut_get_type_name(type_needed), 101 acpi_ut_get_type_name(type_needed),
101 acpi_ut_get_type_name(this_type), object)); 102 acpi_ut_get_type_name(this_type), object));
102 103
103 return (AE_AML_OPERAND_TYPE); 104 return (AE_AML_OPERAND_TYPE);
104 } 105 }
@@ -151,13 +152,13 @@ acpi_ex_resolve_operands(u16 opcode,
151 152
152 arg_types = op_info->runtime_args; 153 arg_types = op_info->runtime_args;
153 if (arg_types == ARGI_INVALID_OPCODE) { 154 if (arg_types == ARGI_INVALID_OPCODE) {
154 ACPI_REPORT_ERROR(("resolve_operands: %X is not a valid AML opcode\n", opcode)); 155 ACPI_ERROR((AE_INFO, "Unknown AML opcode %X", opcode));
155 156
156 return_ACPI_STATUS(AE_AML_INTERNAL); 157 return_ACPI_STATUS(AE_AML_INTERNAL);
157 } 158 }
158 159
159 ACPI_DEBUG_PRINT((ACPI_DB_EXEC, 160 ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
160 "Opcode %X [%s] required_operand_types=%8.8X \n", 161 "Opcode %X [%s] required_operand_types=%8.8X\n",
161 opcode, op_info->name, arg_types)); 162 opcode, op_info->name, arg_types));
162 163
163 /* 164 /*
@@ -169,7 +170,8 @@ acpi_ex_resolve_operands(u16 opcode,
169 */ 170 */
170 while (GET_CURRENT_ARG_TYPE(arg_types)) { 171 while (GET_CURRENT_ARG_TYPE(arg_types)) {
171 if (!stack_ptr || !*stack_ptr) { 172 if (!stack_ptr || !*stack_ptr) {
172 ACPI_REPORT_ERROR(("resolve_operands: Null stack entry at %p\n", stack_ptr)); 173 ACPI_ERROR((AE_INFO, "Null stack entry at %p",
174 stack_ptr));
173 175
174 return_ACPI_STATUS(AE_AML_INTERNAL); 176 return_ACPI_STATUS(AE_AML_INTERNAL);
175 } 177 }
@@ -187,6 +189,22 @@ acpi_ex_resolve_operands(u16 opcode,
187 189
188 object_type = 190 object_type =
189 ((struct acpi_namespace_node *)obj_desc)->type; 191 ((struct acpi_namespace_node *)obj_desc)->type;
192
193 /*
194 * Resolve an alias object. The construction of these objects
195 * guarantees that there is only one level of alias indirection;
196 * thus, the attached object is always the aliased namespace node
197 */
198 if (object_type == ACPI_TYPE_LOCAL_ALIAS) {
199 obj_desc =
200 acpi_ns_get_attached_object((struct
201 acpi_namespace_node
202 *)obj_desc);
203 *stack_ptr = obj_desc;
204 object_type =
205 ((struct acpi_namespace_node *)obj_desc)->
206 type;
207 }
190 break; 208 break;
191 209
192 case ACPI_DESC_TYPE_OPERAND: 210 case ACPI_DESC_TYPE_OPERAND:
@@ -198,9 +216,9 @@ acpi_ex_resolve_operands(u16 opcode,
198 /* Check for bad acpi_object_type */ 216 /* Check for bad acpi_object_type */
199 217
200 if (!acpi_ut_valid_object_type(object_type)) { 218 if (!acpi_ut_valid_object_type(object_type)) {
201 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 219 ACPI_ERROR((AE_INFO,
202 "Bad operand object type [%X]\n", 220 "Bad operand object type [%X]",
203 object_type)); 221 object_type));
204 222
205 return_ACPI_STATUS(AE_AML_OPERAND_TYPE); 223 return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
206 } 224 }
@@ -238,13 +256,10 @@ acpi_ex_resolve_operands(u16 opcode,
238 break; 256 break;
239 257
240 default: 258 default:
241 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 259 ACPI_ERROR((AE_INFO,
242 "Operand is a Reference, Unknown Reference Opcode %X [%s]\n", 260 "Operand is a Reference, Unknown Reference Opcode: %X",
243 obj_desc->reference. 261 obj_desc->reference.
244 opcode, 262 opcode));
245 (acpi_ps_get_opcode_info
246 (obj_desc->reference.
247 opcode))->name));
248 263
249 return_ACPI_STATUS(AE_AML_OPERAND_TYPE); 264 return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
250 } 265 }
@@ -255,11 +270,10 @@ acpi_ex_resolve_operands(u16 opcode,
255 270
256 /* Invalid descriptor */ 271 /* Invalid descriptor */
257 272
258 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 273 ACPI_ERROR((AE_INFO,
259 "Invalid descriptor %p [%s]\n", 274 "Invalid descriptor %p [%s]",
260 obj_desc, 275 obj_desc,
261 acpi_ut_get_descriptor_name 276 acpi_ut_get_descriptor_name(obj_desc)));
262 (obj_desc)));
263 277
264 return_ACPI_STATUS(AE_AML_OPERAND_TYPE); 278 return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
265 } 279 }
@@ -417,11 +431,10 @@ acpi_ex_resolve_operands(u16 opcode,
417 acpi_ex_convert_to_integer(obj_desc, stack_ptr, 16); 431 acpi_ex_convert_to_integer(obj_desc, stack_ptr, 16);
418 if (ACPI_FAILURE(status)) { 432 if (ACPI_FAILURE(status)) {
419 if (status == AE_TYPE) { 433 if (status == AE_TYPE) {
420 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 434 ACPI_ERROR((AE_INFO,
421 "Needed [Integer/String/Buffer], found [%s] %p\n", 435 "Needed [Integer/String/Buffer], found [%s] %p",
422 acpi_ut_get_object_type_name 436 acpi_ut_get_object_type_name
423 (obj_desc), 437 (obj_desc), obj_desc));
424 obj_desc));
425 438
426 return_ACPI_STATUS(AE_AML_OPERAND_TYPE); 439 return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
427 } 440 }
@@ -444,11 +457,10 @@ acpi_ex_resolve_operands(u16 opcode,
444 status = acpi_ex_convert_to_buffer(obj_desc, stack_ptr); 457 status = acpi_ex_convert_to_buffer(obj_desc, stack_ptr);
445 if (ACPI_FAILURE(status)) { 458 if (ACPI_FAILURE(status)) {
446 if (status == AE_TYPE) { 459 if (status == AE_TYPE) {
447 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 460 ACPI_ERROR((AE_INFO,
448 "Needed [Integer/String/Buffer], found [%s] %p\n", 461 "Needed [Integer/String/Buffer], found [%s] %p",
449 acpi_ut_get_object_type_name 462 acpi_ut_get_object_type_name
450 (obj_desc), 463 (obj_desc), obj_desc));
451 obj_desc));
452 464
453 return_ACPI_STATUS(AE_AML_OPERAND_TYPE); 465 return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
454 } 466 }
@@ -472,11 +484,10 @@ acpi_ex_resolve_operands(u16 opcode,
472 ACPI_IMPLICIT_CONVERT_HEX); 484 ACPI_IMPLICIT_CONVERT_HEX);
473 if (ACPI_FAILURE(status)) { 485 if (ACPI_FAILURE(status)) {
474 if (status == AE_TYPE) { 486 if (status == AE_TYPE) {
475 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 487 ACPI_ERROR((AE_INFO,
476 "Needed [Integer/String/Buffer], found [%s] %p\n", 488 "Needed [Integer/String/Buffer], found [%s] %p",
477 acpi_ut_get_object_type_name 489 acpi_ut_get_object_type_name
478 (obj_desc), 490 (obj_desc), obj_desc));
479 obj_desc));
480 491
481 return_ACPI_STATUS(AE_AML_OPERAND_TYPE); 492 return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
482 } 493 }
@@ -502,10 +513,10 @@ acpi_ex_resolve_operands(u16 opcode,
502 break; 513 break;
503 514
504 default: 515 default:
505 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 516 ACPI_ERROR((AE_INFO,
506 "Needed [Integer/String/Buffer], found [%s] %p\n", 517 "Needed [Integer/String/Buffer], found [%s] %p",
507 acpi_ut_get_object_type_name 518 acpi_ut_get_object_type_name
508 (obj_desc), obj_desc)); 519 (obj_desc), obj_desc));
509 520
510 return_ACPI_STATUS(AE_AML_OPERAND_TYPE); 521 return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
511 } 522 }
@@ -539,10 +550,10 @@ acpi_ex_resolve_operands(u16 opcode,
539 break; 550 break;
540 551
541 default: 552 default:
542 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 553 ACPI_ERROR((AE_INFO,
543 "Needed [Integer/String/Buffer], found [%s] %p\n", 554 "Needed [Integer/String/Buffer], found [%s] %p",
544 acpi_ut_get_object_type_name 555 acpi_ut_get_object_type_name
545 (obj_desc), obj_desc)); 556 (obj_desc), obj_desc));
546 557
547 return_ACPI_STATUS(AE_AML_OPERAND_TYPE); 558 return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
548 } 559 }
@@ -566,10 +577,10 @@ acpi_ex_resolve_operands(u16 opcode,
566 break; 577 break;
567 578
568 default: 579 default:
569 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 580 ACPI_ERROR((AE_INFO,
570 "Needed [Buffer/String/Package/Reference], found [%s] %p\n", 581 "Needed [Buffer/String/Package/Reference], found [%s] %p",
571 acpi_ut_get_object_type_name 582 acpi_ut_get_object_type_name
572 (obj_desc), obj_desc)); 583 (obj_desc), obj_desc));
573 584
574 return_ACPI_STATUS(AE_AML_OPERAND_TYPE); 585 return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
575 } 586 }
@@ -588,10 +599,10 @@ acpi_ex_resolve_operands(u16 opcode,
588 break; 599 break;
589 600
590 default: 601 default:
591 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 602 ACPI_ERROR((AE_INFO,
592 "Needed [Buffer/String/Package], found [%s] %p\n", 603 "Needed [Buffer/String/Package], found [%s] %p",
593 acpi_ut_get_object_type_name 604 acpi_ut_get_object_type_name
594 (obj_desc), obj_desc)); 605 (obj_desc), obj_desc));
595 606
596 return_ACPI_STATUS(AE_AML_OPERAND_TYPE); 607 return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
597 } 608 }
@@ -611,10 +622,10 @@ acpi_ex_resolve_operands(u16 opcode,
611 break; 622 break;
612 623
613 default: 624 default:
614 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 625 ACPI_ERROR((AE_INFO,
615 "Needed [Region/region_field], found [%s] %p\n", 626 "Needed [Region/region_field], found [%s] %p",
616 acpi_ut_get_object_type_name 627 acpi_ut_get_object_type_name
617 (obj_desc), obj_desc)); 628 (obj_desc), obj_desc));
618 629
619 return_ACPI_STATUS(AE_AML_OPERAND_TYPE); 630 return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
620 } 631 }
@@ -656,10 +667,10 @@ acpi_ex_resolve_operands(u16 opcode,
656 break; 667 break;
657 } 668 }
658 669
659 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 670 ACPI_ERROR((AE_INFO,
660 "Needed Integer/Buffer/String/Package/Ref/Ddb], found [%s] %p\n", 671 "Needed Integer/Buffer/String/Package/Ref/Ddb], found [%s] %p",
661 acpi_ut_get_object_type_name 672 acpi_ut_get_object_type_name
662 (obj_desc), obj_desc)); 673 (obj_desc), obj_desc));
663 674
664 return_ACPI_STATUS(AE_AML_OPERAND_TYPE); 675 return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
665 } 676 }
@@ -669,9 +680,9 @@ acpi_ex_resolve_operands(u16 opcode,
669 680
670 /* Unknown type */ 681 /* Unknown type */
671 682
672 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 683 ACPI_ERROR((AE_INFO,
673 "Internal - Unknown ARGI (required operand) type %X\n", 684 "Internal - Unknown ARGI (required operand) type %X",
674 this_arg_type)); 685 this_arg_type));
675 686
676 return_ACPI_STATUS(AE_BAD_PARAMETER); 687 return_ACPI_STATUS(AE_BAD_PARAMETER);
677 } 688 }