nsobject.c revision 199767f8919635c4928607450d9e0abb932109ce
/*******************************************************************************
*
* Module Name: nsobject - Utilities for objects attached to namespace
* table entries
*
******************************************************************************/
/*
* Copyright (C) 2000 - 2015, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions, and the following disclaimer,
* without modification.
* 2. Redistributions in binary form must reproduce at minimum a disclaimer
* substantially similar to the "NO WARRANTY" disclaimer below
* ("Disclaimer") and any redistribution must be conditioned upon
* including a substantially similar Disclaimer requirement for further
* binary redistribution.
* 3. Neither the names of the above-listed copyright holders nor the names
* of any contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* Alternatively, this software may be distributed under the terms of the
* GNU General Public License ("GPL") version 2 as published by the Free
* Software Foundation.
*
* NO WARRANTY
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES.
*/
#define _COMPONENT ACPI_NAMESPACE
ACPI_MODULE_NAME ("nsobject")
/*******************************************************************************
*
* FUNCTION: AcpiNsAttachObject
*
* PARAMETERS: Node - Parent Node
* Object - Object to be attached
* Type - Type of object, or ACPI_TYPE_ANY if not
* known
*
* RETURN: Status
*
* 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.
* Note: Future may require that the Node->Flags field be passed
* as a parameter.
*
* MUTEX: Assumes namespace is locked
*
******************************************************************************/
{
/*
* Parameter validation
*/
if (!Node)
{
/* Invalid handle */
}
{
/* Null object */
"Null object, but type not ACPI_TYPE_ANY"));
}
{
/* Not a name handle */
}
/* Check if this object is already attached */
{
"Obj %p already installed in NameObj %p\n",
}
/* If null object, we will just install it */
if (!Object)
{
}
/*
* If the source object is a namespace Node with an attached object,
* we will use that (attached) object
*/
{
/*
* Value passed is a name handle and that name has a
* non-null value. Use that name's value and type.
*/
}
/*
* Otherwise, we will use the parameter object, but we must type
* it first
*/
else
{
/* Use the given type */
ObjectType = Type;
}
/* Detach an existing attached object if present */
{
}
if (ObjDesc)
{
/*
* Must increment the new value's reference count
* (if it is an internal object)
*/
/*
* Handle objects with multiple descriptors - walk
* to the end of the descriptor list
*/
{
}
/* Install the object at the front of the object list */
}
}
/*******************************************************************************
*
* FUNCTION: AcpiNsDetachObject
*
* PARAMETERS: Node - A Namespace node whose object will be detached
*
* RETURN: None.
*
* if the object is an allocated object, it is freed.
* Otherwise, the field is simply cleared.
*
******************************************************************************/
void
{
if (!ObjDesc ||
{
}
{
/* Free the dynamic aml buffer */
{
}
}
/* Clear the Node entry in all cases */
{
/* Unlink object from front of possible object list */
/* Handle possible 2-descriptor object */
{
}
/*
* Detach the object from any data objects (which are still held by
* the namespace node)
*/
{
}
}
/* Reset the node type to untyped */
/* Remove one reference on the object (and all subobjects) */
}
/*******************************************************************************
*
* FUNCTION: AcpiNsGetAttachedObject
*
* PARAMETERS: Node - Namespace node
*
* RETURN: Current value of the object field from the Node whose
* handle is passed
*
* DESCRIPTION: Obtain the object attached to a namespace node.
*
******************************************************************************/
{
if (!Node)
{
return_PTR (NULL);
}
{
return_PTR (NULL);
}
}
/*******************************************************************************
*
* FUNCTION: AcpiNsGetSecondaryObject
*
* PARAMETERS: Node - Namespace node
*
* RETURN: Current value of the object field from the Node whose
* handle is passed.
*
* DESCRIPTION: Obtain a secondary object associated with a namespace node.
*
******************************************************************************/
{
if ((!ObjDesc) ||
{
return_PTR (NULL);
}
}
/*******************************************************************************
*
* FUNCTION: AcpiNsAttachData
*
* PARAMETERS: Node - Namespace node
* Handler - Handler to be associated with the data
* Data - Data to be attached
*
* RETURN: Status
*
* DESCRIPTION: Low-level attach data. Create and attach a Data object.
*
******************************************************************************/
void *Data)
{
/* We only allow one attachment per handler */
PrevObjDesc = NULL;
while (ObjDesc)
{
{
return (AE_ALREADY_EXISTS);
}
}
/* Create an internal object for the data */
if (!DataDesc)
{
return (AE_NO_MEMORY);
}
/* Install the data object */
if (PrevObjDesc)
{
}
else
{
}
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: AcpiNsDetachData
*
* PARAMETERS: Node - Namespace node
* Handler - Handler associated with the data
*
* RETURN: Status
*
* DESCRIPTION: Low-level detach data. Delete the data node, but the caller
* is responsible for the actual data.
*
******************************************************************************/
{
PrevObjDesc = NULL;
while (ObjDesc)
{
{
if (PrevObjDesc)
{
}
else
{
}
return (AE_OK);
}
}
return (AE_NOT_FOUND);
}
/*******************************************************************************
*
* FUNCTION: AcpiNsGetAttachedData
*
* PARAMETERS: Node - Namespace node
* Handler - Handler associated with the data
* Data - Where the data is returned
*
* RETURN: Status
*
* DESCRIPTION: Low level interface to obtain data previously associated with
* a namespace node.
*
******************************************************************************/
void **Data)
{
while (ObjDesc)
{
{
return (AE_OK);
}
}
return (AE_NOT_FOUND);
}