2 Reset System Library functions for RISC-V
4 Copyright (c) 2021, Hewlett Packard Development LP. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
9 #include <Library/DebugLib.h>
10 #include <Library/ResetSystemLib.h>
11 #include <Library/BaseRiscVSbiLib.h>
14 This function causes a system-wide reset (cold reset), in which
15 all circuitry within the system returns to its initial state. This type of reset
16 is asynchronous to system operation and operates without regard to
19 If this function returns, it means that the system does not support cold reset.
27 // Warm Reset via SBI ecall
28 SbiSystemReset (SBI_SRST_RESET_TYPE_COLD_REBOOT
, SBI_SRST_RESET_REASON_NONE
);
32 This function causes a system-wide initialization (warm reset), in which all processors
33 are set to their initial state. Pending cycles are not corrupted.
35 If this function returns, it means that the system does not support warm reset.
43 // Warm Reset via SBI ecall
44 SbiSystemReset (SBI_SRST_RESET_TYPE_WARM_REBOOT
, SBI_SRST_RESET_REASON_NONE
);
48 This function causes the system to enter a power state equivalent
49 to the ACPI G2/S5 or G3 states.
51 If this function returns, it means that the system does not support shutdown reset.
59 // Shut down via SBI ecall
60 SbiSystemReset (SBI_SRST_RESET_TYPE_SHUTDOWN
, SBI_SRST_RESET_REASON_NONE
);
64 This function causes a systemwide reset. The exact type of the reset is
65 defined by the EFI_GUID that follows the Null-terminated Unicode string passed
66 into ResetData. If the platform does not recognize the EFI_GUID in ResetData
67 the platform must pick a supported reset type to perform. The platform may
68 optionally log the parameters from any non-normal reset that occurs.
70 @param[in] DataSize The size, in bytes, of ResetData.
71 @param[in] ResetData The data buffer starts with a Null-terminated string,
72 followed by the EFI_GUID.
76 ResetPlatformSpecific (
82 // Can map to OpenSBI vendor or platform specific reset type.
88 The ResetSystem function resets the entire platform.
90 @param[in] ResetType The type of reset to perform.
91 @param[in] ResetStatus The status code for the reset.
92 @param[in] DataSize The size, in bytes, of ResetData.
93 @param[in] ResetData For a ResetType of EfiResetCold, EfiResetWarm, or EfiResetShutdown
94 the data buffer starts with a Null-terminated string, optionally
95 followed by additional binary data. The string is a description
96 that the caller may use to further indicate the reason for the
102 IN EFI_RESET_TYPE ResetType
,
103 IN EFI_STATUS ResetStatus
,
105 IN VOID
*ResetData OPTIONAL
117 case EfiResetShutdown
:
121 case EfiResetPlatformSpecific
:
122 ResetPlatformSpecific (DataSize
, ResetData
);