TianoCore EDK2 master
Loading...
Searching...
No Matches
ArmPsciResetSystemLib.c
Go to the documentation of this file.
1
14#include <PiDxe.h>
15
17
19#include <Library/BaseLib.h>
20#include <Library/DebugLib.h>
23
29RETURN_STATUS
30EFIAPI
32 VOID
33 )
34{
35 return EFI_SUCCESS;
36}
37
46VOID
47EFIAPI
49 VOID
50 )
51{
53
54 // Send a PSCI 0.2 SYSTEM_RESET command
55 Args.Arg0 = ARM_SMC_ID_PSCI_SYSTEM_RESET;
56
57 ArmMonitorCall (&Args);
58}
59
66VOID
67EFIAPI
69 VOID
70 )
71{
73
74 Args.Arg0 = ARM_SMC_ID_PSCI_SYSTEM_RESET2_AARCH64;
75
76 // Is SYSTEM_RESET2 supported?
77 ArmMonitorCall (&Args);
78 if (Args.Arg0 == ARM_SMC_PSCI_RET_SUCCESS) {
79 // Send PSCI SYSTEM_RESET2 command
80 Args.Arg0 = ARM_SMC_ID_PSCI_SYSTEM_RESET2_AARCH64;
81
82 ArmMonitorCall (&Args);
83 } else {
84 // Map a warm reset into a cold reset
85 DEBUG ((
86 DEBUG_INFO,
87 "Warm reboot not supported by platform, issuing cold reboot\n"
88 ));
89 ResetCold ();
90 }
91}
92
99VOID
100EFIAPI
102 VOID
103 )
104{
105 ARM_MONITOR_ARGS Args;
106
107 // Send a PSCI 0.2 SYSTEM_RESET command
108 Args.Arg0 = ARM_SMC_ID_PSCI_SYSTEM_OFF;
109
110 ArmMonitorCall (&Args);
111}
112
124VOID
125EFIAPI
127 IN UINTN DataSize,
128 IN VOID *ResetData
129 )
130{
131 // Map the platform specific reset as reboot
132 ResetCold ();
133}
134
147VOID
148EFIAPI
150 IN EFI_RESET_TYPE ResetType,
151 IN EFI_STATUS ResetStatus,
152 IN UINTN DataSize,
153 IN VOID *ResetData OPTIONAL
154 )
155{
156 switch (ResetType) {
157 case EfiResetWarm:
158 ResetWarm ();
159 break;
160
161 case EfiResetCold:
162 ResetCold ();
163 break;
164
165 case EfiResetShutdown:
166 ResetShutdown ();
167 return;
168
170 ResetPlatformSpecific (DataSize, ResetData);
171 return;
172
173 default:
174 return;
175 }
176}
UINT64 UINTN
VOID EFIAPI ArmMonitorCall(IN OUT ARM_MONITOR_ARGS *Args)
VOID EFIAPI ResetWarm(VOID)
RETURN_STATUS EFIAPI ArmPsciResetSystemLibConstructor(VOID)
VOID EFIAPI ResetShutdown(VOID)
VOID EFIAPI ResetSystem(IN EFI_RESET_TYPE ResetType, IN EFI_STATUS ResetStatus, IN UINTN DataSize, IN VOID *ResetData OPTIONAL)
VOID EFIAPI ResetPlatformSpecific(IN UINTN DataSize, IN VOID *ResetData)
VOID EFIAPI ResetCold(VOID)
#define IN
Definition: Base.h:279
#define DEBUG(Expression)
Definition: DebugLib.h:434
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
#define EFI_SUCCESS
Definition: UefiBaseType.h:112
EFI_RESET_TYPE
@ EfiResetCold
@ EfiResetShutdown
@ EfiResetWarm
@ EfiResetPlatformSpecific