summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Porotchkin <kostap@marvell.com>2017-03-20 15:45:08 +0200
committerKonstantin Porotchkin <kostap@marvell.com>2017-04-02 17:33:14 +0300
commit40f9219872b6dd906e25dfd421ae6026f1ab2bd7 (patch)
tree16ad34e36fa73f87df701c2101b322b8960dd7fe
parenta5eeac6a2352e926722b801cfead7af1e92a55a1 (diff)
io: Allow image load to address zero
Allow zero-address assertion bypass if requested by platform compilation flag PLAT_ALLOW_ZERO_ADDR_COPY. This patch allows loading BL33 (u-boot) to address 0x0 Change-Id: I10518db13466017110358437790ce5212d52d9e6 Signed-off-by: Haim Boot <hayim@marvell.com> Signed-off-by: Konstantin Porotchkin <kostap@marvell.com> Reviewed-on: http://vgitil04.il.marvell.com:8080/37914
-rw-r--r--drivers/io/io_fip.c2
-rw-r--r--drivers/io/io_memmap.c3
-rw-r--r--drivers/io/io_storage.c5
3 files changed, 9 insertions, 1 deletions
diff --git a/drivers/io/io_fip.c b/drivers/io/io_fip.c
index 99cf15b9..bdacc9c0 100644
--- a/drivers/io/io_fip.c
+++ b/drivers/io/io_fip.c
@@ -299,7 +299,9 @@ static int fip_file_read(io_entity_t *entity, uintptr_t buffer, size_t length,
uintptr_t backend_handle;
assert(entity != NULL);
+#ifndef PLAT_ALLOW_ZERO_ADDR_COPY
assert(buffer != (uintptr_t)NULL);
+#endif
assert(length_read != NULL);
assert(entity->info != (uintptr_t)NULL);
diff --git a/drivers/io/io_memmap.c b/drivers/io/io_memmap.c
index fe39652b..5aedd010 100644
--- a/drivers/io/io_memmap.c
+++ b/drivers/io/io_memmap.c
@@ -32,6 +32,7 @@
#include <debug.h>
#include <io_driver.h>
#include <io_storage.h>
+#include <platform_def.h>
#include <string.h>
/* As we need to be able to keep state for seek, only one file can be open
@@ -185,7 +186,9 @@ static int memmap_block_read(io_entity_t *entity, uintptr_t buffer,
file_state_t *fp;
assert(entity != NULL);
+#ifndef PLAT_ALLOW_ZERO_ADDR_COPY
assert(buffer != (uintptr_t)NULL);
+#endif
assert(length_read != NULL);
fp = (file_state_t *)entity->info;
diff --git a/drivers/io/io_storage.c b/drivers/io/io_storage.c
index 7cb1a6aa..45c3e568 100644
--- a/drivers/io/io_storage.c
+++ b/drivers/io/io_storage.c
@@ -302,7 +302,10 @@ int io_read(uintptr_t handle,
size_t *length_read)
{
int result = -ENODEV;
- assert(is_valid_entity(handle) && (buffer != (uintptr_t)NULL));
+ assert(is_valid_entity(handle));
+#ifndef PLAT_ALLOW_ZERO_ADDR_COPY
+ assert(buffer != (uintptr_t)NULL);
+#endif
io_entity_t *entity = (io_entity_t *)handle;