]> Pileus Git - ~andy/linux/blobdiff - drivers/edac/e752x_edac.c
drivers/edac: mod race fix i82875p
[~andy/linux] / drivers / edac / e752x_edac.c
index 45c55a067c7390ae26005990439a26c9a5f59fef..a041218370f9f66bcdfd606b03257be3d662c52b 100644 (file)
@@ -204,21 +204,21 @@ struct e752x_error_info {
 
 static const struct e752x_dev_info e752x_devs[] = {
        [E7520] = {
-                  .err_dev = PCI_DEVICE_ID_INTEL_7520_1_ERR,
-                  .ctl_dev = PCI_DEVICE_ID_INTEL_7520_0,
-                  .ctl_name = "E7520"},
+               .err_dev = PCI_DEVICE_ID_INTEL_7520_1_ERR,
+               .ctl_dev = PCI_DEVICE_ID_INTEL_7520_0,
+               .ctl_name = "E7520"},
        [E7525] = {
-                  .err_dev = PCI_DEVICE_ID_INTEL_7525_1_ERR,
-                  .ctl_dev = PCI_DEVICE_ID_INTEL_7525_0,
-                  .ctl_name = "E7525"},
+               .err_dev = PCI_DEVICE_ID_INTEL_7525_1_ERR,
+               .ctl_dev = PCI_DEVICE_ID_INTEL_7525_0,
+               .ctl_name = "E7525"},
        [E7320] = {
-                  .err_dev = PCI_DEVICE_ID_INTEL_7320_1_ERR,
-                  .ctl_dev = PCI_DEVICE_ID_INTEL_7320_0,
-                  .ctl_name = "E7320"},
+               .err_dev = PCI_DEVICE_ID_INTEL_7320_1_ERR,
+               .ctl_dev = PCI_DEVICE_ID_INTEL_7320_0,
+               .ctl_name = "E7320"},
 };
 
 static unsigned long ctl_page_to_phys(struct mem_ctl_info *mci,
-                                     unsigned long page)
+                               unsigned long page)
 {
        u32 remap;
        struct e752x_pvt *pvt = (struct e752x_pvt *)mci->pvt_info;
@@ -241,7 +241,7 @@ static unsigned long ctl_page_to_phys(struct mem_ctl_info *mci,
 }
 
 static void do_process_ce(struct mem_ctl_info *mci, u16 error_one,
-                         u32 sec1_add, u16 sec1_syndrome)
+                       u32 sec1_add, u16 sec1_syndrome)
 {
        u32 page;
        int row;
@@ -259,10 +259,10 @@ static void do_process_ce(struct mem_ctl_info *mci, u16 error_one,
                /* chip select are bits 14 & 13 */
                row = ((page >> 1) & 3);
                e752x_printk(KERN_WARNING,
-                            "Test row %d Table %d %d %d %d %d %d %d %d\n", row,
-                            pvt->map[0], pvt->map[1], pvt->map[2], pvt->map[3],
-                            pvt->map[4], pvt->map[5], pvt->map[6],
-                            pvt->map[7]);
+                       "Test row %d Table %d %d %d %d %d %d %d %d\n", row,
+                       pvt->map[0], pvt->map[1], pvt->map[2], pvt->map[3],
+                       pvt->map[4], pvt->map[5], pvt->map[6],
+                       pvt->map[7]);
 
                /* test for channel remapping */
                for (i = 0; i < 8; i++) {
@@ -289,12 +289,12 @@ static void do_process_ce(struct mem_ctl_info *mci, u16 error_one,
 
        /* e752x mc reads 34:6 of the DRAM linear address */
        edac_mc_handle_ce(mci, page, offset_in_page(sec1_add << 4),
-                         sec1_syndrome, row, channel, "e752x CE");
+                       sec1_syndrome, row, channel, "e752x CE");
 }
 
 static inline void process_ce(struct mem_ctl_info *mci, u16 error_one,
-                             u32 sec1_add, u16 sec1_syndrome, int *error_found,
-                             int handle_error)
+                       u32 sec1_add, u16 sec1_syndrome, int *error_found,
+                       int handle_error)
 {
        *error_found = 1;
 
@@ -303,7 +303,7 @@ static inline void process_ce(struct mem_ctl_info *mci, u16 error_one,
 }
 
 static void do_process_ue(struct mem_ctl_info *mci, u16 error_one,
-                         u32 ded_add, u32 scrb_add)
+                       u32 ded_add, u32 scrb_add)
 {
        u32 error_2b, block_page;
        int row;
@@ -318,14 +318,14 @@ static void do_process_ue(struct mem_ctl_info *mci, u16 error_one,
                block_page = error_2b >> (PAGE_SHIFT - 4);
 
                row = pvt->mc_symmetric ?
-                   /* chip select are bits 14 & 13 */
-                   ((block_page >> 1) & 3) :
-                   edac_mc_find_csrow_by_page(mci, block_page);
+               /* chip select are bits 14 & 13 */
+                       ((block_page >> 1) & 3) :
+                       edac_mc_find_csrow_by_page(mci, block_page);
 
                /* e752x mc reads 34:6 of the DRAM linear address */
                edac_mc_handle_ue(mci, block_page,
-                                 offset_in_page(error_2b << 4),
-                                 row, "e752x UE from Read");
+                               offset_in_page(error_2b << 4),
+                               row, "e752x UE from Read");
        }
        if (error_one & 0x0404) {
                error_2b = scrb_add;
@@ -334,20 +334,20 @@ static void do_process_ue(struct mem_ctl_info *mci, u16 error_one,
                block_page = error_2b >> (PAGE_SHIFT - 4);
 
                row = pvt->mc_symmetric ?
-                   /* chip select are bits 14 & 13 */
-                   ((block_page >> 1) & 3) :
-                   edac_mc_find_csrow_by_page(mci, block_page);
+               /* chip select are bits 14 & 13 */
+                       ((block_page >> 1) & 3) :
+                       edac_mc_find_csrow_by_page(mci, block_page);
 
                /* e752x mc reads 34:6 of the DRAM linear address */
                edac_mc_handle_ue(mci, block_page,
-                                 offset_in_page(error_2b << 4),
-                                 row, "e752x UE from Scruber");
+                               offset_in_page(error_2b << 4),
+                               row, "e752x UE from Scruber");
        }
 }
 
 static inline void process_ue(struct mem_ctl_info *mci, u16 error_one,
-                             u32 ded_add, u32 scrb_add, int *error_found,
-                             int handle_error)
+                       u32 ded_add, u32 scrb_add, int *error_found,
+                       int handle_error)
 {
        *error_found = 1;
 
@@ -377,15 +377,15 @@ static void do_process_ded_retry(struct mem_ctl_info *mci, u16 error,
        error_1b = retry_add;
        page = error_1b >> (PAGE_SHIFT - 4);    /* convert the addr to 4k page */
        row = pvt->mc_symmetric ? ((page >> 1) & 3) :   /* chip select are bits 14 & 13 */
-           edac_mc_find_csrow_by_page(mci, page);
+               edac_mc_find_csrow_by_page(mci, page);
        e752x_mc_printk(mci, KERN_WARNING,
                        "CE page 0x%lx, row %d : Memory read retry\n",
                        (long unsigned int)page, row);
 }
 
 static inline void process_ded_retry(struct mem_ctl_info *mci, u16 error,
-                                    u32 retry_add, int *error_found,
-                                    int handle_error)
+                               u32 retry_add, int *error_found,
+                               int handle_error)
 {
        *error_found = 1;
 
@@ -418,7 +418,7 @@ static void do_global_error(int fatal, u32 errors)
        for (i = 0; i < 11; i++) {
                if (errors & (1 << i))
                        e752x_printk(KERN_WARNING, "%sError %s\n",
-                                    fatal_message[fatal], global_message[i]);
+                               fatal_message[fatal], global_message[i]);
        }
 }
 
