[coreboot] [PATCH] Streamline CPU_ADDR_BITS usage
mylesgw at gmail.com
Tue Oct 5 02:03:30 CEST 2010
> 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
> +#error No CPU_ADDR_BITS value was selected or an unknown value was
> #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
#define CPU_ADDR_BITS_MASK (0xffff >> (48 - CPU_ADDR_BITS))
or for the future:
#define CPU_ADDR_BITS_MASK (0xffffff >> (56 - CPU_ADDR_BITS))
More information about the coreboot