Commit 203333cb authored by Dave Jiang's avatar Dave Jiang Committed by Linus Torvalds

drivers/edac: Lindent e752x

Run e752x_edac.c file through Lindent for cleanup
Signed-off-by: default avatarDave Jiang <djiang@mvista.com>
Signed-off-by: default avatarDouglas Thompson <dougthompson@xmission.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 466b71d5
...@@ -204,27 +204,24 @@ struct e752x_error_info { ...@@ -204,27 +204,24 @@ struct e752x_error_info {
static const struct e752x_dev_info e752x_devs[] = { static const struct e752x_dev_info e752x_devs[] = {
[E7520] = { [E7520] = {
.err_dev = PCI_DEVICE_ID_INTEL_7520_1_ERR, .err_dev = PCI_DEVICE_ID_INTEL_7520_1_ERR,
.ctl_dev = PCI_DEVICE_ID_INTEL_7520_0, .ctl_dev = PCI_DEVICE_ID_INTEL_7520_0,
.ctl_name = "E7520" .ctl_name = "E7520"},
},
[E7525] = { [E7525] = {
.err_dev = PCI_DEVICE_ID_INTEL_7525_1_ERR, .err_dev = PCI_DEVICE_ID_INTEL_7525_1_ERR,
.ctl_dev = PCI_DEVICE_ID_INTEL_7525_0, .ctl_dev = PCI_DEVICE_ID_INTEL_7525_0,
.ctl_name = "E7525" .ctl_name = "E7525"},
},
[E7320] = { [E7320] = {
.err_dev = PCI_DEVICE_ID_INTEL_7320_1_ERR, .err_dev = PCI_DEVICE_ID_INTEL_7320_1_ERR,
.ctl_dev = PCI_DEVICE_ID_INTEL_7320_0, .ctl_dev = PCI_DEVICE_ID_INTEL_7320_0,
.ctl_name = "E7320" .ctl_name = "E7320"},
},
}; };
static unsigned long ctl_page_to_phys(struct mem_ctl_info *mci, static unsigned long ctl_page_to_phys(struct mem_ctl_info *mci,
unsigned long page) unsigned long page)
{ {
u32 remap; u32 remap;
struct e752x_pvt *pvt = (struct e752x_pvt *) mci->pvt_info; struct e752x_pvt *pvt = (struct e752x_pvt *)mci->pvt_info;
debugf3("%s()\n", __func__); debugf3("%s()\n", __func__);
...@@ -244,13 +241,13 @@ static unsigned long ctl_page_to_phys(struct mem_ctl_info *mci, ...@@ -244,13 +241,13 @@ 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, 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; u32 page;
int row; int row;
int channel; int channel;
int i; int i;
struct e752x_pvt *pvt = (struct e752x_pvt *) mci->pvt_info; struct e752x_pvt *pvt = (struct e752x_pvt *)mci->pvt_info;
debugf3("%s()\n", __func__); debugf3("%s()\n", __func__);
...@@ -262,9 +259,10 @@ static void do_process_ce(struct mem_ctl_info *mci, u16 error_one, ...@@ -262,9 +259,10 @@ static void do_process_ce(struct mem_ctl_info *mci, u16 error_one,
/* chip select are bits 14 & 13 */ /* chip select are bits 14 & 13 */
row = ((page >> 1) & 3); row = ((page >> 1) & 3);
e752x_printk(KERN_WARNING, e752x_printk(KERN_WARNING,
"Test row %d Table %d %d %d %d %d %d %d %d\n", row, "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[0], pvt->map[1], pvt->map[2], pvt->map[3],
pvt->map[4], pvt->map[5], pvt->map[6], pvt->map[7]); pvt->map[4], pvt->map[5], pvt->map[6],
pvt->map[7]);
/* test for channel remapping */ /* test for channel remapping */
for (i = 0; i < 8; i++) { for (i = 0; i < 8; i++) {
...@@ -278,7 +276,8 @@ static void do_process_ce(struct mem_ctl_info *mci, u16 error_one, ...@@ -278,7 +276,8 @@ static void do_process_ce(struct mem_ctl_info *mci, u16 error_one,
row = i; row = i;
else else
e752x_mc_printk(mci, KERN_WARNING, e752x_mc_printk(mci, KERN_WARNING,
"row %d not found in remap table\n", row); "row %d not found in remap table\n",
row);
} else } else
row = edac_mc_find_csrow_by_page(mci, page); row = edac_mc_find_csrow_by_page(mci, page);
...@@ -290,12 +289,12 @@ static void do_process_ce(struct mem_ctl_info *mci, u16 error_one, ...@@ -290,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 */ /* e752x mc reads 34:6 of the DRAM linear address */
edac_mc_handle_ce(mci, page, offset_in_page(sec1_add << 4), 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, static inline void process_ce(struct mem_ctl_info *mci, u16 error_one,
u32 sec1_add, u16 sec1_syndrome, int *error_found, u32 sec1_add, u16 sec1_syndrome, int *error_found,
int handle_error) int handle_error)
{ {
*error_found = 1; *error_found = 1;
...@@ -304,11 +303,11 @@ static inline void process_ce(struct mem_ctl_info *mci, u16 error_one, ...@@ -304,11 +303,11 @@ 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, 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; u32 error_2b, block_page;
int row; int row;
struct e752x_pvt *pvt = (struct e752x_pvt *) mci->pvt_info; struct e752x_pvt *pvt = (struct e752x_pvt *)mci->pvt_info;
debugf3("%s()\n", __func__); debugf3("%s()\n", __func__);
...@@ -319,14 +318,14 @@ static void do_process_ue(struct mem_ctl_info *mci, u16 error_one, ...@@ -319,14 +318,14 @@ static void do_process_ue(struct mem_ctl_info *mci, u16 error_one,
block_page = error_2b >> (PAGE_SHIFT - 4); block_page = error_2b >> (PAGE_SHIFT - 4);
row = pvt->mc_symmetric ? row = pvt->mc_symmetric ?
/* chip select are bits 14 & 13 */ /* chip select are bits 14 & 13 */
((block_page >> 1) & 3) : ((block_page >> 1) & 3) :
edac_mc_find_csrow_by_page(mci, block_page); edac_mc_find_csrow_by_page(mci, block_page);
/* e752x mc reads 34:6 of the DRAM linear address */ /* e752x mc reads 34:6 of the DRAM linear address */
edac_mc_handle_ue(mci, block_page, edac_mc_handle_ue(mci, block_page,
offset_in_page(error_2b << 4), offset_in_page(error_2b << 4),
row, "e752x UE from Read"); row, "e752x UE from Read");
} }
if (error_one & 0x0404) { if (error_one & 0x0404) {
error_2b = scrb_add; error_2b = scrb_add;
...@@ -335,19 +334,20 @@ static void do_process_ue(struct mem_ctl_info *mci, u16 error_one, ...@@ -335,19 +334,20 @@ static void do_process_ue(struct mem_ctl_info *mci, u16 error_one,
block_page = error_2b >> (PAGE_SHIFT - 4); block_page = error_2b >> (PAGE_SHIFT - 4);
row = pvt->mc_symmetric ? row = pvt->mc_symmetric ?
/* chip select are bits 14 & 13 */ /* chip select are bits 14 & 13 */
((block_page >> 1) & 3) : ((block_page >> 1) & 3) :
edac_mc_find_csrow_by_page(mci, block_page); edac_mc_find_csrow_by_page(mci, block_page);
/* e752x mc reads 34:6 of the DRAM linear address */ /* e752x mc reads 34:6 of the DRAM linear address */
edac_mc_handle_ue(mci, block_page, edac_mc_handle_ue(mci, block_page,
offset_in_page(error_2b << 4), offset_in_page(error_2b << 4),
row, "e752x UE from Scruber"); row, "e752x UE from Scruber");
} }
} }
static inline void process_ue(struct mem_ctl_info *mci, u16 error_one, 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; *error_found = 1;
...@@ -356,7 +356,7 @@ static inline void process_ue(struct mem_ctl_info *mci, u16 error_one, ...@@ -356,7 +356,7 @@ static inline void process_ue(struct mem_ctl_info *mci, u16 error_one,
} }
static inline void process_ue_no_info_wr(struct mem_ctl_info *mci, static inline void process_ue_no_info_wr(struct mem_ctl_info *mci,
int *error_found, int handle_error) int *error_found, int handle_error)
{ {
*error_found = 1; *error_found = 1;
...@@ -368,24 +368,24 @@ static inline void process_ue_no_info_wr(struct mem_ctl_info *mci, ...@@ -368,24 +368,24 @@ static inline void process_ue_no_info_wr(struct mem_ctl_info *mci,
} }
static void do_process_ded_retry(struct mem_ctl_info *mci, u16 error, static void do_process_ded_retry(struct mem_ctl_info *mci, u16 error,
u32 retry_add) u32 retry_add)
{ {
u32 error_1b, page; u32 error_1b, page;
int row; int row;
struct e752x_pvt *pvt = (struct e752x_pvt *) mci->pvt_info; struct e752x_pvt *pvt = (struct e752x_pvt *)mci->pvt_info;
error_1b = retry_add; error_1b = retry_add;
page = error_1b >> (PAGE_SHIFT - 4); /* convert the addr to 4k page */ page = error_1b >> (PAGE_SHIFT - 4); /* convert the addr to 4k page */
row = pvt->mc_symmetric ? row = pvt->mc_symmetric ? ((page >> 1) & 3) : /* chip select are bits 14 & 13 */
((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, e752x_mc_printk(mci, KERN_WARNING,
"CE page 0x%lx, row %d : Memory read retry\n", "CE page 0x%lx, row %d : Memory read retry\n",
(long unsigned int) page, row); (long unsigned int)page, row);
} }
static inline void process_ded_retry(struct mem_ctl_info *mci, u16 error, 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; *error_found = 1;
...@@ -394,7 +394,7 @@ static inline void process_ded_retry(struct mem_ctl_info *mci, u16 error, ...@@ -394,7 +394,7 @@ static inline void process_ded_retry(struct mem_ctl_info *mci, u16 error,
} }
static inline void process_threshold_ce(struct mem_ctl_info *mci, u16 error, static inline void process_threshold_ce(struct mem_ctl_info *mci, u16 error,
int *error_found, int handle_error) int *error_found, int handle_error)
{ {
*error_found = 1; *error_found = 1;
...@@ -418,12 +418,12 @@ static void do_global_error(int fatal, u32 errors) ...@@ -418,12 +418,12 @@ static void do_global_error(int fatal, u32 errors)
for (i = 0; i < 11; i++) { for (i = 0; i < 11; i++) {
if (errors & (1 << i)) if (errors & (1 << i))
e752x_printk(KERN_WARNING, "%sError %s\n", e752x_printk(KERN_WARNING, "%sError %s\n",
fatal_message[fatal], global_message[i]); fatal_message[fatal], global_message[i]);
} }
} }
static inline void global_error(int fatal, u32 errors, int *error_found, static inline void global_error(int fatal, u32 errors, int *error_found,
int handle_error) int handle_error)
{ {
*error_found = 1; *error_found = 1;
...@@ -445,12 +445,12 @@ static void do_hub_error(int fatal, u8 errors) ...@@ -445,12 +445,12 @@ static void do_hub_error(int fatal, u8 errors)
for (i = 0; i < 7; i++) { for (i = 0; i < 7; i++) {
if (errors & (1 << i)) if (errors & (1 << i))
e752x_printk(KERN_WARNING, "%sError %s\n", 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, static inline void hub_error(int fatal, u8 errors, int *error_found,
int handle_error) int handle_error)
{ {
*error_found = 1; *error_found = 1;
...@@ -472,7 +472,7 @@ static void do_membuf_error(u8 errors) ...@@ -472,7 +472,7 @@ static void do_membuf_error(u8 errors)
for (i = 0; i < 4; i++) { for (i = 0; i < 4; i++) {
if (errors & (1 << i)) if (errors & (1 << i))
e752x_printk(KERN_WARNING, "Non-Fatal Error %s\n", e752x_printk(KERN_WARNING, "Non-Fatal Error %s\n",
membuf_message[i]); membuf_message[i]);
} }
} }
...@@ -503,12 +503,12 @@ static void do_sysbus_error(int fatal, u32 errors) ...@@ -503,12 +503,12 @@ static void do_sysbus_error(int fatal, u32 errors)
for (i = 0; i < 10; i++) { for (i = 0; i < 10; i++) {
if (errors & (1 << i)) if (errors & (1 << i))
e752x_printk(KERN_WARNING, "%sError System Bus %s\n", e752x_printk(KERN_WARNING, "%sError System Bus %s\n",
fatal_message[fatal], sysbus_message[i]); fatal_message[fatal], sysbus_message[i]);
} }
} }
static inline void sysbus_error(int fatal, u32 errors, int *error_found, static inline void sysbus_error(int fatal, u32 errors, int *error_found,
int handle_error) int handle_error)
{ {
*error_found = 1; *error_found = 1;
...@@ -517,7 +517,7 @@ static inline void sysbus_error(int fatal, u32 errors, int *error_found, ...@@ -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, 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; u8 stat8;
...@@ -525,33 +525,32 @@ static void e752x_check_hub_interface(struct e752x_error_info *info, ...@@ -525,33 +525,32 @@ static void e752x_check_hub_interface(struct e752x_error_info *info,
stat8 = info->hi_ferr; stat8 = info->hi_ferr;
if(stat8 & 0x7f) { /* Error, so process */ if (stat8 & 0x7f) { /* Error, so process */
stat8 &= 0x7f; stat8 &= 0x7f;
if(stat8 & 0x2b) if (stat8 & 0x2b)
hub_error(1, stat8 & 0x2b, error_found, handle_error); hub_error(1, stat8 & 0x2b, error_found, handle_error);
if(stat8 & 0x54) if (stat8 & 0x54)
hub_error(0, stat8 & 0x54, error_found, handle_error); hub_error(0, stat8 & 0x54, error_found, handle_error);
} }
//pci_read_config_byte(dev,E752X_HI_NERR,&stat8); //pci_read_config_byte(dev,E752X_HI_NERR,&stat8);
stat8 = info->hi_nerr; stat8 = info->hi_nerr;
if(stat8 & 0x7f) { /* Error, so process */ if (stat8 & 0x7f) { /* Error, so process */
stat8 &= 0x7f; stat8 &= 0x7f;
if (stat8 & 0x2b) if (stat8 & 0x2b)
hub_error(1, stat8 & 0x2b, error_found, handle_error); hub_error(1, stat8 & 0x2b, error_found, handle_error);
if(stat8 & 0x54) if (stat8 & 0x54)
hub_error(0, stat8 & 0x54, error_found, handle_error); hub_error(0, stat8 & 0x54, error_found, handle_error);
} }
} }
static void e752x_check_sysbus(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; u32 stat32, error32;
...@@ -559,47 +558,47 @@ static void e752x_check_sysbus(struct e752x_error_info *info, ...@@ -559,47 +558,47 @@ static void e752x_check_sysbus(struct e752x_error_info *info,
stat32 = info->sysbus_ferr + (info->sysbus_nerr << 16); stat32 = info->sysbus_ferr + (info->sysbus_nerr << 16);
if (stat32 == 0) if (stat32 == 0)
return; /* no errors */ return; /* no errors */
error32 = (stat32 >> 16) & 0x3ff; error32 = (stat32 >> 16) & 0x3ff;
stat32 = stat32 & 0x3ff; stat32 = stat32 & 0x3ff;
if(stat32 & 0x087) if (stat32 & 0x087)
sysbus_error(1, stat32 & 0x087, error_found, handle_error); sysbus_error(1, stat32 & 0x087, error_found, handle_error);
if(stat32 & 0x378) if (stat32 & 0x378)
sysbus_error(0, stat32 & 0x378, error_found, handle_error); sysbus_error(0, stat32 & 0x378, error_found, handle_error);
if(error32 & 0x087) if (error32 & 0x087)
sysbus_error(1, error32 & 0x087, error_found, handle_error); sysbus_error(1, error32 & 0x087, error_found, handle_error);
if(error32 & 0x378) if (error32 & 0x378)
sysbus_error(0, error32 & 0x378, error_found, handle_error); sysbus_error(0, error32 & 0x378, error_found, handle_error);
} }
static void e752x_check_membuf (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; u8 stat8;
stat8 = info->buf_ferr; stat8 = info->buf_ferr;
if (stat8 & 0x0f) { /* Error, so process */ if (stat8 & 0x0f) { /* Error, so process */
stat8 &= 0x0f; stat8 &= 0x0f;
membuf_error(stat8, error_found, handle_error); membuf_error(stat8, error_found, handle_error);
} }
stat8 = info->buf_nerr; stat8 = info->buf_nerr;
if (stat8 & 0x0f) { /* Error, so process */ if (stat8 & 0x0f) { /* Error, so process */
stat8 &= 0x0f; stat8 &= 0x0f;
membuf_error(stat8, error_found, handle_error); membuf_error(stat8, error_found, handle_error);
} }
} }
static void e752x_check_dram (struct mem_ctl_info *mci, static void e752x_check_dram(struct mem_ctl_info *mci,
struct e752x_error_info *info, int *error_found, struct e752x_error_info *info, int *error_found,
int handle_error) int handle_error)
{ {
u16 error_one, error_next; u16 error_one, error_next;
...@@ -607,94 +606,90 @@ static void e752x_check_dram (struct mem_ctl_info *mci, ...@@ -607,94 +606,90 @@ static void e752x_check_dram (struct mem_ctl_info *mci,
error_next = info->dram_nerr; error_next = info->dram_nerr;
/* decode and report errors */ /* decode and report errors */
if(error_one & 0x0101) /* check first error correctable */ if (error_one & 0x0101) /* check first error correctable */
process_ce(mci, error_one, info->dram_sec1_add, process_ce(mci, error_one, info->dram_sec1_add,
info->dram_sec1_syndrome, error_found, info->dram_sec1_syndrome, error_found, handle_error);
handle_error);
if(error_next & 0x0101) /* check next error correctable */ if (error_next & 0x0101) /* check next error correctable */
process_ce(mci, error_next, info->dram_sec2_add, process_ce(mci, error_next, info->dram_sec2_add,
info->dram_sec2_syndrome, error_found, info->dram_sec2_syndrome, error_found, handle_error);
handle_error);
if(error_one & 0x4040) if (error_one & 0x4040)
process_ue_no_info_wr(mci, error_found, handle_error); process_ue_no_info_wr(mci, error_found, handle_error);
if(error_next & 0x4040) if (error_next & 0x4040)
process_ue_no_info_wr(mci, error_found, handle_error); process_ue_no_info_wr(mci, error_found, handle_error);
if(error_one & 0x2020) if (error_one & 0x2020)
process_ded_retry(mci, error_one, info->dram_retr_add, process_ded_retry(mci, error_one, info->dram_retr_add,
error_found, handle_error); error_found, handle_error);
if(error_next & 0x2020) if (error_next & 0x2020)
process_ded_retry(mci, error_next, info->dram_retr_add, process_ded_retry(mci, error_next, info->dram_retr_add,
error_found, handle_error); error_found, handle_error);
if(error_one & 0x0808) if (error_one & 0x0808)
process_threshold_ce(mci, error_one, error_found, process_threshold_ce(mci, error_one, error_found, handle_error);
handle_error);
if(error_next & 0x0808) if (error_next & 0x0808)
process_threshold_ce(mci, error_next, error_found, process_threshold_ce(mci, error_next, error_found,
handle_error); handle_error);
if(error_one & 0x0606) if (error_one & 0x0606)
process_ue(mci, error_one, info->dram_ded_add, 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) if (error_next & 0x0606)
process_ue(mci, error_next, info->dram_ded_add, 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, static void e752x_get_error_info(struct mem_ctl_info *mci,
struct e752x_error_info *info) struct e752x_error_info *info)
{ {
struct pci_dev *dev; struct pci_dev *dev;
struct e752x_pvt *pvt; struct e752x_pvt *pvt;
memset(info, 0, sizeof(*info)); memset(info, 0, sizeof(*info));
pvt = (struct e752x_pvt *) mci->pvt_info; pvt = (struct e752x_pvt *)mci->pvt_info;
dev = pvt->dev_d0f1; dev = pvt->dev_d0f1;
pci_read_config_dword(dev, E752X_FERR_GLOBAL, &info->ferr_global); pci_read_config_dword(dev, E752X_FERR_GLOBAL, &info->ferr_global);
if (info->ferr_global) { if (info->ferr_global) {
pci_read_config_byte(dev, E752X_HI_FERR, &info->hi_ferr); pci_read_config_byte(dev, E752X_HI_FERR, &info->hi_ferr);
pci_read_config_word(dev, E752X_SYSBUS_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_byte(dev, E752X_BUF_FERR, &info->buf_ferr);
pci_read_config_word(dev, E752X_DRAM_FERR, pci_read_config_word(dev, E752X_DRAM_FERR, &info->dram_ferr);
&info->dram_ferr);
pci_read_config_dword(dev, E752X_DRAM_SEC1_ADD, 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, 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, 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, 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, pci_read_config_dword(dev, E752X_DRAM_RETR_ADD,
&info->dram_retr_add); &info->dram_retr_add);
if (info->hi_ferr & 0x7f) if (info->hi_ferr & 0x7f)
pci_write_config_byte(dev, E752X_HI_FERR, pci_write_config_byte(dev, E752X_HI_FERR,
info->hi_ferr); info->hi_ferr);
if (info->sysbus_ferr) if (info->sysbus_ferr)
pci_write_config_word(dev, E752X_SYSBUS_FERR, pci_write_config_word(dev, E752X_SYSBUS_FERR,
info->sysbus_ferr); info->sysbus_ferr);
if (info->buf_ferr & 0x0f) if (info->buf_ferr & 0x0f)
pci_write_config_byte(dev, E752X_BUF_FERR, pci_write_config_byte(dev, E752X_BUF_FERR,
info->buf_ferr); info->buf_ferr);
if (info->dram_ferr) if (info->dram_ferr)
pci_write_bits16(pvt->bridge_ck, E752X_DRAM_FERR, pci_write_bits16(pvt->bridge_ck, E752X_DRAM_FERR,
info->dram_ferr, info->dram_ferr); info->dram_ferr, info->dram_ferr);
pci_write_config_dword(dev, E752X_FERR_GLOBAL, 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); pci_read_config_dword(dev, E752X_NERR_GLOBAL, &info->nerr_global);
...@@ -702,38 +697,38 @@ static void e752x_get_error_info (struct mem_ctl_info *mci, ...@@ -702,38 +697,38 @@ static void e752x_get_error_info (struct mem_ctl_info *mci,
if (info->nerr_global) { if (info->nerr_global) {
pci_read_config_byte(dev, E752X_HI_NERR, &info->hi_nerr); pci_read_config_byte(dev, E752X_HI_NERR, &info->hi_nerr);
pci_read_config_word(dev, E752X_SYSBUS_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_byte(dev, E752X_BUF_NERR, &info->buf_nerr);
pci_read_config_word(dev, E752X_DRAM_NERR, pci_read_config_word(dev, E752X_DRAM_NERR, &info->dram_nerr);
&info->dram_nerr);
pci_read_config_dword(dev, E752X_DRAM_SEC2_ADD, 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, pci_read_config_word(dev, E752X_DRAM_SEC2_SYNDROME,
&info->dram_sec2_syndrome); &info->dram_sec2_syndrome);
if (info->hi_nerr & 0x7f) if (info->hi_nerr & 0x7f)
pci_write_config_byte(dev, E752X_HI_NERR, pci_write_config_byte(dev, E752X_HI_NERR,
info->hi_nerr); info->hi_nerr);
if (info->sysbus_nerr) if (info->sysbus_nerr)
pci_write_config_word(dev, E752X_SYSBUS_NERR, pci_write_config_word(dev, E752X_SYSBUS_NERR,
info->sysbus_nerr); info->sysbus_nerr);
if (info->buf_nerr & 0x0f) if (info->buf_nerr & 0x0f)
pci_write_config_byte(dev, E752X_BUF_NERR, pci_write_config_byte(dev, E752X_BUF_NERR,
info->buf_nerr); info->buf_nerr);
if (info->dram_nerr) if (info->dram_nerr)
pci_write_bits16(pvt->bridge_ck, E752X_DRAM_NERR, pci_write_bits16(pvt->bridge_ck, E752X_DRAM_NERR,
info->dram_nerr, info->dram_nerr); info->dram_nerr, info->dram_nerr);
pci_write_config_dword(dev, E752X_NERR_GLOBAL, 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, 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; u32 error32, stat32;
int error_found; int error_found;
...@@ -780,25 +775,25 @@ static inline int dual_channel_active(u16 ddrcsr) ...@@ -780,25 +775,25 @@ static inline int dual_channel_active(u16 ddrcsr)
} }
static void e752x_init_csrows(struct mem_ctl_info *mci, struct pci_dev *pdev, static void e752x_init_csrows(struct mem_ctl_info *mci, struct pci_dev *pdev,
u16 ddrcsr) u16 ddrcsr)
{ {
struct csrow_info *csrow; struct csrow_info *csrow;
unsigned long last_cumul_size; unsigned long last_cumul_size;
int index, mem_dev, drc_chan; int index, mem_dev, drc_chan;
int drc_drbg; /* DRB granularity 0=64mb, 1=128mb */ int drc_drbg; /* DRB granularity 0=64mb, 1=128mb */
int drc_ddim; /* DRAM Data Integrity Mode 0=none, 2=edac */ int drc_ddim; /* DRAM Data Integrity Mode 0=none, 2=edac */
u8 value; u8 value;
u32 dra, drc, cumul_size; u32 dra, drc, cumul_size;
dra = 0; dra = 0;
for (index=0; index < 4; index++) { for (index = 0; index < 4; index++) {
u8 dra_reg; u8 dra_reg;
pci_read_config_byte(pdev, E752X_DRA+index, &dra_reg); pci_read_config_byte(pdev, E752X_DRA + index, &dra_reg);
dra |= dra_reg << (index * 8); dra |= dra_reg << (index * 8);
} }
pci_read_config_dword(pdev, E752X_DRC, &drc); pci_read_config_dword(pdev, E752X_DRC, &drc);
drc_chan = dual_channel_active(ddrcsr); drc_chan = dual_channel_active(ddrcsr);
drc_drbg = drc_chan + 1; /* 128 in dual mode, 64 in single */ drc_drbg = drc_chan + 1; /* 128 in dual mode, 64 in single */
drc_ddim = (drc >> 20) & 0x3; drc_ddim = (drc >> 20) & 0x3;
/* The dram row boundary (DRB) reg values are boundary address for /* The dram row boundary (DRB) reg values are boundary address for
...@@ -846,7 +841,7 @@ static void e752x_init_csrows(struct mem_ctl_info *mci, struct pci_dev *pdev, ...@@ -846,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, static void e752x_init_mem_map_table(struct pci_dev *pdev,
struct e752x_pvt *pvt) struct e752x_pvt *pvt)
{ {
int index; int index;
u8 value, last, row, stat8; u8 value, last, row, stat8;
...@@ -861,7 +856,7 @@ static void e752x_init_mem_map_table(struct pci_dev *pdev, ...@@ -861,7 +856,7 @@ static void e752x_init_mem_map_table(struct pci_dev *pdev,
/* no dimm in the slot, so flag it as empty */ /* no dimm in the slot, so flag it as empty */
pvt->map[index] = 0xff; pvt->map[index] = 0xff;
pvt->map[index + 1] = 0xff; pvt->map[index + 1] = 0xff;
} else { /* there is a dimm in the slot */ } else { /* there is a dimm in the slot */
pvt->map[index] = row; pvt->map[index] = row;
row++; row++;
last = value; last = value;
...@@ -870,10 +865,9 @@ static void e752x_init_mem_map_table(struct pci_dev *pdev, ...@@ -870,10 +865,9 @@ static void e752x_init_mem_map_table(struct pci_dev *pdev,
*/ */
pci_read_config_byte(pdev, E752X_DRB + index + 1, pci_read_config_byte(pdev, E752X_DRB + index + 1,
&value); &value);
pvt->map[index + 1] = (value == last) ? pvt->map[index + 1] = (value == last) ? 0xff : /* the dimm is single sided,
0xff : /* the dimm is single sided, so flag as empty */
so flag as empty */ row; /* this is a double sided dimm
row; /* this is a double sided dimm
to save the next row # */ to save the next row # */
row++; row++;
last = value; last = value;
...@@ -887,13 +881,12 @@ static void e752x_init_mem_map_table(struct pci_dev *pdev, ...@@ -887,13 +881,12 @@ static void e752x_init_mem_map_table(struct pci_dev *pdev,
/* Return 0 on success or 1 on failure. */ /* Return 0 on success or 1 on failure. */
static int e752x_get_devs(struct pci_dev *pdev, int dev_idx, static int e752x_get_devs(struct pci_dev *pdev, int dev_idx,
struct e752x_pvt *pvt) struct e752x_pvt *pvt)
{ {
struct pci_dev *dev; struct pci_dev *dev;
pvt->bridge_ck = pci_get_device(PCI_VENDOR_ID_INTEL, pvt->bridge_ck = pci_get_device(PCI_VENDOR_ID_INTEL,
pvt->dev_info->err_dev, pvt->dev_info->err_dev, pvt->bridge_ck);
pvt->bridge_ck);
if (pvt->bridge_ck == NULL) if (pvt->bridge_ck == NULL)
pvt->bridge_ck = pci_scan_single_device(pdev->bus, pvt->bridge_ck = pci_scan_single_device(pdev->bus,
...@@ -901,8 +894,8 @@ static int e752x_get_devs(struct pci_dev *pdev, int dev_idx, ...@@ -901,8 +894,8 @@ static int e752x_get_devs(struct pci_dev *pdev, int dev_idx,
if (pvt->bridge_ck == NULL) { if (pvt->bridge_ck == NULL) {
e752x_printk(KERN_ERR, "error reporting device not found:" e752x_printk(KERN_ERR, "error reporting device not found:"
"vendor %x device 0x%x (broken BIOS?)\n", "vendor %x device 0x%x (broken BIOS?)\n",
PCI_VENDOR_ID_INTEL, e752x_devs[dev_idx].err_dev); PCI_VENDOR_ID_INTEL, e752x_devs[dev_idx].err_dev);
return 1; return 1;
} }
...@@ -917,7 +910,7 @@ static int e752x_get_devs(struct pci_dev *pdev, int dev_idx, ...@@ -917,7 +910,7 @@ static int e752x_get_devs(struct pci_dev *pdev, int dev_idx,
return 0; return 0;
fail: fail:
pci_dev_put(pvt->bridge_ck); pci_dev_put(pvt->bridge_ck);
return 1; return 1;
} }
...@@ -945,20 +938,20 @@ static int e752x_probe1(struct pci_dev *pdev, int dev_idx) ...@@ -945,20 +938,20 @@ static int e752x_probe1(struct pci_dev *pdev, int dev_idx)
struct mem_ctl_info *mci; struct mem_ctl_info *mci;
struct e752x_pvt *pvt; struct e752x_pvt *pvt;
u16 ddrcsr; u16 ddrcsr;
int drc_chan; /* Number of channels 0=1chan,1=2chan */ int drc_chan; /* Number of channels 0=1chan,1=2chan */
struct e752x_error_info discard; struct e752x_error_info discard;
debugf0("%s(): mci\n", __func__); debugf0("%s(): mci\n", __func__);
debugf0("Starting Probe1\n"); debugf0("Starting Probe1\n");
/* make sure error reporting method is sane */ /* make sure error reporting method is sane */
switch(edac_op_state) { switch (edac_op_state) {
case EDAC_OPSTATE_POLL: case EDAC_OPSTATE_POLL:
case EDAC_OPSTATE_NMI: case EDAC_OPSTATE_NMI:
break; break;
default: default:
edac_op_state = EDAC_OPSTATE_POLL; edac_op_state = EDAC_OPSTATE_POLL;
break; break;
} }
/* check to see if device 0 function 1 is enabled; if it isn't, we /* check to see if device 0 function 1 is enabled; if it isn't, we
...@@ -968,7 +961,7 @@ static int e752x_probe1(struct pci_dev *pdev, int dev_idx) ...@@ -968,7 +961,7 @@ static int e752x_probe1(struct pci_dev *pdev, int dev_idx)
pci_read_config_byte(pdev, E752X_DEVPRES1, &stat8); pci_read_config_byte(pdev, E752X_DEVPRES1, &stat8);
if (!force_function_unhide && !(stat8 & (1 << 5))) { if (!force_function_unhide && !(stat8 & (1 << 5))) {
printk(KERN_INFO "Contact your BIOS vendor to see if the " 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; return -ENOMEM;
} }
stat8 |= (1 << 5); stat8 |= (1 << 5);
...@@ -995,7 +988,7 @@ static int e752x_probe1(struct pci_dev *pdev, int dev_idx) ...@@ -995,7 +988,7 @@ static int e752x_probe1(struct pci_dev *pdev, int dev_idx)
mci->dev = &pdev->dev; mci->dev = &pdev->dev;
debugf3("%s(): init pvt\n", __func__); debugf3("%s(): init pvt\n", __func__);
pvt = (struct e752x_pvt *) mci->pvt_info; pvt = (struct e752x_pvt *)mci->pvt_info;
pvt->dev_info = &e752x_devs[dev_idx]; pvt->dev_info = &e752x_devs[dev_idx];
pvt->mc_symmetric = ((ddrcsr & 0x10) != 0); pvt->mc_symmetric = ((ddrcsr & 0x10) != 0);
...@@ -1028,36 +1021,34 @@ static int e752x_probe1(struct pci_dev *pdev, int dev_idx) ...@@ -1028,36 +1021,34 @@ static int e752x_probe1(struct pci_dev *pdev, int dev_idx)
pci_read_config_word(pdev, E752X_REMAPLIMIT, &pci_data); pci_read_config_word(pdev, E752X_REMAPLIMIT, &pci_data);
pvt->remaplimit = ((u32) pci_data) << 14; pvt->remaplimit = ((u32) pci_data) << 14;
e752x_printk(KERN_INFO, e752x_printk(KERN_INFO,
"tolm = %x, remapbase = %x, remaplimit = %x\n", pvt->tolm, "tolm = %x, remapbase = %x, remaplimit = %x\n", pvt->tolm,
pvt->remapbase, pvt->remaplimit); pvt->remapbase, pvt->remaplimit);
/* Here we assume that we will never see multiple instances of this /* Here we assume that we will never see multiple instances of this
* type of memory controller. The ID is therefore hardcoded to 0. * type of memory controller. The ID is therefore hardcoded to 0.
*/ */
if (edac_mc_add_mc(mci,0)) { if (edac_mc_add_mc(mci, 0)) {
debugf3("%s(): failed edac_mc_add_mc()\n", __func__); debugf3("%s(): failed edac_mc_add_mc()\n", __func__);
goto fail; goto fail;
} }
e752x_init_error_reporting_regs(pvt); e752x_init_error_reporting_regs(pvt);
e752x_get_error_info(mci, &discard); /* clear other MCH errors */ e752x_get_error_info(mci, &discard); /* clear other MCH errors */
/* allocating generic PCI control info */ /* allocating generic PCI control info */
e752x_pci = edac_pci_create_generic_ctl(&pdev->dev, EDAC_MOD_STR); e752x_pci = edac_pci_create_generic_ctl(&pdev->dev, EDAC_MOD_STR);
if (!e752x_pci) { if (!e752x_pci) {
printk(KERN_WARNING printk(KERN_WARNING
"%s(): Unable to create PCI control\n", "%s(): Unable to create PCI control\n", __func__);
__func__);
printk(KERN_WARNING printk(KERN_WARNING
"%s(): PCI error report via EDAC not setup\n", "%s(): PCI error report via EDAC not setup\n", __func__);
__func__);
} }
/* get this far and it's successful */ /* get this far and it's successful */
debugf3("%s(): success\n", __func__); debugf3("%s(): success\n", __func__);
return 0; return 0;
fail: fail:
pci_dev_put(pvt->dev_d0f0); pci_dev_put(pvt->dev_d0f0);
pci_dev_put(pvt->dev_d0f1); pci_dev_put(pvt->dev_d0f1);
pci_dev_put(pvt->bridge_ck); pci_dev_put(pvt->bridge_ck);
...@@ -1068,12 +1059,12 @@ static int e752x_probe1(struct pci_dev *pdev, int dev_idx) ...@@ -1068,12 +1059,12 @@ static int e752x_probe1(struct pci_dev *pdev, int dev_idx)
/* returns count (>= 0), or negative on error */ /* returns count (>= 0), or negative on error */
static int __devinit e752x_init_one(struct pci_dev *pdev, 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__); debugf0("%s()\n", __func__);
/* wake up and enable device */ /* wake up and enable device */
if(pci_enable_device(pdev) < 0) if (pci_enable_device(pdev) < 0)
return -EIO; return -EIO;
return e752x_probe1(pdev, ent->driver_data); return e752x_probe1(pdev, ent->driver_data);
...@@ -1092,7 +1083,7 @@ static void __devexit e752x_remove_one(struct pci_dev *pdev) ...@@ -1092,7 +1083,7 @@ static void __devexit e752x_remove_one(struct pci_dev *pdev)
if ((mci = edac_mc_del_mc(&pdev->dev)) == NULL) if ((mci = edac_mc_del_mc(&pdev->dev)) == NULL)
return; return;
pvt = (struct e752x_pvt *) mci->pvt_info; pvt = (struct e752x_pvt *)mci->pvt_info;
pci_dev_put(pvt->dev_d0f0); pci_dev_put(pvt->dev_d0f0);
pci_dev_put(pvt->dev_d0f1); pci_dev_put(pvt->dev_d0f1);
pci_dev_put(pvt->bridge_ck); pci_dev_put(pvt->bridge_ck);
...@@ -1101,20 +1092,17 @@ static void __devexit e752x_remove_one(struct pci_dev *pdev) ...@@ -1101,20 +1092,17 @@ static void __devexit e752x_remove_one(struct pci_dev *pdev)
static const struct pci_device_id e752x_pci_tbl[] __devinitdata = { static const struct pci_device_id e752x_pci_tbl[] __devinitdata = {
{ {
PCI_VEND_DEV(INTEL, 7520_0), PCI_ANY_ID, PCI_ANY_ID, 0, 0, PCI_VEND_DEV(INTEL, 7520_0), PCI_ANY_ID, PCI_ANY_ID, 0, 0,
E7520 E7520},
},
{ {
PCI_VEND_DEV(INTEL, 7525_0), PCI_ANY_ID, PCI_ANY_ID, 0, 0, PCI_VEND_DEV(INTEL, 7525_0), PCI_ANY_ID, PCI_ANY_ID, 0, 0,
E7525 E7525},
},
{ {
PCI_VEND_DEV(INTEL, 7320_0), PCI_ANY_ID, PCI_ANY_ID, 0, 0, PCI_VEND_DEV(INTEL, 7320_0), PCI_ANY_ID, PCI_ANY_ID, 0, 0,
E7320 E7320},
},
{ {
0, 0,
} /* 0 terminated list. */ } /* 0 terminated list. */
}; };
MODULE_DEVICE_TABLE(pci, e752x_pci_tbl); MODULE_DEVICE_TABLE(pci, e752x_pci_tbl);
...@@ -1150,6 +1138,6 @@ MODULE_DESCRIPTION("MC support for Intel e752x memory controllers"); ...@@ -1150,6 +1138,6 @@ MODULE_DESCRIPTION("MC support for Intel e752x memory controllers");
module_param(force_function_unhide, int, 0444); module_param(force_function_unhide, int, 0444);
MODULE_PARM_DESC(force_function_unhide, "if BIOS sets Dev0:Fun1 up as hidden:" MODULE_PARM_DESC(force_function_unhide, "if BIOS sets Dev0:Fun1 up as hidden:"
" 1=force unhide and hope BIOS doesn't fight driver for Dev0:Fun1 access"); " 1=force unhide and hope BIOS doesn't fight driver for Dev0:Fun1 access");
module_param(edac_op_state, int, 0444); module_param(edac_op_state, int, 0444);
MODULE_PARM_DESC(edac_op_state, "EDAC Error Reporting state: 0=Poll,1=NMI"); MODULE_PARM_DESC(edac_op_state, "EDAC Error Reporting state: 0=Poll,1=NMI");
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment