📄 exdump.c
字号:
/****************************************************************************** * * Module Name: exdump - Interpreter debug output routines * $Revision: 126 $ * *****************************************************************************//* * Copyright (C) 2000, 2001 R. Byron Moore * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */#include "acpi.h"#include "acinterp.h"#include "amlcode.h"#include "acnamesp.h"#include "actables.h"#include "acparser.h"#define _COMPONENT ACPI_EXECUTER MODULE_NAME ("exdump")/* * The following routines are used for debug output only */#if defined(ACPI_DEBUG) || defined(ENABLE_DEBUGGER)/***************************************************************************** * * FUNCTION: Acpi_ex_show_hex_value * * PARAMETERS: Byte_count - Number of bytes to print (1, 2, or 4) * *Aml_start - Address in AML stream of bytes to print * Interpreter_mode - Current running mode (load1/Load2/Exec) * Lead_space - # of spaces to print ahead of value * 0 => none ahead but one behind * * DESCRIPTION: Print Byte_count byte(s) starting at Aml_start as a single * value, in hex. If Byte_count > 1 or the value printed is > 9, also * print in decimal. * ****************************************************************************/voidacpi_ex_show_hex_value ( u32 byte_count, u8 *aml_start, u32 lead_space){ u32 value; /* Value retrieved from AML stream */ u32 show_decimal_value; u32 length; /* Length of printed field */ u8 *current_aml_ptr = NULL; /* Pointer to current byte of AML value */ FUNCTION_TRACE ("Ex_show_hex_value"); if (!aml_start) { REPORT_ERROR (("Ex_show_hex_value: null pointer\n")); } /* * AML numbers are always stored little-endian, * even if the processor is big-endian. */ for (current_aml_ptr = aml_start + byte_count, value = 0; current_aml_ptr > aml_start; ) { value = (value << 8) + (u32)* --current_aml_ptr; } length = lead_space * byte_count + 2; if (byte_count > 1) { length += (byte_count - 1); } show_decimal_value = (byte_count > 1 || value > 9); if (show_decimal_value) { length += 3 + acpi_ex_digits_needed (value, 10); } for (length = lead_space; length; --length ) { ACPI_DEBUG_PRINT_RAW ((ACPI_DB_LOAD, " ")); } while (byte_count--) { ACPI_DEBUG_PRINT_RAW ((ACPI_DB_LOAD, "%02x", *aml_start++)); if (byte_count) { ACPI_DEBUG_PRINT_RAW ((ACPI_DB_LOAD, " ")); } } if (show_decimal_value) { ACPI_DEBUG_PRINT_RAW ((ACPI_DB_LOAD, " [%d]", value)); } if (0 == lead_space) { ACPI_DEBUG_PRINT_RAW ((ACPI_DB_LOAD, " ")); } ACPI_DEBUG_PRINT_RAW ((ACPI_DB_LOAD, "\n")); return_VOID;}/***************************************************************************** * * FUNCTION: Acpi_ex_dump_operand * * PARAMETERS: *Entry_desc - Pointer to entry to be dumped * * RETURN: Status * * DESCRIPTION: Dump a stack entry * ****************************************************************************/acpi_statusacpi_ex_dump_operand ( acpi_operand_object *entry_desc){ u8 *buf = NULL; u32 length; u32 i; PROC_NAME ("Ex_dump_operand") if (!entry_desc) { /* * This usually indicates that something serious is wrong -- * since most (if not all) * code that dumps the stack expects something to be there! */ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Null stack entry ptr\n")); return (AE_OK); } if (VALID_DESCRIPTOR_TYPE (entry_desc, ACPI_DESC_TYPE_NAMED)) { ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "%p NS Node: ", entry_desc)); DUMP_ENTRY (entry_desc, ACPI_LV_INFO); return (AE_OK); } if (!VALID_DESCRIPTOR_TYPE (entry_desc, ACPI_DESC_TYPE_INTERNAL)) { ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "%p Is not a local object \n", entry_desc)); DUMP_BUFFER (entry_desc, sizeof (acpi_operand_object)); return (AE_OK); } /* Entry_desc is a valid object */ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "%p ", entry_desc)); switch (entry_desc->common.type) { case INTERNAL_TYPE_REFERENCE: switch (entry_desc->reference.opcode) { case AML_ZERO_OP: ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "Reference: Zero\n")); break; case AML_ONE_OP: ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "Reference: One\n")); break; case AML_ONES_OP: ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "Reference: Ones\n")); break; case AML_REVISION_OP: ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "Reference: Revision\n")); break; case AML_DEBUG_OP: ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "Reference: Debug\n")); break; case AML_NAME_OP: DUMP_PATHNAME (entry_desc->reference.object, "Reference: Name: ", ACPI_LV_INFO, _COMPONENT); DUMP_ENTRY (entry_desc->reference.object, ACPI_LV_INFO); break; case AML_INDEX_OP: ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "Reference: Index %p\n", entry_desc->reference.object)); break; case AML_ARG_OP: ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "Reference: Arg%d", entry_desc->reference.offset)); if (ACPI_TYPE_INTEGER == entry_desc->common.type) { /* Value is a Number */ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, " value is [%8.8X%8.8x]", HIDWORD(entry_desc->integer.value), LODWORD(entry_desc->integer.value))); } ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "\n")); break; case AML_LOCAL_OP: ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "Reference: Local%d", entry_desc->reference.offset)); if (ACPI_TYPE_INTEGER == entry_desc->common.type) { /* Value is a Number */ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, " value is [%8.8X%8.8x]", HIDWORD(entry_desc->integer.value), LODWORD(entry_desc->integer.value))); } ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "\n")); break; case AML_INT_NAMEPATH_OP: ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "Reference.Node->Name %X\n", entry_desc->reference.node->name)); break; default: /* unknown opcode */ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "Unknown opcode=%X\n", entry_desc->reference.opcode)); break; } break; case ACPI_TYPE_BUFFER: ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "Buffer len %X @ %p \n", entry_desc->buffer.length, entry_desc->buffer.pointer)); length = entry_desc->buffer.length; if (length > 64) { length = 64; } /* Debug only -- dump the buffer contents */ if (entry_desc->buffer.pointer) { ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "Buffer Contents: ")); for (buf = entry_desc->buffer.pointer; length--; ++buf) { ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, " %02x", *buf)); } ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO,"\n")); } break; case ACPI_TYPE_INTEGER: ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "Integer %8.8X%8.8X\n", HIDWORD (entry_desc->integer.value), LODWORD (entry_desc->integer.value))); break; case INTERNAL_TYPE_IF: ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "If [Integer] %8.8X%8.8X\n", HIDWORD (entry_desc->integer.value), LODWORD (entry_desc->integer.value))); break; case INTERNAL_TYPE_WHILE: ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "While [Integer] %8.8X%8.8X\n", HIDWORD (entry_desc->integer.value), LODWORD (entry_desc->integer.value))); break; case ACPI_TYPE_PACKAGE: ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "Package count %X @ %p\n", entry_desc->package.count, entry_desc->package.elements)); /* * If elements exist, package vector pointer is valid, * and debug_level exceeds 1, dump package's elements. */ if (entry_desc->package.count && entry_desc->package.elements && acpi_dbg_level > 1) { acpi_operand_object**element; u16 element_index; for (element_index = 0, element = entry_desc->package.elements; element_index < entry_desc->package.count; ++element_index, ++element) { acpi_ex_dump_operand (*element); } } ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "\n")); break; case ACPI_TYPE_REGION: ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "Region %s (%X)", acpi_ut_get_region_name (entry_desc->region.space_id), entry_desc->region.space_id)); /* * If the address and length have not been evaluated, * don't print them. */ if (!(entry_desc->region.flags & AOPOBJ_DATA_VALID)) { ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "\n")); } else { ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, " base %8.8X%8.8X Length %X\n", HIDWORD(entry_desc->region.address), LODWORD(entry_desc->region.address), entry_desc->region.length)); } break; case ACPI_TYPE_STRING: ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "String length %X @ %p \"", entry_desc->string.length, entry_desc->string.pointer)); for (i = 0; i < entry_desc->string.length; i++) { ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "%c", entry_desc->string.pointer[i])); } ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "\"\n")); break; case INTERNAL_TYPE_BANK_FIELD: ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "Bank_field\n")); break; case INTERNAL_TYPE_REGION_FIELD: ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "Region_field: bits=%X bitaccwidth=%X lock=%X update=%X at byte=%X bit=%X of below:\n", entry_desc->field.bit_length, entry_desc->field.access_bit_width, entry_desc->field.lock_rule, entry_desc->field.update_rule, entry_desc->field.base_byte_offset, entry_desc->field.start_field_bit_offset)); DUMP_STACK_ENTRY (entry_desc->field.region_obj); break; case INTERNAL_TYPE_INDEX_FIELD: ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "Index_field\n")); break; case ACPI_TYPE_BUFFER_FIELD: ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "Buffer_field: %X bits at byte %X bit %X of \n", entry_desc->buffer_field.bit_length, entry_desc->buffer_field.base_byte_offset, entry_desc->buffer_field.start_field_bit_offset)); if (!entry_desc->buffer_field.buffer_obj) { ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "*NULL* \n")); } else if (ACPI_TYPE_BUFFER != entry_desc->buffer_field.buffer_obj->common.type) { ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "*not a Buffer* \n")); } else { DUMP_STACK_ENTRY (entry_desc->buffer_field.buffer_obj); } break; case ACPI_TYPE_EVENT: ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "Event\n")); break;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -