mirror of
https://github.com/acpica/acpica/
synced 2025-02-16 05:24:36 +03:00
Cleanup prior to label
date 2001.04.26.23.04.00; author rmoore1; state Exp;
This commit is contained in:
parent
df8b7a781d
commit
7a65b4c8f4
@ -2,7 +2,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: amstore - AML Interpreter object store support
|
||||
* $Revision: 1.135 $
|
||||
* $Revision: 1.136 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -259,7 +259,7 @@ AcpiAmlExecStore (
|
||||
{
|
||||
/* TBD: print known object types "prettier". */
|
||||
|
||||
DEBUG_PRINT_RAW (ACPI_DEBUG_OBJECT, ("Debug Object: %s 0x%X\n",
|
||||
DEBUG_PRINT_RAW (ACPI_DEBUG_OBJECT, ("Debug Object: %s 0x%X\n",
|
||||
AcpiCmGetTypeName (ValDesc->Common.Type),
|
||||
ValDesc));
|
||||
DUMP_STACK_ENTRY (ValDesc);
|
||||
|
@ -2,7 +2,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: amstorob - AML Interpreter object store support, store to object
|
||||
* $Revision: 1.24 $
|
||||
* $Revision: 1.31 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -126,7 +126,7 @@
|
||||
#include "actables.h"
|
||||
|
||||
|
||||
#define _COMPONENT INTERPRETER
|
||||
#define _COMPONENT ACPI_EXECUTER
|
||||
MODULE_NAME ("amstorob")
|
||||
|
||||
|
||||
@ -270,311 +270,3 @@ AcpiAmlCopyStringToString (
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiAmlCopyIntegerToIndexField
|
||||
*
|
||||
* PARAMETERS: SourceDesc - Source object to copy
|
||||
* TargetDesc - Destination object of the copy
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION: Write an Integer to an Index Field
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiAmlCopyIntegerToIndexField (
|
||||
ACPI_OPERAND_OBJECT *SourceDesc,
|
||||
ACPI_OPERAND_OBJECT *TargetDesc)
|
||||
{
|
||||
ACPI_STATUS Status;
|
||||
BOOLEAN Locked;
|
||||
|
||||
|
||||
/*
|
||||
* Get the global lock if needed
|
||||
*/
|
||||
Locked = AcpiAmlAcquireGlobalLock (TargetDesc->IndexField.LockRule);
|
||||
|
||||
/*
|
||||
* Set Index value to select proper Data register
|
||||
* perform the update (Set index)
|
||||
*/
|
||||
Status = AcpiAmlAccessNamedField (ACPI_WRITE,
|
||||
TargetDesc->IndexField.Index,
|
||||
&TargetDesc->IndexField.Value,
|
||||
sizeof (TargetDesc->IndexField.Value));
|
||||
if (ACPI_SUCCESS (Status))
|
||||
{
|
||||
/* SetIndex was successful, next set Data value */
|
||||
|
||||
Status = AcpiAmlAccessNamedField (ACPI_WRITE,
|
||||
TargetDesc->IndexField.Data,
|
||||
&SourceDesc->Integer.Value,
|
||||
sizeof (SourceDesc->Integer.Value));
|
||||
|
||||
DEBUG_PRINT (ACPI_INFO,
|
||||
("AmlCopyIntegerToIndexField: IndexField: set data returned %s\n",
|
||||
AcpiCmFormatException (Status)));
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
DEBUG_PRINT (ACPI_INFO,
|
||||
("AmlCopyIntegerToIndexField: IndexField: set index returned %s\n",
|
||||
AcpiCmFormatException (Status)));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Release global lock if we acquired it earlier
|
||||
*/
|
||||
AcpiAmlReleaseGlobalLock (Locked);
|
||||
|
||||
return (Status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiAmlCopyIntegerToBankField
|
||||
*
|
||||
* PARAMETERS: SourceDesc - Source object to copy
|
||||
* TargetDesc - Destination object of the copy
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION: Write an Integer to a Bank Field
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiAmlCopyIntegerToBankField (
|
||||
ACPI_OPERAND_OBJECT *SourceDesc,
|
||||
ACPI_OPERAND_OBJECT *TargetDesc)
|
||||
{
|
||||
ACPI_STATUS Status;
|
||||
BOOLEAN Locked;
|
||||
|
||||
|
||||
/*
|
||||
* Get the global lock if needed
|
||||
*/
|
||||
Locked = AcpiAmlAcquireGlobalLock (TargetDesc->IndexField.LockRule);
|
||||
|
||||
|
||||
/*
|
||||
* Set Bank value to select proper Bank
|
||||
* Perform the update (Set Bank Select)
|
||||
*/
|
||||
|
||||
Status = AcpiAmlAccessNamedField (ACPI_WRITE,
|
||||
TargetDesc->BankField.BankSelect,
|
||||
&TargetDesc->BankField.Value,
|
||||
sizeof (TargetDesc->BankField.Value));
|
||||
if (ACPI_SUCCESS (Status))
|
||||
{
|
||||
/* Set bank select successful, set data value */
|
||||
|
||||
Status = AcpiAmlAccessNamedField (ACPI_WRITE,
|
||||
TargetDesc->BankField.BankSelect,
|
||||
&SourceDesc->BankField.Value,
|
||||
sizeof (SourceDesc->BankField.Value));
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
DEBUG_PRINT (ACPI_INFO,
|
||||
("AmlCopyIntegerToBankField: BankField: set bakn returned %s\n",
|
||||
AcpiCmFormatException (Status)));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Release global lock if we acquired it earlier
|
||||
*/
|
||||
AcpiAmlReleaseGlobalLock (Locked);
|
||||
|
||||
return (Status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiAmlCopyDataToNamedField
|
||||
*
|
||||
* PARAMETERS: SourceDesc - Source object to copy
|
||||
* Node - Destination Namespace node
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION: Copy raw data to a Named Field. No implicit conversion
|
||||
* is performed on the source object
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiAmlCopyDataToNamedField (
|
||||
ACPI_OPERAND_OBJECT *SourceDesc,
|
||||
ACPI_NAMESPACE_NODE *Node)
|
||||
{
|
||||
ACPI_STATUS Status;
|
||||
BOOLEAN Locked;
|
||||
UINT32 Length;
|
||||
UINT8 *Buffer;
|
||||
|
||||
|
||||
/*
|
||||
* Named fields (CreateXxxField) - We don't perform any conversions on the
|
||||
* source operand, just use the raw data
|
||||
*/
|
||||
switch (SourceDesc->Common.Type)
|
||||
{
|
||||
case ACPI_TYPE_INTEGER:
|
||||
Buffer = (UINT8 *) &SourceDesc->Integer.Value;
|
||||
Length = sizeof (SourceDesc->Integer.Value);
|
||||
break;
|
||||
|
||||
case ACPI_TYPE_BUFFER:
|
||||
Buffer = (UINT8 *) SourceDesc->Buffer.Pointer;
|
||||
Length = SourceDesc->Buffer.Length;
|
||||
break;
|
||||
|
||||
case ACPI_TYPE_STRING:
|
||||
Buffer = (UINT8 *) SourceDesc->String.Pointer;
|
||||
Length = SourceDesc->String.Length;
|
||||
break;
|
||||
|
||||
default:
|
||||
return (AE_TYPE);
|
||||
}
|
||||
|
||||
/*
|
||||
* Get the global lock if needed before the update
|
||||
* TBD: not needed!
|
||||
*/
|
||||
Locked = AcpiAmlAcquireGlobalLock (SourceDesc->Field.LockRule);
|
||||
|
||||
Status = AcpiAmlAccessNamedField (ACPI_WRITE,
|
||||
Node, Buffer, Length);
|
||||
|
||||
AcpiAmlReleaseGlobalLock (Locked);
|
||||
|
||||
return (Status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiAmlCopyIntegerToFieldUnit
|
||||
*
|
||||
* PARAMETERS: SourceDesc - Source object to copy
|
||||
* TargetDesc - Destination object of the copy
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION: Write an Integer to a Field Unit.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiAmlCopyIntegerToFieldUnit (
|
||||
ACPI_OPERAND_OBJECT *SourceDesc,
|
||||
ACPI_OPERAND_OBJECT *TargetDesc)
|
||||
{
|
||||
ACPI_STATUS Status = AE_OK;
|
||||
UINT8 *Location = NULL;
|
||||
UINT32 Mask;
|
||||
UINT32 NewValue;
|
||||
BOOLEAN Locked = FALSE;
|
||||
|
||||
|
||||
FUNCTION_TRACE ("AmlCopyIntegerToFieldUnit");
|
||||
|
||||
/*
|
||||
* If the Field Buffer and Index have not been previously evaluated,
|
||||
* evaluate them and save the results.
|
||||
*/
|
||||
if (!(TargetDesc->Common.Flags & AOPOBJ_DATA_VALID))
|
||||
{
|
||||
Status = AcpiDsGetFieldUnitArguments (TargetDesc);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
}
|
||||
|
||||
if ((!TargetDesc->FieldUnit.Container ||
|
||||
ACPI_TYPE_BUFFER != TargetDesc->FieldUnit.Container->Common.Type))
|
||||
{
|
||||
DEBUG_PRINT (ACPI_ERROR,
|
||||
("Null Container or wrong type: %p", TargetDesc->FieldUnit.Container));
|
||||
|
||||
if (TargetDesc->FieldUnit.Container)
|
||||
{
|
||||
DEBUG_PRINT_RAW (ACPI_ERROR, (" Type %X",
|
||||
TargetDesc->FieldUnit.Container->Common.Type));
|
||||
}
|
||||
DEBUG_PRINT_RAW (ACPI_ERROR, ("\n"));
|
||||
|
||||
return_ACPI_STATUS (AE_AML_INTERNAL);
|
||||
}
|
||||
|
||||
/*
|
||||
* Get the global lock if needed
|
||||
*/
|
||||
Locked = AcpiAmlAcquireGlobalLock (TargetDesc->FieldUnit.LockRule);
|
||||
|
||||
/*
|
||||
* TBD: [Unhandled] REMOVE this limitation
|
||||
* Make sure the operation is within the limits of our implementation
|
||||
* this is not a Spec limitation!!
|
||||
*/
|
||||
if (TargetDesc->FieldUnit.Length + TargetDesc->FieldUnit.BitOffset > 32)
|
||||
{
|
||||
DEBUG_PRINT (ACPI_ERROR,
|
||||
("AmlCopyIntegerToFieldUnit: FieldUnit: Implementation limitation - Field exceeds UINT32\n"));
|
||||
return_ACPI_STATUS (AE_NOT_IMPLEMENTED);
|
||||
}
|
||||
|
||||
/* Field location is (base of buffer) + (byte offset) */
|
||||
|
||||
Location = TargetDesc->FieldUnit.Container->Buffer.Pointer
|
||||
+ TargetDesc->FieldUnit.Offset;
|
||||
|
||||
/*
|
||||
* Construct Mask with 1 bits where the field is,
|
||||
* 0 bits elsewhere
|
||||
*/
|
||||
Mask = ((UINT32) 1 << TargetDesc->FieldUnit.Length) - ((UINT32)1
|
||||
<< TargetDesc->FieldUnit.BitOffset);
|
||||
|
||||
DEBUG_PRINT (TRACE_EXEC,
|
||||
("** Store %lx in buffer %p byte %ld bit %X width %d addr %p mask %08lx\n",
|
||||
SourceDesc->Integer.Value,
|
||||
TargetDesc->FieldUnit.Container->Buffer.Pointer,
|
||||
TargetDesc->FieldUnit.Offset, TargetDesc->FieldUnit.BitOffset,
|
||||
TargetDesc->FieldUnit.Length,Location, Mask));
|
||||
|
||||
/* Zero out the field in the buffer */
|
||||
|
||||
MOVE_UNALIGNED32_TO_32 (&NewValue, Location);
|
||||
NewValue &= ~Mask;
|
||||
|
||||
/*
|
||||
* Shift and mask the new value into position,
|
||||
* and or it into the buffer.
|
||||
*/
|
||||
NewValue |= (SourceDesc->Integer.Value << TargetDesc->FieldUnit.BitOffset) &
|
||||
Mask;
|
||||
|
||||
/* Store back the value */
|
||||
|
||||
MOVE_UNALIGNED32_TO_32 (Location, &NewValue);
|
||||
|
||||
DEBUG_PRINT (TRACE_EXEC, ("New Field value %08lx\n", NewValue));
|
||||
return_ACPI_STATUS (AE_OK);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user