From ea78388e1a314c78eb03814a5f9c78e8d3bfb140 Mon Sep 17 00:00:00 2001 From: xli24 Date: Sat, 30 Dec 2006 03:21:44 +0000 Subject: For USB mass storage, READ_FORMAT_CAPACITIES command returns wrong value for USB2.0 device. 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 | 4 ++-- EdkModulePkg/Bus/Usb/UsbMassStorage/Dxe/UsbMassStorageHelper.c | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'EdkModulePkg') diff --git a/EdkModulePkg/Bus/Usb/UsbMassStorage/Dxe/UsbMassStorage.h b/EdkModulePkg/Bus/Usb/UsbMassStorage/Dxe/UsbMassStorage.h index 387c53a72d..fc19930cbd 100644 --- a/EdkModulePkg/Bus/Usb/UsbMassStorage/Dxe/UsbMassStorage.h +++ b/EdkModulePkg/Bus/Usb/UsbMassStorage/Dxe/UsbMassStorage.h @@ -33,8 +33,8 @@ Revision History #define PROTOCOL_CBI0 0 #define PROTOCOL_CBI1 1 -#define USBFLOPPY 1 -#define USBFLOPPY2 2 // for those that use ReadCapacity(0x25) command to retrieve media capacity +#define USBFLOPPY 1 // for those that use ReadCapacity(0x25) command to retrieve media capacity +#define USBFLOPPY2 2 // for those that use ReadFormatCapacity(0x23) command to retrieve media capacity #define USBCDROM 3 #define USB_FLOPPY_DEV_SIGNATURE EFI_SIGNATURE_32 ('u', 'f', 'l', 'p') diff --git a/EdkModulePkg/Bus/Usb/UsbMassStorage/Dxe/UsbMassStorageHelper.c b/EdkModulePkg/Bus/Usb/UsbMassStorage/Dxe/UsbMassStorageHelper.c index 3d6a6d977b..de61eeb6d0 100644 --- a/EdkModulePkg/Bus/Usb/UsbMassStorage/Dxe/UsbMassStorageHelper.c +++ b/EdkModulePkg/Bus/Usb/UsbMassStorage/Dxe/UsbMassStorageHelper.c @@ -999,26 +999,26 @@ UsbFloppyDetectMedia ( Status = USBFloppyReadCapacity (UsbFloppyDevice); break; - case USBFLOPPY: + case USBFLOPPY2: UsbMassStorageModeSense (UsbFloppyDevice); Status = USBFloppyReadFormatCapacity (UsbFloppyDevice); if (EFI_ERROR (Status) || !UsbFloppyDevice->BlkMedia.MediaPresent) { // // retry the ReadCapacity command // - UsbFloppyDevice->DeviceType = USBFLOPPY2; + UsbFloppyDevice->DeviceType = USBFLOPPY; Status = EFI_DEVICE_ERROR; } break; - case USBFLOPPY2: + case USBFLOPPY: UsbMassStorageModeSense (UsbFloppyDevice); Status = USBFloppyReadCapacity (UsbFloppyDevice); if (EFI_ERROR (Status)) { // // retry the ReadFormatCapacity command // - UsbFloppyDevice->DeviceType = USBFLOPPY; + UsbFloppyDevice->DeviceType = USBFLOPPY2; } // // force the BlockSize to be 0x200. -- cgit v1.2.3