Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions BaseTools/Source/C/DevicePath/DevicePath.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent

EFI_GUID gEfiDebugPortProtocolGuid = DEVICE_PATH_MESSAGING_DEBUGPORT;
EFI_GUID gEfiPcAnsiGuid = EFI_PC_ANSI_GUID;
EFI_GUID gEfiTtyTermGuid = EFI_TTY_TERM_GUID;
EFI_GUID gEfiVT100Guid = EFI_VT_100_GUID;
EFI_GUID gEfiVT100PlusGuid = EFI_VT_100_PLUS_GUID;
EFI_GUID gEfiVTUTF8Guid = EFI_VT_UTF8_GUID;
Expand Down
25 changes: 25 additions & 0 deletions BaseTools/Source/C/DevicePath/DevicePathFromText.c
Original file line number Diff line number Diff line change
Expand Up @@ -1241,6 +1241,30 @@ DevPathFromTextVenUtf8 (
return (EFI_DEVICE_PATH_PROTOCOL *) Vendor;
}

/**
Converts a text device path node to Vendor defined TtyTerm device path structure.

@param TextDeviceNode The input Text device path node.

@return A pointer to the newly-created Vendor defined TtyTerm device path structure.

**/
EFI_DEVICE_PATH_PROTOCOL *
DevPathFromTextVenTtyTerm (
CHAR16 *TextDeviceNode
)
{
VENDOR_DEVICE_PATH *Vendor;

Vendor = (VENDOR_DEVICE_PATH *) CreateDeviceNode (
MESSAGING_DEVICE_PATH,
MSG_VENDOR_DP,
(UINT16) sizeof (VENDOR_DEVICE_PATH));
CopyGuid (&Vendor->Guid, &gEfiTtyTermGuid);

return (EFI_DEVICE_PATH_PROTOCOL *) Vendor;
}

/**
Converts a text device path node to UART Flow Control device path structure.

Expand Down Expand Up @@ -3335,6 +3359,7 @@ DEVICE_PATH_FROM_TEXT_TABLE mUefiDevicePathLibDevPathFromTextTable[] = {
{L"VenVt100", DevPathFromTextVenVt100 },
{L"VenVt100Plus", DevPathFromTextVenVt100Plus },
{L"VenUtf8", DevPathFromTextVenUtf8 },
{L"VenTtyTerm", DevPathFromTextVenTtyTerm },
{L"UartFlowCtrl", DevPathFromTextUartFlowCtrl },
{L"SAS", DevPathFromTextSAS },
{L"SasEx", DevPathFromTextSasEx },
Expand Down
36 changes: 36 additions & 0 deletions BaseTools/Source/C/Include/Guid/TtyTerm.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/** @file
GUID definition for TtyTerm terminal type. The TtyTerm terminal aims to
provide support for modern *nix terminals.


Copyright (c) 2015 Linaro Ltd.
Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent

**/

#ifndef __TTYTERM_H__
#define __TTYTERM_H__

#define EFI_TTY_TERM_GUID \
{0x7d916d80, 0x5bb1, 0x458c, {0xa4, 0x8f, 0xe2, 0x5f, 0xdd, 0x51, 0xef, 0x94 } }

#define EDKII_LINUX_TERM_GUID \
{0xe4364a7f, 0xf825, 0x430e, {0x9d, 0x3a, 0x9c, 0x9b, 0xe6, 0x81, 0x7c, 0xa5 } }

#define EDKII_XTERM_R6_GUID \
{0xfbfca56b, 0xbb36, 0x4b78, {0xaa, 0xab, 0xbe, 0x1b, 0x97, 0xec, 0x7c, 0xcb } }

#define EDKII_VT400_GUID \
{0x8e46dddd, 0x3d49, 0x4a9d, {0xb8, 0x75, 0x3c, 0x08, 0x6f, 0x6a, 0xa2, 0xbd } }

#define EDKII_SCO_TERM_GUID \
{0xfc7dd6e0, 0x813c, 0x434d, {0xb4, 0xda, 0x3b, 0xd6, 0x49, 0xe9, 0xe1, 0x5a } }

extern EFI_GUID gEfiTtyTermGuid;
extern EFI_GUID gEdkiiLinuxTermGuid;
extern EFI_GUID gEdkiiXtermR6Guid;
extern EFI_GUID gEdkiiVT400Guid;
extern EFI_GUID gEdkiiSCOTermGuid;

