diff options
author | Laszlo Ersek <lersek@redhat.com> | 2018-05-13 00:13:53 +0200 |
---|---|---|
committer | Laszlo Ersek <lersek@redhat.com> | 2018-05-14 15:23:54 +0200 |
commit | f803c03cc2e0b6b0b0bed447a97ea2c61b04ed82 (patch) | |
tree | ae837b9fa464844e390fd7c5b5eb87d0da73f5df /OvmfPkg | |
parent | 989f7a2cf0e27123fda5ca538b15832e115e0f4e (diff) | |
download | edk2-f803c03cc2e0b6b0b0bed447a97ea2c61b04ed82.tar.gz edk2-f803c03cc2e0b6b0b0bed447a97ea2c61b04ed82.tar.bz2 edk2-f803c03cc2e0b6b0b0bed447a97ea2c61b04ed82.zip |
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 245c643cc8b7.
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: 245c643cc8b73240c3b88cb55b2911b285a8c10d
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>
Diffstat (limited to 'OvmfPkg')
-rw-r--r-- | OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c | 127 |
1 files changed, 44 insertions, 83 deletions
diff --git a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c index 862fa6ebb4..004b753f4d 100644 --- a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c +++ b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c @@ -26,7 +26,6 @@ VOID *mEfiDevPathNotifyReg; EFI_EVENT mEfiDevPathEvent;
VOID *mEmuVariableEventReg;
EFI_EVENT mEmuVariableEvent;
-BOOLEAN mDetectVgaOnly;
UINT16 mHostBridgeDevId;
//
@@ -830,35 +829,33 @@ DetectAndPreparePlatformPciDevicePath ( );
ASSERT_EFI_ERROR (Status);
- if (!mDetectVgaOnly) {
+ //
+ // Here we decide whether it is LPC Bridge
+ //
+ if ((IS_PCI_LPC (Pci)) ||
+ ((IS_PCI_ISA_PDECODE (Pci)) &&
+ (Pci->Hdr.VendorId == 0x8086) &&
+ (Pci->Hdr.DeviceId == 0x7000)
+ )
+ ) {
//
- // Here we decide whether it is LPC Bridge
+ // Add IsaKeyboard to ConIn,
+ // add IsaSerial to ConOut, ConIn, ErrOut
//
- if ((IS_PCI_LPC (Pci)) ||
- ((IS_PCI_ISA_PDECODE (Pci)) &&
- (Pci->Hdr.VendorId == 0x8086) &&
- (Pci->Hdr.DeviceId == 0x7000)
- )
- ) {
- //
- // Add IsaKeyboard to ConIn,
- // add IsaSerial to ConOut, ConIn, ErrOut
- //
- DEBUG ((EFI_D_INFO, "Found LPC Bridge device\n"));
- PrepareLpcBridgeDevicePath (Handle);
- return EFI_SUCCESS;
- }
+ DEBUG ((EFI_D_INFO, "Found LPC Bridge device\n"));
+ PrepareLpcBridgeDevicePath (Handle);
+ return EFI_SUCCESS;
+ }
+ //
+ // Here we decide which Serial device to enable in PCI bus
+ //
+ if (IS_PCI_16550SERIAL (Pci)) {
//
- // Here we decide which Serial device to enable in PCI bus
+ // Add them to ConOut, ConIn, ErrOut.
//
- if (IS_PCI_16550SERIAL (Pci)) {
- //
- // Add them to ConOut, ConIn, ErrOut.
- //
- DEBUG ((EFI_D_INFO, "Found PCI 16550 SERIAL device\n"));
- PreparePciSerialDevicePath (Handle);
- return EFI_SUCCESS;
- }
+ DEBUG ((EFI_D_INFO, "Found PCI 16550 SERIAL device\n"));
+ PreparePciSerialDevicePath (Handle);
+ return EFI_SUCCESS;
}
//
@@ -878,26 +875,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.
Always try to find and enable PCI display devices.
@@ -910,50 +887,34 @@ PlatformInitializeConsole ( )
{
UINTN Index;
- EFI_DEVICE_PATH_PROTOCOL *VarConout;
- EFI_DEVICE_PATH_PROTOCOL *VarConin;
//
- // Connect RootBridge
+ // Do platform specific PCI Device check and add them to ConOut, ConIn,
+ // ErrOut
//
- 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,
+ // the platform default console is the minimum device group
+ // the platform should support
+ //
+ for (Index = 0; PlatformConsole[Index].DevicePath != NULL; ++Index) {
//
- // Have chance to connect the platform default console,
- // the platform default console is the minimum device group
- // the platform should support
+ // Update the console variable with the connect type
//
- for (Index = 0; PlatformConsole[Index].DevicePath != NULL; ++Index) {
- //
- // Update the console variable with the connect type
- //
- if ((PlatformConsole[Index].ConnectType & CONSOLE_IN) == CONSOLE_IN) {
- EfiBootManagerUpdateConsoleVariable (ConIn,
- PlatformConsole[Index].DevicePath, NULL);
- }
- if ((PlatformConsole[Index].ConnectType & CONSOLE_OUT) == CONSOLE_OUT) {
- EfiBootManagerUpdateConsoleVariable (ConOut,
- PlatformConsole[Index].DevicePath, NULL);
- }
- if ((PlatformConsole[Index].ConnectType & STD_ERROR) == STD_ERROR) {
- EfiBootManagerUpdateConsoleVariable (ErrOut,
- PlatformConsole[Index].DevicePath, NULL);
- }
+ if ((PlatformConsole[Index].ConnectType & CONSOLE_IN) == CONSOLE_IN) {
+ EfiBootManagerUpdateConsoleVariable (ConIn,
+ PlatformConsole[Index].DevicePath, NULL);
+ }
+ if ((PlatformConsole[Index].ConnectType & CONSOLE_OUT) == CONSOLE_OUT) {
+ EfiBootManagerUpdateConsoleVariable (ConOut,
+ PlatformConsole[Index].DevicePath, NULL);
+ }
+ if ((PlatformConsole[Index].ConnectType & STD_ERROR) == STD_ERROR) {
+ EfiBootManagerUpdateConsoleVariable (ErrOut,
+ PlatformConsole[Index].DevicePath, NULL);
}
- } else {
- //
- // Only detect VGA device and add them to ConOut
- //
- DetectAndPreparePlatformPciDevicePaths (TRUE);
}
}
|