aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/edac/amd64_edac.c
diff options
context:
space:
mode:
authorBorislav Petkov <borislav.petkov@amd.com>2010-12-21 09:53:27 -0500
committerBorislav Petkov <borislav.petkov@amd.com>2011-03-17 09:46:14 -0400
commit525a1b20a6830317db17b62df322b45d92ecd550 (patch)
tree02b9f603b4545e11726b40c96f39f30c6eeed199 /drivers/edac/amd64_edac.c
parentf678b8ccce69dcf9c597e3029ee35421ba62a215 (diff)
amd64_edac: Cleanup DBAM handling
Do not read DBAM regs twice and simplify code around them. There should be no functional change resulting from this patch. Signed-off-by: Borislav Petkov <borislav.petkov@amd.com>
Diffstat (limited to 'drivers/edac/amd64_edac.c')
-rw-r--r--drivers/edac/amd64_edac.c27
1 files changed, 8 insertions, 19 deletions
diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c
index aed7f7bbc5d2..9fd3c2d9c2a7 100644
--- a/drivers/edac/amd64_edac.c
+++ b/drivers/edac/amd64_edac.c
@@ -875,12 +875,6 @@ static void dump_misc_regs(struct amd64_pvt *pvt)
875 amd64_dump_dramcfg_low(pvt->dclr1, 1); 875 amd64_dump_dramcfg_low(pvt->dclr1, 1);
876} 876}
877 877
878static void amd64_read_dbam_reg(struct amd64_pvt *pvt)
879{
880 amd64_read_dct_pci_cfg(pvt, DBAM0, &pvt->dbam0);
881 amd64_read_dct_pci_cfg(pvt, DBAM1, &pvt->dbam1);
882}
883
884/* 878/*
885 * see BKDG, F2x[1,0][5C:40], F2[1,0][6C:60] 879 * see BKDG, F2x[1,0][5C:40], F2[1,0][6C:60]
886 */ 880 */
@@ -1098,9 +1092,7 @@ static int k8_dbam_to_chip_select(struct amd64_pvt *pvt, int cs_mode)
1098 */ 1092 */
1099static int f10_early_channel_count(struct amd64_pvt *pvt) 1093static int f10_early_channel_count(struct amd64_pvt *pvt)
1100{ 1094{
1101 int dbams[] = { DBAM0, DBAM1 };
1102 int i, j, channels = 0; 1095 int i, j, channels = 0;
1103 u32 dbam;
1104 1096
1105 /* If we are in 128 bit mode, then we are using 2 channels */ 1097 /* If we are in 128 bit mode, then we are using 2 channels */
1106 if (pvt->dclr0 & F10_WIDTH_128) { 1098 if (pvt->dclr0 & F10_WIDTH_128) {
@@ -1123,9 +1115,8 @@ static int f10_early_channel_count(struct amd64_pvt *pvt)
1123 * is more than just one DIMM present in unganged mode. Need to check 1115 * is more than just one DIMM present in unganged mode. Need to check
1124 * both controllers since DIMMs can be placed in either one. 1116 * both controllers since DIMMs can be placed in either one.
1125 */ 1117 */
1126 for (i = 0; i < ARRAY_SIZE(dbams); i++) { 1118 for (i = 0; i < 2; i++) {
1127 if (amd64_read_dct_pci_cfg(pvt, dbams[i], &dbam)) 1119 u32 dbam = (i ? pvt->dbam1 : pvt->dbam0);
1128 goto err_reg;
1129 1120
1130 for (j = 0; j < 4; j++) { 1121 for (j = 0; j < 4; j++) {
1131 if (DBAM_DIMM(j, dbam) > 0) { 1122 if (DBAM_DIMM(j, dbam) > 0) {
@@ -1141,10 +1132,6 @@ static int f10_early_channel_count(struct amd64_pvt *pvt)
1141 amd64_info("MCT channel count: %d\n", channels); 1132 amd64_info("MCT channel count: %d\n", channels);
1142 1133
1143 return channels; 1134 return channels;
1144
1145err_reg:
1146 return -1;
1147
1148} 1135}
1149 1136
1150static int f10_dbam_to_chip_select(struct amd64_pvt *pvt, int cs_mode) 1137static int f10_dbam_to_chip_select(struct amd64_pvt *pvt, int cs_mode)
@@ -1504,8 +1491,8 @@ static void f10_map_sysaddr_to_csrow(struct mem_ctl_info *mci,
1504static void amd64_debug_display_dimm_sizes(int ctrl, struct amd64_pvt *pvt) 1491static void amd64_debug_display_dimm_sizes(int ctrl, struct amd64_pvt *pvt)
1505{ 1492{
1506 int dimm, size0, size1, factor = 0; 1493 int dimm, size0, size1, factor = 0;
1507 u32 dbam; 1494 u32 *dcsb = ctrl ? pvt->csels[1].csbases : pvt->csels[0].csbases;
1508 u32 *dcsb; 1495 u32 dbam = ctrl ? pvt->dbam1 : pvt->dbam0;
1509 1496
1510 if (boot_cpu_data.x86 == 0xf) { 1497 if (boot_cpu_data.x86 == 0xf) {
1511 if (pvt->dclr0 & F10_WIDTH_128) 1498 if (pvt->dclr0 & F10_WIDTH_128)
@@ -1969,7 +1956,7 @@ static void read_mc_regs(struct amd64_pvt *pvt)
1969 read_dct_base_mask(pvt); 1956 read_dct_base_mask(pvt);
1970 1957
1971 amd64_read_pci_cfg(pvt->F1, DHAR, &pvt->dhar); 1958 amd64_read_pci_cfg(pvt->F1, DHAR, &pvt->dhar);
1972 amd64_read_dbam_reg(pvt); 1959 amd64_read_dct_pci_cfg(pvt, DBAM0, &pvt->dbam0);
1973 1960
1974 amd64_read_pci_cfg(pvt->F3, F10_ONLINE_SPARE, &pvt->online_spare); 1961 amd64_read_pci_cfg(pvt->F3, F10_ONLINE_SPARE, &pvt->online_spare);
1975 1962
@@ -1981,8 +1968,10 @@ static void read_mc_regs(struct amd64_pvt *pvt)
1981 amd64_read_dct_pci_cfg(pvt, F10_DCHR_1, &pvt->dchr1); 1968 amd64_read_dct_pci_cfg(pvt, F10_DCHR_1, &pvt->dchr1);
1982 } 1969 }
1983 1970
1984 if (boot_cpu_data.x86 >= 0x10) 1971 if (boot_cpu_data.x86 >= 0x10) {
1985 amd64_read_pci_cfg(pvt->F3, EXT_NB_MCA_CFG, &tmp); 1972 amd64_read_pci_cfg(pvt->F3, EXT_NB_MCA_CFG, &tmp);
1973 amd64_read_dct_pci_cfg(pvt, DBAM1, &pvt->dbam1);
1974 }
1986 1975
1987 if (boot_cpu_data.x86 == 0x10 && 1976 if (boot_cpu_data.x86 == 0x10 &&
1988 boot_cpu_data.x86_model > 7 && 1977 boot_cpu_data.x86_model > 7 &&