forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-09 95099d4622f8cb224d94e314c7a8e0df60b13f87
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
....@@ -625,6 +706,39 @@
625706 info.count, acpi_ut_get_type_name(type));
626707
627708 acpi_db_set_output_destination(ACPI_DB_CONSOLE_OUTPUT);
709
+ return (AE_OK);
710
+}
711
+
712
+/*******************************************************************************
713
+ *
714
+ * FUNCTION: acpi_db_display_fields
715
+ *
716
+ * PARAMETERS: obj_type_arg - Type of object to display
717
+ * display_count_arg - Max depth to display
718
+ *
719
+ * RETURN: None
720
+ *
721
+ * DESCRIPTION: Display objects in the namespace of the requested type
722
+ *
723
+ ******************************************************************************/
724
+
725
+acpi_status acpi_db_display_fields(u32 address_space_id)
726
+{
727
+ struct acpi_region_walk_info info;
728
+
729
+ info.count = 0;
730
+ info.owner_id = ACPI_OWNER_ID_MAX;
731
+ info.debug_level = ACPI_UINT32_MAX;
732
+ info.display_type = ACPI_DISPLAY_SUMMARY | ACPI_DISPLAY_SHORT;
733
+ info.address_space_id = address_space_id;
734
+
735
+ /* Walk the namespace from the root */
736
+
737
+ (void)acpi_walk_namespace(ACPI_TYPE_LOCAL_REGION_FIELD,
738
+ ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
739
+ acpi_db_walk_for_fields, NULL, (void *)&info,
740
+ NULL);
741
+
628742 return (AE_OK);
629743 }
630744
....@@ -904,7 +1018,7 @@
9041018 *
9051019 * RETURN: None
9061020 *
907
- * DESCRIPTION: Display info about system busses.
1021
+ * DESCRIPTION: Display info about system buses.
9081022 *
9091023 ******************************************************************************/
9101024