Commit 4de78c6877ec21142582ac19453c2d453d1ea298

Authored by Dave Jiang
Committed by Linus Torvalds
1 parent 66ee2f940a

drivers/edac: mod PCI poll names

Fixup poll values for MC and PCI.
Also make mc function names unique to mc.

Signed-off-by: Dave Jiang <djiang@mvista.com>
Signed-off-by: Douglas Thompson <dougthompson@xmissin.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Showing 6 changed files with 111 additions and 77 deletions Side-by-side Diff

drivers/edac/edac_core.h
... ... @@ -646,13 +646,6 @@
646 646  
647 647 int pci_idx;
648 648  
649   - /* Per instance controls for this edac_device */
650   - int check_parity_error; /* boolean for checking parity errs */
651   - int log_parity_error; /* boolean for logging parity errs */
652   - int panic_on_pe; /* boolean for panic'ing on a PE */
653   - unsigned poll_msec; /* number of milliseconds to poll interval */
654   - unsigned long delay; /* number of jiffies for poll_msec */
655   -
656 649 struct sysdev_class *edac_class; /* pointer to class */
657 650  
658 651 /* the internal state of this controller instance */
drivers/edac/edac_mc.c
... ... @@ -263,7 +263,8 @@
263 263 mutex_unlock(&mem_ctls_mutex);
264 264  
265 265 /* Reschedule */
266   - queue_delayed_work(edac_workqueue, &mci->work, edac_mc_get_poll_msec());
  266 + queue_delayed_work(edac_workqueue, &mci->work,
  267 + msecs_to_jiffies(edac_mc_get_poll_msec()));
