WIP FPC-III support
[linux/fpc-iii.git] / arch / powerpc / platforms / 44x / machine_check.c
bloba5c898bb9bab7d5ddce0051d40e5600f2c10880a
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3 */
5 #include <linux/kernel.h>
6 #include <linux/printk.h>
7 #include <linux/ptrace.h>
9 #include <asm/reg.h>
10 #include <asm/cacheflush.h>
12 int machine_check_440A(struct pt_regs *regs)
14 unsigned long reason = regs->dsisr;
16 printk("Machine check in kernel mode.\n");
17 if (reason & ESR_IMCP){
18 printk("Instruction Synchronous Machine Check exception\n");
19 mtspr(SPRN_ESR, reason & ~ESR_IMCP);
21 else {
22 u32 mcsr = mfspr(SPRN_MCSR);
23 if (mcsr & MCSR_IB)
24 printk("Instruction Read PLB Error\n");
25 if (mcsr & MCSR_DRB)
26 printk("Data Read PLB Error\n");
27 if (mcsr & MCSR_DWB)
28 printk("Data Write PLB Error\n");
29 if (mcsr & MCSR_TLBP)
30 printk("TLB Parity Error\n");
31 if (mcsr & MCSR_ICP){
32 flush_instruction_cache();
33 printk("I-Cache Parity Error\n");
35 if (mcsr & MCSR_DCSP)
36 printk("D-Cache Search Parity Error\n");
37 if (mcsr & MCSR_DCFP)
38 printk("D-Cache Flush Parity Error\n");
39 if (mcsr & MCSR_IMPE)
40 printk("Machine Check exception is imprecise\n");
42 /* Clear MCSR */
43 mtspr(SPRN_MCSR, mcsr);
45 return 0;
48 #ifdef CONFIG_PPC_47x
49 int machine_check_47x(struct pt_regs *regs)
51 unsigned long reason = regs->dsisr;
52 u32 mcsr;
54 printk(KERN_ERR "Machine check in kernel mode.\n");
55 if (reason & ESR_IMCP) {
56 printk(KERN_ERR "Instruction Synchronous Machine Check exception\n");
57 mtspr(SPRN_ESR, reason & ~ESR_IMCP);
58 return 0;
60 mcsr = mfspr(SPRN_MCSR);
61 if (mcsr & MCSR_IB)
62 printk(KERN_ERR "Instruction Read PLB Error\n");
63 if (mcsr & MCSR_DRB)
64 printk(KERN_ERR "Data Read PLB Error\n");
65 if (mcsr & MCSR_DWB)
66 printk(KERN_ERR "Data Write PLB Error\n");
67 if (mcsr & MCSR_TLBP)
68 printk(KERN_ERR "TLB Parity Error\n");
69 if (mcsr & MCSR_ICP) {
70 flush_instruction_cache();
71 printk(KERN_ERR "I-Cache Parity Error\n");
73 if (mcsr & MCSR_DCSP)
74 printk(KERN_ERR "D-Cache Search Parity Error\n");
75 if (mcsr & PPC47x_MCSR_GPR)
76 printk(KERN_ERR "GPR Parity Error\n");
77 if (mcsr & PPC47x_MCSR_FPR)
78 printk(KERN_ERR "FPR Parity Error\n");
79 if (mcsr & PPC47x_MCSR_IPR)
80 printk(KERN_ERR "Machine Check exception is imprecise\n");
82 /* Clear MCSR */
83 mtspr(SPRN_MCSR, mcsr);
85 return 0;
87 #endif /* CONFIG_PPC_47x */