edac_module.h 4.7 KB

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