blob: d4cc53a0ef89f136f70e1e5f945810d35490d133 [file] [log] [blame]
Bernd Schmidtb97b8a92008-01-27 18:39:16 +08001/*
Robin Getz96f10502009-09-24 14:11:24 +00002 * Blackfin CPLB exception handling for when MPU in on
Bernd Schmidtb97b8a92008-01-27 18:39:16 +08003 *
Robin Getz96f10502009-09-24 14:11:24 +00004 * Copyright 2008-2009 Analog Devices Inc.
Bernd Schmidtb97b8a92008-01-27 18:39:16 +08005 *
Robin Getz96f10502009-09-24 14:11:24 +00006 * Licensed under the GPL-2 or later.
Bernd Schmidtb97b8a92008-01-27 18:39:16 +08007 */
Robin Getz96f10502009-09-24 14:11:24 +00008
Bernd Schmidtb97b8a92008-01-27 18:39:16 +08009#include <linux/module.h>
10#include <linux/mm.h>
11
12#include <asm/blackfin.h>
Mike Frysingera92946b2008-10-16 23:25:34 +080013#include <asm/cacheflush.h>
Yi Lieb7bd9c2009-08-07 01:20:58 +000014#include <asm/cplb.h>
Bernd Schmidtb97b8a92008-01-27 18:39:16 +080015#include <asm/cplbinit.h>
16#include <asm/mmu_context.h>
17
Bernd Schmidtdbdf20d2009-01-07 23:14:38 +080018/*
19 * WARNING
20 *
21 * This file is compiled with certain -ffixed-reg options. We have to
22 * make sure not to call any functions here that could clobber these
23 * registers.
24 */
Bernd Schmidtb97b8a92008-01-27 18:39:16 +080025
26int page_mask_nelts;
27int page_mask_order;
Graf Yangb8a98982008-11-18 17:48:22 +080028unsigned long *current_rwx_mask[NR_CPUS];
Bernd Schmidtb97b8a92008-01-27 18:39:16 +080029
Graf Yangb8a98982008-11-18 17:48:22 +080030int nr_dcplb_miss[NR_CPUS], nr_icplb_miss[NR_CPUS];
31int nr_icplb_supv_miss[NR_CPUS], nr_dcplb_prot[NR_CPUS];
32int nr_cplb_flush[NR_CPUS];
Bernd Schmidtb97b8a92008-01-27 18:39:16 +080033
Bernd Schmidtb97b8a92008-01-27 18:39:16 +080034/*
35 * Given the contents of the status register, return the index of the
36 * CPLB that caused the fault.
37 */
38static inline int faulting_cplb_index(int status)
39{
40 int signbits = __builtin_bfin_norm_fr1x32(status & 0xFFFF);
41 return 30 - signbits;
42}
43
44/*
45 * Given the contents of the status register and the DCPLB_DATA contents,
46 * return true if a write access should be permitted.
47 */
48static inline int write_permitted(int status, unsigned long data)
49{
50 if (status & FAULT_USERSUPV)
51 return !!(data & CPLB_SUPV_WR);
52 else
53 return !!(data & CPLB_USER_WR);
54}
55
56/* Counters to implement round-robin replacement. */
Graf Yangb8a98982008-11-18 17:48:22 +080057static int icplb_rr_index[NR_CPUS], dcplb_rr_index[NR_CPUS];
Bernd Schmidtb97b8a92008-01-27 18:39:16 +080058
59/*
60 * Find an ICPLB entry to be evicted and return its index.
61 */
Graf Yangb8a98982008-11-18 17:48:22 +080062static int evict_one_icplb(unsigned int cpu)
Bernd Schmidtb97b8a92008-01-27 18:39:16 +080063{
64 int i;
65 for (i = first_switched_icplb; i < MAX_CPLBS; i++)
Graf Yangb8a98982008-11-18 17:48:22 +080066 if ((icplb_tbl[cpu][i].data & CPLB_VALID) == 0)
Bernd Schmidtb97b8a92008-01-27 18:39:16 +080067 return i;
Graf Yangb8a98982008-11-18 17:48:22 +080068 i = first_switched_icplb + icplb_rr_index[cpu];
Bernd Schmidtb97b8a92008-01-27 18:39:16 +080069 if (i >= MAX_CPLBS) {
70 i -= MAX_CPLBS - first_switched_icplb;
Graf Yangb8a98982008-11-18 17:48:22 +080071 icplb_rr_index[cpu] -= MAX_CPLBS - first_switched_icplb;
Bernd Schmidtb97b8a92008-01-27 18:39:16 +080072 }
Graf Yangb8a98982008-11-18 17:48:22 +080073 icplb_rr_index[cpu]++;
Bernd Schmidtb97b8a92008-01-27 18:39:16 +080074 return i;
75}
76
Graf Yangb8a98982008-11-18 17:48:22 +080077static int evict_one_dcplb(unsigned int cpu)
Bernd Schmidtb97b8a92008-01-27 18:39:16 +080078{
79 int i;
80 for (i = first_switched_dcplb; i < MAX_CPLBS; i++)
Graf Yangb8a98982008-11-18 17:48:22 +080081 if ((dcplb_tbl[cpu][i].data & CPLB_VALID) == 0)
Bernd Schmidtb97b8a92008-01-27 18:39:16 +080082 return i;
Graf Yangb8a98982008-11-18 17:48:22 +080083 i = first_switched_dcplb + dcplb_rr_index[cpu];
Bernd Schmidtb97b8a92008-01-27 18:39:16 +080084 if (i >= MAX_CPLBS) {
85 i -= MAX_CPLBS - first_switched_dcplb;
Graf Yangb8a98982008-11-18 17:48:22 +080086 dcplb_rr_index[cpu] -= MAX_CPLBS - first_switched_dcplb;
Bernd Schmidtb97b8a92008-01-27 18:39:16 +080087 }
Graf Yangb8a98982008-11-18 17:48:22 +080088 dcplb_rr_index[cpu]++;
Bernd Schmidtb97b8a92008-01-27 18:39:16 +080089 return i;
90}
91
Graf Yangb8a98982008-11-18 17:48:22 +080092static noinline int dcplb_miss(unsigned int cpu)
Bernd Schmidtb97b8a92008-01-27 18:39:16 +080093{
94 unsigned long addr = bfin_read_DCPLB_FAULT_ADDR();
95 int status = bfin_read_DCPLB_STATUS();
96 unsigned long *mask;
97 int idx;
98 unsigned long d_data;
99
Graf Yangb8a98982008-11-18 17:48:22 +0800100 nr_dcplb_miss[cpu]++;
Bernd Schmidtb97b8a92008-01-27 18:39:16 +0800101
102 d_data = CPLB_SUPV_WR | CPLB_VALID | CPLB_DIRTY | PAGE_SIZE_4KB;
Jie Zhang41ba6532009-06-16 09:48:33 +0000103#ifdef CONFIG_BFIN_EXTMEM_DCACHEABLE
Jie Zhang67834fa2009-06-10 06:26:26 +0000104 if (bfin_addr_dcacheable(addr)) {
Bernd Schmidtb4bb68f2008-04-23 07:26:23 +0800105 d_data |= CPLB_L1_CHBL | ANOMALY_05000158_WORKAROUND;
Jie Zhang41ba6532009-06-16 09:48:33 +0000106# ifdef CONFIG_BFIN_EXTMEM_WRITETHROUGH
Bernd Schmidtb4bb68f2008-04-23 07:26:23 +0800107 d_data |= CPLB_L1_AOW | CPLB_WT;
Jie Zhang41ba6532009-06-16 09:48:33 +0000108# endif
Bernd Schmidtb97b8a92008-01-27 18:39:16 +0800109 }
Bernd Schmidtb4bb68f2008-04-23 07:26:23 +0800110#endif
Jie Zhang41ba6532009-06-16 09:48:33 +0000111
112 if (L2_LENGTH && addr >= L2_START && addr < L2_START + L2_LENGTH) {
113 addr = L2_START;
114 d_data = L2_DMEMORY;
115 } else if (addr >= physical_mem_end) {
Barry Songe1878372009-12-02 02:50:43 +0000116 if (addr >= ASYNC_BANK0_BASE && addr < ASYNC_BANK3_BASE + ASYNC_BANK3_SIZE) {
Barry Songe18e7dd2009-12-07 10:05:58 +0000117 mask = current_rwx_mask[cpu];
118 if (mask) {
119 int page = (addr - (ASYNC_BANK0_BASE - _ramend)) >> PAGE_SHIFT;
120 int idx = page >> 5;
121 int bit = 1 << (page & 31);
122
123 if (mask[idx] & bit)
124 d_data |= CPLB_USER_RD;
125 }
Mike Frysinger4e354b52008-04-24 05:44:32 +0800126 } else if (addr >= BOOT_ROM_START && addr < BOOT_ROM_START + BOOT_ROM_LENGTH
127 && (status & (FAULT_RW | FAULT_USERSUPV)) == FAULT_USERSUPV) {
128 addr &= ~(1 * 1024 * 1024 - 1);
129 d_data &= ~PAGE_SIZE_4KB;
Mike Frysinger4bea8b22008-04-24 07:23:36 +0800130 d_data |= PAGE_SIZE_1MB;
Bernd Schmidtb4bb68f2008-04-23 07:26:23 +0800131 } else
132 return CPLB_PROT_VIOL;
Bernd Schmidt1ebc7232008-04-24 02:58:26 +0800133 } else if (addr >= _ramend) {
134 d_data |= CPLB_USER_RD | CPLB_USER_WR;
Bernd Schmidtb4bb68f2008-04-23 07:26:23 +0800135 } else {
Graf Yangb8a98982008-11-18 17:48:22 +0800136 mask = current_rwx_mask[cpu];
Bernd Schmidtb4bb68f2008-04-23 07:26:23 +0800137 if (mask) {
138 int page = addr >> PAGE_SHIFT;
Graf Yangb8a98982008-11-18 17:48:22 +0800139 int idx = page >> 5;
Bernd Schmidtb4bb68f2008-04-23 07:26:23 +0800140 int bit = 1 << (page & 31);
Bernd Schmidtb97b8a92008-01-27 18:39:16 +0800141
Graf Yangb8a98982008-11-18 17:48:22 +0800142 if (mask[idx] & bit)
Bernd Schmidtb4bb68f2008-04-23 07:26:23 +0800143 d_data |= CPLB_USER_RD;
144
145 mask += page_mask_nelts;
Graf Yangb8a98982008-11-18 17:48:22 +0800146 if (mask[idx] & bit)
Bernd Schmidtb4bb68f2008-04-23 07:26:23 +0800147 d_data |= CPLB_USER_WR;
148 }
149 }
Graf Yangb8a98982008-11-18 17:48:22 +0800150 idx = evict_one_dcplb(cpu);
Bernd Schmidtb97b8a92008-01-27 18:39:16 +0800151
152 addr &= PAGE_MASK;
Graf Yangb8a98982008-11-18 17:48:22 +0800153 dcplb_tbl[cpu][idx].addr = addr;
154 dcplb_tbl[cpu][idx].data = d_data;
Bernd Schmidtb97b8a92008-01-27 18:39:16 +0800155
Yi Lieb7bd9c2009-08-07 01:20:58 +0000156 _disable_dcplb();
Bernd Schmidtb97b8a92008-01-27 18:39:16 +0800157 bfin_write32(DCPLB_DATA0 + idx * 4, d_data);
158 bfin_write32(DCPLB_ADDR0 + idx * 4, addr);
Yi Lieb7bd9c2009-08-07 01:20:58 +0000159 _enable_dcplb();
Bernd Schmidtb97b8a92008-01-27 18:39:16 +0800160
161 return 0;
162}
163
Graf Yangb8a98982008-11-18 17:48:22 +0800164static noinline int icplb_miss(unsigned int cpu)
Bernd Schmidtb97b8a92008-01-27 18:39:16 +0800165{
166 unsigned long addr = bfin_read_ICPLB_FAULT_ADDR();
167 int status = bfin_read_ICPLB_STATUS();
168 int idx;
169 unsigned long i_data;
170
Graf Yangb8a98982008-11-18 17:48:22 +0800171 nr_icplb_miss[cpu]++;
Bernd Schmidt1ebc7232008-04-24 02:58:26 +0800172
173 /* If inside the uncached DMA region, fault. */
174 if (addr >= _ramend - DMA_UNCACHED_REGION && addr < _ramend)
175 return CPLB_PROT_VIOL;
176
Bernd Schmidtb97b8a92008-01-27 18:39:16 +0800177 if (status & FAULT_USERSUPV)
Graf Yangb8a98982008-11-18 17:48:22 +0800178 nr_icplb_supv_miss[cpu]++;
Bernd Schmidtb97b8a92008-01-27 18:39:16 +0800179
Bernd Schmidtb97b8a92008-01-27 18:39:16 +0800180 /*
181 * First, try to find a CPLB that matches this address. If we
182 * find one, then the fact that we're in the miss handler means
183 * that the instruction crosses a page boundary.
184 */
185 for (idx = first_switched_icplb; idx < MAX_CPLBS; idx++) {
Graf Yangb8a98982008-11-18 17:48:22 +0800186 if (icplb_tbl[cpu][idx].data & CPLB_VALID) {
187 unsigned long this_addr = icplb_tbl[cpu][idx].addr;
Bernd Schmidtb97b8a92008-01-27 18:39:16 +0800188 if (this_addr <= addr && this_addr + PAGE_SIZE > addr) {
189 addr += PAGE_SIZE;
190 break;
191 }
192 }
193 }
194
195 i_data = CPLB_VALID | CPLB_PORTPRIO | PAGE_SIZE_4KB;
Bernd Schmidt1ebc7232008-04-24 02:58:26 +0800196
Jie Zhang41ba6532009-06-16 09:48:33 +0000197#ifdef CONFIG_BFIN_EXTMEM_ICACHEABLE
Bernd Schmidt1ebc7232008-04-24 02:58:26 +0800198 /*
199 * Normal RAM, and possibly the reserved memory area, are
200 * cacheable.
201 */
202 if (addr < _ramend ||
203 (addr < physical_mem_end && reserved_mem_icache_on))
204 i_data |= CPLB_L1_CHBL | ANOMALY_05000158_WORKAROUND;
Bernd Schmidtb97b8a92008-01-27 18:39:16 +0800205#endif
206
Jie Zhang41ba6532009-06-16 09:48:33 +0000207 if (L2_LENGTH && addr >= L2_START && addr < L2_START + L2_LENGTH) {
208 addr = L2_START;
209 i_data = L2_IMEMORY;
210 } else if (addr >= physical_mem_end) {
Barry Songe1878372009-12-02 02:50:43 +0000211 if (addr >= ASYNC_BANK0_BASE && addr < ASYNC_BANK3_BASE + ASYNC_BANK3_SIZE) {
Barry Songe18e7dd2009-12-07 10:05:58 +0000212 if (!(status & FAULT_USERSUPV)) {
213 unsigned long *mask = current_rwx_mask[cpu];
214
215 if (mask) {
216 int page = (addr - (ASYNC_BANK0_BASE - _ramend)) >> PAGE_SHIFT;
217 int idx = page >> 5;
218 int bit = 1 << (page & 31);
219
220 mask += 2 * page_mask_nelts;
221 if (mask[idx] & bit)
222 i_data |= CPLB_USER_RD;
223 }
224 }
Barry Songe1878372009-12-02 02:50:43 +0000225 } else if (addr >= BOOT_ROM_START && addr < BOOT_ROM_START + BOOT_ROM_LENGTH
Mike Frysinger4bea8b22008-04-24 07:23:36 +0800226 && (status & FAULT_USERSUPV)) {
227 addr &= ~(1 * 1024 * 1024 - 1);
228 i_data &= ~PAGE_SIZE_4KB;
229 i_data |= PAGE_SIZE_1MB;
230 } else
231 return CPLB_PROT_VIOL;
Bernd Schmidt1ebc7232008-04-24 02:58:26 +0800232 } else if (addr >= _ramend) {
233 i_data |= CPLB_USER_RD;
234 } else {
235 /*
236 * Two cases to distinguish - a supervisor access must
237 * necessarily be for a module page; we grant it
238 * unconditionally (could do better here in the future).
239 * Otherwise, check the x bitmap of the current process.
240 */
241 if (!(status & FAULT_USERSUPV)) {
Graf Yangb8a98982008-11-18 17:48:22 +0800242 unsigned long *mask = current_rwx_mask[cpu];
Bernd Schmidtb97b8a92008-01-27 18:39:16 +0800243
Bernd Schmidt1ebc7232008-04-24 02:58:26 +0800244 if (mask) {
245 int page = addr >> PAGE_SHIFT;
Graf Yangb8a98982008-11-18 17:48:22 +0800246 int idx = page >> 5;
Bernd Schmidt1ebc7232008-04-24 02:58:26 +0800247 int bit = 1 << (page & 31);
Bernd Schmidtb97b8a92008-01-27 18:39:16 +0800248
Bernd Schmidt1ebc7232008-04-24 02:58:26 +0800249 mask += 2 * page_mask_nelts;
Graf Yangb8a98982008-11-18 17:48:22 +0800250 if (mask[idx] & bit)
Bernd Schmidt1ebc7232008-04-24 02:58:26 +0800251 i_data |= CPLB_USER_RD;
252 }
Bernd Schmidtb97b8a92008-01-27 18:39:16 +0800253 }
254 }
Graf Yangb8a98982008-11-18 17:48:22 +0800255 idx = evict_one_icplb(cpu);
Bernd Schmidtb97b8a92008-01-27 18:39:16 +0800256 addr &= PAGE_MASK;
Graf Yangb8a98982008-11-18 17:48:22 +0800257 icplb_tbl[cpu][idx].addr = addr;
258 icplb_tbl[cpu][idx].data = i_data;
Bernd Schmidtb97b8a92008-01-27 18:39:16 +0800259
Yi Lieb7bd9c2009-08-07 01:20:58 +0000260 _disable_icplb();
Bernd Schmidtb97b8a92008-01-27 18:39:16 +0800261 bfin_write32(ICPLB_DATA0 + idx * 4, i_data);
262 bfin_write32(ICPLB_ADDR0 + idx * 4, addr);
Yi Lieb7bd9c2009-08-07 01:20:58 +0000263 _enable_icplb();
Bernd Schmidtb97b8a92008-01-27 18:39:16 +0800264
265 return 0;
266}
267
Graf Yangb8a98982008-11-18 17:48:22 +0800268static noinline int dcplb_protection_fault(unsigned int cpu)
Bernd Schmidtb97b8a92008-01-27 18:39:16 +0800269{
Bernd Schmidtb97b8a92008-01-27 18:39:16 +0800270 int status = bfin_read_DCPLB_STATUS();
271
Graf Yangb8a98982008-11-18 17:48:22 +0800272 nr_dcplb_prot[cpu]++;
Bernd Schmidtb97b8a92008-01-27 18:39:16 +0800273
274 if (status & FAULT_RW) {
275 int idx = faulting_cplb_index(status);
Graf Yangb8a98982008-11-18 17:48:22 +0800276 unsigned long data = dcplb_tbl[cpu][idx].data;
Bernd Schmidtb97b8a92008-01-27 18:39:16 +0800277 if (!(data & CPLB_WT) && !(data & CPLB_DIRTY) &&
278 write_permitted(status, data)) {
279 data |= CPLB_DIRTY;
Graf Yangb8a98982008-11-18 17:48:22 +0800280 dcplb_tbl[cpu][idx].data = data;
Bernd Schmidtb97b8a92008-01-27 18:39:16 +0800281 bfin_write32(DCPLB_DATA0 + idx * 4, data);
282 return 0;
283 }
284 }
285 return CPLB_PROT_VIOL;
286}
287
288int cplb_hdr(int seqstat, struct pt_regs *regs)
289{
290 int cause = seqstat & 0x3f;
Yi Lib6dbde22009-08-20 04:17:47 +0000291 unsigned int cpu = raw_smp_processor_id();
Bernd Schmidtb97b8a92008-01-27 18:39:16 +0800292 switch (cause) {
293 case 0x23:
Graf Yangb8a98982008-11-18 17:48:22 +0800294 return dcplb_protection_fault(cpu);
Bernd Schmidtb97b8a92008-01-27 18:39:16 +0800295 case 0x2C:
Graf Yangb8a98982008-11-18 17:48:22 +0800296 return icplb_miss(cpu);
Bernd Schmidtb97b8a92008-01-27 18:39:16 +0800297 case 0x26:
Graf Yangb8a98982008-11-18 17:48:22 +0800298 return dcplb_miss(cpu);
Bernd Schmidtb97b8a92008-01-27 18:39:16 +0800299 default:
Bernd Schmidtb4bb68f2008-04-23 07:26:23 +0800300 return 1;
Bernd Schmidtb97b8a92008-01-27 18:39:16 +0800301 }
302}
303
Graf Yangb8a98982008-11-18 17:48:22 +0800304void flush_switched_cplbs(unsigned int cpu)
Bernd Schmidtb97b8a92008-01-27 18:39:16 +0800305{
306 int i;
Bernd Schmidt5d2e3212008-10-07 16:27:01 +0800307 unsigned long flags;
Bernd Schmidtb97b8a92008-01-27 18:39:16 +0800308
Graf Yangb8a98982008-11-18 17:48:22 +0800309 nr_cplb_flush[cpu]++;
Bernd Schmidtb97b8a92008-01-27 18:39:16 +0800310
Yi Li6a01f232009-01-07 23:14:39 +0800311 local_irq_save_hw(flags);
Yi Lieb7bd9c2009-08-07 01:20:58 +0000312 _disable_icplb();
Bernd Schmidtb97b8a92008-01-27 18:39:16 +0800313 for (i = first_switched_icplb; i < MAX_CPLBS; i++) {
Graf Yangb8a98982008-11-18 17:48:22 +0800314 icplb_tbl[cpu][i].data = 0;
Bernd Schmidtb97b8a92008-01-27 18:39:16 +0800315 bfin_write32(ICPLB_DATA0 + i * 4, 0);
316 }
Yi Lieb7bd9c2009-08-07 01:20:58 +0000317 _enable_icplb();
Bernd Schmidtb97b8a92008-01-27 18:39:16 +0800318
Yi Lieb7bd9c2009-08-07 01:20:58 +0000319 _disable_dcplb();
Bernd Schmidtd56daae2008-04-24 02:56:36 +0800320 for (i = first_switched_dcplb; i < MAX_CPLBS; i++) {
Graf Yangb8a98982008-11-18 17:48:22 +0800321 dcplb_tbl[cpu][i].data = 0;
Bernd Schmidtb97b8a92008-01-27 18:39:16 +0800322 bfin_write32(DCPLB_DATA0 + i * 4, 0);
323 }
Yi Lieb7bd9c2009-08-07 01:20:58 +0000324 _enable_dcplb();
Yi Li6a01f232009-01-07 23:14:39 +0800325 local_irq_restore_hw(flags);
Bernd Schmidt5d2e3212008-10-07 16:27:01 +0800326
Bernd Schmidtb97b8a92008-01-27 18:39:16 +0800327}
328
Graf Yangb8a98982008-11-18 17:48:22 +0800329void set_mask_dcplbs(unsigned long *masks, unsigned int cpu)
Bernd Schmidtb97b8a92008-01-27 18:39:16 +0800330{
331 int i;
332 unsigned long addr = (unsigned long)masks;
333 unsigned long d_data;
Bernd Schmidt5d2e3212008-10-07 16:27:01 +0800334 unsigned long flags;
Bernd Schmidtb97b8a92008-01-27 18:39:16 +0800335
Bernd Schmidt5d2e3212008-10-07 16:27:01 +0800336 if (!masks) {
Graf Yangb8a98982008-11-18 17:48:22 +0800337 current_rwx_mask[cpu] = masks;
Bernd Schmidtb97b8a92008-01-27 18:39:16 +0800338 return;
Bernd Schmidt5d2e3212008-10-07 16:27:01 +0800339 }
340
Yi Li6a01f232009-01-07 23:14:39 +0800341 local_irq_save_hw(flags);
Graf Yangb8a98982008-11-18 17:48:22 +0800342 current_rwx_mask[cpu] = masks;
Bernd Schmidtb97b8a92008-01-27 18:39:16 +0800343
Jie Zhang41ba6532009-06-16 09:48:33 +0000344 if (L2_LENGTH && addr >= L2_START && addr < L2_START + L2_LENGTH) {
345 addr = L2_START;
346 d_data = L2_DMEMORY;
347 } else {
348 d_data = CPLB_SUPV_WR | CPLB_VALID | CPLB_DIRTY | PAGE_SIZE_4KB;
349#ifdef CONFIG_BFIN_EXTMEM_DCACHEABLE
350 d_data |= CPLB_L1_CHBL;
351# ifdef CONFIG_BFIN_EXTMEM_WRITETHROUGH
352 d_data |= CPLB_L1_AOW | CPLB_WT;
353# endif
Bernd Schmidtb97b8a92008-01-27 18:39:16 +0800354#endif
Jie Zhang41ba6532009-06-16 09:48:33 +0000355 }
Bernd Schmidtb97b8a92008-01-27 18:39:16 +0800356
Yi Lieb7bd9c2009-08-07 01:20:58 +0000357 _disable_dcplb();
Bernd Schmidtb97b8a92008-01-27 18:39:16 +0800358 for (i = first_mask_dcplb; i < first_switched_dcplb; i++) {
Graf Yangb8a98982008-11-18 17:48:22 +0800359 dcplb_tbl[cpu][i].addr = addr;
360 dcplb_tbl[cpu][i].data = d_data;
Bernd Schmidtb97b8a92008-01-27 18:39:16 +0800361 bfin_write32(DCPLB_DATA0 + i * 4, d_data);
362 bfin_write32(DCPLB_ADDR0 + i * 4, addr);
363 addr += PAGE_SIZE;
364 }
Yi Lieb7bd9c2009-08-07 01:20:58 +0000365 _enable_dcplb();
Yi Li6a01f232009-01-07 23:14:39 +0800366 local_irq_restore_hw(flags);
Bernd Schmidtb97b8a92008-01-27 18:39:16 +0800367}