From eb5776f8f10a4dc13be52aacf272aff2763f2cba Mon Sep 17 00:00:00 2001 From: Goldfish64 Date: Sun, 8 Nov 2020 12:59:20 -0600 Subject: [PATCH] DxeIpl: Fallback to 0xCF9 for reset register --- Legacy/BootPlatform/DxeIpl/LegacyTable.c | 56 ++++++++++-------------- 1 file changed, 22 insertions(+), 34 deletions(-) diff --git a/Legacy/BootPlatform/DxeIpl/LegacyTable.c b/Legacy/BootPlatform/DxeIpl/LegacyTable.c index 9ce17cda..cb8d259d 100644 --- a/Legacy/BootPlatform/DxeIpl/LegacyTable.c +++ b/Legacy/BootPlatform/DxeIpl/LegacyTable.c @@ -306,43 +306,31 @@ PrepareFadtTable ( sizeof(EFI_ACPI_3_0_GENERIC_ADDRESS_STRUCTURE) ); } - if (Fadt->Header.Length >= OFFSET_OF (EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE, ResetValue) + sizeof (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; - } + + // + // Ensure FADT register information is valid and can be trusted before using. + // If not, use universal register settings. See AcpiFadtEnableReset() in OcAcpiLib. + // + if (Fadt->Header.Length >= OFFSET_OF (EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE, ResetValue) + sizeof (Fadt->ResetValue) + && 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 { // - // ** CHANGE START ** - // Otherwise fill with defaults. - // - AcpiDescription->RESET_REG.Address = 0x64; - 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 = 0xFE; - // - // ** CHANGE END ** + // 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; } //