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