From: Marcin Wojtas Date: Tue, 18 Sep 2018 08:59:07 +0000 (+0800) Subject: MdeModulePkg/SdMmcPciHcDxe: Execute card detect only for RemovableSlot X-Git-Tag: edk2-stable201903~1005 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=4cd9d7fc6f2ece01a46f2156ba009e83a2951907;hp=064d301fb07566ab6d3d89010b9666f320698f34;p=mirror_edk2.git MdeModulePkg/SdMmcPciHcDxe: Execute card detect only for RemovableSlot 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 --- diff --git a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.c b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.c index f923930bba..bf9869dbb5 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);