Skip to content

Commit dcd0139

Browse files
yghannamsuryasaimadhu
authored andcommitted
EDAC/amd64: Drop some family checks for newer systems
In general, "pvt->umc != NULL" is used to check if the system is Family 17h+. However, there are a few places that are using direct family checks. Replace the remaining family checks with a check for "pvt->umc != NULL". Signed-off-by: Yazen Ghannam <[email protected]> Signed-off-by: Borislav Petkov <[email protected]> Link: https://lkml.kernel.org/r/[email protected]
1 parent 2eb61c9 commit dcd0139

File tree

1 file changed

+19
-26
lines changed

1 file changed

+19
-26
lines changed

drivers/edac/amd64_edac.c

Lines changed: 19 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ static int __set_scrub_rate(struct amd64_pvt *pvt, u32 new_bw, u32 min_rate)
214214

215215
scrubval = scrubrates[i].scrubval;
216216

217-
if (pvt->fam == 0x17 || pvt->fam == 0x18) {
217+
if (pvt->umc) {
218218
__f17h_set_scrubval(pvt, scrubval);
219219
} else if (pvt->fam == 0x15 && pvt->model == 0x60) {
220220
f15h_select_dct(pvt, 0);
@@ -256,18 +256,7 @@ static int get_scrub_rate(struct mem_ctl_info *mci)
256256
int i, retval = -EINVAL;
257257
u32 scrubval = 0;
258258

259-
switch (pvt->fam) {
260-
case 0x15:
261-
/* Erratum #505 */
262-
if (pvt->model < 0x10)
263-
f15h_select_dct(pvt, 0);
264-
265-
if (pvt->model == 0x60)
266-
amd64_read_pci_cfg(pvt->F2, F15H_M60H_SCRCTRL, &scrubval);
267-
break;
268-
269-
case 0x17:
270-
case 0x18:
259+
if (pvt->umc) {
271260
amd64_read_pci_cfg(pvt->F6, F17H_SCR_BASE_ADDR, &scrubval);
272261
if (scrubval & BIT(0)) {
273262
amd64_read_pci_cfg(pvt->F6, F17H_SCR_LIMIT_ADDR, &scrubval);
@@ -276,11 +265,15 @@ static int get_scrub_rate(struct mem_ctl_info *mci)
276265
} else {
277266
scrubval = 0;
278267
}
279-
break;
268+
} else if (pvt->fam == 0x15) {
269+
/* Erratum #505 */
270+
if (pvt->model < 0x10)
271+
f15h_select_dct(pvt, 0);
280272

281-
default:
273+
if (pvt->model == 0x60)
274+
amd64_read_pci_cfg(pvt->F2, F15H_M60H_SCRCTRL, &scrubval);
275+
} else {
282276
amd64_read_pci_cfg(pvt->F3, SCRCTRL, &scrubval);
283-
break;
284277
}
285278

286279
scrubval = scrubval & 0x001F;
@@ -1055,6 +1048,16 @@ static void determine_memory_type(struct amd64_pvt *pvt)
10551048
{
10561049
u32 dram_ctrl, dcsm;
10571050

1051+
if (pvt->umc) {
1052+
if ((pvt->umc[0].dimm_cfg | pvt->umc[1].dimm_cfg) & BIT(5))
1053+
pvt->dram_type = MEM_LRDDR4;
1054+
else if ((pvt->umc[0].dimm_cfg | pvt->umc[1].dimm_cfg) & BIT(4))
1055+
pvt->dram_type = MEM_RDDR4;
1056+
else
1057+
pvt->dram_type = MEM_DDR4;
1058+
return;
1059+
}
1060+
10581061
switch (pvt->fam) {
10591062
case 0xf:
10601063
if (pvt->ext_model >= K8_REV_F)
@@ -1100,16 +1103,6 @@ static void determine_memory_type(struct amd64_pvt *pvt)
11001103
case 0x16:
11011104
goto ddr3;
11021105

1103-
case 0x17:
1104-
case 0x18:
1105-
if ((pvt->umc[0].dimm_cfg | pvt->umc[1].dimm_cfg) & BIT(5))
1106-
pvt->dram_type = MEM_LRDDR4;
1107-
else if ((pvt->umc[0].dimm_cfg | pvt->umc[1].dimm_cfg) & BIT(4))
1108-
pvt->dram_type = MEM_RDDR4;
1109-
else
1110-
pvt->dram_type = MEM_DDR4;
1111-
return;
1112-
11131106
default:
11141107
WARN(1, KERN_ERR "%s: Family??? 0x%x\n", __func__, pvt->fam);
11151108
pvt->dram_type = MEM_EMPTY;

0 commit comments

Comments
 (0)