Debugger: Add Template command to dump resource templates.

Will format/dump any buffer object that is also a resource
template.
This commit is contained in:
Robert Moore 2011-10-28 14:18:51 -07:00
parent c543c59676
commit eb513d0723
3 changed files with 83 additions and 0 deletions

View File

@ -526,6 +526,78 @@ AcpiDbDisplayInterfaces (
}
/*******************************************************************************
*
* FUNCTION: AcpiDbDisplayTemplate
*
* PARAMETERS: BufferArg - Buffer name or addrss
*
* RETURN: None
*
* DESCRIPTION: Dump a buffer that contains a resource template
*
******************************************************************************/
void
AcpiDbDisplayTemplate (
char *BufferArg)
{
ACPI_NAMESPACE_NODE *Node;
ACPI_STATUS Status;
ACPI_BUFFER ReturnObj;
/* Translate BufferArg to an Named object */
Node = AcpiDbConvertToNode (BufferArg);
if (!Node || (Node == AcpiGbl_RootNode))
{
AcpiOsPrintf ("Invalid argument: %s\n", BufferArg);
return;
}
/* We must have a buffer object */
if (Node->Type != ACPI_TYPE_BUFFER)
{
AcpiOsPrintf ("Not a Buffer object, cannot be a template: %s\n",
BufferArg);
return;
}
ReturnObj.Length = ACPI_DEBUG_BUFFER_SIZE;
ReturnObj.Pointer = AcpiGbl_DbBuffer;
/* Attempt to convert the raw buffer to a resource list */
Status = AcpiRsCreateResourceList (Node->Object, &ReturnObj);
AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT);
AcpiDbgLevel |= ACPI_LV_RESOURCES;
if (ACPI_FAILURE (Status))
{
AcpiOsPrintf ("Could not convert Buffer to a resource list: %s, %s\n",
BufferArg, AcpiFormatException (Status));
goto DumpBuffer;
}
/* Now we can dump the resource list */
AcpiRsDumpResourceList (ACPI_CAST_PTR (ACPI_RESOURCE,
ReturnObj.Pointer));
DumpBuffer:
AcpiOsPrintf ("\nRaw data buffer:\n");
AcpiUtDumpBuffer ((UINT8 *) Node->Object->Buffer.Pointer,
Node->Object->Buffer.Length,
DB_BYTE_DISPLAY, ACPI_UINT32_MAX);
AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT);
return;
}
/*******************************************************************************
*
* FUNCTION: AcpiDmCompareAmlResources

View File

@ -203,6 +203,7 @@ enum AcpiExDebuggerCommands
CMD_STATS,
CMD_STOP,
CMD_TABLES,
CMD_TEMPLATE,
CMD_TERMINATE,
CMD_THREADS,
CMD_TRACE,
@ -271,6 +272,7 @@ static const COMMAND_INFO AcpiGbl_DbCommands[] =
{"STATS", 0},
{"STOP", 0},
{"TABLES", 0},
{"TEMPLATE", 1},
{"TERMINATE", 0},
{"THREADS", 3},
{"TRACE", 1},
@ -343,6 +345,7 @@ AcpiDbDisplayHelp (
AcpiOsPrintf (" Resources <Device> Get and display Device resources\n");
AcpiOsPrintf (" Set N <NamedObject> <Value> Set value for named integer\n");
AcpiOsPrintf (" Sleep <SleepState> Simulate sleep/wake sequence\n");
AcpiOsPrintf (" Template <Object> Format/dump a Buffer/ResourceTemplate\n");
AcpiOsPrintf (" Terminate Delete namespace and all internal objects\n");
AcpiOsPrintf (" Type <Object> Display object type\n");
@ -926,6 +929,10 @@ AcpiDbCommandDispatch (
AcpiDbDisplayTableInfo (AcpiGbl_DbArgs[1]);
break;
case CMD_TEMPLATE:
AcpiDbDisplayTemplate (AcpiGbl_DbArgs[1]);
break;
case CMD_TERMINATE:
AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT);
AcpiUtSubsystemShutdown ();

View File

@ -178,6 +178,10 @@ void
AcpiDbDisplayTableInfo (
char *TableArg);
void
AcpiDbDisplayTemplate (
char *BufferArg);
void
AcpiDbUnloadAcpiTable (
char *TableArg,