David Hendricks (dhendrix@chromium.org) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/2870
-gerrit
commit 55d9fba217938da3a2b22583c3cc223ae4828295 Author: David Hendricks dhendrix@chromium.org Date: Tue Mar 19 17:57:59 2013 -0700
armv7: add a helper function for dcache ops by MVA
This adds a helper function for dcache ops by MVA which will perform the specified operation on a given memory range. This will make it more trivial to add other data cache maintenance routines.
Change-Id: I01d746d5fd2f4138257ca9cab9e9d738e73f8633 Signed-off-by: David Hendricks dhendrix@chromium.org --- src/arch/armv7/lib/cache.c | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-)
diff --git a/src/arch/armv7/lib/cache.c b/src/arch/armv7/lib/cache.c index d413bc4..8fb238a 100644 --- a/src/arch/armv7/lib/cache.c +++ b/src/arch/armv7/lib/cache.c @@ -77,7 +77,8 @@ void icache_invalidate_all(void)
enum dcache_op { OP_DCCISW, - OP_DCISW + OP_DCISW, + OP_DCCIMVAC, };
/* @@ -169,13 +170,32 @@ static unsigned int line_bytes(void) return size; }
-void dcache_clean_invalidate_by_mva(unsigned long addr, unsigned long len) +/* + * Do a dcache operation by modified virtual address. This is useful for + * maintaining coherency in drivers which do DMA transfers and only need to + * perform cache maintenance on a particular memory range rather than the + * entire cache. + */ +static void dcache_op_mva(unsigned long addr, + unsigned long len, enum dcache_op op) { unsigned long line, i;
line = line_bytes(); - for (i = addr & ~(line - 1); i < addr + len - 1; i += line) - dccimvac(addr); + for (i = addr & ~(line - 1); i < addr + len - 1; i += line) { + switch(op) { + case OP_DCCIMVAC: + dccimvac(addr); + break; + default: + break; + } + } +} + +void dcache_clean_invalidate_by_mva(unsigned long addr, unsigned long len) +{ + dcache_op_mva(addr, len, OP_DCCIMVAC); }
void armv7_invalidate_caches(void)