diff options
author | Jung-uk Kim <jkim@FreeBSD.org> | 2005-11-01 22:11:18 +0000 |
---|---|---|
committer | Jung-uk Kim <jkim@FreeBSD.org> | 2005-11-01 22:11:18 +0000 |
commit | fba7fc7e34e95963b681b882698b951b35d1ba48 (patch) | |
tree | 4450b2c84d749dd8a8425a8feb88b084809f6ef0 /sys/contrib/dev/acpica/nsdump.c | |
parent | 28f22a242b27179668329edee7235b98ed7e2af9 (diff) | |
download | src-test2-fba7fc7e34e95963b681b882698b951b35d1ba48.tar.gz src-test2-fba7fc7e34e95963b681b882698b951b35d1ba48.zip |
Notes
Diffstat (limited to 'sys/contrib/dev/acpica/nsdump.c')
-rw-r--r-- | sys/contrib/dev/acpica/nsdump.c | 188 |
1 files changed, 114 insertions, 74 deletions
diff --git a/sys/contrib/dev/acpica/nsdump.c b/sys/contrib/dev/acpica/nsdump.c index b345b28c03aa..007c20a37966 100644 --- a/sys/contrib/dev/acpica/nsdump.c +++ b/sys/contrib/dev/acpica/nsdump.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: nsdump - table dumping routines for debug - * $Revision: 160 $ + * $Revision: 1.172 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp. * All rights reserved. * * 2. License @@ -125,16 +125,32 @@ #define _COMPONENT ACPI_NAMESPACE ACPI_MODULE_NAME ("nsdump") +/* Local prototypes */ -#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) +#ifdef ACPI_OBSOLETE_FUNCTIONS +void +AcpiNsDumpRootDevices ( + void); + +static ACPI_STATUS +AcpiNsDumpOneDevice ( + ACPI_HANDLE ObjHandle, + UINT32 Level, + void *Context, + void **ReturnValue); +#endif + +#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) /******************************************************************************* * * FUNCTION: AcpiNsPrintPathname * - * PARAMETERS: NumSegment - Number of ACPI name segments + * PARAMETERS: NumSegments - Number of ACPI name segments * Pathname - The compressed (internal) path * + * RETURN: None + * * DESCRIPTION: Print an object's full namespace pathname * ******************************************************************************/ @@ -144,6 +160,9 @@ AcpiNsPrintPathname ( UINT32 NumSegments, char *Pathname) { + ACPI_NATIVE_UINT i; + + ACPI_FUNCTION_NAME ("NsPrintPathname"); @@ -158,9 +177,14 @@ AcpiNsPrintPathname ( while (NumSegments) { - AcpiOsPrintf ("%4.4s", Pathname); - Pathname += ACPI_NAME_SIZE; + for (i = 0; i < 4; i++) + { + ACPI_IS_PRINT (Pathname[i]) ? + AcpiOsPrintf ("%c", Pathname[i]) : + AcpiOsPrintf ("?"); + } + Pathname += ACPI_NAME_SIZE; NumSegments--; if (NumSegments) { @@ -181,6 +205,8 @@ AcpiNsPrintPathname ( * Level - Desired debug level * Component - Caller's component ID * + * RETURN: None + * * DESCRIPTION: Print an object's full namespace pathname * Manages allocation/freeing of a pathname buffer * @@ -216,9 +242,12 @@ AcpiNsDumpPathname ( * * FUNCTION: AcpiNsDumpOneObject * - * PARAMETERS: Handle - Node to be dumped + * PARAMETERS: ObjHandle - Node to be dumped * Level - Nesting level of the handle * Context - Passed into WalkNamespace + * ReturnValue - Not used + * + * RETURN: Status * * DESCRIPTION: Dump a single Node * This procedure is a UserFunction called by AcpiNsWalkNamespace. @@ -263,41 +292,46 @@ AcpiNsDumpOneObject ( /* Check if the owner matches */ - if ((Info->OwnerId != ACPI_UINT32_MAX) && + if ((Info->OwnerId != ACPI_OWNER_ID_MAX) && (Info->OwnerId != ThisNode->OwnerId)) { return (AE_OK); } - /* Indent the object according to the level */ + if (!(Info->DisplayType & ACPI_DISPLAY_SHORT)) + { + /* Indent the object according to the level */ - AcpiOsPrintf ("%2d%*s", (UINT32) Level - 1, (int) Level * 2, " "); + AcpiOsPrintf ("%2d%*s", (UINT32) Level - 1, (int) Level * 2, " "); - /* Check the node type and name */ + /* Check the node type and name */ - if (Type > ACPI_TYPE_LOCAL_MAX) - { - ACPI_REPORT_WARNING (("Invalid ACPI Type %08X\n", Type)); - } + if (Type > ACPI_TYPE_LOCAL_MAX) + { + ACPI_REPORT_WARNING (("Invalid ACPI Type %08X\n", Type)); + } - if (!AcpiUtValidAcpiName (ThisNode->Name.Integer)) - { - ACPI_REPORT_WARNING (("Invalid ACPI Name %08X\n", - ThisNode->Name.Integer)); + if (!AcpiUtValidAcpiName (ThisNode->Name.Integer)) + { + ACPI_REPORT_WARNING (("Invalid ACPI Name %08X\n", + ThisNode->Name.Integer)); + } + + AcpiOsPrintf ("%4.4s", AcpiUtGetNodeName (ThisNode)); } /* * Now we can print out the pertinent information */ - AcpiOsPrintf ("%4.4s %-12s %p ", - AcpiUtGetNodeName (ThisNode), AcpiUtGetTypeName (Type), ThisNode); + AcpiOsPrintf (" %-12s %p ", + AcpiUtGetTypeName (Type), ThisNode); DbgLevel = AcpiDbgLevel; AcpiDbgLevel = 0; ObjDesc = AcpiNsGetAttachedObject (ThisNode); AcpiDbgLevel = DbgLevel; - switch (Info->DisplayType) + switch (Info->DisplayType & ACPI_DISPLAY_MASK) { case ACPI_DISPLAY_SUMMARY: @@ -492,8 +526,7 @@ AcpiNsDumpOneObject ( return (AE_OK); } - AcpiOsPrintf ("(R%d)", - ObjDesc->Common.ReferenceCount); + AcpiOsPrintf ("(R%d)", ObjDesc->Common.ReferenceCount); switch (Type) { @@ -556,7 +589,7 @@ AcpiNsDumpOneObject ( while (ObjDesc) { ObjType = ACPI_TYPE_INVALID; - AcpiOsPrintf (" Attached Object %p: ", ObjDesc); + AcpiOsPrintf ("Attached Object %p: ", ObjDesc); /* Decode the type of attached object and dump the contents */ @@ -566,9 +599,9 @@ AcpiNsDumpOneObject ( AcpiOsPrintf ("(Ptr to Node)\n"); BytesToDump = sizeof (ACPI_NAMESPACE_NODE); + ACPI_DUMP_BUFFER (ObjDesc, BytesToDump); break; - case ACPI_DESC_TYPE_OPERAND: ObjType = ACPI_GET_OBJECT_TYPE (ObjDesc); @@ -581,24 +614,19 @@ AcpiNsDumpOneObject ( } else { - AcpiOsPrintf ("(Ptr to ACPI Object type %s, %X)\n", - AcpiUtGetTypeName (ObjType), ObjType); + AcpiOsPrintf ("(Ptr to ACPI Object type %X [%s])\n", + ObjType, AcpiUtGetTypeName (ObjType)); BytesToDump = sizeof (ACPI_OPERAND_OBJECT); } - break; + ACPI_DUMP_BUFFER (ObjDesc, BytesToDump); + break; default: - AcpiOsPrintf ( - "(String or Buffer ptr - not an object descriptor) [%s]\n", - AcpiUtGetDescriptorName (ObjDesc)); - BytesToDump = 16; break; } - ACPI_DUMP_BUFFER (ObjDesc, BytesToDump); - /* If value is NOT an internal object, we are done */ if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) != ACPI_DESC_TYPE_OPERAND) @@ -611,13 +639,17 @@ AcpiNsDumpOneObject ( */ switch (ObjType) { + case ACPI_TYPE_BUFFER: case ACPI_TYPE_STRING: + /* + * NOTE: takes advantage of common fields between string/buffer + */ + BytesToDump = ObjDesc->String.Length; ObjDesc = (void *) ObjDesc->String.Pointer; - break; - - case ACPI_TYPE_BUFFER: - ObjDesc = (void *) ObjDesc->Buffer.Pointer; - break; + AcpiOsPrintf ( "(Buffer/String pointer %p length %X)\n", + ObjDesc, BytesToDump); + ACPI_DUMP_BUFFER (ObjDesc, BytesToDump); + goto Cleanup; case ACPI_TYPE_BUFFER_FIELD: ObjDesc = (ACPI_OPERAND_OBJECT *) ObjDesc->BufferField.BufferObj; @@ -661,12 +693,15 @@ Cleanup: * FUNCTION: AcpiNsDumpObjects * * PARAMETERS: Type - Object type to be dumped + * DisplayType - 0 or ACPI_DISPLAY_SUMMARY * MaxDepth - Maximum depth of dump. Use ACPI_UINT32_MAX * for an effectively unlimited depth. * OwnerId - Dump only objects owned by this ID. Use * ACPI_UINT32_MAX to match all owners. * StartHandle - Where in namespace to start/end search * + * RETURN: None + * * DESCRIPTION: Dump typed objects within the loaded namespace. * Uses AcpiNsWalkNamespace in conjunction with AcpiNsDumpOneObject. * @@ -677,7 +712,7 @@ AcpiNsDumpObjects ( ACPI_OBJECT_TYPE Type, UINT8 DisplayType, UINT32 MaxDepth, - UINT32 OwnerId, + ACPI_OWNER_ID OwnerId, ACPI_HANDLE StartHandle) { ACPI_WALK_INFO Info; @@ -698,6 +733,39 @@ AcpiNsDumpObjects ( /******************************************************************************* * + * FUNCTION: AcpiNsDumpEntry + * + * PARAMETERS: Handle - Node to be dumped + * DebugLevel - Output level + * + * RETURN: None + * + * DESCRIPTION: Dump a single Node + * + ******************************************************************************/ + +void +AcpiNsDumpEntry ( + ACPI_HANDLE Handle, + UINT32 DebugLevel) +{ + ACPI_WALK_INFO Info; + + + ACPI_FUNCTION_ENTRY (); + + + Info.DebugLevel = DebugLevel; + Info.OwnerId = ACPI_OWNER_ID_MAX; + Info.DisplayType = ACPI_DISPLAY_SUMMARY; + + (void) AcpiNsDumpOneObject (Handle, 1, &Info, NULL); +} + + +#ifdef ACPI_ASL_COMPILER +/******************************************************************************* + * * FUNCTION: AcpiNsDumpTables * * PARAMETERS: SearchBase - Root of subtree to be dumped, or @@ -705,6 +773,8 @@ AcpiNsDumpObjects ( * MaxDepth - Maximum depth of dump. Use INT_MAX * for an effectively unlimited depth. * + * RETURN: None + * * DESCRIPTION: Dump the name space, or a portion of it. * ******************************************************************************/ @@ -732,46 +802,16 @@ AcpiNsDumpTables ( if (ACPI_NS_ALL == SearchBase) { - /* entire namespace */ + /* Entire namespace */ SearchHandle = AcpiGbl_RootNode; ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "\\\n")); } AcpiNsDumpObjects (ACPI_TYPE_ANY, ACPI_DISPLAY_OBJECTS, MaxDepth, - ACPI_UINT32_MAX, SearchHandle); + ACPI_OWNER_ID_MAX, SearchHandle); return_VOID; } - - -/******************************************************************************* - * - * FUNCTION: AcpiNsDumpEntry - * - * PARAMETERS: Handle - Node to be dumped - * DebugLevel - Output level - * - * DESCRIPTION: Dump a single Node - * - ******************************************************************************/ - -void -AcpiNsDumpEntry ( - ACPI_HANDLE Handle, - UINT32 DebugLevel) -{ - ACPI_WALK_INFO Info; - - - ACPI_FUNCTION_ENTRY (); - - - Info.DebugLevel = DebugLevel; - Info.OwnerId = ACPI_UINT32_MAX; - Info.DisplayType = ACPI_DISPLAY_SUMMARY; - - (void) AcpiNsDumpOneObject (Handle, 1, &Info, NULL); -} - +#endif #endif |