aboutsummaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorYann Gautier <yann.gautier@st.com>2020-11-09 13:28:47 +0100
committerYann Gautier <yann.gautier@foss.st.com>2021-06-04 15:15:18 +0200
commita5bcf82402ff415326b4dba42aae95c499821e94 (patch)
treeb7d8f16493c7391cdd0d026c288954815233e812 /drivers
parentb6561c1217f5b9be9cc2b66d0c5309ed0b7698cf (diff)
downloadtrusted-firmware-a-a5bcf82402ff415326b4dba42aae95c499821e94.tar.gz
fix(io_stm32image): invalidate cache on local buf
When retrieving data from stm32 image file, the header is removed with a memcpy that shifts the data to overwrite the useless header for next binary. STM32 binary from boot device: |-------------------------------------| | header | payload | |-------------------------------------| After the memcpy: |-------------------------------------| | payload | remain | |-------------------------------------| But the remaining data after the shifted payload is still in the cache. As it is of no use for anyone, just invalidate the cache at this address. This is required if the DDR is mapped secure in BL2, and the secure access is forbidden in BL33, or else TZC-400 issues an error. Change-Id: Ice2af3b1ca49eccb79bfc62db60437e259d344ca Signed-off-by: Yann Gautier <yann.gautier@st.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/st/io/io_stm32image.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/st/io/io_stm32image.c b/drivers/st/io/io_stm32image.c
index 70e4be30fc..9fa0c50fd4 100644
--- a/drivers/st/io/io_stm32image.c
+++ b/drivers/st/io/io_stm32image.c
@@ -346,6 +346,9 @@ static int stm32image_partition_read(io_entity_t *entity, uintptr_t buffer,
return result;
}
+ inv_dcache_range(round_up((uintptr_t)(local_buffer + length - hdr_sz),
+ CACHE_WRITEBACK_GRANULE), *length_read - length + hdr_sz);
+
io_close(backend_handle);
}