mce.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. #ifndef _ASM_MCE_H
  2. #define _ASM_MCE_H 1
  3. #include <asm/ioctls.h>
  4. #include <asm/types.h>
  5. /*
  6. * Machine Check support for x86
  7. */
  8. #define MCG_CTL_P (1UL<<8) /* MCG_CAP register available */
  9. #define MCG_STATUS_RIPV (1UL<<0) /* restart ip valid */
  10. #define MCG_STATUS_EIPV (1UL<<1) /* eip points to correct instruction */
  11. #define MCG_STATUS_MCIP (1UL<<2) /* machine check in progress */
  12. #define MCI_STATUS_VAL (1UL<<63) /* valid error */
  13. #define MCI_STATUS_OVER (1UL<<62) /* previous errors lost */
  14. #define MCI_STATUS_UC (1UL<<61) /* uncorrected error */
  15. #define MCI_STATUS_EN (1UL<<60) /* error enabled */
  16. #define MCI_STATUS_MISCV (1UL<<59) /* misc error reg. valid */
  17. #define MCI_STATUS_ADDRV (1UL<<58) /* addr reg. valid */
  18. #define MCI_STATUS_PCC (1UL<<57) /* processor context corrupt */
  19. /* Fields are zero when not available */
  20. struct mce {
  21. __u64 status;
  22. __u64 misc;
  23. __u64 addr;
  24. __u64 mcgstatus;
  25. __u64 rip;
  26. __u64 tsc; /* cpu time stamp counter */
  27. __u64 res1; /* for future extension */
  28. __u64 res2; /* dito. */
  29. __u8 cs; /* code segment */
  30. __u8 bank; /* machine check bank */
  31. __u8 cpu; /* cpu that raised the error */
  32. __u8 finished; /* entry is valid */
  33. __u32 pad;
  34. };
  35. /*
  36. * This structure contains all data related to the MCE log.
  37. * Also carries a signature to make it easier to find from external debugging tools.
  38. * Each entry is only valid when its finished flag is set.
  39. */
  40. #define MCE_LOG_LEN 32
  41. struct mce_log {
  42. char signature[12]; /* "MACHINECHECK" */
  43. unsigned len; /* = MCE_LOG_LEN */
  44. unsigned next;
  45. unsigned flags;
  46. unsigned pad0;
  47. struct mce entry[MCE_LOG_LEN];
  48. };
  49. #define MCE_OVERFLOW 0 /* bit 0 in flags means overflow */
  50. #define MCE_LOG_SIGNATURE "MACHINECHECK"
  51. #define MCE_GET_RECORD_LEN _IOR('M', 1, int)
  52. #define MCE_GET_LOG_LEN _IOR('M', 2, int)
  53. #define MCE_GETCLEAR_FLAGS _IOR('M', 3, int)
  54. /* Software defined banks */
  55. #define MCE_EXTENDED_BANK 128
  56. #define MCE_THERMAL_BANK MCE_EXTENDED_BANK + 0
  57. void mce_log(struct mce *m);
  58. #ifdef CONFIG_X86_MCE_INTEL
  59. void mce_intel_feature_init(struct cpuinfo_x86 *c);
  60. #else
  61. static inline void mce_intel_feature_init(struct cpuinfo_x86 *c)
  62. {
  63. }
  64. #endif
  65. #endif