2 Support ResetSystem Runtime call using PSCI calls
4 Note: A similar library is implemented in
5 ArmVirtPkg/Library/ArmVirtualizationPsciResetSystemLib
6 So similar issues might exist in this implementation too.
8 Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
9 Copyright (c) 2013-2015, ARM Ltd. All rights reserved.<BR>
10 Copyright (c) 2014, Linaro Ltd. All rights reserved.<BR>
12 SPDX-License-Identifier: BSD-2-Clause-Patent
18 #include <Library/BaseLib.h>
19 #include <Library/DebugLib.h>
20 #include <Library/EfiResetSystemLib.h>
21 #include <Library/ArmSmcLib.h>
23 #include <IndustryStandard/ArmStdSmc.h>
26 Resets the entire platform.
28 @param ResetType The type of reset to perform.
29 @param ResetStatus The status code for the reset.
30 @param DataSize The size, in bytes, of WatchdogData.
31 @param ResetData For a ResetType of EfiResetCold, EfiResetWarm, or
32 EfiResetShutdown the data buffer starts with a Null-terminated
33 Unicode string, optionally followed by additional binary data.
39 IN EFI_RESET_TYPE ResetType
,
40 IN EFI_STATUS ResetStatus
,
42 IN CHAR16
*ResetData OPTIONAL
45 ARM_SMC_ARGS ArmSmcArgs
;
48 case EfiResetPlatformSpecific
:
49 // Map the platform specific reset as reboot
51 // Map a warm reset into a cold reset
53 // Send a PSCI 0.2 SYSTEM_RESET command
54 ArmSmcArgs
.Arg0
= ARM_SMC_ID_PSCI_SYSTEM_RESET
;
56 case EfiResetShutdown
:
57 // Send a PSCI 0.2 SYSTEM_OFF command
58 ArmSmcArgs
.Arg0
= ARM_SMC_ID_PSCI_SYSTEM_OFF
;
62 return EFI_UNSUPPORTED
;
65 ArmCallSmc (&ArmSmcArgs
);
67 // We should never be here
68 DEBUG ((DEBUG_ERROR
, "%a: PSCI Reset failed\n", __FUNCTION__
));
70 return EFI_UNSUPPORTED
;
74 Initialize any infrastructure required for LibResetSystem () to function.
76 @param ImageHandle The firmware allocated handle for the EFI image.
77 @param SystemTable A pointer to the EFI System Table.
79 @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS.
84 LibInitializeResetSystem (
85 IN EFI_HANDLE ImageHandle
,
86 IN EFI_SYSTEM_TABLE
*SystemTable