[U-Boot] [PATCH 3/9] CACHE: ext2load: Test if start address is aligned

Marek Vasut marex at denx.de
Mon Jun 25 02:17:51 CEST 2012


This prevents the scenario where data cache is on and the
device uses DMA to deploy data. In that case, it might not
be possible to flush/invalidate data to RAM properly. The
other option is to use bounce buffer, but that involves a
lot of copying and therefore degrades performance rapidly.
Therefore disallow this possibility of unaligned load address
altogether if data cache is on.

Signed-off-by: Marek Vasut <marex at denx.de>
Cc: Wolfgang Denk <wd at denx.de>
---
 common/cmd_ext2.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/common/cmd_ext2.c b/common/cmd_ext2.c
index 79b1e2f..45b5a0c 100644
--- a/common/cmd_ext2.c
+++ b/common/cmd_ext2.c
@@ -166,6 +166,9 @@ int do_ext2load (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 		return CMD_RET_USAGE;
 	}
 
+	if (!cacheline_aligned(addr))
+		return 1;
+
 	if (!filename) {
 		puts ("** No boot file defined **\n");
 		return 1;
-- 
1.7.10



More information about the U-Boot mailing list