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