aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBorislav Petkov <borislav.petkov@amd.com>2009-07-23 08:45:48 -0400
committerBorislav Petkov <borislav.petkov@amd.com>2009-09-14 12:58:18 -0400
commitef44cc4c2245d3c43f3c11c7bff6239852eef498 (patch)
treecac7e3a36daa98fecc38cd66033ee3e279874cdb
parent1c43f2e24d059913bce58887f1d6e4267aaed284 (diff)
amd64_edac: cleanup amd64_process_error_info
* mv amd64_error_info_regs -> err_regs * remove redundant info ptr Signed-off-by: Borislav Petkov <borislav.petkov@amd.com>
-rw-r--r--drivers/edac/amd64_edac.c44
-rw-r--r--drivers/edac/amd64_edac.h10
2 files changed, 25 insertions, 29 deletions
diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c
index b9e84bc91766..c9b88d829701 100644
--- a/drivers/edac/amd64_edac.c
+++ b/drivers/edac/amd64_edac.c
@@ -750,7 +750,7 @@ static void find_csrow_limits(struct mem_ctl_info *mci, int csrow,
750 * specific. 750 * specific.
751 */ 751 */
752static u64 extract_error_address(struct mem_ctl_info *mci, 752static u64 extract_error_address(struct mem_ctl_info *mci,
753 struct amd64_error_info_regs *info) 753 struct err_regs *info)
754{ 754{
755 struct amd64_pvt *pvt = mci->pvt_info; 755 struct amd64_pvt *pvt = mci->pvt_info;
756 756
@@ -1106,7 +1106,7 @@ static int k8_early_channel_count(struct amd64_pvt *pvt)
1106 1106
1107/* extract the ERROR ADDRESS for the K8 CPUs */ 1107/* extract the ERROR ADDRESS for the K8 CPUs */
1108static u64 k8_get_error_address(struct mem_ctl_info *mci, 1108static u64 k8_get_error_address(struct mem_ctl_info *mci,
1109 struct amd64_error_info_regs *info) 1109 struct err_regs *info)
1110{ 1110{
1111 return (((u64) (info->nbeah & 0xff)) << 32) + 1111 return (((u64) (info->nbeah & 0xff)) << 32) +
1112 (info->nbeal & ~0x03); 1112 (info->nbeal & ~0x03);
@@ -1149,7 +1149,7 @@ static void k8_read_dram_base_limit(struct amd64_pvt *pvt, int dram)
1149} 1149}
1150 1150
1151static void k8_map_sysaddr_to_csrow(struct mem_ctl_info *mci, 1151static void k8_map_sysaddr_to_csrow(struct mem_ctl_info *mci,
1152 struct amd64_error_info_regs *info, 1152 struct err_regs *info,
1153 u64 SystemAddress) 1153 u64 SystemAddress)
1154{ 1154{
1155 struct mem_ctl_info *src_mci; 1155 struct mem_ctl_info *src_mci;
@@ -1368,7 +1368,7 @@ static void amd64_teardown(struct amd64_pvt *pvt)
1368} 1368}
1369 1369
1370static u64 f10_get_error_address(struct mem_ctl_info *mci, 1370static u64 f10_get_error_address(struct mem_ctl_info *mci,
1371 struct amd64_error_info_regs *info) 1371 struct err_regs *info)
1372{ 1372{
1373 return (((u64) (info->nbeah & 0xffff)) << 32) + 1373 return (((u64) (info->nbeah & 0xffff)) << 32) +
1374 (info->nbeal & ~0x01); 1374 (info->nbeal & ~0x01);
@@ -1745,7 +1745,7 @@ static int f10_translate_sysaddr_to_cs(struct amd64_pvt *pvt, u64 sys_addr,
1745 * The @sys_addr is usually an error address received from the hardware. 1745 * The @sys_addr is usually an error address received from the hardware.
1746 */ 1746 */
1747static void f10_map_sysaddr_to_csrow(struct mem_ctl_info *mci, 1747static void f10_map_sysaddr_to_csrow(struct mem_ctl_info *mci,
1748 struct amd64_error_info_regs *info, 1748 struct err_regs *info,
1749 u64 sys_addr) 1749 u64 sys_addr)
1750{ 1750{
1751 struct amd64_pvt *pvt = mci->pvt_info; 1751 struct amd64_pvt *pvt = mci->pvt_info;
@@ -2102,7 +2102,7 @@ static int get_channel_from_ecc_syndrome(unsigned short syndrome)
2102 * - 0: if no valid error is indicated 2102 * - 0: if no valid error is indicated
2103 */ 2103 */
2104static int amd64_get_error_info_regs(struct mem_ctl_info *mci, 2104static int amd64_get_error_info_regs(struct mem_ctl_info *mci,
2105 struct amd64_error_info_regs *regs) 2105 struct err_regs *regs)
2106{ 2106{
2107 struct amd64_pvt *pvt; 2107 struct amd64_pvt *pvt;
2108 struct pci_dev *misc_f3_ctl; 2108 struct pci_dev *misc_f3_ctl;
@@ -2151,10 +2151,10 @@ err_reg:
2151 * - 0: if no error is found 2151 * - 0: if no error is found
2152 */ 2152 */
2153static int amd64_get_error_info(struct mem_ctl_info *mci, 2153static int amd64_get_error_info(struct mem_ctl_info *mci,
2154 struct amd64_error_info_regs *info) 2154 struct err_regs *info)
2155{ 2155{
2156 struct amd64_pvt *pvt; 2156 struct amd64_pvt *pvt;
2157 struct amd64_error_info_regs regs; 2157 struct err_regs regs;
2158 2158
2159 pvt = mci->pvt_info; 2159 pvt = mci->pvt_info;
2160 2160
@@ -2210,7 +2210,7 @@ static int amd64_get_error_info(struct mem_ctl_info *mci,
2210} 2210}
2211 2211
2212static inline void amd64_decode_gart_tlb_error(struct mem_ctl_info *mci, 2212static inline void amd64_decode_gart_tlb_error(struct mem_ctl_info *mci,
2213 struct amd64_error_info_regs *info) 2213 struct err_regs *info)
2214{ 2214{
2215 u32 ec = ERROR_CODE(info->nbsl); 2215 u32 ec = ERROR_CODE(info->nbsl);
2216 2216
@@ -2220,7 +2220,7 @@ static inline void amd64_decode_gart_tlb_error(struct mem_ctl_info *mci,
2220} 2220}
2221 2221
2222static inline void amd64_decode_mem_cache_error(struct mem_ctl_info *mci, 2222static inline void amd64_decode_mem_cache_error(struct mem_ctl_info *mci,
2223 struct amd64_error_info_regs *info) 2223 struct err_regs *info)
2224{ 2224{
2225 u32 ec = ERROR_CODE(info->nbsl); 2225 u32 ec = ERROR_CODE(info->nbsl);
2226 2226
@@ -2236,7 +2236,7 @@ static inline void amd64_decode_mem_cache_error(struct mem_ctl_info *mci,
2236 * ADDRESS and process. 2236 * ADDRESS and process.
2237 */ 2237 */
2238static void amd64_handle_ce(struct mem_ctl_info *mci, 2238static void amd64_handle_ce(struct mem_ctl_info *mci,
2239 struct amd64_error_info_regs *info) 2239 struct err_regs *info)
2240{ 2240{
2241 struct amd64_pvt *pvt = mci->pvt_info; 2241 struct amd64_pvt *pvt = mci->pvt_info;
2242 u64 SystemAddress; 2242 u64 SystemAddress;
@@ -2259,7 +2259,7 @@ static void amd64_handle_ce(struct mem_ctl_info *mci,
2259 2259
2260/* Handle any Un-correctable Errors (UEs) */ 2260/* Handle any Un-correctable Errors (UEs) */
2261static void amd64_handle_ue(struct mem_ctl_info *mci, 2261static void amd64_handle_ue(struct mem_ctl_info *mci,
2262 struct amd64_error_info_regs *info) 2262 struct err_regs *info)
2263{ 2263{
2264 int csrow; 2264 int csrow;
2265 u64 SystemAddress; 2265 u64 SystemAddress;
@@ -2305,7 +2305,7 @@ static void amd64_handle_ue(struct mem_ctl_info *mci,
2305} 2305}
2306 2306
2307static void amd64_decode_bus_error(struct mem_ctl_info *mci, 2307static void amd64_decode_bus_error(struct mem_ctl_info *mci,
2308 struct amd64_error_info_regs *info) 2308 struct err_regs *info)
2309{ 2309{
2310 u32 ec = ERROR_CODE(info->nbsl); 2310 u32 ec = ERROR_CODE(info->nbsl);
2311 u32 xec = EXT_ERROR_CODE(info->nbsl); 2311 u32 xec = EXT_ERROR_CODE(info->nbsl);
@@ -2356,22 +2356,18 @@ static void amd64_decode_bus_error(struct mem_ctl_info *mci,
2356} 2356}
2357 2357
2358int amd64_process_error_info(struct mem_ctl_info *mci, 2358int amd64_process_error_info(struct mem_ctl_info *mci,
2359 struct amd64_error_info_regs *info, 2359 struct err_regs *regs,
2360 int handle_errors) 2360 int handle_errors)
2361{ 2361{
2362 struct amd64_pvt *pvt; 2362 struct amd64_pvt *pvt;
2363 struct amd64_error_info_regs *regs;
2364 u32 err_code, ext_ec; 2363 u32 err_code, ext_ec;
2365 int gart_tlb_error = 0; 2364 int gart_tlb_error = 0;
2366 2365
2367 pvt = mci->pvt_info; 2366 pvt = mci->pvt_info;
2368 2367
2369 /* If caller doesn't want us to process the error, return */
2370 if (!handle_errors) 2368 if (!handle_errors)
2371 return 1; 2369 return 1;
2372 2370
2373 regs = info;
2374
2375 debugf1("NorthBridge ERROR: mci(0x%p)\n", mci); 2371 debugf1("NorthBridge ERROR: mci(0x%p)\n", mci);
2376 debugf1(" MC node(%d) Error-Address(0x%.8x-%.8x)\n", 2372 debugf1(" MC node(%d) Error-Address(0x%.8x-%.8x)\n",
2377 pvt->mc_node_id, regs->nbeah, regs->nbeal); 2373 pvt->mc_node_id, regs->nbeah, regs->nbeal);
@@ -2437,13 +2433,13 @@ int amd64_process_error_info(struct mem_ctl_info *mci,
2437 gart_tlb_error = 1; 2433 gart_tlb_error = 1;
2438 2434
2439 debugf1("GART TLB error\n"); 2435 debugf1("GART TLB error\n");
2440 amd64_decode_gart_tlb_error(mci, info); 2436 amd64_decode_gart_tlb_error(mci, regs);
2441 } else if (MEM_ERROR(err_code)) { 2437 } else if (MEM_ERROR(err_code)) {
2442 debugf1("Memory/Cache error\n"); 2438 debugf1("Memory/Cache error\n");
2443 amd64_decode_mem_cache_error(mci, info); 2439 amd64_decode_mem_cache_error(mci, regs);
2444 } else if (BUS_ERROR(err_code)) { 2440 } else if (BUS_ERROR(err_code)) {
2445 debugf1("Bus (Link/DRAM) error\n"); 2441 debugf1("Bus (Link/DRAM) error\n");
2446 amd64_decode_bus_error(mci, info); 2442 amd64_decode_bus_error(mci, regs);
2447 } else { 2443 } else {
2448 /* shouldn't reach here! */ 2444 /* shouldn't reach here! */
2449 amd64_mc_printk(mci, KERN_WARNING, 2445 amd64_mc_printk(mci, KERN_WARNING,
@@ -2480,10 +2476,10 @@ EXPORT_SYMBOL_GPL(amd64_process_error_info);
2480 */ 2476 */
2481static void amd64_check(struct mem_ctl_info *mci) 2477static void amd64_check(struct mem_ctl_info *mci)
2482{ 2478{
2483 struct amd64_error_info_regs info; 2479 struct err_regs regs;
2484 2480
2485 if (amd64_get_error_info(mci, &info)) 2481 if (amd64_get_error_info(mci, &regs))
2486 amd64_process_error_info(mci, &info, 1); 2482 amd64_process_error_info(mci, &regs, 1);
2487} 2483}
2488 2484
2489/* 2485/*
diff --git a/drivers/edac/amd64_edac.h b/drivers/edac/amd64_edac.h
index 1ddef8d15d52..bde8f78551f9 100644
--- a/drivers/edac/amd64_edac.h
+++ b/drivers/edac/amd64_edac.h
@@ -449,7 +449,7 @@ enum amd64_chipset_families {
449 * 449 *
450 * Depends on entry into the modules 450 * Depends on entry into the modules
451 */ 451 */
452struct amd64_error_info_regs { 452struct err_regs {
453 u32 nbcfg; 453 u32 nbcfg;
454 u32 nbsh; 454 u32 nbsh;
455 u32 nbsl; 455 u32 nbsl;
@@ -527,7 +527,7 @@ struct amd64_pvt {
527 u32 online_spare; /* On-Line spare Reg */ 527 u32 online_spare; /* On-Line spare Reg */
528 528
529 /* temp storage for when input is received from sysfs */ 529 /* temp storage for when input is received from sysfs */
530 struct amd64_error_info_regs ctl_error_info; 530 struct err_regs ctl_error_info;
531 531
532 /* place to store error injection parameters prior to issue */ 532 /* place to store error injection parameters prior to issue */
533 struct error_injection injection; 533 struct error_injection injection;
@@ -586,11 +586,11 @@ struct low_ops {
586 int (*early_channel_count)(struct amd64_pvt *pvt); 586 int (*early_channel_count)(struct amd64_pvt *pvt);
587 587
588 u64 (*get_error_address)(struct mem_ctl_info *mci, 588 u64 (*get_error_address)(struct mem_ctl_info *mci,
589 struct amd64_error_info_regs *info); 589 struct err_regs *info);
590 void (*read_dram_base_limit)(struct amd64_pvt *pvt, int dram); 590 void (*read_dram_base_limit)(struct amd64_pvt *pvt, int dram);
591 void (*read_dram_ctl_register)(struct amd64_pvt *pvt); 591 void (*read_dram_ctl_register)(struct amd64_pvt *pvt);
592 void (*map_sysaddr_to_csrow)(struct mem_ctl_info *mci, 592 void (*map_sysaddr_to_csrow)(struct mem_ctl_info *mci,
593 struct amd64_error_info_regs *info, 593 struct err_regs *info,
594 u64 SystemAddr); 594 u64 SystemAddr);
595 int (*dbam_map_to_pages)(struct amd64_pvt *pvt, int dram_map); 595 int (*dbam_map_to_pages)(struct amd64_pvt *pvt, int dram_map);
596}; 596};
@@ -623,7 +623,7 @@ static inline struct low_ops *family_ops(int index)
623#define F11_MIN_SCRUB_RATE_BITS 0x6 623#define F11_MIN_SCRUB_RATE_BITS 0x6
624 624
625int amd64_process_error_info(struct mem_ctl_info *mci, 625int amd64_process_error_info(struct mem_ctl_info *mci,
626 struct amd64_error_info_regs *info, 626 struct err_regs *info,
627 int handle_errors); 627 int handle_errors);
628int amd64_get_dram_hole_info(struct mem_ctl_info *mci, u64 *hole_base, 628int amd64_get_dram_hole_info(struct mem_ctl_info *mci, u64 *hole_base,
629 u64 *hole_offset, u64 *hole_size); 629 u64 *hole_offset, u64 *hole_size);