]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Library/UefiLib/UefiNotTiano.c
Import some Pei and Dxe related instances for MdePkg.
[mirror_edk2.git] / MdePkg / Library / UefiLib / UefiNotTiano.c
CommitLineData
e386b444 1/** @file\r
2 Library functions that abstract areas of conflict between Tiano an UEFI 2.0.\r
3\r
4 Help Port Framework/Tinao code that has conflicts with UEFI 2.0 by hiding the\r
5 oldconflicts with library functions and supporting implementations of the old\r
6 (EDK/EFI 1.10) and new (EDK II/UEFI 2.0) way. This module is a DXE driver as\r
7 it contains DXE enum extensions for EFI event services.\r
8\r
9Copyright (c) 2006 - 2007, Intel Corporation<BR>\r
10All rights reserved. This program and the accompanying materials\r
11are licensed and made available under the terms and conditions of the BSD License\r
12which accompanies this distribution. The full text of the license may be found at\r
13http://opensource.org/licenses/bsd-license.php\r
14\r
15THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
16WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
17\r
18**/\r
19\r
20\r
21//\r
22// Include common header file for this module.\r
23//\r
24#include "CommonHeader.h"\r
25\r
26/**\r
27 An empty function to pass error checking of CreateEventEx ().\r
28\r
29 This empty function ensures that EFI_EVENT_NOTIFY_SIGNAL_ALL is error\r
30 checked correctly since it is now mapped into CreateEventEx() in UEFI 2.0.\r
31\r
32**/\r
33STATIC\r
34VOID\r
35EFIAPI\r
36InternalEmptyFuntion (\r
37 IN EFI_EVENT Event,\r
38 IN VOID *Context\r
39 )\r
40{\r
41 return;\r
42}\r
43\r
44/**\r
45 Create a Legacy Boot Event.\r
46\r
47 Tiano extended the CreateEvent Type enum to add a legacy boot event type.\r
48 This was bad as Tiano did not own the enum. In UEFI 2.0 CreateEventEx was\r
49 added and now it's possible to not voilate the UEFI specification by\r
50 declaring a GUID for the legacy boot event class. This library supports\r
51 the EDK/EFI 1.10 form and EDK II/UEFI 2.0 form and allows common code to\r
52 work both ways.\r
53\r
54 @param LegacyBootEvent Returns the EFI event returned from gBS->CreateEvent(Ex).\r
55\r
56 @retval EFI_SUCCESS Event was created.\r
57 @retval Other Event was not created.\r
58\r
59**/\r
60EFI_STATUS\r
61EFIAPI\r
62EfiCreateEventLegacyBoot (\r
63 OUT EFI_EVENT *LegacyBootEvent\r
64 )\r
65{\r
66 return EfiCreateEventLegacyBootEx (\r
67 TPL_CALLBACK,\r
68 InternalEmptyFuntion,\r
69 NULL,\r
70 LegacyBootEvent\r
71 );\r
72}\r
73\r
74/**\r
75 Create an EFI event in the Legacy Boot Event Group and allows\r
76 the caller to specify a notification function.\r
77\r
78 This function abstracts the creation of the Legacy Boot Event.\r
79 The Framework moved from a proprietary to UEFI 2.0 based mechanism.\r
80 This library abstracts the caller from how this event is created to prevent\r
81 to code form having to change with the version of the specification supported.\r
82 If LegacyBootEvent is NULL, then ASSERT().\r
83\r
84 @param NotifyTpl The task priority level of the event.\r
85 @param NotifyFunction The notification function to call when the event is signaled.\r
86 @param NotifyContext The content to pass to NotifyFunction when the event is signaled.\r
87 @param LegacyBootEvent Returns the EFI event returned from gBS->CreateEvent(Ex).\r
88\r
89 @retval EFI_SUCCESS Event was created.\r
90 @retval Other Event was not created.\r
91\r
92**/\r
93EFI_STATUS\r
94EFIAPI\r
95EfiCreateEventLegacyBootEx (\r
96 IN EFI_TPL NotifyTpl,\r
97 IN EFI_EVENT_NOTIFY NotifyFunction, OPTIONAL\r
98 IN VOID *NotifyContext, OPTIONAL\r
99 OUT EFI_EVENT *LegacyBootEvent\r
100 )\r
101{\r
102 EFI_STATUS Status;\r
103\r
104 ASSERT (LegacyBootEvent != NULL);\r
105\r
106 if (gST->Hdr.Revision < 0x00020000) {\r
107 return EFI_UNSUPPORTED;\r
108 } else {\r
109 //\r
110 // For UEFI 2.0 and the future use an Event Group\r
111 //\r
112 Status = gBS->CreateEventEx (\r
113 EVT_NOTIFY_SIGNAL,\r
114 NotifyTpl,\r
115 NotifyFunction,\r
116 NotifyContext,\r
117 &gEfiEventLegacyBootGuid,\r
118 LegacyBootEvent\r
119 );\r
120 }\r
121\r
122 return Status;\r
123}\r
124\r
125/**\r
126 Create a Read to Boot Event.\r
127\r
128 Tiano extended the CreateEvent Type enum to add a ready to boot event type.\r
129 This was bad as Tiano did not own the enum. In UEFI 2.0 CreateEventEx was\r
130 added and now it's possible to not voilate the UEFI specification and use\r
131 the ready to boot event class defined in UEFI 2.0. This library supports\r
132 the EDK/EFI 1.10 form and EDK II/UEFI 2.0 form and allows common code to\r
133 work both ways.\r
134\r
135 @param LegacyBootEvent Returns the EFI event returned from gBS->CreateEvent(Ex).\r
136\r
137 @retval EFI_SUCCESS Event was created.\r
138 @retval Other Event was not created.\r
139\r
140**/\r
141EFI_STATUS\r
142EFIAPI\r
143EfiCreateEventReadyToBoot (\r
144 OUT EFI_EVENT *ReadyToBootEvent\r
145 )\r
146{\r
147 return EfiCreateEventReadyToBootEx (\r
148 TPL_CALLBACK ,\r
149 InternalEmptyFuntion,\r
150 NULL,\r
151 ReadyToBootEvent\r
152 );\r
153}\r
154\r
155/**\r
156 Create an EFI event in the Ready To Boot Event Group and allows\r
157 the caller to specify a notification function.\r
158\r
159 This function abstracts the creation of the Ready to Boot Event.\r
160 The Framework moved from a proprietary to UEFI 2.0 based mechanism.\r
161 This library abstracts the caller from how this event is created to prevent\r
162 to code form having to change with the version of the specification supported.\r
163 If ReadyToBootEvent is NULL, then ASSERT().\r
164\r
165 @param NotifyTpl The task priority level of the event.\r
166 @param NotifyFunction The notification function to call when the event is signaled.\r
167 @param NotifyContext The content to pass to NotifyFunction when the event is signaled.\r
168 @param LegacyBootEvent Returns the EFI event returned from gBS->CreateEvent(Ex).\r
169\r
170 @retval EFI_SUCCESS Event was created.\r
171 @retval Other Event was not created.\r
172\r
173**/\r
174EFI_STATUS\r
175EFIAPI\r
176EfiCreateEventReadyToBootEx (\r
177 IN EFI_TPL NotifyTpl,\r
178 IN EFI_EVENT_NOTIFY NotifyFunction, OPTIONAL\r
179 IN VOID *NotifyContext, OPTIONAL\r
180 OUT EFI_EVENT *ReadyToBootEvent\r
181 )\r
182{\r
183 EFI_STATUS Status;\r
184\r
185 ASSERT (ReadyToBootEvent != NULL);\r
186\r
187 if (gST->Hdr.Revision < 0x00020000) {\r
188 return EFI_UNSUPPORTED;\r
189 } else {\r
190 //\r
191 // For UEFI 2.0 and the future use an Event Group\r
192 //\r
193 Status = gBS->CreateEventEx (\r
194 EVT_NOTIFY_SIGNAL,\r
195 NotifyTpl,\r
196 NotifyFunction,\r
197 NotifyContext,\r
198 &gEfiEventReadyToBootGuid,\r
199 ReadyToBootEvent\r
200 );\r
201 }\r
202\r
203 return Status;\r
204}\r
205\r
206\r
207/**\r
208 Signal a Ready to Boot Event.\r
209\r
210 Create a Ready to Boot Event. Signal it and close it. This causes other\r
211 events of the same event group to be signaled in other modules.\r
212\r
213**/\r
214VOID\r
215EFIAPI\r
216EfiSignalEventReadyToBoot (\r
217 VOID\r
218 )\r
219{\r
220 EFI_STATUS Status;\r
221 EFI_EVENT ReadyToBootEvent;\r
222\r
223 Status = EfiCreateEventReadyToBoot (&ReadyToBootEvent);\r
224 if (!EFI_ERROR (Status)) {\r
225 gBS->SignalEvent (ReadyToBootEvent);\r
226 gBS->CloseEvent (ReadyToBootEvent);\r
227 }\r
228}\r
229\r
230/**\r
231 Signal a Legacy Boot Event.\r
232\r
233 Create a legacy Boot Event. Signal it and close it. This causes other\r
234 events of the same event group to be signaled in other modules.\r
235\r
236**/\r
237VOID\r
238EFIAPI\r
239EfiSignalEventLegacyBoot (\r
240 VOID\r
241 )\r
242{\r
243 EFI_STATUS Status;\r
244 EFI_EVENT LegacyBootEvent;\r
245\r
246 Status = EfiCreateEventLegacyBoot (&LegacyBootEvent);\r
247 if (!EFI_ERROR (Status)) {\r
248 gBS->SignalEvent (LegacyBootEvent);\r
249 gBS->CloseEvent (LegacyBootEvent);\r
250 }\r
251}\r
252\r
253\r
254/**\r
255 Check to see if the Firmware Volume (FV) Media Device Path is valid\r
256\r
257 Tiano extended the EFI 1.10 device path nodes. Tiano does not own this enum\r
258 so as we move to UEFI 2.0 support we must use a mechanism that conforms with\r
259 the UEFI 2.0 specification to define the FV device path. An UEFI GUIDed\r
260 device path is defined for Tiano extensions of device path. If the code\r
261 is compiled to conform with the UEFI 2.0 specification use the new device path\r
262 else use the old form for backwards compatability. The return value to this\r
263 function points to a location in FvDevicePathNode and it does not allocate\r
264 new memory for the GUID pointer that is returned.\r
265\r
266 @param FvDevicePathNode Pointer to FV device path to check.\r
267\r
268 @retval NULL FvDevicePathNode is not valid.\r
269 @retval Other FvDevicePathNode is valid and pointer to NameGuid was returned.\r
270\r
271**/\r
272EFI_GUID *\r
273EFIAPI\r
274EfiGetNameGuidFromFwVolDevicePathNode (\r
275 IN CONST MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *FvDevicePathNode\r
276 )\r
277{\r
278 ASSERT (FvDevicePathNode != NULL);\r
279 //\r
280 // bugbug:Need to implement ...\r
281 //\r
282 return NULL;\r
283}\r
284\r
285\r
286/**\r
287 Initialize a Firmware Volume (FV) Media Device Path node.\r
288\r
289 Tiano extended the EFI 1.10 device path nodes. Tiano does not own this enum\r
290 so as we move to UEFI 2.0 support we must use a mechanism that conforms with\r
291 the UEFI 2.0 specification to define the FV device path. An UEFI GUIDed\r
292 device path is defined for Tiano extensions of device path. If the code\r
293 is compiled to conform with the UEFI 2.0 specification use the new device path\r
294 else use the old form for backwards compatability.\r
295\r
296 @param FvDevicePathNode Pointer to a FV device path node to initialize\r
297 @param NameGuid FV file name to use in FvDevicePathNode\r
298\r
299**/\r
300VOID\r
301EFIAPI\r
302EfiInitializeFwVolDevicepathNode (\r
303 IN OUT MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *FvDevicePathNode,\r
304 IN CONST EFI_GUID *NameGuid\r
305 )\r
306{\r
307 ASSERT (FvDevicePathNode != NULL);\r
308 ASSERT (NameGuid != NULL);\r
309 //\r
310 // bugbug:Need to implement ...\r
311 //\r
312}\r
313\r