2 ResetSystemLib implementation using PSCI calls
4 Copyright (c) 2017 - 2018, Linaro Ltd. All rights reserved.<BR>
5 Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
7 SPDX-License-Identifier: BSD-2-Clause-Patent
13 #include <Library/ArmSmcLib.h>
14 #include <Library/BaseLib.h>
15 #include <Library/DebugLib.h>
16 #include <Library/ResetSystemLib.h>
18 #include <IndustryStandard/ArmStdSmc.h>
21 This function causes a system-wide reset (cold reset), in which
22 all circuitry within the system returns to its initial state. This type of reset
23 is asynchronous to system operation and operates without regard to
26 If this function returns, it means that the system does not support cold reset.
34 // Send a PSCI 0.2 SYSTEM_RESET command
35 ArmCallSmc0 (ARM_SMC_ID_PSCI_SYSTEM_RESET
, NULL
, NULL
, NULL
);
39 This function causes a system-wide initialization (warm reset), in which all processors
40 are set to their initial state. Pending cycles are not corrupted.
42 If this function returns, it means that the system does not support warm reset.
50 // Map a warm reset into a cold reset
55 This function causes the system to enter a power state equivalent
56 to the ACPI G2/S5 or G3 states.
58 If this function returns, it means that the system does not support shutdown reset.
66 // Send a PSCI 0.2 SYSTEM_OFF command
67 ArmCallSmc0 (ARM_SMC_ID_PSCI_SYSTEM_OFF
, NULL
, NULL
, NULL
);
71 This function causes a systemwide reset. The exact type of the reset is
72 defined by the EFI_GUID that follows the Null-terminated Unicode string passed
73 into ResetData. If the platform does not recognize the EFI_GUID in ResetData
74 the platform must pick a supported reset type to perform.The platform may
75 optionally log the parameters from any non-normal reset that occurs.
77 @param[in] DataSize The size, in bytes, of ResetData.
78 @param[in] ResetData The data buffer starts with a Null-terminated string,
79 followed by the EFI_GUID.
83 ResetPlatformSpecific (
88 // Map the platform specific reset as reboot
93 The ResetSystem function resets the entire platform.
95 @param[in] ResetType The type of reset to perform.
96 @param[in] ResetStatus The status code for the reset.
97 @param[in] DataSize The size, in bytes, of ResetData.
98 @param[in] ResetData For a ResetType of EfiResetCold, EfiResetWarm, or EfiResetShutdown
99 the data buffer starts with a Null-terminated string, optionally
100 followed by additional binary data. The string is a description
101 that the caller may use to further indicate the reason for the
107 IN EFI_RESET_TYPE ResetType
,
108 IN EFI_STATUS ResetStatus
,
110 IN VOID
*ResetData OPTIONAL
122 case EfiResetShutdown
:
126 case EfiResetPlatformSpecific
:
127 ResetPlatformSpecific (DataSize
, ResetData
);