]>
Commit | Line | Data |
---|---|---|
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 | |
26 | VOID\r | |
27 | EFIAPI\r | |
28 | ResetCold (\r | |
29 | VOID\r | |
30 | )\r | |
31 | {\r | |
5220bd21 | 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 | |
42 | VOID\r | |
43 | EFIAPI\r | |
44 | ResetWarm (\r | |
45 | VOID\r | |
46 | )\r | |
47 | {\r | |
5220bd21 | 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 | |
58 | VOID\r | |
59 | EFIAPI\r | |
60 | ResetShutdown (\r | |
61 | VOID\r | |
62 | )\r | |
63 | {\r | |
64 | ASSERT (FALSE);\r | |
65 | }\r | |
66 | \r | |
1b22c63a RN |
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 | |
78 | VOID\r | |
79 | EFIAPI\r | |
80 | ResetPlatformSpecific (\r | |
5220bd21 MK |
81 | IN UINTN DataSize,\r |
82 | IN VOID *ResetData\r | |
1b22c63a RN |
83 | )\r |
84 | {\r | |
85 | ResetCold ();\r | |
86 | }\r | |
b700a827 ZG |
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 | |
100 | VOID\r | |
101 | EFIAPI\r | |
102 | ResetSystem (\r | |
5220bd21 MK |
103 | IN EFI_RESET_TYPE ResetType,\r |
104 | IN EFI_STATUS ResetStatus,\r | |
105 | IN UINTN DataSize,\r | |
106 | IN VOID *ResetData OPTIONAL\r | |
b700a827 ZG |
107 | )\r |
108 | {\r | |
109 | switch (ResetType) {\r | |
5220bd21 MK |
110 | case EfiResetWarm:\r |
111 | ResetWarm ();\r | |
112 | break;\r | |
b700a827 | 113 | \r |
5220bd21 MK |
114 | case EfiResetCold:\r |
115 | ResetCold ();\r | |
116 | break;\r | |
b700a827 | 117 | \r |
5220bd21 MK |
118 | case EfiResetShutdown:\r |
119 | ResetShutdown ();\r | |
120 | return;\r | |
b700a827 | 121 | \r |
5220bd21 MK |
122 | case EfiResetPlatformSpecific:\r |
123 | ResetPlatformSpecific (DataSize, ResetData);\r | |
124 | return;\r | |
b700a827 | 125 | \r |
5220bd21 MK |
126 | default:\r |
127 | return;\r | |
b700a827 ZG |
128 | }\r |
129 | }\r |