public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Marcin Wojtas <mw@semihalf.com>
To: edk2-devel@lists.01.org
Cc: leif.lindholm@linaro.org, ard.biesheuvel@linaro.org,
	nadavh@marvell.com, neta@marvell.com, kostap@marvell.com,
	jinghua@marvell.com, mw@semihalf.com, jsd@semihalf.com
Subject: [platforms: PATCH 01/13] Marvell/Armada: Introduce platform initialization driver
Date: Mon,  9 Oct 2017 19:00:50 +0200	[thread overview]
Message-ID: <1507568462-28775-2-git-send-email-mw@semihalf.com> (raw)
In-Reply-To: <1507568462-28775-1-git-send-email-mw@semihalf.com>

In order to enable modification of dynamic PCD's for the libraries
and DXE drivers, this patch introduces new driver. It is
executed prior to other drivers. Mpp, ComPhy and Utmi libraries
initialization were moved from PrePi stage to DXE.

To force the correct driver dispatch sequence, introduce a protocol GUID
and install the protocol as a NULL protocol when PlatInitDxe executes.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Marcin Wojtas <mw@semihalf.com>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
 Platform/Marvell/Armada/Armada.dsc.inc                        |  3 ++
 Platform/Marvell/Armada/Armada70x0.fdf                        |  5 +++
 Platform/Marvell/Armada/Drivers/PlatInitDxe/PlatInitDxe.c     | 44 ++++++++++++++++++++
 Platform/Marvell/Armada/Drivers/PlatInitDxe/PlatInitDxe.inf   | 44 ++++++++++++++++++++
 Platform/Marvell/Armada/Library/Armada70x0Lib/Armada70x0Lib.c | 11 -----
 Platform/Marvell/Marvell.dec                                  |  5 +++
 6 files changed, 101 insertions(+), 11 deletions(-)

diff --git a/Platform/Marvell/Armada/Armada.dsc.inc b/Platform/Marvell/Armada/Armada.dsc.inc
index 89fb7e7..417bb0c 100644
--- a/Platform/Marvell/Armada/Armada.dsc.inc
+++ b/Platform/Marvell/Armada/Armada.dsc.inc
@@ -378,6 +378,9 @@
   ArmPkg/Drivers/TimerDxe/TimerDxe.inf
   ArmPkg/Drivers/GenericWatchdogDxe/GenericWatchdogDxe.inf
 
+  # Platform Initialization
+  Platform/Marvell/Armada/Drivers/PlatInitDxe/PlatInitDxe.inf
+
   # Platform drivers
   Platform/Marvell/Drivers/I2c/MvI2cDxe/MvI2cDxe.inf
   MdeModulePkg/Bus/I2c/I2cDxe/I2cDxe.inf
diff --git a/Platform/Marvell/Armada/Armada70x0.fdf b/Platform/Marvell/Armada/Armada70x0.fdf
index c861e78..763d76a 100644
--- a/Platform/Marvell/Armada/Armada70x0.fdf
+++ b/Platform/Marvell/Armada/Armada70x0.fdf
@@ -89,6 +89,11 @@ FvNameGuid         = 5eda4200-2c5f-43cb-9da3-0baf74b1b30c
 
   INF MdeModulePkg/Core/Dxe/DxeMain.inf
 
+  #
+  # Platform Initialization
+  #
+  INF Platform/Marvell/Armada/Drivers/PlatInitDxe/PlatInitDxe.inf
+
   # PI DXE Drivers producing Architectural Protocols (EFI Services)
   INF ArmPkg/Drivers/CpuDxe/CpuDxe.inf
   INF ArmPkg/Drivers/ArmGic/ArmGicDxe.inf
