]> git.proxmox.com Git - mirror_edk2.git/commit
UefiPayloadPkg/UefiPayloadEntry: Improve bootloader memrange parsing
authorPatrick Rudolph <patrick.rudolph@9elements.com>
Mon, 21 Jun 2021 08:09:37 +0000 (01:09 -0700)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Tue, 22 Jun 2021 18:04:36 +0000 (18:04 +0000)
commit1e5e58d39bb18a127e978d6e46a7454430799e57
tree2263acb748e097ee77fa3ed4d46ebb3ca37682f6
parent4dda0f7ab44a206997f9ef026f4e6b25422e455b
UefiPayloadPkg/UefiPayloadEntry: Improve bootloader memrange parsing

Currently several DXE crash due to invalid memory resource settings.
The PciHostBridgeDxe which expects the MMCONF and PCI Aperature
to be EfiMemoryMappedIO, but currently those regions are (partly)
mapped as EfiReservedMemoryType.

coreboot and slimbootloader provide an e820 compatible memory map,
which doesn't work well with EDK2 as the e820 spec is missing MMIO regions.
In e820 'reserved' could either mean "DRAM used by boot firmware" or "MMIO
in use and not detectable by OS".

Guess Top of lower usable DRAM (TOLUD) by walking the bootloader provided
memory ranges. Memory types of RAM, ACPI and ACPI NVS below 4 GiB are used
to increment TOLUD and reserved memory ranges touching TOLUD at the base
are also assumed to be reserved DRAM, which increment TOLUD.

Then mark everything reserved below TOLUD as EfiReservedMemoryType and
everything reserved above TOLUD as EfiMemoryMappedIO.

This fixes assertions seen in PciHostBridgeDxe.

Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
Reviewed-by: Maurice Ma <maurice.ma@intel.com>
Reviewed-by: Guo Dong <guo.dong@intel.com>
UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c
UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h