mirror of
https://github.com/tianocore/edk2
synced 2026-08-27 00:23:19 -04:00
MdeModulePkg/UsbMassStorageDxe: Report blank optical media as media absent
A blank (unwritten) optical disc reports a zero capacity through READ CAPACITY (LastBlock == 0). The driver currently exposes such a device with BlockSize 2048 and LastBlock 0, so upper layers such as PartitionDxe and the BDS removable-media boot probe keep reading LBA 0. The drive rejects the read with "Illegal Request / LBA out of range" (sense 5/21/0) and UsbMassReadBlocks enters its reset recovery loop. So each failed probe can block for tens of seconds and boot appears to hang. Treat an optical device with zero capacity as media absent so that the media is skipped instead of being probed. Signed-off-by: Haword <zhenghaowei@loongson.cn>
This commit is contained in:
parent
7735ed4f8e
commit
4d02d548bc
1 changed files with 11 additions and 0 deletions
|
|
@ -722,6 +722,17 @@ UsbBootDetectMedia (
|
|||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_ERROR, "UsbBootDetectMedia: UsbBootReadCapacity (%r)\n", Status));
|
||||
}
|
||||
|
||||
if (UsbMass->OpticalStorage && (Media->LastBlock == 0)) {
|
||||
//
|
||||
// A blank (unwritten) optical disc reports a zero capacity: there is no
|
||||
// user data block that can be read. Report the media as absent so that
|
||||
// upper layers (e.g. PartitionDxe and the BDS boot option probe) skip it
|
||||
// instead of repeatedly reading LBA 0 and getting "LBA out of range".
|
||||
//
|
||||
Media->MediaPresent = FALSE;
|
||||
Status = EFI_NO_MEDIA;
|
||||
}
|
||||
}
|
||||
|
||||
if (EFI_ERROR (Status) && (Status != EFI_NO_MEDIA)) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue