lkml.org 
[lkml]   [2008]   [May]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: 2.6.26, PAT and AMD family 6
On Wed, May 7, 2008 at 3:37 PM, Pavel Machek <pavel@suse.cz> wrote:
> On Wed 2008-05-07 15:22:37, Yinghai Lu wrote:
> > On Wed, May 7, 2008 at 3:14 PM, Pavel Machek <pavel@suse.cz> wrote:
> > > 3) copy&paste code remained in the patch
> >
> > i thought to keep the stub so could add more other stuff in the switch
> > like 64 bit
>
> This is _not_ good enough reason to copy&paste. Just do it like this:
>
>
> > switch (c->x86_vendor) {
> > case X86_VENDOR_AMD:
> > early_init_amd(c);
>
> > break;
> > case X86_VENDOR_INTEL:
> > early_init_intel(c);
>
> > break;
> > case X86_VENDOR_CENTAUR:
> > early_init_centaur(c);
> > break;
> > }
>
> # clear_cpu_cap(c, X86_FEATURE_PAT);
>
> #
> # switch (c->x86_vendor) {
> # case X86_VENDOR_AMD:
> # if (c->x86 >= 0xf && c->x86 <= 0x11)
>
> # set_cpu_cap(c, X86_FEATURE_PAT);
> # break;
> # case X86_VENDOR_INTEL:
> # if (c->x86 == 0xF || (c->x86 == 6 && c->x86_model >= 15))
>
> # set_cpu_cap(c, X86_FEATURE_PAT);
> # break;
> # }
>
> And then, factor out code marked # into separate function, and call it
> from all three places.

still need two copies or ifdef, otherwise you will check some 32bit
only cpu fam/model in 64bit node.

YH


\
 
 \ /
  Last update: 2008-05-08 00:43    [W:0.155 / U:0.328 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site