@@ -1347,6 +1347,13 @@ static void debug_dump_dramcfg_low(struct amd64_pvt *pvt, u32 dclr, int chan)
#define CS_EVEN (CS_EVEN_PRIMARY | CS_EVEN_SECONDARY)
#define CS_ODD (CS_ODD_PRIMARY | CS_ODD_SECONDARY)
+static int f1x_get_cs_mode(int dimm, u8 ctrl, struct amd64_pvt *pvt)
+{
+ u32 dbam = ctrl ? pvt->dbam1 : pvt->dbam0;
+
+ return DBAM_DIMM(dimm, dbam);
+}
+
static int f17_get_cs_mode(int dimm, u8 ctrl, struct amd64_pvt *pvt)
{
u8 base, count = 0;
@@ -3346,16 +3353,10 @@ static void read_mc_regs(struct amd64_pvt *pvt)
*/
static u32 get_csrow_nr_pages(struct amd64_pvt *pvt, u8 dct, int csrow_nr_orig)
{
- u32 dbam = dct ? pvt->dbam1 : pvt->dbam0;
int csrow_nr = csrow_nr_orig;
u32 cs_mode, nr_pages;
- if (!pvt->umc) {
- csrow_nr >>= 1;
- cs_mode = DBAM_DIMM(csrow_nr, dbam);
- } else {
- cs_mode = f17_get_cs_mode(csrow_nr >> 1, dct, pvt);
- }
+ cs_mode = pvt->ops->get_cs_mode(csrow_nr >> 1, dct, pvt);
nr_pages = pvt->ops->dbam_to_cs(pvt, dct, cs_mode, csrow_nr);
nr_pages <<= 20 - PAGE_SHIFT;
@@ -3799,6 +3800,7 @@ static int per_family_init(struct amd64_pvt *pvt)
pvt->ops->setup_mci_misc_attrs = f1x_setup_mci_misc_attrs;
pvt->ops->populate_csrows = init_csrows;
pvt->ops->dump_misc_regs = __dump_misc_regs;
+ pvt->ops->get_cs_mode = f1x_get_cs_mode;
break;
case 0x10:
@@ -3819,6 +3821,7 @@ static int per_family_init(struct amd64_pvt *pvt)
pvt->ops->setup_mci_misc_attrs = f1x_setup_mci_misc_attrs;
pvt->ops->populate_csrows = init_csrows;
pvt->ops->dump_misc_regs = __dump_misc_regs;
+ pvt->ops->get_cs_mode = f1x_get_cs_mode;
break;
case 0x15:
@@ -3855,6 +3858,7 @@ static int per_family_init(struct amd64_pvt *pvt)
pvt->ops->setup_mci_misc_attrs = f1x_setup_mci_misc_attrs;
pvt->ops->populate_csrows = init_csrows;
pvt->ops->dump_misc_regs = __dump_misc_regs;
+ pvt->ops->get_cs_mode = f1x_get_cs_mode;
break;
case 0x16:
@@ -3881,6 +3885,7 @@ static int per_family_init(struct amd64_pvt *pvt)
pvt->ops->setup_mci_misc_attrs = f1x_setup_mci_misc_attrs;
pvt->ops->populate_csrows = init_csrows;
pvt->ops->dump_misc_regs = __dump_misc_regs;
+ pvt->ops->get_cs_mode = f1x_get_cs_mode;
break;
case 0x17:
@@ -3921,6 +3926,7 @@ static int per_family_init(struct amd64_pvt *pvt)
pvt->ops->setup_mci_misc_attrs = f1x_setup_mci_misc_attrs;
pvt->ops->populate_csrows = init_csrows_df;
pvt->ops->dump_misc_regs = __dump_misc_regs_df;
+ pvt->ops->get_cs_mode = f17_get_cs_mode;
if (pvt->fam == 0x18) {
pvt->ctl_name = "F18h";
@@ -3967,6 +3973,7 @@ static int per_family_init(struct amd64_pvt *pvt)
pvt->ops->setup_mci_misc_attrs = f1x_setup_mci_misc_attrs;
pvt->ops->populate_csrows = init_csrows_df;
pvt->ops->dump_misc_regs = __dump_misc_regs_df;
+ pvt->ops->get_cs_mode = f17_get_cs_mode;
break;
default:
@@ -3981,7 +3988,7 @@ static int per_family_init(struct amd64_pvt *pvt)
!pvt->ops->get_mc_regs || !pvt->ops->ecc_enabled ||
!pvt->ops->determine_edac_cap || !pvt->ops->determine_edac_ctl_cap ||
!pvt->ops->setup_mci_misc_attrs || !pvt->ops->populate_csrows ||
- !pvt->ops->dump_misc_regs) {
+ !pvt->ops->dump_misc_regs || !pvt->ops->get_cs_mode) {
edac_dbg(1, "Common helper routines not defined.\n");
return -EFAULT;
}
@@ -475,6 +475,7 @@ struct low_ops {
void (*setup_mci_misc_attrs)(struct mem_ctl_info *mci);
int (*populate_csrows)(struct mem_ctl_info *mci);
void (*dump_misc_regs)(struct amd64_pvt *pvt);
+ int (*get_cs_mode)(int dimm, u8 ctrl, struct amd64_pvt *pvt);
};
int __amd64_read_pci_cfg_dword(struct pci_dev *pdev, int offset,