2 * operations on all memory data or unified caches, a no-op cache,
3 * and an l1-only cache ops cache.
4 * i-caches are not handled here.
6 * there are only three cache operations that we care about:
7 * force cache contents to memory (before dma out or shutdown),
8 * ignore cache contents in favour of memory (initialisation, after dma in),
9 * both (update page tables and force cpu to read new contents).
13 #include "../port/lib.h"
18 #include "../port/error.h"
20 static Cacheimpl allcaches, nullcaches, l1caches;
23 cachesinfo(Memcache *cp)
25 memset(cp, 0, sizeof *cp);
26 cp->setsways = Cara | Cawa | Cawt | Cawb;
27 cp->l1ip = 3<<14; /* PIPT */
28 cp->log2linelen = log2(CACHELINESZ);
35 allcache = &allcaches;
36 nocache = &nullcaches;
47 cachesinvse(void *va, int bytes)
52 l2cache->invse(va, bytes);
53 cachedinvse(va, bytes);
58 cacheswbse(void *va, int bytes)
63 cachedwbse(va, bytes);
64 l2cache->wbse(va, bytes);
69 cacheswbinvse(void *va, int bytes)
74 cachedwbse(va, bytes);
75 l2cache->wbinvse(va, bytes);
76 cachedwbinvse(va, bytes);
115 static Cacheimpl allcaches = {
122 .wbinv = cacheswbinv,
124 .invse = cachesinvse,
126 .wbinvse= cacheswbinvse,
135 nullinfo(Memcache *cp)
137 memset(cp, 0, sizeof *cp);
144 nocache = &nullcaches;
157 static Cacheimpl nullcaches = {
176 l1cachesinfo(Memcache *)
186 static Cacheimpl l1caches = {
187 .info = l1cachesinfo,
193 .wbinv = cachedwbinv,
195 .invse = cachedinvse,
197 .wbinvse= cachedwbinvse,