/*******************************************************************************
*
* Module Name: dmnames - AML disassembler, names, namestrings, pathnames
*
******************************************************************************/
/*
* Copyright (C) 2000 - 2016, 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.
*/
#include "acpi.h"
#include "accommon.h"
#include "amlcode.h"
#include "acnamesp.h"
#include "acdisasm.h"
ACPI_MODULE_NAME ("dmnames")
/* Local prototypes */
#ifdef ACPI_OBSOLETE_FUNCTIONS
void
#endif
/*******************************************************************************
*
* FUNCTION: AcpiDmDumpName
*
* PARAMETERS: Name - 4 character ACPI name
*
* RETURN: Final length of name
*
* DESCRIPTION: Dump an ACPI name, minus any trailing underscores.
*
******************************************************************************/
{
UINT32 i;
/* Copy name locally in case the original name is not writeable */
/* Ensure that the name is printable, even if we have to fix it */
/* Remove all trailing underscores from the name */
for (i = (ACPI_NAME_SIZE - 1); i != 0; i--)
{
if (NewName[i] == '_')
{
Length--;
}
else
{
break;
}
}
/* Dump the name, up to the start of the trailing underscores */
for (i = 0; i < Length; i++)
{
}
return (Length);
}
/*******************************************************************************
*
* FUNCTION: AcpiPsDisplayObjectPathname
*
* PARAMETERS: WalkState - Current walk state
* Op - Object whose pathname is to be obtained
*
* RETURN: Status
*
* DESCRIPTION: Diplay the pathname associated with a named object. Two
* versions. One searches the parse tree (for parser-only
* applications suchas AcpiDump), and the other searches the
* ACPI namespace (the parse tree is probably deleted)
*
******************************************************************************/
{
/* Save current debug level so we don't get extraneous debug output */
AcpiDbgLevel = 0;
/* Just get the Node out of the Op object */
if (!Node)
{
/* Node not defined in this scope, look it up */
if (ACPI_FAILURE (Status))
{
/*
* We can't get the pathname since the object is not in the
* namespace. This can happen during single stepping
* where a dynamic named object is *about* to be created.
*/
AcpiOsPrintf (" [Path not found]");
goto Exit;
}
/* Save it for next time. */
}
if (ACPI_FAILURE (Status))
{
AcpiOsPrintf ("****Could not get pathname****)");
goto Exit;
}
Exit:
/* Restore the debug level */
return (Status);
}
/*******************************************************************************
*
* FUNCTION: AcpiDmNamestring
*
* PARAMETERS: Name - ACPI Name string to store
*
* RETURN: None
*
* DESCRIPTION: Decode and dump an ACPI namestring. Handles prefix characters
*
******************************************************************************/
void
char *Name)
{
if (!Name)
{
return;
}
/* Handle all Scope Prefix operators */
{
/* Append prefix character */
Name++;
}
{
case 0:
SegCount = 0;
break;
case AML_DUAL_NAME_PREFIX:
SegCount = 2;
Name++;
break;
case AML_MULTI_NAME_PREFIX_OP:
Name += 2;
break;
default:
SegCount = 1;
break;
}
while (SegCount)
{
/* Append Name segment */
SegCount--;
if (SegCount)
{
/* Not last name, append dot separator */
AcpiOsPrintf (".");
}
Name += ACPI_NAME_SIZE;
}
}
#ifdef ACPI_OBSOLETE_FUNCTIONS
/*******************************************************************************
*
* FUNCTION: AcpiDmDisplayPath
*
* PARAMETERS: Op - Named Op whose path is to be constructed
*
* RETURN: None
*
* DESCRIPTION: Walk backwards from current scope and display the name
* of each previous level of scope up to the root scope
* (like "pwd" does with file systems)
*
******************************************************************************/
void
{
/* We are only interested in named objects */
{
return;
}
{
/* Field creation - check for a fully qualified namepath */
{
}
else
{
}
if ((NamePath) &&
{
return;
}
}
{
/* Search upwards in the tree to find scope with "prev" as its parent */
for (; ;)
{
{
break;
}
/* Go up one level */
}
if (Prev)
{
{
/* Below root scope, append scope name */
if (DoDot)
{
/* Append dot */
AcpiOsPrintf (".");
}
{
{
}
else
{
}
if ((NamePath) &&
{
}
}
else
{
AcpiDmDumpName ((char *) &Name);
}
}
}
}
}
/*******************************************************************************
*
* FUNCTION: AcpiDmValidateName
*
* PARAMETERS: Name - 4 character ACPI name
*
* RETURN: None
*
* DESCRIPTION: Lookup the name
*
******************************************************************************/
void
char *Name,
{
if ((!Name) ||
{
return;
}
{
" /**** Name not found or not accessible from this scope ****/ ");
}
if ((!Name) ||
{
return;
}
if (!TargetOp)
{
/*
* Didn't find the name in the parse tree. This may be
* a problem, or it may simply be one of the predefined names
* (such as _OS_). Rather than worry about looking up all
* the predefined names, just display the name as given
*/
" /**** Name not found or not accessible from this scope ****/ ");
}
}
#endif