aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/edac/e752x_edac.c
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@redhat.com>2012-03-28 18:37:59 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-06-11 12:23:44 -0400
commitfd63312dfe70b8279618b4d77dc951b6e309ffa2 (patch)
treea6a4012398f8977d7059d3dd6e85c120c4fc50fd /drivers/edac/e752x_edac.c
parent452a6bf955ee1842361742833e40e046287308f4 (diff)
edac: Move grain/dtype/edac_type calculus to be out of channel loop
The 3e7bddc changeset (edac: move dimm properties to struct memset_info) moved the calculus inside a loop. However, at those stuff are common to all channels, on several drivers, it is better to put the calculus outside the loop, to optimize the code. Reported-by: Aristeu Rozanski Filho <arozansk@redhat.com> Reviewed-by: Aristeu Rozanski <arozansk@redhat.com> Cc: Mark Gross <mark.gross@intel.com> Cc: Doug Thompson <norsk5@yahoo.com> Cc: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Michal Marek <mmarek@suse.cz> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/edac/e752x_edac.c')
-rw-r--r--drivers/edac/e752x_edac.c31
1 files changed, 16 insertions, 15 deletions
diff --git a/drivers/edac/e752x_edac.c b/drivers/edac/e752x_edac.c
index d75660634b43..d1142ed8bd88 100644
--- a/drivers/edac/e752x_edac.c
+++ b/drivers/edac/e752x_edac.c
@@ -1069,6 +1069,7 @@ static void e752x_init_csrows(struct mem_ctl_info *mci, struct pci_dev *pdev,
1069 u16 ddrcsr) 1069 u16 ddrcsr)
1070{ 1070{
1071 struct csrow_info *csrow; 1071 struct csrow_info *csrow;
1072 enum edac_type edac_mode;
1072 unsigned long last_cumul_size; 1073 unsigned long last_cumul_size;
1073 int index, mem_dev, drc_chan; 1074 int index, mem_dev, drc_chan;
1074 int drc_drbg; /* DRB granularity 0=64mb, 1=128mb */ 1075 int drc_drbg; /* DRB granularity 0=64mb, 1=128mb */
@@ -1111,6 +1112,20 @@ static void e752x_init_csrows(struct mem_ctl_info *mci, struct pci_dev *pdev,
1111 nr_pages = cumul_size - last_cumul_size; 1112 nr_pages = cumul_size - last_cumul_size;
1112 last_cumul_size = cumul_size; 1113 last_cumul_size = cumul_size;
1113 1114
1115 /*
1116 * if single channel or x8 devices then SECDED
1117 * if dual channel and x4 then S4ECD4ED
1118 */
1119 if (drc_ddim) {
1120 if (drc_chan && mem_dev) {
1121 edac_mode = EDAC_S4ECD4ED;
1122 mci->edac_cap |= EDAC_FLAG_S4ECD4ED;
1123 } else {
1124 edac_mode = EDAC_SECDED;
1125 mci->edac_cap |= EDAC_FLAG_SECDED;
1126 }
1127 } else
1128 edac_mode = EDAC_NONE;
1114 for (i = 0; i < csrow->nr_channels; i++) { 1129 for (i = 0; i < csrow->nr_channels; i++) {
1115 struct dimm_info *dimm = csrow->channels[i].dimm; 1130 struct dimm_info *dimm = csrow->channels[i].dimm;
1116 1131
@@ -1119,21 +1134,7 @@ static void e752x_init_csrows(struct mem_ctl_info *mci, struct pci_dev *pdev,
1119 dimm->grain = 1 << 12; /* 4KiB - resolution of CELOG */ 1134 dimm->grain = 1 << 12; /* 4KiB - resolution of CELOG */
1120 dimm->mtype = MEM_RDDR; /* only one type supported */ 1135 dimm->mtype = MEM_RDDR; /* only one type supported */
1121 dimm->dtype = mem_dev ? DEV_X4 : DEV_X8; 1136 dimm->dtype = mem_dev ? DEV_X4 : DEV_X8;
1122 1137 dimm->edac_mode = edac_mode;
1123 /*
1124 * if single channel or x8 devices then SECDED
1125 * if dual channel and x4 then S4ECD4ED
1126 */
1127 if (drc_ddim) {
1128 if (drc_chan && mem_dev) {
1129 dimm->edac_mode = EDAC_S4ECD4ED;
1130 mci->edac_cap |= EDAC_FLAG_S4ECD4ED;
1131 } else {
1132 dimm->edac_mode = EDAC_SECDED;
1133 mci->edac_cap |= EDAC_FLAG_SECDED;
1134 }
1135 } else
1136 dimm->edac_mode = EDAC_NONE;
1137 } 1138 }
1138 } 1139 }
1139} 1140}