]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/edac/i3000_edac.c
skeletonfb: wrong field name fix
[linux-2.6-omap-h63xx.git] / drivers / edac / i3000_edac.c
index 570925d410a77eba1c95502ba68a6f5e8e39efbe..e895f9f887abb8dbda0c45706e649a8cff8fd9c8 100644 (file)
                                         * 30:0  reserved
                                         */
 
-
 enum i3000p_chips {
        I3000 = 0,
 };
@@ -149,15 +148,15 @@ struct i3000_error_info {
 
 static const struct i3000_dev_info i3000_devs[] = {
        [I3000] = {
-                    .ctl_name = "i3000"
-       },
+               .ctl_name = "i3000"},
 };
 
-static struct pci_dev *mci_pdev = NULL;
+static struct pci_dev *mci_pdev;
 static int i3000_registered = 1;
+static struct edac_pci_ctl_info *i3000_pci;
 
 static void i3000_get_error_info(struct mem_ctl_info *mci,
-               struct i3000_error_info *info)
+                                struct i3000_error_info *info)
 {
        struct pci_dev *pdev;
 
@@ -183,22 +182,21 @@ static void i3000_get_error_info(struct mem_ctl_info *mci,
         * should be UE info.
         */
        if ((info->errsts ^ info->errsts2) & I3000_ERRSTS_BITS) {
-                       pci_read_config_byte(pdev, I3000_EDEAP,
-                                       &info->edeap);
-                       pci_read_config_dword(pdev, I3000_DEAP,
-                                       &info->deap);
-                       pci_read_config_byte(pdev, I3000_DERRSYN,
-                                       &info->derrsyn);
+               pci_read_config_byte(pdev, I3000_EDEAP, &info->edeap);
+               pci_read_config_dword(pdev, I3000_DEAP, &info->deap);
+               pci_read_config_byte(pdev, I3000_DERRSYN, &info->derrsyn);
        }
 
        /* Clear any error bits.
         * (Yes, we really clear bits by writing 1 to them.)
         */
-       pci_write_bits16(pdev, I3000_ERRSTS, I3000_ERRSTS_BITS, I3000_ERRSTS_BITS);
+       pci_write_bits16(pdev, I3000_ERRSTS, I3000_ERRSTS_BITS,
+                        I3000_ERRSTS_BITS);
 }
 
 static int i3000_process_error_info(struct mem_ctl_info *mci,
-               struct i3000_error_info *info, int handle_errors)
+                               struct i3000_error_info *info,
+                               int handle_errors)
 {
        int row, multi_chan;
        int pfn, offset, channel;
@@ -226,8 +224,7 @@ static int i3000_process_error_info(struct mem_ctl_info *mci,
                edac_mc_handle_ue(mci, pfn, offset, row, "i3000 UE");
        else
                edac_mc_handle_ce(mci, pfn, offset, info->derrsyn, row,
-                                      multi_chan ? channel : 0,
-                                      "i3000 CE");
+                               multi_chan ? channel : 0, "i3000 CE");
 
        return 1;
 }
