edac_module.h 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * edac_module.h
  4. *
  5. * For defining functions/data for within the EDAC_CORE module only
  6. *
  7. * written by doug thompson <norsk5@xmission.h>
  8. */
  9. #ifndef __EDAC_MODULE_H__
  10. #define __EDAC_MODULE_H__
  11. #include <acpi/ghes.h>
  12. #include "edac_mc.h"
  13. #include "edac_pci.h"
  14. #include "edac_device.h"
  15. /*
  16. * INTERNAL EDAC MODULE:
  17. * EDAC memory controller sysfs create/remove functions
  18. * and setup/teardown functions
  19. *
  20. * edac_mc objects
  21. */
  22. /* on edac_mc_sysfs.c */
  23. int edac_mc_sysfs_init(void);
  24. void edac_mc_sysfs_exit(void);
  25. extern int edac_create_sysfs_mci_device(struct mem_ctl_info *mci,
  26. const struct attribute_group **groups);
  27. extern void edac_remove_sysfs_mci_device(struct mem_ctl_info *mci);
  28. extern int edac_mc_get_log_ue(void);
  29. extern int edac_mc_get_log_ce(void);
  30. extern int edac_mc_get_panic_on_ue(void);
  31. extern unsigned int edac_mc_get_poll_msec(void);
  32. unsigned edac_dimm_info_location(struct dimm_info *dimm, char *buf,
  33. unsigned len);
  34. /* on edac_device.c */
  35. extern int edac_device_register_sysfs_main_kobj(
  36. struct edac_device_ctl_info *edac_dev);
  37. extern void edac_device_unregister_sysfs_main_kobj(
  38. struct edac_device_ctl_info *edac_dev);
  39. extern int edac_device_create_sysfs(struct edac_device_ctl_info *edac_dev);
  40. extern void edac_device_remove_sysfs(struct edac_device_ctl_info *edac_dev);
  41. /* edac core workqueue: single CPU mode */
  42. int edac_workqueue_setup(void);
  43. void edac_workqueue_teardown(void);
  44. bool edac_queue_work(struct delayed_work *work, unsigned long delay);
  45. bool edac_stop_work(struct delayed_work *work);
  46. bool edac_mod_work(struct delayed_work *work, unsigned long delay);
  47. extern void edac_device_reset_delay_period(struct edac_device_ctl_info
  48. *edac_dev, unsigned long msec);
  49. extern void edac_mc_reset_delay_period(unsigned long value);
  50. /*
  51. * EDAC debugfs functions
  52. */
  53. #define edac_debugfs_remove_recursive debugfs_remove_recursive
  54. #define edac_debugfs_remove debugfs_remove
  55. #ifdef CONFIG_EDAC_DEBUG
  56. void edac_debugfs_init(void);
  57. void edac_debugfs_exit(void);
  58. void edac_create_debugfs_nodes(struct mem_ctl_info *mci);
  59. struct dentry *edac_debugfs_create_dir(const char *dirname);
  60. struct dentry *
  61. edac_debugfs_create_dir_at(const char *dirname, struct dentry *parent);
  62. struct dentry *
  63. edac_debugfs_create_file(const char *name, umode_t mode, struct dentry *parent,
  64. void *data, const struct file_operations *fops);
  65. void edac_debugfs_create_x8(const char *name, umode_t mode,
  66. struct dentry *parent, u8 *value);
  67. void edac_debugfs_create_x16(const char *name, umode_t mode,
  68. struct dentry *parent, u16 *value);
  69. void edac_debugfs_create_x32(const char *name, umode_t mode,
  70. struct dentry *parent, u32 *value);
  71. #else
  72. static inline void edac_debugfs_init(void) { }
  73. static inline void edac_debugfs_exit(void) { }
  74. static inline void edac_create_debugfs_nodes(struct mem_ctl_info *mci) { }
  75. static inline struct dentry *edac_debugfs_create_dir(const char *dirname) { return NULL; }
  76. static inline struct dentry *
  77. edac_debugfs_create_dir_at(const char *dirname, struct dentry *parent) { return NULL; }
  78. static inline struct dentry *
  79. edac_debugfs_create_file(const char *name, umode_t mode, struct dentry *parent,
  80. void *data, const struct file_operations *fops) { return NULL; }
  81. static inline void edac_debugfs_create_x8(const char *name, umode_t mode,
  82. struct dentry *parent, u8 *value) { }
  83. static inline void edac_debugfs_create_x16(const char *name, umode_t mode,
  84. struct dentry *parent, u16 *value) { }
  85. static inline void edac_debugfs_create_x32(const char *name, umode_t mode,
  86. struct dentry *parent, u32 *value) { }
  87. #endif
  88. /*
  89. * EDAC PCI functions
  90. */
  91. #ifdef CONFIG_PCI
  92. extern void edac_pci_do_parity_check(void);
  93. extern void edac_pci_clear_parity_errors(void);
  94. extern int edac_sysfs_pci_setup(void);
  95. extern void edac_sysfs_pci_teardown(void);
  96. extern int edac_pci_get_check_errors(void);
  97. extern int edac_pci_get_poll_msec(void);
  98. extern void edac_pci_remove_sysfs(struct edac_pci_ctl_info *pci);
  99. extern void edac_pci_handle_pe(struct edac_pci_ctl_info *pci, const char *msg);
  100. extern void edac_pci_handle_npe(struct edac_pci_ctl_info *pci,
  101. const char *msg);
  102. #else /* CONFIG_PCI */
  103. /* pre-process these away */
  104. #define edac_pci_do_parity_check()
  105. #define edac_pci_clear_parity_errors()
  106. #define edac_sysfs_pci_setup() (0)
  107. #define edac_sysfs_pci_teardown()
  108. #define edac_pci_get_check_errors()
  109. #define edac_pci_get_poll_msec()
  110. #define edac_pci_handle_pe()
  111. #define edac_pci_handle_npe()
  112. #endif /* CONFIG_PCI */
  113. #endif /* __EDAC_MODULE_H__ */