diff options
author | Yann Gautier <yann.gautier@st.com> | 2019-04-16 11:35:19 +0200 |
---|---|---|
committer | Lionel Debieve <lionel.debieve@st.com> | 2020-01-10 21:14:57 +0100 |
commit | 70cb0bff7d42bd9e09dddef3c2fc6e3b385c6e5a (patch) | |
tree | efbc6f4022b452814b15ef9f4d4762387a2d7e88 /drivers/renesas/rcar/io/io_memdrv.c | |
parent | 8c80c86573898eb59127a32b089e753f40e254fb (diff) | |
download | trusted-firmware-a-70cb0bff7d42bd9e09dddef3c2fc6e3b385c6e5a.tar.gz |
io: change seek offset to signed long long
IO seek offset can be set to values above UINT32_MAX, this change
changes the seek offset argument from 'ssize_t' to 'signed long long'.
Fixing platform seek functions to match the new interface update.
Change-Id: I25de83b3b7abe5f52a7b0fee36f71e60cac9cfcb
Signed-off-by: Yann Gautier <yann.gautier@st.com>
Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
Signed-off-by: Lionel Debieve <lionel.debieve@st.com>
Diffstat (limited to 'drivers/renesas/rcar/io/io_memdrv.c')
-rw-r--r-- | drivers/renesas/rcar/io/io_memdrv.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/drivers/renesas/rcar/io/io_memdrv.c b/drivers/renesas/rcar/io/io_memdrv.c index 3f6b4c71b1..7e8c1d3a65 100644 --- a/drivers/renesas/rcar/io/io_memdrv.c +++ b/drivers/renesas/rcar/io/io_memdrv.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2018, Renesas Electronics Corporation. All rights reserved. + * Copyright (c) 2015-2019, Renesas Electronics Corporation. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ @@ -28,7 +28,7 @@ static int32_t memdrv_dev_close(io_dev_info_t *dev_info); typedef struct { uint32_t in_use; uintptr_t base; - ssize_t file_pos; + signed long long file_pos; } file_state_t; static file_state_t current_file = { 0 }; @@ -47,7 +47,7 @@ static int32_t memdrv_block_open(io_dev_info_t *dev_info, const uintptr_t spec, * spec at a time. When we have dynamic memory we can malloc and set * entity->info. */ - if (current_file.in_use) + if (current_file.in_use != 0U) return IO_RESOURCES_EXHAUSTED; /* File cursor offset for seek and incremental reads etc. */ @@ -61,7 +61,7 @@ static int32_t memdrv_block_open(io_dev_info_t *dev_info, const uintptr_t spec, } static int32_t memdrv_block_seek(io_entity_t *entity, int32_t mode, - ssize_t offset) + signed long long offset) { if (mode != IO_SEEK_SET) return IO_FAIL; @@ -78,16 +78,17 @@ static int32_t memdrv_block_read(io_entity_t *entity, uintptr_t buffer, fp = (file_state_t *) entity->info; - NOTICE("BL2: dst=0x%lx src=0x%lx len=%ld(0x%lx)\n", - buffer, fp->base + fp->file_pos, length, length); + NOTICE("BL2: dst=0x%lx src=0x%llx len=%ld(0x%lx)\n", + buffer, (unsigned long long)fp->base + + (unsigned long long)fp->file_pos, length, length); - if (FLASH_MEMORY_SIZE < fp->file_pos + length) { + if (FLASH_MEMORY_SIZE < (fp->file_pos + (signed long long)length)) { ERROR("BL2: check load image (source address)\n"); return IO_FAIL; } - rcar_dma_exec(buffer, fp->base + fp->file_pos, length); - fp->file_pos += length; + rcar_dma_exec(buffer, fp->base + (uintptr_t)fp->file_pos, length); + fp->file_pos += (signed long long)length; *cnt = length; return IO_SUCCESS; |