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