public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Marek Vasut <marex@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 2/7] usb: Support the CONFIG_SYS_64BIT_LBA option
Date: Sat, 13 Oct 2012 04:01:06 +0200	[thread overview]
Message-ID: <201210130401.06769.marex@denx.de> (raw)
In-Reply-To: <1350087972-1581-2-git-send-email-sjg@chromium.org>

Dear Simon Glass,

> From: Gabe Black <gabeblack@chromium.org>
> 
> 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.

Reviewed-by: Marek Vasut <marex@denx.de>

> 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>
> ---
>  common/usb_storage.c |   24 ++++++++++++++----------
>  1 files changed, 14 insertions(+), 10 deletions(-)
> 
> diff --git a/common/usb_storage.c b/common/usb_storage.c
> index 950451e..0c2a4c7 100644
> --- a/common/usb_storage.c
> +++ b/common/usb_storage.c
> @@ -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 */

  reply	other threads:[~2012-10-13  2:01 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-13  0:26 [U-Boot] [PATCH 1/7] ide: Add printf format string for CONFIG_SYS_64BIT_LBA option Simon Glass
2012-10-13  0:26 ` [U-Boot] [PATCH 2/7] usb: Support the " Simon Glass
2012-10-13  2:01   ` Marek Vasut [this message]
2012-10-13  0:26 ` [U-Boot] [PATCH 3/7] disk: Make the disk partition code work with no specific partition types Simon Glass
2012-10-13  0:26 ` [U-Boot] [PATCH 4/7] disk: Address cast and format errors Simon Glass
2012-10-13  0:26 ` [U-Boot] [PATCH 5/7] disk: Allow alternate EFI partition signature Simon Glass
2012-10-15 15:19   ` Stephen Warren
2012-10-15 17:17     ` Stefan Reinauer
2012-10-16 17:58       ` Stephen Warren
2012-10-17 23:36   ` Tom Rini
2012-10-17 23:39     ` Stefan Reinauer
2012-10-17 23:49       ` Simon Glass
2012-10-13  0:26 ` [U-Boot] [PATCH 6/7] fs: Add a Coreboot Filesystem (CBFS) driver and commands Simon Glass
2012-10-22 15:22   ` Tom Rini
2012-10-31 22:28     ` Simon Glass
2012-10-31 22:41   ` Wolfgang Denk
2012-11-01  1:22     ` Tom Rini
2012-11-02  2:23       ` Simon Glass
2012-11-03 15:04         ` Wolfgang Denk
2012-11-03 21:11           ` Simon Glass
2012-11-05 22:19             ` Simon Glass
2012-11-06  7:27               ` Wolfgang Denk
2012-11-06 22:13                 ` Simon Glass
2012-11-06 22:23                   ` Wolfgang Denk
2012-11-06 22:35                     ` Simon Glass
2012-11-07 12:38                       ` Wolfgang Denk
2012-11-07 16:18                         ` Simon Glass
2012-10-13  0:26 ` [U-Boot] [PATCH 7/7] config: Enable CBFS, ext4 for coreboot Simon Glass
2012-10-22 20:38   ` Tom Rini
2012-10-23  5:36     ` Simon Glass
2012-10-22 21:05 ` [U-Boot] [PATCH 1/7] ide: Add printf format string for CONFIG_SYS_64BIT_LBA option Tom Rini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201210130401.06769.marex@denx.de \
    --to=marex@denx.de \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox