OvmfPkg/PlatformBootManagerLib: connect consoles unconditionally

If both ConIn and ConOut exist, but ConIn references none of the PS/2
keyboard, the USB wild-card keyboard, and any serial ports, then
PlatformInitializeConsole() currently allows the boot to proceed without
any input devices at all. This makes for a bad user experience -- the
firmware menu could only be entered through OsIndications, set by a guest
OS.

Do what ArmVirtQemu does already, namely connect the consoles, and add
them to ConIn / ConOut / ErrOut, unconditionally. (The underlying
EfiBootManagerUpdateConsoleVariable() function checks for duplicates.)

The issue used to be masked by the EfiBootManagerConnectAll() call that
got conditionalized in commit 245c643cc8.

This patch is best viewed with "git show -b -W".

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Fixes: 245c643cc8
Ref: https://bugzilla.redhat.com/show_bug.cgi?id=1577546
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
This commit is contained in:
Laszlo Ersek 2018-05-13 00:13:53 +02:00
parent 989f7a2cf0
commit f803c03cc2
1 changed files with 44 additions and 83 deletions

View File

@ -26,7 +26,6 @@ VOID *mEfiDevPathNotifyReg;
EFI_EVENT mEfiDevPathEvent;
VOID *mEmuVariableEventReg;
EFI_EVENT mEmuVariableEvent;
BOOLEAN mDetectVgaOnly;
UINT16 mHostBridgeDevId;
//
@ -830,7 +829,6 @@ DetectAndPreparePlatformPciDevicePath (
);
ASSERT_EFI_ERROR (Status);
if (!mDetectVgaOnly) {
//
// Here we decide whether it is LPC Bridge
//
@ -859,7 +857,6 @@ DetectAndPreparePlatformPciDevicePath (
PreparePciSerialDevicePath (Handle);
return EFI_SUCCESS;
}
}
//
// Here we decide which display device to enable in PCI bus
@ -877,26 +874,6 @@ DetectAndPreparePlatformPciDevicePath (
}
/**
Do platform specific PCI Device check and add them to ConOut, ConIn, ErrOut
@param[in] DetectVgaOnly - Only detect VGA device if it's TRUE.
@retval EFI_SUCCESS - PCI Device check and Console variable update
successfully.
@retval EFI_STATUS - PCI Device check or Console variable update fail.
**/
EFI_STATUS
DetectAndPreparePlatformPciDevicePaths (
BOOLEAN DetectVgaOnly
)
{
mDetectVgaOnly = DetectVgaOnly;
return VisitAllPciInstances (DetectAndPreparePlatformPciDevicePath);
}
/**
Connect the predefined platform default console device.
@ -910,22 +887,12 @@ PlatformInitializeConsole (
)
{
UINTN Index;
EFI_DEVICE_PATH_PROTOCOL *VarConout;
EFI_DEVICE_PATH_PROTOCOL *VarConin;
//
// Connect RootBridge
//
GetEfiGlobalVariable2 (EFI_CON_OUT_VARIABLE_NAME, (VOID **) &VarConout,
NULL);
GetEfiGlobalVariable2 (EFI_CON_IN_VARIABLE_NAME, (VOID **) &VarConin, NULL);
if (VarConout == NULL || VarConin == NULL) {
//
// Do platform specific PCI Device check and add them to ConOut, ConIn,
// ErrOut
//
DetectAndPreparePlatformPciDevicePaths (FALSE);
VisitAllPciInstances (DetectAndPreparePlatformPciDevicePath);
//
// Have chance to connect the platform default console,
@ -949,12 +916,6 @@ PlatformInitializeConsole (
PlatformConsole[Index].DevicePath, NULL);
}
}
} else {
//
// Only detect VGA device and add them to ConOut
//
DetectAndPreparePlatformPciDevicePaths (TRUE);
}
}