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 <mw@semihalf.com>
Reviewed-by: Hao Wu <hao.a.wu@intel.com>
This commit is contained in:
Marcin Wojtas 2018-09-18 16:59:07 +08:00 committed by Hao Wu
parent 064d301fb0
commit 4cd9d7fc6f
1 changed files with 12 additions and 6 deletions

View File

@ -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);