From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga18.intel.com (mga18.intel.com []) by mx.groups.io with SMTP id smtpd.web12.17390.1589127269924431738 for ; Sun, 10 May 2020 09:14:35 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=fail (domain: intel.com, ip: , mailfrom: ashraf.javeed@intel.com) IronPort-SDR: OX1rs9AQZTl04tNKrzrV3RlCnMpwkI3ZeoIdTdT8N9CWety+CyPQVihx6biivYrAlmvw6acaaL sQUUws7FGHjQ== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 May 2020 09:14:34 -0700 IronPort-SDR: 38YpUjHRnfAeTLgx+NSkgFQKQOAX5e5EolANezffIxVOz8+tpSGAq002v0UO2XkZsTh82Bbhxv UGsd1gmKJN1w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,376,1583222400"; d="scan'208";a="463129627" Received: from pidsbabios005.gar.corp.intel.com ([10.66.128.37]) by fmsmga006.fm.intel.com with ESMTP; 10 May 2020 09:14:32 -0700 From: "Javeed, Ashraf" To: devel@edk2.groups.io Cc: Ray Ni , Jian J Wang , Hao A Wu Subject: [edk2-staging/UEFI_PCI_ENHANCE-2 PATCH 05/15] MdeModulePkg/PciBusDxe: Locate PciePlatform/PcieOverride protocol Date: Sun, 10 May 2020 21:44:02 +0530 Message-Id: <20200510161412.13832-6-ashraf.javeed@intel.com> X-Mailer: git-send-email 2.21.0.windows.1 In-Reply-To: <20200510161412.13832-1-ashraf.javeed@intel.com> References: <20200510161412.13832-1-ashraf.javeed@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1954 https://bugzilla.tianocore.org/show_bug.cgi?id=2194 https://bugzilla.tianocore.org/show_bug.cgi?id=2313 https://bugzilla.tianocore.org/show_bug.cgi?id=2499 https://bugzilla.tianocore.org/show_bug.cgi?id=2500 Signed-off-by: Ashraf Javeed Signed-off-by: Ray Ni Cc: Jian J Wang Cc: Hao A Wu Cc: Ray Ni Cc: Ashraf Javeed --- MdeModulePkg/Bus/Pci/PciBusDxe/PciBus.c | 5 +++++ MdeModulePkg/Bus/Pci/PciBusDxe/PciBus.h | 1 + MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf | 2 ++ MdeModulePkg/Bus/Pci/PciBusDxe/PcieFeatureSupport.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ MdeModulePkg/Bus/Pci/PciBusDxe/PcieFeatureSupport.h | 25 +++++++++++++++++++++++++ 5 files changed, 77 insertions(+) diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciBus.c b/MdeModulePkg/Bus/Pci/PciBusDxe/PciBus.c index 53e6dfa..a139bed 100644 --- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciBus.c +++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciBus.c @@ -285,6 +285,11 @@ PciBusDriverBindingStart ( ); } + // + // get the PCI Express Protocol or the PCI Express Override Protocol + // + InitializePciExpressProtocols (); + if (mIoMmuProtocol == NULL) { gBS->LocateProtocol ( &gEdkiiIoMmuProtocolGuid, diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciBus.h b/MdeModulePkg/Bus/Pci/PciBusDxe/PciBus.h index 9947203..ccf9ffa 100644 --- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciBus.h +++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciBus.h @@ -82,6 +82,7 @@ typedef enum { #include "PciPowerManagement.h" #include "PciHotPlugSupport.h" #include "PciLib.h" +#include "PcieFeatureSupport.h" #define VGABASE1 0x3B0 #define VGALIMIT1 0x3BB diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf b/MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf index 3b1559e..0818153 100644 --- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf +++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf @@ -57,6 +57,8 @@ PciCommand.h PciIo.h PciBus.h + PcieFeatureSupport.c + PcieFeatureSupport.h [Packages] MdePkg/MdePkg.dec diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PcieFeatureSupport.c b/MdeModulePkg/Bus/Pci/PciBusDxe/PcieFeatureSupport.c new file mode 100644 index 0000000..13d0e0b --- /dev/null +++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PcieFeatureSupport.c @@ -0,0 +1,44 @@ +/** @file + PCI standard feature support functions implementation for PCI Bus module.. + +Copyright (c) 2020, Intel Corporation. All rights reserved.
+SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include "PciBus.h" +#include "PcieFeatureSupport.h" +EFI_PCI_EXPRESS_PLATFORM_PROTOCOL *mPciePlatformProtocol; + +/** + This function retrieves the PCI Express Platform Protocols published by platform + @retval EFI_STATUS direct return status from the LocateProtocol () + boot service for the PCI Express Override Protocol. + EFI_SUCCESS The PCI Express Platform Protocol is found. +**/ +EFI_STATUS +InitializePciExpressProtocols ( + VOID + ) +{ + EFI_STATUS Status; + + Status = gBS->LocateProtocol ( + &gEfiPciExpressPlatformProtocolGuid, + NULL, + (VOID **) &mPciePlatformProtocol + ); + if (EFI_ERROR (Status)) { + // + // If PCI Express Platform protocol doesn't exist, try to get the Pci Express + // Override Protocol and treat it as PCI Express Platform protocol. + // + Status = gBS->LocateProtocol ( + &gEfiPciExpressOverrideProtocolGuid, + NULL, + (VOID **) &mPciePlatformProtocol + ); + } + return Status; +} + diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PcieFeatureSupport.h b/MdeModulePkg/Bus/Pci/PciBusDxe/PcieFeatureSupport.h new file mode 100644 index 0000000..5d15e0a --- /dev/null +++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PcieFeatureSupport.h @@ -0,0 +1,25 @@ +/** @file + PCI standard feature support functions implementation for PCI Bus module.. + +Copyright (c) 2020, Intel Corporation. All rights reserved.
+SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __PCIE_FEATURE_SUPPORT_H__ +#define __PCIE_FEATURE_SUPPORT_H__ + +extern EFI_PCI_EXPRESS_PLATFORM_PROTOCOL *mPciePlatformProtocol; +/** + This function retrieves the PCI Express Platform Protocols published by platform + @retval EFI_STATUS direct return status from the LocateProtocol () + boot service for the PCI Express Override Protocol + EFI_SUCCESS The PCI Express Platform Protocol is found +**/ +EFI_STATUS +InitializePciExpressProtocols ( + VOID + ); + + +#endif -- 2.21.0.windows.1