@@ -445,12 +445,12 @@ static void do_hub_error(int fatal, u8 errors)
        for (i = 0; i < 7; i++) {
                if (errors & (1 << i))
                        e752x_printk(KERN_WARNING, "%sError %s\n",
-                                    fatal_message[fatal], hub_message[i]);
+                               fatal_message[fatal], hub_message[i]);
        }
 }
 
 static inline void hub_error(int fatal, u8 errors, int *error_found,
-                            int handle_error)
+                       int handle_error)
 {
        *error_found = 1;
 
@@ -472,7 +472,7 @@ static void do_membuf_error(u8 errors)
        for (i = 0; i < 4; i++) {
                if (errors & (1 << i))
                        e752x_printk(KERN_WARNING, "Non-Fatal Error %s\n",
-                                    membuf_message[i]);
+                               membuf_message[i]);
        }
 }
 
@@ -503,7 +503,7 @@ static void do_sysbus_error(int fatal, u32 errors)
        for (i = 0; i < 10; i++) {
                if (errors & (1 << i))
                        e752x_printk(KERN_WARNING, "%sError System Bus %s\n",
-                                    fatal_message[fatal], sysbus_message[i]);
+                               fatal_message[fatal], sysbus_message[i]);
        }
 }
 
@@ -517,7 +517,7 @@ static inline void sysbus_error(int fatal, u32 errors, int *error_found,
 }
 
 static void e752x_check_hub_interface(struct e752x_error_info *info,
-                                     int *error_found, int handle_error)
+                               int *error_found, int handle_error)
 {
        u8 stat8;
 
@@ -550,7 +550,7 @@ static void e752x_check_hub_interface(struct e752x_error_info *info,
 }
 
 static void e752x_check_sysbus(struct e752x_error_info *info,
-                              int *error_found, int handle_error)
+                       int *error_found, int handle_error)
 {
        u32 stat32, error32;
 
@@ -577,7 +577,7 @@ static void e752x_check_sysbus(struct e752x_error_info *info,
 }
 
 static void e752x_check_membuf(struct e752x_error_info *info,
-                              int *error_found, int handle_error)
+                       int *error_found, int handle_error)
 {
        u8 stat8;
 
@@ -597,8 +597,8 @@ static void e752x_check_membuf(struct e752x_error_info *info,
 }
 
 static void e752x_check_dram(struct mem_ctl_info *mci,
-                            struct e752x_error_info *info, int *error_found,
-                            int handle_error)
+                       struct e752x_error_info *info, int *error_found,
+                       int handle_error)
 {
        u16 error_one, error_next;
 
@@ -608,11 +608,11 @@ static void e752x_check_dram(struct mem_ctl_info *mci,
        /* decode and report errors */
        if (error_one & 0x0101) /* check first error correctable */
                process_ce(mci, error_one, info->dram_sec1_add,
-                          info->dram_sec1_syndrome, error_found, handle_error);
+                       info->dram_sec1_syndrome, error_found, handle_error);
 
        if (error_next & 0x0101)        /* check next error correctable */
                process_ce(mci, error_next, info->dram_sec2_add,
-                          info->dram_sec2_syndrome, error_found, handle_error);
+                       info->dram_sec2_syndrome, error_found, handle_error);
 
        if (error_one & 0x4040)
                process_ue_no_info_wr(mci, error_found, handle_error);
