From nobody Thu May 2 00:21:46 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1500999837239956.0431838139654; Tue, 25 Jul 2017 09:23:57 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id F24E32095DB9A; Tue, 25 Jul 2017 09:21:49 -0700 (PDT) Received: from mx0a-0014ca01.pphosted.com (mx0b-0014ca01.pphosted.com [208.86.201.193]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id A67DD2095DB88 for ; Tue, 25 Jul 2017 09:21:48 -0700 (PDT) Received: from pps.filterd (m0042333.ppops.net [127.0.0.1]) by mx0b-0014ca01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id v6PGJDaI021544; Tue, 25 Jul 2017 09:23:44 -0700 Received: from mx-sanjose.cadence.com (mx-sanjose.Cadence.COM [158.140.2.60]) by mx0b-0014ca01.pphosted.com with ESMTP id 2bv29sq3gh-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Tue, 25 Jul 2017 09:23:44 -0700 Received: from maileu3.global.cadence.com (maileu3.Cadence.COM [10.160.88.99]) by mx-sanjose.cadence.com (8.14.4/8.14.4) with ESMTP id v6PGMf3u006080 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=FAIL); Tue, 25 Jul 2017 09:22:43 -0700 (PDT) Received: from maileu3.global.cadence.com (10.160.88.99) by maileu3.global.cadence.com (10.160.88.99) with Microsoft SMTP Server (TLS) id 15.0.1044.25; Tue, 25 Jul 2017 18:23:37 +0200 Received: from lvloginb.cadence.com (10.165.177.11) by maileu3.global.cadence.com (10.160.88.99) with Microsoft SMTP Server (TLS) id 15.0.1044.25 via Frontend Transport; Tue, 25 Jul 2017 18:23:37 +0200 Received: from lvloginb.cadence.com (localhost [127.0.0.1]) by lvloginb.cadence.com (8.14.4/8.14.4) with ESMTP id v6PGNbsd030423; Tue, 25 Jul 2017 17:23:37 +0100 Received: (from stelford@localhost) by lvloginb.cadence.com (8.14.4/8.14.4/Submit) id v6PGNYtr030235; Tue, 25 Jul 2017 17:23:34 +0100 X-Original-To: edk2-devel@ml01.01.org X-CrossPremisesHeadersFilteredBySendConnector: maileu3.global.cadence.com From: Scott Telford To: , , , Date: Tue, 25 Jul 2017 17:23:31 +0100 Message-ID: <1500999811-22999-1-git-send-email-stelford@cadence.com> X-Mailer: git-send-email 2.2.2 MIME-Version: 1.0 X-OrganizationHeadersPreserved: maileu3.global.cadence.com X-Received: by mx-sanjose.cadence.com as v6PGMf3u006080 at Tue Jul 25 09:22:43 2017 Subject: [edk2] [staging/cadence-aarch64 PATCH] CadencePkg: switch to 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: , Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Change CadenceCspResetSystemLib to implement ResetSystemLib, consumed by MdeModulePkg/Universal/ResetSystemRuntimeDxe. Wire all reset variants to ResetCold, except for ResetShutdown and EnterS3WithImmediateWake, which return immediately. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Scott Telford Reviewed-by: Leif Lindholm --- CadencePkg/CadenceCsp.dsc | 4 +- CadencePkg/CadenceCsp.fdf | 2 +- .../CadenceCspResetSystemLib.c | 121 +++++++++++++----= ---- .../CadenceCspResetSystemLib.inf | 13 +-- 4 files changed, 84 insertions(+), 56 deletions(-) diff --git a/CadencePkg/CadenceCsp.dsc b/CadencePkg/CadenceCsp.dsc index 3711b7b..ee4327d 100644 --- a/CadencePkg/CadenceCsp.dsc +++ b/CadencePkg/CadenceCsp.dsc @@ -103,7 +103,7 @@ ArmGenericTimerCounterLib|ArmPkg/Library/ArmGenericTimerPhyCounterLib/Ar= mGenericTimerPhyCounterLib.inf =20 PlatformPeiLib|ArmPlatformPkg/PlatformPei/PlatformPeiLib.inf - EfiResetSystemLib|CadencePkg/Library/CadenceCspResetSystemLib/CadenceCsp= ResetSystemLib.inf + ResetSystemLib|CadencePkg/Library/CadenceCspResetSystemLib/CadenceCspRes= etSystemLib.inf =20 RealTimeClockLib|EmbeddedPkg/Library/TemplateRealTimeClockLib/TemplateRe= alTimeClockLib.inf =20 @@ -620,7 +620,7 @@ MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariableRuntimeDxe.inf MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntim= eDxe.inf - EmbeddedPkg/ResetRuntimeDxe/ResetRuntimeDxe.inf + MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystemRuntimeDxe.inf EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf EmbeddedPkg/MetronomeDxe/MetronomeDxe.inf =20 diff --git a/CadencePkg/CadenceCsp.fdf b/CadencePkg/CadenceCsp.fdf index 8a9acbd..6fb1478 100644 --- a/CadencePkg/CadenceCsp.fdf +++ b/CadencePkg/CadenceCsp.fdf @@ -152,7 +152,7 @@ FvNameGuid =3D b1e2a5cf-5357-4fc8-9532-49f3ce32= 7bd3 !endif INF MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariableRuntimeDxe.= inf INF MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRu= ntimeDxe.inf - INF EmbeddedPkg/ResetRuntimeDxe/ResetRuntimeDxe.inf + INF MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystemRuntimeDxe.i= nf INF EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf INF EmbeddedPkg/MetronomeDxe/MetronomeDxe.inf =20 diff --git a/CadencePkg/Library/CadenceCspResetSystemLib/CadenceCspResetSys= temLib.c b/CadencePkg/Library/CadenceCspResetSystemLib/CadenceCspResetSyste= mLib.c index 20ea1a6..1996adc 100644 --- a/CadencePkg/Library/CadenceCspResetSystemLib/CadenceCspResetSystemLib.c +++ b/CadencePkg/Library/CadenceCspResetSystemLib/CadenceCspResetSystemLib.c @@ -1,8 +1,8 @@ /** @file - Library to support ResetSystem Runtime call. + ResetSystemLib implementation for Cadence CSP. =20 - Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
- Copyright (c) 2013, ARM Ltd. All rights reserved.
+ Copyright (c) 2008 - 2010, Apple Inc. All rights reserved.
+ Copyright (c) 2017, Linaro Ltd. All rights reserved.
Copyright (c) 2017, Cadence Design Systems, Inc. All rights reserved. =20 This program and the accompanying materials @@ -15,68 +15,97 @@ =20 **/ =20 -#include =20 -#include +#include + #include -#include -#include #include -#include +#include + =20 /** - Resets the entire platform. + 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. +**/ +VOID +EFIAPI +ResetCold ( + VOID + ) +{ + //Perform cold reset of the system using CSP System Registers. + MmioWrite32 ((PcdGet64(PcdCspSysRegBase) + CSP_SYSREG_SW_RESET), 0xDEAD); +} =20 - @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, EfiResetW= arm, or - EfiResetShutdown the data buffer starts wi= th a Null-terminated - Unicode string, optionally followed by add= itional binary data. +/** + This function causes a system-wide initialization (warm reset), in which= all + processors are set to their initial state. Pending cycles are not corrup= ted. =20 + If this function returns, it means that the system does not support warm + reset. **/ -EFI_STATUS +VOID EFIAPI -LibResetSystem ( - IN EFI_RESET_TYPE ResetType, - IN EFI_STATUS ResetStatus, - IN UINTN DataSize, - IN CHAR16 *ResetData OPTIONAL +ResetWarm ( + VOID ) { - switch (ResetType) { - case EfiResetPlatformSpecific: - // Map the platform specific reset as reboot - case EfiResetWarm: - // Map a warm reset into a cold reset - case EfiResetShutdown: - // Map a shutdown into a cold reset - case EfiResetCold: - MmioWrite16((PcdGet64(PcdCspSysRegBase) + CSP_SYSREG_SW_RESET), 0xDEAD= ); - break; - default: - return EFI_INVALID_PARAMETER; - } - - ASSERT(FALSE); - return EFI_UNSUPPORTED; + ResetCold (); } =20 /** - Initialize any infrastructure required for LibResetSystem () to function. + This function causes the system to enter a power state equivalent + to the ACPI G2/S5 or G3 states. =20 - @param ImageHandle The firmware allocated handle for the EFI image. - @param SystemTable A pointer to the EFI System Table. + If this function returns, it means that the system does not support shut= down + reset. +**/ +VOID +EFIAPI +ResetShutdown ( + VOID + ) +{ + // not implemented +} + +/** + This function causes the system to enter S3 and then wake up immediately. =20 - @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS. + If this function returns, it means that the system does not support S3 + feature. +**/ +VOID +EFIAPI +EnterS3WithImmediateWake ( + VOID + ) +{ + // not implemented +} + +/** + 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 Reset= Data + the platform must pick a supported reset type to perform.The platform may + optionally log the parameters from any non-normal reset that occurs. =20 + @param[in] DataSize The size, in bytes, of ResetData. + @param[in] ResetData The data buffer starts with a Null-terminated str= ing, + followed by the EFI_GUID. **/ -EFI_STATUS +VOID EFIAPI -LibInitializeResetSystem ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable +ResetPlatformSpecific ( + IN UINTN DataSize, + IN VOID *ResetData ) { - return EFI_SUCCESS; + ResetCold (); } diff --git a/CadencePkg/Library/CadenceCspResetSystemLib/CadenceCspResetSys= temLib.inf b/CadencePkg/Library/CadenceCspResetSystemLib/CadenceCspResetSys= temLib.inf index 66491ee..949f9e2 100644 --- a/CadencePkg/Library/CadenceCspResetSystemLib/CadenceCspResetSystemLib.= inf +++ b/CadencePkg/Library/CadenceCspResetSystemLib/CadenceCspResetSystemLib.= inf @@ -1,7 +1,7 @@ #/** @file -# Library to support ResetSystem Runtime call. +# ResetSystemLib implementation for Cadence CSP. # -# Copyright (c) 2006, Intel Corporation. All rights reserved.
+# Copyright (c) 2008, Apple Inc. All rights reserved.
# Copyright (c) 2017, Cadence Design Systems, Inc. All rights reserved. # # This program and the accompanying materials @@ -20,21 +20,20 @@ FILE_GUID =3D 4b1bc734-7534-4baa-b33f-7f5caa743996 MODULE_TYPE =3D BASE VERSION_STRING =3D 1.0 - LIBRARY_CLASS =3D EfiResetSystemLib + LIBRARY_CLASS =3D ResetSystemLib =20 =20 [Sources.common] CadenceCspResetSystemLib.c =20 [Packages] - CadencePkg/CadenceCspPkg.dec - EmbeddedPkg/EmbeddedPkg.dec + ArmPkg/ArmPkg.dec + MdeModulePkg/MdeModulePkg.dec MdePkg/MdePkg.dec + CadencePkg/CadenceCspPkg.dec =20 [LibraryClasses] IoLib - DebugLib - PcdLib =20 [FixedPcd] gCadenceCspTokenSpaceGuid.PcdCspSysRegBase --=20 2.2.2 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel