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::142; helo=mail-lf1-x142.google.com; envelope-from=mw@semihalf.com; receiver=edk2-devel@lists.01.org Received: from mail-lf1-x142.google.com (mail-lf1-x142.google.com [IPv6:2a00:1450:4864:20::142]) (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 567A9211350FC for ; Sat, 15 Sep 2018 15:26:09 -0700 (PDT) Received: by mail-lf1-x142.google.com with SMTP id g24-v6so5379139lfb.11 for ; Sat, 15 Sep 2018 15:26:09 -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=eo6m65lU7R8FrregEnSG6Qm7JS/n3e2fNfUBWbZrJWo=; b=Pt9aw22fiAxs7K2V8HufMzj+atWtgSN66m1DpNEY3lndLk+Z3CzGEUe/TaByK9KzlE XySki7uyy/z/yQe+rcmSZjwrKgAxxYxDraOS9UzW6jBNOzowwmRHl7RKgKyqJ/NGp/Gw VHQi1qzaaFr6Krb3b6b9prz69pYuduK2c0sFCSQgjMGIZkrBYCv7v6BYQaa1IGWzJqiE 6kXDvx4FIktRdxBADRL9RcQUq66m7GumfztGAHyocXwZvtC9N7ZiTkSWV8Gzz0sqsuaY TLIowqNAjUNffSwCoCbvHOUKCACSS0v77YgClzb+UMxeAA+g4b4rRbiv+BSPSOwaGKg1 PntQ== 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=eo6m65lU7R8FrregEnSG6Qm7JS/n3e2fNfUBWbZrJWo=; b=c3BevfhZGSb8bkLLxWE/JMxP18JgUX36xUTeLQ+sT+zZ8rz5sCsMRRMLiLGTzWIAbY PKgkOAgEw1HK99naoEyL3W65dyTIH+BRftWhDpqKXR76LnntKJm67wVeQ3Z2eIsg7pX6 qkVDuyNZijbh0PbM5ZL3P3Ca0sUnP1a3aygyaQcHUynPFbNd1wr/2vICWr4XGAoz0NY4 sRnq7h5CCvtvb+cCVaCaDWJaoUYYyP1/3Vm/rmCjGglpy1MCLNgNgktPenSpEvfKztsM iNFmzisA2cWIf8/lSzuPMLhP/FmCn3UjS73pA8LvRG1pe9k07Qe34RF/PIPB6DPgK1QT ptXg== X-Gm-Message-State: APzg51CYqSc8TSVT7pym4S6t08Ycr6wl99YKJjHyDjkcIwRKbHUwE5KT OVTGQmAL+s1AXZFzoL8W4GhV3d4Mtbk= X-Google-Smtp-Source: ANB0VdYSZ1eJVBGIP1BZmQrbY0DVw7B1YtBdhTo8evwP09jdPa5l9GIfqE/XeADy9O23Y5YC/glfFg== X-Received: by 2002:ac2:4218:: with SMTP id y24-v6mr2477274lfh.6.1537050367384; Sat, 15 Sep 2018 15:26:07 -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 c2-v6sm2044974lfg.45.2018.09.15.15.26.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 15 Sep 2018 15:26:06 -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, hao.a.wu@intel.com, ard.biesheuvel@linaro.org, nadavh@marvell.com, mw@semihalf.com, jsd@semihalf.com, tm@semihalf.com Date: Sun, 16 Sep 2018 00:25:46 +0200 Message-Id: <1537050346-16445-4-git-send-email-mw@semihalf.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1537050346-16445-1-git-send-email-mw@semihalf.com> References: <1537050346-16445-1-git-send-email-mw@semihalf.com> Subject: [PATCH v3 3/3] 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: Sat, 15 Sep 2018 22:26:09 -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 f923930..bf9869d 100644 --- a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.c +++ b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.c @@ -661,12 +661,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