Caching is a very architecture-specific thing, but most architectures have a cache in general. Therefore it can be useful to have a generic architecture-independent API to perform simple cache management tasks from common code.
We have already standardized on the dcache_clean/invalidate naming scheme that originally comes from ARM in libpayload, so let's just do the same for coreboot. Unlike libpayload, there are other things than just DMA coherency we may want to achieve with those functions, so actually implement them for real even on architectures with cache-snooping DMA like x86. (In the future, we may find applications like this in libpayload as well and should probably rethink the API there... maybe move the current functionality to a separate dma_map/unmap API instead. But that's beyond scope of this patch.)
cd6b22f arch: Unify basic cache clearing API
src/arch/mips/include/arch/cache.h | 7 +++++++
src/arch/power8/include/arch/cache.h | 40 ++++++++++++++++++++++++++++++++++++
src/arch/riscv/include/arch/cache.h | 40 ++++++++++++++++++++++++++++++++++++
src/arch/x86/include/arch/cache.h | 20 ++++++++++++++++++
4 files changed, 107 insertions(+)