public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] OvmfPkg/PlatformBootManagerLib: add USB keyboard to ConIn
@ 2018-04-15 21:15 Laszlo Ersek
  2018-04-16  5:41 ` Ard Biesheuvel
  0 siblings, 1 reply; 3+ messages in thread
From: Laszlo Ersek @ 2018-04-15 21:15 UTC (permalink / raw)
  To: edk2-devel; +Cc: Ard Biesheuvel, Jordan Justen

PlatformInitializeConsole() (called by PlatformBootManagerBeforeConsole())
adds elements of "gPlatformConsole" to ConIn / ConOut / ErrOut (as
requested per element) if at boot at least one of ConIn and ConOut doesn't
exist. This typically applies to new VMs, and VMs with freshly recreated
varstores.

Add a USB keyboard wildcard to ConIn via "gPlatformConsole", so that we
not only bind the PS/2 keyboard. (The PS/2 keyboard is added in
PrepareLpcBridgeDevicePath()). Explicitly connecting the USB keyboard is
necessary after commit 245c643cc8b7.

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
---

Notes:
    Repo:   https://github.com/lersek/edk2.git
    Branch: ovmf_usb_kbd_con

 OvmfPkg/Library/PlatformBootManagerLib/PlatformData.c | 32 ++++++++++++++++++++
 1 file changed, 32 insertions(+)

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



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] OvmfPkg/PlatformBootManagerLib: add USB keyboard to ConIn
  2018-04-15 21:15 [PATCH] OvmfPkg/PlatformBootManagerLib: add USB keyboard to ConIn Laszlo Ersek
@ 2018-04-16  5:41 ` Ard Biesheuvel
  2018-04-16 19:48   ` Laszlo Ersek
  0 siblings, 1 reply; 3+ messages in thread
From: Ard Biesheuvel @ 2018-04-16  5:41 UTC (permalink / raw)
  To: Laszlo Ersek; +Cc: edk2-devel@lists.01.org, Jordan Justen

On 15 April 2018 at 23:15, Laszlo Ersek <lersek@redhat.com> wrote:
> PlatformInitializeConsole() (called by PlatformBootManagerBeforeConsole())
> adds elements of "gPlatformConsole" to ConIn / ConOut / ErrOut (as
> requested per element) if at boot at least one of ConIn and ConOut doesn't
> exist. This typically applies to new VMs, and VMs with freshly recreated
> varstores.
>
> Add a USB keyboard wildcard to ConIn via "gPlatformConsole", so that we
> not only bind the PS/2 keyboard. (The PS/2 keyboard is added in
> PrepareLpcBridgeDevicePath()). Explicitly connecting the USB keyboard is
> necessary after commit 245c643cc8b7.
>
> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> Cc: Jordan Justen <jordan.l.justen@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Laszlo Ersek <lersek@redhat.com>

Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

> ---
>
> Notes:
>     Repo:   https://github.com/lersek/edk2.git
>     Branch: ovmf_usb_kbd_con
>
>  OvmfPkg/Library/PlatformBootManagerLib/PlatformData.c | 32 ++++++++++++++++++++
>  1 file changed, 32 insertions(+)
>
> diff --git a/OvmfPkg/Library/PlatformBootManagerLib/PlatformData.c b/OvmfPkg/Library/PlatformBootManagerLib/PlatformData.c
> index 82f294577ecf..a50cd7bcaf90 100644
> --- a/OvmfPkg/Library/PlatformBootManagerLib/PlatformData.c
> +++ b/OvmfPkg/Library/PlatformBootManagerLib/PlatformData.c
> @@ -27,6 +27,16 @@ typedef struct {
>  } VENDOR_UART_DEVICE_PATH;
>  #pragma pack()
>
> +//
> +// USB Keyboard Device Path structure
> +//
> +#pragma pack (1)
> +typedef struct {
> +  USB_CLASS_DEVICE_PATH    Keyboard;
> +  EFI_DEVICE_PATH_PROTOCOL End;
> +} USB_KEYBOARD_DEVICE_PATH;
> +#pragma pack ()
> +
>  ACPI_HID_DEVICE_PATH       gPnpPs2KeyboardDeviceNode  = gPnpPs2Keyboard;
>  ACPI_HID_DEVICE_PATH       gPnp16550ComPortDeviceNode = gPnp16550ComPort;
>  UART_DEVICE_PATH           gUartDeviceNode            = gUart;
> @@ -71,6 +81,24 @@ VENDOR_UART_DEVICE_PATH gDebugAgentUartDevicePath = {
>    gEndEntire
>  };
>
> +STATIC USB_KEYBOARD_DEVICE_PATH gUsbKeyboardDevicePath = {
> +  {
> +    {
> +      MESSAGING_DEVICE_PATH,
> +      MSG_USB_CLASS_DP,
> +      {
> +        (UINT8)sizeof (USB_CLASS_DEVICE_PATH),
> +        (UINT8)(sizeof (USB_CLASS_DEVICE_PATH) >> 8)
> +      }
> +    },
> +    0xFFFF, // VendorId: any
> +    0xFFFF, // ProductId: any
> +    3,      // DeviceClass: HID
> +    1,      // DeviceSubClass: boot
> +    1       // DeviceProtocol: keyboard
> +  },
> +  gEndEntire
> +};
>
>  //
>  // Predefined platform default console device path
> @@ -80,6 +108,10 @@ PLATFORM_CONSOLE_CONNECT_ENTRY   gPlatformConsole[] = {
>      (EFI_DEVICE_PATH_PROTOCOL *) &gDebugAgentUartDevicePath,
>      (CONSOLE_OUT | CONSOLE_IN | STD_ERROR)
>    },
> +  {
> +    (EFI_DEVICE_PATH_PROTOCOL *)&gUsbKeyboardDevicePath,
> +    CONSOLE_IN
> +  },
>    {
>      NULL,
>      0
> --
> 2.14.1.3.gb7cf6e02401b
>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] OvmfPkg/PlatformBootManagerLib: add USB keyboard to ConIn
  2018-04-16  5:41 ` Ard Biesheuvel
