23 #include <linux/kernel.h>
24 #include <linux/types.h>
25 #include <linux/module.h>
28 #include <linux/pci.h>
29 #include <linux/time.h>
38 #define EDAC_DEVICE_NAME_LEN 31
39 #define EDAC_ATTRIB_VALUE_LEN 15
42 #define PAGES_TO_MiB(pages) ((pages) >> (20 - PAGE_SHIFT))
43 #define MiB_TO_PAGES(mb) ((mb) << (20 - PAGE_SHIFT))
45 #define PAGES_TO_MiB(pages) ((pages) << (PAGE_SHIFT - 20))
46 #define MiB_TO_PAGES(mb) ((mb) >> (PAGE_SHIFT - 20))
49 #define edac_printk(level, prefix, fmt, arg...) \
50 printk(level "EDAC " prefix ": " fmt, ##arg)
52 #define edac_mc_printk(mci, level, fmt, arg...) \
53 printk(level "EDAC MC%d: " fmt, mci->mc_idx, ##arg)
55 #define edac_mc_chipset_printk(mci, level, prefix, fmt, arg...) \
56 printk(level "EDAC " prefix " MC%d: " fmt, mci->mc_idx, ##arg)
58 #define edac_device_printk(ctl, level, fmt, arg...) \
59 printk(level "EDAC DEVICE%d: " fmt, ctl->dev_idx, ##arg)
61 #define edac_pci_printk(ctl, level, fmt, arg...) \
62 printk(level "EDAC PCI%d: " fmt, ctl->pci_idx, ##arg)
66 #define EDAC_PCI "PCI"
67 #define EDAC_DEBUG "DEBUG"
71 #ifdef CONFIG_EDAC_DEBUG
72 extern int edac_debug_level;
74 #define edac_dbg(level, fmt, ...) \
76 if (level <= edac_debug_level) \
77 edac_printk(KERN_DEBUG, EDAC_DEBUG, \
78 "%s: " fmt, __func__, ##__VA_ARGS__); \
83 #define edac_dbg(level, fmt, ...) \
86 edac_printk(KERN_DEBUG, EDAC_DEBUG, \
87 "%s: " fmt, __func__, ##__VA_ARGS__); \
92 #define PCI_VEND_DEV(vend, dev) PCI_VENDOR_ID_ ## vend, \
93 PCI_DEVICE_ID_ ## vend ## _ ## dev
95 #define edac_dev_name(dev) (dev)->dev_name
292 #define to_edac_mem_ctl_work(w) \
293 container_of(w, struct mem_ctl_info, work)
295 #define to_edac_device_ctl_work(w) \
296 container_of(w,struct edac_device_ctl_info,work)
304 unsigned sizeof_private,
306 char *edac_block_name,
unsigned nr_blocks,
307 unsigned offset_value,
318 #define BLOCK_OFFSET_VALUE_OFF ((unsigned) -1)
324 struct edac_pci_counter {
333 struct edac_pci_ctl_info {
351 void (*edac_check) (
struct edac_pci_ctl_info * edac_dev);
355 const char *mod_name;
356 const char *ctl_name;
357 const char *dev_name;
375 struct edac_pci_counter counters;
384 #define to_edac_pci_ctl_work(w) \
385 container_of(w, struct edac_pci_ctl_info,work)
394 pci_read_config_byte(pdev, offset, &buf);
400 pci_write_config_byte(pdev, offset, value);
404 static inline void pci_write_bits16(
struct pci_dev *pdev,
int offset,
407 if (mask != 0xffff) {
410 pci_read_config_word(pdev, offset, &buf);
416 pci_write_config_word(pdev, offset, value);
428 static inline void pci_write_bits32(
struct pci_dev *pdev,
int offset,
431 if (mask != 0xffffffff) {
434 pci_read_config_dword(pdev, offset, &buf);
440 pci_write_config_dword(pdev, offset, value);
458 const u16 error_count,
459 const unsigned long page_frame_number,
461 const unsigned long syndrome,
466 const char *other_detail);
474 int inst_nr,
int block_nr,
const char *
msg);
476 int inst_nr,
int block_nr,
const char *
msg);
484 const char *edac_pci_name);
489 unsigned long value);
497 const char *mod_name);