mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-27 07:34:06 +02:00
OvmfPkg/AcpiPlatformDxe: split S3/S4 package into bytes
This should be more compatible with AML parsers in practice since older versions of ACPICA's OS support would not accept the previous OVMF format (despite being spec compliant). (For example, on OpenBSD 5.2 it caused a kernel crash) ACPICA has fixed this issue in: https://github.com/otcshare/acpica/commit/5869690a Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Tested-by: David Woodhouse <David.Woodhouse@intel.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@14130 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
54c9a68d9c
commit
3d80db51f4
@ -199,6 +199,11 @@ typedef struct {
|
|||||||
PCI_WINDOW PciWindow64;
|
PCI_WINDOW PciWindow64;
|
||||||
} FIRMWARE_DATA;
|
} FIRMWARE_DATA;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
UINT8 BytePrefix;
|
||||||
|
UINT8 ByteValue;
|
||||||
|
} AML_BYTE;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
UINT8 NameOp;
|
UINT8 NameOp;
|
||||||
UINT8 RootChar;
|
UINT8 RootChar;
|
||||||
@ -206,10 +211,9 @@ typedef struct {
|
|||||||
UINT8 PackageOp;
|
UINT8 PackageOp;
|
||||||
UINT8 PkgLength;
|
UINT8 PkgLength;
|
||||||
UINT8 NumElements;
|
UINT8 NumElements;
|
||||||
UINT8 DWordPrefix;
|
AML_BYTE Pm1aCntSlpTyp;
|
||||||
UINT8 Pm1aCntSlpTyp;
|
AML_BYTE Pm1bCntSlpTyp;
|
||||||
UINT8 Pm1bCntSlpTyp;
|
AML_BYTE Reserved[2];
|
||||||
UINT8 Reserved[2];
|
|
||||||
} SYSTEM_STATE_PACKAGE;
|
} SYSTEM_STATE_PACKAGE;
|
||||||
|
|
||||||
#pragma pack()
|
#pragma pack()
|
||||||
@ -326,12 +330,14 @@ GetSuspendStates (
|
|||||||
'\\', // RootChar
|
'\\', // RootChar
|
||||||
{ '_', 'S', 'x', '_' }, // NameChar[4]
|
{ '_', 'S', 'x', '_' }, // NameChar[4]
|
||||||
0x12, // PackageOp
|
0x12, // PackageOp
|
||||||
0x07, // PkgLength
|
0x0A, // PkgLength
|
||||||
0x01, // NumElements
|
0x04, // NumElements
|
||||||
0x0c, // DWordPrefix
|
{ 0x0A, 0x00 }, // Pm1aCntSlpTyp
|
||||||
0x00, // Pm1aCntSlpTyp
|
{ 0x0A, 0x00 }, // Pm1bCntSlpTyp -- we don't support it
|
||||||
0x00, // Pm1bCntSlpTyp -- we don't support it
|
{ // Reserved[2]
|
||||||
{ 0x00, 0x00 } // Reserved
|
{ 0x0A, 0x00 },
|
||||||
|
{ 0x0A, 0x00 }
|
||||||
|
}
|
||||||
};
|
};
|
||||||
RETURN_STATUS Status;
|
RETURN_STATUS Status;
|
||||||
FIRMWARE_CONFIG_ITEM FwCfgItem;
|
FIRMWARE_CONFIG_ITEM FwCfgItem;
|
||||||
@ -344,12 +350,12 @@ GetSuspendStates (
|
|||||||
*SuspendToRamSize = sizeof Template;
|
*SuspendToRamSize = sizeof Template;
|
||||||
CopyMem (SuspendToRam, &Template, sizeof Template);
|
CopyMem (SuspendToRam, &Template, sizeof Template);
|
||||||
SuspendToRam->NameChar[2] = '3'; // S3
|
SuspendToRam->NameChar[2] = '3'; // S3
|
||||||
SuspendToRam->Pm1aCntSlpTyp = 1; // PIIX4: STR
|
SuspendToRam->Pm1aCntSlpTyp.ByteValue = 1; // PIIX4: STR
|
||||||
|
|
||||||
*SuspendToDiskSize = sizeof Template;
|
*SuspendToDiskSize = sizeof Template;
|
||||||
CopyMem (SuspendToDisk, &Template, sizeof Template);
|
CopyMem (SuspendToDisk, &Template, sizeof Template);
|
||||||
SuspendToDisk->NameChar[2] = '4'; // S4
|
SuspendToDisk->NameChar[2] = '4'; // S4
|
||||||
SuspendToDisk->Pm1aCntSlpTyp = 2; // PIIX4: POSCL
|
SuspendToDisk->Pm1aCntSlpTyp.ByteValue = 2; // PIIX4: POSCL
|
||||||
|
|
||||||
//
|
//
|
||||||
// check for overrides
|
// check for overrides
|
||||||
@ -368,16 +374,20 @@ GetSuspendStates (
|
|||||||
// value to be written to the PM control register's SUS_TYP bits.
|
// value to be written to the PM control register's SUS_TYP bits.
|
||||||
//
|
//
|
||||||
if (SystemStates[3] & BIT7) {
|
if (SystemStates[3] & BIT7) {
|
||||||
SuspendToRam->Pm1aCntSlpTyp = SystemStates[3] & (BIT2 | BIT1 | BIT0);
|
SuspendToRam->Pm1aCntSlpTyp.ByteValue =
|
||||||
DEBUG ((DEBUG_INFO, "ACPI S3 value: %d\n", SuspendToRam->Pm1aCntSlpTyp));
|
SystemStates[3] & (BIT2 | BIT1 | BIT0);
|
||||||
|
DEBUG ((DEBUG_INFO, "ACPI S3 value: %d\n",
|
||||||
|
SuspendToRam->Pm1aCntSlpTyp.ByteValue));
|
||||||
} else {
|
} else {
|
||||||
*SuspendToRamSize = 0;
|
*SuspendToRamSize = 0;
|
||||||
DEBUG ((DEBUG_INFO, "ACPI S3 disabled\n"));
|
DEBUG ((DEBUG_INFO, "ACPI S3 disabled\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SystemStates[4] & BIT7) {
|
if (SystemStates[4] & BIT7) {
|
||||||
SuspendToDisk->Pm1aCntSlpTyp = SystemStates[4] & (BIT2 | BIT1 | BIT0);
|
SuspendToDisk->Pm1aCntSlpTyp.ByteValue =
|
||||||
DEBUG ((DEBUG_INFO, "ACPI S4 value: %d\n", SuspendToDisk->Pm1aCntSlpTyp));
|
SystemStates[4] & (BIT2 | BIT1 | BIT0);
|
||||||
|
DEBUG ((DEBUG_INFO, "ACPI S4 value: %d\n",
|
||||||
|
SuspendToDisk->Pm1aCntSlpTyp.ByteValue));
|
||||||
} else {
|
} else {
|
||||||
*SuspendToDiskSize = 0;
|
*SuspendToDiskSize = 0;
|
||||||
DEBUG ((DEBUG_INFO, "ACPI S4 disabled\n"));
|
DEBUG ((DEBUG_INFO, "ACPI S4 disabled\n"));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user