diff options
Diffstat (limited to 'sys/contrib/dev/acpica/exfield.c')
-rw-r--r-- | sys/contrib/dev/acpica/exfield.c | 33 |
1 files changed, 25 insertions, 8 deletions
diff --git a/sys/contrib/dev/acpica/exfield.c b/sys/contrib/dev/acpica/exfield.c index 4a6e62853493..2321a5a09a2e 100644 --- a/sys/contrib/dev/acpica/exfield.c +++ b/sys/contrib/dev/acpica/exfield.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: exfield - ACPI AML (p-code) execution - field manipulation - * $Revision: 105 $ + * $Revision: 108 $ * *****************************************************************************/ @@ -134,7 +134,8 @@ * * FUNCTION: AcpiExReadDataFromField * - * PARAMETERS: ObjDesc - The named field + * PARAMETERS: WalkState - Current execution state + * ObjDesc - The named field * RetBufferDesc - Where the return data object is stored * * RETURN: Status @@ -146,12 +147,14 @@ ACPI_STATUS AcpiExReadDataFromField ( + ACPI_WALK_STATE *WalkState, ACPI_OPERAND_OBJECT *ObjDesc, ACPI_OPERAND_OBJECT **RetBufferDesc) { ACPI_STATUS Status; ACPI_OPERAND_OBJECT *BufferDesc; UINT32 Length; + UINT32 IntegerSize; void *Buffer; BOOLEAN Locked; @@ -194,7 +197,19 @@ AcpiExReadDataFromField ( */ Length = ACPI_ROUND_BITS_UP_TO_BYTES (ObjDesc->Field.BitLength); - if (Length > sizeof (ACPI_INTEGER)) + /* Handle both ACPI 1.0 and ACPI 2.0 Integer widths */ + + IntegerSize = sizeof (ACPI_INTEGER); + if (WalkState->MethodNode->Flags & ANOBJ_DATA_WIDTH_32) + { + /* + * We are running a method that exists in a 32-bit ACPI table. + * Integer size is 4. + */ + IntegerSize = sizeof (UINT32); + } + + if (Length > IntegerSize) { /* Field is too large for an Integer, create a Buffer instead */ @@ -213,6 +228,7 @@ AcpiExReadDataFromField ( return_ACPI_STATUS (AE_NO_MEMORY); } + BufferDesc->Common.Flags = AOPOBJ_DATA_VALID; BufferDesc->Buffer.Length = Length; Buffer = BufferDesc->Buffer.Pointer; } @@ -226,14 +242,15 @@ AcpiExReadDataFromField ( return_ACPI_STATUS (AE_NO_MEMORY); } - Length = sizeof (BufferDesc->Integer.Value); + Length = IntegerSize; + BufferDesc->Integer.Value = 0; Buffer = &BufferDesc->Integer.Value; } - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, + ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "Obj=%p Type=%X Buf=%p Len=%X\n", ObjDesc, ObjDesc->Common.Type, Buffer, Length)); - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, + ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "FieldWrite: BitLen=%X BitOff=%X ByteOff=%X\n", ObjDesc->CommonField.BitLength, ObjDesc->CommonField.StartFieldBitOffset, @@ -368,10 +385,10 @@ AcpiExWriteDataToField ( Length = RequiredLength; } - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, + ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "Obj=%p Type=%X Buf=%p Len=%X\n", ObjDesc, ObjDesc->Common.Type, Buffer, Length)); - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, + ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "FieldRead: BitLen=%X BitOff=%X ByteOff=%X\n", ObjDesc->CommonField.BitLength, ObjDesc->CommonField.StartFieldBitOffset, |