From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mx.groups.io with SMTP id smtpd.web08.2661.1652352917194448306 for ; Thu, 12 May 2022 03:55:21 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=BxVEev4t; spf=pass (domain: intel.com, ip: 192.55.52.115, mailfrom: zhiguang.liu@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1652352921; x=1683888921; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=yak0oBOAQ844jzWjZw5cx/koQ1IcvhbRVNfppl1GvGo=; b=BxVEev4tUjOmmXB///jQ/fiPCOj2AiOuFjFFZmr78f97Yw+Dfu1NXoCP oUhMA2BdpkBFe1D+7P4tliNbtJ7yN6bkxsYGUDlmfVDCIApmGf0aSMr/i oIMLk9TZ7AUxI79g0LHQy4ajn9G/+m7jVnrw39ftggc48R7h9sWeIcnbj q8jghRxusAUW+APNRw1zA/jOGEzzFFzlSLS0u40qH2Y4uLzBgI4MuZm5t hYNmIgbPIEPizKuM1tGjSo19vyWPCbhzSt4Mbmi5Eo/RL4A7JfejhfXx8 iMfut70IaMUyQ334/CVuYJ9rv+2vxkhJWNcG7rekDQ1wvMlHPga5YrGNN A==; X-IronPort-AV: E=McAfee;i="6400,9594,10344"; a="270094666" X-IronPort-AV: E=Sophos;i="5.91,219,1647327600"; d="scan'208";a="270094666" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 May 2022 03:55:20 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,219,1647327600"; d="scan'208";a="566627463" Received: from shwdesfp01.ccr.corp.intel.com ([10.239.158.158]) by orsmga007.jf.intel.com with ESMTP; 12 May 2022 03:55:18 -0700 From: "Zhiguang Liu" To: devel@edk2.groups.io Cc: Guo Dong , Ray Ni , Maurice Ma , Benjamin You , Sean Rhodes Subject: [PATCH v2 3/3] UefiPayloadPkg: Connect all root bridge in PlatformBootManagerBeforeConsole Date: Thu, 12 May 2022 18:54:59 +0800 Message-Id: X-Mailer: git-send-email 2.32.0.windows.2 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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 Cc: Ray Ni Cc: Maurice Ma Cc: Benjamin You Cc: Sean Rhodes Signed-off-by: Zhiguang Liu --- .../PlatformBootManagerLib.inf | 1 + .../PlatformBootManagerLib/PlatformConsole.c | 49 ++++++------------- 2 files changed, 15 insertions(+), 35 deletions(-) diff --git a/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootMana= gerLib.inf b/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootMana= gerLib.inf index acf2880d22..9f58c460cd 100644 --- a/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.= inf +++ b/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.= inf @@ -61,6 +61,7 @@ gEfiSmmAccess2ProtocolGuid=0D gUniversalPayloadPlatformBootManagerOverrideProtocolGuid=0D gEfiSerialIoProtocolGuid=0D + gEfiPciRootBridgeIoProtocolGuid=0D =0D [Pcd]=0D gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut=0D diff --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 \=0D }=0D =0D -#define gPciRootBridge \=0D - PNPID_DEVICE_PATH_NODE(0x0A03)=0D -=0D #define gPnp16550ComPort \=0D PNPID_DEVICE_PATH_NODE(0x0501)=0D =0D @@ -64,19 +61,6 @@ ACPI_HID_DEVICE_PATH gPnpPs2KeyboardDeviceNode =3D gPn= pPs2Keyboard; ACPI_HID_DEVICE_PATH gPnp16550ComPortDeviceNode =3D gPnp16550ComPort;=0D VENDOR_DEVICE_PATH gTerminalTypeDeviceNode =3D gPcAnsiTerminal;=0D =0D -//=0D -// Predefined platform root bridge=0D -//=0D -PLATFORM_ROOT_BRIDGE_DEVICE_PATH gPlatformRootBridge0 =3D {=0D - gPciRootBridge,=0D - gEndEntire=0D -};=0D -=0D -EFI_DEVICE_PATH_PROTOCOL *gPlatformRootBridges[] =3D {=0D - (EFI_DEVICE_PATH_PROTOCOL *)&gPlatformRootBridge0,=0D - NULL=0D -};=0D -=0D BOOLEAN mDetectDisplayOnly;=0D =0D /**=0D @@ -447,32 +431,24 @@ DetectAndPreparePlatformPciDevicePaths ( }=0D =0D /**=0D - The function will connect root bridge=0D + The function will connect one root bridge=0D =0D - @return EFI_SUCCESS Connect RootBridge successfully.=0D + @param[in] Handle - The root bridge handle=0D + @param[in] Instance - The instance of the root bridge=0D +=0D + @return EFI_SUCCESS Connect RootBridge successfully.=0D =0D **/=0D EFI_STATUS=0D -ConnectRootBridge (=0D - VOID=0D +EFIAPI=0D +ConnectOneRootBridge (=0D + IN EFI_HANDLE Handle,=0D + IN VOID *Instance=0D )=0D {=0D EFI_STATUS Status;=0D - EFI_HANDLE RootHandle;=0D =0D - //=0D - // Make all the PCI_IO protocols on PCI Seg 0 show up=0D - //=0D - Status =3D gBS->LocateDevicePath (=0D - &gEfiDevicePathProtocolGuid,=0D - &gPlatformRootBridges[0],=0D - &RootHandle=0D - );=0D - if (EFI_ERROR (Status)) {=0D - return Status;=0D - }=0D -=0D - Status =3D gBS->ConnectController (RootHandle, NULL, NULL, FALSE);=0D + Status =3D gBS->ConnectController (Handle, NULL, NULL, FALSE);=0D if (EFI_ERROR (Status)) {=0D return Status;=0D }=0D @@ -491,7 +467,10 @@ PlatformConsoleInit ( VOID=0D )=0D {=0D - ConnectRootBridge ();=0D + VisitAllInstancesOfProtocol (=0D + &gEfiPciRootBridgeIoProtocolGuid,=0D + ConnectOneRootBridge=0D + );=0D =0D //=0D // Do platform specific PCI Device check and add them to ConOut, ConIn, = ErrOut=0D --=20 2.32.0.windows.2