/*******************************************************************************
*
* Module Name: dbdisply - debug display commands
*
******************************************************************************/
/*
* Copyright (C) 2000 - 2018, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions, and the following disclaimer,
* without modification.
* 2. Redistributions in binary form must reproduce at minimum a disclaimer
* substantially similar to the "NO WARRANTY" disclaimer below
* ("Disclaimer") and any redistribution must be conditioned upon
* including a substantially similar Disclaimer requirement for further
* binary redistribution.
* 3. Neither the names of the above-listed copyright holders nor the names
* of any contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* Alternatively, this software may be distributed under the terms of the
* GNU General Public License ("GPL") version 2 as published by the Free
* Software Foundation.
*
* NO WARRANTY
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES.
*/
#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_CA_DEBUGGER
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 "%25s (%.2X) : "
#define ACPI_HANDLER_NAME_STRING "%30s : "
#define ACPI_HANDLER_PRESENT_STRING "%-9s (%p)\n"
#define ACPI_HANDLER_PRESENT_STRING2 "%-9s (%p)"
#define ACPI_HANDLER_NOT_PRESENT_STRING "%-9s\n"
/* All predefined Address Space IDs */
static acpi_adr_space_type acpi_gbl_space_id_list[] = {
ACPI_ADR_SPACE_SYSTEM_MEMORY,
ACPI_ADR_SPACE_SYSTEM_IO,
ACPI_ADR_SPACE_PCI_CONFIG,
ACPI_ADR_SPACE_EC,
ACPI_ADR_SPACE_SMBUS,
ACPI_ADR_SPACE_CMOS,
ACPI_ADR_SPACE_PCI_BAR_TARGET,
ACPI_ADR_SPACE_IPMI,
ACPI_ADR_SPACE_GPIO,
ACPI_ADR_SPACE_GSBUS,
ACPI_ADR_SPACE_DATA_TABLE,
ACPI_ADR_SPACE_FIXED_HARDWARE
};
/* Global handler information */
typedef struct acpi_handler_info {
void *handler;
char *name;
} acpi_handler_info;
static struct acpi_handler_info acpi_gbl_handler_list[] = {
{&acpi_gbl_global_notify[0].handler, "System Notifications"},
{&acpi_gbl_global_notify[1].handler, "Device Notifications"},
{&acpi_gbl_table_handler, "ACPI Table Events"},
{&acpi_gbl_exception_handler, "Control Method Exceptions"},
{&acpi_gbl_interface_handler, "OSI Invocations"}
};
/*******************************************************************************
*
* 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)
{
void *obj_ptr;
acpi_size address;
address = strtoul(target, NULL, 16);
obj_ptr = ACPI_TO_POINTER(address);
return (obj_ptr);
}
/*******************************************************************************
*
* 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)
{
const struct acpi_opcode_info *info;
info = acpi_ps_get_opcode_info(op->common.aml_opcode);
acpi_os_printf("Parser Op Descriptor:\n");
acpi_os_printf("%20.20s : %4.4X\n", "Opcode", op->common.aml_opcode);
ACPI_DEBUG_ONLY_MEMBERS(acpi_os_printf("%20.20s : %s\n", "Opcode Name",
info->name));
acpi_os_printf("%20.20s : %p\n", "Value/ArgList", op->common.value.arg);
acpi_os_printf("%20.20s : %p\n", "Parent", op->common.parent);
acpi_os_printf("%20.20s : %p\n", "NextOp", op->common.next);
}
/*******************************************************************************
*
* 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