From: Chuong Tran <chu...@os.amperecomputing.com> OS kernel with greater than or equal to 48-bit VA space avoids EFI's SetVirtualAddressMap() runtime service on Arm64 and simply uses the 1:1 address mapping that UEFI used at booting. However, AmpereAltraPkg's RuntimeFlashLib replies on function call SetVirtualAddressMap() to determine whether it is in boot time or run-time. If SetVirtualAddressMap() has not been called prior, it causes the kernel crash. This patch fixes that issue by removing the separation between UEFI boot time and run-time in RuntimeFlashLib.
Signed-off-by: Nhi Pham <n...@os.amperecomputing.com> --- Silicon/Ampere/AmpereAltraPkg/Library/FlashLib/FlashLibCommon.c | 11 +++-------- Silicon/Ampere/AmpereAltraPkg/Library/FlashLib/RuntimeFlashLib.c | 2 -- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/Silicon/Ampere/AmpereAltraPkg/Library/FlashLib/FlashLibCommon.c b/Silicon/Ampere/AmpereAltraPkg/Library/FlashLib/FlashLibCommon.c index 83695c857a11..0b000c2aad46 100644 --- a/Silicon/Ampere/AmpereAltraPkg/Library/FlashLib/FlashLibCommon.c +++ b/Silicon/Ampere/AmpereAltraPkg/Library/FlashLib/FlashLibCommon.c @@ -15,7 +15,6 @@ #include "FlashLibCommon.h" -BOOLEAN gFlashLibRuntime = FALSE; UINT8 *gFlashLibPhysicalBuffer; UINT8 *gFlashLibVirtualBuffer; @@ -34,13 +33,9 @@ ConvertToPhysicalBuffer ( IN UINT32 Size ) { - if (gFlashLibRuntime) { - ASSERT (VirtualPtr != NULL); - CopyMem (gFlashLibVirtualBuffer, VirtualPtr, Size); - return gFlashLibPhysicalBuffer; - } - - return VirtualPtr; + ASSERT (VirtualPtr != NULL); + CopyMem (gFlashLibVirtualBuffer, VirtualPtr, Size); + return gFlashLibPhysicalBuffer; } /** diff --git a/Silicon/Ampere/AmpereAltraPkg/Library/FlashLib/RuntimeFlashLib.c b/Silicon/Ampere/AmpereAltraPkg/Library/FlashLib/RuntimeFlashLib.c index 2dcd13e08146..14cef8e17ece 100644 --- a/Silicon/Ampere/AmpereAltraPkg/Library/FlashLib/RuntimeFlashLib.c +++ b/Silicon/Ampere/AmpereAltraPkg/Library/FlashLib/RuntimeFlashLib.c @@ -35,8 +35,6 @@ FlashLibAddressChangeEvent ( { gRT->ConvertPointer (0x0, (VOID **)&gFlashLibVirtualBuffer); gRT->ConvertPointer (0x0, (VOID **)&mMmCommunicationProtocol); - - gFlashLibRuntime = TRUE; } /** -- 2.25.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#120334): https://edk2.groups.io/g/devel/message/120334 Mute This Topic: https://groups.io/mt/107889187/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-