9 #include <linux/module.h>
13 #include <asm/cacheflush.h>
16 #include <asm/mmu_context.h>
34 #ifdef CONFIG_EXCPT_IRQ_SYSC_L1
35 #define MGR_ATTR __attribute__((l1_text))
44 static inline int faulting_cplb_index(
int status)
46 int signbits = __builtin_bfin_norm_fr1x32(status & 0xFFFF);
54 static inline int write_permitted(
int status,
unsigned long data)
68 MGR_ATTR static int evict_one_icplb(
unsigned int cpu)
79 icplb_rr_index[
cpu]++;
83 MGR_ATTR static int evict_one_dcplb(
unsigned int cpu)
87 if ((
dcplb_tbl[cpu][i].data & CPLB_VALID) == 0)
94 dcplb_rr_index[
cpu]++;
104 unsigned long d_data;
109 #ifdef CONFIG_BFIN_EXTMEM_DCACHEABLE
110 if (bfin_addr_dcacheable(addr)) {
112 # ifdef CONFIG_BFIN_EXTMEM_WRITETHROUGH
123 #if defined(CONFIG_ROMFS_ON_MTD) && defined(CONFIG_MTD_ROM)
128 int bit = 1 << (page & 31);
136 addr &= ~(1 * 1024 * 1024 - 1);
150 int bit = 1 << (page & 31);
160 idx = evict_one_dcplb(cpu);
179 unsigned long i_data;
196 if (
icplb_tbl[cpu][idx].data & CPLB_VALID) {
198 if (this_addr <= addr && this_addr + PAGE_SIZE > addr) {
207 #ifdef CONFIG_BFIN_EXTMEM_ICACHEABLE
222 if (!(status & FAULT_USERSUPV)) {
228 int bit = 1 << (page & 31);
236 && (status & FAULT_USERSUPV)) {
237 addr &= ~(1 * 1024 * 1024 - 1);
253 if (!(status & FAULT_USERSUPV)) {
259 int bit = 1 << (page & 31);
267 idx = evict_one_icplb(cpu);
287 int idx = faulting_cplb_index(status);
290 write_permitted(status, data)) {
302 int cause = seqstat & 0x3f;
306 return dcplb_protection_fault(cpu);
308 return icplb_miss(cpu);
310 return dcplb_miss(cpu);
344 unsigned long addr = (
unsigned long)masks;
345 unsigned long d_data;
361 #ifdef CONFIG_BFIN_EXTMEM_DCACHEABLE
363 # ifdef CONFIG_BFIN_EXTMEM_WRITETHROUGH