1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3  */
4 
5 #include <linux/kernel.h>
6 #include <linux/printk.h>
7 #include <linux/ptrace.h>
8 
9 #include <asm/reg.h>
10 
11 int machine_check_8xx(struct pt_regs *regs)
12 {
13 	unsigned long reason = regs->msr;
14 
15 	pr_err("Machine check in kernel mode.\n");
16 	pr_err("Caused by (from SRR1=%lx): ", reason);
17 	if (reason & 0x40000000)
18 		pr_cont("Fetch error at address %lx\n", regs->nip);
19 	else
20 		pr_cont("Data access error at address %lx\n", regs->dar);
21 
22 #ifdef CONFIG_PCI
23 	/* the qspan pci read routines can cause machine checks -- Cort
24 	 *
25 	 * yuck !!! that totally needs to go away ! There are better ways
26 	 * to deal with that than having a wart in the mcheck handler.
27 	 * -- BenH
28 	 */
29 	bad_page_fault(regs, regs->dar, SIGBUS);
30 	return 1;
31 #else
32 	return 0;
33 #endif
34 }
35