diff options
Diffstat (limited to 'sys/contrib/dev/acpica/nsdump.c')
-rw-r--r-- | sys/contrib/dev/acpica/nsdump.c | 133 |
1 files changed, 71 insertions, 62 deletions
diff --git a/sys/contrib/dev/acpica/nsdump.c b/sys/contrib/dev/acpica/nsdump.c index f2b0b3549d86..ee74fee10873 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: 116 $ + * $Revision: 127 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp. * All rights reserved. * * 2. License @@ -125,7 +125,7 @@ #define _COMPONENT ACPI_NAMESPACE - MODULE_NAME ("nsdump") + ACPI_MODULE_NAME ("nsdump") #if defined(ACPI_DEBUG) || defined(ENABLE_DEBUGGER) @@ -146,9 +146,7 @@ AcpiNsPrintPathname ( UINT32 NumSegments, char *Pathname) { - UINT32 i; - - PROC_NAME ("AcpiNsPrintPathname"); + ACPI_FUNCTION_NAME ("AcpiNsPrintPathname"); if (!(AcpiDbgLevel & ACPI_LV_NAMES) || !(AcpiDbgLayer & ACPI_NAMESPACE)) @@ -160,9 +158,16 @@ AcpiNsPrintPathname ( ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "[")); - for (i = 0; i < NumSegments; i++) + while (NumSegments) { - AcpiOsPrintf ("%4.4s.", (char *) &Pathname[i * 4]); + AcpiOsPrintf ("%4.4s", Pathname); + Pathname += ACPI_NAME_SIZE; + + NumSegments--; + if (NumSegments) + { + AcpiOsPrintf ("."); + } } AcpiOsPrintf ("]\n"); @@ -190,11 +195,11 @@ AcpiNsDumpPathname ( UINT32 Level, UINT32 Component) { - NATIVE_CHAR *Buffer; - UINT32 Length; + ACPI_BUFFER Buffer; + ACPI_STATUS Status; - FUNCTION_TRACE ("NsDumpPathname"); + ACPI_FUNCTION_TRACE ("NsDumpPathname"); /* Do this only if the requested debug level and component are enabled */ @@ -204,23 +209,18 @@ AcpiNsDumpPathname ( return_ACPI_STATUS (AE_OK); } - Buffer = ACPI_MEM_ALLOCATE (PATHNAME_MAX); - if (!Buffer) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } - /* Convert handle to a full pathname and print it (with supplied message) */ - Length = PATHNAME_MAX; - if (ACPI_SUCCESS (AcpiNsHandleToPathname (Handle, &Length, Buffer))) + Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER; + + Status = AcpiNsHandleToPathname (Handle, &Buffer); + if (ACPI_SUCCESS (Status)) { - AcpiOsPrintf ("%s %s (Node %p)\n", Msg, Buffer, Handle); + AcpiOsPrintf ("%s %s (Node %p)\n", Msg, Buffer.Pointer, Handle); + ACPI_MEM_FREE (Buffer.Pointer); } - ACPI_MEM_FREE (Buffer); - - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS (Status); } @@ -247,16 +247,17 @@ AcpiNsDumpOneObject ( ACPI_WALK_INFO *Info = (ACPI_WALK_INFO *) Context; ACPI_NAMESPACE_NODE *ThisNode; ACPI_OPERAND_OBJECT *ObjDesc = NULL; - ACPI_OBJECT_TYPE8 ObjType; - ACPI_OBJECT_TYPE8 Type; + ACPI_OBJECT_TYPE ObjType; + ACPI_OBJECT_TYPE Type; UINT32 BytesToDump; UINT32 DownstreamSiblingMask = 0; UINT32 LevelTmp; UINT32 WhichBit; UINT32 i; + UINT32 DbgLevel; - PROC_NAME ("NsDumpOneObject"); + ACPI_FUNCTION_NAME ("NsDumpOneObject"); ThisNode = AcpiNsMapHandleToNode (ObjHandle); @@ -271,11 +272,6 @@ AcpiNsDumpOneObject ( return (AE_OK); } - if (!((ACPI_LV_TABLES & AcpiDbgLevel) && (_COMPONENT & AcpiDbgLayer))) - { - return (AE_OK); - } - if (!ObjHandle) { ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Null object handle\n")); @@ -346,7 +342,7 @@ AcpiNsDumpOneObject ( if (!AcpiUtValidAcpiName (ThisNode->Name)) { - REPORT_WARNING (("Invalid ACPI Name %08X\n", ThisNode->Name)); + ACPI_REPORT_WARNING (("Invalid ACPI Name %08X\n", ThisNode->Name)); } /* @@ -355,7 +351,10 @@ AcpiNsDumpOneObject ( AcpiOsPrintf (" %4.4s %-12s %p", (char *) &ThisNode->Name, AcpiUtGetTypeName (Type), ThisNode); + DbgLevel = AcpiDbgLevel; + AcpiDbgLevel = 0; ObjDesc = AcpiNsGetAttachedObject (ThisNode); + AcpiDbgLevel = DbgLevel; switch (Info->DisplayType) { @@ -391,8 +390,8 @@ AcpiNsDumpOneObject ( case ACPI_TYPE_INTEGER: AcpiOsPrintf (" = %8.8X%8.8X\n", - HIDWORD (ObjDesc->Integer.Value), - LODWORD (ObjDesc->Integer.Value)); + ACPI_HIDWORD (ObjDesc->Integer.Value), + ACPI_LODWORD (ObjDesc->Integer.Value)); break; case ACPI_TYPE_PACKAGE: @@ -432,8 +431,8 @@ AcpiNsDumpOneObject ( if (ObjDesc->Region.Flags & AOPOBJ_DATA_VALID) { AcpiOsPrintf (" Addr %8.8X%8.8X Len %.4X\n", - HIDWORD(ObjDesc->Region.Address), - LODWORD(ObjDesc->Region.Address), + ACPI_HIDWORD (ObjDesc->Region.Address), + ACPI_LODWORD (ObjDesc->Region.Address), ObjDesc->Region.Length); } else @@ -490,7 +489,7 @@ AcpiNsDumpOneObject ( (ObjDesc->CommonField.BaseByteOffset * 8) + ObjDesc->CommonField.StartFieldBitOffset, ObjDesc->CommonField.BitLength, - ObjDesc->CommonField.AccessBitWidth); + ObjDesc->CommonField.AccessByteWidth); break; } @@ -525,8 +524,8 @@ AcpiNsDumpOneObject ( case ACPI_TYPE_INTEGER: - AcpiOsPrintf (" N:%X%X\n", HIDWORD(ObjDesc->Integer.Value), - LODWORD(ObjDesc->Integer.Value)); + AcpiOsPrintf (" N:%X%X\n", ACPI_HIDWORD(ObjDesc->Integer.Value), + ACPI_LODWORD(ObjDesc->Integer.Value)); break; case ACPI_TYPE_STRING: @@ -564,26 +563,31 @@ AcpiNsDumpOneObject ( /* If there is an attached object, display it */ + DbgLevel = AcpiDbgLevel; + AcpiDbgLevel = 0; ObjDesc = AcpiNsGetAttachedObject (ThisNode); + AcpiDbgLevel = DbgLevel; /* Dump attached objects */ while (ObjDesc) { ObjType = INTERNAL_TYPE_INVALID; + AcpiOsPrintf (" Attached Object %p: ", ObjDesc); /* Decode the type of attached object and dump the contents */ - AcpiOsPrintf (" Attached Object %p: ", ObjDesc); - - if (VALID_DESCRIPTOR_TYPE (ObjDesc, ACPI_DESC_TYPE_NAMED)) + switch (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc)) { + case ACPI_DESC_TYPE_NAMED: + AcpiOsPrintf ("(Ptr to Node)\n"); BytesToDump = sizeof (ACPI_NAMESPACE_NODE); - } + break; + + + case ACPI_DESC_TYPE_INTERNAL: - else if (VALID_DESCRIPTOR_TYPE (ObjDesc, ACPI_DESC_TYPE_INTERNAL)) - { ObjType = ObjDesc->Common.Type; if (ObjType > INTERNAL_TYPE_MAX) @@ -597,18 +601,21 @@ AcpiNsDumpOneObject ( ObjType, AcpiUtGetTypeName (ObjType)); BytesToDump = sizeof (ACPI_OPERAND_OBJECT); } - } - else - { - AcpiOsPrintf ("(String or Buffer - not descriptor)\n"); + break; + + + default: + + AcpiOsPrintf ("(String or Buffer ptr - not an object descriptor)\n"); BytesToDump = 16; + break; } - DUMP_BUFFER (ObjDesc, BytesToDump); + ACPI_DUMP_BUFFER (ObjDesc, BytesToDump); /* If value is NOT an internal object, we are done */ - if (VALID_DESCRIPTOR_TYPE (ObjDesc, ACPI_DESC_TYPE_NAMED)) + if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) != ACPI_DESC_TYPE_INTERNAL) { goto Cleanup; } @@ -681,7 +688,7 @@ Cleanup: void AcpiNsDumpObjects ( - ACPI_OBJECT_TYPE8 Type, + ACPI_OBJECT_TYPE Type, UINT8 DisplayType, UINT32 MaxDepth, UINT32 OwnerId, @@ -690,7 +697,7 @@ AcpiNsDumpObjects ( ACPI_WALK_INFO Info; - FUNCTION_ENTRY (); + ACPI_FUNCTION_ENTRY (); Info.DebugLevel = ACPI_LV_TABLES; @@ -698,7 +705,7 @@ AcpiNsDumpObjects ( Info.DisplayType = DisplayType; - AcpiNsWalkNamespace (Type, StartHandle, MaxDepth, NS_WALK_NO_UNLOCK, AcpiNsDumpOneObject, + AcpiNsWalkNamespace (Type, StartHandle, MaxDepth, ACPI_NS_WALK_NO_UNLOCK, AcpiNsDumpOneObject, (void *) &Info, NULL); } @@ -729,7 +736,7 @@ AcpiNsDumpOneDevice ( UINT32 i; - PROC_NAME ("NsDumpOneDevice"); + ACPI_FUNCTION_NAME ("NsDumpOneDevice"); Status = AcpiNsDumpOneObject (ObjHandle, Level, Context, ReturnValue); @@ -743,7 +750,9 @@ AcpiNsDumpOneDevice ( } ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " HID: %s, ADR: %8.8X%8.8X, Status: %x\n", - Info.HardwareId, HIDWORD(Info.Address), LODWORD(Info.Address), Info.CurrentStatus)); + Info.HardwareId, + ACPI_HIDWORD (Info.Address), ACPI_LODWORD (Info.Address), + Info.CurrentStatus)); } return (Status); @@ -766,7 +775,7 @@ AcpiNsDumpRootDevices (void) ACPI_HANDLE SysBusHandle; - PROC_NAME ("NsDumpRootDevices"); + ACPI_FUNCTION_NAME ("NsDumpRootDevices"); /* Only dump the table if tracing is enabled */ @@ -776,10 +785,10 @@ AcpiNsDumpRootDevices (void) return; } - AcpiGetHandle (0, NS_SYSTEM_BUS, &SysBusHandle); + AcpiGetHandle (0, ACPI_NS_SYSTEM_BUS, &SysBusHandle); ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "Display of all devices in the namespace:\n")); - AcpiNsWalkNamespace (ACPI_TYPE_DEVICE, SysBusHandle, ACPI_UINT32_MAX, NS_WALK_NO_UNLOCK, + AcpiNsWalkNamespace (ACPI_TYPE_DEVICE, SysBusHandle, ACPI_UINT32_MAX, ACPI_NS_WALK_NO_UNLOCK, AcpiNsDumpOneDevice, NULL, NULL); } @@ -806,7 +815,7 @@ AcpiNsDumpTables ( ACPI_HANDLE SearchHandle = SearchBase; - FUNCTION_TRACE ("NsDumpTables"); + ACPI_FUNCTION_TRACE ("NsDumpTables"); if (!AcpiGbl_RootNode) @@ -819,7 +828,7 @@ AcpiNsDumpTables ( return_VOID; } - if (NS_ALL == SearchBase) + if (ACPI_NS_ALL == SearchBase) { /* entire namespace */ @@ -853,7 +862,7 @@ AcpiNsDumpEntry ( ACPI_WALK_INFO Info; - FUNCTION_ENTRY (); + ACPI_FUNCTION_ENTRY (); Info.DebugLevel = DebugLevel; |