summaryrefslogtreecommitdiff
path: root/usr/src/uts/intel/io/acpica/namespace/nsdump.c
diff options
context:
space:
mode:
authorJerry Jelinek <jerry.jelinek@joyent.com>2016-07-26 15:05:29 +0000
committerJerry Jelinek <jerry.jelinek@joyent.com>2016-07-26 15:05:29 +0000
commitd103e8b98085dbb5f7707242723b9d3ce74f2723 (patch)
tree263af7aa964a6c36a7cd561cd80268d6cbba5d5d /usr/src/uts/intel/io/acpica/namespace/nsdump.c
parent9b221abb819d37d8c917941b8348a6c0e49c74b1 (diff)
downloadillumos-joyent-d103e8b98085dbb5f7707242723b9d3ce74f2723.tar.gz
OS-5536 update to ACPI version 6.x
Reviewed by: Patrick Mooney <patrick.mooney@joyent.com> Reviewed by: Robert Mustacchi <rm@joyent.com>
Diffstat (limited to 'usr/src/uts/intel/io/acpica/namespace/nsdump.c')
-rw-r--r--usr/src/uts/intel/io/acpica/namespace/nsdump.c248
1 files changed, 206 insertions, 42 deletions
diff --git a/usr/src/uts/intel/io/acpica/namespace/nsdump.c b/usr/src/uts/intel/io/acpica/namespace/nsdump.c
index 6b7c505779..32ada86001 100644
--- a/usr/src/uts/intel/io/acpica/namespace/nsdump.c
+++ b/usr/src/uts/intel/io/acpica/namespace/nsdump.c
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2012, Intel Corp.
+ * Copyright (C) 2000 - 2016, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -41,11 +41,10 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
-#define __NSDUMP_C__
-
#include "acpi.h"
#include "accommon.h"
#include "acnamesp.h"
+#include "acoutput.h"
#define _COMPONENT ACPI_NAMESPACE
@@ -68,6 +67,22 @@ AcpiNsDumpOneDevice (
#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
@@ -84,7 +99,7 @@ AcpiNsDumpOneDevice (
void
AcpiNsPrintPathname (
UINT32 NumSegments,
- char *Pathname)
+ const char *Pathname)
{
UINT32 i;
@@ -92,7 +107,9 @@ AcpiNsPrintPathname (
ACPI_FUNCTION_NAME (NsPrintPathname);
- if (!(AcpiDbgLevel & ACPI_LV_NAMES) || !(AcpiDbgLayer & ACPI_NAMESPACE))
+ /* Check if debug output enabled */
+
+ if (!ACPI_IS_DEBUG_ENABLED (ACPI_LV_NAMES, ACPI_NAMESPACE))
{
return;
}
@@ -105,7 +122,7 @@ AcpiNsPrintPathname (
{
for (i = 0; i < 4; i++)
{
- ACPI_IS_PRINT (Pathname[i]) ?
+ isprint ((int) Pathname[i]) ?
AcpiOsPrintf ("%c", Pathname[i]) :
AcpiOsPrintf ("?");
}
@@ -122,6 +139,9 @@ AcpiNsPrintPathname (
}
+#ifdef ACPI_OBSOLETE_FUNCTIONS
+/* Not used at this time, perhaps later */
+
/*******************************************************************************
*
* FUNCTION: AcpiNsDumpPathname
@@ -141,7 +161,7 @@ AcpiNsPrintPathname (
void
AcpiNsDumpPathname (
ACPI_HANDLE Handle,
- char *Msg,
+ const char *Msg,
UINT32 Level,
UINT32 Component)
{
@@ -151,7 +171,7 @@ AcpiNsDumpPathname (
/* Do this only if the requested debug level and component are enabled */
- if (!(AcpiDbgLevel & Level) || !(AcpiDbgLayer & Component))
+ if (!ACPI_IS_DEBUG_ENABLED (Level, Component))
{
return_VOID;
}
@@ -162,7 +182,7 @@ AcpiNsDumpPathname (
AcpiOsPrintf ("\n");
return_VOID;
}
-
+#endif
/*******************************************************************************
*
@@ -241,7 +261,8 @@ AcpiNsDumpOneObject (
if (Type > ACPI_TYPE_LOCAL_MAX)
{
- ACPI_WARNING ((AE_INFO, "Invalid ACPI Object Type 0x%08X", Type));
+ ACPI_WARNING ((AE_INFO,
+ "Invalid ACPI Object Type 0x%08X", Type));
}
AcpiOsPrintf ("%4.4s", AcpiUtGetNodeName (ThisNode));
@@ -250,7 +271,7 @@ AcpiNsDumpOneObject (
/* Now we can print out the pertinent information */
AcpiOsPrintf (" %-12s %p %2.2X ",
- AcpiUtGetTypeName (Type), ThisNode, ThisNode->OwnerId);
+ AcpiUtGetTypeName (Type), ThisNode, ThisNode->OwnerId);
DbgLevel = AcpiDbgLevel;
AcpiDbgLevel = 0;
@@ -279,10 +300,12 @@ AcpiNsDumpOneObject (
case ACPI_TYPE_BUFFER:
case ACPI_TYPE_STRING:
case ACPI_TYPE_METHOD:
+
AcpiOsPrintf ("<No attached object>");
break;
default:
+
break;
}
@@ -294,18 +317,16 @@ AcpiNsDumpOneObject (
{
case ACPI_TYPE_PROCESSOR:
- AcpiOsPrintf ("ID %X Len %.4X Addr %p\n",
+ AcpiOsPrintf ("ID %02X Len %02X Addr %8.8X%8.8X\n",
ObjDesc->Processor.ProcId, ObjDesc->Processor.Length,
- ACPI_CAST_PTR (void, ObjDesc->Processor.Address));
+ ACPI_FORMAT_UINT64 (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",
@@ -313,14 +334,12 @@ AcpiNsDumpOneObject (
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)
@@ -334,13 +353,12 @@ AcpiNsDumpOneObject (
}
break;
-
case ACPI_TYPE_BUFFER:
if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID)
{
AcpiOsPrintf ("Len %.2X",
- ObjDesc->Buffer.Length);
+ ObjDesc->Buffer.Length);
/* Dump some of the buffer */
@@ -360,15 +378,13 @@ AcpiNsDumpOneObject (
}
break;
-
case ACPI_TYPE_STRING:
AcpiOsPrintf ("Len %.2X ", ObjDesc->String.Length);
- AcpiUtPrintString (ObjDesc->String.Pointer, 32);
+ AcpiUtPrintString (ObjDesc->String.Pointer, 80);
AcpiOsPrintf ("\n");
break;
-
case ACPI_TYPE_REGION:
AcpiOsPrintf ("[%s]",
@@ -376,7 +392,7 @@ AcpiNsDumpOneObject (
if (ObjDesc->Region.Flags & AOPOBJ_DATA_VALID)
{
AcpiOsPrintf (" Addr %8.8X%8.8X Len %.4X\n",
- ACPI_FORMAT_NATIVE_UINT (ObjDesc->Region.Address),
+ ACPI_FORMAT_UINT64 (ObjDesc->Region.Address),
ObjDesc->Region.Length);
}
else
@@ -385,13 +401,11 @@ AcpiNsDumpOneObject (
}
break;
-
case ACPI_TYPE_LOCAL_REFERENCE:
AcpiOsPrintf ("[%s]\n", AcpiUtGetReferenceName (ObjDesc));
break;
-
case ACPI_TYPE_BUFFER_FIELD:
if (ObjDesc->BufferField.BufferObj &&
@@ -403,7 +417,6 @@ AcpiNsDumpOneObject (
}
break;
-
case ACPI_TYPE_LOCAL_REGION_FIELD:
AcpiOsPrintf ("Rgn [%4.4s]",
@@ -411,7 +424,6 @@ AcpiNsDumpOneObject (
ObjDesc->CommonField.RegionObj->Region.Node));
break;
-
case ACPI_TYPE_LOCAL_BANK_FIELD:
AcpiOsPrintf ("Rgn [%4.4s] Bnk [%4.4s]",
@@ -421,7 +433,6 @@ AcpiNsDumpOneObject (
ObjDesc->BankField.BankObj->CommonField.Node));
break;
-
case ACPI_TYPE_LOCAL_INDEX_FIELD:
AcpiOsPrintf ("Idx [%4.4s] Dat [%4.4s]",
@@ -431,7 +442,6 @@ AcpiNsDumpOneObject (
ObjDesc->IndexField.DataObj->CommonField.Node));
break;
-
case ACPI_TYPE_LOCAL_ALIAS:
case ACPI_TYPE_LOCAL_METHOD_ALIAS:
@@ -462,11 +472,11 @@ AcpiNsDumpOneObject (
break;
default:
+
break;
}
break;
-
case ACPI_DISPLAY_OBJECTS:
AcpiOsPrintf ("O:%p", ObjDesc);
@@ -515,7 +525,6 @@ AcpiNsDumpOneObject (
}
break;
-
default:
AcpiOsPrintf ("\n");
break;
@@ -530,9 +539,9 @@ AcpiNsDumpOneObject (
/* If there is an attached object, display it */
- DbgLevel = AcpiDbgLevel;
+ DbgLevel = AcpiDbgLevel;
AcpiDbgLevel = 0;
- ObjDesc = AcpiNsGetAttachedObject (ThisNode);
+ ObjDesc = AcpiNsGetAttachedObject (ThisNode);
AcpiDbgLevel = DbgLevel;
/* Dump attached objects */
@@ -559,14 +568,18 @@ AcpiNsDumpOneObject (
if (ObjType > ACPI_TYPE_LOCAL_MAX)
{
- AcpiOsPrintf ("(Pointer to ACPI Object type %.2X [UNKNOWN])\n",
+ AcpiOsPrintf (
+ "(Pointer to ACPI Object type %.2X [UNKNOWN])\n",
ObjType);
+
BytesToDump = 32;
}
else
{
- AcpiOsPrintf ("(Pointer to ACPI Object type %.2X [%s])\n",
+ AcpiOsPrintf (
+ "(Pointer to ACPI Object type %.2X [%s])\n",
ObjType, AcpiUtGetTypeName (ObjType));
+
BytesToDump = sizeof (ACPI_OPERAND_OBJECT);
}
@@ -596,36 +609,44 @@ AcpiNsDumpOneObject (
*/
BytesToDump = ObjDesc->String.Length;
ObjDesc = (void *) ObjDesc->String.Pointer;
- AcpiOsPrintf ( "(Buffer/String pointer %p length %X)\n",
+
+ 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;
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;
}
@@ -690,8 +711,151 @@ AcpiNsDumpObjects (
Info.DisplayType = DisplayType;
(void) AcpiNsWalkNamespace (Type, StartHandle, MaxDepth,
- ACPI_NS_WALK_NO_UNLOCK | ACPI_NS_WALK_TEMP_NODES,
- AcpiNsDumpOneObject, NULL, (void *) &Info, NULL);
+ ACPI_NS_WALK_NO_UNLOCK | ACPI_NS_WALK_TEMP_NODES,
+ AcpiNsDumpOneObject, NULL, (void *) &Info, NULL);
+
+ (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
+}
+
+
+/*******************************************************************************
+ *
+ * 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 = AcpiNsGetNormalizedPathname (Node, TRUE);
+
+ 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);
}
@@ -736,7 +900,7 @@ AcpiNsDumpEntry (
*
* PARAMETERS: SearchBase - Root of subtree to be dumped, or
* NS_ALL to dump the entire namespace
- * MaxDepth - Maximum depth of dump. Use INT_MAX
+ * MaxDepth - Maximum depth of dump. Use INT_MAX
* for an effectively unlimited depth.
*
* RETURN: None
@@ -762,7 +926,8 @@ AcpiNsDumpTables (
* If the name space has not been initialized,
* there is nothing to dump.
*/
- ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "namespace not initialized!\n"));
+ ACPI_DEBUG_PRINT ((ACPI_DB_TABLES,
+ "namespace not initialized!\n"));
return_VOID;
}
@@ -775,9 +940,8 @@ AcpiNsDumpTables (
}
AcpiNsDumpObjects (ACPI_TYPE_ANY, ACPI_DISPLAY_OBJECTS, MaxDepth,
- ACPI_OWNER_ID_MAX, SearchHandle);
+ ACPI_OWNER_ID_MAX, SearchHandle);
return_VOID;
}
#endif
#endif
-