OvmfPkg/PlatformBootManagerLib: setup virtio-mmio devices.
Add DetectAndPreparePlatformVirtioDevicePath() helper function to setup virtio-mmio devices. Start with virtio-serial support. This makes virtio console usable with microvm. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Acked-by: Ard Biesheuvel <ardb@kernel.org>
This commit is contained in:
parent
b81557a00c
commit
163083fd80
|
@ -10,6 +10,7 @@
|
||||||
#include <Guid/RootBridgesConnectedEventGroup.h>
|
#include <Guid/RootBridgesConnectedEventGroup.h>
|
||||||
#include <Guid/SerialPortLibVendor.h>
|
#include <Guid/SerialPortLibVendor.h>
|
||||||
#include <Protocol/FirmwareVolume2.h>
|
#include <Protocol/FirmwareVolume2.h>
|
||||||
|
#include <Protocol/VirtioDevice.h>
|
||||||
#include <Library/PlatformBmPrintScLib.h>
|
#include <Library/PlatformBmPrintScLib.h>
|
||||||
#include <Library/Tcg2PhysicalPresenceLib.h>
|
#include <Library/Tcg2PhysicalPresenceLib.h>
|
||||||
#include <Library/XenPlatformLib.h>
|
#include <Library/XenPlatformLib.h>
|
||||||
|
@ -1236,6 +1237,30 @@ DetectAndPreparePlatformPciDevicePath (
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
|
DetectAndPreparePlatformVirtioDevicePath (
|
||||||
|
IN EFI_HANDLE Handle,
|
||||||
|
IN VOID *Instance,
|
||||||
|
IN VOID *Context
|
||||||
|
)
|
||||||
|
{
|
||||||
|
VIRTIO_DEVICE_PROTOCOL *VirtIo = (VIRTIO_DEVICE_PROTOCOL *)Instance;
|
||||||
|
|
||||||
|
DEBUG ((DEBUG_INFO, "%a:%d: id %d\n", __func__, __LINE__, VirtIo->SubSystemDeviceId));
|
||||||
|
|
||||||
|
switch (VirtIo->SubSystemDeviceId) {
|
||||||
|
case 3:
|
||||||
|
PrepareVirtioSerialDevicePath (Handle);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
/* nothing */
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return EFI_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Connect the predefined platform default console device.
|
Connect the predefined platform default console device.
|
||||||
|
|
||||||
|
@ -1256,6 +1281,12 @@ PlatformInitializeConsole (
|
||||||
//
|
//
|
||||||
VisitAllPciInstances (DetectAndPreparePlatformPciDevicePath);
|
VisitAllPciInstances (DetectAndPreparePlatformPciDevicePath);
|
||||||
|
|
||||||
|
VisitAllInstancesOfProtocol (
|
||||||
|
&gVirtioDeviceProtocolGuid,
|
||||||
|
DetectAndPreparePlatformVirtioDevicePath,
|
||||||
|
NULL
|
||||||
|
);
|
||||||
|
|
||||||
PrepareMicrovmDevicePath ();
|
PrepareMicrovmDevicePath ();
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -75,6 +75,7 @@
|
||||||
[Protocols]
|
[Protocols]
|
||||||
gEfiDecompressProtocolGuid
|
gEfiDecompressProtocolGuid
|
||||||
gEfiPciRootBridgeIoProtocolGuid
|
gEfiPciRootBridgeIoProtocolGuid
|
||||||
|
gVirtioDeviceProtocolGuid
|
||||||
gEfiS3SaveStateProtocolGuid # PROTOCOL SOMETIMES_CONSUMED
|
gEfiS3SaveStateProtocolGuid # PROTOCOL SOMETIMES_CONSUMED
|
||||||
gEfiDxeSmmReadyToLockProtocolGuid # PROTOCOL SOMETIMES_PRODUCED
|
gEfiDxeSmmReadyToLockProtocolGuid # PROTOCOL SOMETIMES_PRODUCED
|
||||||
gEfiLoadedImageProtocolGuid # PROTOCOL SOMETIMES_PRODUCED
|
gEfiLoadedImageProtocolGuid # PROTOCOL SOMETIMES_PRODUCED
|
||||||
|
|
Loading…
Reference in New Issue