FreeBSD/sys/contrib/dev/acpica/components/executer/exstore.c
/*******************************************************************************
 *
 * FUNCTION:    AcpiExStore
 *
 * PARAMETERS:  *SourceDesc         - Value to be stored
 *              *DestDesc           - Where to store it. Must be an NS node
 *                                    or ACPI_OPERAND_OBJECT of type
 *                                    Reference;
 *              WalkState           - Current walk state
 *
 * RETURN:      Status
 *
 * DESCRIPTION: Store the value described by SourceDesc into the location
 *              described by DestDesc. Called by various interpreter
 *              functions to store the result of an operation into
 *              the destination operand -- not just simply the actual "Store"
 *              ASL operator.
 *
 ******************************************************************************/
AcpiExStore
PARAMETERS:  *SourceDesc         - Value to be stored
*DestDesc           - Where to store it. Must be an NS node
or ACPI_OPERAND_OBJECT of type
Reference;
WalkState           - Current walk state

Status

Store the value described by SourceDesc into the location
described by DestDesc. Called by various interpreter
functions to store the result of an operation into
the destination operand -- not just simply the actual "Store"
ASL operator.
AcpiExStore PARAMETERS : * SourceDesc - Value to be stored * DestDesc - Where to store it . Must be an NS node or ACPI_OPERAND_OBJECT of type Reference ; WalkState - Current walk state Status Store the value described by SourceDesc into the location described by DestDesc . Called by various interpreter functions to store the result of an operation into the destination operand -- not just simply the actual " Store " ASL operator .
ACPI_STATUS
AcpiExStore (
    ACPI_OPERAND_OBJECT     *SourceDesc,
    ACPI_OPERAND_OBJECT     *DestDesc,
    ACPI_WALK_STATE         *WalkState)
{
    ACPI_STATUS             Status = AE_OK;
    ACPI_OPERAND_OBJECT     *RefDesc = DestDesc;
    ACPI_FUNCTION_TRACE_PTR (ExStore, DestDesc);
    if (!SourceDesc || !DestDesc)
    {
        ACPI_ERROR ((AE_INFO, "Null parameter"));
        return_ACPI_STATUS (AE_AML_NO_OPERAND);
    }
    if (ACPI_GET_DESCRIPTOR_TYPE (DestDesc) == ACPI_DESC_TYPE_NAMED)
    {
        Status = AcpiExStoreObjectToNode (SourceDesc,
            (ACPI_NAMESPACE_NODE *) DestDesc, WalkState,
            ACPI_IMPLICIT_CONVERSION);
        return_ACPI_STATUS (Status);
    }
    switch (DestDesc->Common.Type)
    {
    case ACPI_TYPE_LOCAL_REFERENCE:
        break;
    case ACPI_TYPE_INTEGER:
        if (DestDesc->Common.Flags & AOPOBJ_AML_CONSTANT)
        {
            return_ACPI_STATUS (AE_OK);
        }
    default:
        ACPI_ERROR ((AE_INFO,
            "Target is not a Reference or Constant object - [%s] %p",
            AcpiUtGetObjectTypeName (DestDesc), DestDesc));
        return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
    }
    switch (RefDesc->Reference.Class)
    {
    case ACPI_REFCLASS_REFOF:
        Status = AcpiExStoreObjectToNode (SourceDesc,
            RefDesc->Reference.Object,
            WalkState, ACPI_IMPLICIT_CONVERSION);
        break;
    case ACPI_REFCLASS_INDEX:
        Status = AcpiExStoreObjectToIndex (SourceDesc, RefDesc, WalkState);
        break;
    case ACPI_REFCLASS_LOCAL:
    case ACPI_REFCLASS_ARG:
        Status = AcpiDsStoreObjectToLocal (RefDesc->Reference.Class,
            RefDesc->Reference.Value, SourceDesc, WalkState);
        break;
    case ACPI_REFCLASS_DEBUG:
        ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
            "**** Write to Debug Object: Object %p [%s] ****:\n\n",
            SourceDesc, AcpiUtGetObjectTypeName (SourceDesc)));
        ACPI_DEBUG_OBJECT (SourceDesc, 0, 0);
        break;
    default:
        ACPI_ERROR ((AE_INFO, "Unknown Reference Class 0x%2.2X",
            RefDesc->Reference.Class));
        ACPI_DUMP_ENTRY (RefDesc, ACPI_LV_INFO);
        Status = AE_AML_INTERNAL;
        break;
    }
    return_ACPI_STATUS (Status);
}
ACPI_STATUS AcpiExStore ( ACPI_OPERAND_OBJECT * SourceDesc , ACPI_OPERAND_OBJECT * DestDesc , ACPI_WALK_STATE * WalkState ) { ACPI_STATUS Status = AE_OK ; ACPI_OPERAND_OBJECT * RefDesc = DestDesc ; ACPI_FUNCTION_TRACE_PTR ( ExStore , DestDesc ) ; if ( ! SourceDesc || ! DestDesc ) { ACPI_ERROR ( ( AE_INFO , " " ) ) ; return_ACPI_STATUS ( AE_AML_NO_OPERAND ) ; } if ( ACPI_GET_DESCRIPTOR_TYPE ( DestDesc ) == ACPI_DESC_TYPE_NAMED ) { Status = AcpiExStoreObjectToNode ( SourceDesc , ( ACPI_NAMESPACE_NODE * ) DestDesc , WalkState , ACPI_IMPLICIT_CONVERSION ) ; return_ACPI_STATUS ( Status ) ; } switch ( DestDesc -> Common . Type ) { case ACPI_TYPE_LOCAL_REFERENCE : break ; case ACPI_TYPE_INTEGER : if ( DestDesc -> Common . Flags & AOPOBJ_AML_CONSTANT ) { return_ACPI_STATUS ( AE_OK ) ; } default : ACPI_ERROR ( ( AE_INFO , " " , AcpiUtGetObjectTypeName ( DestDesc ) , DestDesc ) ) ; return_ACPI_STATUS ( AE_AML_OPERAND_TYPE ) ; } switch ( RefDesc -> Reference . Class ) { case ACPI_REFCLASS_REFOF : Status = AcpiExStoreObjectToNode ( SourceDesc , RefDesc -> Reference . Object , WalkState , ACPI_IMPLICIT_CONVERSION ) ; break ; case ACPI_REFCLASS_INDEX : Status = AcpiExStoreObjectToIndex ( SourceDesc , RefDesc , WalkState ) ; break ; case ACPI_REFCLASS_LOCAL : case ACPI_REFCLASS_ARG : Status = AcpiDsStoreObjectToLocal ( RefDesc -> Reference . Class , RefDesc -> Reference . Value , SourceDesc , WalkState ) ; break ; case ACPI_REFCLASS_DEBUG : ACPI_DEBUG_PRINT ( ( ACPI_DB_EXEC , " \n \n " , SourceDesc , AcpiUtGetObjectTypeName ( SourceDesc ) ) ) ; ACPI_DEBUG_OBJECT ( SourceDesc , 0 , 0 ) ; break ; default : ACPI_ERROR ( ( AE_INFO , " " , RefDesc -> Reference . Class ) ) ; ACPI_DUMP_ENTRY ( RefDesc , ACPI_LV_INFO ) ; Status = AE_AML_INTERNAL ; break ; } return_ACPI_STATUS ( Status ) ; }
FUNCTION:    AcpiExStore
 PARAMETERS:  *SourceDesc         - Value to be stored
              *DestDesc           - Where to store it.
FUNCTION : AcpiExStore PARAMETERS : * SourceDesc - Value to be stored * DestDesc - Where to store it .
/* Validate parameters */ /* DestDesc can be either a namespace node or an ACPI object */ /*
         * Dest is a namespace node,
         * Storing an object into a Named node.
         */ /* Destination object must be a Reference or a Constant object */ /* Allow stores to Constants -- a Noop as per ACPI spec */ /*lint -fallthrough */ /* Destination is not a Reference object */ /*
     * Examine the Reference class. These cases are handled:
     *
     * 1) Store to Name (Change the object associated with a name)
     * 2) Store to an indexed area of a Buffer or Package
     * 3) Store to a Method Local or Arg
     * 4) Store to the debug object
     */ /* Storing an object into a Name "container" */ /* Storing to an Index (pointer into a packager or buffer) */ /* Store to a method local/arg  */ /*
         * Storing to the Debug object causes the value stored to be
         * displayed and otherwise has no effect -- see ACPI Specification
         */