From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: None (no SPF record) identity=mailfrom; client-ip=2a00:1450:4010:c07::236; helo=mail-lf0-x236.google.com; envelope-from=mw@semihalf.com; receiver=edk2-devel@lists.01.org Received: from mail-lf0-x236.google.com (mail-lf0-x236.google.com [IPv6:2a00:1450:4010:c07::236]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 8C64E21EA15DC for ; Wed, 11 Oct 2017 03:12:31 -0700 (PDT) Received: by mail-lf0-x236.google.com with SMTP id a69so1496086lfe.5 for ; Wed, 11 Oct 2017 03:16:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=EpjCl/cmnnUgdY7RglaorymXIFAIcFW29XiqxJtKBrg=; b=fOCJbehWCAFwnuESzRjNpjoXzfuWsb+kNNXMV7oYWZ3kEKPOdT4h7gsBgAotlcSkbr kSNCIlSwRBFpue/uuVtsa6CxVcd283cjJBeQ/QkT/10jfVZltLoEAlEA9isZrDk+gDTg LM/VosF6o4ungAy6+kFzxV9mRYnKuA5U4qmHQr3ioaH99LTcZ+IS6Kc9mgGJa+EL0zWQ +TGx3PaEA00VJi9xb+GE0u+Q+bysN4FgJM8gsot//mp9Qb8fhoEvj5PfCFg2px/7gfak WnmUoAA5gnAoF6pl7j3UovzvdmVfskyTphb0ANfE+lFpO5PThMjSTKi7l3OzHisHJc31 y0HQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=EpjCl/cmnnUgdY7RglaorymXIFAIcFW29XiqxJtKBrg=; b=L2lPSq1p01wNvkYWuku0pFTWcqOyfWJsXGLq3deMrVDAPyhkwBWr/0GWLeoXnog+SX dEUdeKuhC/u2urfnfoBiQT+W/Ln20ppSpgSuFIdNdFk4sct6JLjy4reNgdjLOdPYAkQL QboOBcEUyTHpQq7CdVcKMzLMPr8pSfcgIbnb2GdNfvVPg18e4B0DMSZP8r8kBTH4YqfB N0pFHN5ZGPjECuDS62IC4QpU//cNFAynUbc9hIM1MulLDxDtH5cYuzxnBqqHvDVCv98i /2Y2KCXDXC0CZMTNCmaWtQzACuFFbgAftU4W3DkdFD2ESREYvYJq1bBAGKsrgwrSNqrv 1G5w== X-Gm-Message-State: AMCzsaXCtDx1U4Lax23+XsGDcttF/rV2YrAsK7tbwbUaNiUKicVAjfav ZwFFSpVgnS4jUueG56GzYbdNIPXUG+Y= X-Google-Smtp-Source: AOwi7QAnpzR8EdZFQmrRsJU+hTvaYYSk+SDW6aL2ymSY7elihpMqkhko6l33DtirET+baNu5UPqwUQ== X-Received: by 10.25.193.81 with SMTP id r78mr3151909lff.187.1507716958645; Wed, 11 Oct 2017 03:15:58 -0700 (PDT) Received: from gilgamesh.semihalf.com (31-172-191-173.noc.fibertech.net.pl. [31.172.191.173]) by smtp.gmail.com with ESMTPSA id 84sm1539781ljc.67.2017.10.11.03.15.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 11 Oct 2017 03:15:57 -0700 (PDT) From: Marcin Wojtas 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 Date: Wed, 11 Oct 2017 12:15:28 +0200 Message-Id: <1507716939-31798-2-git-send-email-mw@semihalf.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1507716939-31798-1-git-send-email-mw@semihalf.com> References: <1507716939-31798-1-git-send-email-mw@semihalf.com> Subject: [platforms: PATCH v2 01/12] Marvell/Armada: Introduce platform initialization driver X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Oct 2017 10:12:31 -0000 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 [Introduce protocol GUID to force correct driver dispatch order] Signed-off-by: Ard Biesheuvel Signed-off-by: Marcin Wojtas --- Platform/Marvell/Armada/Armada.dsc.inc | 3 ++ Platform/Marvell/Armada/Armada70x0.fdf | 5 +++ Platform/Marvell/Armada/Drivers/PlatInitDxe/PlatInitDxe.c | 45 ++++++++++++++++++++ Platform/Marvell/Armada/Drivers/PlatInitDxe/PlatInitDxe.inf | 45 ++++++++++++++++++++ Platform/Marvell/Armada/Library/Armada70x0Lib/Armada70x0Lib.c | 11 ----- Platform/Marvell/Marvell.dec | 5 +++ 6 files changed, 103 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..1efad77 --- /dev/null +++ b/Platform/Marvell/Armada/Drivers/PlatInitDxe/PlatInitDxe.c @@ -0,0 +1,45 @@ +/** @file + Copyright (c) 2017, Linaro Limited. All rights reserved. + Copyright (c) 2017, 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 +#include +#include +#include +#include +#include +#include + +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..790b7e3 --- /dev/null +++ b/Platform/Marvell/Armada/Drivers/PlatInitDxe/PlatInitDxe.inf @@ -0,0 +1,45 @@ +#/* @file +# Copyright (c) 2017, Linaro Limited. All rights reserved. +# Copyright (c) 2017, 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 #include -#include -#include -#include #include - 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 -- 2.7.4