2005-04-16 15:20:36 -07:00
|
|
|
/*
|
|
|
|
* arch/sh/mm/cache-sh2.c
|
|
|
|
*
|
|
|
|
* Copyright (C) 2002 Paul Mundt
|
|
|
|
*
|
|
|
|
* Released under the terms of the GNU GPL v2.0.
|
|
|
|
*/
|
2006-11-04 23:40:13 -07:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
#include <linux/init.h>
|
|
|
|
#include <linux/mm.h>
|
|
|
|
|
|
|
|
#include <asm/cache.h>
|
|
|
|
#include <asm/addrspace.h>
|
|
|
|
#include <asm/processor.h>
|
|
|
|
#include <asm/cacheflush.h>
|
|
|
|
#include <asm/io.h>
|
|
|
|
|
2006-11-04 23:40:13 -07:00
|
|
|
void __flush_wback_region(void *start, int size)
|
2005-04-16 15:20:36 -07:00
|
|
|
{
|
2006-11-04 23:40:13 -07:00
|
|
|
unsigned long v;
|
|
|
|
unsigned long begin, end;
|
|
|
|
|
|
|
|
begin = (unsigned long)start & ~(L1_CACHE_BYTES-1);
|
|
|
|
end = ((unsigned long)start + size + L1_CACHE_BYTES-1)
|
|
|
|
& ~(L1_CACHE_BYTES-1);
|
|
|
|
for (v = begin; v < end; v+=L1_CACHE_BYTES) {
|
|
|
|
/* FIXME cache purge */
|
|
|
|
ctrl_outl((v & 0x1ffffc00), (v & 0x00000ff0) | 0x00000008);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void __flush_purge_region(void *start, int size)
|
|
|
|
{
|
|
|
|
unsigned long v;
|
|
|
|
unsigned long begin, end;
|
|
|
|
|
|
|
|
begin = (unsigned long)start & ~(L1_CACHE_BYTES-1);
|
|
|
|
end = ((unsigned long)start + size + L1_CACHE_BYTES-1)
|
|
|
|
& ~(L1_CACHE_BYTES-1);
|
|
|
|
for (v = begin; v < end; v+=L1_CACHE_BYTES) {
|
|
|
|
ctrl_outl((v & 0x1ffffc00), (v & 0x00000ff0) | 0x00000008);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void __flush_invalidate_region(void *start, int size)
|
|
|
|
{
|
|
|
|
unsigned long v;
|
|
|
|
unsigned long begin, end;
|
|
|
|
|
|
|
|
begin = (unsigned long)start & ~(L1_CACHE_BYTES-1);
|
|
|
|
end = ((unsigned long)start + size + L1_CACHE_BYTES-1)
|
|
|
|
& ~(L1_CACHE_BYTES-1);
|
|
|
|
for (v = begin; v < end; v+=L1_CACHE_BYTES) {
|
|
|
|
ctrl_outl((v & 0x1ffffc00), (v & 0x00000ff0) | 0x00000008);
|
|
|
|
}
|
2005-04-16 15:20:36 -07:00
|
|
|
}
|
|
|
|
|