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::242; helo=mail-lj1-x242.google.com; envelope-from=mw@semihalf.com; receiver=edk2-devel@lists.01.org Received: from mail-lj1-x242.google.com (mail-lj1-x242.google.com [IPv6:2a00:1450:4864:20::242]) (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 8F1812194D387 for ; Fri, 7 Sep 2018 02:11:04 -0700 (PDT) Received: by mail-lj1-x242.google.com with SMTP id p6-v6so11712598ljc.5 for ; Fri, 07 Sep 2018 02:11:04 -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=iOYTyx+rSL7zOFILg9520XFCeRffyHOQT4A4uKIOaTLznLAAnSBln1F/joYbWN9Lv2 Z+mHe2pAFNOocS/jUFOpeuwscbbWY0SQDlhEUkNFXNtQJZNSBTStRR0Xw3hixOjv1Dzp 8gw/SYVJ5zTLyAs78tQ9dMA9EHdBOWjNP3+hGCcsm/ipnJgPjUtIDgQ39akkf5GZOoC0 fbzBaAO+XpqZ4sGyIRUO5y/dP8NB0x1ydnmLK0X8/jvPr/PjZtBp2+PfKL8EHH7k417K wr1jtjXAeNB+eujoeH5h8wEGEuaV9/jZl6tlRN0BV3gleR8E+tLdFhwXqeqmVTWukTI3 ExUg== 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=e9h4GJkmL2dDxFGIYVMbEzZw5uI6ixbIInEeJPqBUAzcN46XX3Svu4z3YDEx+SPgdt hZ+X+cmWqKI3na8DELvEbz9skd1FJRcMV5KtJ1tvBRRUgBwIrTQZ5UBMGgxT77z7gHY0 zlsWBWedCe5/M5RgFIdAETJc3kZbtFnMKid0CON5vptpJhew2cqDcG6VIa8fe7i8MMh3 NfjLeBUgExzm0mmq+sDZIt60HQukYOrIlAZ3lCu1xVjIix/BC6XoJvg2g+nDqn10E1ai 0OR+M1Q0B/uCxrat8dHFncPMS5f3Xi3XJsksc/YraGttUo/m3loT0gyroYXev7zN4m3J PXHw== X-Gm-Message-State: APzg51AQoMfOHx3D8pLYcaIgwN4Wd+IW+YkoszBG9jzWonSi4iaOTclt BpT9Mw1vRf697jOnZNkyH55PW6xiAow= X-Google-Smtp-Source: ANB0VdYVKkQQgPn/nfDLbp3cdRcsTWenqoNXtTwfmy0O5wgzm2KPqYk6D+vyXl10X5sS/UWNuLWHSA== X-Received: by 2002:a2e:92c4:: with SMTP id k4-v6mr4455146ljh.18.1536311462571; Fri, 07 Sep 2018 02:11:02 -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 q16-v6sm1197337ljj.68.2018.09.07.02.11.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 07 Sep 2018 02:11:01 -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, tm@semihalf.com Date: Fri, 7 Sep 2018 11:10:16 +0200 Message-Id: <1536311416-2751-5-git-send-email-mw@semihalf.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1536311416-2751-1-git-send-email-mw@semihalf.com> References: <1536311416-2751-1-git-send-email-mw@semihalf.com> Subject: [PATCH v2 4/4] 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: Fri, 07 Sep 2018 09:11:05 -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