edac_mce.c 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /* Provides edac interface to mcelog events
  2. *
  3. * This file may be distributed under the terms of the
  4. * GNU General Public License version 2.
  5. *
  6. * Copyright (c) 2009 by:
  7. * Mauro Carvalho Chehab <mchehab@redhat.com>
  8. *
  9. * Red Hat Inc. http://www.redhat.com
  10. */
  11. #include <linux/module.h>
  12. #include <linux/edac_mce.h>
  13. #include <asm/mce.h>
  14. int edac_mce_enabled;
  15. EXPORT_SYMBOL_GPL(edac_mce_enabled);
  16. /*
  17. * Extension interface
  18. */
  19. static LIST_HEAD(edac_mce_list);
  20. static DEFINE_MUTEX(edac_mce_lock);
  21. int edac_mce_register(struct edac_mce *edac_mce)
  22. {
  23. mutex_lock(&edac_mce_lock);
  24. list_add_tail(&edac_mce->list, &edac_mce_list);
  25. mutex_unlock(&edac_mce_lock);
  26. return 0;
  27. }
  28. EXPORT_SYMBOL(edac_mce_register);
  29. void edac_mce_unregister(struct edac_mce *edac_mce)
  30. {
  31. mutex_lock(&edac_mce_lock);
  32. list_del(&edac_mce->list);
  33. mutex_unlock(&edac_mce_lock);
  34. }
  35. EXPORT_SYMBOL(edac_mce_unregister);
  36. int edac_mce_parse(struct mce *mce)
  37. {
  38. struct edac_mce *edac_mce;
  39. list_for_each_entry(edac_mce, &edac_mce_list, list) {
  40. if (edac_mce->check_error(edac_mce->priv, mce))
  41. return 1;
  42. }
  43. /* Nobody queued the error */
  44. return 0;
  45. }
  46. EXPORT_SYMBOL_GPL(edac_mce_parse);
  47. MODULE_LICENSE("GPL");
  48. MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>");
  49. MODULE_AUTHOR("Red Hat Inc. (http://www.redhat.com)");
  50. MODULE_DESCRIPTION("EDAC Driver for mcelog captured errors");