14 #include <linux/device.h>
16 #include <linux/module.h>
28 #define EDAC_MCE_ATTR(_name, _mode, _show, _store) \
29 static struct edac_mce_attr mce_attr_##_name = __ATTR(_name, _mode, _show, _store)
31 static struct kobject *mce_kobj;
36 static struct mce i_mce;
38 #define MCE_INJECT_STORE(reg) \
39 static ssize_t edac_inject_##reg##_store(struct kobject *kobj, \
40 struct edac_mce_attr *attr, \
41 const char *data, size_t count)\
44 unsigned long value; \
46 ret = strict_strtoul(data, 16, &value); \
48 printk(KERN_ERR "Error writing MCE " #reg " field.\n"); \
59 #define MCE_INJECT_SHOW(reg) \
60 static ssize_t edac_inject_##reg##_show(struct kobject *kobj, \
61 struct edac_mce_attr *attr, \
64 return sprintf(buf, "0x%016llx\n", i_mce.reg); \
108 return sprintf(buf,
"%d\n", i_mce.bank);
113 static struct edac_mce_attr *sysfs_attrs[] = { &mce_attr_status, &mce_attr_misc,
114 &mce_attr_addr, &mce_attr_bank
117 static int __init edac_init_mce_inject(
void)
133 for (i = 0; i <
ARRAY_SIZE(sysfs_attrs); i++) {
137 sysfs_attrs[i]->attr.name);
138 goto err_sysfs_create;
155 static void __exit edac_exit_mce_inject(
void)