summaryrefslogtreecommitdiff
path: root/arch/mips/lib/cache.c
diff options
context:
space:
mode:
authorDaniel Schwierzeck <daniel.schwierzeck@gmail.com>2018-09-07 20:02:03 +0300
committerDaniel Schwierzeck <daniel.schwierzeck@gmail.com>2018-09-22 22:02:03 +0300
commit2f85c2be21dfee1e8ac1f8fb9759be7108233e85 (patch)
treee2c84aa7045529245c41ec07d0dd6ec51db3266d /arch/mips/lib/cache.c
parentd1c3d8bdfa41a7002bc9c9c0fe8cf7b41d573c0e (diff)
downloadu-boot-2f85c2be21dfee1e8ac1f8fb9759be7108233e85.tar.xz
MIPS: cache: reimplement dcache_[status, enable, disable]
Those functions are not needed during cache init and can be implemented in C. Only support the safe disabling of caches when this is required for booting an OS. Reenabling caches is much harder to implement if an optional coherency manager must be supported. As there is no real use-case anyway, dcache_enable is implemented with an error message. Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Diffstat (limited to 'arch/mips/lib/cache.c')
-rw-r--r--arch/mips/lib/cache.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/arch/mips/lib/cache.c b/arch/mips/lib/cache.c
index 1d14fc487e..d56fd1e0f4 100644
--- a/arch/mips/lib/cache.c
+++ b/arch/mips/lib/cache.c
@@ -175,3 +175,23 @@ void invalidate_dcache_range(ulong start_addr, ulong stop)
/* ensure cache ops complete before any further memory accesses */
sync();
}
+
+int dcache_status(void)
+{
+ unsigned int cca = read_c0_config() & CONF_CM_CMASK;
+ return cca != CONF_CM_UNCACHED;
+}
+
+void dcache_enable(void)
+{
+ puts("Not supported!\n");
+}
+
+void dcache_disable(void)
+{
+ /* change CCA to uncached */
+ change_c0_config(CONF_CM_CMASK, CONF_CM_UNCACHED);
+
+ /* ensure the pipeline doesn't contain now-invalid instructions */
+ instruction_hazard_barrier();
+}