mce.c 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. /*
  2. * mce.c - x86 Machine Check Exception Reporting
  3. * (c) 2002 Alan Cox <alan@redhat.com>, Dave Jones <davej@codemonkey.org.uk>
  4. */
  5. #include <linux/init.h>
  6. #include <linux/types.h>
  7. #include <linux/kernel.h>
  8. #include <linux/config.h>
  9. #include <linux/module.h>
  10. #include <linux/smp.h>
  11. #include <linux/thread_info.h>
  12. #include <asm/processor.h>
  13. #include <asm/system.h>
  14. #include "mce.h"
  15. int mce_disabled __devinitdata = 0;
  16. int nr_mce_banks;
  17. EXPORT_SYMBOL_GPL(nr_mce_banks); /* non-fatal.o */
  18. /* Handle unconfigured int18 (should never happen) */
  19. static fastcall void unexpected_machine_check(struct pt_regs * regs, long error_code)
  20. {
  21. printk(KERN_ERR "CPU#%d: Unexpected int18 (Machine Check).\n", smp_processor_id());
  22. }
  23. /* Call the installed machine check handler for this CPU setup. */
  24. void fastcall (*machine_check_vector)(struct pt_regs *, long error_code) = unexpected_machine_check;
  25. /* This has to be run for each processor */
  26. void __devinit mcheck_init(struct cpuinfo_x86 *c)
  27. {
  28. if (mce_disabled==1)
  29. return;
  30. switch (c->x86_vendor) {
  31. case X86_VENDOR_AMD:
  32. if (c->x86==6 || c->x86==15)
  33. amd_mcheck_init(c);
  34. break;
  35. case X86_VENDOR_INTEL:
  36. if (c->x86==5)
  37. intel_p5_mcheck_init(c);
  38. if (c->x86==6)
  39. intel_p6_mcheck_init(c);
  40. if (c->x86==15)
  41. intel_p4_mcheck_init(c);
  42. break;
  43. case X86_VENDOR_CENTAUR:
  44. if (c->x86==5)
  45. winchip_mcheck_init(c);
  46. break;
  47. default:
  48. break;
  49. }
  50. }
  51. static int __init mcheck_disable(char *str)
  52. {
  53. mce_disabled = 1;
  54. return 0;
  55. }
  56. static int __init mcheck_enable(char *str)
  57. {
  58. mce_disabled = -1;
  59. return 0;
  60. }
  61. __setup("nomce", mcheck_disable);
  62. __setup("mce", mcheck_enable);