diff options
Diffstat (limited to 'drivers/edac/edac_mc.c')
| -rw-r--r-- | drivers/edac/edac_mc.c | 56 | 
1 files changed, 51 insertions, 5 deletions
diff --git a/drivers/edac/edac_mc.c b/drivers/edac/edac_mc.c index b10ee4698b1d..9c205274c1cb 100644 --- a/drivers/edac/edac_mc.c +++ b/drivers/edac/edac_mc.c  | |||
| @@ -38,6 +38,12 @@ | |||
| 38 | 38 | ||
| 39 | #define EDAC_MC_VERSION "edac_mc Ver: 2.0.0 " __DATE__ | 39 | #define EDAC_MC_VERSION "edac_mc Ver: 2.0.0 " __DATE__ | 
| 40 | 40 | ||
| 41 | /* For now, disable the EDAC sysfs code. The sysfs interface that EDAC | ||
| 42 | * presents to user space needs more thought, and is likely to change | ||
| 43 | * substantially. | ||
| 44 | */ | ||
| 45 | #define DISABLE_EDAC_SYSFS | ||
| 46 | |||
| 41 | #ifdef CONFIG_EDAC_DEBUG | 47 | #ifdef CONFIG_EDAC_DEBUG | 
| 42 | /* Values of 0 to 4 will generate output */ | 48 | /* Values of 0 to 4 will generate output */ | 
| 43 | int edac_debug_level = 1; | 49 | int edac_debug_level = 1; | 
| @@ -47,7 +53,7 @@ EXPORT_SYMBOL(edac_debug_level); | |||
| 47 | /* EDAC Controls, setable by module parameter, and sysfs */ | 53 | /* EDAC Controls, setable by module parameter, and sysfs */ | 
| 48 | static int log_ue = 1; | 54 | static int log_ue = 1; | 
| 49 | static int log_ce = 1; | 55 | static int log_ce = 1; | 
| 50 | static int panic_on_ue = 1; | 56 | static int panic_on_ue; | 
| 51 | static int poll_msec = 1000; | 57 | static int poll_msec = 1000; | 
| 52 | 58 | ||
| 53 | static int check_pci_parity = 0; /* default YES check PCI parity */ | 59 | static int check_pci_parity = 0; /* default YES check PCI parity */ | 
| @@ -77,6 +83,8 @@ static int pci_whitelist_count ; | |||
| 77 | 83 | ||
| 78 | /* START sysfs data and methods */ | 84 | /* START sysfs data and methods */ | 
| 79 | 85 | ||
| 86 | #ifndef DISABLE_EDAC_SYSFS | ||
| 87 | |||
| 80 | static const char *mem_types[] = { | 88 | static const char *mem_types[] = { | 
| 81 | [MEM_EMPTY] = "Empty", | 89 | [MEM_EMPTY] = "Empty", | 
| 82 | [MEM_RESERVED] = "Reserved", | 90 | [MEM_RESERVED] = "Reserved", | 
| @@ -132,11 +140,13 @@ static struct kobject edac_pci_kobj; | |||
| 132 | * /sys/devices/system/edac/mc; | 140 | * /sys/devices/system/edac/mc; | 
| 133 | * data structures and methods | 141 | * data structures and methods | 
| 134 | */ | 142 | */ | 
| 143 | #if 0 | ||
| 135 | static ssize_t memctrl_string_show(void *ptr, char *buffer) | 144 | static ssize_t memctrl_string_show(void *ptr, char *buffer) | 
| 136 | { | 145 | { | 
| 137 | char *value = (char*) ptr; | 146 | char *value = (char*) ptr; | 
| 138 | return sprintf(buffer, "%s\n", value); | 147 | return sprintf(buffer, "%s\n", value); | 
| 139 | } | 148 | } | 
| 149 | #endif | ||
| 140 | 150 | ||
| 141 | static ssize_t memctrl_int_show(void *ptr, char *buffer) | 151 | static ssize_t memctrl_int_show(void *ptr, char *buffer) | 
| 142 | { | 152 | { | 
| @@ -207,7 +217,9 @@ struct memctrl_dev_attribute attr_##_name = { \ | |||
| 207 | }; | 217 | }; | 
| 208 | 218 | ||
| 209 | /* cwrow<id> attribute f*/ | 219 | /* cwrow<id> attribute f*/ | 
| 220 | #if 0 | ||
| 210 | MEMCTRL_STRING_ATTR(mc_version,EDAC_MC_VERSION,S_IRUGO,memctrl_string_show,NULL); | 221 | MEMCTRL_STRING_ATTR(mc_version,EDAC_MC_VERSION,S_IRUGO,memctrl_string_show,NULL); | 
| 222 | #endif | ||
| 211 | 223 | ||
| 212 | /* csrow<id> control files */ | 224 | /* csrow<id> control files */ | 
| 213 | MEMCTRL_ATTR(panic_on_ue,S_IRUGO|S_IWUSR,memctrl_int_show,memctrl_int_store); | 225 | MEMCTRL_ATTR(panic_on_ue,S_IRUGO|S_IWUSR,memctrl_int_show,memctrl_int_store); | 
| @@ -222,7 +234,6 @@ static struct memctrl_dev_attribute *memctrl_attr[] = { | |||
| 222 | &attr_log_ue, | 234 | &attr_log_ue, | 
| 223 | &attr_log_ce, | 235 | &attr_log_ce, | 
| 224 | &attr_poll_msec, | 236 | &attr_poll_msec, | 
| 225 | &attr_mc_version, | ||
| 226 | NULL, | 237 | NULL, | 
| 227 | }; | 238 | }; | 
| 228 | 239 | ||
| @@ -238,6 +249,7 @@ static struct kobj_type ktype_memctrl = { | |||
| 238 | .default_attrs = (struct attribute **) memctrl_attr, | 249 | .default_attrs = (struct attribute **) memctrl_attr, | 
| 239 | }; | 250 | }; | 
| 240 | 251 | ||
| 252 | #endif /* DISABLE_EDAC_SYSFS */ | ||
| 241 | 253 | ||
| 242 | /* Initialize the main sysfs entries for edac: | 254 | /* Initialize the main sysfs entries for edac: | 
| 243 | * /sys/devices/system/edac | 255 | * /sys/devices/system/edac | 
| @@ -248,6 +260,11 @@ static struct kobj_type ktype_memctrl = { | |||
| 248 | * !0 FAILURE | 260 | * !0 FAILURE | 
| 249 | */ | 261 | */ | 
| 250 | static int edac_sysfs_memctrl_setup(void) | 262 | static int edac_sysfs_memctrl_setup(void) | 
| 263 | #ifdef DISABLE_EDAC_SYSFS | ||
| 264 | { | ||
| 265 | return 0; | ||
| 266 | } | ||
| 267 | #else | ||
| 251 | { | 268 | { | 
| 252 | int err=0; | 269 | int err=0; | 
| 253 | 270 | ||
| @@ -280,6 +297,7 @@ static int edac_sysfs_memctrl_setup(void) | |||
| 280 | 297 | ||
| 281 | return err; | 298 | return err; | 
| 282 | } | 299 | } | 
| 300 | #endif /* DISABLE_EDAC_SYSFS */ | ||
| 283 | 301 | ||
| 284 | /* | 302 | /* | 
| 285 | * MC teardown: | 303 | * MC teardown: | 
| @@ -287,6 +305,7 @@ static int edac_sysfs_memctrl_setup(void) | |||
| 287 | */ | 305 | */ | 
| 288 | static void edac_sysfs_memctrl_teardown(void) | 306 | static void edac_sysfs_memctrl_teardown(void) | 
| 289 | { | 307 | { | 
| 308 | #ifndef DISABLE_EDAC_SYSFS | ||
| 290 | debugf0("MC: " __FILE__ ": %s()\n", __func__); | 309 | debugf0("MC: " __FILE__ ": %s()\n", __func__); | 
| 291 | 310 | ||
| 292 | /* Unregister the MC's kobject */ | 311 | /* Unregister the MC's kobject */ | 
| @@ -297,8 +316,11 @@ static void edac_sysfs_memctrl_teardown(void) | |||
| 297 | 316 | ||
| 298 | /* Unregister the 'edac' object */ | 317 | /* Unregister the 'edac' object */ | 
| 299 | sysdev_class_unregister(&edac_class); | 318 | sysdev_class_unregister(&edac_class); | 
| 319 | #endif /* DISABLE_EDAC_SYSFS */ | ||
| 300 | } | 320 | } | 
| 301 | 321 | ||
| 322 | #ifndef DISABLE_EDAC_SYSFS | ||
| 323 | |||
| 302 | /* | 324 | /* | 
| 303 | * /sys/devices/system/edac/pci; | 325 | * /sys/devices/system/edac/pci; | 
| 304 | * data structures and methods | 326 | * data structures and methods | 
| @@ -309,6 +331,8 @@ struct list_control { | |||
| 309 | int *count; | 331 | int *count; | 
| 310 | }; | 332 | }; | 
| 311 | 333 | ||
| 334 | |||
| 335 | #if 0 | ||
| 312 | /* Output the list as: vendor_id:device:id<,vendor_id:device_id> */ | 336 | /* Output the list as: vendor_id:device:id<,vendor_id:device_id> */ | 
| 313 | static ssize_t edac_pci_list_string_show(void *ptr, char *buffer) | 337 | static ssize_t edac_pci_list_string_show(void *ptr, char *buffer) | 
| 314 | { | 338 | { | 
| @@ -430,6 +454,7 @@ static ssize_t edac_pci_list_string_store(void *ptr, const char *buffer, | |||
| 430 | return count; | 454 | return count; | 
| 431 | } | 455 | } | 
| 432 | 456 | ||
| 457 | #endif | ||
| 433 | static ssize_t edac_pci_int_show(void *ptr, char *buffer) | 458 | static ssize_t edac_pci_int_show(void *ptr, char *buffer) | 
| 434 | { | 459 | { | 
| 435 | int *value = ptr; | 460 | int *value = ptr; | 
| @@ -498,6 +523,7 @@ struct edac_pci_dev_attribute edac_pci_attr_##_name = { \ | |||
| 498 | .store = _store, \ | 523 | .store = _store, \ | 
| 499 | }; | 524 | }; | 
| 500 | 525 | ||
| 526 | #if 0 | ||
| 501 | static struct list_control pci_whitelist_control = { | 527 | static struct list_control pci_whitelist_control = { | 
| 502 | .list = pci_whitelist, | 528 | .list = pci_whitelist, | 
| 503 | .count = &pci_whitelist_count | 529 | .count = &pci_whitelist_count | 
| @@ -520,6 +546,7 @@ EDAC_PCI_STRING_ATTR(pci_parity_blacklist, | |||
| 520 | S_IRUGO|S_IWUSR, | 546 | S_IRUGO|S_IWUSR, | 
| 521 | edac_pci_list_string_show, | 547 | edac_pci_list_string_show, | 
| 522 | edac_pci_list_string_store); | 548 | edac_pci_list_string_store); | 
| 549 | #endif | ||
| 523 | 550 | ||
| 524 | /* PCI Parity control files */ | 551 | /* PCI Parity control files */ | 
| 525 | EDAC_PCI_ATTR(check_pci_parity,S_IRUGO|S_IWUSR,edac_pci_int_show,edac_pci_int_store); | 552 | EDAC_PCI_ATTR(check_pci_parity,S_IRUGO|S_IWUSR,edac_pci_int_show,edac_pci_int_store); | 
| @@ -531,8 +558,6 @@ static struct edac_pci_dev_attribute *edac_pci_attr[] = { | |||
| 531 | &edac_pci_attr_check_pci_parity, | 558 | &edac_pci_attr_check_pci_parity, | 
| 532 | &edac_pci_attr_panic_on_pci_parity, | 559 | &edac_pci_attr_panic_on_pci_parity, | 
| 533 | &edac_pci_attr_pci_parity_count, | 560 | &edac_pci_attr_pci_parity_count, | 
| 534 | &edac_pci_attr_pci_parity_whitelist, | ||
| 535 | &edac_pci_attr_pci_parity_blacklist, | ||
| 536 | NULL, | 561 | NULL, | 
| 537 | }; | 562 | }; | 
| 538 | 563 | ||
| @@ -548,11 +573,18 @@ static struct kobj_type ktype_edac_pci = { | |||
| 548 | .default_attrs = (struct attribute **) edac_pci_attr, | 573 | .default_attrs = (struct attribute **) edac_pci_attr, | 
| 549 | }; | 574 | }; | 
| 550 | 575 | ||
| 576 | #endif /* DISABLE_EDAC_SYSFS */ | ||
| 577 | |||
| 551 | /** | 578 | /** | 
| 552 | * edac_sysfs_pci_setup() | 579 | * edac_sysfs_pci_setup() | 
| 553 | * | 580 | * | 
| 554 | */ | 581 | */ | 
| 555 | static int edac_sysfs_pci_setup(void) | 582 | static int edac_sysfs_pci_setup(void) | 
| 583 | #ifdef DISABLE_EDAC_SYSFS | ||
| 584 | { | ||
| 585 | return 0; | ||
| 586 | } | ||
| 587 | #else | ||
| 556 | { | 588 | { | 
| 557 | int err; | 589 | int err; | 
| 558 | 590 | ||
| @@ -576,16 +608,20 @@ static int edac_sysfs_pci_setup(void) | |||
| 576 | } | 608 | } | 
| 577 | return err; | 609 | return err; | 
| 578 | } | 610 | } | 
| 579 | 611 | #endif /* DISABLE_EDAC_SYSFS */ | |
| 580 | 612 | ||
| 581 | static void edac_sysfs_pci_teardown(void) | 613 | static void edac_sysfs_pci_teardown(void) | 
| 582 | { | 614 | { | 
| 615 | #ifndef DISABLE_EDAC_SYSFS | ||
| 583 | debugf0("MC: " __FILE__ ": %s()\n", __func__); | 616 | debugf0("MC: " __FILE__ ": %s()\n", __func__); | 
| 584 | 617 | ||
| 585 | kobject_unregister(&edac_pci_kobj); | 618 | kobject_unregister(&edac_pci_kobj); | 
| 586 | kobject_put(&edac_pci_kobj); | 619 | kobject_put(&edac_pci_kobj); | 
| 620 | #endif | ||
| 587 | } | 621 | } | 
| 588 | 622 | ||
| 623 | #ifndef DISABLE_EDAC_SYSFS | ||
| 624 | |||
| 589 | /* EDAC sysfs CSROW data structures and methods */ | 625 | /* EDAC sysfs CSROW data structures and methods */ | 
| 590 | 626 | ||
| 591 | /* Set of more detailed csrow<id> attribute show/store functions */ | 627 | /* Set of more detailed csrow<id> attribute show/store functions */ | 
| @@ -1039,6 +1075,8 @@ static struct kobj_type ktype_mci = { | |||
| 1039 | .default_attrs = (struct attribute **) mci_attr, | 1075 | .default_attrs = (struct attribute **) mci_attr, | 
| 1040 | }; | 1076 | }; | 
| 1041 | 1077 | ||
| 1078 | #endif /* DISABLE_EDAC_SYSFS */ | ||
| 1079 | |||
| 1042 | #define EDAC_DEVICE_SYMLINK "device" | 1080 | #define EDAC_DEVICE_SYMLINK "device" | 
| 1043 | 1081 | ||
| 1044 | /* | 1082 | /* | 
| @@ -1050,6 +1088,11 @@ static struct kobj_type ktype_mci = { | |||
| 1050 | * !0 Failure | 1088 | * !0 Failure | 
| 1051 | */ | 1089 | */ | 
| 1052 | static int edac_create_sysfs_mci_device(struct mem_ctl_info *mci) | 1090 | static int edac_create_sysfs_mci_device(struct mem_ctl_info *mci) | 
| 1091 | #ifdef DISABLE_EDAC_SYSFS | ||
| 1092 | { | ||
| 1093 | return 0; | ||
| 1094 | } | ||
| 1095 | #else | ||
| 1053 | { | 1096 | { | 
| 1054 | int i; | 1097 | int i; | 
| 1055 | int err; | 1098 | int err; | 
| @@ -1118,12 +1161,14 @@ fail: | |||
| 1118 | 1161 | ||
| 1119 | return err; | 1162 | return err; | 
| 1120 | } | 1163 | } | 
| 1164 | #endif /* DISABLE_EDAC_SYSFS */ | ||
| 1121 | 1165 | ||
| 1122 | /* | 1166 | /* | 
| 1123 | * remove a Memory Controller instance | 1167 | * remove a Memory Controller instance | 
| 1124 | */ | 1168 | */ | 
| 1125 | static void edac_remove_sysfs_mci_device(struct mem_ctl_info *mci) | 1169 | static void edac_remove_sysfs_mci_device(struct mem_ctl_info *mci) | 
| 1126 | { | 1170 | { | 
| 1171 | #ifndef DISABLE_EDAC_SYSFS | ||
| 1127 | int i; | 1172 | int i; | 
| 1128 | 1173 | ||
| 1129 | debugf0("MC: " __FILE__ ": %s()\n", __func__); | 1174 | debugf0("MC: " __FILE__ ": %s()\n", __func__); | 
| @@ -1140,6 +1185,7 @@ static void edac_remove_sysfs_mci_device(struct mem_ctl_info *mci) | |||
| 1140 | 1185 | ||
| 1141 | kobject_unregister(&mci->edac_mci_kobj); | 1186 | kobject_unregister(&mci->edac_mci_kobj); | 
| 1142 | kobject_put(&mci->edac_mci_kobj); | 1187 | kobject_put(&mci->edac_mci_kobj); | 
| 1188 | #endif /* DISABLE_EDAC_SYSFS */ | ||
| 1143 | } | 1189 | } | 
| 1144 | 1190 | ||
| 1145 | /* END OF sysfs data and methods */ | 1191 | /* END OF sysfs data and methods */ | 
