summaryrefslogtreecommitdiffstats
path: root/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h
diff options
context:
space:
mode:
authorPatrick Rudolph <patrick.rudolph@9elements.com>2021-06-21 01:09:37 -0700
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2021-06-22 18:04:36 +0000
commit1e5e58d39bb18a127e978d6e46a7454430799e57 (patch)
tree2263acb748e097ee77fa3ed4d46ebb3ca37682f6 /UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h
parent4dda0f7ab44a206997f9ef026f4e6b25422e455b (diff)
downloadedk2-1e5e58d39bb18a127e978d6e46a7454430799e57.tar.gz
edk2-1e5e58d39bb18a127e978d6e46a7454430799e57.tar.bz2
edk2-1e5e58d39bb18a127e978d6e46a7454430799e57.zip
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>
Diffstat (limited to 'UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h')
-rw-r--r--UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h
index a4c9da128e..5a1b37be16 100644
--- a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h
+++ b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h
@@ -39,6 +39,16 @@
#define GET_OCCUPIED_SIZE(ActualSize, Alignment) \
((ActualSize) + (((Alignment) - ((ActualSize) & ((Alignment) - 1))) & ((Alignment) - 1)))
+
+#define E820_RAM 1
+#define E820_RESERVED 2
+#define E820_ACPI 3
+#define E820_NVS 4
+#define E820_UNUSABLE 5
+#define E820_DISABLED 6
+#define E820_PMEM 7
+#define E820_UNDEFINED 8
+
/**
Auto-generated function that calls the library constructors for all of the module's
dependent libraries.