From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: None (no SPF record) identity=mailfrom; client-ip=2a00:1450:4864:20::12f; helo=mail-lf1-x12f.google.com; envelope-from=mw@semihalf.com; receiver=edk2-devel@lists.01.org Received: from mail-lf1-x12f.google.com (mail-lf1-x12f.google.com [IPv6:2a00:1450:4864:20::12f]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 6A32A21BADAB6 for ; Sun, 2 Sep 2018 21:54:38 -0700 (PDT) Received: by mail-lf1-x12f.google.com with SMTP id e23-v6so14103918lfc.13 for ; Sun, 02 Sep 2018 21:54:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=pG5q9h+2NTEZCXfyHf4auXIySZhbbMnlqNqVAaWRuyU=; b=ZD9iKsAAtEI7FBgzMZVAa17gJvECuEwtLrRHEE49JNa7Km18KNO5TLz42q/eWhKcL5 qfxVAu1PZQpJMalzR91nAfc7Sj2u5I2JsN3HC8E0qu4WC0Ws7kNnRoKlpVp7k3rkVbGg UYnEna0ds2KZICQM5SZGDsAocP/q3wHAu1Sov2I4IiNJ0W2K8RArEN27nWho2g5ez1MA aJ0Jq+3/dVxoJmiYgHMS0tpIyZyr6OV/8BEutXGefY14x+skoyVOCy8DSfXivcKHkRK8 1H36nKRyOTS1081g85hB1A1TKZDJgk/jw8RiOaVMdF77soYzkZtBk/LM4LsE3k61TFQ0 QdkA== 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; bh=pG5q9h+2NTEZCXfyHf4auXIySZhbbMnlqNqVAaWRuyU=; b=job6QZoxxR382o24GHwvkXWgt046PpTzYsrVe/Wy33M6BTynaA3kmuqhLyIYLQuhKg wY1pmxkbbQxxkyBqN+Yv+8ARNyffb6k4u5Ca0//+aj+at4bFTf/Hi4d0bcAoajFxlcE5 D5b8sGzbLIdZUKoVt1m0w0yLferzCpWgMVLXZDDFJ3rxF8kV9gSrflBRSwRG5FM9MCKI TIe3ZfBGxir4KvspQUppgUv5Hxfj+jfFtZWXUavXOAg7s9s9QwyXC9DvRsHdZ/eKGnBn AM6hUYes3Icc5LboQw1EdxwnFkSnmtySNsOCpUvEQQ3iryzC4s/FuTD/RLRb//y43GxG CVFg== X-Gm-Message-State: APzg51BKcl8yq9eKUkfiPG99w17ZT+jH7bSvdEcfW0tAnCvJjNgmgIeE x+je5eG58m3Kemds5CHdJ3kEKgFHbTU= X-Google-Smtp-Source: ANB0VdaWUTD0gfd0mr5GA/zFaGmwEeaK8qzoDp4q5vgw60+X5oiadPxyEZikfz/4sbCqszureeUwRg== X-Received: by 2002:a19:5353:: with SMTP id h80-v6mr17280610lfb.9.1535950476400; Sun, 02 Sep 2018 21:54:36 -0700 (PDT) Received: from gilgamesh.semihalf.com (31-172-191-173.noc.fibertech.net.pl. [31.172.191.173]) by smtp.gmail.com with ESMTPSA id h16-v6sm3196658ljh.26.2018.09.02.21.54.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 02 Sep 2018 21:54:35 -0700 (PDT) From: Marcin Wojtas To: edk2-devel@lists.01.org Cc: feng.tian@intel.com, michael.d.kinney@intel.com, liming.gao@intel.com, leif.lindholm@linaro.org, ard.biesheuvel@linaro.org, nadavh@marvell.com, mw@semihalf.com, jsd@semihalf.com Date: Mon, 3 Sep 2018 06:54:13 +0200 Message-Id: <1535950453-27147-8-git-send-email-mw@semihalf.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1535950453-27147-1-git-send-email-mw@semihalf.com> References: <1535950453-27147-1-git-send-email-mw@semihalf.com> Subject: [PATCH 7/7] MdeModulePkg/SdMmcPciHcDxe: Execute card detect only for RemovableSlot X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Sep 2018 04:54:38 -0000 Some devices can be non removable (such as eMMC) and checking Present State Register on host controller may falsely return an information that device is not present. Execute this check conditionally on the SloType field value. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Marcin Wojtas --- MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.c b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.c index 50c1e74..174efa9 100644 --- a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.c +++ b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.c @@ -678,12 +678,18 @@ SdMmcPciHcDriverBindingStart ( // // Check whether there is a SD/MMC card attached // - Status = SdMmcHcCardDetect (PciIo, Slot, &MediaPresent); - if (EFI_ERROR (Status) && (Status != EFI_MEDIA_CHANGED)) { - continue; - } else if (!MediaPresent) { - DEBUG ((DEBUG_INFO, "SdMmcHcCardDetect: No device attached in Slot[%d]!!!\n", Slot)); - continue; + if (Private->Slot[Slot].SlotType == RemovableSlot) { + Status = SdMmcHcCardDetect (PciIo, Slot, &MediaPresent); + if (EFI_ERROR (Status) && (Status != EFI_MEDIA_CHANGED)) { + continue; + } else if (!MediaPresent) { + DEBUG (( + DEBUG_INFO, + "SdMmcHcCardDetect: No device attached in Slot[%d]!!!\n", + Slot + )); + continue; + } } Status = SdMmcHcInitHost (Private, Slot); -- 2.7.4