Author: ruik Date: Tue Nov 9 23:31:11 2010 New Revision: 6052 URL: https://tracker.coreboot.org/trac/coreboot/changeset/6052
Log: 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 ranma+coreboot@tdiedrich.de Acked-by: Scott Duplichan scott@notabs.org
Modified: trunk/src/cpu/amd/mtrr/amd_mtrr.c
Modified: trunk/src/cpu/amd/mtrr/amd_mtrr.c ============================================================================== --- trunk/src/cpu/amd/mtrr/amd_mtrr.c Tue Nov 9 23:18:28 2010 (r6051) +++ trunk/src/cpu/amd/mtrr/amd_mtrr.c Tue Nov 9 23:31:11 2010 (r6052) @@ -1,5 +1,6 @@ #include <console/console.h> #include <device/device.h> +#include <arch/cpu.h> #include <cpu/x86/mtrr.h> #include <cpu/amd/mtrr.h> #include <cpu/x86/cache.h> @@ -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 cpuid function 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. */