Print this page
update to acpica-unix2-20130927
acpica-unix2-20130823
PANKOVs restructure

*** 3,13 **** * Module Name: nsdump - table dumping routines for debug * *****************************************************************************/ /* ! * Copyright (C) 2000 - 2011, 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: --- 3,13 ---- * Module Name: nsdump - table dumping routines for debug * *****************************************************************************/ /* ! * Copyright (C) 2000 - 2013, 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:
*** 44,53 **** --- 44,54 ---- #define __NSDUMP_C__ #include "acpi.h" #include "accommon.h" #include "acnamesp.h" + #include "acoutput.h" #define _COMPONENT ACPI_NAMESPACE ACPI_MODULE_NAME ("nsdump")
*** 66,75 **** --- 67,92 ---- void **ReturnValue); #endif #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) + + static ACPI_STATUS + AcpiNsDumpOneObjectPath ( + ACPI_HANDLE ObjHandle, + UINT32 Level, + void *Context, + void **ReturnValue); + + static ACPI_STATUS + AcpiNsGetMaxDepth ( + ACPI_HANDLE ObjHandle, + UINT32 Level, + void *Context, + void **ReturnValue); + + /******************************************************************************* * * FUNCTION: AcpiNsPrintPathname * * PARAMETERS: NumSegments - Number of ACPI name segments
*** 90,100 **** ACPI_FUNCTION_NAME (NsPrintPathname); ! if (!(AcpiDbgLevel & ACPI_LV_NAMES) || !(AcpiDbgLayer & ACPI_NAMESPACE)) { return; } /* Print the entire name */ --- 107,119 ---- ACPI_FUNCTION_NAME (NsPrintPathname); ! /* Check if debug output enabled */ ! ! if (!ACPI_IS_DEBUG_ENABLED (ACPI_LV_NAMES, ACPI_NAMESPACE)) { return; } /* Print the entire name */
*** 149,159 **** ACPI_FUNCTION_TRACE (NsDumpPathname); /* Do this only if the requested debug level and component are enabled */ ! if (!(AcpiDbgLevel & Level) || !(AcpiDbgLayer & Component)) { return_VOID; } /* Convert handle to a full pathname and print it (with supplied message) */ --- 168,178 ---- ACPI_FUNCTION_TRACE (NsDumpPathname); /* Do this only if the requested debug level and component are enabled */ ! if (!ACPI_IS_DEBUG_ENABLED (Level, Component)) { return_VOID; } /* Convert handle to a full pathname and print it (with supplied message) */
*** 268,314 **** { case ACPI_DISPLAY_SUMMARY: if (!ObjDesc) { ! /* No attached object, we are done */ AcpiOsPrintf ("\n"); return (AE_OK); } switch (Type) { case ACPI_TYPE_PROCESSOR: ! AcpiOsPrintf ("ID %X Len %.4X Addr %p\n", ObjDesc->Processor.ProcId, ObjDesc->Processor.Length, ACPI_CAST_PTR (void, ObjDesc->Processor.Address)); break; - case ACPI_TYPE_DEVICE: AcpiOsPrintf ("Notify Object: %p\n", ObjDesc); break; - case ACPI_TYPE_METHOD: AcpiOsPrintf ("Args %X Len %.4X Aml %p\n", (UINT32) ObjDesc->Method.ParamCount, ObjDesc->Method.AmlLength, ObjDesc->Method.AmlStart); break; - case ACPI_TYPE_INTEGER: AcpiOsPrintf ("= %8.8X%8.8X\n", ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value)); break; - case ACPI_TYPE_PACKAGE: if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID) { AcpiOsPrintf ("Elements %.2X\n", --- 287,345 ---- { case ACPI_DISPLAY_SUMMARY: if (!ObjDesc) { ! /* No attached object. Some types should always have an object */ + switch (Type) + { + case ACPI_TYPE_INTEGER: + case ACPI_TYPE_PACKAGE: + case ACPI_TYPE_BUFFER: + case ACPI_TYPE_STRING: + case ACPI_TYPE_METHOD: + + AcpiOsPrintf ("<No attached object>"); + break; + + default: + + break; + } + AcpiOsPrintf ("\n"); return (AE_OK); } switch (Type) { case ACPI_TYPE_PROCESSOR: ! AcpiOsPrintf ("ID %02X Len %02X Addr %p\n", ObjDesc->Processor.ProcId, ObjDesc->Processor.Length, ACPI_CAST_PTR (void, ObjDesc->Processor.Address)); break; case ACPI_TYPE_DEVICE: AcpiOsPrintf ("Notify Object: %p\n", ObjDesc); break; case ACPI_TYPE_METHOD: AcpiOsPrintf ("Args %X Len %.4X Aml %p\n", (UINT32) ObjDesc->Method.ParamCount, ObjDesc->Method.AmlLength, ObjDesc->Method.AmlStart); break; case ACPI_TYPE_INTEGER: AcpiOsPrintf ("= %8.8X%8.8X\n", ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value)); break; case ACPI_TYPE_PACKAGE: if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID) { AcpiOsPrintf ("Elements %.2X\n",
*** 318,328 **** { AcpiOsPrintf ("[Length not yet evaluated]\n"); } break; - case ACPI_TYPE_BUFFER: if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID) { AcpiOsPrintf ("Len %.2X", --- 349,358 ----
*** 344,362 **** { AcpiOsPrintf ("[Length not yet evaluated]\n"); } break; - case ACPI_TYPE_STRING: AcpiOsPrintf ("Len %.2X ", ObjDesc->String.Length); AcpiUtPrintString (ObjDesc->String.Pointer, 32); AcpiOsPrintf ("\n"); break; - case ACPI_TYPE_REGION: AcpiOsPrintf ("[%s]", AcpiUtGetRegionName (ObjDesc->Region.SpaceId)); if (ObjDesc->Region.Flags & AOPOBJ_DATA_VALID) --- 374,390 ----
*** 369,385 **** { AcpiOsPrintf (" [Address/Length not yet evaluated]\n"); } break; - case ACPI_TYPE_LOCAL_REFERENCE: AcpiOsPrintf ("[%s]\n", AcpiUtGetReferenceName (ObjDesc)); break; - case ACPI_TYPE_BUFFER_FIELD: if (ObjDesc->BufferField.BufferObj && ObjDesc->BufferField.BufferObj->Buffer.Node) { --- 397,411 ----
*** 387,425 **** AcpiUtGetNodeName ( ObjDesc->BufferField.BufferObj->Buffer.Node)); } break; - case ACPI_TYPE_LOCAL_REGION_FIELD: AcpiOsPrintf ("Rgn [%4.4s]", AcpiUtGetNodeName ( ObjDesc->CommonField.RegionObj->Region.Node)); break; - case ACPI_TYPE_LOCAL_BANK_FIELD: AcpiOsPrintf ("Rgn [%4.4s] Bnk [%4.4s]", AcpiUtGetNodeName ( ObjDesc->CommonField.RegionObj->Region.Node), AcpiUtGetNodeName ( ObjDesc->BankField.BankObj->CommonField.Node)); break; - case ACPI_TYPE_LOCAL_INDEX_FIELD: AcpiOsPrintf ("Idx [%4.4s] Dat [%4.4s]", AcpiUtGetNodeName ( ObjDesc->IndexField.IndexObj->CommonField.Node), AcpiUtGetNodeName ( ObjDesc->IndexField.DataObj->CommonField.Node)); break; - case ACPI_TYPE_LOCAL_ALIAS: case ACPI_TYPE_LOCAL_METHOD_ALIAS: AcpiOsPrintf ("Target %4.4s (%p)\n", AcpiUtGetNodeName (ObjDesc), ObjDesc); --- 413,447 ----
*** 446,460 **** ObjDesc->CommonField.BitLength, ObjDesc->CommonField.AccessByteWidth); break; default: break; } break; - case ACPI_DISPLAY_OBJECTS: AcpiOsPrintf ("O:%p", ObjDesc); if (!ObjDesc) { --- 468,482 ---- ObjDesc->CommonField.BitLength, ObjDesc->CommonField.AccessByteWidth); break; default: + break; } break; case ACPI_DISPLAY_OBJECTS: AcpiOsPrintf ("O:%p", ObjDesc); if (!ObjDesc) {
*** 499,509 **** AcpiOsPrintf ("\n"); break; } break; - default: AcpiOsPrintf ("\n"); break; } --- 521,530 ----
*** 586,619 **** --- 607,647 ---- ObjDesc, BytesToDump); ACPI_DUMP_BUFFER (ObjDesc, BytesToDump); goto Cleanup; case ACPI_TYPE_BUFFER_FIELD: + ObjDesc = (ACPI_OPERAND_OBJECT *) ObjDesc->BufferField.BufferObj; break; case ACPI_TYPE_PACKAGE: + ObjDesc = (void *) ObjDesc->Package.Elements; break; case ACPI_TYPE_METHOD: + ObjDesc = (void *) ObjDesc->Method.AmlStart; break; case ACPI_TYPE_LOCAL_REGION_FIELD: + ObjDesc = (void *) ObjDesc->Field.RegionObj; break; case ACPI_TYPE_LOCAL_BANK_FIELD: + ObjDesc = (void *) ObjDesc->BankField.RegionObj; break; case ACPI_TYPE_LOCAL_INDEX_FIELD: + ObjDesc = (void *) ObjDesc->IndexField.IndexObj; break; default: + goto Cleanup; } ObjType = ACPI_TYPE_INVALID; /* Terminate loop after next pass */ }
*** 683,692 **** --- 711,863 ---- } /******************************************************************************* * + * FUNCTION: AcpiNsDumpOneObjectPath, AcpiNsGetMaxDepth + * + * PARAMETERS: ObjHandle - Node to be dumped + * Level - Nesting level of the handle + * Context - Passed into WalkNamespace + * ReturnValue - Not used + * + * RETURN: Status + * + * DESCRIPTION: Dump the full pathname to a namespace object. AcpNsGetMaxDepth + * computes the maximum nesting depth in the namespace tree, in + * order to simplify formatting in AcpiNsDumpOneObjectPath. + * These procedures are UserFunctions called by AcpiNsWalkNamespace. + * + ******************************************************************************/ + + static ACPI_STATUS + AcpiNsDumpOneObjectPath ( + ACPI_HANDLE ObjHandle, + UINT32 Level, + void *Context, + void **ReturnValue) + { + UINT32 MaxLevel = *((UINT32 *) Context); + char *Pathname; + ACPI_NAMESPACE_NODE *Node; + int PathIndent; + + + if (!ObjHandle) + { + return (AE_OK); + } + + Node = AcpiNsValidateHandle (ObjHandle); + if (!Node) + { + /* Ignore bad node during namespace walk */ + + return (AE_OK); + } + + Pathname = AcpiNsGetExternalPathname (Node); + + PathIndent = 1; + if (Level <= MaxLevel) + { + PathIndent = MaxLevel - Level + 1; + } + + AcpiOsPrintf ("%2d%*s%-12s%*s", + Level, Level, " ", AcpiUtGetTypeName (Node->Type), + PathIndent, " "); + + AcpiOsPrintf ("%s\n", &Pathname[1]); + ACPI_FREE (Pathname); + return (AE_OK); + } + + + static ACPI_STATUS + AcpiNsGetMaxDepth ( + ACPI_HANDLE ObjHandle, + UINT32 Level, + void *Context, + void **ReturnValue) + { + UINT32 *MaxLevel = (UINT32 *) Context; + + + if (Level > *MaxLevel) + { + *MaxLevel = Level; + } + return (AE_OK); + } + + + /******************************************************************************* + * + * FUNCTION: AcpiNsDumpObjectPaths + * + * 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 full object pathnames within the loaded namespace. Uses + * AcpiNsWalkNamespace in conjunction with AcpiNsDumpOneObjectPath. + * + ******************************************************************************/ + + void + AcpiNsDumpObjectPaths ( + ACPI_OBJECT_TYPE Type, + UINT8 DisplayType, + UINT32 MaxDepth, + ACPI_OWNER_ID OwnerId, + ACPI_HANDLE StartHandle) + { + ACPI_STATUS Status; + UINT32 MaxLevel = 0; + + + ACPI_FUNCTION_ENTRY (); + + + /* + * Just lock the entire namespace for the duration of the dump. + * We don't want any changes to the namespace during this time, + * especially the temporary nodes since we are going to display + * them also. + */ + Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); + if (ACPI_FAILURE (Status)) + { + AcpiOsPrintf ("Could not acquire namespace mutex\n"); + return; + } + + /* Get the max depth of the namespace tree, for formatting later */ + + (void) AcpiNsWalkNamespace (Type, StartHandle, MaxDepth, + ACPI_NS_WALK_NO_UNLOCK | ACPI_NS_WALK_TEMP_NODES, + AcpiNsGetMaxDepth, NULL, (void *) &MaxLevel, NULL); + + /* Now dump the entire namespace */ + + (void) AcpiNsWalkNamespace (Type, StartHandle, MaxDepth, + ACPI_NS_WALK_NO_UNLOCK | ACPI_NS_WALK_TEMP_NODES, + AcpiNsDumpOneObjectPath, NULL, (void *) &MaxLevel, NULL); + + (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); + } + + + /******************************************************************************* + * * FUNCTION: AcpiNsDumpEntry * * PARAMETERS: Handle - Node to be dumped * DebugLevel - Output level *
*** 764,769 **** ACPI_OWNER_ID_MAX, SearchHandle); return_VOID; } #endif #endif - --- 935,939 ----