#endif
1 change: 1 addition & 0 deletions BaseTools/Source/C/Include/Protocol/DevicePath.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#define __EFI_DEVICE_PATH_H__

#include <Guid/PcAnsi.h>
#include <Guid/TtyTerm.h>
#include <IndustryStandard/Acpi30.h>
#include <IndustryStandard/Bluetooth.h>

Expand Down
6 changes: 5 additions & 1 deletion DasharoPayloadPkg/DasharoPayloadPkg.dsc
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@
DEFINE UART_DEFAULT_PARITY = 1
DEFINE UART_DEFAULT_STOP_BITS = 1
DEFINE DEFAULT_TERMINAL_TYPE = 4


DEFINE FTDI_USB_UART_SUPPORT = FALSE
DEFINE UART_ON_SUPERIO = FALSE

DEFINE BOOT_MENU_KEY = 0x0016
Expand Down Expand Up @@ -865,6 +866,9 @@
MdeModulePkg/Bus/Usb/UsbMouseDxe/UsbMouseDxe.inf
MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassStorageDxe.inf
MdeModulePkg/Bus/Usb/UsbMouseAbsolutePointerDxe/UsbMouseAbsolutePointerDxe.inf
!if $(FTDI_USB_UART_SUPPORT) == TRUE
OptionRomPkg/Bus/Usb/FtdiUsbSerialDxe/FtdiUsbSerialDxe.inf
!endif

#
# ISA Support
Expand Down
3 changes: 3 additions & 0 deletions DasharoPayloadPkg/DasharoPayloadPkg.fdf
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,9 @@ INF MdeModulePkg/Bus/Usb/UsbKbDxe/UsbKbDxe.inf
INF MdeModulePkg/Bus/Usb/UsbMouseDxe/UsbMouseDxe.inf
INF MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassStorageDxe.inf
INF MdeModulePkg/Bus/Usb/UsbMouseAbsolutePointerDxe/UsbMouseAbsolutePointerDxe.inf
!if $(FTDI_USB_UART_SUPPORT) == TRUE
INF OptionRomPkg/Bus/Usb/FtdiUsbSerialDxe/FtdiUsbSerialDxe.inf
!endif

#
# Hash2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -607,6 +607,8 @@ AddOutput (
EFI_DEVICE_PATH_PROTOCOL *DevicePath;

