xref: /linux/drivers/edac/edac_module.h (revision 9a87ffc99ec8eb8d35eed7c4f816d75f5cc9662e)
1b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */
27c9281d7SDouglas Thompson 
37c9281d7SDouglas Thompson /*
47c9281d7SDouglas Thompson  * edac_module.h
57c9281d7SDouglas Thompson  *
67c9281d7SDouglas Thompson  * For defining functions/data for within the EDAC_CORE module only
77c9281d7SDouglas Thompson  *
87c9281d7SDouglas Thompson  * written by doug thompson <norsk5@xmission.h>
97c9281d7SDouglas Thompson  */
107c9281d7SDouglas Thompson 
117c9281d7SDouglas Thompson #ifndef	__EDAC_MODULE_H__
127c9281d7SDouglas Thompson #define	__EDAC_MODULE_H__
137c9281d7SDouglas Thompson 
14315bada6SJia He #include <acpi/ghes.h>
1578d88e8aSMauro Carvalho Chehab #include "edac_mc.h"
1678d88e8aSMauro Carvalho Chehab #include "edac_pci.h"
1778d88e8aSMauro Carvalho Chehab #include "edac_device.h"
187c9281d7SDouglas Thompson 
197c9281d7SDouglas Thompson /*
207c9281d7SDouglas Thompson  * INTERNAL EDAC MODULE:
217c9281d7SDouglas Thompson  * EDAC memory controller sysfs create/remove functions
227c9281d7SDouglas Thompson  * and setup/teardown functions
238096cfafSDoug Thompson  *
248096cfafSDoug Thompson  * edac_mc objects
257c9281d7SDouglas Thompson  */
267a623c03SMauro Carvalho Chehab 	/* on edac_mc_sysfs.c */
277a623c03SMauro Carvalho Chehab int edac_mc_sysfs_init(void);
287a623c03SMauro Carvalho Chehab void edac_mc_sysfs_exit(void);
294e8d230dSTakashi Iwai extern int edac_create_sysfs_mci_device(struct mem_ctl_info *mci,
304e8d230dSTakashi Iwai 					const struct attribute_group **groups);
317c9281d7SDouglas Thompson extern void edac_remove_sysfs_mci_device(struct mem_ctl_info *mci);
324de78c68SDave Jiang extern int edac_mc_get_log_ue(void);
334de78c68SDave Jiang extern int edac_mc_get_log_ce(void);
344de78c68SDave Jiang extern int edac_mc_get_panic_on_ue(void);
35d8655e76SEiichi Tsukata extern unsigned int edac_mc_get_poll_msec(void);
367c9281d7SDouglas Thompson 
376e84d359SMauro Carvalho Chehab unsigned edac_dimm_info_location(struct dimm_info *dimm, char *buf,
386e84d359SMauro Carvalho Chehab 				 unsigned len);
396e84d359SMauro Carvalho Chehab 
407a623c03SMauro Carvalho Chehab 	/* on edac_device.c */
411c3631ffSDouglas Thompson extern int edac_device_register_sysfs_main_kobj(
421c3631ffSDouglas Thompson 				struct edac_device_ctl_info *edac_dev);
431c3631ffSDouglas Thompson extern void edac_device_unregister_sysfs_main_kobj(
441c3631ffSDouglas Thompson 				struct edac_device_ctl_info *edac_dev);
457c9281d7SDouglas Thompson extern int edac_device_create_sysfs(struct edac_device_ctl_info *edac_dev);
467c9281d7SDouglas Thompson extern void edac_device_remove_sysfs(struct edac_device_ctl_info *edac_dev);
477c9281d7SDouglas Thompson 
48e27e3dacSDouglas Thompson /* edac core workqueue: single CPU mode */
49c4cf3b45SBorislav Petkov int edac_workqueue_setup(void);
50c4cf3b45SBorislav Petkov void edac_workqueue_teardown(void);
51c4cf3b45SBorislav Petkov bool edac_queue_work(struct delayed_work *work, unsigned long delay);
52c4cf3b45SBorislav Petkov bool edac_stop_work(struct delayed_work *work);
53c4cf3b45SBorislav Petkov bool edac_mod_work(struct delayed_work *work, unsigned long delay);
54c4cf3b45SBorislav Petkov 
55079708b9SDouglas Thompson extern void edac_device_reset_delay_period(struct edac_device_ctl_info
56*e8407743SEliav Farber 					   *edac_dev, unsigned long msec);
579da21b15SBorislav Petkov extern void edac_mc_reset_delay_period(unsigned long value);
58bce19683SDoug Thompson 
597c9281d7SDouglas Thompson /*
60e7930ba4SRob Herring  * EDAC debugfs functions
61e7930ba4SRob Herring  */
624397bcb4SBorislav Petkov 
634397bcb4SBorislav Petkov #define edac_debugfs_remove_recursive debugfs_remove_recursive
644397bcb4SBorislav Petkov #define edac_debugfs_remove debugfs_remove
65e7930ba4SRob Herring #ifdef CONFIG_EDAC_DEBUG
66912ebd99SGreg Kroah-Hartman void edac_debugfs_init(void);
67e7930ba4SRob Herring void edac_debugfs_exit(void);
68912ebd99SGreg Kroah-Hartman void edac_create_debugfs_nodes(struct mem_ctl_info *mci);
694397bcb4SBorislav Petkov struct dentry *edac_debugfs_create_dir(const char *dirname);
704397bcb4SBorislav Petkov struct dentry *
714397bcb4SBorislav Petkov edac_debugfs_create_dir_at(const char *dirname, struct dentry *parent);
724397bcb4SBorislav Petkov struct dentry *
734397bcb4SBorislav Petkov edac_debugfs_create_file(const char *name, umode_t mode, struct dentry *parent,
744397bcb4SBorislav Petkov 			 void *data, const struct file_operations *fops);
7540d79624SGreg Kroah-Hartman void edac_debugfs_create_x8(const char *name, umode_t mode,
7640d79624SGreg Kroah-Hartman 			    struct dentry *parent, u8 *value);
7740d79624SGreg Kroah-Hartman void edac_debugfs_create_x16(const char *name, umode_t mode,
7840d79624SGreg Kroah-Hartman 			     struct dentry *parent, u16 *value);
790ecace04SJan Luebbe void edac_debugfs_create_x32(const char *name, umode_t mode,
800ecace04SJan Luebbe 			     struct dentry *parent, u32 *value);
81e7930ba4SRob Herring #else
edac_debugfs_init(void)82912ebd99SGreg Kroah-Hartman static inline void edac_debugfs_init(void)					{ }
edac_debugfs_exit(void)83e7930ba4SRob Herring static inline void edac_debugfs_exit(void)					{ }
edac_create_debugfs_nodes(struct mem_ctl_info * mci)84912ebd99SGreg Kroah-Hartman static inline void edac_create_debugfs_nodes(struct mem_ctl_info *mci)		{ }
edac_debugfs_create_dir(const char * dirname)854397bcb4SBorislav Petkov static inline struct dentry *edac_debugfs_create_dir(const char *dirname)	{ return NULL; }
864397bcb4SBorislav Petkov static inline struct dentry *
edac_debugfs_create_dir_at(const char * dirname,struct dentry * parent)874397bcb4SBorislav Petkov edac_debugfs_create_dir_at(const char *dirname, struct dentry *parent)		{ return NULL; }
884397bcb4SBorislav Petkov static inline struct dentry *
edac_debugfs_create_file(const char * name,umode_t mode,struct dentry * parent,void * data,const struct file_operations * fops)894397bcb4SBorislav Petkov edac_debugfs_create_file(const char *name, umode_t mode, struct dentry *parent,
904397bcb4SBorislav Petkov 			 void *data, const struct file_operations *fops)	{ return NULL; }
edac_debugfs_create_x8(const char * name,umode_t mode,struct dentry * parent,u8 * value)9140d79624SGreg Kroah-Hartman static inline void edac_debugfs_create_x8(const char *name, umode_t mode,
9240d79624SGreg Kroah-Hartman 					  struct dentry *parent, u8 *value)	{ }
edac_debugfs_create_x16(const char * name,umode_t mode,struct dentry * parent,u16 * value)9340d79624SGreg Kroah-Hartman static inline void edac_debugfs_create_x16(const char *name, umode_t mode,
9440d79624SGreg Kroah-Hartman 					   struct dentry *parent, u16 *value)	{ }
edac_debugfs_create_x32(const char * name,umode_t mode,struct dentry * parent,u32 * value)950ecace04SJan Luebbe static inline void edac_debugfs_create_x32(const char *name, umode_t mode,
960ecace04SJan Luebbe 		       struct dentry *parent, u32 *value)			{ }
97e7930ba4SRob Herring #endif
98e7930ba4SRob Herring 
99e7930ba4SRob Herring /*
1007c9281d7SDouglas Thompson  * EDAC PCI functions
1017c9281d7SDouglas Thompson  */
1027c9281d7SDouglas Thompson #ifdef	CONFIG_PCI
1037c9281d7SDouglas Thompson extern void edac_pci_do_parity_check(void);
1047c9281d7SDouglas Thompson extern void edac_pci_clear_parity_errors(void);
1057c9281d7SDouglas Thompson extern int edac_sysfs_pci_setup(void);
1067c9281d7SDouglas Thompson extern void edac_sysfs_pci_teardown(void);
1074de78c68SDave Jiang extern int edac_pci_get_check_errors(void);
1084de78c68SDave Jiang extern int edac_pci_get_poll_msec(void);
109d4c1465bSDoug Thompson extern void edac_pci_remove_sysfs(struct edac_pci_ctl_info *pci);
110d4c1465bSDoug Thompson extern void edac_pci_handle_pe(struct edac_pci_ctl_info *pci, const char *msg);
111d4c1465bSDoug Thompson extern void edac_pci_handle_npe(struct edac_pci_ctl_info *pci,
112d4c1465bSDoug Thompson 				const char *msg);
1137c9281d7SDouglas Thompson #else				/* CONFIG_PCI */
1147c9281d7SDouglas Thompson /* pre-process these away */
1157c9281d7SDouglas Thompson #define edac_pci_do_parity_check()
1167c9281d7SDouglas Thompson #define edac_pci_clear_parity_errors()
1177c9281d7SDouglas Thompson #define edac_sysfs_pci_setup()  (0)
1187c9281d7SDouglas Thompson #define edac_sysfs_pci_teardown()
1194de78c68SDave Jiang #define edac_pci_get_check_errors()
1204de78c68SDave Jiang #define edac_pci_get_poll_msec()
121d4c1465bSDoug Thompson #define edac_pci_handle_pe()
122d4c1465bSDoug Thompson #define edac_pci_handle_npe()
1237c9281d7SDouglas Thompson #endif				/* CONFIG_PCI */
1247c9281d7SDouglas Thompson 
1257c9281d7SDouglas Thompson #endif				/* __EDAC_MODULE_H__ */
126