forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-01-04 1543e317f1da31b75942316931e8f491a8920811
kernel/drivers/acpi/acpica/dbexec.c
....@@ -86,7 +86,8 @@
8686 *
8787 * RETURN: Status
8888 *
89
- * DESCRIPTION: Execute a control method.
89
+ * DESCRIPTION: Execute a control method. Used to evaluate objects via the
90
+ * "EXECUTE" or "EVALUATE" commands.
9091 *
9192 ******************************************************************************/
9293
....@@ -160,12 +161,12 @@
160161 }
161162
162163 ACPI_EXCEPTION((AE_INFO, status,
163
- "while executing %s from debugger",
164
+ "while executing %s from AML Debugger",
164165 info->pathname));
165166
166167 if (status == AE_BUFFER_OVERFLOW) {
167168 ACPI_ERROR((AE_INFO,
168
- "Possible overflow of internal debugger "
169
+ "Possible buffer overflow within AML Debugger "
169170 "buffer (size 0x%X needed 0x%X)",
170171 ACPI_DEBUG_BUFFER_SIZE,
171172 (u32)return_obj->length));
....@@ -314,11 +315,12 @@
314315
315316 status = acpi_evaluate_object(node, NULL, NULL, &return_obj);
316317
318
+ acpi_gbl_method_executing = FALSE;
319
+
317320 acpi_os_printf("Evaluation of [%4.4s] returned %s\n",
318321 acpi_ut_get_node_name(node),
319322 acpi_format_exception(status));
320323
321
- acpi_gbl_method_executing = FALSE;
322324 return (AE_OK);
323325 }
324326
....@@ -334,7 +336,8 @@
334336 * RETURN: None
335337 *
336338 * DESCRIPTION: Execute a control method. Name is relative to the current
337
- * scope.
339
+ * scope. Function used for the "EXECUTE", "EVALUATE", and
340
+ * "ALL" commands
338341 *
339342 ******************************************************************************/
340343
....@@ -372,6 +375,12 @@
372375 return;
373376 }
374377
378
+ if ((flags & EX_ALL) && (strlen(name) > 4)) {
379
+ acpi_os_printf("Input name (%s) must be a 4-char NameSeg\n",
380
+ name);
381
+ return;
382
+ }
383
+
375384 name_string = ACPI_ALLOCATE(strlen(name) + 1);
376385 if (!name_string) {
377386 return;
....@@ -389,13 +398,24 @@
389398 return;
390399 }
391400
392
- acpi_gbl_db_method_info.name = name_string;
393
- acpi_gbl_db_method_info.args = args;
394
- acpi_gbl_db_method_info.types = types;
395
- acpi_gbl_db_method_info.flags = flags;
401
+ /* Command (ALL <nameseg>) to execute all methods of a particular name */
396402
397
- return_obj.pointer = NULL;
398
- return_obj.length = ACPI_ALLOCATE_BUFFER;
403
+ else if (flags & EX_ALL) {
404
+ acpi_gbl_db_method_info.name = name_string;
405
+ return_obj.pointer = NULL;
406
+ return_obj.length = ACPI_ALLOCATE_BUFFER;
407
+ acpi_db_evaluate_all(name_string);
408
+ ACPI_FREE(name_string);
409
+ return;
410
+ } else {
411
+ acpi_gbl_db_method_info.name = name_string;
412
+ acpi_gbl_db_method_info.args = args;
413
+ acpi_gbl_db_method_info.types = types;
414
+ acpi_gbl_db_method_info.flags = flags;
415
+
416
+ return_obj.pointer = NULL;
417
+ return_obj.length = ACPI_ALLOCATE_BUFFER;
418
+ }
399419
400420 status = acpi_db_execute_setup(&acpi_gbl_db_method_info);
401421 if (ACPI_FAILURE(status)) {
....@@ -450,10 +470,11 @@
450470 (u32)return_obj.length);
451471
452472 acpi_db_dump_external_object(return_obj.pointer, 1);
473
+ acpi_os_printf("\n");
453474
454475 /* Dump a _PLD buffer if present */
455476
456
- if (ACPI_COMPARE_NAME
477
+ if (ACPI_COMPARE_NAMESEG
457478 ((ACPI_CAST_PTR
458479 (struct acpi_namespace_node,
459480 acpi_gbl_db_method_info.method)->name.ascii),