]> git.proxmox.com Git - mirror_edk2.git/commitdiff
For USB mass storage, READ_FORMAT_CAPACITIES command returns wrong value for USB2...
authorxli24 <xli24@6f19259b-4bc3-4df7-8a09-765794883524>
Sat, 30 Dec 2006 03:21:44 +0000 (03:21 +0000)
committerxli24 <xli24@6f19259b-4bc3-4df7-8a09-765794883524>
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.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2155 6f19259b-4bc3-4df7-8a09-765794883524

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

index 387c53a72d2e176858711e326d621ec727f87275..fc19930cbdc433a7029411d4bbdcf4941aca69c8 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 3d6a6d977b2e983ec759cac351c87378b91d1516..de61eeb6d0a3840c8f98af03563aef5d0dc1e477 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