hc
2024-01-03 2f7c68cb55ecb7331f2381deb497c27155f32faf
kernel/drivers/acpi/acpica/dbnames.c
....@@ -10,6 +10,7 @@
1010 #include "acnamesp.h"
1111 #include "acdebug.h"
1212 #include "acpredef.h"
13
+#include "acinterp.h"
1314
1415 #define _COMPONENT ACPI_CA_DEBUGGER
1516 ACPI_MODULE_NAME("dbnames")
....@@ -354,7 +355,7 @@
354355 char acpi_name[5] = "____";
355356 char *acpi_name_ptr = acpi_name;
356357
357
- if (strlen(name_arg) > ACPI_NAME_SIZE) {
358
+ if (strlen(name_arg) > ACPI_NAMESEG_SIZE) {
358359 acpi_os_printf("Name must be no longer than 4 characters\n");
359360 return (AE_OK);
360361 }
....@@ -504,6 +505,86 @@
504505
505506 /*******************************************************************************
506507 *
508
+ * FUNCTION: acpi_db_walk_for_fields
509
+ *
510
+ * PARAMETERS: Callback from walk_namespace
511
+ *
512
+ * RETURN: Status
513
+ *
514
+ * DESCRIPTION: Display short info about objects in the namespace
515
+ *
516
+ ******************************************************************************/
517
+
518
+static acpi_status
519
+acpi_db_walk_for_fields(acpi_handle obj_handle,
520
+ u32 nesting_level, void *context, void **return_value)
521
+{
522
+ union acpi_object *ret_value;
523
+ struct acpi_region_walk_info *info =
524
+ (struct acpi_region_walk_info *)context;
525
+ struct acpi_buffer buffer;
526
+ acpi_status status;
527
+ struct acpi_namespace_node *node = acpi_ns_validate_handle(obj_handle);
528
+
529
+ if (!node) {
530
+ return (AE_OK);
531
+ }
532
+ if (node->object->field.region_obj->region.space_id !=
533
+ info->address_space_id) {
534
+ return (AE_OK);
535
+ }
536
+
537
+ info->count++;
538
+
539
+ /* Get and display the full pathname to this object */
540
+
541
+ buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER;
542
+ status = acpi_ns_handle_to_pathname(obj_handle, &buffer, TRUE);
543
+ if (ACPI_FAILURE(status)) {
544
+ acpi_os_printf("Could Not get pathname for object %p\n",
545
+ obj_handle);
546
+ return (AE_OK);
547
+ }
548
+
549
+ acpi_os_printf("%s ", (char *)buffer.pointer);
550
+ ACPI_FREE(buffer.pointer);
551
+
552
+ buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER;
553
+ acpi_evaluate_object(obj_handle, NULL, NULL, &buffer);
554
+
555
+ /*
556
+ * Since this is a field unit, surround the output in braces
557
+ */
558
+ acpi_os_printf("{");
559
+
560
+ ret_value = (union acpi_object *)buffer.pointer;
561
+ switch (ret_value->type) {
562
+ case ACPI_TYPE_INTEGER:
563
+
564
+ acpi_os_printf("%8.8X%8.8X",
565
+ ACPI_FORMAT_UINT64(ret_value->integer.value));
566
+ break;
567
+
568
+ case ACPI_TYPE_BUFFER:
569
+
570
+ acpi_ut_dump_buffer(ret_value->buffer.pointer,
571
+ ret_value->buffer.length,
572
+ DB_DISPLAY_DATA_ONLY | DB_BYTE_DISPLAY, 0);
573
+ break;
574
+
575
+ default:
576
+
577
+ break;
578
+ }
579
+ acpi_os_printf("}\n");
580
+
581
+ ACPI_FREE(buffer.pointer);
582
+
583
+ return (AE_OK);
584
+}
585
+
586
+/*******************************************************************************
587
+ *
507588 * FUNCTION: acpi_db_walk_for_specific_objects
508589 *
509590 * PARAMETERS: Callback from walk_namespace
....@@ -571,6 +652,9 @@
571652 object_info =
572653 ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_object_info));
573654
655
+ if (!object_info)
656
+ return (AE_NO_MEMORY);
657
+
574658 /* Walk the namespace from the root */
575659
576660 (void)acpi_walk_namespace(ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
....@@ -625,6 +709,39 @@
625709 info.count, acpi_ut_get_type_name(type));
626710
627711 acpi_db_set_output_destination(ACPI_DB_CONSOLE_OUTPUT);
712
+ return (AE_OK);
713
+}
714
+
715
+/*******************************************************************************
716
+ *
717
+ * FUNCTION: acpi_db_display_fields
718
+ *
719
+ * PARAMETERS: obj_type_arg - Type of object to display
720
+ * display_count_arg - Max depth to display
721
+ *
722
+ * RETURN: None
723
+ *
724
+ * DESCRIPTION: Display objects in the namespace of the requested type
725
+ *
726
+ ******************************************************************************/
727
+
728
+acpi_status acpi_db_display_fields(u32 address_space_id)
729
+{
730
+ struct acpi_region_walk_info info;
731
+
732
+ info.count = 0;
733
+ info.owner_id = ACPI_OWNER_ID_MAX;
734
+ info.debug_level = ACPI_UINT32_MAX;
735
+ info.display_type = ACPI_DISPLAY_SUMMARY | ACPI_DISPLAY_SHORT;
736
+ info.address_space_id = address_space_id;
737
+
738
+ /* Walk the namespace from the root */
739
+
740
+ (void)acpi_walk_namespace(ACPI_TYPE_LOCAL_REGION_FIELD,
741
+ ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
742
+ acpi_db_walk_for_fields, NULL, (void *)&info,
743
+ NULL);
744
+
628745 return (AE_OK);
629746 }
630747
....@@ -904,7 +1021,7 @@
9041021 *
9051022 * RETURN: None
9061023 *
907
- * DESCRIPTION: Display info about system busses.
1024
+ * DESCRIPTION: Display info about system buses.
9081025 *
9091026 ******************************************************************************/
9101027