1 // SPDX-License-Identifier: GPL-2.0-or-later
5 #include <linux/kernel.h>
6 #include <linux/printk.h>
7 #include <linux/ptrace.h>
10 #include <asm/cacheflush.h>
12 int machine_check_440A(struct pt_regs *regs)
14 unsigned long reason = regs->esr;
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);
22 u32 mcsr = mfspr(SPRN_MCSR);
24 printk("Instruction Read PLB Error\n");
26 printk("Data Read PLB Error\n");
28 printk("Data Write PLB Error\n");
30 printk("TLB Parity Error\n");
32 flush_instruction_cache();
33 printk("I-Cache Parity Error\n");
36 printk("D-Cache Search Parity Error\n");
38 printk("D-Cache Flush Parity Error\n");
40 printk("Machine Check exception is imprecise\n");
43 mtspr(SPRN_MCSR, mcsr);
49 int machine_check_47x(struct pt_regs *regs)
51 unsigned long reason = regs->esr;
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);
60 mcsr = mfspr(SPRN_MCSR);
62 printk(KERN_ERR "Instruction Read PLB Error\n");
64 printk(KERN_ERR "Data Read PLB Error\n");
66 printk(KERN_ERR "Data Write PLB Error\n");
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");
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");
83 mtspr(SPRN_MCSR, mcsr);
87 #endif /* CONFIG_PPC_47x */