]> git.proxmox.com Git - mirror_edk2.git/blame - EdkCompatibilityPkg/Foundation/Library/Dxe/Include/EfiDriverLib.h
Avoid using code name in comments.
[mirror_edk2.git] / EdkCompatibilityPkg / Foundation / Library / Dxe / Include / EfiDriverLib.h
CommitLineData
3eb9473e 1/*++\r
2\r
8598a1ed 3Copyright (c) 2004 - 2011, Intel Corporation. All rights reserved.<BR>\r
4ea9375a 4This program and the accompanying materials \r
3eb9473e 5are licensed and made available under the terms and conditions of the BSD License \r
6which accompanies this distribution. The full text of the license may be found at \r
7http://opensource.org/licenses/bsd-license.php \r
8 \r
9THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
10WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
11\r
12Module Name:\r
13\r
14 EfiDriverLib.h\r
15\r
16Abstract:\r
17\r
18 Light weight lib to support EFI drivers.\r
19\r
20--*/\r
21\r
22#ifndef _EFI_DRIVER_LIB_H_\r
23#define _EFI_DRIVER_LIB_H_\r
24\r
25#include "EfiStatusCode.h"\r
26#include "EfiCommonLib.h"\r
27#include "EfiPerf.h"\r
28#include "LinkedList.h"\r
29#include "GetImage.h"\r
30#include "EfiImageFormat.h"\r
d850121e 31#include "EfiCompNameSupport.h"\r
3eb9473e 32\r
33#include EFI_GUID_DEFINITION (DxeServices)\r
34#include EFI_GUID_DEFINITION (EventGroup)\r
35#include EFI_GUID_DEFINITION (EventLegacyBios)\r
36#include EFI_GUID_DEFINITION (FrameworkDevicePath)\r
37#include EFI_PROTOCOL_DEFINITION (FirmwareVolume)\r
38#include EFI_PROTOCOL_DEFINITION (FirmwareVolume2)\r
39#include EFI_PROTOCOL_DEFINITION (DataHub)\r
40#include EFI_PROTOCOL_DEFINITION (DriverBinding)\r
41#include EFI_PROTOCOL_DEFINITION (ComponentName)\r
42#include EFI_PROTOCOL_DEFINITION (ComponentName2)\r
43#include EFI_PROTOCOL_DEFINITION (DriverConfiguration)\r
d850121e 44#include EFI_PROTOCOL_DEFINITION (DriverConfiguration2)\r
3eb9473e 45#include EFI_PROTOCOL_DEFINITION (DriverDiagnostics)\r
d850121e 46#include EFI_PROTOCOL_DEFINITION (DriverDiagnostics2)\r
3eb9473e 47\r
48#include EFI_PROTOCOL_DEFINITION (DebugMask)\r
49\r
f90eb36c 50#if defined(__GNUC__) && defined(ECP_CPU_IPF)\r
51\r
52VOID\r
53EFIAPI\r
54EcpEfiBreakPoint (\r
55 VOID\r
56 )\r
57/*++\r
58\r
59Routine Description:\r
60\r
61 Generates a breakpoint on the CPU.\r
62\r
63 Generates a breakpoint on the CPU. The breakpoint must be implemented such\r
64 that code can resume normal execution after the breakpoint.\r
65\r
66Arguments:\r
67\r
68 VOID\r
69\r
70Returns: \r
71\r
72 VOID\r
73\r
74--*/\r
75;\r
76\r
77VOID\r
78EFIAPI\r
79EcpMemoryFence (\r
80 VOID\r
81 )\r
82/*++\r
83\r
84Routine Description:\r
85\r
86 Used to serialize load and store operations.\r
87\r
88 All loads and stores that proceed calls to this function are guaranteed to be\r
89 globally visible when this function returns.\r
90\r
91Arguments:\r
92\r
93 VOID\r
94\r
95Returns: \r
96\r
97 VOID\r
98\r
99--*/\r
100;\r
101\r
102#endif\r
103\r
3eb9473e 104typedef struct {\r
105 CHAR8 *Language;\r
106 CHAR16 *UnicodeString;\r
107} EFI_UNICODE_STRING_TABLE;\r
108#if (EFI_SPECIFICATION_VERSION >= 0x00020000)\r
3eb9473e 109#define LANGUAGE_CODE_ENGLISH "en-US"\r
110#else\r
3eb9473e 111#define LANGUAGE_CODE_ENGLISH "eng"\r
112#endif\r
113\r
114//\r
115// Macros for EFI Driver Library Functions that are really EFI Boot Services\r
116//\r
117#define EfiCopyMem(_Destination, _Source, _Length) gBS->CopyMem ((_Destination), (_Source), (_Length))\r
118#define EfiSetMem(_Destination, _Length, _Value) gBS->SetMem ((_Destination), (_Length), (_Value))\r
119#define EfiZeroMem(_Destination, _Length) gBS->SetMem ((_Destination), (_Length), 0)\r
120\r
121//\r
122// Driver Lib Globals.\r
123//\r
124extern EFI_BOOT_SERVICES *gBS;\r
125extern EFI_DXE_SERVICES *gDS;\r
126extern EFI_RUNTIME_SERVICES *gRT;\r
127extern EFI_SYSTEM_TABLE *gST;\r
128extern UINTN gErrorLevel;\r
129extern EFI_GUID gEfiCallerIdGuid;\r
130extern EFI_DEBUG_MASK_PROTOCOL *gDebugMaskInterface;\r
131\r
132EFI_STATUS\r
133EfiInitializeDriverLib (\r
134 IN EFI_HANDLE ImageHandle,\r
135 IN EFI_SYSTEM_TABLE *SystemTable\r
136 )\r
137/*++\r
138\r
139Routine Description:\r
140\r
141 Intialize Driver Lib if it has not yet been initialized. \r
142\r
143Arguments:\r
144\r
145 ImageHandle - The firmware allocated handle for the EFI image.\r
146 \r
147 SystemTable - A pointer to the EFI System Table.\r
148\r
149\r
150Returns: \r
151\r
152 EFI_STATUS always returns EFI_SUCCESS\r
153\r
154--*/\r
155;\r
156\r
157EFI_STATUS\r
158DxeInitializeDriverLib (\r
159 IN EFI_HANDLE ImageHandle,\r
160 IN EFI_SYSTEM_TABLE *SystemTable\r
161 )\r
162/*++\r
163\r
164Routine Description:\r
165\r
166 Intialize Driver Lib if it has not yet been initialized. \r
167\r
168Arguments:\r
169\r
170 ImageHandle - The firmware allocated handle for the EFI image.\r
171 \r
172 SystemTable - A pointer to the EFI System Table.\r
173\r
174Returns: \r
175\r
176 EFI_STATUS always returns EFI_SUCCESS\r
177\r
178--*/\r
179;\r
180\r
181EFI_STATUS\r
182EfiLibInstallDriverBinding (\r
183 IN EFI_HANDLE ImageHandle,\r
184 IN EFI_SYSTEM_TABLE *SystemTable,\r
185 IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding,\r
186 IN EFI_HANDLE DriverBindingHandle\r
187 )\r
188/*++\r
189\r
190Routine Description:\r
191\r
192 Intialize a driver by installing the Driver Binding Protocol onto the \r
193 driver's DriverBindingHandle. This is typically the same as the driver's\r
194 ImageHandle, but it can be different if the driver produces multiple\r
195 DriverBinding Protocols. This function also initializes the EFI Driver\r
196 Library that initializes the global variables gST, gBS, gRT.\r
197\r
198Arguments:\r
199\r
200 ImageHandle - The image handle of the driver\r
201\r
202 SystemTable - The EFI System Table that was passed to the driver's entry point\r
203\r
204 DriverBinding - A Driver Binding Protocol instance that this driver is producing\r
205\r
206 DriverBindingHandle - The handle that DriverBinding is to be installe onto. If this\r
207 parameter is NULL, then a new handle is created.\r
208\r
209Returns: \r
210\r
211 EFI_SUCCESS is DriverBinding is installed onto DriverBindingHandle\r
212\r
213 Otherwise, then return status from gBS->InstallProtocolInterface()\r
214\r
215--*/\r
216;\r
217\r
218EFI_STATUS\r
219EfiLibInstallAllDriverProtocols (\r
220 IN EFI_HANDLE ImageHandle,\r
221 IN EFI_SYSTEM_TABLE *SystemTable,\r
222 IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding,\r
223 IN EFI_HANDLE DriverBindingHandle,\r
d850121e 224 IN EFI_COMPONENT_NAME_PROTOCOL *ComponentName, OPTIONAL\r
225 IN EFI_DRIVER_CONFIGURATION_PROTOCOL *DriverConfiguration, OPTIONAL\r
226 IN EFI_DRIVER_DIAGNOSTICS_PROTOCOL *DriverDiagnostics OPTIONAL\r
3eb9473e 227 )\r
228/*++\r
229\r
230Routine Description:\r
231\r
232 Intialize a driver by installing the Driver Binding Protocol onto the \r
233 driver's DriverBindingHandle. This is typically the same as the driver's\r
234 ImageHandle, but it can be different if the driver produces multiple\r
235 DriverBinding Protocols. This function also initializes the EFI Driver\r
236 Library that initializes the global variables gST, gBS, gRT.\r
237\r
238Arguments:\r
239\r
240 ImageHandle - The image handle of the driver\r
241\r
242 SystemTable - The EFI System Table that was passed to the driver's entry point\r
243\r
244 DriverBinding - A Driver Binding Protocol instance that this driver is producing\r
245\r
246 DriverBindingHandle - The handle that DriverBinding is to be installe onto. If this\r
247 parameter is NULL, then a new handle is created.\r
248\r
249 ComponentName - A Component Name Protocol instance that this driver is producing\r
250\r
251 DriverConfiguration - A Driver Configuration Protocol instance that this driver is producing\r
252 \r
253 DriverDiagnostics - A Driver Diagnostics Protocol instance that this driver is producing\r
254\r
255Returns: \r
256\r
257 EFI_SUCCESS if all the protocols were installed onto DriverBindingHandle\r
258\r
259 Otherwise, then return status from gBS->InstallProtocolInterface()\r
260\r
261--*/\r
262;\r
263\r
d850121e 264EFI_STATUS\r
265EfiLibInstallAllDriverProtocols2 (\r
266 IN EFI_HANDLE ImageHandle,\r
267 IN EFI_SYSTEM_TABLE *SystemTable,\r
268 IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding,\r
269 IN EFI_HANDLE DriverBindingHandle,\r
270 IN EFI_COMPONENT_NAME2_PROTOCOL *ComponentName2, OPTIONAL\r
271 IN EFI_DRIVER_CONFIGURATION2_PROTOCOL *DriverConfiguration2, OPTIONAL\r
272 IN EFI_DRIVER_DIAGNOSTICS2_PROTOCOL *DriverDiagnostics2 OPTIONAL\r
273 )\r
274/*++\r
275\r
276Routine Description:\r
277\r
278 Intialize a driver by installing the Driver Binding Protocol onto the \r
279 driver's DriverBindingHandle. This is typically the same as the driver's\r
280 ImageHandle, but it can be different if the driver produces multiple\r
281 DriverBinding Protocols. This function also initializes the EFI Driver\r
282 Library that initializes the global variables gST, gBS, gRT.\r
283\r
284Arguments:\r
285\r
286 ImageHandle - The image handle of the driver\r
287\r
288 SystemTable - The EFI System Table that was passed to the driver's entry point\r
289\r
290 DriverBinding - A Driver Binding Protocol instance that this driver is producing\r
291\r
292 DriverBindingHandle - The handle that DriverBinding is to be installe onto. If this\r
293 parameter is NULL, then a new handle is created.\r
294\r
295 ComponentName2 - A Component Name2 Protocol instance that this driver is producing\r
296\r
297 DriverConfiguration2- A Driver Configuration2 Protocol instance that this driver is producing\r
298 \r
299 DriverDiagnostics2 - A Driver Diagnostics2 Protocol instance that this driver is producing\r
300\r
301Returns: \r
302\r
303 EFI_SUCCESS if all the protocols were installed onto DriverBindingHandle\r
304\r
305 Otherwise, then return status from gBS->InstallProtocolInterface()\r
306\r
307--*/\r
308;\r
309\r
3eb9473e 310EFI_STATUS\r
311EfiLibGetSystemConfigurationTable (\r
312 IN EFI_GUID *TableGuid,\r
313 OUT VOID **Table\r
314 )\r
315/*++\r
316\r
317Routine Description:\r
318 \r
319 Return the EFI 1.0 System Tabl entry with TableGuid\r
320\r
321Arguments:\r
322\r
323 TableGuid - Name of entry to return in the system table\r
324 Table - Pointer in EFI system table associated with TableGuid\r
325\r
326Returns: \r
327\r
328 EFI_SUCCESS - Table returned;\r
329 EFI_NOT_FOUND - TableGuid not in EFI system table\r
330\r
331--*/\r
332;\r
333\r
334BOOLEAN\r
335EfiLibCompareLanguage (\r
336 CHAR8 *Language1,\r
337 CHAR8 *Language2\r
338 )\r
339/*++\r
340\r
341Routine Description:\r
342\r
343 Compare two languages to say whether they are identical.\r
344\r
345Arguments:\r
346\r
347 Language1 - first language\r
348 Language2 - second language\r
349\r
350Returns:\r
351\r
352 TRUE - identical\r
353 FALSE - not identical\r
354\r
355--*/\r
356;\r
357\r
358//\r
359// DevicePath.c\r
360//\r
361BOOLEAN\r
362EfiIsDevicePathMultiInstance (\r
363 IN EFI_DEVICE_PATH_PROTOCOL *DevicePath\r
364 )\r
365/*++\r
366\r
367Routine Description:\r
368 Return TRUE is this is a multi instance device path.\r
369\r
370Arguments:\r
371 DevicePath - A pointer to a device path data structure.\r
372\r
373\r
374Returns:\r
375 TRUE - If DevicePath is multi instance. \r
376 FALSE - If DevicePath is not multi instance.\r
377\r
378--*/\r
379;\r
380\r
381EFI_DEVICE_PATH_PROTOCOL *\r
382EfiDevicePathInstance (\r
383 IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath,\r
384 OUT UINTN *Size\r
385 )\r
386/*++\r
387\r
388Routine Description:\r
389 Function retrieves the next device path instance from a device path data structure.\r
390\r
391Arguments:\r
392 DevicePath - A pointer to a device path data structure.\r
393\r
394 Size - A pointer to the size of a device path instance in bytes.\r
395\r
396Returns:\r
397\r
398 This function returns a pointer to the current device path instance.\r
399 In addition, it returns the size in bytes of the current device path instance in Size,\r
400 and a pointer to the next device path instance in DevicePath.\r
401 If there are no more device path instances in DevicePath, then DevicePath will be set to NULL.\r
402\r
403--*/\r
404;\r
405\r
406UINTN\r
407EfiDevicePathSize (\r
408 IN EFI_DEVICE_PATH_PROTOCOL *DevPath\r
409 )\r
410/*++\r
411\r
412Routine Description:\r
413\r
414 Calculate the size of a whole device path. \r
415 \r
416Arguments:\r
417\r
418 DevPath - The pointer to the device path data.\r
419 \r
420Returns:\r
421\r
422 Size of device path data structure..\r
423\r
424--*/\r
425;\r
426\r
427EFI_DEVICE_PATH_PROTOCOL *\r
428EfiAppendDevicePath (\r
429 IN EFI_DEVICE_PATH_PROTOCOL *Src1,\r
430 IN EFI_DEVICE_PATH_PROTOCOL *Src2\r
431 )\r
432/*++\r
433\r
434Routine Description:\r
435 Function is used to append a Src1 and Src2 together.\r
436\r
437Arguments:\r
438 Src1 - A pointer to a device path data structure.\r
439\r
440 Src2 - A pointer to a device path data structure.\r
441\r
442Returns:\r
443\r
444 A pointer to the new device path is returned.\r
445 NULL is returned if space for the new device path could not be allocated from pool.\r
446 It is up to the caller to free the memory used by Src1 and Src2 if they are no longer needed.\r
447\r
448--*/\r
449;\r
450\r
451EFI_DEVICE_PATH_PROTOCOL *\r
452EfiDevicePathFromHandle (\r
453 IN EFI_HANDLE Handle\r
454 )\r
455/*++\r
456\r
457Routine Description:\r
458\r
459 Locate device path protocol interface on a device handle.\r
460\r
461Arguments:\r
462\r
463 Handle - The device handle\r
464\r
465Returns:\r
466\r
467 Device path protocol interface located.\r
468\r
469--*/\r
470;\r
471\r
472EFI_DEVICE_PATH_PROTOCOL *\r
473EfiDuplicateDevicePath (\r
474 IN EFI_DEVICE_PATH_PROTOCOL *DevPath\r
475 )\r
476/*++\r
477\r
478Routine Description:\r
479 Duplicate a new device path data structure from the old one.\r
480\r
481Arguments:\r
482 DevPath - A pointer to a device path data structure.\r
483\r
484Returns:\r
485 A pointer to the new allocated device path data.\r
486 Caller must free the memory used by DevicePath if it is no longer needed.\r
487\r
488--*/\r
489;\r
490\r
491EFI_DEVICE_PATH_PROTOCOL *\r
492EfiAppendDevicePathNode (\r
493 IN EFI_DEVICE_PATH_PROTOCOL *Src1,\r
494 IN EFI_DEVICE_PATH_PROTOCOL *Src2\r
495 )\r
496/*++\r
497\r
498Routine Description:\r
499 Function is used to append a device path node to the end of another device path.\r
500\r
501Arguments:\r
502 Src1 - A pointer to a device path data structure.\r
503\r
504 Src2 - A pointer to a device path data structure.\r
505\r
506Returns:\r
507 This function returns a pointer to the new device path.\r
508 If there is not enough temporary pool memory available to complete this function,\r
509 then NULL is returned.\r
510\r
511\r
512--*/\r
513;\r
514\r
515EFI_DEVICE_PATH_PROTOCOL *\r
516EfiFileDevicePath (\r
517 IN EFI_HANDLE Device OPTIONAL,\r
518 IN CHAR16 *FileName\r
519 )\r
520/*++\r
521\r
522Routine Description:\r
523 Create a device path that appends a MEDIA_DEVICE_PATH with\r
524 FileNameGuid to the device path of DeviceHandle.\r
525\r
526Arguments:\r
527 Device - Optional Device Handle to use as Root of the Device Path\r
528\r
529 FileName - FileName\r
530\r
531Returns:\r
532 EFI_DEVICE_PATH_PROTOCOL that was allocated from dynamic memory\r
533 or NULL pointer.\r
534\r
535--*/\r
536;\r
537\r
538EFI_DEVICE_PATH_PROTOCOL *\r
539EfiAppendDevicePathInstance (\r
540 IN EFI_DEVICE_PATH_PROTOCOL *Src,\r
541 IN EFI_DEVICE_PATH_PROTOCOL *Instance\r
542 )\r
543/*++\r
544\r
545Routine Description:\r
546\r
547 Append a device path instance to another.\r
548\r
549Arguments:\r
550\r
551 Src - The device path instance to be appended with.\r
552 Instance - The device path instance appending the other.\r
553\r
554Returns:\r
555\r
556 The contaction of these two.\r
557\r
558--*/\r
559;\r
560\r
561//\r
562// Lock.c\r
563//\r
564typedef struct {\r
565 EFI_TPL Tpl;\r
566 EFI_TPL OwnerTpl;\r
567 UINTN Lock;\r
568} EFI_LOCK;\r
569\r
570VOID\r
571EfiInitializeLock (\r
572 IN OUT EFI_LOCK *Lock,\r
573 IN EFI_TPL Priority\r
574 )\r
575/*++\r
576\r
577Routine Description:\r
578\r
579 Initialize a basic mutual exclusion lock. Each lock\r
580 provides mutual exclusion access at it's task priority\r
581 level. Since there is no-premption (at any TPL) or\r
582 multiprocessor support, acquiring the lock only consists\r
583 of raising to the locks TPL.\r
584\r
585 Note on a check build ASSERT()s are used to ensure proper\r
586 lock usage.\r
587 \r
588Arguments:\r
589\r
590 Lock - The EFI_LOCK structure to initialize\r
591\r
592 Priority - The task priority level of the lock\r
593\r
594 \r
595Returns:\r
596\r
597 An initialized Efi Lock structure.\r
598\r
599--*/\r
600;\r
601\r
602//\r
603// Macro to initialize the state of a lock when a lock variable is declared\r
604//\r
605#define EFI_INITIALIZE_LOCK_VARIABLE(Tpl) {Tpl,0,0}\r
606\r
607VOID\r
608EfiAcquireLock (\r
609 IN EFI_LOCK *Lock\r
610 )\r
611/*++\r
612\r
613Routine Description:\r
614\r
615 Raising to the task priority level of the mutual exclusion\r
616 lock, and then acquires ownership of the lock.\r
617 \r
618Arguments:\r
619\r
620 Lock - The lock to acquire\r
621 \r
622Returns:\r
623\r
624 None\r
625\r
626--*/\r
627;\r
628\r
629EFI_STATUS\r
630EfiAcquireLockOrFail (\r
631 IN EFI_LOCK *Lock\r
632 )\r
633/*++\r
634\r
635Routine Description:\r
636\r
637 Initialize a basic mutual exclusion lock. Each lock\r
638 provides mutual exclusion access at it's task priority\r
639 level. Since there is no-premption (at any TPL) or\r
640 multiprocessor support, acquiring the lock only consists\r
641 of raising to the locks TPL.\r
642 \r
643Arguments:\r
644\r
645 Lock - The EFI_LOCK structure to initialize\r
646 \r
647Returns:\r
648\r
649 EFI_SUCCESS - Lock Owned.\r
650 EFI_ACCESS_DENIED - Reentrant Lock Acquisition, Lock not Owned.\r
651\r
652--*/\r
653;\r
654\r
655VOID\r
656EfiReleaseLock (\r
657 IN EFI_LOCK *Lock\r
658 )\r
659/*++\r
660\r
661Routine Description:\r
662\r
663 Releases ownership of the mutual exclusion lock, and\r
664 restores the previous task priority level.\r
665 \r
666Arguments:\r
667\r
668 Lock - The lock to release\r
669 \r
670Returns:\r
671\r
672 None\r
673\r
674--*/\r
675;\r
676\r
677VOID *\r
678EfiLibAllocatePool (\r
679 IN UINTN AllocationSize\r
680 )\r
681/*++\r
682\r
683Routine Description:\r
684\r
685 Allocate EfiBootServicesData pool of size AllocationSize\r
686\r
687Arguments:\r
688\r
689 AllocationSize - Pool size\r
690\r
691Returns:\r
692\r
693 Pointer to the pool allocated\r
694\r
695--*/\r
696;\r
697\r
698VOID *\r
699EfiLibAllocateRuntimePool (\r
700 IN UINTN AllocationSize\r
701 )\r
702/*++\r
703\r
704Routine Description:\r
705\r
706 Allocate EfiRuntimeServicesData pool of size AllocationSize\r
707\r
708Arguments:\r
709\r
710 AllocationSize - Pool size\r
711\r
712Returns:\r
713\r
714 Pointer to the pool allocated\r
715\r
716--*/\r
717;\r
718\r
719VOID *\r
720EfiLibAllocateZeroPool (\r
721 IN UINTN AllocationSize\r
722 )\r
723/*++\r
724\r
725Routine Description:\r
726\r
727 Allocate EfiBootServicesData pool of size AllocationSize and set memory to zero.\r
728\r
729Arguments:\r
730\r
731 AllocationSize - Pool size\r
732\r
733Returns:\r
734\r
735 Pointer to the pool allocated\r
736\r
737--*/\r
738;\r
739\r
740VOID *\r
741EfiLibAllocateRuntimeZeroPool (\r
742 IN UINTN AllocationSize\r
743 )\r
744/*++\r
745\r
746Routine Description:\r
747\r
748 Allocate EfiRuntimeServicesData pool of size AllocationSize and set memory to zero.\r
749\r
750Arguments:\r
751\r
752 AllocationSize - Pool size\r
753\r
754Returns:\r
755\r
756 Pointer to the pool allocated\r
757\r
758--*/\r
759;\r
760\r
761VOID *\r
762EfiLibAllocateCopyPool (\r
763 IN UINTN AllocationSize,\r
764 IN VOID *Buffer\r
765 )\r
766/*++\r
767\r
768Routine Description:\r
769\r
770 Allocate BootServicesData pool and use a buffer provided by \r
771 caller to fill it.\r
772\r
773Arguments:\r
774\r
775 AllocationSize - The size to allocate\r
776 \r
777 Buffer - Buffer that will be filled into the buffer allocated\r
778\r
779Returns:\r
780\r
781 Pointer of the buffer allocated.\r
782\r
783--*/\r
784;\r
785\r
786VOID *\r
787EfiLibAllocateRuntimeCopyPool (\r
788 IN UINTN AllocationSize,\r
789 IN VOID *Buffer\r
790 )\r
791/*++\r
792\r
793Routine Description:\r
794\r
795 Allocate RuntimeServicesData pool and use a buffer provided by \r
796 caller to fill it.\r
797\r
798Arguments:\r
799\r
800 AllocationSize - The size to allocate\r
801 \r
802 Buffer - Buffer that will be filled into the buffer allocated\r
803\r
804Returns:\r
805\r
806 Pointer of the buffer allocated.\r
807\r
808--*/\r
809;\r
810\r
811//\r
812// Event.c\r
813//\r
814EFI_EVENT\r
815EfiLibCreateProtocolNotifyEvent (\r
816 IN EFI_GUID *ProtocolGuid,\r
817 IN EFI_TPL NotifyTpl,\r
818 IN EFI_EVENT_NOTIFY NotifyFunction,\r
819 IN VOID *NotifyContext,\r
820 OUT VOID **Registration\r
821 )\r
822/*++\r
823\r
824Routine Description:\r
825\r
826 Create a protocol notification event and return it.\r
827\r
828Arguments:\r
829\r
830 ProtocolGuid - Protocol to register notification event on.\r
831\r
832 NotifyTpl - Maximum TPL to single the NotifyFunction.\r
833\r
834 NotifyFunction - EFI notification routine.\r
835\r
836 NotifyContext - Context passed into Event when it is created.\r
837\r
838 Registration - Registration key returned from RegisterProtocolNotify().\r
839\r
840Returns:\r
841\r
842 The EFI_EVENT that has been registered to be signaled when a ProtocolGuid\r
843 is added to the system.\r
844\r
845--*/\r
846;\r
847\r
848EFI_STATUS\r
849EfiLibNamedEventSignal (\r
850 IN EFI_GUID *Name\r
851 )\r
852/*++\r
853\r
854Routine Description:\r
855 Signals a named event. All registered listeners will run.\r
856 The listeners should register using EfiLibNamedEventListen() function.\r
857\r
858 NOTE: For now, the named listening/signalling is implemented\r
859 on a protocol interface being installed and uninstalled.\r
860 In the future, this maybe implemented based on a dedicated mechanism.\r
861\r
862Arguments:\r
863 Name - Name to perform the signaling on. The name is a GUID.\r
864\r
865Returns:\r
866 EFI_SUCCESS if successfull.\r
867\r
868--*/\r
869;\r
870\r
871EFI_STATUS\r
872EfiLibNamedEventListen (\r
873 IN EFI_GUID * Name,\r
874 IN EFI_TPL NotifyTpl,\r
875 IN EFI_EVENT_NOTIFY NotifyFunction,\r
876 IN VOID *NotifyContext\r
877 )\r
878/*++\r
879\r
880Routine Description:\r
881 Listenes to signals on the name.\r
882 EfiLibNamedEventSignal() signals the event.\r
883\r
884 NOTE: For now, the named listening/signalling is implemented\r
885 on a protocol interface being installed and uninstalled.\r
886 In the future, this maybe implemented based on a dedicated mechanism.\r
887\r
888Arguments:\r
889 Name - Name to register the listener on.\r
890 NotifyTpl - Maximum TPL to singnal the NotifyFunction.\r
891 NotifyFunction - The listener routine.\r
892 NotifyContext - Context passed into the listener routine.\r
893\r
894Returns:\r
895 EFI_SUCCESS if successful.\r
896\r
897--*/\r
898;\r
899\r
900//\r
901// Handle.c\r
902//\r
903EFI_STATUS\r
904EfiLibLocateHandleProtocolByProtocols (\r
905 IN OUT EFI_HANDLE * Handle, OPTIONAL\r
906 OUT VOID **Interface, OPTIONAL\r
907 ...\r
908 )\r
909/*++\r
910Routine Description:\r
911\r
912 Function locates Protocol and/or Handle on which all Protocols specified\r
913 as a variable list are installed.\r
914 It supports continued search. The caller must assure that no handles are added\r
915 or removed while performing continued search, by e.g., rising the TPL and not\r
916 calling any handle routines. Otherwise the behavior is undefined.\r
917\r
918Arguments:\r
919\r
920 Handle - The address of handle to receive the handle on which protocols\r
921 indicated by the variable list are installed.\r
922 If points to NULL, all handles are searched. If pointing to a\r
923 handle returned from previous call, searches starting from next handle.\r
924 If NULL, the parameter is ignored.\r
925\r
926 Interface - The address of a pointer to a protocol interface that will receive\r
927 the interface indicated by first variable argument.\r
928 If NULL, the parameter is ignored.\r
929\r
930 ... - A variable argument list containing protocol GUIDs. Must end with NULL.\r
931\r
932Returns:\r
933\r
934 EFI_SUCCESS - All the protocols where found on same handle.\r
935 EFI_NOT_FOUND - A Handle with all the protocols installed was not found.\r
936 Other values as may be returned from LocateHandleBuffer() or HandleProtocol().\r
937\r
938--*/\r
939;\r
940\r
941//\r
942// Debug.c init\r
943//\r
944EFI_STATUS\r
945EfiDebugAssertInit (\r
946 VOID\r
947 )\r
948/*++\r
949\r
950Routine Description:\r
951 \r
952 Locate Debug Assert Protocol and set as mDebugAssert\r
953\r
954Arguments:\r
955\r
956 None\r
957\r
958Returns:\r
959\r
960 Status code\r
961\r
962--*/\r
963;\r
964\r
965//\r
966// Unicode String Support\r
967//\r
968EFI_STATUS\r
969EfiLibLookupUnicodeString (\r
970 CHAR8 *Language,\r
971 CHAR8 *SupportedLanguages,\r
972 EFI_UNICODE_STRING_TABLE *UnicodeStringTable,\r
973 CHAR16 **UnicodeString\r
974 )\r
975/*++\r
976\r
977Routine Description:\r
978\r
979 Translate a unicode string to a specified language if supported.\r
980 \r
981Arguments:\r
982\r
983 Language - The name of language to translate to\r
984 SupportedLanguages - Supported languages set\r
985 UnicodeStringTable - Pointer of one item in translation dictionary\r
986 UnicodeString - The translated string\r
987\r
988Returns: \r
989\r
990 EFI_INVALID_PARAMETER - Invalid parameter\r
991 EFI_UNSUPPORTED - System not supported this language or this string translation\r
992 EFI_SUCCESS - String successfully translated\r
993\r
994--*/\r
995;\r
996\r
997EFI_STATUS\r
998EfiLibAddUnicodeString (\r
999 CHAR8 *Language,\r
1000 CHAR8 *SupportedLanguages,\r
1001 EFI_UNICODE_STRING_TABLE **UnicodeStringTable,\r
1002 CHAR16 *UnicodeString\r
1003 )\r
1004/*++\r
1005\r
1006Routine Description:\r
1007\r
1008 Add an translation to the dictionary if this language if supported.\r
1009 \r
1010Arguments:\r
1011\r
1012 Language - The name of language to translate to\r
1013 SupportedLanguages - Supported languages set\r
1014 UnicodeStringTable - Translation dictionary\r
1015 UnicodeString - The corresponding string for the language to be translated to\r
1016\r
1017Returns: \r
1018\r
1019 EFI_INVALID_PARAMETER - Invalid parameter\r
1020 EFI_UNSUPPORTED - System not supported this language\r
1021 EFI_ALREADY_STARTED - Already has a translation item of this language\r
1022 EFI_OUT_OF_RESOURCES - No enough buffer to be allocated\r
1023 EFI_SUCCESS - String successfully translated\r
1024\r
1025--*/\r
1026;\r
1027\r
1028EFI_STATUS\r
1029EfiLibFreeUnicodeStringTable (\r
1030 EFI_UNICODE_STRING_TABLE *UnicodeStringTable\r
1031 )\r
1032/*++\r
1033\r
1034Routine Description:\r
1035\r
1036 Free a string table.\r
1037\r
1038Arguments:\r
1039\r
1040 UnicodeStringTable - The string table to be freed.\r
1041\r
1042Returns: \r
1043\r
1044 EFI_SUCCESS - The table successfully freed.\r
1045\r
1046--*/\r
1047;\r
1048\r
1049EFI_STATUS\r
1050EfiLibReportStatusCode (\r
1051 IN EFI_STATUS_CODE_TYPE Type,\r
1052 IN EFI_STATUS_CODE_VALUE Value,\r
1053 IN UINT32 Instance,\r
1054 IN EFI_GUID *CallerId OPTIONAL,\r
1055 IN EFI_STATUS_CODE_DATA *Data OPTIONAL \r
1056 )\r
1057/*++\r
1058\r
1059Routine Description:\r
1060\r
1061 Report status code.\r
1062\r
1063Arguments:\r
1064\r
1065 Type - Code type\r
1066 Value - Code value\r
1067 Instance - Instance number\r
1068 CallerId - Caller name\r
1069 DevicePath - Device path that to be reported\r
1070\r
1071Returns:\r
1072\r
1073 Status code.\r
1074\r
1075 EFI_OUT_OF_RESOURCES - No enough buffer could be allocated\r
1076\r
1077--*/\r
1078;\r
1079\r
1080EFI_STATUS\r
1081ReportStatusCodeWithDevicePath (\r
1082 IN EFI_STATUS_CODE_TYPE Type,\r
1083 IN EFI_STATUS_CODE_VALUE Value,\r
1084 IN UINT32 Instance,\r
1085 IN EFI_GUID * CallerId OPTIONAL,\r
1086 IN EFI_DEVICE_PATH_PROTOCOL * DevicePath\r
1087 )\r
1088/*++\r
1089\r
1090Routine Description:\r
1091\r
1092 Report device path through status code.\r
1093\r
1094Arguments:\r
1095\r
1096 Type - Code type\r
1097 Value - Code value\r
1098 Instance - Instance number\r
1099 CallerId - Caller name\r
1100 DevicePath - Device path that to be reported\r
1101\r
1102Returns:\r
1103\r
1104 Status code.\r
1105\r
1106 EFI_OUT_OF_RESOURCES - No enough buffer could be allocated\r
1107\r
1108--*/\r
1109;\r
1110\r
1111EFI_STATUS\r
1112EFIAPI\r
1113EfiCreateEventLegacyBoot (\r
1114 IN EFI_TPL NotifyTpl,\r
1115 IN EFI_EVENT_NOTIFY NotifyFunction,\r
1116 IN VOID *NotifyContext,\r
1117 OUT EFI_EVENT *LegacyBootEvent\r
1118 )\r
1119/*++\r
1120\r
1121Routine Description:\r
1122 Create a Legacy Boot Event. \r
1123 Tiano extended the CreateEvent Type enum to add a legacy boot event type. \r
1124 This was bad as Tiano did not own the enum. In UEFI 2.0 CreateEventEx was\r
1125 added and now it's possible to not voilate the UEFI specification by \r
1126 declaring a GUID for the legacy boot event class. This library supports\r
8598a1ed 1127 the EFI 1.10 form and UEFI 2.0 form and allows common code to work both ways.\r
3eb9473e 1128\r
1129Arguments:\r
1130 LegacyBootEvent Returns the EFI event returned from gBS->CreateEvent(Ex)\r
1131\r
1132Returns:\r
1133 EFI_SUCCESS Event was created.\r
1134 Other Event was not created.\r
1135\r
1136--*/\r
1137;\r
1138\r
1139EFI_STATUS\r
1140EFIAPI\r
1141EfiCreateEventReadyToBoot (\r
1142 IN EFI_TPL NotifyTpl,\r
1143 IN EFI_EVENT_NOTIFY NotifyFunction,\r
1144 IN VOID *NotifyContext,\r
1145 OUT EFI_EVENT *ReadyToBootEvent\r
1146 )\r
1147/*++\r
1148\r
1149Routine Description:\r
1150 Create a Read to Boot Event. \r
1151 \r
1152 Tiano extended the CreateEvent Type enum to add a ready to boot event type. \r
1153 This was bad as Tiano did not own the enum. In UEFI 2.0 CreateEventEx was\r
1154 added and now it's possible to not voilate the UEFI specification and use \r
1155 the ready to boot event class defined in UEFI 2.0. This library supports\r
8598a1ed 1156 the EFI 1.10 form and UEFI 2.0 form and allows common code to work both ways.\r
3eb9473e 1157\r
1158Arguments:\r
1159 @param LegacyBootEvent Returns the EFI event returned from gBS->CreateEvent(Ex)\r
1160\r
1161Return:\r
1162 EFI_SUCCESS - Event was created.\r
1163 Other - Event was not created.\r
1164\r
1165--*/\r
1166;\r
1167\r
1168VOID\r
1169EFIAPI\r
1170EfiInitializeFwVolDevicepathNode (\r
1171 IN MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *FvDevicePathNode,\r
1172 IN EFI_GUID *NameGuid\r
1173 )\r
1174/*++\r
1175Routine Description:\r
1176 Initialize a Firmware Volume (FV) Media Device Path node.\r
1177 \r
3eb9473e 1178Arguments:\r
1179 FvDevicePathNode - Pointer to a FV device path node to initialize\r
1180 NameGuid - FV file name to use in FvDevicePathNode\r
1181\r
1182--*/\r
1183;\r
1184\r
1185EFI_GUID *\r
1186EFIAPI\r
1187EfiGetNameGuidFromFwVolDevicePathNode (\r
1188 IN MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *FvDevicePathNode\r
1189 )\r
1190/*++\r
1191Routine Description:\r
1192 Check to see if the Firmware Volume (FV) Media Device Path is valid.\r
1193 \r
3eb9473e 1194Arguments:\r
1195 FvDevicePathNode - Pointer to FV device path to check\r
1196\r
1197Return:\r
1198 NULL - FvDevicePathNode is not valid.\r
1199 Other - FvDevicePathNode is valid and pointer to NameGuid was returned.\r
1200\r
1201--*/\r
1202;\r
1203\r
1204VOID\r
1205EfiLibSafeFreePool (\r
1206 IN VOID *Buffer\r
1207 )\r
1208/*++\r
1209\r
1210Routine Description:\r
1211\r
1212 Free pool safely.\r
1213\r
1214Arguments:\r
1215 \r
1216 Buffer - The allocated pool entry to free\r
1217\r
1218Returns:\r
1219\r
1220 Pointer of the buffer allocated.\r
1221\r
1222--*/\r
1223;\r
1224\r
1225EFI_STATUS\r
1226EfiLibTestManagedDevice (\r
1227 IN EFI_HANDLE ControllerHandle,\r
1228 IN EFI_HANDLE DriverBindingHandle,\r
1229 IN EFI_GUID *ManagedProtocolGuid\r
1230 )\r
1231/*++\r
1232\r
1233Routine Description:\r
1234\r
1235 Test to see if the controller is managed by a specific driver.\r
1236\r
1237Arguments:\r
1238\r
1239 ControllerHandle - Handle for controller to test\r
1240\r
1241 DriverBindingHandle - Driver binding handle for controller\r
1242\r
1243 ManagedProtocolGuid - The protocol guid the driver opens on controller\r
1244\r
1245Returns: \r
1246\r
1247 EFI_SUCCESS - The controller is managed by the driver\r
1248\r
1249 EFI_UNSUPPORTED - The controller is not managed by the driver\r
1250\r
1251--*/\r
1252;\r
1253\r
1254EFI_STATUS\r
1255EfiLibTestChildHandle (\r
1256 IN EFI_HANDLE ControllerHandle,\r
1257 IN EFI_HANDLE ChildHandle,\r
1258 IN EFI_GUID *ConsumedGuid\r
1259 )\r
1260/*++\r
1261\r
1262Routine Description:\r
1263\r
1264 Test to see if the child handle is the child of the controller\r
1265\r
1266Arguments:\r
1267\r
1268 ControllerHandle - Handle for controller (parent)\r
1269\r
1270 ChildHandle - Child handle to test\r
1271\r
1272 ConsumsedGuid - Protocol guid consumed by child from controller\r
1273\r
1274Returns: \r
1275\r
1276 EFI_SUCCESS - The child handle is the child of the controller\r
1277\r
1278 EFI_UNSUPPORTED - The child handle is not the child of the controller\r
1279\r
1280--*/\r
1281;\r
1282#endif\r