FreeBSD/sys/contrib/dev/acpica/components/executer/exstoren.c
/*******************************************************************************
 *
 * FUNCTION:    AcpiExStoreObjectToObject
 *
 * PARAMETERS:  SourceDesc          - Object to store
 *              DestDesc            - Object to receive a copy of the source
 *              NewDesc             - New object if DestDesc is obsoleted
 *              WalkState           - Current walk state
 *
 * RETURN:      Status
 *
 * DESCRIPTION: "Store" an object to another object. This may include
 *              converting the source type to the target type (implicit
 *              conversion), and a copy of the value of the source to
 *              the target.
 *
 *              The Assignment of an object to another (not named) object
 *              is handled here.
 *              The Source passed in will replace the current value (if any)
 *              with the input value.
 *
 *              When storing into an object the data is converted to the
 *              target object type then stored in the object. This means
 *              that the target object type (for an initialized target) will
 *              not be changed by a store operation.
 *
 *              This module allows destination types of Number, String,
 *              Buffer, and Package.
 *
 *              Assumes parameters are already validated. NOTE: SourceDesc
 *              resolution (from a reference object) must be performed by
 *              the caller if necessary.
 *
 ******************************************************************************/
AcpiExStoreObjectToObject
PARAMETERS:  SourceDesc          - Object to store
DestDesc            - Object to receive a copy of the source
NewDesc             - New object if DestDesc is obsoleted
WalkState           - Current walk state

Status

"Store" an object to another object. This may include
converting the source type to the target type (implicit
conversion), and a copy of the value of the source to
the target.

The Assignment of an object to another (not named) object
is handled here.
The Source passed in will replace the current value (if any)
with the input value.

When storing into an object the data is converted to the
target object type then stored in the object. This means
that the target object type (for an initialized target) will
not be changed by a store operation.

This module allows destination types of Number, String,
Buffer, and Package.

