📄 dbcmds.c
字号:
return; } /* Decode Named object type */ switch (node->type) { case ACPI_TYPE_DEVICE: case ACPI_TYPE_THERMAL: /* Send the notify */ acpi_ev_queue_notify_request (node, value); break; default: acpi_os_printf ("Named object is not a device or a thermal object\n"); break; }}/******************************************************************************* * * FUNCTION: Acpi_db_set_method_data * * PARAMETERS: Type_arg - L for local, A for argument * Index_arg - which one * Value_arg - Value to set. * * RETURN: None * * DESCRIPTION: Set a local or argument for the running control method. * NOTE: only object supported is Number. * ******************************************************************************/voidacpi_db_set_method_data ( NATIVE_CHAR *type_arg, NATIVE_CHAR *index_arg, NATIVE_CHAR *value_arg){ NATIVE_CHAR type; u32 index; u32 value; acpi_walk_state *walk_state; acpi_operand_object *obj_desc; /* Validate Type_arg */ STRUPR (type_arg); type = type_arg[0]; if ((type != 'L') && (type != 'A')) { acpi_os_printf ("Invalid SET operand: %s\n", type_arg); return; } /* Get the index and value */ index = STRTOUL (index_arg, NULL, 16); value = STRTOUL (value_arg, NULL, 16); walk_state = acpi_ds_get_current_walk_state (acpi_gbl_current_walk_list); if (!walk_state) { acpi_os_printf ("There is no method currently executing\n"); return; } /* Create and initialize the new object */ obj_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER); if (!obj_desc) { acpi_os_printf ("Could not create an internal object\n"); return; } obj_desc->integer.value = value; /* Store the new object into the target */ switch (type) { case 'A': /* Set a method argument */ if (index > MTH_NUM_ARGS) { acpi_os_printf ("Arg%d - Invalid argument name\n", index); return; } acpi_ds_store_object_to_local (AML_ARG_OP, index, obj_desc, walk_state); obj_desc = walk_state->arguments[index].object; acpi_os_printf ("Arg%d: ", index); acpi_db_display_internal_object (obj_desc, walk_state); break; case 'L': /* Set a method local */ if (index > MTH_NUM_LOCALS) { acpi_os_printf ("Local%d - Invalid local variable name\n", index); return; } acpi_ds_store_object_to_local (AML_LOCAL_OP, index, obj_desc, walk_state); obj_desc = walk_state->local_variables[index].object; acpi_os_printf ("Local%d: ", index); acpi_db_display_internal_object (obj_desc, walk_state); break; default: break; }}/******************************************************************************* * * FUNCTION: Acpi_db_walk_for_specific_objects * * PARAMETERS: Callback from Walk_namespace * * RETURN: Status * * DESCRIPTION: Display short info about objects in the namespace * ******************************************************************************/acpi_statusacpi_db_walk_for_specific_objects ( acpi_handle obj_handle, u32 nesting_level, void *context, void **return_value){ acpi_operand_object *obj_desc; acpi_status status; u32 buf_size; NATIVE_CHAR buffer[64]; obj_desc = ((acpi_namespace_node *)obj_handle)->object; buf_size = sizeof (buffer) / sizeof (*buffer); /* Get and display the full pathname to this object */ status = acpi_ns_handle_to_pathname (obj_handle, &buf_size, buffer); if (ACPI_FAILURE (status)) { acpi_os_printf ("Could Not get pathname for object %p\n", obj_handle); return (AE_OK); } acpi_os_printf ("%32s", buffer); /* Display short information about the object */ if (obj_desc) { switch (obj_desc->common.type) { case ACPI_TYPE_METHOD: acpi_os_printf (" #Args %d Concurrency %X", obj_desc->method.param_count, obj_desc->method.concurrency); break; case ACPI_TYPE_INTEGER: acpi_os_printf (" Value %X", obj_desc->integer.value); break; case ACPI_TYPE_STRING: acpi_os_printf (" \"%s\"", obj_desc->string.pointer); break; case ACPI_TYPE_REGION: acpi_os_printf (" Space_id %X Address %X Length %X", obj_desc->region.space_id, obj_desc->region.address, obj_desc->region.length); break; case ACPI_TYPE_PACKAGE: acpi_os_printf (" #Elements %X", obj_desc->package.count); break; case ACPI_TYPE_BUFFER: acpi_os_printf (" Length %X", obj_desc->buffer.length); break; } } acpi_os_printf ("\n"); return (AE_OK);}/******************************************************************************* * * FUNCTION: Acpi_db_display_objects * * PARAMETERS: Obj_type_arg - Type of object to display * Display_count_arg - Max depth to display * * RETURN: None * * DESCRIPTION: Display objects in the namespace of the requested type * ******************************************************************************/acpi_statusacpi_db_display_objects ( NATIVE_CHAR *obj_type_arg, NATIVE_CHAR *display_count_arg){ acpi_object_type8 type; /* Get the object type */ type = acpi_db_match_argument (obj_type_arg, acpi_db_object_types); if (type == ACPI_TYPE_NOT_FOUND) { acpi_os_printf ("Invalid or unsupported argument\n"); return (AE_OK); } acpi_db_set_output_destination (DB_DUPLICATE_OUTPUT); acpi_os_printf ("Objects of type [%s] defined in the current ACPI Namespace: \n", acpi_ut_get_type_name (type)); acpi_db_set_output_destination (DB_REDIRECTABLE_OUTPUT); /* Walk the namespace from the root */ acpi_walk_namespace (type, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX, acpi_db_walk_for_specific_objects, (void *) &type, NULL); acpi_db_set_output_destination (DB_CONSOLE_OUTPUT); return (AE_OK);}/******************************************************************************* * * FUNCTION: Acpi_db_walk_and_match_name * * PARAMETERS: Callback from Walk_namespace * * RETURN: Status * * DESCRIPTION: Find a particular name/names within the namespace. Wildcards * are supported -- '?' matches any character. * ******************************************************************************/acpi_statusacpi_db_walk_and_match_name ( acpi_handle obj_handle, u32 nesting_level, void *context, void **return_value){ acpi_status status; NATIVE_CHAR *requested_name = (NATIVE_CHAR *) context; u32 i; u32 buf_size; NATIVE_CHAR buffer[96]; /* Check for a name match */ for (i = 0; i < 4; i++) { /* Wildcard support */ if ((requested_name[i] != '?') && (requested_name[i] != ((NATIVE_CHAR *) (&((acpi_namespace_node *) obj_handle)->name))[i])) { /* No match, just exit */ return (AE_OK); } } /* Get the full pathname to this object */ buf_size = sizeof (buffer) / sizeof (*buffer); status = acpi_ns_handle_to_pathname (obj_handle, &buf_size, buffer); if (ACPI_FAILURE (status)) { acpi_os_printf ("Could Not get pathname for object %p\n", obj_handle); } else { acpi_os_printf ("%32s (%p) - %s\n", buffer, obj_handle, acpi_ut_get_type_name (((acpi_namespace_node *) obj_handle)->type)); } return (AE_OK);}/******************************************************************************* * * FUNCTION: Acpi_db_find_name_in_namespace * * PARAMETERS: Name_arg - The 4-character ACPI name to find. * wildcards are supported. * * RETURN: None * * DESCRIPTION: Search the namespace for a given name (with wildcards) * ******************************************************************************/acpi_statusacpi_db_find_name_in_namespace ( NATIVE_CHAR *name_arg){ if (STRLEN (name_arg) > 4) { acpi_os_printf ("Name must be no longer than 4 characters\n"); return (AE_OK); } /* Walk the namespace from the root */ acpi_walk_namespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX, acpi_db_walk_and_match_name, name_arg, NULL); acpi_db_set_output_destination (DB_CONSOLE_OUTPUT); return (AE_OK);}/******************************************************************************* * * FUNCTION: Acpi_db_set_scope * * PARAMETERS: Name - New scope path * * RETURN: Status * * DESCRIPTION: Set the "current scope" as maintained by this utility. * The scope is used as a prefix to ACPI paths. * ******************************************************************************/voidacpi_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);}/******************************************************************************* * * FUNCTION: Acpi_db_display_resources * * PARAMETERS: Object_arg - String with hex value of the object * * RETURN: None * * DESCRIPTION: * ******************************************************************************/voidacpi_db_display_resources ( NATIVE_CHAR *object_arg){#ifndef _IA16 acpi_operand_object *obj_desc; acpi_status status; acpi_buffer return_obj; acpi_db_set_output_destination (DB_REDIRECTABLE_OUTPUT); /* Convert string to object pointer */ obj_desc = (acpi_operand_object *) STRTOUL (object_arg, NULL, 16); /* Prepare for a return object of arbitrary size */ return_obj.pointer = acpi_gbl_db_buffer; return_obj.length = ACPI_DEBUG_BUFFER_SIZE; /* _PRT */ acpi_os_printf ("Evaluating _PRT\n"); status = acpi_evaluate_object (obj_desc, "_PRT", NULL, &return_obj); if (ACPI_FAILURE (status)) { acpi_os_printf ("Could not obtain _PRT: %s\n", acpi_format_exception (status)); goto get_crs; } return_obj.pointer = acpi_gbl_db_buffer; return_obj.length = ACPI_DEBUG_BUFFER_SIZE; status = acpi_get_irq_routing_table (obj_desc, &return_obj); if (ACPI_FAILURE (status)) { acpi_os_printf ("Get_irq_routing_table failed: %s\n", acpi_format_exception (status)); } else { acpi_rs_dump_irq_list ((u8 *) acpi_gbl_db_buffer); } /* _CRS */get_crs: acpi_os_printf ("Evaluating _CRS\n"); return_obj.pointer = acpi_gbl_db_buffer; return_obj.length = ACPI_DEBUG_BUFFER_SIZE; status = acpi_evaluate_object (obj_desc, "_CRS", NULL, &return_obj); if (ACPI_FAILURE (status)) { acpi_os_printf ("Could not obtain _CRS: %s\n", acpi_format_exception (status)); goto get_prs; } return_obj.pointer = acpi_gbl_db_buffer; return_obj.length = ACPI_DEBUG_BUFFER_SIZE; status = acpi_get_current_resources (obj_desc, &return_obj); if (ACPI_FAILURE (status)) { acpi_os_printf ("Acpi_get_current_resources failed: %s\n", acpi_format_exception (status)); } else { acpi_rs_dump_resource_list ((acpi_resource *) acpi_gbl_db_buffer); } /* _PRS */get_prs: acpi_os_printf ("Evaluating _PRS\n"); return_obj.pointer = acpi_gbl_db_buffer; return_obj.length = ACPI_DEBUG_BUFFER_SIZE; status = acpi_evaluate_object (obj_desc, "_PRS", NULL, &return_obj); if (ACPI_FAILURE (status)) { acpi_os_printf ("Could not obtain _PRS: %s\n", acpi_format_exception (status)); goto cleanup; } return_obj.pointer = acpi_gbl_db_buffer; return_obj.length = ACPI_DEBUG_BUFFER_SIZE; status = acpi_get_possible_resources (obj_desc, &return_obj); if (ACPI_FAILURE (status)) { acpi_os_printf ("Acpi_get_possible_resources failed: %s\n", acpi_format_exception (status)); } else { acpi_rs_dump_resource_list ((acpi_resource *) acpi_gbl_db_buffer); }cleanup: acpi_db_set_output_destination (DB_CONSOLE_OUTPUT); return;#endif}#endif /* ENABLE_DEBUGGER */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -