TianoCore EDK2 master
Loading...
Searching...
No Matches
ArmSmcPsciResetSystemLib.c
Go to the documentation of this file.
1
12#include <PiDxe.h>
13
14#include <Library/ArmSmcLib.h>
15#include <Library/BaseLib.h>
16#include <Library/DebugLib.h>
18
20
29VOID
30EFIAPI
32 VOID
33 )
34{
35 // Send a PSCI 0.2 SYSTEM_RESET command
36 ArmCallSmc0 (ARM_SMC_ID_PSCI_SYSTEM_RESET, NULL, NULL, NULL);
37}
38
45VOID
46EFIAPI
48 VOID
49 )
50{
51 UINTN Arg1;
52 UINTN Ret;
53
54 Arg1 = ARM_SMC_ID_PSCI_SYSTEM_RESET2_AARCH64;
55
56 // Is SYSTEM_RESET2 supported?
57 Ret = ArmCallSmc0 (ARM_SMC_ID_PSCI_FEATURES, &Arg1, NULL, NULL);
58 if (Ret == ARM_SMC_PSCI_RET_SUCCESS) {
59 // Send PSCI SYSTEM_RESET2 command
60 ArmCallSmc0 (Arg1, NULL, NULL, NULL);
61 } else {
62 // Map a warm reset into a cold reset
63 DEBUG ((
64 DEBUG_INFO,
65 "Warm reboot not supported by platform, issuing cold reboot\n"
66 ));
67 ResetCold ();
68 }
69}
70
77VOID
78EFIAPI
80 VOID
81 )
82{
83 // Send a PSCI 0.2 SYSTEM_OFF command
84 ArmCallSmc0 (ARM_SMC_ID_PSCI_SYSTEM_OFF, NULL, NULL, NULL);
85}
86
98VOID
99EFIAPI
101 IN UINTN DataSize,
102 IN VOID *ResetData
103 )
104{
105 // Map the platform specific reset as reboot
106 ResetCold ();
107}
108
121VOID
122EFIAPI
124 IN EFI_RESET_TYPE ResetType,
125 IN EFI_STATUS ResetStatus,
126 IN UINTN DataSize,
127 IN VOID *ResetData OPTIONAL
128 )
129{
130 switch (ResetType) {
131 case EfiResetWarm:
132 ResetWarm ();
133 break;
134
135 case EfiResetCold:
136 ResetCold ();
137 break;
138
139 case EfiResetShutdown:
140 ResetShutdown ();
141 return;
142
144 ResetPlatformSpecific (DataSize, ResetData);
145 return;
146
147 default:
148 return;
149 }
150}
UINT64 UINTN
UINTN ArmCallSmc0(IN UINTN Function, OUT UINTN *Arg1 OPTIONAL, OUT UINTN *Arg2 OPTIONAL, OUT UINTN *Arg3 OPTIONAL)
Definition: ArmSmc.c:121
VOID EFIAPI ResetWarm(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 NULL
Definition: Base.h:319
#define IN
Definition: Base.h:279
#define DEBUG(Expression)
Definition: DebugLib.h:422
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
EFI_RESET_TYPE
@ EfiResetCold
@ EfiResetShutdown
@ EfiResetWarm
@ EfiResetPlatformSpecific