]> git.proxmox.com Git - mirror_edk2.git/blob - Nt32Pkg/Library/ResetSystemLib/ResetSystemLib.c
UefiCpuPkg: Remove double \r
[mirror_edk2.git] / Nt32Pkg / Library / ResetSystemLib / ResetSystemLib.c
1 /** @file
2
3 Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.<BR>
4 SPDX-License-Identifier: BSD-2-Clause-Patent
5
6 **/
7 #include <Uefi.h>
8 #include <Library/DebugLib.h>
9 #include <Library/WinNtLib.h>
10
11 /**
12 This function causes a system-wide reset (cold reset), in which
13 all circuitry within the system returns to its initial state. This type of reset
14 is asynchronous to system operation and operates without regard to
15 cycle boundaries.
16
17 If this function returns, it means that the system does not support cold reset.
18 **/
19 VOID
20 EFIAPI
21 ResetCold (
22 VOID
23 )
24 {
25 gWinNt->ExitProcess (0);
26 ASSERT (FALSE);
27 }
28
29 /**
30 This function causes a system-wide initialization (warm reset), in which all processors
31 are set to their initial state. Pending cycles are not corrupted.
32
33 If this function returns, it means that the system does not support warm reset.
34 **/
35 VOID
36 EFIAPI
37 ResetWarm (
38 VOID
39 )
40 {
41 ResetCold ();
42 }
43
44 /**
45 This function causes the system to enter a power state equivalent
46 to the ACPI G2/S5 or G3 states.
47
48 If this function returns, it means that the system does not support shut down reset.
49 **/
50 VOID
51 EFIAPI
52 ResetShutdown (
53 VOID
54 )
55 {
56 ResetCold ();
57 }
58
59 /**
60 This function causes the system to enter S3 and then wake up immediately.
61
62 If this function returns, it means that the system does not support S3 feature.
63 **/
64 VOID
65 EFIAPI
66 EnterS3WithImmediateWake (
67 VOID
68 )
69 {
70 ResetCold ();
71 }
72
73 /**
74 This function causes a systemwide reset. The exact type of the reset is
75 defined by the EFI_GUID that follows the Null-terminated Unicode string passed
76 into ResetData. If the platform does not recognize the EFI_GUID in ResetData
77 the platform must pick a supported reset type to perform.The platform may
78 optionally log the parameters from any non-normal reset that occurs.
79
80 @param[in] DataSize The size, in bytes, of ResetData.
81 @param[in] ResetData The data buffer starts with a Null-terminated string,
82 followed by the EFI_GUID.
83 **/
84 VOID
85 EFIAPI
86 ResetPlatformSpecific (
87 IN UINTN DataSize,
88 IN VOID *ResetData
89 )
90 {
91 ResetCold ();
92 }
93
94 /**
95 The ResetSystem function resets the entire platform.
96
97 @param[in] ResetType The type of reset to perform.
98 @param[in] ResetStatus The status code for the reset.
99 @param[in] DataSize The size, in bytes, of ResetData.
100 @param[in] ResetData For a ResetType of EfiResetCold, EfiResetWarm, or EfiResetShutdown
101 the data buffer starts with a Null-terminated string, optionally
102 followed by additional binary data. The string is a description
103 that the caller may use to further indicate the reason for the
104 system reset.
105 **/
106 VOID
107 EFIAPI
108 ResetSystem (
109 IN EFI_RESET_TYPE ResetType,
110 IN EFI_STATUS ResetStatus,
111 IN UINTN DataSize,
112 IN VOID *ResetData OPTIONAL
113 )
114 {
115 switch (ResetType) {
116 case EfiResetWarm:
117 ResetWarm ();
118 break;
119
120 case EfiResetCold:
121 ResetCold ();
122 break;
123
124 case EfiResetShutdown:
125 ResetShutdown ();
126 return;
127
128 case EfiResetPlatformSpecific:
129 ResetPlatformSpecific (DataSize, ResetData);
130 return;
131
132 default:
133 return;
134 }
135 }