mirror of
https://github.com/acpica/acpica/
synced 2025-02-23 08:54:16 +03:00
Add multi-endian support to the _PLD decode routine.
Deploy the multi-endian macros to extract data from the _PLD buffer.
This commit is contained in:
parent
33b1aae263
commit
0d9370ee26
@ -807,65 +807,69 @@ AcpiDbEncodePldBuffer (
|
||||
ACPI_PLD_INFO *PldInfo)
|
||||
{
|
||||
UINT32 *Buffer;
|
||||
UINT32 *BufferPtr;
|
||||
UINT32 Dword;
|
||||
|
||||
|
||||
BufferPtr = ACPI_ALLOCATE_ZEROED (ACPI_PLD_BUFFER_SIZE);
|
||||
if (!BufferPtr)
|
||||
Buffer = ACPI_ALLOCATE_ZEROED (ACPI_PLD_BUFFER_SIZE);
|
||||
if (!Buffer)
|
||||
{
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
Buffer = BufferPtr;
|
||||
|
||||
/* First 32 bits */
|
||||
|
||||
ACPI_PLD_SET_REVISION (Buffer, PldInfo->Revision);
|
||||
ACPI_PLD_SET_IGNORE_COLOR (Buffer, PldInfo->IgnoreColor);
|
||||
ACPI_PLD_SET_COLOR (Buffer, PldInfo->Color);
|
||||
Dword = 0;
|
||||
ACPI_PLD_SET_REVISION (&Dword, PldInfo->Revision);
|
||||
ACPI_PLD_SET_IGNORE_COLOR (&Dword, PldInfo->IgnoreColor);
|
||||
ACPI_PLD_SET_COLOR (&Dword, PldInfo->Color);
|
||||
ACPI_MOVE_32_TO_32 (&Buffer[0], &Dword);
|
||||
|
||||
/* Second 32 bits */
|
||||
|
||||
Buffer++;
|
||||
ACPI_PLD_SET_WIDTH (Buffer, PldInfo->Width);
|
||||
ACPI_PLD_SET_HEIGHT (Buffer, PldInfo->Height);
|
||||
Dword = 0;
|
||||
ACPI_PLD_SET_WIDTH (&Dword, PldInfo->Width);
|
||||
ACPI_PLD_SET_HEIGHT (&Dword, PldInfo->Height);
|
||||
ACPI_MOVE_32_TO_32 (&Buffer[1], &Dword);
|
||||
|
||||
/* Third 32 bits */
|
||||
|
||||
Buffer++;
|
||||
ACPI_PLD_SET_USER_VISIBLE (Buffer, PldInfo->UserVisible);
|
||||
ACPI_PLD_SET_DOCK (Buffer, PldInfo->Dock);
|
||||
ACPI_PLD_SET_LID (Buffer, PldInfo->Lid);
|
||||
ACPI_PLD_SET_PANEL (Buffer, PldInfo->Panel);
|
||||
ACPI_PLD_SET_VERTICAL (Buffer, PldInfo->VerticalPosition);
|
||||
ACPI_PLD_SET_HORIZONTAL (Buffer, PldInfo->HorizontalPosition);
|
||||
ACPI_PLD_SET_SHAPE (Buffer, PldInfo->Shape);
|
||||
ACPI_PLD_SET_ORIENTATION (Buffer, PldInfo->GroupOrientation);
|
||||
ACPI_PLD_SET_TOKEN (Buffer, PldInfo->GroupToken);
|
||||
ACPI_PLD_SET_POSITION (Buffer, PldInfo->GroupPosition);
|
||||
ACPI_PLD_SET_BAY (Buffer, PldInfo->Bay);
|
||||
Dword = 0;
|
||||
ACPI_PLD_SET_USER_VISIBLE (&Dword, PldInfo->UserVisible);
|
||||
ACPI_PLD_SET_DOCK (&Dword, PldInfo->Dock);
|
||||
ACPI_PLD_SET_LID (&Dword, PldInfo->Lid);
|
||||
ACPI_PLD_SET_PANEL (&Dword, PldInfo->Panel);
|
||||
ACPI_PLD_SET_VERTICAL (&Dword, PldInfo->VerticalPosition);
|
||||
ACPI_PLD_SET_HORIZONTAL (&Dword, PldInfo->HorizontalPosition);
|
||||
ACPI_PLD_SET_SHAPE (&Dword, PldInfo->Shape);
|
||||
ACPI_PLD_SET_ORIENTATION (&Dword, PldInfo->GroupOrientation);
|
||||
ACPI_PLD_SET_TOKEN (&Dword, PldInfo->GroupToken);
|
||||
ACPI_PLD_SET_POSITION (&Dword, PldInfo->GroupPosition);
|
||||
ACPI_PLD_SET_BAY (&Dword, PldInfo->Bay);
|
||||
ACPI_MOVE_32_TO_32 (&Buffer[2], &Dword);
|
||||
|
||||
/* Fourth 32 bits */
|
||||
|
||||
Buffer++;
|
||||
ACPI_PLD_SET_EJECTABLE (Buffer, PldInfo->Ejectable);
|
||||
ACPI_PLD_SET_OSPM_EJECT (Buffer, PldInfo->OspmEjectRequired);
|
||||
ACPI_PLD_SET_CABINET (Buffer, PldInfo->CabinetNumber);
|
||||
ACPI_PLD_SET_CARD_CAGE (Buffer, PldInfo->CardCageNumber);
|
||||
ACPI_PLD_SET_REFERENCE (Buffer, PldInfo->Reference);
|
||||
ACPI_PLD_SET_ROTATION (Buffer, PldInfo->Rotation);
|
||||
ACPI_PLD_SET_ORDER (Buffer, PldInfo->Order);
|
||||
Dword = 0;
|
||||
ACPI_PLD_SET_EJECTABLE (&Dword, PldInfo->Ejectable);
|
||||
ACPI_PLD_SET_OSPM_EJECT (&Dword, PldInfo->OspmEjectRequired);
|
||||
ACPI_PLD_SET_CABINET (&Dword, PldInfo->CabinetNumber);
|
||||
ACPI_PLD_SET_CARD_CAGE (&Dword, PldInfo->CardCageNumber);
|
||||
ACPI_PLD_SET_REFERENCE (&Dword, PldInfo->Reference);
|
||||
ACPI_PLD_SET_ROTATION (&Dword, PldInfo->Rotation);
|
||||
ACPI_PLD_SET_ORDER (&Dword, PldInfo->Order);
|
||||
ACPI_MOVE_32_TO_32 (&Buffer[3], &Dword);
|
||||
|
||||
if (PldInfo->Revision >= 2)
|
||||
{
|
||||
/* Fifth 32 bits */
|
||||
|
||||
Buffer++;
|
||||
ACPI_PLD_SET_VERT_OFFSET (Buffer, PldInfo->VerticalOffset);
|
||||
ACPI_PLD_SET_HORIZ_OFFSET (Buffer, PldInfo->HorizontalOffset);
|
||||
Dword = 0;
|
||||
ACPI_PLD_SET_VERT_OFFSET (&Dword, PldInfo->VerticalOffset);
|
||||
ACPI_PLD_SET_HORIZ_OFFSET (&Dword, PldInfo->HorizontalOffset);
|
||||
ACPI_MOVE_32_TO_32 (&Buffer[4], &Dword);
|
||||
}
|
||||
|
||||
return (ACPI_CAST_PTR (UINT8, BufferPtr));
|
||||
return (ACPI_CAST_PTR (UINT8, Buffer));
|
||||
}
|
||||
|
||||
|
||||
|
@ -624,6 +624,7 @@ AcpiDecodePldBuffer (
|
||||
{
|
||||
ACPI_PLD_INFO *PldInfo;
|
||||
UINT32 *Buffer = ACPI_CAST_PTR (UINT32, InBuffer);
|
||||
UINT32 Dword;
|
||||
|
||||
|
||||
/* Parameter validation */
|
||||
@ -641,49 +642,50 @@ AcpiDecodePldBuffer (
|
||||
|
||||
/* First 32-bit DWord */
|
||||
|
||||
PldInfo->Revision = ACPI_PLD_GET_REVISION (Buffer);
|
||||
PldInfo->IgnoreColor = ACPI_PLD_GET_IGNORE_COLOR (Buffer);
|
||||
PldInfo->Color = ACPI_PLD_GET_COLOR (Buffer);
|
||||
ACPI_MOVE_32_TO_32 (&Dword, &Buffer[0]);
|
||||
PldInfo->Revision = ACPI_PLD_GET_REVISION (&Dword);
|
||||
PldInfo->IgnoreColor = ACPI_PLD_GET_IGNORE_COLOR (&Dword);
|
||||
PldInfo->Color = ACPI_PLD_GET_COLOR (&Dword);
|
||||
|
||||
/* Second 32-bit DWord */
|
||||
|
||||
Buffer++;
|
||||
PldInfo->Width = ACPI_PLD_GET_WIDTH (Buffer);
|
||||
PldInfo->Height = ACPI_PLD_GET_HEIGHT(Buffer);
|
||||
ACPI_MOVE_32_TO_32 (&Dword, &Buffer[1]);
|
||||
PldInfo->Width = ACPI_PLD_GET_WIDTH (&Dword);
|
||||
PldInfo->Height = ACPI_PLD_GET_HEIGHT(&Dword);
|
||||
|
||||
/* Third 32-bit DWord */
|
||||
|
||||
Buffer++;
|
||||
PldInfo->UserVisible = ACPI_PLD_GET_USER_VISIBLE (Buffer);
|
||||
PldInfo->Dock = ACPI_PLD_GET_DOCK (Buffer);
|
||||
PldInfo->Lid = ACPI_PLD_GET_LID (Buffer);
|
||||
PldInfo->Panel = ACPI_PLD_GET_PANEL (Buffer);
|
||||
PldInfo->VerticalPosition = ACPI_PLD_GET_VERTICAL (Buffer);
|
||||
PldInfo->HorizontalPosition = ACPI_PLD_GET_HORIZONTAL (Buffer);
|
||||
PldInfo->Shape = ACPI_PLD_GET_SHAPE (Buffer);
|
||||
PldInfo->GroupOrientation = ACPI_PLD_GET_ORIENTATION (Buffer);
|
||||
PldInfo->GroupToken = ACPI_PLD_GET_TOKEN (Buffer);
|
||||
PldInfo->GroupPosition = ACPI_PLD_GET_POSITION (Buffer);
|
||||
PldInfo->Bay = ACPI_PLD_GET_BAY (Buffer);
|
||||
ACPI_MOVE_32_TO_32 (&Dword, &Buffer[2]);
|
||||
PldInfo->UserVisible = ACPI_PLD_GET_USER_VISIBLE (&Dword);
|
||||
PldInfo->Dock = ACPI_PLD_GET_DOCK (&Dword);
|
||||
PldInfo->Lid = ACPI_PLD_GET_LID (&Dword);
|
||||
PldInfo->Panel = ACPI_PLD_GET_PANEL (&Dword);
|
||||
PldInfo->VerticalPosition = ACPI_PLD_GET_VERTICAL (&Dword);
|
||||
PldInfo->HorizontalPosition = ACPI_PLD_GET_HORIZONTAL (&Dword);
|
||||
PldInfo->Shape = ACPI_PLD_GET_SHAPE (&Dword);
|
||||
PldInfo->GroupOrientation = ACPI_PLD_GET_ORIENTATION (&Dword);
|
||||
PldInfo->GroupToken = ACPI_PLD_GET_TOKEN (&Dword);
|
||||
PldInfo->GroupPosition = ACPI_PLD_GET_POSITION (&Dword);
|
||||
PldInfo->Bay = ACPI_PLD_GET_BAY (&Dword);
|
||||
|
||||
/* Fourth 32-bit DWord */
|
||||
|
||||
Buffer++;
|
||||
PldInfo->Ejectable = ACPI_PLD_GET_EJECTABLE (Buffer);
|
||||
PldInfo->OspmEjectRequired = ACPI_PLD_GET_OSPM_EJECT (Buffer);
|
||||
PldInfo->CabinetNumber = ACPI_PLD_GET_CABINET (Buffer);
|
||||
PldInfo->CardCageNumber = ACPI_PLD_GET_CARD_CAGE (Buffer);
|
||||
PldInfo->Reference = ACPI_PLD_GET_REFERENCE (Buffer);
|
||||
PldInfo->Rotation = ACPI_PLD_GET_ROTATION (Buffer);
|
||||
PldInfo->Order = ACPI_PLD_GET_ORDER (Buffer);
|
||||
ACPI_MOVE_32_TO_32 (&Dword, &Buffer[3]);
|
||||
PldInfo->Ejectable = ACPI_PLD_GET_EJECTABLE (&Dword);
|
||||
PldInfo->OspmEjectRequired = ACPI_PLD_GET_OSPM_EJECT (&Dword);
|
||||
PldInfo->CabinetNumber = ACPI_PLD_GET_CABINET (&Dword);
|
||||
PldInfo->CardCageNumber = ACPI_PLD_GET_CARD_CAGE (&Dword);
|
||||
PldInfo->Reference = ACPI_PLD_GET_REFERENCE (&Dword);
|
||||
PldInfo->Rotation = ACPI_PLD_GET_ROTATION (&Dword);
|
||||
PldInfo->Order = ACPI_PLD_GET_ORDER (&Dword);
|
||||
|
||||
if (Length >= ACPI_PLD_BUFFER_SIZE)
|
||||
{
|
||||
/* Fifth 32-bit DWord (Revision 2 of _PLD) */
|
||||
|
||||
Buffer++;
|
||||
PldInfo->VerticalOffset = ACPI_PLD_GET_VERT_OFFSET (Buffer);
|
||||
PldInfo->HorizontalOffset = ACPI_PLD_GET_HORIZ_OFFSET (Buffer);
|
||||
ACPI_MOVE_32_TO_32 (&Dword, &Buffer[4]);
|
||||
PldInfo->VerticalOffset = ACPI_PLD_GET_VERT_OFFSET (&Dword);
|
||||
PldInfo->HorizontalOffset = ACPI_PLD_GET_HORIZ_OFFSET (&Dword);
|
||||
}
|
||||
|
||||
*ReturnBuffer = PldInfo;
|
||||
|
Loading…
x
Reference in New Issue
Block a user