dbnames.c revision 199767f8919635c4928607450d9e0abb932109ce
/*******************************************************************************
*
* Module Name: dbnames - Debugger commands for the acpi namespace
*
******************************************************************************/
/*
* Copyright (C) 2000 - 2015, 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:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions, and the following disclaimer,
* without modification.
* 2. Redistributions in binary form must reproduce at minimum a disclaimer
* substantially similar to the "NO WARRANTY" disclaimer below
* ("Disclaimer") and any redistribution must be conditioned upon
* including a substantially similar Disclaimer requirement for further
* binary redistribution.
* 3. Neither the names of the above-listed copyright holders nor the names
* of any contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* Alternatively, this software may be distributed under the terms of the
* GNU General Public License ("GPL") version 2 as published by the Free
* Software Foundation.
*
* NO WARRANTY
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES.
*/
#define _COMPONENT ACPI_CA_DEBUGGER
ACPI_MODULE_NAME ("dbnames")
/* Local prototypes */
static ACPI_STATUS
void *Context,
void **ReturnValue);
static ACPI_STATUS
void *Context,
void **ReturnValue);
static ACPI_STATUS
void *Context,
void **ReturnValue);
static ACPI_STATUS
void *Context,
void **ReturnValue);
static ACPI_STATUS
void *Context,
void **ReturnValue);
static ACPI_STATUS
void *Context,
void **ReturnValue);
static ACPI_STATUS
void *Context,
void **ReturnValue);
/*
* Arguments for the Objects command
* These object types map directly to the ACPI_TYPES
*/
static ACPI_DB_ARGUMENT_INFO AcpiDbObjectTypes [] =
{
{"ANY"},
{"INTEGERS"},
{"STRINGS"},
{"BUFFERS"},
{"PACKAGES"},
{"FIELDS"},
{"DEVICES"},
{"EVENTS"},
{"METHODS"},
{"MUTEXES"},
{"REGIONS"},
{"POWERRESOURCES"},
{"PROCESSORS"},
{"THERMALZONES"},
{"BUFFERFIELDS"},
{"DDBHANDLES"},
{"DEBUG"},
{"REGIONFIELDS"},
{"BANKFIELDS"},
{"INDEXFIELDS"},
{"REFERENCES"},
{"ALIASES"},
{"METHODALIASES"},
{"NOTIFY"},
{"ADDRESSHANDLER"},
{"RESOURCE"},
{"RESOURCEFIELD"},
{"SCOPES"},
{NULL} /* Must be null terminated */
};
/*******************************************************************************
*
* FUNCTION: AcpiDbSetScope
*
* PARAMETERS: Name - New scope path
*
* RETURN: Status
*
* DESCRIPTION: Set the "current scope" as maintained by this utility.
* The scope is used as a prefix to ACPI paths.
*
******************************************************************************/
void
char *Name)
{
{
return;
}
if (ACPI_IS_ROOT_PREFIX (Name[0]))
{
/* Validate new scope from the root */
if (ACPI_FAILURE (Status))
{
goto ErrorExit;
}
AcpiGbl_DbScopeBuf[0] = 0;
}
else
{
/* Validate new scope relative to old scope */
if (ACPI_FAILURE (Status))
{
goto ErrorExit;
}
}
/* Build the final pathname */
Name))
{
goto ErrorExit;
}
"\\"))
{
goto ErrorExit;
}
return;
AcpiOsPrintf ("Could not attach scope: %s, %s\n",
}
/*******************************************************************************
*
* FUNCTION: AcpiDbDumpNamespace
*
* PARAMETERS: StartArg - Node to begin namespace dump
* DepthArg - Maximum tree depth to be dumped
*
* RETURN: None
*
* DESCRIPTION: Dump entire namespace or a subtree. Each node is displayed
* with type and other information.
*
******************************************************************************/
void
char *StartArg,
char *DepthArg)
{
/* No argument given, just start at the root and dump entire namespace */
if (StartArg)
{
if (!SubtreeEntry)
{
return;
}
/* Now we can check for the depth argument */
if (DepthArg)
{
}
}
AcpiOsPrintf ("ACPI Namespace (from %4.4s (%p) subtree):\n",
/* Display the subtree */
}
/*******************************************************************************
*
* FUNCTION: AcpiDbDumpNamespacePaths
*
* PARAMETERS: None
*
* RETURN: None
*
* DESCRIPTION: Dump entire namespace with full object pathnames and object
* type information. Alternative to "namespace" command.
*
******************************************************************************/
void
void)
{
AcpiOsPrintf ("ACPI Namespace (from root):\n");
/* Display the entire namespace */
}
/*******************************************************************************
*
* FUNCTION: AcpiDbDumpNamespaceByOwner
*
* PARAMETERS: OwnerArg - Owner ID whose nodes will be displayed
* DepthArg - Maximum tree depth to be dumped
*
* RETURN: None
*
* DESCRIPTION: Dump elements of the namespace that are owned by the OwnerId.
*
******************************************************************************/
void
char *OwnerArg,
char *DepthArg)
{
/* Now we can check for the depth argument */
if (DepthArg)
{
}
/* Display the subtree */
}
/*******************************************************************************
*
* FUNCTION: AcpiDbWalkAndMatchName
*
* PARAMETERS: Callback from WalkNamespace
*
* RETURN: Status
*
* are supported -- '?' matches any character.
*
******************************************************************************/
static ACPI_STATUS
void *Context,
void **ReturnValue)
{
char *RequestedName = (char *) Context;
UINT32 i;
/* Check for a name match */
for (i = 0; i < 4; i++)
{
/* Wildcard support */
if ((RequestedName[i] != '?') &&
(RequestedName[i] != ((ACPI_NAMESPACE_NODE *)
{
/* No match, just exit */
return (AE_OK);
}
}
/* Get the full pathname to this object */
if (ACPI_FAILURE (Status))
{
AcpiOsPrintf ("Could Not get pathname for object %p\n",
}
else
{
}
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: AcpiDbFindNameInNamespace
*
* PARAMETERS: NameArg - The 4-character ACPI name to find.
* wildcards are supported.
*
* RETURN: None
*
* DESCRIPTION: Search the namespace for a given name (with wildcards)
*
******************************************************************************/
char *NameArg)
{
char *AcpiNamePtr = AcpiName;
{
AcpiOsPrintf ("Name must be no longer than 4 characters\n");
return (AE_OK);
}
/* Pad out name with underscores as necessary to create a 4-char name */
while (*NameArg)
{
*AcpiNamePtr = *NameArg;
AcpiNamePtr++;
NameArg++;
}
/* Walk the namespace from the root */
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: AcpiDbWalkForPredefinedNames
*
* PARAMETERS: Callback from WalkNamespace
*
* RETURN: Status
*
* DESCRIPTION: Detect and display predefined ACPI names (names that start with
* an underscore)
*
******************************************************************************/
static ACPI_STATUS
void *Context,
void **ReturnValue)
{
const ACPI_PREDEFINED_INFO *Predefined;
char *Pathname;
char StringBuffer[48];
if (!Predefined)
{
return (AE_OK);
}
if (!Pathname)
{
return (AE_OK);
}
/* If method returns a package, the info is in the next table entry */
{
}
if (Package)
{
AcpiOsPrintf (" (PkgType %2.2X, ObjType %2.2X, Count %2.2X)",
}
AcpiOsPrintf("\n");
/* Check that the declared argument count matches the ACPI spec */
(*Count)++;
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: AcpiDbCheckPredefinedNames
*
* PARAMETERS: None
*
* RETURN: None
*
* DESCRIPTION: Validate all predefined names in the namespace
*
******************************************************************************/
void
void)
{
/* Search all nodes in namespace */
}
/*******************************************************************************
*
* FUNCTION: AcpiDbWalkForObjectCounts
*
* PARAMETERS: Callback from WalkNamespace
*
* RETURN: Status
*
* DESCRIPTION: Display short info about objects in the namespace
*
******************************************************************************/
static ACPI_STATUS
void *Context,
void **ReturnValue)
{
{
AcpiOsPrintf ("[%4.4s]: Unknown object type %X\n",
}
else
{
}
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: AcpiDbWalkForSpecificObjects
*
* PARAMETERS: Callback from WalkNamespace
*
* RETURN: Status
*
* DESCRIPTION: Display short info about objects in the namespace
*
******************************************************************************/
static ACPI_STATUS
void *Context,
void **ReturnValue)
{
/* Get and display the full pathname to this object */
if (ACPI_FAILURE (Status))
{
return (AE_OK);
}
/* Dump short info about the object */
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: AcpiDbDisplayObjects
*
* PARAMETERS: ObjTypeArg - Type of object to display
* DisplayCountArg - Max depth to display
*
* RETURN: None
*
* DESCRIPTION: Display objects in the namespace of the requested type
*
******************************************************************************/
char *ObjTypeArg,
char *DisplayCountArg)
{
UINT32 i;
UINT32 TotalObjects = 0;
if (!ObjTypeArg)
{
/* Walk the namespace from the root */
(void *) ObjectInfo, NULL);
AcpiOsPrintf ("\nSummary of namespace objects:\n\n");
for (i = 0; i < ACPI_TOTAL_TYPES; i++)
{
AcpiUtGetTypeName (i));
}
AcpiOsPrintf ("\n%8u Total namespace objects\n\n",
return (AE_OK);
}
/* Get the object type */
if (Type == ACPI_TYPE_NOT_FOUND)
{
AcpiOsPrintf ("Invalid or unsupported argument\n");
return (AE_OK);
}
"Objects of type [%s] defined in the current ACPI Namespace:\n",
/* Walk the namespace from the root */
"\nFound %u objects of type [%s] in the current ACPI Namespace\n",
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: AcpiDbIntegrityWalk
*
* PARAMETERS: Callback from WalkNamespace
*
* RETURN: Status
*
* DESCRIPTION: Examine one NS node for valid values.
*
******************************************************************************/
static ACPI_STATUS
void *Context,
void **ReturnValue)
{
/* Verify the NS node, and dereference aliases */
while (Alias)
{
{
"Invalid Descriptor Type for Node %p [%s] - "
"is %2.2X should be %2.2X\n",
return (AE_OK);
}
{
}
else
{
}
}
{
AcpiOsPrintf ("Invalid Object Type for Node %p, Type = %X\n",
return (AE_OK);
}
{
return (AE_OK);
}
if (Object)
{
{
AcpiOsPrintf ("Invalid Descriptor Type for Object %p [%s]\n",
}
}
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: AcpiDbCheckIntegrity
*
* PARAMETERS: None
*
* RETURN: None
*
* DESCRIPTION: Check entire namespace for data structure integrity
*
******************************************************************************/
void
void)
{
ACPI_INTEGRITY_INFO Info = {0,0};
/* Search all nodes in namespace */
AcpiOsPrintf ("Verified %u namespace nodes with %u Objects\n",
}
/*******************************************************************************
*
* FUNCTION: AcpiDbWalkForReferences
*
* PARAMETERS: Callback from WalkNamespace
*
* RETURN: Status
*
* DESCRIPTION: Check if this namespace object refers to the target object
* that is passed in as the context value.
*
* Note: Currently doesn't check subobjects within the Node's object
*
******************************************************************************/
static ACPI_STATUS
void *Context,
void **ReturnValue)
{
/* Check for match against the namespace node itself */
{
AcpiOsPrintf ("Object is a Node [%4.4s]\n",
}
/* Check for match against the object attached to the node */
{
AcpiOsPrintf ("Reference at Node->Object %p [%4.4s]\n",
}
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: AcpiDbFindReferences
*
* PARAMETERS: ObjectArg - String with hex value of the object
*
* RETURN: None
*
* DESCRIPTION: Search namespace for all references to the input object
*
******************************************************************************/
void
char *ObjectArg)
{
/* Convert string to object pointer */
/* Search all nodes in namespace */
}
/*******************************************************************************
*
* FUNCTION: AcpiDbBusWalk
*
* PARAMETERS: Callback from WalkNamespace
*
* RETURN: Status
*
* DESCRIPTION: Display info about device objects that have a corresponding
* _PRT method.
*
******************************************************************************/
static ACPI_STATUS
void *Context,
void **ReturnValue)
{
UINT32 i;
{
return (AE_OK);
}
/* Exit if there is no _PRT under this device */
if (ACPI_FAILURE (Status))
{
return (AE_OK);
}
/* Get the full path to this device object */
if (ACPI_FAILURE (Status))
{
AcpiOsPrintf ("Could Not get pathname for object %p\n",
return (AE_OK);
}
if (ACPI_FAILURE (Status))
{
return (AE_OK);
}
/* Display the full path */
{
AcpiOsPrintf (" - Is PCI Root Bridge");
}
AcpiOsPrintf ("\n");
/* _PRT info */
/* Dump _ADR, _HID, _UID, _CID */
{
AcpiOsPrintf ("_ADR: %8.8X%8.8X\n",
}
else
{
AcpiOsPrintf ("_ADR: <Not Present>\n");
}
{
}
else
{
AcpiOsPrintf ("_HID: <Not Present>\n");
}
{
}
else
{
AcpiOsPrintf ("_UID: <Not Present>\n");
}
{
{
AcpiOsPrintf ("_CID: %s\n",
}
}
else
{
AcpiOsPrintf ("_CID: <Not Present>\n");
}
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: AcpiDbGetBusInfo
*
* PARAMETERS: None
*
* RETURN: None
*
* DESCRIPTION: Display info about system busses.
*
******************************************************************************/
void
void)
{
/* Search all nodes in namespace */
}