exdump.c revision 30082d0cc16bf5799269ca464a219de900f519cd
/******************************************************************************
*
* Module Name: exdump - Interpreter debug output routines
* $Revision: 1.194 $
*
*****************************************************************************/
/******************************************************************************
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp.
* All rights reserved.
*
* 2. License
*
* 2.1. This is your license from Intel Corp. under its intellectual property
* rights. You may have additional license terms from the party that provided
* you this software, covering your right to use that party's intellectual
* property rights.
*
* 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
* copy of the source code appearing in this file ("Covered Code") an
* irrevocable, perpetual, worldwide license under Intel's copyrights in the
* base code distributed originally by Intel ("Original Intel Code") to copy,
* make derivatives, distribute, use and display any portion of the Covered
* Code in any form, with the right to sublicense such rights; and
*
* 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
* license (with the right to sublicense), under only those claims of Intel
* patents that are infringed by the Original Intel Code, to make, use, sell,
* offer to sell, and import the Covered Code and derivative works thereof
* solely to the minimum extent necessary to exercise the above copyright
* license, and in no event shall the patent license extend to any additions
* to or modifications of the Original Intel Code. No other license or right
* is granted directly or by implication, estoppel or otherwise;
*
* The above copyright and patent license is granted only if the following
* conditions are met:
*
* 3. Conditions
*
* 3.1. Redistribution of Source with Rights to Further Distribute Source.
* Redistribution of source code of any substantial portion of the Covered
* Code or modification with rights to further distribute source must include
* the above Copyright Notice, the above License, this list of Conditions,
* and the following Disclaimer and Export Compliance provision. In addition,
* Licensee must cause all Covered Code to which Licensee contributes to
* contain a file documenting the changes Licensee made to create that Covered
* Code and the date of any change. Licensee must include in that file the
* documentation of any changes made by any predecessor Licensee. Licensee
* must include a prominent statement that the modification is derived,
* directly or indirectly, from Original Intel Code.
*
* 3.2. Redistribution of Source with no Rights to Further Distribute Source.
* Redistribution of source code of any substantial portion of the Covered
* Code or modification without rights to further distribute source must
* include the following Disclaimer and Export Compliance provision in the
* addition, Licensee may not authorize further sublicense of source of any
* portion of the Covered Code, and must include terms to the effect that the
* license from Licensee to its licensee is limited to the intellectual
* property embodied in the software Licensee provides to its licensee, and
* not to intellectual property embodied in modifications its licensee may
* make.
*
* 3.3. Redistribution of Executable. Redistribution in executable form of any
* substantial portion of the Covered Code or modification must reproduce the
* above Copyright Notice, and the following Disclaimer and Export Compliance
* distribution.
*
* 3.4. Intel retains all right, title, and interest in and to the Original
* Intel Code.
*
* 3.5. Neither the name Intel nor any other trademark owned or controlled by
* Intel shall be used in advertising or otherwise to promote the sale, use or
* other dealings in products derived from or relating to the Covered Code
* without prior written authorization from Intel.
*
* 4. Disclaimer and Export Compliance
*
* 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
* HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
* IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
* INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
* UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
* IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
* PARTICULAR PURPOSE.
*
* 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
* OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
* COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
* SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
* CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
* HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
* SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
* LIMITED REMEDY.
*
* 4.3. Licensee shall not export, either directly or indirectly, any of this
* software or system incorporating such software without first obtaining any
* required license or other approval from the U. S. Department of Commerce or
* any other agency or department of the United States Government. In the
* event Licensee exports any such software from the United States or
* re-exports any such software from a foreign destination, Licensee shall
* compliance with all laws, regulations, orders, or other restrictions of the
* U.S. Export Administration Regulations. Licensee agrees that neither it nor
* software, or service, directly or indirectly, to any country for which the
* United States government or any agency thereof requires an export license,
* other governmental approval, or letter of assurance, without first obtaining
* such license, approval or letter.
*
*****************************************************************************/
#define __EXDUMP_C__
#include "acpi.h"
#include "acinterp.h"
#include "amlcode.h"
#include "acnamesp.h"
#include "acparser.h"
#define _COMPONENT ACPI_EXECUTER
ACPI_MODULE_NAME ("exdump")
/*
* The following routines are used for debug output only
*/
#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
/* Local prototypes */
static void
char *Title,
char *Value);
static void
char *Title,
void *Value);
static void
char *Title,
static void
static void
/*******************************************************************************
*
* Object Descriptor info tables
*
* Note: The first table entry must be an INIT opcode and must contain
* the table length (number of table entries)
*
******************************************************************************/
{
};
{
{ACPI_EXD_STRING, 0, NULL}
};
{
{ACPI_EXD_BUFFER, 0, NULL}
};
{
{ACPI_EXD_PACKAGE, 0, NULL}
};
{
};
{
};
{
};
{
};
{
};
{
};
{
};
{
};
{
{ACPI_EXD_FIELD, 0, NULL},
};
{
{ACPI_EXD_FIELD, 0, NULL},
};
{
{ACPI_EXD_FIELD, 0, NULL},
};
{
{ACPI_EXD_FIELD, 0, NULL},
};
{
{ACPI_EXD_REFERENCE,0, NULL}
};
{
};
{
};
/* Miscellaneous tables */
{
{ACPI_EXD_TYPE , 0, NULL},
};
{
};
{
};
/* Dispatch table, indexed by object type */
static ACPI_EXDUMP_INFO *AcpiExDumpInfo[] =
{
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
};
/*******************************************************************************
*
* FUNCTION: AcpiExDumpObject
*
* PARAMETERS: ObjDesc - Descriptor to dump
* Info - Info table corresponding to this object
* type
*
* RETURN: None
*
* DESCRIPTION: Walk the info table for this object
*
******************************************************************************/
static void
{
char *Name;
if (!Info)
{
"ExDumpObject: Display not implemented for object type %s\n",
return;
}
/* First table entry must contain the table length (# of table entries) */
while (Count)
{
{
case ACPI_EXD_INIT:
break;
case ACPI_EXD_TYPE:
break;
case ACPI_EXD_UINT8:
break;
case ACPI_EXD_UINT16:
break;
case ACPI_EXD_UINT32:
break;
case ACPI_EXD_UINT64:
break;
case ACPI_EXD_POINTER:
break;
case ACPI_EXD_ADDRESS:
break;
case ACPI_EXD_STRING:
AcpiOsPrintf ("\n");
break;
case ACPI_EXD_BUFFER:
break;
case ACPI_EXD_PACKAGE:
/* Dump the package contents */
AcpiOsPrintf ("\nPackage Contents:\n");
AcpiExDumpPackageObj (ObjDesc, 0, 0);
break;
case ACPI_EXD_FIELD:
break;
case ACPI_EXD_REFERENCE:
AcpiExOutString ("Opcode",
break;
default:
return;
}
Info++;
Count--;
}
}
/*******************************************************************************
*
* FUNCTION: AcpiExDumpOperand
*
* PARAMETERS: *ObjDesc - Pointer to entry to be dumped
* Depth - Current nesting depth
*
* RETURN: None
*
* DESCRIPTION: Dump an operand object
*
******************************************************************************/
void
{
ACPI_FUNCTION_NAME ("ExDumpOperand")
{
return;
}
if (!ObjDesc)
{
/* This could be a null element of a package */
return;
}
{
return;
}
{
"%p is not a node or operand object: [%s]\n",
return;
}
/* ObjDesc is a valid object */
if (Depth > 0)
{
}
else
{
}
/* Decode object type */
switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
{
{
case AML_DEBUG_OP:
AcpiOsPrintf ("Reference: Debug\n");
break;
case AML_NAME_OP:
break;
case AML_INDEX_OP:
AcpiOsPrintf ("Reference: Index %p\n",
break;
case AML_REF_OF_OP:
AcpiOsPrintf ("Reference: (RefOf) %p\n",
break;
case AML_ARG_OP:
AcpiOsPrintf ("Reference: Arg%d",
{
/* Value is an Integer */
AcpiOsPrintf (" value is [%8.8X%8.8x]",
}
AcpiOsPrintf ("\n");
break;
case AML_LOCAL_OP:
AcpiOsPrintf ("Reference: Local%d",
{
/* Value is an Integer */
AcpiOsPrintf (" value is [%8.8X%8.8x]",
}
AcpiOsPrintf ("\n");
break;
case AML_INT_NAMEPATH_OP:
AcpiOsPrintf ("Reference.Node->Name %X\n",
break;
default:
/* Unknown opcode */
AcpiOsPrintf ("Unknown Reference opcode=%X\n",
break;
}
break;
case ACPI_TYPE_BUFFER:
AcpiOsPrintf ("Buffer len %X @ %p\n",
if (Length > 64)
{
Length = 64;
}
/* Debug only -- dump the buffer contents */
{
AcpiOsPrintf ("Buffer Contents: ");
{
}
AcpiOsPrintf ("\n");
}
break;
case ACPI_TYPE_INTEGER:
AcpiOsPrintf ("Integer %8.8X%8.8X\n",
break;
case ACPI_TYPE_PACKAGE:
AcpiOsPrintf ("Package [Len %X] ElementArray %p\n",
/*
* If elements exist, package element pointer is valid,
* and debug_level exceeds 1, dump package's elements.
*/
AcpiDbgLevel > 1)
{
{
}
}
break;
case ACPI_TYPE_REGION:
AcpiOsPrintf ("Region %s (%X)",
/*
* If the address and length have not been evaluated,
* don't print them.
*/
{
AcpiOsPrintf ("\n");
}
else
{
AcpiOsPrintf (" base %8.8X%8.8X Length %X\n",
}
break;
case ACPI_TYPE_STRING:
AcpiOsPrintf ("String length %X @ %p ",
AcpiOsPrintf ("\n");
break;
AcpiOsPrintf ("BankField\n");
break;
"RegionField: Bits=%X AccWidth=%X Lock=%X Update=%X at byte=%X bit=%X of below:\n",
break;
AcpiOsPrintf ("IndexField\n");
break;
case ACPI_TYPE_BUFFER_FIELD:
"BufferField: %X bits at byte %X bit %X of\n",
{
}
{
AcpiOsPrintf ("*not a Buffer*\n");
}
else
{
}
break;
case ACPI_TYPE_EVENT:
AcpiOsPrintf ("Event\n");
break;
case ACPI_TYPE_METHOD:
AcpiOsPrintf ("Method(%X) @ %p:%X\n",
break;
case ACPI_TYPE_MUTEX:
AcpiOsPrintf ("Mutex\n");
break;
case ACPI_TYPE_DEVICE:
AcpiOsPrintf ("Device\n");
break;
case ACPI_TYPE_POWER:
AcpiOsPrintf ("Power\n");
break;
case ACPI_TYPE_PROCESSOR:
AcpiOsPrintf ("Processor\n");
break;
case ACPI_TYPE_THERMAL:
AcpiOsPrintf ("Thermal\n");
break;
default:
/* Unknown Type */
break;
}
return;
}
/*******************************************************************************
*
* FUNCTION: AcpiExDumpOperands
*
* PARAMETERS: Operands - Operand list
* InterpreterMode - Load or Exec
* Ident - Identification
* NumLevels - # of stack entries to dump above line
* Note - Output notation
* ModuleName - Caller's module name
* LineNumber - Caller's invocation line number
*
* DESCRIPTION: Dump the object stack
*
******************************************************************************/
void
char *Ident,
char *Note,
char *ModuleName,
{
ACPI_FUNCTION_NAME ("ExDumpOperands");
if (!Ident)
{
Ident = "?";
}
if (!Note)
{
Note = "?";
}
"************* Operand Stack Contents (Opcode [%s], %d Operands)\n",
if (NumLevels == 0)
{
NumLevels = 1;
}
/* Dump the operand stack starting at the top */
{
AcpiExDumpOperand (Operands[i], 0);
}
"************* Operand Stack dump from %s(%d), %s\n",
return;
}
/*******************************************************************************
*
* FUNCTION: AcpiExOut* functions
*
* PARAMETERS: Title - Descriptive text
* Value - Value to be displayed
*
* DESCRIPTION: Object dump output formatting functions. These functions
* reduce the number of format strings required and keeps them
* all in one place for easy modification.
*
******************************************************************************/
static void
char *Title,
char *Value)
{
}
static void
char *Title,
void *Value)
{
}
static void
char *Title,
{
#if ACPI_MACHINE_WIDTH == 16
#else
#endif
}
/*******************************************************************************
*
* FUNCTION: AcpiExDumpNamespaceNode
*
* PARAMETERS: Node - Descriptor to dump
* Flags - Force display if TRUE
*
* DESCRIPTION: Dumps the members of the given.Node
*
******************************************************************************/
void
{
if (!Flags)
{
{
return;
}
}
}
/*******************************************************************************
*
* FUNCTION: AcpiExDumpReferenceObj
*
* PARAMETERS: Object - Descriptor to dump
*
* DESCRIPTION: Dumps a reference object
*
******************************************************************************/
static void
{
{
if (ACPI_FAILURE (Status))
{
AcpiOsPrintf ("Could not convert name to pathname\n");
}
else
{
}
}
{
}
}
/*******************************************************************************
*
* FUNCTION: AcpiExDumpPackageObj
*
* PARAMETERS: ObjDesc - Descriptor to dump
* Level - Indentation Level
* Index - Package index for this object
*
* DESCRIPTION: Dumps the elements of the package
*
******************************************************************************/
static void
{
UINT32 i;
/* Indentation and index output */
if (Level > 0)
{
for (i = 0; i < Level; i++)
{
AcpiOsPrintf (" ");
}
}
/* Null package elements are allowed */
if (!ObjDesc)
{
AcpiOsPrintf ("[Null Object]\n");
return;
}
/* Packages may only contain a few object types */
switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
{
case ACPI_TYPE_INTEGER:
AcpiOsPrintf ("[Integer] = %8.8X%8.8X\n",
break;
case ACPI_TYPE_STRING:
AcpiOsPrintf ("[String] Value: ");
{
}
AcpiOsPrintf ("\n");
break;
case ACPI_TYPE_BUFFER:
{
}
else
{
AcpiOsPrintf ("\n");
}
break;
case ACPI_TYPE_PACKAGE:
AcpiOsPrintf ("[Package] Contains %d Elements:\n",
{
}
break;
AcpiOsPrintf ("[Object Reference] ");
break;
default:
break;
}
}
/*******************************************************************************
*
* FUNCTION: AcpiExDumpObjectDescriptor
*
* PARAMETERS: ObjDesc - Descriptor to dump
* Flags - Force display if TRUE
*
* DESCRIPTION: Dumps the members of the object descriptor given.
*
******************************************************************************/
void
{
ACPI_FUNCTION_TRACE ("ExDumpObjectDescriptor");
if (!ObjDesc)
{
}
if (!Flags)
{
{
}
}
{
AcpiOsPrintf ("\nAttached Object (%p):\n",
}
{
"ExDumpObjectDescriptor: %p is not an ACPI operand object: [%s]\n",
}
{
}
/* Common Fields */
/* Object-specific fields */
}
#endif