// SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0 /******************************************************************************* * * Module Name: dbdisply - debug display commands * ******************************************************************************/ #include <acpi/acpi.h> #include "accommon.h" #include "amlcode.h" #include "acdispat.h" #include "acnamesp.h" #include "acparser.h" #include "acinterp.h" #include "acevents.h" #include "acdebug.h" #define _COMPONENT … ACPI_MODULE_NAME("dbdisply") /* Local prototypes */ static void acpi_db_dump_parser_descriptor(union acpi_parse_object *op); static void *acpi_db_get_pointer(void *target); static acpi_status acpi_db_display_non_root_handlers(acpi_handle obj_handle, u32 nesting_level, void *context, void **return_value); /* * System handler information. * Used for Handlers command, in acpi_db_display_handlers. */ #define ACPI_PREDEFINED_PREFIX … #define ACPI_HANDLER_NAME_STRING … #define ACPI_HANDLER_PRESENT_STRING … #define ACPI_HANDLER_PRESENT_STRING2 … #define ACPI_HANDLER_NOT_PRESENT_STRING … /* All predefined Address Space IDs */ static acpi_adr_space_type acpi_gbl_space_id_list[] = …; /* Global handler information */ acpi_handler_info; static struct acpi_handler_info acpi_gbl_handler_list[] = …; /******************************************************************************* * * FUNCTION: acpi_db_get_pointer * * PARAMETERS: target - Pointer to string to be converted * * RETURN: Converted pointer * * DESCRIPTION: Convert an ascii pointer value to a real value * ******************************************************************************/ static void *acpi_db_get_pointer(void *target) { … } /******************************************************************************* * * FUNCTION: acpi_db_dump_parser_descriptor * * PARAMETERS: op - A parser Op descriptor * * RETURN: None * * DESCRIPTION: Display a formatted parser object * ******************************************************************************/ static void acpi_db_dump_parser_descriptor(union acpi_parse_object *op) { … } /******************************************************************************* * * FUNCTION: acpi_db_decode_and_display_object * * PARAMETERS: target - String with object to be displayed. Names * and hex pointers are supported. * output_type - Byte, Word, Dword, or Qword (B|W|D|Q) * * RETURN: None * * DESCRIPTION: Display a formatted ACPI object * ******************************************************************************/ void acpi_db_decode_and_display_object(char *target, char *output_type) { … } /******************************************************************************* * * FUNCTION: acpi_db_display_method_info * * PARAMETERS: start_op - Root of the control method parse tree * * RETURN: None * * DESCRIPTION: Display information about the current method * ******************************************************************************/ void acpi_db_display_method_info(union acpi_parse_object *start_op) { … } /******************************************************************************* * * FUNCTION: acpi_db_display_locals * * PARAMETERS: None * * RETURN: None * * DESCRIPTION: Display all locals for the currently running control method * ******************************************************************************/ void acpi_db_display_locals(void) { … } /******************************************************************************* * * FUNCTION: acpi_db_display_arguments * * PARAMETERS: None * * RETURN: None * * DESCRIPTION: Display all arguments for the currently running control method * ******************************************************************************/ void acpi_db_display_arguments(void) { … } /******************************************************************************* * * FUNCTION: acpi_db_display_results * * PARAMETERS: None * * RETURN: None * * DESCRIPTION: Display current contents of a method result stack * ******************************************************************************/ void acpi_db_display_results(void) { … } /******************************************************************************* * * FUNCTION: acpi_db_display_calling_tree * * PARAMETERS: None * * RETURN: None * * DESCRIPTION: Display current calling tree of nested control methods * ******************************************************************************/ void acpi_db_display_calling_tree(void) { … } /******************************************************************************* * * FUNCTION: acpi_db_display_object_type * * PARAMETERS: object_arg - User entered NS node handle * * RETURN: None * * DESCRIPTION: Display type of an arbitrary NS node * ******************************************************************************/ void acpi_db_display_object_type(char *object_arg) { … } /******************************************************************************* * * FUNCTION: acpi_db_display_result_object * * PARAMETERS: obj_desc - Object to be displayed * walk_state - Current walk state * * RETURN: None * * DESCRIPTION: Display the result of an AML opcode * * Note: Currently only displays the result object if we are single stepping. * However, this output may be useful in other contexts and could be enabled * to do so if needed. * ******************************************************************************/ void acpi_db_display_result_object(union acpi_operand_object *obj_desc, struct acpi_walk_state *walk_state) { … } /******************************************************************************* * * FUNCTION: acpi_db_display_argument_object * * PARAMETERS: obj_desc - Object to be displayed * walk_state - Current walk state * * RETURN: None * * DESCRIPTION: Display the result of an AML opcode * ******************************************************************************/ void acpi_db_display_argument_object(union acpi_operand_object *obj_desc, struct acpi_walk_state *walk_state) { … } #if (!ACPI_REDUCED_HARDWARE) /******************************************************************************* * * FUNCTION: acpi_db_display_gpes * * PARAMETERS: None * * RETURN: None * * DESCRIPTION: Display the current GPE structures * ******************************************************************************/ void acpi_db_display_gpes(void) { struct acpi_gpe_block_info *gpe_block; struct acpi_gpe_xrupt_info *gpe_xrupt_info; struct acpi_gpe_event_info *gpe_event_info; struct acpi_gpe_register_info *gpe_register_info; char *gpe_type; struct acpi_gpe_notify_info *notify; u32 gpe_index; u32 block = 0; u32 i; u32 j; u32 count; char buffer[80]; struct acpi_buffer ret_buf; acpi_status status; ret_buf.length = sizeof(buffer); ret_buf.pointer = buffer; block = 0; /* Walk the GPE lists */ gpe_xrupt_info = acpi_gbl_gpe_xrupt_list_head; while (gpe_xrupt_info) { gpe_block = gpe_xrupt_info->gpe_block_list_head; while (gpe_block) { status = acpi_get_name(gpe_block->node, ACPI_FULL_PATHNAME_NO_TRAILING, &ret_buf); if (ACPI_FAILURE(status)) { acpi_os_printf ("Could not convert name to pathname\n"); } if (gpe_block->node == acpi_gbl_fadt_gpe_device) { gpe_type = "FADT-defined GPE block"; } else { gpe_type = "GPE Block Device"; } acpi_os_printf ("\nBlock %u - Info %p DeviceNode %p [%s] - %s\n", block, gpe_block, gpe_block->node, buffer, gpe_type); acpi_os_printf(" Registers: %u (%u GPEs)\n", gpe_block->register_count, gpe_block->gpe_count); acpi_os_printf (" GPE range: 0x%X to 0x%X on interrupt %u\n", gpe_block->block_base_number, gpe_block->block_base_number + (gpe_block->gpe_count - 1), gpe_xrupt_info->interrupt_number); acpi_os_printf (" RegisterInfo: %p Status %8.8X%8.8X Enable %8.8X%8.8X\n", gpe_block->register_info, ACPI_FORMAT_UINT64(gpe_block->register_info-> status_address.address), ACPI_FORMAT_UINT64(gpe_block->register_info-> enable_address.address)); acpi_os_printf(" EventInfo: %p\n", gpe_block->event_info); /* Examine each GPE Register within the block */ for (i = 0; i < gpe_block->register_count; i++) { gpe_register_info = &gpe_block->register_info[i]; acpi_os_printf(" Reg %u: (GPE %.2X-%.2X) " "RunEnable %2.2X WakeEnable %2.2X" " Status %8.8X%8.8X Enable %8.8X%8.8X\n", i, gpe_register_info-> base_gpe_number, gpe_register_info-> base_gpe_number + (ACPI_GPE_REGISTER_WIDTH - 1), gpe_register_info-> enable_for_run, gpe_register_info-> enable_for_wake, ACPI_FORMAT_UINT64 (gpe_register_info-> status_address.address), ACPI_FORMAT_UINT64 (gpe_register_info-> enable_address.address)); /* Now look at the individual GPEs in this byte register */ for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++) { gpe_index = (i * ACPI_GPE_REGISTER_WIDTH) + j; gpe_event_info = &gpe_block->event_info[gpe_index]; if (ACPI_GPE_DISPATCH_TYPE (gpe_event_info->flags) == ACPI_GPE_DISPATCH_NONE) { /* This GPE is not used (no method or handler), ignore it */ continue; } acpi_os_printf (" GPE %.2X: %p RunRefs %2.2X Flags %2.2X (", gpe_block->block_base_number + gpe_index, gpe_event_info, gpe_event_info->runtime_count, gpe_event_info->flags); /* Decode the flags byte */ if (gpe_event_info-> flags & ACPI_GPE_LEVEL_TRIGGERED) { acpi_os_printf("Level, "); } else { acpi_os_printf("Edge, "); } if (gpe_event_info-> flags & ACPI_GPE_CAN_WAKE) { acpi_os_printf("CanWake, "); } else { acpi_os_printf("RunOnly, "); } switch (ACPI_GPE_DISPATCH_TYPE (gpe_event_info->flags)) { case ACPI_GPE_DISPATCH_NONE: acpi_os_printf("NotUsed"); break; case ACPI_GPE_DISPATCH_METHOD: acpi_os_printf("Method"); break; case ACPI_GPE_DISPATCH_HANDLER: acpi_os_printf("Handler"); break; case ACPI_GPE_DISPATCH_NOTIFY: count = 0; notify = gpe_event_info->dispatch. notify_list; while (notify) { count++; notify = notify->next; } acpi_os_printf ("Implicit Notify on %u devices", count); break; case ACPI_GPE_DISPATCH_RAW_HANDLER: acpi_os_printf("RawHandler"); break; default: acpi_os_printf("UNKNOWN: %X", ACPI_GPE_DISPATCH_TYPE (gpe_event_info-> flags)); break; } acpi_os_printf(")\n"); } } block++; gpe_block = gpe_block->next; } gpe_xrupt_info = gpe_xrupt_info->next; } } #endif /* !ACPI_REDUCED_HARDWARE */ /******************************************************************************* * * FUNCTION: acpi_db_display_handlers * * PARAMETERS: None * * RETURN: None * * DESCRIPTION: Display the currently installed global handlers * ******************************************************************************/ void acpi_db_display_handlers(void) { … } /******************************************************************************* * * FUNCTION: acpi_db_display_non_root_handlers * * PARAMETERS: acpi_walk_callback * * RETURN: Status * * DESCRIPTION: Display information about all handlers installed for a * device object. * ******************************************************************************/ static acpi_status acpi_db_display_non_root_handlers(acpi_handle obj_handle, u32 nesting_level, void *context, void **return_value) { … }