From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by mx.groups.io with SMTP id smtpd.web12.6679.1652166681383551366 for ; Tue, 10 May 2022 00:11:29 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=D5NyyhxO; spf=pass (domain: intel.com, ip: 192.55.52.120, 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=1652166689; x=1683702689; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ghLjiM+DJcmc7O6ZKyq1Krv5XhLV/flcjSZQQ6QYzFM=; b=D5NyyhxOHRcdtQv3qgw0APR0jgNSJ0A3EigmyP5S5eFNvKN/QNiX/6SL 5UG/oobf4ozJ1omr7K2s6OF2GTmfNlq183nFJl7pCqsxZaJQfF3Mz2M9Z T7nkxCpBSvIXK4Inpo3hiI6nbpf6XJ1IlMjzxS2wIDaqAyfPG8Pj+WjMw n784T5EKAJO8E+f1woTnvdZVBZ1CU+U8j7qZFdZi5K+iWfm5ndQdiF+tF 61izpaPuhC2JCOiixQEwTBJt4m/HmJzkTuFPqlnyJrMGpYiiyyImvWWSd Z10RufZ0BUrapqzdwgYeoUENDMwqvZfUByIKKsM2E+UiOFU41l/CL0ZvV A==; X-IronPort-AV: E=McAfee;i="6400,9594,10342"; a="268127965" X-IronPort-AV: E=Sophos;i="5.91,213,1647327600"; d="scan'208";a="268127965" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 May 2022 00:11:29 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,213,1647327600"; d="scan'208";a="696953493" Received: from shwdesfp01.ccr.corp.intel.com ([10.239.158.158]) by orsmga004.jf.intel.com with ESMTP; 10 May 2022 00:11:27 -0700 From: "Zhiguang Liu" To: devel@edk2.groups.io Cc: Guo Dong , Ray Ni , Maurice Ma , Benjamin You , Sean Rhodes Subject: [PATCH 3/3] UefiPayloadPkg: Connect all root bridge in PlatformBootManagerBeforeConsole Date: Tue, 10 May 2022 15:11:11 +0800 Message-Id: <5090af6605c3ae9e1ea3c6ebd2e1e5f6c870dac0.1652166437.git.zhiguang.liu@intel.com> 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 | 52 ++++++------------- 2 files changed, 18 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 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 \=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 @@ -456,32 +440,26 @@ 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 + @param[in] Context - The context of the callback=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 + IN VOID *Context=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 @@ -500,7 +478,11 @@ PlatformConsoleInit ( VOID=0D )=0D {=0D - ConnectRootBridge ();=0D + VisitAllInstancesOfProtocol (=0D + &gEfiPciRootBridgeIoProtocolGuid,=0D + ConnectOneRootBridge,=0D + NULL=0D + );=0D =0D //=0D // Do platform specific PCI Device check and add them to ConOut, ConIn, = ErrOut=0D --=20 2.32.0.windows.2