[edk2-devel] [edk2-staging/UEFI_PCI_ENHANCE-2 PATCH 05/15] MdeModulePkg/PciBusDxe: Locate PciePlatform/PcieOverride protocol

Ni, Ray ray.ni at intel.com
Wed May 13 06:31:53 UTC 2020


Reviewed-by: Ray Ni <ray.ni at intel.com>

> -----Original Message-----
> From: Javeed, Ashraf <ashraf.javeed at intel.com>
> Sent: Monday, May 11, 2020 12:14 AM
> To: devel at edk2.groups.io
> Cc: Ni, Ray <ray.ni at intel.com>; Wang, Jian J <jian.j.wang at intel.com>; Wu, Hao A <hao.a.wu at intel.com>
> Subject: [edk2-staging/UEFI_PCI_ENHANCE-2 PATCH 05/15] MdeModulePkg/PciBusDxe: Locate PciePlatform/PcieOverride
> protocol
> 
> 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 <ashraf.javeed at intel.com>
> Signed-off-by: Ray Ni <ray.ni at intel.com>
> Cc: Jian J Wang <jian.j.wang at intel.com>
> Cc: Hao A Wu <hao.a.wu at intel.com>
> Cc: Ray Ni <ray.ni at intel.com>
> Cc: Ashraf Javeed <ashraf.javeed at intel.com>
> ---
>  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.<BR>
> +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.<BR>
> +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


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#59402): https://edk2.groups.io/g/devel/message/59402
Mute This Topic: https://groups.io/mt/74118512/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-





More information about the edk2-devel-archive mailing list