From bf65d7ee8842a93116534f727abcad235dd3e233 Mon Sep 17 00:00:00 2001 From: Gerd Hoffmann Date: Wed, 7 Dec 2022 06:32:15 +0100 Subject: OvmfPkg/PlatformInitLib: pass through reservations from qemu qemu uses the etc/e820 fw_cfg file not only for memory, but also for reservations. Handle reservations by adding resource descriptor hobs for them. A typical qemu configuration has a small reservation between lapic and flash: # sudo cat /proc/iomem [ ... ] fee00000-fee00fff : Local APIC feffc000-feffffff : Reserved <= HERE ffc00000-ffffffff : Reserved [ ... ] Signed-off-by: Gerd Hoffmann --- OvmfPkg/Library/PlatformInitLib/MemDetect.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'OvmfPkg') diff --git a/OvmfPkg/Library/PlatformInitLib/MemDetect.c b/OvmfPkg/Library/PlatformInitLib/MemDetect.c index 6dbdbf9..0c49568 100644 --- a/OvmfPkg/Library/PlatformInitLib/MemDetect.c +++ b/OvmfPkg/Library/PlatformInitLib/MemDetect.c @@ -229,6 +229,22 @@ PlatformScanOrAdd64BitE820Ram ( )); } } + } else if (E820Entry.Type == EfiAcpiAddressRangeReserved) { + if (AddHighHob) { + DEBUG (( + DEBUG_INFO, + "%a: Reserved: Base=0x%Lx Length=0x%Lx\n", + __FUNCTION__, + E820Entry.BaseAddr, + E820Entry.Length + )); + BuildResourceDescriptorHob ( + EFI_RESOURCE_MEMORY_RESERVED, + 0, + E820Entry.BaseAddr, + E820Entry.Length + ); + } } } -- cgit v1.1