Commit 8edc5445 authored by Borislav Petkov's avatar Borislav Petkov

amd64_edac: fix K8 intlv_sel check

The check when DRAM interleaving is enabled should be done against the
pvt->dram_IntlvSel field and not against the ->dram_limit.

Simplify first loop and fixup printk formatting while at it.
Signed-off-by: default avatarBorislav Petkov <borislav.petkov@amd.com>
parent 72f158fe
...@@ -279,14 +279,11 @@ static struct mem_ctl_info *find_mc_by_sys_addr(struct mem_ctl_info *mci, ...@@ -279,14 +279,11 @@ static struct mem_ctl_info *find_mc_by_sys_addr(struct mem_ctl_info *mci,
intlv_en = pvt->dram_IntlvEn[0]; intlv_en = pvt->dram_IntlvEn[0];
if (intlv_en == 0) { if (intlv_en == 0) {
for (node_id = 0; ; ) { for (node_id = 0; node_id < DRAM_REG_COUNT; node_id++) {
if (amd64_base_limit_match(pvt, sys_addr, node_id)) if (amd64_base_limit_match(pvt, sys_addr, node_id))
break; goto found;
if (++node_id >= DRAM_REG_COUNT)
goto err_no_match;
} }
goto found; goto err_no_match;
} }
if (unlikely((intlv_en != 0x01) && if (unlikely((intlv_en != 0x01) &&
...@@ -301,7 +298,7 @@ static struct mem_ctl_info *find_mc_by_sys_addr(struct mem_ctl_info *mci, ...@@ -301,7 +298,7 @@ static struct mem_ctl_info *find_mc_by_sys_addr(struct mem_ctl_info *mci,
bits = (((u32) sys_addr) >> 12) & intlv_en; bits = (((u32) sys_addr) >> 12) & intlv_en;
for (node_id = 0; ; ) { for (node_id = 0; ; ) {
if ((pvt->dram_limit[node_id] & intlv_en) == bits) if ((pvt->dram_IntlvSel[node_id] & intlv_en) == bits)
break; /* intlv_sel field matches */ break; /* intlv_sel field matches */
if (++node_id >= DRAM_REG_COUNT) if (++node_id >= DRAM_REG_COUNT)
...@@ -311,10 +308,10 @@ static struct mem_ctl_info *find_mc_by_sys_addr(struct mem_ctl_info *mci, ...@@ -311,10 +308,10 @@ static struct mem_ctl_info *find_mc_by_sys_addr(struct mem_ctl_info *mci,
/* sanity test for sys_addr */ /* sanity test for sys_addr */
if (unlikely(!amd64_base_limit_match(pvt, sys_addr, node_id))) { if (unlikely(!amd64_base_limit_match(pvt, sys_addr, node_id))) {
amd64_printk(KERN_WARNING, amd64_printk(KERN_WARNING,
"%s(): sys_addr 0x%lx falls outside base/limit " "%s(): sys_addr 0x%llx falls outside base/limit "
"address range for node %d with node interleaving " "address range for node %d with node interleaving "
"enabled.\n", __func__, (unsigned long)sys_addr, "enabled.\n",
node_id); __func__, sys_addr, node_id);
return NULL; return NULL;
} }
......
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