Skip to content

Commit db2e11a

Browse files
acpibobrafaeljw
authored andcommitted
ACPICA: Debugger: Add Package support for "test objects" command
This was missing in the initial implementation of "test objects". Signed-off-by: Bob Moore <[email protected]> Signed-off-by: Erik Schmauss <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 4032cc3 commit db2e11a

File tree

1 file changed

+54
-2
lines changed

1 file changed

+54
-2
lines changed

drivers/acpi/acpica/dbtest.c

Lines changed: 54 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ acpi_db_test_buffer_type(struct acpi_namespace_node *node, u32 bit_length);
3030
static acpi_status
3131
acpi_db_test_string_type(struct acpi_namespace_node *node, u32 byte_length);
3232

33+
static acpi_status acpi_db_test_package_type(struct acpi_namespace_node *node);
34+
3335
static acpi_status
3436
acpi_db_read_from_object(struct acpi_namespace_node *node,
3537
acpi_object_type expected_type,
@@ -273,6 +275,11 @@ acpi_db_test_one_object(acpi_handle obj_handle,
273275
bit_length = byte_length * 8;
274276
break;
275277

278+
case ACPI_TYPE_PACKAGE:
279+
280+
local_type = ACPI_TYPE_PACKAGE;
281+
break;
282+
276283
case ACPI_TYPE_FIELD_UNIT:
277284
case ACPI_TYPE_BUFFER_FIELD:
278285
case ACPI_TYPE_LOCAL_REGION_FIELD:
@@ -305,6 +312,7 @@ acpi_db_test_one_object(acpi_handle obj_handle,
305312

306313
acpi_os_printf("%14s: %4.4s",
307314
acpi_ut_get_type_name(node->type), node->name.ascii);
315+
308316
if (!obj_desc) {
309317
acpi_os_printf(" Ignoring, no attached object\n");
310318
return (AE_OK);
@@ -359,26 +367,40 @@ acpi_db_test_one_object(acpi_handle obj_handle,
359367
status = acpi_db_test_buffer_type(node, bit_length);
360368
break;
361369

370+
case ACPI_TYPE_PACKAGE:
371+
372+
status = acpi_db_test_package_type(node);
373+
break;
374+
362375
default:
363376

364377
acpi_os_printf(" Ignoring, type not implemented (%2.2X)",
365378
local_type);
366379
break;
367380
}
368381

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+
369389
switch (node->type) {
370390
case ACPI_TYPE_LOCAL_REGION_FIELD:
371391

372392
region_obj = obj_desc->field.region_obj;
373393
acpi_os_printf(" (%s)",
374394
acpi_ut_get_region_name(region_obj->region.
375395
space_id));
396+
376397
break;
377398

378399
default:
379400
break;
380401
}
381402

403+
exit:
382404
acpi_os_printf("\n");
383405
return (status);
384406
}
@@ -431,7 +453,6 @@ acpi_db_test_integer_type(struct acpi_namespace_node *node, u32 bit_length)
431453
if (temp1->integer.value == value_to_write) {
432454
value_to_write = 0;
433455
}
434-
435456
/* Write a new value */
436457

437458
write_value.type = ACPI_TYPE_INTEGER;
@@ -706,6 +727,35 @@ acpi_db_test_string_type(struct acpi_namespace_node *node, u32 byte_length)
706727
return (status);
707728
}
708729

730+
/*******************************************************************************
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+
742+
static 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+
709759
/*******************************************************************************
710760
*
711761
* FUNCTION: acpi_db_read_from_object
@@ -746,8 +796,8 @@ acpi_db_read_from_object(struct acpi_namespace_node *node,
746796
acpi_gbl_method_executing = TRUE;
747797
status = acpi_evaluate_object(read_handle, NULL,
748798
&param_objects, &return_obj);
749-
acpi_gbl_method_executing = FALSE;
750799

800+
acpi_gbl_method_executing = FALSE;
751801
if (ACPI_FAILURE(status)) {
752802
acpi_os_printf("Could not read from object, %s",
753803
acpi_format_exception(status));
@@ -760,6 +810,7 @@ acpi_db_read_from_object(struct acpi_namespace_node *node,
760810
case ACPI_TYPE_INTEGER:
761811
case ACPI_TYPE_BUFFER:
762812
case ACPI_TYPE_STRING:
813+
case ACPI_TYPE_PACKAGE:
763814
/*
764815
* Did we receive the type we wanted? Most important for the
765816
* 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,
771822
acpi_ut_get_type_name(expected_type),
772823
acpi_ut_get_type_name(ret_value->type));
773824

825+
acpi_os_free(return_obj.pointer);
774826
return (AE_TYPE);
775827
}
776828

0 commit comments

Comments
 (0)