haswell: resource allocation
commitc12ef9723efac1006307c7fae13e34cb444cee36
authorAaron Durbin <adurbin@chromium.org>
Tue, 18 Dec 2012 20:22:49 +0000 (18 14:22 -0600)
committerStefan Reinauer <stefan.reinauer@coreboot.org>
Fri, 15 Mar 2013 14:24:31 +0000 (15 15:24 +0100)
tree3e8db65dda443509db490c9919bac3a77501871e
parent6f561afa4a635958dedf20ffda9a40c6f5e5699e
haswell: resource allocation

The previous code w.r.t. resource allocation was getting lucky
based on the way fixed mmio resources on the system were being
chosen. Namely, PCIEXBAR was the lowest mmio space and the other
fixed non-standar BARs were above it. The resource allocator would
then start allocating standard BARs below that.

On top of that other resources were being added when
dev_ops->set_resources() was being called on the PCI domain. At that
point the PCI range limit were already picked for where to start
allocating from.

To ensure we no longer get lucky during resource allocation add the
fixed resources in the host bridge and add the memory controller
cacheable memory areas. With those resources added the range limit
for standard PCI BARs is chosen properly.

Depending on haswell board configurations we may need to adjust and
pass in the size of physical address space needed for PCI resources
to the reference code. For the time being the CRBs appear to be OK.

Lastly, remove the SNB workaround for reserving 2MiB at 1GiB and 512MiB.

Output from 6GiB memory configuration:
MC MAP: TOM: 0x140000000
MC MAP: TOUUD: 0x18f600000
MC MAP: MESEG_BASE: 0x13f000000
MC MAP: MESEG_LIMIT: 0x7fff0fffff
MC MAP: REMAP_BASE: 0x13f000000
MC MAP: REMAP_LIMIT: 0x18f5fffff
MC MAP: TOLUD: 0xafa00000
MC MAP: BDSM: 0xada00000
MC MAP: BGSM: 0xad800000
MC MAP: TESGMB: 0xad000000
MC MAP: GGC: 0x209

coreboot memory table:
 0. 0000000000000000-0000000000000fff: CONFIGURATION TABLES
 1. 0000000000001000-000000000009ffff: RAM
 2. 00000000000a0000-00000000000fffff: RESERVED
 3. 0000000000100000-0000000000efffff: RAM
 4. 0000000000f00000-0000000000ffffff: RESERVED
 5. 0000000001000000-00000000acebffff: RAM
 6. 00000000acec0000-00000000acffffff: CONFIGURATION TABLES
 7. 00000000ad000000-00000000af9fffff: RESERVED
 8. 00000000f0000000-00000000f3ffffff: RESERVED
 9. 00000000fed10000-00000000fed17fff: RESERVED
10. 00000000fed18000-00000000fed18fff: RESERVED
11. 00000000fed19000-00000000fed19fff: RESERVED
12. 00000000fed84000-00000000fed84fff: RESERVED
13. 0000000100000000-000000018f5fffff: RAM

e820 map has 11 items:
  0: 0000000000000000 - 000000000009fc00 = 1 RAM
  1: 000000000009fc00 - 00000000000a0000 = 2 RESERVED
  2: 00000000000f0000 - 0000000000100000 = 2 RESERVED
  3: 0000000000100000 - 0000000000f00000 = 1 RAM
  4: 0000000000f00000 - 0000000001000000 = 2 RESERVED
  5: 0000000001000000 - 00000000acec0000 = 1 RAM
  6: 00000000acec0000 - 00000000afa00000 = 2 RESERVED
  7: 00000000f0000000 - 00000000f4000000 = 2 RESERVED
  8: 00000000fed10000 - 00000000fed1a000 = 2 RESERVED
  9: 00000000fed84000 - 00000000fed85000 = 2 RESERVED
  10: 0000000100000000 - 000000018f600000 = 1 RAM

Output from 4GiB memory configuration:
MC MAP: TOM: 0x100000000
MC MAP: TOUUD: 0x14f600000
MC MAP: MESEG_BASE: 0xff000000
MC MAP: MESEG_LIMIT: 0x7fff0fffff
MC MAP: REMAP_BASE: 0x100000000
MC MAP: REMAP_LIMIT: 0x14f5fffff
MC MAP: TOLUD: 0xafa00000
MC MAP: BDSM: 0xada00000
MC MAP: BGSM: 0xad800000
MC MAP: TESGMB: 0xad000000
MC MAP: GGC: 0x209

