forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-01-04 1543e317f1da31b75942316931e8f491a8920811
kernel/drivers/acpi/acpica/dbinput.c
....@@ -37,6 +37,7 @@
3737 enum acpi_ex_debugger_commands {
3838 CMD_NOT_FOUND = 0,
3939 CMD_NULL,
40
+ CMD_ALL,
4041 CMD_ALLOCATIONS,
4142 CMD_ARGS,
4243 CMD_ARGUMENTS,
....@@ -50,6 +51,7 @@
5051 CMD_EVALUATE,
5152 CMD_EXECUTE,
5253 CMD_EXIT,
54
+ CMD_FIELDS,
5355 CMD_FIND,
5456 CMD_GO,
5557 CMD_HANDLERS,
....@@ -114,6 +116,7 @@
114116 static const struct acpi_db_command_info acpi_gbl_db_commands[] = {
115117 {"<NOT FOUND>", 0},
116118 {"<NULL>", 0},
119
+ {"ALL", 1},
117120 {"ALLOCATIONS", 0},
118121 {"ARGS", 0},
119122 {"ARGUMENTS", 0},
....@@ -127,6 +130,7 @@
127130 {"EVALUATE", 1},
128131 {"EXECUTE", 1},
129132 {"EXIT", 0},
133
+ {"FIELDS", 1},
130134 {"FIND", 1},
131135 {"GO", 0},
132136 {"HANDLERS", 0},
....@@ -200,6 +204,8 @@
200204 "Find ACPI name(s) with wildcards\n"},
201205 {1, " Integrity", "Validate namespace integrity\n"},
202206 {1, " Methods", "Display list of loaded control methods\n"},
207
+ {1, " Fields <AddressSpaceId>",
208
+ "Display list of loaded field units by space ID\n"},
203209 {1, " Namespace [Object] [Depth]",
204210 "Display loaded namespace tree/subtree\n"},
205211 {1, " Notify <Object> <Value>", "Send a notification on Object\n"},
....@@ -218,6 +224,7 @@
218224 {1, " Type <Object>", "Display object type\n"},
219225
220226 {0, "\nControl Method Execution:", "\n"},
227
+ {1, " All <NameSeg>", "Evaluate all objects named NameSeg\n"},
221228 {1, " Evaluate <Namepath> [Arguments]",
222229 "Evaluate object or control method\n"},
223230 {1, " Execute <Namepath> [Arguments]", "Synonym for Evaluate\n"},
....@@ -432,7 +439,7 @@
432439 acpi_os_printf("\n");
433440
434441 } else {
435
- /* Display help for all commands that match the subtring */
442
+ /* Display help for all commands that match the substring */
436443
437444 acpi_db_display_command_info(command, TRUE);
438445 }
....@@ -464,16 +471,14 @@
464471 return (NULL);
465472 }
466473
467
- /* Remove any spaces at the beginning */
474
+ /* Remove any spaces at the beginning, ignore blank lines */
468475
469
- if (*string == ' ') {
470
- while (*string && (*string == ' ')) {
471
- string++;
472
- }
476
+ while (*string && isspace(*string)) {
477
+ string++;
478
+ }
473479
474
- if (!(*string)) {
475
- return (NULL);
476
- }
480
+ if (!(*string)) {
481
+ return (NULL);
477482 }
478483
479484 switch (*string) {
....@@ -503,6 +508,21 @@
503508 /* Find end of buffer */
504509
505510 while (*string && (*string != ')')) {
511
+ string++;
512
+ }
513
+ break;
514
+
515
+ case '{':
516
+
517
+ /* This is the start of a field unit, scan until closing brace */
518
+
519
+ string++;
520
+ start = string;
521
+ type = ACPI_TYPE_FIELD_UNIT;
522
+
523
+ /* Find end of buffer */
524
+
525
+ while (*string && (*string != '}')) {
506526 string++;
507527 }
508528 break;
....@@ -551,7 +571,7 @@
551571
552572 /* Find end of token */
553573
554
- while (*string && (*string != ' ')) {
574
+ while (*string && !isspace(*string)) {
555575 string++;
556576 }
557577 break;
....@@ -593,7 +613,7 @@
593613 input_buffer)) {
594614 acpi_os_printf
595615 ("Buffer overflow while parsing input line (max %u characters)\n",
596
- sizeof(acpi_gbl_db_parsed_buf));
616
+ (u32)sizeof(acpi_gbl_db_parsed_buf));
597617 return (0);
598618 }
599619
....@@ -674,6 +694,7 @@
674694 union acpi_parse_object *op)
675695 {
676696 u32 temp;
697
+ u64 temp64;
677698 u32 command_index;
678699 u32 param_count;
679700 char *command_line;
....@@ -689,7 +710,6 @@
689710
690711 param_count = acpi_db_get_line(input_buffer);
691712 command_index = acpi_db_match_command(acpi_gbl_db_args[0]);
692
- temp = 0;
693713
694714 /*
695715 * We don't want to add the !! command to the history buffer. It
....@@ -721,6 +741,15 @@
721741 if (op) {
722742 return (AE_OK);
723743 }
744
+ break;
745
+
746
+ case CMD_ALL:
747
+
748
+ acpi_os_printf("Executing all objects with NameSeg: %s\n",
749
+ acpi_gbl_db_args[1]);
750
+ acpi_db_execute(acpi_gbl_db_args[1], &acpi_gbl_db_args[2],
751
+ &acpi_gbl_db_arg_types[2],
752
+ EX_NO_SINGLE_STEP | EX_ALL);
724753 break;
725754
726755 case CMD_ALLOCATIONS:
....@@ -790,6 +819,21 @@
790819 status = acpi_db_find_name_in_namespace(acpi_gbl_db_args[1]);
791820 break;
792821
822
+ case CMD_FIELDS:
823
+
824
+ status = acpi_ut_strtoul64(acpi_gbl_db_args[1], &temp64);
825
+
826
+ if (ACPI_FAILURE(status)
827
+ || temp64 >= ACPI_NUM_PREDEFINED_REGIONS) {
828
+ acpi_os_printf
829
+ ("Invalid address space ID: must be between 0 and %u inclusive\n",
830
+ ACPI_NUM_PREDEFINED_REGIONS - 1);
831
+ return (AE_OK);
832
+ }
833
+
834
+ status = acpi_db_display_fields((u32)temp64);
835
+ break;
836
+
793837 case CMD_GO:
794838
795839 acpi_gbl_cm_single_step = FALSE;
....@@ -853,24 +897,24 @@
853897
854898 if (param_count == 0) {
855899 acpi_os_printf
856
- ("Current debug level for file output is: %8.8lX\n",
900
+ ("Current debug level for file output is: %8.8X\n",
857901 acpi_gbl_db_debug_level);
858902 acpi_os_printf
859
- ("Current debug level for console output is: %8.8lX\n",
903
+ ("Current debug level for console output is: %8.8X\n",
860904 acpi_gbl_db_console_debug_level);
861905 } else if (param_count == 2) {
862906 temp = acpi_gbl_db_console_debug_level;
863907 acpi_gbl_db_console_debug_level =
864908 strtoul(acpi_gbl_db_args[1], NULL, 16);
865909 acpi_os_printf
866
- ("Debug Level for console output was %8.8lX, now %8.8lX\n",
910
+ ("Debug Level for console output was %8.8X, now %8.8X\n",
867911 temp, acpi_gbl_db_console_debug_level);
868912 } else {
869913 temp = acpi_gbl_db_debug_level;
870914 acpi_gbl_db_debug_level =
871915 strtoul(acpi_gbl_db_args[1], NULL, 16);
872916 acpi_os_printf
873
- ("Debug Level for file output was %8.8lX, now %8.8lX\n",
917
+ ("Debug Level for file output was %8.8X, now %8.8X\n",
874918 temp, acpi_gbl_db_debug_level);
875919 }
876920 break;