diff --git a/Platform/Marvell/Armada/Drivers/PlatInitDxe/PlatInitDxe.c b/Platform/Marvell/Armada/Drivers/PlatInitDxe/PlatInitDxe.c
new file mode 100644
index 0000000..919454b
--- /dev/null
+++ b/Platform/Marvell/Armada/Drivers/PlatInitDxe/PlatInitDxe.c
@@ -0,0 +1,44 @@
+/** @file
+  Copyright (C) Marvell International Ltd. and its affiliates
+
+  This program and the accompanying materials
+  are licensed and made available under the terms and conditions of the BSD License
+  which accompanies this distribution.  The full text of the license may be found at
+  http://opensource.org/licenses/bsd-license.php
+
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#include <Library/DebugLib.h>
+#include <Library/MppLib.h>
+#include <Library/MvComPhyLib.h>
+#include <Library/PcdLib.h>
+#include <Library/UefiDriverEntryPoint.h>
+#include <Library/UefiBootServicesTableLib.h>
+#include <Library/UtmiPhyLib.h>
+
+EFI_STATUS
+EFIAPI
+ArmadaPlatInitDxeEntryPoint (
+  IN EFI_HANDLE         ImageHandle,
+  IN EFI_SYSTEM_TABLE   *SystemTable
+  )
+{
+  EFI_STATUS    Status;
+
+  DEBUG ((DEBUG_ERROR, "\nArmada Platform Init\n\n"));
+
+  Status = gBS->InstallProtocolInterface (&ImageHandle,
+                  &gMarvellPlatformInitCompleteProtocolGuid,
+                  EFI_NATIVE_INTERFACE,
+                  NULL);
+  ASSERT_EFI_ERROR (Status);
+
+  MvComPhyInit ();
+  UtmiPhyInit ();
+  MppInitialize ();
+
+  return EFI_SUCCESS;
+}
diff --git a/Platform/Marvell/Armada/Drivers/PlatInitDxe/PlatInitDxe.inf b/Platform/Marvell/Armada/Drivers/PlatInitDxe/PlatInitDxe.inf
new file mode 100644
index 0000000..29abcaf
--- /dev/null
+++ b/Platform/Marvell/Armada/Drivers/PlatInitDxe/PlatInitDxe.inf
@@ -0,0 +1,44 @@
+#/* @file
+#  Copyright (C) Marvell International Ltd. and its affiliates
+#
+#  This program and the accompanying materials
+#  are licensed and made available under the terms and conditions of the BSD License
+#  which accompanies this distribution.  The full text of the license may be found at
+#  http://opensource.org/licenses/bsd-license.php
+#
+#  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+#*/
+
+[Defines]
+  INF_VERSION                    = 0x00010019
+  BASE_NAME                      = PlatInitDxe
+  FILE_GUID                      = 8c66f65b-08a6-4c91-b993-ff81e0adf818
+  MODULE_TYPE                    = DXE_DRIVER
+  VERSION_STRING                 = 1.0
+
+  ENTRY_POINT                    = ArmadaPlatInitDxeEntryPoint
+
+[Sources]
+  PlatInitDxe.c
+
+[Packages]
+  MdeModulePkg/MdeModulePkg.dec
+  MdePkg/MdePkg.dec
+  Platform/Marvell/Marvell.dec
+
+[LibraryClasses]
+  ComPhyLib
+  DebugLib
+  MppLib
+  PcdLib
+  TimerLib
+  UefiDriverEntryPoint
+  UtmiPhyLib
+
+[Protocols]
+  gMarvellPlatformInitCompleteProtocolGuid    ## PRODUCES
+
+[Depex]
+  TRUE
diff --git a/Platform/Marvell/Armada/Library/Armada70x0Lib/Armada70x0Lib.c b/Platform/Marvell/Armada/Library/Armada70x0Lib/Armada70x0Lib.c
index 0ed310f..968d28f 100644
--- a/Platform/Marvell/Armada/Library/Armada70x0Lib/Armada70x0Lib.c
+++ b/Platform/Marvell/Armada/Library/Armada70x0Lib/Armada70x0Lib.c
@@ -15,12 +15,8 @@
 
 #include <Library/ArmLib.h>
 #include <Library/ArmPlatformLib.h>
-#include <Library/MppLib.h>
-#include <Library/MvComPhyLib.h>
-#include <Library/UtmiPhyLib.h>
 #include <Ppi/ArmMpCoreInfo.h>
 
