]>
Commit | Line | Data |
---|---|---|
b2c55e73 AB |
1 | /** @file\r |
2 | ResetSystemLib implementation using PSCI calls\r | |
3 | \r | |
4 | Copyright (c) 2017, Linaro Ltd. All rights reserved.<BR>\r | |
5 | \r | |
6 | This program and the accompanying materials\r | |
7 | are licensed and made available under the terms and conditions of the BSD License\r | |
8 | which accompanies this distribution. The full text of the license may be found at\r | |
9 | http://opensource.org/licenses/bsd-license.php\r | |
10 | \r | |
11 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
12 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
13 | \r | |
14 | **/\r | |
15 | \r | |
16 | #include <PiDxe.h>\r | |
17 | \r | |
18 | #include <Library/BaseLib.h>\r | |
19 | #include <Library/DebugLib.h>\r | |
20 | #include <Library/ResetSystemLib.h>\r | |
21 | #include <Library/ArmSmcLib.h>\r | |
22 | \r | |
23 | #include <IndustryStandard/ArmStdSmc.h>\r | |
24 | \r | |
25 | /**\r | |
26 | This function causes a system-wide reset (cold reset), in which\r | |
27 | all circuitry within the system returns to its initial state. This type of reset\r | |
28 | is asynchronous to system operation and operates without regard to\r | |
29 | cycle boundaries.\r | |
30 | \r | |
31 | If this function returns, it means that the system does not support cold reset.\r | |
32 | **/\r | |
33 | VOID\r | |
34 | EFIAPI\r | |
35 | ResetCold (\r | |
36 | VOID\r | |
37 | )\r | |
38 | {\r | |
39 | ARM_SMC_ARGS ArmSmcArgs;\r | |
40 | \r | |
41 | // Send a PSCI 0.2 SYSTEM_RESET command\r | |
42 | ArmSmcArgs.Arg0 = ARM_SMC_ID_PSCI_SYSTEM_RESET;\r | |
43 | ArmCallSmc (&ArmSmcArgs);\r | |
44 | }\r | |
45 | \r | |
46 | /**\r | |
47 | This function causes a system-wide initialization (warm reset), in which all processors\r | |
48 | are set to their initial state. Pending cycles are not corrupted.\r | |
49 | \r | |
50 | If this function returns, it means that the system does not support warm reset.\r | |
51 | **/\r | |
52 | VOID\r | |
53 | EFIAPI\r | |
54 | ResetWarm (\r | |
55 | VOID\r | |
56 | )\r | |
57 | {\r | |
58 | // Map a warm reset into a cold reset\r | |
59 | ResetCold ();\r | |
60 | }\r | |
61 | \r | |
62 | /**\r | |
63 | This function causes the system to enter a power state equivalent\r | |
64 | to the ACPI G2/S5 or G3 states.\r | |
65 | \r | |
66 | If this function returns, it means that the system does not support shutdown reset.\r | |
67 | **/\r | |
68 | VOID\r | |
69 | EFIAPI\r | |
70 | ResetShutdown (\r | |
71 | VOID\r | |
72 | )\r | |
73 | {\r | |
74 | ARM_SMC_ARGS ArmSmcArgs;\r | |
75 | \r | |
76 | // Send a PSCI 0.2 SYSTEM_OFF command\r | |
77 | ArmSmcArgs.Arg0 = ARM_SMC_ID_PSCI_SYSTEM_OFF;\r | |
78 | ArmCallSmc (&ArmSmcArgs);\r | |
79 | }\r | |
80 | \r | |
81 | /**\r | |
82 | This function causes the system to enter S3 and then wake up immediately.\r | |
83 | \r | |
84 | If this function returns, it means that the system does not support S3 feature.\r | |
85 | **/\r | |
86 | VOID\r | |
87 | EFIAPI\r | |
88 | EnterS3WithImmediateWake (\r | |
89 | VOID\r | |
90 | )\r | |
91 | {\r | |
92 | // Not implemented\r | |
93 | }\r | |
94 | \r | |
95 | /**\r | |
96 | This function causes a systemwide reset. The exact type of the reset is\r | |
97 | defined by the EFI_GUID that follows the Null-terminated Unicode string passed\r | |
98 | into ResetData. If the platform does not recognize the EFI_GUID in ResetData\r | |
99 | the platform must pick a supported reset type to perform.The platform may\r | |
100 | optionally log the parameters from any non-normal reset that occurs.\r | |
101 | \r | |
102 | @param[in] DataSize The size, in bytes, of ResetData.\r | |
103 | @param[in] ResetData The data buffer starts with a Null-terminated string,\r | |
104 | followed by the EFI_GUID.\r | |
105 | **/\r | |
106 | VOID\r | |
107 | EFIAPI\r | |
108 | ResetPlatformSpecific (\r | |
109 | IN UINTN DataSize,\r | |
110 | IN VOID *ResetData\r | |
111 | )\r | |
112 | {\r | |
113 | // Map the platform specific reset as reboot\r | |
114 | ResetCold ();\r | |
115 | }\r |