2 ResetSystemLib implementation using PSCI calls
4 Copyright (c) 2017, Linaro Ltd. All rights reserved.<BR>
6 This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
18 #include <Library/BaseLib.h>
19 #include <Library/DebugLib.h>
20 #include <Library/ResetSystemLib.h>
21 #include <Library/ArmSmcLib.h>
23 #include <IndustryStandard/ArmStdSmc.h>
26 This function causes a system-wide reset (cold reset), in which
27 all circuitry within the system returns to its initial state. This type of reset
28 is asynchronous to system operation and operates without regard to
31 If this function returns, it means that the system does not support cold reset.
39 ARM_SMC_ARGS ArmSmcArgs
;
41 // Send a PSCI 0.2 SYSTEM_RESET command
42 ArmSmcArgs
.Arg0
= ARM_SMC_ID_PSCI_SYSTEM_RESET
;
43 ArmCallSmc (&ArmSmcArgs
);
47 This function causes a system-wide initialization (warm reset), in which all processors
48 are set to their initial state. Pending cycles are not corrupted.
50 If this function returns, it means that the system does not support warm reset.
58 // Map a warm reset into a cold reset
63 This function causes the system to enter a power state equivalent
64 to the ACPI G2/S5 or G3 states.
66 If this function returns, it means that the system does not support shutdown reset.
74 ARM_SMC_ARGS ArmSmcArgs
;
76 // Send a PSCI 0.2 SYSTEM_OFF command
77 ArmSmcArgs
.Arg0
= ARM_SMC_ID_PSCI_SYSTEM_OFF
;
78 ArmCallSmc (&ArmSmcArgs
);
82 This function causes the system to enter S3 and then wake up immediately.
84 If this function returns, it means that the system does not support S3 feature.
88 EnterS3WithImmediateWake (
96 This function causes a systemwide reset. The exact type of the reset is
97 defined by the EFI_GUID that follows the Null-terminated Unicode string passed
98 into ResetData. If the platform does not recognize the EFI_GUID in ResetData
99 the platform must pick a supported reset type to perform.The platform may
100 optionally log the parameters from any non-normal reset that occurs.
102 @param[in] DataSize The size, in bytes, of ResetData.
103 @param[in] ResetData The data buffer starts with a Null-terminated string,
104 followed by the EFI_GUID.
108 ResetPlatformSpecific (
113 // Map the platform specific reset as reboot