[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <BDAE4D65-0E5E-4F35-B651-5332D17BDADC@ludd.ltu.se>
Date: Wed, 9 Nov 2011 21:51:18 +0100
From: Nils Carlson <nils.carlson@...d.ltu.se>
To: Borislav Petkov <bp@...64.org>
Cc: Niklas Söderlund <niklas.soderlund@...csson.com>,
"dougthompson@...ssion.com" <dougthompson@...ssion.com>,
"linux-edac@...r.kernel.org" <linux-edac@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] amd64_edac: fix size decoding error on K8
Hi Borislav,
On Nov 9, 2011, at 9:35 PM, Borislav Petkov wrote:
> Hi Niklas,
>
> On Wed, Nov 09, 2011 at 04:13:37PM +0100, Niklas Söderlund wrote:
>> The decoding table from the documentation:
>>
>> <snip>
>> - It do not consider the out of order values of cs_mode values 4-7:
>> 256, 512, 256, 512.
>
> Agreed, thanks for reporting this. However, I removed the static tables
> at the time because I didn't want to carry unnecessary weight around for
> no reason (tables were static back then). And I know, they're small but
> dead weight like that tends to accumulate.
>
> Your approach is ok with creating the lookup table on the stack but how
> about the following instead - it is much smaller and it is only code,
> no need for stack memory at all. It should give you the proper mapping,
> IINM.
>
I have to say that I much prefer Niklas approach, the code below is difficult
to understand compared to the table, and seeing as the data sheet contains
the table it's much easier for a reader to understand the correspondance.
Cheers,
Nils Carlson
> --
> diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c
> index c9eee6d33e9a..3702f20d784e 100644
> --- a/drivers/edac/amd64_edac.c
> +++ b/drivers/edac/amd64_edac.c
> @@ -1132,12 +1132,12 @@ static int k8_dbam_to_chip_select(struct amd64_pvt *pvt, u8 dct,
> return ddr2_cs_size(cs_mode, dclr & WIDTH_128);
> }
> else if (pvt->ext_model >= K8_REV_D) {
> + unsigned diff;
> WARN_ON(cs_mode > 10);
>
> - if (cs_mode == 3 || cs_mode == 8)
> - return 32 << (cs_mode - 1);
> - else
> - return 32 << cs_mode;
> + diff = cs_mode / 3 + (unsigned)(cs_mode > 5);
> +
> + return 32 << (cs_mode - diff);
> }
> else {
> WARN_ON(cs_mode > 6);
> --
>
> Thanks.
>
> --
> Regards/Gruss,
> Boris.
>
> Advanced Micro Devices GmbH
> Einsteinring 24, 85609 Dornach
> GM: Alberto Bozzo
> Reg: Dornach, Landkreis Muenchen
> HRB Nr. 43632 WEEE Registernr: 129 19551
> --
> To unsubscribe from this list: send the line "unsubscribe linux-edac" in
> the body of a message to majordomo@...r.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists