^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) // SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) * Module Name: dbdisply - debug display commands
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) #include <acpi/acpi.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) #include "accommon.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #include "amlcode.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include "acdispat.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include "acnamesp.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #include "acparser.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #include "acinterp.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #include "acevents.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #include "acdebug.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) #define _COMPONENT ACPI_CA_DEBUGGER
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) ACPI_MODULE_NAME("dbdisply")
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) /* Local prototypes */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) static void acpi_db_dump_parser_descriptor(union acpi_parse_object *op);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) static void *acpi_db_get_pointer(void *target);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) static acpi_status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) acpi_db_display_non_root_handlers(acpi_handle obj_handle,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) u32 nesting_level,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) void *context, void **return_value);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) * System handler information.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) * Used for Handlers command, in acpi_db_display_handlers.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) #define ACPI_PREDEFINED_PREFIX "%25s (%.2X) : "
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) #define ACPI_HANDLER_NAME_STRING "%30s : "
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) #define ACPI_HANDLER_PRESENT_STRING "%-9s (%p)\n"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) #define ACPI_HANDLER_PRESENT_STRING2 "%-9s (%p)"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) #define ACPI_HANDLER_NOT_PRESENT_STRING "%-9s\n"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) /* All predefined Address Space IDs */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) static acpi_adr_space_type acpi_gbl_space_id_list[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) ACPI_ADR_SPACE_SYSTEM_MEMORY,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) ACPI_ADR_SPACE_SYSTEM_IO,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) ACPI_ADR_SPACE_PCI_CONFIG,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) ACPI_ADR_SPACE_EC,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) ACPI_ADR_SPACE_SMBUS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) ACPI_ADR_SPACE_CMOS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) ACPI_ADR_SPACE_PCI_BAR_TARGET,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) ACPI_ADR_SPACE_IPMI,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) ACPI_ADR_SPACE_GPIO,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) ACPI_ADR_SPACE_GSBUS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) ACPI_ADR_SPACE_PLATFORM_COMM,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) ACPI_ADR_SPACE_PLATFORM_RT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) ACPI_ADR_SPACE_DATA_TABLE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) ACPI_ADR_SPACE_FIXED_HARDWARE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) /* Global handler information */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) typedef struct acpi_handler_info {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) void *handler;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) char *name;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) } acpi_handler_info;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) static struct acpi_handler_info acpi_gbl_handler_list[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) {&acpi_gbl_global_notify[0].handler, "System Notifications"},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) {&acpi_gbl_global_notify[1].handler, "Device Notifications"},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) {&acpi_gbl_table_handler, "ACPI Table Events"},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) {&acpi_gbl_exception_handler, "Control Method Exceptions"},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) {&acpi_gbl_interface_handler, "OSI Invocations"}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) /*******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) * FUNCTION: acpi_db_get_pointer
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) * PARAMETERS: target - Pointer to string to be converted
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) * RETURN: Converted pointer
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) * DESCRIPTION: Convert an ascii pointer value to a real value
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) static void *acpi_db_get_pointer(void *target)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) void *obj_ptr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) acpi_size address;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) address = strtoul(target, NULL, 16);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) obj_ptr = ACPI_TO_POINTER(address);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) return (obj_ptr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) /*******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) * FUNCTION: acpi_db_dump_parser_descriptor
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) * PARAMETERS: op - A parser Op descriptor
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) * RETURN: None
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) * DESCRIPTION: Display a formatted parser object
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) static void acpi_db_dump_parser_descriptor(union acpi_parse_object *op)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) const struct acpi_opcode_info *info;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) info = acpi_ps_get_opcode_info(op->common.aml_opcode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) acpi_os_printf("Parser Op Descriptor:\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) acpi_os_printf("%20.20s : %4.4X\n", "Opcode", op->common.aml_opcode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) ACPI_DEBUG_ONLY_MEMBERS(acpi_os_printf("%20.20s : %s\n", "Opcode Name",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) info->name));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) acpi_os_printf("%20.20s : %p\n", "Value/ArgList", op->common.value.arg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) acpi_os_printf("%20.20s : %p\n", "Parent", op->common.parent);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) acpi_os_printf("%20.20s : %p\n", "NextOp", op->common.next);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) /*******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) * FUNCTION: acpi_db_decode_and_display_object
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) * PARAMETERS: target - String with object to be displayed. Names
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) * and hex pointers are supported.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) * output_type - Byte, Word, Dword, or Qword (B|W|D|Q)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) * RETURN: None
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) * DESCRIPTION: Display a formatted ACPI object
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) void acpi_db_decode_and_display_object(char *target, char *output_type)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) void *obj_ptr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) struct acpi_namespace_node *node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) union acpi_operand_object *obj_desc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) u32 display = DB_BYTE_DISPLAY;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) char buffer[80];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) struct acpi_buffer ret_buf;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) acpi_status status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) u32 size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) if (!target) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) /* Decode the output type */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) if (output_type) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) acpi_ut_strupr(output_type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) if (output_type[0] == 'W') {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) display = DB_WORD_DISPLAY;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) } else if (output_type[0] == 'D') {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) display = DB_DWORD_DISPLAY;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) } else if (output_type[0] == 'Q') {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) display = DB_QWORD_DISPLAY;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) ret_buf.length = sizeof(buffer);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) ret_buf.pointer = buffer;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) /* Differentiate between a number and a name */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) if ((target[0] >= 0x30) && (target[0] <= 0x39)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) obj_ptr = acpi_db_get_pointer(target);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) if (!acpi_os_readable(obj_ptr, 16)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) acpi_os_printf
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) ("Address %p is invalid in this address space\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) obj_ptr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) /* Decode the object type */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) switch (ACPI_GET_DESCRIPTOR_TYPE(obj_ptr)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) case ACPI_DESC_TYPE_NAMED:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) /* This is a namespace Node */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) if (!acpi_os_readable
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) (obj_ptr, sizeof(struct acpi_namespace_node))) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) acpi_os_printf
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) ("Cannot read entire Named object at address %p\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) obj_ptr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) node = obj_ptr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) goto dump_node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) case ACPI_DESC_TYPE_OPERAND:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) /* This is a ACPI OPERAND OBJECT */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) if (!acpi_os_readable
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) (obj_ptr, sizeof(union acpi_operand_object))) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) acpi_os_printf
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) ("Cannot read entire ACPI object at address %p\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) obj_ptr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) acpi_ut_debug_dump_buffer(obj_ptr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) sizeof(union
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) acpi_operand_object),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) display, ACPI_UINT32_MAX);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) acpi_ex_dump_object_descriptor(obj_ptr, 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) case ACPI_DESC_TYPE_PARSER:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) /* This is a Parser Op object */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) if (!acpi_os_readable
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) (obj_ptr, sizeof(union acpi_parse_object))) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) acpi_os_printf
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) ("Cannot read entire Parser object at address %p\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) obj_ptr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) acpi_ut_debug_dump_buffer(obj_ptr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) sizeof(union
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) acpi_parse_object),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) display, ACPI_UINT32_MAX);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) acpi_db_dump_parser_descriptor((union acpi_parse_object
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) *)obj_ptr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) /* Is not a recognizable object */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) acpi_os_printf
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) ("Not a known ACPI internal object, descriptor type %2.2X\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) ACPI_GET_DESCRIPTOR_TYPE(obj_ptr));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) size = 16;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) if (acpi_os_readable(obj_ptr, 64)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) size = 64;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) /* Just dump some memory */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) acpi_ut_debug_dump_buffer(obj_ptr, size, display,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) ACPI_UINT32_MAX);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) /* The parameter is a name string that must be resolved to a Named obj */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) node = acpi_db_local_ns_lookup(target);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) if (!node) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) dump_node:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) /* Now dump the NS node */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) status = acpi_get_name(node, ACPI_FULL_PATHNAME_NO_TRAILING, &ret_buf);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) acpi_os_printf("Could not convert name to pathname\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) acpi_os_printf("Object %p: Namespace Node - Pathname: %s\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) node, (char *)ret_buf.pointer);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) if (!acpi_os_readable(node, sizeof(struct acpi_namespace_node))) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) acpi_os_printf("Invalid Named object at address %p\n", node);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) acpi_ut_debug_dump_buffer((void *)node,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) sizeof(struct acpi_namespace_node), display,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) ACPI_UINT32_MAX);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) acpi_ex_dump_namespace_node(node, 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) obj_desc = acpi_ns_get_attached_object(node);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) if (obj_desc) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) acpi_os_printf("\nAttached Object %p:", obj_desc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296) if (!acpi_os_readable
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297) (obj_desc, sizeof(union acpi_operand_object))) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298) acpi_os_printf
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299) ("Invalid internal ACPI Object at address %p\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) obj_desc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301) return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304) if (ACPI_GET_DESCRIPTOR_TYPE(((struct acpi_namespace_node *)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305) obj_desc)) ==
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306) ACPI_DESC_TYPE_NAMED) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307) acpi_os_printf(" Namespace Node - ");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308) status =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309) acpi_get_name((struct acpi_namespace_node *)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310) obj_desc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311) ACPI_FULL_PATHNAME_NO_TRAILING,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312) &ret_buf);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313) if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314) acpi_os_printf
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315) ("Could not convert name to pathname\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317) acpi_os_printf("Pathname: %s",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318) (char *)ret_buf.pointer);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321) acpi_os_printf("\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322) acpi_ut_debug_dump_buffer((void *)obj_desc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323) sizeof(struct
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324) acpi_namespace_node),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325) display, ACPI_UINT32_MAX);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327) acpi_os_printf("\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328) acpi_ut_debug_dump_buffer((void *)obj_desc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329) sizeof(union
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330) acpi_operand_object),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331) display, ACPI_UINT32_MAX);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334) acpi_ex_dump_object_descriptor(obj_desc, 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338) /*******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340) * FUNCTION: acpi_db_display_method_info
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342) * PARAMETERS: start_op - Root of the control method parse tree
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 344) * RETURN: None
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 345) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 346) * DESCRIPTION: Display information about the current method
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348) ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 350) void acpi_db_display_method_info(union acpi_parse_object *start_op)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 351) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 352) struct acpi_walk_state *walk_state;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 353) union acpi_operand_object *obj_desc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 354) struct acpi_namespace_node *node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 355) union acpi_parse_object *root_op;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 356) union acpi_parse_object *op;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 357) const struct acpi_opcode_info *op_info;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 358) u32 num_ops = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 359) u32 num_operands = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 360) u32 num_operators = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 361) u32 num_remaining_ops = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 362) u32 num_remaining_operands = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 363) u32 num_remaining_operators = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 364) u8 count_remaining = FALSE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 365)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 366) walk_state = acpi_ds_get_current_walk_state(acpi_gbl_current_walk_list);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 367) if (!walk_state) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 368) acpi_os_printf("There is no method currently executing\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 369) return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 370) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 371)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 372) obj_desc = walk_state->method_desc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 373) node = walk_state->method_node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 374)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 375) acpi_os_printf("Currently executing control method is [%4.4s]\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 376) acpi_ut_get_node_name(node));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 377) acpi_os_printf("%X Arguments, SyncLevel = %X\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 378) (u32)obj_desc->method.param_count,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 379) (u32)obj_desc->method.sync_level);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 380)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 381) root_op = start_op;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 382) while (root_op->common.parent) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 383) root_op = root_op->common.parent;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 384) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 385)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 386) op = root_op;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 387)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 388) while (op) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 389) if (op == start_op) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 390) count_remaining = TRUE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 391) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 392)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 393) num_ops++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 394) if (count_remaining) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 395) num_remaining_ops++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 396) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 397)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 398) /* Decode the opcode */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 399)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 400) op_info = acpi_ps_get_opcode_info(op->common.aml_opcode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 401) switch (op_info->class) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 402) case AML_CLASS_ARGUMENT:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 403)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 404) if (count_remaining) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 405) num_remaining_operands++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 406) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 407)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 408) num_operands++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 409) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 410)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 411) case AML_CLASS_UNKNOWN:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 412)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 413) /* Bad opcode or ASCII character */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 414)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 415) continue;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 416)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 417) default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 418)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 419) if (count_remaining) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 420) num_remaining_operators++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 421) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 422)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 423) num_operators++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 424) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 425) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 426)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 427) op = acpi_ps_get_depth_next(start_op, op);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 428) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 429)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 430) acpi_os_printf
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 431) ("Method contains: %X AML Opcodes - %X Operators, %X Operands\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 432) num_ops, num_operators, num_operands);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 433)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 434) acpi_os_printf
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 435) ("Remaining to execute: %X AML Opcodes - %X Operators, %X Operands\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 436) num_remaining_ops, num_remaining_operators,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 437) num_remaining_operands);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 438) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 439)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 440) /*******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 441) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 442) * FUNCTION: acpi_db_display_locals
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 443) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 444) * PARAMETERS: None
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 445) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 446) * RETURN: None
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 447) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 448) * DESCRIPTION: Display all locals for the currently running control method
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 449) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 450) ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 451)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 452) void acpi_db_display_locals(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 453) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 454) struct acpi_walk_state *walk_state;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 455)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 456) walk_state = acpi_ds_get_current_walk_state(acpi_gbl_current_walk_list);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 457) if (!walk_state) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 458) acpi_os_printf("There is no method currently executing\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 459) return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 460) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 461)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 462) acpi_db_decode_locals(walk_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 463) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 464)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 465) /*******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 466) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 467) * FUNCTION: acpi_db_display_arguments
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 468) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 469) * PARAMETERS: None
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 470) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 471) * RETURN: None
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 472) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 473) * DESCRIPTION: Display all arguments for the currently running control method
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 474) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 475) ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 476)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 477) void acpi_db_display_arguments(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 478) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 479) struct acpi_walk_state *walk_state;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 480)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 481) walk_state = acpi_ds_get_current_walk_state(acpi_gbl_current_walk_list);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 482) if (!walk_state) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 483) acpi_os_printf("There is no method currently executing\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 484) return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 485) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 486)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 487) acpi_db_decode_arguments(walk_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 488) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 489)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 490) /*******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 491) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 492) * FUNCTION: acpi_db_display_results
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 493) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 494) * PARAMETERS: None
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 495) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 496) * RETURN: None
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 497) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 498) * DESCRIPTION: Display current contents of a method result stack
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 499) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 500) ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 501)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 502) void acpi_db_display_results(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 503) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 504) u32 i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 505) struct acpi_walk_state *walk_state;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 506) union acpi_operand_object *obj_desc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 507) u32 result_count = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 508) struct acpi_namespace_node *node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 509) union acpi_generic_state *frame;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 510) u32 index; /* Index onto current frame */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 511)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 512) walk_state = acpi_ds_get_current_walk_state(acpi_gbl_current_walk_list);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 513) if (!walk_state) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 514) acpi_os_printf("There is no method currently executing\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 515) return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 516) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 517)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 518) node = walk_state->method_node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 519)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 520) if (walk_state->results) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 521) result_count = walk_state->result_count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 522) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 523)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 524) acpi_os_printf("Method [%4.4s] has %X stacked result objects\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 525) acpi_ut_get_node_name(node), result_count);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 526)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 527) /* From the top element of result stack */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 528)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 529) frame = walk_state->results;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 530) index = (result_count - 1) % ACPI_RESULTS_FRAME_OBJ_NUM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 531)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 532) for (i = 0; i < result_count; i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 533) obj_desc = frame->results.obj_desc[index];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 534) acpi_os_printf("Result%u: ", i);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 535) acpi_db_display_internal_object(obj_desc, walk_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 536)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 537) if (index == 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 538) frame = frame->results.next;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 539) index = ACPI_RESULTS_FRAME_OBJ_NUM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 540) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 541)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 542) index--;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 543) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 544) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 545)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 546) /*******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 547) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 548) * FUNCTION: acpi_db_display_calling_tree
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 549) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 550) * PARAMETERS: None
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 551) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 552) * RETURN: None
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 553) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 554) * DESCRIPTION: Display current calling tree of nested control methods
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 555) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 556) ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 557)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 558) void acpi_db_display_calling_tree(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 559) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 560) struct acpi_walk_state *walk_state;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 561) struct acpi_namespace_node *node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 562)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 563) walk_state = acpi_ds_get_current_walk_state(acpi_gbl_current_walk_list);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 564) if (!walk_state) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 565) acpi_os_printf("There is no method currently executing\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 566) return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 567) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 568)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 569) acpi_os_printf("Current Control Method Call Tree\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 570)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 571) while (walk_state) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 572) node = walk_state->method_node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 573) acpi_os_printf(" [%4.4s]\n", acpi_ut_get_node_name(node));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 574)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 575) walk_state = walk_state->next;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 576) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 577) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 578)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 579) /*******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 580) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 581) * FUNCTION: acpi_db_display_object_type
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 582) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 583) * PARAMETERS: object_arg - User entered NS node handle
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 584) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 585) * RETURN: None
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 586) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 587) * DESCRIPTION: Display type of an arbitrary NS node
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 588) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 589) ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 590)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 591) void acpi_db_display_object_type(char *object_arg)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 592) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 593) acpi_size arg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 594) acpi_handle handle;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 595) struct acpi_device_info *info;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 596) acpi_status status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 597) u32 i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 598)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 599) arg = strtoul(object_arg, NULL, 16);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 600) handle = ACPI_TO_POINTER(arg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 601)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 602) status = acpi_get_object_info(handle, &info);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 603) if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 604) acpi_os_printf("Could not get object info, %s\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 605) acpi_format_exception(status));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 606) return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 607) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 608)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 609) acpi_os_printf("ADR: %8.8X%8.8X, Flags: %X\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 610) ACPI_FORMAT_UINT64(info->address), info->flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 611)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 612) acpi_os_printf("S1D-%2.2X S2D-%2.2X S3D-%2.2X S4D-%2.2X\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 613) info->highest_dstates[0], info->highest_dstates[1],
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 614) info->highest_dstates[2], info->highest_dstates[3]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 615)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 616) acpi_os_printf("S0W-%2.2X S1W-%2.2X S2W-%2.2X S3W-%2.2X S4W-%2.2X\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 617) info->lowest_dstates[0], info->lowest_dstates[1],
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 618) info->lowest_dstates[2], info->lowest_dstates[3],
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 619) info->lowest_dstates[4]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 620)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 621) if (info->valid & ACPI_VALID_HID) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 622) acpi_os_printf("HID: %s\n", info->hardware_id.string);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 623) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 624)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 625) if (info->valid & ACPI_VALID_UID) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 626) acpi_os_printf("UID: %s\n", info->unique_id.string);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 627) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 628)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 629) if (info->valid & ACPI_VALID_CID) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 630) for (i = 0; i < info->compatible_id_list.count; i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 631) acpi_os_printf("CID %u: %s\n", i,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 632) info->compatible_id_list.ids[i].string);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 633) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 634) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 635)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 636) ACPI_FREE(info);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 637) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 638)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 639) /*******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 640) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 641) * FUNCTION: acpi_db_display_result_object
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 642) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 643) * PARAMETERS: obj_desc - Object to be displayed
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 644) * walk_state - Current walk state
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 645) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 646) * RETURN: None
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 647) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 648) * DESCRIPTION: Display the result of an AML opcode
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 649) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 650) * Note: Currently only displays the result object if we are single stepping.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 651) * However, this output may be useful in other contexts and could be enabled
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 652) * to do so if needed.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 653) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 654) ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 655)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 656) void
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 657) acpi_db_display_result_object(union acpi_operand_object *obj_desc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 658) struct acpi_walk_state *walk_state)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 659) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 660)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 661) #ifndef ACPI_APPLICATION
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 662) if (acpi_gbl_db_thread_id != acpi_os_get_thread_id()) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 663) return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 664) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 665) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 666)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 667) /* Only display if single stepping */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 668)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 669) if (!acpi_gbl_cm_single_step) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 670) return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 671) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 672)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 673) acpi_os_printf("ResultObj: ");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 674) acpi_db_display_internal_object(obj_desc, walk_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 675) acpi_os_printf("\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 676) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 677)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 678) /*******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 679) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 680) * FUNCTION: acpi_db_display_argument_object
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 681) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 682) * PARAMETERS: obj_desc - Object to be displayed
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 683) * walk_state - Current walk state
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 684) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 685) * RETURN: None
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 686) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 687) * DESCRIPTION: Display the result of an AML opcode
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 688) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 689) ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 690)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 691) void
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 692) acpi_db_display_argument_object(union acpi_operand_object *obj_desc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 693) struct acpi_walk_state *walk_state)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 694) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 695)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 696) #ifndef ACPI_APPLICATION
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 697) if (acpi_gbl_db_thread_id != acpi_os_get_thread_id()) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 698) return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 699) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 700) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 701)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 702) if (!acpi_gbl_cm_single_step) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 703) return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 704) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 705)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 706) acpi_os_printf("ArgObj: ");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 707) acpi_db_display_internal_object(obj_desc, walk_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 708) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 709)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 710) #if (!ACPI_REDUCED_HARDWARE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 711) /*******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 712) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 713) * FUNCTION: acpi_db_display_gpes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 714) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 715) * PARAMETERS: None
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 716) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 717) * RETURN: None
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 718) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 719) * DESCRIPTION: Display the current GPE structures
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 720) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 721) ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 722)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 723) void acpi_db_display_gpes(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 724) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 725) struct acpi_gpe_block_info *gpe_block;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 726) struct acpi_gpe_xrupt_info *gpe_xrupt_info;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 727) struct acpi_gpe_event_info *gpe_event_info;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 728) struct acpi_gpe_register_info *gpe_register_info;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 729) char *gpe_type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 730) struct acpi_gpe_notify_info *notify;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 731) u32 gpe_index;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 732) u32 block = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 733) u32 i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 734) u32 j;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 735) u32 count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 736) char buffer[80];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 737) struct acpi_buffer ret_buf;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 738) acpi_status status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 739)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 740) ret_buf.length = sizeof(buffer);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 741) ret_buf.pointer = buffer;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 742)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 743) block = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 744)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 745) /* Walk the GPE lists */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 746)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 747) gpe_xrupt_info = acpi_gbl_gpe_xrupt_list_head;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 748) while (gpe_xrupt_info) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 749) gpe_block = gpe_xrupt_info->gpe_block_list_head;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 750) while (gpe_block) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 751) status = acpi_get_name(gpe_block->node,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 752) ACPI_FULL_PATHNAME_NO_TRAILING,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 753) &ret_buf);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 754) if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 755) acpi_os_printf
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 756) ("Could not convert name to pathname\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 757) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 758)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 759) if (gpe_block->node == acpi_gbl_fadt_gpe_device) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 760) gpe_type = "FADT-defined GPE block";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 761) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 762) gpe_type = "GPE Block Device";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 763) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 764)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 765) acpi_os_printf
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 766) ("\nBlock %u - Info %p DeviceNode %p [%s] - %s\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 767) block, gpe_block, gpe_block->node, buffer,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 768) gpe_type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 769)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 770) acpi_os_printf(" Registers: %u (%u GPEs)\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 771) gpe_block->register_count,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 772) gpe_block->gpe_count);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 773)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 774) acpi_os_printf
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 775) (" GPE range: 0x%X to 0x%X on interrupt %u\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 776) gpe_block->block_base_number,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 777) gpe_block->block_base_number +
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 778) (gpe_block->gpe_count - 1),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 779) gpe_xrupt_info->interrupt_number);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 780)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 781) acpi_os_printf
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 782) (" RegisterInfo: %p Status %8.8X%8.8X Enable %8.8X%8.8X\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 783) gpe_block->register_info,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 784) ACPI_FORMAT_UINT64(gpe_block->register_info->
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 785) status_address.address),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 786) ACPI_FORMAT_UINT64(gpe_block->register_info->
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 787) enable_address.address));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 788)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 789) acpi_os_printf(" EventInfo: %p\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 790) gpe_block->event_info);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 791)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 792) /* Examine each GPE Register within the block */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 793)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 794) for (i = 0; i < gpe_block->register_count; i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 795) gpe_register_info =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 796) &gpe_block->register_info[i];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 797)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 798) acpi_os_printf(" Reg %u: (GPE %.2X-%.2X) "
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 799) "RunEnable %2.2X WakeEnable %2.2X"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 800) " Status %8.8X%8.8X Enable %8.8X%8.8X\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 801) i,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 802) gpe_register_info->
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 803) base_gpe_number,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 804) gpe_register_info->
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 805) base_gpe_number +
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 806) (ACPI_GPE_REGISTER_WIDTH - 1),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 807) gpe_register_info->
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 808) enable_for_run,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 809) gpe_register_info->
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 810) enable_for_wake,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 811) ACPI_FORMAT_UINT64
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 812) (gpe_register_info->
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 813) status_address.address),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 814) ACPI_FORMAT_UINT64
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 815) (gpe_register_info->
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 816) enable_address.address));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 817)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 818) /* Now look at the individual GPEs in this byte register */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 819)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 820) for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 821) gpe_index =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 822) (i * ACPI_GPE_REGISTER_WIDTH) + j;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 823) gpe_event_info =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 824) &gpe_block->event_info[gpe_index];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 825)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 826) if (ACPI_GPE_DISPATCH_TYPE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 827) (gpe_event_info->flags) ==
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 828) ACPI_GPE_DISPATCH_NONE) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 829)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 830) /* This GPE is not used (no method or handler), ignore it */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 831)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 832) continue;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 833) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 834)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 835) acpi_os_printf
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 836) (" GPE %.2X: %p RunRefs %2.2X Flags %2.2X (",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 837) gpe_block->block_base_number +
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 838) gpe_index, gpe_event_info,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 839) gpe_event_info->runtime_count,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 840) gpe_event_info->flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 841)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 842) /* Decode the flags byte */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 843)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 844) if (gpe_event_info->
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 845) flags & ACPI_GPE_LEVEL_TRIGGERED) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 846) acpi_os_printf("Level, ");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 847) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 848) acpi_os_printf("Edge, ");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 849) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 850)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 851) if (gpe_event_info->
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 852) flags & ACPI_GPE_CAN_WAKE) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 853) acpi_os_printf("CanWake, ");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 854) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 855) acpi_os_printf("RunOnly, ");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 856) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 857)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 858) switch (ACPI_GPE_DISPATCH_TYPE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 859) (gpe_event_info->flags)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 860) case ACPI_GPE_DISPATCH_NONE:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 861)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 862) acpi_os_printf("NotUsed");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 863) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 864)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 865) case ACPI_GPE_DISPATCH_METHOD:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 866)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 867) acpi_os_printf("Method");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 868) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 869)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 870) case ACPI_GPE_DISPATCH_HANDLER:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 871)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 872) acpi_os_printf("Handler");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 873) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 874)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 875) case ACPI_GPE_DISPATCH_NOTIFY:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 876)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 877) count = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 878) notify =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 879) gpe_event_info->dispatch.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 880) notify_list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 881) while (notify) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 882) count++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 883) notify = notify->next;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 884) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 885)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 886) acpi_os_printf
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 887) ("Implicit Notify on %u devices",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 888) count);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 889) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 890)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 891) case ACPI_GPE_DISPATCH_RAW_HANDLER:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 892)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 893) acpi_os_printf("RawHandler");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 894) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 895)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 896) default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 897)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 898) acpi_os_printf("UNKNOWN: %X",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 899) ACPI_GPE_DISPATCH_TYPE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 900) (gpe_event_info->
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 901) flags));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 902) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 903) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 904)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 905) acpi_os_printf(")\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 906) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 907) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 908)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 909) block++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 910) gpe_block = gpe_block->next;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 911) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 912)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 913) gpe_xrupt_info = gpe_xrupt_info->next;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 914) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 915) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 916) #endif /* !ACPI_REDUCED_HARDWARE */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 917)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 918) /*******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 919) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 920) * FUNCTION: acpi_db_display_handlers
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 921) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 922) * PARAMETERS: None
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 923) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 924) * RETURN: None
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 925) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 926) * DESCRIPTION: Display the currently installed global handlers
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 927) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 928) ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 929)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 930) void acpi_db_display_handlers(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 931) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 932) union acpi_operand_object *obj_desc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 933) union acpi_operand_object *handler_obj;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 934) acpi_adr_space_type space_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 935) u32 i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 936)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 937) /* Operation region handlers */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 938)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 939) acpi_os_printf("\nOperation Region Handlers at the namespace root:\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 940)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 941) obj_desc = acpi_ns_get_attached_object(acpi_gbl_root_node);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 942) if (obj_desc) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 943) for (i = 0; i < ACPI_ARRAY_LENGTH(acpi_gbl_space_id_list); i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 944) space_id = acpi_gbl_space_id_list[i];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 945)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 946) acpi_os_printf(ACPI_PREDEFINED_PREFIX,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 947) acpi_ut_get_region_name((u8)space_id),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 948) space_id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 949)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 950) handler_obj =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 951) acpi_ev_find_region_handler(space_id,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 952) obj_desc->common_notify.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 953) handler);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 954) if (handler_obj) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 955) acpi_os_printf(ACPI_HANDLER_PRESENT_STRING,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 956) (handler_obj->address_space.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 957) handler_flags &
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 958) ACPI_ADDR_HANDLER_DEFAULT_INSTALLED)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 959) ? "Default" : "User",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 960) handler_obj->address_space.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 961) handler);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 962)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 963) goto found_handler;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 964) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 965)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 966) /* There is no handler for this space_id */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 967)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 968) acpi_os_printf("None\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 969)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 970) found_handler: ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 971) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 972)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 973) /* Find all handlers for user-defined space_IDs */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 974)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 975) handler_obj = obj_desc->common_notify.handler;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 976) while (handler_obj) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 977) if (handler_obj->address_space.space_id >=
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 978) ACPI_USER_REGION_BEGIN) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 979) acpi_os_printf(ACPI_PREDEFINED_PREFIX,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 980) "User-defined ID",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 981) handler_obj->address_space.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 982) space_id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 983) acpi_os_printf(ACPI_HANDLER_PRESENT_STRING,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 984) (handler_obj->address_space.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 985) handler_flags &
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 986) ACPI_ADDR_HANDLER_DEFAULT_INSTALLED)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 987) ? "Default" : "User",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 988) handler_obj->address_space.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 989) handler);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 990) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 991)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 992) handler_obj = handler_obj->address_space.next;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 993) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 994) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 995) #if (!ACPI_REDUCED_HARDWARE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 996)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 997) /* Fixed event handlers */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 998)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 999) acpi_os_printf("\nFixed Event Handlers:\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1000)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1001) for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1002) acpi_os_printf(ACPI_PREDEFINED_PREFIX,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1003) acpi_ut_get_event_name(i), i);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1004) if (acpi_gbl_fixed_event_handlers[i].handler) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1005) acpi_os_printf(ACPI_HANDLER_PRESENT_STRING, "User",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1006) acpi_gbl_fixed_event_handlers[i].
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1007) handler);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1008) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1009) acpi_os_printf(ACPI_HANDLER_NOT_PRESENT_STRING, "None");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1010) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1011) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1012)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1013) #endif /* !ACPI_REDUCED_HARDWARE */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1014)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1015) /* Miscellaneous global handlers */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1016)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1017) acpi_os_printf("\nMiscellaneous Global Handlers:\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1018)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1019) for (i = 0; i < ACPI_ARRAY_LENGTH(acpi_gbl_handler_list); i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1020) acpi_os_printf(ACPI_HANDLER_NAME_STRING,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1021) acpi_gbl_handler_list[i].name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1022)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1023) if (acpi_gbl_handler_list[i].handler) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1024) acpi_os_printf(ACPI_HANDLER_PRESENT_STRING, "User",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1025) acpi_gbl_handler_list[i].handler);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1026) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1027) acpi_os_printf(ACPI_HANDLER_NOT_PRESENT_STRING, "None");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1028) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1029) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1030)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1031) /* Other handlers that are installed throughout the namespace */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1032)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1033) acpi_os_printf("\nOperation Region Handlers for specific devices:\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1034)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1035) (void)acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1036) ACPI_UINT32_MAX,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1037) acpi_db_display_non_root_handlers, NULL, NULL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1038) NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1039) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1040)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1041) /*******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1042) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1043) * FUNCTION: acpi_db_display_non_root_handlers
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1044) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1045) * PARAMETERS: acpi_walk_callback
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1046) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1047) * RETURN: Status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1048) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1049) * DESCRIPTION: Display information about all handlers installed for a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1050) * device object.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1051) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1052) ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1053)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1054) static acpi_status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1055) acpi_db_display_non_root_handlers(acpi_handle obj_handle,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1056) u32 nesting_level,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1057) void *context, void **return_value)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1058) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1059) struct acpi_namespace_node *node =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1060) ACPI_CAST_PTR(struct acpi_namespace_node, obj_handle);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1061) union acpi_operand_object *obj_desc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1062) union acpi_operand_object *handler_obj;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1063) char *pathname;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1064)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1065) obj_desc = acpi_ns_get_attached_object(node);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1066) if (!obj_desc) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1067) return (AE_OK);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1068) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1069)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1070) pathname = acpi_ns_get_normalized_pathname(node, TRUE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1071) if (!pathname) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1072) return (AE_OK);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1073) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1074)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1075) /* Display all handlers associated with this device */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1076)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1077) handler_obj = obj_desc->common_notify.handler;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1078) while (handler_obj) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1079) acpi_os_printf(ACPI_PREDEFINED_PREFIX,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1080) acpi_ut_get_region_name((u8)handler_obj->
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1081) address_space.space_id),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1082) handler_obj->address_space.space_id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1083)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1084) acpi_os_printf(ACPI_HANDLER_PRESENT_STRING2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1085) (handler_obj->address_space.handler_flags &
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1086) ACPI_ADDR_HANDLER_DEFAULT_INSTALLED) ? "Default"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1087) : "User", handler_obj->address_space.handler);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1088)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1089) acpi_os_printf(" Device Name: %s (%p)\n", pathname, node);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1090)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1091) handler_obj = handler_obj->address_space.next;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1092) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1093)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1094) ACPI_FREE(pathname);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1095) return (AE_OK);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1096) }