aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/acpica/dbexec.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/acpica/dbexec.c')
-rw-r--r--drivers/acpi/acpica/dbexec.c110
1 files changed, 109 insertions, 1 deletions
diff --git a/drivers/acpi/acpica/dbexec.c b/drivers/acpi/acpica/dbexec.c
index 3b30319752f0..ed088fceb18d 100644
--- a/drivers/acpi/acpica/dbexec.c
+++ b/drivers/acpi/acpica/dbexec.c
@@ -67,6 +67,8 @@ static acpi_status
67acpi_db_execution_walk(acpi_handle obj_handle, 67acpi_db_execution_walk(acpi_handle obj_handle,
68 u32 nesting_level, void *context, void **return_value); 68 u32 nesting_level, void *context, void **return_value);
69 69
70static void ACPI_SYSTEM_XFACE acpi_db_single_execution_thread(void *context);
71
70/******************************************************************************* 72/*******************************************************************************
71 * 73 *
72 * FUNCTION: acpi_db_delete_objects 74 * FUNCTION: acpi_db_delete_objects
@@ -229,7 +231,7 @@ static acpi_status acpi_db_execute_setup(struct acpi_db_method_info *info)
229 231
230 ACPI_FUNCTION_NAME(db_execute_setup); 232 ACPI_FUNCTION_NAME(db_execute_setup);
231 233
232 /* Catenate the current scope to the supplied name */ 234 /* Concatenate the current scope to the supplied name */
233 235
234 info->pathname[0] = 0; 236 info->pathname[0] = 0;
235 if ((info->name[0] != '\\') && (info->name[0] != '/')) { 237 if ((info->name[0] != '\\') && (info->name[0] != '/')) {
@@ -611,6 +613,112 @@ static void ACPI_SYSTEM_XFACE acpi_db_method_thread(void *context)
611 613
612/******************************************************************************* 614/*******************************************************************************
613 * 615 *
616 * FUNCTION: acpi_db_single_execution_thread
617 *
618 * PARAMETERS: context - Method info struct
619 *
620 * RETURN: None
621 *
622 * DESCRIPTION: Create one thread and execute a method
623 *
624 ******************************************************************************/
625
626static void ACPI_SYSTEM_XFACE acpi_db_single_execution_thread(void *context)
627{
628 struct acpi_db_method_info *info = context;
629 acpi_status status;
630 struct acpi_buffer return_obj;
631
632 acpi_os_printf("\n");
633
634 status = acpi_db_execute_method(info, &return_obj);
635 if (ACPI_FAILURE(status)) {
636 acpi_os_printf("%s During evaluation of %s\n",
637 acpi_format_exception(status), info->pathname);
638 return;
639 }
640
641 /* Display a return object, if any */
642
643 if (return_obj.length) {
644 acpi_os_printf("Evaluation of %s returned object %p, "
645 "external buffer length %X\n",
646 acpi_gbl_db_method_info.pathname,
647 return_obj.pointer, (u32)return_obj.length);
648
649 acpi_db_dump_external_object(return_obj.pointer, 1);
650 }
651
652 acpi_os_printf("\nBackground thread completed\n%c ",
653 ACPI_DEBUGGER_COMMAND_PROMPT);
654}
655
656/*******************************************************************************
657 *
658 * FUNCTION: acpi_db_create_execution_thread
659 *
660 * PARAMETERS: method_name_arg - Control method to execute
661 * arguments - Array of arguments to the method
662 * types - Corresponding array of object types
663 *
664 * RETURN: None
665 *
666 * DESCRIPTION: Create a single thread to evaluate a namespace object. Handles
667 * arguments passed on command line for control methods.
668 *
669 ******************************************************************************/
670
671void
672acpi_db_create_execution_thread(char *method_name_arg,
673 char **arguments, acpi_object_type *types)
674{
675 acpi_status status;
676 u32 i;
677
678 memset(&acpi_gbl_db_method_info, 0, sizeof(struct acpi_db_method_info));
679 acpi_gbl_db_method_info.name = method_name_arg;
680 acpi_gbl_db_method_info.init_args = 1;
681 acpi_gbl_db_method_info.args = acpi_gbl_db_method_info.arguments;
682 acpi_gbl_db_method_info.types = acpi_gbl_db_method_info.arg_types;
683
684 /* Setup method arguments, up to 7 (0-6) */
685
686 for (i = 0; (i < ACPI_METHOD_NUM_ARGS) && *arguments; i++) {
687 acpi_gbl_db_method_info.arguments[i] = *arguments;
688 arguments++;
689
690 acpi_gbl_db_method_info.arg_types[i] = *types;
691 types++;
692 }
693
694 status = acpi_db_execute_setup(&acpi_gbl_db_method_info);
695 if (ACPI_FAILURE(status)) {
696 return;
697 }
698
699 /* Get the NS node, determines existence also */
700
701 status = acpi_get_handle(NULL, acpi_gbl_db_method_info.pathname,
702 &acpi_gbl_db_method_info.method);
703 if (ACPI_FAILURE(status)) {
704 acpi_os_printf("%s Could not get handle for %s\n",
705 acpi_format_exception(status),
706 acpi_gbl_db_method_info.pathname);
707 return;
708 }
709
710 status = acpi_os_execute(OSL_DEBUGGER_EXEC_THREAD,
711 acpi_db_single_execution_thread,
712 &acpi_gbl_db_method_info);
713 if (ACPI_FAILURE(status)) {
714 return;
715 }
716
717 acpi_os_printf("\nBackground thread started\n");
718}
719
720/*******************************************************************************
721 *
614 * FUNCTION: acpi_db_create_execution_threads 722 * FUNCTION: acpi_db_create_execution_threads
615 * 723 *
616 * PARAMETERS: num_threads_arg - Number of threads to create 724 * PARAMETERS: num_threads_arg - Number of threads to create