summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaweł Poławski <ppolawsk@redhat.com>2024-07-29 10:50:55 +0200
committerArd Biesheuvel <workofard@gmail.com>2024-12-29 19:19:59 +0100
commit0eea7b9c025ebf430d3d1e5585ca61c015bb42db (patch)
treee8d9ed1b46b4a85f67e9888efac87ab38ef628f8
parent0986082d7ef68fe63d215af925b22394ac93e544 (diff)
downloadedk2-0eea7b9c025ebf430d3d1e5585ca61c015bb42db.tar.gz
OvmfPkg: Add virtio keyboard device hooks
This commit adds: - missing virtio subsystem ID for input device - PrepareVirtioKeyboardDevicePath() handler to boot manager library Signed-off-by: Paweł Poławski <ppolawsk@redhat.com>
-rw-r--r--OvmfPkg/Include/IndustryStandard/Virtio10.h1
-rw-r--r--OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c28
2 files changed, 29 insertions, 0 deletions
diff --git a/OvmfPkg/Include/IndustryStandard/Virtio10.h b/OvmfPkg/Include/IndustryStandard/Virtio10.h
index c47bcbd41a..c92bd66ca5 100644
--- a/OvmfPkg/Include/IndustryStandard/Virtio10.h
+++ b/OvmfPkg/Include/IndustryStandard/Virtio10.h
@@ -17,6 +17,7 @@
// Subsystem Device IDs (to be) introduced in VirtIo 1.0
//
#define VIRTIO_SUBSYSTEM_GPU_DEVICE 16
+#define VIRTIO_SUBSYSTEM_INPUT 18
//
// Subsystem Device IDs from the VirtIo spec at git commit 87fa6b5d8155;
// <https://github.com/oasis-tcs/virtio-spec/tree/87fa6b5d8155>.
diff --git a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
index 17e3bda967..e66693879d 100644
--- a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
+++ b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
@@ -1112,6 +1112,28 @@ PrepareVirtioSerialDevicePath (
}
EFI_STATUS
+PrepareVirtioKeyboardDevicePath (
+ 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;
+ }
+
+ EfiBootManagerUpdateConsoleVariable (ConIn, DevicePath, NULL);
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS
VisitAllInstancesOfProtocol (
IN EFI_GUID *Id,
IN PROTOCOL_INSTANCE_CALLBACK CallBackFunction,
@@ -1287,6 +1309,12 @@ DetectAndPreparePlatformPciDevicePath (
return EFI_SUCCESS;
}
+ if ((Pci->Hdr.VendorId == 0x1af4) && (Pci->Hdr.DeviceId == 0x1052)) {
+ DEBUG ((DEBUG_INFO, "Found virtio keyboard device\n"));
+ PrepareVirtioKeyboardDevicePath (Handle);
+ return EFI_SUCCESS;
+ }
+
return Status;
}