mirror of
https://github.com/acpica/acpica/
synced 2025-02-25 18:04:08 +03:00
Modifications to read/write to address bit offset translation of
buffers date 2000.03.24.23.57.00; author mwalz; state Exp;
This commit is contained in:
parent
327322df3f
commit
8f0803680a
@ -254,12 +254,12 @@ AmlReadField (
|
||||
UINT32 ByteGranularity)
|
||||
{
|
||||
ACPI_STATUS Status;
|
||||
UINT32 MergedDatum;
|
||||
UINT32 ThisFieldByteOffset;
|
||||
UINT32 ThisFieldDatumOffset;
|
||||
UINT32 PreviousRawDatum;
|
||||
UINT32 ThisRawDatum;
|
||||
UINT32 ValidFieldBits;
|
||||
// UINT32 ValidFieldBits;
|
||||
UINT32 MergedDatum = 0;
|
||||
|
||||
|
||||
FUNCTION_TRACE ("AmlReadField");
|
||||
@ -307,6 +307,21 @@ AmlReadField (
|
||||
goto Cleanup;
|
||||
}
|
||||
|
||||
/* Before merging the data, make sure the unused bits are clear */
|
||||
|
||||
switch (ByteGranularity)
|
||||
{
|
||||
case 1:
|
||||
ThisRawDatum &= 0x000000FF;
|
||||
PreviousRawDatum &= 0x000000FF;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
ThisRawDatum &= 0x0000FFFF;
|
||||
PreviousRawDatum &= 0x0000FFFF;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Put together bits of the two raw data to make a complete field datum */
|
||||
|
||||
if (ObjDesc->Field.BitOffset != 0)
|
||||
@ -348,36 +363,6 @@ AmlReadField (
|
||||
} /* while */
|
||||
}
|
||||
|
||||
|
||||
/* Cleanup the last datum if necessary by zeroing the bits that aren't part of the field */
|
||||
|
||||
ValidFieldBits = ((ObjDesc->FieldUnit.Length % BitGranularity) + ObjDesc->Field.BitOffset);
|
||||
if (ValidFieldBits)
|
||||
{
|
||||
MergedDatum &= (((UINT32) 1 << ValidFieldBits) - (UINT32) 1);
|
||||
}
|
||||
|
||||
ThisFieldDatumOffset--;
|
||||
|
||||
|
||||
/* Store the last datum again (might actually be the first, or it might be fixed from above */
|
||||
|
||||
switch (ByteGranularity)
|
||||
{
|
||||
case 1:
|
||||
((UINT8 *) Buffer) [ThisFieldDatumOffset] = (UINT8) MergedDatum;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
((UINT16 *) Buffer) [ThisFieldDatumOffset] = (UINT16) MergedDatum;
|
||||
break;
|
||||
|
||||
case 4:
|
||||
((UINT32 *) Buffer) [ThisFieldDatumOffset] = (UINT32) MergedDatum;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
Cleanup:
|
||||
|
||||
return_ACPI_STATUS (Status);
|
||||
|
Loading…
x
Reference in New Issue
Block a user