summaryrefslogtreecommitdiffstats
path: root/board/gdsys
diff options
context:
space:
mode:
authorSuriyan Ramasami <suriyan.r@gmail.com>2014-11-17 14:39:38 -0800
committerTom Rini <trini@ti.com>2014-11-23 06:49:04 -0500
commitd455d8789d5b35a39a0a179b3af4b423db13bfdd (patch)
tree751a2fa1db26cd7b6666bdf96cafc17db310e2b7 /board/gdsys
parent96b1046d1c68352677aa888cc110951a68daf155 (diff)
downloadblackbird-obmc-uboot-d455d8789d5b35a39a0a179b3af4b423db13bfdd.tar.gz
blackbird-obmc-uboot-d455d8789d5b35a39a0a179b3af4b423db13bfdd.zip
fs: API changes enabling extra parameter to return size of type loff_t
The sandbox/ext4/fat/generic fs commands do not gracefully deal with files greater than 2GB. Negative values are returned in such cases. To handle this, the fs functions have been modified to take an additional parameter of type "* loff_t" which is then populated. The return value of the fs functions are used only for error conditions. Signed-off-by: Suriyan Ramasami <suriyan.r@gmail.com> Acked-by: Simon Glass <sjg@chromium.org> [trini: Update board/gdsys/p1022/controlcenterd-id.c, drivers/fpga/zynqpl.c for changes] Signed-off-by: Tom Rini <trini@ti.com>
Diffstat (limited to 'board/gdsys')
-rw-r--r--board/gdsys/p1022/controlcenterd-id.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/board/gdsys/p1022/controlcenterd-id.c b/board/gdsys/p1022/controlcenterd-id.c
index 317669b9ab..11d075c385 100644
--- a/board/gdsys/p1022/controlcenterd-id.c
+++ b/board/gdsys/p1022/controlcenterd-id.c
@@ -932,11 +932,12 @@ static struct key_program *load_key_chunk(const char *ifname,
struct key_program header;
uint32_t crc;
uint8_t buf[12];
- int i;
+ loff_t i;
if (fs_set_blk_dev(ifname, dev_part_str, fs_type))
goto failure;
- i = fs_read(path, (ulong)buf, 0, 12);
+ if (fs_read(path, (ulong)buf, 0, 12, &i) < 0)
+ goto failure;
if (i < 12)
goto failure;
header.magic = get_unaligned_be32(buf);
@@ -951,8 +952,9 @@ static struct key_program *load_key_chunk(const char *ifname,
goto failure;
if (fs_set_blk_dev(ifname, dev_part_str, fs_type))
goto failure;
- i = fs_read(path, (ulong)result, 0,
- sizeof(struct key_program) + header.code_size);
+ if (fs_read(path, (ulong)result, 0,
+ sizeof(struct key_program) + header.code_size, &i) < 0)
+ goto failure;
if (i <= 0)
goto failure;
*result = header;
@@ -1043,7 +1045,7 @@ static int second_stage_init(void)
const char *image_path = "/ccdm.itb";
char *mac_path = NULL;
ulong image_addr;
- size_t image_size;
+ loff_t image_size;
uint32_t err;
printf("CCDM S2\n");
@@ -1085,10 +1087,11 @@ static int second_stage_init(void)
image_addr = (ulong)get_image_location();
if (fs_set_blk_dev("mmc", mmcdev, FS_TYPE_EXT))
goto failure;
- image_size = fs_read(image_path, image_addr, 0, 0);
+ if (fs_read(image_path, image_addr, 0, 0, &image_size) < 0)
+ goto failure;
if (image_size <= 0)
goto failure;
- printf("CCDM image found on %s, %d bytes\n", mmcdev, image_size);
+ printf("CCDM image found on %s, %lld bytes\n", mmcdev, image_size);
hmac_blob = load_key_chunk("mmc", mmcdev, FS_TYPE_EXT, mac_path);
if (!hmac_blob) {
OpenPOWER on IntegriCloud