From patchwork Tue Oct 26 17:05:51 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: Query cpu instead of using CONFIG_CPU_ADDR_BITS on AMD cpus Date: Tue, 26 Oct 2010 17:05:51 -0000 From: Tobias Diedrich X-Patchwork-Id: 2172 Message-Id: <20101026170550.GD17791@yumi.tdiedrich.de> To: coreboot@coreboot.org This fixes a FIXME in src/cpu/amd/mtrr/amd_mtrr.c and shuts up the Linux kernel, which was previously complaining that the MTRR setup is wrong, if the cpu supports more than CONFIG_CPU_ADDR_BITS bits of address space. Shamelessly copied from Linux arch/x86/kernel/cpu/mtrr/main.c Signed-off-by: Tobias Diedrich --- Index: src/cpu/amd/mtrr/amd_mtrr.c =================================================================== --- src/cpu/amd/mtrr/amd_mtrr.c (revision 5985) +++ src/cpu/amd/mtrr/amd_mtrr.c (working copy) @@ -1,5 +1,6 @@ #include #include +#include #include #include #include @@ -175,11 +176,13 @@ enable_cache(); - /* FIXME we should probably query the cpu for this - * but so far this is all any recent AMD cpu has supported. - */ address_bits = CONFIG_CPU_ADDR_BITS; //K8 could be 40, and GH could be 48 + /* AMD specific MSR to query number of address bits */ + if (cpuid_eax(0x80000000) >= 0x80000008) { + address_bits = cpuid_eax(0x80000008) & 0xff; + } + /* Now that I have mapped what is memory and what is not * Setup the mtrrs so we can cache the memory. */