EFI_STATUS Status;\r
UINT32 Ocr;\r
UINT32 Rca;\r
+ UINTN Retry;\r
\r
Status = EmmcPeimReset (Slot);\r
if (EFI_ERROR (Status)) {\r
return Status;\r
}\r
\r
- Ocr = 0;\r
+ Ocr = 0;\r
+ Retry = 0;\r
do {\r
Status = EmmcPeimGetOcr (Slot, &Ocr);\r
if (EFI_ERROR (Status)) {\r
DEBUG ((EFI_D_ERROR, "EmmcPeimIdentification: EmmcPeimGetOcr fails with %r\n", Status));\r
return Status;\r
}\r
+\r
+ if (Retry++ == 100) {\r
+ DEBUG ((EFI_D_ERROR, "EmmcPeimIdentification: EmmcPeimGetOcr fails too many times\n"));\r
+ return EFI_DEVICE_ERROR;\r
+ }\r
+ MicroSecondDelay (10 * 1000);\r
} while ((Ocr & BIT31) == 0);\r
\r
Status = EmmcPeimGetAllCid (Slot);\r