Skip to content

Commit

Permalink
UefiPayloadPkg/BootManager: Add PS2 keyboard support
Browse files Browse the repository at this point in the history
Add PS2 keyboard support.
REF:https://bugzilla.tianocore.org/show_bug.cgi?id=2316

This patch adds PS2 keyboard support in boot manager, and
add a build flag PS2_KEYBOARD_ENABLE for PS2 keyboard to
build PS2 keyboard driver and SIO driver. Be default the
build flag is not enabled since PS2 keyboard is not common
used. could use -DPS2_KEYBOARD_ENABLE to enable build it
if need this feature.

Signed-off-by: Guo Dong <guo.dong@intel.com>
Reviewed-by: Maurice Ma <maurice.ma@intel.com>
Reviewed-by: Benjamin You <benjamin.you@intel.com>
  • Loading branch information
Dong, Guo authored and mergify[bot] committed Jan 2, 2020
1 parent fd30b00 commit 33a3293
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 5 deletions.
25 changes: 20 additions & 5 deletions UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformConsole.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#define gPnp16550ComPort \
PNPID_DEVICE_PATH_NODE(0x0501)

#define gPnpPs2Keyboard \
PNPID_DEVICE_PATH_NODE(0x0303)

#define gUartVendor \
{ \
{ \
Expand Down Expand Up @@ -87,7 +90,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
DEVICE_PATH_MESSAGING_PC_ANSI \
}


ACPI_HID_DEVICE_PATH gPnpPs2KeyboardDeviceNode = gPnpPs2Keyboard;
ACPI_HID_DEVICE_PATH gPnp16550ComPortDeviceNode = gPnp16550ComPort;
UART_DEVICE_PATH gUartDeviceNode = gUart;
VENDOR_DEVICE_PATH gTerminalTypeDeviceNode = gPcAnsiTerminal;
Expand All @@ -109,12 +112,15 @@ EFI_DEVICE_PATH_PROTOCOL *gPlatformRootBridges[] = {
BOOLEAN mDetectVgaOnly;

/**
Add UART to ConOut, ConIn, ErrOut.
Add IsaKeyboard to ConIn; add IsaSerial to ConOut, ConIn, ErrOut.
@param[in] DeviceHandle - LPC device path.
@param[in] DeviceHandle Handle of the LPC Bridge device.
@retval EFI_SUCCESS - Serial console is added to ConOut, ConIn, and ErrOut.
@retval EFI_STATUS - No serial console is added.
@retval EFI_SUCCESS Console devices on the LPC bridge have been added to
ConOut, ConIn, and ErrOut.
@return Error codes, due to EFI_DEVICE_PATH_PROTOCOL missing
from DeviceHandle.
**/
EFI_STATUS
PrepareLpcBridgeDevicePath (
Expand All @@ -123,6 +129,7 @@ PrepareLpcBridgeDevicePath (
{
EFI_STATUS Status;
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
EFI_DEVICE_PATH_PROTOCOL *TempDevicePath;

DevicePath = NULL;
Status = gBS->HandleProtocol (
Expand All @@ -133,10 +140,18 @@ PrepareLpcBridgeDevicePath (
if (EFI_ERROR (Status)) {
return Status;
}
TempDevicePath = DevicePath;

//
// Register Keyboard
//
DevicePath = AppendDevicePathNode (DevicePath, (EFI_DEVICE_PATH_PROTOCOL *)&gPnpPs2KeyboardDeviceNode);
EfiBootManagerUpdateConsoleVariable (ConIn, DevicePath, NULL);

//
// Register COM1
//
DevicePath = TempDevicePath;
DevicePath = AppendDevicePathNode ((EFI_DEVICE_PATH_PROTOCOL *)NULL, (EFI_DEVICE_PATH_PROTOCOL *)&gUartDeviceVendorNode);
DevicePath = AppendDevicePathNode (DevicePath, (EFI_DEVICE_PATH_PROTOCOL *)&gUartDeviceNode);
DevicePath = AppendDevicePathNode (DevicePath, (EFI_DEVICE_PATH_PROTOCOL *)&gTerminalTypeDeviceNode);
Expand Down
4 changes: 4 additions & 0 deletions UefiPayloadPkg/UefiPayloadPkg.fdf
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,10 @@ INF MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf
# ISA Support
#
INF MdeModulePkg/Universal/SerialDxe/SerialDxe.inf
!if $(PS2_KEYBOARD_ENABLE) == TRUE
INF OvmfPkg/SioBusDxe/SioBusDxe.inf
INF MdeModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2KeyboardDxe.inf
!endif

#
# Console Support
Expand Down
4 changes: 4 additions & 0 deletions UefiPayloadPkg/UefiPayloadPkgIa32.dsc
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,10 @@
# ISA Support
#
MdeModulePkg/Universal/SerialDxe/SerialDxe.inf
!if $(PS2_KEYBOARD_ENABLE) == TRUE
OvmfPkg/SioBusDxe/SioBusDxe.inf
MdeModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2KeyboardDxe.inf
!endif

#
# Console Support
Expand Down
5 changes: 5 additions & 0 deletions UefiPayloadPkg/UefiPayloadPkgIa32X64.dsc
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
FLASH_DEFINITION = UefiPayloadPkg/UefiPayloadPkg.fdf

DEFINE SOURCE_DEBUG_ENABLE = FALSE
DEFINE PS2_KEYBOARD_ENABLE = FALSE

#
# SBL: UEFI payload for Slim Bootloader
Expand Down Expand Up @@ -492,6 +493,10 @@
# ISA Support
#
MdeModulePkg/Universal/SerialDxe/SerialDxe.inf
!if $(PS2_KEYBOARD_ENABLE) == TRUE
OvmfPkg/SioBusDxe/SioBusDxe.inf
MdeModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2KeyboardDxe.inf
!endif

#
# Console Support
Expand Down

0 comments on commit 33a3293

Please sign in to comment.