diff --git a/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibCore.c b/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibCore.c index b83373d4b5..64386aac1e 100644 --- a/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibCore.c +++ b/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibCore.c @@ -568,6 +568,11 @@ ArmConfigureMmu ( UINT64 TCR; EFI_STATUS Status; + ASSERT (ArmReadCurrentEL () < AARCH64_EL3); + if (ArmReadCurrentEL () == AARCH64_EL3) { + return EFI_UNSUPPORTED; + } + if (MemoryTable == NULL) { ASSERT (MemoryTable != NULL); return EFI_INVALID_PARAMETER; @@ -617,7 +622,7 @@ ArmConfigureMmu ( ASSERT (0); // Bigger than 48-bit memory space are not supported return EFI_UNSUPPORTED; } - } else if (ArmReadCurrentEL () == AARCH64_EL1) { + } else { // Due to Cortex-A57 erratum #822227 we must set TG1[1] == 1, regardless of EPD1. TCR = T0SZ | TCR_TG0_4KB | TCR_TG1_4KB | TCR_EPD1; @@ -643,9 +648,6 @@ ArmConfigureMmu ( ASSERT (0); // Bigger than 48-bit memory space are not supported return EFI_UNSUPPORTED; } - } else { - ASSERT (0); // UEFI is only expected to run at EL2 and EL1, not EL3. - return EFI_UNSUPPORTED; } //