diff options
author | Mauro Carvalho Chehab <mchehab@redhat.com> | 2012-06-12 09:55:57 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2012-06-27 08:01:30 -0400 |
commit | 38ced28b21efff18fd5e5c98a92830e8f0031cee (patch) | |
tree | e409eed80e257faa01acc1cdc05cb7c0e0be7cb2 /drivers/edac/edac_mc_sysfs.c | |
parent | 69154d069869b612383cef9d594f39b34ffba6dd (diff) |
edac: allow specifying the error count with fake_inject
In order to test if the error counters are properly incremented,
add a way to specify how many errors were generated by a trace.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/edac/edac_mc_sysfs.c')
-rw-r--r-- | drivers/edac/edac_mc_sysfs.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/drivers/edac/edac_mc_sysfs.c b/drivers/edac/edac_mc_sysfs.c index a2bf7e9dd6de..ed0bc07b8503 100644 --- a/drivers/edac/edac_mc_sysfs.c +++ b/drivers/edac/edac_mc_sysfs.c | |||
@@ -812,18 +812,24 @@ static ssize_t edac_fake_inject_write(struct file *file, | |||
812 | struct device *dev = file->private_data; | 812 | struct device *dev = file->private_data; |
813 | struct mem_ctl_info *mci = to_mci(dev); | 813 | struct mem_ctl_info *mci = to_mci(dev); |
814 | static enum hw_event_mc_err_type type; | 814 | static enum hw_event_mc_err_type type; |
815 | u16 errcount = mci->fake_inject_count; | ||
816 | |||
817 | if (!errcount) | ||
818 | errcount = 1; | ||
815 | 819 | ||
816 | type = mci->fake_inject_ue ? HW_EVENT_ERR_UNCORRECTED | 820 | type = mci->fake_inject_ue ? HW_EVENT_ERR_UNCORRECTED |
817 | : HW_EVENT_ERR_CORRECTED; | 821 | : HW_EVENT_ERR_CORRECTED; |
818 | 822 | ||
819 | printk(KERN_DEBUG | 823 | printk(KERN_DEBUG |
820 | "Generating a %s fake error to %d.%d.%d to test core handling. NOTE: this won't test the driver-specific decoding logic.\n", | 824 | "Generating %d %s fake error%s to %d.%d.%d to test core handling. NOTE: this won't test the driver-specific decoding logic.\n", |
825 | errcount, | ||
821 | (type == HW_EVENT_ERR_UNCORRECTED) ? "UE" : "CE", | 826 | (type == HW_EVENT_ERR_UNCORRECTED) ? "UE" : "CE", |
827 | errcount > 1 ? "s" : "", | ||
822 | mci->fake_inject_layer[0], | 828 | mci->fake_inject_layer[0], |
823 | mci->fake_inject_layer[1], | 829 | mci->fake_inject_layer[1], |
824 | mci->fake_inject_layer[2] | 830 | mci->fake_inject_layer[2] |
825 | ); | 831 | ); |
826 | edac_mc_handle_error(type, mci, 1, 0, 0, 0, | 832 | edac_mc_handle_error(type, mci, errcount, 0, 0, 0, |
827 | mci->fake_inject_layer[0], | 833 | mci->fake_inject_layer[0], |
828 | mci->fake_inject_layer[1], | 834 | mci->fake_inject_layer[1], |
829 | mci->fake_inject_layer[2], | 835 | mci->fake_inject_layer[2], |
@@ -944,6 +950,11 @@ int edac_create_debug_nodes(struct mem_ctl_info *mci) | |||
944 | if (!d) | 950 | if (!d) |
945 | goto nomem; | 951 | goto nomem; |
946 | 952 | ||
953 | d = debugfs_create_u16("fake_inject_count", S_IRUGO | S_IWUSR, parent, | ||
954 | &mci->fake_inject_count); | ||
955 | if (!d) | ||
956 | goto nomem; | ||
957 | |||
947 | d = debugfs_create_file("fake_inject", S_IWUSR, parent, | 958 | d = debugfs_create_file("fake_inject", S_IWUSR, parent, |
948 | &mci->dev, | 959 | &mci->dev, |
949 | &debug_fake_inject_fops); | 960 | &debug_fake_inject_fops); |