diff options
author | Steve Rae <srae@broadcom.com> | 2016-06-07 21:19:37 +0300 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2016-06-27 23:37:38 +0300 |
commit | 9bc34799c8e6d8907b18e02c405576aa6bf9ce15 (patch) | |
tree | 879b7cb9c0aead4b5707a7539d25571060cb80fc /common/fb_mmc.c | |
parent | cc0f08cd347ea9741375a70c490c6bee684f7bac (diff) | |
download | u-boot-9bc34799c8e6d8907b18e02c405576aa6bf9ce15.tar.xz |
fastboot: sparse: resync common/image-sparse.c (part 2)
- update fastboot_okay() and fastboot_fail()
This file originally came from upstream code.
While retaining the storage abstraction feature, this is the second
set of the changes required to resync with the
cmd_flash_mmc_sparse_img()
in the file
aboot.c
from
https://us.codeaurora.org/cgit/quic/la/kernel/lk/plain/app/aboot/aboot.c?h=LE.BR.1.2.1
Signed-off-by: Steve Rae <srae@broadcom.com>
Diffstat (limited to 'common/fb_mmc.c')
-rw-r--r-- | common/fb_mmc.c | 40 |
1 files changed, 16 insertions, 24 deletions
diff --git a/common/fb_mmc.c b/common/fb_mmc.c index 3dad0ea8e3..6bafbc675d 100644 --- a/common/fb_mmc.c +++ b/common/fb_mmc.c @@ -18,8 +18,6 @@ #define CONFIG_FASTBOOT_GPT_NAME GPT_ENTRY_NAME #endif -static char *response_str; - struct fb_mmc_sparse { struct blk_desc *dev_desc; }; @@ -68,7 +66,7 @@ static void write_raw_image(struct blk_desc *dev_desc, disk_partition_t *info, if (blkcnt > info->size) { error("too large for partition: '%s'\n", part_name); - fastboot_fail(response_str, "too large for partition"); + fastboot_fail("too large for partition"); return; } @@ -77,28 +75,25 @@ static void write_raw_image(struct blk_desc *dev_desc, disk_partition_t *info, blks = blk_dwrite(dev_desc, info->start, blkcnt, buffer); if (blks != blkcnt) { error("failed writing to device %d\n", dev_desc->devnum); - fastboot_fail(response_str, "failed writing to device"); + fastboot_fail("failed writing to device"); return; } printf("........ wrote " LBAFU " bytes to '%s'\n", blkcnt * info->blksz, part_name); - fastboot_okay(response_str, ""); + fastboot_okay(""); } void fb_mmc_flash_write(const char *cmd, void *download_buffer, - unsigned int download_bytes, char *response) + unsigned int download_bytes) { struct blk_desc *dev_desc; disk_partition_t info; - /* initialize the response buffer */ - response_str = response; - dev_desc = blk_get_dev("mmc", CONFIG_FASTBOOT_FLASH_MMC_DEV); if (!dev_desc || dev_desc->type == DEV_TYPE_UNKNOWN) { error("invalid mmc device\n"); - fastboot_fail(response_str, "invalid mmc device"); + fastboot_fail("invalid mmc device"); return; } @@ -108,21 +103,21 @@ void fb_mmc_flash_write(const char *cmd, void *download_buffer, if (is_valid_gpt_buf(dev_desc, download_buffer)) { printf("%s: invalid GPT - refusing to write to flash\n", __func__); - fastboot_fail(response_str, "invalid GPT partition"); + fastboot_fail("invalid GPT partition"); return; } if (write_mbr_and_gpt_partitions(dev_desc, download_buffer)) { printf("%s: writing GPT partitions failed\n", __func__); - fastboot_fail(response_str, + fastboot_fail( "writing GPT partitions failed"); return; } printf("........ success\n"); - fastboot_okay(response_str, ""); + fastboot_okay(""); return; } else if (part_get_info_efi_by_name_or_alias(dev_desc, cmd, &info)) { error("cannot find partition: '%s'\n", cmd); - fastboot_fail(response_str, "cannot find partition"); + fastboot_fail("cannot find partition"); return; } @@ -142,14 +137,14 @@ void fb_mmc_flash_write(const char *cmd, void *download_buffer, sparse.priv = &sparse_priv; write_sparse_image(&sparse, cmd, download_buffer, - download_bytes, response_str); + download_bytes); } else { write_raw_image(dev_desc, &info, cmd, download_buffer, download_bytes); } } -void fb_mmc_erase(const char *cmd, char *response) +void fb_mmc_erase(const char *cmd) { int ret; struct blk_desc *dev_desc; @@ -159,24 +154,21 @@ void fb_mmc_erase(const char *cmd, char *response) if (mmc == NULL) { error("invalid mmc device"); - fastboot_fail(response_str, "invalid mmc device"); + fastboot_fail("invalid mmc device"); return; } - /* initialize the response buffer */ - response_str = response; - dev_desc = blk_get_dev("mmc", CONFIG_FASTBOOT_FLASH_MMC_DEV); if (!dev_desc || dev_desc->type == DEV_TYPE_UNKNOWN) { error("invalid mmc device"); - fastboot_fail(response_str, "invalid mmc device"); + fastboot_fail("invalid mmc device"); return; } ret = part_get_info_efi_by_name_or_alias(dev_desc, cmd, &info); if (ret) { error("cannot find partition: '%s'", cmd); - fastboot_fail(response_str, "cannot find partition"); + fastboot_fail("cannot find partition"); return; } @@ -195,11 +187,11 @@ void fb_mmc_erase(const char *cmd, char *response) blks = dev_desc->block_erase(dev_desc, blks_start, blks_size); if (blks != blks_size) { error("failed erasing from device %d", dev_desc->devnum); - fastboot_fail(response_str, "failed erasing from device"); + fastboot_fail("failed erasing from device"); return; } printf("........ erased " LBAFU " bytes from '%s'\n", blks_size * info.blksz, cmd); - fastboot_okay(response_str, ""); + fastboot_okay(""); } |