MTRR: get physical address size from CPUID
The current code uses static values for the physical address size supported by a CPU. This isn't always the right value: I.e. on model_6[ef]x Core (2) Duo CPUs physical address size is 36, while Xeons from the same family have 38 bits, which results in invalid MTRR setup. Fix this by getting the right number from CPUID. Change-Id: If019c3d9147c3b86357f0ef0d9fda94d49d811ca Signed-off-by: Sven Schnelle <svens@stackframe.org> Reviewed-on: http://review.coreboot.org/529 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
This commit is contained in:
@@ -108,6 +108,8 @@ static inline unsigned int cpuid_edx(unsigned int op)
|
||||
#if !defined(__PRE_RAM__)
|
||||
#include <device/device.h>
|
||||
|
||||
int cpu_phys_address_size(void);
|
||||
|
||||
struct cpu_device_id {
|
||||
unsigned vendor;
|
||||
unsigned device;
|
||||
|
@@ -131,6 +131,26 @@ static const char *cpu_vendor_name(int vendor)
|
||||
return name;
|
||||
}
|
||||
|
||||
static int cpu_cpuid_extended_level(void)
|
||||
{
|
||||
return cpuid_eax(0x80000000);
|
||||
}
|
||||
|
||||
#define CPUID_FEATURE_PAE (1 << 6)
|
||||
#define CPUID_FEATURE_PSE36 (1 << 17)
|
||||
|
||||
int cpu_phys_address_size(void)
|
||||
{
|
||||
if (!(have_cpuid_p()))
|
||||
return 32;
|
||||
|
||||
if (cpu_cpuid_extended_level() > 0x80000008)
|
||||
return cpuid_eax(0x80000008) & 0xff;
|
||||
|
||||
if (cpuid_eax(1) & (CPUID_FEATURE_PAE | CPUID_FEATURE_PSE36))
|
||||
return 36;
|
||||
return 32;
|
||||
}
|
||||
static void identify_cpu(struct device *cpu)
|
||||
{
|
||||
char vendor_name[16];
|
||||
|
Reference in New Issue
Block a user