diff options
Diffstat (limited to 'arch/mips/kernel/genex.S')
-rw-r--r-- | arch/mips/kernel/genex.S | 75 |
1 files changed, 55 insertions, 20 deletions
diff --git a/arch/mips/kernel/genex.S b/arch/mips/kernel/genex.S index ecb347ce1b3d..5c2ba9f08a80 100644 --- a/arch/mips/kernel/genex.S +++ b/arch/mips/kernel/genex.S | |||
@@ -5,8 +5,8 @@ | |||
5 | * | 5 | * |
6 | * Copyright (C) 1994 - 2000, 2001, 2003 Ralf Baechle | 6 | * Copyright (C) 1994 - 2000, 2001, 2003 Ralf Baechle |
7 | * Copyright (C) 1999, 2000 Silicon Graphics, Inc. | 7 | * Copyright (C) 1999, 2000 Silicon Graphics, Inc. |
8 | * Copyright (C) 2001 MIPS Technologies, Inc. | ||
9 | * Copyright (C) 2002, 2007 Maciej W. Rozycki | 8 | * Copyright (C) 2002, 2007 Maciej W. Rozycki |
9 | * Copyright (C) 2001, 2012 MIPS Technologies, Inc. All rights reserved. | ||
10 | */ | 10 | */ |
11 | #include <linux/init.h> | 11 | #include <linux/init.h> |
12 | 12 | ||
@@ -21,8 +21,10 @@ | |||
21 | #include <asm/war.h> | 21 | #include <asm/war.h> |
22 | #include <asm/thread_info.h> | 22 | #include <asm/thread_info.h> |
23 | 23 | ||
24 | #ifdef CONFIG_MIPS_MT_SMTC | ||
24 | #define PANIC_PIC(msg) \ | 25 | #define PANIC_PIC(msg) \ |
25 | .set push; \ | 26 | .set push; \ |
27 | .set nomicromips; \ | ||
26 | .set reorder; \ | 28 | .set reorder; \ |
27 | PTR_LA a0,8f; \ | 29 | PTR_LA a0,8f; \ |
28 | .set noat; \ | 30 | .set noat; \ |
@@ -31,17 +33,10 @@ | |||
31 | 9: b 9b; \ | 33 | 9: b 9b; \ |
32 | .set pop; \ | 34 | .set pop; \ |
33 | TEXT(msg) | 35 | TEXT(msg) |
36 | #endif | ||
34 | 37 | ||
35 | __INIT | 38 | __INIT |
36 | 39 | ||
37 | NESTED(except_vec0_generic, 0, sp) | ||
38 | PANIC_PIC("Exception vector 0 called") | ||
39 | END(except_vec0_generic) | ||
40 | |||
41 | NESTED(except_vec1_generic, 0, sp) | ||
42 | PANIC_PIC("Exception vector 1 called") | ||
43 | END(except_vec1_generic) | ||
44 | |||
45 | /* | 40 | /* |
46 | * General exception vector for all other CPUs. | 41 | * General exception vector for all other CPUs. |
47 | * | 42 | * |
@@ -138,12 +133,19 @@ LEAF(r4k_wait) | |||
138 | nop | 133 | nop |
139 | nop | 134 | nop |
140 | nop | 135 | nop |
136 | #ifdef CONFIG_CPU_MICROMIPS | ||
137 | nop | ||
138 | nop | ||
139 | nop | ||
140 | nop | ||
141 | #endif | ||
141 | .set mips3 | 142 | .set mips3 |
142 | wait | 143 | wait |
143 | /* end of rollback region (the region size must be power of two) */ | 144 | /* end of rollback region (the region size must be power of two) */ |
144 | .set pop | ||
145 | 1: | 145 | 1: |
146 | jr ra | 146 | jr ra |
147 | nop | ||
148 | .set pop | ||
147 | END(r4k_wait) | 149 | END(r4k_wait) |
148 | 150 | ||
149 | .macro BUILD_ROLLBACK_PROLOGUE handler | 151 | .macro BUILD_ROLLBACK_PROLOGUE handler |
@@ -201,7 +203,11 @@ NESTED(handle_int, PT_SIZE, sp) | |||
201 | LONG_L s0, TI_REGS($28) | 203 | LONG_L s0, TI_REGS($28) |
202 | LONG_S sp, TI_REGS($28) | 204 | LONG_S sp, TI_REGS($28) |
203 | PTR_LA ra, ret_from_irq | 205 | PTR_LA ra, ret_from_irq |
204 | j plat_irq_dispatch | 206 | PTR_LA v0, plat_irq_dispatch |
207 | jr v0 | ||
208 | #ifdef CONFIG_CPU_MICROMIPS | ||
209 | nop | ||
210 | #endif | ||
205 | END(handle_int) | 211 | END(handle_int) |
206 | 212 | ||
207 | __INIT | 213 | __INIT |
@@ -222,11 +228,14 @@ NESTED(except_vec4, 0, sp) | |||
222 | /* | 228 | /* |
223 | * EJTAG debug exception handler. | 229 | * EJTAG debug exception handler. |
224 | * The EJTAG debug exception entry point is 0xbfc00480, which | 230 | * The EJTAG debug exception entry point is 0xbfc00480, which |
225 | * normally is in the boot PROM, so the boot PROM must do a | 231 | * normally is in the boot PROM, so the boot PROM must do an |
226 | * unconditional jump to this vector. | 232 | * unconditional jump to this vector. |
227 | */ | 233 | */ |
228 | NESTED(except_vec_ejtag_debug, 0, sp) | 234 | NESTED(except_vec_ejtag_debug, 0, sp) |
229 | j ejtag_debug_handler | 235 | j ejtag_debug_handler |
236 | #ifdef CONFIG_CPU_MICROMIPS | ||
237 | nop | ||
238 | #endif | ||
230 | END(except_vec_ejtag_debug) | 239 | END(except_vec_ejtag_debug) |
231 | 240 | ||
232 | __FINIT | 241 | __FINIT |
@@ -251,9 +260,10 @@ NESTED(except_vec_vi, 0, sp) | |||
251 | FEXPORT(except_vec_vi_mori) | 260 | FEXPORT(except_vec_vi_mori) |
252 | ori a0, $0, 0 | 261 | ori a0, $0, 0 |
253 | #endif /* CONFIG_MIPS_MT_SMTC */ | 262 | #endif /* CONFIG_MIPS_MT_SMTC */ |
263 | PTR_LA v1, except_vec_vi_handler | ||
254 | FEXPORT(except_vec_vi_lui) | 264 | FEXPORT(except_vec_vi_lui) |
255 | lui v0, 0 /* Patched */ | 265 | lui v0, 0 /* Patched */ |
256 | j except_vec_vi_handler | 266 | jr v1 |
257 | FEXPORT(except_vec_vi_ori) | 267 | FEXPORT(except_vec_vi_ori) |
258 | ori v0, 0 /* Patched */ | 268 | ori v0, 0 /* Patched */ |
259 | .set pop | 269 | .set pop |
@@ -354,6 +364,9 @@ EXPORT(ejtag_debug_buffer) | |||
354 | */ | 364 | */ |
355 | NESTED(except_vec_nmi, 0, sp) | 365 | NESTED(except_vec_nmi, 0, sp) |
356 | j nmi_handler | 366 | j nmi_handler |
367 | #ifdef CONFIG_CPU_MICROMIPS | ||
368 | nop | ||
369 | #endif | ||
357 | END(except_vec_nmi) | 370 | END(except_vec_nmi) |
358 | 371 | ||
359 | __FINIT | 372 | __FINIT |
@@ -480,7 +493,7 @@ NESTED(nmi_handler, PT_SIZE, sp) | |||
480 | .set noreorder | 493 | .set noreorder |
481 | /* check if TLB contains a entry for EPC */ | 494 | /* check if TLB contains a entry for EPC */ |
482 | MFC0 k1, CP0_ENTRYHI | 495 | MFC0 k1, CP0_ENTRYHI |
483 | andi k1, 0xff /* ASID_MASK */ | 496 | andi k1, 0xff /* ASID_MASK patched at run-time!! */ |
484 | MFC0 k0, CP0_EPC | 497 | MFC0 k0, CP0_EPC |
485 | PTR_SRL k0, _PAGE_SHIFT + 1 | 498 | PTR_SRL k0, _PAGE_SHIFT + 1 |
486 | PTR_SLL k0, _PAGE_SHIFT + 1 | 499 | PTR_SLL k0, _PAGE_SHIFT + 1 |
@@ -500,13 +513,35 @@ NESTED(nmi_handler, PT_SIZE, sp) | |||
500 | .set push | 513 | .set push |
501 | .set noat | 514 | .set noat |
502 | .set noreorder | 515 | .set noreorder |
503 | /* 0x7c03e83b: rdhwr v1,$29 */ | 516 | /* MIPS32: 0x7c03e83b: rdhwr v1,$29 */ |
517 | /* microMIPS: 0x007d6b3c: rdhwr v1,$29 */ | ||
504 | MFC0 k1, CP0_EPC | 518 | MFC0 k1, CP0_EPC |
505 | lui k0, 0x7c03 | 519 | #if defined(CONFIG_CPU_MICROMIPS) || defined(CONFIG_CPU_MIPS32_R2) || defined(CONFIG_CPU_MIPS64_R2) |
506 | lw k1, (k1) | 520 | and k0, k1, 1 |
507 | ori k0, 0xe83b | 521 | beqz k0, 1f |
508 | .set reorder | 522 | xor k1, k0 |
523 | lhu k0, (k1) | ||
524 | lhu k1, 2(k1) | ||
525 | ins k1, k0, 16, 16 | ||
526 | lui k0, 0x007d | ||
527 | b docheck | ||
528 | ori k0, 0x6b3c | ||
529 | 1: | ||
530 | lui k0, 0x7c03 | ||
531 | lw k1, (k1) | ||
532 | ori k0, 0xe83b | ||
533 | #else | ||
534 | andi k0, k1, 1 | ||
535 | bnez k0, handle_ri | ||
536 | lui k0, 0x7c03 | ||
537 | lw k1, (k1) | ||
538 | ori k0, 0xe83b | ||
539 | #endif | ||
540 | .set reorder | ||
541 | docheck: | ||
509 | bne k0, k1, handle_ri /* if not ours */ | 542 | bne k0, k1, handle_ri /* if not ours */ |
543 | |||
544 | isrdhwr: | ||
510 | /* The insn is rdhwr. No need to check CAUSE.BD here. */ | 545 | /* The insn is rdhwr. No need to check CAUSE.BD here. */ |
511 | get_saved_sp /* k1 := current_thread_info */ | 546 | get_saved_sp /* k1 := current_thread_info */ |
512 | .set noreorder | 547 | .set noreorder |