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 <kraxel@redhat.com>
This commit is contained in:
Gerd Hoffmann 2022-12-07 06:32:15 +01:00 committed by mergify[bot]
parent 16acacf24c
commit bf65d7ee88
1 changed files with 16 additions and 0 deletions

View File

@ -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
);
}
}
}