OvmfPkg/PlatformBootManagerLib: add USB keyboard to ConIn
[mirror_edk2.git] / OvmfPkg / Library / PlatformBootManagerLib / PlatformData.c
index 82f294577ecf41f50458432d6e220381a8f710ad..a50cd7bcaf903f19fc6b53a74092e2301f745f6d 100644 (file)
@@ -27,6 +27,16 @@ typedef struct {
 } VENDOR_UART_DEVICE_PATH;\r
 #pragma pack()\r
 \r
+//\r
+// USB Keyboard Device Path structure\r
+//\r
+#pragma pack (1)\r
+typedef struct {\r
+  USB_CLASS_DEVICE_PATH    Keyboard;\r
+  EFI_DEVICE_PATH_PROTOCOL End;\r
+} USB_KEYBOARD_DEVICE_PATH;\r
+#pragma pack ()\r
+\r
 ACPI_HID_DEVICE_PATH       gPnpPs2KeyboardDeviceNode  = gPnpPs2Keyboard;\r
 ACPI_HID_DEVICE_PATH       gPnp16550ComPortDeviceNode = gPnp16550ComPort;\r
 UART_DEVICE_PATH           gUartDeviceNode            = gUart;\r
@@ -71,6 +81,24 @@ VENDOR_UART_DEVICE_PATH gDebugAgentUartDevicePath = {
   gEndEntire\r
 };\r
 \r
+STATIC USB_KEYBOARD_DEVICE_PATH gUsbKeyboardDevicePath = {\r
+  {\r
+    {\r
+      MESSAGING_DEVICE_PATH,\r
+      MSG_USB_CLASS_DP,\r
+      {\r
+        (UINT8)sizeof (USB_CLASS_DEVICE_PATH),\r
+        (UINT8)(sizeof (USB_CLASS_DEVICE_PATH) >> 8)\r
+      }\r
+    },\r
+    0xFFFF, // VendorId: any\r
+    0xFFFF, // ProductId: any\r
+    3,      // DeviceClass: HID\r
+    1,      // DeviceSubClass: boot\r
+    1       // DeviceProtocol: keyboard\r
+  },\r
+  gEndEntire\r
+};\r
 \r
 //\r
 // Predefined platform default console device path\r
@@ -80,6 +108,10 @@ PLATFORM_CONSOLE_CONNECT_ENTRY   gPlatformConsole[] = {
     (EFI_DEVICE_PATH_PROTOCOL *) &gDebugAgentUartDevicePath,\r
     (CONSOLE_OUT | CONSOLE_IN | STD_ERROR)\r
   },\r
+  {\r
+    (EFI_DEVICE_PATH_PROTOCOL *)&gUsbKeyboardDevicePath,\r
+    CONSOLE_IN\r
+  },\r
   {\r
     NULL,\r
     0\r