mirror of https://github.com/acidanthera/audk.git
OvmfPkg/Microvm/fdt: load fdt from fw_cfg
Needed for hardware detection: virtio-mmio devices for now, later also pcie root bridge. Depends on patched qemu which actually provides an fdt: https://gitlab.com/kraxel/qemu/-/commits/sirius/microvm-device-tree Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3689 Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
This commit is contained in:
parent
64ef0dd1d3
commit
79dcaf7054
|
@ -321,6 +321,50 @@ PciExBarInitialization (
|
|||
);
|
||||
}
|
||||
|
||||
VOID
|
||||
MicrovmInitialization (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
FIRMWARE_CONFIG_ITEM FdtItem;
|
||||
UINTN FdtSize;
|
||||
UINTN FdtPages;
|
||||
EFI_STATUS Status;
|
||||
UINT64 *FdtHobData;
|
||||
VOID *NewBase;
|
||||
|
||||
Status = QemuFwCfgFindFile ("etc/fdt", &FdtItem, &FdtSize);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_INFO, "%a: no etc/fdt found in fw_cfg\n", __FUNCTION__));
|
||||
return;
|
||||
}
|
||||
|
||||
FdtPages = EFI_SIZE_TO_PAGES (FdtSize);
|
||||
NewBase = AllocatePages (FdtPages);
|
||||
if (NewBase == NULL) {
|
||||
DEBUG ((DEBUG_INFO, "%a: AllocatePages failed\n", __FUNCTION__));
|
||||
return;
|
||||
}
|
||||
|
||||
QemuFwCfgSelectItem (FdtItem);
|
||||
QemuFwCfgReadBytes (FdtSize, NewBase);
|
||||
|
||||
FdtHobData = BuildGuidHob (&gFdtHobGuid, sizeof (*FdtHobData));
|
||||
if (FdtHobData == NULL) {
|
||||
DEBUG ((DEBUG_INFO, "%a: BuildGuidHob failed\n", __FUNCTION__));
|
||||
return;
|
||||
}
|
||||
|
||||
DEBUG ((
|
||||
DEBUG_INFO,
|
||||
"%a: fdt at 0x%x (size %d)\n",
|
||||
__FUNCTION__,
|
||||
NewBase,
|
||||
FdtSize
|
||||
));
|
||||
*FdtHobData = (UINTN)NewBase;
|
||||
}
|
||||
|
||||
VOID
|
||||
MiscInitialization (
|
||||
VOID
|
||||
|
@ -368,6 +412,7 @@ MiscInitialization (
|
|||
break;
|
||||
case 0xffff: /* microvm */
|
||||
DEBUG ((DEBUG_INFO, "%a: microvm\n", __FUNCTION__));
|
||||
MicrovmInitialization ();
|
||||
PcdStatus = PcdSet16S (
|
||||
PcdOvmfHostBridgePciDevId,
|
||||
MICROVM_PSEUDO_DEVICE_ID
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
|
||||
[Guids]
|
||||
gEfiMemoryTypeInformationGuid
|
||||
gFdtHobGuid
|
||||
|
||||
[LibraryClasses]
|
||||
BaseLib
|
||||
|
|
Loading…
Reference in New Issue