edac_stub.c 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /*
  2. * common EDAC components that must be in kernel
  3. *
  4. * Author: Dave Jiang <djiang@mvista.com>
  5. *
  6. * 2007 (c) MontaVista Software, Inc.
  7. * 2010 (c) Advanced Micro Devices Inc.
  8. * Borislav Petkov <bp@alien8.de>
  9. *
  10. * This file is licensed under the terms of the GNU General Public
  11. * License version 2. This program is licensed "as is" without any
  12. * warranty of any kind, whether express or implied.
  13. *
  14. */
  15. #include <linux/module.h>
  16. #include <linux/edac.h>
  17. #include <linux/atomic.h>
  18. #include <linux/device.h>
  19. int edac_op_state = EDAC_OPSTATE_INVAL;
  20. EXPORT_SYMBOL_GPL(edac_op_state);
  21. atomic_t edac_handlers = ATOMIC_INIT(0);
  22. EXPORT_SYMBOL_GPL(edac_handlers);
  23. int edac_err_assert = 0;
  24. EXPORT_SYMBOL_GPL(edac_err_assert);
  25. int edac_report_status = EDAC_REPORTING_ENABLED;
  26. EXPORT_SYMBOL_GPL(edac_report_status);
  27. static int __init edac_report_setup(char *str)
  28. {
  29. if (!str)
  30. return -EINVAL;
  31. if (!strncmp(str, "on", 2))
  32. set_edac_report_status(EDAC_REPORTING_ENABLED);
  33. else if (!strncmp(str, "off", 3))
  34. set_edac_report_status(EDAC_REPORTING_DISABLED);
  35. else if (!strncmp(str, "force", 5))
  36. set_edac_report_status(EDAC_REPORTING_FORCE);
  37. return 0;
  38. }
  39. __setup("edac_report=", edac_report_setup);
  40. /*
  41. * called to determine if there is an EDAC driver interested in
  42. * knowing an event (such as NMI) occurred
  43. */
  44. int edac_handler_set(void)
  45. {
  46. if (edac_op_state == EDAC_OPSTATE_POLL)
  47. return 0;
  48. return atomic_read(&edac_handlers);
  49. }
  50. EXPORT_SYMBOL_GPL(edac_handler_set);
  51. /*
  52. * handler for NMI type of interrupts to assert error
  53. */
  54. void edac_atomic_assert_error(void)
  55. {
  56. edac_err_assert++;
  57. }
  58. EXPORT_SYMBOL_GPL(edac_atomic_assert_error);