For USB mass storage, READ_FORMAT_CAPACITIES command returns wrong value for USB2...
authorxli24 <xli24@de2fecce-e211-0410-80a6-f3fac2684e05>
Sat, 30 Dec 2006 03:21:44 +0000 (03:21 +0000)
committerxli24 <xli24@de2fecce-e211-0410-80a6-f3fac2684e05>
Sat, 30 Dec 2006 03:21:44 +0000 (03:21 +0000)
In order to fix this issue, we change the retry policy. Try old command before new command.

git-svn-id: https://edk2.tianocore.org/svn/edk2/trunk@2155 de2fecce-e211-0410-80a6-f3fac2684e05

edk2/EdkModulePkg/Bus/Usb/UsbMassStorage/Dxe/UsbMassStorage.h
edk2/EdkModulePkg/Bus/Usb/UsbMassStorage/Dxe/UsbMassStorageHelper.c

index 387c53a..fc19930 100644 (file)
@@ -33,8 +33,8 @@ Revision History
 #define PROTOCOL_CBI0             0\r
 #define PROTOCOL_CBI1             1\r
 \r
-#define USBFLOPPY                 1\r
-#define USBFLOPPY2                2 // for those that use ReadCapacity(0x25) command to retrieve media capacity\r
+#define USBFLOPPY                 1 // for those that use ReadCapacity(0x25) command to retrieve media capacity\r
+#define USBFLOPPY2                2 // for those that use ReadFormatCapacity(0x23) command to retrieve media capacity\r
 #define USBCDROM                  3\r
 \r
 #define USB_FLOPPY_DEV_SIGNATURE  EFI_SIGNATURE_32 ('u', 'f', 'l', 'p')\r
index 3d6a6d9..de61eeb 100644 (file)
@@ -999,26 +999,26 @@ UsbFloppyDetectMedia (
         Status = USBFloppyReadCapacity (UsbFloppyDevice);\r
         break;\r
 \r
-      case USBFLOPPY:\r
+      case USBFLOPPY2:\r
         UsbMassStorageModeSense (UsbFloppyDevice);\r
         Status = USBFloppyReadFormatCapacity (UsbFloppyDevice);\r
         if (EFI_ERROR (Status) || !UsbFloppyDevice->BlkMedia.MediaPresent) {\r
           //\r
           // retry the ReadCapacity command\r
           //\r
-          UsbFloppyDevice->DeviceType = USBFLOPPY2;\r
+          UsbFloppyDevice->DeviceType = USBFLOPPY;\r
           Status                      = EFI_DEVICE_ERROR;\r
         }\r
         break;\r
 \r
-      case USBFLOPPY2:\r
+      case USBFLOPPY:\r
         UsbMassStorageModeSense (UsbFloppyDevice);\r
         Status = USBFloppyReadCapacity (UsbFloppyDevice);\r
         if (EFI_ERROR (Status)) {\r
           //\r
           // retry the ReadFormatCapacity command\r
           //\r
-          UsbFloppyDevice->DeviceType = USBFLOPPY;\r
+          UsbFloppyDevice->DeviceType = USBFLOPPY2;\r
         }\r
         //\r
         // force the BlockSize to be 0x200.\r