From: Andrei Warkentin <andrey.warken...@gmail.com>

For reasons that aren't entirely understood, SCR reads can randomly
fail on the Raspberry Pi 4. It can be on the first boot or during
subsequent reboots.

To alleviate this, and improve the overall behavior of the code,
we modify CheckCardsCallback () to retry InitializeMmcDevice ()
in case of failure.

Signed-off-by: Pete Batard <p...@akeo.ie>
---
 Platform/RaspberryPi/Drivers/MmcDxe/Mmc.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/Platform/RaspberryPi/Drivers/MmcDxe/Mmc.c 
b/Platform/RaspberryPi/Drivers/MmcDxe/Mmc.c
index c3c7279e4707..f6c4cc7bc3a3 100644
--- a/Platform/RaspberryPi/Drivers/MmcDxe/Mmc.c
+++ b/Platform/RaspberryPi/Drivers/MmcDxe/Mmc.c
@@ -2,6 +2,7 @@
  *
  *  Main file of the MMC Dxe driver. The driver entrypoint is defined into 
this file.
  *
+ *  Copyright (c) 2019, Andrei Warkentin <andrey.warken...@gmail.com>
  *  Copyright (c) 2011-2013, ARM Limited. All rights reserved.
  *
  *  SPDX-License-Identifier: BSD-2-Clause-Patent
@@ -367,7 +368,11 @@ CheckCardsCallback (
       MmcHostInstance->Initialized = !MmcHostInstance->Initialized;
 
       if (MmcHostInstance->BlockIo.Media->MediaPresent) {
-        InitializeMmcDevice (MmcHostInstance);
+        Status = InitializeMmcDevice (MmcHostInstance);
+        if (EFI_ERROR (Status)) {
+          MmcHostInstance->Initialized = !MmcHostInstance->Initialized;
+          continue;
+        }
       }
 
       Status = gBS->ReinstallProtocolInterface (
-- 
2.21.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#51338): https://edk2.groups.io/g/devel/message/51338
Mute This Topic: https://groups.io/mt/62504744/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to