@@ -622,26 +622,26 @@ static void e752x_check_dram(struct mem_ctl_info *mci,
 
        if (error_one & 0x2020)
                process_ded_retry(mci, error_one, info->dram_retr_add,
-                                 error_found, handle_error);
+                               error_found, handle_error);
 
        if (error_next & 0x2020)
                process_ded_retry(mci, error_next, info->dram_retr_add,
-                                 error_found, handle_error);
+                               error_found, handle_error);
 
        if (error_one & 0x0808)
                process_threshold_ce(mci, error_one, error_found, handle_error);
 
        if (error_next & 0x0808)
                process_threshold_ce(mci, error_next, error_found,
-                                    handle_error);
+                               handle_error);
 
        if (error_one & 0x0606)
                process_ue(mci, error_one, info->dram_ded_add,
-                          info->dram_scrb_add, error_found, handle_error);
+                       info->dram_scrb_add, error_found, handle_error);
 
        if (error_next & 0x0606)
                process_ue(mci, error_next, info->dram_ded_add,
-                          info->dram_scrb_add, error_found, handle_error);
+                       info->dram_scrb_add, error_found, handle_error);
 }
 
 static void e752x_get_error_info(struct mem_ctl_info *mci,
@@ -658,38 +658,38 @@ static void e752x_get_error_info(struct mem_ctl_info *mci,
        if (info->ferr_global) {
                pci_read_config_byte(dev, E752X_HI_FERR, &info->hi_ferr);
                pci_read_config_word(dev, E752X_SYSBUS_FERR,
-                                    &info->sysbus_ferr);
+                               &info->sysbus_ferr);
                pci_read_config_byte(dev, E752X_BUF_FERR, &info->buf_ferr);
                pci_read_config_word(dev, E752X_DRAM_FERR, &info->dram_ferr);
                pci_read_config_dword(dev, E752X_DRAM_SEC1_ADD,
-                                     &info->dram_sec1_add);
+                               &info->dram_sec1_add);
                pci_read_config_word(dev, E752X_DRAM_SEC1_SYNDROME,
-                                    &info->dram_sec1_syndrome);
+                               &info->dram_sec1_syndrome);
                pci_read_config_dword(dev, E752X_DRAM_DED_ADD,
-                                     &info->dram_ded_add);
+                               &info->dram_ded_add);
                pci_read_config_dword(dev, E752X_DRAM_SCRB_ADD,
-                                     &info->dram_scrb_add);
+                               &info->dram_scrb_add);
                pci_read_config_dword(dev, E752X_DRAM_RETR_ADD,
-                                     &info->dram_retr_add);
+                               &info->dram_retr_add);
 
                if (info->hi_ferr & 0x7f)
                        pci_write_config_byte(dev, E752X_HI_FERR,
-                                             info->hi_ferr);
+                                       info->hi_ferr);
 
                if (info->sysbus_ferr)
                        pci_write_config_word(dev, E752X_SYSBUS_FERR,
-                                             info->sysbus_ferr);
+                                       info->sysbus_ferr);
 
                if (info->buf_ferr & 0x0f)
                        pci_write_config_byte(dev, E752X_BUF_FERR,
-                                             info->buf_ferr);
+                                       info->buf_ferr);
 
                if (info->dram_ferr)
                        pci_write_bits16(pvt->bridge_ck, E752X_DRAM_FERR,
                                         info->dram_ferr, info->dram_ferr);
 
                pci_write_config_dword(dev, E752X_FERR_GLOBAL,
-                                      info->ferr_global);
+                               info->ferr_global);
        }
 
        pci_read_config_dword(dev, E752X_NERR_GLOBAL, &info->nerr_global);
