From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f65.google.com (mail-wr1-f65.google.com [209.85.221.65]) by mx.groups.io with SMTP id smtpd.web10.4345.1575307002183637071 for ; Mon, 02 Dec 2019 09:16:42 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@akeo-ie.20150623.gappssmtp.com header.s=20150623 header.b=U9OvhRMn; spf=none, err=permanent DNS error (domain: akeo.ie, ip: 209.85.221.65, mailfrom: pete@akeo.ie) Received: by mail-wr1-f65.google.com with SMTP id q10so721wrm.11 for ; Mon, 02 Dec 2019 09:16:41 -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=U9OvhRMnlHpFjJ8rlDJoHv5FUvLnkecrA/rP0oz6Wx4vQTjTAXASDiw/IWUAZIYohB LxFQhmJr0T950KFlRfsxIYvjRVseFRiHmjJk0JdaM4nFysX1PMLHhB5/+RL3hWQZO6uy dvEABujJMACa0Ly7FkuTabTCX19k+k2dtdb2l3UJZl6m8RYQA+eOEC47+sxS83kfuShZ yM7ag7/tnEWzDfc1Ni+NipRWj+1FL+al1KPy8FX/XWrh3vKFIR4AdV3NWf8x94Dgzlnt XY+Cq8obvW+Ozk6niQ0+d0MQyjVaz0J+buNmru7BUe7By+7hjQukPw4Tb1ESp7bs5QXb CDmQ== 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=byjGZvCy8vkhOD2AoJ4fvlEdH1b1LFnziRDHgWUaW7lwLqpNQGjE7H8xAfuCFGHER9 AlrUj9VP35s2CO5P+1yeXp8JUK1AHg5iCETMb3ZBTNpNKvHXIYWIpHD7O4hWFWrn9vid ujGVxysr6/bqTLcbZWiLePW0udvEhhib9uwLXBwY2ONXVpk8C5vYio8wf5rAmSnq+gYO 96Nm2lY0S5OgZHdq/XXTRqTgKnzpOcP0ZhvvrgCXeBFeabM11eTUuBcCaejBjkWVJw/5 XlUFpxXjjuamFcN4INGENsrS9viH71adWWb4ICb6fps4gv4a8poUtAOfUZAV636BxTrE qHEw== X-Gm-Message-State: APjAAAWFI1G8a6ZFbQ+NDqm7n7LOzpplg7sK1kaDmWeVWi81Nay10K5y yoJ7ryZlC9Z8iTBsPDprdv5bXOUOMG4= X-Google-Smtp-Source: APXvYqztbcvon1rDSBnB9GV1+n1DjEunPqH3OO2p5KwF8AaigZGLaPJYUC8lv7Fd/JlESOxL9SSjdA== X-Received: by 2002:adf:fd91:: with SMTP id d17mr15992354wrr.340.1575307000270; Mon, 02 Dec 2019 09:16:40 -0800 (PST) Return-Path: Received: from localhost.localdomain ([84.203.45.230]) by smtp.gmail.com with ESMTPSA id 205sm496035wmb.3.2019.12.02.09.16.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 02 Dec 2019 09:16:39 -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 v2 2/3] Platform/RPi/MmcDxe: Improve MMC driver stability Date: Mon, 2 Dec 2019 17:16:21 +0000 Message-Id: <20191202171622.10980-3-pete@akeo.ie> X-Mailer: git-send-email 2.21.0.windows.1 In-Reply-To: <20191202171622.10980-1-pete@akeo.ie> References: <20191202171622.10980-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