1 // SPDX-License-Identifier: GPL-2.0-or-later
5 #include <linux/kernel.h>
6 #include <linux/printk.h>
7 #include <linux/ptrace.h>
11 int machine_check_440A(struct pt_regs *regs)
13 unsigned long reason = regs->dsisr;
15 printk("Machine check in kernel mode.\n");
16 if (reason & ESR_IMCP){
17 printk("Instruction Synchronous Machine Check exception\n");
18 mtspr(SPRN_ESR, reason & ~ESR_IMCP);
21 u32 mcsr = mfspr(SPRN_MCSR);
23 printk("Instruction Read PLB Error\n");
25 printk("Data Read PLB Error\n");
27 printk("Data Write PLB Error\n");
29 printk("TLB Parity Error\n");
31 flush_instruction_cache();
32 printk("I-Cache Parity Error\n");
35 printk("D-Cache Search Parity Error\n");
37 printk("D-Cache Flush Parity Error\n");
39 printk("Machine Check exception is imprecise\n");
42 mtspr(SPRN_MCSR, mcsr);
48 int machine_check_47x(struct pt_regs *regs)
50 unsigned long reason = regs->dsisr;
53 printk(KERN_ERR "Machine check in kernel mode.\n");
54 if (reason & ESR_IMCP) {
55 printk(KERN_ERR "Instruction Synchronous Machine Check exception\n");
56 mtspr(SPRN_ESR, reason & ~ESR_IMCP);
59 mcsr = mfspr(SPRN_MCSR);
61 printk(KERN_ERR "Instruction Read PLB Error\n");
63 printk(KERN_ERR "Data Read PLB Error\n");
65 printk(KERN_ERR "Data Write PLB Error\n");
67 printk(KERN_ERR "TLB Parity Error\n");
68 if (mcsr & MCSR_ICP) {
69 flush_instruction_cache();
70 printk(KERN_ERR "I-Cache Parity Error\n");
73 printk(KERN_ERR "D-Cache Search Parity Error\n");
74 if (mcsr & PPC47x_MCSR_GPR)
75 printk(KERN_ERR "GPR Parity Error\n");
76 if (mcsr & PPC47x_MCSR_FPR)
77 printk(KERN_ERR "FPR Parity Error\n");
78 if (mcsr & PPC47x_MCSR_IPR)
79 printk(KERN_ERR "Machine Check exception is imprecise\n");
82 mtspr(SPRN_MCSR, mcsr);
86 #endif /* CONFIG_PPC_47x */