]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg/UsbMassStorageDxe: Fix USB Mass Storage detection
authorMichael D Kinney <michael.d.kinney@intel.com>
Mon, 30 Oct 2017 20:57:32 +0000 (13:57 -0700)
committerMichael D Kinney <michael.d.kinney@intel.com>
Wed, 15 Nov 2017 00:40:50 +0000 (16:40 -0800)
https://bugzilla.tianocore.org/show_bug.cgi?id=766

Update logic to not return an error from UsbBootRequestSense()
if a Request Sense command responds with no sense information.
It is legal for a USB mass storage device to respond to a
Request Sense command with a SenseKey of
USB_BOOT_SENSE_NO_SENSE and an Additional Sense
Code of USB_BOOT_ASC_NO_ADDITIONAL_SENSE_INFORMATION.

This is described in Section 3.3 of the Universal Serial
Bus Mass Storage Specification For Bootability:

http://www.usb.org/developers/docs/devclass_docs/usb_msc_boot_1.0.pdf

The previous logic returned an error of EFI_NO_RESPONSE
and this caused USB mass storage devices such as a USB
floppy drive to not be detected.

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
MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassBoot.h

index 0c46f888ebc84c041cb81a83ac2b087e5c87eb62..2eb30f0c5f5010843b0c74af99366415aee3660b 100644 (file)
@@ -2,7 +2,7 @@
   Implementation of the command set of USB Mass Storage Specification\r
   for Bootability, Revision 1.0.\r
 \r
   Implementation of the command set of USB Mass Storage Specification\r
   for Bootability, Revision 1.0.\r
 \r
-Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -80,7 +80,14 @@ UsbBootRequestSense (
   switch (USB_BOOT_SENSE_KEY (SenseData.SenseKey)) {\r
 \r
   case USB_BOOT_SENSE_NO_SENSE:\r
   switch (USB_BOOT_SENSE_KEY (SenseData.SenseKey)) {\r
 \r
   case USB_BOOT_SENSE_NO_SENSE:\r
-    Status = EFI_NO_RESPONSE;\r
+    if (SenseData.Asc == USB_BOOT_ASC_NO_ADDITIONAL_SENSE_INFORMATION) {\r
+      //\r
+      // It is not an error if a device does not have additional sense information\r
+      //\r
+      Status = EFI_SUCCESS;\r
+    } else {\r
+      Status = EFI_NO_RESPONSE;\r
+    }\r
     break;\r
 \r
   case USB_BOOT_SENSE_RECOVERED:\r
     break;\r
 \r
   case USB_BOOT_SENSE_RECOVERED:\r
index c4082558fa930c93ae9b22af5bc5d1e676570343..13a926035ceb4b6b5709ea3c86f6ea9b8134be5f 100644 (file)
@@ -2,7 +2,7 @@
   Definition of the command set of USB Mass Storage Specification\r
   for Bootability, Revision 1.0.\r
 \r
   Definition of the command set of USB Mass Storage Specification\r
   for Bootability, Revision 1.0.\r
 \r
-Copyright (c) 2007 - 2012, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -51,9 +51,10 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #define USB_BOOT_SENSE_VOLUME_OVERFLOW  0x0D ///< Partition overflow\r
 #define USB_BOOT_SENSE_MISCOMPARE       0x0E ///< Source data mis-match while verfying.\r
 \r
 #define USB_BOOT_SENSE_VOLUME_OVERFLOW  0x0D ///< Partition overflow\r
 #define USB_BOOT_SENSE_MISCOMPARE       0x0E ///< Source data mis-match while verfying.\r
 \r
-#define USB_BOOT_ASC_NOT_READY          0x04\r
-#define USB_BOOT_ASC_NO_MEDIA           0x3A\r
-#define USB_BOOT_ASC_MEDIA_CHANGE       0x28\r
+#define USB_BOOT_ASC_NO_ADDITIONAL_SENSE_INFORMATION  0x00\r
+#define USB_BOOT_ASC_NOT_READY                        0x04\r
+#define USB_BOOT_ASC_NO_MEDIA                         0x3A\r
+#define USB_BOOT_ASC_MEDIA_CHANGE                     0x28\r
 \r
 //\r
 // Supported PDT codes, or Peripheral Device Type\r
 \r
 //\r
 // Supported PDT codes, or Peripheral Device Type\r