27 #include <linux/device.h>
31 #include <linux/module.h>
35 #define ERR_DATA_BUFFER_SIZE 3 // Three 8-byte;
37 #define define_one_ro(name) \
38 static DEVICE_ATTR(name, 0444, show_##name, NULL)
40 #define define_one_rw(name) \
41 static DEVICE_ATTR(name, 0644, show_##name, store_##name)
58 show_##name(struct device *dev, struct device_attribute *attr, \
62 return sprintf(buf, "%lx\n", name[cpu]); \
67 store_##name(struct device *dev, struct device_attribute *attr, \
68 const char *buf, size_t size) \
70 unsigned int cpu=dev->id; \
71 name[cpu] = simple_strtoull(buf, NULL, 16); \
84 unsigned int cpu=dev->id;
92 err_data_buffer[cpu].
data1,
93 err_data_buffer[cpu].
data2,
94 err_data_buffer[cpu].
data3);
100 status[
cpu]=ia64_pal_mc_error_inject_phys(err_type_info[cpu],
101 err_struct_info[cpu],
107 status[
cpu]=ia64_pal_mc_error_inject_virt(err_type_info[cpu],
108 err_struct_info[cpu],
133 unsigned int cpu=dev->id;
139 const char *buf,
size_t size)
141 unsigned int cpu=dev->
id;
149 printk(
"Virtual address %lx is not existing.\n",virt_addr);
159 store(err_struct_info)
165 unsigned int cpu=dev->id;
167 return sprintf(buf,
"%lx, %lx, %lx\n",
168 err_data_buffer[cpu].data1,
169 err_data_buffer[cpu].data2,
170 err_data_buffer[cpu].data3);
174 store_err_data_buffer(
struct device *dev,
176 const char *buf,
size_t size)
178 unsigned int cpu=dev->
id;
182 printk(
"write err_data_buffer=[%lx,%lx,%lx] on cpu%d\n",
183 err_data_buffer[cpu].data1,
184 err_data_buffer[cpu].data2,
185 err_data_buffer[cpu].data3,
188 ret=
sscanf(buf,
"%lx, %lx, %lx",
189 &err_data_buffer[cpu].data1,
190 &err_data_buffer[cpu].data2,
191 &err_data_buffer[cpu].data3);
212 &dev_attr_call_start.attr,
213 &dev_attr_virtual_to_phys.attr,
214 &dev_attr_err_type_info.attr,
215 &dev_attr_err_struct_info.attr,
216 &dev_attr_err_data_buffer.attr,
217 &dev_attr_status.attr,
218 &dev_attr_capabilities.attr,
219 &dev_attr_resources.attr,
224 .attrs = default_attrs,
239 unsigned long action,
void *hcpu)
241 unsigned int cpu = (
unsigned long)hcpu;
248 err_inject_add_dev(sys_dev);
252 err_inject_remove_dev(sys_dev);
261 .notifier_call = err_inject_cpu_callback,
265 err_inject_init(
void)
273 err_inject_cpu_callback(&err_inject_cpu_notifier,
CPU_ONLINE,
283 err_inject_exit(
void)