X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=MdeModulePkg%2FBus%2FPci%2FSdMmcPciHcDxe%2FEmmcDevice.c;h=c5fd214307ff5658bd80b17115c32fe67167372d;hb=a829f08684e29ebb68009ff2bcbf9f8edaf4affa;hp=3f73194da7ff7041d029198e4569bd059fc5ac54;hpb=e27ccaba9050b11a10d82fd9a0dfdd87015bd710;p=mirror_edk2.git diff --git a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/EmmcDevice.c b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/EmmcDevice.c index 3f73194da7..c5fd214307 100755 --- a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/EmmcDevice.c +++ b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/EmmcDevice.c @@ -783,9 +783,6 @@ EmmcSwitchToHighSpeed ( HsTiming = 1; Status = EmmcSwitchClockFreq (PciIo, PassThru, Slot, Rca, HsTiming, ClockFreq); - if (EFI_ERROR (Status)) { - return Status; - } return Status; } @@ -1112,6 +1109,7 @@ EmmcIdentification ( EFI_SD_MMC_PASS_THRU_PROTOCOL *PassThru; UINT32 Ocr; UINT16 Rca; + UINTN Retry; PciIo = Private->PciIo; PassThru = &Private->PassThru; @@ -1122,7 +1120,8 @@ EmmcIdentification ( return Status; } - Ocr = 0; + Ocr = 0; + Retry = 0; do { Status = EmmcGetOcr (PassThru, Slot, &Ocr); if (EFI_ERROR (Status)) { @@ -1130,6 +1129,12 @@ EmmcIdentification ( return Status; } Ocr |= BIT30; + + if (Retry++ == 100) { + DEBUG ((DEBUG_VERBOSE, "EmmcIdentification: Executing Cmd1 fails too many times\n")); + return EFI_DEVICE_ERROR; + } + gBS->Stall(10 * 1000); } while ((Ocr & BIT31) == 0); Status = EmmcGetAllCid (PassThru, Slot);