]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Library/DxeResetSystemLib/DxeResetSystemLib.c
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[mirror_edk2.git] / MdeModulePkg / Library / DxeResetSystemLib / DxeResetSystemLib.c
1 /** @file
2 DXE Reset System Library instance that calls gRT->ResetSystem().
3
4 Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
6
7 **/
8
9 #include <PiDxe.h>
10 #include <Library/ResetSystemLib.h>
11 #include <Library/UefiRuntimeServicesTableLib.h>
12
13 /**
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
17 cycle boundaries.
18
19 If this function returns, it means that the system does not support cold reset.
20 **/
21 VOID
22 EFIAPI
23 ResetCold (
24 VOID
25 )
26 {
27 gRT->ResetSystem (EfiResetCold, EFI_SUCCESS, 0, NULL);
28 }
29
30 /**
31 This function causes a system-wide initialization (warm reset), in which all processors
32 are set to their initial state. Pending cycles are not corrupted.
33
34 If this function returns, it means that the system does not support warm reset.
35 **/
36 VOID
37 EFIAPI
38 ResetWarm (
39 VOID
40 )
41 {
42 gRT->ResetSystem (EfiResetWarm, EFI_SUCCESS, 0, NULL);
43 }
44
45 /**
46 This function causes the system to enter a power state equivalent
47 to the ACPI G2/S5 or G3 states.
48
49 If this function returns, it means that the system does not support shut down reset.
50 **/
51 VOID
52 EFIAPI
53 ResetShutdown (
54 VOID
55 )
56 {
57 gRT->ResetSystem (EfiResetShutdown, EFI_SUCCESS, 0, NULL);
58 }
59
60 /**
61 This function causes a systemwide reset. The exact type of the reset is
62 defined by the EFI_GUID that follows the Null-terminated Unicode string passed
63 into ResetData. If the platform does not recognize the EFI_GUID in ResetData
64 the platform must pick a supported reset type to perform.The platform may
65 optionally log the parameters from any non-normal reset that occurs.
66
67 @param[in] DataSize The size, in bytes, of ResetData.
68 @param[in] ResetData The data buffer starts with a Null-terminated string,
69 followed by the EFI_GUID.
70 **/
71 VOID
72 EFIAPI
73 ResetPlatformSpecific (
74 IN UINTN DataSize,
75 IN VOID *ResetData
76 )
77 {
78 gRT->ResetSystem (EfiResetPlatformSpecific, EFI_SUCCESS, DataSize, ResetData);
79 }
80
81 /**
82 The ResetSystem function resets the entire platform.
83
84 @param[in] ResetType The type of reset to perform.
85 @param[in] ResetStatus The status code for the reset.
86 @param[in] DataSize The size, in bytes, of ResetData.
87 @param[in] ResetData For a ResetType of EfiResetCold, EfiResetWarm, or EfiResetShutdown
88 the data buffer starts with a Null-terminated string, optionally
89 followed by additional binary data. The string is a description
90 that the caller may use to further indicate the reason for the
91 system reset.
92 **/
93 VOID
94 EFIAPI
95 ResetSystem (
96 IN EFI_RESET_TYPE ResetType,
97 IN EFI_STATUS ResetStatus,
98 IN UINTN DataSize,
99 IN VOID *ResetData OPTIONAL
100 )
101 {
102 gRT->ResetSystem (ResetType, ResetStatus, DataSize, ResetData);
103 }