TianoCore EDK2 master
Loading...
Searching...
No Matches
RuntimeResetSystemLib.c
Go to the documentation of this file.
1
9#include <PiDxe.h>
13#include <Library/DebugLib.h>
14
15EFI_EVENT mRuntimeResetSystemLibVirtualAddressChangeEvent;
16static EFI_RUNTIME_SERVICES *mInternalRT;
17
26VOID
27EFIAPI
29 VOID
30 )
31{
32 mInternalRT->ResetSystem (EfiResetCold, EFI_SUCCESS, 0, NULL);
33}
34
41VOID
42EFIAPI
44 VOID
45 )
46{
47 mInternalRT->ResetSystem (EfiResetWarm, EFI_SUCCESS, 0, NULL);
48}
49
56VOID
57EFIAPI
59 VOID
60 )
61{
62 mInternalRT->ResetSystem (EfiResetShutdown, EFI_SUCCESS, 0, NULL);
63}
64
76VOID
77EFIAPI
79 IN UINTN DataSize,
80 IN VOID *ResetData
81 )
82{
83 mInternalRT->ResetSystem (EfiResetPlatformSpecific, EFI_SUCCESS, DataSize, ResetData);
84}
85
98VOID
99EFIAPI
101 IN EFI_RESET_TYPE ResetType,
102 IN EFI_STATUS ResetStatus,
103 IN UINTN DataSize,
104 IN VOID *ResetData OPTIONAL
105 )
106{
107 mInternalRT->ResetSystem (ResetType, ResetStatus, DataSize, ResetData);
108}
109
117VOID
118EFIAPI
120 IN EFI_EVENT Event,
121 IN VOID *Context
122 )
123{
124 mInternalRT->ConvertPointer (0, (VOID **)&mInternalRT);
125}
126
140EFIAPI
142 IN EFI_HANDLE ImageHandle,
143 IN EFI_SYSTEM_TABLE *SystemTable
144 )
145{
146 EFI_STATUS Status;
147
148 //
149 // Library should not use the gRT directly, for it may be converted by other library instance.
150 //
151 mInternalRT = gRT;
152
153 //
154 // Register notify function for EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE
155 //
156 Status = gBS->CreateEventEx (
157 EVT_NOTIFY_SIGNAL,
158 TPL_NOTIFY,
160 NULL,
161 &gEfiEventVirtualAddressChangeGuid,
162 &mRuntimeResetSystemLibVirtualAddressChangeEvent
163 );
164 ASSERT_EFI_ERROR (Status);
165
166 return EFI_SUCCESS;
167}
168
182EFIAPI
184 IN EFI_HANDLE ImageHandle,
185 IN EFI_SYSTEM_TABLE *SystemTable
186 )
187{
188 EFI_STATUS Status;
189
190 ASSERT (gBS != NULL);
191 Status = gBS->CloseEvent (mRuntimeResetSystemLibVirtualAddressChangeEvent);
192 ASSERT_EFI_ERROR (Status);
193
194 return EFI_SUCCESS;
195}
UINT64 UINTN
EFI_RUNTIME_SERVICES * gRT
#define NULL
Definition: Base.h:319
#define IN
Definition: Base.h:279
#define ASSERT_EFI_ERROR(StatusParameter)
Definition: DebugLib.h:462
VOID EFIAPI ResetWarm(VOID)
VOID EFIAPI ResetShutdown(VOID)
EFI_STATUS EFIAPI RuntimeResetSystemLibConstruct(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
VOID EFIAPI ResetSystem(IN EFI_RESET_TYPE ResetType, IN EFI_STATUS ResetStatus, IN UINTN DataSize, IN VOID *ResetData OPTIONAL)
VOID EFIAPI RuntimeResetSystemLibVirtualAddressChange(IN EFI_EVENT Event, IN VOID *Context)
VOID EFIAPI ResetPlatformSpecific(IN UINTN DataSize, IN VOID *ResetData)
VOID EFIAPI ResetCold(VOID)
EFI_STATUS EFIAPI RuntimeResetSystemLibDeconstruct(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
VOID * EFI_EVENT
Definition: UefiBaseType.h:37
VOID * EFI_HANDLE
Definition: UefiBaseType.h:33
#define EFI_SUCCESS
Definition: UefiBaseType.h:112
EFI_BOOT_SERVICES * gBS
EFI_RESET_TYPE
@ EfiResetCold
@ EfiResetShutdown
@ EfiResetWarm
@ EfiResetPlatformSpecific