DevicePath = DevicePathFromHandle (Handle);
DEBUG ((DEBUG_INFO, "%a: %s: handle %p: device path found\n",
__FUNCTION__, ReportText, Handle));
if (DevicePath == NULL) {
DEBUG ((EFI_D_ERROR, "%a: %s: handle %p: device path not found\n",
__FUNCTION__, ReportText, Handle));
Expand All @@ -615,7 +617,7 @@ AddOutput (

Status = EfiBootManagerUpdateConsoleVariable (ConOut, DevicePath, NULL);
if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_ERROR, "%a: %s: adding to ConOut: %r\n", __FUNCTION__,
DEBUG ((DEBUG_INFO, "%a: %s: adding to ConOut: %r\n", __FUNCTION__,
ReportText, Status));
return;
}
Expand Down Expand Up @@ -1607,15 +1609,62 @@ PlatformBootManagerAfterConsole (
Enter.UnicodeChar = CHAR_CARRIAGE_RETURN;
EfiBootManagerRegisterContinueKeyOption (0, &Enter, NULL);

if (!mFastBoot || FUMEnabled) {
// FIXME: USB devices are not being detected unless we wait a bit.
// But don't wait with fastboot enabled. We typically don't boot a full blown OS from USB.
gBS->Stall (100 * 1000);
// if (!mFastBoot || FUMEnabled) {
// // FIXME: USB devices are not being detected unless we wait a bit.
// // But don't wait with fastboot enabled. We typically don't boot a full blown OS from USB.
// gBS->Stall (100 * 1000);

// With fast boot, we can't call ConnectAll as it would connect all consoles.
EfiBootManagerConnectAll ();
// // With fast boot, we can't call ConnectAll as it would connect all consoles.
// EfiBootManagerConnectAll ();
// }

gBS->Stall (200 * 1000);
EfiBootManagerConnectAll ();

// ------

EFI_DEVICE_PATH_PROTOCOL *dp;
UINTN Size;
EFI_STATUS dumpStatus;

// Dump ConOut
Size = 0;
Status = gRT->GetVariable(
L"ConOut", &gEfiGlobalVariableGuid,
NULL, &Size, NULL);
if (Status == EFI_BUFFER_TOO_SMALL) {
dp = AllocatePool(Size);
if (dp) {
Status = gRT->GetVariable(
L"ConOut", &gEfiGlobalVariableGuid,
NULL, &Size, dp);
if (!EFI_ERROR(dumpStatus)) {
DEBUG((DEBUG_INFO, "[ConOut] %s\n", ConvertDevicePathToText(dp, TRUE, TRUE)));
}
FreePool(dp);
}
}

// Repeat the same for ConIn
Size = 0;
Status = gRT->GetVariable(
L"ConIn", &gEfiGlobalVariableGuid,
NULL, &Size, NULL);
if (Status == EFI_BUFFER_TOO_SMALL) {
dp = AllocatePool(Size);
if (dp) {
Status = gRT->GetVariable(
L"ConIn", &gEfiGlobalVariableGuid,
NULL, &Size, dp);
if (!EFI_ERROR(dumpStatus)) {
DEBUG((DEBUG_INFO, "[ConIn] %s\n", ConvertDevicePathToText(dp, TRUE, TRUE)));
}
FreePool(dp);
}
}

// ------

EfiBootManagerRefreshAllBootOption ();

//
Expand Down
21 changes: 17 additions & 4 deletions DasharoPayloadPkg/Library/PlatformBootManagerLib/PlatformConsole.c
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,13 @@ RegisterUartConsole (
// Print Device Path
//
DevPathStr = ConvertDevicePathToText (DevicePath, FALSE, FALSE);
DEBUG((
EFI_D_INFO,
"%segistering UART Console: COM%d DevPath: %s\n",
UartEnabled ? L"R" : L"Unr",
UartNumber + 1,
DevPathStr
));
if (DevPathStr != NULL) {
DEBUG((
EFI_D_INFO,
Expand Down Expand Up @@ -303,10 +310,10 @@ UpdatePs2KeyboardConIn (
return;

// Remove the keyboard from ConIn if it was not detected.
if (!DetectPs2Keyboard()) {
DEBUG ((DEBUG_INFO, "PS/2 keyboard not connected\n"));
EfiBootManagerUpdateConsoleVariable (ConIn, NULL, mPs2KbdDevicePath);
}
// if (!DetectPs2Keyboard()) {
// DEBUG ((DEBUG_INFO, "PS/2 keyboard not connected\n"));
// EfiBootManagerUpdateConsoleVariable (ConIn, NULL, mPs2KbdDevicePath);
// }
}

/**
Expand Down Expand Up @@ -464,6 +471,12 @@ PreparePciSerialDevicePath (
// Print Device Path
//
DevPathStr = ConvertDevicePathToText (DevicePath, FALSE, FALSE);
DEBUG((
DEBUG_INFO,
"Setting PCI Serial Console, DevPath: %s\n",
DevPathStr
));

if (DevPathStr != NULL) {
DEBUG((
EFI_D_INFO,
Expand Down
25 changes: 25 additions & 0 deletions MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c
Original file line number Diff line number Diff line change
Expand Up @@ -1411,6 +1411,30 @@ DevPathFromTextVenUtf8 (
return (EFI_DEVICE_PATH_PROTOCOL *)Vendor;
}

/**
Converts a text device path node to Vendor defined TtyTerm device path structure.

@param TextDeviceNode The input Text device path node.

@return A pointer to the newly-created Vendor defined TtyTerm device path structure.

**/
EFI_DEVICE_PATH_PROTOCOL *
DevPathFromTextVenTtyTerm (
CHAR16 *TextDeviceNode
)
{
VENDOR_DEVICE_PATH *Vendor;

Vendor = (VENDOR_DEVICE_PATH *) CreateDeviceNode (
MESSAGING_DEVICE_PATH,
MSG_VENDOR_DP,
(UINT16) sizeof (VENDOR_DEVICE_PATH));
CopyGuid (&Vendor->Guid, &gEfiTtyTermGuid);

return (EFI_DEVICE_PATH_PROTOCOL *) Vendor;
}

/**
Converts a text device path node to UART Flow Control device path structure.

Expand Down Expand Up @@ -3508,6 +3532,7 @@ GLOBAL_REMOVE_IF_UNREFERENCED DEVICE_PATH_FROM_TEXT_TABLE mUefiDevicePathLibDev
{ L"VenVt100", DevPathFromTextVenVt100 },
{ L"VenVt100Plus", DevPathFromTextVenVt100Plus },
{ L"VenUtf8", DevPathFromTextVenUtf8 },
{ L"VenTtyTerm", DevPathFromTextVenTtyTerm },
{ L"UartFlowCtrl", DevPathFromTextUartFlowCtrl },
{ L"SAS", DevPathFromTextSAS },
{ L"SasEx", DevPathFromTextSasEx },
Expand Down
3 changes: 3 additions & 0 deletions MdePkg/Library/UefiDevicePathLib/DevicePathToText.c
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,9 @@ DevPathToTextVendor (
} else if (CompareGuid (&Vendor->Guid, &gEfiVTUTF8Guid)) {
UefiDevicePathLibCatPrint (Str, L"VenUtf8()");
return;
} else if (CompareGuid (&Vendor->Guid, &gEfiTtyTermGuid)) {
UefiDevicePathLibCatPrint (Str, L"TtyTerm()");
return;
} else if (CompareGuid (&Vendor->Guid, &gEfiUartDevicePathGuid)) {
FlowControlMap = (((UART_FLOW_CONTROL_DEVICE_PATH *)Vendor)->FlowControlMap);
switch (FlowControlMap & 0x00000003) {
Expand Down
2 changes: 2 additions & 0 deletions MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@
## SOMETIMES_CONSUMES ## GUID
gEfiPcAnsiGuid
## SOMETIMES_CONSUMES ## GUID
gEfiTtyTermGuid
## SOMETIMES_CONSUMES ## GUID
gEfiUartDevicePathGuid
## SOMETIMES_CONSUMES ## GUID
gEfiSasDevicePathGuid
Expand Down
2 changes: 2 additions & 0 deletions MdePkg/Library/UefiDevicePathLib/UefiDevicePathLibBase.inf
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@
## SOMETIMES_CONSUMES ## GUID
gEfiPcAnsiGuid
## SOMETIMES_CONSUMES ## GUID
gEfiTtyTermGuid
## SOMETIMES_CONSUMES ## GUID
gEfiUartDevicePathGuid
## SOMETIMES_CONSUMES ## GUID
gEfiSasDevicePathGuid
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@
## SOMETIMES_CONSUMES ## GUID
gEfiPcAnsiGuid
## SOMETIMES_CONSUMES ## GUID
gEfiTtyTermGuid
## SOMETIMES_CONSUMES ## GUID
gEfiUartDevicePathGuid
## SOMETIMES_CONSUMES ## GUID
gEfiSasDevicePathGuid
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@
## SOMETIMES_CONSUMES ## GUID
gEfiPcAnsiGuid
## SOMETIMES_CONSUMES ## GUID
gEfiTtyTermGuid
## SOMETIMES_CONSUMES ## GUID
gEfiUartDevicePathGuid
## SOMETIMES_CONSUMES ## GUID
gEfiSasDevicePathGuid
Expand Down
3 changes: 3 additions & 0 deletions MdePkg/MdePkg.dec
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,9 @@
## Include/Guid/PcAnsi.h
gEfiVTUTF8Guid = { 0xAD15A0D6, 0x8BEC, 0x4ACF, { 0xA0, 0x73, 0xD0, 0x1D, 0xE7, 0x7E, 0x2D, 0x88 }}

## Include/Guid/TtyTerm.h
gEfiTtyTermGuid = { 0x7d916d80, 0x5bb1, 0x458c, {0xa4, 0x8f, 0xe2, 0x5f, 0xdd, 0x51, 0xef, 0x94 }}

## Include/Guid/PcAnsi.h
gEfiUartDevicePathGuid = { 0x37499a9d, 0x542f, 0x4c89, { 0xa0, 0x26, 0x35, 0xda, 0x14, 0x20, 0x94, 0xe4 }}

Expand Down