mirror of
https://github.com/u-boot/u-boot.git
synced 2025-04-18 19:04:38 +00:00
dfu: remove limitation on partition size
Change long (32 bits on arm) to u64 (same type than offset) for size and read offset r_left So partition and device used for DFU can be greater than 4GB Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
This commit is contained in:
parent
4de512018b
commit
15970d871c
6 changed files with 11 additions and 11 deletions
|
@ -343,7 +343,7 @@ int dfu_read(struct dfu_entity *dfu, void *buf, int size, int blk_seq_num)
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
debug("%s: %s %ld [B]\n", __func__, dfu->name, dfu->r_left);
|
debug("%s: %s %lld [B]\n", __func__, dfu->name, dfu->r_left);
|
||||||
|
|
||||||
dfu->i_blk_seq_num = 0;
|
dfu->i_blk_seq_num = 0;
|
||||||
dfu->crc = 0;
|
dfu->crc = 0;
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
#include <mmc.h>
|
#include <mmc.h>
|
||||||
|
|
||||||
static unsigned char *dfu_file_buf;
|
static unsigned char *dfu_file_buf;
|
||||||
static long dfu_file_buf_len;
|
static u64 dfu_file_buf_len;
|
||||||
static long dfu_file_buf_filled;
|
static long dfu_file_buf_filled;
|
||||||
|
|
||||||
static int mmc_block_op(enum dfu_op op, struct dfu_entity *dfu,
|
static int mmc_block_op(enum dfu_op op, struct dfu_entity *dfu,
|
||||||
|
@ -107,7 +107,7 @@ static int mmc_file_buffer(struct dfu_entity *dfu, void *buf, long *len)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int mmc_file_op(enum dfu_op op, struct dfu_entity *dfu,
|
static int mmc_file_op(enum dfu_op op, struct dfu_entity *dfu,
|
||||||
void *buf, long *len)
|
void *buf, u64 *len)
|
||||||
{
|
{
|
||||||
const char *fsname, *opname;
|
const char *fsname, *opname;
|
||||||
char cmd_buf[DFU_CMD_BUF_SIZE];
|
char cmd_buf[DFU_CMD_BUF_SIZE];
|
||||||
|
@ -150,7 +150,7 @@ static int mmc_file_op(enum dfu_op op, struct dfu_entity *dfu,
|
||||||
sprintf(cmd_buf + strlen(cmd_buf), " %s", dfu->name);
|
sprintf(cmd_buf + strlen(cmd_buf), " %s", dfu->name);
|
||||||
|
|
||||||
if (op == DFU_OP_WRITE)
|
if (op == DFU_OP_WRITE)
|
||||||
sprintf(cmd_buf + strlen(cmd_buf), " %lx", *len);
|
sprintf(cmd_buf + strlen(cmd_buf), " %llx", *len);
|
||||||
|
|
||||||
debug("%s: %s 0x%p\n", __func__, cmd_buf, cmd_buf);
|
debug("%s: %s 0x%p\n", __func__, cmd_buf, cmd_buf);
|
||||||
|
|
||||||
|
@ -209,7 +209,7 @@ int dfu_flush_medium_mmc(struct dfu_entity *dfu)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int dfu_get_medium_size_mmc(struct dfu_entity *dfu, long *size)
|
int dfu_get_medium_size_mmc(struct dfu_entity *dfu, u64 *size)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
@ -237,7 +237,7 @@ static int mmc_file_unbuffer(struct dfu_entity *dfu, u64 offset, void *buf,
|
||||||
long *len)
|
long *len)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
long file_len;
|
u64 file_len;
|
||||||
|
|
||||||
if (dfu_file_buf_filled == -1) {
|
if (dfu_file_buf_filled == -1) {
|
||||||
ret = mmc_file_op(DFU_OP_READ, dfu, dfu_file_buf, &file_len);
|
ret = mmc_file_op(DFU_OP_READ, dfu, dfu_file_buf, &file_len);
|
||||||
|
|
|
@ -114,7 +114,7 @@ static int dfu_write_medium_nand(struct dfu_entity *dfu,
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int dfu_get_medium_size_nand(struct dfu_entity *dfu, long *size)
|
int dfu_get_medium_size_nand(struct dfu_entity *dfu, u64 *size)
|
||||||
{
|
{
|
||||||
*size = dfu->data.nand.size;
|
*size = dfu->data.nand.size;
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ static int dfu_write_medium_ram(struct dfu_entity *dfu, u64 offset,
|
||||||
return dfu_transfer_medium_ram(DFU_OP_WRITE, dfu, offset, buf, len);
|
return dfu_transfer_medium_ram(DFU_OP_WRITE, dfu, offset, buf, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
int dfu_get_medium_size_ram(struct dfu_entity *dfu, long *size)
|
int dfu_get_medium_size_ram(struct dfu_entity *dfu, u64 *size)
|
||||||
{
|
{
|
||||||
*size = dfu->data.ram.size;
|
*size = dfu->data.ram.size;
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
#include <spi.h>
|
#include <spi.h>
|
||||||
#include <spi_flash.h>
|
#include <spi_flash.h>
|
||||||
|
|
||||||
static int dfu_get_medium_size_sf(struct dfu_entity *dfu, long *size)
|
static int dfu_get_medium_size_sf(struct dfu_entity *dfu, u64 *size)
|
||||||
{
|
{
|
||||||
*size = dfu->data.sf.size;
|
*size = dfu->data.sf.size;
|
||||||
|
|
||||||
|
|
|
@ -110,7 +110,7 @@ struct dfu_entity {
|
||||||
struct sf_internal_data sf;
|
struct sf_internal_data sf;
|
||||||
} data;
|
} data;
|
||||||
|
|
||||||
int (*get_medium_size)(struct dfu_entity *dfu, long *size);
|
int (*get_medium_size)(struct dfu_entity *dfu, u64 *size);
|
||||||
|
|
||||||
int (*read_medium)(struct dfu_entity *dfu,
|
int (*read_medium)(struct dfu_entity *dfu,
|
||||||
u64 offset, void *buf, long *len);
|
u64 offset, void *buf, long *len);
|
||||||
|
@ -132,7 +132,7 @@ struct dfu_entity {
|
||||||
u8 *i_buf;
|
u8 *i_buf;
|
||||||
u8 *i_buf_start;
|
u8 *i_buf_start;
|
||||||
u8 *i_buf_end;
|
u8 *i_buf_end;
|
||||||
long r_left;
|
u64 r_left;
|
||||||
long b_left;
|
long b_left;
|
||||||
|
|
||||||
u32 bad_skip; /* for nand use */
|
u32 bad_skip; /* for nand use */
|
||||||
|
|
Loading…
Add table
Reference in a new issue