coreboot memory table:
 0. 0000000000000000-0000000000000fff: CONFIGURATION TABLES
 1. 0000000000001000-000000000009ffff: RAM
 2. 00000000000a0000-00000000000fffff: RESERVED
 3. 0000000000100000-0000000000efffff: RAM
 4. 0000000000f00000-0000000000ffffff: RESERVED
 5. 0000000001000000-00000000acebffff: RAM
 6. 00000000acec0000-00000000acffffff: CONFIGURATION TABLES
 7. 00000000ad000000-00000000af9fffff: RESERVED
 8. 00000000f0000000-00000000f3ffffff: RESERVED
 9. 00000000fed10000-00000000fed17fff: RESERVED
10. 00000000fed18000-00000000fed18fff: RESERVED
11. 00000000fed19000-00000000fed19fff: RESERVED
12. 00000000fed84000-00000000fed84fff: RESERVED
13. 0000000100000000-000000014f5fffff: RAM

e820 map has 11 items:
  0: 0000000000000000 - 000000000009fc00 = 1 RAM
  1: 000000000009fc00 - 00000000000a0000 = 2 RESERVED
  2: 00000000000f0000 - 0000000000100000 = 2 RESERVED
  3: 0000000000100000 - 0000000000f00000 = 1 RAM
  4: 0000000000f00000 - 0000000001000000 = 2 RESERVED
  5: 0000000001000000 - 00000000acec0000 = 1 RAM
  6: 00000000acec0000 - 00000000afa00000 = 2 RESERVED
  7: 00000000f0000000 - 00000000f4000000 = 2 RESERVED
  8: 00000000fed10000 - 00000000fed1a000 = 2 RESERVED
  9: 00000000fed84000 - 00000000fed85000 = 2 RESERVED
  10: 0000000100000000 - 000000014f600000 = 1 RAM

Output from 2GiB memory configuration:
MC MAP: TOM: 0x40000000
MC MAP: TOUUD: 0x100600000
MC MAP: MESEG_BASE: 0x3f000000
MC MAP: MESEG_LIMIT: 0x7fff0fffff
MC MAP: REMAP_BASE: 0x100000000
MC MAP: REMAP_LIMIT: 0x1005fffff
MC MAP: TOLUD: 0x3ea00000
MC MAP: BDSM: 0x3ca00000
MC MAP: BGSM: 0x3c800000
MC MAP: TESGMB: 0x3c000000
MC MAP: GGC: 0x209

coreboot memory table:
 0. 0000000000000000-0000000000000fff: CONFIGURATION TABLES
 1. 0000000000001000-000000000009ffff: RAM
 2. 00000000000a0000-00000000000fffff: RESERVED
 3. 0000000000100000-0000000000efffff: RAM
 4. 0000000000f00000-0000000000ffffff: RESERVED
 5. 0000000001000000-000000003bebffff: RAM
 6. 000000003bec0000-000000003bffffff: CONFIGURATION TABLES
 7. 000000003c000000-000000003e9fffff: RESERVED
 8. 00000000f0000000-00000000f3ffffff: RESERVED
 9. 00000000fed10000-00000000fed17fff: RESERVED
10. 00000000fed18000-00000000fed18fff: RESERVED
11. 00000000fed19000-00000000fed19fff: RESERVED
12. 00000000fed84000-00000000fed84fff: RESERVED
13. 0000000100000000-00000001005fffff: RAM

e820 map has 11 items:
  0: 0000000000000000 - 000000000009fc00 = 1 RAM
  1: 000000000009fc00 - 00000000000a0000 = 2 RESERVED
  2: 00000000000f0000 - 0000000000100000 = 2 RESERVED
  3: 0000000000100000 - 0000000000f00000 = 1 RAM
  4: 0000000000f00000 - 0000000001000000 = 2 RESERVED
  5: 0000000001000000 - 000000003bec0000 = 1 RAM
  6: 000000003bec0000 - 000000003ea00000 = 2 RESERVED
  7: 00000000f0000000 - 00000000f4000000 = 2 RESERVED
  8: 00000000fed10000 - 00000000fed1a000 = 2 RESERVED
  9: 00000000fed84000 - 00000000fed85000 = 2 RESERVED
  10: 0000000100000000 - 0000000100600000 = 1 RAM

Verified through debug messages that range limits as well as
resources were being properly honored.

Change-Id: I2faa7d8a2a34a6a411a2885afb3b5c3fa1ad9c23
Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: http://review.coreboot.org/2687
Reviewed-by: Ronald G. Minnich <rminnich@gmail.com>
Tested-by: build bot (Jenkins)
src/northbridge/intel/haswell/haswell.h
src/northbridge/intel/haswell/northbridge.c