Eliminated "Name Tables" and replaced with "Named Objects"

date	2000.08.29.00.39.00;	author rmoore1;	state Exp;
This commit is contained in:
aystarik 2005-06-29 18:13:11 +00:00
parent 5b9866dfe4
commit df9336144a
14 changed files with 6822 additions and 323 deletions

View File

@ -1,9 +1,10 @@
/******************************************************************************
*
* Module Name: nsaccess - Top-level functions for accessing ACPI namespace
/*******************************************************************************
*
*****************************************************************************/
* Module Name: nsaccess - Top-level functions for accessing ACPI namespace
* $Revision: 1.105 $
*
******************************************************************************/
/******************************************************************************
*
@ -38,9 +39,9 @@
* The above copyright and patent license is granted only if the following
* conditions are met:
*
* 3. Conditions
* 3. Conditions
*
* 3.1. Redistribution of Source with Rights to Further Distribute Source.
* 3.1. Redistribution of Source with Rights to Further Distribute Source.
* Redistribution of source code of any substantial portion of the Covered
* Code or modification with rights to further distribute source must include
* the above Copyright Notice, the above License, this list of Conditions,
@ -48,11 +49,11 @@
* Licensee must cause all Covered Code to which Licensee contributes to
* contain a file documenting the changes Licensee made to create that Covered
* Code and the date of any change. Licensee must include in that file the
* documentation of any changes made by any predecessor Licensee. Licensee
* documentation of any changes made by any predecessor Licensee. Licensee
* must include a prominent statement that the modification is derived,
* directly or indirectly, from Original Intel Code.
*
* 3.2. Redistribution of Source with no Rights to Further Distribute Source.
* 3.2. Redistribution of Source with no Rights to Further Distribute Source.
* Redistribution of source code of any substantial portion of the Covered
* Code or modification without rights to further distribute source must
* include the following Disclaimer and Export Compliance provision in the
@ -86,7 +87,7 @@
* INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
* UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
* IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
* PARTICULAR PURPOSE.
* PARTICULAR PURPOSE.
*
* 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
* OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
@ -116,11 +117,11 @@
#define __NSACCESS_C__
#include <acpi.h>
#include <amlcode.h>
#include <interp.h>
#include <namesp.h>
#include <dispatch.h>
#include "acpi.h"
#include "amlcode.h"
#include "acinterp.h"
#include "acnamesp.h"
#include "acdispat.h"
#define _COMPONENT NAMESPACE
@ -128,177 +129,176 @@
/****************************************************************************
*
* FUNCTION: NsRootCreateScope
/*******************************************************************************
*
* PARAMETERS: Entry - NTE for which a scope will be created
*
* RETURN: Status
*
* DESCRIPTION: Create a scope table for the given name table entry
*
* MUTEX: Expects namespace to be locked
*
***************************************************************************/
ACPI_STATUS
NsRootCreateScope (
NAME_TABLE_ENTRY *Entry)
{
FUNCTION_TRACE ("NsRootCreateScope");
/* Allocate a scope table */
if (Entry->Scope)
{
return_ACPI_STATUS (AE_EXIST);
}
Entry->Scope = NsAllocateNameTable (NS_TABLE_SIZE);
if (!Entry->Scope)
{
/* root name table allocation failure */
REPORT_ERROR ("Root name table allocation failure");
return_ACPI_STATUS (AE_NO_MEMORY);
}
/*
* Init the scope first entry -- since it is the exemplar of
* the scope (Some fields are duplicated to new entries!)
*/
NsInitializeTable (Entry->Scope, NULL, Entry);
return_ACPI_STATUS (AE_OK);
}
/****************************************************************************
*
* FUNCTION: NsRootInitialize
* FUNCTION: AcpiNsRootInitialize
*
* PARAMETERS: None
*
* RETURN: Status
*
* DESCRIPTION: Allocate and initialize the root name table
* DESCRIPTION: Allocate and initialize the default root named objects
*
* MUTEX: Locks namespace for entire execution
*
***************************************************************************/
******************************************************************************/
ACPI_STATUS
NsRootInitialize (void)
AcpiNsRootInitialize (void)
{
ACPI_STATUS Status = AE_OK;
PREDEFINED_NAMES *InitVal = NULL;
NAME_TABLE_ENTRY *NewEntry;
ACPI_NAMED_OBJECT *NewNameDesc;
ACPI_OBJECT_INTERNAL *ObjDesc;
FUNCTION_TRACE ("NsRootInitialize");
CmAcquireMutex (MTX_NAMESPACE);
/*
* Root is initially NULL, so a non-NULL value indicates
* that NsRootInitialize() has already been called; just return.
AcpiCmAcquireMutex (ACPI_MTX_NAMESPACE);
/*
* The global root ptr is initially NULL, so a non-NULL value indicates
* that AcpiNsRootInitialize() has already been called; just return.
*/
if (Gbl_RootObject->Scope)
if (AcpiGbl_RootObject)
{
Status = AE_OK;
goto UnlockAndExit;
}
/* Create the root scope */
/*
* Tell the rest of the subsystem that the root is initialized
* (This is OK because the namespace is locked)
*/
AcpiGbl_RootObject = &AcpiGbl_RootNamedObject;
Status = NsRootCreateScope (Gbl_RootObject);
if (ACPI_FAILURE (Status))
{
goto UnlockAndExit;
}
/* Enter the pre-defined names in the name table */
DEBUG_PRINT (ACPI_INFO, ("Entering predefined name table entries into namespace\n"));
for (InitVal = Gbl_PreDefinedNames; InitVal->Name; InitVal++)
DEBUG_PRINT (ACPI_INFO,
("Entering predefined name table entries into namespace\n"));
for (InitVal = AcpiGbl_PreDefinedNames; InitVal->Name; InitVal++)
{
Status = NsLookup (NULL, InitVal->Name, (OBJECT_TYPE_INTERNAL) InitVal->Type,
IMODE_LoadPass2, NS_NO_UPSEARCH, NULL, &NewEntry);
Status = AcpiNsLookup (NULL, InitVal->Name,
(OBJECT_TYPE_INTERNAL) InitVal->Type,
IMODE_LOAD_PASS2, NS_NO_UPSEARCH,
NULL, &NewNameDesc);
/*
* if name entered successfully
* && its entry in PreDefinedNames[] specifies an initial value
*/
if ((Status == AE_OK) &&
NewEntry && InitVal->Val)
if (ACPI_FAILURE (Status) ||
(!NewNameDesc))
{
/* Entry requests an initial value, allocate a descriptor for it. */
ObjDesc = CmCreateInternalObject ((OBJECT_TYPE_INTERNAL) InitVal->Type);
DEBUG_PRINT (ACPI_ERROR,
("Could not create predefined name %s, %s\n",
InitVal->Name, AcpiCmFormatException (Status)));
}
/*
* Name entered successfully.
* If entry in PreDefinedNames[] specifies an
* initial value, create the initial value.
*/
if (InitVal->Val)
{
/*
* Entry requests an initial value, allocate a
* descriptor for it.
*/
ObjDesc = AcpiCmCreateInternalObject (
(OBJECT_TYPE_INTERNAL) InitVal->Type);
if (!ObjDesc)
{
Status = AE_NO_MEMORY;
goto UnlockAndExit;
}
/*
* Convert value string from table entry to internal representation.
* Only types actually used for initial values are implemented here.
/*
* Convert value string from table entry to
* internal representation. Only types actually
* used for initial values are implemented here.
*/
switch (InitVal->Type)
{
case ACPI_TYPE_Number:
case ACPI_TYPE_NUMBER:
ObjDesc->Number.Value = (UINT32) STRTOUL (InitVal->Val, NULL, 10);
ObjDesc->Number.Value =
(UINT32) STRTOUL (InitVal->Val, NULL, 10);
break;
case ACPI_TYPE_String:
case ACPI_TYPE_STRING:
ObjDesc->String.Length = (UINT16) STRLEN (InitVal->Val);
ObjDesc->String.Length =
(UINT16) STRLEN (InitVal->Val);
/*
* Allocate a buffer for the string. All String.Pointers must be
* allocated buffers! (makes deletion simpler)
/*
* Allocate a buffer for the string. All
* String.Pointers must be allocated buffers!
* (makes deletion simpler)
*/
ObjDesc->String.Pointer = CmAllocate ((ACPI_SIZE) (ObjDesc->String.Length + 1));
ObjDesc->String.Pointer = AcpiCmAllocate (
(ObjDesc->String.Length + 1));
if (!ObjDesc->String.Pointer)
{
REPORT_ERROR ("Initial value string allocation failure");
CmRemoveReference (ObjDesc);
REPORT_ERROR ("Initial value string"
"allocation failure");
AcpiCmRemoveReference (ObjDesc);
Status = AE_NO_MEMORY;
goto UnlockAndExit;
}
STRCPY ((char *) ObjDesc->String.Pointer, InitVal->Val);
STRCPY (ObjDesc->String.Pointer, InitVal->Val);
break;
case ACPI_TYPE_Mutex:
case ACPI_TYPE_MUTEX:
ObjDesc->Mutex.SyncLevel = (UINT16) STRTOUL (InitVal->Val, NULL, 10);
Status = OsdCreateSemaphore (1, &ObjDesc->Mutex.Semaphore);
if (ACPI_FAILURE (Status))
{
goto UnlockAndExit;
}
ObjDesc->Mutex.SyncLevel =
(UINT16) STRTOUL (InitVal->Val, NULL, 10);
if (STRCMP (InitVal->Name, "_GL_") == 0)
{
/* We just created the mutex for the global lock, save it */
/*
* Create a counting semaphore for the
* global lock
*/
Status = AcpiOsCreateSemaphore (ACPI_NO_UNIT_LIMIT,
1, &ObjDesc->Mutex.Semaphore);
Gbl_GlobalLockSemaphore = ObjDesc->Mutex.Semaphore;
if (ACPI_FAILURE (Status))
{
goto UnlockAndExit;
}
/*
* We just created the mutex for the
* global lock, save it
*/
AcpiGbl_GlobalLockSemaphore = ObjDesc->Mutex.Semaphore;
}
else
{
/* Create a mutex */
Status = AcpiOsCreateSemaphore (1, 1,
&ObjDesc->Mutex.Semaphore);
if (ACPI_FAILURE (Status))
{
goto UnlockAndExit;
}
}
/* TBD: [Restructure] These fields may be obsolete */
@ -310,34 +310,38 @@ NsRootInitialize (void)
default:
REPORT_ERROR ("Unsupported initial type value");
CmRemoveReference (ObjDesc);
AcpiCmRemoveReference (ObjDesc);
ObjDesc = NULL;
continue;
}
/* Store pointer to value descriptor in nte */
NsAttachObject (NewEntry, ObjDesc, ObjDesc->Common.Type);
/* Store pointer to value descriptor in the Named Object */
AcpiNsAttachObject (NewNameDesc, ObjDesc,
ObjDesc->Common.Type);
}
}
UnlockAndExit:
CmReleaseMutex (MTX_NAMESPACE);
AcpiCmReleaseMutex (ACPI_MTX_NAMESPACE);
return_ACPI_STATUS (Status);
}
/****************************************************************************
/*******************************************************************************
*
* FUNCTION: NsLookup
* FUNCTION: AcpiNsLookup
*
* PARAMETERS: PrefixScope - Search scope if name is not fully qualified
* Pathname - Name to be entered, in internal format
* as represented in the AML stream
* PARAMETERS: PrefixNameDesc - Search scope if name is not fully qualified
* Pathname - Search pathname, in internal format
* (as represented in the AML stream)
* Type - Type associated with name
* InterpreterMode - IMODE_LoadPass2 => add name if not found
* RetEntry - Where the new entry (NTE) is placed
* InterpreterMode - IMODE_LOAD_PASS2 => add name if not found
* Flags - Flags describing the search restrictions
* WalkState - Current state of the walk
* ReturnNameDesc - Where the Named Object is placed (if found
* or created successfully)
*
* RETURN: Status
*
@ -346,102 +350,86 @@ UnlockAndExit:
*
* MUTEX: Assumes namespace is locked.
*
***************************************************************************/
******************************************************************************/
ACPI_STATUS
NsLookup (
AcpiNsLookup (
ACPI_GENERIC_STATE *ScopeInfo,
char *Pathname,
OBJECT_TYPE_INTERNAL Type,
NATIVE_CHAR *Pathname,
OBJECT_TYPE_INTERNAL Type,
OPERATING_MODE InterpreterMode,
UINT32 Flags,
ACPI_WALK_STATE *WalkState,
NAME_TABLE_ENTRY **RetEntry)
UINT32 Flags,
ACPI_WALK_STATE *WalkState,
ACPI_NAMED_OBJECT **ReturnNameDesc)
{
ACPI_STATUS Status;
NAME_TABLE_ENTRY *PrefixScope;
NAME_TABLE_ENTRY *EntryToSearch = NULL;
NAME_TABLE_ENTRY *ThisEntry = NULL;
NAME_TABLE_ENTRY *ScopeToPush = NULL;
ACPI_NAMED_OBJECT *PrefixNameDesc;
ACPI_NAMED_OBJECT *CurrentNameDesc = NULL;
ACPI_NAMED_OBJECT *ScopeToPush = NULL;
ACPI_NAMED_OBJECT *ThisNameDesc = NULL;
UINT32 NumSegments;
UINT32 i;
ACPI_NAME SimpleName;
BOOLEAN NullNamePath = FALSE;
OBJECT_TYPE_INTERNAL TypeToCheckFor;
OBJECT_TYPE_INTERNAL ThisSearchType;
DEBUG_EXEC (UINT32 i)
FUNCTION_TRACE ("NsLookup");
if (!RetEntry)
if (!ReturnNameDesc)
{
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
Gbl_NsLookupCount++;
*RetEntry = ENTRY_NOT_FOUND;
if (!Gbl_RootObject->Scope)
AcpiGbl_NsLookupCount++;
*ReturnNameDesc = ENTRY_NOT_FOUND;
if (!AcpiGbl_RootObject)
{
/*
* If the name space has not been initialized:
* - In Pass1 of Load mode, we need to initialize it
* before trying to define a name.
* - In Exec mode, there are no names to be found.
*/
if (IMODE_LoadPass1 == InterpreterMode)
{
if ((Status = NsRootInitialize ()) != AE_OK)
{
return_ACPI_STATUS (Status);
}
}
else
{
return_ACPI_STATUS (AE_NOT_FOUND);
}
return (AE_NO_NAMESPACE);
}
/*
/*
* Get the prefix scope.
* A null scope means use the root scope
* A null scope means use the root scope
*/
if ((!ScopeInfo) ||
(!ScopeInfo->Scope.Entry))
(!ScopeInfo->Scope.NameTable))
{
PrefixScope = Gbl_RootObject->Scope;
PrefixNameDesc = AcpiGbl_RootObject;
}
else
{
PrefixScope = ScopeInfo->Scope.Entry;
PrefixNameDesc = ScopeInfo->Scope.NameTable;
}
/*
* This check is explicitly split provide relax the TypeToCheckFor
* conditions for BankFieldDefn. Originally, both BankFieldDefn and
* DefFieldDefn caused TypeToCheckFor to be set to ACPI_TYPE_Region,
* DefFieldDefn caused TypeToCheckFor to be set to ACPI_TYPE_REGION,
* but the BankFieldDefn may also check for a Field definition as well
* as an OperationRegion.
*/
if (INTERNAL_TYPE_DefFieldDefn == Type)
if (INTERNAL_TYPE_DEF_FIELD_DEFN == Type)
{
/* DefFieldDefn defines fields in a Region */
TypeToCheckFor = ACPI_TYPE_Region;
TypeToCheckFor = ACPI_TYPE_REGION;
}
else if (INTERNAL_TYPE_BankFieldDefn == Type)
else if (INTERNAL_TYPE_BANK_FIELD_DEFN == Type)
{
/* BankFieldDefn defines data fields in a Field Object */
TypeToCheckFor = ACPI_TYPE_Any;
TypeToCheckFor = ACPI_TYPE_ANY;
}
else
@ -450,6 +438,9 @@ NsLookup (
}
/* TBD: [Restructure] - Move the pathname stuff into a new procedure */
/* Examine the name pointer */
if (!Pathname)
@ -458,281 +449,302 @@ NsLookup (
NullNamePath = TRUE;
NumSegments = 0;
ThisEntry = Gbl_RootObject;
ThisNameDesc = AcpiGbl_RootObject;
DEBUG_PRINT (TRACE_NAMES, ("NsLookup: Null Pathname (Zero segments), Flags=%x\n", Flags));
DEBUG_PRINT (TRACE_NAMES,
("NsLookup: Null Pathname (Zero segments), Flags=%x\n", Flags));
}
else
{
/*
/*
* Valid name pointer (Internal name format)
*
* Check for prefixes. As represented in the AML stream, a Pathname consists
* of an optional scope prefix followed by a segment part.
* Check for prefixes. As represented in the AML stream, a
* Pathname consists of an optional scope prefix followed by
* a segment part.
*
* If present, the scope prefix is either a RootPrefix (in which case the
* name is fully qualified), or zero or more ParentPrefixes (in which case
* the name's scope is relative to the current scope).
* If present, the scope prefix is either a RootPrefix (in
* which case the name is fully qualified), or zero or more
* ParentPrefixes (in which case the name's scope is relative
* to the current scope).
*
* The segment part consists of either:
* - A single 4-byte name segment, or
* - A DualNamePrefix followed by two 4-byte name segments, or
* - A MultiNamePrefixOp, followed by a byte indicating the number of
* segments and the segments themselves.
* - A MultiNamePrefixOp, followed by a byte indicating the
* number of segments and the segments themselves.
*/
if (*Pathname == AML_RootPrefix)
if (*Pathname == AML_ROOT_PREFIX)
{
/* Pathname is fully qualified, look in root name table */
EntryToSearch = Gbl_RootObject->Scope;
Pathname++; /* point to segment part */
DEBUG_PRINT (TRACE_NAMES, ("NsLookup: Searching from root [%p]\n",
EntryToSearch));
CurrentNameDesc = AcpiGbl_RootObject;
/* point to segment part */
Pathname++;
DEBUG_PRINT (TRACE_NAMES,
("NsLookup: Searching from root [%p]\n",
CurrentNameDesc));
/* Direct reference to root, "\" */
if (!(*Pathname))
{
*RetEntry = Gbl_RootObject;
return_ACPI_STATUS (AE_OK);
ThisNameDesc = AcpiGbl_RootObject;
goto CheckForNewScopeAndExit;
}
}
else
{
/* Pathname is relative to current scope, start there */
EntryToSearch = PrefixScope;
DEBUG_PRINT (TRACE_NAMES, ("NsLookup: Searching relative to pfx scope [%p]\n",
PrefixScope));
CurrentNameDesc = PrefixNameDesc;
/* Handle up-prefix (carat). More than one prefix is supported */
DEBUG_PRINT (TRACE_NAMES,
("NsLookup: Searching relative to pfx scope [%p]\n",
PrefixNameDesc));
while (*Pathname == AML_ParentPrefix)
/*
* Handle up-prefix (carat). More than one prefix
* is supported
*/
while (*Pathname == AML_PARENT_PREFIX)
{
/* Point to segment part or next ParentPrefix */
Pathname++;
Pathname++;
/* Backup to the parent's scope */
EntryToSearch = EntryToSearch->ParentEntry;
if (!EntryToSearch)
ThisNameDesc = AcpiNsGetParentObject (CurrentNameDesc);
if (!ThisNameDesc)
{
/* Current scope has no parent scope */
REPORT_ERROR ("NsLookup: Too many parent prefixes or scope has no parent");
REPORT_ERROR ("Too many parent prefixes (^) - reached root");
return_ACPI_STATUS (AE_NOT_FOUND);
}
EntryToSearch = EntryToSearch->Scope;
CurrentNameDesc = ThisNameDesc;
}
}
/* Examine the name prefix opcode, if any, to determine the number of segments */
/*
* Examine the name prefix opcode, if any,
* to determine the number of segments
*/
if (*Pathname == AML_DualNamePrefix)
if (*Pathname == AML_DUAL_NAME_PREFIX)
{
NumSegments = 2;
Pathname++; /* point to first segment */
DEBUG_PRINT (TRACE_NAMES, ("NsLookup: Dual Pathname (2 segments, Flags=%X)\n", Flags));
/* point to first segment */
Pathname++;
DEBUG_PRINT (TRACE_NAMES,
("NsLookup: Dual Pathname (2 segments, Flags=%X)\n", Flags));
}
else if (*Pathname == AML_MultiNamePrefixOp)
else if (*Pathname == AML_MULTI_NAME_PREFIX_OP)
{
NumSegments = (INT32)* (UINT8 *) ++Pathname;
Pathname++; /* point to first segment */
DEBUG_PRINT (TRACE_NAMES, ("NsLookup: Multi Pathname (%d Segments, Flags=%X) \n", NumSegments, Flags));
NumSegments = (UINT32)* (UINT8 *) ++Pathname;
/* point to first segment */
Pathname++;
DEBUG_PRINT (TRACE_NAMES,
("NsLookup: Multi Pathname (%d Segments, Flags=%X) \n",
NumSegments, Flags));
}
else
{
/*
/*
* No Dual or Multi prefix, hence there is only one
* segment and Pathname is already pointing to it.
*/
NumSegments = 1;
DEBUG_PRINT (TRACE_NAMES, ("NsLookup: Simple Pathname (1 segment, Flags=%X)\n", Flags));
DEBUG_PRINT (TRACE_NAMES,
("NsLookup: Simple Pathname (1 segment, Flags=%X)\n", Flags));
}
#ifdef ACPI_DEBUG
/* TBD: [Restructure] Make this a procedure */
/* Debug only: print the entire name that we are about to lookup */
DEBUG_PRINT (TRACE_NAMES, ("NsLookup: ["));
for (i = 0; i < NumSegments; i++)
{
DEBUG_PRINT_RAW (TRACE_NAMES, ("%4.4s/", &Pathname[i * 4]));
}
DEBUG_PRINT_RAW (TRACE_NAMES, ("]\n"));
#endif
}
/*
* Search namespace for each segment of the name.
* Loop through and verify/add each name segment.
*/
while (NumSegments-- && EntryToSearch)
while (NumSegments-- && CurrentNameDesc)
{
/*
* Search for the current segment in the table where it should be.
* Type is significant only at the last (topmost) level.
/*
* Search for the current name segment under the current
* named object. The Type is significant only at the last (topmost)
* level. (We don't care about the types along the path, only
* the type of the final target object.)
*/
ThisSearchType = ACPI_TYPE_Any;
ThisSearchType = ACPI_TYPE_ANY;
if (!NumSegments)
{
ThisSearchType = Type;
}
STORE32TO32 (&SimpleName, Pathname);
Status = NsSearchAndEnter (SimpleName, WalkState, EntryToSearch, InterpreterMode,
ThisSearchType, Flags, &ThisEntry);
if (Status != AE_OK)
/* Pluck and ACPI name from the front of the pathname */
MOVE_UNALIGNED32_TO_32 (&SimpleName, Pathname);
/* Try to find the ACPI name */
Status = AcpiNsSearchAndEnter (SimpleName, WalkState,
CurrentNameDesc, InterpreterMode,
ThisSearchType, Flags,
&ThisNameDesc);
if (ACPI_FAILURE (Status))
{
if (Status == AE_NOT_FOUND)
{
/* Name not in ACPI namespace */
/* Name not found in ACPI namespace */
if (IMODE_LoadPass1 == InterpreterMode ||
IMODE_LoadPass2 == InterpreterMode)
{
REPORT_ERROR ("Name table overflow");
}
else
{
DEBUG_PRINT (TRACE_NAMES, ("NsLookup: Name not found in this scope\n"));
}
DEBUG_PRINT (TRACE_NAMES,
("NsLookup: Name [%4.4s] not found in scope %X\n",
&SimpleName, CurrentNameDesc));
}
return_ACPI_STATUS (Status);
}
if (NumSegments == 0 && /* If last segment */
TypeToCheckFor != ACPI_TYPE_Any && /* and looking for a specific type */
TypeToCheckFor != INTERNAL_TYPE_DefAny && /* which is not a local type */
TypeToCheckFor != INTERNAL_TYPE_Scope && /* " " " " " " */
TypeToCheckFor != INTERNAL_TYPE_IndexFieldDefn && /* " " " " " " */
ThisEntry->Type != ACPI_TYPE_Any && /* and type of entry is known */
ThisEntry->Type != TypeToCheckFor) /* and entry does not match request */
{ /* complain. */
/* Complain about type mismatch */
/*
* If 1) This is the last segment (NumSegments == 0)
* 2) and looking for a specific type
* (Not checking for TYPE_ANY)
* 3) which is not a local type (TYPE_DEF_ANY)
* 4) which is not a local type (TYPE_SCOPE)
* 5) which is not a local type (TYPE_INDEX_FIELD_DEFN)
* 6) and type of object is known (not TYPE_ANY)
* 7) and object does not match request
*
* Then we have a type mismatch. Just warn and ignore it.
*/
if ((NumSegments == 0) &&
(TypeToCheckFor != ACPI_TYPE_ANY) &&
(TypeToCheckFor != INTERNAL_TYPE_DEF_ANY) &&
(TypeToCheckFor != INTERNAL_TYPE_SCOPE) &&
(TypeToCheckFor != INTERNAL_TYPE_INDEX_FIELD_DEFN) &&
(ThisNameDesc->Type != ACPI_TYPE_ANY) &&
(ThisNameDesc->Type != TypeToCheckFor))
{
/* Complain about a type mismatch */
REPORT_WARNING ("Type mismatch");
DEBUG_PRINT (ACPI_WARN, ("NsLookup: %4.4s, type 0x%X, checking for type 0x%X\n",
&SimpleName, ThisEntry->Type, TypeToCheckFor));
DEBUG_PRINT (ACPI_WARN,
("NsLookup: %4.4s, type 0x%X, checking for type 0x%X\n",
&SimpleName, ThisNameDesc->Type, TypeToCheckFor));
}
/*
* If last segment and not looking for a specific type, but type of
* found entry is known, use that type to see if it opens a scope.
* If this is the last name segment and we are not looking for a
* specific type, but the type of found object is known, use that type
* to see if it opens a scope.
*/
if ((0 == NumSegments) && (ACPI_TYPE_Any == Type))
if ((0 == NumSegments) && (ACPI_TYPE_ANY == Type))
{
Type = ThisEntry->Type;
Type = ThisNameDesc->Type;
}
if ((NumSegments || NsOpensScope (Type)) &&
(ThisEntry->Scope == NULL))
if ((NumSegments || AcpiNsOpensScope (Type)) &&
(ThisNameDesc->Child == NULL))
{
/*
* More segments or the type implies enclosed scope,
/*
* More segments or the type implies enclosed scope,
* and the next scope has not been allocated.
*/
DEBUG_PRINT (ACPI_INFO, ("NsLookup: Load mode=%d ThisEntry=%x\n", InterpreterMode, ThisEntry));
if ((IMODE_LoadPass1 == InterpreterMode) ||
(IMODE_LoadPass2 == InterpreterMode))
{
/* First or second pass load mode ==> locate the next scope */
DEBUG_PRINT (TRACE_NAMES, ("NsLookup: Creating and adding a new scope\n"));
ThisEntry->Scope = NsAllocateNameTable (NS_TABLE_SIZE);
if (!ThisEntry->Scope)
{
return_ACPI_STATUS (AE_NO_MEMORY);
}
}
/* Now complain if there is no next scope */
if (ThisEntry->Scope == NULL)
{
if (IMODE_LoadPass1 == InterpreterMode ||
IMODE_LoadPass2 == InterpreterMode)
{
DEBUG_PRINT (ACPI_ERROR, ("NsLookup: ***Error - No child scope at entry %p\n", ThisEntry));
REPORT_ERROR ("Name Table allocation failure");
return_ACPI_STATUS (AE_NOT_FOUND);
}
DEBUG_PRINT (ACPI_INFO, ("NsLookup: No child scope at entry %p\n", ThisEntry));
return_ACPI_STATUS (AE_NOT_FOUND);
}
/* Scope table initialization */
if (IMODE_LoadPass1 == InterpreterMode ||
IMODE_LoadPass2 == InterpreterMode)
{
/* Initialize the new table */
NsInitializeTable (ThisEntry->Scope, EntryToSearch, ThisEntry);
}
DEBUG_PRINT (ACPI_INFO,
("NsLookup: Load mode=%d ThisNameDesc=%x\n",
InterpreterMode, ThisNameDesc));
}
EntryToSearch = ThisEntry->Scope;
Pathname += ACPI_NAME_SIZE; /* point to next name segment */
CurrentNameDesc = ThisNameDesc;
/* point to next name segment */
Pathname += ACPI_NAME_SIZE;
}
/*
* Always check if we need to open a new scope
*/
CheckForNewScopeAndExit:
if (!(Flags & NS_DONT_OPEN_SCOPE) && (WalkState))
{
/*
/*
* If entry is a type which opens a scope,
* push the new scope on the scope stack.
*/
if (NsOpensScope (TypeToCheckFor))
if (AcpiNsOpensScope (TypeToCheckFor))
{
/* 8-12-98 ASL Grammar Update supports null NamePath */
if (NullNamePath)
{
ScopeToPush = ThisEntry;
/* TBD: [Investigate] - is this the correct thing to do? */
ScopeToPush = NULL;
}
else
{
ScopeToPush = ThisEntry->Scope;
ScopeToPush = ThisNameDesc;
}
Status = DsScopeStackPush (ScopeToPush, Type, WalkState);
Status = AcpiDsScopeStackPush (ScopeToPush, Type,
WalkState);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
DEBUG_PRINT (ACPI_INFO, ("NsLookup: Set global scope to %p\n", ScopeToPush));
DEBUG_PRINT (ACPI_INFO,
("NsLookup: Set global scope to %p\n", ScopeToPush));
}
}
*RetEntry = ThisEntry;
*ReturnNameDesc = ThisNameDesc;
return_ACPI_STATUS (AE_OK);
}

View File

@ -0,0 +1,726 @@
/*******************************************************************************
*
* Module Name: nsalloc - Namespace allocation and deletion utilities
* $Revision: 1.38 $
*
******************************************************************************/
/******************************************************************************
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, Intel Corp. All rights
* reserved.
*
* 2. License
*
* 2.1. This is your license from Intel Corp. under its intellectual property
* rights. You may have additional license terms from the party that provided
* you this software, covering your right to use that party's intellectual
* property rights.
*
* 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
* copy of the source code appearing in this file ("Covered Code") an
* irrevocable, perpetual, worldwide license under Intel's copyrights in the
* base code distributed originally by Intel ("Original Intel Code") to copy,
* make derivatives, distribute, use and display any portion of the Covered
* Code in any form, with the right to sublicense such rights; and
*
* 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
* license (with the right to sublicense), under only those claims of Intel
* patents that are infringed by the Original Intel Code, to make, use, sell,
* offer to sell, and import the Covered Code and derivative works thereof
* solely to the minimum extent necessary to exercise the above copyright
* license, and in no event shall the patent license extend to any additions
* to or modifications of the Original Intel Code. No other license or right
* is granted directly or by implication, estoppel or otherwise;
*
* The above copyright and patent license is granted only if the following
* conditions are met:
*
* 3. Conditions
*
* 3.1. Redistribution of Source with Rights to Further Distribute Source.
* Redistribution of source code of any substantial portion of the Covered
* Code or modification with rights to further distribute source must include
* the above Copyright Notice, the above License, this list of Conditions,
* and the following Disclaimer and Export Compliance provision. In addition,
* Licensee must cause all Covered Code to which Licensee contributes to
* contain a file documenting the changes Licensee made to create that Covered
* Code and the date of any change. Licensee must include in that file the
* documentation of any changes made by any predecessor Licensee. Licensee
* must include a prominent statement that the modification is derived,
* directly or indirectly, from Original Intel Code.
*
* 3.2. Redistribution of Source with no Rights to Further Distribute Source.
* Redistribution of source code of any substantial portion of the Covered
* Code or modification without rights to further distribute source must
* include the following Disclaimer and Export Compliance provision in the
* documentation and/or other materials provided with distribution. In
* addition, Licensee may not authorize further sublicense of source of any
* portion of the Covered Code, and must include terms to the effect that the
* license from Licensee to its licensee is limited to the intellectual
* property embodied in the software Licensee provides to its licensee, and
* not to intellectual property embodied in modifications its licensee may
* make.
*
* 3.3. Redistribution of Executable. Redistribution in executable form of any
* substantial portion of the Covered Code or modification must reproduce the
* above Copyright Notice, and the following Disclaimer and Export Compliance
* provision in the documentation and/or other materials provided with the
* distribution.
*
* 3.4. Intel retains all right, title, and interest in and to the Original
* Intel Code.
*
* 3.5. Neither the name Intel nor any other trademark owned or controlled by
* Intel shall be used in advertising or otherwise to promote the sale, use or
* other dealings in products derived from or relating to the Covered Code
* without prior written authorization from Intel.
*
* 4. Disclaimer and Export Compliance
*
* 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
* HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
* IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
* INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
* UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
* IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
* PARTICULAR PURPOSE.
*
* 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
* OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
* COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
* SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
* CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
* HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
* SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
* LIMITED REMEDY.
*
* 4.3. Licensee shall not export, either directly or indirectly, any of this
* software or system incorporating such software without first obtaining any
* required license or other approval from the U. S. Department of Commerce or
* any other agency or department of the United States Government. In the
* event Licensee exports any such software from the United States or
* re-exports any such software from a foreign destination, Licensee shall
* ensure that the distribution and export/re-export of the software is in
* compliance with all laws, regulations, orders, or other restrictions of the
* U.S. Export Administration Regulations. Licensee agrees that neither it nor
* any of its subsidiaries will export/re-export any technical data, process,
* software, or service, directly or indirectly, to any country for which the
* United States government or any agency thereof requires an export license,
* other governmental approval, or letter of assurance, without first obtaining
* such license, approval or letter.
*
*****************************************************************************/
#define __NSALLOC_C__
#include "acpi.h"
#include "acnamesp.h"
#include "acinterp.h"
#define _COMPONENT NAMESPACE
MODULE_NAME ("nsalloc");
/*******************************************************************************
*
* FUNCTION: AcpiNsCreateNamedObject
*
* PARAMETERS:
*
* RETURN: None
*
* DESCRIPTION:
*
******************************************************************************/
ACPI_NAMED_OBJECT *
AcpiNsCreateNamedObject (
UINT32 AcpiName)
{
ACPI_NAMED_OBJECT *NameDesc;
FUNCTION_TRACE ("NsCreateNamedObject");
NameDesc = AcpiCmCallocate (sizeof (ACPI_NAMED_OBJECT));
if (!NameDesc)
{
return_PTR (NULL);
}
INCREMENT_NAME_TABLE_METRICS (sizeof (ACPI_NAMED_OBJECT));
NameDesc->DataType = ACPI_DESC_TYPE_NAMED;
NameDesc->Name = AcpiName;
NameDesc->ReferenceCount = 1;
return_PTR (NameDesc);
}
/*******************************************************************************
*
* FUNCTION: AcpiNsDeleteNamedObject
*
* PARAMETERS:
*
* RETURN: None
*
* DESCRIPTION:
*
******************************************************************************/
void
AcpiNsDeleteNamedObject (
ACPI_NAMED_OBJECT *NameDesc)
{
ACPI_NAMED_OBJECT *ParentDesc;
ACPI_NAMED_OBJECT *PrevDesc;
ACPI_NAMED_OBJECT *NextDesc;
FUNCTION_TRACE_PTR ("NsDeleteNamedObject", NameDesc);
ParentDesc = AcpiNsGetParentObject (NameDesc);
PrevDesc = NULL;
NextDesc = ParentDesc->Child;
while (NextDesc != NameDesc)
{
PrevDesc = NextDesc;
NextDesc = PrevDesc->Peer;
}
if (PrevDesc)
{
PrevDesc->Peer = NextDesc->Peer;
if (NextDesc->Flags & ANOBJ_END_OF_PEER_LIST)
{
PrevDesc->Flags |= ANOBJ_END_OF_PEER_LIST;
}
}
else
{
ParentDesc->Child = NextDesc->Peer;
}
DECREMENT_NAME_TABLE_METRICS (sizeof (ACPI_NAMED_OBJECT));
/*
* Detach an object if there is one
*/
if (NameDesc->Object)
{
AcpiNsDetachObject (NameDesc);
}
AcpiCmFree (NameDesc);
return_VOID;
}
/*******************************************************************************
*
* FUNCTION: AcpiNsInstallNamedObject
*
* PARAMETERS: WalkState - Current state of the walk
* ParentDesc - The parent of the new Named Object
* NameDesc - The new Named Object to install
* Type - ACPI object type of the new Named Object
*
* RETURN: None
*
* DESCRIPTION: Initialize a new entry within a namespace table.
*
******************************************************************************/
void
AcpiNsInstallNamedObject (
ACPI_WALK_STATE *WalkState,
ACPI_NAMED_OBJECT *ParentDesc, /* Parent */
ACPI_NAMED_OBJECT *NameDesc, /* New Child*/
OBJECT_TYPE_INTERNAL Type)
{
UINT16 OwnerId = TABLE_ID_DSDT;
ACPI_NAMED_OBJECT *ChildDesc;
FUNCTION_TRACE ("NsInstallNamedObject");
/*
* Get the owner ID from the Walk state
* The owner ID is used to track table deletion and
* deletion of objects created by methods
*/
if (WalkState)
{
OwnerId = WalkState->OwnerId;
}
/* link the new entry into the parent and existing children */
/* TBD: Could be first, last, or alphabetic */
ChildDesc = ParentDesc->Child;
if (!ChildDesc)
{
ParentDesc->Child = NameDesc;
}
else
{
while (!(ChildDesc->Flags & ANOBJ_END_OF_PEER_LIST))
{
ChildDesc = ChildDesc->Peer;
}
ChildDesc->Peer = NameDesc;
/* Clear end-of-list flag */
ChildDesc->Flags &= ~ANOBJ_END_OF_PEER_LIST;
}
/* Init the new entry */
NameDesc->OwnerId = OwnerId;
NameDesc->Flags |= ANOBJ_END_OF_PEER_LIST;
NameDesc->Peer = ParentDesc;
/*
* If adding a name with unknown type, or having to
* add the region in order to define fields in it, we
* have a forward reference.
*/
if ((ACPI_TYPE_ANY == Type) ||
(INTERNAL_TYPE_DEF_FIELD_DEFN == Type) ||
(INTERNAL_TYPE_BANK_FIELD_DEFN == Type))
{
/*
* We don't want to abort here, however!
* We will fill in the actual type when the
* real definition is found later.
*/
DEBUG_PRINT (ACPI_INFO,
("NsInstallNamedObject: [%4.4s] is a forward reference\n",
&NameDesc->Name));
}
/*
* The DefFieldDefn and BankFieldDefn cases are actually
* looking up the Region in which the field will be defined
*/
if ((INTERNAL_TYPE_DEF_FIELD_DEFN == Type) ||
(INTERNAL_TYPE_BANK_FIELD_DEFN == Type))
{
Type = ACPI_TYPE_REGION;
}
/*
* Scope, DefAny, and IndexFieldDefn are bogus "types" which do
* not actually have anything to do with the type of the name
* being looked up. Save any other value of Type as the type of
* the entry.
*/
if ((Type != INTERNAL_TYPE_SCOPE) &&
(Type != INTERNAL_TYPE_DEF_ANY) &&
(Type != INTERNAL_TYPE_INDEX_FIELD_DEFN))
{
NameDesc->Type = (UINT8) Type;
}
DEBUG_PRINT (TRACE_NAMES,
("NsInstallNamedObject: %4.4s added to %p at %p\n",
&NameDesc->Name, ParentDesc, NameDesc));
/*
* Increment the reference count(s) of all parents up to
* the root!
*/
while ((NameDesc = AcpiNsGetParentObject (NameDesc)) != NULL)
{
NameDesc->ReferenceCount++;
}
return_VOID;
}
/*******************************************************************************
*
* FUNCTION: AcpiNsDeleteChildren
*
* PARAMETERS: ParentDesc - Delete this objects children
*
* RETURN: None.
*
* DESCRIPTION: Delete all children of the parent object. Deletes a
* "scope".
*
******************************************************************************/
void
AcpiNsDeleteChildren (
ACPI_NAMED_OBJECT *ParentDesc)
{
ACPI_NAMED_OBJECT *ChildDesc;
ACPI_NAMED_OBJECT *NextDesc;
UINT8 Flags;
FUNCTION_TRACE_PTR ("AcpiNsDeleteChildren", ParentDesc);
if (!ParentDesc)
{
return_VOID;
}
/* If no children, all done! */
ChildDesc = ParentDesc->Child;
if (!ChildDesc)
{
return_VOID;
}
/*
* Deallocate all children at this level
*/
do
{
/* Get the things we need */
NextDesc = ChildDesc->Peer;
Flags = ChildDesc->Flags;
/* Grandchildren should have all been deleted already */
if (ChildDesc->Child)
{
DEBUG_PRINT (ACPI_ERROR,
("NsDeleteChildren: Found a grandchild! P=%X C=%X\n",
ParentDesc, ChildDesc));
}
/* Now we can free this child object */
DECREMENT_NAME_TABLE_METRICS (sizeof (ACPI_NAMED_OBJECT));
DEBUG_PRINT (ACPI_INFO,
("AcpiNsDeleteChildren: Object %p, Remaining %d\n",
ChildDesc, AcpiGbl_CurrentNamedObjectCount));
/*
* Detach an object if there is one
*/
if (ChildDesc->Object)
{
AcpiNsDetachObject (ChildDesc);
}
AcpiCmFree (ChildDesc);
/* And move on to the next child in the list */
ChildDesc = NextDesc;
} while (!(Flags & ANOBJ_END_OF_PEER_LIST));
/* Clear the parent's child pointer */
ParentDesc->Child = NULL;
return_VOID;
}
/*******************************************************************************
*
* FUNCTION: AcpiNsDeleteNamespaceSubtree
*
* PARAMETERS: None.
*
* RETURN: None.
*
* DESCRIPTION: Delete a subtree of the namespace. This includes all objects
* stored within the subtree. Scope tables are deleted also
*
******************************************************************************/
ACPI_STATUS
AcpiNsDeleteNamespaceSubtree (
ACPI_NAMED_OBJECT *ParentDesc)
{
ACPI_NAMED_OBJECT *ChildDesc;
UINT32 Level;
ACPI_OBJECT_INTERNAL *ObjDesc;
FUNCTION_TRACE ("NsDeleteNamespaceSubtree");
ChildDesc = 0;
Level = 1;
/*
* Traverse the tree of objects until we bubble back up
* to where we started.
*/
while (Level > 0)
{
/*
* Get the next typed object in this scope.
* Null returned if not found
*/
ChildDesc = AcpiNsGetNextObject (ACPI_TYPE_ANY, ParentDesc,
ChildDesc);
if (ChildDesc)
{
/*
* Found an object - delete the object within
* the Value field
*/
ObjDesc = AcpiNsGetAttachedObject (ChildDesc);
if (ObjDesc)
{
AcpiNsDetachObject (ChildDesc);
AcpiCmRemoveReference (ObjDesc);
}
/* Check if this object has any children */
if (AcpiNsGetNextObject (ACPI_TYPE_ANY, ChildDesc, 0))
{
/*
* There is at least one child of this object,
* visit the object
*/
Level++;
ParentDesc = ChildDesc;
ChildDesc = 0;
}
}
else
{
/*
* No more children in this object.
* We will move up to the grandparent.
*/
Level--;
/*
* Now delete all of the children of this parent
* all at the same time.
*/
AcpiNsDeleteChildren (ParentDesc);
/* New "last child" is this parent object */
ChildDesc = ParentDesc;
/* Now we can move up the tree to the grandparent */
ParentDesc = AcpiNsGetParentObject (ParentDesc);
}
}
return_ACPI_STATUS (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: AcpiNsRemoveReference
*
* PARAMETERS: NameDesc - Named object whose reference count is to be
* decremented
*
* RETURN: None.
*
* DESCRIPTION: Remove a Named Object reference. Decrements the reference count
* of all parent Named Objects up to the root. Any object along
* the way that reaches zero references is freed.
*
******************************************************************************/
void
AcpiNsRemoveReference (
ACPI_NAMED_OBJECT *NameDesc)
{
ACPI_NAMED_OBJECT *CurrentDesc;
/*
* Decrement the reference count(s) of this object and all
* objects up to the root, Delete anything with zero remaining references.
*/
CurrentDesc = NameDesc;
while (CurrentDesc)
{
/* Decrement the reference count on this object*/
CurrentDesc->ReferenceCount--;
/* Delete the object if no more references */
if (!CurrentDesc->ReferenceCount)
{
/* Delete all children and delete the object */
AcpiNsDeleteChildren (CurrentDesc);
AcpiNsDeleteNamedObject (CurrentDesc);
}
/* Move up to parent */
CurrentDesc = AcpiNsGetParentObject (CurrentDesc);
}
}
/*******************************************************************************
*
* FUNCTION: AcpiNsDeleteNamespaceByOwner
*
* PARAMETERS: None.
*
* RETURN: None.
*
* DESCRIPTION: Delete entries within the namespace that are owned by a
* specific ID. Used to delete entire ACPI tables. All
* reference counts are updated.
*
******************************************************************************/
ACPI_STATUS
AcpiNsDeleteNamespaceByOwner (
UINT16 OwnerId)
{
ACPI_NAMED_OBJECT *ChildDesc;
UINT32 Level;
ACPI_OBJECT_INTERNAL *ObjDesc;
ACPI_NAMED_OBJECT *ParentDesc;
FUNCTION_TRACE ("NsDeleteNamespaceSubtree");
ParentDesc = AcpiGbl_RootObject;
ChildDesc = 0;
Level = 1;
/*
* Traverse the tree of objects until we bubble back up
* to where we started.
*/
while (Level > 0)
{
/*
* Get the next typed object in this scope.
* Null returned if not found
*/
ChildDesc = AcpiNsGetNextObject (ACPI_TYPE_ANY, ParentDesc,
ChildDesc);
if (ChildDesc)
{
if (ChildDesc->OwnerId == OwnerId)
{
/*
* Found an object - delete the object within
* the Value field
*/
ObjDesc = AcpiNsGetAttachedObject (ChildDesc);
if (ObjDesc)
{
AcpiNsDetachObject (ChildDesc);
AcpiCmRemoveReference (ObjDesc);
}
}
/* Check if this object has any children */
if (AcpiNsGetNextObject (ACPI_TYPE_ANY, ChildDesc, 0))
{
/*
* There is at least one child of this object,
* visit the object
*/
Level++;
ParentDesc = ChildDesc;
ChildDesc = 0;
}
else if (ChildDesc->OwnerId == OwnerId)
{
AcpiNsRemoveReference (ChildDesc);
}
}
else
{
/*
* No more children in this object. Move up to grandparent.
*/
Level--;
if (Level != 0)
{
if (ParentDesc->OwnerId == OwnerId)
{
AcpiNsRemoveReference (ParentDesc);
}
}
/* New "last child" is this parent object */
ChildDesc = ParentDesc;
/* Now we can move up the tree to the grandparent */
ParentDesc = AcpiNsGetParentObject (ParentDesc);
}
}
return_ACPI_STATUS (AE_OK);
}

View File

@ -0,0 +1,678 @@
/******************************************************************************
*
* Module Name: nsdump - table dumping routines for debug
* $Revision: 1.75 $
*
*****************************************************************************/
/******************************************************************************
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, Intel Corp. All rights
* reserved.
*
* 2. License
*
* 2.1. This is your license from Intel Corp. under its intellectual property
* rights. You may have additional license terms from the party that provided
* you this software, covering your right to use that party's intellectual
* property rights.
*
* 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
* copy of the source code appearing in this file ("Covered Code") an
* irrevocable, perpetual, worldwide license under Intel's copyrights in the
* base code distributed originally by Intel ("Original Intel Code") to copy,
* make derivatives, distribute, use and display any portion of the Covered
* Code in any form, with the right to sublicense such rights; and
*
* 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
* license (with the right to sublicense), under only those claims of Intel
* patents that are infringed by the Original Intel Code, to make, use, sell,
* offer to sell, and import the Covered Code and derivative works thereof
* solely to the minimum extent necessary to exercise the above copyright
* license, and in no event shall the patent license extend to any additions
* to or modifications of the Original Intel Code. No other license or right
* is granted directly or by implication, estoppel or otherwise;
*
* The above copyright and patent license is granted only if the following
* conditions are met:
*
* 3. Conditions
*
* 3.1. Redistribution of Source with Rights to Further Distribute Source.
* Redistribution of source code of any substantial portion of the Covered
* Code or modification with rights to further distribute source must include
* the above Copyright Notice, the above License, this list of Conditions,
* and the following Disclaimer and Export Compliance provision. In addition,
* Licensee must cause all Covered Code to which Licensee contributes to
* contain a file documenting the changes Licensee made to create that Covered
* Code and the date of any change. Licensee must include in that file the
* documentation of any changes made by any predecessor Licensee. Licensee
* must include a prominent statement that the modification is derived,
* directly or indirectly, from Original Intel Code.
*
* 3.2. Redistribution of Source with no Rights to Further Distribute Source.
* Redistribution of source code of any substantial portion of the Covered
* Code or modification without rights to further distribute source must
* include the following Disclaimer and Export Compliance provision in the
* documentation and/or other materials provided with distribution. In
* addition, Licensee may not authorize further sublicense of source of any
* portion of the Covered Code, and must include terms to the effect that the
* license from Licensee to its licensee is limited to the intellectual
* property embodied in the software Licensee provides to its licensee, and
* not to intellectual property embodied in modifications its licensee may
* make.
*
* 3.3. Redistribution of Executable. Redistribution in executable form of any
* substantial portion of the Covered Code or modification must reproduce the
* above Copyright Notice, and the following Disclaimer and Export Compliance
* provision in the documentation and/or other materials provided with the
* distribution.
*
* 3.4. Intel retains all right, title, and interest in and to the Original
* Intel Code.
*
* 3.5. Neither the name Intel nor any other trademark owned or controlled by
* Intel shall be used in advertising or otherwise to promote the sale, use or
* other dealings in products derived from or relating to the Covered Code
* without prior written authorization from Intel.
*
* 4. Disclaimer and Export Compliance
*
* 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
* HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
* IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
* INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
* UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
* IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
* PARTICULAR PURPOSE.
*
* 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
* OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
* COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
* SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
* CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
* HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
* SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
* LIMITED REMEDY.
*
* 4.3. Licensee shall not export, either directly or indirectly, any of this
* software or system incorporating such software without first obtaining any
* required license or other approval from the U. S. Department of Commerce or
* any other agency or department of the United States Government. In the
* event Licensee exports any such software from the United States or
* re-exports any such software from a foreign destination, Licensee shall
* ensure that the distribution and export/re-export of the software is in
* compliance with all laws, regulations, orders, or other restrictions of the
* U.S. Export Administration Regulations. Licensee agrees that neither it nor
* any of its subsidiaries will export/re-export any technical data, process,
* software, or service, directly or indirectly, to any country for which the
* United States government or any agency thereof requires an export license,
* other governmental approval, or letter of assurance, without first obtaining
* such license, approval or letter.
*
*****************************************************************************/
#define __NSDUMP_C__
#include "acpi.h"
#include "acinterp.h"
#include "acnamesp.h"
#include "actables.h"
#define _COMPONENT NAMESPACE
MODULE_NAME ("nsdump");
#ifdef ACPI_DEBUG
/****************************************************************************
*
* FUNCTION: AcpiNsDumpPathname
*
* PARAMETERS: Handle - Object
* Msg - Prefix message
* Level - Desired debug level
* Component - Caller's component ID
*
* DESCRIPTION: Print an object's full namespace pathname
* Manages allocation/freeing of a pathname buffer
*
***************************************************************************/
ACPI_STATUS
AcpiNsDumpPathname (
ACPI_HANDLE Handle,
NATIVE_CHAR *Msg,
UINT32 Level,
UINT32 Component)
{
NATIVE_CHAR *Buffer;
UINT32 Length;
FUNCTION_TRACE ("NsDumpPathname");
/* Do this only if the requested debug level and component are enabled */
if (!(AcpiDbgLevel & Level) || !(AcpiDbgLayer & Component))
{
return_ACPI_STATUS (AE_OK);
}
Buffer = AcpiCmAllocate (PATHNAME_MAX);
if (!Buffer)
{
return_ACPI_STATUS (AE_NO_MEMORY);
}
/* Convert handle to a full pathname and print it (with supplied message) */
Length = PATHNAME_MAX;
if (ACPI_SUCCESS (AcpiNsHandleToPathname (Handle, &Length, Buffer)))
{
AcpiOsPrintf ("%s %s (%p)\n", Msg, Buffer, Handle);
}
AcpiCmFree (Buffer);
return_ACPI_STATUS (AE_OK);
}
/****************************************************************************
*
* FUNCTION: AcpiNsDumpOneObject
*
* PARAMETERS: Handle - Named Object to be dumped
* Level - Nesting level of the handle
* Context - Passed into WalkNamespace
*
* DESCRIPTION: Dump a single Named Object
* This procedure is a UserFunction called by AcpiNsWalkNamespace.
*
***************************************************************************/
ACPI_STATUS
AcpiNsDumpOneObject (
ACPI_HANDLE ObjHandle,
UINT32 Level,
void *Context,
void **ReturnValue)
{
ACPI_WALK_INFO *Info = (ACPI_WALK_INFO *) Context;
ACPI_NAMED_OBJECT *ThisNameDesc;
UINT8 *Value;
ACPI_OBJECT_INTERNAL *ObjDesc = NULL;
OBJECT_TYPE_INTERNAL ObjType;
OBJECT_TYPE_INTERNAL Type;
UINT32 BytesToDump;
UINT32 DownstreamSiblingMask = 0;
UINT32 LevelTmp;
UINT32 WhichBit;
ThisNameDesc = AcpiNsConvertHandleToEntry (ObjHandle);
LevelTmp = Level;
Type = ThisNameDesc->Type;
WhichBit = 1;
if (!(AcpiDbgLevel & Info->DebugLevel))
{
return (AE_OK);
}
if (!ObjHandle)
{
DEBUG_PRINT (ACPI_INFO, ("Null object handle\n"));
return (AE_OK);
}
/* Check if the owner matches */
if ((Info->OwnerId != ACPI_UINT32_MAX) &&
(Info->OwnerId != ThisNameDesc->OwnerId))
{
return (AE_OK);
}
/* Indent the object according to the level */
while (LevelTmp--)
{
/* Print appropriate characters to form tree structure */
if (LevelTmp)
{
if (DownstreamSiblingMask & WhichBit)
{
DEBUG_PRINT_RAW (TRACE_TABLES, ("|"));
}
else
{
DEBUG_PRINT_RAW (TRACE_TABLES, (" "));
}
WhichBit <<= 1;
}
else
{
if (AcpiNsExistDownstreamSibling (ThisNameDesc + 1))
{
DownstreamSiblingMask |= (1 << (Level - 1));
DEBUG_PRINT_RAW (TRACE_TABLES, ("+"));
}
else
{
DownstreamSiblingMask &= 0xffffffff ^ (1 << (Level - 1));
DEBUG_PRINT_RAW (TRACE_TABLES, ("+"));
}
if (ThisNameDesc->Child == NULL)
{
DEBUG_PRINT_RAW (TRACE_TABLES, ("-"));
}
else if (AcpiNsExistDownstreamSibling (ThisNameDesc->Child))
{
DEBUG_PRINT_RAW (TRACE_TABLES, ("+"));
}
else
{
DEBUG_PRINT_RAW (TRACE_TABLES, ("-"));
}
}
}
/* Check the integrity of our data */
if (Type > INTERNAL_TYPE_MAX)
{
Type = INTERNAL_TYPE_DEF_ANY; /* prints as *ERROR* */
}
if (!AcpiCmValidAcpiName (ThisNameDesc->Name))
{
REPORT_WARNING ("Invalid Name");
}
/*
* Now we can print out the pertinent information
*/
DEBUG_PRINT_RAW (TRACE_TABLES, (" %4.4s %-9s ", &ThisNameDesc->Name, AcpiCmGetTypeName (Type)));
DEBUG_PRINT_RAW (TRACE_TABLES, ("%p S:%p O:%p", ThisNameDesc, ThisNameDesc->Child, ThisNameDesc->Object));
if (!ThisNameDesc->Object)
{
/* No attached object, we are done */
DEBUG_PRINT_RAW (TRACE_TABLES, ("\n"));
return (AE_OK);
}
switch (Type)
{
case ACPI_TYPE_METHOD:
/* Name is a Method and its AML offset/length are set */
DEBUG_PRINT_RAW (TRACE_TABLES, (" M:%p-%X\n",
((ACPI_OBJECT_INTERNAL *) ThisNameDesc->Object)->Method.Pcode,
((ACPI_OBJECT_INTERNAL *) ThisNameDesc->Object)->Method.PcodeLength));
break;
case ACPI_TYPE_NUMBER:
DEBUG_PRINT_RAW (TRACE_TABLES, (" N:%X\n",
((ACPI_OBJECT_INTERNAL *) ThisNameDesc->Object)->Number.Value));
break;
case ACPI_TYPE_STRING:
DEBUG_PRINT_RAW (TRACE_TABLES, (" S:%p-%X\n",
((ACPI_OBJECT_INTERNAL *) ThisNameDesc->Object)->String.Pointer,
((ACPI_OBJECT_INTERNAL *) ThisNameDesc->Object)->String.Length));
break;
case ACPI_TYPE_BUFFER:
DEBUG_PRINT_RAW (TRACE_TABLES, (" B:%p-%X\n",
((ACPI_OBJECT_INTERNAL *) ThisNameDesc->Object)->Buffer.Pointer,
((ACPI_OBJECT_INTERNAL *) ThisNameDesc->Object)->Buffer.Length));
break;
default:
DEBUG_PRINT_RAW (TRACE_TABLES, ("\n"));
break;
}
/* If debug turned off, done */
if (!(AcpiDbgLevel & TRACE_VALUES))
{
return (AE_OK);
}
/* If there is an attached object, display it */
Value = ThisNameDesc->Object;
/* Dump attached objects */
while (Value)
{
ObjType = INTERNAL_TYPE_INVALID;
/* Decode the type of attached object and dump the contents */
DEBUG_PRINT_RAW (TRACE_TABLES, (" Attached Object %p: ", Value));
if (AcpiTbSystemTablePointer (Value))
{
DEBUG_PRINT_RAW (TRACE_TABLES, ("(Ptr to AML Code)\n"));
BytesToDump = 16;
}
else if (VALID_DESCRIPTOR_TYPE (Value, ACPI_DESC_TYPE_NAMED))
{
DEBUG_PRINT_RAW (TRACE_TABLES, ("(Ptr to NamedObject)\n"));
BytesToDump = sizeof (ACPI_NAMED_OBJECT);
}
else if (VALID_DESCRIPTOR_TYPE (Value, ACPI_DESC_TYPE_INTERNAL))
{
ObjDesc = (ACPI_OBJECT_INTERNAL *) Value;
ObjType = ObjDesc->Common.Type;
if (ObjType > INTERNAL_TYPE_MAX)
{
DEBUG_PRINT_RAW (TRACE_TABLES, ("(Ptr to ACPI Object type 0x%X [UNKNOWN])\n", ObjType));
BytesToDump = 32;
}
else
{
DEBUG_PRINT_RAW (TRACE_TABLES, ("(Ptr to ACPI Object type 0x%X [%s])\n",
ObjType, AcpiCmGetTypeName (ObjType)));
BytesToDump = ObjDesc->Common.Size;
}
}
else
{
DEBUG_PRINT_RAW (TRACE_TABLES, ("(String or Buffer - not descriptor)\n", Value));
BytesToDump = 16;
}
DUMP_BUFFER (Value, BytesToDump);
/* If value is NOT an internal object, we are done */
if ((AcpiTbSystemTablePointer (Value)) ||
(VALID_DESCRIPTOR_TYPE (Value, ACPI_DESC_TYPE_NAMED)))
{
goto Cleanup;
}
/*
* Valid object, get the pointer to next level, if any
*/
switch (ObjType)
{
case ACPI_TYPE_STRING:
Value = (UINT8 *) ObjDesc->String.Pointer;
break;
case ACPI_TYPE_BUFFER:
Value = (UINT8 *) ObjDesc->Buffer.Pointer;
break;
case ACPI_TYPE_PACKAGE:
Value = (UINT8 *) ObjDesc->Package.Elements;
break;
case ACPI_TYPE_METHOD:
Value = (UINT8 *) ObjDesc->Method.Pcode;
break;
case ACPI_TYPE_FIELD_UNIT:
Value = (UINT8 *) ObjDesc->FieldUnit.Container;
break;
case INTERNAL_TYPE_DEF_FIELD:
Value = (UINT8 *) ObjDesc->Field.Container;
break;
case INTERNAL_TYPE_BANK_FIELD:
Value = (UINT8 *) ObjDesc->BankField.Container;
break;
case INTERNAL_TYPE_INDEX_FIELD:
Value = (UINT8 *) ObjDesc->IndexField.Index;
break;
default:
goto Cleanup;
}
ObjType = INTERNAL_TYPE_INVALID; /* Terminate loop after next pass */
}
Cleanup:
DEBUG_PRINT_RAW (TRACE_TABLES, ("\n"));
return (AE_OK);
}
/****************************************************************************
*
* FUNCTION: AcpiNsDumpObjects
*
* PARAMETERS: Type - Object type to be dumped
* 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
*
* DESCRIPTION: Dump typed objects within the loaded namespace.
* Uses AcpiNsWalkNamespace in conjunction with AcpiNsDumpOneObject.
*
***************************************************************************/
void
AcpiNsDumpObjects (
OBJECT_TYPE_INTERNAL Type,
UINT32 MaxDepth,
UINT32 OwnerId,
ACPI_HANDLE StartHandle)
{
ACPI_WALK_INFO Info;
Info.DebugLevel = TRACE_TABLES;
Info.OwnerId = OwnerId;
AcpiNsWalkNamespace (Type, StartHandle, MaxDepth, NS_WALK_NO_UNLOCK, AcpiNsDumpOneObject,
(void *) &Info, NULL);
}
/****************************************************************************
*
* FUNCTION: AcpiNsDumpOneDevice
*
* PARAMETERS: Handle - NamedObject to be dumped
* Level - Nesting level of the handle
* Context - Passed into WalkNamespace
*
* DESCRIPTION: Dump a single Named Object that represents a device
* This procedure is a UserFunction called by AcpiNsWalkNamespace.
*
***************************************************************************/
ACPI_STATUS
AcpiNsDumpOneDevice (
ACPI_HANDLE ObjHandle,
UINT32 Level,
void *Context,
void **ReturnValue)
{
ACPI_DEVICE_INFO Info;
ACPI_STATUS Status;
UINT32 i;
Status = AcpiNsDumpOneObject (ObjHandle, Level, Context, ReturnValue);
Status = AcpiGetObjectInfo (ObjHandle, &Info);
if (ACPI_SUCCESS (Status))
{
for (i = 0; i < Level; i++)
{
DEBUG_PRINT_RAW (TRACE_TABLES, (" "));
}
DEBUG_PRINT_RAW (TRACE_TABLES, (" HID: %.8X, ADR: %.8X, Status: %x\n",
Info.HardwareId, Info.Address, Info.CurrentStatus));
}
return (Status);
}
/****************************************************************************
*
* FUNCTION: AcpiNsDumpRootDevices
*
* PARAMETERS: None
*
* DESCRIPTION: Dump all objects of type "device"
*
***************************************************************************/
void
AcpiNsDumpRootDevices (void)
{
ACPI_HANDLE SysBusHandle;
/* Only dump the table if tracing is enabled */
if (!(TRACE_TABLES & AcpiDbgLevel))
{
return;
}
AcpiGetHandle (0, NS_SYSTEM_BUS, &SysBusHandle);
DEBUG_PRINT (TRACE_TABLES, ("Display of all devices in the namespace:\n"));
AcpiNsWalkNamespace (ACPI_TYPE_DEVICE, SysBusHandle, ACPI_UINT32_MAX, NS_WALK_NO_UNLOCK,
AcpiNsDumpOneDevice, NULL, NULL);
}
/****************************************************************************
*
* FUNCTION: AcpiNsDumpTables
*
* PARAMETERS: SearchBase - Root of subtree to be dumped, or
* NS_ALL to dump the entire namespace
* MaxDepth - Maximum depth of dump. Use INT_MAX
* for an effectively unlimited depth.
*
* DESCRIPTION: Dump the name space, or a portion of it.
*
***************************************************************************/
void
AcpiNsDumpTables (
ACPI_HANDLE SearchBase,
UINT32 MaxDepth)
{
ACPI_HANDLE SearchHandle = SearchBase;
FUNCTION_TRACE ("NsDumpTables");
if (!AcpiGbl_RootObject)
{
/*
* If the name space has not been initialized,
* there is nothing to dump.
*/
DEBUG_PRINT (TRACE_TABLES, ("NsDumpTables: name space not initialized!\n"));
return_VOID;
}
if (NS_ALL == SearchBase)
{
/* entire namespace */
SearchHandle = AcpiGbl_RootObject;
DEBUG_PRINT (TRACE_TABLES, ("\\\n"));
}
AcpiNsDumpObjects (ACPI_TYPE_ANY, MaxDepth, ACPI_UINT32_MAX, SearchHandle);
return_VOID;
}
/****************************************************************************
*
* FUNCTION: AcpiNsDumpEntry
*
* PARAMETERS: Handle - NamedObject to be dumped
* DebugLevel - Output level
*
* DESCRIPTION: Dump a single Named Object
*
***************************************************************************/
void
AcpiNsDumpEntry (
ACPI_HANDLE Handle,
UINT32 DebugLevel)
{
ACPI_WALK_INFO Info;
FUNCTION_TRACE_PTR ("NsDumpEntry", Handle);
Info.DebugLevel = DebugLevel;
Info.OwnerId = ACPI_UINT32_MAX;
AcpiNsDumpOneObject (Handle, 1, &Info, NULL);
DEBUG_PRINT (TRACE_EXEC, ("leave AcpiNsDumpEntry %p\n", Handle));
return_VOID;
}
#endif

View File

@ -0,0 +1,673 @@
/******************************************************************************
*
* Module Name: nseval - Object evaluation interfaces -- includes control
* method lookup and execution.
* $Revision: 1.73 $
*
*****************************************************************************/
/******************************************************************************
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, Intel Corp. All rights
* reserved.
*
* 2. License
*
* 2.1. This is your license from Intel Corp. under its intellectual property
* rights. You may have additional license terms from the party that provided
* you this software, covering your right to use that party's intellectual
* property rights.
*
* 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
* copy of the source code appearing in this file ("Covered Code") an
* irrevocable, perpetual, worldwide license under Intel's copyrights in the
* base code distributed originally by Intel ("Original Intel Code") to copy,
* make derivatives, distribute, use and display any portion of the Covered
* Code in any form, with the right to sublicense such rights; and
*
* 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
* license (with the right to sublicense), under only those claims of Intel
* patents that are infringed by the Original Intel Code, to make, use, sell,
* offer to sell, and import the Covered Code and derivative works thereof
* solely to the minimum extent necessary to exercise the above copyright
* license, and in no event shall the patent license extend to any additions
* to or modifications of the Original Intel Code. No other license or right
* is granted directly or by implication, estoppel or otherwise;
*
* The above copyright and patent license is granted only if the following
* conditions are met:
*
* 3. Conditions
*
* 3.1. Redistribution of Source with Rights to Further Distribute Source.
* Redistribution of source code of any substantial portion of the Covered
* Code or modification with rights to further distribute source must include
* the above Copyright Notice, the above License, this list of Conditions,
* and the following Disclaimer and Export Compliance provision. In addition,
* Licensee must cause all Covered Code to which Licensee contributes to
* contain a file documenting the changes Licensee made to create that Covered
* Code and the date of any change. Licensee must include in that file the
* documentation of any changes made by any predecessor Licensee. Licensee
* must include a prominent statement that the modification is derived,
* directly or indirectly, from Original Intel Code.
*
* 3.2. Redistribution of Source with no Rights to Further Distribute Source.
* Redistribution of source code of any substantial portion of the Covered
* Code or modification without rights to further distribute source must
* include the following Disclaimer and Export Compliance provision in the
* documentation and/or other materials provided with distribution. In
* addition, Licensee may not authorize further sublicense of source of any
* portion of the Covered Code, and must include terms to the effect that the
* license from Licensee to its licensee is limited to the intellectual
* property embodied in the software Licensee provides to its licensee, and
* not to intellectual property embodied in modifications its licensee may
* make.
*
* 3.3. Redistribution of Executable. Redistribution in executable form of any
* substantial portion of the Covered Code or modification must reproduce the
* above Copyright Notice, and the following Disclaimer and Export Compliance
* provision in the documentation and/or other materials provided with the
* distribution.
*
* 3.4. Intel retains all right, title, and interest in and to the Original
* Intel Code.
*
* 3.5. Neither the name Intel nor any other trademark owned or controlled by
* Intel shall be used in advertising or otherwise to promote the sale, use or
* other dealings in products derived from or relating to the Covered Code
* without prior written authorization from Intel.
*
* 4. Disclaimer and Export Compliance
*
* 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
* HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
* IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
* INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
* UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
* IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
* PARTICULAR PURPOSE.
*
* 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
* OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
* COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
* SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
* CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
* HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
* SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
* LIMITED REMEDY.
*
* 4.3. Licensee shall not export, either directly or indirectly, any of this
* software or system incorporating such software without first obtaining any
* required license or other approval from the U. S. Department of Commerce or
* any other agency or department of the United States Government. In the
* event Licensee exports any such software from the United States or
* re-exports any such software from a foreign destination, Licensee shall
* ensure that the distribution and export/re-export of the software is in
* compliance with all laws, regulations, orders, or other restrictions of the
* U.S. Export Administration Regulations. Licensee agrees that neither it nor
* any of its subsidiaries will export/re-export any technical data, process,
* software, or service, directly or indirectly, to any country for which the
* United States government or any agency thereof requires an export license,
* other governmental approval, or letter of assurance, without first obtaining
* such license, approval or letter.
*
*****************************************************************************/
#define __NSEVAL_C__
#include "acpi.h"
#include "amlcode.h"
#include "acparser.h"
#include "acinterp.h"
#include "acnamesp.h"
#define _COMPONENT NAMESPACE
MODULE_NAME ("nseval");
/****************************************************************************
*
* FUNCTION: AcpiNsEvaluateRelative
*
* PARAMETERS: Handle - The relative containing object
* *Pathname - Name of method to execute, If NULL, the
* handle is the object to execute
* **Params - List of parameters to pass to the method,
* terminated by NULL. Params itself may be
* NULL if no parameters are being passed.
* *ReturnObject - Where to put method's return value (if
* any). If NULL, no value is returned.
*
* RETURN: Status
*
* DESCRIPTION: Find and execute the requested method using the handle as a
* scope
*
* MUTEX: Locks Namespace
*
****************************************************************************/
ACPI_STATUS
AcpiNsEvaluateRelative (
ACPI_NAMED_OBJECT *Handle,
NATIVE_CHAR *Pathname,
ACPI_OBJECT_INTERNAL **Params,
ACPI_OBJECT_INTERNAL **ReturnObject)
{
ACPI_NAMED_OBJECT *RelObjEntry;
ACPI_STATUS Status;
ACPI_NAMED_OBJECT *ObjEntry = NULL;
NATIVE_CHAR *InternalPath = NULL;
ACPI_GENERIC_STATE ScopeInfo;
FUNCTION_TRACE ("NsEvaluateRelative");
/*
* Must have a valid object handle
*/
if (!Handle)
{
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
/* Build an internal name string for the method */
Status = AcpiNsInternalizeName (Pathname, &InternalPath);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
/* Get the prefix handle and Named Object */
AcpiCmAcquireMutex (ACPI_MTX_NAMESPACE);
RelObjEntry = AcpiNsConvertHandleToEntry (Handle);
if (!RelObjEntry)
{
AcpiCmReleaseMutex (ACPI_MTX_NAMESPACE);
Status = AE_BAD_PARAMETER;
goto Cleanup;
}
/* Lookup the name in the namespace */
ScopeInfo.Scope.NameTable = RelObjEntry->Child;
Status = AcpiNsLookup (&ScopeInfo, InternalPath, ACPI_TYPE_ANY,
IMODE_EXECUTE,
NS_NO_UPSEARCH, NULL,
&ObjEntry);
AcpiCmReleaseMutex (ACPI_MTX_NAMESPACE);
if (ACPI_FAILURE (Status))
{
DEBUG_PRINT (ACPI_INFO,
("NsEvaluateRelative: Object [%s] not found [%.4X]\n",
Pathname, AcpiCmFormatException (Status)));
goto Cleanup;
}
/*
* Now that we have a handle to the object, we can attempt
* to evaluate it.
*/
DEBUG_PRINT (ACPI_INFO,
("NsEvaluateRelative: %s [%p] Value %p\n",
Pathname, ObjEntry, ObjEntry->Object));
Status = AcpiNsEvaluateByHandle (ObjEntry, Params, ReturnObject);
DEBUG_PRINT (ACPI_INFO,
("NsEvaluateRelative: *** Completed eval of object %s ***\n",
Pathname));
Cleanup:
/* Cleanup */
AcpiCmFree (InternalPath);
return_ACPI_STATUS (Status);
}
/****************************************************************************
*
* FUNCTION: AcpiNsEvaluateByName
*
* PARAMETERS: Pathname - Fully qualified pathname to the object
* *ReturnObject - Where to put method's return value (if
* any). If NULL, no value is returned.
* **Params - List of parameters to pass to the method,
* terminated by NULL. Params itself may be
* NULL if no parameters are being passed.
*
* RETURN: Status
*
* DESCRIPTION: Find and execute the requested method passing the given
* parameters
*
* MUTEX: Locks Namespace
*
****************************************************************************/
ACPI_STATUS
AcpiNsEvaluateByName (
NATIVE_CHAR *Pathname,
ACPI_OBJECT_INTERNAL **Params,
ACPI_OBJECT_INTERNAL **ReturnObject)
{
ACPI_STATUS Status;
ACPI_NAMED_OBJECT *ObjEntry = NULL;
NATIVE_CHAR *InternalPath = NULL;
FUNCTION_TRACE ("NsEvaluateByName");
/* Build an internal name string for the method */
Status = AcpiNsInternalizeName (Pathname, &InternalPath);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
AcpiCmAcquireMutex (ACPI_MTX_NAMESPACE);
/* Lookup the name in the namespace */
Status = AcpiNsLookup (NULL, InternalPath, ACPI_TYPE_ANY,
IMODE_EXECUTE,
NS_NO_UPSEARCH, NULL,
&ObjEntry);
AcpiCmReleaseMutex (ACPI_MTX_NAMESPACE);
if (ACPI_FAILURE (Status))
{
DEBUG_PRINT (ACPI_INFO,
("NsEvaluateByName: Object at [%s] was not found, status=%.4X\n",
Pathname, Status));
goto Cleanup;
}
/*
* Now that we have a handle to the object, we can attempt
* to evaluate it.
*/
DEBUG_PRINT (ACPI_INFO,
("NsEvaluateByName: %s [%p] Value %p\n",
Pathname, ObjEntry, ObjEntry->Object));
Status = AcpiNsEvaluateByHandle (ObjEntry, Params, ReturnObject);
DEBUG_PRINT (ACPI_INFO,
("NsEvaluateByName: *** Completed eval of object %s ***\n",
Pathname));
Cleanup:
/* Cleanup */
if (InternalPath)
{
AcpiCmFree (InternalPath);
}
return_ACPI_STATUS (Status);
}
/****************************************************************************
*
* FUNCTION: AcpiNsEvaluateByHandle
*
* PARAMETERS: Handle - Method Named Object to execute
* **Params - List of parameters to pass to the method,
* terminated by NULL. Params itself may be
* NULL if no parameters are being passed.
* *ReturnObject - Where to put method's return value (if
* any). If NULL, no value is returned.
*
* RETURN: Status
*
* DESCRIPTION: Execute the requested method passing the given parameters
*
* MUTEX: Locks Namespace
*
****************************************************************************/
ACPI_STATUS
AcpiNsEvaluateByHandle (
ACPI_NAMED_OBJECT *Handle,
ACPI_OBJECT_INTERNAL **Params,
ACPI_OBJECT_INTERNAL **ReturnObject)
{
ACPI_NAMED_OBJECT *ObjEntry;
ACPI_STATUS Status;
ACPI_OBJECT_INTERNAL *LocalReturnObject;
FUNCTION_TRACE ("NsEvaluateByHandle");
/* Check if namespace has been initialized */
if (!AcpiGbl_RootObject)
{
return_ACPI_STATUS (AE_NO_NAMESPACE);
}
/* Parameter Validation */
if (!Handle)
{
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
if (ReturnObject)
{
/* Initialize the return value to an invalid object */
*ReturnObject = NULL;
}
/* Get the prefix handle and Named Object */
AcpiCmAcquireMutex (ACPI_MTX_NAMESPACE);
ObjEntry = AcpiNsConvertHandleToEntry (Handle);
if (!ObjEntry)
{
Status = AE_BAD_PARAMETER;
goto UnlockAndExit;
}
/*
* Two major cases here:
* 1) The object is an actual control method -- execute it.
* 2) The object is not a method -- just return it's current
* value
*
* In both cases, the namespace is unlocked by the
* AcpiNs* procedure
*/
if (AcpiNsGetType (ObjEntry) == ACPI_TYPE_METHOD)
{
/*
* Case 1) We have an actual control method to execute
*/
Status = AcpiNsExecuteControlMethod (ObjEntry,
Params,
&LocalReturnObject);
}
else
{
/*
* Case 2) Object is NOT a method, just return its
* current value
*/
Status = AcpiNsGetObjectValue (ObjEntry,
&LocalReturnObject);
}
/*
* Check if there is a return value on the stack that must
* be dealt with
*/
if (Status == AE_CTRL_RETURN_VALUE)
{
/*
* If the Method returned a value and the caller
* provided a place to store a returned value, Copy
* the returned value to the object descriptor provided
* by the caller.
*/
if (ReturnObject)
{
/*
* Valid return object, copy the pointer to
* the returned object
*/
*ReturnObject = LocalReturnObject;
}
/* Map AE_RETURN_VALUE to AE_OK, we are done with it */
if (Status == AE_CTRL_RETURN_VALUE)
{
Status = AE_OK;
}
}
/*
* Namespace was unlocked by the handling AcpiNs* function,
* so we just return
*/
return_ACPI_STATUS (Status);
UnlockAndExit:
AcpiCmReleaseMutex (ACPI_MTX_NAMESPACE);
return_ACPI_STATUS (Status);
}
/****************************************************************************
*
* FUNCTION: AcpiNsExecuteControlMethod
*
* PARAMETERS: MethodNameDesc - The object/method
* **Params - List of parameters to pass to the method,
* terminated by NULL. Params itself may be
* NULL if no parameters are being passed.
* **ReturnObjDesc - List of result objects to be returned
* from the method.
*
* RETURN: Status
*
* DESCRIPTION: Execute the requested method passing the given parameters
*
* MUTEX: Assumes namespace is locked
*
****************************************************************************/
ACPI_STATUS
AcpiNsExecuteControlMethod (
ACPI_NAMED_OBJECT *MethodNameDesc,
ACPI_OBJECT_INTERNAL **Params,
ACPI_OBJECT_INTERNAL **ReturnObjDesc)
{
ACPI_STATUS Status;
ACPI_OBJECT_INTERNAL *ObjDesc;
FUNCTION_TRACE ("NsExecuteControlMethod");
/* Verify that there is a method associated with this object */
ObjDesc = AcpiNsGetAttachedObject ((ACPI_HANDLE) MethodNameDesc);
if (!ObjDesc)
{
DEBUG_PRINT (ACPI_ERROR,
("Control method is undefined (nil value)\n"));
return_ACPI_STATUS (AE_ERROR);
}
DEBUG_PRINT (ACPI_INFO, ("Control method at Offset %x Length %lx]\n",
ObjDesc->Method.Pcode + 1,
ObjDesc->Method.PcodeLength - 1));
DUMP_PATHNAME (MethodNameDesc, "NsExecuteControlMethod: Executing",
TRACE_NAMES, _COMPONENT);
DEBUG_PRINT (TRACE_NAMES,
("At offset %8XH\n", ObjDesc->Method.Pcode + 1));
/*
* Unlock the namespace before execution. This allows namespace access
* via the external Acpi* interfaces while a method is being executed.
* However, any namespace deletion must acquire both the namespace and
* interpreter locks to ensure that no thread is using the portion of the
* namespace that is being deleted.
*/
AcpiCmReleaseMutex (ACPI_MTX_NAMESPACE);
/*
* Excecute the method via the interpreter
*/
Status = AcpiAmlExecuteMethod (MethodNameDesc, Params, ReturnObjDesc);
return_ACPI_STATUS (Status);
}
/****************************************************************************
*
* FUNCTION: AcpiNsGetObjectValue
*
* PARAMETERS: NameDesc - The object
*
* RETURN: Status
*
* DESCRIPTION: Return the current value of the object
*
* MUTEX: Assumes namespace is locked
*
****************************************************************************/
ACPI_STATUS
AcpiNsGetObjectValue (
ACPI_NAMED_OBJECT *NameDesc,
ACPI_OBJECT_INTERNAL **ReturnObjDesc)
{
ACPI_STATUS Status = AE_OK;
ACPI_OBJECT_INTERNAL *ObjDesc;
ACPI_OBJECT_INTERNAL *ValDesc;
FUNCTION_TRACE ("NsGetObjectValue");
/*
* We take the value from certain objects directly
*/
if ((NameDesc->Type == ACPI_TYPE_PROCESSOR) ||
(NameDesc->Type == ACPI_TYPE_POWER))
{
/*
* Create a Reference object to contain the object
*/
ObjDesc = AcpiCmCreateInternalObject (NameDesc->Type);
if (!ObjDesc)
{
Status = AE_NO_MEMORY;
goto UnlockAndExit;
}
/*
* Get the attached object
*/
ValDesc = AcpiNsGetAttachedObject (NameDesc);
if (!ValDesc)
{
Status = AE_NULL_OBJECT;
goto UnlockAndExit;
}
/*
* Just copy from the original to the return object
*/
MEMCPY (&ObjDesc->Common.FirstNonCommonByte,
&ValDesc->Common.FirstNonCommonByte,
(sizeof(ACPI_OBJECT_COMMON) -
sizeof(ObjDesc->Common.FirstNonCommonByte)));
}
/*
* Other objects require a reference object wrapper which we
* then attempt to resolve.
*/
else
{
/* Create an Reference object to contain the object */
ObjDesc = AcpiCmCreateInternalObject (INTERNAL_TYPE_REFERENCE);
if (!ObjDesc)
{
Status = AE_NO_MEMORY;
goto UnlockAndExit;
}
/* Construct a descriptor pointing to the name */
ObjDesc->Reference.OpCode = (UINT8) AML_NAME_OP;
ObjDesc->Reference.Object = (void *) NameDesc;
/*
* Use AcpiAmlResolveToValue() to get the associated value.
* The call to AcpiAmlResolveToValue causes
* ObjDesc (allocated above) to always be deleted.
*
* NOTE: we can get away with passing in NULL for a walk state
* because ObjDesc is guaranteed to not be a reference to either
* a method local or a method argument
*/
Status = AcpiAmlResolveToValue (&ObjDesc, NULL);
}
/*
* If AcpiAmlResolveToValue() succeeded, the return value was
* placed in ObjDesc.
*/
if (ACPI_SUCCESS (Status))
{
Status = AE_CTRL_RETURN_VALUE;
*ReturnObjDesc = ObjDesc;
DEBUG_PRINT (ACPI_INFO,
("NsGetObjectValue: Returning obj %p\n", *ReturnObjDesc));
}
UnlockAndExit:
/* Unlock the namespace */
AcpiCmReleaseMutex (ACPI_MTX_NAMESPACE);
return_ACPI_STATUS (Status);
}

View File

@ -0,0 +1,638 @@
/******************************************************************************
*
* Module Name: nsload - namespace loading/expanding/contracting procedures
* $Revision: 1.25 $
*
*****************************************************************************/
/******************************************************************************
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, Intel Corp. All rights
* reserved.
*
* 2. License
*
* 2.1. This is your license from Intel Corp. under its intellectual property
* rights. You may have additional license terms from the party that provided
* you this software, covering your right to use that party's intellectual
* property rights.
*
* 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
* copy of the source code appearing in this file ("Covered Code") an
* irrevocable, perpetual, worldwide license under Intel's copyrights in the
* base code distributed originally by Intel ("Original Intel Code") to copy,
* make derivatives, distribute, use and display any portion of the Covered
* Code in any form, with the right to sublicense such rights; and
*
* 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
* license (with the right to sublicense), under only those claims of Intel
* patents that are infringed by the Original Intel Code, to make, use, sell,
* offer to sell, and import the Covered Code and derivative works thereof
* solely to the minimum extent necessary to exercise the above copyright
* license, and in no event shall the patent license extend to any additions
* to or modifications of the Original Intel Code. No other license or right
* is granted directly or by implication, estoppel or otherwise;
*
* The above copyright and patent license is granted only if the following
* conditions are met:
*
* 3. Conditions
*
* 3.1. Redistribution of Source with Rights to Further Distribute Source.
* Redistribution of source code of any substantial portion of the Covered
* Code or modification with rights to further distribute source must include
* the above Copyright Notice, the above License, this list of Conditions,
* and the following Disclaimer and Export Compliance provision. In addition,
* Licensee must cause all Covered Code to which Licensee contributes to
* contain a file documenting the changes Licensee made to create that Covered
* Code and the date of any change. Licensee must include in that file the
* documentation of any changes made by any predecessor Licensee. Licensee
* must include a prominent statement that the modification is derived,
* directly or indirectly, from Original Intel Code.
*
* 3.2. Redistribution of Source with no Rights to Further Distribute Source.
* Redistribution of source code of any substantial portion of the Covered
* Code or modification without rights to further distribute source must
* include the following Disclaimer and Export Compliance provision in the
* documentation and/or other materials provided with distribution. In
* addition, Licensee may not authorize further sublicense of source of any
* portion of the Covered Code, and must include terms to the effect that the
* license from Licensee to its licensee is limited to the intellectual
* property embodied in the software Licensee provides to its licensee, and
* not to intellectual property embodied in modifications its licensee may
* make.
*
* 3.3. Redistribution of Executable. Redistribution in executable form of any
* substantial portion of the Covered Code or modification must reproduce the
* above Copyright Notice, and the following Disclaimer and Export Compliance
* provision in the documentation and/or other materials provided with the
* distribution.
*
* 3.4. Intel retains all right, title, and interest in and to the Original
* Intel Code.
*
* 3.5. Neither the name Intel nor any other trademark owned or controlled by
* Intel shall be used in advertising or otherwise to promote the sale, use or
* other dealings in products derived from or relating to the Covered Code
* without prior written authorization from Intel.
*
* 4. Disclaimer and Export Compliance
*
* 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
* HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
* IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
* INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
* UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
* IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
* PARTICULAR PURPOSE.
*
* 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
* OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
* COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
* SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
* CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
* HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
* SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
* LIMITED REMEDY.
*
* 4.3. Licensee shall not export, either directly or indirectly, any of this
* software or system incorporating such software without first obtaining any
* required license or other approval from the U. S. Department of Commerce or
* any other agency or department of the United States Government. In the
* event Licensee exports any such software from the United States or
* re-exports any such software from a foreign destination, Licensee shall
* ensure that the distribution and export/re-export of the software is in
* compliance with all laws, regulations, orders, or other restrictions of the
* U.S. Export Administration Regulations. Licensee agrees that neither it nor
* any of its subsidiaries will export/re-export any technical data, process,
* software, or service, directly or indirectly, to any country for which the
* United States government or any agency thereof requires an export license,
* other governmental approval, or letter of assurance, without first obtaining
* such license, approval or letter.
*
*****************************************************************************/
#define __NSLOAD_C__
#include "acpi.h"
#include "acinterp.h"
#include "acnamesp.h"
#include "amlcode.h"
#include "acparser.h"
#include "acdispat.h"
#include "acdebug.h"
#define _COMPONENT NAMESPACE
MODULE_NAME ("nsload");
/*******************************************************************************
*
* FUNCTION: AcpiNsParseTable
*
* PARAMETERS: TableDesc - An ACPI table descriptor for table to parse
* Scope - Where to enter the table into the namespace
*
* RETURN: Status
*
* DESCRIPTION: Parse AML within an ACPI table and return a tree of ops
*
******************************************************************************/
ACPI_STATUS
AcpiNsParseTable (
ACPI_TABLE_DESC *TableDesc,
ACPI_NAMED_OBJECT *Scope)
{
ACPI_STATUS Status;
FUNCTION_TRACE ("NsParseTable");
/*
* AML Parse, pass 1
*
* In this pass, we load most of the namespace. Control methods
* are not parsed until later. A parse tree is not created. Instead,
* each Parser Op subtree is deleted when it is finished. This saves
* a great deal of memory, and allows a small cache of parse objects
* to service the entire parse. The second pass of the parse then
* performs another complete parse of the AML..
*/
/* Create and init a root object */
AcpiGbl_ParsedNamespaceRoot = AcpiPsAllocOp (AML_SCOPE_OP);
if (!AcpiGbl_ParsedNamespaceRoot)
{
return_ACPI_STATUS (AE_NO_MEMORY);
}
((ACPI_EXTENDED_OP *) AcpiGbl_ParsedNamespaceRoot)->Name = ACPI_ROOT_NAME;
/* Pass 1: Parse everything except control method bodies */
DEBUG_PRINT (TRACE_PARSE,
("NsParseTable: *PARSE* 1st pass parse\n"));
Status = AcpiPsParseAml (AcpiGbl_ParsedNamespaceRoot,
TableDesc->AmlPointer,
TableDesc->AmlLength,
ACPI_PARSE_LOAD_PASS1 | ACPI_PARSE_DELETE_TREE,
NULL, NULL, NULL,
AcpiDsLoad1BeginOp,
AcpiDsLoad1EndOp);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
AcpiPsDeleteParseTree (AcpiGbl_ParsedNamespaceRoot);
/*
* AML Parse, pass 2
*
* In this pass, we resolve forward references and other things
* that could not be completed during the first pass.
* Another complete parse of the AML is performed, but the
* overhead of this is compensated for by the fact that the
* parse objects are all cached.
*/
/* Create and init a root object */
AcpiGbl_ParsedNamespaceRoot = AcpiPsAllocOp (AML_SCOPE_OP);
if (!AcpiGbl_ParsedNamespaceRoot)
{
return_ACPI_STATUS (AE_NO_MEMORY);
}
((ACPI_EXTENDED_OP *) AcpiGbl_ParsedNamespaceRoot)->Name = ACPI_ROOT_NAME;
/* Pass 2: Resolve forward references */
DEBUG_PRINT (TRACE_PARSE,
("NsParseTable: *PARSE* 2nd pass parse\n"));
Status = AcpiPsParseAml (AcpiGbl_ParsedNamespaceRoot,
TableDesc->AmlPointer,
TableDesc->AmlLength,
ACPI_PARSE_LOAD_PASS1 | ACPI_PARSE_DELETE_TREE,
NULL, NULL, NULL,
AcpiDsLoad2BeginOp,
AcpiDsLoad2EndOp);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
/* TBD: [Restructure] must generate stats on the fly, can't walk the tree */
DEBUG_EXEC (AcpiDbGenerateStatistics (AcpiGbl_ParsedNamespaceRoot, 0));
AcpiPsDeleteParseTree (AcpiGbl_ParsedNamespaceRoot);
AcpiGbl_ParsedNamespaceRoot = NULL;
return_ACPI_STATUS (Status);
}
/*****************************************************************************
*
* FUNCTION: AcpiNsLoadTable
*
* PARAMETERS: *PcodeAddr - Address of pcode block
* PcodeLength - Length of pcode block
*
* RETURN: Status
*
* DESCRIPTION: Mainline of the AML load/dump subsystem. Sets up the
* input engine, calls handler for outermost object type.
*
****************************************************************************/
ACPI_STATUS
AcpiNsLoadTable (
ACPI_TABLE_DESC *TableDesc,
ACPI_NAMED_OBJECT *NameDesc)
{
ACPI_STATUS Status;
FUNCTION_TRACE ("NsLoadTable");
if (!TableDesc->AmlPointer)
{
DEBUG_PRINT (ACPI_ERROR, ("NsLoadTable: Null AML pointer\n"));
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
DEBUG_PRINT (ACPI_INFO,
("NsLoadTable: AML block at %p\n", TableDesc->AmlPointer));
if (!TableDesc->AmlLength)
{
DEBUG_PRINT (ACPI_ERROR,
("NsLoadTable: Zero-length AML block\n"));
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
/*
* Parse the table and load the namespace with all named
* objects found within. Control methods are NOT parsed
* at this time. In fact, the control methods cannot be
* parsed until the entire namespace is loaded, because
* if a control method makes a forward reference (call)
* to another control method, we can't continue parsing
* because we don't know how many arguments to parse next!
*/
DEBUG_PRINT (ACPI_INFO,
("NsLoadTable: **** Loading table into namespace ****\n"));
AcpiCmAcquireMutex (ACPI_MTX_NAMESPACE);
Status = AcpiNsParseTable (TableDesc, NameDesc->Child);
AcpiCmReleaseMutex (ACPI_MTX_NAMESPACE);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
/*
* Now we can parse the control methods. We always parse
* them here for a sanity check, and if configured for
* just-in-time parsing, we delete the control method
* parse trees.
*/
DEBUG_PRINT (ACPI_INFO,
("NsLoadTable: **** Begin Table Method Parsing and Object Initialization ****\n"));
Status = AcpiDsInitializeObjects (TableDesc, NameDesc);
DEBUG_PRINT (ACPI_INFO,
("NsLoadTable: **** Completed Table Method Parsing and Object Initialization ****\n"));
return_ACPI_STATUS (Status);
}
/******************************************************************************
*
* FUNCTION: AcpiNsLoadTableByType
*
* PARAMETERS: TableType - Id of the table type to load
*
* RETURN: Status
*
* DESCRIPTION: Load an ACPI table or tables into the namespace. All tables
* of the given type are loaded. The mechanism allows this
* routine to be called repeatedly.
*
*****************************************************************************/
ACPI_STATUS
AcpiNsLoadTableByType (
ACPI_TABLE_TYPE TableType)
{
UINT32 i;
ACPI_STATUS Status = AE_OK;
ACPI_TABLE_HEADER *TablePtr;
ACPI_TABLE_DESC *TableDesc;
FUNCTION_TRACE ("NsLoadTableByType");
AcpiCmAcquireMutex (ACPI_MTX_TABLES);
/*
* Table types supported are:
* DSDT (one), SSDT/PSDT (multiple)
*/
switch (TableType)
{
case ACPI_TABLE_DSDT:
DEBUG_PRINT (ACPI_INFO, ("NsLoadTableByType: Loading DSDT\n"));
TableDesc = &AcpiGbl_AcpiTables[ACPI_TABLE_DSDT];
/* If table already loaded into namespace, just return */
if (TableDesc->LoadedIntoNamespace)
{
goto UnlockAndExit;
}
TableDesc->TableId = TABLE_ID_DSDT;
/* Initialize the root of the namespace tree */
Status = AcpiNsRootInitialize ();
if (ACPI_FAILURE (Status))
{
goto UnlockAndExit;
}
/* Now load the single DSDT */
Status = AcpiNsLoadTable (TableDesc, AcpiGbl_RootObject);
if (ACPI_SUCCESS (Status))
{
TableDesc->LoadedIntoNamespace = TRUE;
}
break;
case ACPI_TABLE_SSDT:
DEBUG_PRINT (ACPI_INFO,
("NsLoadTableByType: Loading %d SSDTs\n",
AcpiGbl_AcpiTables[ACPI_TABLE_SSDT].Count));
/*
* Traverse list of SSDT tables
*/
TableDesc = &AcpiGbl_AcpiTables[ACPI_TABLE_SSDT];
for (i = 0; i < AcpiGbl_AcpiTables[ACPI_TABLE_SSDT].Count; i++)
{
TablePtr = TableDesc->Pointer;
/*
* Only attempt to load table if it is not
* already loaded!
*/
if (!TableDesc->LoadedIntoNamespace)
{
Status = AcpiNsLoadTable (TableDesc,
AcpiGbl_RootObject);
if (ACPI_FAILURE (Status))
{
break;
}
TableDesc->LoadedIntoNamespace = TRUE;
}
TableDesc = TableDesc->Next;
}
break;
case ACPI_TABLE_PSDT:
DEBUG_PRINT (ACPI_INFO,
("NsLoadTableByType: Loading %d PSDTs\n",
AcpiGbl_AcpiTables[ACPI_TABLE_PSDT].Count));
/*
* Traverse list of PSDT tables
*/
TableDesc = &AcpiGbl_AcpiTables[ACPI_TABLE_PSDT];
for (i = 0; i < AcpiGbl_AcpiTables[ACPI_TABLE_PSDT].Count; i++)
{
TablePtr = TableDesc->Pointer;
/* Only attempt to load table if it is not already loaded! */
if (!TableDesc->LoadedIntoNamespace)
{
Status = AcpiNsLoadTable (TableDesc,
AcpiGbl_RootObject);
if (ACPI_FAILURE (Status))
{
break;
}
TableDesc->LoadedIntoNamespace = TRUE;
}
TableDesc = TableDesc->Next;
}
break;
default:
Status = AE_SUPPORT;
}
UnlockAndExit:
AcpiCmReleaseMutex (ACPI_MTX_TABLES);
return_ACPI_STATUS (Status);
}
/******************************************************************************
*
* FUNCTION: AcpiNsDeleteSubtree
*
* PARAMETERS: StartHandle - Handle in namespace where search begins
*
* RETURNS Status
*
* DESCRIPTION: Walks the namespace starting at the given handle and deletes
* all objects, entries, and scopes in the entire subtree.
*
* TBD: [Investigate] What if any part of this subtree is in use?
* (i.e. on one of the object stacks?)
*
******************************************************************************/
ACPI_STATUS
AcpiNsDeleteSubtree (
ACPI_HANDLE StartHandle)
{
ACPI_STATUS Status;
ACPI_HANDLE ChildHandle;
ACPI_HANDLE ParentHandle;
ACPI_HANDLE NextChildHandle;
ACPI_HANDLE Dummy;
UINT32 Level;
FUNCTION_TRACE ("NsDeleteSubtree");
ParentHandle = StartHandle;
ChildHandle = 0;
Level = 1;
/*
* Traverse the tree of objects until we bubble back up
* to where we started.
*/
while (Level > 0)
{
/* Attempt to get the next object in this scope */
Status = AcpiGetNextObject (ACPI_TYPE_ANY, ParentHandle,
ChildHandle,
&NextChildHandle);
ChildHandle = NextChildHandle;
/* Did we get a new object? */
if (ACPI_SUCCESS (Status))
{
/* Check if this object has any children */
if (ACPI_SUCCESS (AcpiGetNextObject (ACPI_TYPE_ANY,
ChildHandle, 0,
&Dummy)))
{
/*
* There is at least one child of this object,
* visit the object
*/
Level++;
ParentHandle = ChildHandle;
ChildHandle = 0;
}
}
else
{
/*
* No more children in this object, go back up to
* the object's parent
*/
Level--;
/* Delete all children now */
AcpiNsDeleteChildren (ChildHandle);
ChildHandle = ParentHandle;
AcpiGetParent (ParentHandle, &ParentHandle);
}
}
/* Now delete the starting object, and we are done */
AcpiNsDeleteNamedObject (ChildHandle);
return_ACPI_STATUS (AE_OK);
}
/****************************************************************************
*
* FUNCTION: AcpiNsUnloadNameSpace
*
* PARAMETERS: Handle - Root of namespace subtree to be deleted
*
* RETURN: Status
*
* DESCRIPTION: Shrinks the namespace, typically in response to an undocking
* event. Deletes an entire subtree starting from (and
* including) the given handle.
*
****************************************************************************/
ACPI_STATUS
AcpiNsUnloadNamespace (
ACPI_HANDLE Handle)
{
ACPI_STATUS Status;
FUNCTION_TRACE ("NsUnloadNameSpace");
/* Parameter validation */
if (!AcpiGbl_RootObject)
{
return_ACPI_STATUS (AE_NO_NAMESPACE);
}
if (!Handle)
{
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
/* This function does the real work */
Status = AcpiNsDeleteSubtree (Handle);
return_ACPI_STATUS (Status);
}

View File

@ -0,0 +1,336 @@
/*******************************************************************************
*
* Module Name: nsnames - Name manipulation and search
* $Revision: 1.46 $
*
******************************************************************************/
/******************************************************************************
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, Intel Corp. All rights
* reserved.
*
* 2. License
*
* 2.1. This is your license from Intel Corp. under its intellectual property
* rights. You may have additional license terms from the party that provided
* you this software, covering your right to use that party's intellectual
* property rights.
*
* 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
* copy of the source code appearing in this file ("Covered Code") an
* irrevocable, perpetual, worldwide license under Intel's copyrights in the
* base code distributed originally by Intel ("Original Intel Code") to copy,
* make derivatives, distribute, use and display any portion of the Covered
* Code in any form, with the right to sublicense such rights; and
*
* 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
* license (with the right to sublicense), under only those claims of Intel
* patents that are infringed by the Original Intel Code, to make, use, sell,
* offer to sell, and import the Covered Code and derivative works thereof
* solely to the minimum extent necessary to exercise the above copyright
* license, and in no event shall the patent license extend to any additions
* to or modifications of the Original Intel Code. No other license or right
* is granted directly or by implication, estoppel or otherwise;
*
* The above copyright and patent license is granted only if the following
* conditions are met:
*
* 3. Conditions
*
* 3.1. Redistribution of Source with Rights to Further Distribute Source.
* Redistribution of source code of any substantial portion of the Covered
* Code or modification with rights to further distribute source must include
* the above Copyright Notice, the above License, this list of Conditions,
* and the following Disclaimer and Export Compliance provision. In addition,
* Licensee must cause all Covered Code to which Licensee contributes to
* contain a file documenting the changes Licensee made to create that Covered
* Code and the date of any change. Licensee must include in that file the
* documentation of any changes made by any predecessor Licensee. Licensee
* must include a prominent statement that the modification is derived,
* directly or indirectly, from Original Intel Code.
*
* 3.2. Redistribution of Source with no Rights to Further Distribute Source.
* Redistribution of source code of any substantial portion of the Covered
* Code or modification without rights to further distribute source must
* include the following Disclaimer and Export Compliance provision in the
* documentation and/or other materials provided with distribution. In
* addition, Licensee may not authorize further sublicense of source of any
* portion of the Covered Code, and must include terms to the effect that the
* license from Licensee to its licensee is limited to the intellectual
* property embodied in the software Licensee provides to its licensee, and
* not to intellectual property embodied in modifications its licensee may
* make.
*
* 3.3. Redistribution of Executable. Redistribution in executable form of any
* substantial portion of the Covered Code or modification must reproduce the
* above Copyright Notice, and the following Disclaimer and Export Compliance
* provision in the documentation and/or other materials provided with the
* distribution.
*
* 3.4. Intel retains all right, title, and interest in and to the Original
* Intel Code.
*
* 3.5. Neither the name Intel nor any other trademark owned or controlled by
* Intel shall be used in advertising or otherwise to promote the sale, use or
* other dealings in products derived from or relating to the Covered Code
* without prior written authorization from Intel.
*
* 4. Disclaimer and Export Compliance
*
* 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
* HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
* IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
* INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
* UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
* IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
* PARTICULAR PURPOSE.
*
* 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
* OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
* COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
* SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
* CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
* HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
* SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
* LIMITED REMEDY.
*
* 4.3. Licensee shall not export, either directly or indirectly, any of this
* software or system incorporating such software without first obtaining any
* required license or other approval from the U. S. Department of Commerce or
* any other agency or department of the United States Government. In the
* event Licensee exports any such software from the United States or
* re-exports any such software from a foreign destination, Licensee shall
* ensure that the distribution and export/re-export of the software is in
* compliance with all laws, regulations, orders, or other restrictions of the
* U.S. Export Administration Regulations. Licensee agrees that neither it nor
* any of its subsidiaries will export/re-export any technical data, process,
* software, or service, directly or indirectly, to any country for which the
* United States government or any agency thereof requires an export license,
* other governmental approval, or letter of assurance, without first obtaining
* such license, approval or letter.
*
*****************************************************************************/
#define __NSNAMES_C__
#include "acpi.h"
#include "amlcode.h"
#include "acinterp.h"
#include "acnamesp.h"
#define _COMPONENT NAMESPACE
MODULE_NAME ("nsnames");
/*******************************************************************************
*
* FUNCTION: AcpiNsGetTablePathname
*
* PARAMETERS: NameDesc - Scope whose name is needed
*
* RETURN: Pointer to storage containing the fully qualified name of
* the scope, in Label format (all segments strung together
* with no separators)
*
* DESCRIPTION: Used for debug printing in AcpiNsSearchTable().
*
******************************************************************************/
NATIVE_CHAR *
AcpiNsGetTablePathname (
ACPI_NAMED_OBJECT *NameDesc)
{
NATIVE_CHAR *NameBuffer;
UINT32 Size;
ACPI_NAME Name;
ACPI_NAMED_OBJECT *ChildDesc;
ACPI_NAMED_OBJECT *ParentDesc;
FUNCTION_TRACE_PTR ("AcpiNsGetTablePathname", NameDesc);
if (!AcpiGbl_RootObject || !NameDesc)
{
/*
* If the name space has not been initialized,
* this function should not have been called.
*/
return_PTR (NULL);
}
ChildDesc = NameDesc->Child;
/* Calculate required buffer size based on depth below root */
Size = 1;
ParentDesc = ChildDesc;
while (ParentDesc)
{
ParentDesc = AcpiNsGetParentObject (ParentDesc);
if (ParentDesc)
{
Size += ACPI_NAME_SIZE;
}
}
/* Allocate a buffer to be returned to caller */
NameBuffer = AcpiCmCallocate (Size + 1);
if (!NameBuffer)
{
REPORT_ERROR ("NsGetTablePathname: allocation failure");
return_PTR (NULL);
}
/* Store terminator byte, then build name backwards */
NameBuffer[Size] = '\0';
while ((Size > ACPI_NAME_SIZE) &&
AcpiNsGetParentObject (ChildDesc))
{
Size -= ACPI_NAME_SIZE;
Name = AcpiNsFindParentName (ChildDesc);
/* Put the name into the buffer */
MOVE_UNALIGNED32_TO_32 ((NameBuffer + Size), &Name);
ChildDesc = AcpiNsGetParentObject (ChildDesc);
}
NameBuffer[--Size] = AML_ROOT_PREFIX;
if (Size != 0)
{
DEBUG_PRINT (ACPI_ERROR,
("NsGetTablePathname: Bad pointer returned; size = %d\n", Size));
}
return_PTR (NameBuffer);
}
/*******************************************************************************
*
* FUNCTION: AcpiNsHandleToPathname
*
* PARAMETERS: TargetHandle - Handle of named object whose name is
* to be found
* BufSize - Size of the buffer provided
* UserBuffer - Where the pathname is returned
*
* RETURN: Status, Buffer is filled with pathname if status is AE_OK
*
* DESCRIPTION: Build and return a full namespace pathname
*
* MUTEX: Locks Namespace
*
******************************************************************************/
ACPI_STATUS
AcpiNsHandleToPathname (
ACPI_HANDLE TargetHandle,
UINT32 *BufSize,
NATIVE_CHAR *UserBuffer)
{
ACPI_STATUS Status = AE_OK;
ACPI_NAMED_OBJECT *NameDesc = NULL;
ACPI_NAMED_OBJECT *Temp = NULL;
UINT32 PathLength = 0;
UINT32 Size;
UINT32 UserBufSize;
ACPI_NAME Name;
FUNCTION_TRACE_PTR ("NsHandleToPathname", TargetHandle);
if (!AcpiGbl_RootObject || !TargetHandle)
{
/*
* If the name space has not been initialized,
* this function should not have been called.
*/
return_ACPI_STATUS (AE_NO_NAMESPACE);
}
NameDesc = AcpiNsConvertHandleToEntry (TargetHandle);
if (!NameDesc)
{
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
/*
* Compute length of pathname as 5 * number of name segments.
* Go back up the parent tree to the root
*/
for (Size = 0, Temp = NameDesc;
AcpiNsGetParentObject (Temp);
Temp = AcpiNsGetParentObject (Temp))
{
Size += PATH_SEGMENT_LENGTH;
}
/* Set return length to the required path length */
PathLength = Size + 1;
UserBufSize = *BufSize;
*BufSize = PathLength;
/* Check if the user buffer is sufficiently large */
if (PathLength > UserBufSize)
{
Status = AE_BUFFER_OVERFLOW;
goto Exit;
}
/* Store null terminator */
UserBuffer[Size] = 0;
Size -= ACPI_NAME_SIZE;
/* Put the original ACPI name at the end of the path */
MOVE_UNALIGNED32_TO_32 ((UserBuffer + Size),
&NameDesc->Name);
UserBuffer[--Size] = PATH_SEPARATOR;
/* Build name backwards, putting "." between segments */
while ((Size > ACPI_NAME_SIZE) && NameDesc)
{
Size -= ACPI_NAME_SIZE;
Name = AcpiNsFindParentName (NameDesc);
MOVE_UNALIGNED32_TO_32 ((UserBuffer + Size), &Name);
UserBuffer[--Size] = PATH_SEPARATOR;
NameDesc = AcpiNsGetParentObject (NameDesc);
}
/*
* Overlay the "." preceding the first segment with
* the root name "\"
*/
UserBuffer[Size] = '\\';
DEBUG_PRINT (TRACE_EXEC,
("NsHandleToPathname: Len=%d, %s \n",
PathLength, UserBuffer));
Exit:
return_ACPI_STATUS (Status);
}

View File

@ -0,0 +1,525 @@
/*******************************************************************************
*
* Module Name: nsobject - Utilities for objects attached to namespace
* table entries
* $Revision: 1.42 $
*
******************************************************************************/
/******************************************************************************
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, Intel Corp. All rights
* reserved.
*
* 2. License
*
* 2.1. This is your license from Intel Corp. under its intellectual property
* rights. You may have additional license terms from the party that provided
* you this software, covering your right to use that party's intellectual
* property rights.
*
* 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
* copy of the source code appearing in this file ("Covered Code") an
* irrevocable, perpetual, worldwide license under Intel's copyrights in the
* base code distributed originally by Intel ("Original Intel Code") to copy,
* make derivatives, distribute, use and display any portion of the Covered
* Code in any form, with the right to sublicense such rights; and
*
* 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
* license (with the right to sublicense), under only those claims of Intel
* patents that are infringed by the Original Intel Code, to make, use, sell,
* offer to sell, and import the Covered Code and derivative works thereof
* solely to the minimum extent necessary to exercise the above copyright
* license, and in no event shall the patent license extend to any additions
* to or modifications of the Original Intel Code. No other license or right
* is granted directly or by implication, estoppel or otherwise;
*
* The above copyright and patent license is granted only if the following
* conditions are met:
*
* 3. Conditions
*
* 3.1. Redistribution of Source with Rights to Further Distribute Source.
* Redistribution of source code of any substantial portion of the Covered
* Code or modification with rights to further distribute source must include
* the above Copyright Notice, the above License, this list of Conditions,
* and the following Disclaimer and Export Compliance provision. In addition,
* Licensee must cause all Covered Code to which Licensee contributes to
* contain a file documenting the changes Licensee made to create that Covered
* Code and the date of any change. Licensee must include in that file the
* documentation of any changes made by any predecessor Licensee. Licensee
* must include a prominent statement that the modification is derived,
* directly or indirectly, from Original Intel Code.
*
* 3.2. Redistribution of Source with no Rights to Further Distribute Source.
* Redistribution of source code of any substantial portion of the Covered
* Code or modification without rights to further distribute source must
* include the following Disclaimer and Export Compliance provision in the
* documentation and/or other materials provided with distribution. In
* addition, Licensee may not authorize further sublicense of source of any
* portion of the Covered Code, and must include terms to the effect that the
* license from Licensee to its licensee is limited to the intellectual
* property embodied in the software Licensee provides to its licensee, and
* not to intellectual property embodied in modifications its licensee may
* make.
*
* 3.3. Redistribution of Executable. Redistribution in executable form of any
* substantial portion of the Covered Code or modification must reproduce the
* above Copyright Notice, and the following Disclaimer and Export Compliance
* provision in the documentation and/or other materials provided with the
* distribution.
*
* 3.4. Intel retains all right, title, and interest in and to the Original
* Intel Code.
*
* 3.5. Neither the name Intel nor any other trademark owned or controlled by
* Intel shall be used in advertising or otherwise to promote the sale, use or
* other dealings in products derived from or relating to the Covered Code
* without prior written authorization from Intel.
*
* 4. Disclaimer and Export Compliance
*
* 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
* HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
* IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
* INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
* UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
* IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
* PARTICULAR PURPOSE.
*
* 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
* OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
* COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
* SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
* CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
* HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
* SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
* LIMITED REMEDY.
*
* 4.3. Licensee shall not export, either directly or indirectly, any of this
* software or system incorporating such software without first obtaining any
* required license or other approval from the U. S. Department of Commerce or
* any other agency or department of the United States Government. In the
* event Licensee exports any such software from the United States or
* re-exports any such software from a foreign destination, Licensee shall
* ensure that the distribution and export/re-export of the software is in
* compliance with all laws, regulations, orders, or other restrictions of the
* U.S. Export Administration Regulations. Licensee agrees that neither it nor
* any of its subsidiaries will export/re-export any technical data, process,
* software, or service, directly or indirectly, to any country for which the
* United States government or any agency thereof requires an export license,
* other governmental approval, or letter of assurance, without first obtaining
* such license, approval or letter.
*
*****************************************************************************/
#define __NSOBJECT_C__
#include "acpi.h"
#include "amlcode.h"
#include "acnamesp.h"
#include "acinterp.h"
#include "actables.h"
#define _COMPONENT NAMESPACE
MODULE_NAME ("nsobject");
/*******************************************************************************
*
* FUNCTION: AcpiNsAttachObject
*
* PARAMETERS: NameDesc - Parent Named Object
* Object - Object to be attached
* Type - Type of object, or ACPI_TYPE_ANY if not
* known
*
* DESCRIPTION: Record the given object as the value associated with the
* name whose ACPI_HANDLE is passed. If Object is NULL
* and Type is ACPI_TYPE_ANY, set the name as having no value.
*
* MUTEX: Assumes namespace is locked
*
******************************************************************************/
ACPI_STATUS
AcpiNsAttachObject (
ACPI_NAMED_OBJECT *NameDesc,
ACPI_OBJECT_INTERNAL *Object,
OBJECT_TYPE_INTERNAL Type)
{
ACPI_OBJECT_INTERNAL *ObjDesc;
ACPI_OBJECT_INTERNAL *PreviousObjDesc;
OBJECT_TYPE_INTERNAL ObjType = ACPI_TYPE_ANY;
UINT8 Flags;
UINT16 Opcode;
FUNCTION_TRACE ("NsAttachObject");
/*
* Parameter validation
*/
if (!AcpiGbl_RootObject)
{
/* Name space not initialized */
REPORT_ERROR ("NsAttachObject: Name space not initialized");
return_ACPI_STATUS (AE_NO_NAMESPACE);
}
if (!NameDesc)
{
/* Invalid handle */
REPORT_ERROR ("NsAttachObject: Null NamedObj handle");
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
if (!Object && (ACPI_TYPE_ANY != Type))
{
/* Null object */
REPORT_ERROR ("NsAttachObject: Null object, but type"
"not ACPI_TYPE_ANY");
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
if (!VALID_DESCRIPTOR_TYPE (NameDesc, ACPI_DESC_TYPE_NAMED))
{
/* Not a name handle */
REPORT_ERROR ("NsAttachObject: Invalid handle");
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
/* Check if this object is already attached */
if (NameDesc->Object == Object)
{
DEBUG_PRINT (TRACE_EXEC,
("NsAttachObject: Obj %p already installed in NameObj %p\n",
Object, NameDesc));
return_ACPI_STATUS (AE_OK);
}
/* Get the current flags field of the NamedObject */
Flags = NameDesc->Flags;
Flags &= ~ANOBJ_AML_ATTACHMENT;
/* If null object, we will just install it */
if (!Object)
{
ObjDesc = NULL;
ObjType = ACPI_TYPE_ANY;
}
/*
* If the object is an Named Object with an attached object,
* we will use that (attached) object
*/
else if (VALID_DESCRIPTOR_TYPE (Object, ACPI_DESC_TYPE_NAMED) &&
((ACPI_NAMED_OBJECT *) Object)->Object)
{
/*
* Value passed is a name handle and that name has a
* non-null value. Use that name's value and type.
*/
ObjDesc = ((ACPI_NAMED_OBJECT *) Object)->Object;
ObjType = ((ACPI_NAMED_OBJECT *) Object)->Type;
/*
* Copy appropriate flags
*/
if (((ACPI_NAMED_OBJECT*) Object)->Flags & ANOBJ_AML_ATTACHMENT)
{
Flags |= ANOBJ_AML_ATTACHMENT;
}
}
/*
* Otherwise, we will use the parameter object, but we must type
* it first
*/
else
{
ObjDesc = (ACPI_OBJECT_INTERNAL *) Object;
/* If a valid type (non-ANY) was given, just use it */
if (ACPI_TYPE_ANY != Type)
{
ObjType = Type;
}
/*
* Type is TYPE_Any, we must try to determinte the
* actual type of the object
*/
/*
* Check if value points into the AML code
*/
else if (AcpiTbSystemTablePointer (Object))
{
/*
* Object points into the AML stream.
* Set a flag bit in the Named Object to indicate this
*/
Flags |= ANOBJ_AML_ATTACHMENT;
/*
* The next byte (perhaps the next two bytes)
* will be the AML opcode
*/
MOVE_UNALIGNED16_TO_16 (&Opcode, Object);
/* Check for a recognized OpCode */
switch ((UINT8) Opcode)
{
case AML_OP_PREFIX:
if (Opcode != AML_REVISION_OP)
{
/*
* OpPrefix is unrecognized unless part
* of RevisionOp
*/
break;
}
/* Else fall through to set type as Number */
case AML_ZERO_OP: case AML_ONES_OP: case AML_ONE_OP:
case AML_BYTE_OP: case AML_WORD_OP: case AML_DWORD_OP:
ObjType = ACPI_TYPE_NUMBER;
break;
case AML_STRING_OP:
ObjType = ACPI_TYPE_STRING;
break;
case AML_BUFFER_OP:
ObjType = ACPI_TYPE_BUFFER;
break;
case AML_MUTEX_OP:
ObjType = ACPI_TYPE_MUTEX;
break;
case AML_PACKAGE_OP:
ObjType = ACPI_TYPE_PACKAGE;
break;
default:
DEBUG_PRINT (ACPI_ERROR,
("AML Opcode/Type [%x] not supported in attach\n",
(UINT8) Opcode));
return_ACPI_STATUS (AE_TYPE);
break;
}
}
else
{
/*
* Cannot figure out the type -- set to DefAny which
* will print as an error in the name table dump
*/
if (GetDebugLevel () > 0)
{
DUMP_PATHNAME (NameDesc,
"NsAttachObject confused: setting bogus type for ",
ACPI_INFO, _COMPONENT);
if (AcpiTbSystemTablePointer (Object))
{
DEBUG_PRINT (ACPI_INFO,
("AML-stream code %02x\n", *(UINT8 *) Object));
}
else if (VALID_DESCRIPTOR_TYPE (Object, ACPI_DESC_TYPE_NAMED))
{
DUMP_PATHNAME (Object,
"name ", ACPI_INFO,
_COMPONENT);
}
else
{
DUMP_PATHNAME (Object, "object ",
ACPI_INFO, _COMPONENT);
DUMP_STACK_ENTRY (Object);
}
}
ObjType = INTERNAL_TYPE_DEF_ANY;
}
}
DEBUG_PRINT (TRACE_EXEC,
("NsAttachObject: Installing Intobj %p into NameObj %p\n",
ObjDesc, NameDesc));
/*
* Must increment the new value's reference count
* (if it is an internal object)
*/
AcpiCmAddReference (ObjDesc);
/* Save the existing object (if any) for deletion later */
PreviousObjDesc = NameDesc->Object;
/* Install the object and set the type, flags */
NameDesc->Object = ObjDesc;
NameDesc->Type = (UINT8) ObjType;
NameDesc->Flags |= Flags;
/*
* Delete an existing attached object.
*/
if (PreviousObjDesc)
{
/* One for the attach to the Named Object */
AcpiCmRemoveReference (PreviousObjDesc);
/* Now delete */
AcpiCmRemoveReference (PreviousObjDesc);
}
return_ACPI_STATUS (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: AcpiNsDetachObject
*
* PARAMETERS: NameDesc - An object whose Value will be deleted
*
* RETURN: None.
*
* DESCRIPTION: Delete the Value associated with a namespace object. If the
* Value is an allocated object, it is freed. Otherwise, the
* field is simply cleared.
*
******************************************************************************/
void
AcpiNsDetachObject (
ACPI_NAMED_OBJECT *NameDesc)
{
ACPI_OBJECT_INTERNAL *ObjDesc;
FUNCTION_TRACE ("NsDetachObject");
ObjDesc = NameDesc->Object;
if (!ObjDesc)
{
return_VOID;
}
/* Clear the entry in all cases */
NameDesc->Object = NULL;
/* Found a valid value */
DEBUG_PRINT (ACPI_INFO,
("NsDetachObject: Object=%p Value=%p Name %4.4s\n",
NameDesc, ObjDesc, &NameDesc->Name));
/*
* Not every value is an object allocated via AcpiCmCallocate,
* - must check
*/
if (!AcpiTbSystemTablePointer (ObjDesc))
{
/* Attempt to delete the object (and all subobjects) */
AcpiCmRemoveReference (ObjDesc);
}
return_VOID;
}
/*******************************************************************************
*
* FUNCTION: AcpiNsGetAttachedObject
*
* PARAMETERS: Handle - Parent Named Object to be examined
*
* RETURN: Current value of the object field from the Named Object whose
* handle is passed
*
******************************************************************************/
void *
AcpiNsGetAttachedObject (
ACPI_HANDLE Handle)
{
FUNCTION_TRACE_PTR ("NsGetAttachedObject", Handle);
if (!Handle)
{
/* handle invalid */
REPORT_WARNING ("NsGetAttachedObject: Null handle");
return_PTR (NULL);
}
return_PTR (((ACPI_NAMED_OBJECT*) Handle)->Object);
}

View File

@ -0,0 +1,509 @@
/*******************************************************************************
*
* Module Name: nssearch - Namespace search
* $Revision: 1.55 $
*
******************************************************************************/
/******************************************************************************
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, Intel Corp. All rights
* reserved.
*
* 2. License
*
* 2.1. This is your license from Intel Corp. under its intellectual property
* rights. You may have additional license terms from the party that provided
* you this software, covering your right to use that party's intellectual
* property rights.
*
* 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
* copy of the source code appearing in this file ("Covered Code") an
* irrevocable, perpetual, worldwide license under Intel's copyrights in the
* base code distributed originally by Intel ("Original Intel Code") to copy,
* make derivatives, distribute, use and display any portion of the Covered
* Code in any form, with the right to sublicense such rights; and
*
* 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
* license (with the right to sublicense), under only those claims of Intel
* patents that are infringed by the Original Intel Code, to make, use, sell,
* offer to sell, and import the Covered Code and derivative works thereof
* solely to the minimum extent necessary to exercise the above copyright
* license, and in no event shall the patent license extend to any additions
* to or modifications of the Original Intel Code. No other license or right
* is granted directly or by implication, estoppel or otherwise;
*
* The above copyright and patent license is granted only if the following
* conditions are met:
*
* 3. Conditions
*
* 3.1. Redistribution of Source with Rights to Further Distribute Source.
* Redistribution of source code of any substantial portion of the Covered
* Code or modification with rights to further distribute source must include
* the above Copyright Notice, the above License, this list of Conditions,
* and the following Disclaimer and Export Compliance provision. In addition,
* Licensee must cause all Covered Code to which Licensee contributes to
* contain a file documenting the changes Licensee made to create that Covered
* Code and the date of any change. Licensee must include in that file the
* documentation of any changes made by any predecessor Licensee. Licensee
* must include a prominent statement that the modification is derived,
* directly or indirectly, from Original Intel Code.
*
* 3.2. Redistribution of Source with no Rights to Further Distribute Source.
* Redistribution of source code of any substantial portion of the Covered
* Code or modification without rights to further distribute source must
* include the following Disclaimer and Export Compliance provision in the
* documentation and/or other materials provided with distribution. In
* addition, Licensee may not authorize further sublicense of source of any
* portion of the Covered Code, and must include terms to the effect that the
* license from Licensee to its licensee is limited to the intellectual
* property embodied in the software Licensee provides to its licensee, and
* not to intellectual property embodied in modifications its licensee may
* make.
*
* 3.3. Redistribution of Executable. Redistribution in executable form of any
* substantial portion of the Covered Code or modification must reproduce the
* above Copyright Notice, and the following Disclaimer and Export Compliance
* provision in the documentation and/or other materials provided with the
* distribution.
*
* 3.4. Intel retains all right, title, and interest in and to the Original
* Intel Code.
*
* 3.5. Neither the name Intel nor any other trademark owned or controlled by
* Intel shall be used in advertising or otherwise to promote the sale, use or
* other dealings in products derived from or relating to the Covered Code
* without prior written authorization from Intel.
*
* 4. Disclaimer and Export Compliance
*
* 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
* HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
* IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
* INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
* UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
* IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
* PARTICULAR PURPOSE.
*
* 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
* OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
* COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
* SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
* CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
* HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
* SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
* LIMITED REMEDY.
*
* 4.3. Licensee shall not export, either directly or indirectly, any of this
* software or system incorporating such software without first obtaining any
* required license or other approval from the U. S. Department of Commerce or
* any other agency or department of the United States Government. In the
* event Licensee exports any such software from the United States or
* re-exports any such software from a foreign destination, Licensee shall
* ensure that the distribution and export/re-export of the software is in
* compliance with all laws, regulations, orders, or other restrictions of the
* U.S. Export Administration Regulations. Licensee agrees that neither it nor
* any of its subsidiaries will export/re-export any technical data, process,
* software, or service, directly or indirectly, to any country for which the
* United States government or any agency thereof requires an export license,
* other governmental approval, or letter of assurance, without first obtaining
* such license, approval or letter.
*
*****************************************************************************/
#define __NSSEARCH_C__
#include "acpi.h"
#include "amlcode.h"
#include "acinterp.h"
#include "acnamesp.h"
#define _COMPONENT NAMESPACE
MODULE_NAME ("nssearch");
/*******************************************************************************
*
* FUNCTION: AcpiNsSearchNameTable
*
* PARAMETERS: *TargetName - Ascii ACPI name to search for
* *NameDesc - Starting table where search will begin
* Type - Object type to match
* **ReturnNameDesc - Where the matched Named obj is returned
*
* RETURN: Status
*
* DESCRIPTION: Search a single namespace table. Performs a simple search,
* does not add entries or search parents.
*
*
* Named object lists are built (and subsequently dumped) in the
* order in which the names are encountered during the namespace load;
*
* All namespace searching is linear in this implementation, but
* could be easily modified to support any improved search
* algorithm. However, the linear search was chosen for simplicity
* and because the trees are small and the other interpreter
* execution overhead is relatively high.
*
******************************************************************************/
ACPI_STATUS
AcpiNsSearchNameTable (
UINT32 TargetName,
ACPI_NAMED_OBJECT *NameDesc,
OBJECT_TYPE_INTERNAL Type,
ACPI_NAMED_OBJECT **ReturnNameDesc)
{
ACPI_NAMED_OBJECT *NextDesc;
FUNCTION_TRACE ("NsSearchNameTable");
{
DEBUG_EXEC (NATIVE_CHAR *ScopeName = AcpiNsGetTablePathname (NameDesc));
DEBUG_PRINT (TRACE_NAMES,
("NsSearchNameTable: Searching %s [%p]\n",
ScopeName, NameDesc));
DEBUG_PRINT (TRACE_NAMES,
("NsSearchNameTable: For %4.4s (type 0x%X)\n",
&TargetName, Type));
DEBUG_EXEC (AcpiCmFree (ScopeName));
}
/*
* Search for name in this table, which is to say that we must search
* for the name among the children of this object
*/
NextDesc = NameDesc->Child;
while (NextDesc)
{
/* Check for match against the name */
if (NextDesc->Name == TargetName)
{
/*
* Found matching entry. Capture type if
* appropriate before returning the entry.
*/
/*
* The DefFieldDefn and BankFieldDefn cases
* are actually looking up the Region in which
* the field will be defined
*/
if ((INTERNAL_TYPE_DEF_FIELD_DEFN == Type) ||
(INTERNAL_TYPE_BANK_FIELD_DEFN == Type))
{
Type = ACPI_TYPE_REGION;
}
/*
* Scope, DefAny, and IndexFieldDefn are bogus
* "types" which do not actually have anything
* to do with the type of the name being looked
* up. For any other value of Type, if the type
* stored in the entry is Any (i.e. unknown),
* save the actual type.
*/
if (Type != INTERNAL_TYPE_SCOPE &&
Type != INTERNAL_TYPE_DEF_ANY &&
Type != INTERNAL_TYPE_INDEX_FIELD_DEFN &&
NextDesc->Type == ACPI_TYPE_ANY)
{
NextDesc->Type = (UINT8) Type;
}
DEBUG_PRINT (TRACE_NAMES,
("NsSearchNameTable: Name %4.4s (actual type 0x%X) found at %p\n",
&TargetName, NextDesc->Type, NextDesc));
*ReturnNameDesc = NextDesc;
return_ACPI_STATUS (AE_OK);
}
/*
* The last entry in the list points back to the parent,
* so a flag is used to indicate the end-of-list
*/
if (NextDesc->Flags & ANOBJ_END_OF_PEER_LIST)
{
/* Searched entire list, we are done */
break;
}
/* Didn't match name, move on to the next peer object */
NextDesc = NextDesc->Peer;
}
/* Searched entire table, not found */
DEBUG_PRINT (TRACE_NAMES,
("NsSearchNameTable: Name %4.4s (type 0x%X) not found at %p\n",
&TargetName, Type, NextDesc));
return_ACPI_STATUS (AE_NOT_FOUND);
}
/*******************************************************************************
*
* FUNCTION: AcpiNsSearchParentTree
*
* PARAMETERS: *TargetName - Ascii ACPI name to search for
* *NameDesc - Starting table where search will begin
* Type - Object type to match
* **ReturnNameDesc - Where the matched Named Obj is returned
*
* RETURN: Status
*
* DESCRIPTION: Called when a name has not been found in the current namespace
* table. Before adding it or giving up, ACPI scope rules require
* searching enclosing scopes in cases identified by AcpiNsLocal().
*
* "A name is located by finding the matching name in the current
* name space, and then in the parent name space. If the parent
* name space does not contain the name, the search continues
* recursively until either the name is found or the name space
* does not have a parent (the root of the name space). This
* indicates that the name is not found" (From ACPI Specification,
* section 5.3)
*
******************************************************************************/
ACPI_STATUS
AcpiNsSearchParentTree (
UINT32 TargetName,
ACPI_NAMED_OBJECT *NameDesc,
OBJECT_TYPE_INTERNAL Type,
ACPI_NAMED_OBJECT **ReturnNameDesc)
{
ACPI_STATUS Status;
ACPI_NAMED_OBJECT *ParentDesc;
FUNCTION_TRACE ("NsSearchParentTree");
ParentDesc = AcpiNsGetParentObject (NameDesc);
/*
* If there is no parent (at the root) or type is "local", we won't be
* searching the parent tree.
*/
if ((AcpiNsLocal (Type)) ||
(!ParentDesc))
{
if (!ParentDesc)
{
DEBUG_PRINT (TRACE_NAMES,
("NsSearchParentTree: [%4.4s] has no parent\n",
&TargetName));
}
if (AcpiNsLocal (Type))
{
DEBUG_PRINT (TRACE_NAMES,
("NsSearchParentTree: [%4.4s] (type 0x%X) is local (no search)\n",
&TargetName, Type));
}
return_ACPI_STATUS (AE_NOT_FOUND);
}
/* Search the parent tree */
DEBUG_PRINT (TRACE_NAMES,
("NsSearchParentTree: Searching parent for %4.4s\n",
&TargetName));
/*
* Search parents until found the target or we have backed up to
* the root
*/
while (ParentDesc)
{
/* Search parent scope */
/* TBD: [Investigate] Why ACPI_TYPE_ANY? */
Status = AcpiNsSearchNameTable (TargetName, ParentDesc,
ACPI_TYPE_ANY, ReturnNameDesc);
if (ACPI_SUCCESS (Status))
{
return_ACPI_STATUS (Status);
}
/*
* Not found here, go up another level
* (until we reach the root)
*/
ParentDesc = AcpiNsGetParentObject (ParentDesc);
}
/* Not found in parent tree */
return_ACPI_STATUS (AE_NOT_FOUND);
}
/*******************************************************************************
*
* FUNCTION: AcpiNsSearchAndEnter
*
* PARAMETERS: TargetName - Ascii ACPI name to search for (4 chars)
* WalkState - Current state of the walk
* *NameDesc - Starting table where search will begin
* InterpreterMode - Add names only in MODE_LoadPassX.
* Otherwise,search only.
* Type - Object type to match
* Flags - Flags describing the search restrictions
* **ReturnNameDesc - Where the Named Object is returned
*
* RETURN: Status
*
* DESCRIPTION: Search for a name segment in a single name table,
* optionally adding it if it is not found. If the passed
* Type is not Any and the type previously stored in the
* entry was Any (i.e. unknown), update the stored type.
*
* In IMODE_EXECUTE, search only.
* In other modes, search and add if not found.
*
******************************************************************************/
ACPI_STATUS
AcpiNsSearchAndEnter (
UINT32 TargetName,
ACPI_WALK_STATE *WalkState,
ACPI_NAMED_OBJECT *NameDesc,
OPERATING_MODE InterpreterMode,
OBJECT_TYPE_INTERNAL Type,
UINT32 Flags,
ACPI_NAMED_OBJECT **ReturnNameDesc)
{
ACPI_STATUS Status;
ACPI_NAMED_OBJECT *NewDesc;
FUNCTION_TRACE ("NsSearchAndEnter");
/* Parameter validation */
if (!NameDesc || !TargetName || !ReturnNameDesc)
{
DEBUG_PRINT (ACPI_ERROR,
("NsSearchAndEnter: Null param: Table %p Name %p Return %p\n",
NameDesc, TargetName, ReturnNameDesc));
REPORT_ERROR ("NsSearchAndEnter: bad (null)parameter");
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
/* Name must consist of printable characters */
if (!AcpiCmValidAcpiName (TargetName))
{
DEBUG_PRINT (ACPI_ERROR,
("NsSearchAndEnter: *** Bad character in name: %08lx *** \n",
TargetName));
REPORT_ERROR ("NsSearchAndEnter: Bad character in ACPI Name");
return_ACPI_STATUS (AE_BAD_CHARACTER);
}
/* Try to find the name in the table specified by the caller */
*ReturnNameDesc = ENTRY_NOT_FOUND;
Status = AcpiNsSearchNameTable (TargetName, NameDesc,
Type, ReturnNameDesc);
if (Status != AE_NOT_FOUND)
{
/*
* Either found it or there was an error
* -- finished either way
*/
return_ACPI_STATUS (Status);
}
/*
* Not found in the table. If we are NOT performing the
* first pass (name entry) of loading the namespace, search
* the parent tree (all the way to the root if necessary.)
* We don't want to perform the parent search when the
* namespace is actually being loaded. We want to perform
* the search when namespace references are being resolved
* (load pass 2) and during the execution phase.
*/
if ((InterpreterMode != IMODE_LOAD_PASS1) &&
(Flags & NS_SEARCH_PARENT))
{
/*
* Not found in table - search parent tree according
* to ACPI specification
*/
Status = AcpiNsSearchParentTree (TargetName, NameDesc,
Type, ReturnNameDesc);
if (ACPI_SUCCESS (Status))
{
return_ACPI_STATUS (Status);
}
}
/*
* In execute mode, just search, never add names. Exit now.
*/
if (InterpreterMode == IMODE_EXECUTE)
{
DEBUG_PRINT (TRACE_NAMES,
("NsSearchAndEnter: %4.4s Not found in %p [Not adding]\n",
&TargetName, NameDesc));
return_ACPI_STATUS (AE_NOT_FOUND);
}
/* Create the new named object */
NewDesc = AcpiNsCreateNamedObject (TargetName);
if (!NewDesc)
{
return_ACPI_STATUS (AE_NO_MEMORY);
}
/* Install the new object into the parent's list of children */
AcpiNsInstallNamedObject (WalkState, NameDesc, NewDesc, Type);
*ReturnNameDesc = NewDesc;
return_ACPI_STATUS (AE_OK);
}

View File

@ -0,0 +1,841 @@
/******************************************************************************
*
* Module Name: nsutils - Utilities for accessing ACPI namespace, accessing
* parents and siblings and Scope manipulation
* $Revision: 1.67 $
*
*****************************************************************************/
/******************************************************************************
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, Intel Corp. All rights
* reserved.
*
* 2. License
*
* 2.1. This is your license from Intel Corp. under its intellectual property
* rights. You may have additional license terms from the party that provided
* you this software, covering your right to use that party's intellectual
* property rights.
*
* 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
* copy of the source code appearing in this file ("Covered Code") an
* irrevocable, perpetual, worldwide license under Intel's copyrights in the
* base code distributed originally by Intel ("Original Intel Code") to copy,
* make derivatives, distribute, use and display any portion of the Covered
* Code in any form, with the right to sublicense such rights; and
*
* 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
* license (with the right to sublicense), under only those claims of Intel
* patents that are infringed by the Original Intel Code, to make, use, sell,
* offer to sell, and import the Covered Code and derivative works thereof
* solely to the minimum extent necessary to exercise the above copyright
* license, and in no event shall the patent license extend to any additions
* to or modifications of the Original Intel Code. No other license or right
* is granted directly or by implication, estoppel or otherwise;
*
* The above copyright and patent license is granted only if the following
* conditions are met:
*
* 3. Conditions
*
* 3.1. Redistribution of Source with Rights to Further Distribute Source.
* Redistribution of source code of any substantial portion of the Covered
* Code or modification with rights to further distribute source must include
* the above Copyright Notice, the above License, this list of Conditions,
* and the following Disclaimer and Export Compliance provision. In addition,
* Licensee must cause all Covered Code to which Licensee contributes to
* contain a file documenting the changes Licensee made to create that Covered
* Code and the date of any change. Licensee must include in that file the
* documentation of any changes made by any predecessor Licensee. Licensee
* must include a prominent statement that the modification is derived,
* directly or indirectly, from Original Intel Code.
*
* 3.2. Redistribution of Source with no Rights to Further Distribute Source.
* Redistribution of source code of any substantial portion of the Covered
* Code or modification without rights to further distribute source must
* include the following Disclaimer and Export Compliance provision in the
* documentation and/or other materials provided with distribution. In
* addition, Licensee may not authorize further sublicense of source of any
* portion of the Covered Code, and must include terms to the effect that the
* license from Licensee to its licensee is limited to the intellectual
* property embodied in the software Licensee provides to its licensee, and
* not to intellectual property embodied in modifications its licensee may
* make.
*
* 3.3. Redistribution of Executable. Redistribution in executable form of any
* substantial portion of the Covered Code or modification must reproduce the
* above Copyright Notice, and the following Disclaimer and Export Compliance
* provision in the documentation and/or other materials provided with the
* distribution.
*
* 3.4. Intel retains all right, title, and interest in and to the Original
* Intel Code.
*
* 3.5. Neither the name Intel nor any other trademark owned or controlled by
* Intel shall be used in advertising or otherwise to promote the sale, use or
* other dealings in products derived from or relating to the Covered Code
* without prior written authorization from Intel.
*
* 4. Disclaimer and Export Compliance
*
* 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
* HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
* IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
* INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
* UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
* IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
* PARTICULAR PURPOSE.
*
* 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
* OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
* COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
* SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
* CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
* HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
* SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
* LIMITED REMEDY.
*
* 4.3. Licensee shall not export, either directly or indirectly, any of this
* software or system incorporating such software without first obtaining any
* required license or other approval from the U. S. Department of Commerce or
* any other agency or department of the United States Government. In the
* event Licensee exports any such software from the United States or
* re-exports any such software from a foreign destination, Licensee shall
* ensure that the distribution and export/re-export of the software is in
* compliance with all laws, regulations, orders, or other restrictions of the
* U.S. Export Administration Regulations. Licensee agrees that neither it nor
* any of its subsidiaries will export/re-export any technical data, process,
* software, or service, directly or indirectly, to any country for which the
* United States government or any agency thereof requires an export license,
* other governmental approval, or letter of assurance, without first obtaining
* such license, approval or letter.
*
*****************************************************************************/
#define __NSUTILS_C__
#include "acpi.h"
#include "acnamesp.h"
#include "acinterp.h"
#include "amlcode.h"
#include "actables.h"
#define _COMPONENT NAMESPACE
MODULE_NAME ("nsutils");
/****************************************************************************
*
* FUNCTION: AcpiNsValidRootPrefix
*
* PARAMETERS: Prefix - Character to be checked
*
* RETURN: TRUE if a valid prefix
*
* DESCRIPTION: Check if a character is a valid ACPI Root prefix
*
***************************************************************************/
BOOLEAN
AcpiNsValidRootPrefix (
NATIVE_CHAR Prefix)
{
return ((BOOLEAN) (Prefix == '\\'));
}
/****************************************************************************
*
* FUNCTION: AcpiNsValidPathSeparator
*
* PARAMETERS: Sep - Character to be checked
*
* RETURN: TRUE if a valid path separator
*
* DESCRIPTION: Check if a character is a valid ACPI path separator
*
***************************************************************************/
BOOLEAN
AcpiNsValidPathSeparator (
NATIVE_CHAR Sep)
{
return ((BOOLEAN) (Sep == '.'));
}
/****************************************************************************
*
* FUNCTION: AcpiNsGetType
*
* PARAMETERS: Handle - Parent Named Object to be examined
*
* RETURN: Type field from Named Object whose handle is passed
*
***************************************************************************/
OBJECT_TYPE_INTERNAL
AcpiNsGetType (
ACPI_HANDLE handle)
{
FUNCTION_TRACE ("NsGetType");
if (!handle)
{
/* Handle invalid */
REPORT_WARNING ("NsGetType: Null handle");
return_VALUE (ACPI_TYPE_ANY);
}
return_VALUE (((ACPI_NAMED_OBJECT*) handle)->Type);
}
/****************************************************************************
*
* FUNCTION: AcpiNsLocal
*
* PARAMETERS: Type - A namespace object type
*
* RETURN: LOCAL if names must be found locally in objects of the
* passed type, 0 if enclosing scopes should be searched
*
***************************************************************************/
UINT32
AcpiNsLocal (
OBJECT_TYPE_INTERNAL Type)
{
FUNCTION_TRACE ("NsLocal");
if (!AcpiCmValidObjectType (Type))
{
/* type code out of range */
REPORT_WARNING ("NsLocal: Invalid Object Type");
return_VALUE (NSP_NORMAL);
}
return_VALUE ((UINT32) AcpiGbl_NsProperties[Type] & NSP_LOCAL);
}
/****************************************************************************
*
* FUNCTION: AcpiNsInternalizeName
*
* PARAMETERS: *ExternalName - External representation of name
* **Converted Name - Where to return the resulting
* internal represention of the name
*
* RETURN: Status
*
* DESCRIPTION: Convert an external representation (e.g. "\_PR_.CPU0")
* to internal form (e.g. 5c 2f 02 5f 50 52 5f 43 50 55 30)
*
****************************************************************************/
ACPI_STATUS
AcpiNsInternalizeName (
NATIVE_CHAR *ExternalName,
NATIVE_CHAR **ConvertedName)
{
NATIVE_CHAR *Result = NULL;
NATIVE_CHAR *InternalName;
UINT32 NumSegments;
BOOLEAN FullyQualified = FALSE;
UINT32 i;
FUNCTION_TRACE ("NsInternalizeName");
if ((!ExternalName) ||
(*ExternalName == 0) ||
(!ConvertedName))
{
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
/*
* For the internal name, the required length is 4 bytes
* per segment, plus 1 each for RootPrefix, MultiNamePrefixOp,
* segment count, trailing null (which is not really needed,
* but no there's harm in putting it there)
*
* strlen() + 1 covers the first NameSeg, which has no
* path separator
*/
if (AcpiNsValidRootPrefix (ExternalName[0]))
{
FullyQualified = TRUE;
ExternalName++;
}
/*
* Determine the number of ACPI name "segments" by counting
* the number of path separators within the string. Start
* with one segment since the segment count is (# separators)
* + 1, and zero separators is ok.
*/
NumSegments = 1;
for (i = 0; ExternalName[i]; i++)
{
if (AcpiNsValidPathSeparator (ExternalName[i]))
{
NumSegments++;
}
}
/* We need a segment to store the internal version of the name */
InternalName = AcpiCmCallocate ((ACPI_NAME_SIZE * NumSegments) + 4);
if (!InternalName)
{
return_ACPI_STATUS (AE_NO_MEMORY);
}
/* Setup the correct prefixes, counts, and pointers */
if (FullyQualified)
{
InternalName[0] = '\\';
InternalName[1] = AML_MULTI_NAME_PREFIX_OP;
InternalName[2] = (char) NumSegments;
Result = &InternalName[3];
}
else
{
InternalName[0] = AML_MULTI_NAME_PREFIX_OP;
InternalName[1] = (char) NumSegments;
Result = &InternalName[2];
}
/* Build the name (minus path separators) */
for (; NumSegments; NumSegments--)
{
for (i = 0; i < ACPI_NAME_SIZE; i++)
{
if (AcpiNsValidPathSeparator (*ExternalName) ||
(*ExternalName == 0))
{
/*
* Pad the segment with underscore(s) if
* segment is short
*/
Result[i] = '_';
}
else
{
/* Convert INT8 to uppercase and save it */
Result[i] = (char) TOUPPER (*ExternalName);
ExternalName++;
}
}
/* Now we must have a path separator, or the pathname is bad */
if (!AcpiNsValidPathSeparator (*ExternalName) &&
(*ExternalName != 0))
{
AcpiCmFree (InternalName);
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
/* Move on the next segment */
ExternalName++;
Result += ACPI_NAME_SIZE;
}
/* Return the completed name */
/* Terminate the string! */
*Result = 0;
*ConvertedName = InternalName;
if (FullyQualified)
{
DEBUG_PRINT (TRACE_EXEC,
("NsInternalizeName: returning [%p] (abs) \"\\%s\"\n",
InternalName, &InternalName[3]));
}
else
{
DEBUG_PRINT (TRACE_EXEC,
("NsInternalizeName: returning [%p] (rel) \"%s\"\n",
InternalName, &InternalName[2]));
}
return_ACPI_STATUS (AE_OK);
}
/****************************************************************************
*
* FUNCTION: AcpiNsConvertHandleToEntry
*
* PARAMETERS: Handle - Handle to be converted to an Named Object
*
* RETURN: A Name table entry pointer
*
* DESCRIPTION: Convert a namespace handle to a real Named Object
*
****************************************************************************/
ACPI_NAMED_OBJECT*
AcpiNsConvertHandleToEntry (
ACPI_HANDLE Handle)
{
/*
* Simple implementation for now;
* TBD: [Future] Real integer handles allow for more verification
* and keep all pointers within this subsystem!
*/
if (!Handle)
{
return (NULL);
}
if (Handle == ACPI_ROOT_OBJECT)
{
return (AcpiGbl_RootObject);
}
/* We can at least attempt to verify the handle */
if (!VALID_DESCRIPTOR_TYPE (Handle, ACPI_DESC_TYPE_NAMED))
{
return (NULL);
}
return ((ACPI_NAMED_OBJECT*) Handle);
}
/****************************************************************************
*
* FUNCTION: AcpiNsConvertEntryToHandle
*
* PARAMETERS: NameDesc - Named Object to be converted to a Handle
*
* RETURN: An USER ACPI_HANDLE
*
* DESCRIPTION: Convert a real Named Object to a namespace handle
*
****************************************************************************/
ACPI_HANDLE
AcpiNsConvertEntryToHandle (
ACPI_NAMED_OBJECT *NameDesc)
{
/*
* Simple implementation for now;
* TBD: [Future] Real integer handles allow for more verification
* and keep all pointers within this subsystem!
*/
return ((ACPI_HANDLE) NameDesc);
/* ---------------------------------------------------
if (!NameDesc)
{
return (NULL);
}
if (NameDesc == AcpiGbl_RootObject)
{
return (ACPI_ROOT_OBJECT);
}
return ((ACPI_HANDLE) NameDesc);
------------------------------------------------------*/
}
/******************************************************************************
*
* FUNCTION: AcpiNsTerminate
*
* PARAMETERS: none
*
* RETURN: none
*
* DESCRIPTION: free memory allocated for table storage.
*
******************************************************************************/
void
AcpiNsTerminate (void)
{
ACPI_OBJECT_INTERNAL *ObjDesc;
ACPI_NAMED_OBJECT *ThisNameDesc;
FUNCTION_TRACE ("NsTerminate");
ThisNameDesc = AcpiGbl_RootObject;
/*
* 1) Free the entire namespace -- all objects, tables, and stacks
*/
/*
* Delete all objects linked to the root
* (additional table descriptors)
*/
AcpiNsDeleteNamespaceSubtree (ThisNameDesc);
/* Detach any object(s) attached to the root */
ObjDesc = AcpiNsGetAttachedObject (ThisNameDesc);
if (ObjDesc)
{
AcpiNsDetachObject (ThisNameDesc);
AcpiCmRemoveReference (ObjDesc);
}
AcpiNsDeleteChildren (ThisNameDesc);
DEBUG_PRINT (ACPI_INFO, ("NsTerminate: Namespace freed\n"));
/*
* 2) Now we can delete the ACPI tables
*/
AcpiTbDeleteAcpiTables ();
DEBUG_PRINT (ACPI_INFO, ("NsTerminate: ACPI Tables freed\n"));
return_VOID;
}
/****************************************************************************
*
* FUNCTION: AcpiNsOpensScope
*
* PARAMETERS: Type - A valid namespace type
*
* RETURN: NEWSCOPE if the passed type "opens a name scope" according
* to the ACPI specification, else 0
*
***************************************************************************/
UINT32
AcpiNsOpensScope (
OBJECT_TYPE_INTERNAL Type)
{
FUNCTION_TRACE_U32 ("NsOpensScope", Type);
if (!AcpiCmValidObjectType (Type))
{
/* type code out of range */
REPORT_WARNING ("NsOpensScope: Invalid Object Type");
return_VALUE (NSP_NORMAL);
}
return_VALUE (((UINT32) AcpiGbl_NsProperties[Type]) & NSP_NEWSCOPE);
}
/****************************************************************************
*
* FUNCTION: AcpiNsGetNamedObject
*
* PARAMETERS: *Pathname - Name to be found, in external (ASL) format. The
* \ (backslash) and ^ (carat) prefixes, and the
* . (period) to separate segments are supported.
* InScope - Root of subtree to be searched, or NS_ALL for the
* root of the name space. If Name is fully
* qualified (first INT8 is '\'), the passed value
* of Scope will not be accessed.
* ReturnNameDesc - Where the NameDesc is returned
*
* DESCRIPTION: Look up a name relative to a given scope and return the
* corresponding Named Object. NOTE: Scope can be null.
*
* MUTEX: Locks namespace
*
***************************************************************************/
ACPI_STATUS
AcpiNsGetNamedObject (
NATIVE_CHAR *Pathname,
ACPI_NAMED_OBJECT *InScope,
ACPI_NAMED_OBJECT **ReturnNameDesc)
{
ACPI_GENERIC_STATE ScopeInfo;
ACPI_STATUS Status;
NATIVE_CHAR *InternalPath = NULL;
FUNCTION_TRACE_PTR ("NsGetNte", Pathname);
ScopeInfo.Scope.NameTable = InScope;
/* Ensure that the namespace has been initialized */
if (!AcpiGbl_RootObject)
{
return_ACPI_STATUS (AE_NO_NAMESPACE);
}
if (!Pathname)
{
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
/* Convert path to internal representation */
Status = AcpiNsInternalizeName (Pathname, &InternalPath);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
AcpiCmAcquireMutex (ACPI_MTX_NAMESPACE);
/* NS_ALL means start from the root */
if (NS_ALL == ScopeInfo.Scope.NameTable)
{
ScopeInfo.Scope.NameTable = AcpiGbl_RootObject;
}
else
{
ScopeInfo.Scope.NameTable = InScope;
if (!ScopeInfo.Scope.NameTable)
{
Status = AE_BAD_PARAMETER;
goto UnlockAndExit;
}
}
/* Lookup the name in the namespace */
Status = AcpiNsLookup (&ScopeInfo, InternalPath,
ACPI_TYPE_ANY, IMODE_EXECUTE,
NS_NO_UPSEARCH | NS_DONT_OPEN_SCOPE,
NULL, ReturnNameDesc);
if (ACPI_FAILURE (Status))
{
DEBUG_PRINT (ACPI_INFO, ("NsGetNte: %s, %s\n",
InternalPath, AcpiCmFormatException (Status)));
}
UnlockAndExit:
AcpiCmReleaseMutex (ACPI_MTX_NAMESPACE);
/* Cleanup */
AcpiCmFree (InternalPath);
return_ACPI_STATUS (Status);
}
/****************************************************************************
*
* FUNCTION: AcpiNsFindParentName
*
* PARAMETERS: *ChildDesc - Named Obj whose name is to be found
*
* RETURN: The ACPI name
*
* DESCRIPTION: Search for the given obj in its parent scope and return the
* name segment, or "????" if the parent name can't be found
* (which "should not happen").
*
***************************************************************************/
ACPI_NAME
AcpiNsFindParentName (
ACPI_NAMED_OBJECT *ChildDesc)
{
ACPI_NAMED_OBJECT *ParentDesc;
FUNCTION_TRACE ("FindParentName");
if (ChildDesc)
{
/* Valid entry. Get the parent NameDesc */
ParentDesc = AcpiNsGetParentObject (ChildDesc);
if (ParentDesc)
{
DEBUG_PRINT (TRACE_EXEC,
("Parent of %p [%4.4s] is %p [%4.4s]\n",
ChildDesc, &ChildDesc->Name, ParentDesc,
&ParentDesc->Name));
if (ParentDesc->Name)
{
return_VALUE (ParentDesc->Name);
}
}
DEBUG_PRINT (TRACE_EXEC,
("FindParentName: unable to find parent of %p (%4.4s)\n",
ChildDesc, &ChildDesc->Name));
}
return_VALUE (ACPI_UNKNOWN_NAME);
}
#ifdef ACPI_DEBUG
/****************************************************************************
*
* FUNCTION: AcpiNsExistDownstreamSibling
*
* PARAMETERS: *NameDesc - pointer to first Named Object to examine
*
* RETURN: TRUE if sibling is found, FALSE otherwise
*
* DESCRIPTION: Searches remainder of scope being processed to determine
* whether there is a downstream sibling to the current
* object. This function is used to determine what type of
* line drawing character to use when displaying namespace
* trees.
*
***************************************************************************/
BOOLEAN
AcpiNsExistDownstreamSibling (
ACPI_NAMED_OBJECT *NameDesc)
{
if (!NameDesc)
{
return (FALSE);
}
if (NameDesc->Name)
{
return (TRUE);
}
return (FALSE);
}
#endif /* ACPI_DEBUG */
/****************************************************************************
*
* FUNCTION: AcpiNsGetParentObject
*
* PARAMETERS: NameDesc - Current table entry
*
* RETURN: Parent entry of the given entry
*
* DESCRIPTION: Obtain the parent entry for a given entry in the namespace.
*
***************************************************************************/
ACPI_NAMED_OBJECT *
AcpiNsGetParentObject (
ACPI_NAMED_OBJECT *NameDesc)
{
/*
* Walk to the end of this peer list.
* The last entry is marked with a flag and the peer
* pointer is really a pointer back to the parent.
* This saves putting a parent back pointer in each and
* every named object!
*/
while (!(NameDesc->Flags & ANOBJ_END_OF_PEER_LIST))
{
NameDesc = NameDesc->Peer;
}
return (NameDesc->Peer);
}
/****************************************************************************
*
* FUNCTION: AcpiNsGetNextValidObject
*
* PARAMETERS: NameDesc - Current table entry
*
* RETURN: Next valid object in the table. NULL if no more valid
* objects
*
* DESCRIPTION: Find the next valid object within a name table.
* Useful for implementing NULL-end-of-list loops.
*
***************************************************************************/
ACPI_NAMED_OBJECT *
AcpiNsGetNextValidObject (
ACPI_NAMED_OBJECT *NameDesc)
{
/* If we are at the end of this peer list, return NULL */
if (NameDesc->Flags & ANOBJ_END_OF_PEER_LIST)
{
return NULL;
}
/* Otherwise just return the next peer */
return (NameDesc->Peer);
}

View File

@ -0,0 +1,385 @@
/******************************************************************************
*
* Module Name: nswalk - Functions for walking the APCI namespace
* $Revision: 1.15 $
*
*****************************************************************************/
/******************************************************************************
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, Intel Corp. All rights
* reserved.
*
* 2. License
*
* 2.1. This is your license from Intel Corp. under its intellectual property
* rights. You may have additional license terms from the party that provided
* you this software, covering your right to use that party's intellectual
* property rights.
*
* 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
* copy of the source code appearing in this file ("Covered Code") an
* irrevocable, perpetual, worldwide license under Intel's copyrights in the
* base code distributed originally by Intel ("Original Intel Code") to copy,
* make derivatives, distribute, use and display any portion of the Covered
* Code in any form, with the right to sublicense such rights; and
*
* 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
* license (with the right to sublicense), under only those claims of Intel
* patents that are infringed by the Original Intel Code, to make, use, sell,
* offer to sell, and import the Covered Code and derivative works thereof
* solely to the minimum extent necessary to exercise the above copyright
* license, and in no event shall the patent license extend to any additions
* to or modifications of the Original Intel Code. No other license or right
* is granted directly or by implication, estoppel or otherwise;
*
* The above copyright and patent license is granted only if the following
* conditions are met:
*
* 3. Conditions
*
* 3.1. Redistribution of Source with Rights to Further Distribute Source.
* Redistribution of source code of any substantial portion of the Covered
* Code or modification with rights to further distribute source must include
* the above Copyright Notice, the above License, this list of Conditions,
* and the following Disclaimer and Export Compliance provision. In addition,
* Licensee must cause all Covered Code to which Licensee contributes to
* contain a file documenting the changes Licensee made to create that Covered
* Code and the date of any change. Licensee must include in that file the
* documentation of any changes made by any predecessor Licensee. Licensee
* must include a prominent statement that the modification is derived,
* directly or indirectly, from Original Intel Code.
*
* 3.2. Redistribution of Source with no Rights to Further Distribute Source.
* Redistribution of source code of any substantial portion of the Covered
* Code or modification without rights to further distribute source must
* include the following Disclaimer and Export Compliance provision in the
* documentation and/or other materials provided with distribution. In
* addition, Licensee may not authorize further sublicense of source of any
* portion of the Covered Code, and must include terms to the effect that the
* license from Licensee to its licensee is limited to the intellectual
* property embodied in the software Licensee provides to its licensee, and
* not to intellectual property embodied in modifications its licensee may
* make.
*
* 3.3. Redistribution of Executable. Redistribution in executable form of any
* substantial portion of the Covered Code or modification must reproduce the
* above Copyright Notice, and the following Disclaimer and Export Compliance
* provision in the documentation and/or other materials provided with the
* distribution.
*
* 3.4. Intel retains all right, title, and interest in and to the Original
* Intel Code.
*
* 3.5. Neither the name Intel nor any other trademark owned or controlled by
* Intel shall be used in advertising or otherwise to promote the sale, use or
* other dealings in products derived from or relating to the Covered Code
* without prior written authorization from Intel.
*
* 4. Disclaimer and Export Compliance
*
* 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
* HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
* IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
* INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
* UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
* IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
* PARTICULAR PURPOSE.
*
* 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
* OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
* COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
* SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
* CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
* HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
* SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
* LIMITED REMEDY.
*
* 4.3. Licensee shall not export, either directly or indirectly, any of this
* software or system incorporating such software without first obtaining any
* required license or other approval from the U. S. Department of Commerce or
* any other agency or department of the United States Government. In the
* event Licensee exports any such software from the United States or
* re-exports any such software from a foreign destination, Licensee shall
* ensure that the distribution and export/re-export of the software is in
* compliance with all laws, regulations, orders, or other restrictions of the
* U.S. Export Administration Regulations. Licensee agrees that neither it nor
* any of its subsidiaries will export/re-export any technical data, process,
* software, or service, directly or indirectly, to any country for which the
* United States government or any agency thereof requires an export license,
* other governmental approval, or letter of assurance, without first obtaining
* such license, approval or letter.
*
*****************************************************************************/
#define __NSWALK_C__
#include "acpi.h"
#include "acinterp.h"
#include "acnamesp.h"
#define _COMPONENT NAMESPACE
MODULE_NAME ("nswalk");
/****************************************************************************
*
* FUNCTION: AcpiGetNextObject
*
* PARAMETERS: Type - Type of object to be searched for
* Parent - Parent object whose children we are
* getting
* LastChild - Previous child that was found.
* The NEXT child will be returned
*
* RETURN: ACPI_NAMED_OBJECT - Pointer to the NEXT child or NULL if
* none is found.
*
* DESCRIPTION: Return the next peer object within the namespace. If Handle
* is valid, Scope is ignored. Otherwise, the first object
* within Scope is returned.
*
****************************************************************************/
ACPI_NAMED_OBJECT*
AcpiNsGetNextObject (
OBJECT_TYPE_INTERNAL Type,
ACPI_NAMED_OBJECT *ParentDesc,
ACPI_NAMED_OBJECT *ChildDesc)
{
ACPI_NAMED_OBJECT *ThisDesc = NULL;
if (!ChildDesc)
{
/* It's really the parent's _scope_ that we want */
if (ParentDesc->Child)
{
ThisDesc = ParentDesc->Child;
}
}
else
{
/* Start search at the NEXT object */
ThisDesc = AcpiNsGetNextValidObject (ChildDesc);
}
/* If any type is OK, we are done */
if (Type == ACPI_TYPE_ANY)
{
/* ThisDesc is NULL if we are at the end-of-list */
return (ThisDesc);
}
/* Must search for the object -- but within this scope only */
while (ThisDesc)
{
/* If type matches, we are done */
if (ThisDesc->Type == Type)
{
return (ThisDesc);
}
/* Otherwise, move on to the next object */
ThisDesc = AcpiNsGetNextValidObject (ThisDesc);
}
/* Not found */
return (NULL);
}
/******************************************************************************
*
* FUNCTION: AcpiNsWalkNamespace
*
* PARAMETERS: Type - ACPI_OBJECT_TYPE to search for
* StartObject - Handle in namespace where search begins
* MaxDepth - Depth to which search is to reach
* UnlockBeforeCallback- Whether to unlock the NS before invoking
* the callback routine
* UserFunction - Called when an object of "Type" is found
* Context - Passed to user function
*
* RETURNS Return value from the UserFunction if terminated early.
* Otherwise, returns NULL.
*
* DESCRIPTION: Performs a modified depth-first walk of the namespace tree,
* starting (and ending) at the object specified by StartHandle.
* The UserFunction is called whenever an object that matches
* the type parameter is found. If the user function returns
* a non-zero value, the search is terminated immediately and this
* value is returned to the caller.
*
* The point of this procedure is to provide a generic namespace
* walk routine that can be called from multiple places to
* provide multiple services; the User Function can be tailored
* to each task, whether it is a print function, a compare
* function, etc.
*
******************************************************************************/
ACPI_STATUS
AcpiNsWalkNamespace (
OBJECT_TYPE_INTERNAL Type,
ACPI_HANDLE StartObject,
UINT32 MaxDepth,
BOOLEAN UnlockBeforeCallback,
WALK_CALLBACK UserFunction,
void *Context,
void **ReturnValue)
{
ACPI_STATUS Status;
ACPI_NAMED_OBJECT *ChildDesc;
ACPI_NAMED_OBJECT *ParentDesc;
OBJECT_TYPE_INTERNAL ChildType;
UINT32 Level;
FUNCTION_TRACE ("NsWalkNamespace");
/* Special case for the namespace root object */
if (StartObject == ACPI_ROOT_OBJECT)
{
StartObject = AcpiGbl_RootObject;
}
/* Null child means "get first object" */
ParentDesc = StartObject;
ChildDesc = 0;
ChildType = ACPI_TYPE_ANY;
Level = 1;
/*
* Traverse the tree of objects until we bubble back up to where we
* started. When Level is zero, the loop is done because we have
* bubbled up to (and passed) the original parent handle (StartEntry)
*/
while (Level > 0)
{
/*
* Get the next typed object in this scope. Null returned
* if not found
*/
Status = AE_OK;
ChildDesc = AcpiNsGetNextObject (ACPI_TYPE_ANY,
ParentDesc,
ChildDesc);
if (ChildDesc)
{
/*
* Found an object, Get the type if we are not
* searching for ANY
*/
if (Type != ACPI_TYPE_ANY)
{
ChildType = ChildDesc->Type;
}
if (ChildType == Type)
{
/*
* Found a matching object, invoke the user
* callback function
*/
if (UnlockBeforeCallback)
{
AcpiCmReleaseMutex (ACPI_MTX_NAMESPACE);
}
Status = UserFunction (ChildDesc, Level,
Context, ReturnValue);
if (UnlockBeforeCallback)
{
AcpiCmAcquireMutex (ACPI_MTX_NAMESPACE);
}
switch (Status)
{
case AE_OK:
case AE_CTRL_DEPTH:
/* Just keep going */
break;
case AE_CTRL_TERMINATE:
/* Exit now, with OK status */
return_ACPI_STATUS (AE_OK);
break;
default:
/* All others are valid exceptions */
return_ACPI_STATUS (Status);
break;
}
}
/*
* Depth first search:
* Attempt to go down another level in the namespace
* if we are allowed to. Don't go any further if we
* have reached the caller specified maximum depth
* or if the user function has specified that the
* maximum depth has been reached.
*/
if ((Level < MaxDepth) && (Status != AE_CTRL_DEPTH))
{
if (AcpiNsGetNextObject (ACPI_TYPE_ANY,
ChildDesc, 0))
{
/*
* There is at least one child of this
* object, visit the object
*/
Level++;
ParentDesc = ChildDesc;
ChildDesc = 0;
}
}
}
else
{
/*
* No more children in this object (AcpiNsGetNextObject
* failed), go back upwards in the namespace tree to
* the object's parent.
*/
Level--;
ChildDesc = ParentDesc;
ParentDesc = AcpiNsGetParentObject (ParentDesc);
}
}
/* Complete walk, not terminated by user function */
return_ACPI_STATUS (AE_OK);
}

View File

@ -0,0 +1,484 @@
/******************************************************************************
*
* Module Name: nsxfname - Public interfaces to the ACPI subsystem
* ACPI Namespace oriented interfaces
* $Revision: 1.61 $
*
*****************************************************************************/
/******************************************************************************
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, Intel Corp. All rights
* reserved.
*
* 2. License
*
* 2.1. This is your license from Intel Corp. under its intellectual property
* rights. You may have additional license terms from the party that provided
* you this software, covering your right to use that party's intellectual
* property rights.
*
* 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
* copy of the source code appearing in this file ("Covered Code") an
* irrevocable, perpetual, worldwide license under Intel's copyrights in the
* base code distributed originally by Intel ("Original Intel Code") to copy,
* make derivatives, distribute, use and display any portion of the Covered
* Code in any form, with the right to sublicense such rights; and
*
* 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
* license (with the right to sublicense), under only those claims of Intel
* patents that are infringed by the Original Intel Code, to make, use, sell,
* offer to sell, and import the Covered Code and derivative works thereof
* solely to the minimum extent necessary to exercise the above copyright
* license, and in no event shall the patent license extend to any additions
* to or modifications of the Original Intel Code. No other license or right
* is granted directly or by implication, estoppel or otherwise;
*
* The above copyright and patent license is granted only if the following
* conditions are met:
*
* 3. Conditions
*
* 3.1. Redistribution of Source with Rights to Further Distribute Source.
* Redistribution of source code of any substantial portion of the Covered
* Code or modification with rights to further distribute source must include
* the above Copyright Notice, the above License, this list of Conditions,
* and the following Disclaimer and Export Compliance provision. In addition,
* Licensee must cause all Covered Code to which Licensee contributes to
* contain a file documenting the changes Licensee made to create that Covered
* Code and the date of any change. Licensee must include in that file the
* documentation of any changes made by any predecessor Licensee. Licensee
* must include a prominent statement that the modification is derived,
* directly or indirectly, from Original Intel Code.
*
* 3.2. Redistribution of Source with no Rights to Further Distribute Source.
* Redistribution of source code of any substantial portion of the Covered
* Code or modification without rights to further distribute source must
* include the following Disclaimer and Export Compliance provision in the
* documentation and/or other materials provided with distribution. In
* addition, Licensee may not authorize further sublicense of source of any
* portion of the Covered Code, and must include terms to the effect that the
* license from Licensee to its licensee is limited to the intellectual
* property embodied in the software Licensee provides to its licensee, and
* not to intellectual property embodied in modifications its licensee may
* make.
*
* 3.3. Redistribution of Executable. Redistribution in executable form of any
* substantial portion of the Covered Code or modification must reproduce the
* above Copyright Notice, and the following Disclaimer and Export Compliance
* provision in the documentation and/or other materials provided with the
* distribution.
*
* 3.4. Intel retains all right, title, and interest in and to the Original
* Intel Code.
*
* 3.5. Neither the name Intel nor any other trademark owned or controlled by
* Intel shall be used in advertising or otherwise to promote the sale, use or
* other dealings in products derived from or relating to the Covered Code
* without prior written authorization from Intel.
*
* 4. Disclaimer and Export Compliance
*
* 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
* HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
* IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
* INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
* UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
* IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
* PARTICULAR PURPOSE.
*
* 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
* OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
* COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
* SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
* CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
* HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
* SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
* LIMITED REMEDY.
*
* 4.3. Licensee shall not export, either directly or indirectly, any of this
* software or system incorporating such software without first obtaining any
* required license or other approval from the U. S. Department of Commerce or
* any other agency or department of the United States Government. In the
* event Licensee exports any such software from the United States or
* re-exports any such software from a foreign destination, Licensee shall
* ensure that the distribution and export/re-export of the software is in
* compliance with all laws, regulations, orders, or other restrictions of the
* U.S. Export Administration Regulations. Licensee agrees that neither it nor
* any of its subsidiaries will export/re-export any technical data, process,
* software, or service, directly or indirectly, to any country for which the
* United States government or any agency thereof requires an export license,
* other governmental approval, or letter of assurance, without first obtaining
* such license, approval or letter.
*
*****************************************************************************/
#define __NSXFNAME_C__
#include "acpi.h"
#include "acinterp.h"
#include "acnamesp.h"
#include "amlcode.h"
#include "acparser.h"
#include "acdispat.h"
#include "acevents.h"
#define _COMPONENT NAMESPACE
MODULE_NAME ("nsxfname");
/******************************************************************************
*
* FUNCTION: AcpiLoadNamespace
*
* PARAMETERS: DisplayAmlDuringLoad
*
* RETURN: Status
*
* DESCRIPTION: Load the name space from what ever is pointed to by DSDT.
* (DSDT points to either the BIOS or a buffer.)
*
******************************************************************************/
ACPI_STATUS
AcpiLoadNamespace (
void)
{
ACPI_STATUS Status;
FUNCTION_TRACE ("AcpiLoadNameSpace");
/* There must be at least a DSDT installed */
if (AcpiGbl_DSDT == NULL)
{
DEBUG_PRINT (ACPI_ERROR, ("DSDT is not in memory\n"));
return_ACPI_STATUS (AE_NO_ACPI_TABLES);
}
/*
* Load the namespace. The DSDT is required,
* but the SSDT and PSDT tables are optional.
*/
Status = AcpiNsLoadTableByType (ACPI_TABLE_DSDT);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
/* Ignore exceptions from these */
AcpiNsLoadTableByType (ACPI_TABLE_SSDT);
AcpiNsLoadTableByType (ACPI_TABLE_PSDT);
DEBUG_PRINT_RAW (ACPI_OK,
("ACPI Namespace successfully loaded at root 0x%p\n",
AcpiGbl_RootObject));
/*
* Install the default OpRegion handlers, ignore the return
* code right now.
*/
AcpiEvInstallDefaultAddressSpaceHandlers ();
return_ACPI_STATUS (Status);
}
/****************************************************************************
*
* FUNCTION: AcpiGetHandle
*
* PARAMETERS: Parent - Object to search under (search scope).
* PathName - Pointer to an asciiz string containing the
* name
* RetHandle - Where the return handle is placed
*
* RETURN: Status
*
* DESCRIPTION: This routine will search for a caller specified name in the
* name space. The caller can restrict the search region by
* specifying a non NULL parent. The parent value is itself a
* namespace handle.
*
******************************************************************************/
ACPI_STATUS
AcpiGetHandle (
ACPI_HANDLE Parent,
ACPI_STRING Pathname,
ACPI_HANDLE *RetHandle)
{
ACPI_STATUS Status;
ACPI_NAMED_OBJECT *NameDesc;
ACPI_NAMED_OBJECT *Scope = NULL;
if (!RetHandle || !Pathname)
{
return (AE_BAD_PARAMETER);
}
if (Parent)
{
AcpiCmAcquireMutex (ACPI_MTX_NAMESPACE);
NameDesc = AcpiNsConvertHandleToEntry (Parent);
if (!NameDesc)
{
AcpiCmReleaseMutex (ACPI_MTX_NAMESPACE);
return (AE_BAD_PARAMETER);
}
Scope = NameDesc->Child;
AcpiCmReleaseMutex (ACPI_MTX_NAMESPACE);
}
/* Special case for root, since we can't search for it */
/* TBD: [Investigate] Check for both forward and backslash?? */
if (STRCMP (Pathname, NS_ROOT_PATH) == 0)
{
*RetHandle = AcpiNsConvertEntryToHandle (AcpiGbl_RootObject);
return (AE_OK);
}
/*
* Find the Named Object and convert to the user format
*/
NameDesc = NULL;
Status = AcpiNsGetNamedObject (Pathname, Scope, &NameDesc);
*RetHandle = NULL;
if(ACPI_SUCCESS(Status))
{
*RetHandle = AcpiNsConvertEntryToHandle (NameDesc);
}
return (Status);
}
/****************************************************************************
*
* FUNCTION: AcpiGetPathname
*
* PARAMETERS: Handle - Handle to be converted to a pathname
* NameType - Full pathname or single segment
* RetPathPtr - Buffer for returned path
*
* RETURN: Pointer to a string containing the fully qualified Name.
*
* DESCRIPTION: This routine returns the fully qualified name associated with
* the Handle parameter. This and the AcpiPathnameToHandle are
* complementary functions.
*
******************************************************************************/
ACPI_STATUS
AcpiGetName (
ACPI_HANDLE Handle,
UINT32 NameType,
ACPI_BUFFER *RetPathPtr)
{
ACPI_STATUS Status;
ACPI_NAMED_OBJECT *NameDesc;
/* Buffer pointer must be valid always */
if (!RetPathPtr || (NameType > ACPI_NAME_TYPE_MAX))
{
return (AE_BAD_PARAMETER);
}
/* Allow length to be zero and ignore the pointer */
if ((RetPathPtr->Length) &&
(!RetPathPtr->Pointer))
{
return (AE_BAD_PARAMETER);
}
if (NameType == ACPI_FULL_PATHNAME)
{
/* Get the full pathname (From the namespace root) */
Status = AcpiNsHandleToPathname (Handle, &RetPathPtr->Length,
RetPathPtr->Pointer);
return (Status);
}
/*
* Wants the single segment ACPI name.
* Validate handle and convert to an Named Object
*/
AcpiCmAcquireMutex (ACPI_MTX_NAMESPACE);
NameDesc = AcpiNsConvertHandleToEntry (Handle);
if (!NameDesc)
{
Status = AE_BAD_PARAMETER;
goto UnlockAndExit;
}
/* Check if name will fit in buffer */
if (RetPathPtr->Length < PATH_SEGMENT_LENGTH)
{
RetPathPtr->Length = PATH_SEGMENT_LENGTH;
Status = AE_BUFFER_OVERFLOW;
goto UnlockAndExit;
}
/* Just copy the ACPI name from the Named Object and zero terminate it */
STRNCPY (RetPathPtr->Pointer, (UINT8 *) &NameDesc->Name,
ACPI_NAME_SIZE);
((NATIVE_CHAR *) RetPathPtr->Pointer) [ACPI_NAME_SIZE] = 0;
Status = AE_OK;
UnlockAndExit:
AcpiCmReleaseMutex (ACPI_MTX_NAMESPACE);
return (Status);
}
/****************************************************************************
*
* FUNCTION: AcpiGetObjectInfo
*
* PARAMETERS: Handle - Object Handle
* Info - Where the info is returned
*
* RETURN: Status
*
* DESCRIPTION: Returns information about an object as gleaned from running
* several standard control methods.
*
******************************************************************************/
ACPI_STATUS
AcpiGetObjectInfo (
ACPI_HANDLE Device,
ACPI_DEVICE_INFO *Info)
{
DEVICE_ID Hid;
DEVICE_ID Uid;
ACPI_STATUS Status;
UINT32 DeviceStatus = 0;
UINT32 Address = 0;
ACPI_NAMED_OBJECT *DeviceDesc;
/* Parameter validation */
if (!Device || !Info)
{
return (AE_BAD_PARAMETER);
}
AcpiCmAcquireMutex (ACPI_MTX_NAMESPACE);
DeviceDesc = AcpiNsConvertHandleToEntry (Device);
if (!DeviceDesc)
{
AcpiCmReleaseMutex (ACPI_MTX_NAMESPACE);
return (AE_BAD_PARAMETER);
}
Info->Type = DeviceDesc->Type;
Info->Name = DeviceDesc->Name;
Info->Parent = AcpiNsConvertEntryToHandle (
AcpiNsGetParentObject (DeviceDesc));
AcpiCmReleaseMutex (ACPI_MTX_NAMESPACE);
/*
* If not a device, we are all done.
*/
if (Info->Type != ACPI_TYPE_DEVICE)
{
return (AE_OK);
}
/* Get extra info for ACPI devices */
Info->Valid = 0;
/* Execute the _HID method and save the result */
Status = AcpiCmExecute_HID (DeviceDesc, &Hid);
if (ACPI_SUCCESS (Status))
{
if (Hid.Type == STRING_PTR_DEVICE_ID)
{
STRCPY (Info->HardwareId, Hid.Data.StringPtr);
}
else
{
STRCPY (Info->HardwareId, Hid.Data.Buffer);
}
Info->Valid |= ACPI_VALID_HID;
}
/* Execute the _UID method and save the result */
Status = AcpiCmExecute_UID (DeviceDesc, &Uid);
if (ACPI_SUCCESS (Status))
{
if (Hid.Type == STRING_PTR_DEVICE_ID)
{
STRCPY (Info->UniqueId, Uid.Data.StringPtr);
}
else
{
STRCPY (Info->UniqueId, Uid.Data.Buffer);
}
Info->Valid |= ACPI_VALID_UID;
}
/*
* Execute the _STA method and save the result
* _STA is not always present
*/
Status = AcpiCmExecute_STA (DeviceDesc, &DeviceStatus);
if (ACPI_SUCCESS (Status))
{
Info->CurrentStatus = DeviceStatus;
Info->Valid |= ACPI_VALID_STA;
}
/*
* Execute the _ADR method and save result if successful
* _ADR is not always present
*/
Status = AcpiCmEvaluateNumericObject (METHOD_NAME__ADR,
DeviceDesc, &Address);
if (ACPI_SUCCESS (Status))
{
Info->Address = Address;
Info->Valid |= ACPI_VALID_ADR;
}
return (AE_OK);
}

View File

@ -0,0 +1,692 @@
/*******************************************************************************
*
* Module Name: nsxfobj - Public interfaces to the ACPI subsystem
* ACPI Object oriented interfaces
* $Revision: 1.63 $
*
******************************************************************************/
/******************************************************************************
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, Intel Corp. All rights
* reserved.
*
* 2. License
*
* 2.1. This is your license from Intel Corp. under its intellectual property
* rights. You may have additional license terms from the party that provided
* you this software, covering your right to use that party's intellectual
* property rights.
*
* 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
* copy of the source code appearing in this file ("Covered Code") an
* irrevocable, perpetual, worldwide license under Intel's copyrights in the
* base code distributed originally by Intel ("Original Intel Code") to copy,
* make derivatives, distribute, use and display any portion of the Covered
* Code in any form, with the right to sublicense such rights; and
*
* 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
* license (with the right to sublicense), under only those claims of Intel
* patents that are infringed by the Original Intel Code, to make, use, sell,
* offer to sell, and import the Covered Code and derivative works thereof
* solely to the minimum extent necessary to exercise the above copyright
* license, and in no event shall the patent license extend to any additions
* to or modifications of the Original Intel Code. No other license or right
* is granted directly or by implication, estoppel or otherwise;
*
* The above copyright and patent license is granted only if the following
* conditions are met:
*
* 3. Conditions
*
* 3.1. Redistribution of Source with Rights to Further Distribute Source.
* Redistribution of source code of any substantial portion of the Covered
* Code or modification with rights to further distribute source must include
* the above Copyright Notice, the above License, this list of Conditions,
* and the following Disclaimer and Export Compliance provision. In addition,
* Licensee must cause all Covered Code to which Licensee contributes to
* contain a file documenting the changes Licensee made to create that Covered
* Code and the date of any change. Licensee must include in that file the
* documentation of any changes made by any predecessor Licensee. Licensee
* must include a prominent statement that the modification is derived,
* directly or indirectly, from Original Intel Code.
*
* 3.2. Redistribution of Source with no Rights to Further Distribute Source.
* Redistribution of source code of any substantial portion of the Covered
* Code or modification without rights to further distribute source must
* include the following Disclaimer and Export Compliance provision in the
* documentation and/or other materials provided with distribution. In
* addition, Licensee may not authorize further sublicense of source of any
* portion of the Covered Code, and must include terms to the effect that the
* license from Licensee to its licensee is limited to the intellectual
* property embodied in the software Licensee provides to its licensee, and
* not to intellectual property embodied in modifications its licensee may
* make.
*
* 3.3. Redistribution of Executable. Redistribution in executable form of any
* substantial portion of the Covered Code or modification must reproduce the
* above Copyright Notice, and the following Disclaimer and Export Compliance
* provision in the documentation and/or other materials provided with the
* distribution.
*
* 3.4. Intel retains all right, title, and interest in and to the Original
* Intel Code.
*
* 3.5. Neither the name Intel nor any other trademark owned or controlled by
* Intel shall be used in advertising or otherwise to promote the sale, use or
* other dealings in products derived from or relating to the Covered Code
* without prior written authorization from Intel.
*
* 4. Disclaimer and Export Compliance
*
* 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
* HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
* IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
* INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
* UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
* IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
* PARTICULAR PURPOSE.
*
* 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
* OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
* COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
* SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
* CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
* HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
* SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
* LIMITED REMEDY.
*
* 4.3. Licensee shall not export, either directly or indirectly, any of this
* software or system incorporating such software without first obtaining any
* required license or other approval from the U. S. Department of Commerce or
* any other agency or department of the United States Government. In the
* event Licensee exports any such software from the United States or
* re-exports any such software from a foreign destination, Licensee shall
* ensure that the distribution and export/re-export of the software is in
* compliance with all laws, regulations, orders, or other restrictions of the
* U.S. Export Administration Regulations. Licensee agrees that neither it nor
* any of its subsidiaries will export/re-export any technical data, process,
* software, or service, directly or indirectly, to any country for which the
* United States government or any agency thereof requires an export license,
* other governmental approval, or letter of assurance, without first obtaining
* such license, approval or letter.
*
*****************************************************************************/
#define __NSXFOBJ_C__
#include "acpi.h"
#include "acinterp.h"
#include "acnamesp.h"
#define _COMPONENT NAMESPACE
MODULE_NAME ("nsxfobj");
/*******************************************************************************
*
* FUNCTION: AcpiEvaluateObject
*
* PARAMETERS: Handle - Object handle (optional)
* *Pathname - Object pathname (optional)
* **Params - List of parameters to pass to
* method, terminated by NULL.
* Params itself may be NULL
* if no parameters are being
* passed.
* *ReturnObject - Where to put method's return value (if
* any). If NULL, no value is returned.
*
* RETURN: Status
*
* DESCRIPTION: Find and evaluate the given object, passing the given
* parameters if necessary. One of "Handle" or "Pathname" must
* be valid (non-null)
*
******************************************************************************/
ACPI_STATUS
AcpiEvaluateObject (
ACPI_HANDLE Handle,
ACPI_STRING Pathname,
ACPI_OBJECT_LIST *ParamObjects,
ACPI_BUFFER *ReturnBuffer)
{
ACPI_STATUS Status;
ACPI_OBJECT_INTERNAL **ParamPtr = NULL;
ACPI_OBJECT_INTERNAL *ReturnObj = NULL;
ACPI_OBJECT_INTERNAL *ObjectPtr = NULL;
UINT32 BufferSpaceNeeded;
UINT32 UserBufferLength;
UINT32 Count;
UINT32 i;
UINT32 ParamLength;
UINT32 ObjectLength;
FUNCTION_TRACE ("AcpiEvaluateObject");
/*
* If there are parameters to be passed to the object
* (which must be a control method), the external objects
* must be converted to internal objects
*/
if (ParamObjects && ParamObjects->Count)
{
/*
* Allocate a new parameter block for the internal objects
* Add 1 to count to allow for null terminated internal list
*/
Count = ParamObjects->Count;
ParamLength = (Count + 1) * sizeof (void *);
ObjectLength = Count * sizeof (ACPI_OBJECT_INTERNAL);
ParamPtr = AcpiCmCallocate (ParamLength + /* Parameter List part */
ObjectLength); /* Actual objects */
if (!ParamPtr)
{
return_ACPI_STATUS (AE_NO_MEMORY);
}
ObjectPtr = (ACPI_OBJECT_INTERNAL *) ((UINT8 *) ParamPtr +
ParamLength);
/*
* Init the param array of pointers and NULL terminate
* the list
*/
for (i = 0; i < Count; i++)
{
ParamPtr[i] = &ObjectPtr[i];
AcpiCmInitStaticObject (&ObjectPtr[i]);
}
ParamPtr[Count] = NULL;
/*
* Convert each external object in the list to an
* internal object
*/
for (i = 0; i < Count; i++)
{
Status =
AcpiCmBuildInternalObject (&ParamObjects->Pointer[i],
ParamPtr[i]);
if (ACPI_FAILURE (Status))
{
AcpiCmDeleteInternalObjectList (ParamPtr);
return_ACPI_STATUS (Status);
}
}
}
/*
* Three major cases:
* 1) Fully qualified pathname
* 2) No handle, not fully qualified pathname (error)
* 3) Valid handle
*/
if ((Pathname) &&
(AcpiNsValidRootPrefix (Pathname[0])))
{
/*
* The path is fully qualified, just evaluate by name
*/
Status = AcpiNsEvaluateByName (Pathname, ParamPtr, &ReturnObj);
}
else if (!Handle)
{
/*
* A handle is optional iff a fully qualified pathname
* is specified. Since we've already handled fully
* qualified names above, this is an error
*/
if (!Pathname)
{
DEBUG_PRINT (ACPI_ERROR,
("AcpiEvaluateObject: Both Handle and Pathname are NULL\n"));
}
else
{
DEBUG_PRINT (ACPI_ERROR,
("AcpiEvaluateObject: Handle is NULL and Pathname is relative\n"));
}
Status = AE_BAD_PARAMETER;
}
else
{
/*
* We get here if we have a handle -- and if we have a
* pathname it is relative. The handle will be validated
* in the lower procedures
*/
if (!Pathname)
{
/*
* The null pathname case means the handle is for
* the actual object to be evaluated
*/
Status = AcpiNsEvaluateByHandle (Handle, ParamPtr, &ReturnObj);
}
else
{
/*
* Both a Handle and a relative Pathname
*/
Status = AcpiNsEvaluateRelative (Handle, Pathname, ParamPtr,
&ReturnObj);
}
}
/*
* If we are expecting a return value, and all went well above,
* copy the return value to an external object.
*/
if (ReturnBuffer)
{
UserBufferLength = ReturnBuffer->Length;
ReturnBuffer->Length = 0;
if (ReturnObj)
{
if (VALID_DESCRIPTOR_TYPE (ReturnObj, ACPI_DESC_TYPE_NAMED))
{
/*
* If we got an Named Object as a return object,
* this means the object we are evaluating
* has nothing interesting to return (such
* as a mutex, etc.) We return an error
* because these types are essentially
* unsupported by this interface. We
* don't check up front because this makes
* it easier to add support for various
* types at a later date if necessary.
*/
Status = AE_TYPE;
ReturnObj = NULL; /* No need to delete an Named Object */
}
if (ACPI_SUCCESS (Status))
{
/*
* Find out how large a buffer is needed
* to contain the returned object
*/
Status = AcpiCmGetObjectSize (ReturnObj,
&BufferSpaceNeeded);
if (ACPI_SUCCESS (Status))
{
/*
* Check if there is enough room in the
* caller's buffer
*/
if (UserBufferLength < BufferSpaceNeeded)
{
/*
* Caller's buffer is too small, can't
* give him partial results fail the call
* but return the buffer size needed
*/
DEBUG_PRINT (ACPI_ERROR,
("AcpiEvaluateObject: Needed buffer size %d, received %d\n",
BufferSpaceNeeded, UserBufferLength));
ReturnBuffer->Length = BufferSpaceNeeded;
Status = AE_BUFFER_OVERFLOW;
}
else
{
/*
* We have enough space for the object, build it
*/
Status = AcpiCmBuildExternalObject (ReturnObj,
ReturnBuffer);
ReturnBuffer->Length = BufferSpaceNeeded;
}
}
}
}
}
/* Delete the return and parameter objects */
if (ReturnObj)
{
/*
* Delete the internal return object. (Or at least
* decrement the reference count by one)
*/
AcpiCmRemoveReference (ReturnObj);
}
/*
* Free the input parameter list (if we created one),
*/
if (ParamPtr)
{
/* Free the allocated parameter block */
AcpiCmDeleteInternalObjectList (ParamPtr);
}
return_ACPI_STATUS (Status);
}
/*******************************************************************************
*
* FUNCTION: AcpiGetNextObject
*
* PARAMETERS: Type - Type of object to be searched for
* Parent - Parent object whose children we are getting
* LastChild - Previous child that was found.
* The NEXT child will be returned
* RetHandle - Where handle to the next object is placed
*
* RETURN: Status
*
* DESCRIPTION: Return the next peer object within the namespace. If Handle is
* valid, Scope is ignored. Otherwise, the first object within
* Scope is returned.
*
******************************************************************************/
ACPI_STATUS
AcpiGetNextObject (
ACPI_OBJECT_TYPE Type,
ACPI_HANDLE Parent,
ACPI_HANDLE Child,
ACPI_HANDLE *RetHandle)
{
ACPI_STATUS Status = AE_OK;
ACPI_NAMED_OBJECT *NameDesc;
ACPI_NAMED_OBJECT *ParentDesc = NULL;
ACPI_NAMED_OBJECT *ChildDesc = NULL;
/* Parameter validation */
if (Type > ACPI_TYPE_MAX)
{
return (AE_BAD_PARAMETER);
}
AcpiCmAcquireMutex (ACPI_MTX_NAMESPACE);
/* If null handle, use the parent */
if (!Child)
{
/* Start search at the beginning of the specified scope */
ParentDesc = AcpiNsConvertHandleToEntry (Parent);
if (!ParentDesc)
{
Status = AE_BAD_PARAMETER;
goto UnlockAndExit;
}
}
/* Non-null handle, ignore the parent */
else
{
/* Convert and validate the handle */
ChildDesc = AcpiNsConvertHandleToEntry (Child);
if (!ChildDesc)
{
Status = AE_BAD_PARAMETER;
goto UnlockAndExit;
}
}
/* Internal function does the real work */
NameDesc = AcpiNsGetNextObject ((OBJECT_TYPE_INTERNAL) Type,
ParentDesc, ChildDesc);
if (!NameDesc)
{
Status = AE_NOT_FOUND;
goto UnlockAndExit;
}
if (RetHandle)
{
*RetHandle = AcpiNsConvertEntryToHandle (NameDesc);
}
UnlockAndExit:
AcpiCmReleaseMutex (ACPI_MTX_NAMESPACE);
return (Status);
}
/*******************************************************************************
*
* FUNCTION: AcpiGetType
*
* PARAMETERS: Handle - Handle of object whose type is desired
* *RetType - Where the type will be placed
*
* RETURN: Status
*
* DESCRIPTION: This routine returns the type associatd with a particular handle
*
******************************************************************************/
ACPI_STATUS
AcpiGetType (
ACPI_HANDLE Handle,
ACPI_OBJECT_TYPE *RetType)
{
ACPI_NAMED_OBJECT *NameDesc;
/* Parameter Validation */
if (!RetType)
{
return (AE_BAD_PARAMETER);
}
/*
* Special case for the predefined Root Object
* (return type ANY)
*/
if (Handle == ACPI_ROOT_OBJECT)
{
*RetType = ACPI_TYPE_ANY;
return (AE_OK);
}
AcpiCmAcquireMutex (ACPI_MTX_NAMESPACE);
/* Convert and validate the handle */
NameDesc = AcpiNsConvertHandleToEntry (Handle);
if (!NameDesc)
{
AcpiCmReleaseMutex (ACPI_MTX_NAMESPACE);
return (AE_BAD_PARAMETER);
}
*RetType = NameDesc->Type;
AcpiCmReleaseMutex (ACPI_MTX_NAMESPACE);
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: AcpiGetParent
*
* PARAMETERS: Handle - Handle of object whose parent is desired
* RetHandle - Where the parent handle will be placed
*
* RETURN: Status
*
* DESCRIPTION: Returns a handle to the parent of the object represented by
* Handle.
*
******************************************************************************/
ACPI_STATUS
AcpiGetParent (
ACPI_HANDLE Handle,
ACPI_HANDLE *RetHandle)
{
ACPI_NAMED_OBJECT *NameDesc;
ACPI_STATUS Status = AE_OK;
/* No trace macro, too verbose */
if (!RetHandle)
{
return (AE_BAD_PARAMETER);
}
/* Special case for the predefined Root Object (no parent) */
if (Handle == ACPI_ROOT_OBJECT)
{
return (AE_NULL_ENTRY);
}
AcpiCmAcquireMutex (ACPI_MTX_NAMESPACE);
/* Convert and validate the handle */
NameDesc = AcpiNsConvertHandleToEntry (Handle);
if (!NameDesc)
{
Status = AE_BAD_PARAMETER;
goto UnlockAndExit;
}
/* Get the parent entry */
*RetHandle =
AcpiNsConvertEntryToHandle (AcpiNsGetParentObject (NameDesc));
/* Return exeption if parent is null */
if (!AcpiNsGetParentObject (NameDesc))
{
Status = AE_NULL_ENTRY;
}
UnlockAndExit:
AcpiCmReleaseMutex (ACPI_MTX_NAMESPACE);
return (Status);
}
/*******************************************************************************
*
* FUNCTION: AcpiWalkNamespace
*
* PARAMETERS: Type - ACPI_OBJECT_TYPE to search for
* StartObject - Handle in namespace where search begins
* MaxDepth - Depth to which search is to reach
* UserFunction - Called when an object of "Type" is found
* Context - Passed to user function
*
* RETURNS Return value from the UserFunction if terminated early.
* Otherwise, returns NULL.
*
* DESCRIPTION: Performs a modified depth-first walk of the namespace tree,
* starting (and ending) at the object specified by StartHandle.
* The UserFunction is called whenever an object that matches
* the type parameter is found. If the user function returns
* a non-zero value, the search is terminated immediately and this
* value is returned to the caller.
*
* The point of this procedure is to provide a generic namespace
* walk routine that can be called from multiple places to
* provide multiple services; the User Function can be tailored
* to each task, whether it is a print function, a compare
* function, etc.
*
******************************************************************************/
ACPI_STATUS
AcpiWalkNamespace (
ACPI_OBJECT_TYPE Type,
ACPI_HANDLE StartObject,
UINT32 MaxDepth,
WALK_CALLBACK UserFunction,
void *Context,
void **ReturnValue)
{
ACPI_STATUS Status;
FUNCTION_TRACE ("AcpiWalkNamespace");
/* Parameter validation */
if ((Type > ACPI_TYPE_MAX) ||
(!MaxDepth) ||
(!UserFunction))
{
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
/*
* Lock the namespace around the walk.
* The namespace will be unlocked/locked around each call
* to the user function - since this function
* must be allowed to make Acpi calls itself.
*/
AcpiCmAcquireMutex (ACPI_MTX_NAMESPACE);
Status = AcpiNsWalkNamespace ((OBJECT_TYPE_INTERNAL) Type,
StartObject, MaxDepth,
NS_WALK_UNLOCK,
UserFunction, Context,
ReturnValue);
AcpiCmReleaseMutex (ACPI_MTX_NAMESPACE);
return_ACPI_STATUS (Status);
}

View File

@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: pswalk - Parser routines to walk parsed op tree(s)
* $Revision: 1.42 $
* $Revision: 1.43 $
*
*****************************************************************************/
@ -567,7 +567,7 @@ AcpiPsWalkParsedAml (
ACPI_GENERIC_OP *StartOp,
ACPI_GENERIC_OP *EndOp,
ACPI_OBJECT_INTERNAL *MthDesc,
ACPI_NAME_TABLE *StartScope,
ACPI_NAMED_OBJECT *StartScope,
ACPI_OBJECT_INTERNAL **Params,
ACPI_OBJECT_INTERNAL **CallerReturnDesc,
ACPI_OWNER_ID OwnerId,

View File

@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: psxface - Parser external interfaces
* $Revision: 1.33 $
* $Revision: 1.34 $
*
*****************************************************************************/
@ -147,7 +147,7 @@
ACPI_STATUS
AcpiPsxExecute (
ACPI_NAMED_OBJECT *MethodEntry,
ACPI_NAMED_OBJECT *MethodNameDesc,
ACPI_OBJECT_INTERNAL **Params,
ACPI_OBJECT_INTERNAL **ReturnObjDesc)
{
@ -160,14 +160,14 @@ AcpiPsxExecute (
FUNCTION_TRACE ("PsxExecute");
/* Validate the NTE and get the attached object */
/* Validate the Named Object and get the attached object */
if (!MethodEntry)
if (!MethodNameDesc)
{
return_ACPI_STATUS (AE_NULL_ENTRY);
}
ObjDesc = AcpiNsGetAttachedObject (MethodEntry);
ObjDesc = AcpiNsGetAttachedObject (MethodNameDesc);
if (!ObjDesc)
{
return_ACPI_STATUS (AE_NULL_OBJECT);
@ -175,7 +175,7 @@ AcpiPsxExecute (
/* Init for new method, wait on concurrency semaphore */
Status = AcpiDsBeginMethodExecution (MethodEntry, ObjDesc);
Status = AcpiDsBeginMethodExecution (MethodNameDesc, ObjDesc);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@ -201,7 +201,7 @@ AcpiPsxExecute (
DEBUG_PRINT (ACPI_INFO,
("PsxExecute: **** Begin Method Execution **** Entry=%p obj=%p\n",
MethodEntry, ObjDesc));
MethodNameDesc, ObjDesc));
/* Create and init a root object */
@ -214,7 +214,7 @@ AcpiPsxExecute (
Status = AcpiPsParseAml (Op, ObjDesc->Method.Pcode,
ObjDesc->Method.PcodeLength,
ACPI_PARSE_LOAD_PASS1 | ACPI_PARSE_DELETE_TREE,
MethodEntry, Params, ReturnObjDesc,
MethodNameDesc, Params, ReturnObjDesc,
AcpiDsLoad1BeginOp, AcpiDsLoad1EndOp);
AcpiPsDeleteParseTree (Op);
@ -232,7 +232,7 @@ AcpiPsxExecute (
Status = AcpiPsParseAml (Op, ObjDesc->Method.Pcode,
ObjDesc->Method.PcodeLength,
ACPI_PARSE_EXECUTE | ACPI_PARSE_DELETE_TREE,
MethodEntry, Params, ReturnObjDesc,
MethodNameDesc, Params, ReturnObjDesc,
AcpiDsExecBeginOp, AcpiDsExecEndOp);
AcpiPsDeleteParseTree (Op);