aboutsummaryrefslogtreecommitdiff
path: root/sys/i386/include/specialreg.h
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2009-05-13 17:53:04 +0000
committerJohn Baldwin <jhb@FreeBSD.org>2009-05-13 17:53:04 +0000
commit9dc0b3d54f3d673ef95c8dcf4781caf797a2f6ee (patch)
treee92a8666a427cd3b54074a55134d6d643f102bf6 /sys/i386/include/specialreg.h
parent2f120c90a7362e49b327675019a8726c3a049a2b (diff)
downloadsrc-9dc0b3d54f3d673ef95c8dcf4781caf797a2f6ee.tar.gz
src-9dc0b3d54f3d673ef95c8dcf4781caf797a2f6ee.zip
Implement simple machine check support for amd64 and i386.
- For CPUs that only support MCE (the machine check exception) but not MCA (i.e. Pentium), all this does is print out the value of the machine check registers and then panic when a machine check exception occurs. - For CPUs that support MCA (the machine check architecture), the support is a bit more involved. - First, there is limited support for decoding the CPU-independent MCA error codes in the kernel, and the kernel uses this to output a short description of any machine check events that occur. - When a machine check exception occurs, all of the MCx banks on the current CPU are scanned and any events are reported to the console before panic'ing. - To catch events for correctable errors, a periodic timer kicks off a task which scans the MCx banks on all CPUs. The frequency of these checks is controlled via the "hw.mca.interval" sysctl. - Userland can request an immediate scan of the MCx banks by writing a non-zero value to "hw.mca.force_scan". - If any correctable events are encountered, the appropriate details are stored in a 'struct mca_record' (defined in <machine/mca.h>). The "hw.mca.count" is a count of such records and each record may be queried via the "hw.mca.records" tree by specifying the record index (0 .. count - 1) as the next name in the MIB similar to using PIDs with the kern.proc.* sysctls. The idea is to export machine check events to userland for more detailed processing. - The periodic timer and hw.mca sysctls are only present if the CPU supports MCA. Discussed with: emaste (briefly) MFC after: 1 month
Notes
Notes: svn path=/head/; revision=192050
Diffstat (limited to 'sys/i386/include/specialreg.h')
-rw-r--r--sys/i386/include/specialreg.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/sys/i386/include/specialreg.h b/sys/i386/include/specialreg.h
index fa9cf8143bef..67283e44c580 100644
--- a/sys/i386/include/specialreg.h
+++ b/sys/i386/include/specialreg.h
@@ -415,6 +415,34 @@
#define DIR1 0xff
/*
+ * Machine Check register constants.
+ */
+#define MCG_CAP_COUNT 0x000000ff
+#define MCG_CAP_CTL_P 0x00000100
+#define MCG_CAP_EXT_P 0x00000200
+#define MCG_CAP_TES_P 0x00000800
+#define MCG_CAP_EXT_CNT 0x00ff0000
+#define MCG_STATUS_RIPV 0x00000001
+#define MCG_STATUS_EIPV 0x00000002
+#define MCG_STATUS_MCIP 0x00000004
+#define MCG_CTL_ENABLE 0xffffffffffffffffUL
+#define MCG_CTL_DISABLE 0x0000000000000000UL
+#define MSR_MC_CTL(x) (MSR_MC0_CTL + (x) * 4)
+#define MSR_MC_STATUS(x) (MSR_MC0_STATUS + (x) * 4)
+#define MSR_MC_ADDR(x) (MSR_MC0_ADDR + (x) * 4)
+#define MSR_MC_MISC(x) (MSR_MC0_MISC + (x) * 4)
+#define MC_STATUS_MCA_ERROR 0x000000000000ffffUL
+#define MC_STATUS_MODEL_ERROR 0x00000000ffff0000UL
+#define MC_STATUS_OTHER_INFO 0x01ffffff00000000UL
+#define MC_STATUS_PCC 0x0200000000000000UL
+#define MC_STATUS_ADDRV 0x0400000000000000UL
+#define MC_STATUS_MISCV 0x0800000000000000UL
+#define MC_STATUS_EN 0x1000000000000000UL
+#define MC_STATUS_UC 0x2000000000000000UL
+#define MC_STATUS_OVER 0x4000000000000000UL
+#define MC_STATUS_VAL 0x8000000000000000UL
+
+/*
* The following four 3-byte registers control the non-cacheable regions.
* These registers must be written as three separate bytes.
*