]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
usb: Support the CONFIG_SYS_64BIT_LBA option
authorGabe Black <gabeblack@chromium.org>
Fri, 12 Oct 2012 14:26:07 +0000 (14:26 +0000)
committerMarek Vasut <marex@denx.de>
Mon, 22 Oct 2012 06:25:07 +0000 (08:25 +0200)
usb_storage wouldn't compile when the CONFIG_SYS_64BIT_LBA option is
turned on because the used fixed size data types in their exported
functions when they should have used lbaint_t for the block count
parameter. That meant that when the sizes happened to be the same, when
using a 28 bit LBA, the driver would build, but when it wasn't, a 48 bit
LBA, things broke.

This change adjusts the signatures to use the right type and makes small
adjustments in the affected functions.

Signed-off-by: Gabe Black <gabeblack@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>
common/usb_storage.c

index 950451e11f6570576898cc0fc1c33bf209c7c588..0c2a4c718f3a4617b36333859dd1154456b1422f 100644 (file)
@@ -179,9 +179,9 @@ int usb_stor_get_info(struct usb_device *dev, struct us_data *us,
 int usb_storage_probe(struct usb_device *dev, unsigned int ifnum,
                      struct us_data *ss);
 unsigned long usb_stor_read(int device, unsigned long blknr,
-                           unsigned long blkcnt, void *buffer);
+                           lbaint_t blkcnt, void *buffer);
 unsigned long usb_stor_write(int device, unsigned long blknr,
-                            unsigned long blkcnt, const void *buffer);
+                            lbaint_t blkcnt, const void *buffer);
 struct usb_device * usb_get_dev_index(int index);
 void uhci_show_temp_int_td(void);
 
@@ -1053,9 +1053,10 @@ static void usb_bin_fixup(struct usb_device_descriptor descriptor,
 #endif /* CONFIG_USB_BIN_FIXUP */
 
 unsigned long usb_stor_read(int device, unsigned long blknr,
-                           unsigned long blkcnt, void *buffer)
+                           lbaint_t blkcnt, void *buffer)
 {
-       unsigned long start, blks, buf_addr;
+       lbaint_t start, blks;
+       uintptr_t buf_addr;
        unsigned short smallblks;
        struct usb_device *dev;
        struct us_data *ss;
@@ -1084,7 +1085,7 @@ unsigned long usb_stor_read(int device, unsigned long blknr,
        start = blknr;
        blks = blkcnt;
 
-       USB_STOR_PRINTF("\nusb_read: dev %d startblk %lx, blccnt %lx"
+       USB_STOR_PRINTF("\nusb_read: dev %d startblk " LBAF ", blccnt " LBAF
                        " buffer %lx\n", device, start, blks, buf_addr);
 
        do {
@@ -1114,7 +1115,8 @@ retry_it:
        } while (blks != 0);
        ss->flags &= ~USB_READY;
 
-       USB_STOR_PRINTF("usb_read: end startblk %lx, blccnt %x buffer %lx\n",
+       USB_STOR_PRINTF("usb_read: end startblk " LBAF
+                       ", blccnt %x buffer %lx\n",
                        start, smallblks, buf_addr);
 
        usb_disable_asynch(0); /* asynch transfer allowed */
@@ -1124,9 +1126,10 @@ retry_it:
 }
 
 unsigned long usb_stor_write(int device, unsigned long blknr,
-                               unsigned long blkcnt, const void *buffer)
+                               lbaint_t blkcnt, const void *buffer)
 {
-       unsigned long start, blks, buf_addr;
+       lbaint_t start, blks;
+       uintptr_t buf_addr;
        unsigned short smallblks;
        struct usb_device *dev;
        struct us_data *ss;
@@ -1156,7 +1159,7 @@ unsigned long usb_stor_write(int device, unsigned long blknr,
        start = blknr;
        blks = blkcnt;
 
-       USB_STOR_PRINTF("\nusb_write: dev %d startblk %lx, blccnt %lx"
+       USB_STOR_PRINTF("\nusb_write: dev %d startblk " LBAF ", blccnt " LBAF
                        " buffer %lx\n", device, start, blks, buf_addr);
 
        do {
@@ -1188,7 +1191,8 @@ retry_it:
        } while (blks != 0);
        ss->flags &= ~USB_READY;
 
-       USB_STOR_PRINTF("usb_write: end startblk %lx, blccnt %x buffer %lx\n",
+       USB_STOR_PRINTF("usb_write: end startblk " LBAF
+                       ", blccnt %x buffer %lx\n",
                        start, smallblks, buf_addr);
 
        usb_disable_asynch(0); /* asynch transfer allowed */