mirror of
https://github.com/acpica/acpica/
synced 2025-02-23 00:44:17 +03:00
Changed to AddReference
date 2000.04.27.23.06.00; author rmoore1; state Exp;
This commit is contained in:
parent
5ea72f0de5
commit
e56bffb6eb
@ -662,7 +662,7 @@ AmlResolveEntryToValue (
|
||||
/* Return an additional reference to the object */
|
||||
|
||||
ObjDesc = ValDesc;
|
||||
CmUpdateObjectReference (ObjDesc, REF_INCREMENT);
|
||||
CmAddReference (ObjDesc);
|
||||
break;
|
||||
|
||||
|
||||
@ -738,7 +738,7 @@ AmlResolveEntryToValue (
|
||||
/* Return an additional reference to the object */
|
||||
|
||||
ObjDesc = ValDesc;
|
||||
CmUpdateObjectReference (ObjDesc, REF_INCREMENT);
|
||||
CmAddReference (ObjDesc);
|
||||
|
||||
DEBUG_PRINT (TRACE_BFIELD,
|
||||
("AmlResolveEntryToValue: New Buffer descriptor seq# %ld @ %p \n",
|
||||
@ -777,7 +777,7 @@ AmlResolveEntryToValue (
|
||||
/* Return an additional reference to the object */
|
||||
|
||||
ObjDesc = ValDesc;
|
||||
CmUpdateObjectReference (ObjDesc, REF_INCREMENT);
|
||||
CmAddReference (ObjDesc);
|
||||
}
|
||||
|
||||
break;
|
||||
@ -882,7 +882,7 @@ AmlResolveEntryToValue (
|
||||
/* Return an additional reference to the object */
|
||||
|
||||
ObjDesc = ValDesc;
|
||||
CmUpdateObjectReference (ObjDesc, REF_INCREMENT);
|
||||
CmAddReference (ObjDesc);
|
||||
}
|
||||
|
||||
break;
|
||||
@ -1114,7 +1114,7 @@ AmlResolveEntryToValue (
|
||||
/* Return an additional reference to the object */
|
||||
|
||||
ObjDesc = ValDesc;
|
||||
CmUpdateObjectReference (ObjDesc, REF_INCREMENT);
|
||||
CmAddReference (ObjDesc);
|
||||
break;
|
||||
|
||||
|
||||
|
@ -774,29 +774,97 @@ AmlExecStore (
|
||||
* must be converted to the same type as the package element
|
||||
* then stored.
|
||||
*
|
||||
* Storing into a package element is simple - just store the object at the
|
||||
* element location specified by the Reference.Object
|
||||
* Actually, storing to a package is not so simple. The source must be
|
||||
* evaluated and converted to the type of the destination and then the
|
||||
* source is copied into the destination - we can't just point to the
|
||||
* source object.
|
||||
*/
|
||||
if (DestDesc->Reference.TargetType == ACPI_TYPE_Package)
|
||||
{
|
||||
DeleteDestDesc = DestDesc;
|
||||
|
||||
/* Delete any object that just happens to be here */
|
||||
/* TBD: we may have to do a type conversion here! */
|
||||
|
||||
/*
|
||||
* The object at *(DestDesc->Reference.Where) is the
|
||||
* element within the package that is to be modified.
|
||||
*/
|
||||
TmpDesc = *(DestDesc->Reference.Where);
|
||||
|
||||
/*
|
||||
* If the Destination element is a package, we will delete
|
||||
* that object and construct a new one.
|
||||
*/
|
||||
if (TmpDesc)
|
||||
{
|
||||
/* Take away the reference for being part of a package and delete */
|
||||
if(ACPI_TYPE_Package == TmpDesc->Common.Type)
|
||||
{
|
||||
/* Take away the reference for being part of a package and delete */
|
||||
|
||||
CmUpdateObjectReference (TmpDesc, REF_DECREMENT);
|
||||
CmRemoveReference (TmpDesc);
|
||||
CmRemoveReference (TmpDesc);
|
||||
|
||||
/*
|
||||
* Now create the new object for storage
|
||||
* and build the new package to match the original
|
||||
*/
|
||||
TmpDesc = CmCreateInternalObject (ACPI_TYPE_Package);
|
||||
if (TmpDesc)
|
||||
{
|
||||
Status = CmBuildCopyInternalPackageObject (ValDesc, TmpDesc);
|
||||
if (AE_OK == Status)
|
||||
{
|
||||
/*
|
||||
* Increment the ref count and point the destination
|
||||
* object's where element to our newly built package.
|
||||
*/
|
||||
CmAddReference (TmpDesc);
|
||||
*(DestDesc->Reference.Where) = TmpDesc;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
/*
|
||||
* An error occurred when copying the internal object
|
||||
* so delete the reference.
|
||||
*/
|
||||
CmRemoveReference (TmpDesc);
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
Status = AE_NO_MEMORY;
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
/*
|
||||
* The destination element is not a package, so
|
||||
* we need to convert the contents of the source
|
||||
* (ValDesc) and copy into the destination (TmpDesc)
|
||||
*/
|
||||
Status = CmCopyInternalSimpleObject(ValDesc, TmpDesc);
|
||||
|
||||
if (AE_OK != Status)
|
||||
{
|
||||
/*
|
||||
* An error occurred when copying the internal object
|
||||
* so delete the reference.
|
||||
*/
|
||||
DEBUG_PRINT (ACPI_ERROR, ("AmlExecStore/Index: Unable to copy the internal object\n"));
|
||||
DeleteDestDesc = DestDesc;
|
||||
Status = AE_AML_OPERAND_TYPE;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* There is no destination storage
|
||||
*/
|
||||
DEBUG_PRINT (ACPI_ERROR, ("AmlExecStore/Index: Reference Destination is NULL\n"));
|
||||
DeleteDestDesc = DestDesc;
|
||||
Status = AE_AML_OPERAND_TYPE;
|
||||
}
|
||||
|
||||
/* Now store the new object */
|
||||
|
||||
CmUpdateObjectReference (ValDesc, REF_INCREMENT);
|
||||
*(DestDesc->Reference.Where) = ValDesc;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -819,18 +887,27 @@ AmlExecStore (
|
||||
switch (ValDesc->Common.Type)
|
||||
{
|
||||
/*
|
||||
* TBD: Verify that this truncation behavior is correct
|
||||
* If the type is Integer, only the least significant
|
||||
* 8-bits are used
|
||||
*/
|
||||
case ACPI_TYPE_Number:
|
||||
Value = (UINT8)ValDesc->Number.Value;
|
||||
break;
|
||||
|
||||
/*
|
||||
* TBD: Should the buffer replace only the single element?
|
||||
* If the type is Buffer, the least significant
|
||||
* 8-bits are copied over (last element)
|
||||
*/
|
||||
case ACPI_TYPE_Buffer:
|
||||
Value = *(ValDesc->Buffer.Pointer + ValDesc->Buffer.Length - 1);
|
||||
break;
|
||||
|
||||
/*
|
||||
* If the type is String, the least significant
|
||||
* 8-bits are copied over (last element)
|
||||
*/
|
||||
case ACPI_TYPE_String:
|
||||
Value = *(ValDesc->Buffer.Pointer);
|
||||
Value = *(ValDesc->String.Pointer + ValDesc->String.Length - 1);
|
||||
break;
|
||||
|
||||
/*
|
||||
|
Loading…
x
Reference in New Issue
Block a user