2 Library functions that abstract areas of conflict between Tiano an UEFI 2.0.
4 Help Port Framework/Tinao code that has conflicts with UEFI 2.0 by hiding the
5 oldconflicts with library functions and supporting implementations of the old
6 (EDK/EFI 1.10) and new (EDK II/UEFI 2.0) way. This module is a DXE driver as
7 it contains DXE enum extensions for EFI event services.
9 Copyright (c) 2006 - 2007, Intel Corporation<BR>
10 All rights reserved. This program and the accompanying materials
11 are licensed and made available under the terms and conditions of the BSD License
12 which accompanies this distribution. The full text of the license may be found at
13 http://opensource.org/licenses/bsd-license.php
15 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
16 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
22 // Include common header file for this module.
24 #include "CommonHeader.h"
27 An empty function to pass error checking of CreateEventEx ().
29 This empty function ensures that EFI_EVENT_NOTIFY_SIGNAL_ALL is error
30 checked correctly since it is now mapped into CreateEventEx() in UEFI 2.0.
36 InternalEmptyFuntion (
45 Create a Legacy Boot Event.
47 Tiano extended the CreateEvent Type enum to add a legacy boot event type.
48 This was bad as Tiano did not own the enum. In UEFI 2.0 CreateEventEx was
49 added and now it's possible to not voilate the UEFI specification by
50 declaring a GUID for the legacy boot event class. This library supports
51 the EDK/EFI 1.10 form and EDK II/UEFI 2.0 form and allows common code to
54 @param LegacyBootEvent Returns the EFI event returned from gBS->CreateEvent(Ex).
56 @retval EFI_SUCCESS Event was created.
57 @retval Other Event was not created.
62 EfiCreateEventLegacyBoot (
63 OUT EFI_EVENT
*LegacyBootEvent
66 return EfiCreateEventLegacyBootEx (
75 Create an EFI event in the Legacy Boot Event Group and allows
76 the caller to specify a notification function.
78 This function abstracts the creation of the Legacy Boot Event.
79 The Framework moved from a proprietary to UEFI 2.0 based mechanism.
80 This library abstracts the caller from how this event is created to prevent
81 to code form having to change with the version of the specification supported.
82 If LegacyBootEvent is NULL, then ASSERT().
84 @param NotifyTpl The task priority level of the event.
85 @param NotifyFunction The notification function to call when the event is signaled.
86 @param NotifyContext The content to pass to NotifyFunction when the event is signaled.
87 @param LegacyBootEvent Returns the EFI event returned from gBS->CreateEvent(Ex).
89 @retval EFI_SUCCESS Event was created.
90 @retval Other Event was not created.
95 EfiCreateEventLegacyBootEx (
97 IN EFI_EVENT_NOTIFY NotifyFunction
, OPTIONAL
98 IN VOID
*NotifyContext
, OPTIONAL
99 OUT EFI_EVENT
*LegacyBootEvent
104 ASSERT (LegacyBootEvent
!= NULL
);
106 if (gST
->Hdr
.Revision
< 0x00020000) {
107 return EFI_UNSUPPORTED
;
110 // For UEFI 2.0 and the future use an Event Group
112 Status
= gBS
->CreateEventEx (
117 &gEfiEventLegacyBootGuid
,
126 Create a Read to Boot Event.
128 Tiano extended the CreateEvent Type enum to add a ready to boot event type.
129 This was bad as Tiano did not own the enum. In UEFI 2.0 CreateEventEx was
130 added and now it's possible to not voilate the UEFI specification and use
131 the ready to boot event class defined in UEFI 2.0. This library supports
132 the EDK/EFI 1.10 form and EDK II/UEFI 2.0 form and allows common code to
135 @param LegacyBootEvent Returns the EFI event returned from gBS->CreateEvent(Ex).
137 @retval EFI_SUCCESS Event was created.
138 @retval Other Event was not created.
143 EfiCreateEventReadyToBoot (
144 OUT EFI_EVENT
*ReadyToBootEvent
147 return EfiCreateEventReadyToBootEx (
149 InternalEmptyFuntion
,
156 Create an EFI event in the Ready To Boot Event Group and allows
157 the caller to specify a notification function.
159 This function abstracts the creation of the Ready to Boot Event.
160 The Framework moved from a proprietary to UEFI 2.0 based mechanism.
161 This library abstracts the caller from how this event is created to prevent
162 to code form having to change with the version of the specification supported.
163 If ReadyToBootEvent is NULL, then ASSERT().
165 @param NotifyTpl The task priority level of the event.
166 @param NotifyFunction The notification function to call when the event is signaled.
167 @param NotifyContext The content to pass to NotifyFunction when the event is signaled.
168 @param LegacyBootEvent Returns the EFI event returned from gBS->CreateEvent(Ex).
170 @retval EFI_SUCCESS Event was created.
171 @retval Other Event was not created.
176 EfiCreateEventReadyToBootEx (
177 IN EFI_TPL NotifyTpl
,
178 IN EFI_EVENT_NOTIFY NotifyFunction
, OPTIONAL
179 IN VOID
*NotifyContext
, OPTIONAL
180 OUT EFI_EVENT
*ReadyToBootEvent
185 ASSERT (ReadyToBootEvent
!= NULL
);
187 if (gST
->Hdr
.Revision
< 0x00020000) {
188 return EFI_UNSUPPORTED
;
191 // For UEFI 2.0 and the future use an Event Group
193 Status
= gBS
->CreateEventEx (
198 &gEfiEventReadyToBootGuid
,
208 Signal a Ready to Boot Event.
210 Create a Ready to Boot Event. Signal it and close it. This causes other
211 events of the same event group to be signaled in other modules.
216 EfiSignalEventReadyToBoot (
221 EFI_EVENT ReadyToBootEvent
;
223 Status
= EfiCreateEventReadyToBoot (&ReadyToBootEvent
);
224 if (!EFI_ERROR (Status
)) {
225 gBS
->SignalEvent (ReadyToBootEvent
);
226 gBS
->CloseEvent (ReadyToBootEvent
);
231 Signal a Legacy Boot Event.
233 Create a legacy Boot Event. Signal it and close it. This causes other
234 events of the same event group to be signaled in other modules.
239 EfiSignalEventLegacyBoot (
244 EFI_EVENT LegacyBootEvent
;
246 Status
= EfiCreateEventLegacyBoot (&LegacyBootEvent
);
247 if (!EFI_ERROR (Status
)) {
248 gBS
->SignalEvent (LegacyBootEvent
);
249 gBS
->CloseEvent (LegacyBootEvent
);
255 Check to see if the Firmware Volume (FV) Media Device Path is valid
257 Tiano extended the EFI 1.10 device path nodes. Tiano does not own this enum
258 so as we move to UEFI 2.0 support we must use a mechanism that conforms with
259 the UEFI 2.0 specification to define the FV device path. An UEFI GUIDed
260 device path is defined for Tiano extensions of device path. If the code
261 is compiled to conform with the UEFI 2.0 specification use the new device path
262 else use the old form for backwards compatability. The return value to this
263 function points to a location in FvDevicePathNode and it does not allocate
264 new memory for the GUID pointer that is returned.
266 @param FvDevicePathNode Pointer to FV device path to check.
268 @retval NULL FvDevicePathNode is not valid.
269 @retval Other FvDevicePathNode is valid and pointer to NameGuid was returned.
274 EfiGetNameGuidFromFwVolDevicePathNode (
275 IN CONST MEDIA_FW_VOL_FILEPATH_DEVICE_PATH
*FvDevicePathNode
278 ASSERT (FvDevicePathNode
!= NULL
);
280 // bugbug:Need to implement ...
287 Initialize a Firmware Volume (FV) Media Device Path node.
289 Tiano extended the EFI 1.10 device path nodes. Tiano does not own this enum
290 so as we move to UEFI 2.0 support we must use a mechanism that conforms with
291 the UEFI 2.0 specification to define the FV device path. An UEFI GUIDed
292 device path is defined for Tiano extensions of device path. If the code
293 is compiled to conform with the UEFI 2.0 specification use the new device path
294 else use the old form for backwards compatability.
296 @param FvDevicePathNode Pointer to a FV device path node to initialize
297 @param NameGuid FV file name to use in FvDevicePathNode
302 EfiInitializeFwVolDevicepathNode (
303 IN OUT MEDIA_FW_VOL_FILEPATH_DEVICE_PATH
*FvDevicePathNode
,
304 IN CONST EFI_GUID
*NameGuid
307 ASSERT (FvDevicePathNode
!= NULL
);
308 ASSERT (NameGuid
!= NULL
);
310 // bugbug:Need to implement ...