@ 2018-04-16 19:48   ` Laszlo Ersek
  0 siblings, 0 replies; 3+ messages in thread
From: Laszlo Ersek @ 2018-04-16 19:48 UTC (permalink / raw)
  To: Ard Biesheuvel; +Cc: Jordan Justen, edk2-devel@lists.01.org

On 04/16/18 07:41, Ard Biesheuvel wrote:
> On 15 April 2018 at 23:15, Laszlo Ersek <lersek@redhat.com> wrote:
>> PlatformInitializeConsole() (called by PlatformBootManagerBeforeConsole())
>> adds elements of "gPlatformConsole" to ConIn / ConOut / ErrOut (as
>> requested per element) if at boot at least one of ConIn and ConOut doesn't
>> exist. This typically applies to new VMs, and VMs with freshly recreated
>> varstores.
>>
>> Add a USB keyboard wildcard to ConIn via "gPlatformConsole", so that we
>> not only bind the PS/2 keyboard. (The PS/2 keyboard is added in
>> PrepareLpcBridgeDevicePath()). Explicitly connecting the USB keyboard is
>> necessary after commit 245c643cc8b7.
>>
>> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
>> Cc: Jordan Justen <jordan.l.justen@intel.com>
>> Contributed-under: TianoCore Contribution Agreement 1.1
>> Signed-off-by: Laszlo Ersek <lersek@redhat.com>
> 
> Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

Thanks Ard, commit 5e0e476a9542.

Laszlo


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-04-16 19:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-04-15 21:15 [PATCH] OvmfPkg/PlatformBootManagerLib: add USB keyboard to ConIn Laszlo Ersek
2018-04-16  5:41 ` Ard Biesheuvel
2018-04-16 19:48   ` Laszlo Ersek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox