TianoCore EDK2 master
Loading...
Searching...
No Matches
UefiNotTiano.c
Go to the documentation of this file.
1
14#include "UefiLibInternal.h"
15
34EFIAPI
36 OUT EFI_EVENT *LegacyBootEvent
37 )
38{
40 TPL_CALLBACK,
42 NULL,
43 LegacyBootEvent
44 );
45}
46
67EFIAPI
69 IN EFI_TPL NotifyTpl,
71 IN VOID *NotifyContext OPTIONAL,
72 OUT EFI_EVENT *LegacyBootEvent
73 )
74{
75 EFI_STATUS Status;
76 EFI_EVENT_NOTIFY WorkerNotifyFunction;
77
78 ASSERT (LegacyBootEvent != NULL);
79
80 if (gST->Hdr.Revision < EFI_2_00_SYSTEM_TABLE_REVISION) {
81 DEBUG ((DEBUG_ERROR, "EFI1.1 can't support LegacyBootEvent!"));
82 ASSERT (FALSE);
83
84 return EFI_UNSUPPORTED;
85 } else {
86 //
87 // For UEFI 2.0 and the future use an Event Group
88 //
89 if (NotifyFunction == NULL) {
90 //
91 // CreateEventEx will check NotifyFunction is NULL or not and return error.
92 // Use dummy routine for the case NotifyFunction is NULL.
93 //
94 WorkerNotifyFunction = EfiEventEmptyFunction;
95 } else {
96 WorkerNotifyFunction = NotifyFunction;
97 }
98
99 Status = gBS->CreateEventEx (
100 EVT_NOTIFY_SIGNAL,
101 NotifyTpl,
102 WorkerNotifyFunction,
103 NotifyContext,
104 &gEfiEventLegacyBootGuid,
105 LegacyBootEvent
106 );
107 }
108
109 return Status;
110}
111
130EFIAPI
132 OUT EFI_EVENT *ReadyToBootEvent
133 )
134{
136 TPL_CALLBACK,
138 NULL,
139 ReadyToBootEvent
140 );
141}
142
163EFIAPI
165 IN EFI_TPL NotifyTpl,
167 IN VOID *NotifyContext OPTIONAL,
168 OUT EFI_EVENT *ReadyToBootEvent
169 )
170{
171 EFI_STATUS Status;
172 EFI_EVENT_NOTIFY WorkerNotifyFunction;
173
174 ASSERT (ReadyToBootEvent != NULL);
175
176 if (gST->Hdr.Revision < EFI_2_00_SYSTEM_TABLE_REVISION) {
177 DEBUG ((DEBUG_ERROR, "EFI1.1 can't support ReadyToBootEvent!"));
178 ASSERT (FALSE);
179
180 return EFI_UNSUPPORTED;
181 } else {
182 //
183 // For UEFI 2.0 and the future use an Event Group
184 //
185 if (NotifyFunction == NULL) {
186 //
187 // CreateEventEx will check NotifyFunction is NULL or not and return error.
188 // Use dummy routine for the case NotifyFunction is NULL.
189 //
190 WorkerNotifyFunction = EfiEventEmptyFunction;
191 } else {
192 WorkerNotifyFunction = NotifyFunction;
193 }
194
195 Status = gBS->CreateEventEx (
196 EVT_NOTIFY_SIGNAL,
197 NotifyTpl,
198 WorkerNotifyFunction,
199 NotifyContext,
200 &gEfiEventReadyToBootGuid,
201 ReadyToBootEvent
202 );
203 }
204
205 return Status;
206}
207
217VOID
218EFIAPI
220 VOID
221 )
222{
223 EFI_STATUS Status;
224 EFI_EVENT ReadyToBootEvent;
225 EFI_EVENT AfterReadyToBootEvent;
226
227 Status = EfiCreateEventReadyToBoot (&ReadyToBootEvent);
228 if (!EFI_ERROR (Status)) {
229 gBS->SignalEvent (ReadyToBootEvent);
230 gBS->CloseEvent (ReadyToBootEvent);
231 }
232
233 Status = gBS->CreateEventEx (
234 EVT_NOTIFY_SIGNAL,
235 TPL_CALLBACK,
237 NULL,
238 &gEfiEventAfterReadyToBootGuid,
239 &AfterReadyToBootEvent
240 );
241 if (!EFI_ERROR (Status)) {
242 gBS->SignalEvent (AfterReadyToBootEvent);
243 gBS->CloseEvent (AfterReadyToBootEvent);
244 }
245}
246
256VOID
257EFIAPI
259 VOID
260 )
261{
262 EFI_STATUS Status;
263 EFI_EVENT LegacyBootEvent;
264
265 Status = EfiCreateEventLegacyBoot (&LegacyBootEvent);
266 if (!EFI_ERROR (Status)) {
267 gBS->SignalEvent (LegacyBootEvent);
268 gBS->CloseEvent (LegacyBootEvent);
269 }
270}
271
290EFI_GUID *
291EFIAPI
294 )
295{
296 ASSERT (FvDevicePathNode != NULL);
297
298 if ((DevicePathType (&FvDevicePathNode->Header) == MEDIA_DEVICE_PATH) &&
299 (DevicePathSubType (&FvDevicePathNode->Header) == MEDIA_PIWG_FW_FILE_DP))
300 {
301 return (EFI_GUID *)&FvDevicePathNode->FvFileName;
302 }
303
304 return NULL;
305}
306
323VOID
324EFIAPI
326 IN OUT MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *FvDevicePathNode,
327 IN CONST EFI_GUID *NameGuid
328 )
329{
330 ASSERT (FvDevicePathNode != NULL);
331 ASSERT (NameGuid != NULL);
332
333 //
334 // Use the new Device path that does not conflict with the UEFI
335 //
336 FvDevicePathNode->Header.Type = MEDIA_DEVICE_PATH;
337 FvDevicePathNode->Header.SubType = MEDIA_PIWG_FW_FILE_DP;
338 SetDevicePathNodeLength (&FvDevicePathNode->Header, sizeof (MEDIA_FW_VOL_FILEPATH_DEVICE_PATH));
339
340 CopyGuid (&FvDevicePathNode->FvFileName, NameGuid);
341}
GUID *EFIAPI CopyGuid(OUT GUID *DestinationGuid, IN CONST GUID *SourceGuid)
Definition: MemLibGuid.c:39
#define MEDIA_PIWG_FW_FILE_DP
Definition: DevicePath.h:1130
UINT8 EFIAPI DevicePathType(IN CONST VOID *Node)
UINT16 EFIAPI SetDevicePathNodeLength(IN OUT VOID *Node, IN UINTN Length)
UINT8 EFIAPI DevicePathSubType(IN CONST VOID *Node)
#define NULL
Definition: Base.h:319
#define CONST
Definition: Base.h:259
#define FALSE
Definition: Base.h:307
#define IN
Definition: Base.h:279
#define OUT
Definition: Base.h:284
#define DEBUG(Expression)
Definition: DebugLib.h:434
VOID EFIAPI NotifyFunction(IN EFI_EVENT Event, IN VOID *Context)
Definition: ScsiBus.c:1492
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
VOID * EFI_EVENT
Definition: UefiBaseType.h:37
UINTN EFI_TPL
Definition: UefiBaseType.h:41
EFI_SYSTEM_TABLE * gST
EFI_BOOT_SERVICES * gBS
VOID EFIAPI EfiEventEmptyFunction(IN EFI_EVENT Event, IN VOID *Context)
Definition: UefiLib.c:354
EFI_STATUS EFIAPI EfiCreateEventLegacyBootEx(IN EFI_TPL NotifyTpl, IN EFI_EVENT_NOTIFY NotifyFunction OPTIONAL, IN VOID *NotifyContext OPTIONAL, OUT EFI_EVENT *LegacyBootEvent)
Definition: UefiNotTiano.c:68
EFI_STATUS EFIAPI EfiCreateEventReadyToBoot(OUT EFI_EVENT *ReadyToBootEvent)
Definition: UefiNotTiano.c:131
EFI_STATUS EFIAPI EfiCreateEventLegacyBoot(OUT EFI_EVENT *LegacyBootEvent)
Definition: UefiNotTiano.c:35
VOID EFIAPI EfiInitializeFwVolDevicepathNode(IN OUT MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *FvDevicePathNode, IN CONST EFI_GUID *NameGuid)
Definition: UefiNotTiano.c:325
EFI_STATUS EFIAPI EfiCreateEventReadyToBootEx(IN EFI_TPL NotifyTpl, IN EFI_EVENT_NOTIFY NotifyFunction OPTIONAL, IN VOID *NotifyContext OPTIONAL, OUT EFI_EVENT *ReadyToBootEvent)
Definition: UefiNotTiano.c:164
VOID EFIAPI EfiSignalEventLegacyBoot(VOID)
Definition: UefiNotTiano.c:258
VOID EFIAPI EfiSignalEventReadyToBoot(VOID)
Definition: UefiNotTiano.c:219
EFI_GUID *EFIAPI EfiGetNameGuidFromFwVolDevicePathNode(IN CONST MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *FvDevicePathNode)
Definition: UefiNotTiano.c:292
VOID(EFIAPI * EFI_EVENT_NOTIFY)(IN EFI_EVENT Event, IN VOID *Context)
Definition: UefiSpec.h:463
EFI_TABLE_HEADER Hdr
Definition: UefiSpec.h:2032
Definition: Base.h:213