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