|
|
bdb79c |
From 3e05bfc48cd7b2cf4c1cbfc1d0cd2572338fad1e Mon Sep 17 00:00:00 2001
|
|
|
bdb79c |
From: Laszlo Ersek <lersek@redhat.com>
|
|
|
bdb79c |
Date: Tue, 15 May 2018 12:40:05 +0200
|
|
|
bdb79c |
Subject: [PATCH 1/5] OvmfPkg/PlatformBootManagerLib: connect consoles
|
|
|
bdb79c |
unconditionally
|
|
|
bdb79c |
|
|
|
bdb79c |
Message-id: <20180515104005.12265-2-lersek@redhat.com>
|
|
|
bdb79c |
Patchwork-id: 80268
|
|
|
bdb79c |
O-Subject: [RHEL-7.6 ovmf PATCH 1/1] OvmfPkg/PlatformBootManagerLib: connect
|
|
|
bdb79c |
consoles unconditionally
|
|
|
bdb79c |
Bugzilla: 1577546
|
|
|
bdb79c |
Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
bdb79c |
Acked-by: Vitaly Kuznetsov <vkuznets@redhat.com>
|
|
|
bdb79c |
|
|
|
bdb79c |
If both ConIn and ConOut exist, but ConIn references none of the PS/2
|
|
|
bdb79c |
keyboard, the USB wild-card keyboard, and any serial ports, then
|
|
|
bdb79c |
PlatformInitializeConsole() currently allows the boot to proceed without
|
|
|
bdb79c |
any input devices at all. This makes for a bad user experience -- the
|
|
|
bdb79c |
firmware menu could only be entered through OsIndications, set by a guest
|
|
|
bdb79c |
OS.
|
|
|
bdb79c |
|
|
|
bdb79c |
Do what ArmVirtQemu does already, namely connect the consoles, and add
|
|
|
bdb79c |
them to ConIn / ConOut / ErrOut, unconditionally. (The underlying
|
|
|
bdb79c |
EfiBootManagerUpdateConsoleVariable() function checks for duplicates.)
|
|
|
bdb79c |
|
|
|
bdb79c |
The issue used to be masked by the EfiBootManagerConnectAll() call that
|
|
|
bdb79c |
got conditionalized in commit 245c643cc8b7.
|
|
|
bdb79c |
|
|
|
bdb79c |
This patch is best viewed with "git show -b -W".
|
|
|
bdb79c |
|
|
|
bdb79c |
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
|
|
|
bdb79c |
Cc: Jordan Justen <jordan.l.justen@intel.com>
|
|
|
bdb79c |
Fixes: 245c643cc8b73240c3b88cb55b2911b285a8c10d
|
|
|
bdb79c |
Ref: https://bugzilla.redhat.com/show_bug.cgi?id=1577546
|
|
|
bdb79c |
Contributed-under: TianoCore Contribution Agreement 1.1
|
|
|
bdb79c |
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
|
|
|
bdb79c |
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
|
|
|
bdb79c |
(cherry picked from commit f803c03cc2e0b6b0b0bed447a97ea2c61b04ed82)
|
|
|
bdb79c |
---
|
|
|
bdb79c |
.../Library/PlatformBootManagerLib/BdsPlatform.c | 127 +++++++--------------
|
|
|
bdb79c |
1 file changed, 44 insertions(+), 83 deletions(-)
|
|
|
bdb79c |
|
|
|
bdb79c |
diff --git a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
|
|
|
bdb79c |
index 862fa6e..004b753 100644
|
|
|
bdb79c |
--- a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
|
|
|
bdb79c |
+++ b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
|
|
|
bdb79c |
@@ -26,7 +26,6 @@ VOID *mEfiDevPathNotifyReg;
|
|
|
bdb79c |
EFI_EVENT mEfiDevPathEvent;
|
|
|
bdb79c |
VOID *mEmuVariableEventReg;
|
|
|
bdb79c |
EFI_EVENT mEmuVariableEvent;
|
|
|
bdb79c |
-BOOLEAN mDetectVgaOnly;
|
|
|
bdb79c |
UINT16 mHostBridgeDevId;
|
|
|
bdb79c |
|
|
|
bdb79c |
//
|
|
|
bdb79c |
@@ -830,35 +829,33 @@ DetectAndPreparePlatformPciDevicePath (
|
|
|
bdb79c |
);
|
|
|
bdb79c |
ASSERT_EFI_ERROR (Status);
|
|
|
bdb79c |
|
|
|
bdb79c |
- if (!mDetectVgaOnly) {
|
|
|
bdb79c |
+ //
|
|
|
bdb79c |
+ // Here we decide whether it is LPC Bridge
|
|
|
bdb79c |
+ //
|
|
|
bdb79c |
+ if ((IS_PCI_LPC (Pci)) ||
|
|
|
bdb79c |
+ ((IS_PCI_ISA_PDECODE (Pci)) &&
|
|
|
bdb79c |
+ (Pci->Hdr.VendorId == 0x8086) &&
|
|
|
bdb79c |
+ (Pci->Hdr.DeviceId == 0x7000)
|
|
|
bdb79c |
+ )
|
|
|
bdb79c |
+ ) {
|
|
|
bdb79c |
//
|
|
|
bdb79c |
- // Here we decide whether it is LPC Bridge
|
|
|
bdb79c |
+ // Add IsaKeyboard to ConIn,
|
|
|
bdb79c |
+ // add IsaSerial to ConOut, ConIn, ErrOut
|
|
|
bdb79c |
//
|
|
|
bdb79c |
- if ((IS_PCI_LPC (Pci)) ||
|
|
|
bdb79c |
- ((IS_PCI_ISA_PDECODE (Pci)) &&
|
|
|
bdb79c |
- (Pci->Hdr.VendorId == 0x8086) &&
|
|
|
bdb79c |
- (Pci->Hdr.DeviceId == 0x7000)
|
|
|
bdb79c |
- )
|
|
|
bdb79c |
- ) {
|
|
|
bdb79c |
- //
|
|
|
bdb79c |
- // Add IsaKeyboard to ConIn,
|
|
|
bdb79c |
- // add IsaSerial to ConOut, ConIn, ErrOut
|
|
|
bdb79c |
- //
|
|
|
bdb79c |
- DEBUG ((EFI_D_INFO, "Found LPC Bridge device\n"));
|
|
|
bdb79c |
- PrepareLpcBridgeDevicePath (Handle);
|
|
|
bdb79c |
- return EFI_SUCCESS;
|
|
|
bdb79c |
- }
|
|
|
bdb79c |
+ DEBUG ((EFI_D_INFO, "Found LPC Bridge device\n"));
|
|
|
bdb79c |
+ PrepareLpcBridgeDevicePath (Handle);
|
|
|
bdb79c |
+ return EFI_SUCCESS;
|
|
|
bdb79c |
+ }
|
|
|
bdb79c |
+ //
|
|
|
bdb79c |
+ // Here we decide which Serial device to enable in PCI bus
|
|
|
bdb79c |
+ //
|
|
|
bdb79c |
+ if (IS_PCI_16550SERIAL (Pci)) {
|
|
|
bdb79c |
//
|
|
|
bdb79c |
- // Here we decide which Serial device to enable in PCI bus
|
|
|
bdb79c |
+ // Add them to ConOut, ConIn, ErrOut.
|
|
|
bdb79c |
//
|
|
|
bdb79c |
- if (IS_PCI_16550SERIAL (Pci)) {
|
|
|
bdb79c |
- //
|
|
|
bdb79c |
- // Add them to ConOut, ConIn, ErrOut.
|
|
|
bdb79c |
- //
|
|
|
bdb79c |
- DEBUG ((EFI_D_INFO, "Found PCI 16550 SERIAL device\n"));
|
|
|
bdb79c |
- PreparePciSerialDevicePath (Handle);
|
|
|
bdb79c |
- return EFI_SUCCESS;
|
|
|
bdb79c |
- }
|
|
|
bdb79c |
+ DEBUG ((EFI_D_INFO, "Found PCI 16550 SERIAL device\n"));
|
|
|
bdb79c |
+ PreparePciSerialDevicePath (Handle);
|
|
|
bdb79c |
+ return EFI_SUCCESS;
|
|
|
bdb79c |
}
|
|
|
bdb79c |
|
|
|
bdb79c |
//
|
|
|
bdb79c |
@@ -878,26 +875,6 @@ DetectAndPreparePlatformPciDevicePath (
|
|
|
bdb79c |
|
|
|
bdb79c |
|
|
|
bdb79c |
/**
|
|
|
bdb79c |
- Do platform specific PCI Device check and add them to ConOut, ConIn, ErrOut
|
|
|
bdb79c |
-
|
|
|
bdb79c |
- @param[in] DetectVgaOnly - Only detect VGA device if it's TRUE.
|
|
|
bdb79c |
-
|
|
|
bdb79c |
- @retval EFI_SUCCESS - PCI Device check and Console variable update
|
|
|
bdb79c |
- successfully.
|
|
|
bdb79c |
- @retval EFI_STATUS - PCI Device check or Console variable update fail.
|
|
|
bdb79c |
-
|
|
|
bdb79c |
-**/
|
|
|
bdb79c |
-EFI_STATUS
|
|
|
bdb79c |
-DetectAndPreparePlatformPciDevicePaths (
|
|
|
bdb79c |
- BOOLEAN DetectVgaOnly
|
|
|
bdb79c |
- )
|
|
|
bdb79c |
-{
|
|
|
bdb79c |
- mDetectVgaOnly = DetectVgaOnly;
|
|
|
bdb79c |
- return VisitAllPciInstances (DetectAndPreparePlatformPciDevicePath);
|
|
|
bdb79c |
-}
|
|
|
bdb79c |
-
|
|
|
bdb79c |
-
|
|
|
bdb79c |
-/**
|
|
|
bdb79c |
Connect the predefined platform default console device.
|
|
|
bdb79c |
|
|
|
bdb79c |
Always try to find and enable PCI display devices.
|
|
|
bdb79c |
@@ -910,50 +887,34 @@ PlatformInitializeConsole (
|
|
|
bdb79c |
)
|
|
|
bdb79c |
{
|
|
|
bdb79c |
UINTN Index;
|
|
|
bdb79c |
- EFI_DEVICE_PATH_PROTOCOL *VarConout;
|
|
|
bdb79c |
- EFI_DEVICE_PATH_PROTOCOL *VarConin;
|
|
|
bdb79c |
|
|
|
bdb79c |
//
|
|
|
bdb79c |
- // Connect RootBridge
|
|
|
bdb79c |
+ // Do platform specific PCI Device check and add them to ConOut, ConIn,
|
|
|
bdb79c |
+ // ErrOut
|
|
|
bdb79c |
//
|
|
|
bdb79c |
- GetEfiGlobalVariable2 (EFI_CON_OUT_VARIABLE_NAME, (VOID **) &VarConout,
|
|
|
bdb79c |
- NULL);
|
|
|
bdb79c |
- GetEfiGlobalVariable2 (EFI_CON_IN_VARIABLE_NAME, (VOID **) &VarConin, NULL);
|
|
|
bdb79c |
-
|
|
|
bdb79c |
- if (VarConout == NULL || VarConin == NULL) {
|
|
|
bdb79c |
- //
|
|
|
bdb79c |
- // Do platform specific PCI Device check and add them to ConOut, ConIn,
|
|
|
bdb79c |
- // ErrOut
|
|
|
bdb79c |
- //
|
|
|
bdb79c |
- DetectAndPreparePlatformPciDevicePaths (FALSE);
|
|
|
bdb79c |
+ VisitAllPciInstances (DetectAndPreparePlatformPciDevicePath);
|
|
|
bdb79c |
|
|
|
bdb79c |
+ //
|
|
|
bdb79c |
+ // Have chance to connect the platform default console,
|
|
|
bdb79c |
+ // the platform default console is the minimum device group
|
|
|
bdb79c |
+ // the platform should support
|
|
|
bdb79c |
+ //
|
|
|
bdb79c |
+ for (Index = 0; PlatformConsole[Index].DevicePath != NULL; ++Index) {
|
|
|
bdb79c |
//
|
|
|
bdb79c |
- // Have chance to connect the platform default console,
|
|
|
bdb79c |
- // the platform default console is the minimum device group
|
|
|
bdb79c |
- // the platform should support
|
|
|
bdb79c |
+ // Update the console variable with the connect type
|
|
|
bdb79c |
//
|
|
|
bdb79c |
- for (Index = 0; PlatformConsole[Index].DevicePath != NULL; ++Index) {
|
|
|
bdb79c |
- //
|
|
|
bdb79c |
- // Update the console variable with the connect type
|
|
|
bdb79c |
- //
|
|
|
bdb79c |
- if ((PlatformConsole[Index].ConnectType & CONSOLE_IN) == CONSOLE_IN) {
|
|
|
bdb79c |
- EfiBootManagerUpdateConsoleVariable (ConIn,
|
|
|
bdb79c |
- PlatformConsole[Index].DevicePath, NULL);
|
|
|
bdb79c |
- }
|
|
|
bdb79c |
- if ((PlatformConsole[Index].ConnectType & CONSOLE_OUT) == CONSOLE_OUT) {
|
|
|
bdb79c |
- EfiBootManagerUpdateConsoleVariable (ConOut,
|
|
|
bdb79c |
- PlatformConsole[Index].DevicePath, NULL);
|
|
|
bdb79c |
- }
|
|
|
bdb79c |
- if ((PlatformConsole[Index].ConnectType & STD_ERROR) == STD_ERROR) {
|
|
|
bdb79c |
- EfiBootManagerUpdateConsoleVariable (ErrOut,
|
|
|
bdb79c |
- PlatformConsole[Index].DevicePath, NULL);
|
|
|
bdb79c |
- }
|
|
|
bdb79c |
+ if ((PlatformConsole[Index].ConnectType & CONSOLE_IN) == CONSOLE_IN) {
|
|
|
bdb79c |
+ EfiBootManagerUpdateConsoleVariable (ConIn,
|
|
|
bdb79c |
+ PlatformConsole[Index].DevicePath, NULL);
|
|
|
bdb79c |
+ }
|
|
|
bdb79c |
+ if ((PlatformConsole[Index].ConnectType & CONSOLE_OUT) == CONSOLE_OUT) {
|
|
|
bdb79c |
+ EfiBootManagerUpdateConsoleVariable (ConOut,
|
|
|
bdb79c |
+ PlatformConsole[Index].DevicePath, NULL);
|
|
|
bdb79c |
+ }
|
|
|
bdb79c |
+ if ((PlatformConsole[Index].ConnectType & STD_ERROR) == STD_ERROR) {
|
|
|
bdb79c |
+ EfiBootManagerUpdateConsoleVariable (ErrOut,
|
|
|
bdb79c |
+ PlatformConsole[Index].DevicePath, NULL);
|
|
|
bdb79c |
}
|
|
|
bdb79c |
- } else {
|
|
|
bdb79c |
- //
|
|
|
bdb79c |
- // Only detect VGA device and add them to ConOut
|
|
|
bdb79c |
- //
|
|
|
bdb79c |
- DetectAndPreparePlatformPciDevicePaths (TRUE);
|
|
|
bdb79c |
}
|
|
|
bdb79c |
}
|
|
|
bdb79c |
|
|
|
bdb79c |
--
|
|
|
bdb79c |
1.8.3.1
|
|
|
bdb79c |
|