blob: 014871e169ccf2b9ee98824d0172713ffc1ab454 [file] [log] [blame]
Douglas Thompson7c9281d2007-07-19 01:49:33 -07001
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
10#ifndef __EDAC_MODULE_H__
11#define __EDAC_MODULE_H__
12
Mauro Carvalho Chehab78d88e82016-10-29 15:16:34 -020013#include "edac_mc.h"
14#include "edac_pci.h"
15#include "edac_device.h"
Douglas Thompson7c9281d2007-07-19 01:49:33 -070016
17/*
18 * INTERNAL EDAC MODULE:
19 * EDAC memory controller sysfs create/remove functions
20 * and setup/teardown functions
Doug Thompson8096cfa2007-07-19 01:50:27 -070021 *
22 * edac_mc objects
Douglas Thompson7c9281d2007-07-19 01:49:33 -070023 */
Mauro Carvalho Chehab7a623c02012-04-16 16:41:11 -030024 /* on edac_mc_sysfs.c */
25int edac_mc_sysfs_init(void);
26void edac_mc_sysfs_exit(void);
Takashi Iwai4e8d2302015-02-04 11:48:52 +010027extern int edac_create_sysfs_mci_device(struct mem_ctl_info *mci,
28 const struct attribute_group **groups);
Douglas Thompson7c9281d2007-07-19 01:49:33 -070029extern void edac_remove_sysfs_mci_device(struct mem_ctl_info *mci);
Mauro Carvalho Chehab7a623c02012-04-16 16:41:11 -030030void edac_unregister_sysfs(struct mem_ctl_info *mci);
Douglas Thompson7c9281d2007-07-19 01:49:33 -070031extern int edac_get_log_ue(void);
32extern int edac_get_log_ce(void);
33extern int edac_get_panic_on_ue(void);
Dave Jiang4de78c62007-07-19 01:49:54 -070034extern int edac_mc_get_log_ue(void);
35extern int edac_mc_get_log_ce(void);
36extern int edac_mc_get_panic_on_ue(void);
Douglas Thompson7c9281d2007-07-19 01:49:33 -070037extern int edac_get_poll_msec(void);
Dave Jiang81d87cb2007-07-19 01:49:52 -070038extern int edac_mc_get_poll_msec(void);
Douglas Thompson7c9281d2007-07-19 01:49:33 -070039
Mauro Carvalho Chehab6e84d352012-04-30 10:24:43 -030040unsigned edac_dimm_info_location(struct dimm_info *dimm, char *buf,
41 unsigned len);
42
Mauro Carvalho Chehab7a623c02012-04-16 16:41:11 -030043 /* on edac_device.c */
Douglas Thompson1c3631f2007-07-19 01:50:29 -070044extern int edac_device_register_sysfs_main_kobj(
45 struct edac_device_ctl_info *edac_dev);
46extern void edac_device_unregister_sysfs_main_kobj(
47 struct edac_device_ctl_info *edac_dev);
Douglas Thompson7c9281d2007-07-19 01:49:33 -070048extern int edac_device_create_sysfs(struct edac_device_ctl_info *edac_dev);
49extern void edac_device_remove_sysfs(struct edac_device_ctl_info *edac_dev);
Douglas Thompson7c9281d2007-07-19 01:49:33 -070050
Douglas Thompsone27e3da2007-07-19 01:49:36 -070051/* edac core workqueue: single CPU mode */
Borislav Petkovc4cf3b42015-11-30 19:02:01 +010052int edac_workqueue_setup(void);
53void edac_workqueue_teardown(void);
54bool edac_queue_work(struct delayed_work *work, unsigned long delay);
55bool edac_stop_work(struct delayed_work *work);
56bool edac_mod_work(struct delayed_work *work, unsigned long delay);
57
Douglas Thompson079708b2007-07-19 01:49:58 -070058extern void edac_device_reset_delay_period(struct edac_device_ctl_info
59 *edac_dev, unsigned long value);
Borislav Petkov9da21b12014-02-03 15:05:13 -050060extern void edac_mc_reset_delay_period(unsigned long value);
Doug Thompsonbce19682007-07-26 10:41:14 -070061
Mauro Carvalho Chehab93e4fe62012-04-16 10:18:12 -030062extern void *edac_align_ptr(void **p, unsigned size, int n_elems);
Douglas Thompson7c9281d2007-07-19 01:49:33 -070063
64/*
Rob Herringe7930ba2012-06-11 21:32:12 -050065 * EDAC debugfs functions
66 */
Borislav Petkov4397bcb2015-09-22 12:16:05 +020067
68#define edac_debugfs_remove_recursive debugfs_remove_recursive
69#define edac_debugfs_remove debugfs_remove
Rob Herringe7930ba2012-06-11 21:32:12 -050070#ifdef CONFIG_EDAC_DEBUG
71int edac_debugfs_init(void);
72void edac_debugfs_exit(void);
Borislav Petkov7ac8bf92015-09-22 11:56:04 +020073int edac_create_debugfs_nodes(struct mem_ctl_info *mci);
Borislav Petkov4397bcb2015-09-22 12:16:05 +020074struct dentry *edac_debugfs_create_dir(const char *dirname);
75struct dentry *
76edac_debugfs_create_dir_at(const char *dirname, struct dentry *parent);
77struct dentry *
78edac_debugfs_create_file(const char *name, umode_t mode, struct dentry *parent,
79 void *data, const struct file_operations *fops);
80struct dentry *
81edac_debugfs_create_x8(const char *name, umode_t mode, struct dentry *parent, u8 *value);
82struct dentry *
83edac_debugfs_create_x16(const char *name, umode_t mode, struct dentry *parent, u16 *value);
Rob Herringe7930ba2012-06-11 21:32:12 -050084#else
Borislav Petkov4397bcb2015-09-22 12:16:05 +020085static inline int edac_debugfs_init(void) { return -ENODEV; }
86static inline void edac_debugfs_exit(void) { }
87static inline int edac_create_debugfs_nodes(struct mem_ctl_info *mci) { return 0; }
88static inline struct dentry *edac_debugfs_create_dir(const char *dirname) { return NULL; }
89static inline struct dentry *
90edac_debugfs_create_dir_at(const char *dirname, struct dentry *parent) { return NULL; }
91static inline struct dentry *
92edac_debugfs_create_file(const char *name, umode_t mode, struct dentry *parent,
93 void *data, const struct file_operations *fops) { return NULL; }
94static inline struct dentry *
95edac_debugfs_create_x8(const char *name, umode_t mode,
96 struct dentry *parent, u8 *value) { return NULL; }
97static inline struct dentry *
98edac_debugfs_create_x16(const char *name, umode_t mode,
99 struct dentry *parent, u16 *value) { return NULL; }
Rob Herringe7930ba2012-06-11 21:32:12 -0500100#endif
101
102/*
Douglas Thompson7c9281d2007-07-19 01:49:33 -0700103 * EDAC PCI functions
104 */
105#ifdef CONFIG_PCI
106extern void edac_pci_do_parity_check(void);
107extern void edac_pci_clear_parity_errors(void);
108extern int edac_sysfs_pci_setup(void);
109extern void edac_sysfs_pci_teardown(void);
Dave Jiang4de78c62007-07-19 01:49:54 -0700110extern int edac_pci_get_check_errors(void);
111extern int edac_pci_get_poll_msec(void);
Doug Thompsond4c14652007-07-26 10:41:15 -0700112extern void edac_pci_remove_sysfs(struct edac_pci_ctl_info *pci);
113extern void edac_pci_handle_pe(struct edac_pci_ctl_info *pci, const char *msg);
114extern void edac_pci_handle_npe(struct edac_pci_ctl_info *pci,
115 const char *msg);
Douglas Thompson079708b2007-07-19 01:49:58 -0700116#else /* CONFIG_PCI */
Douglas Thompson7c9281d2007-07-19 01:49:33 -0700117/* pre-process these away */
118#define edac_pci_do_parity_check()
119#define edac_pci_clear_parity_errors()
120#define edac_sysfs_pci_setup() (0)
121#define edac_sysfs_pci_teardown()
Dave Jiang4de78c62007-07-19 01:49:54 -0700122#define edac_pci_get_check_errors()
123#define edac_pci_get_poll_msec()
Doug Thompsond4c14652007-07-26 10:41:15 -0700124#define edac_pci_handle_pe()
125#define edac_pci_handle_npe()
Douglas Thompson079708b2007-07-19 01:49:58 -0700126#endif /* CONFIG_PCI */
Douglas Thompson7c9281d2007-07-19 01:49:33 -0700127
Douglas Thompson079708b2007-07-19 01:49:58 -0700128#endif /* __EDAC_MODULE_H__ */