mirror of
https://github.com/tianocore/edk2
synced 2026-08-27 00:23:19 -04:00
EmbeddedPkg: normalize mmc interaction latency to 1us
Upon inspecting the source code, I found that the original implementation of eMMC timeout in MmcDxe is affected by the CPU execution speed. With higher-performance CPUs, the actual timeout duration would be shortened as it was not based on wall clock. Add a precise 1us delay to each iteration of the wait loop to make the actual duration of the delay clock- and performance-agnostic. Signed-off-by: snowpiaoling <1972997989@qq.com>
This commit is contained in:
parent
c5aa7e7d94
commit
33dadb270b
2 changed files with 8 additions and 0 deletions
|
|
@ -210,6 +210,8 @@ MmcTransferBlock (
|
|||
break; // Prevents delay once finished
|
||||
}
|
||||
}
|
||||
|
||||
gBS->Stall (1);
|
||||
}
|
||||
|
||||
if (BufferSize > This->Media->BlockSize) {
|
||||
|
|
@ -323,6 +325,8 @@ MmcIoBlocks (
|
|||
if (!EFI_ERROR (Status)) {
|
||||
MmcHost->ReceiveResponse (MmcHost, MMC_RESPONSE_TYPE_R1, Response);
|
||||
}
|
||||
|
||||
gBS->Stall (1);
|
||||
}
|
||||
|
||||
if (0 == Timeout) {
|
||||
|
|
|
|||
|
|
@ -596,6 +596,10 @@ MmcIdentificationMode (
|
|||
return Status;
|
||||
}
|
||||
|
||||
if (!OcrResponse.Ocr.PowerUp) {
|
||||
gBS->Stall (1);
|
||||
}
|
||||
|
||||
Timeout--;
|
||||
} while (!OcrResponse.Ocr.PowerUp && (Timeout > 0));
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue