/******************************************************************************
*
* Module Name: exdump - Interpreter debug output routines
*
*****************************************************************************/
/*
* Copyright (C) 2000 - 2016, 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 "acinterp.h"
#include "amlcode.h"
#include "acnamesp.h"
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
const char *Title,
const char *Value);
static void
const char *Title,
const void *Value);
static void
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 */
{
NULL,
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
{
const 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:
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:
break;
case ACPI_EXD_LIST:
if (Next)
{
AcpiOsPrintf ("(%s %2.2X)",
{
!Data)
{
}
{
"\n**** Error: Object list appears to be circular linked");
break;
}
}
}
AcpiOsPrintf ("\n");
break;
case ACPI_EXD_HDLR_LIST:
if (Next)
{
AcpiOsPrintf ("(%s %2.2X)",
{
!Data)
{
}
{
"\n**** Error: Handler list appears to be circular linked");
break;
}
}
}
AcpiOsPrintf ("\n");
break;
case ACPI_EXD_RGN_LIST:
if (Next)
{
AcpiOsPrintf ("(%s %2.2X)",
{
!Data)
{
}
{
"\n**** Error: Region list appears to be circular linked");
break;
}
}
}
AcpiOsPrintf ("\n");
break;
case ACPI_EXD_NODE:
if (Node)
{
}
AcpiOsPrintf ("\n");
break;
default:
AcpiOsPrintf ("**** Invalid table opcode [%X] ****\n",
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
{
/* Check if debug output enabled */
{
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 */
{
AcpiOsPrintf ("Reference: [%s] ",
{
case ACPI_REFCLASS_DEBUG:
AcpiOsPrintf ("\n");
break;
case ACPI_REFCLASS_INDEX:
break;
case ACPI_REFCLASS_TABLE:
break;
case ACPI_REFCLASS_REFOF:
break;
case ACPI_REFCLASS_NAME:
AcpiOsPrintf ("- [%4.4s]\n",
break;
case ACPI_REFCLASS_ARG:
case ACPI_REFCLASS_LOCAL:
break;
default: /* Unknown reference class */
break;
}
break;
case ACPI_TYPE_BUFFER:
AcpiOsPrintf ("Buffer length %.2X @ %p\n",
/* Debug only -- dump the buffer contents */
{
if (Length > 128)
{
Length = 128;
}
"Buffer Contents: (displaying length 0x%.2X)\n", Length);
}
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;
AcpiOsPrintf ("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:
AcpiOsPrintf ("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 - A list of Operand objects
* OpcodeName - AML opcode name
* NumOperands - Operand count for this opcode
*
* DESCRIPTION: Dump the operands associated with the opcode
*
******************************************************************************/
void
const char *OpcodeName,
{
if (!OpcodeName)
{
OpcodeName = "UNKNOWN";
}
"**** Start operand dump for opcode [%s], %u operands\n",
if (NumOperands == 0)
{
NumOperands = 1;
}
/* Dump the individual operands */
while (NumOperands)
{
AcpiExDumpOperand (*Operands, 0);
Operands++;
NumOperands--;
}
"**** End operand dump for [%s]\n", OpcodeName));
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
const char *Title,
const char *Value)
{
}
static void
const char *Title,
const void *Value)
{
}
/*******************************************************************************
*
* FUNCTION: AcpiExDumpNamespaceNode
*
* PARAMETERS: Node - Descriptor to dump
* Flags - Force display if TRUE
*
* DESCRIPTION: Dumps the members of the given.Node
*
******************************************************************************/
void
{
if (!Flags)
{
/* Check if debug output enabled */
{
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
{
}
}
{
{
{
AcpiOsPrintf (" Table Index: %X\n",
}
else
{
AcpiOsPrintf (" [%s]\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 */
{
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 %u Elements:\n",
{
}
break;
AcpiOsPrintf ("[Object Reference] Type [%s] %2.2X",
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
{
if (!ObjDesc)
{
}
if (!Flags)
{
/* Check if debug output enabled */
{
}
}
{
AcpiOsPrintf ("\nAttached Object (%p):\n",
goto DumpObject;
}
{
"%p is not an ACPI operand object: [%s]\n",
}
/* Validate the object type */
{
AcpiOsPrintf ("Not a known object type: %2.2X\n",
}
/* Common Fields */
/* Object-specific fields */
{
{
"Secondary object is not a known object type: %2.2X\n",
}
}
}
#endif