coreboot-kgpe-d16/src
Duncan Laurie 7389fa945f MTRR: add alternate allocation method for odd memory maps
With >= 4GB memory installed we get a memory map split in the middle
due to remap that has boundaries that are inconveniently aligned for
MTRRs due to the various UMA regions.

0000MB-2780MB  2780MB  RAM     (writeback)
2780MB-2782MB     2MB  TSEG    (uncached/SMRR)
2782MB-2784MB     2MB  GFX GTT (uncached)
2784MB-2816MB    32MB  GFX UMA (uncached)
2816MB-4096MB  1280MB  EMPTY   (N/A)
4096MB-5368MB  1272MB  RAM     (writeback)
5368MB-5376MB     8MB  ME UMA  (uncached)

The default MTRR allocation method of trying to cover everything
with one MTRR and then carve out a single uncached region does
not work for the GPU aperture which needs write-combining type,
and it also has issues trying to cover the uneven boundaries
in the avaiable variable MTRRs.

My goal was to make a minimal set of changes and avoid modifying
behavior on existing systems with an algorithm that is not always
optimal for a typical memory layout.  So the flag 'above4gb=2'
will change these allocation behaviors:

1) Detect the number of available variable MTRRs rather than
limiting to hardcoded value.  We need every last MTRR.

2) Don't try to cover all RAM with one MTRR, instead let each
RAM region get covered independently.

3) Don't assume uma_memory_base is part of the last region
and increase the size of that region.  In this case the UMA
region is carved out from the lower memory region and it is
already declared as part of the ram region.

4) If a memory region can't be covered with MTRRs >= 16MB then
instead make a larger region and trim it with uncached MTRRs.

Change-Id: I5a60a44ab6d3ae2f46ea6ffa9e3677aaad2485eb
Signed-off-by: Duncan Laurie <dlaurie@google.com>
Reviewed-on: http://review.coreboot.org/761
Tested-by: build bot (Jenkins)
Reviewed-by: Ronald G. Minnich <rminnich@gmail.com>
2012-03-30 17:53:39 +02:00
..
arch/x86 Don't re-init EBDA in S3 resume path. 2012-03-30 17:52:11 +02:00
boot Add more timestamps in coreboot. 2012-03-30 17:45:20 +02:00
console Fix typos in src/console/Kconfig 2012-03-29 22:35:12 +02:00
cpu MTRR: add alternate allocation method for odd memory maps 2012-03-30 17:53:39 +02:00
devices Prepare the BIOS data areas before device init. 2012-03-30 17:51:45 +02:00
drivers Detect whether the OXPCIE card is really present while in the ROM stage. 2012-03-29 23:04:06 +02:00
ec X60/T60: Add option to enable/disable bluetooth 2012-01-31 18:03:40 +01:00
include Add more timestamps in coreboot. 2012-03-30 17:45:20 +02:00
lib Add native memset() function on x86 2012-03-30 00:57:24 +02:00
mainboard Add bifferboard 2012-03-27 18:42:31 +02:00
northbridge Add the support for RDC R8610 Northbridge 2012-03-27 18:37:57 +02:00
pc80 vga_io.c is not needed unless CONFIG_VGA is set 2012-03-30 17:49:35 +02:00
southbridge Add support for RDC R8610 Southbridge 2012-03-27 18:39:05 +02:00
superio SIO: Add smsc sio1036 superio 2012-02-17 17:19:34 +01:00
vendorcode Add TPM support to coreboot 2012-03-30 02:04:20 +02:00
Kconfig Add TPM support to coreboot 2012-03-30 02:04:20 +02:00
Kconfig.deprecated_options Unify ID_SECTION_OFFSET and mark it deprecated 2012-01-18 11:21:39 +01:00