{
UINT32 AccessBitWidth;
UINT32 ByteAlignment;
UINT32 NearestByteAddress;
ACPI_FUNCTION_TRACE (ExPrepCommonFieldObject);
/* * Note: the structure being initialized is the * ACPI_COMMON_FIELD_INFO; No structure fields outside of the common * area are initialized by this procedure. */
ObjDesc->CommonField.FieldFlags = FieldFlags;
ObjDesc->CommonField.Attribute = FieldAttribute;
ObjDesc->CommonField.BitLength = FieldBitLength;
/* * Decode the access type so we can compute offsets. The access type gives * two pieces of information - the width of each field access and the * necessary ByteAlignment (address granularity) of the access. * * For AnyAcc, the AccessBitWidth is the largest width that is both * necessary and possible in an attempt to access the whole field in one * I/O operation. However, for AnyAcc, the ByteAlignment is always one * byte. * * For all Buffer Fields, the ByteAlignment is always one byte. * * For all other access types (Byte, Word, Dword, Qword), the Bitwidth is * the same (equivalent) as the ByteAlignment. */
AccessBitWidth = AcpiExDecodeFieldAccess (ObjDesc, FieldFlags,
&ByteAlignment);
if (!AccessBitWidth)
{
return_ACPI_STATUS (AE_AML_OPERAND_VALUE);
}
/* Setup width (access granularity) fields (values are: 1, 2, 4, 8) */
ObjDesc->CommonField.AccessByteWidth = (UINT8)
ACPI_DIV_8 (AccessBitWidth);
/* * BaseByteOffset is the address of the start of the field within the * region. It is the byte address of the first *datum* (field-width data * unit) of the field. (i.e., the first datum that contains at least the * first *bit* of the field.) * * Note: ByteAlignment is always either equal to the AccessBitWidth or 8 * (Byte access), and it defines the addressing granularity of the parent * region or buffer. */
NearestByteAddress =
ACPI_ROUND_BITS_DOWN_TO_BYTES (FieldBitPosition);
ObjDesc->CommonField.BaseByteOffset = (UINT32)
ACPI_ROUND_DOWN (NearestByteAddress, ByteAlignment);
/* * StartFieldBitOffset is the offset of the first bit of the field within * a field datum. */
ObjDesc->CommonField.StartFieldBitOffset = (UINT8)
(FieldBitPosition - ACPI_MUL_8 (ObjDesc->CommonField.BaseByteOffset));
return_ACPI_STATUS (AE_OK);
}
Generated on Sun May 27 2012 05:21:52 for ReactOS by
1.7.6.1
ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.