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 <[email protected]>
Looks good to me: Reviewed-by: Leif Lindholm <[email protected]> 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.<BR> > - Copyright (c) 2013, ARM Ltd. All rights reserved.<BR> > + Copyright (c) 2008 - 2010, Apple Inc. All rights reserved.<BR> > + Copyright (c) 2017, Linaro Ltd. All rights reserved.<BR> > Copyright (c) 2017, Cadence Design Systems, Inc. All rights reserved. > > This program and the accompanying materials > @@ -15,68 +15,97 @@ > > **/ > > -#include <PiDxe.h> > > -#include <Library/BaseLib.h> > +#include <Uefi.h> > + > #include <Library/CspSysReg.h> > -#include <Library/DebugLib.h> > -#include <Library/EfiResetSystemLib.h> > #include <Library/IoLib.h> > -#include <Library/PcdLib.h> > +#include <Library/ResetSystemLib.h> > + > > /** > - 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.<BR> > +# Copyright (c) 2008, Apple Inc. All rights reserved.<BR> > # 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 > _______________________________________________ edk2-devel mailing list [email protected] https://lists.01.org/mailman/listinfo/edk2-devel

