18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 28c2ecf20Sopenharmony_ci 38c2ecf20Sopenharmony_ci/* 48c2ecf20Sopenharmony_ci * edac_module.h 58c2ecf20Sopenharmony_ci * 68c2ecf20Sopenharmony_ci * For defining functions/data for within the EDAC_CORE module only 78c2ecf20Sopenharmony_ci * 88c2ecf20Sopenharmony_ci * written by doug thompson <norsk5@xmission.h> 98c2ecf20Sopenharmony_ci */ 108c2ecf20Sopenharmony_ci 118c2ecf20Sopenharmony_ci#ifndef __EDAC_MODULE_H__ 128c2ecf20Sopenharmony_ci#define __EDAC_MODULE_H__ 138c2ecf20Sopenharmony_ci 148c2ecf20Sopenharmony_ci#include "edac_mc.h" 158c2ecf20Sopenharmony_ci#include "edac_pci.h" 168c2ecf20Sopenharmony_ci#include "edac_device.h" 178c2ecf20Sopenharmony_ci 188c2ecf20Sopenharmony_ci/* 198c2ecf20Sopenharmony_ci * INTERNAL EDAC MODULE: 208c2ecf20Sopenharmony_ci * EDAC memory controller sysfs create/remove functions 218c2ecf20Sopenharmony_ci * and setup/teardown functions 228c2ecf20Sopenharmony_ci * 238c2ecf20Sopenharmony_ci * edac_mc objects 248c2ecf20Sopenharmony_ci */ 258c2ecf20Sopenharmony_ci /* on edac_mc_sysfs.c */ 268c2ecf20Sopenharmony_ciint edac_mc_sysfs_init(void); 278c2ecf20Sopenharmony_civoid edac_mc_sysfs_exit(void); 288c2ecf20Sopenharmony_ciextern int edac_create_sysfs_mci_device(struct mem_ctl_info *mci, 298c2ecf20Sopenharmony_ci const struct attribute_group **groups); 308c2ecf20Sopenharmony_ciextern void edac_remove_sysfs_mci_device(struct mem_ctl_info *mci); 318c2ecf20Sopenharmony_ciextern int edac_get_log_ue(void); 328c2ecf20Sopenharmony_ciextern int edac_get_log_ce(void); 338c2ecf20Sopenharmony_ciextern int edac_get_panic_on_ue(void); 348c2ecf20Sopenharmony_ciextern int edac_mc_get_log_ue(void); 358c2ecf20Sopenharmony_ciextern int edac_mc_get_log_ce(void); 368c2ecf20Sopenharmony_ciextern int edac_mc_get_panic_on_ue(void); 378c2ecf20Sopenharmony_ciextern int edac_get_poll_msec(void); 388c2ecf20Sopenharmony_ciextern unsigned int edac_mc_get_poll_msec(void); 398c2ecf20Sopenharmony_ci 408c2ecf20Sopenharmony_ciunsigned edac_dimm_info_location(struct dimm_info *dimm, char *buf, 418c2ecf20Sopenharmony_ci unsigned len); 428c2ecf20Sopenharmony_ci 438c2ecf20Sopenharmony_ci /* on edac_device.c */ 448c2ecf20Sopenharmony_ciextern int edac_device_register_sysfs_main_kobj( 458c2ecf20Sopenharmony_ci struct edac_device_ctl_info *edac_dev); 468c2ecf20Sopenharmony_ciextern void edac_device_unregister_sysfs_main_kobj( 478c2ecf20Sopenharmony_ci struct edac_device_ctl_info *edac_dev); 488c2ecf20Sopenharmony_ciextern int edac_device_create_sysfs(struct edac_device_ctl_info *edac_dev); 498c2ecf20Sopenharmony_ciextern void edac_device_remove_sysfs(struct edac_device_ctl_info *edac_dev); 508c2ecf20Sopenharmony_ci 518c2ecf20Sopenharmony_ci/* edac core workqueue: single CPU mode */ 528c2ecf20Sopenharmony_ciint edac_workqueue_setup(void); 538c2ecf20Sopenharmony_civoid edac_workqueue_teardown(void); 548c2ecf20Sopenharmony_cibool edac_queue_work(struct delayed_work *work, unsigned long delay); 558c2ecf20Sopenharmony_cibool edac_stop_work(struct delayed_work *work); 568c2ecf20Sopenharmony_cibool edac_mod_work(struct delayed_work *work, unsigned long delay); 578c2ecf20Sopenharmony_ci 588c2ecf20Sopenharmony_ciextern void edac_device_reset_delay_period(struct edac_device_ctl_info 598c2ecf20Sopenharmony_ci *edac_dev, unsigned long msec); 608c2ecf20Sopenharmony_ciextern void edac_mc_reset_delay_period(unsigned long value); 618c2ecf20Sopenharmony_ci 628c2ecf20Sopenharmony_ciextern void *edac_align_ptr(void **p, unsigned size, int n_elems); 638c2ecf20Sopenharmony_ci 648c2ecf20Sopenharmony_ci/* 658c2ecf20Sopenharmony_ci * EDAC debugfs functions 668c2ecf20Sopenharmony_ci */ 678c2ecf20Sopenharmony_ci 688c2ecf20Sopenharmony_ci#define edac_debugfs_remove_recursive debugfs_remove_recursive 698c2ecf20Sopenharmony_ci#define edac_debugfs_remove debugfs_remove 708c2ecf20Sopenharmony_ci#ifdef CONFIG_EDAC_DEBUG 718c2ecf20Sopenharmony_civoid edac_debugfs_init(void); 728c2ecf20Sopenharmony_civoid edac_debugfs_exit(void); 738c2ecf20Sopenharmony_civoid edac_create_debugfs_nodes(struct mem_ctl_info *mci); 748c2ecf20Sopenharmony_cistruct dentry *edac_debugfs_create_dir(const char *dirname); 758c2ecf20Sopenharmony_cistruct dentry * 768c2ecf20Sopenharmony_ciedac_debugfs_create_dir_at(const char *dirname, struct dentry *parent); 778c2ecf20Sopenharmony_cistruct dentry * 788c2ecf20Sopenharmony_ciedac_debugfs_create_file(const char *name, umode_t mode, struct dentry *parent, 798c2ecf20Sopenharmony_ci void *data, const struct file_operations *fops); 808c2ecf20Sopenharmony_civoid edac_debugfs_create_x8(const char *name, umode_t mode, 818c2ecf20Sopenharmony_ci struct dentry *parent, u8 *value); 828c2ecf20Sopenharmony_civoid edac_debugfs_create_x16(const char *name, umode_t mode, 838c2ecf20Sopenharmony_ci struct dentry *parent, u16 *value); 848c2ecf20Sopenharmony_civoid edac_debugfs_create_x32(const char *name, umode_t mode, 858c2ecf20Sopenharmony_ci struct dentry *parent, u32 *value); 868c2ecf20Sopenharmony_ci#else 878c2ecf20Sopenharmony_cistatic inline void edac_debugfs_init(void) { } 888c2ecf20Sopenharmony_cistatic inline void edac_debugfs_exit(void) { } 898c2ecf20Sopenharmony_cistatic inline void edac_create_debugfs_nodes(struct mem_ctl_info *mci) { } 908c2ecf20Sopenharmony_cistatic inline struct dentry *edac_debugfs_create_dir(const char *dirname) { return NULL; } 918c2ecf20Sopenharmony_cistatic inline struct dentry * 928c2ecf20Sopenharmony_ciedac_debugfs_create_dir_at(const char *dirname, struct dentry *parent) { return NULL; } 938c2ecf20Sopenharmony_cistatic inline struct dentry * 948c2ecf20Sopenharmony_ciedac_debugfs_create_file(const char *name, umode_t mode, struct dentry *parent, 958c2ecf20Sopenharmony_ci void *data, const struct file_operations *fops) { return NULL; } 968c2ecf20Sopenharmony_cistatic inline void edac_debugfs_create_x8(const char *name, umode_t mode, 978c2ecf20Sopenharmony_ci struct dentry *parent, u8 *value) { } 988c2ecf20Sopenharmony_cistatic inline void edac_debugfs_create_x16(const char *name, umode_t mode, 998c2ecf20Sopenharmony_ci struct dentry *parent, u16 *value) { } 1008c2ecf20Sopenharmony_cistatic inline void edac_debugfs_create_x32(const char *name, umode_t mode, 1018c2ecf20Sopenharmony_ci struct dentry *parent, u32 *value) { } 1028c2ecf20Sopenharmony_ci#endif 1038c2ecf20Sopenharmony_ci 1048c2ecf20Sopenharmony_ci/* 1058c2ecf20Sopenharmony_ci * EDAC PCI functions 1068c2ecf20Sopenharmony_ci */ 1078c2ecf20Sopenharmony_ci#ifdef CONFIG_PCI 1088c2ecf20Sopenharmony_ciextern void edac_pci_do_parity_check(void); 1098c2ecf20Sopenharmony_ciextern void edac_pci_clear_parity_errors(void); 1108c2ecf20Sopenharmony_ciextern int edac_sysfs_pci_setup(void); 1118c2ecf20Sopenharmony_ciextern void edac_sysfs_pci_teardown(void); 1128c2ecf20Sopenharmony_ciextern int edac_pci_get_check_errors(void); 1138c2ecf20Sopenharmony_ciextern int edac_pci_get_poll_msec(void); 1148c2ecf20Sopenharmony_ciextern void edac_pci_remove_sysfs(struct edac_pci_ctl_info *pci); 1158c2ecf20Sopenharmony_ciextern void edac_pci_handle_pe(struct edac_pci_ctl_info *pci, const char *msg); 1168c2ecf20Sopenharmony_ciextern void edac_pci_handle_npe(struct edac_pci_ctl_info *pci, 1178c2ecf20Sopenharmony_ci const char *msg); 1188c2ecf20Sopenharmony_ci#else /* CONFIG_PCI */ 1198c2ecf20Sopenharmony_ci/* pre-process these away */ 1208c2ecf20Sopenharmony_ci#define edac_pci_do_parity_check() 1218c2ecf20Sopenharmony_ci#define edac_pci_clear_parity_errors() 1228c2ecf20Sopenharmony_ci#define edac_sysfs_pci_setup() (0) 1238c2ecf20Sopenharmony_ci#define edac_sysfs_pci_teardown() 1248c2ecf20Sopenharmony_ci#define edac_pci_get_check_errors() 1258c2ecf20Sopenharmony_ci#define edac_pci_get_poll_msec() 1268c2ecf20Sopenharmony_ci#define edac_pci_handle_pe() 1278c2ecf20Sopenharmony_ci#define edac_pci_handle_npe() 1288c2ecf20Sopenharmony_ci#endif /* CONFIG_PCI */ 1298c2ecf20Sopenharmony_ci 1308c2ecf20Sopenharmony_ci#endif /* __EDAC_MODULE_H__ */ 131