aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBob Moore <robert.moore@intel.com>2018-05-08 17:06:12 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2018-05-15 04:16:10 -0400
commitdb2e11a7c2a2aa695d5876e3666dde7267ed516c (patch)
tree9aed734e427a97bbddc10b7dc63e640fd3c6151c
parent4032cc3e516f484f3d846369b901cad40388c391 (diff)
ACPICA: Debugger: Add Package support for "test objects" command
This was missing in the initial implementation of "test objects". Signed-off-by: Bob Moore <robert.moore@intel.com> Signed-off-by: Erik Schmauss <erik.schmauss@intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r--drivers/acpi/acpica/dbtest.c56
1 files changed, 54 insertions, 2 deletions
diff --git a/drivers/acpi/acpica/dbtest.c b/drivers/acpi/acpica/dbtest.c
index 3892680a5258..5536104c23b4 100644
--- a/drivers/acpi/acpica/dbtest.c
+++ b/drivers/acpi/acpica/dbtest.c
@@ -30,6 +30,8 @@ acpi_db_test_buffer_type(struct acpi_namespace_node *node, u32 bit_length);
30static acpi_status 30static acpi_status
31acpi_db_test_string_type(struct acpi_namespace_node *node, u32 byte_length); 31acpi_db_test_string_type(struct acpi_namespace_node *node, u32 byte_length);
32 32
33static acpi_status acpi_db_test_package_type(struct acpi_namespace_node *node);
34
33static acpi_status 35static acpi_status
34acpi_db_read_from_object(struct acpi_namespace_node *node, 36acpi_db_read_from_object(struct acpi_namespace_node *node,
35 acpi_object_type expected_type, 37 acpi_object_type expected_type,
@@ -273,6 +275,11 @@ acpi_db_test_one_object(acpi_handle obj_handle,
273 bit_length = byte_length * 8; 275 bit_length = byte_length * 8;
274 break; 276 break;
275 277
278 case ACPI_TYPE_PACKAGE:
279
280 local_type = ACPI_TYPE_PACKAGE;
281 break;
282
276 case ACPI_TYPE_FIELD_UNIT: 283 case ACPI_TYPE_FIELD_UNIT:
277 case ACPI_TYPE_BUFFER_FIELD: 284 case ACPI_TYPE_BUFFER_FIELD:
278 case ACPI_TYPE_LOCAL_REGION_FIELD: 285 case ACPI_TYPE_LOCAL_REGION_FIELD:
@@ -305,6 +312,7 @@ acpi_db_test_one_object(acpi_handle obj_handle,
305 312
306 acpi_os_printf("%14s: %4.4s", 313 acpi_os_printf("%14s: %4.4s",
307 acpi_ut_get_type_name(node->type), node->name.ascii); 314 acpi_ut_get_type_name(node->type), node->name.ascii);
315
308 if (!obj_desc) { 316 if (!obj_desc) {
309 acpi_os_printf(" Ignoring, no attached object\n"); 317 acpi_os_printf(" Ignoring, no attached object\n");
310 return (AE_OK); 318 return (AE_OK);
@@ -359,6 +367,11 @@ acpi_db_test_one_object(acpi_handle obj_handle,
359 status = acpi_db_test_buffer_type(node, bit_length); 367 status = acpi_db_test_buffer_type(node, bit_length);
360 break; 368 break;
361 369
370 case ACPI_TYPE_PACKAGE:
371
372 status = acpi_db_test_package_type(node);
373 break;
374
362 default: 375 default:
363 376
364 acpi_os_printf(" Ignoring, type not implemented (%2.2X)", 377 acpi_os_printf(" Ignoring, type not implemented (%2.2X)",
@@ -366,6 +379,13 @@ acpi_db_test_one_object(acpi_handle obj_handle,
366 break; 379 break;
367 } 380 }
368 381
382 /* Exit on error, but don't abort the namespace walk */
383
384 if (ACPI_FAILURE(status)) {
385 status = AE_OK;
386 goto exit;
387 }
388
369 switch (node->type) { 389 switch (node->type) {
370 case ACPI_TYPE_LOCAL_REGION_FIELD: 390 case ACPI_TYPE_LOCAL_REGION_FIELD:
371 391
@@ -373,12 +393,14 @@ acpi_db_test_one_object(acpi_handle obj_handle,
373 acpi_os_printf(" (%s)", 393 acpi_os_printf(" (%s)",
374 acpi_ut_get_region_name(region_obj->region. 394 acpi_ut_get_region_name(region_obj->region.
375 space_id)); 395 space_id));
396
376 break; 397 break;
377 398
378 default: 399 default:
379 break; 400 break;
380 } 401 }
381 402
403exit:
382 acpi_os_printf("\n"); 404 acpi_os_printf("\n");
383 return (status); 405 return (status);
384} 406}
@@ -431,7 +453,6 @@ acpi_db_test_integer_type(struct acpi_namespace_node *node, u32 bit_length)
431 if (temp1->integer.value == value_to_write) { 453 if (temp1->integer.value == value_to_write) {
432 value_to_write = 0; 454 value_to_write = 0;
433 } 455 }
434
435 /* Write a new value */ 456 /* Write a new value */
436 457
437 write_value.type = ACPI_TYPE_INTEGER; 458 write_value.type = ACPI_TYPE_INTEGER;
@@ -708,6 +729,35 @@ exit:
708 729
709/******************************************************************************* 730/*******************************************************************************
710 * 731 *
732 * FUNCTION: acpi_db_test_package_type
733 *
734 * PARAMETERS: node - Parent NS node for the object
735 *
736 * RETURN: Status
737 *
738 * DESCRIPTION: Test read for a Package object.
739 *
740 ******************************************************************************/
741
742static acpi_status acpi_db_test_package_type(struct acpi_namespace_node *node)
743{
744 union acpi_object *temp1 = NULL;
745 acpi_status status;
746
747 /* Read the original value */
748
749 status = acpi_db_read_from_object(node, ACPI_TYPE_PACKAGE, &temp1);
750 if (ACPI_FAILURE(status)) {
751 return (status);
752 }
753
754 acpi_os_printf(" %8.8X Elements", temp1->package.count);
755 acpi_os_free(temp1);
756 return (status);
757}
758
759/*******************************************************************************
760 *
711 * FUNCTION: acpi_db_read_from_object 761 * FUNCTION: acpi_db_read_from_object
712 * 762 *
713 * PARAMETERS: node - Parent NS node for the object 763 * PARAMETERS: node - Parent NS node for the object
@@ -746,8 +796,8 @@ acpi_db_read_from_object(struct acpi_namespace_node *node,
746 acpi_gbl_method_executing = TRUE; 796 acpi_gbl_method_executing = TRUE;
747 status = acpi_evaluate_object(read_handle, NULL, 797 status = acpi_evaluate_object(read_handle, NULL,
748 &param_objects, &return_obj); 798 &param_objects, &return_obj);
749 acpi_gbl_method_executing = FALSE;
750 799
800 acpi_gbl_method_executing = FALSE;
751 if (ACPI_FAILURE(status)) { 801 if (ACPI_FAILURE(status)) {
752 acpi_os_printf("Could not read from object, %s", 802 acpi_os_printf("Could not read from object, %s",
753 acpi_format_exception(status)); 803 acpi_format_exception(status));
@@ -760,6 +810,7 @@ acpi_db_read_from_object(struct acpi_namespace_node *node,
760 case ACPI_TYPE_INTEGER: 810 case ACPI_TYPE_INTEGER:
761 case ACPI_TYPE_BUFFER: 811 case ACPI_TYPE_BUFFER:
762 case ACPI_TYPE_STRING: 812 case ACPI_TYPE_STRING:
813 case ACPI_TYPE_PACKAGE:
763 /* 814 /*
764 * Did we receive the type we wanted? Most important for the 815 * Did we receive the type we wanted? Most important for the
765 * Integer/Buffer case (when a field is larger than an Integer, 816 * Integer/Buffer case (when a field is larger than an Integer,
@@ -771,6 +822,7 @@ acpi_db_read_from_object(struct acpi_namespace_node *node,
771 acpi_ut_get_type_name(expected_type), 822 acpi_ut_get_type_name(expected_type),
772 acpi_ut_get_type_name(ret_value->type)); 823 acpi_ut_get_type_name(ret_value->type));
773 824
825 acpi_os_free(return_obj.pointer);
774 return (AE_TYPE); 826 return (AE_TYPE);
775 } 827 }
776 828