diff mbox series

[edk2,edk2-platforms,v2,04/12] Hisilicon/Pci: Add two api for PciPlatform driver

Message ID 20180724063220.61679-5-ming.huang@linaro.org
State New
Headers show
Series Switching to generic PciHostBridge driver | expand

Commit Message

Ming Huang July 24, 2018, 6:32 a.m. UTC
PciPlatform may add some features platform special, like
InitAtu and EnlargeAtu for Hi161x, MaxPlayload for Hi1620.
So Add two api for expansibility.

This patch is to prepare moving EnlargeAtuConfig0() out of
PciHostBridge. Since the function was originally called in
NotifyPhase() of phase EfiPciHostBridgeEndEnumeration, so we propose
to move it to EFI_PCI_PLATFORM_PROTOCOL->PlatformNotify().

To reduce redundant ATU definitions, we also move InitAtu to
PciPlatformLib in Hi161x.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ming Huang <ming.huang@linaro.org>

Signed-off-by: Heyi Guo <heyi.guo@linaro.org>

---
 Silicon/Hisilicon/Drivers/PciPlatform/PciPlatform.c   | 45 ++++++++++++++++++++
 Silicon/Hisilicon/Drivers/PciPlatform/PciPlatform.inf |  1 +
 2 files changed, 46 insertions(+)

-- 
2.17.0

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
diff mbox series

Patch

diff --git a/Silicon/Hisilicon/Drivers/PciPlatform/PciPlatform.c b/Silicon/Hisilicon/Drivers/PciPlatform/PciPlatform.c
index 8bfac2d99f..fcdd36cf94 100644
--- a/Silicon/Hisilicon/Drivers/PciPlatform/PciPlatform.c
+++ b/Silicon/Hisilicon/Drivers/PciPlatform/PciPlatform.c
@@ -103,6 +103,48 @@  PCI_OPTION_ROM_TABLE      mPciOptionRomTable[] = {
   }
 };
 
+/*++
+
+ Routine Description:
+
+   Perform Platform initialization first in PciPlatform.
+
+   Arguments:
+
+   Returns:
+
+    VOID.
+
+--*/
+VOID
+EFIAPI
+PciInitPlatform (
+  VOID
+  );
+
+/*++
+
+ Routine Description:
+
+   Perform Platform initialization by the phase indicated.
+
+   Arguments:
+
+   HostBridge    -  The associated PCI host bridge handle.
+   Phase         -  The phase of the PCI controller enumeration.
+   ChipsetPhase  -  Defines the execution phase of the PCI chipset driver.
+
+   Returns:
+
+--*/
+VOID
+EFIAPI
+PhaseNotifyPlatform (
+  IN  EFI_HANDLE                                     HostBridge,
+  IN  EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PHASE  Phase,
+  IN  EFI_PCI_CHIPSET_EXECUTION_PHASE                ChipsetPhase
+  );
+
 EFI_STATUS
 EFIAPI
 GetPlatformPolicy (
@@ -387,6 +429,7 @@  Returns:
 
 --*/
 {
+  PhaseNotifyPlatform (HostBridge, Phase, ChipsetPhase);
 
   return EFI_SUCCESS;
 }
@@ -415,6 +458,8 @@  Returns:
   EFI_STATUS  Status;
   PCI_PLATFORM_PRIVATE_DATA *PciPrivateData;
 
+  PciInitPlatform ();
+
   PciPrivateData = AllocateZeroPool (sizeof (PCI_PLATFORM_PRIVATE_DATA));
   mPciPrivateData = PciPrivateData;
 
diff --git a/Silicon/Hisilicon/Drivers/PciPlatform/PciPlatform.inf b/Silicon/Hisilicon/Drivers/PciPlatform/PciPlatform.inf
index 8b170d2654..099021fcc8 100644
--- a/Silicon/Hisilicon/Drivers/PciPlatform/PciPlatform.inf
+++ b/Silicon/Hisilicon/Drivers/PciPlatform/PciPlatform.inf
@@ -38,6 +38,7 @@ 
   ArmLib
   IoLib
   MemoryAllocationLib
+  PciPlatformLib
 
 [Protocols]
   gEfiPciPlatformProtocolGuid