aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/edac
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@redhat.com>2012-01-27 19:20:32 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-05-28 18:10:58 -0400
commit5e2af0c09e60d11dd8297e259a9ca2b3d92d2cf4 (patch)
treed4c7b687508ea48ab0fb844cbe61e7521ed17f01 /drivers/edac
parent084a4fccef39ac7abb039511f32380f28d0b67e6 (diff)
edac: Don't initialize csrow's first_page & friends when not needed
Almost all edac drivers initialize csrow_info->first_page, csrow_info->last_page and csrow_info->page_mask. Those vars are used inside the EDAC core, in order to calculate the csrow affected by an error, by using the routine edac_mc_find_csrow_by_page(). However, very few drivers actually use it: e752x_edac.c e7xxx_edac.c i3000_edac.c i82443bxgx_edac.c i82860_edac.c i82875p_edac.c i82975x_edac.c r82600_edac.c There also a few other drivers that have their own calculus formula internally using those vars. All the others are just wasting time by initializing those data. While initializing data without using them won't cause any troubles, as those information is stored at the wrong place (at csrows structure), it is better to remove what is unused, in order to simplify the next patch. Reviewed-by: Aristeu Rozanski <arozansk@redhat.com> Acked-by: Borislav Petkov <borislav.petkov@amd.com> Acked-by: Chris Metcalf <cmetcalf@tilera.com> Cc: Doug Thompson <norsk5@yahoo.com> Cc: Hitoshi Mitake <h.mitake@gmail.com> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: "Niklas Söderlund" <niklas.soderlund@ericsson.com> Cc: Josh Boyer <jwboyer@gmail.com> Cc: Jiri Kosina <jkosina@suse.cz> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/edac')
-rw-r--r--drivers/edac/amd64_edac.c37
-rw-r--r--drivers/edac/i3200_edac.c5
-rw-r--r--drivers/edac/i5000_edac.c5
-rw-r--r--drivers/edac/i5100_edac.c2
-rw-r--r--drivers/edac/i5400_edac.c5
-rw-r--r--drivers/edac/i7300_edac.c5
-rw-r--r--drivers/edac/i7core_edac.c5
-rw-r--r--drivers/edac/mv64x60_edac.c1
-rw-r--r--drivers/edac/ppc4xx_edac.c7
-rw-r--r--drivers/edac/sb_edac.c2
-rw-r--r--drivers/edac/tile_edac.c2
-rw-r--r--drivers/edac/x38_edac.c5
12 files changed, 3 insertions, 78 deletions
diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c
index 8126db0c8987..e2c5a94f683c 100644
--- a/drivers/edac/amd64_edac.c
+++ b/drivers/edac/amd64_edac.c
@@ -715,25 +715,6 @@ static inline u64 input_addr_to_sys_addr(struct mem_ctl_info *mci,
715 input_addr_to_dram_addr(mci, input_addr)); 715 input_addr_to_dram_addr(mci, input_addr));
716} 716}
717 717
718/*
719 * Find the minimum and maximum InputAddr values that map to the given @csrow.
720 * Pass back these values in *input_addr_min and *input_addr_max.
721 */
722static void find_csrow_limits(struct mem_ctl_info *mci, int csrow,
723 u64 *input_addr_min, u64 *input_addr_max)
724{
725 struct amd64_pvt *pvt;
726 u64 base, mask;
727
728 pvt = mci->pvt_info;
729 BUG_ON((csrow < 0) || (csrow >= pvt->csels[0].b_cnt));
730
731 get_cs_base_and_mask(pvt, csrow, 0, &base, &mask);
732
733 *input_addr_min = base & ~mask;
734 *input_addr_max = base | mask;
735}
736
737/* Map the Error address to a PAGE and PAGE OFFSET. */ 718/* Map the Error address to a PAGE and PAGE OFFSET. */
738static inline void error_address_to_page_and_offset(u64 error_address, 719static inline void error_address_to_page_and_offset(u64 error_address,
739 u32 *page, u32 *offset) 720 u32 *page, u32 *offset)
@@ -2185,7 +2166,7 @@ static int init_csrows(struct mem_ctl_info *mci)
2185{ 2166{
2186 struct csrow_info *csrow; 2167 struct csrow_info *csrow;
2187 struct amd64_pvt *pvt = mci->pvt_info; 2168 struct amd64_pvt *pvt = mci->pvt_info;
2188 u64 input_addr_min, input_addr_max, sys_addr, base, mask; 2169 u64 base, mask;
2189 u32 val; 2170 u32 val;
2190 int i, j, empty = 1; 2171 int i, j, empty = 1;
2191 enum mem_type mtype; 2172 enum mem_type mtype;
@@ -2216,28 +2197,14 @@ static int init_csrows(struct mem_ctl_info *mci)
2216 csrow->nr_pages = amd64_csrow_nr_pages(pvt, 0, i); 2197 csrow->nr_pages = amd64_csrow_nr_pages(pvt, 0, i);
2217 if (csrow_enabled(i, 1, pvt)) 2198 if (csrow_enabled(i, 1, pvt))
2218 csrow->nr_pages += amd64_csrow_nr_pages(pvt, 1, i); 2199 csrow->nr_pages += amd64_csrow_nr_pages(pvt, 1, i);
2219 find_csrow_limits(mci, i, &input_addr_min, &input_addr_max);
2220 sys_addr = input_addr_to_sys_addr(mci, input_addr_min);
2221 csrow->first_page = (u32) (sys_addr >> PAGE_SHIFT);
2222 sys_addr = input_addr_to_sys_addr(mci, input_addr_max);
2223 csrow->last_page = (u32) (sys_addr >> PAGE_SHIFT);
2224 2200
2225 get_cs_base_and_mask(pvt, i, 0, &base, &mask); 2201 get_cs_base_and_mask(pvt, i, 0, &base, &mask);
2226 csrow->page_mask = ~mask;
2227 /* 8 bytes of resolution */ 2202 /* 8 bytes of resolution */
2228 2203
2229 mtype = amd64_determine_memory_type(pvt, i); 2204 mtype = amd64_determine_memory_type(pvt, i);
2230 2205
2231 debugf1(" for MC node %d csrow %d:\n", pvt->mc_node_id, i); 2206 debugf1(" for MC node %d csrow %d:\n", pvt->mc_node_id, i);
2232 debugf1(" input_addr_min: 0x%lx input_addr_max: 0x%lx\n", 2207 debugf1(" nr_pages: %u\n", csrow->nr_pages);
2233 (unsigned long)input_addr_min,
2234 (unsigned long)input_addr_max);
2235 debugf1(" sys_addr: 0x%lx page_mask: 0x%lx\n",
2236 (unsigned long)sys_addr, csrow->page_mask);
2237 debugf1(" nr_pages: %u first_page: 0x%lx "
2238 "last_page: 0x%lx\n",
2239 (unsigned)csrow->nr_pages,
2240 csrow->first_page, csrow->last_page);
2241 2208
2242 /* 2209 /*
2243 * determine whether CHIPKILL or JUST ECC or NO ECC is operating 2210 * determine whether CHIPKILL or JUST ECC or NO ECC is operating
diff --git a/drivers/edac/i3200_edac.c b/drivers/edac/i3200_edac.c
index 6ae30176aef5..93c4d5a6a623 100644
--- a/drivers/edac/i3200_edac.c
+++ b/drivers/edac/i3200_edac.c
@@ -321,7 +321,6 @@ static int i3200_probe1(struct pci_dev *pdev, int dev_idx)
321 int rc; 321 int rc;
322 int i, j; 322 int i, j;
323 struct mem_ctl_info *mci = NULL; 323 struct mem_ctl_info *mci = NULL;
324 unsigned long last_page;
325 u16 drbs[I3200_CHANNELS][I3200_RANKS_PER_CHANNEL]; 324 u16 drbs[I3200_CHANNELS][I3200_RANKS_PER_CHANNEL];
326 bool stacked; 325 bool stacked;
327 void __iomem *window; 326 void __iomem *window;
@@ -366,7 +365,6 @@ static int i3200_probe1(struct pci_dev *pdev, int dev_idx)
366 * cumulative; the last one will contain the total memory 365 * cumulative; the last one will contain the total memory
367 * contained in all ranks. 366 * contained in all ranks.
368 */ 367 */
369 last_page = -1UL;
370 for (i = 0; i < mci->nr_csrows; i++) { 368 for (i = 0; i < mci->nr_csrows; i++) {
371 unsigned long nr_pages; 369 unsigned long nr_pages;
372 struct csrow_info *csrow = &mci->csrows[i]; 370 struct csrow_info *csrow = &mci->csrows[i];
@@ -378,9 +376,6 @@ static int i3200_probe1(struct pci_dev *pdev, int dev_idx)
378 if (nr_pages == 0) 376 if (nr_pages == 0)
379 continue; 377 continue;
380 378
381 csrow->first_page = last_page + 1;
382 last_page += nr_pages;
383 csrow->last_page = last_page;
384 csrow->nr_pages = nr_pages; 379 csrow->nr_pages = nr_pages;
385 380
386 for (j = 0; j < nr_channels; j++) { 381 for (j = 0; j < nr_channels; j++) {
diff --git a/drivers/edac/i5000_edac.c b/drivers/edac/i5000_edac.c
index 95966ba9c5ca..26b40556958e 100644
--- a/drivers/edac/i5000_edac.c
+++ b/drivers/edac/i5000_edac.c
@@ -1263,11 +1263,6 @@ static int i5000_init_csrows(struct mem_ctl_info *mci)
1263 if (!MTR_DIMMS_PRESENT(mtr) && !MTR_DIMMS_PRESENT(mtr1)) 1263 if (!MTR_DIMMS_PRESENT(mtr) && !MTR_DIMMS_PRESENT(mtr1))
1264 continue; 1264 continue;
1265 1265
1266 /* FAKE OUT VALUES, FIXME */
1267 p_csrow->first_page = 0 + csrow * 20;
1268 p_csrow->last_page = 9 + csrow * 20;
1269 p_csrow->page_mask = 0xFFF;
1270
1271 csrow_megs = 0; 1266 csrow_megs = 0;
1272 for (channel = 0; channel < pvt->maxch; channel++) { 1267 for (channel = 0; channel < pvt->maxch; channel++) {
1273 csrow_megs += pvt->dimm_info[csrow][channel].megabytes; 1268 csrow_megs += pvt->dimm_info[csrow][channel].megabytes;
diff --git a/drivers/edac/i5100_edac.c b/drivers/edac/i5100_edac.c
index 6c0dafa3f67b..5338c7968f78 100644
--- a/drivers/edac/i5100_edac.c
+++ b/drivers/edac/i5100_edac.c
@@ -859,8 +859,6 @@ static void __devinit i5100_init_csrows(struct mem_ctl_info *mci)
859 * FIXME: these two are totally bogus -- I don't see how to 859 * FIXME: these two are totally bogus -- I don't see how to
860 * map them correctly to this structure... 860 * map them correctly to this structure...
861 */ 861 */
862 mci->csrows[i].first_page = total_pages;
863 mci->csrows[i].last_page = total_pages + npages - 1;
864 mci->csrows[i].nr_pages = npages; 862 mci->csrows[i].nr_pages = npages;
865 mci->csrows[i].csrow_idx = i; 863 mci->csrows[i].csrow_idx = i;
866 mci->csrows[i].mci = mci; 864 mci->csrows[i].mci = mci;
diff --git a/drivers/edac/i5400_edac.c b/drivers/edac/i5400_edac.c
index c2379ba95c5a..6f85dcb34019 100644
--- a/drivers/edac/i5400_edac.c
+++ b/drivers/edac/i5400_edac.c
@@ -1180,11 +1180,6 @@ static int i5400_init_csrows(struct mem_ctl_info *mci)
1180 if (!MTR_DIMMS_PRESENT(mtr)) 1180 if (!MTR_DIMMS_PRESENT(mtr))
1181 continue; 1181 continue;
1182 1182
1183 /* FAKE OUT VALUES, FIXME */
1184 p_csrow->first_page = 0 + csrow * 20;
1185 p_csrow->last_page = 9 + csrow * 20;
1186 p_csrow->page_mask = 0xFFF;
1187
1188 csrow_megs = 0; 1183 csrow_megs = 0;
1189 for (channel = 0; channel < pvt->maxch; channel++) { 1184 for (channel = 0; channel < pvt->maxch; channel++) {
1190 csrow_megs += pvt->dimm_info[csrow][channel].megabytes; 1185 csrow_megs += pvt->dimm_info[csrow][channel].megabytes;
diff --git a/drivers/edac/i7300_edac.c b/drivers/edac/i7300_edac.c
index 4bfcb3da3f01..d4153d6cfe30 100644
--- a/drivers/edac/i7300_edac.c
+++ b/drivers/edac/i7300_edac.c
@@ -778,7 +778,7 @@ static int i7300_init_csrows(struct mem_ctl_info *mci)
778 int rc = -ENODEV; 778 int rc = -ENODEV;
779 int mtr; 779 int mtr;
780 int ch, branch, slot, channel; 780 int ch, branch, slot, channel;
781 u32 last_page = 0, nr_pages; 781 u32 nr_pages;
782 struct dimm_info *dimm; 782 struct dimm_info *dimm;
783 783
784 pvt = mci->pvt_info; 784 pvt = mci->pvt_info;
@@ -828,9 +828,6 @@ static int i7300_init_csrows(struct mem_ctl_info *mci)
828 828
829 /* Update per_csrow memory count */ 829 /* Update per_csrow memory count */
830 p_csrow->nr_pages += nr_pages; 830 p_csrow->nr_pages += nr_pages;
831 p_csrow->first_page = last_page;
832 last_page += nr_pages;
833 p_csrow->last_page = last_page;
834 831
835 rc = 0; 832 rc = 0;
836 } 833 }
diff --git a/drivers/edac/i7core_edac.c b/drivers/edac/i7core_edac.c
index 5449bd40a739..76c957c525fb 100644
--- a/drivers/edac/i7core_edac.c
+++ b/drivers/edac/i7core_edac.c
@@ -599,7 +599,6 @@ static int get_dimm_config(struct mem_ctl_info *mci)
599 struct pci_dev *pdev; 599 struct pci_dev *pdev;
600 int i, j; 600 int i, j;
601 int csrow = 0; 601 int csrow = 0;
602 unsigned long last_page = 0;
603 enum edac_type mode; 602 enum edac_type mode;
604 enum mem_type mtype; 603 enum mem_type mtype;
605 struct dimm_info *dimm; 604 struct dimm_info *dimm;
@@ -716,12 +715,8 @@ static int get_dimm_config(struct mem_ctl_info *mci)
716 npages = MiB_TO_PAGES(size); 715 npages = MiB_TO_PAGES(size);
717 716
718 csr = &mci->csrows[csrow]; 717 csr = &mci->csrows[csrow];
719 csr->first_page = last_page + 1;
720 last_page += npages;
721 csr->last_page = last_page;
722 csr->nr_pages = npages; 718 csr->nr_pages = npages;
723 719
724 csr->page_mask = 0;
725 csr->csrow_idx = csrow; 720 csr->csrow_idx = csrow;
726 csr->nr_channels = 1; 721 csr->nr_channels = 1;
727 722
diff --git a/drivers/edac/mv64x60_edac.c b/drivers/edac/mv64x60_edac.c
index 12d7fe04454c..d2e3c39ede9f 100644
--- a/drivers/edac/mv64x60_edac.c
+++ b/drivers/edac/mv64x60_edac.c
@@ -668,7 +668,6 @@ static void mv64x60_init_csrows(struct mem_ctl_info *mci,
668 csrow = &mci->csrows[0]; 668 csrow = &mci->csrows[0];
669 dimm = csrow->channels[0].dimm; 669 dimm = csrow->channels[0].dimm;
670 csrow->nr_pages = pdata->total_mem >> PAGE_SHIFT; 670 csrow->nr_pages = pdata->total_mem >> PAGE_SHIFT;
671 csrow->last_page = csrow->first_page + csrow->nr_pages - 1;
672 dimm->grain = 8; 671 dimm->grain = 8;
673 672
674 dimm->mtype = (ctl & MV64X60_SDRAM_REGISTERED) ? MEM_RDDR : MEM_DDR; 673 dimm->mtype = (ctl & MV64X60_SDRAM_REGISTERED) ? MEM_RDDR : MEM_DDR;
diff --git a/drivers/edac/ppc4xx_edac.c b/drivers/edac/ppc4xx_edac.c
index a75e56788b29..ec5e529e33f6 100644
--- a/drivers/edac/ppc4xx_edac.c
+++ b/drivers/edac/ppc4xx_edac.c
@@ -897,7 +897,6 @@ ppc4xx_edac_init_csrows(struct mem_ctl_info *mci, u32 mcopt1)
897 enum edac_type edac_mode; 897 enum edac_type edac_mode;
898 int row, j; 898 int row, j;
899 u32 mbxcf, size; 899 u32 mbxcf, size;
900 static u32 ppc4xx_last_page;
901 900
902 /* Establish the memory type and width */ 901 /* Establish the memory type and width */
903 902
@@ -959,10 +958,6 @@ ppc4xx_edac_init_csrows(struct mem_ctl_info *mci, u32 mcopt1)
959 goto done; 958 goto done;
960 } 959 }
961 960
962 csi->first_page = ppc4xx_last_page;
963 csi->last_page = csi->first_page + csi->nr_pages - 1;
964 csi->page_mask = 0;
965
966 /* 961 /*
967 * It's unclear exactly what grain should be set to 962 * It's unclear exactly what grain should be set to
968 * here. The SDRAM_ECCES register allows resolution of 963 * here. The SDRAM_ECCES register allows resolution of
@@ -984,8 +979,6 @@ ppc4xx_edac_init_csrows(struct mem_ctl_info *mci, u32 mcopt1)
984 dimm->dtype = dtype; 979 dimm->dtype = dtype;
985 980
986 dimm->edac_mode = edac_mode; 981 dimm->edac_mode = edac_mode;
987
988 ppc4xx_last_page += csi->nr_pages;
989 } 982 }
990 } 983 }
991 984
diff --git a/drivers/edac/sb_edac.c b/drivers/edac/sb_edac.c
index 21147ac38c4d..d5892c052bf4 100644
--- a/drivers/edac/sb_edac.c
+++ b/drivers/edac/sb_edac.c
@@ -642,8 +642,6 @@ static int get_dimm_config(struct mem_ctl_info *mci)
642 * csrows. 642 * csrows.
643 */ 643 */
644 csr = &mci->csrows[csrow]; 644 csr = &mci->csrows[csrow];
645 csr->first_page = last_page;
646 csr->last_page = last_page + npages - 1;
647 csr->nr_pages = npages; 645 csr->nr_pages = npages;
648 csr->csrow_idx = csrow; 646 csr->csrow_idx = csrow;
649 csr->nr_channels = 1; 647 csr->nr_channels = 1;
diff --git a/drivers/edac/tile_edac.c b/drivers/edac/tile_edac.c
index c870f68ae8f1..54067c4b0cc1 100644
--- a/drivers/edac/tile_edac.c
+++ b/drivers/edac/tile_edac.c
@@ -110,9 +110,7 @@ static int __devinit tile_edac_init_csrows(struct mem_ctl_info *mci)
110 return -1; 110 return -1;
111 } 111 }
112 112
113 csrow->first_page = 0;
114 csrow->nr_pages = mem_info.mem_size >> PAGE_SHIFT; 113 csrow->nr_pages = mem_info.mem_size >> PAGE_SHIFT;
115 csrow->last_page = csrow->first_page + csrow->nr_pages - 1;
116 dimm->grain = TILE_EDAC_ERROR_GRAIN; 114 dimm->grain = TILE_EDAC_ERROR_GRAIN;
117 dimm->dtype = DEV_UNKNOWN; 115 dimm->dtype = DEV_UNKNOWN;
118 116
diff --git a/drivers/edac/x38_edac.c b/drivers/edac/x38_edac.c
index f7cc4d214949..bc7f880a4eed 100644
--- a/drivers/edac/x38_edac.c
+++ b/drivers/edac/x38_edac.c
@@ -319,7 +319,6 @@ static int x38_probe1(struct pci_dev *pdev, int dev_idx)
319 int rc; 319 int rc;
320 int i, j; 320 int i, j;
321 struct mem_ctl_info *mci = NULL; 321 struct mem_ctl_info *mci = NULL;
322 unsigned long last_page;
323 u16 drbs[X38_CHANNELS][X38_RANKS_PER_CHANNEL]; 322 u16 drbs[X38_CHANNELS][X38_RANKS_PER_CHANNEL];
324 bool stacked; 323 bool stacked;
325 void __iomem *window; 324 void __iomem *window;
@@ -363,7 +362,6 @@ static int x38_probe1(struct pci_dev *pdev, int dev_idx)
363 * cumulative; the last one will contain the total memory 362 * cumulative; the last one will contain the total memory
364 * contained in all ranks. 363 * contained in all ranks.
365 */ 364 */
366 last_page = -1UL;
367 for (i = 0; i < mci->nr_csrows; i++) { 365 for (i = 0; i < mci->nr_csrows; i++) {
368 unsigned long nr_pages; 366 unsigned long nr_pages;
369 struct csrow_info *csrow = &mci->csrows[i]; 367 struct csrow_info *csrow = &mci->csrows[i];
@@ -375,9 +373,6 @@ static int x38_probe1(struct pci_dev *pdev, int dev_idx)
375 if (nr_pages == 0) 373 if (nr_pages == 0)
376 continue; 374 continue;
377 375
378 csrow->first_page = last_page + 1;
379 last_page += nr_pages;
380 csrow->last_page = last_page;
381 csrow->nr_pages = nr_pages; 376 csrow->nr_pages = nr_pages;
382 377
383 for (j = 0; j < x38_channel_num; j++) { 378 for (j = 0; j < x38_channel_num; j++) {