/* * arch/sh/mm/cache-sh7705.c * * Copyright (C) 1999, 2000 Niibe Yutaka * Copyright (C) 2004 Alex Song * * This file is subject to the terms and conditions of the GNU General Public * License. See the file "COPYING" in the main directory of this archive * for more details. *
*/ #include <linux/init.h> #include <linux/mman.h> #include <linux/mm.h> #include <linux/fs.h> #include <linux/pagemap.h> #include <linux/threads.h> #include <asm/addrspace.h> #include <asm/page.h> #include <asm/processor.h> #include <asm/cache.h> #include <asm/io.h> #include <linux/uaccess.h> #include <asm/mmu_context.h> #include <asm/cacheflush.h>
/* * The 32KB cache on the SH7705 suffers from the same synonym problem * as SH4 CPUs
*/ staticinlinevoid cache_wback_all(void)
{ unsignedlong ways, waysize, addrstart;
for (addr = addrstart;
addr < addrstart + waysize;
addr += current_cpu_data.dcache.linesz) { unsignedlong data; int v = SH_CACHE_UPDATED | SH_CACHE_VALID;
data = __raw_readl(addr);
if ((data & v) == v)
__raw_writel(data & ~v, addr);
}
addrstart += current_cpu_data.dcache.way_incr;
} while (--ways);
}
/* * Write back the range of D-cache, and purge the I-cache. * * Called from kernel/module.c:sys_init_module and routine for a.out format.
*/ staticvoid sh7705_flush_icache_range(void *args)
{ struct flusher_data *data = args; unsignedlong start, end;
start = data->addr1;
end = data->addr2;
__flush_wback_region((void *)start, end - start);
}
/* * Writeback&Invalidate the D-cache of the page
*/ staticvoid __flush_dcache_page(unsignedlong phys)
{ unsignedlong ways, waysize, addrstart; unsignedlong flags;
phys |= SH_CACHE_VALID;
/* * Here, phys is the physical address of the page. We check all the * tags in the cache for those with the same page number as this page * (by masking off the lowest 2 bits of the 19-bit tag; these bits are * derived from the offset within in the 4k page). Matching valid * entries are invalidated. * * Since 2 bits of the cache index are derived from the virtual page * number, knowing this would reduce the number of cache entries to be * searched by a factor of 4. However this function exists to deal with * potential cache aliasing, therefore the optimisation is probably not * possible.
*/
local_irq_save(flags);
jump_to_uncached();
/* * Write back and invalidate I/D-caches for the page. * * ADDRESS: Virtual Address (U0 address)
*/ staticvoid sh7705_flush_cache_page(void *args)
{ struct flusher_data *data = args; unsignedlong pfn = data->addr2;
__flush_dcache_page(pfn << PAGE_SHIFT);
}
/* * This is called when a page-cache page is about to be mapped into a * user process' address space. It offers an opportunity for a * port to ensure d-cache/i-cache coherency if necessary. * * Not entirely sure why this is necessary on SH3 with 32K cache but * without it we get occasional "Memory fault" when loading a program.
*/ staticvoid sh7705_flush_icache_folio(void *arg)
{ struct folio *folio = arg;
__flush_purge_region(folio_address(folio), folio_size(folio));
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.