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::22e; helo=mail-lj1-x22e.google.com; envelope-from=mw@semihalf.com; receiver=edk2-devel@lists.01.org Received: from mail-lj1-x22e.google.com (mail-lj1-x22e.google.com [IPv6:2a00:1450:4864:20::22e]) (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 8928E21140802 for ; Tue, 18 Sep 2018 01:59:43 -0700 (PDT) Received: by mail-lj1-x22e.google.com with SMTP id m84-v6so1017842lje.10 for ; Tue, 18 Sep 2018 01:59:43 -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=KIIUktkFQ5xDEzIGdgbxcxRFdzH3rDKD/Y2T2hYFV+M=; b=B/k2MF4vFiKfhMjWK/P/slpvWaDO3QxgYn4JzHDMY5smOG7ySJ4gutOfwNguZCmKKJ 9ZVe0mIvP8tDv/UH3ymwxQ0QocM6mSwMClzn9o3Umlbum0nU7eIGoVrahNbEibzE6qla 4M7GVNhVB5rgv9/ldSzJY1Jp1yk1RxxJgAqyLLFJJwHTGERXqijHlkaqXGDsvFcJGjwS lPW6u4FXZKkoPs4Q4rypWykAvdOnG6FfM6zIrWbZC2Nu725UzQ6047sVuIZx9NsSl00y vBbvTyUVDOk/KsCxireNE2NDxO71TECv9MtgxxqY6K+PmFb1SOfQ4sjC4h3dqJBAUPjK 22hg== 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=KIIUktkFQ5xDEzIGdgbxcxRFdzH3rDKD/Y2T2hYFV+M=; b=YxVSBuG1VhJuLbFcAxFoDzK6hcWxjq2VV7shHoDhhXL8TCfbIq7VPI/ArCRnRzM/lf vg4i6IzaX7qIiQsi3YTL0Ta/jkZ7cnWxBOI5Y9zS9fCADkflhlpSZ2FLs/sk/awaOKSy oXXNj+iqRDS77KVuSsTAYwXhppG3QeEJPQSOKspelU783d3JU3e5rBjeg60DUwKndvGW GAu/H1iWU+3DZeYZJXfteIcF+DirLC8YK2rZ6geUP0Zz2FTZLiifHVfUpbI6SqyZcSY7 XWNE7X0egruXFAewX7znSpdme02mFaJGXg7nNT9kVg9oMxg1pyx14gAPJBNZz55AF3Kc lqeQ== X-Gm-Message-State: APzg51DwDdHxLSbBu4K8Ty80DvJoew3IecVs+7EMQm8VcElRqy47qUNk 2Y1oXagI0Hia2ZBaXGLPIJRPgMxiA4A= X-Google-Smtp-Source: ANB0Vdav3L0OOmXNwVEhCyQasSIDyx/VjLnHeRCXEy8tRglaPo/2Enfi9fgJ/X/HUA+3z8FZk8eYIw== X-Received: by 2002:a2e:9883:: with SMTP id b3-v6mr17594633ljj.80.1537261181025; Tue, 18 Sep 2018 01:59:41 -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 l141-v6sm340518lfg.55.2018.09.18.01.59.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 18 Sep 2018 01:59:40 -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: Tue, 18 Sep 2018 10:59:07 +0200 Message-Id: <1537261147-7214-3-git-send-email-mw@semihalf.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1537261147-7214-1-git-send-email-mw@semihalf.com> References: <1537261147-7214-1-git-send-email-mw@semihalf.com> Subject: [PATCH v4 2/2] 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: Tue, 18 Sep 2018 08:59:44 -0000 REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1182 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 Reviewed-by: Hao Wu --- 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