diff options
author | Gerd Hoffmann <kraxel@redhat.com> | 2023-05-04 15:12:01 +0200 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2023-05-04 14:26:58 +0000 |
commit | 4b02045f86d6aac8a617bf3f65f9cb2146630ce3 (patch) | |
tree | 0da218f4a33e9cc509efadda3acc146dbb7d5158 | |
parent | c6c43620513e6a3411e68567f10661ee17d02dd8 (diff) | |
download | edk2-4b02045f86d6aac8a617bf3f65f9cb2146630ce3.tar.gz edk2-4b02045f86d6aac8a617bf3f65f9cb2146630ce3.tar.bz2 edk2-4b02045f86d6aac8a617bf3f65f9cb2146630ce3.zip |
OvmfPkg/PlatformBootManagerLib: setup virtio serial console
In case a virtio-serial device is present in the system register the
first serial port as console.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
-rw-r--r-- | OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c index a90076c9e6..3b7dc53e9f 100644 --- a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c +++ b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c @@ -977,6 +977,45 @@ PreparePciSerialDevicePath ( }
EFI_STATUS
+PrepareVirtioSerialDevicePath (
+ IN EFI_HANDLE DeviceHandle
+ )
+{
+ EFI_STATUS Status;
+ EFI_DEVICE_PATH_PROTOCOL *DevicePath;
+
+ DevicePath = NULL;
+ Status = gBS->HandleProtocol (
+ DeviceHandle,
+ &gEfiDevicePathProtocolGuid,
+ (VOID *)&DevicePath
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ gPnp16550ComPortDeviceNode.UID = 0;
+ DevicePath = AppendDevicePathNode (
+ DevicePath,
+ (EFI_DEVICE_PATH_PROTOCOL *)&gPnp16550ComPortDeviceNode
+ );
+ DevicePath = AppendDevicePathNode (
+ DevicePath,
+ (EFI_DEVICE_PATH_PROTOCOL *)&gUartDeviceNode
+ );
+ DevicePath = AppendDevicePathNode (
+ DevicePath,
+ (EFI_DEVICE_PATH_PROTOCOL *)&gTerminalTypeDeviceNode
+ );
+
+ EfiBootManagerUpdateConsoleVariable (ConOut, DevicePath, NULL);
+ EfiBootManagerUpdateConsoleVariable (ConIn, DevicePath, NULL);
+ EfiBootManagerUpdateConsoleVariable (ErrOut, DevicePath, NULL);
+
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS
VisitAllInstancesOfProtocol (
IN EFI_GUID *Id,
IN PROTOCOL_INSTANCE_CALLBACK CallBackFunction,
@@ -1144,6 +1183,14 @@ DetectAndPreparePlatformPciDevicePath ( return EFI_SUCCESS;
}
+ if (((Pci->Hdr.VendorId == 0x1af4) && (Pci->Hdr.DeviceId == 0x1003)) ||
+ ((Pci->Hdr.VendorId == 0x1af4) && (Pci->Hdr.DeviceId == 0x1043)))
+ {
+ DEBUG ((DEBUG_INFO, "Found virtio serial device\n"));
+ PrepareVirtioSerialDevicePath (Handle);
+ return EFI_SUCCESS;
+ }
+
return Status;
}
|