Reviewed-by: Guo Dong <guo.d...@intel.com>

-----Original Message-----
From: Liu, Zhiguang <zhiguang....@intel.com> 
Sent: Thursday, May 12, 2022 3:55 AM
To: devel@edk2.groups.io
Cc: Dong, Guo <guo.d...@intel.com>; Ni, Ray <ray...@intel.com>; Maurice Ma 
<maurice...@intel.com>; You, Benjamin <benjamin....@intel.com>; Rhodes, Sean 
<sean@starlabs.systems>
Subject: [PATCH v2 3/3] UefiPayloadPkg: Connect all root bridge in 
PlatformBootManagerBeforeConsole

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.d...@intel.com>
Cc: Ray Ni <ray...@intel.com>
Cc: Maurice Ma <maurice...@intel.com>
Cc: Benjamin You <benjamin....@intel.com>
Cc: Sean Rhodes <sean@starlabs.systems>
Signed-off-by: Zhiguang Liu <zhiguang....@intel.com>
---
 .../PlatformBootManagerLib.inf                |  1 +
 .../PlatformBootManagerLib/PlatformConsole.c  | 49 ++++++-------------
 2 files changed, 15 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/PlatformBootManagerL
+++ ib.inf
@@ -61,6 +61,7 @@
   gEfiSmmAccess2ProtocolGuid   
gUniversalPayloadPlatformBootManagerOverrideProtocolGuid   
gEfiSerialIoProtocolGuid+  gEfiPciRootBridgeIoProtocolGuid  [Pcd]   
gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOutdiff --git 
a/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformConsole.c 
b/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformConsole.c
index 5aece6636f..e92d12e991 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;  /**@@ -447,32 +431,24 @@ 
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++  @return EFI_SUCCESS      Connect RootBridge 
successfully.  **/ EFI_STATUS-ConnectRootBridge (-  
VOID+EFIAPI+ConnectOneRootBridge (+  IN EFI_HANDLE  Handle,+  IN VOID        
*Instance   ) {   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;   }@@ -491,7 +467,10 @@ PlatformConsoleInit (
   VOID   ) {-  ConnectRootBridge ();+  VisitAllInstancesOfProtocol (+    
&gEfiPciRootBridgeIoProtocolGuid,+    ConnectOneRootBridge+    );    //   // Do 
platform specific PCI Device check and add them to ConOut, ConIn, ErrOut-- 
2.32.0.windows.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#89709): https://edk2.groups.io/g/devel/message/89709
Mute This Topic: https://groups.io/mt/91055224/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-


Reply via email to