Submitter | Uwe Hermann |
---|---|
Date | 2010-10-04 22:57:49 |
Message ID | <20101004225748.GI3256@greenwood> |
Download | mbox | patch |
Permalink | /patch/2037/ |
State | Superseded |
Headers | show |
Comments
> On Mon, Oct 04, 2010 at 01:19:07AM +0200, Peter Stuge wrote: > > Stefan Reinauer wrote: > > > > +config CPU_ADDR_BITS_MASK > > > > > > Such stuff belongs into an include file, not into Kconfig. > > > > Good point! I agree completely if it works in practise. > > Are you guys suggesting something like this? > > Index: src/include/cpu/cpu.h > =================================================================== > --- src/include/cpu/cpu.h (Revision 5909) > +++ src/include/cpu/cpu.h (Arbeitskopie) > @@ -27,4 +27,21 @@ > /** end of compile time generated pci driver array */ > extern struct cpu_driver ecpu_drivers[]; > > +/* > + * Map the number of address space bits supported by the CPU to the > + * mask field value as it needs to be written into the upper 32 bits > + * of the various MTRRphysMask_MSR MSRs. > + */ > +#if defined(CONFIG_CPU_ADDR_BITS) && (CONFIG_CPU_ADDR_BITS == 32) > +#define CONFIG_CPU_ADDR_BITS_MASK 0x00000000 > +#elif defined(CONFIG_CPU_ADDR_BITS) && (CONFIG_CPU_ADDR_BITS == 36) > +#define CONFIG_CPU_ADDR_BITS_MASK 0x0000000f > +#elif defined(CONFIG_CPU_ADDR_BITS) && (CONFIG_CPU_ADDR_BITS == 40) > +#define CONFIG_CPU_ADDR_BITS_MASK 0x000000ff > +#elif defined(CONFIG_CPU_ADDR_BITS) && (CONFIG_CPU_ADDR_BITS == 48) > +#define CONFIG_CPU_ADDR_BITS_MASK 0x0000ffff > +#else > +#error No CPU_ADDR_BITS value was selected or an unknown value was > selected > +#endif > + > #endif /* CPU_CPU_H */ I have no idea what others were envisioning, but I would think something like this would work for me. In a processor-specific file: #define CPU_ADDR_BITS 40 In cpu.h: #define CPU_ADDR_BITS_MASK (0xffff >> (48 - CPU_ADDR_BITS)) or for the future: #define CPU_ADDR_BITS_MASK (0xffffff >> (56 - CPU_ADDR_BITS)) Thanks, Myles
Patch
Index: src/include/cpu/cpu.h =================================================================== --- src/include/cpu/cpu.h (Revision 5909) +++ src/include/cpu/cpu.h (Arbeitskopie) @@ -27,4 +27,21 @@ /** end of compile time generated pci driver array */ extern struct cpu_driver ecpu_drivers[]; +/* + * Map the number of address space bits supported by the CPU to the + * mask field value as it needs to be written into the upper 32 bits + * of the various MTRRphysMask_MSR MSRs. + */ +#if defined(CONFIG_CPU_ADDR_BITS) && (CONFIG_CPU_ADDR_BITS == 32) +#define CONFIG_CPU_ADDR_BITS_MASK 0x00000000 +#elif defined(CONFIG_CPU_ADDR_BITS) && (CONFIG_CPU_ADDR_BITS == 36) +#define CONFIG_CPU_ADDR_BITS_MASK 0x0000000f +#elif defined(CONFIG_CPU_ADDR_BITS) && (CONFIG_CPU_ADDR_BITS == 40) +#define CONFIG_CPU_ADDR_BITS_MASK 0x000000ff +#elif defined(CONFIG_CPU_ADDR_BITS) && (CONFIG_CPU_ADDR_BITS == 48) +#define CONFIG_CPU_ADDR_BITS_MASK 0x0000ffff +#else +#error No CPU_ADDR_BITS value was selected or an unknown value was selected +#endif + #endif /* CPU_CPU_H */