From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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) X-CrossPremisesHeadersFilteredBySendConnector: maileu3.global.cadence.com 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 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: [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: , X-List-Received-Date: Tue, 25 Jul 2017 16:21:48 -0000 Content-Type: text/plain 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 --- 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/ArmGenericTimerPhyCounterLib.inf PlatformPeiLib|ArmPlatformPkg/PlatformPei/PlatformPeiLib.inf - EfiResetSystemLib|CadencePkg/Library/CadenceCspResetSystemLib/CadenceCspResetSystemLib.inf + ResetSystemLib|CadencePkg/Library/CadenceCspResetSystemLib/CadenceCspResetSystemLib.inf RealTimeClockLib|EmbeddedPkg/Library/TemplateRealTimeClockLib/TemplateRealTimeClockLib.inf @@ -620,7 +620,7 @@ MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariableRuntimeDxe.inf MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntimeDxe.inf - EmbeddedPkg/ResetRuntimeDxe/ResetRuntimeDxe.inf + MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystemRuntimeDxe.inf EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf EmbeddedPkg/MetronomeDxe/MetronomeDxe.inf 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 = b1e2a5cf-5357-4fc8-9532-49f3ce327bd3 !endif INF MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariableRuntimeDxe.inf INF MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntimeDxe.inf - INF EmbeddedPkg/ResetRuntimeDxe/ResetRuntimeDxe.inf + INF MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystemRuntimeDxe.inf INF EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf INF EmbeddedPkg/MetronomeDxe/MetronomeDxe.inf diff --git a/CadencePkg/Library/CadenceCspResetSystemLib/CadenceCspResetSystemLib.c b/CadencePkg/Library/CadenceCspResetSystemLib/CadenceCspResetSystemLib.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. - 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. This program and the accompanying materials @@ -15,68 +15,97 @@ **/ -#include -#include +#include + #include -#include -#include #include -#include +#include + /** - 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); +} - @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 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. **/ -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 (); } /** - 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. - @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. - @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 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. **/ -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/CadenceCspResetSystemLib.inf b/CadencePkg/Library/CadenceCspResetSystemLib/CadenceCspResetSystemLib.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 = 4b1bc734-7534-4baa-b33f-7f5caa743996 MODULE_TYPE = BASE VERSION_STRING = 1.0 - LIBRARY_CLASS = EfiResetSystemLib + LIBRARY_CLASS = ResetSystemLib [Sources.common] CadenceCspResetSystemLib.c [Packages] - CadencePkg/CadenceCspPkg.dec - EmbeddedPkg/EmbeddedPkg.dec + ArmPkg/ArmPkg.dec + MdeModulePkg/MdeModulePkg.dec MdePkg/MdePkg.dec + CadencePkg/CadenceCspPkg.dec [LibraryClasses] IoLib - DebugLib - PcdLib [FixedPcd] gCadenceCspTokenSpaceGuid.PcdCspSysRegBase -- 2.2.2