summaryrefslogtreecommitdiff
path: root/common/cmd_fastboot.c
diff options
context:
space:
mode:
authorSammy He <r62914@freescale.com>2011-01-26 23:03:31 +0800
committerSammy He <r62914@freescale.com>2011-01-27 00:03:37 +0800
commit209829f34409af6b7352d9478d8f12075331ab81 (patch)
tree98e4e3ee1668a64fdc37e63022500aa8da1db1b0 /common/cmd_fastboot.c
parentc7c9adb7ec54c5686e5ca975cae76a3c3f13d777 (diff)
downloadu-boot-imx-209829f34409af6b7352d9478d8f12075331ab81.zip
u-boot-imx-209829f34409af6b7352d9478d8f12075331ab81.tar.gz
u-boot-imx-209829f34409af6b7352d9478d8f12075331ab81.tar.bz2
ENGR00138422-3 Android fastboot: Pass block offset to cmd_fastboot
Pass mmc/sata block offset from fastboot driver to cmd_fastboot, not byte. Signed-off-by: Sammy He <r62914@freescale.com>
Diffstat (limited to 'common/cmd_fastboot.c')
-rw-r--r--common/cmd_fastboot.c22
1 files changed, 10 insertions, 12 deletions
diff --git a/common/cmd_fastboot.c b/common/cmd_fastboot.c
index e3eb590..cf51b3a 100644
--- a/common/cmd_fastboot.c
+++ b/common/cmd_fastboot.c
@@ -110,8 +110,7 @@ static unsigned int mmc_controller_no;
/* To support the Android-style naming of flash */
#define MAX_PTN 16
-#define MMC_BLOCK_SIZE 512
-#define SATA_BLOCK_SIZE 512
+#define MMC_SATA_BLOCK_SIZE 512
static fastboot_ptentry ptable[MAX_PTN];
static unsigned int pcount;
@@ -1116,7 +1115,8 @@ static int rx_handler (const unsigned char *buffer, unsigned int buffer_size)
if (ptn == 0) {
printf("Partition:'%s' does not exist\n", ptn->name);
sprintf(response, "FAILpartition does not exist");
- } else if ((download_bytes > ptn->length) &&
+ } else if ((download_bytes >
+ ptn->length * MMC_SATA_BLOCK_SIZE) &&
!(ptn->flags & FASTBOOT_PTENTRY_FLAGS_WRITE_ENV)) {
printf("Image too large for the partition\n");
sprintf(response, "FAILimage too large for partition");
@@ -1164,13 +1164,12 @@ static int rx_handler (const unsigned char *buffer, unsigned int buffer_size)
sprintf(source, "0x%x",
interface.transfer_buffer);
- /* block offset */
- temp = ptn->start / SATA_BLOCK_SIZE;
- sprintf(dest, "0x%x", temp);
+ /* block offset */
+ sprintf(dest, "0x%x", ptn->start);
/* block count */
temp = (download_bytes +
- SATA_BLOCK_SIZE - 1) /
- SATA_BLOCK_SIZE;
+ MMC_SATA_BLOCK_SIZE - 1) /
+ MMC_SATA_BLOCK_SIZE;
sprintf(length, "0x%x", temp);
if (do_sata(NULL, 0, 5, sata_write)) {
printf("Writing '%s' FAILED!\n",
@@ -1210,12 +1209,11 @@ mmc_ops:
sprintf(source, "0x%x", interface.transfer_buffer);
/* block offset */
- temp = ptn->start / MMC_BLOCK_SIZE;
- sprintf(dest, "0x%x", temp);
+ sprintf(dest, "0x%x", ptn->start);
/* block count */
temp = (download_bytes +
- MMC_BLOCK_SIZE - 1) /
- MMC_BLOCK_SIZE;
+ MMC_SATA_BLOCK_SIZE - 1) /
+ MMC_SATA_BLOCK_SIZE;
sprintf(length, "0x%x", temp);
printf("Initializing '%s'\n", ptn->name);