x86: reorganize code that deals with unexpected NMI-s
Expected NMI-s are those than are either generated by the software (such as a CPU sending NMI to other CPU) or generated by the hardware after the software configured it to do so (such as NMI-s on PMC events). Some unexpected NMI-s can be caused by hardware failures and it is possible to inquire the hardware about them (somewhat like MCA but much more primitive) using an EISA mechanism. In some cases the origin of the NMI can remain truly unknown. This commit should not change any functionality. It just reorganizes the code, so that it is easier to extend with new checks for the origin of the NMI. Also, it frees the code that has nothing to do with ISA from DEV_ISA. MFC after: 3 weeks
This commit is contained in:
parent
413ed27cd7
commit
0fb3a72a0d
@ -735,33 +735,34 @@ SYSCTL_INT(_machdep, OID_AUTO, kdb_on_nmi, CTLFLAG_RWTUN,
|
||||
"Go to KDB on NMI with unknown source");
|
||||
#endif
|
||||
|
||||
#ifdef DEV_ISA
|
||||
void
|
||||
nmi_call_kdb(u_int cpu, u_int type, struct trapframe *frame)
|
||||
{
|
||||
bool claimed = false;
|
||||
|
||||
#ifdef DEV_ISA
|
||||
/* machine/parity/power fail/"kitchen sink" faults */
|
||||
if (isa_nmi(frame->tf_err) == 0) {
|
||||
if (isa_nmi(frame->tf_err)) {
|
||||
claimed = true;
|
||||
if (panic_on_nmi)
|
||||
panic("NMI indicates hardware failure");
|
||||
}
|
||||
#endif /* DEV_ISA */
|
||||
#ifdef KDB
|
||||
if (!claimed && kdb_on_nmi) {
|
||||
/*
|
||||
* NMI can be hooked up to a pushbutton for debugging.
|
||||
*/
|
||||
if (kdb_on_nmi) {
|
||||
printf("NMI/cpu%d ... going to debugger\n", cpu);
|
||||
kdb_trap(type, 0, frame);
|
||||
}
|
||||
#endif /* KDB */
|
||||
} else if (panic_on_nmi) {
|
||||
panic("NMI indicates hardware failure");
|
||||
printf("NMI/cpu%d ... going to debugger\n", cpu);
|
||||
kdb_trap(type, 0, frame);
|
||||
}
|
||||
#endif /* KDB */
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
nmi_handle_intr(u_int type, struct trapframe *frame)
|
||||
{
|
||||
|
||||
#ifdef DEV_ISA
|
||||
#ifdef SMP
|
||||
if (nmi_is_broadcast) {
|
||||
nmi_call_kdb_smp(type, frame);
|
||||
@ -769,7 +770,6 @@ nmi_handle_intr(u_int type, struct trapframe *frame)
|
||||
}
|
||||
#endif
|
||||
nmi_call_kdb(PCPU_GET(cpuid), type, frame);
|
||||
#endif
|
||||
}
|
||||
|
||||
int hw_ibrs_active;
|
||||
|
@ -31,7 +31,6 @@ __FBSDID("$FreeBSD$");
|
||||
#include "opt_apic.h"
|
||||
#endif
|
||||
#include "opt_cpu.h"
|
||||
#include "opt_isa.h"
|
||||
#include "opt_kstack_pages.h"
|
||||
#include "opt_pmap.h"
|
||||
#include "opt_sched.h"
|
||||
@ -1339,7 +1338,6 @@ ipi_nmi_handler(void)
|
||||
return (0);
|
||||
}
|
||||
|
||||
#ifdef DEV_ISA
|
||||
int nmi_kdb_lock;
|
||||
|
||||
void
|
||||
@ -1363,7 +1361,6 @@ nmi_call_kdb_smp(u_int type, struct trapframe *frame)
|
||||
if (call_post)
|
||||
cpustop_handler_post(cpu);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Handle an IPI_STOP by saving our current context and spinning until we
|
||||
|
Loading…
Reference in New Issue
Block a user