@@ -697,38 +697,38 @@ static void e752x_get_error_info(struct mem_ctl_info *mci,
        if (info->nerr_global) {
                pci_read_config_byte(dev, E752X_HI_NERR, &info->hi_nerr);
                pci_read_config_word(dev, E752X_SYSBUS_NERR,
-                                    &info->sysbus_nerr);
+                               &info->sysbus_nerr);
                pci_read_config_byte(dev, E752X_BUF_NERR, &info->buf_nerr);
                pci_read_config_word(dev, E752X_DRAM_NERR, &info->dram_nerr);
                pci_read_config_dword(dev, E752X_DRAM_SEC2_ADD,
-                                     &info->dram_sec2_add);
+                               &info->dram_sec2_add);
                pci_read_config_word(dev, E752X_DRAM_SEC2_SYNDROME,
-                                    &info->dram_sec2_syndrome);
+                               &info->dram_sec2_syndrome);
 
                if (info->hi_nerr & 0x7f)
                        pci_write_config_byte(dev, E752X_HI_NERR,
-                                             info->hi_nerr);
+                                       info->hi_nerr);
 
                if (info->sysbus_nerr)
                        pci_write_config_word(dev, E752X_SYSBUS_NERR,
-                                             info->sysbus_nerr);
+                                       info->sysbus_nerr);
 
                if (info->buf_nerr & 0x0f)
                        pci_write_config_byte(dev, E752X_BUF_NERR,
-                                             info->buf_nerr);
+                                       info->buf_nerr);
 
                if (info->dram_nerr)
                        pci_write_bits16(pvt->bridge_ck, E752X_DRAM_NERR,
                                         info->dram_nerr, info->dram_nerr);
 
                pci_write_config_dword(dev, E752X_NERR_GLOBAL,
-                                      info->nerr_global);
+                               info->nerr_global);
        }
 }
 
 static int e752x_process_error_info(struct mem_ctl_info *mci,
-                                   struct e752x_error_info *info,
-                                   int handle_errors)
+                               struct e752x_error_info *info,
+                               int handle_errors)
 {
        u32 error32, stat32;
        int error_found;
@@ -775,7 +775,7 @@ static inline int dual_channel_active(u16 ddrcsr)
 }
 
 static void e752x_init_csrows(struct mem_ctl_info *mci, struct pci_dev *pdev,
-                             u16 ddrcsr)
+                       u16 ddrcsr)
 {
        struct csrow_info *csrow;
        unsigned long last_cumul_size;
@@ -841,7 +841,7 @@ static void e752x_init_csrows(struct mem_ctl_info *mci, struct pci_dev *pdev,
 }
 
 static void e752x_init_mem_map_table(struct pci_dev *pdev,
-                                    struct e752x_pvt *pvt)
+                               struct e752x_pvt *pvt)
 {
        int index;
        u8 value, last, row, stat8;
@@ -864,11 +864,11 @@ static void e752x_init_mem_map_table(struct pci_dev *pdev,
                         * sided
                         */
                        pci_read_config_byte(pdev, E752X_DRB + index + 1,
-                                            &value);
-                       pvt->map[index + 1] = (value == last) ? 0xff :  /* the dimm is single sided,
-                                                                          so flag as empty */
-                           row;        /* this is a double sided dimm
-                                          to save the next row # */
+                                       &value);
+
+                       /* the dimm is single sided, so flag as empty */
+                       /* this is a double sided dimm to save the next row #*/
+                       pvt->map[index + 1] = (value == last) ? 0xff :  row;
                        row++;
                        last = value;
                }
