From patchwork Tue Jul 4 11:00:17 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 106941 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp854554qge; Tue, 4 Jul 2017 04:00:29 -0700 (PDT) X-Received: by 10.84.143.36 with SMTP id 33mr15716848ply.171.1499166028928; Tue, 04 Jul 2017 04:00:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1499166028; cv=none; d=google.com; s=arc-20160816; b=wuh8CYw9YmufQsFyCLVxMi85l6Ekc0jL9Vm6ND8AYeR8CxKevQtJhYKCW57PyaIwsD s8xyYML35Pj9Sy7ZMEZTL7A30drTUKDj700d7GHY2HbCgGme8PIXRCBZig2GZM1Ug0w7 aNhCqtUxfPdE40Y/quGJcoONmIYY3twwo2BWBPllJuHdbhNCImIZpX2Vrh3cvPNQ8/OA 2M0gXNymQwr6qM2k11e8PjobUe2M0dCHC1vbuXgCocd6TMg7j9CNIbArWqd1X4X6jYx7 T2Og1HzeNa+hFqV6OMxqI4ZKZibbz66dqK3DmqZB5iMHdmxVYrosb6RBXzHRa1m8eXBi eP9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:message-id:date:to:from:dkim-signature :delivered-to:arc-authentication-results; bh=FbyLZ0wVJUIX3N4bZ9f3fPYNClNOHLuh3tmIsBS/KWY=; b=lyIpSXDCDEVzybKu1KeAUsvDi9O0X/U7JehAvlwjdFrBRQdDUrsEZ4LaTJHfdidn1c 4xbxHY51rzp8vDGalilUlChJ5LQZAWqnBp5ftkwt3PnANIFlNLr7MDFg9h3D2Bbla9Ij mEEWAMx71pjtvQ7wYv7RO+a88B5wN2F7pYHROrp08tdZviTXsn4OwNdginFp3r9BU3ND 4nps1bBSmVHueMq0btEitpWcrJufstovfMZsacgMebwguDXv8jfkbwQnsgVtYKplLuZ7 t0z/P2uj8jcCJHHfIFeqfpbTMdwJ5opmkSaRFaTC98MsX/76O72yTvbx5dgbtDYcQfm1 KpFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.b=WfVIuq+a; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ml01.01.org (ml01.01.org. [198.145.21.10]) by mx.google.com with ESMTPS id q2si6586412pgd.227.2017.07.04.04.00.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 04 Jul 2017 04:00:28 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) client-ip=198.145.21.10; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.b=WfVIuq+a; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 5A2E221A00AC9; Tue, 4 Jul 2017 03:58:49 -0700 (PDT) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received: from mail-wm0-x234.google.com (mail-wm0-x234.google.com [IPv6:2a00:1450:400c:c09::234]) (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 B060B209455ED for ; Tue, 4 Jul 2017 03:58:47 -0700 (PDT) Received: by mail-wm0-x234.google.com with SMTP id w126so192294518wme.0 for ; Tue, 04 Jul 2017 04:00:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=mx1x9RYC0ysyO8m5m18QljY48BqI+//V139BcH9ljfU=; b=WfVIuq+ayVKei/WYa1lDOZ4euiwEzmeH3NLyFI6Q61etWoKJvXGsFXTiL2/9V6g2RI rbJfjdGb1oE63C++qmDy/+Cn3FicZg4c2ATdzfN8Gog1bLJHPux7JZLNJuyv3d8+OUVj Fri4Z84nXM3irhWGtqLuwBGoS2yL8xZJkMrlo= 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; bh=mx1x9RYC0ysyO8m5m18QljY48BqI+//V139BcH9ljfU=; b=eP9aLH7EMi2yKNMZsLd6SDIKVQVGRipC7TbhgAv/MIE7K12LJk19aoTvCbiMA/DRHv gj79xjAQwQQiva0i3lci59VA/sDT0hs5Fsphz+fUg5k6fwPmdxW9MtyDlUnfelWaA2Zh hbQF5fKyICTfjvDtgce0hgIVC/2Dgj/HWzLbzc+tqNk6MK0KYezt3Tgcxlw2iypDJngB +YuEtSEPRnZpf1fL1PfOrPxQhrEgeF0LsIoNnO1QdobAChoL02q4v9w1aTYfyb95LaYr s7fOwKgvoX17xHnttYFcPuCOOTT60GGnX8TTVNnpPHqMhOkGTDrk6qbnQ/X1wYDXxFfM qARA== X-Gm-Message-State: AKS2vOyo+XhRJnpAO5wyQbpg9wBltdg57m6qnbFUZIoIF1JnBV9g/X/Z YaGOF77yL0xFeGxzIb5y1A== X-Received: by 10.28.167.205 with SMTP id q196mr28100544wme.54.1499166023729; Tue, 04 Jul 2017 04:00:23 -0700 (PDT) Received: from localhost.localdomain ([154.145.144.206]) by smtp.gmail.com with ESMTPSA id i136sm596670wmf.33.2017.07.04.04.00.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 04 Jul 2017 04:00:22 -0700 (PDT) From: Ard Biesheuvel To: edk2-devel@lists.01.org, leif.lindholm@linaro.org, mw@semihalf.com Date: Tue, 4 Jul 2017 12:00:17 +0100 Message-Id: <20170704110017.32042-1-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.9.3 Subject: [edk2] [PATCH] Platforms/Marvell: switch to generic ResetSystemRuntimeDxe 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: , Cc: Ard Biesheuvel MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" Switch to the generic implementation of the ResetSystem() runtime service call, which is preferred over the one in EmbeddedPkg. This involves selecting another DXE runtime driver, and morphing the existing EfiResetSystemLib implementation into a ResetSystemLib one (which is what the generic driver depends on for platform glue) Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel --- Platforms/Marvell/Armada/Armada.dsc.inc | 4 +- Platforms/Marvell/Armada/Armada70x0.fdf | 2 +- Platforms/Marvell/Library/ResetSystemLib/MvResetSystemLib.c | 110 ++++++++++++++------ Platforms/Marvell/Library/ResetSystemLib/MvResetSystemLib.inf | 7 +- 4 files changed, 87 insertions(+), 36 deletions(-) -- 2.9.3 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel diff --git a/Platforms/Marvell/Armada/Armada.dsc.inc b/Platforms/Marvell/Armada/Armada.dsc.inc index 475fc6d05379..32eaa2942564 100644 --- a/Platforms/Marvell/Armada/Armada.dsc.inc +++ b/Platforms/Marvell/Armada/Armada.dsc.inc @@ -94,7 +94,7 @@ # Reset and Time libraries EfiTimeBaseLib|OpenPlatformPkg/Library/EfiTimeBaseLib/EfiTimeBaseLib.inf RealTimeClockLib|OpenPlatformPkg/Platforms/Marvell/Armada/Library/RealTimeClockLib/RealTimeClockLib.inf - EfiResetSystemLib|OpenPlatformPkg/Platforms/Marvell/Library/ResetSystemLib/MvResetSystemLib.inf + ResetSystemLib|OpenPlatformPkg/Platforms/Marvell/Library/ResetSystemLib/MvResetSystemLib.inf # Network support NetLib|MdeModulePkg/Library/DxeNetLib/DxeNetLib.inf @@ -416,7 +416,7 @@ MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariableRuntimeDxe.inf EmbeddedPkg/EmbeddedMonotonicCounter/EmbeddedMonotonicCounter.inf - EmbeddedPkg/ResetRuntimeDxe/ResetRuntimeDxe.inf + MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystemRuntimeDxe.inf EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf EmbeddedPkg/MetronomeDxe/MetronomeDxe.inf diff --git a/Platforms/Marvell/Armada/Armada70x0.fdf b/Platforms/Marvell/Armada/Armada70x0.fdf index 280b40be1d39..8091ea260261 100644 --- a/Platforms/Marvell/Armada/Armada70x0.fdf +++ b/Platforms/Marvell/Armada/Armada70x0.fdf @@ -99,7 +99,7 @@ FvNameGuid = 5eda4200-2c5f-43cb-9da3-0baf74b1b30c INF MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf INF MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariableRuntimeDxe.inf INF EmbeddedPkg/EmbeddedMonotonicCounter/EmbeddedMonotonicCounter.inf - INF EmbeddedPkg/ResetRuntimeDxe/ResetRuntimeDxe.inf + INF MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystemRuntimeDxe.inf INF EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf INF EmbeddedPkg/MetronomeDxe/MetronomeDxe.inf INF OpenPlatformPkg/Drivers/I2c/MvI2cDxe/MvI2cDxe.inf diff --git a/Platforms/Marvell/Library/ResetSystemLib/MvResetSystemLib.c b/Platforms/Marvell/Library/ResetSystemLib/MvResetSystemLib.c index c0787aceac9c..f349c5c5387b 100644 --- a/Platforms/Marvell/Library/ResetSystemLib/MvResetSystemLib.c +++ b/Platforms/Marvell/Library/ResetSystemLib/MvResetSystemLib.c @@ -66,51 +66,99 @@ LibResetSystemVirtualNotifyEvent ( } /** - Resets the entire platform. - - @param ResetType The type of reset to perform. - @param ResetStatus The status code for the reset. - @param DataSize The size, in bytes, of WatchdogData. - @param ResetData For a ResetType of EfiResetCold, EfiResetWarm, - or EfiResetShutdown the data buffer starts with - a Null-terminated Unicode string, optionally - followed by additional binary data. + This function causes a system-wide reset (cold reset), in which + all circuitry within the system returns to its initial state. This type of reset + is asynchronous to system operation and operates without regard to + cycle boundaries. + + If this function returns, it means that the system does not support cold reset. **/ -EFI_STATUS +VOID EFIAPI -LibResetSystem ( - IN EFI_RESET_TYPE ResetType, - IN EFI_STATUS ResetStatus, - IN UINTN DataSize, - IN VOID *ResetData OPTIONAL +ResetCold ( + VOID ) { UINT32 Data; - switch (ResetType) { - case EfiResetCold: - case EfiResetWarm: - Data = MmioRead32 (mAddress); - Data &= ~PcdGet32 (PcdResetRegMask); - MmioWrite32 (mAddress, Data); - break; - case EfiResetShutdown: + Data = MmioRead32 (mAddress); + Data &= ~PcdGet32 (PcdResetRegMask); + MmioWrite32 (mAddress, Data); +} + +/** + This function causes a system-wide initialization (warm reset), in which all processors + are set to their initial state. Pending cycles are not corrupted. + + If this function returns, it means that the system does not support warm reset. +**/ +VOID +EFIAPI +ResetWarm ( + VOID + ) +{ + // Map a warm reset into a cold reset + ResetCold (); +} + +/** + This function causes the system to enter a power state equivalent + to the ACPI G2/S5 or G3 states. + + If this function returns, it means that the system does not support shutdown reset. +**/ +VOID +EFIAPI +ResetShutdown ( + VOID + ) +{ // // Currently there is no support for power-off platform // - break; - default: - break; - } +} + +/** + This function causes the system to enter S3 and then wake up immediately. + + If this function returns, it means that the system does not support S3 feature. +**/ +VOID +EFIAPI +EnterS3WithImmediateWake ( + VOID + ) +{ + // not implemented +} - return EFI_DEVICE_ERROR; +/** + This function causes a systemwide reset. The exact type of the reset is + defined by the EFI_GUID that follows the Null-terminated Unicode string passed + into ResetData. If the platform does not recognize the EFI_GUID in ResetData + the platform must pick a supported reset type to perform.The platform may + optionally log the parameters from any non-normal reset that occurs. + + @param[in] DataSize The size, in bytes, of ResetData. + @param[in] ResetData The data buffer starts with a Null-terminated string, + followed by the EFI_GUID. +**/ +VOID +EFIAPI +ResetPlatformSpecific ( + IN UINTN DataSize, + IN VOID *ResetData + ) +{ + // Map the platform specific reset as reboot + ResetCold (); } -EFI_STATUS +RETURN_STATUS EFIAPI LibInitializeResetSystem ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable + VOID ) { UINT64 Alignment; diff --git a/Platforms/Marvell/Library/ResetSystemLib/MvResetSystemLib.inf b/Platforms/Marvell/Library/ResetSystemLib/MvResetSystemLib.inf index 87fff5707909..0d5951d7e9a0 100644 --- a/Platforms/Marvell/Library/ResetSystemLib/MvResetSystemLib.inf +++ b/Platforms/Marvell/Library/ResetSystemLib/MvResetSystemLib.inf @@ -1,4 +1,5 @@ # Copyright (C) 2016 Marvell International Ltd. +# Copyright (C) 2017 Linaro Ltd. # # Marvell BSD License Option # @@ -32,16 +33,18 @@ [Defines] INF_VERSION = 0x00010019 - BASE_NAME = Reset + BASE_NAME = MvResetSystemLib FILE_GUID = 9d1373c0-6fac-432c-88e7-818744dc45d9 MODULE_TYPE = BASE VERSION_STRING = 1.0 - LIBRARY_CLASS = EfiResetSystemLib + LIBRARY_CLASS = ResetSystemLib + CONSTRUCTOR = LibInitializeResetSystem [Sources.common] MvResetSystemLib.c [Packages] + MdeModulePkg/MdeModulePkg.dec MdePkg/MdePkg.dec OpenPlatformPkg/Platforms/Marvell/Marvell.dec