From 2a3ca8bf7511dfd04eaf5617262895ccf9948709 Mon Sep 17 00:00:00 2001 From: Maurice Ma Date: Sun, 2 Feb 2020 22:32:28 -0800 Subject: [PATCH] Fix QEMU Flash read issue after erasing After erasing flash on QEMU, it needs to be returned to normal read state to allow normal read access. However, this is missing in current SBL QEMU SpiFlashLib. This patched added the code to switch back to read mode. It also fixed #552. Signed-off-by: Maurice Ma --- Silicon/QemuSocPkg/Library/SpiFlashLib/SpiFlashLib.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Silicon/QemuSocPkg/Library/SpiFlashLib/SpiFlashLib.c b/Silicon/QemuSocPkg/Library/SpiFlashLib/SpiFlashLib.c index 0191b7ad..e1238f50 100644 --- a/Silicon/QemuSocPkg/Library/SpiFlashLib/SpiFlashLib.c +++ b/Silicon/QemuSocPkg/Library/SpiFlashLib/SpiFlashLib.c @@ -406,5 +406,9 @@ SpiFlashErase ( Ptr += 0x1000; } + if (ByteCount > 0) { + *(Ptr - 1) = READ_ARRAY_CMD; + } + return EFI_SUCCESS; }