Commit ef44cc4c authored by Borislav Petkov's avatar Borislav Petkov

amd64_edac: cleanup amd64_process_error_info

* mv amd64_error_info_regs -> err_regs

* remove redundant info ptr
Signed-off-by: default avatarBorislav Petkov <borislav.petkov@amd.com>
parent 1c43f2e2
...@@ -750,7 +750,7 @@ static void find_csrow_limits(struct mem_ctl_info *mci, int csrow, ...@@ -750,7 +750,7 @@ static void find_csrow_limits(struct mem_ctl_info *mci, int csrow,
* specific. * specific.
*/ */
static u64 extract_error_address(struct mem_ctl_info *mci, static u64 extract_error_address(struct mem_ctl_info *mci,
struct amd64_error_info_regs *info) struct err_regs *info)
{ {
struct amd64_pvt *pvt = mci->pvt_info; struct amd64_pvt *pvt = mci->pvt_info;
...@@ -1106,7 +1106,7 @@ static int k8_early_channel_count(struct amd64_pvt *pvt) ...@@ -1106,7 +1106,7 @@ static int k8_early_channel_count(struct amd64_pvt *pvt)
/* extract the ERROR ADDRESS for the K8 CPUs */ /* extract the ERROR ADDRESS for the K8 CPUs */
static u64 k8_get_error_address(struct mem_ctl_info *mci, static u64 k8_get_error_address(struct mem_ctl_info *mci,
struct amd64_error_info_regs *info) struct err_regs *info)
{ {
return (((u64) (info->nbeah & 0xff)) << 32) + return (((u64) (info->nbeah & 0xff)) << 32) +
(info->nbeal & ~0x03); (info->nbeal & ~0x03);
...@@ -1149,7 +1149,7 @@ static void k8_read_dram_base_limit(struct amd64_pvt *pvt, int dram) ...@@ -1149,7 +1149,7 @@ static void k8_read_dram_base_limit(struct amd64_pvt *pvt, int dram)
} }
static void k8_map_sysaddr_to_csrow(struct mem_ctl_info *mci, static void k8_map_sysaddr_to_csrow(struct mem_ctl_info *mci,
struct amd64_error_info_regs *info, struct err_regs *info,
u64 SystemAddress) u64 SystemAddress)
{ {
struct mem_ctl_info *src_mci; struct mem_ctl_info *src_mci;
...@@ -1368,7 +1368,7 @@ static void amd64_teardown(struct amd64_pvt *pvt) ...@@ -1368,7 +1368,7 @@ static void amd64_teardown(struct amd64_pvt *pvt)
} }
static u64 f10_get_error_address(struct mem_ctl_info *mci, static u64 f10_get_error_address(struct mem_ctl_info *mci,
struct amd64_error_info_regs *info) struct err_regs *info)
{ {
return (((u64) (info->nbeah & 0xffff)) << 32) + return (((u64) (info->nbeah & 0xffff)) << 32) +
(info->nbeal & ~0x01); (info->nbeal & ~0x01);
...@@ -1745,7 +1745,7 @@ static int f10_translate_sysaddr_to_cs(struct amd64_pvt *pvt, u64 sys_addr, ...@@ -1745,7 +1745,7 @@ static int f10_translate_sysaddr_to_cs(struct amd64_pvt *pvt, u64 sys_addr,
* The @sys_addr is usually an error address received from the hardware. * The @sys_addr is usually an error address received from the hardware.
*/ */
static void f10_map_sysaddr_to_csrow(struct mem_ctl_info *mci, static void f10_map_sysaddr_to_csrow(struct mem_ctl_info *mci,
struct amd64_error_info_regs *info, struct err_regs *info,
u64 sys_addr) u64 sys_addr)
{ {
struct amd64_pvt *pvt = mci->pvt_info; struct amd64_pvt *pvt = mci->pvt_info;
...@@ -2102,7 +2102,7 @@ static int get_channel_from_ecc_syndrome(unsigned short syndrome) ...@@ -2102,7 +2102,7 @@ static int get_channel_from_ecc_syndrome(unsigned short syndrome)
* - 0: if no valid error is indicated * - 0: if no valid error is indicated
*/ */
static int amd64_get_error_info_regs(struct mem_ctl_info *mci, static int amd64_get_error_info_regs(struct mem_ctl_info *mci,
struct amd64_error_info_regs *regs) struct err_regs *regs)
{ {
struct amd64_pvt *pvt; struct amd64_pvt *pvt;
struct pci_dev *misc_f3_ctl; struct pci_dev *misc_f3_ctl;
...@@ -2151,10 +2151,10 @@ static int amd64_get_error_info_regs(struct mem_ctl_info *mci, ...@@ -2151,10 +2151,10 @@ static int amd64_get_error_info_regs(struct mem_ctl_info *mci,
* - 0: if no error is found * - 0: if no error is found
*/ */
static int amd64_get_error_info(struct mem_ctl_info *mci, static int amd64_get_error_info(struct mem_ctl_info *mci,
struct amd64_error_info_regs *info) struct err_regs *info)
{ {
struct amd64_pvt *pvt; struct amd64_pvt *pvt;
struct amd64_error_info_regs regs; struct err_regs regs;
pvt = mci->pvt_info; pvt = mci->pvt_info;
...@@ -2210,7 +2210,7 @@ static int amd64_get_error_info(struct mem_ctl_info *mci, ...@@ -2210,7 +2210,7 @@ static int amd64_get_error_info(struct mem_ctl_info *mci,
} }
static inline void amd64_decode_gart_tlb_error(struct mem_ctl_info *mci, static inline void amd64_decode_gart_tlb_error(struct mem_ctl_info *mci,
struct amd64_error_info_regs *info) struct err_regs *info)
{ {
u32 ec = ERROR_CODE(info->nbsl); u32 ec = ERROR_CODE(info->nbsl);
...@@ -2220,7 +2220,7 @@ static inline void amd64_decode_gart_tlb_error(struct mem_ctl_info *mci, ...@@ -2220,7 +2220,7 @@ static inline void amd64_decode_gart_tlb_error(struct mem_ctl_info *mci,
} }
static inline void amd64_decode_mem_cache_error(struct mem_ctl_info *mci, static inline void amd64_decode_mem_cache_error(struct mem_ctl_info *mci,
struct amd64_error_info_regs *info) struct err_regs *info)
{ {
u32 ec = ERROR_CODE(info->nbsl); u32 ec = ERROR_CODE(info->nbsl);
...@@ -2236,7 +2236,7 @@ static inline void amd64_decode_mem_cache_error(struct mem_ctl_info *mci, ...@@ -2236,7 +2236,7 @@ static inline void amd64_decode_mem_cache_error(struct mem_ctl_info *mci,
* ADDRESS and process. * ADDRESS and process.
*/ */
static void amd64_handle_ce(struct mem_ctl_info *mci, static void amd64_handle_ce(struct mem_ctl_info *mci,
struct amd64_error_info_regs *info) struct err_regs *info)
{ {
struct amd64_pvt *pvt = mci->pvt_info; struct amd64_pvt *pvt = mci->pvt_info;
u64 SystemAddress; u64 SystemAddress;
...@@ -2259,7 +2259,7 @@ static void amd64_handle_ce(struct mem_ctl_info *mci, ...@@ -2259,7 +2259,7 @@ static void amd64_handle_ce(struct mem_ctl_info *mci,
/* Handle any Un-correctable Errors (UEs) */ /* Handle any Un-correctable Errors (UEs) */
static void amd64_handle_ue(struct mem_ctl_info *mci, static void amd64_handle_ue(struct mem_ctl_info *mci,
struct amd64_error_info_regs *info) struct err_regs *info)
{ {
int csrow; int csrow;
u64 SystemAddress; u64 SystemAddress;
...@@ -2305,7 +2305,7 @@ static void amd64_handle_ue(struct mem_ctl_info *mci, ...@@ -2305,7 +2305,7 @@ static void amd64_handle_ue(struct mem_ctl_info *mci,
} }
static void amd64_decode_bus_error(struct mem_ctl_info *mci, static void amd64_decode_bus_error(struct mem_ctl_info *mci,
struct amd64_error_info_regs *info) struct err_regs *info)
{ {
u32 ec = ERROR_CODE(info->nbsl); u32 ec = ERROR_CODE(info->nbsl);
u32 xec = EXT_ERROR_CODE(info->nbsl); u32 xec = EXT_ERROR_CODE(info->nbsl);
...@@ -2356,22 +2356,18 @@ static void amd64_decode_bus_error(struct mem_ctl_info *mci, ...@@ -2356,22 +2356,18 @@ static void amd64_decode_bus_error(struct mem_ctl_info *mci,
} }
int amd64_process_error_info(struct mem_ctl_info *mci, int amd64_process_error_info(struct mem_ctl_info *mci,
struct amd64_error_info_regs *info, struct err_regs *regs,
int handle_errors) int handle_errors)
{ {
struct amd64_pvt *pvt; struct amd64_pvt *pvt;
struct amd64_error_info_regs *regs;
u32 err_code, ext_ec; u32 err_code, ext_ec;
int gart_tlb_error = 0; int gart_tlb_error = 0;
pvt = mci->pvt_info; pvt = mci->pvt_info;
/* If caller doesn't want us to process the error, return */
if (!handle_errors) if (!handle_errors)
return 1; return 1;
regs = info;
debugf1("NorthBridge ERROR: mci(0x%p)\n", mci); debugf1("NorthBridge ERROR: mci(0x%p)\n", mci);
debugf1(" MC node(%d) Error-Address(0x%.8x-%.8x)\n", debugf1(" MC node(%d) Error-Address(0x%.8x-%.8x)\n",
pvt->mc_node_id, regs->nbeah, regs->nbeal); pvt->mc_node_id, regs->nbeah, regs->nbeal);
...@@ -2437,13 +2433,13 @@ int amd64_process_error_info(struct mem_ctl_info *mci, ...@@ -2437,13 +2433,13 @@ int amd64_process_error_info(struct mem_ctl_info *mci,
gart_tlb_error = 1; gart_tlb_error = 1;
debugf1("GART TLB error\n"); debugf1("GART TLB error\n");
amd64_decode_gart_tlb_error(mci, info); amd64_decode_gart_tlb_error(mci, regs);
} else if (MEM_ERROR(err_code)) { } else if (MEM_ERROR(err_code)) {
debugf1("Memory/Cache error\n"); debugf1("Memory/Cache error\n");
amd64_decode_mem_cache_error(mci, info); amd64_decode_mem_cache_error(mci, regs);
} else if (BUS_ERROR(err_code)) { } else if (BUS_ERROR(err_code)) {
debugf1("Bus (Link/DRAM) error\n"); debugf1("Bus (Link/DRAM) error\n");
amd64_decode_bus_error(mci, info); amd64_decode_bus_error(mci, regs);
} else { } else {
/* shouldn't reach here! */ /* shouldn't reach here! */
amd64_mc_printk(mci, KERN_WARNING, amd64_mc_printk(mci, KERN_WARNING,
...@@ -2480,10 +2476,10 @@ EXPORT_SYMBOL_GPL(amd64_process_error_info); ...@@ -2480,10 +2476,10 @@ EXPORT_SYMBOL_GPL(amd64_process_error_info);
*/ */
static void amd64_check(struct mem_ctl_info *mci) static void amd64_check(struct mem_ctl_info *mci)
{ {
struct amd64_error_info_regs info; struct err_regs regs;
if (amd64_get_error_info(mci, &info)) if (amd64_get_error_info(mci, &regs))
amd64_process_error_info(mci, &info, 1); amd64_process_error_info(mci, &regs, 1);
} }
/* /*
......
...@@ -449,7 +449,7 @@ enum amd64_chipset_families { ...@@ -449,7 +449,7 @@ enum amd64_chipset_families {
* *
* Depends on entry into the modules * Depends on entry into the modules
*/ */
struct amd64_error_info_regs { struct err_regs {
u32 nbcfg; u32 nbcfg;
u32 nbsh; u32 nbsh;
u32 nbsl; u32 nbsl;
...@@ -527,7 +527,7 @@ struct amd64_pvt { ...@@ -527,7 +527,7 @@ struct amd64_pvt {
u32 online_spare; /* On-Line spare Reg */ u32 online_spare; /* On-Line spare Reg */
/* temp storage for when input is received from sysfs */ /* temp storage for when input is received from sysfs */
struct amd64_error_info_regs ctl_error_info; struct err_regs ctl_error_info;
/* place to store error injection parameters prior to issue */ /* place to store error injection parameters prior to issue */
struct error_injection injection; struct error_injection injection;
...@@ -586,11 +586,11 @@ struct low_ops { ...@@ -586,11 +586,11 @@ struct low_ops {
int (*early_channel_count)(struct amd64_pvt *pvt); int (*early_channel_count)(struct amd64_pvt *pvt);
u64 (*get_error_address)(struct mem_ctl_info *mci, u64 (*get_error_address)(struct mem_ctl_info *mci,
struct amd64_error_info_regs *info); struct err_regs *info);
void (*read_dram_base_limit)(struct amd64_pvt *pvt, int dram); void (*read_dram_base_limit)(struct amd64_pvt *pvt, int dram);
void (*read_dram_ctl_register)(struct amd64_pvt *pvt); void (*read_dram_ctl_register)(struct amd64_pvt *pvt);
void (*map_sysaddr_to_csrow)(struct mem_ctl_info *mci, void (*map_sysaddr_to_csrow)(struct mem_ctl_info *mci,
struct amd64_error_info_regs *info, struct err_regs *info,
u64 SystemAddr); u64 SystemAddr);
int (*dbam_map_to_pages)(struct amd64_pvt *pvt, int dram_map); int (*dbam_map_to_pages)(struct amd64_pvt *pvt, int dram_map);
}; };
...@@ -623,7 +623,7 @@ static inline struct low_ops *family_ops(int index) ...@@ -623,7 +623,7 @@ static inline struct low_ops *family_ops(int index)
#define F11_MIN_SCRUB_RATE_BITS 0x6 #define F11_MIN_SCRUB_RATE_BITS 0x6
int amd64_process_error_info(struct mem_ctl_info *mci, int amd64_process_error_info(struct mem_ctl_info *mci,
struct amd64_error_info_regs *info, struct err_regs *info,
int handle_errors); int handle_errors);
int amd64_get_dram_hole_info(struct mem_ctl_info *mci, u64 *hole_base, int amd64_get_dram_hole_info(struct mem_ctl_info *mci, u64 *hole_base,
u64 *hole_offset, u64 *hole_size); u64 *hole_offset, u64 *hole_size);
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