MdeModulePkg/UsbMass: Retry CMD for MediaChanged sense key
When a USB device reports failure for a CMD and REQUEST SENSE returns Media Changed key, UsbBootExecCmdWithRetry() stops to retry CMD and returns EFI_MEDIA_CHANGED to caller. For this case, the CMD should be retried until success, getting NoMedia sense key or timeout. The patch updates UsbBootExecCmdWithRetry() to follow the above rule so EFI_MEDIA_CHANGED is no longer returned. UsbBootDetectMedia() is updated accordingly. Because UsbBootGetParams() is called for new plugged USB storage, and some USB storage devices may report Media Changed key, UsbBootGetParams() is updated to treat it as a Success. This change could fix the issue that some USB storage devices cannot be detected. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Star Zeng <star.zeng@intel.com>
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
/** @file
|
||||
USB Mass Storage Driver that manages USB Mass Storage Device and produces Block I/O Protocol.
|
||||
|
||||
Copyright (c) 2007 - 2015, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
@@ -361,6 +361,14 @@ UsbMassInitMedia (
|
||||
Media->MediaId = 1;
|
||||
|
||||
Status = UsbBootGetParams (UsbMass);
|
||||
DEBUG ((DEBUG_INFO, "UsbMassInitMedia: UsbBootGetParams (%r)\n", Status));
|
||||
if (Status == EFI_MEDIA_CHANGED) {
|
||||
//
|
||||
// Some USB storage devices may report MEDIA_CHANGED sense key when hot-plugged.
|
||||
// Treat it as SUCCESS
|
||||
//
|
||||
Status = EFI_SUCCESS;
|
||||
}
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user