Assumes parameters are already validated. NOTE: SourceDesc
resolution (from a reference object) must be performed by
the caller if necessary.
AcpiExStoreObjectToObject PARAMETERS : SourceDesc - Object to store DestDesc - Object to receive a copy of the source NewDesc - New object if DestDesc is obsoleted WalkState - Current walk state Status " Store " an object to another object . This may include converting the source type to the target type ( implicit conversion ) and a copy of the value of the source to the target . The Assignment of an object to another ( not named ) object is handled here . The Source passed in will replace the current value ( if any ) with the input value . When storing into an object the data is converted to the target object type then stored in the object . This means that the target object type ( for an initialized target ) will not be changed by a store operation . This module allows destination types of Number String Buffer and Package . Assumes parameters are already validated . NOTE : SourceDesc resolution ( from a reference object ) must be performed by the caller if necessary .
ACPI_STATUS
AcpiExStoreObjectToObject (
    ACPI_OPERAND_OBJECT     *SourceDesc,
    ACPI_OPERAND_OBJECT     *DestDesc,
    ACPI_OPERAND_OBJECT     **NewDesc,
    ACPI_WALK_STATE         *WalkState)
{
    ACPI_OPERAND_OBJECT     *ActualSrcDesc;
    ACPI_STATUS             Status = AE_OK;
    ACPI_FUNCTION_TRACE_PTR (ExStoreObjectToObject, SourceDesc);
    ActualSrcDesc = SourceDesc;
    if (!DestDesc)
    {
        Status = AcpiUtCopyIobjectToIobject (ActualSrcDesc, NewDesc, WalkState);
        return_ACPI_STATUS (Status);
    }
    if (SourceDesc->Common.Type != DestDesc->Common.Type)
    {
        Status = AcpiExConvertToTargetType (DestDesc->Common.Type,
            SourceDesc, &ActualSrcDesc, WalkState);
        if (ACPI_FAILURE (Status))
        {
            return_ACPI_STATUS (Status);
        }
        if (SourceDesc == ActualSrcDesc)
        {
            *NewDesc = SourceDesc;
            return_ACPI_STATUS (AE_OK);
        }
    }
    switch (DestDesc->Common.Type)
    {
    case ACPI_TYPE_INTEGER:
        DestDesc->Integer.Value = ActualSrcDesc->Integer.Value;
        (void) AcpiExTruncateFor32bitTable (DestDesc);
        break;
    case ACPI_TYPE_STRING:
        Status = AcpiExStoreStringToString (ActualSrcDesc, DestDesc);
        break;
    case ACPI_TYPE_BUFFER:
        Status = AcpiExStoreBufferToBuffer (ActualSrcDesc, DestDesc);
        break;
    case ACPI_TYPE_PACKAGE:
        Status = AcpiUtCopyIobjectToIobject (ActualSrcDesc, &DestDesc,
                    WalkState);
        break;
    default:
        ACPI_WARNING ((AE_INFO, "Store into type [%s] not implemented",
            AcpiUtGetObjectTypeName (DestDesc)));
        Status = AE_NOT_IMPLEMENTED;
        break;
    }
    if (ActualSrcDesc != SourceDesc)
    {
        AcpiUtRemoveReference (ActualSrcDesc);
    }
    *NewDesc = DestDesc;
    return_ACPI_STATUS (Status);
}
ACPI_STATUS AcpiExStoreObjectToObject ( ACPI_OPERAND_OBJECT * SourceDesc , ACPI_OPERAND_OBJECT * DestDesc , ACPI_OPERAND_OBJECT * * NewDesc , ACPI_WALK_STATE * WalkState ) { ACPI_OPERAND_OBJECT * ActualSrcDesc ; ACPI_STATUS Status = AE_OK ; ACPI_FUNCTION_TRACE_PTR ( ExStoreObjectToObject , SourceDesc ) ; ActualSrcDesc = SourceDesc ; if ( ! DestDesc ) { Status = AcpiUtCopyIobjectToIobject ( ActualSrcDesc , NewDesc , WalkState ) ; return_ACPI_STATUS ( Status ) ; } if ( SourceDesc -> Common . Type != DestDesc -> Common . Type ) { Status = AcpiExConvertToTargetType ( DestDesc -> Common . Type , SourceDesc , & ActualSrcDesc , WalkState ) ; if ( ACPI_FAILURE ( Status ) ) { return_ACPI_STATUS ( Status ) ; } if ( SourceDesc == ActualSrcDesc ) { * NewDesc = SourceDesc ; return_ACPI_STATUS ( AE_OK ) ; } } switch ( DestDesc -> Common . Type ) { case ACPI_TYPE_INTEGER : DestDesc -> Integer . Value = ActualSrcDesc -> Integer . Value ; ( void ) AcpiExTruncateFor32bitTable ( DestDesc ) ; break ; case ACPI_TYPE_STRING : Status = AcpiExStoreStringToString ( ActualSrcDesc , DestDesc ) ; break ; case ACPI_TYPE_BUFFER : Status = AcpiExStoreBufferToBuffer ( ActualSrcDesc , DestDesc ) ; break ; case ACPI_TYPE_PACKAGE : Status = AcpiUtCopyIobjectToIobject ( ActualSrcDesc , & DestDesc , WalkState ) ; break ; default : ACPI_WARNING ( ( AE_INFO , " " , AcpiUtGetObjectTypeName ( DestDesc ) ) ) ; Status = AE_NOT_IMPLEMENTED ; break ; } if ( ActualSrcDesc != SourceDesc ) { AcpiUtRemoveReference ( ActualSrcDesc ) ; } * NewDesc = DestDesc ; return_ACPI_STATUS ( Status ) ; }
FUNCTION:    AcpiExStoreObjectToObject
 PARAMETERS:  SourceDesc          - Object to store
              DestDesc            - Object to receive a copy of the source
              NewDesc             - New object if DestDesc is obsoleted
              WalkState           - Current walk state
FUNCTION : AcpiExStoreObjectToObject PARAMETERS : SourceDesc - Object to store DestDesc - Object to receive a copy of the source NewDesc - New object if DestDesc is obsoleted WalkState - Current walk state
/*
         * There is no destination object (An uninitialized node or
         * package element), so we can simply copy the source object
         * creating a new destination object
         */ /*
         * The source type does not match the type of the destination.
         * Perform the "implicit conversion" of the source to the current type
         * of the target as per the ACPI specification.
         *
         * If no conversion performed, ActualSrcDesc = SourceDesc.
         * Otherwise, ActualSrcDesc is a temporary object to hold the
         * converted object.
         */ /*
             * No conversion was performed. Return the SourceDesc as the
             * new object.
             */ /*
     * We now have two objects of identical types, and we can perform a
     * copy of the *value* of the source object.
     */ /* Truncate value if we are executing from a 32-bit ACPI table */ /*
         * All other types come here.
         */ /* Delete the intermediate (temporary) source object */