void acpi_db_set_scope ( NATIVE_CHAR *name) { if (!name || name[0] == 0) { acpi_os_printf ("Current scope: %s\n", acpi_gbl_db_scope_buf); return; } acpi_db_prep_namestring (name); /* TBD: [Future] Validate scope here */ if (name[0] == '\\') { STRCPY (acpi_gbl_db_scope_buf, name); STRCAT (acpi_gbl_db_scope_buf, "\\"); } else { STRCAT (acpi_gbl_db_scope_buf, name); STRCAT (acpi_gbl_db_scope_buf, "\\"); } acpi_os_printf ("New scope: %s\n", acpi_gbl_db_scope_buf); }
struct acpi_namespace_node *acpi_db_local_ns_lookup(char *name) { char *internal_path; acpi_status status; struct acpi_namespace_node *node = NULL; acpi_db_prep_namestring(name); /* Build an internal namestring */ status = acpi_ns_internalize_name(name, &internal_path); if (ACPI_FAILURE(status)) { acpi_os_printf("Invalid namestring: %s\n", name); return (NULL); } /* * Lookup the name. * (Uses root node as the search starting point) */ status = acpi_ns_lookup(NULL, internal_path, ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE, NULL, &node); if (ACPI_FAILURE(status)) { acpi_os_printf("Could not locate name: %s, %s\n", name, acpi_format_exception(status)); } ACPI_FREE(internal_path); return (node); }
void acpi_db_execute_setup ( db_method_info *info) { /* Catenate the current scope to the supplied name */ info->pathname[0] = 0; if ((info->name[0] != '\\') && (info->name[0] != '/')) { STRCAT (info->pathname, acpi_gbl_db_scope_buf); } STRCAT (info->pathname, info->name); acpi_db_prep_namestring (info->pathname); acpi_db_set_output_destination (DB_DUPLICATE_OUTPUT); acpi_os_printf ("Executing %s\n", info->pathname); if (info->flags & EX_SINGLE_STEP) { acpi_gbl_cm_single_step = TRUE; acpi_db_set_output_destination (DB_CONSOLE_OUTPUT); } else { /* No single step, allow redirection to a file */ acpi_db_set_output_destination (DB_REDIRECTABLE_OUTPUT); } }
void acpi_db_set_scope(char *name) { acpi_status status; struct acpi_namespace_node *node; if (!name || name[0] == 0) { acpi_os_printf("Current scope: %s\n", acpi_gbl_db_scope_buf); return; } acpi_db_prep_namestring(name); if (ACPI_IS_ROOT_PREFIX(name[0])) { /* Validate new scope from the root */ status = acpi_ns_get_node(acpi_gbl_root_node, name, ACPI_NS_NO_UPSEARCH, &node); if (ACPI_FAILURE(status)) { goto error_exit; } acpi_gbl_db_scope_buf[0] = 0; } else { /* Validate new scope relative to old scope */ status = acpi_ns_get_node(acpi_gbl_db_scope_node, name, ACPI_NS_NO_UPSEARCH, &node); if (ACPI_FAILURE(status)) { goto error_exit; } } /* Build the final pathname */ if (acpi_ut_safe_strcat (acpi_gbl_db_scope_buf, sizeof(acpi_gbl_db_scope_buf), name)) { status = AE_BUFFER_OVERFLOW; goto error_exit; } if (acpi_ut_safe_strcat (acpi_gbl_db_scope_buf, sizeof(acpi_gbl_db_scope_buf), "\\")) { status = AE_BUFFER_OVERFLOW; goto error_exit; } acpi_gbl_db_scope_node = node; acpi_os_printf("New scope: %s\n", acpi_gbl_db_scope_buf); return; error_exit: acpi_os_printf("Could not attach scope: %s, %s\n", name, acpi_format_exception(status)); }
acpi_namespace_node * acpi_db_local_ns_lookup ( NATIVE_CHAR *name) { NATIVE_CHAR *internal_path; acpi_status status; acpi_namespace_node *node = NULL; acpi_db_prep_namestring (name); /* Build an internal namestring */ status = acpi_ns_internalize_name (name, &internal_path); if (ACPI_FAILURE (status)) { acpi_os_printf ("Invalid namestring: %s\n", name); return (NULL); } /* Lookup the name */ /* TBD: [Investigate] what scope do we use? */ /* Use the root scope for the start of the search */ status = acpi_ns_lookup (NULL, internal_path, ACPI_TYPE_ANY, IMODE_EXECUTE, NS_NO_UPSEARCH | NS_DONT_OPEN_SCOPE, NULL, &node); if (ACPI_FAILURE (status)) { acpi_os_printf ("Could not locate name: %s %s\n", name, acpi_format_exception (status)); } ACPI_MEM_FREE (internal_path); return (node); }