summaryrefslogtreecommitdiffstats
path: root/common/fb_mmc.c
diff options
context:
space:
mode:
authorSteve Rae <srae@broadcom.com>2016-06-07 11:19:36 -0700
committerTom Rini <trini@konsulko.com>2016-06-27 16:37:36 -0400
commitcc0f08cd347ea9741375a70c490c6bee684f7bac (patch)
treeb1a4d8c4dfb3cfb62439355726e570e7f52fd7d9 /common/fb_mmc.c
parent64ece84854ae49f40e9b9d4d88502247774f9d2f (diff)
downloadblackbird-obmc-uboot-cc0f08cd347ea9741375a70c490c6bee684f7bac.tar.gz
blackbird-obmc-uboot-cc0f08cd347ea9741375a70c490c6bee684f7bac.zip
fastboot: sparse: resync common/image-sparse.c (part 1)
This file originally came from upstream code. While retaining the storage abstraction feature, this is the first 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.c32
1 files changed, 10 insertions, 22 deletions
diff --git a/common/fb_mmc.c b/common/fb_mmc.c
index 9e53adba5e..3dad0ea8e3 100644
--- a/common/fb_mmc.c
+++ b/common/fb_mmc.c
@@ -7,12 +7,10 @@
#include <config.h>
#include <common.h>
#include <blk.h>
-#include <errno.h>
#include <fastboot.h>
#include <fb_mmc.h>
#include <image-sparse.h>
#include <part.h>
-#include <sparse_format.h>
#include <mmc.h>
#include <div64.h>
@@ -48,22 +46,13 @@ static int part_get_info_efi_by_name_or_alias(struct blk_desc *dev_desc,
return ret;
}
-
-static int fb_mmc_sparse_write(struct sparse_storage *storage,
- void *priv,
- unsigned int offset,
- unsigned int size,
- char *data)
+static lbaint_t fb_mmc_sparse_write(struct sparse_storage *info,
+ lbaint_t blk, lbaint_t blkcnt, const void *buffer)
{
- struct fb_mmc_sparse *sparse = priv;
+ struct fb_mmc_sparse *sparse = info->priv;
struct blk_desc *dev_desc = sparse->dev_desc;
- int ret;
-
- ret = blk_dwrite(dev_desc, offset, size, data);
- if (!ret)
- return -EIO;
- return ret;
+ return blk_dwrite(dev_desc, blk, blkcnt, buffer);
}
static void write_raw_image(struct blk_desc *dev_desc, disk_partition_t *info,
@@ -139,26 +128,25 @@ void fb_mmc_flash_write(const char *cmd, void *download_buffer,
if (is_sparse_image(download_buffer)) {
struct fb_mmc_sparse sparse_priv;
- sparse_storage_t sparse;
+ struct sparse_storage sparse;
sparse_priv.dev_desc = dev_desc;
- sparse.block_sz = info.blksz;
+ sparse.blksz = info.blksz;
sparse.start = info.start;
sparse.size = info.size;
- sparse.name = cmd;
sparse.write = fb_mmc_sparse_write;
printf("Flashing sparse image at offset " LBAFU "\n",
- info.start);
+ sparse.start);
- store_sparse_image(&sparse, &sparse_priv, download_buffer);
+ sparse.priv = &sparse_priv;
+ write_sparse_image(&sparse, cmd, download_buffer,
+ download_bytes, response_str);
} else {
write_raw_image(dev_desc, &info, cmd, download_buffer,
download_bytes);
}
-
- fastboot_okay(response_str, "");
}
void fb_mmc_erase(const char *cmd, char *response)
OpenPOWER on IntegriCloud