From: "Zhiguang Liu" <zhiguang.liu@intel.com>
To: devel@edk2.groups.io
Cc: Guo Dong <guo.dong@intel.com>, Ray Ni <ray.ni@intel.com>,
Maurice Ma <maurice.ma@intel.com>,
Benjamin You <benjamin.you@intel.com>,
Sean Rhodes <sean@starlabs.systems>
Subject: [PATCH 3/3] UefiPayloadPkg: Connect all root bridge in PlatformBootManagerBeforeConsole
Date: Tue, 10 May 2022 15:11:11 +0800 [thread overview]
Message-ID: <5090af6605c3ae9e1ea3c6ebd2e1e5f6c870dac0.1652166437.git.zhiguang.liu@intel.com> (raw)
In-Reply-To: <cover.1652166437.git.zhiguang.liu@intel.com>
Some ConIn or ConOut device may not in the first root bridge, so connect all
root bridge before detect ConIn and ConOut device.
Cc: Guo Dong <guo.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Maurice Ma <maurice.ma@intel.com>
Cc: Benjamin You <benjamin.you@intel.com>
Cc: Sean Rhodes <sean@starlabs.systems>
Signed-off-by: Zhiguang Liu <zhiguang.liu@intel.com>
---
.../PlatformBootManagerLib.inf | 1 +
.../PlatformBootManagerLib/PlatformConsole.c | 52 ++++++-------------
2 files changed, 18 insertions(+), 35 deletions(-)
diff --git a/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf b/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
index acf2880d22..9f58c460cd 100644
--- a/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
+++ b/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
@@ -61,6 +61,7 @@
gEfiSmmAccess2ProtocolGuid
gUniversalPayloadPlatformBootManagerOverrideProtocolGuid
gEfiSerialIoProtocolGuid
+ gEfiPciRootBridgeIoProtocolGuid
[Pcd]
gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut
diff --git a/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformConsole.c b/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformConsole.c
index 5e1c77d866..e4a9f5f0f9 100644
--- a/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformConsole.c
+++ b/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformConsole.c
@@ -38,9 +38,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
0 \
}
-#define gPciRootBridge \
- PNPID_DEVICE_PATH_NODE(0x0A03)
-
#define gPnp16550ComPort \
PNPID_DEVICE_PATH_NODE(0x0501)
@@ -64,19 +61,6 @@ ACPI_HID_DEVICE_PATH gPnpPs2KeyboardDeviceNode = gPnpPs2Keyboard;
ACPI_HID_DEVICE_PATH gPnp16550ComPortDeviceNode = gPnp16550ComPort;
VENDOR_DEVICE_PATH gTerminalTypeDeviceNode = gPcAnsiTerminal;
-//
-// Predefined platform root bridge
-//
-PLATFORM_ROOT_BRIDGE_DEVICE_PATH gPlatformRootBridge0 = {
- gPciRootBridge,
- gEndEntire
-};
-
-EFI_DEVICE_PATH_PROTOCOL *gPlatformRootBridges[] = {
- (EFI_DEVICE_PATH_PROTOCOL *)&gPlatformRootBridge0,
- NULL
-};
-
BOOLEAN mDetectDisplayOnly;
/**
@@ -456,32 +440,26 @@ DetectAndPreparePlatformPciDevicePaths (
}
/**
- The function will connect root bridge
+ The function will connect one root bridge
- @return EFI_SUCCESS Connect RootBridge successfully.
+ @param[in] Handle - The root bridge handle
+ @param[in] Instance - The instance of the root bridge
+ @param[in] Context - The context of the callback
+
+ @return EFI_SUCCESS Connect RootBridge successfully.
**/
EFI_STATUS
-ConnectRootBridge (
- VOID
+EFIAPI
+ConnectOneRootBridge (
+ IN EFI_HANDLE Handle,
+ IN VOID *Instance,
+ IN VOID *Context
)
{
EFI_STATUS Status;
- EFI_HANDLE RootHandle;
-
- //
- // Make all the PCI_IO protocols on PCI Seg 0 show up
- //
- Status = gBS->LocateDevicePath (
- &gEfiDevicePathProtocolGuid,
- &gPlatformRootBridges[0],
- &RootHandle
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
- Status = gBS->ConnectController (RootHandle, NULL, NULL, FALSE);
+ Status = gBS->ConnectController (Handle, NULL, NULL, FALSE);
if (EFI_ERROR (Status)) {
return Status;
}
@@ -500,7 +478,11 @@ PlatformConsoleInit (
VOID
)
{
- ConnectRootBridge ();
+ VisitAllInstancesOfProtocol (
+ &gEfiPciRootBridgeIoProtocolGuid,
+ ConnectOneRootBridge,
+ NULL
+ );
//
// Do platform specific PCI Device check and add them to ConOut, ConIn, ErrOut
--
2.32.0.windows.2
prev parent reply other threads:[~2022-05-10 7:11 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-10 7:11 [PATCH 0/3] UefiPayloadPkg: Enhance the logic to add ConIn and ConOut Zhiguang Liu
2022-05-10 7:11 ` [PATCH 1/3] UefiPayloadPkg: Simplify code logic Zhiguang Liu
2022-05-10 7:39 ` Ni, Ray
2022-05-11 1:48 ` Zhiguang Liu
2022-05-10 7:11 ` [PATCH 2/3] UefiPayloadPkg: Add Serial IO device path according to related protocol Zhiguang Liu
2022-05-10 7:11 ` Zhiguang Liu [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5090af6605c3ae9e1ea3c6ebd2e1e5f6c870dac0.1652166437.git.zhiguang.liu@intel.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox