summaryrefslogtreecommitdiffstats
path: root/sys/contrib/dev/acpica/components/debugger/dbnames.c
diff options
context:
space:
mode:
authorjkim <jkim@FreeBSD.org>2016-09-30 22:40:58 +0000
committerjkim <jkim@FreeBSD.org>2016-09-30 22:40:58 +0000
commitdba8c0a565199df70a86f6a036d00c92f0c7675f (patch)
treecf4924274c6e92898c01efb3c8ba31b34f0630f2 /sys/contrib/dev/acpica/components/debugger/dbnames.c
parent0f41551ef9dde560d9d191d7190af02904dbf611 (diff)
downloadFreeBSD-src-dba8c0a565199df70a86f6a036d00c92f0c7675f.zip
FreeBSD-src-dba8c0a565199df70a86f6a036d00c92f0c7675f.tar.gz
MFC: r284583, r285797, r285799, r287168, r298714, r298720, r298838,
r300879 Merge ACPICA up to 20160527. Requested by: mav
Diffstat (limited to 'sys/contrib/dev/acpica/components/debugger/dbnames.c')
-rw-r--r--sys/contrib/dev/acpica/components/debugger/dbnames.c170
1 files changed, 128 insertions, 42 deletions
diff --git a/sys/contrib/dev/acpica/components/debugger/dbnames.c b/sys/contrib/dev/acpica/components/debugger/dbnames.c
index d749b1d..f91bf97 100644
--- a/sys/contrib/dev/acpica/components/debugger/dbnames.c
+++ b/sys/contrib/dev/acpica/components/debugger/dbnames.c
@@ -5,7 +5,7 @@
******************************************************************************/
/*
- * Copyright (C) 2000 - 2015, Intel Corp.
+ * Copyright (C) 2000 - 2016, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -48,8 +48,6 @@
#include <contrib/dev/acpica/include/acpredef.h>
-#ifdef ACPI_DEBUGGER
-
#define _COMPONENT ACPI_CA_DEBUGGER
ACPI_MODULE_NAME ("dbnames")
@@ -78,6 +76,13 @@ AcpiDbWalkForSpecificObjects (
void **ReturnValue);
static ACPI_STATUS
+AcpiDbWalkForObjectCounts (
+ ACPI_HANDLE ObjHandle,
+ UINT32 NestingLevel,
+ void *Context,
+ void **ReturnValue);
+
+static ACPI_STATUS
AcpiDbIntegrityWalk (
ACPI_HANDLE ObjHandle,
UINT32 NestingLevel,
@@ -125,7 +130,13 @@ static ACPI_DB_ARGUMENT_INFO AcpiDbObjectTypes [] =
{"BANKFIELDS"},
{"INDEXFIELDS"},
{"REFERENCES"},
- {"ALIAS"},
+ {"ALIASES"},
+ {"METHODALIASES"},
+ {"NOTIFY"},
+ {"ADDRESSHANDLER"},
+ {"RESOURCE"},
+ {"RESOURCEFIELD"},
+ {"SCOPES"},
{NULL} /* Must be null terminated */
};
@@ -163,8 +174,8 @@ AcpiDbSetScope (
{
/* Validate new scope from the root */
- Status = AcpiNsGetNode (AcpiGbl_RootNode, Name, ACPI_NS_NO_UPSEARCH,
- &Node);
+ Status = AcpiNsGetNode (AcpiGbl_RootNode, Name,
+ ACPI_NS_NO_UPSEARCH, &Node);
if (ACPI_FAILURE (Status))
{
goto ErrorExit;
@@ -176,8 +187,8 @@ AcpiDbSetScope (
{
/* Validate new scope relative to old scope */
- Status = AcpiNsGetNode (AcpiGbl_DbScopeNode, Name, ACPI_NS_NO_UPSEARCH,
- &Node);
+ Status = AcpiNsGetNode (AcpiGbl_DbScopeNode, Name,
+ ACPI_NS_NO_UPSEARCH, &Node);
if (ACPI_FAILURE (Status))
{
goto ErrorExit;
@@ -194,7 +205,7 @@ AcpiDbSetScope (
}
if (AcpiUtSafeStrcat (AcpiGbl_DbScopeBuf, sizeof (AcpiGbl_DbScopeBuf),
- "\\"))
+ "\\"))
{
Status = AE_BUFFER_OVERFLOW;
goto ErrorExit;
@@ -248,7 +259,7 @@ AcpiDbDumpNamespace (
if (DepthArg)
{
- MaxDepth = ACPI_STRTOUL (DepthArg, NULL, 0);
+ MaxDepth = strtoul (DepthArg, NULL, 0);
}
}
@@ -319,13 +330,13 @@ AcpiDbDumpNamespaceByOwner (
ACPI_OWNER_ID OwnerId;
- OwnerId = (ACPI_OWNER_ID) ACPI_STRTOUL (OwnerArg, NULL, 0);
+ OwnerId = (ACPI_OWNER_ID) strtoul (OwnerArg, NULL, 0);
/* Now we can check for the depth argument */
if (DepthArg)
{
- MaxDepth = ACPI_STRTOUL (DepthArg, NULL, 0);
+ MaxDepth = strtoul (DepthArg, NULL, 0);
}
AcpiDbSetOutputDestination (ACPI_DB_DUPLICATE_OUTPUT);
@@ -334,8 +345,8 @@ AcpiDbDumpNamespaceByOwner (
/* Display the subtree */
AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT);
- AcpiNsDumpObjects (ACPI_TYPE_ANY, ACPI_DISPLAY_SUMMARY, MaxDepth, OwnerId,
- SubtreeEntry);
+ AcpiNsDumpObjects (ACPI_TYPE_ANY, ACPI_DISPLAY_SUMMARY, MaxDepth,
+ OwnerId, SubtreeEntry);
AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT);
}
@@ -374,7 +385,8 @@ AcpiDbWalkAndMatchName (
/* Wildcard support */
if ((RequestedName[i] != '?') &&
- (RequestedName[i] != ((ACPI_NAMESPACE_NODE *) ObjHandle)->Name.Ascii[i]))
+ (RequestedName[i] != ((ACPI_NAMESPACE_NODE *)
+ ObjHandle)->Name.Ascii[i]))
{
/* No match, just exit */
@@ -385,10 +397,11 @@ AcpiDbWalkAndMatchName (
/* Get the full pathname to this object */
Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
- Status = AcpiNsHandleToPathname (ObjHandle, &Buffer);
+ Status = AcpiNsHandleToPathname (ObjHandle, &Buffer, TRUE);
if (ACPI_FAILURE (Status))
{
- AcpiOsPrintf ("Could Not get pathname for object %p\n", ObjHandle);
+ AcpiOsPrintf ("Could Not get pathname for object %p\n",
+ ObjHandle);
}
else
{
@@ -426,7 +439,7 @@ AcpiDbFindNameInNamespace (
char *AcpiNamePtr = AcpiName;
- if (ACPI_STRLEN (NameArg) > 4)
+ if (strlen (NameArg) > ACPI_NAME_SIZE)
{
AcpiOsPrintf ("Name must be no longer than 4 characters\n");
return (AE_OK);
@@ -444,8 +457,8 @@ AcpiDbFindNameInNamespace (
/* Walk the namespace from the root */
- (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
- AcpiDbWalkAndMatchName, NULL, AcpiName, NULL);
+ (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
+ ACPI_UINT32_MAX, AcpiDbWalkAndMatchName, NULL, AcpiName, NULL);
AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT);
return (AE_OK);
@@ -486,7 +499,7 @@ AcpiDbWalkForPredefinedNames (
return (AE_OK);
}
- Pathname = AcpiNsGetExternalPathname (Node);
+ Pathname = AcpiNsGetNormalizedPathname (Node, TRUE);
if (!Pathname)
{
return (AE_OK);
@@ -546,8 +559,9 @@ AcpiDbCheckPredefinedNames (
/* Search all nodes in namespace */
- (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
- AcpiDbWalkForPredefinedNames, NULL, (void *) &Count, NULL);
+ (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
+ ACPI_UINT32_MAX, AcpiDbWalkForPredefinedNames,
+ NULL, (void *) &Count, NULL);
AcpiOsPrintf ("Found %u predefined names in the namespace\n", Count);
}
@@ -555,6 +569,43 @@ AcpiDbCheckPredefinedNames (
/*******************************************************************************
*
+ * FUNCTION: AcpiDbWalkForObjectCounts
+ *
+ * PARAMETERS: Callback from WalkNamespace
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Display short info about objects in the namespace
+ *
+ ******************************************************************************/
+
+static ACPI_STATUS
+AcpiDbWalkForObjectCounts (
+ ACPI_HANDLE ObjHandle,
+ UINT32 NestingLevel,
+ void *Context,
+ void **ReturnValue)
+{
+ ACPI_OBJECT_INFO *Info = (ACPI_OBJECT_INFO *) Context;
+ ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle;
+
+
+ if (Node->Type > ACPI_TYPE_NS_NODE_MAX)
+ {
+ AcpiOsPrintf ("[%4.4s]: Unknown object type %X\n",
+ Node->Name.Ascii, Node->Type);
+ }
+ else
+ {
+ Info->Types[Node->Type]++;
+ }
+
+ return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
* FUNCTION: AcpiDbWalkForSpecificObjects
*
* PARAMETERS: Callback from WalkNamespace
@@ -582,7 +633,7 @@ AcpiDbWalkForSpecificObjects (
/* Get and display the full pathname to this object */
Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
- Status = AcpiNsHandleToPathname (ObjHandle, &Buffer);
+ Status = AcpiNsHandleToPathname (ObjHandle, &Buffer, TRUE);
if (ACPI_FAILURE (Status))
{
AcpiOsPrintf ("Could Not get pathname for object %p\n", ObjHandle);
@@ -619,7 +670,39 @@ AcpiDbDisplayObjects (
{
ACPI_WALK_INFO Info;
ACPI_OBJECT_TYPE Type;
+ ACPI_OBJECT_INFO *ObjectInfo;
+ UINT32 i;
+ UINT32 TotalObjects = 0;
+
+
+ /* No argument means display summary/count of all object types */
+ if (!ObjTypeArg)
+ {
+ ObjectInfo = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_OBJECT_INFO));
+
+ /* Walk the namespace from the root */
+
+ (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
+ ACPI_UINT32_MAX, AcpiDbWalkForObjectCounts, NULL,
+ (void *) ObjectInfo, NULL);
+
+ AcpiOsPrintf ("\nSummary of namespace objects:\n\n");
+
+ for (i = 0; i < ACPI_TOTAL_TYPES; i++)
+ {
+ AcpiOsPrintf ("%8u %s\n", ObjectInfo->Types[i],
+ AcpiUtGetTypeName (i));
+
+ TotalObjects += ObjectInfo->Types[i];
+ }
+
+ AcpiOsPrintf ("\n%8u Total namespace objects\n\n",
+ TotalObjects);
+
+ ACPI_FREE (ObjectInfo);
+ return (AE_OK);
+ }
/* Get the object type */
@@ -645,7 +728,7 @@ AcpiDbDisplayObjects (
/* Walk the namespace from the root */
(void) AcpiWalkNamespace (Type, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
- AcpiDbWalkForSpecificObjects, NULL, (void *) &Info, NULL);
+ AcpiDbWalkForSpecificObjects, NULL, (void *) &Info, NULL);
AcpiOsPrintf (
"\nFound %u objects of type [%s] in the current ACPI Namespace\n",
@@ -689,9 +772,11 @@ AcpiDbIntegrityWalk (
{
if (ACPI_GET_DESCRIPTOR_TYPE (Node) != ACPI_DESC_TYPE_NAMED)
{
- AcpiOsPrintf ("Invalid Descriptor Type for Node %p [%s] - is %2.2X should be %2.2X\n",
- Node, AcpiUtGetDescriptorName (Node), ACPI_GET_DESCRIPTOR_TYPE (Node),
- ACPI_DESC_TYPE_NAMED);
+ AcpiOsPrintf (
+ "Invalid Descriptor Type for Node %p [%s] - "
+ "is %2.2X should be %2.2X\n",
+ Node, AcpiUtGetDescriptorName (Node),
+ ACPI_GET_DESCRIPTOR_TYPE (Node), ACPI_DESC_TYPE_NAMED);
return (AE_OK);
}
@@ -713,7 +798,7 @@ AcpiDbIntegrityWalk (
return (AE_OK);
}
- if (!AcpiUtValidAcpiName (Node->Name.Ascii))
+ if (!AcpiUtValidNameseg (Node->Name.Ascii))
{
AcpiOsPrintf ("Invalid AcpiName for Node %p\n", Node);
return (AE_OK);
@@ -754,8 +839,8 @@ AcpiDbCheckIntegrity (
/* Search all nodes in namespace */
- (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
- AcpiDbIntegrityWalk, NULL, (void *) &Info, NULL);
+ (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
+ ACPI_UINT32_MAX, AcpiDbIntegrityWalk, NULL, (void *) &Info, NULL);
AcpiOsPrintf ("Verified %u namespace nodes with %u Objects\n",
Info.Nodes, Info.Objects);
@@ -830,13 +915,14 @@ AcpiDbFindReferences (
/* Convert string to object pointer */
- Address = ACPI_STRTOUL (ObjectArg, NULL, 16);
+ Address = strtoul (ObjectArg, NULL, 16);
ObjDesc = ACPI_TO_POINTER (Address);
/* Search all nodes in namespace */
- (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
- AcpiDbWalkForReferences, NULL, (void *) ObjDesc, NULL);
+ (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
+ ACPI_UINT32_MAX, AcpiDbWalkForReferences, NULL,
+ (void *) ObjDesc, NULL);
}
@@ -877,7 +963,7 @@ AcpiDbBusWalk (
/* Exit if there is no _PRT under this device */
Status = AcpiGetHandle (Node, METHOD_NAME__PRT,
- ACPI_CAST_PTR (ACPI_HANDLE, &TempNode));
+ ACPI_CAST_PTR (ACPI_HANDLE, &TempNode));
if (ACPI_FAILURE (Status))
{
return (AE_OK);
@@ -886,10 +972,11 @@ AcpiDbBusWalk (
/* Get the full path to this device object */
Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
- Status = AcpiNsHandleToPathname (ObjHandle, &Buffer);
+ Status = AcpiNsHandleToPathname (ObjHandle, &Buffer, TRUE);
if (ACPI_FAILURE (Status))
{
- AcpiOsPrintf ("Could Not get pathname for object %p\n", ObjHandle);
+ AcpiOsPrintf ("Could Not get pathname for object %p\n",
+ ObjHandle);
return (AE_OK);
}
@@ -918,7 +1005,8 @@ AcpiDbBusWalk (
if (Info->Valid & ACPI_VALID_ADR)
{
- AcpiOsPrintf ("_ADR: %8.8X%8.8X\n", ACPI_FORMAT_UINT64 (Info->Address));
+ AcpiOsPrintf ("_ADR: %8.8X%8.8X\n",
+ ACPI_FORMAT_UINT64 (Info->Address));
}
else
{
@@ -979,8 +1067,6 @@ AcpiDbGetBusInfo (
{
/* Search all nodes in namespace */
- (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
- AcpiDbBusWalk, NULL, NULL, NULL);
+ (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
+ ACPI_UINT32_MAX, AcpiDbBusWalk, NULL, NULL, NULL);
}
-
-#endif /* ACPI_DEBUGGER */
OpenPOWER on IntegriCloud