diff options
author | David Hendricks <dhendrix@chromium.org> | 2013-03-19 17:57:59 -0700 |
---|---|---|
committer | David Hendricks <dhendrix@chromium.org> | 2013-03-21 05:15:14 +0100 |
commit | 758abdd75b22108b14427edc3704a84783759c27 (patch) | |
tree | d1cb7a5330807761d434310a5b7faa3958206b8c /src | |
parent | a54efdcf8cd8cc0f5f879fdf229b2e479bf0bcd1 (diff) |
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>
Reviewed-on: http://review.coreboot.org/2870
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Tested-by: build bot (Jenkins)
Diffstat (limited to 'src')
-rw-r--r-- | src/arch/armv7/lib/cache.c | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/src/arch/armv7/lib/cache.c b/src/arch/armv7/lib/cache.c index d413bc4046..8fb238af9b 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) |