From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-x22d.google.com (mail-wr0-x22d.google.com [IPv6:2a00:1450:400c:c0c::22d]) (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 845652193B800 for ; Mon, 31 Jul 2017 09:36:30 -0700 (PDT) Received: by mail-wr0-x22d.google.com with SMTP id k71so127940034wrc.2 for ; Mon, 31 Jul 2017 09:38:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=nU2JZIh9wtINHXrJtJ0b0utPML3q2U8Lf5d43qoib5s=; b=LWEOi9VWpkaJP1Fh2ZgeMJTz18+1/Ff0N10zbSPt8QLlwO4+oAVB6F8V6HxSzOX7MZ AQrQrnlfp+g2tKa++5Wto0LZmd0e/Cp2cDU7u0Mo1KbmniFCVW2lLvdr0XA6fY3oKBkG GW8upKJzJlR99hhVL1P+SE6PQt4+B+d6QV8Xs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=nU2JZIh9wtINHXrJtJ0b0utPML3q2U8Lf5d43qoib5s=; b=g6vMmUoUIlIxEhSx0hS6INHTGaGCyE21+ovo1ZxU/ixREa3aDNUzALpvATY2rO8aOc BX+Loxyrm1G3ShYDPaF5XhUsVtl1tWNu8JAyQkGKgWrwtU3bd7L6Wx5CSKq5iDvL6q7K JYrXZzTmOBZDO9qUWcJFtAhTVdG7wu4PNkNrUYeOlltmOfOen01zI7l1i2X3SL/nz+ZZ fVotY9aq/ZEw4zKjZR3tHHpbZPT3ewIh/+mm51ciHZsoKbPJED22ki68WWwAkp5eEpgQ ffFgmBVT7OEpVNzopy7HY3lBcmrQ2AmPXQqTRxCjlXYC7gFb3s5uKm8/hPwpjV1TmwVS aJTw== X-Gm-Message-State: AIVw1106SPwsGAfGI/zf2O7osDEhU8m2BFsb3xtxEz35TAd1yJ3f1vTp n0nWrR5dJDahUXx2 X-Received: by 10.223.138.182 with SMTP id y51mr13267990wry.83.1501519116367; Mon, 31 Jul 2017 09:38:36 -0700 (PDT) Received: from bivouac.eciton.net (bivouac.eciton.net. [2a00:1098:0:86:1000:23:0:2]) by smtp.gmail.com with ESMTPSA id n184sm1034376wme.33.2017.07.31.09.38.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 31 Jul 2017 09:38:35 -0700 (PDT) Date: Mon, 31 Jul 2017 17:38:34 +0100 From: Leif Lindholm To: Scott Telford Cc: edk2-devel@ml01.01.org, afish@apple.com, michael.d.kinney@intel.com Message-ID: <20170731163833.GB1501@bivouac.eciton.net> References: <1500999811-22999-1-git-send-email-stelford@cadence.com> MIME-Version: 1.0 In-Reply-To: <1500999811-22999-1-git-send-email-stelford@cadence.com> User-Agent: Mutt/1.5.23 (2014-03-12) Subject: Re: [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: Mon, 31 Jul 2017 16:36:31 -0000 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Tue, Jul 25, 2017 at 05:23:31PM +0100, Scott Telford wrote: > 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 Looks good to me: Reviewed-by: Leif Lindholm Rebased to current edk2 HEAD and pushed the series to edk2-staging:cadence-aarch64 as 559a165c68...3709125beb. / Leif > --- > 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 >