Switch to the generic implementation of the ResetSystem() runtime service call, which is preferred over the one in EmbeddedPkg. Since this involves switching to another platform reset library class (ResetSystemLib vs EfiResetSystemLib), of which a perfectly suitable implementation exists for PSCI basd platforms such as Styx, don't bother porting the existing EfiResetSystemLib implementation, but simply delete it.
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel ard.biesheuvel@linaro.org --- Platforms/AMD/Styx/CelloBoard/CelloBoard.dsc | 4 +- Platforms/AMD/Styx/CelloBoard/CelloBoard.fdf | 2 +- Platforms/AMD/Styx/Library/ResetSystemLib/ResetSystemLib.c | 113 -------------------- Platforms/AMD/Styx/Library/ResetSystemLib/ResetSystemLib.inf | 47 -------- Platforms/AMD/Styx/Overdrive1000Board/Overdrive1000Board.dsc | 4 +- Platforms/AMD/Styx/Overdrive1000Board/Overdrive1000Board.fdf | 2 +- Platforms/AMD/Styx/OverdriveBoard/OverdriveBoard.dsc | 4 +- Platforms/AMD/Styx/OverdriveBoard/OverdriveBoard.fdf | 2 +- 8 files changed, 9 insertions(+), 169 deletions(-)
diff --git a/Platforms/AMD/Styx/CelloBoard/CelloBoard.dsc b/Platforms/AMD/Styx/CelloBoard/CelloBoard.dsc index a7b3e4bb2e32..e02adf65e512 100644 --- a/Platforms/AMD/Styx/CelloBoard/CelloBoard.dsc +++ b/Platforms/AMD/Styx/CelloBoard/CelloBoard.dsc @@ -121,7 +121,7 @@ DEFINE RTK8169_MAC_OVERRIDE = 0x0 # AmdSataInit|AmdModulePkg/Library/AmdSataInitLib/AmdSataInitLib.inf AmdStyxAcpiLib|OpenPlatformPkg/Platforms/AMD/Styx/AcpiTables/AcpiTables.inf - EfiResetSystemLib|OpenPlatformPkg/Platforms/AMD/Styx/Library/ResetSystemLib/ResetSystemLib.inf + ResetSystemLib|ArmPkg/Library/ArmSmcPsciResetSystemLib/ArmSmcPsciResetSystemLib.inf RealTimeClockLib|OpenPlatformPkg/Platforms/AMD/Styx/Library/RealTimeClockLib/RealTimeClockLib.inf
CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf @@ -529,7 +529,7 @@ DEFINE RTK8169_MAC_OVERRIDE = 0x0 MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntimeDxe.inf - EmbeddedPkg/ResetRuntimeDxe/ResetRuntimeDxe.inf + MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystemRuntimeDxe.inf EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf EmbeddedPkg/MetronomeDxe/MetronomeDxe.inf MdeModulePkg/Universal/EbcDxe/EbcDxe.inf diff --git a/Platforms/AMD/Styx/CelloBoard/CelloBoard.fdf b/Platforms/AMD/Styx/CelloBoard/CelloBoard.fdf index 30ea6ac08ab4..010993291ee6 100644 --- a/Platforms/AMD/Styx/CelloBoard/CelloBoard.fdf +++ b/Platforms/AMD/Styx/CelloBoard/CelloBoard.fdf @@ -102,7 +102,7 @@ READ_LOCK_STATUS = TRUE INF MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf INF MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.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 INF MdeModulePkg/Universal/EbcDxe/EbcDxe.inf diff --git a/Platforms/AMD/Styx/Library/ResetSystemLib/ResetSystemLib.c b/Platforms/AMD/Styx/Library/ResetSystemLib/ResetSystemLib.c deleted file mode 100644 index 90eec09b1b88..000000000000 --- a/Platforms/AMD/Styx/Library/ResetSystemLib/ResetSystemLib.c +++ /dev/null @@ -1,113 +0,0 @@ -/** @file - Support ResetSystem Runtime call using PSCI calls - - Note: A similar library is implemented in - ArmVirtPkg/Library/ArmVirtualizationPsciResetSystemLib - So similar issues might exist in this implementation too. - - Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR> - Copyright (c) 2013-2015, ARM Ltd. All rights reserved.<BR> - Copyright (c) 2014, Linaro Ltd. All rights reserved.<BR> - Copyright (c) 2014 - 2016, AMD Inc. All rights reserved.<BR> - - This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ -/** - Derived from: - ArmPkg/Library/ArmPsciResetSystemLib/ArmPsciResetSystemLib.c - -**/ - -#include <PiDxe.h> - -#include <Library/BaseLib.h> -#include <Library/DebugLib.h> -#include <Library/EfiResetSystemLib.h> -#include <Library/ArmSmcLib.h> - -#include <IndustryStandard/ArmStdSmc.h> - -/** - 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 CHAR16 *ResetData OPTIONAL - ) -{ - ARM_SMC_ARGS ArmSmcArgs; - - if (!FixedPcdGetBool (PcdTrustedFWSupport)) { - return EFI_UNSUPPORTED; - } - - switch (ResetType) { - case EfiResetPlatformSpecific: - // Map the platform specific reset as reboot - case EfiResetWarm: - // Map a warm reset into a cold reset - case EfiResetCold: - // Send a PSCI 0.2 SYSTEM_RESET command - ArmSmcArgs.Arg0 = ARM_SMC_ID_PSCI_SYSTEM_RESET; - break; - case EfiResetShutdown: - // Send a PSCI 0.2 SYSTEM_OFF command - ArmSmcArgs.Arg0 = ARM_SMC_ID_PSCI_SYSTEM_OFF; - break; - default: - ASSERT (FALSE); - return EFI_UNSUPPORTED; - } - - ArmCallSmc (&ArmSmcArgs); - - // We should never be here - DEBUG ((EFI_D_ERROR, "%a: PSCI Reset failed\n", __FUNCTION__)); - CpuDeadLoop (); - return EFI_UNSUPPORTED; -} - - -/** - Initialize any infrastructure required for LibResetSystem () to function. - - @param ImageHandle The firmware allocated handle for the EFI image. - @param SystemTable A pointer to the EFI System Table. - - @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS. - -**/ -EFI_STATUS -EFIAPI -LibInitializeResetSystem ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - - if (FixedPcdGetBool (PcdTrustedFWSupport)) { - return EFI_SUCCESS; - } else { - return EFI_UNSUPPORTED; - } -} - diff --git a/Platforms/AMD/Styx/Library/ResetSystemLib/ResetSystemLib.inf b/Platforms/AMD/Styx/Library/ResetSystemLib/ResetSystemLib.inf deleted file mode 100644 index 5af4c9c449b6..000000000000 --- a/Platforms/AMD/Styx/Library/ResetSystemLib/ResetSystemLib.inf +++ /dev/null @@ -1,47 +0,0 @@ -#/** @file -# Reset System lib using PSCI hypervisor or secure monitor calls -# -# Copyright (c) 2008, Apple Inc. All rights reserved.<BR> -# Copyright (c) 2014, Linaro Ltd. All rights reserved.<BR> -# Copyright (c) 2014, ARM Ltd. All rights reserved.<BR> -# Copyright (c) 2014 - 2016, AMD Inc. All rights reserved.<BR> -# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -#**/ -#/** -# Derived from: -# ArmPkg/Library/ArmPsciResetSystemLib/ArmPsciResetSystemLib.inf -# -#**/ - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = AmdStyxResetSystemLib - FILE_GUID = 624f6cc6-c38f-4897-b3b7-8a601701291b - MODULE_TYPE = BASE - VERSION_STRING = 1.0 - LIBRARY_CLASS = EfiResetSystemLib - -[Sources.common] - ResetSystemLib.c - -[Packages] - ArmPkg/ArmPkg.dec - MdePkg/MdePkg.dec - EmbeddedPkg/EmbeddedPkg.dec - AmdModulePkg/AmdModulePkg.dec - OpenPlatformPkg/Platforms/AMD/Styx/AmdStyx.dec - -[LibraryClasses] - PcdLib - BaseLib - ArmSmcLib - -[FixedPcd] - gAmdStyxTokenSpaceGuid.PcdTrustedFWSupport diff --git a/Platforms/AMD/Styx/Overdrive1000Board/Overdrive1000Board.dsc b/Platforms/AMD/Styx/Overdrive1000Board/Overdrive1000Board.dsc index 5b7d7f4a7b4a..1c85b5fc740a 100644 --- a/Platforms/AMD/Styx/Overdrive1000Board/Overdrive1000Board.dsc +++ b/Platforms/AMD/Styx/Overdrive1000Board/Overdrive1000Board.dsc @@ -122,7 +122,7 @@ DEFINE DO_FLASHER = FALSE # AmdSataInit|AmdModulePkg/Library/AmdSataInitLib/AmdSataInitLib.inf AmdStyxAcpiLib|OpenPlatformPkg/Platforms/AMD/Styx/AcpiTables/AcpiTables.inf - EfiResetSystemLib|OpenPlatformPkg/Platforms/AMD/Styx/Library/ResetSystemLib/ResetSystemLib.inf + ResetSystemLib|ArmPkg/Library/ArmSmcPsciResetSystemLib/ArmSmcPsciResetSystemLib.inf RealTimeClockLib|OpenPlatformPkg/Platforms/AMD/Styx/Library/RealTimeClockLib/RealTimeClockLib.inf
CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf @@ -526,7 +526,7 @@ DEFINE DO_FLASHER = FALSE MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntimeDxe.inf - EmbeddedPkg/ResetRuntimeDxe/ResetRuntimeDxe.inf + MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystemRuntimeDxe.inf EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf EmbeddedPkg/MetronomeDxe/MetronomeDxe.inf MdeModulePkg/Universal/EbcDxe/EbcDxe.inf diff --git a/Platforms/AMD/Styx/Overdrive1000Board/Overdrive1000Board.fdf b/Platforms/AMD/Styx/Overdrive1000Board/Overdrive1000Board.fdf index c7f98b087fa9..278f497afbbf 100644 --- a/Platforms/AMD/Styx/Overdrive1000Board/Overdrive1000Board.fdf +++ b/Platforms/AMD/Styx/Overdrive1000Board/Overdrive1000Board.fdf @@ -102,7 +102,7 @@ READ_LOCK_STATUS = TRUE INF MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf INF MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.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 INF MdeModulePkg/Universal/EbcDxe/EbcDxe.inf diff --git a/Platforms/AMD/Styx/OverdriveBoard/OverdriveBoard.dsc b/Platforms/AMD/Styx/OverdriveBoard/OverdriveBoard.dsc index 662a15a9ccea..4fb13206db06 100644 --- a/Platforms/AMD/Styx/OverdriveBoard/OverdriveBoard.dsc +++ b/Platforms/AMD/Styx/OverdriveBoard/OverdriveBoard.dsc @@ -123,7 +123,7 @@ DEFINE DO_FLASHER = FALSE # AmdSataInit|AmdModulePkg/Library/AmdSataInitLib/AmdSataInitLib.inf AmdStyxAcpiLib|OpenPlatformPkg/Platforms/AMD/Styx/AcpiTables/AcpiTables.inf - EfiResetSystemLib|OpenPlatformPkg/Platforms/AMD/Styx/Library/ResetSystemLib/ResetSystemLib.inf + ResetSystemLib|ArmPkg/Library/ArmSmcPsciResetSystemLib/ArmSmcPsciResetSystemLib.inf RealTimeClockLib|OpenPlatformPkg/Platforms/AMD/Styx/Library/RealTimeClockLib/RealTimeClockLib.inf
CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf @@ -567,7 +567,7 @@ DEFINE DO_FLASHER = FALSE MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntimeDxe.inf - EmbeddedPkg/ResetRuntimeDxe/ResetRuntimeDxe.inf + MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystemRuntimeDxe.inf EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf EmbeddedPkg/MetronomeDxe/MetronomeDxe.inf MdeModulePkg/Universal/EbcDxe/EbcDxe.inf diff --git a/Platforms/AMD/Styx/OverdriveBoard/OverdriveBoard.fdf b/Platforms/AMD/Styx/OverdriveBoard/OverdriveBoard.fdf index d51bed87ebf6..ac683c9e38e3 100644 --- a/Platforms/AMD/Styx/OverdriveBoard/OverdriveBoard.fdf +++ b/Platforms/AMD/Styx/OverdriveBoard/OverdriveBoard.fdf @@ -102,7 +102,7 @@ READ_LOCK_STATUS = TRUE INF MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf INF MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.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 INF MdeModulePkg/Universal/EbcDxe/EbcDxe.inf