From: Borislav Petkov <borislav.petkov@amd.com>
To: <torvalds@linux-foundation.org>
Cc: <norsk5@yahoo.com>, <linux-kernel@vger.kernel.org>,
<x86@kernel.org>, Wan Wei <onewayforever@gmail.com>,
Wan Wei <wanwei@mail.dawning.com.cn>,
Borislav Petkov <borislav.petkov@amd.com>
Subject: [PATCH 4/5] amd64_edac: Rewrite unganged mode code of f10_early_channel_count
Date: Wed, 16 Sep 2009 15:50:49 +0200 [thread overview]
Message-ID: <1253109050-31165-5-git-send-email-borislav.petkov@amd.com> (raw)
In-Reply-To: <1253109050-31165-1-git-send-email-borislav.petkov@amd.com>
From: Wan Wei <onewayforever@gmail.com>
Simplify the procedure by checking if there is any DIMM in each channel.
This patch will fix the bugs such as when there is no DIMMs under
certain node, two DIMMs in the same channel, and only one DIMM in each
channel of the node.
Borislav: minor fixups
Signed-off-by: Wan Wei <wanwei@mail.dawning.com.cn>
Signed-off-by: Borislav Petkov <borislav.petkov@amd.com>
---
drivers/edac/amd64_edac.c | 45 ++++++++++-----------------------------------
1 files changed, 10 insertions(+), 35 deletions(-)
diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c
index bde3d02..f943ad8 100644
--- a/drivers/edac/amd64_edac.c
+++ b/drivers/edac/amd64_edac.c
@@ -1255,7 +1255,9 @@ static int k8_dbam_map_to_pages(struct amd64_pvt *pvt, int dram_map)
*/
static int f10_early_channel_count(struct amd64_pvt *pvt)
{
+ int dbams[] = { DBAM0, DBAM1 };
int err = 0, channels = 0;
+ int i, j;
u32 dbam;
err = pci_read_config_dword(pvt->dram_f2_ctl, F10_DCLR_0, &pvt->dclr0);
@@ -1288,46 +1290,19 @@ static int f10_early_channel_count(struct amd64_pvt *pvt)
* is more than just one DIMM present in unganged mode. Need to check
* both controllers since DIMMs can be placed in either one.
*/
- channels = 0;
- err = pci_read_config_dword(pvt->dram_f2_ctl, DBAM0, &dbam);
- if (err)
- goto err_reg;
-
- if (DBAM_DIMM(0, dbam) > 0)
- channels++;
- if (DBAM_DIMM(1, dbam) > 0)
- channels++;
- if (DBAM_DIMM(2, dbam) > 0)
- channels++;
- if (DBAM_DIMM(3, dbam) > 0)
- channels++;
-
- /* If more than 2 DIMMs are present, then we have 2 channels */
- if (channels > 2)
- channels = 2;
- else if (channels == 0) {
- /* No DIMMs on DCT0, so look at DCT1 */
- err = pci_read_config_dword(pvt->dram_f2_ctl, DBAM1, &dbam);
+ for (i = 0; i < ARRAY_SIZE(dbams); i++) {
+ err = pci_read_config_dword(pvt->dram_f2_ctl, dbams[i], &dbam);
if (err)
goto err_reg;
- if (DBAM_DIMM(0, dbam) > 0)
- channels++;
- if (DBAM_DIMM(1, dbam) > 0)
- channels++;
- if (DBAM_DIMM(2, dbam) > 0)
- channels++;
- if (DBAM_DIMM(3, dbam) > 0)
- channels++;
-
- if (channels > 2)
- channels = 2;
+ for (j = 0; j < 4; j++) {
+ if (DBAM_DIMM(j, dbam) > 0) {
+ channels++;
+ break;
+ }
+ }
}
- /* If we found ALL 0 values, then assume just ONE DIMM-ONE Channel */
- if (channels == 0)
- channels = 1;
-
debugf0("MCT channel count: %d\n", channels);
return channels;
--
1.6.3.3
next prev parent reply other threads:[~2009-09-16 13:51 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-16 13:50 [GIT PULL] AMD64 EDAC updates, p2 Borislav Petkov
2009-09-16 13:50 ` [PATCH 1/5] amd64_edac: build driver only on AMD hardware Borislav Petkov
2009-09-16 13:50 ` [PATCH 2/5] x86, EDAC: Provide function to return NodeId of a CPU Borislav Petkov
2009-09-16 13:50 ` [PATCH 3/5] amd64_edac: cleanup amd64_check_ecc_enabled Borislav Petkov
2009-09-16 13:50 ` Borislav Petkov [this message]
2009-09-16 13:50 ` [PATCH 5/5] amd64_edac: check NB MCE bank enable on the current node properly 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=1253109050-31165-5-git-send-email-borislav.petkov@amd.com \
--to=borislav.petkov@amd.com \
--cc=linux-kernel@vger.kernel.org \
--cc=norsk5@yahoo.com \
--cc=onewayforever@gmail.com \
--cc=torvalds@linux-foundation.org \
--cc=wanwei@mail.dawning.com.cn \
--cc=x86@kernel.org \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®