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