aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBob Moore <robert.moore@intel.com>2015-10-18 22:24:58 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2015-10-21 20:01:12 -0400
commita5922a1f738b077c9f341f4bf3c02be436d39687 (patch)
tree9a1d4b4818242ef99dad9752a8f93201b03e2dfa
parentca321d1ca6723ed0e04edd09de49c92b24e3648e (diff)
ACPICA: Improve typechecking, both compile-time and runtime
ACPICA commit 8d0f96e2a11a4ceabb2cae4b41e0ce1f4d3786b9 Adds much stricter typechecking in the iASL compiler, and also adds some additional checking in the interpreter. Link: https://github.com/acpica/acpica/commit/8d0f96e2 Signed-off-by: Bob Moore <robert.moore@intel.com> Signed-off-by: Lv Zheng <lv.zheng@intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r--drivers/acpi/acpica/aclocal.h8
-rw-r--r--drivers/acpi/acpica/acopcode.h4
-rw-r--r--drivers/acpi/acpica/amlcode.h11
-rw-r--r--drivers/acpi/acpica/exconvrt.c1
-rw-r--r--drivers/acpi/acpica/exresolv.c1
-rw-r--r--drivers/acpi/acpica/exresop.c2
-rw-r--r--drivers/acpi/acpica/exstore.c120
-rw-r--r--drivers/acpi/acpica/exstoren.c5
-rw-r--r--drivers/acpi/acpica/nspredef.c2
-rw-r--r--drivers/acpi/acpica/utdecode.c19
-rw-r--r--include/acpi/acexcep.h7
11 files changed, 134 insertions, 46 deletions
diff --git a/drivers/acpi/acpica/aclocal.h b/drivers/acpi/acpica/aclocal.h
index 918f70d15fda..4e41b43ebad3 100644
--- a/drivers/acpi/acpica/aclocal.h
+++ b/drivers/acpi/acpica/aclocal.h
@@ -285,13 +285,17 @@ acpi_status(*acpi_internal_method) (struct acpi_walk_state * walk_state);
285#define ACPI_BTYPE_BUFFER_FIELD 0x00002000 285#define ACPI_BTYPE_BUFFER_FIELD 0x00002000
286#define ACPI_BTYPE_DDB_HANDLE 0x00004000 286#define ACPI_BTYPE_DDB_HANDLE 0x00004000
287#define ACPI_BTYPE_DEBUG_OBJECT 0x00008000 287#define ACPI_BTYPE_DEBUG_OBJECT 0x00008000
288#define ACPI_BTYPE_REFERENCE 0x00010000 288#define ACPI_BTYPE_REFERENCE_OBJECT 0x00010000 /* From Index(), ref_of(), etc (type6_opcodes) */
289#define ACPI_BTYPE_RESOURCE 0x00020000 289#define ACPI_BTYPE_RESOURCE 0x00020000
290#define ACPI_BTYPE_NAMED_REFERENCE 0x00040000 /* Generic unresolved Name or Namepath */
290 291
291#define ACPI_BTYPE_COMPUTE_DATA (ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING | ACPI_BTYPE_BUFFER) 292#define ACPI_BTYPE_COMPUTE_DATA (ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING | ACPI_BTYPE_BUFFER)
292 293
293#define ACPI_BTYPE_DATA (ACPI_BTYPE_COMPUTE_DATA | ACPI_BTYPE_PACKAGE) 294#define ACPI_BTYPE_DATA (ACPI_BTYPE_COMPUTE_DATA | ACPI_BTYPE_PACKAGE)
294#define ACPI_BTYPE_DATA_REFERENCE (ACPI_BTYPE_DATA | ACPI_BTYPE_REFERENCE | ACPI_BTYPE_DDB_HANDLE) 295
296 /* Used by Copy, de_ref_of, Store, Printf, Fprintf */
297
298#define ACPI_BTYPE_DATA_REFERENCE (ACPI_BTYPE_DATA | ACPI_BTYPE_REFERENCE_OBJECT | ACPI_BTYPE_DDB_HANDLE)
295#define ACPI_BTYPE_DEVICE_OBJECTS (ACPI_BTYPE_DEVICE | ACPI_BTYPE_THERMAL | ACPI_BTYPE_PROCESSOR) 299#define ACPI_BTYPE_DEVICE_OBJECTS (ACPI_BTYPE_DEVICE | ACPI_BTYPE_THERMAL | ACPI_BTYPE_PROCESSOR)
296#define ACPI_BTYPE_OBJECTS_AND_REFS 0x0001FFFF /* ARG or LOCAL */ 300#define ACPI_BTYPE_OBJECTS_AND_REFS 0x0001FFFF /* ARG or LOCAL */
297#define ACPI_BTYPE_ALL_OBJECTS 0x0000FFFF 301#define ACPI_BTYPE_ALL_OBJECTS 0x0000FFFF
diff --git a/drivers/acpi/acpica/acopcode.h b/drivers/acpi/acpica/acopcode.h
index fd85ad05a24a..f9acf92fa0bc 100644
--- a/drivers/acpi/acpica/acopcode.h
+++ b/drivers/acpi/acpica/acopcode.h
@@ -211,7 +211,7 @@
211#define ARGI_ARG4 ARG_NONE 211#define ARGI_ARG4 ARG_NONE
212#define ARGI_ARG5 ARG_NONE 212#define ARGI_ARG5 ARG_NONE
213#define ARGI_ARG6 ARG_NONE 213#define ARGI_ARG6 ARG_NONE
214#define ARGI_BANK_FIELD_OP ARGI_INVALID_OPCODE 214#define ARGI_BANK_FIELD_OP ARGI_LIST1 (ARGI_INTEGER)
215#define ARGI_BIT_AND_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF) 215#define ARGI_BIT_AND_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
216#define ARGI_BIT_NAND_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF) 216#define ARGI_BIT_NAND_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
217#define ARGI_BIT_NOR_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF) 217#define ARGI_BIT_NOR_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
@@ -307,7 +307,7 @@
307#define ARGI_SLEEP_OP ARGI_LIST1 (ARGI_INTEGER) 307#define ARGI_SLEEP_OP ARGI_LIST1 (ARGI_INTEGER)
308#define ARGI_STALL_OP ARGI_LIST1 (ARGI_INTEGER) 308#define ARGI_STALL_OP ARGI_LIST1 (ARGI_INTEGER)
309#define ARGI_STATICSTRING_OP ARGI_INVALID_OPCODE 309#define ARGI_STATICSTRING_OP ARGI_INVALID_OPCODE
310#define ARGI_STORE_OP ARGI_LIST2 (ARGI_DATAREFOBJ, ARGI_TARGETREF) 310#define ARGI_STORE_OP ARGI_LIST2 (ARGI_DATAREFOBJ, ARGI_STORE_TARGET)
311#define ARGI_STRING_OP ARGI_INVALID_OPCODE 311#define ARGI_STRING_OP ARGI_INVALID_OPCODE
312#define ARGI_SUBTRACT_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF) 312#define ARGI_SUBTRACT_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
313#define ARGI_THERMAL_ZONE_OP ARGI_INVALID_OPCODE 313#define ARGI_THERMAL_ZONE_OP ARGI_INVALID_OPCODE
diff --git a/drivers/acpi/acpica/amlcode.h b/drivers/acpi/acpica/amlcode.h
index be9fd009cb28..883f20cfa698 100644
--- a/drivers/acpi/acpica/amlcode.h
+++ b/drivers/acpi/acpica/amlcode.h
@@ -277,14 +277,15 @@
277#define ARGI_TARGETREF 0x0F /* Target, subject to implicit conversion */ 277#define ARGI_TARGETREF 0x0F /* Target, subject to implicit conversion */
278#define ARGI_FIXED_TARGET 0x10 /* Target, no implicit conversion */ 278#define ARGI_FIXED_TARGET 0x10 /* Target, no implicit conversion */
279#define ARGI_SIMPLE_TARGET 0x11 /* Name, Local, Arg -- no implicit conversion */ 279#define ARGI_SIMPLE_TARGET 0x11 /* Name, Local, Arg -- no implicit conversion */
280#define ARGI_STORE_TARGET 0x12 /* Target for store is TARGETREF + package objects */
280 281
281/* Multiple/complex types */ 282/* Multiple/complex types */
282 283
283#define ARGI_DATAOBJECT 0x12 /* Buffer, String, package or reference to a node - Used only by size_of operator */ 284#define ARGI_DATAOBJECT 0x13 /* Buffer, String, package or reference to a node - Used only by size_of operator */
284#define ARGI_COMPLEXOBJ 0x13 /* Buffer, String, or package (Used by INDEX op only) */ 285#define ARGI_COMPLEXOBJ 0x14 /* Buffer, String, or package (Used by INDEX op only) */
285#define ARGI_REF_OR_STRING 0x14 /* Reference or String (Used by DEREFOF op only) */ 286#define ARGI_REF_OR_STRING 0x15 /* Reference or String (Used by DEREFOF op only) */
286#define ARGI_REGION_OR_BUFFER 0x15 /* Used by LOAD op only */ 287#define ARGI_REGION_OR_BUFFER 0x16 /* Used by LOAD op only */
287#define ARGI_DATAREFOBJ 0x16 288#define ARGI_DATAREFOBJ 0x17
288 289
289/* Note: types above can expand to 0x1F maximum */ 290/* Note: types above can expand to 0x1F maximum */
290 291
diff --git a/drivers/acpi/acpica/exconvrt.c b/drivers/acpi/acpica/exconvrt.c
index 075d654c837f..1e4c5b6dc0b0 100644
--- a/drivers/acpi/acpica/exconvrt.c
+++ b/drivers/acpi/acpica/exconvrt.c
@@ -618,6 +618,7 @@ acpi_ex_convert_to_target_type(acpi_object_type destination_type,
618 break; 618 break;
619 619
620 case ARGI_TARGETREF: 620 case ARGI_TARGETREF:
621 case ARGI_STORE_TARGET:
621 622
622 switch (destination_type) { 623 switch (destination_type) {
623 case ACPI_TYPE_INTEGER: 624 case ACPI_TYPE_INTEGER:
diff --git a/drivers/acpi/acpica/exresolv.c b/drivers/acpi/acpica/exresolv.c
index 7b109128b035..a1afe1a1e7c2 100644
--- a/drivers/acpi/acpica/exresolv.c
+++ b/drivers/acpi/acpica/exresolv.c
@@ -209,7 +209,6 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr,
209 * (i.e., dereference the package index) 209 * (i.e., dereference the package index)
210 * Delete the ref object, increment the returned object 210 * Delete the ref object, increment the returned object
211 */ 211 */
212 acpi_ut_remove_reference(stack_desc);
213 acpi_ut_add_reference(obj_desc); 212 acpi_ut_add_reference(obj_desc);
214 *stack_ptr = obj_desc; 213 *stack_ptr = obj_desc;
215 } else { 214 } else {
diff --git a/drivers/acpi/acpica/exresop.c b/drivers/acpi/acpica/exresop.c
index d2964af9ad4d..424442d50b5e 100644
--- a/drivers/acpi/acpica/exresop.c
+++ b/drivers/acpi/acpica/exresop.c
@@ -307,6 +307,8 @@ acpi_ex_resolve_operands(u16 opcode,
307 case ARGI_TARGETREF: /* Allows implicit conversion rules before store */ 307 case ARGI_TARGETREF: /* Allows implicit conversion rules before store */
308 case ARGI_FIXED_TARGET: /* No implicit conversion before store to target */ 308 case ARGI_FIXED_TARGET: /* No implicit conversion before store to target */
309 case ARGI_SIMPLE_TARGET: /* Name, Local, or arg - no implicit conversion */ 309 case ARGI_SIMPLE_TARGET: /* Name, Local, or arg - no implicit conversion */
310 case ARGI_STORE_TARGET:
311
310 /* 312 /*
311 * Need an operand of type ACPI_TYPE_LOCAL_REFERENCE 313 * Need an operand of type ACPI_TYPE_LOCAL_REFERENCE
312 * A Namespace Node is OK as-is 314 * A Namespace Node is OK as-is
diff --git a/drivers/acpi/acpica/exstore.c b/drivers/acpi/acpica/exstore.c
index a7eee2400ce0..c076e9100d66 100644
--- a/drivers/acpi/acpica/exstore.c
+++ b/drivers/acpi/acpica/exstore.c
@@ -137,7 +137,7 @@ acpi_ex_store(union acpi_operand_object *source_desc,
137 /* Destination is not a Reference object */ 137 /* Destination is not a Reference object */
138 138
139 ACPI_ERROR((AE_INFO, 139 ACPI_ERROR((AE_INFO,
140 "Target is not a Reference or Constant object - %s [%p]", 140 "Target is not a Reference or Constant object - [%s] %p",
141 acpi_ut_get_object_type_name(dest_desc), 141 acpi_ut_get_object_type_name(dest_desc),
142 dest_desc)); 142 dest_desc));
143 143
@@ -189,7 +189,7 @@ acpi_ex_store(union acpi_operand_object *source_desc,
189 * displayed and otherwise has no effect -- see ACPI Specification 189 * displayed and otherwise has no effect -- see ACPI Specification
190 */ 190 */
191 ACPI_DEBUG_PRINT((ACPI_DB_EXEC, 191 ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
192 "**** Write to Debug Object: Object %p %s ****:\n\n", 192 "**** Write to Debug Object: Object %p [%s] ****:\n\n",
193 source_desc, 193 source_desc,
194 acpi_ut_get_object_type_name(source_desc))); 194 acpi_ut_get_object_type_name(source_desc)));
195 195
@@ -341,7 +341,7 @@ acpi_ex_store_object_to_index(union acpi_operand_object *source_desc,
341 /* All other types are invalid */ 341 /* All other types are invalid */
342 342
343 ACPI_ERROR((AE_INFO, 343 ACPI_ERROR((AE_INFO,
344 "Source must be Integer/Buffer/String type, not %s", 344 "Source must be type [Integer/Buffer/String], found [%s]",
345 acpi_ut_get_object_type_name(source_desc))); 345 acpi_ut_get_object_type_name(source_desc)));
346 return_ACPI_STATUS(AE_AML_OPERAND_TYPE); 346 return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
347 } 347 }
@@ -352,8 +352,9 @@ acpi_ex_store_object_to_index(union acpi_operand_object *source_desc,
352 break; 352 break;
353 353
354 default: 354 default:
355 ACPI_ERROR((AE_INFO, "Target is not a Package or BufferField")); 355 ACPI_ERROR((AE_INFO,
356 status = AE_AML_OPERAND_TYPE; 356 "Target is not of type [Package/BufferField]"));
357 status = AE_AML_TARGET_TYPE;
357 break; 358 break;
358 } 359 }
359 360
@@ -373,20 +374,20 @@ acpi_ex_store_object_to_index(union acpi_operand_object *source_desc,
373 * 374 *
374 * DESCRIPTION: Store the object to the named object. 375 * DESCRIPTION: Store the object to the named object.
375 * 376 *
376 * The Assignment of an object to a named object is handled here 377 * The assignment of an object to a named object is handled here.
377 * The value passed in will replace the current value (if any) 378 * The value passed in will replace the current value (if any)
378 * with the input value. 379 * with the input value.
379 * 380 *
380 * When storing into an object the data is converted to the 381 * When storing into an object the data is converted to the
381 * target object type then stored in the object. This means 382 * target object type then stored in the object. This means
382 * that the target object type (for an initialized target) will 383 * that the target object type (for an initialized target) will
383 * not be changed by a store operation. A copy_object can change 384 * not be changed by a store operation. A copy_object can change
384 * the target type, however. 385 * the target type, however.
385 * 386 *
386 * The implicit_conversion flag is set to NO/FALSE only when 387 * The implicit_conversion flag is set to NO/FALSE only when
387 * storing to an arg_x -- as per the rules of the ACPI spec. 388 * storing to an arg_x -- as per the rules of the ACPI spec.
388 * 389 *
389 * Assumes parameters are already validated. 390 * Assumes parameters are already validated.
390 * 391 *
391 ******************************************************************************/ 392 ******************************************************************************/
392 393
@@ -408,11 +409,75 @@ acpi_ex_store_object_to_node(union acpi_operand_object *source_desc,
408 target_type = acpi_ns_get_type(node); 409 target_type = acpi_ns_get_type(node);
409 target_desc = acpi_ns_get_attached_object(node); 410 target_desc = acpi_ns_get_attached_object(node);
410 411
411 ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Storing %p (%s) to node %p (%s)\n", 412 ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Storing %p [%s] to node %p [%s]\n",
412 source_desc, 413 source_desc,
413 acpi_ut_get_object_type_name(source_desc), node, 414 acpi_ut_get_object_type_name(source_desc), node,
414 acpi_ut_get_type_name(target_type))); 415 acpi_ut_get_type_name(target_type)));
415 416
417 /* Only limited target types possible for everything except copy_object */
418
419 if (walk_state->opcode != AML_COPY_OP) {
420 /*
421 * Only copy_object allows all object types to be overwritten. For
422 * target_ref(s), there are restrictions on the object types that
423 * are allowed.
424 *
425 * Allowable operations/typing for Store:
426 *
427 * 1) Simple Store
428 * Integer --> Integer (Named/Local/Arg)
429 * String --> String (Named/Local/Arg)
430 * Buffer --> Buffer (Named/Local/Arg)
431 * Package --> Package (Named/Local/Arg)
432 *
433 * 2) Store with implicit conversion
434 * Integer --> String or Buffer (Named)
435 * String --> Integer or Buffer (Named)
436 * Buffer --> Integer or String (Named)
437 */
438 switch (target_type) {
439 case ACPI_TYPE_PACKAGE:
440 /*
441 * Here, can only store a package to an existing package.
442 * Storing a package to a Local/Arg is OK, and handled
443 * elsewhere.
444 */
445 if (walk_state->opcode == AML_STORE_OP) {
446 if (source_desc->common.type !=
447 ACPI_TYPE_PACKAGE) {
448 ACPI_ERROR((AE_INFO,
449 "Cannot assign type [%s] to [Package] "
450 "(source must be type Pkg)",
451 acpi_ut_get_object_type_name
452 (source_desc)));
453
454 return_ACPI_STATUS(AE_AML_TARGET_TYPE);
455 }
456 break;
457 }
458
459 /* Fallthrough */
460
461 case ACPI_TYPE_DEVICE:
462 case ACPI_TYPE_EVENT:
463 case ACPI_TYPE_MUTEX:
464 case ACPI_TYPE_REGION:
465 case ACPI_TYPE_POWER:
466 case ACPI_TYPE_PROCESSOR:
467 case ACPI_TYPE_THERMAL:
468
469 ACPI_ERROR((AE_INFO,
470 "Target must be [Buffer/Integer/String/Reference], found [%s] (%4.4s)",
471 acpi_ut_get_type_name(node->type),
472 node->name.ascii));
473
474 return_ACPI_STATUS(AE_AML_TARGET_TYPE);
475
476 default:
477 break;
478 }
479 }
480
416 /* 481 /*
417 * Resolve the source object to an actual value 482 * Resolve the source object to an actual value
418 * (If it is a reference object) 483 * (If it is a reference object)
@@ -425,13 +490,13 @@ acpi_ex_store_object_to_node(union acpi_operand_object *source_desc,
425 /* Do the actual store operation */ 490 /* Do the actual store operation */
426 491
427 switch (target_type) { 492 switch (target_type) {
428 case ACPI_TYPE_INTEGER:
429 case ACPI_TYPE_STRING:
430 case ACPI_TYPE_BUFFER:
431 /* 493 /*
432 * The simple data types all support implicit source operand 494 * The simple data types all support implicit source operand
433 * conversion before the store. 495 * conversion before the store.
434 */ 496 */
497 case ACPI_TYPE_INTEGER:
498 case ACPI_TYPE_STRING:
499 case ACPI_TYPE_BUFFER:
435 500
436 if ((walk_state->opcode == AML_COPY_OP) || !implicit_conversion) { 501 if ((walk_state->opcode == AML_COPY_OP) || !implicit_conversion) {
437 /* 502 /*
@@ -467,7 +532,7 @@ acpi_ex_store_object_to_node(union acpi_operand_object *source_desc,
467 new_desc->common.type); 532 new_desc->common.type);
468 533
469 ACPI_DEBUG_PRINT((ACPI_DB_EXEC, 534 ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
470 "Store %s into %s via Convert/Attach\n", 535 "Store type [%s] into [%s] via Convert/Attach\n",
471 acpi_ut_get_object_type_name 536 acpi_ut_get_object_type_name
472 (source_desc), 537 (source_desc),
473 acpi_ut_get_object_type_name 538 acpi_ut_get_object_type_name
@@ -491,15 +556,12 @@ acpi_ex_store_object_to_node(union acpi_operand_object *source_desc,
491 556
492 default: 557 default:
493 /* 558 /*
494 * No conversions for all other types. Directly store a copy of 559 * copy_object operator: No conversions for all other types.
495 * the source object. This is the ACPI spec-defined behavior for 560 * Instead, directly store a copy of the source object.
496 * the copy_object operator.
497 * 561 *
498 * NOTE: For the Store operator, this is a departure from the 562 * This is the ACPI spec-defined behavior for the copy_object
499 * ACPI spec, which states "If conversion is impossible, abort 563 * operator. (Note, for this default case, all normal
500 * the running control method". Instead, this code implements 564 * Store/Target operations exited above with an error).
501 * "If conversion is impossible, treat the Store operation as
502 * a CopyObject".
503 */ 565 */
504 status = acpi_ex_store_direct_to_node(source_desc, node, 566 status = acpi_ex_store_direct_to_node(source_desc, node,
505 walk_state); 567 walk_state);
diff --git a/drivers/acpi/acpica/exstoren.c b/drivers/acpi/acpica/exstoren.c
index 3101607b4efe..d1841defa669 100644
--- a/drivers/acpi/acpica/exstoren.c
+++ b/drivers/acpi/acpica/exstoren.c
@@ -122,9 +122,10 @@ acpi_ex_resolve_object(union acpi_operand_object **source_desc_ptr,
122 /* Conversion successful but still not a valid type */ 122 /* Conversion successful but still not a valid type */
123 123
124 ACPI_ERROR((AE_INFO, 124 ACPI_ERROR((AE_INFO,
125 "Cannot assign type %s to %s (must be type Int/Str/Buf)", 125 "Cannot assign type [%s] to [%s] (must be type Int/Str/Buf)",
126 acpi_ut_get_object_type_name(source_desc), 126 acpi_ut_get_object_type_name(source_desc),
127 acpi_ut_get_type_name(target_type))); 127 acpi_ut_get_type_name(target_type)));
128
128 status = AE_AML_OPERAND_TYPE; 129 status = AE_AML_OPERAND_TYPE;
129 } 130 }
130 break; 131 break;
@@ -275,7 +276,7 @@ acpi_ex_store_object_to_object(union acpi_operand_object *source_desc,
275 /* 276 /*
276 * All other types come here. 277 * All other types come here.
277 */ 278 */
278 ACPI_WARNING((AE_INFO, "Store into type %s not implemented", 279 ACPI_WARNING((AE_INFO, "Store into type [%s] not implemented",
279 acpi_ut_get_object_type_name(dest_desc))); 280 acpi_ut_get_object_type_name(dest_desc)));
280 281
281 status = AE_NOT_IMPLEMENTED; 282 status = AE_NOT_IMPLEMENTED;
diff --git a/drivers/acpi/acpica/nspredef.c b/drivers/acpi/acpica/nspredef.c
index 0eb54315b4be..0c20980bbcf3 100644
--- a/drivers/acpi/acpica/nspredef.c
+++ b/drivers/acpi/acpica/nspredef.c
@@ -226,7 +226,7 @@ acpi_ns_check_object_type(struct acpi_evaluate_info *info,
226{ 226{
227 union acpi_operand_object *return_object = *return_object_ptr; 227 union acpi_operand_object *return_object = *return_object_ptr;
228 acpi_status status = AE_OK; 228 acpi_status status = AE_OK;
229 char type_buffer[48]; /* Room for 5 types */ 229 char type_buffer[96]; /* Room for 10 types */
230 230
231 /* A Namespace node should not get here, but make sure */ 231 /* A Namespace node should not get here, but make sure */
232 232
diff --git a/drivers/acpi/acpica/utdecode.c b/drivers/acpi/acpica/utdecode.c
index d452a7837c8c..ecaaaffc0788 100644
--- a/drivers/acpi/acpica/utdecode.c
+++ b/drivers/acpi/acpica/utdecode.c
@@ -232,12 +232,27 @@ char *acpi_ut_get_type_name(acpi_object_type type)
232 232
233char *acpi_ut_get_object_type_name(union acpi_operand_object *obj_desc) 233char *acpi_ut_get_object_type_name(union acpi_operand_object *obj_desc)
234{ 234{
235 ACPI_FUNCTION_TRACE(ut_get_object_type_name);
235 236
236 if (!obj_desc) { 237 if (!obj_desc) {
237 return ("[NULL Object Descriptor]"); 238 ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Null Object Descriptor\n"));
239 return_PTR("[NULL Object Descriptor]");
238 } 240 }
239 241
240 return (acpi_ut_get_type_name(obj_desc->common.type)); 242 /* These descriptor types share a common area */
243
244 if ((ACPI_GET_DESCRIPTOR_TYPE(obj_desc) != ACPI_DESC_TYPE_OPERAND) &&
245 (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) != ACPI_DESC_TYPE_NAMED)) {
246 ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
247 "Invalid object descriptor type: 0x%2.2X [%s] (%p)\n",
248 ACPI_GET_DESCRIPTOR_TYPE(obj_desc),
249 acpi_ut_get_descriptor_name(obj_desc),
250 obj_desc));
251
252 return_PTR("Invalid object");
253 }
254
255 return_PTR(acpi_ut_get_type_name(obj_desc->common.type));
241} 256}
242 257
243/******************************************************************************* 258/*******************************************************************************
diff --git a/include/acpi/acexcep.h b/include/acpi/acexcep.h
index 9f20eb4acaa6..204f5819d464 100644
--- a/include/acpi/acexcep.h
+++ b/include/acpi/acexcep.h
@@ -193,8 +193,9 @@ struct acpi_exception_info {
193#define AE_AML_ILLEGAL_ADDRESS EXCEP_AML (0x0020) 193#define AE_AML_ILLEGAL_ADDRESS EXCEP_AML (0x0020)
194#define AE_AML_INFINITE_LOOP EXCEP_AML (0x0021) 194#define AE_AML_INFINITE_LOOP EXCEP_AML (0x0021)
195#define AE_AML_UNINITIALIZED_NODE EXCEP_AML (0x0022) 195#define AE_AML_UNINITIALIZED_NODE EXCEP_AML (0x0022)
196#define AE_AML_TARGET_TYPE EXCEP_AML (0x0023)
196 197
197#define AE_CODE_AML_MAX 0x0022 198#define AE_CODE_AML_MAX 0x0023
198 199
199/* 200/*
200 * Internal exceptions used for control 201 * Internal exceptions used for control
@@ -358,7 +359,9 @@ static const struct acpi_exception_info acpi_gbl_exception_names_aml[] = {
358 EXCEP_TXT("AE_AML_INFINITE_LOOP", 359 EXCEP_TXT("AE_AML_INFINITE_LOOP",
359 "An apparent infinite AML While loop, method was aborted"), 360 "An apparent infinite AML While loop, method was aborted"),
360 EXCEP_TXT("AE_AML_UNINITIALIZED_NODE", 361 EXCEP_TXT("AE_AML_UNINITIALIZED_NODE",
361 "A namespace node is uninitialized or unresolved") 362 "A namespace node is uninitialized or unresolved"),
363 EXCEP_TXT("AE_AML_TARGET_TYPE",
364 "A target operand of an incorrect type was encountered")
362}; 365};
363 366
364static const struct acpi_exception_info acpi_gbl_exception_names_ctrl[] = { 367static const struct acpi_exception_info acpi_gbl_exception_names_ctrl[] = {