audk/OvmfPkg/PlatformPei
Laszlo Ersek 49edde1523 OvmfPkg/PlatformPei: set 32-bit UC area at PciBase / PciExBarBase (pc/q35)
(This is a replacement for commit 39b9a5ffe6 ("OvmfPkg/PlatformPei: fix
MTRR for low-RAM sizes that have many bits clear", 2019-05-16).)

Reintroduce the same logic as seen in commit 39b9a5ffe6 for the pc
(i440fx) board type.

For q35, the same approach doesn't work any longer, given that (a) we'd
like to keep the PCIEXBAR in the platform DSC a fixed-at-build PCD, and
(b) QEMU expects the PCIEXBAR to reside at a lower address than the 32-bit
PCI MMIO aperture.

Therefore, introduce a helper function for determining the 32-bit
"uncacheable" (MMIO) area base address:

- On q35, this function behaves statically. Furthermore, the MTRR setup
  exploits that the range [0xB000_0000, 0xFFFF_FFFF] can be marked UC with
  just two variable MTRRs (one at 0xB000_0000 (size 256MB), another at
  0xC000_0000 (size 1GB)).

- On pc (i440fx), the function behaves dynamically, implementing the same
  logic as commit 39b9a5ffe6 did. The PciBase value is adjusted to the
  value calculated, similarly to commit 39b9a5ffe6. A further
  simplification is that we show that the UC32 area size truncation to a
  whole power of two automatically guarantees a >=2GB base address.

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1859
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
2019-06-03 19:54:34 +02:00
..
AmdSev.c OvmfPkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:19 -07:00
ClearCache.c OvmfPkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:19 -07:00
Cmos.c OvmfPkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:19 -07:00
Cmos.h OvmfPkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:19 -07:00
FeatureControl.c OvmfPkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:19 -07:00
Fv.c OvmfPkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:19 -07:00
MemDetect.c OvmfPkg/PlatformPei: set 32-bit UC area at PciBase / PciExBarBase (pc/q35) 2019-06-03 19:54:34 +02:00
Platform.c OvmfPkg/PlatformPei: set 32-bit UC area at PciBase / PciExBarBase (pc/q35) 2019-06-03 19:54:34 +02:00
Platform.h OvmfPkg/PlatformPei: set 32-bit UC area at PciBase / PciExBarBase (pc/q35) 2019-06-03 19:54:34 +02:00
PlatformPei.inf OvmfPkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:19 -07:00
Xen.c OvmfPkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:19 -07:00
Xen.h OvmfPkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:19 -07:00