@@ -881,7 +881,7 @@ static void e752x_init_mem_map_table(struct pci_dev *pdev,
 
 /* Return 0 on success or 1 on failure. */
 static int e752x_get_devs(struct pci_dev *pdev, int dev_idx,
-                         struct e752x_pvt *pvt)
+                       struct e752x_pvt *pvt)
 {
        struct pci_dev *dev;
 
@@ -894,13 +894,13 @@ static int e752x_get_devs(struct pci_dev *pdev, int dev_idx,
 
        if (pvt->bridge_ck == NULL) {
                e752x_printk(KERN_ERR, "error reporting device not found:"
-                            "vendor %x device 0x%x (broken BIOS?)\n",
-                            PCI_VENDOR_ID_INTEL, e752x_devs[dev_idx].err_dev);
+                       "vendor %x device 0x%x (broken BIOS?)\n",
+                       PCI_VENDOR_ID_INTEL, e752x_devs[dev_idx].err_dev);
                return 1;
        }
 
        dev = pci_get_device(PCI_VENDOR_ID_INTEL, e752x_devs[dev_idx].ctl_dev,
-                            NULL);
+                       NULL);
 
        if (dev == NULL)
                goto fail;
@@ -910,7 +910,7 @@ static int e752x_get_devs(struct pci_dev *pdev, int dev_idx,
 
        return 0;
 
-      fail:
+fail:
        pci_dev_put(pvt->bridge_ck);
        return 1;
 }
