Commit 15970d871c299c8a4218911ee68edb0495a69cd4
Committed by
Marek Vasut
1 parent
4de512018b
Exists in
smarc_8mq_lf_v2020.04
and in
17 other branches
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>
Showing 6 changed files with 11 additions and 11 deletions Side-by-side Diff
drivers/dfu/dfu.c
drivers/dfu/dfu_mmc.c
... | ... | @@ -17,7 +17,7 @@ |
17 | 17 | #include <mmc.h> |
18 | 18 | |
19 | 19 | static unsigned char *dfu_file_buf; |
20 | -static long dfu_file_buf_len; | |
20 | +static u64 dfu_file_buf_len; | |
21 | 21 | static long dfu_file_buf_filled; |
22 | 22 | |
23 | 23 | static int mmc_block_op(enum dfu_op op, struct dfu_entity *dfu, |
... | ... | @@ -107,7 +107,7 @@ |
107 | 107 | } |
108 | 108 | |
109 | 109 | static int mmc_file_op(enum dfu_op op, struct dfu_entity *dfu, |
110 | - void *buf, long *len) | |
110 | + void *buf, u64 *len) | |
111 | 111 | { |
112 | 112 | const char *fsname, *opname; |
113 | 113 | char cmd_buf[DFU_CMD_BUF_SIZE]; |
... | ... | @@ -150,7 +150,7 @@ |
150 | 150 | sprintf(cmd_buf + strlen(cmd_buf), " %s", dfu->name); |
151 | 151 | |
152 | 152 | if (op == DFU_OP_WRITE) |
153 | - sprintf(cmd_buf + strlen(cmd_buf), " %lx", *len); | |
153 | + sprintf(cmd_buf + strlen(cmd_buf), " %llx", *len); | |
154 | 154 | |
155 | 155 | debug("%s: %s 0x%p\n", __func__, cmd_buf, cmd_buf); |
156 | 156 | |
... | ... | @@ -209,7 +209,7 @@ |
209 | 209 | return ret; |
210 | 210 | } |
211 | 211 | |
212 | -int dfu_get_medium_size_mmc(struct dfu_entity *dfu, long *size) | |
212 | +int dfu_get_medium_size_mmc(struct dfu_entity *dfu, u64 *size) | |
213 | 213 | { |
214 | 214 | int ret; |
215 | 215 | |
... | ... | @@ -237,7 +237,7 @@ |
237 | 237 | long *len) |
238 | 238 | { |
239 | 239 | int ret; |
240 | - long file_len; | |
240 | + u64 file_len; | |
241 | 241 | |
242 | 242 | if (dfu_file_buf_filled == -1) { |
243 | 243 | ret = mmc_file_op(DFU_OP_READ, dfu, dfu_file_buf, &file_len); |
drivers/dfu/dfu_nand.c
drivers/dfu/dfu_ram.c
drivers/dfu/dfu_sf.c
include/dfu.h
... | ... | @@ -110,7 +110,7 @@ |
110 | 110 | struct sf_internal_data sf; |
111 | 111 | } data; |
112 | 112 | |
113 | - int (*get_medium_size)(struct dfu_entity *dfu, long *size); | |
113 | + int (*get_medium_size)(struct dfu_entity *dfu, u64 *size); | |
114 | 114 | |
115 | 115 | int (*read_medium)(struct dfu_entity *dfu, |
116 | 116 | u64 offset, void *buf, long *len); |
... | ... | @@ -132,7 +132,7 @@ |
132 | 132 | u8 *i_buf; |
133 | 133 | u8 *i_buf_start; |
134 | 134 | u8 *i_buf_end; |
135 | - long r_left; | |
135 | + u64 r_left; | |
136 | 136 | long b_left; |
137 | 137 | |
138 | 138 | u32 bad_skip; /* for nand use */ |