Message ID | 20170705094250.22848-1-ard.biesheuvel@linaro.org |
---|---|
State | Accepted |
Commit | 470ab22d9ef4cd30459f234b14665bfe0b2287ed |
Headers | show |
Hi, With the patch replacing ReportStatusCodeLib with NULL implementation: Tested-by: Marcin Wojtas <mw@semihalf.com> Best regards, Marcin 2017-07-05 11:42 GMT+02:00 Ard Biesheuvel <ard.biesheuvel@linaro.org>: > 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 given that the > Marvell platforms support PSCI these days, we can drop the existing > MvResetSystemLib entirely and switch to the shared PSCI based one. > > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> > --- > v2: - switch to PSCI while we're at it. > > Platforms/Marvell/Armada/Armada.dsc.inc | 4 +- > Platforms/Marvell/Armada/Armada70x0.fdf | 2 +- > Platforms/Marvell/Library/ResetSystemLib/MvResetSystemLib.c | 159 -------------------- > Platforms/Marvell/Library/ResetSystemLib/MvResetSystemLib.inf | 58 ------- > 4 files changed, 3 insertions(+), 220 deletions(-) > > diff --git a/Platforms/Marvell/Armada/Armada.dsc.inc b/Platforms/Marvell/Armada/Armada.dsc.inc > index 475fc6d05379..c30f39fc12dd 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|ArmPkg/Library/ArmSmcPsciResetSystemLib/ArmSmcPsciResetSystemLib.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 > deleted file mode 100644 > index c0787aceac9c..000000000000 > --- a/Platforms/Marvell/Library/ResetSystemLib/MvResetSystemLib.c > +++ /dev/null > @@ -1,159 +0,0 @@ > -/******************************************************************************** > -Copyright (C) 2016 Marvell International Ltd. > - > -Marvell BSD License Option > - > -If you received this File from Marvell, you may opt to use, redistribute and/or > -modify this File under the following licensing terms. > -Redistribution and use in source and binary forms, with or without modification, > -are permitted provided that the following conditions are met: > - > - * Redistributions of source code must retain the above copyright notice, > - this list of conditions and the following disclaimer. > - > - * Redistributions in binary form must reproduce the above copyright > - notice, this list of conditions and the following disclaimer in the > - documentation and/or other materials provided with the distribution. > - > - * Neither the name of Marvell nor the names of its contributors may be > - used to endorse or promote products derived from this software without > - specific prior written permission. > - > -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND > -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED > -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE > -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR > -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES > -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; > -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON > -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT > -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS > -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. > - > -*******************************************************************************/ > - > - > -#include <PiDxe.h> > -#include <Uefi.h> > - > -#include <Library/BaseLib.h> > -#include <Library/DebugLib.h> > -#include <Library/DxeServicesTableLib.h> > -#include <Library/IoLib.h> > -#include <Library/UefiLib.h> > -#include <Library/UefiBootServicesTableLib.h> > -#include <Library/UefiRuntimeLib.h> > -#include <Library/UefiRuntimeServicesTableLib.h> > - > -#include <Guid/EventGroup.h> > - > -STATIC EFI_EVENT mResetSystemVirtualAddrChangeEvent; > -STATIC UINT64 mAddress; > - > -STATIC > -VOID > -EFIAPI > -LibResetSystemVirtualNotifyEvent ( > - IN EFI_EVENT Event, > - IN VOID *Context > - ) > -{ > - // > - // Convert physical address to virtual address. > - // > - EfiConvertPointer (0x0, (VOID**)&mAddress); > - return; > -} > - > -/** > - 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. > -**/ > -EFI_STATUS > -EFIAPI > -LibResetSystem ( > - IN EFI_RESET_TYPE ResetType, > - IN EFI_STATUS ResetStatus, > - IN UINTN DataSize, > - IN VOID *ResetData OPTIONAL > - ) > -{ > - UINT32 Data; > - > - switch (ResetType) { > - case EfiResetCold: > - case EfiResetWarm: > - Data = MmioRead32 (mAddress); > - Data &= ~PcdGet32 (PcdResetRegMask); > - MmioWrite32 (mAddress, Data); > - break; > - case EfiResetShutdown: > - // > - // Currently there is no support for power-off platform > - // > - break; > - default: > - break; > - } > - > - return EFI_DEVICE_ERROR; > -} > - > -EFI_STATUS > -EFIAPI > -LibInitializeResetSystem ( > - IN EFI_HANDLE ImageHandle, > - IN EFI_SYSTEM_TABLE *SystemTable > - ) > -{ > - UINT64 Alignment; > - EFI_STATUS Status; > - > - mAddress = PcdGet64 (PcdResetRegAddress); > - > - Alignment = ~(SIZE_64KB - 1); > - // > - // Add 64KB aligned and 64KB long memory space > - // > - Status = gDS->AddMemorySpace ( > - EfiGcdMemoryTypeMemoryMappedIo, > - mAddress & Alignment, SIZE_64KB, > - EFI_MEMORY_UC | EFI_MEMORY_RUNTIME > - ); > - if (EFI_ERROR (Status)) { > - ASSERT_EFI_ERROR (Status); > - return Status; > - } > - > - // > - // Mark 64KB aligned and 64KB long memory space as runtime > - // > - Status = gDS->SetMemorySpaceAttributes (mAddress & Alignment, SIZE_64KB, > - EFI_MEMORY_UC | EFI_MEMORY_RUNTIME); > - if (EFI_ERROR (Status)) { > - ASSERT_EFI_ERROR (Status); > - return Status; > - } > - > - // > - // Register for the virtual address change event > - // > - Status = gBS->CreateEventEx ( > - EVT_NOTIFY_SIGNAL, > - TPL_NOTIFY, > - LibResetSystemVirtualNotifyEvent, > - NULL, > - &gEfiEventVirtualAddressChangeGuid, > - &mResetSystemVirtualAddrChangeEvent > - ); > - ASSERT_EFI_ERROR (Status); > - > - return Status; > -} > diff --git a/Platforms/Marvell/Library/ResetSystemLib/MvResetSystemLib.inf b/Platforms/Marvell/Library/ResetSystemLib/MvResetSystemLib.inf > deleted file mode 100644 > index 87fff5707909..000000000000 > --- a/Platforms/Marvell/Library/ResetSystemLib/MvResetSystemLib.inf > +++ /dev/null > @@ -1,58 +0,0 @@ > -# Copyright (C) 2016 Marvell International Ltd. > -# > -# Marvell BSD License Option > -# > -# If you received this File from Marvell, you may opt to use, redistribute and/or > -# modify this File under the following licensing terms. > -# Redistribution and use in source and binary forms, with or without modification, > -# are permitted provided that the following conditions are met: > -# > -# * Redistributions of source code must retain the above copyright notice, > -# this list of conditions and the following disclaimer. > -# > -# * Redistributions in binary form must reproduce the above copyright > -# notice, this list of conditions and the following disclaimer in the > -# documentation and/or other materials provided with the distribution. > -# > -# * Neither the name of Marvell nor the names of its contributors may be > -# used to endorse or promote products derived from this software without > -# specific prior written permission. > -# > -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND > -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED > -# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE > -# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR > -# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES > -# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; > -# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON > -# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT > -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS > -# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. > -# > - > -[Defines] > - INF_VERSION = 0x00010019 > - BASE_NAME = Reset > - FILE_GUID = 9d1373c0-6fac-432c-88e7-818744dc45d9 > - MODULE_TYPE = BASE > - VERSION_STRING = 1.0 > - LIBRARY_CLASS = EfiResetSystemLib > - > -[Sources.common] > - MvResetSystemLib.c > - > -[Packages] > - MdePkg/MdePkg.dec > - OpenPlatformPkg/Platforms/Marvell/Marvell.dec > - > -[LibraryClasses] > - DebugLib > - DxeServicesTableLib > - IoLib > - UefiBootServicesTableLib > - UefiLib > - UefiRuntimeLib > - > -[Pcd] > - gMarvellTokenSpaceGuid.PcdResetRegAddress > - gMarvellTokenSpaceGuid.PcdResetRegMask > -- > 2.9.3 >
The pair of patches pushed to OPP as 124202f57b..470ab22d9e. Thanks! (They'll get squashed into the monolithic Marvell commit on edk2-platforms:devel-OpenPlatformPkg.) On Wed, Jul 05, 2017 at 04:00:19PM +0200, Marcin Wojtas wrote: > Hi, > > With the patch replacing ReportStatusCodeLib with NULL implementation: > Tested-by: Marcin Wojtas <mw@semihalf.com> > > Best regards, > Marcin > > 2017-07-05 11:42 GMT+02:00 Ard Biesheuvel <ard.biesheuvel@linaro.org>: > > 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 given that the > > Marvell platforms support PSCI these days, we can drop the existing > > MvResetSystemLib entirely and switch to the shared PSCI based one. > > > > Contributed-under: TianoCore Contribution Agreement 1.0 > > Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> > > --- > > v2: - switch to PSCI while we're at it. > > > > Platforms/Marvell/Armada/Armada.dsc.inc | 4 +- > > Platforms/Marvell/Armada/Armada70x0.fdf | 2 +- > > Platforms/Marvell/Library/ResetSystemLib/MvResetSystemLib.c | 159 -------------------- > > Platforms/Marvell/Library/ResetSystemLib/MvResetSystemLib.inf | 58 ------- > > 4 files changed, 3 insertions(+), 220 deletions(-) > > > > diff --git a/Platforms/Marvell/Armada/Armada.dsc.inc b/Platforms/Marvell/Armada/Armada.dsc.inc > > index 475fc6d05379..c30f39fc12dd 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|ArmPkg/Library/ArmSmcPsciResetSystemLib/ArmSmcPsciResetSystemLib.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 > > deleted file mode 100644 > > index c0787aceac9c..000000000000 > > --- a/Platforms/Marvell/Library/ResetSystemLib/MvResetSystemLib.c > > +++ /dev/null > > @@ -1,159 +0,0 @@ > > -/******************************************************************************** > > -Copyright (C) 2016 Marvell International Ltd. > > - > > -Marvell BSD License Option > > - > > -If you received this File from Marvell, you may opt to use, redistribute and/or > > -modify this File under the following licensing terms. > > -Redistribution and use in source and binary forms, with or without modification, > > -are permitted provided that the following conditions are met: > > - > > - * Redistributions of source code must retain the above copyright notice, > > - this list of conditions and the following disclaimer. > > - > > - * Redistributions in binary form must reproduce the above copyright > > - notice, this list of conditions and the following disclaimer in the > > - documentation and/or other materials provided with the distribution. > > - > > - * Neither the name of Marvell nor the names of its contributors may be > > - used to endorse or promote products derived from this software without > > - specific prior written permission. > > - > > -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND > > -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED > > -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE > > -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR > > -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES > > -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; > > -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON > > -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT > > -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS > > -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. > > - > > -*******************************************************************************/ > > - > > - > > -#include <PiDxe.h> > > -#include <Uefi.h> > > - > > -#include <Library/BaseLib.h> > > -#include <Library/DebugLib.h> > > -#include <Library/DxeServicesTableLib.h> > > -#include <Library/IoLib.h> > > -#include <Library/UefiLib.h> > > -#include <Library/UefiBootServicesTableLib.h> > > -#include <Library/UefiRuntimeLib.h> > > -#include <Library/UefiRuntimeServicesTableLib.h> > > - > > -#include <Guid/EventGroup.h> > > - > > -STATIC EFI_EVENT mResetSystemVirtualAddrChangeEvent; > > -STATIC UINT64 mAddress; > > - > > -STATIC > > -VOID > > -EFIAPI > > -LibResetSystemVirtualNotifyEvent ( > > - IN EFI_EVENT Event, > > - IN VOID *Context > > - ) > > -{ > > - // > > - // Convert physical address to virtual address. > > - // > > - EfiConvertPointer (0x0, (VOID**)&mAddress); > > - return; > > -} > > - > > -/** > > - 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. > > -**/ > > -EFI_STATUS > > -EFIAPI > > -LibResetSystem ( > > - IN EFI_RESET_TYPE ResetType, > > - IN EFI_STATUS ResetStatus, > > - IN UINTN DataSize, > > - IN VOID *ResetData OPTIONAL > > - ) > > -{ > > - UINT32 Data; > > - > > - switch (ResetType) { > > - case EfiResetCold: > > - case EfiResetWarm: > > - Data = MmioRead32 (mAddress); > > - Data &= ~PcdGet32 (PcdResetRegMask); > > - MmioWrite32 (mAddress, Data); > > - break; > > - case EfiResetShutdown: > > - // > > - // Currently there is no support for power-off platform > > - // > > - break; > > - default: > > - break; > > - } > > - > > - return EFI_DEVICE_ERROR; > > -} > > - > > -EFI_STATUS > > -EFIAPI > > -LibInitializeResetSystem ( > > - IN EFI_HANDLE ImageHandle, > > - IN EFI_SYSTEM_TABLE *SystemTable > > - ) > > -{ > > - UINT64 Alignment; > > - EFI_STATUS Status; > > - > > - mAddress = PcdGet64 (PcdResetRegAddress); > > - > > - Alignment = ~(SIZE_64KB - 1); > > - // > > - // Add 64KB aligned and 64KB long memory space > > - // > > - Status = gDS->AddMemorySpace ( > > - EfiGcdMemoryTypeMemoryMappedIo, > > - mAddress & Alignment, SIZE_64KB, > > - EFI_MEMORY_UC | EFI_MEMORY_RUNTIME > > - ); > > - if (EFI_ERROR (Status)) { > > - ASSERT_EFI_ERROR (Status); > > - return Status; > > - } > > - > > - // > > - // Mark 64KB aligned and 64KB long memory space as runtime > > - // > > - Status = gDS->SetMemorySpaceAttributes (mAddress & Alignment, SIZE_64KB, > > - EFI_MEMORY_UC | EFI_MEMORY_RUNTIME); > > - if (EFI_ERROR (Status)) { > > - ASSERT_EFI_ERROR (Status); > > - return Status; > > - } > > - > > - // > > - // Register for the virtual address change event > > - // > > - Status = gBS->CreateEventEx ( > > - EVT_NOTIFY_SIGNAL, > > - TPL_NOTIFY, > > - LibResetSystemVirtualNotifyEvent, > > - NULL, > > - &gEfiEventVirtualAddressChangeGuid, > > - &mResetSystemVirtualAddrChangeEvent > > - ); > > - ASSERT_EFI_ERROR (Status); > > - > > - return Status; > > -} > > diff --git a/Platforms/Marvell/Library/ResetSystemLib/MvResetSystemLib.inf b/Platforms/Marvell/Library/ResetSystemLib/MvResetSystemLib.inf > > deleted file mode 100644 > > index 87fff5707909..000000000000 > > --- a/Platforms/Marvell/Library/ResetSystemLib/MvResetSystemLib.inf > > +++ /dev/null > > @@ -1,58 +0,0 @@ > > -# Copyright (C) 2016 Marvell International Ltd. > > -# > > -# Marvell BSD License Option > > -# > > -# If you received this File from Marvell, you may opt to use, redistribute and/or > > -# modify this File under the following licensing terms. > > -# Redistribution and use in source and binary forms, with or without modification, > > -# are permitted provided that the following conditions are met: > > -# > > -# * Redistributions of source code must retain the above copyright notice, > > -# this list of conditions and the following disclaimer. > > -# > > -# * Redistributions in binary form must reproduce the above copyright > > -# notice, this list of conditions and the following disclaimer in the > > -# documentation and/or other materials provided with the distribution. > > -# > > -# * Neither the name of Marvell nor the names of its contributors may be > > -# used to endorse or promote products derived from this software without > > -# specific prior written permission. > > -# > > -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND > > -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED > > -# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE > > -# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR > > -# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES > > -# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; > > -# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON > > -# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT > > -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS > > -# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. > > -# > > - > > -[Defines] > > - INF_VERSION = 0x00010019 > > - BASE_NAME = Reset > > - FILE_GUID = 9d1373c0-6fac-432c-88e7-818744dc45d9 > > - MODULE_TYPE = BASE > > - VERSION_STRING = 1.0 > > - LIBRARY_CLASS = EfiResetSystemLib > > - > > -[Sources.common] > > - MvResetSystemLib.c > > - > > -[Packages] > > - MdePkg/MdePkg.dec > > - OpenPlatformPkg/Platforms/Marvell/Marvell.dec > > - > > -[LibraryClasses] > > - DebugLib > > - DxeServicesTableLib > > - IoLib > > - UefiBootServicesTableLib > > - UefiLib > > - UefiRuntimeLib > > - > > -[Pcd] > > - gMarvellTokenSpaceGuid.PcdResetRegAddress > > - gMarvellTokenSpaceGuid.PcdResetRegMask > > -- > > 2.9.3 > >
diff --git a/Platforms/Marvell/Armada/Armada.dsc.inc b/Platforms/Marvell/Armada/Armada.dsc.inc index 475fc6d05379..c30f39fc12dd 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|ArmPkg/Library/ArmSmcPsciResetSystemLib/ArmSmcPsciResetSystemLib.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 deleted file mode 100644 index c0787aceac9c..000000000000 --- a/Platforms/Marvell/Library/ResetSystemLib/MvResetSystemLib.c +++ /dev/null @@ -1,159 +0,0 @@ -/******************************************************************************** -Copyright (C) 2016 Marvell International Ltd. - -Marvell BSD License Option - -If you received this File from Marvell, you may opt to use, redistribute and/or -modify this File under the following licensing terms. -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - * Neither the name of Marvell nor the names of its contributors may be - used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ - - -#include <PiDxe.h> -#include <Uefi.h> - -#include <Library/BaseLib.h> -#include <Library/DebugLib.h> -#include <Library/DxeServicesTableLib.h> -#include <Library/IoLib.h> -#include <Library/UefiLib.h> -#include <Library/UefiBootServicesTableLib.h> -#include <Library/UefiRuntimeLib.h> -#include <Library/UefiRuntimeServicesTableLib.h> - -#include <Guid/EventGroup.h> - -STATIC EFI_EVENT mResetSystemVirtualAddrChangeEvent; -STATIC UINT64 mAddress; - -STATIC -VOID -EFIAPI -LibResetSystemVirtualNotifyEvent ( - IN EFI_EVENT Event, - IN VOID *Context - ) -{ - // - // Convert physical address to virtual address. - // - EfiConvertPointer (0x0, (VOID**)&mAddress); - return; -} - -/** - 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. -**/ -EFI_STATUS -EFIAPI -LibResetSystem ( - IN EFI_RESET_TYPE ResetType, - IN EFI_STATUS ResetStatus, - IN UINTN DataSize, - IN VOID *ResetData OPTIONAL - ) -{ - UINT32 Data; - - switch (ResetType) { - case EfiResetCold: - case EfiResetWarm: - Data = MmioRead32 (mAddress); - Data &= ~PcdGet32 (PcdResetRegMask); - MmioWrite32 (mAddress, Data); - break; - case EfiResetShutdown: - // - // Currently there is no support for power-off platform - // - break; - default: - break; - } - - return EFI_DEVICE_ERROR; -} - -EFI_STATUS -EFIAPI -LibInitializeResetSystem ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - UINT64 Alignment; - EFI_STATUS Status; - - mAddress = PcdGet64 (PcdResetRegAddress); - - Alignment = ~(SIZE_64KB - 1); - // - // Add 64KB aligned and 64KB long memory space - // - Status = gDS->AddMemorySpace ( - EfiGcdMemoryTypeMemoryMappedIo, - mAddress & Alignment, SIZE_64KB, - EFI_MEMORY_UC | EFI_MEMORY_RUNTIME - ); - if (EFI_ERROR (Status)) { - ASSERT_EFI_ERROR (Status); - return Status; - } - - // - // Mark 64KB aligned and 64KB long memory space as runtime - // - Status = gDS->SetMemorySpaceAttributes (mAddress & Alignment, SIZE_64KB, - EFI_MEMORY_UC | EFI_MEMORY_RUNTIME); - if (EFI_ERROR (Status)) { - ASSERT_EFI_ERROR (Status); - return Status; - } - - // - // Register for the virtual address change event - // - Status = gBS->CreateEventEx ( - EVT_NOTIFY_SIGNAL, - TPL_NOTIFY, - LibResetSystemVirtualNotifyEvent, - NULL, - &gEfiEventVirtualAddressChangeGuid, - &mResetSystemVirtualAddrChangeEvent - ); - ASSERT_EFI_ERROR (Status); - - return Status; -} diff --git a/Platforms/Marvell/Library/ResetSystemLib/MvResetSystemLib.inf b/Platforms/Marvell/Library/ResetSystemLib/MvResetSystemLib.inf deleted file mode 100644 index 87fff5707909..000000000000 --- a/Platforms/Marvell/Library/ResetSystemLib/MvResetSystemLib.inf +++ /dev/null @@ -1,58 +0,0 @@ -# Copyright (C) 2016 Marvell International Ltd. -# -# Marvell BSD License Option -# -# If you received this File from Marvell, you may opt to use, redistribute and/or -# modify this File under the following licensing terms. -# Redistribution and use in source and binary forms, with or without modification, -# are permitted provided that the following conditions are met: -# -# * Redistributions of source code must retain the above copyright notice, -# this list of conditions and the following disclaimer. -# -# * Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# * Neither the name of Marvell nor the names of its contributors may be -# used to endorse or promote products derived from this software without -# specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR -# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# - -[Defines] - INF_VERSION = 0x00010019 - BASE_NAME = Reset - FILE_GUID = 9d1373c0-6fac-432c-88e7-818744dc45d9 - MODULE_TYPE = BASE - VERSION_STRING = 1.0 - LIBRARY_CLASS = EfiResetSystemLib - -[Sources.common] - MvResetSystemLib.c - -[Packages] - MdePkg/MdePkg.dec - OpenPlatformPkg/Platforms/Marvell/Marvell.dec - -[LibraryClasses] - DebugLib - DxeServicesTableLib - IoLib - UefiBootServicesTableLib - UefiLib - UefiRuntimeLib - -[Pcd] - gMarvellTokenSpaceGuid.PcdResetRegAddress - gMarvellTokenSpaceGuid.PcdResetRegMask
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 given that the Marvell platforms support PSCI these days, we can drop the existing MvResetSystemLib entirely and switch to the shared PSCI based one. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> --- v2: - switch to PSCI while we're at it. Platforms/Marvell/Armada/Armada.dsc.inc | 4 +- Platforms/Marvell/Armada/Armada70x0.fdf | 2 +- Platforms/Marvell/Library/ResetSystemLib/MvResetSystemLib.c | 159 -------------------- Platforms/Marvell/Library/ResetSystemLib/MvResetSystemLib.inf | 58 ------- 4 files changed, 3 insertions(+), 220 deletions(-)