LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Borislav Petkov <bp@amd64.org>
To: <linux-edac@vger.kernel.org>
Cc: <linux-kernel@vger.kernel.org>,
Borislav Petkov <borislav.petkov@amd.com>
Subject: [PATCH 04/30] amd64_edac: Cleanup DHAR handling
Date: Thu, 10 Feb 2011 18:15:07 +0100 [thread overview]
Message-ID: <1297358133-14320-5-git-send-email-bp@amd64.org> (raw)
In-Reply-To: <1297358133-14320-1-git-send-email-bp@amd64.org>
From: Borislav Petkov <borislav.petkov@amd.com>
Adjust to F15h, simplify code, fixup macros.
Signed-off-by: Borislav Petkov <borislav.petkov@amd.com>
---
drivers/edac/amd64_edac.c | 36 ++++++++++++++++++------------------
drivers/edac/amd64_edac.h | 11 +++++------
2 files changed, 23 insertions(+), 24 deletions(-)
diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c
index 683fd3c..62b4ae9 100644
--- a/drivers/edac/amd64_edac.c
+++ b/drivers/edac/amd64_edac.c
@@ -487,9 +487,9 @@ int amd64_get_dram_hole_info(struct mem_ctl_info *mci, u64 *hole_base,
return 1;
}
- /* only valid for Fam10h */
- if (boot_cpu_data.x86 == 0x10 &&
- (pvt->dhar & F10_DRAM_MEM_HOIST_VALID) == 0) {
+ /* valid for Fam10h and above */
+ if (boot_cpu_data.x86 >= 0x10 &&
+ (pvt->dhar & DRAM_MEM_HOIST_VALID) == 0) {
debugf1(" Dram Memory Hoisting is DISABLED on this system\n");
return 1;
}
@@ -518,15 +518,15 @@ int amd64_get_dram_hole_info(struct mem_ctl_info *mci, u64 *hole_base,
* addresses in the hole so that they start at 0x100000000.
*/
- base = dhar_base(pvt->dhar);
+ base = dhar_base(pvt);
*hole_base = base;
*hole_size = (0x1ull << 32) - base;
if (boot_cpu_data.x86 > 0xf)
- *hole_offset = f10_dhar_offset(pvt->dhar);
+ *hole_offset = f10_dhar_offset(pvt);
else
- *hole_offset = k8_dhar_offset(pvt->dhar);
+ *hole_offset = k8_dhar_offset(pvt);
debugf1(" DHAR info for node %d base 0x%lx offset 0x%lx size 0x%lx\n",
pvt->mc_node_id, (unsigned long)*hole_base,
@@ -884,10 +884,9 @@ static void dump_misc_regs(struct amd64_pvt *pvt)
debugf1("F1xF0 (DRAM Hole Address): 0x%08x, base: 0x%08x, "
"offset: 0x%08x\n",
- pvt->dhar,
- dhar_base(pvt->dhar),
- (boot_cpu_data.x86 == 0xf) ? k8_dhar_offset(pvt->dhar)
- : f10_dhar_offset(pvt->dhar));
+ pvt->dhar, dhar_base(pvt),
+ (boot_cpu_data.x86 == 0xf) ? k8_dhar_offset(pvt)
+ : f10_dhar_offset(pvt));
debugf1(" DramHoleValid: %s\n",
(pvt->dhar & DHAR_VALID) ? "yes" : "no");
@@ -1316,7 +1315,7 @@ static inline u32 f10_map_intlv_en_to_shift(u32 intlv_en)
static inline u64 f10_get_base_addr_offset(u64 sys_addr, int hi_range_sel,
u32 dct_sel_base_addr,
u64 dct_sel_base_off,
- u32 hole_valid, u32 hole_off,
+ u32 hole_valid, u64 hole_off,
u64 dram_base)
{
u64 chan_off;
@@ -1324,12 +1323,12 @@ static inline u64 f10_get_base_addr_offset(u64 sys_addr, int hi_range_sel,
if (hi_range_sel) {
if (!(dct_sel_base_addr & 0xFFFF0000) &&
hole_valid && (sys_addr >= 0x100000000ULL))
- chan_off = hole_off << 16;
+ chan_off = hole_off;
else
chan_off = dct_sel_base_off;
} else {
if (hole_valid && (sys_addr >= 0x100000000ULL))
- chan_off = hole_off << 16;
+ chan_off = hole_off;
else
chan_off = dram_base & 0xFFFFF8000000ULL;
}
@@ -1435,7 +1434,8 @@ static int f10_match_to_this_node(struct amd64_pvt *pvt, int range,
u64 sys_addr, int *nid, int *chan_sel)
{
int cs_found = -EINVAL, high_range = 0;
- u32 intlv_shift, hole_off;
+ u32 intlv_shift;
+ u64 hole_off;
u32 hole_valid, tmp, dct_sel_base, channel;
u64 chan_addr, dct_sel_base_off;
@@ -1451,11 +1451,11 @@ static int f10_match_to_this_node(struct amd64_pvt *pvt, int range,
* This assumes that one node's DHAR is the same as all the other
* nodes' DHAR.
*/
- hole_off = (pvt->dhar & 0x0000FF80);
- hole_valid = (pvt->dhar & 0x1);
+ hole_off = f10_dhar_offset(pvt);
+ hole_valid = (pvt->dhar & DHAR_VALID);
dct_sel_base_off = (pvt->dct_sel_hi & 0xFFFFFC00) << 16;
- debugf1(" HoleOffset=0x%x HoleValid=0x%x IntlvSel=0x%x\n",
+ debugf1(" HoleOffset=0x%016llx HoleValid=%d IntlvSel=0x%x\n",
hole_off, hole_valid, intlv_sel);
if (intlv_en &&
@@ -2051,7 +2051,7 @@ static void read_mc_regs(struct amd64_pvt *pvt)
read_dct_base_mask(pvt);
- amd64_read_pci_cfg(pvt->F1, K8_DHAR, &pvt->dhar);
+ amd64_read_pci_cfg(pvt->F1, DHAR, &pvt->dhar);
amd64_read_dbam_reg(pvt);
amd64_read_pci_cfg(pvt->F3, F10_ONLINE_SPARE, &pvt->online_spare);
diff --git a/drivers/edac/amd64_edac.h b/drivers/edac/amd64_edac.h
index 93af357..a2bc9a6 100644
--- a/drivers/edac/amd64_edac.h
+++ b/drivers/edac/amd64_edac.h
@@ -175,20 +175,19 @@
#define dram_intlv_sel(pvt, i) ((pvt->ranges[i].lim.lo >> 8) & 0x7)
#define dram_dst_node(pvt, i) (pvt->ranges[i].lim.lo & 0x7)
-#define K8_DHAR 0xf0
-
+#define DHAR 0xf0
#define DHAR_VALID BIT(0)
-#define F10_DRAM_MEM_HOIST_VALID BIT(1)
+#define DRAM_MEM_HOIST_VALID BIT(1)
#define DHAR_BASE_MASK 0xff000000
-#define dhar_base(dhar) (dhar & DHAR_BASE_MASK)
+#define dhar_base(pvt) ((pvt)->dhar & DHAR_BASE_MASK)
#define K8_DHAR_OFFSET_MASK 0x0000ff00
-#define k8_dhar_offset(dhar) ((dhar & K8_DHAR_OFFSET_MASK) << 16)
+#define k8_dhar_offset(pvt) (((pvt)->dhar & K8_DHAR_OFFSET_MASK) << 16)
#define F10_DHAR_OFFSET_MASK 0x0000ff80
/* NOTE: Extra mask bit vs K8 */
-#define f10_dhar_offset(dhar) ((dhar & F10_DHAR_OFFSET_MASK) << 16)
+#define f10_dhar_offset(pvt) (((pvt)->dhar & F10_DHAR_OFFSET_MASK) << 16)
#define DCT_CFG_SEL 0x10C
--
1.7.4.rc2
next prev parent reply other threads:[~2011-02-10 17:15 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-10 17:15 [PATCH 00/30] amd64_edac: Add Bulldozer support Borislav Petkov
2011-02-10 17:15 ` [PATCH 01/30] EDAC: Shut up sysfs registration debug code Borislav Petkov
2011-02-10 17:15 ` [PATCH 02/30] amd64_edac: Add support for F15h DCT PCI config accesses Borislav Petkov
2011-02-10 17:15 ` [PATCH 03/30] amd64_edac: Remove DRAM base/limit subfields caching Borislav Petkov
2011-02-10 17:15 ` Borislav Petkov [this message]
2011-02-10 17:15 ` [PATCH 05/30] amd64_edac: Cleanup chipselect handling Borislav Petkov
2011-03-29 14:56 ` Mauro Carvalho Chehab
2011-03-29 15:16 ` Borislav Petkov
2011-03-29 15:39 ` Mauro Carvalho Chehab
2011-03-29 16:02 ` Borislav Petkov
2011-03-29 17:32 ` Mauro Carvalho Chehab
2011-02-10 17:15 ` [PATCH 06/30] amd64_edac: Sanitize channel extraction Borislav Petkov
2011-02-10 17:15 ` [PATCH 07/30] amd64_edac: Sanitize f10_get_base_addr_offset Borislav Petkov
2011-02-10 17:15 ` [PATCH 08/30] amd64_edac: Replace huge bitmasks with a macro Borislav Petkov
2011-02-10 17:15 ` [PATCH 09/30] amd64_edac: Cleanup DBAM handling Borislav Petkov
2011-02-10 17:15 ` [PATCH 10/30] amd64_edac: Cleanup Dram Configuration registers handling Borislav Petkov
2011-02-10 17:15 ` [PATCH 11/30] amd64_edac: Cleanup DCT Select Low/High code Borislav Petkov
2011-02-10 17:15 ` [PATCH 12/30] amd64_edac: Cleanup NBCTL code Borislav Petkov
2011-02-10 17:15 ` [PATCH 13/30] amd64_edac: Cleanup NBCFG handling Borislav Petkov
2011-02-10 17:15 ` [PATCH 14/30] amd64_edac: Cleanup NBSH cruft Borislav Petkov
2011-02-10 17:15 ` [PATCH 15/30] amd64_edac: Cleanup old defines cruft Borislav Petkov
2011-02-10 17:15 ` [PATCH 16/30] amd64_edac: Adjust channel counting to F15h Borislav Petkov
2011-02-10 17:15 ` [PATCH 17/30] amd64_edac: Simplify decoding path Borislav Petkov
2011-02-10 17:15 ` [PATCH 18/30] amd64_edac: Unify get_error_address Borislav Petkov
2011-02-10 17:15 ` [PATCH 19/30] amd64_edac: Add support for interleaved region swapping Borislav Petkov
2011-02-10 17:15 ` [PATCH 20/30] amd64_edac: Correct node interleaving removal Borislav Petkov
2011-02-10 17:15 ` [PATCH 21/30] amd64_edac: Fix channel interleave removal Borislav Petkov
2011-02-10 17:15 ` [PATCH 22/30] amd64_edac: Revamp online spare handling Borislav Petkov
2011-02-10 17:15 ` [PATCH 23/30] amd64_edac: Beef up early exit reporting Borislav Petkov
2011-02-10 17:15 ` [PATCH 24/30] amd64_edac: Adjust sys_addr to chip select conversion routine to F15h Borislav Petkov
2011-02-10 17:15 ` [PATCH 25/30] amd64_edac: Sanitize ->read_dram_ctl_register Borislav Petkov
2011-02-10 17:15 ` [PATCH 26/30] amd64_edac: Improve DRAM address mapping Borislav Petkov
2011-02-10 17:15 ` [PATCH 27/30] PCI: Rename CPU PCI id define Borislav Petkov
2011-02-10 17:15 ` [PATCH 28/30] amd64_edac: Simplify scrubrate setting Borislav Petkov
2011-02-10 17:15 ` [PATCH 29/30] amd64_edac: Adjust ECC symbol size to F15h Borislav Petkov
2011-02-10 17:15 ` [PATCH 30/30] amd64_edac: Enable driver on F15h Borislav Petkov
2011-02-10 18:56 ` [PATCH 00/30] amd64_edac: Add Bulldozer support Greg KH
2011-02-10 19:20 ` Borislav Petkov
2011-02-10 19:22 ` Jesse Barnes
2011-02-10 21:43 ` Borislav Petkov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1297358133-14320-5-git-send-email-bp@amd64.org \
--to=bp@amd64.org \
--cc=borislav.petkov@amd.com \
--cc=linux-edac@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--subject='Re: [PATCH 04/30] amd64_edac: Cleanup DHAR handling' \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).