aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/edac/edac_core.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/edac/edac_core.h')
-rw-r--r--drivers/edac/edac_core.h120
1 files changed, 114 insertions, 6 deletions
diff --git a/drivers/edac/edac_core.h b/drivers/edac/edac_core.h
index b73d659a4bb2..febff4111428 100644
--- a/drivers/edac/edac_core.h
+++ b/drivers/edac/edac_core.h
@@ -60,6 +60,10 @@
60#define edac_device_printk(ctl, level, fmt, arg...) \ 60#define edac_device_printk(ctl, level, fmt, arg...) \
61 printk(level "EDAC DEVICE%d: " fmt, ctl->dev_idx, ##arg) 61 printk(level "EDAC DEVICE%d: " fmt, ctl->dev_idx, ##arg)
62 62
63/* edac_pci printk */
64#define edac_pci_printk(ctl, level, fmt, arg...) \
65 printk(level "EDAC PCI%d: " fmt, ctl->pci_idx, ##arg)
66
63/* prefixes for edac_printk() and edac_mc_printk() */ 67/* prefixes for edac_printk() and edac_mc_printk() */
64#define EDAC_MC "MC" 68#define EDAC_MC "MC"
65#define EDAC_PCI "PCI" 69#define EDAC_PCI "PCI"
@@ -200,6 +204,13 @@ enum scrub_type {
200 204
201/* FIXME - should have notify capabilities: NMI, LOG, PROC, etc */ 205/* FIXME - should have notify capabilities: NMI, LOG, PROC, etc */
202 206
207/* EDAC internal operation states */
208#define OP_ALLOC 0x100
209#define OP_RUNNING_POLL 0x201
210#define OP_RUNNING_INTERRUPT 0x202
211#define OP_RUNNING_POLL_INTR 0x203
212#define OP_OFFLINE 0x300
213
203extern char * edac_align_ptr(void *ptr, unsigned size); 214extern char * edac_align_ptr(void *ptr, unsigned size);
204 215
205/* 216/*
@@ -520,12 +531,6 @@ struct edac_device_ctl_info {
520 531
521 /* the internal state of this controller instance */ 532 /* the internal state of this controller instance */
522 int op_state; 533 int op_state;
523#define OP_ALLOC 0x100
524#define OP_RUNNING_POLL 0x201
525#define OP_RUNNING_INTERRUPT 0x202
526#define OP_RUNNING_POLL_INTR 0x203
527#define OP_OFFLINE 0x300
528
529 /* work struct for this instance */ 534 /* work struct for this instance */
530#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)) 535#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
531 struct delayed_work work; 536 struct delayed_work work;
@@ -626,6 +631,84 @@ extern void edac_device_free_ctl_info( struct edac_device_ctl_info *ctl_info);
626 631
627#ifdef CONFIG_PCI 632#ifdef CONFIG_PCI
628 633
634struct edac_pci_counter {
635 atomic_t pe_count;
636 atomic_t npe_count;
637};
638
639/*
640 * Abstract edac_pci control info structure
641 *
642 */
643struct edac_pci_ctl_info {
644 /* for global list of edac_pci_ctl_info structs */
645 struct list_head link;
646
647 int pci_idx;
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 struct sysdev_class *edac_class; /* pointer to class */
657
658 /* the internal state of this controller instance */
659 int op_state;
660 /* work struct for this instance */
661#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
662 struct delayed_work work;
663#else
664 struct work_struct work;
665#endif
666
667 /* pointer to edac polling checking routine:
668 * If NOT NULL: points to polling check routine
669 * If NULL: Then assumes INTERRUPT operation, where
670 * MC driver will receive events
671 */
672 void (*edac_check) (struct edac_pci_ctl_info * edac_dev);
673
674 struct device *dev; /* pointer to device structure */
675
676 const char *mod_name; /* module name */
677 const char *ctl_name; /* edac controller name */
678 const char *dev_name; /* pci/platform/etc... name */
679
680 void *pvt_info; /* pointer to 'private driver' info */
681
682 unsigned long start_time;/* edac_pci load start time (jiffies)*/
683
684 /* these are for safe removal of devices from global list while
685 * NMI handlers may be traversing list
686 */
687 struct rcu_head rcu;
688 struct completion complete;
689
690 /* sysfs top name under 'edac' directory
691 * and instance name:
692 * cpu/cpu0/...
693 * cpu/cpu1/...
694 * cpu/cpu2/...
695 * ...
696 */
697 char name[EDAC_DEVICE_NAME_LEN + 1];
698
699 /* Event counters for the this whole EDAC Device */
700 struct edac_pci_counter counters;
701
702 /* edac sysfs device control for the 'name'
703 * device this structure controls
704 */
705 struct kobject kobj;
706 struct completion kobj_complete;
707};
708
709#define to_edac_pci_ctl_work(w) \
710 container_of(w, struct edac_pci_ctl_info,work)
711
629/* write all or some bits in a byte-register*/ 712/* write all or some bits in a byte-register*/
630static inline void pci_write_bits8(struct pci_dev *pdev, int offset, u8 value, 713static inline void pci_write_bits8(struct pci_dev *pdev, int offset, u8 value,
631 u8 mask) 714 u8 mask)
@@ -726,5 +809,30 @@ extern void edac_device_handle_ue(struct edac_device_ctl_info *edac_dev,
726extern void edac_device_handle_ce(struct edac_device_ctl_info *edac_dev, 809extern void edac_device_handle_ce(struct edac_device_ctl_info *edac_dev,
727 int inst_nr, int block_nr, const char *msg); 810 int inst_nr, int block_nr, const char *msg);
728 811
812/*
813 * edac_pci APIs
814 */
815extern struct edac_pci_ctl_info *
816edac_pci_alloc_ctl_info(unsigned int sz_pvt, const char *edac_pci_name);
817
818extern void edac_pci_free_ctl_info(struct edac_pci_ctl_info *pci);
819
820extern void
821edac_pci_reset_delay_period(struct edac_pci_ctl_info *pci, unsigned long value);
822
823extern int edac_pci_add_device(struct edac_pci_ctl_info *pci, int edac_idx);
824extern struct edac_pci_ctl_info * edac_pci_del_device(struct device *dev);
825
826extern struct edac_pci_ctl_info *
827edac_pci_create_generic_ctl(struct device *dev, const char *mod_name);
828
829extern void edac_pci_release_generic_ctl(struct edac_pci_ctl_info *pci);
830extern int edac_pci_create_sysfs(struct edac_pci_ctl_info *pci);
831extern void edac_pci_remove_sysfs(struct edac_pci_ctl_info *pci);
832
833/*
834 * edac misc APIs
835 */
836extern char * edac_op_state_toString(int op_state);
729 837
730#endif /* _EDAC_CORE_H_ */ 838#endif /* _EDAC_CORE_H_ */