]> git.proxmox.com Git - mirror_edk2.git/blame_incremental - PcAtChipsetPkg/Library/ResetSystemLib/ResetSystemLib.c
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[mirror_edk2.git] / PcAtChipsetPkg / Library / ResetSystemLib / ResetSystemLib.c
... / ...
CommitLineData
1/** @file\r
2 Reset System Library functions for PCAT platforms\r
3\r
4 Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR>\r
5 SPDX-License-Identifier: BSD-2-Clause-Patent\r
6\r
7**/\r
8\r
9#include <Base.h>\r
10\r
11#include <Uefi/UefiBaseType.h>\r
12#include <Uefi/UefiMultiPhase.h>\r
13\r
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
32 IoWrite8 ((UINTN)PcdGet64 (PcdResetControlRegister), PcdGet8 (PcdResetControlValueColdReset));\r
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
48 IoWrite8 ((UINTN)PcdGet64 (PcdResetControlRegister), PcdGet8 (PcdResetControlValueColdReset));\r
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
68 This function causes a systemwide reset. The exact type of the reset is\r
69 defined by the EFI_GUID that follows the Null-terminated Unicode string passed\r
70 into ResetData. If the platform does not recognize the EFI_GUID in ResetData\r
71 the platform must pick a supported reset type to perform.The platform may\r
72 optionally log the parameters from any non-normal reset that occurs.\r
73\r
74 @param[in] DataSize The size, in bytes, of ResetData.\r
75 @param[in] ResetData The data buffer starts with a Null-terminated string,\r
76 followed by the EFI_GUID.\r
77**/\r
78VOID\r
79EFIAPI\r
80ResetPlatformSpecific (\r
81 IN UINTN DataSize,\r
82 IN VOID *ResetData\r
83 )\r
84{\r
85 ResetCold ();\r
86}\r
87\r
88/**\r
89 The ResetSystem function resets the entire platform.\r
90\r
91 @param[in] ResetType The type of reset to perform.\r
92 @param[in] ResetStatus The status code for the reset.\r
93 @param[in] DataSize The size, in bytes, of ResetData.\r
94 @param[in] ResetData For a ResetType of EfiResetCold, EfiResetWarm, or EfiResetShutdown\r
95 the data buffer starts with a Null-terminated string, optionally\r
96 followed by additional binary data. The string is a description\r
97 that the caller may use to further indicate the reason for the\r
98 system reset.\r
99**/\r
100VOID\r
101EFIAPI\r
102ResetSystem (\r
103 IN EFI_RESET_TYPE ResetType,\r
104 IN EFI_STATUS ResetStatus,\r
105 IN UINTN DataSize,\r
106 IN VOID *ResetData OPTIONAL\r
107 )\r
108{\r
109 switch (ResetType) {\r
110 case EfiResetWarm:\r
111 ResetWarm ();\r
112 break;\r
113\r
114 case EfiResetCold:\r
115 ResetCold ();\r
116 break;\r
117\r
118 case EfiResetShutdown:\r
119 ResetShutdown ();\r
120 return;\r
121\r
122 case EfiResetPlatformSpecific:\r
123 ResetPlatformSpecific (DataSize, ResetData);\r
124 return;\r
125\r
126 default:\r
127 return;\r
128 }\r
129}\r