@@ -253,7 +250,8 @@ static int i3000_is_interleaved(const unsigned char *c0dra,
         */
        for (i = 0; i < I3000_RANKS_PER_CHANNEL / 2; i++)
                if (ODD_RANK_ATTRIB(c0dra[i]) != ODD_RANK_ATTRIB(c1dra[i]) ||
-                   EVEN_RANK_ATTRIB(c0dra[i]) != EVEN_RANK_ATTRIB(c1dra[i]))
+                       EVEN_RANK_ATTRIB(c0dra[i]) !=
+                                               EVEN_RANK_ATTRIB(c1dra[i]))
                        return 0;
 
        /* If the rank boundaries for the two channels are different
@@ -277,22 +275,23 @@ static int i3000_probe1(struct pci_dev *pdev, int dev_idx)
        unsigned char *c0dra = dra, *c1dra = &dra[I3000_RANKS_PER_CHANNEL / 2];
        unsigned char *c0drb = drb, *c1drb = &drb[I3000_RANKS_PER_CHANNEL];
        unsigned long mchbar;
-       void *window;
+       void __iomem *window;
 
        debugf0("MC: %s()\n", __func__);
 
-       pci_read_config_dword(pdev, I3000_MCHBAR, (u32 *)&mchbar);
+       pci_read_config_dword(pdev, I3000_MCHBAR, (u32 *) & mchbar);
        mchbar &= I3000_MCHBAR_MASK;
        window = ioremap_nocache(mchbar, I3000_MMR_WINDOW_SIZE);
        if (!window) {
-               printk(KERN_ERR "i3000: cannot map mmio space at 0x%lx\n", mchbar);
+               printk(KERN_ERR "i3000: cannot map mmio space at 0x%lx\n",
+                       mchbar);
                return -ENODEV;
        }
 
-       c0dra[0] = readb(window + I3000_C0DRA + 0); /* ranks 0,1 */
-       c0dra[1] = readb(window + I3000_C0DRA + 1); /* ranks 2,3 */
-       c1dra[0] = readb(window + I3000_C1DRA + 0); /* ranks 0,1 */
-       c1dra[1] = readb(window + I3000_C1DRA + 1); /* ranks 2,3 */
+       c0dra[0] = readb(window + I3000_C0DRA + 0);     /* ranks 0,1 */
+       c0dra[1] = readb(window + I3000_C0DRA + 1);     /* ranks 2,3 */
+       c1dra[0] = readb(window + I3000_C1DRA + 0);     /* ranks 0,1 */
+       c1dra[1] = readb(window + I3000_C1DRA + 1);     /* ranks 2,3 */
 
        for (i = 0; i < I3000_RANKS_PER_CHANNEL; i++) {
                c0drb[i] = readb(window + I3000_C0DRB + i);
@@ -310,7 +309,7 @@ static int i3000_probe1(struct pci_dev *pdev, int dev_idx)
         */
        interleaved = i3000_is_interleaved(c0dra, c1dra, c0drb, c1drb);
        nr_channels = interleaved ? 2 : 1;
-       mci = edac_mc_alloc(0, I3000_RANKS / nr_channels, nr_channels);
+       mci = edac_mc_alloc(0, I3000_RANKS / nr_channels, nr_channels, 0);
        if (!mci)
                return -ENOMEM;
 
@@ -367,14 +366,26 @@ static int i3000_probe1(struct pci_dev *pdev, int dev_idx)
        /* Clear any error bits.
         * (Yes, we really clear bits by writing 1 to them.)
         */
-       pci_write_bits16(pdev, I3000_ERRSTS, I3000_ERRSTS_BITS, I3000_ERRSTS_BITS);
+       pci_write_bits16(pdev, I3000_ERRSTS, I3000_ERRSTS_BITS,
+                        I3000_ERRSTS_BITS);
 
        rc = -ENODEV;
-       if (edac_mc_add_mc(mci, 0)) {
+       if (edac_mc_add_mc(mci)) {
                debugf3("MC: %s(): failed edac_mc_add_mc()\n", __func__);
                goto fail;
        }
 
+       /* allocating generic PCI control info */
+       i3000_pci = edac_pci_create_generic_ctl(&pdev->dev, EDAC_MOD_STR);
+       if (!i3000_pci) {
+               printk(KERN_WARNING
+                       "%s(): Unable to create PCI control\n",
+                       __func__);
+               printk(KERN_WARNING
+                       "%s(): PCI error report via EDAC not setup\n",
+                       __func__);
+       }
+
        /* get this far and it's successful */
        debugf3("MC: %s(): success\n", __func__);
        return 0;
@@ -388,7 +399,7 @@ static int i3000_probe1(struct pci_dev *pdev, int dev_idx)
 
 /* returns count (>= 0), or negative on error */
 static int __devinit i3000_init_one(struct pci_dev *pdev,
-                                     const struct pci_device_id *ent)
+                               const struct pci_device_id *ent)
 {
        int rc;
 
@@ -410,6 +421,9 @@ static void __devexit i3000_remove_one(struct pci_dev *pdev)
 
        debugf0("%s()\n", __func__);
 
+       if (i3000_pci)
+               edac_pci_release_generic_ctl(i3000_pci);
+
        if ((mci = edac_mc_del_mc(&pdev->dev)) == NULL)
                return;
 
@@ -418,12 +432,11 @@ static void __devexit i3000_remove_one(struct pci_dev *pdev)
 
 static const struct pci_device_id i3000_pci_tbl[] __devinitdata = {
        {
-               PCI_VEND_DEV(INTEL, 3000_HB), PCI_ANY_ID, PCI_ANY_ID, 0, 0,
-               I3000
-       },
+        PCI_VEND_DEV(INTEL, 3000_HB), PCI_ANY_ID, PCI_ANY_ID, 0, 0,
+        I3000},
        {
-               0,
-       }       /* 0 terminated list. */
+        0,
+        }                      /* 0 terminated list. */
 };
 
 MODULE_DEVICE_TABLE(pci, i3000_pci_tbl);
@@ -447,7 +460,7 @@ static int __init i3000_init(void)
        if (mci_pdev == NULL) {
                i3000_registered = 0;
                mci_pdev = pci_get_device(PCI_VENDOR_ID_INTEL,
-                                         PCI_DEVICE_ID_INTEL_3000_HB, NULL);
+                                       PCI_DEVICE_ID_INTEL_3000_HB, NULL);
                if (!mci_pdev) {
                        debugf0("i3000 pci_get_device fail\n");
                        pci_rc = -ENODEV;