dbdisply.c revision 26f3cdf03f1adcc98f6d3d99843ee71e9229a8c0
/*******************************************************************************
*
* Module Name: dbdisply - debug display commands
*
******************************************************************************/
/*
* Copyright (C) 2000 - 2011, 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.h"
#include "accommon.h"
#include "amlcode.h"
#include "acdispat.h"
#include "acnamesp.h"
#include "acparser.h"
#include "acinterp.h"
#include "acdebug.h"
#include "acdisasm.h"
#ifdef ACPI_DEBUGGER
#define _COMPONENT ACPI_CA_DEBUGGER
ACPI_MODULE_NAME ("dbdisply")
/* Local prototypes */
static void
static void *
void *Target);
/*
* System handler information.
* Used for Handlers command, in AcpiDbDisplayHandlers.
*/
#define ACPI_PREDEFINED_PREFIX "%25s (%.2X) : "
#define ACPI_HANDLER_NAME_STRING "%30s : "
#define ACPI_HANDLER_PRESENT_STRING "%-9s (%p)\n"
#define ACPI_HANDLER_NOT_PRESENT_STRING "%-9s\n"
/* All predefined Address Space IDs */
static ACPI_ADR_SPACE_TYPE AcpiGbl_SpaceIdList[] =
{
};
/* Global handler information */
typedef struct acpi_handler_info
{
void *Handler;
char *Name;
static ACPI_HANDLER_INFO AcpiGbl_HandlerList[] =
{
{&AcpiGbl_TableHandler, "ACPI Table Events"},
{&AcpiGbl_ExceptionHandler, "Control Method Exceptions"},
{&AcpiGbl_InterfaceHandler, "OSI Invocations"}
};
/*******************************************************************************
*
* FUNCTION: AcpiDbGetPointer
*
* PARAMETERS: Target - Pointer to string to be converted
*
* RETURN: Converted pointer
*
* DESCRIPTION: Convert an ascii pointer value to a real value
*
******************************************************************************/
static void *
void *Target)
{
void *ObjPtr;
return (ObjPtr);
}
/*******************************************************************************
*
* FUNCTION: AcpiDbDumpParserDescriptor
*
* PARAMETERS: Op - A parser Op descriptor
*
* RETURN: None
*
* DESCRIPTION: Display a formatted parser object
*
******************************************************************************/
static void
{
const ACPI_OPCODE_INFO *Info;
AcpiOsPrintf ("Parser Op Descriptor:\n");
}
/*******************************************************************************
*
* FUNCTION: AcpiDbDecodeAndDisplayObject
*
* PARAMETERS: Target - String with object to be displayed. Names
* and hex pointers are supported.
* OutputType - Byte, Word, Dword, or Qword (B|W|D|Q)
*
* RETURN: None
*
* DESCRIPTION: Display a formatted ACPI object
*
******************************************************************************/
void
char *Target,
char *OutputType)
{
void *ObjPtr;
char Buffer[80];
if (!Target)
{
return;
}
/* Decode the output type */
if (OutputType)
{
if (OutputType[0] == 'W')
{
}
else if (OutputType[0] == 'D')
{
}
else if (OutputType[0] == 'Q')
{
}
}
/* Differentiate between a number and a name */
{
{
AcpiOsPrintf ("Address %p is invalid in this address space\n",
ObjPtr);
return;
}
/* Decode the object type */
switch (ACPI_GET_DESCRIPTOR_TYPE (ObjPtr))
{
case ACPI_DESC_TYPE_NAMED:
/* This is a namespace Node */
{
"Cannot read entire Named object at address %p\n", ObjPtr);
return;
}
goto DumpNode;
case ACPI_DESC_TYPE_OPERAND:
/* This is a ACPI OPERAND OBJECT */
{
AcpiOsPrintf ("Cannot read entire ACPI object at address %p\n",
ObjPtr);
return;
}
break;
case ACPI_DESC_TYPE_PARSER:
/* This is a Parser Op object */
{
"Cannot read entire Parser object at address %p\n", ObjPtr);
return;
}
break;
default:
/* Is not a recognizeable object */
Size = 16;
{
Size = 64;
}
/* Just dump some memory */
break;
}
return;
}
/* The parameter is a name string that must be resolved to a Named obj */
if (!Node)
{
return;
}
/* Now dump the NS node */
if (ACPI_FAILURE (Status))
{
AcpiOsPrintf ("Could not convert name to pathname\n");
}
else
{
AcpiOsPrintf ("Object (%p) Pathname: %s\n",
}
{
return;
}
if (ObjDesc)
{
{
AcpiOsPrintf ("Invalid internal ACPI Object at address %p\n",
ObjDesc);
return;
}
}
}
/*******************************************************************************
*
* FUNCTION: AcpiDbDisplayMethodInfo
*
* PARAMETERS: StartOp - Root of the control method parse tree
*
* RETURN: None
*
* DESCRIPTION: Display information about the current method
*
******************************************************************************/
void
{
const ACPI_OPCODE_INFO *OpInfo;
UINT32 NumOperands = 0;
UINT32 NumOperators = 0;
UINT32 NumRemainingOps = 0;
if (!WalkState)
{
AcpiOsPrintf ("There is no method currently executing\n");
return;
}
AcpiOsPrintf ("Currently executing control method is [%4.4s]\n",
AcpiOsPrintf ("%X Arguments, SyncLevel = %X\n",
{
}
while (Op)
{
{
}
NumOps++;
if (CountRemaining)
{
}
/* Decode the opcode */
{
case AML_CLASS_ARGUMENT:
if (CountRemaining)
{
}
NumOperands++;
break;
case AML_CLASS_UNKNOWN:
/* Bad opcode or ASCII character */
continue;
default:
if (CountRemaining)
{
}
NumOperators++;
break;
}
}
"Method contains: %X AML Opcodes - %X Operators, %X Operands\n",
"Remaining to execute: %X AML Opcodes - %X Operators, %X Operands\n",
}
/*******************************************************************************
*
* FUNCTION: AcpiDbDisplayLocals
*
* PARAMETERS: None
*
* RETURN: None
*
* DESCRIPTION: Display all locals for the currently running control method
*
******************************************************************************/
void
void)
{
if (!WalkState)
{
AcpiOsPrintf ("There is no method currently executing\n");
return;
}
}
/*******************************************************************************
*
* FUNCTION: AcpiDbDisplayArguments
*
* PARAMETERS: None
*
* RETURN: None
*
* DESCRIPTION: Display all arguments for the currently running control method
*
******************************************************************************/
void
void)
{
if (!WalkState)
{
AcpiOsPrintf ("There is no method currently executing\n");
return;
}
}
/*******************************************************************************
*
* FUNCTION: AcpiDbDisplayResults
*
* PARAMETERS: None
*
* RETURN: None
*
* DESCRIPTION: Display current contents of a method result stack
*
******************************************************************************/
void
void)
{
UINT32 i;
UINT32 ResultCount = 0;
if (!WalkState)
{
AcpiOsPrintf ("There is no method currently executing\n");
return;
}
{
}
AcpiOsPrintf ("Method [%4.4s] has %X stacked result objects\n",
/* From the top element of result stack */
for (i = 0; i < ResultCount; i++)
{
AcpiOsPrintf ("Result%u: ", i);
if (Index == 0)
{
}
Index--;
}
}
/*******************************************************************************
*
* FUNCTION: AcpiDbDisplayCallingTree
*
* PARAMETERS: None
*
* RETURN: None
*
* DESCRIPTION: Display current calling tree of nested control methods
*
******************************************************************************/
void
void)
{
if (!WalkState)
{
AcpiOsPrintf ("There is no method currently executing\n");
return;
}
AcpiOsPrintf ("Current Control Method Call Tree\n");
while (WalkState)
{
}
}
/*******************************************************************************
*
* FUNCTION: AcpiDbDisplayObjectType
*
* PARAMETERS: ObjectArg - User entered NS node handle
*
* RETURN: None
*
* DESCRIPTION: Display type of an arbitrary NS node
*
******************************************************************************/
void
char *ObjectArg)
{
UINT32 i;
if (ACPI_FAILURE (Status))
{
AcpiOsPrintf ("Could not get object info, %s\n",
return;
}
AcpiOsPrintf ("ADR: %8.8X%8.8X, STA: %8.8X, Flags: %X\n",
AcpiOsPrintf ("S1D-%2.2X S2D-%2.2X S3D-%2.2X S4D-%2.2X\n",
AcpiOsPrintf ("S0W-%2.2X S1W-%2.2X S2W-%2.2X S3W-%2.2X S4W-%2.2X\n",
{
}
{
}
{
{
AcpiOsPrintf ("CID %u: %s\n", i,
}
}
}
/*******************************************************************************
*
* FUNCTION: AcpiDbDisplayResultObject
*
* PARAMETERS: ObjDesc - Object to be displayed
* WalkState - Current walk state
*
* RETURN: None
*
* DESCRIPTION: Display the result of an AML opcode
*
* Note: Curently 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
{
/* Only display if single stepping */
if (!AcpiGbl_CmSingleStep)
{
return;
}
AcpiOsPrintf ("ResultObj: ");
AcpiOsPrintf ("\n");
}
/*******************************************************************************
*
* FUNCTION: AcpiDbDisplayArgumentObject
*
* PARAMETERS: ObjDesc - Object to be displayed
* WalkState - Current walk state
*
* RETURN: None
*
* DESCRIPTION: Display the result of an AML opcode
*
******************************************************************************/
void
{
if (!AcpiGbl_CmSingleStep)
{
return;
}
AcpiOsPrintf ("ArgObj: ");
}
/*******************************************************************************
*
* FUNCTION: AcpiDbDisplayGpes
*
* PARAMETERS: None
*
* RETURN: None
*
* DESCRIPTION: Display the current GPE structures
*
******************************************************************************/
void
void)
{
char *GpeType;
UINT32 i;
UINT32 j;
char Buffer[80];
Block = 0;
/* Walk the GPE lists */
while (GpeXruptInfo)
{
while (GpeBlock)
{
if (ACPI_FAILURE (Status))
{
AcpiOsPrintf ("Could not convert name to pathname\n");
}
{
GpeType = "FADT-defined GPE block";
}
else
{
GpeType = "GPE Block Device";
}
AcpiOsPrintf ("\nBlock %u - Info %p DeviceNode %p [%s] - %s\n",
AcpiOsPrintf (" Registers: %u (%u GPEs)\n",
AcpiOsPrintf (" GPE range: 0x%X to 0x%X on interrupt %u\n",
" RegisterInfo: %p Status %8.8X%8.8X Enable %8.8X%8.8X\n",
/* Examine each GPE Register within the block */
for (i = 0; i < GpeBlock->RegisterCount; i++)
{
" Reg %u: (GPE %.2X-%.2X) RunEnable %2.2X WakeEnable %2.2X"
" Status %8.8X%8.8X Enable %8.8X%8.8X\n",
/* Now look at the individual GPEs in this byte register */
for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++)
{
GpeIndex = (i * ACPI_GPE_REGISTER_WIDTH) + j;
{
/* This GPE is not used (no method or handler), ignore it */
continue;
}
" GPE %.2X: %p RunRefs %2.2X Flags %2.2X (",
/* Decode the flags byte */
{
AcpiOsPrintf ("Level, ");
}
else
{
AcpiOsPrintf ("Edge, ");
}
{
AcpiOsPrintf ("CanWake, ");
}
else
{
AcpiOsPrintf ("RunOnly, ");
}
{
case ACPI_GPE_DISPATCH_NONE:
AcpiOsPrintf ("NotUsed");
break;
case ACPI_GPE_DISPATCH_METHOD:
AcpiOsPrintf ("Method");
break;
AcpiOsPrintf ("Handler");
break;
case ACPI_GPE_DISPATCH_NOTIFY:
AcpiOsPrintf ("Notify");
break;
default:
AcpiOsPrintf ("UNKNOWN: %X",
break;
}
AcpiOsPrintf (")\n");
}
}
Block++;
}
}
}
/*******************************************************************************
*
* FUNCTION: AcpiDbDisplayHandlers
*
* PARAMETERS: None
*
* RETURN: None
*
* DESCRIPTION: Display the currently installed global handlers
*
******************************************************************************/
void
void)
{
UINT32 i;
/* Operation region handlers */
AcpiOsPrintf ("\nOperation Region Handlers:\n");
if (ObjDesc)
{
for (i = 0; i < ACPI_ARRAY_LENGTH (AcpiGbl_SpaceIdList); i++)
{
SpaceId = AcpiGbl_SpaceIdList[i];
while (HandlerObj)
{
{
goto FoundHandler;
}
}
/* There is no handler for this SpaceId */
AcpiOsPrintf ("None\n");
}
}
/* Fixed event handlers */
AcpiOsPrintf ("\nFixed Event Handlers:\n");
for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++)
{
if (AcpiGbl_FixedEventHandlers[i].Handler)
{
}
else
{
}
}
/* Miscellaneous global handlers */
AcpiOsPrintf ("\nMiscellaneous Global Handlers:\n");
for (i = 0; i < ACPI_ARRAY_LENGTH (AcpiGbl_HandlerList); i++)
{
if (AcpiGbl_HandlerList[i].Handler)
{
}
else
{
}
}
}
#endif /* ACPI_DEBUGGER */