@@ -961,7 +961,7 @@ static int e752x_probe1(struct pci_dev *pdev, int dev_idx)
        pci_read_config_byte(pdev, E752X_DEVPRES1, &stat8);
        if (!force_function_unhide && !(stat8 & (1 << 5))) {
                printk(KERN_INFO "Contact your BIOS vendor to see if the "
-                      "E752x error registers can be safely un-hidden\n");
+                       "E752x error registers can be safely un-hidden\n");
                return -ENOMEM;
        }
        stat8 |= (1 << 5);
@@ -981,7 +981,7 @@ static int e752x_probe1(struct pci_dev *pdev, int dev_idx)
        debugf3("%s(): init mci\n", __func__);
        mci->mtype_cap = MEM_FLAG_RDDR;
        mci->edac_ctl_cap = EDAC_FLAG_NONE | EDAC_FLAG_SECDED |
-           EDAC_FLAG_S4ECD4ED;
+               EDAC_FLAG_S4ECD4ED;
        /* FIXME - what if different memory types are in different csrows? */
        mci->mod_name = EDAC_MOD_STR;
        mci->mod_ver = E752X_REVISION;
@@ -1021,8 +1021,8 @@ static int e752x_probe1(struct pci_dev *pdev, int dev_idx)
        pci_read_config_word(pdev, E752X_REMAPLIMIT, &pci_data);
        pvt->remaplimit = ((u32) pci_data) << 14;
        e752x_printk(KERN_INFO,
-                    "tolm = %x, remapbase = %x, remaplimit = %x\n", pvt->tolm,
-                    pvt->remapbase, pvt->remaplimit);
+                       "tolm = %x, remapbase = %x, remaplimit = %x\n",
+                       pvt->tolm, pvt->remapbase, pvt->remaplimit);
 
        /* Here we assume that we will never see multiple instances of this
         * type of memory controller.  The ID is therefore hardcoded to 0.
@@ -1039,16 +1039,17 @@ static int e752x_probe1(struct pci_dev *pdev, int dev_idx)
        e752x_pci = edac_pci_create_generic_ctl(&pdev->dev, EDAC_MOD_STR);
        if (!e752x_pci) {
                printk(KERN_WARNING
-                      "%s(): Unable to create PCI control\n", __func__);
+                       "%s(): Unable to create PCI control\n", __func__);
                printk(KERN_WARNING
-                      "%s(): PCI error report via EDAC not setup\n", __func__);
+                       "%s(): PCI error report via EDAC not setup\n",
+                       __func__);
        }
 
        /* get this far and it's successful */
        debugf3("%s(): success\n", __func__);
        return 0;
 
-      fail:
+fail:
        pci_dev_put(pvt->dev_d0f0);
        pci_dev_put(pvt->dev_d0f1);
        pci_dev_put(pvt->bridge_ck);
@@ -1059,7 +1060,7 @@ static int e752x_probe1(struct pci_dev *pdev, int dev_idx)
 
 /* returns count (>= 0), or negative on error */
 static int __devinit e752x_init_one(struct pci_dev *pdev,
-                                   const struct pci_device_id *ent)
+                               const struct pci_device_id *ent)
 {
        debugf0("%s()\n", __func__);