diff options
Diffstat (limited to 'arch/mips/kernel/traps.c')
-rw-r--r-- | arch/mips/kernel/traps.c | 45 |
1 files changed, 26 insertions, 19 deletions
diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c index 6379003f9d8d..632bce1bf420 100644 --- a/arch/mips/kernel/traps.c +++ b/arch/mips/kernel/traps.c | |||
@@ -295,7 +295,8 @@ void show_regs(struct pt_regs *regs) | |||
295 | if (1 <= cause && cause <= 5) | 295 | if (1 <= cause && cause <= 5) |
296 | printk("BadVA : %0*lx\n", field, regs->cp0_badvaddr); | 296 | printk("BadVA : %0*lx\n", field, regs->cp0_badvaddr); |
297 | 297 | ||
298 | printk("PrId : %08x\n", read_c0_prid()); | 298 | printk("PrId : %08x (%s)\n", read_c0_prid(), |
299 | cpu_name_string()); | ||
299 | } | 300 | } |
300 | 301 | ||
301 | void show_registers(struct pt_regs *regs) | 302 | void show_registers(struct pt_regs *regs) |
@@ -627,7 +628,7 @@ asmlinkage void do_fpe(struct pt_regs *regs, unsigned long fcr31) | |||
627 | lose_fpu(1); | 628 | lose_fpu(1); |
628 | 629 | ||
629 | /* Run the emulator */ | 630 | /* Run the emulator */ |
630 | sig = fpu_emulator_cop1Handler (regs, ¤t->thread.fpu, 1); | 631 | sig = fpu_emulator_cop1Handler(regs, ¤t->thread.fpu, 1); |
631 | 632 | ||
632 | /* | 633 | /* |
633 | * We can't allow the emulated instruction to leave any of | 634 | * We can't allow the emulated instruction to leave any of |
@@ -954,7 +955,7 @@ asmlinkage void do_reserved(struct pt_regs *regs) | |||
954 | */ | 955 | */ |
955 | static inline void parity_protection_init(void) | 956 | static inline void parity_protection_init(void) |
956 | { | 957 | { |
957 | switch (current_cpu_data.cputype) { | 958 | switch (current_cpu_type()) { |
958 | case CPU_24K: | 959 | case CPU_24K: |
959 | case CPU_34K: | 960 | case CPU_34K: |
960 | case CPU_5KC: | 961 | case CPU_5KC: |
@@ -1075,8 +1076,8 @@ void *set_except_vector(int n, void *addr) | |||
1075 | 1076 | ||
1076 | exception_handlers[n] = handler; | 1077 | exception_handlers[n] = handler; |
1077 | if (n == 0 && cpu_has_divec) { | 1078 | if (n == 0 && cpu_has_divec) { |
1078 | *(volatile u32 *)(ebase + 0x200) = 0x08000000 | | 1079 | *(u32 *)(ebase + 0x200) = 0x08000000 | |
1079 | (0x03ffffff & (handler >> 2)); | 1080 | (0x03ffffff & (handler >> 2)); |
1080 | flush_icache_range(ebase + 0x200, ebase + 0x204); | 1081 | flush_icache_range(ebase + 0x200, ebase + 0x204); |
1081 | } | 1082 | } |
1082 | return (void *)old_handler; | 1083 | return (void *)old_handler; |
@@ -1165,11 +1166,11 @@ static void *set_vi_srs_handler(int n, vi_handler_t addr, int srs) | |||
1165 | 1166 | ||
1166 | if (cpu_has_veic) { | 1167 | if (cpu_has_veic) { |
1167 | if (board_bind_eic_interrupt) | 1168 | if (board_bind_eic_interrupt) |
1168 | board_bind_eic_interrupt (n, srs); | 1169 | board_bind_eic_interrupt(n, srs); |
1169 | } else if (cpu_has_vint) { | 1170 | } else if (cpu_has_vint) { |
1170 | /* SRSMap is only defined if shadow sets are implemented */ | 1171 | /* SRSMap is only defined if shadow sets are implemented */ |
1171 | if (mips_srs_max() > 1) | 1172 | if (mips_srs_max() > 1) |
1172 | change_c0_srsmap (0xf << n*4, srs << n*4); | 1173 | change_c0_srsmap(0xf << n*4, srs << n*4); |
1173 | } | 1174 | } |
1174 | 1175 | ||
1175 | if (srs == 0) { | 1176 | if (srs == 0) { |
@@ -1198,10 +1199,10 @@ static void *set_vi_srs_handler(int n, vi_handler_t addr, int srs) | |||
1198 | * Sigh... panicing won't help as the console | 1199 | * Sigh... panicing won't help as the console |
1199 | * is probably not configured :( | 1200 | * is probably not configured :( |
1200 | */ | 1201 | */ |
1201 | panic ("VECTORSPACING too small"); | 1202 | panic("VECTORSPACING too small"); |
1202 | } | 1203 | } |
1203 | 1204 | ||
1204 | memcpy (b, &except_vec_vi, handler_len); | 1205 | memcpy(b, &except_vec_vi, handler_len); |
1205 | #ifdef CONFIG_MIPS_MT_SMTC | 1206 | #ifdef CONFIG_MIPS_MT_SMTC |
1206 | BUG_ON(n > 7); /* Vector index %d exceeds SMTC maximum. */ | 1207 | BUG_ON(n > 7); /* Vector index %d exceeds SMTC maximum. */ |
1207 | 1208 | ||
@@ -1370,9 +1371,9 @@ void __init per_cpu_trap_init(void) | |||
1370 | #endif /* CONFIG_MIPS_MT_SMTC */ | 1371 | #endif /* CONFIG_MIPS_MT_SMTC */ |
1371 | 1372 | ||
1372 | if (cpu_has_veic || cpu_has_vint) { | 1373 | if (cpu_has_veic || cpu_has_vint) { |
1373 | write_c0_ebase (ebase); | 1374 | write_c0_ebase(ebase); |
1374 | /* Setting vector spacing enables EI/VI mode */ | 1375 | /* Setting vector spacing enables EI/VI mode */ |
1375 | change_c0_intctl (0x3e0, VECTORSPACING); | 1376 | change_c0_intctl(0x3e0, VECTORSPACING); |
1376 | } | 1377 | } |
1377 | if (cpu_has_divec) { | 1378 | if (cpu_has_divec) { |
1378 | if (cpu_has_mipsmt) { | 1379 | if (cpu_has_mipsmt) { |
@@ -1390,8 +1391,8 @@ void __init per_cpu_trap_init(void) | |||
1390 | * o read IntCtl.IPPCI to determine the performance counter interrupt | 1391 | * o read IntCtl.IPPCI to determine the performance counter interrupt |
1391 | */ | 1392 | */ |
1392 | if (cpu_has_mips_r2) { | 1393 | if (cpu_has_mips_r2) { |
1393 | cp0_compare_irq = (read_c0_intctl () >> 29) & 7; | 1394 | cp0_compare_irq = (read_c0_intctl() >> 29) & 7; |
1394 | cp0_perfcount_irq = (read_c0_intctl () >> 26) & 7; | 1395 | cp0_perfcount_irq = (read_c0_intctl() >> 26) & 7; |
1395 | if (cp0_perfcount_irq == cp0_compare_irq) | 1396 | if (cp0_perfcount_irq == cp0_compare_irq) |
1396 | cp0_perfcount_irq = -1; | 1397 | cp0_perfcount_irq = -1; |
1397 | } else { | 1398 | } else { |
@@ -1429,14 +1430,17 @@ void __init per_cpu_trap_init(void) | |||
1429 | } | 1430 | } |
1430 | 1431 | ||
1431 | /* Install CPU exception handler */ | 1432 | /* Install CPU exception handler */ |
1432 | void __init set_handler (unsigned long offset, void *addr, unsigned long size) | 1433 | void __init set_handler(unsigned long offset, void *addr, unsigned long size) |
1433 | { | 1434 | { |
1434 | memcpy((void *)(ebase + offset), addr, size); | 1435 | memcpy((void *)(ebase + offset), addr, size); |
1435 | flush_icache_range(ebase + offset, ebase + offset + size); | 1436 | flush_icache_range(ebase + offset, ebase + offset + size); |
1436 | } | 1437 | } |
1437 | 1438 | ||
1439 | static char panic_null_cerr[] __initdata = | ||
1440 | "Trying to set NULL cache error exception handler"; | ||
1441 | |||
1438 | /* Install uncached CPU exception handler */ | 1442 | /* Install uncached CPU exception handler */ |
1439 | void __init set_uncached_handler (unsigned long offset, void *addr, unsigned long size) | 1443 | void __init set_uncached_handler(unsigned long offset, void *addr, unsigned long size) |
1440 | { | 1444 | { |
1441 | #ifdef CONFIG_32BIT | 1445 | #ifdef CONFIG_32BIT |
1442 | unsigned long uncached_ebase = KSEG1ADDR(ebase); | 1446 | unsigned long uncached_ebase = KSEG1ADDR(ebase); |
@@ -1445,6 +1449,9 @@ void __init set_uncached_handler (unsigned long offset, void *addr, unsigned lon | |||
1445 | unsigned long uncached_ebase = TO_UNCAC(ebase); | 1449 | unsigned long uncached_ebase = TO_UNCAC(ebase); |
1446 | #endif | 1450 | #endif |
1447 | 1451 | ||
1452 | if (!addr) | ||
1453 | panic(panic_null_cerr); | ||
1454 | |||
1448 | memcpy((void *)(uncached_ebase + offset), addr, size); | 1455 | memcpy((void *)(uncached_ebase + offset), addr, size); |
1449 | } | 1456 | } |
1450 | 1457 | ||
@@ -1464,7 +1471,7 @@ void __init trap_init(void) | |||
1464 | unsigned long i; | 1471 | unsigned long i; |
1465 | 1472 | ||
1466 | if (cpu_has_veic || cpu_has_vint) | 1473 | if (cpu_has_veic || cpu_has_vint) |
1467 | ebase = (unsigned long) alloc_bootmem_low_pages (0x200 + VECTORSPACING*64); | 1474 | ebase = (unsigned long) alloc_bootmem_low_pages(0x200 + VECTORSPACING*64); |
1468 | else | 1475 | else |
1469 | ebase = CAC_BASE; | 1476 | ebase = CAC_BASE; |
1470 | 1477 | ||
@@ -1490,7 +1497,7 @@ void __init trap_init(void) | |||
1490 | * destination. | 1497 | * destination. |
1491 | */ | 1498 | */ |
1492 | if (cpu_has_ejtag && board_ejtag_handler_setup) | 1499 | if (cpu_has_ejtag && board_ejtag_handler_setup) |
1493 | board_ejtag_handler_setup (); | 1500 | board_ejtag_handler_setup(); |
1494 | 1501 | ||
1495 | /* | 1502 | /* |
1496 | * Only some CPUs have the watch exceptions. | 1503 | * Only some CPUs have the watch exceptions. |
@@ -1543,8 +1550,8 @@ void __init trap_init(void) | |||
1543 | set_except_vector(12, handle_ov); | 1550 | set_except_vector(12, handle_ov); |
1544 | set_except_vector(13, handle_tr); | 1551 | set_except_vector(13, handle_tr); |
1545 | 1552 | ||
1546 | if (current_cpu_data.cputype == CPU_R6000 || | 1553 | if (current_cpu_type() == CPU_R6000 || |
1547 | current_cpu_data.cputype == CPU_R6000A) { | 1554 | current_cpu_type() == CPU_R6000A) { |
1548 | /* | 1555 | /* |
1549 | * The R6000 is the only R-series CPU that features a machine | 1556 | * The R6000 is the only R-series CPU that features a machine |
1550 | * check exception (similar to the R4000 cache error) and | 1557 | * check exception (similar to the R4000 cache error) and |