267 268 }
268 269  
269 270 /*
... ... @@ -611,7 +612,7 @@
611 612 return;
612 613 }
613 614  
614   - if (edac_get_log_ce())
  615 + if (edac_mc_get_log_ce())
615 616 /* FIXME - put in DIMM location */
616 617 edac_mc_printk(mci, KERN_WARNING,
617 618 "CE page 0x%lx, offset 0x%lx, grain %d, syndrome "
... ... @@ -646,7 +647,7 @@
646 647  
647 648 void edac_mc_handle_ce_no_info(struct mem_ctl_info *mci, const char *msg)
648 649 {
649   - if (edac_get_log_ce())
  650 + if (edac_mc_get_log_ce())
650 651 edac_mc_printk(mci, KERN_WARNING,
651 652 "CE - no information available: %s\n", msg);
652 653  
653 654  
... ... @@ -690,14 +691,14 @@
690 691 pos += chars;
691 692 }
692 693  
693   - if (edac_get_log_ue())
  694 + if (edac_mc_get_log_ue())
694 695 edac_mc_printk(mci, KERN_EMERG,
695 696 "UE page 0x%lx, offset 0x%lx, grain %d, row %d, "
696 697 "labels \"%s\": %s\n", page_frame_number,
697 698 offset_in_page, mci->csrows[row].grain, row, labels,
698 699 msg);
699 700  
700   - if (edac_get_panic_on_ue())
  701 + if (edac_mc_get_panic_on_ue())
701 702 panic("EDAC MC%d: UE page 0x%lx, offset 0x%lx, grain %d, "
702 703 "row %d, labels \"%s\": %s\n", mci->mc_idx,
703 704 page_frame_number, offset_in_page,
704 705  
... ... @@ -710,10 +711,10 @@
710 711  
711 712 void edac_mc_handle_ue_no_info(struct mem_ctl_info *mci, const char *msg)
712 713 {
713   - if (edac_get_panic_on_ue())
  714 + if (edac_mc_get_panic_on_ue())
714 715 panic("EDAC MC%d: Uncorrected Error", mci->mc_idx);
715 716  
716   - if (edac_get_log_ue())
  717 + if (edac_mc_get_log_ue())
717 718 edac_mc_printk(mci, KERN_WARNING,
718 719 "UE - no information available: %s\n", msg);
719 720 mci->ue_noinfo_count++;
720 721  
... ... @@ -776,13 +777,13 @@
776 777 chars = snprintf(pos, len + 1, "-%s",
777 778 mci->csrows[csrow].channels[channelb].label);
778 779  
779   - if (edac_get_log_ue())
  780 + if (edac_mc_get_log_ue())
780 781 edac_mc_printk(mci, KERN_EMERG,
781 782 "UE row %d, channel-a= %d channel-b= %d "
782 783 "labels \"%s\": %s\n", csrow, channela, channelb,
783 784 labels, msg);
784 785  
785   - if (edac_get_panic_on_ue())
  786 + if (edac_mc_get_panic_on_ue())
786 787 panic("UE row %d, channel-a= %d channel-b= %d "
787 788 "labels \"%s\": %s\n", csrow, channela,
788 789 channelb, labels, msg);
... ... @@ -817,7 +818,7 @@
817 818 return;
818 819 }
819 820  
820   - if (edac_get_log_ce())
  821 + if (edac_mc_get_log_ce())
821 822 /* FIXME - put in DIMM location */
822 823 edac_mc_printk(mci, KERN_WARNING,
823 824 "CE row %d, channel %d, label \"%s\": %s\n",
drivers/edac/edac_mc_sysfs.c
... ... @@ -16,47 +16,44 @@
16 16 #include "edac_module.h"
17 17  
18 18 /* MC EDAC Controls, setable by module parameter, and sysfs */
19   -static int log_ue = 1;
20   -static int log_ce = 1;
21   -static int panic_on_ue;
22   -static int poll_msec = 1000;
  19 +static int edac_mc_log_ue = 1;
  20 +static int edac_mc_log_ce = 1;
  21 +static int edac_mc_panic_on_ue = 0;
  22 +static int edac_mc_poll_msec = 1000;
23 23  
24 24 /* Getter functions for above */
25   -int edac_get_log_ue(void)
  25 +int edac_mc_get_log_ue(void)
26 26 {
27   - return log_ue;
  27 + return edac_mc_log_ue;
28 28 }
29 29  
30   -int edac_get_log_ce(void)
  30 +int edac_mc_get_log_ce(void)
31 31 {
32   - return log_ce;
  32 + return edac_mc_log_ce;
33 33 }
34 34  
35   -int edac_get_panic_on_ue(void)
  35 +int edac_mc_get_panic_on_ue(void)
36 36 {
37   - return panic_on_ue;
  37 + return edac_mc_panic_on_ue;
38 38 }
39 39  
40 40 /* this is temporary */
41 41 int edac_mc_get_poll_msec(void)
42 42 {
43   - return edac_get_poll_msec();
  43 + return edac_mc_poll_msec;
44 44 }
45 45  
46   -int edac_get_poll_msec(void)
47   -{
48   - return poll_msec;
49   -}
50   -
51 46 /* Parameter declarations for above */
52   -module_param(panic_on_ue, int, 0644);
53   -MODULE_PARM_DESC(panic_on_ue, "Panic on uncorrected error: 0=off 1=on");
54   -module_param(log_ue, int, 0644);
55   -MODULE_PARM_DESC(log_ue, "Log uncorrectable error to console: 0=off 1=on");
56   -module_param(log_ce, int, 0644);
57   -MODULE_PARM_DESC(log_ce, "Log correctable error to console: 0=off 1=on");
58   -module_param(poll_msec, int, 0644);
59   -MODULE_PARM_DESC(poll_msec, "Polling period in milliseconds");
  47 +module_param(edac_mc_panic_on_ue, int, 0644);
  48 +MODULE_PARM_DESC(edac_mc_panic_on_ue, "Panic on uncorrected error: 0=off 1=on");
  49 +module_param(edac_mc_log_ue, int, 0644);
  50 +MODULE_PARM_DESC(edac_mc_log_ue,
  51 + "Log uncorrectable error to console: 0=off 1=on");
  52 +module_param(edac_mc_log_ce, int, 0644);
  53 +MODULE_PARM_DESC(edac_mc_log_ce,
  54 + "Log correctable error to console: 0=off 1=on");
  55 +module_param(edac_mc_poll_msec, int, 0644);
  56 +MODULE_PARM_DESC(edac_mc_poll_msec, "Polling period in milliseconds");
60 57  
61 58  
62 59 /*
63 60  
64 61  
... ... @@ -187,17 +184,32 @@
187 184 };
188 185  
189 186 /* csrow<id> control files */
190   -MEMCTRL_ATTR(panic_on_ue,S_IRUGO|S_IWUSR,memctrl_int_show,memctrl_int_store);
191   -MEMCTRL_ATTR(log_ue,S_IRUGO|S_IWUSR,memctrl_int_show,memctrl_int_store);
192   -MEMCTRL_ATTR(log_ce,S_IRUGO|S_IWUSR,memctrl_int_show,memctrl_int_store);
193   -MEMCTRL_ATTR(poll_msec,S_IRUGO|S_IWUSR,memctrl_int_show,memctrl_int_store);
  187 +MEMCTRL_ATTR(edac_mc_panic_on_ue,
  188 + S_IRUGO | S_IWUSR,
  189 + memctrl_int_show,
  190 + memctrl_int_store);
194 191  
  192 +MEMCTRL_ATTR(edac_mc_log_ue,
  193 + S_IRUGO|S_IWUSR,
  194 + memctrl_int_show,
  195 + memctrl_int_store);
  196 +
  197 +MEMCTRL_ATTR(edac_mc_log_ce,
  198 + S_IRUGO|S_IWUSR,
  199 + memctrl_int_show,
  200 + memctrl_int_store);
  201 +
  202 +MEMCTRL_ATTR(edac_mc_poll_msec,
  203 + S_IRUGO|S_IWUSR,
  204 + memctrl_int_show,
  205 + memctrl_int_store);
  206 +
195 207 /* Base Attributes of the memory ECC object */
196 208 static struct memctrl_dev_attribute *memctrl_attr[] = {
197   - &attr_panic_on_ue,
198   - &attr_log_ue,
199   - &attr_log_ce,
200   - &attr_poll_msec,
  209 + &attr_edac_mc_panic_on_ue,
  210 + &attr_edac_mc_log_ue,
  211 + &attr_edac_mc_log_ce,
  212 + &attr_edac_mc_poll_msec,
201 213 NULL,
202 214 };
203 215  
drivers/edac/edac_module.h
... ... @@ -27,6 +27,9 @@
27 27 extern int edac_get_log_ue(void);
28 28 extern int edac_get_log_ce(void);
29 29 extern int edac_get_panic_on_ue(void);
  30 +extern int edac_mc_get_log_ue(void);
  31 +extern int edac_mc_get_log_ce(void);
  32 +extern int edac_mc_get_panic_on_ue(void);
30 33 extern int edac_get_poll_msec(void);
31 34 extern int edac_mc_get_poll_msec(void);
32 35  
33 36  
... ... @@ -52,12 +55,16 @@
52 55 extern void edac_pci_clear_parity_errors(void);
53 56 extern int edac_sysfs_pci_setup(void);
54 57 extern void edac_sysfs_pci_teardown(void);
  58 +extern int edac_pci_get_check_errors(void);
  59 +extern int edac_pci_get_poll_msec(void);
55 60 #else /* CONFIG_PCI */
56 61 /* pre-process these away */
57 62 #define edac_pci_do_parity_check()
58 63 #define edac_pci_clear_parity_errors()
59 64 #define edac_sysfs_pci_setup() (0)
60 65 #define edac_sysfs_pci_teardown()
  66 +#define edac_pci_get_check_errors()
  67 +#define edac_pci_get_poll_msec()
61 68 #endif /* CONFIG_PCI */
62 69  
63 70  
drivers/edac/edac_pci.c
... ... @@ -226,13 +226,14 @@
226 226  
227 227 if ((pci->op_state == OP_RUNNING_POLL) &&
228 228 (pci->edac_check != NULL) &&
229   - (pci->check_parity_error))
  229 + (edac_pci_get_check_errors()))
230 230 pci->edac_check(pci);
231 231  
232 232 edac_unlock_pci_list();
233 233  
234 234 /* Reschedule */
235   - queue_delayed_work(edac_workqueue, &pci->work, pci->delay);
  235 + queue_delayed_work(edac_workqueue, &pci->work,
  236 + msecs_to_jiffies(edac_pci_get_poll_msec()));
236 237 }
237 238  
238 239 /*
239 240  
... ... @@ -245,15 +246,13 @@
245 246 {
246 247 debugf0("%s()\n", __func__);
247 248  
248   - pci->poll_msec = msec;
249   - edac_calc_delay(pci);
250   -
251 249 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
252 250 INIT_DELAYED_WORK(&pci->work, edac_pci_workq_function);
253 251 #else
254 252 INIT_WORK(&pci->work, edac_pci_workq_function, pci);
255 253 #endif
256   - queue_delayed_work(edac_workqueue, &pci->work, pci->delay);
  254 + queue_delayed_work(edac_workqueue, &pci->work,
  255 + msecs_to_jiffies(edac_pci_get_poll_msec()));
257 256 }
258 257  
259 258 /*
... ... @@ -389,16 +388,6 @@
389 388 return pci;
390 389 }
391 390 EXPORT_SYMBOL_GPL(edac_pci_del_device);
392   -
393   -static inline int edac_pci_get_log_pe(struct edac_pci_ctl_info *pci)
394   -{
395   - return pci->log_parity_error;
396   -}
397   -
398   -static inline int edac_pci_get_panic_on_pe(struct edac_pci_ctl_info *pci)
399   -{
400   - return pci->panic_on_pe;
401   -}
402 391  
403 392 void edac_pci_generic_check(struct edac_pci_ctl_info *pci)
404 393 {
drivers/edac/edac_pci_sysfs.c
... ... @@ -19,15 +19,42 @@
19 19 #define EDAC_PCI_SYMLINK "device"
20 20  
21 21 static int check_pci_errors = 0; /* default YES check PCI parity */
22   -static int panic_on_pci_parity = 0; /* default no panic on PCI Parity */
23   -static int log_pci_errs = 1;
  22 +static int edac_pci_panic_on_pe = 0; /* default no panic on PCI Parity */
  23 +static int edac_pci_log_pe = 1; /* log PCI parity errors */
  24 +static int edac_pci_log_npe = 1; /* log PCI non-parity error errors */
24 25 static atomic_t pci_parity_count = ATOMIC_INIT(0);
25 26 static atomic_t pci_nonparity_count = ATOMIC_INIT(0);
  27 +static int edac_pci_poll_msec = 1000;
26 28  
27 29 static struct kobject edac_pci_kobj; /* /sys/devices/system/edac/pci */
28 30 static struct completion edac_pci_kobj_complete;
29 31 static atomic_t edac_pci_sysfs_refcount = ATOMIC_INIT(0);
30 32  
  33 +int edac_pci_get_check_errors(void)
  34 +{
  35 + return check_pci_errors;
  36 +}
  37 +
  38 +int edac_pci_get_log_pe(void)
  39 +{
  40 + return edac_pci_log_pe;
  41 +}
  42 +
  43 +int edac_pci_get_log_npe(void)
  44 +{
  45 + return edac_pci_log_npe;
  46 +}
  47 +
  48 +int edac_pci_get_panic_on_pe(void)
  49 +{
  50 + return edac_pci_panic_on_pe;
  51 +}
  52 +
  53 +int edac_pci_get_poll_msec(void)
  54 +{
  55 + return edac_pci_poll_msec;
  56 +}
  57 +
31 58 /**************************** EDAC PCI sysfs instance *******************/
32 59 static ssize_t instance_pe_count_show(struct edac_pci_ctl_info *pci, char *data)
33 60 {
34 61  
35 62  
36 63  
... ... @@ -222,18 +249,21 @@
222 249 /* PCI Parity control files */
223 250 EDAC_PCI_ATTR(check_pci_errors, S_IRUGO|S_IWUSR, edac_pci_int_show,
224 251 edac_pci_int_store);
225   -EDAC_PCI_ATTR(log_pci_errs, S_IRUGO|S_IWUSR, edac_pci_int_show,
  252 +EDAC_PCI_ATTR(edac_pci_log_pe, S_IRUGO|S_IWUSR, edac_pci_int_show,
226 253 edac_pci_int_store);
227   -EDAC_PCI_ATTR(panic_on_pci_parity, S_IRUGO|S_IWUSR, edac_pci_int_show,
  254 +EDAC_PCI_ATTR(edac_pci_log_npe, S_IRUGO|S_IWUSR, edac_pci_int_show,
228 255 edac_pci_int_store);
  256 +EDAC_PCI_ATTR(edac_pci_panic_on_pe, S_IRUGO|S_IWUSR, edac_pci_int_show,
  257 + edac_pci_int_store);
229 258 EDAC_PCI_ATTR(pci_parity_count, S_IRUGO, edac_pci_int_show, NULL);
230 259 EDAC_PCI_ATTR(pci_nonparity_count, S_IRUGO, edac_pci_int_show, NULL);
231 260  
232 261 /* Base Attributes of the memory ECC object */
233 262 static struct edac_pci_dev_attribute *edac_pci_attr[] = {
234 263 &edac_pci_attr_check_pci_errors,
235   - &edac_pci_attr_log_pci_errs,
236   - &edac_pci_attr_panic_on_pci_parity,
  264 + &edac_pci_attr_edac_pci_log_pe,
  265 + &edac_pci_attr_edac_pci_log_npe,
  266 + &edac_pci_attr_edac_pci_panic_on_pe,
237 267 &edac_pci_attr_pci_parity_count,
238 268 &edac_pci_attr_pci_nonparity_count,
239 269 NULL,
... ... @@ -529,7 +559,7 @@
529 559 local_irq_restore(flags);
530 560  
531 561 /* Only if operator has selected panic on PCI Error */
532   - if (panic_on_pci_parity) {
  562 + if (edac_pci_get_panic_on_pe()) {
533 563 /* If the count is different 'after' from 'before' */
534 564 if (before_count != atomic_read(&pci_parity_count))
535 565 panic("EDAC: PCI Parity Error");
... ... @@ -549,7 +579,7 @@
549 579 /* global PE counter incremented by edac_pci_do_parity_check() */
550 580 atomic_inc(&pci->counters.pe_count);
551 581  
552   - if (log_pci_errs)
  582 + if (edac_pci_get_log_pe())
553 583 edac_pci_printk(pci, KERN_WARNING,
554 584 "Parity Error ctl: %s %d: %s\n",
555 585 pci->ctl_name, pci->pci_idx, msg);
... ... @@ -568,7 +598,7 @@
568 598 /* global NPE counter incremented by edac_pci_do_parity_check() */
569 599 atomic_inc(&pci->counters.npe_count);
570 600  
571   - if (log_pci_errs)
  601 + if (edac_pci_get_log_npe())
572 602 edac_pci_printk(pci, KERN_WARNING,
573 603 "Non-Parity Error ctl: %s %d: %s\n",
574 604 pci->ctl_name, pci->pci_idx, msg);
... ... @@ -585,9 +615,11 @@
585 615 * Define the PCI parameter to the module
586 616 */
587 617 module_param(check_pci_errors, int, 0644);
588   -MODULE_PARM_DESC(check_pci_errors, "Check for PCI bus parity errors: 0=off 1=on");
589   -module_param(panic_on_pci_parity, int, 0644);
590   -MODULE_PARM_DESC(panic_on_pci_parity, "Panic on PCI Bus Parity error: 0=off 1=on");
  618 +MODULE_PARM_DESC(check_pci_errors,
  619 + "Check for PCI bus parity errors: 0=off 1=on");
  620 +module_param(edac_pci_panic_on_pe, int, 0644);
  621 +MODULE_PARM_DESC(edac_pci_panic_on_pe,
  622 + "Panic on PCI Bus Parity error: 0=off 1=on");
591 623  
592 624 #endif /* CONFIG_PCI */