Skip to content

Commit

Permalink
DxeIpl: Fix ACPI reset register detection
Browse files Browse the repository at this point in the history
  • Loading branch information
Goldfish64 committed Jul 10, 2020
1 parent 748b0ea commit f6ceca9
Showing 1 changed file with 23 additions and 7 deletions.
30 changes: 23 additions & 7 deletions Legacy/BootPlatform/DxeIpl/LegacyTable.c
Original file line number Diff line number Diff line change
Expand Up @@ -307,12 +307,28 @@ PrepareFadtTable (
);
}
if (Fadt->Header.Length >= OFFSET_OF (EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE, ResetValue) + sizeof (Fadt->ResetValue)) {
CopyMem (
&AcpiDescription->RESET_REG,
&Fadt->ResetReg,
sizeof(EFI_ACPI_3_0_GENERIC_ADDRESS_STRUCTURE)
);
AcpiDescription->RESET_VALUE = Fadt->ResetValue;
//
// Ensure FADT register information is valid and can be trusted before using.
// If not, use universal register settings. See AcpiFadtEnableReset() in OcAcpiLib.
//
if (Fadt->ResetReg.Address != 0 && Fadt->ResetReg.RegisterBitWidth == 8) {
CopyMem (
&AcpiDescription->RESET_REG,
&Fadt->ResetReg,
sizeof(EFI_ACPI_3_0_GENERIC_ADDRESS_STRUCTURE)
);
AcpiDescription->RESET_VALUE = Fadt->ResetValue;
} else {
//
// Use mostly universal default of 0xCF9.
//
AcpiDescription->RESET_REG.Address = 0xCF9;
AcpiDescription->RESET_REG.AddressSpaceId = EFI_ACPI_3_0_SYSTEM_IO;
AcpiDescription->RESET_REG.RegisterBitWidth = 8;
AcpiDescription->RESET_REG.RegisterBitOffset = 0;
AcpiDescription->RESET_REG.AccessSize = EFI_ACPI_3_0_BYTE;
AcpiDescription->RESET_VALUE = 6;
}
} else {
//
// ** CHANGE START **
Expand All @@ -322,7 +338,7 @@ PrepareFadtTable (
AcpiDescription->RESET_REG.AddressSpaceId = EFI_ACPI_3_0_SYSTEM_IO;
AcpiDescription->RESET_REG.RegisterBitWidth = 8;
AcpiDescription->RESET_REG.RegisterBitOffset = 0;
AcpiDescription->RESET_REG.AccessSize = 1;
AcpiDescription->RESET_REG.AccessSize = EFI_ACPI_3_0_BYTE;
AcpiDescription->RESET_VALUE = 0xFE;
//
// ** CHANGE END **
Expand Down

0 comments on commit f6ceca9

Please sign in to comment.