diff options
Diffstat (limited to 'arch/powerpc/kernel/traps.c')
-rw-r--r-- | arch/powerpc/kernel/traps.c | 88 |
1 files changed, 87 insertions, 1 deletions
diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c index ca7ce85ebc2e..5ed46758f4e9 100644 --- a/arch/powerpc/kernel/traps.c +++ b/arch/powerpc/kernel/traps.c | |||
@@ -1,5 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org) | 2 | * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org) |
3 | * Copyright 2007-2010 Freescale Semiconductor, Inc. | ||
3 | * | 4 | * |
4 | * This program is free software; you can redistribute it and/or | 5 | * This program is free software; you can redistribute it and/or |
5 | * modify it under the terms of the GNU General Public License | 6 | * modify it under the terms of the GNU General Public License |
@@ -305,7 +306,7 @@ static inline int check_io_access(struct pt_regs *regs) | |||
305 | #ifndef CONFIG_FSL_BOOKE | 306 | #ifndef CONFIG_FSL_BOOKE |
306 | #define get_mc_reason(regs) ((regs)->dsisr) | 307 | #define get_mc_reason(regs) ((regs)->dsisr) |
307 | #else | 308 | #else |
308 | #define get_mc_reason(regs) (mfspr(SPRN_MCSR) & MCSR_MASK) | 309 | #define get_mc_reason(regs) (mfspr(SPRN_MCSR)) |
309 | #endif | 310 | #endif |
310 | #define REASON_FP ESR_FP | 311 | #define REASON_FP ESR_FP |
311 | #define REASON_ILLEGAL (ESR_PIL | ESR_PUO) | 312 | #define REASON_ILLEGAL (ESR_PIL | ESR_PUO) |
@@ -421,6 +422,91 @@ int machine_check_47x(struct pt_regs *regs) | |||
421 | return 0; | 422 | return 0; |
422 | } | 423 | } |
423 | #elif defined(CONFIG_E500) | 424 | #elif defined(CONFIG_E500) |
425 | int machine_check_e500mc(struct pt_regs *regs) | ||
426 | { | ||
427 | unsigned long mcsr = mfspr(SPRN_MCSR); | ||
428 | unsigned long reason = mcsr; | ||
429 | int recoverable = 1; | ||
430 | |||
431 | printk("Machine check in kernel mode.\n"); | ||
432 | printk("Caused by (from MCSR=%lx): ", reason); | ||
433 | |||
434 | if (reason & MCSR_MCP) | ||
435 | printk("Machine Check Signal\n"); | ||
436 | |||
437 | if (reason & MCSR_ICPERR) { | ||
438 | printk("Instruction Cache Parity Error\n"); | ||
439 | |||
440 | /* | ||
441 | * This is recoverable by invalidating the i-cache. | ||
442 | */ | ||
443 | mtspr(SPRN_L1CSR1, mfspr(SPRN_L1CSR1) | L1CSR1_ICFI); | ||
444 | while (mfspr(SPRN_L1CSR1) & L1CSR1_ICFI) | ||
445 | ; | ||
446 | |||
447 | /* | ||
448 | * This will generally be accompanied by an instruction | ||
449 | * fetch error report -- only treat MCSR_IF as fatal | ||
450 | * if it wasn't due to an L1 parity error. | ||
451 | */ | ||
452 | reason &= ~MCSR_IF; | ||
453 | } | ||
454 | |||
455 | if (reason & MCSR_DCPERR_MC) { | ||
456 | printk("Data Cache Parity Error\n"); | ||
457 | recoverable = 0; | ||
458 | } | ||
459 | |||
460 | if (reason & MCSR_L2MMU_MHIT) { | ||
461 | printk("Hit on multiple TLB entries\n"); | ||
462 | recoverable = 0; | ||
463 | } | ||
464 | |||
465 | if (reason & MCSR_NMI) | ||
466 | printk("Non-maskable interrupt\n"); | ||
467 | |||
468 | if (reason & MCSR_IF) { | ||
469 | printk("Instruction Fetch Error Report\n"); | ||
470 | recoverable = 0; | ||
471 | } | ||
472 | |||
473 | if (reason & MCSR_LD) { | ||
474 | printk("Load Error Report\n"); | ||
475 | recoverable = 0; | ||
476 | } | ||
477 | |||
478 | if (reason & MCSR_ST) { | ||
479 | printk("Store Error Report\n"); | ||
480 | recoverable = 0; | ||
481 | } | ||
482 | |||
483 | if (reason & MCSR_LDG) { | ||
484 | printk("Guarded Load Error Report\n"); | ||
485 | recoverable = 0; | ||
486 | } | ||
487 | |||
488 | if (reason & MCSR_TLBSYNC) | ||
489 | printk("Simultaneous tlbsync operations\n"); | ||
490 | |||
491 | if (reason & MCSR_BSL2_ERR) { | ||
492 | printk("Level 2 Cache Error\n"); | ||
493 | recoverable = 0; | ||
494 | } | ||
495 | |||
496 | if (reason & MCSR_MAV) { | ||
497 | u64 addr; | ||
498 | |||
499 | addr = mfspr(SPRN_MCAR); | ||
500 | addr |= (u64)mfspr(SPRN_MCARU) << 32; | ||
501 | |||
502 | printk("Machine Check %s Address: %#llx\n", | ||
503 | reason & MCSR_MEA ? "Effective" : "Physical", addr); | ||
504 | } | ||
505 | |||
506 | mtspr(SPRN_MCSR, mcsr); | ||
507 | return mfspr(SPRN_MCSR) == 0 && recoverable; | ||
508 | } | ||
509 | |||
424 | int machine_check_e500(struct pt_regs *regs) | 510 | int machine_check_e500(struct pt_regs *regs) |
425 | { | 511 | { |
426 | unsigned long reason = get_mc_reason(regs); | 512 | unsigned long reason = get_mc_reason(regs); |