-
 ARM_CORE_INFO mArmada7040MpCoreInfoTable[] = {
   {
     // Cluster 0, Core 0
@@ -90,13 +86,6 @@ ArmPlatformInitialize (
   IN  UINTN                     MpId
   )
 {
-  if (!ArmPlatformIsPrimaryCore (MpId)) {
-    return RETURN_SUCCESS;
-  }
-
-  MvComPhyInit ();
-  UtmiPhyInit ();
-  MppInitialize ();
   return RETURN_SUCCESS;
 }
 
diff --git a/Platform/Marvell/Marvell.dec b/Platform/Marvell/Marvell.dec
index 0902086..e7d7c2c 100644
--- a/Platform/Marvell/Marvell.dec
+++ b/Platform/Marvell/Marvell.dec
@@ -56,6 +56,11 @@
   gShellFUpdateHiiGuid = { 0x9b5d2176, 0x590a, 0x49db, { 0x89, 0x5d, 0x4a, 0x70, 0xfe, 0xad, 0xbe, 0x24 } }
   gShellSfHiiGuid = { 0x03a67756, 0x8cde, 0x4638, { 0x82, 0x34, 0x4a, 0x0f, 0x6d, 0x58, 0x81, 0x39 } }
 
+[Protocols]
+  # installed as a protocol by PlatInitDxe to force ordering between DXE drivers
+  # that depend on the lowlevel platform initialization having been completed
+  gMarvellPlatformInitCompleteProtocolGuid = { 0x465b8cf7, 0x016f, 0x4ba6, { 0xbe, 0x6b, 0x28, 0x0e, 0x3a, 0x7d, 0x38, 0x6f } }
+
 [PcdsFixedAtBuild.common]
 #MPP
   gMarvellTokenSpaceGuid.PcdMppChipCount|0|UINT32|0x30000001
-- 
1.8.3.1



  reply	other threads:[~2017-10-09 16:50 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-09 17:00 [platforms: PATCH 00/13] Armada 7k/8k - misc improvements Marcin Wojtas
2017-10-09 17:00 ` Marcin Wojtas [this message]
2017-10-10 14:37   ` [platforms: PATCH 01/13] Marvell/Armada: Introduce platform initialization driver Leif Lindholm
2017-10-10 14:45     ` Marcin Wojtas
2017-10-10 15:03       ` Leif Lindholm
2017-10-10 15:06         ` Marcin Wojtas
2017-10-10 15:26           ` Leif Lindholm
2017-10-10 20:36             ` Ard Biesheuvel
2017-10-11  4:53               ` Marcin Wojtas
2017-10-11  8:32                 ` Leif Lindholm
2017-10-11  8:43                   ` Marcin Wojtas
2017-10-11  9:14                     ` Leif Lindholm
2017-10-11  9:16                       ` Marcin Wojtas
2017-10-09 17:00 ` [platforms: PATCH 02/13] Marvell/Armada: Switch to dynamic PCDs Marcin Wojtas
2017-10-10 14:38   ` Leif Lindholm
2017-10-09 17:00 ` [platforms: PATCH 03/13] Marvell/Armada: Armada70x0Lib: Terminate call stack list at entry Marcin Wojtas
2017-10-10 14:39   ` Leif Lindholm
2017-10-09 17:00 ` [platforms: PATCH 04/13] Marvell/Armada: Armada70x0Lib: Clean FV in the D-cache before boot Marcin Wojtas
2017-10-10 14:43   ` Leif Lindholm
2017-10-10 14:50     ` Marcin Wojtas
2017-10-10 15:29       ` Leif Lindholm
2017-10-10 20:39         ` Ard Biesheuvel
2017-10-09 17:00 ` [platforms: PATCH 05/13] Marvell/Armada: Use 4k/64k aligned sections for DXE/DXE-rt modules Marcin Wojtas
2017-10-10 14:44   ` Leif Lindholm
2017-10-09 17:00 ` [platforms: PATCH 06/13] Marvell/Armada: Switch to generic BDS Marcin Wojtas
2017-10-10 14:45   ` Leif Lindholm
2017-10-09 17:00 ` [platforms: PATCH 07/13] Marvell/Armada: Re-enable driver model diagnostics PCDs Marcin Wojtas
2017-10-10 14:46   ` Leif Lindholm
2017-10-09 17:00 ` [platforms: PATCH 08/13] Marvell/Armada: Modify GICC alias Marcin Wojtas
2017-10-10 14:53   ` Leif Lindholm
2017-10-10 14:56     ` Marcin Wojtas
2017-10-10 20:45       ` Ard Biesheuvel
2017-10-10 21:10         ` Leif Lindholm
2017-10-09 17:00 ` [platforms: PATCH 09/13] Marvell/Armada: Disable PerformanceLibrary Marcin Wojtas
2017-10-10 14:54   ` Leif Lindholm
2017-10-09 17:00 ` [platforms: PATCH 10/13] Marvell/Armada: Switch to unicore PrePi Marcin Wojtas
2017-10-10 14:54   ` Leif Lindholm
2017-10-09 17:01 ` [platforms: PATCH 11/13] Marvell/Armada: Remove outdated SEC alignment override Marcin Wojtas
2017-10-10 14:58   ` Leif Lindholm
2017-10-10 15:03     ` Marcin Wojtas
2017-10-09 17:01 ` [platforms: PATCH 12/13] Marvell/Armada: Add the UefiPxeBcDxe driver Marcin Wojtas
2017-10-10 14:59   ` Leif Lindholm
2017-10-09 17:01 ` [platforms: PATCH 13/13] Marvell/Documentation: Follow EDK2 coding style in the PortingGuide Marcin Wojtas
2017-10-10 14:59   ` Leif Lindholm

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1507568462-28775-2-git-send-email-mw@semihalf.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox