aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/edac/amd64_edac.c
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/amd64_edac.c
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/amd64_edac.c')
-rw-r--r--drivers/edac/amd64_edac.c37
1 files changed, 2 insertions, 35 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