From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f67.google.com (mail-wr1-f67.google.com [209.85.221.67]) by mx.groups.io with SMTP id smtpd.web12.5474.1574858248339824496 for ; Wed, 27 Nov 2019 04:37:28 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@akeo-ie.20150623.gappssmtp.com header.s=20150623 header.b=fQqZBHWK; spf=none, err=permanent DNS error (domain: akeo.ie, ip: 209.85.221.67, mailfrom: pete@akeo.ie) Received: by mail-wr1-f67.google.com with SMTP id w9so26549184wrr.0 for ; Wed, 27 Nov 2019 04:37:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=akeo-ie.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=s7XOcskGoINX2tl+PlIimea8zR1u67vc01I40SyDvyI=; b=fQqZBHWKhZBxBAyBqEh7sfXjCdqJLeOZNhnF0CSw3/bB5drgIKYa83QkPhAqRdx5Sn wh/4MFa1BVGwD749RrLOrzB8VJR7quupkTaIszcQjZPRGT8He2mCAPLjEyEcDMyNSuLp LAntI6wa4yM7JCPXXRGQMwFa9bg5ulNdE7ceK4HaVX0ThZcc+yhNN0sjir+fs0mz8Xg5 4stjVYU13wlyOrB21aynVhHZX2zdD2MBWhqHcdLab1UKJLiax1VN74DStAT3cu/DCP7N EzTHXNylPti8mgHn3XQaTvTyHglcHpiM+8eHPVAXB4JrHGxfECEe4x5h25voX79wTXku EiFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=s7XOcskGoINX2tl+PlIimea8zR1u67vc01I40SyDvyI=; b=I1v9j7FAz6qYtHJWBM1w0NkW7at2PzTAhnCs8J2uXeZzjarhkTGPFBo6Q/trEH/o4V JztXxMI0ECydnnd50IggWG8psQkqjqEploUM/1l6pR14/IHQ1aChiOVIUy9p3DfGe74i EVVfzTUEo8+43E7WaXf+AyqsJy5ttlwIiXJaiRLBfkTiWhIDKCBpaxCw/aO4eWqFpyIf fyWm+HGhxLX6lQhxH/pws6sjXyoIFyR/peSwlqGhNzZXhdQPOaRdfEbXYNT0oSksAPBT 6VlS4GiDA7sgKck6SwcOcHx49uoIjuDX8G953Wj9/824crkD2+w7pPnNGPSF6/wm34Ca 6Zrg== X-Gm-Message-State: APjAAAVJKRHAmkXPMoVtv7DxeBTDYXL+/SBTVbP3sICidk9Lc+pKAqDB vJmQVLig7E0VK/9Haof+rVE3UMpymcw= X-Google-Smtp-Source: APXvYqyfzUFqyJ0C0f4aMwAoMcRMrG/lmx9Ra03IY9qlAtFn52Fu3AuShMzb7XjVc23pHBiZafblbQ== X-Received: by 2002:adf:f282:: with SMTP id k2mr20210985wro.387.1574858246424; Wed, 27 Nov 2019 04:37:26 -0800 (PST) Return-Path: Received: from localhost.localdomain ([84.203.37.1]) by smtp.gmail.com with ESMTPSA id p9sm18847833wrs.55.2019.11.27.04.37.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 27 Nov 2019 04:37:25 -0800 (PST) From: "Pete Batard" To: devel@edk2.groups.io Cc: ard.biesheuvel@linaro.org, leif.lindholm@linaro.org, philmd@redhat.com, samer.el-haj-mahmoud@arm.com, andrey.warkentin@gmail.com Subject: [edk2-platforms][PATCH 4/5] Platform/RPi/MmcDxe: Improve MMC driver stability Date: Wed, 27 Nov 2019 12:37:05 +0000 Message-Id: <20191127123706.4604-5-pete@akeo.ie> X-Mailer: git-send-email 2.21.0.windows.1 In-Reply-To: <20191127123706.4604-1-pete@akeo.ie> References: <20191127123706.4604-1-pete@akeo.ie> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Andrei Warkentin 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 --- 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 * 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