]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg/UsbMassStorageDxe: Enhance Request Sense Handling
authorMichael D Kinney <michael.d.kinney@intel.com>
Tue, 14 Nov 2017 23:56:30 +0000 (15:56 -0800)
committerMichael D Kinney <michael.d.kinney@intel.com>
Fri, 17 Nov 2017 18:37:56 +0000 (10:37 -0800)
https://bugzilla.tianocore.org/show_bug.cgi?id=782

Update the Request Sense check for the Request Sense Key of
USB_BOOT_SENSE_UNIT_ATTENTION.  For this Sense Key, the
Additional Sense Key to EFI_STATUS mappings are:

USB_BOOT_ASC_MEDIA_CHANGE -> EFI_MEDIA_CHANGE
USB_BOOT_ASC_NOT_READY    -> EFI_NOT_READY
USB_BOOT_ASC_NO_MEDIA     -> EFI_NOT_READY
All others                -> EFI_DEVICE_ERROR

A USB flash drive is returning Request Sense Key of
USB_BOOT_SENSE_UNIT_ATTENTION and an Additional Sense Key of
USB_BOOT_ASC_NO_MEDIA for a few seconds before returning an
Additional Sense Key of USB_BOOT_ASC_MEDIA_CHANGE.

The current logic treats this initial Request Sense info as an
error and reties the command 5 times before failing completely.

With this change the USB Flash Drive works correctly.

Cc: Star Zeng <star.zeng@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassBoot.c

index 2eb30f0c5f5010843b0c74af99366415aee3660b..a8b6a1c5f13c9cca81490650ddb6c0a5ca013fa5 100644 (file)
@@ -120,6 +120,10 @@ UsbBootRequestSense (
       Status = EFI_MEDIA_CHANGED;\r
       Media->ReadOnly = FALSE;\r
       Media->MediaId++;\r
+    } else if (SenseData.Asc == USB_BOOT_ASC_NOT_READY) {\r
+      Status = EFI_NOT_READY;\r
+    } else if (SenseData.Asc == USB_BOOT_ASC_NO_MEDIA) {\r
+      Status = EFI_NOT_READY;\r
     }\r
     break;\r
 \r