]> git.proxmox.com Git - mirror_edk2.git/blame_incremental - MdeModulePkg/Core/Dxe/DxeMain.h
MdeModulePkg/UsbBusDxe: Fix a bug about the alternate setting number which should...
[mirror_edk2.git] / MdeModulePkg / Core / Dxe / DxeMain.h
... / ...
CommitLineData
1/** @file\r
2 The internal header file includes the common header files, defines\r
3 internal structure and functions used by DxeCore module.\r
4\r
5Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>\r
6This program and the accompanying materials\r
7are licensed and made available under the terms and conditions of the BSD License\r
8which accompanies this distribution. The full text of the license may be found at\r
9http://opensource.org/licenses/bsd-license.php\r
10\r
11THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
12WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
13\r
14**/\r
15\r
16#ifndef _DXE_MAIN_H_\r
17#define _DXE_MAIN_H_\r
18\r
19\r
20\r
21#include <PiDxe.h>\r
22\r
23#include <Protocol/LoadedImage.h>\r
24#include <Protocol/GuidedSectionExtraction.h>\r
25#include <Protocol/DevicePath.h>\r
26#include <Protocol/Runtime.h>\r
27#include <Protocol/LoadFile.h>\r
28#include <Protocol/LoadFile2.h>\r
29#include <Protocol/DriverBinding.h>\r
30#include <Protocol/VariableWrite.h>\r
31#include <Protocol/PlatformDriverOverride.h>\r
32#include <Protocol/Variable.h>\r
33#include <Protocol/Timer.h>\r
34#include <Protocol/SimpleFileSystem.h>\r
35#include <Protocol/Bds.h>\r
36#include <Protocol/RealTimeClock.h>\r
37#include <Protocol/WatchdogTimer.h>\r
38#include <Protocol/FirmwareVolume2.h>\r
39#include <Protocol/MonotonicCounter.h>\r
40#include <Protocol/StatusCode.h>\r
41#include <Protocol/Decompress.h>\r
42#include <Protocol/LoadPe32Image.h>\r
43#include <Protocol/Security.h>\r
44#include <Protocol/Security2.h>\r
45#include <Protocol/Ebc.h>\r
46#include <Protocol/Reset.h>\r
47#include <Protocol/Cpu.h>\r
48#include <Protocol/Metronome.h>\r
49#include <Protocol/FirmwareVolumeBlock.h>\r
50#include <Protocol/Capsule.h>\r
51#include <Protocol/BusSpecificDriverOverride.h>\r
52#include <Protocol/DriverFamilyOverride.h>\r
53#include <Protocol/TcgService.h>\r
54#include <Protocol/HiiPackageList.h>\r
55#include <Protocol/SmmBase2.h>\r
56#include <Guid/MemoryTypeInformation.h>\r
57#include <Guid/FirmwareFileSystem2.h>\r
58#include <Guid/FirmwareFileSystem3.h>\r
59#include <Guid/HobList.h>\r
60#include <Guid/DebugImageInfoTable.h>\r
61#include <Guid/FileInfo.h>\r
62#include <Guid/Apriori.h>\r
63#include <Guid/DxeServices.h>\r
64#include <Guid/MemoryAllocationHob.h>\r
65#include <Guid/EventLegacyBios.h>\r
66#include <Guid/EventGroup.h>\r
67#include <Guid/EventExitBootServiceFailed.h>\r
68#include <Guid/LoadModuleAtFixedAddress.h>\r
69#include <Guid/IdleLoopEvent.h>\r
70#include <Guid/VectorHandoffTable.h>\r
71#include <Ppi/VectorHandoffInfo.h>\r
72\r
73#include <Library/DxeCoreEntryPoint.h>\r
74#include <Library/DebugLib.h>\r
75#include <Library/UefiLib.h>\r
76#include <Library/BaseLib.h>\r
77#include <Library/HobLib.h>\r
78#include <Library/PerformanceLib.h>\r
79#include <Library/UefiDecompressLib.h>\r
80#include <Library/ExtractGuidedSectionLib.h>\r
81#include <Library/CacheMaintenanceLib.h>\r
82#include <Library/BaseMemoryLib.h>\r
83#include <Library/PeCoffLib.h>\r
84#include <Library/PeCoffGetEntryPointLib.h>\r
85#include <Library/PeCoffExtraActionLib.h>\r
86#include <Library/PcdLib.h>\r
87#include <Library/MemoryAllocationLib.h>\r
88#include <Library/DevicePathLib.h>\r
89#include <Library/UefiBootServicesTableLib.h>\r
90#include <Library/ReportStatusCodeLib.h>\r
91#include <Library/TimerLib.h>\r
92#include <Library/DxeServicesLib.h>\r
93#include <Library/DebugAgentLib.h>\r
94#include <Library/CpuExceptionHandlerLib.h>\r
95\r
96\r
97//\r
98// attributes for reserved memory before it is promoted to system memory\r
99//\r
100#define EFI_MEMORY_PRESENT 0x0100000000000000ULL\r
101#define EFI_MEMORY_INITIALIZED 0x0200000000000000ULL\r
102#define EFI_MEMORY_TESTED 0x0400000000000000ULL\r
103\r
104//\r
105// range for memory mapped port I/O on IPF\r
106//\r
107#define EFI_MEMORY_PORT_IO 0x4000000000000000ULL\r
108\r
109\r
110///\r
111/// EFI_DEP_REPLACE_TRUE - Used to dynamically patch the dependecy expression\r
112/// to save time. A EFI_DEP_PUSH is evauated one an\r
113/// replaced with EFI_DEP_REPLACE_TRUE. If PI spec's Vol 2\r
114/// Driver Execution Environment Core Interface use 0xff\r
115/// as new DEPEX opcode. EFI_DEP_REPLACE_TRUE should be\r
116/// defined to a new value that is not conflicting with PI spec.\r
117///\r
118#define EFI_DEP_REPLACE_TRUE 0xff\r
119\r
120///\r
121/// Define the initial size of the dependency expression evaluation stack\r
122///\r
123#define DEPEX_STACK_SIZE_INCREMENT 0x1000\r
124\r
125typedef struct {\r
126 EFI_GUID *ProtocolGuid;\r
127 VOID **Protocol;\r
128 EFI_EVENT Event;\r
129 VOID *Registration;\r
130 BOOLEAN Present;\r
131} EFI_CORE_PROTOCOL_NOTIFY_ENTRY;\r
132\r
133//\r
134// DXE Dispatcher Data structures\r
135//\r
136\r
137#define KNOWN_HANDLE_SIGNATURE SIGNATURE_32('k','n','o','w')\r
138typedef struct {\r
139 UINTN Signature;\r
140 LIST_ENTRY Link; // mFvHandleList\r
141 EFI_HANDLE Handle;\r
142 EFI_GUID FvNameGuid;\r
143} KNOWN_HANDLE;\r
144\r
145\r
146#define EFI_CORE_DRIVER_ENTRY_SIGNATURE SIGNATURE_32('d','r','v','r')\r
147typedef struct {\r
148 UINTN Signature;\r
149 LIST_ENTRY Link; // mDriverList\r
150\r
151 LIST_ENTRY ScheduledLink; // mScheduledQueue\r
152\r
153 EFI_HANDLE FvHandle;\r
154 EFI_GUID FileName;\r
155 EFI_DEVICE_PATH_PROTOCOL *FvFileDevicePath;\r
156 EFI_FIRMWARE_VOLUME2_PROTOCOL *Fv;\r
157\r
158 VOID *Depex;\r
159 UINTN DepexSize;\r
160\r
161 BOOLEAN Before;\r
162 BOOLEAN After;\r
163 EFI_GUID BeforeAfterGuid;\r
164\r
165 BOOLEAN Dependent;\r
166 BOOLEAN Unrequested;\r
167 BOOLEAN Scheduled;\r
168 BOOLEAN Untrusted;\r
169 BOOLEAN Initialized;\r
170 BOOLEAN DepexProtocolError;\r
171\r
172 EFI_HANDLE ImageHandle;\r
173 BOOLEAN IsFvImage;\r
174\r
175} EFI_CORE_DRIVER_ENTRY;\r
176\r
177//\r
178//The data structure of GCD memory map entry\r
179//\r
180#define EFI_GCD_MAP_SIGNATURE SIGNATURE_32('g','c','d','m')\r
181typedef struct {\r
182 UINTN Signature;\r
183 LIST_ENTRY Link;\r
184 EFI_PHYSICAL_ADDRESS BaseAddress;\r
185 UINT64 EndAddress;\r
186 UINT64 Capabilities;\r
187 UINT64 Attributes;\r
188 EFI_GCD_MEMORY_TYPE GcdMemoryType;\r
189 EFI_GCD_IO_TYPE GcdIoType;\r
190 EFI_HANDLE ImageHandle;\r
191 EFI_HANDLE DeviceHandle;\r
192} EFI_GCD_MAP_ENTRY;\r
193\r
194//\r
195// DXE Core Global Variables\r
196//\r
197extern EFI_SYSTEM_TABLE *gDxeCoreST;\r
198extern EFI_RUNTIME_SERVICES *gDxeCoreRT;\r
199extern EFI_DXE_SERVICES *gDxeCoreDS;\r
200extern EFI_HANDLE gDxeCoreImageHandle;\r
201\r
202extern EFI_DECOMPRESS_PROTOCOL gEfiDecompress;\r
203\r
204extern EFI_RUNTIME_ARCH_PROTOCOL *gRuntime;\r
205extern EFI_CPU_ARCH_PROTOCOL *gCpu;\r
206extern EFI_WATCHDOG_TIMER_ARCH_PROTOCOL *gWatchdogTimer;\r
207extern EFI_METRONOME_ARCH_PROTOCOL *gMetronome;\r
208extern EFI_TIMER_ARCH_PROTOCOL *gTimer;\r
209extern EFI_SECURITY_ARCH_PROTOCOL *gSecurity;\r
210extern EFI_SECURITY2_ARCH_PROTOCOL *gSecurity2;\r
211extern EFI_BDS_ARCH_PROTOCOL *gBds;\r
212extern EFI_SMM_BASE2_PROTOCOL *gSmmBase2;\r
213\r
214extern EFI_TPL gEfiCurrentTpl;\r
215\r
216extern EFI_GUID *gDxeCoreFileName;\r
217extern EFI_LOADED_IMAGE_PROTOCOL *gDxeCoreLoadedImage;\r
218\r
219extern EFI_MEMORY_TYPE_INFORMATION gMemoryTypeInformation[EfiMaxMemoryType + 1];\r
220\r
221extern BOOLEAN gDispatcherRunning;\r
222extern EFI_RUNTIME_ARCH_PROTOCOL gRuntimeTemplate;\r
223\r
224extern EFI_LOAD_FIXED_ADDRESS_CONFIGURATION_TABLE gLoadModuleAtFixAddressConfigurationTable;\r
225extern BOOLEAN gLoadFixedAddressCodeMemoryReady;\r
226//\r
227// Service Initialization Functions\r
228//\r
229\r
230\r
231\r
232/**\r
233 Called to initialize the pool.\r
234\r
235**/\r
236VOID\r
237CoreInitializePool (\r
238 VOID\r
239 );\r
240\r
241\r
242/**\r
243 Called to initialize the memory map and add descriptors to\r
244 the current descriptor list.\r
245 The first descriptor that is added must be general usable\r
246 memory as the addition allocates heap.\r
247\r
248 @param Type The type of memory to add\r
249 @param Start The starting address in the memory range Must be\r
250 page aligned\r
251 @param NumberOfPages The number of pages in the range\r
252 @param Attribute Attributes of the memory to add\r
253\r
254 @return None. The range is added to the memory map\r
255\r
256**/\r
257VOID\r
258CoreAddMemoryDescriptor (\r
259 IN EFI_MEMORY_TYPE Type,\r
260 IN EFI_PHYSICAL_ADDRESS Start,\r
261 IN UINT64 NumberOfPages,\r
262 IN UINT64 Attribute\r
263 );\r
264\r
265\r
266/**\r
267 Release memory lock on mGcdMemorySpaceLock.\r
268\r
269**/\r
270VOID\r
271CoreReleaseGcdMemoryLock (\r
272 VOID\r
273 );\r
274\r
275\r
276/**\r
277 Acquire memory lock on mGcdMemorySpaceLock.\r
278\r
279**/\r
280VOID\r
281CoreAcquireGcdMemoryLock (\r
282 VOID\r
283 );\r
284\r
285\r
286/**\r
287 External function. Initializes memory services based on the memory\r
288 descriptor HOBs. This function is responsible for priming the memory\r
289 map, so memory allocations and resource allocations can be made.\r
290 The first part of this function can not depend on any memory services\r
291 until at least one memory descriptor is provided to the memory services.\r
292\r
293 @param HobStart The start address of the HOB.\r
294 @param MemoryBaseAddress Start address of memory region found to init DXE\r
295 core.\r
296 @param MemoryLength Length of memory region found to init DXE core.\r
297\r
298 @retval EFI_SUCCESS Memory services successfully initialized.\r
299\r
300**/\r
301EFI_STATUS\r
302CoreInitializeMemoryServices (\r
303 IN VOID **HobStart,\r
304 OUT EFI_PHYSICAL_ADDRESS *MemoryBaseAddress,\r
305 OUT UINT64 *MemoryLength\r
306 );\r
307\r
308\r
309\r
310/**\r
311 External function. Initializes the GCD and memory services based on the memory\r
312 descriptor HOBs. This function is responsible for priming the GCD map and the\r
313 memory map, so memory allocations and resource allocations can be made. The\r
314 HobStart will be relocated to a pool buffer.\r
315\r
316 @param HobStart The start address of the HOB\r
317 @param MemoryBaseAddress Start address of memory region found to init DXE\r
318 core.\r
319 @param MemoryLength Length of memory region found to init DXE core.\r
320\r
321 @retval EFI_SUCCESS GCD services successfully initialized.\r
322\r
323**/\r
324EFI_STATUS\r
325CoreInitializeGcdServices (\r
326 IN OUT VOID **HobStart,\r
327 IN EFI_PHYSICAL_ADDRESS MemoryBaseAddress,\r
328 IN UINT64 MemoryLength\r
329 );\r
330\r
331\r
332/**\r
333 Initializes "event" support.\r
334\r
335 @retval EFI_SUCCESS Always return success\r
336\r
337**/\r
338EFI_STATUS\r
339CoreInitializeEventServices (\r
340 VOID\r
341 );\r
342\r
343\r
344/**\r
345 Add the Image Services to EFI Boot Services Table and install the protocol\r
346 interfaces for this image.\r
347\r
348 @param HobStart The HOB to initialize\r
349\r
350 @return Status code.\r
351\r
352**/\r
353EFI_STATUS\r
354CoreInitializeImageServices (\r
355 IN VOID *HobStart\r
356 );\r
357\r
358\r
359/**\r
360 Creates an event that is fired everytime a Protocol of a specific type is installed.\r
361\r
362**/\r
363VOID\r
364CoreNotifyOnProtocolInstallation (\r
365 VOID\r
366 );\r
367\r
368\r
369/**\r
370 Return TRUE if all AP services are availible.\r
371\r
372 @retval EFI_SUCCESS All AP services are available\r
373 @retval EFI_NOT_FOUND At least one AP service is not available\r
374\r
375**/\r
376EFI_STATUS\r
377CoreAllEfiServicesAvailable (\r
378 VOID\r
379 );\r
380\r
381\r
382/**\r
383 Calcualte the 32-bit CRC in a EFI table using the service provided by the\r
384 gRuntime service.\r
385\r
386 @param Hdr Pointer to an EFI standard header\r
387\r
388**/\r
389VOID\r
390CalculateEfiHdrCrc (\r
391 IN OUT EFI_TABLE_HEADER *Hdr\r
392 );\r
393\r
394\r
395/**\r
396 Called by the platform code to process a tick.\r
397\r
398 @param Duration The number of 100ns elasped since the last call\r
399 to TimerTick\r
400\r
401**/\r
402VOID\r
403EFIAPI\r
404CoreTimerTick (\r
405 IN UINT64 Duration\r
406 );\r
407\r
408\r
409/**\r
410 Initialize the dispatcher. Initialize the notification function that runs when\r
411 an FV2 protocol is added to the system.\r
412\r
413**/\r
414VOID\r
415CoreInitializeDispatcher (\r
416 VOID\r
417 );\r
418\r
419\r
420/**\r
421 This is the POSTFIX version of the dependency evaluator. This code does\r
422 not need to handle Before or After, as it is not valid to call this\r
423 routine in this case. The SOR is just ignored and is a nop in the grammer.\r
424 POSTFIX means all the math is done on top of the stack.\r
425\r
426 @param DriverEntry DriverEntry element to update.\r
427\r
428 @retval TRUE If driver is ready to run.\r
429 @retval FALSE If driver is not ready to run or some fatal error\r
430 was found.\r
431\r
432**/\r
433BOOLEAN\r
434CoreIsSchedulable (\r
435 IN EFI_CORE_DRIVER_ENTRY *DriverEntry\r
436 );\r
437\r
438\r
439/**\r
440 Preprocess dependency expression and update DriverEntry to reflect the\r
441 state of Before, After, and SOR dependencies. If DriverEntry->Before\r
442 or DriverEntry->After is set it will never be cleared. If SOR is set\r
443 it will be cleared by CoreSchedule(), and then the driver can be\r
444 dispatched.\r
445\r
446 @param DriverEntry DriverEntry element to update .\r
447\r
448 @retval EFI_SUCCESS It always works.\r
449\r
450**/\r
451EFI_STATUS\r
452CorePreProcessDepex (\r
453 IN EFI_CORE_DRIVER_ENTRY *DriverEntry\r
454 );\r
455\r
456\r
457\r
458/**\r
459 Terminates all boot services.\r
460\r
461 @param ImageHandle Handle that identifies the exiting image.\r
462 @param MapKey Key to the latest memory map.\r
463\r
464 @retval EFI_SUCCESS Boot Services terminated\r
465 @retval EFI_INVALID_PARAMETER MapKey is incorrect.\r
466\r
467**/\r
468EFI_STATUS\r
469EFIAPI\r
470CoreExitBootServices (\r
471 IN EFI_HANDLE ImageHandle,\r
472 IN UINTN MapKey\r
473 );\r
474\r
475\r
476/**\r
477 Make sure the memory map is following all the construction rules,\r
478 it is the last time to check memory map error before exit boot services.\r
479\r
480 @param MapKey Memory map key\r
481\r
482 @retval EFI_INVALID_PARAMETER Memory map not consistent with construction\r
483 rules.\r
484 @retval EFI_SUCCESS Valid memory map.\r
485\r
486**/\r
487EFI_STATUS\r
488CoreTerminateMemoryMap (\r
489 IN UINTN MapKey\r
490 );\r
491\r
492\r
493/**\r
494 Signals all events in the EventGroup.\r
495\r
496 @param EventGroup The list to signal\r
497\r
498**/\r
499VOID\r
500CoreNotifySignalList (\r
501 IN EFI_GUID *EventGroup\r
502 );\r
503\r
504\r
505\r
506/**\r
507 Boot Service called to add, modify, or remove a system configuration table from\r
508 the EFI System Table.\r
509\r
510 @param Guid Pointer to the GUID for the entry to add, update, or\r
511 remove\r
512 @param Table Pointer to the configuration table for the entry to add,\r
513 update, or remove, may be NULL.\r
514\r
515 @return EFI_SUCCESS Guid, Table pair added, updated, or removed.\r
516 @return EFI_INVALID_PARAMETER Input GUID not valid.\r
517 @return EFI_NOT_FOUND Attempted to delete non-existant entry\r
518 @return EFI_OUT_OF_RESOURCES Not enough memory available\r
519\r
520**/\r
521EFI_STATUS\r
522EFIAPI\r
523CoreInstallConfigurationTable (\r
524 IN EFI_GUID *Guid,\r
525 IN VOID *Table\r
526 );\r
527\r
528\r
529\r
530/**\r
531 Raise the task priority level to the new level.\r
532 High level is implemented by disabling processor interrupts.\r
533\r
534 @param NewTpl New task priority level\r
535\r
536 @return The previous task priority level\r
537\r
538**/\r
539EFI_TPL\r
540EFIAPI\r
541CoreRaiseTpl (\r
542 IN EFI_TPL NewTpl\r
543 );\r
544\r
545\r
546\r
547/**\r
548 Lowers the task priority to the previous value. If the new\r
549 priority unmasks events at a higher priority, they are dispatched.\r
550\r
551 @param NewTpl New, lower, task priority\r
552\r
553**/\r
554VOID\r
555EFIAPI\r
556CoreRestoreTpl (\r
557 IN EFI_TPL NewTpl\r
558 );\r
559\r
560\r
561\r
562/**\r
563 Introduces a fine-grained stall.\r
564\r
565 @param Microseconds The number of microseconds to stall execution.\r
566\r
567 @retval EFI_SUCCESS Execution was stalled for at least the requested\r
568 amount of microseconds.\r
569 @retval EFI_NOT_AVAILABLE_YET gMetronome is not available yet\r
570\r
571**/\r
572EFI_STATUS\r
573EFIAPI\r
574CoreStall (\r
575 IN UINTN Microseconds\r
576 );\r
577\r
578\r
579\r
580/**\r
581 Sets the system's watchdog timer.\r
582\r
583 @param Timeout The number of seconds to set the watchdog timer to.\r
584 A value of zero disables the timer.\r
585 @param WatchdogCode The numeric code to log on a watchdog timer timeout\r
586 event. The firmware reserves codes 0x0000 to 0xFFFF.\r
587 Loaders and operating systems may use other timeout\r
588 codes.\r
589 @param DataSize The size, in bytes, of WatchdogData.\r
590 @param WatchdogData A data buffer that includes a Null-terminated Unicode\r
591 string, optionally followed by additional binary data.\r
592 The string is a description that the call may use to\r
593 further indicate the reason to be logged with a\r
594 watchdog event.\r
595\r
596 @return EFI_SUCCESS Timeout has been set\r
597 @return EFI_NOT_AVAILABLE_YET WatchdogTimer is not available yet\r
598 @return EFI_UNSUPPORTED System does not have a timer (currently not used)\r
599 @return EFI_DEVICE_ERROR Could not complete due to hardware error\r
600\r
601**/\r
602EFI_STATUS\r
603EFIAPI\r
604CoreSetWatchdogTimer (\r
605 IN UINTN Timeout,\r
606 IN UINT64 WatchdogCode,\r
607 IN UINTN DataSize,\r
608 IN CHAR16 *WatchdogData OPTIONAL\r
609 );\r
610\r
611\r
612\r
613/**\r
614 Wrapper function to CoreInstallProtocolInterfaceNotify. This is the public API which\r
615 Calls the private one which contains a BOOLEAN parameter for notifications\r
616\r
617 @param UserHandle The handle to install the protocol handler on,\r
618 or NULL if a new handle is to be allocated\r
619 @param Protocol The protocol to add to the handle\r
620 @param InterfaceType Indicates whether Interface is supplied in\r
621 native form.\r
622 @param Interface The interface for the protocol being added\r
623\r
624 @return Status code\r
625\r
626**/\r
627EFI_STATUS\r
628EFIAPI\r
629CoreInstallProtocolInterface (\r
630 IN OUT EFI_HANDLE *UserHandle,\r
631 IN EFI_GUID *Protocol,\r
632 IN EFI_INTERFACE_TYPE InterfaceType,\r
633 IN VOID *Interface\r
634 );\r
635\r
636\r
637/**\r
638 Installs a protocol interface into the boot services environment.\r
639\r
640 @param UserHandle The handle to install the protocol handler on,\r
641 or NULL if a new handle is to be allocated\r
642 @param Protocol The protocol to add to the handle\r
643 @param InterfaceType Indicates whether Interface is supplied in\r
644 native form.\r
645 @param Interface The interface for the protocol being added\r
646 @param Notify indicates whether notify the notification list\r
647 for this protocol\r
648\r
649 @retval EFI_INVALID_PARAMETER Invalid parameter\r
650 @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate\r
651 @retval EFI_SUCCESS Protocol interface successfully installed\r
652\r
653**/\r
654EFI_STATUS\r
655CoreInstallProtocolInterfaceNotify (\r
656 IN OUT EFI_HANDLE *UserHandle,\r
657 IN EFI_GUID *Protocol,\r
658 IN EFI_INTERFACE_TYPE InterfaceType,\r
659 IN VOID *Interface,\r
660 IN BOOLEAN Notify\r
661 );\r
662\r
663\r
664\r
665/**\r
666 Installs a list of protocol interface into the boot services environment.\r
667 This function calls InstallProtocolInterface() in a loop. If any error\r
668 occures all the protocols added by this function are removed. This is\r
669 basically a lib function to save space.\r
670\r
671 @param Handle The handle to install the protocol handlers on,\r
672 or NULL if a new handle is to be allocated\r
673 @param ... EFI_GUID followed by protocol instance. A NULL\r
674 terminates the list. The pairs are the\r
675 arguments to InstallProtocolInterface(). All the\r
676 protocols are added to Handle.\r
677\r
678 @retval EFI_SUCCESS All the protocol interface was installed.\r
679 @retval EFI_OUT_OF_RESOURCES There was not enough memory in pool to install all the protocols.\r
680 @retval EFI_ALREADY_STARTED A Device Path Protocol instance was passed in that is already present in\r
681 the handle database.\r
682 @retval EFI_INVALID_PARAMETER Handle is NULL.\r
683 @retval EFI_INVALID_PARAMETER Protocol is already installed on the handle specified by Handle.\r
684\r
685**/\r
686EFI_STATUS\r
687EFIAPI\r
688CoreInstallMultipleProtocolInterfaces (\r
689 IN OUT EFI_HANDLE *Handle,\r
690 ...\r
691 );\r
692\r
693\r
694\r
695/**\r
696 Uninstalls a list of protocol interface in the boot services environment.\r
697 This function calls UnisatllProtocolInterface() in a loop. This is\r
698 basically a lib function to save space.\r
699\r
700 @param Handle The handle to uninstall the protocol\r
701 @param ... EFI_GUID followed by protocol instance. A NULL\r
702 terminates the list. The pairs are the\r
703 arguments to UninstallProtocolInterface(). All\r
704 the protocols are added to Handle.\r
705\r
706 @return Status code\r
707\r
708**/\r
709EFI_STATUS\r
710EFIAPI\r
711CoreUninstallMultipleProtocolInterfaces (\r
712 IN EFI_HANDLE Handle,\r
713 ...\r
714 );\r
715\r
716\r
717\r
718/**\r
719 Reinstall a protocol interface on a device handle. The OldInterface for Protocol is replaced by the NewInterface.\r
720\r
721 @param UserHandle Handle on which the interface is to be\r
722 reinstalled\r
723 @param Protocol The numeric ID of the interface\r
724 @param OldInterface A pointer to the old interface\r
725 @param NewInterface A pointer to the new interface\r
726\r
727 @retval EFI_SUCCESS The protocol interface was installed\r
728 @retval EFI_NOT_FOUND The OldInterface on the handle was not found\r
729 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value\r
730\r
731**/\r
732EFI_STATUS\r
733EFIAPI\r
734CoreReinstallProtocolInterface (\r
735 IN EFI_HANDLE UserHandle,\r
736 IN EFI_GUID *Protocol,\r
737 IN VOID *OldInterface,\r
738 IN VOID *NewInterface\r
739 );\r
740\r
741\r
742\r
743/**\r
744 Uninstalls all instances of a protocol:interfacer from a handle.\r
745 If the last protocol interface is remove from the handle, the\r
746 handle is freed.\r
747\r
748 @param UserHandle The handle to remove the protocol handler from\r
749 @param Protocol The protocol, of protocol:interface, to remove\r
750 @param Interface The interface, of protocol:interface, to remove\r
751\r
752 @retval EFI_INVALID_PARAMETER Protocol is NULL.\r
753 @retval EFI_SUCCESS Protocol interface successfully uninstalled.\r
754\r
755**/\r
756EFI_STATUS\r
757EFIAPI\r
758CoreUninstallProtocolInterface (\r
759 IN EFI_HANDLE UserHandle,\r
760 IN EFI_GUID *Protocol,\r
761 IN VOID *Interface\r
762 );\r
763\r
764\r
765\r
766/**\r
767 Queries a handle to determine if it supports a specified protocol.\r
768\r
769 @param UserHandle The handle being queried.\r
770 @param Protocol The published unique identifier of the protocol.\r
771 @param Interface Supplies the address where a pointer to the\r
772 corresponding Protocol Interface is returned.\r
773\r
774 @return The requested protocol interface for the handle\r
775\r
776**/\r
777EFI_STATUS\r
778EFIAPI\r
779CoreHandleProtocol (\r
780 IN EFI_HANDLE UserHandle,\r
781 IN EFI_GUID *Protocol,\r
782 OUT VOID **Interface\r
783 );\r
784\r
785\r
786\r
787/**\r
788 Locates the installed protocol handler for the handle, and\r
789 invokes it to obtain the protocol interface. Usage information\r
790 is registered in the protocol data base.\r
791\r
792 @param UserHandle The handle to obtain the protocol interface on\r
793 @param Protocol The ID of the protocol\r
794 @param Interface The location to return the protocol interface\r
795 @param ImageHandle The handle of the Image that is opening the\r
796 protocol interface specified by Protocol and\r
797 Interface.\r
798 @param ControllerHandle The controller handle that is requiring this\r
799 interface.\r
800 @param Attributes The open mode of the protocol interface\r
801 specified by Handle and Protocol.\r
802\r
803 @retval EFI_INVALID_PARAMETER Protocol is NULL.\r
804 @retval EFI_SUCCESS Get the protocol interface.\r
805\r
806**/\r
807EFI_STATUS\r
808EFIAPI\r
809CoreOpenProtocol (\r
810 IN EFI_HANDLE UserHandle,\r
811 IN EFI_GUID *Protocol,\r
812 OUT VOID **Interface OPTIONAL,\r
813 IN EFI_HANDLE ImageHandle,\r
814 IN EFI_HANDLE ControllerHandle,\r
815 IN UINT32 Attributes\r
816 );\r
817\r
818\r
819\r
820/**\r
821 Return information about Opened protocols in the system\r
822\r
823 @param UserHandle The handle to close the protocol interface on\r
824 @param Protocol The ID of the protocol\r
825 @param EntryBuffer A pointer to a buffer of open protocol\r
826 information in the form of\r
827 EFI_OPEN_PROTOCOL_INFORMATION_ENTRY structures.\r
828 @param EntryCount Number of EntryBuffer entries\r
829\r
830**/\r
831EFI_STATUS\r
832EFIAPI\r
833CoreOpenProtocolInformation (\r
834 IN EFI_HANDLE UserHandle,\r
835 IN EFI_GUID *Protocol,\r
836 OUT EFI_OPEN_PROTOCOL_INFORMATION_ENTRY **EntryBuffer,\r
837 OUT UINTN *EntryCount\r
838 );\r
839\r
840\r
841\r
842/**\r
843 Closes a protocol on a handle that was opened using OpenProtocol().\r
844\r
845 @param UserHandle The handle for the protocol interface that was\r
846 previously opened with OpenProtocol(), and is\r
847 now being closed.\r
848 @param Protocol The published unique identifier of the protocol.\r
849 It is the caller's responsibility to pass in a\r
850 valid GUID.\r
851 @param AgentHandle The handle of the agent that is closing the\r
852 protocol interface.\r
853 @param ControllerHandle If the agent that opened a protocol is a driver\r
854 that follows the EFI Driver Model, then this\r
855 parameter is the controller handle that required\r
856 the protocol interface. If the agent does not\r
857 follow the EFI Driver Model, then this parameter\r
858 is optional and may be NULL.\r
859\r
860 @retval EFI_SUCCESS The protocol instance was closed.\r
861 @retval EFI_INVALID_PARAMETER Handle, AgentHandle or ControllerHandle is not a\r
862 valid EFI_HANDLE.\r
863 @retval EFI_NOT_FOUND Can not find the specified protocol or\r
864 AgentHandle.\r
865\r
866**/\r
867EFI_STATUS\r
868EFIAPI\r
869CoreCloseProtocol (\r
870 IN EFI_HANDLE UserHandle,\r
871 IN EFI_GUID *Protocol,\r
872 IN EFI_HANDLE AgentHandle,\r
873 IN EFI_HANDLE ControllerHandle\r
874 );\r
875\r
876\r
877\r
878/**\r
879 Retrieves the list of protocol interface GUIDs that are installed on a handle in a buffer allocated\r
880 from pool.\r
881\r
882 @param UserHandle The handle from which to retrieve the list of\r
883 protocol interface GUIDs.\r
884 @param ProtocolBuffer A pointer to the list of protocol interface GUID\r
885 pointers that are installed on Handle.\r
886 @param ProtocolBufferCount A pointer to the number of GUID pointers present\r
887 in ProtocolBuffer.\r
888\r
889 @retval EFI_SUCCESS The list of protocol interface GUIDs installed\r
890 on Handle was returned in ProtocolBuffer. The\r
891 number of protocol interface GUIDs was returned\r
892 in ProtocolBufferCount.\r
893 @retval EFI_INVALID_PARAMETER Handle is NULL.\r
894 @retval EFI_INVALID_PARAMETER Handle is not a valid EFI_HANDLE.\r
895 @retval EFI_INVALID_PARAMETER ProtocolBuffer is NULL.\r
896 @retval EFI_INVALID_PARAMETER ProtocolBufferCount is NULL.\r
897 @retval EFI_OUT_OF_RESOURCES There is not enough pool memory to store the\r
898 results.\r
899\r
900**/\r
901EFI_STATUS\r
902EFIAPI\r
903CoreProtocolsPerHandle (\r
904 IN EFI_HANDLE UserHandle,\r
905 OUT EFI_GUID ***ProtocolBuffer,\r
906 OUT UINTN *ProtocolBufferCount\r
907 );\r
908\r
909\r
910\r
911/**\r
912 Add a new protocol notification record for the request protocol.\r
913\r
914 @param Protocol The requested protocol to add the notify\r
915 registration\r
916 @param Event The event to signal\r
917 @param Registration Returns the registration record\r
918\r
919 @retval EFI_INVALID_PARAMETER Invalid parameter\r
920 @retval EFI_SUCCESS Successfully returned the registration record\r
921 that has been added\r
922\r
923**/\r
924EFI_STATUS\r
925EFIAPI\r
926CoreRegisterProtocolNotify (\r
927 IN EFI_GUID *Protocol,\r
928 IN EFI_EVENT Event,\r
929 OUT VOID **Registration\r
930 );\r
931\r
932\r
933/**\r
934 Removes all the events in the protocol database that match Event.\r
935\r
936 @param Event The event to search for in the protocol\r
937 database.\r
938\r
939 @return EFI_SUCCESS when done searching the entire database.\r
940\r
941**/\r
942EFI_STATUS\r
943CoreUnregisterProtocolNotify (\r
944 IN EFI_EVENT Event\r
945 );\r
946\r
947\r
948/**\r
949 Locates the requested handle(s) and returns them in Buffer.\r
950\r
951 @param SearchType The type of search to perform to locate the\r
952 handles\r
953 @param Protocol The protocol to search for\r
954 @param SearchKey Dependant on SearchType\r
955 @param BufferSize On input the size of Buffer. On output the\r
956 size of data returned.\r
957 @param Buffer The buffer to return the results in\r
958\r
959 @retval EFI_BUFFER_TOO_SMALL Buffer too small, required buffer size is\r
960 returned in BufferSize.\r
961 @retval EFI_INVALID_PARAMETER Invalid parameter\r
962 @retval EFI_SUCCESS Successfully found the requested handle(s) and\r
963 returns them in Buffer.\r
964\r
965**/\r
966EFI_STATUS\r
967EFIAPI\r
968CoreLocateHandle (\r
969 IN EFI_LOCATE_SEARCH_TYPE SearchType,\r
970 IN EFI_GUID *Protocol OPTIONAL,\r
971 IN VOID *SearchKey OPTIONAL,\r
972 IN OUT UINTN *BufferSize,\r
973 OUT EFI_HANDLE *Buffer\r
974 );\r
975\r
976\r
977\r
978/**\r
979 Locates the handle to a device on the device path that best matches the specified protocol.\r
980\r
981 @param Protocol The protocol to search for.\r
982 @param DevicePath On input, a pointer to a pointer to the device\r
983 path. On output, the device path pointer is\r
984 modified to point to the remaining part of the\r
985 devicepath.\r
986 @param Device A pointer to the returned device handle.\r
987\r
988 @retval EFI_SUCCESS The resulting handle was returned.\r
989 @retval EFI_NOT_FOUND No handles matched the search.\r
990 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.\r
991\r
992**/\r
993EFI_STATUS\r
994EFIAPI\r
995CoreLocateDevicePath (\r
996 IN EFI_GUID *Protocol,\r
997 IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath,\r
998 OUT EFI_HANDLE *Device\r
999 );\r
1000\r
1001\r
1002\r
1003/**\r
1004 Function returns an array of handles that support the requested protocol\r
1005 in a buffer allocated from pool. This is a version of CoreLocateHandle()\r
1006 that allocates a buffer for the caller.\r
1007\r
1008 @param SearchType Specifies which handle(s) are to be returned.\r
1009 @param Protocol Provides the protocol to search by. This\r
1010 parameter is only valid for SearchType\r
1011 ByProtocol.\r
1012 @param SearchKey Supplies the search key depending on the\r
1013 SearchType.\r
1014 @param NumberHandles The number of handles returned in Buffer.\r
1015 @param Buffer A pointer to the buffer to return the requested\r
1016 array of handles that support Protocol.\r
1017\r
1018 @retval EFI_SUCCESS The result array of handles was returned.\r
1019 @retval EFI_NOT_FOUND No handles match the search.\r
1020 @retval EFI_OUT_OF_RESOURCES There is not enough pool memory to store the\r
1021 matching results.\r
1022 @retval EFI_INVALID_PARAMETER One or more paramters are not valid.\r
1023\r
1024**/\r
1025EFI_STATUS\r
1026EFIAPI\r
1027CoreLocateHandleBuffer (\r
1028 IN EFI_LOCATE_SEARCH_TYPE SearchType,\r
1029 IN EFI_GUID *Protocol OPTIONAL,\r
1030 IN VOID *SearchKey OPTIONAL,\r
1031 IN OUT UINTN *NumberHandles,\r
1032 OUT EFI_HANDLE **Buffer\r
1033 );\r
1034\r
1035\r
1036\r
1037/**\r
1038 Return the first Protocol Interface that matches the Protocol GUID. If\r
1039 Registration is passed in, return a Protocol Instance that was just add\r
1040 to the system. If Registration is NULL return the first Protocol Interface\r
1041 you find.\r
1042\r
1043 @param Protocol The protocol to search for\r
1044 @param Registration Optional Registration Key returned from\r
1045 RegisterProtocolNotify()\r
1046 @param Interface Return the Protocol interface (instance).\r
1047\r
1048 @retval EFI_SUCCESS If a valid Interface is returned\r
1049 @retval EFI_INVALID_PARAMETER Invalid parameter\r
1050 @retval EFI_NOT_FOUND Protocol interface not found\r
1051\r
1052**/\r
1053EFI_STATUS\r
1054EFIAPI\r
1055CoreLocateProtocol (\r
1056 IN EFI_GUID *Protocol,\r
1057 IN VOID *Registration OPTIONAL,\r
1058 OUT VOID **Interface\r
1059 );\r
1060\r
1061\r
1062/**\r
1063 return handle database key.\r
1064\r
1065\r
1066 @return Handle database key.\r
1067\r
1068**/\r
1069UINT64\r
1070CoreGetHandleDatabaseKey (\r
1071 VOID\r
1072 );\r
1073\r
1074\r
1075/**\r
1076 Go connect any handles that were created or modified while a image executed.\r
1077\r
1078 @param Key The Key to show that the handle has been\r
1079 created/modified\r
1080\r
1081**/\r
1082VOID\r
1083CoreConnectHandlesByKey (\r
1084 UINT64 Key\r
1085 );\r
1086\r
1087\r
1088\r
1089/**\r
1090 Connects one or more drivers to a controller.\r
1091\r
1092 @param ControllerHandle The handle of the controller to which driver(s) are to be connected.\r
1093 @param DriverImageHandle A pointer to an ordered list handles that support the\r
1094 EFI_DRIVER_BINDING_PROTOCOL.\r
1095 @param RemainingDevicePath A pointer to the device path that specifies a child of the\r
1096 controller specified by ControllerHandle.\r
1097 @param Recursive If TRUE, then ConnectController() is called recursively\r
1098 until the entire tree of controllers below the controller specified\r
1099 by ControllerHandle have been created. If FALSE, then\r
1100 the tree of controllers is only expanded one level.\r
1101\r
1102 @retval EFI_SUCCESS 1) One or more drivers were connected to ControllerHandle.\r
1103 2) No drivers were connected to ControllerHandle, but\r
1104 RemainingDevicePath is not NULL, and it is an End Device\r
1105 Path Node.\r
1106 @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.\r
1107 @retval EFI_NOT_FOUND 1) There are no EFI_DRIVER_BINDING_PROTOCOL instances\r
1108 present in the system.\r
1109 2) No drivers were connected to ControllerHandle.\r
1110 @retval EFI_SECURITY_VIOLATION \r
1111 The user has no permission to start UEFI device drivers on the device path \r
1112 associated with the ControllerHandle or specified by the RemainingDevicePath.\r
1113\r
1114**/\r
1115EFI_STATUS\r
1116EFIAPI\r
1117CoreConnectController (\r
1118 IN EFI_HANDLE ControllerHandle,\r
1119 IN EFI_HANDLE *DriverImageHandle OPTIONAL,\r
1120 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL,\r
1121 IN BOOLEAN Recursive\r
1122 );\r
1123\r
1124\r
1125\r
1126/**\r
1127 Disonnects a controller from a driver\r
1128\r
1129 @param ControllerHandle ControllerHandle The handle of\r
1130 the controller from which\r
1131 driver(s) are to be\r
1132 disconnected.\r
1133 @param DriverImageHandle DriverImageHandle The driver to\r
1134 disconnect from ControllerHandle.\r
1135 @param ChildHandle ChildHandle The handle of the\r
1136 child to destroy.\r
1137\r
1138 @retval EFI_SUCCESS One or more drivers were\r
1139 disconnected from the controller.\r
1140 @retval EFI_SUCCESS On entry, no drivers are managing\r
1141 ControllerHandle.\r
1142 @retval EFI_SUCCESS DriverImageHandle is not NULL,\r
1143 and on entry DriverImageHandle is\r
1144 not managing ControllerHandle.\r
1145 @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.\r
1146 @retval EFI_INVALID_PARAMETER DriverImageHandle is not NULL,\r
1147 and it is not a valid EFI_HANDLE.\r
1148 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL, and it\r
1149 is not a valid EFI_HANDLE.\r
1150 @retval EFI_OUT_OF_RESOURCES There are not enough resources\r
1151 available to disconnect any\r
1152 drivers from ControllerHandle.\r
1153 @retval EFI_DEVICE_ERROR The controller could not be\r
1154 disconnected because of a device\r
1155 error.\r
1156\r
1157**/\r
1158EFI_STATUS\r
1159EFIAPI\r
1160CoreDisconnectController (\r
1161 IN EFI_HANDLE ControllerHandle,\r
1162 IN EFI_HANDLE DriverImageHandle OPTIONAL,\r
1163 IN EFI_HANDLE ChildHandle OPTIONAL\r
1164 );\r
1165\r
1166\r
1167\r
1168/**\r
1169 Allocates pages from the memory map.\r
1170\r
1171 @param Type The type of allocation to perform\r
1172 @param MemoryType The type of memory to turn the allocated pages\r
1173 into\r
1174 @param NumberOfPages The number of pages to allocate\r
1175 @param Memory A pointer to receive the base allocated memory\r
1176 address\r
1177\r
1178 @return Status. On success, Memory is filled in with the base address allocated\r
1179 @retval EFI_INVALID_PARAMETER Parameters violate checking rules defined in\r
1180 spec.\r
1181 @retval EFI_NOT_FOUND Could not allocate pages match the requirement.\r
1182 @retval EFI_OUT_OF_RESOURCES No enough pages to allocate.\r
1183 @retval EFI_SUCCESS Pages successfully allocated.\r
1184\r
1185**/\r
1186EFI_STATUS\r
1187EFIAPI\r
1188CoreAllocatePages (\r
1189 IN EFI_ALLOCATE_TYPE Type,\r
1190 IN EFI_MEMORY_TYPE MemoryType,\r
1191 IN UINTN NumberOfPages,\r
1192 IN OUT EFI_PHYSICAL_ADDRESS *Memory\r
1193 );\r
1194\r
1195\r
1196\r
1197/**\r
1198 Frees previous allocated pages.\r
1199\r
1200 @param Memory Base address of memory being freed\r
1201 @param NumberOfPages The number of pages to free\r
1202\r
1203 @retval EFI_NOT_FOUND Could not find the entry that covers the range\r
1204 @retval EFI_INVALID_PARAMETER Address not aligned\r
1205 @return EFI_SUCCESS -Pages successfully freed.\r
1206\r
1207**/\r
1208EFI_STATUS\r
1209EFIAPI\r
1210CoreFreePages (\r
1211 IN EFI_PHYSICAL_ADDRESS Memory,\r
1212 IN UINTN NumberOfPages\r
1213 );\r
1214\r
1215\r
1216\r
1217/**\r
1218 This function returns a copy of the current memory map. The map is an array of\r
1219 memory descriptors, each of which describes a contiguous block of memory.\r
1220\r
1221 @param MemoryMapSize A pointer to the size, in bytes, of the\r
1222 MemoryMap buffer. On input, this is the size of\r
1223 the buffer allocated by the caller. On output,\r
1224 it is the size of the buffer returned by the\r
1225 firmware if the buffer was large enough, or the\r
1226 size of the buffer needed to contain the map if\r
1227 the buffer was too small.\r
1228 @param MemoryMap A pointer to the buffer in which firmware places\r
1229 the current memory map.\r
1230 @param MapKey A pointer to the location in which firmware\r
1231 returns the key for the current memory map.\r
1232 @param DescriptorSize A pointer to the location in which firmware\r
1233 returns the size, in bytes, of an individual\r
1234 EFI_MEMORY_DESCRIPTOR.\r
1235 @param DescriptorVersion A pointer to the location in which firmware\r
1236 returns the version number associated with the\r
1237 EFI_MEMORY_DESCRIPTOR.\r
1238\r
1239 @retval EFI_SUCCESS The memory map was returned in the MemoryMap\r
1240 buffer.\r
1241 @retval EFI_BUFFER_TOO_SMALL The MemoryMap buffer was too small. The current\r
1242 buffer size needed to hold the memory map is\r
1243 returned in MemoryMapSize.\r
1244 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.\r
1245\r
1246**/\r
1247EFI_STATUS\r
1248EFIAPI\r
1249CoreGetMemoryMap (\r
1250 IN OUT UINTN *MemoryMapSize,\r
1251 IN OUT EFI_MEMORY_DESCRIPTOR *MemoryMap,\r
1252 OUT UINTN *MapKey,\r
1253 OUT UINTN *DescriptorSize,\r
1254 OUT UINT32 *DescriptorVersion\r
1255 );\r
1256\r
1257\r
1258\r
1259/**\r
1260 Allocate pool of a particular type.\r
1261\r
1262 @param PoolType Type of pool to allocate\r
1263 @param Size The amount of pool to allocate\r
1264 @param Buffer The address to return a pointer to the allocated\r
1265 pool\r
1266\r
1267 @retval EFI_INVALID_PARAMETER PoolType not valid or Buffer is NULL\r
1268 @retval EFI_OUT_OF_RESOURCES Size exceeds max pool size or allocation failed.\r
1269 @retval EFI_SUCCESS Pool successfully allocated.\r
1270\r
1271**/\r
1272EFI_STATUS\r
1273EFIAPI\r
1274CoreAllocatePool (\r
1275 IN EFI_MEMORY_TYPE PoolType,\r
1276 IN UINTN Size,\r
1277 OUT VOID **Buffer\r
1278 );\r
1279\r
1280\r
1281\r
1282/**\r
1283 Frees pool.\r
1284\r
1285 @param Buffer The allocated pool entry to free\r
1286\r
1287 @retval EFI_INVALID_PARAMETER Buffer is not a valid value.\r
1288 @retval EFI_SUCCESS Pool successfully freed.\r
1289\r
1290**/\r
1291EFI_STATUS\r
1292EFIAPI\r
1293CoreFreePool (\r
1294 IN VOID *Buffer\r
1295 );\r
1296\r
1297\r
1298\r
1299/**\r
1300 Loads an EFI image into memory and returns a handle to the image.\r
1301\r
1302 @param BootPolicy If TRUE, indicates that the request originates\r
1303 from the boot manager, and that the boot\r
1304 manager is attempting to load FilePath as a\r
1305 boot selection.\r
1306 @param ParentImageHandle The caller's image handle.\r
1307 @param FilePath The specific file path from which the image is\r
1308 loaded.\r
1309 @param SourceBuffer If not NULL, a pointer to the memory location\r
1310 containing a copy of the image to be loaded.\r
1311 @param SourceSize The size in bytes of SourceBuffer.\r
1312 @param ImageHandle Pointer to the returned image handle that is\r
1313 created when the image is successfully loaded.\r
1314\r
1315 @retval EFI_SUCCESS The image was loaded into memory.\r
1316 @retval EFI_NOT_FOUND The FilePath was not found.\r
1317 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.\r
1318 @retval EFI_UNSUPPORTED The image type is not supported, or the device\r
1319 path cannot be parsed to locate the proper\r
1320 protocol for loading the file.\r
1321 @retval EFI_OUT_OF_RESOURCES Image was not loaded due to insufficient\r
1322 resources.\r
1323 @retval EFI_LOAD_ERROR Image was not loaded because the image format was corrupt or not\r
1324 understood.\r
1325 @retval EFI_DEVICE_ERROR Image was not loaded because the device returned a read error.\r
1326 @retval EFI_ACCESS_DENIED Image was not loaded because the platform policy prohibits the \r
1327 image from being loaded. NULL is returned in *ImageHandle.\r
1328 @retval EFI_SECURITY_VIOLATION Image was loaded and an ImageHandle was created with a \r
1329 valid EFI_LOADED_IMAGE_PROTOCOL. However, the current \r
1330 platform policy specifies that the image should not be started.\r
1331\r
1332**/\r
1333EFI_STATUS\r
1334EFIAPI\r
1335CoreLoadImage (\r
1336 IN BOOLEAN BootPolicy,\r
1337 IN EFI_HANDLE ParentImageHandle,\r
1338 IN EFI_DEVICE_PATH_PROTOCOL *FilePath,\r
1339 IN VOID *SourceBuffer OPTIONAL,\r
1340 IN UINTN SourceSize,\r
1341 OUT EFI_HANDLE *ImageHandle\r
1342 );\r
1343\r
1344\r
1345\r
1346/**\r
1347 Unloads an image.\r
1348\r
1349 @param ImageHandle Handle that identifies the image to be\r
1350 unloaded.\r
1351\r
1352 @retval EFI_SUCCESS The image has been unloaded.\r
1353 @retval EFI_UNSUPPORTED The image has been sarted, and does not support\r
1354 unload.\r
1355 @retval EFI_INVALID_PARAMPETER ImageHandle is not a valid image handle.\r
1356\r
1357**/\r
1358EFI_STATUS\r
1359EFIAPI\r
1360CoreUnloadImage (\r
1361 IN EFI_HANDLE ImageHandle\r
1362 );\r
1363\r
1364\r
1365\r
1366/**\r
1367 Transfer control to a loaded image's entry point.\r
1368\r
1369 @param ImageHandle Handle of image to be started.\r
1370 @param ExitDataSize Pointer of the size to ExitData\r
1371 @param ExitData Pointer to a pointer to a data buffer that\r
1372 includes a Null-terminated string,\r
1373 optionally followed by additional binary data.\r
1374 The string is a description that the caller may\r
1375 use to further indicate the reason for the\r
1376 image's exit.\r
1377\r
1378 @retval EFI_INVALID_PARAMETER Invalid parameter\r
1379 @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate\r
1380 @retval EFI_SECURITY_VIOLATION The current platform policy specifies that the image should not be started.\r
1381 @retval EFI_SUCCESS Successfully transfer control to the image's\r
1382 entry point.\r
1383\r
1384**/\r
1385EFI_STATUS\r
1386EFIAPI\r
1387CoreStartImage (\r
1388 IN EFI_HANDLE ImageHandle,\r
1389 OUT UINTN *ExitDataSize,\r
1390 OUT CHAR16 **ExitData OPTIONAL\r
1391 );\r
1392\r
1393\r
1394\r
1395/**\r
1396 Terminates the currently loaded EFI image and returns control to boot services.\r
1397\r
1398 @param ImageHandle Handle that identifies the image. This\r
1399 parameter is passed to the image on entry.\r
1400 @param Status The image's exit code.\r
1401 @param ExitDataSize The size, in bytes, of ExitData. Ignored if\r
1402 ExitStatus is EFI_SUCCESS.\r
1403 @param ExitData Pointer to a data buffer that includes a\r
1404 Null-terminated Unicode string, optionally\r
1405 followed by additional binary data. The string\r
1406 is a description that the caller may use to\r
1407 further indicate the reason for the image's\r
1408 exit.\r
1409\r
1410 @retval EFI_INVALID_PARAMETER Image handle is NULL or it is not current\r
1411 image.\r
1412 @retval EFI_SUCCESS Successfully terminates the currently loaded\r
1413 EFI image.\r
1414 @retval EFI_ACCESS_DENIED Should never reach there.\r
1415 @retval EFI_OUT_OF_RESOURCES Could not allocate pool\r
1416\r
1417**/\r
1418EFI_STATUS\r
1419EFIAPI\r
1420CoreExit (\r
1421 IN EFI_HANDLE ImageHandle,\r
1422 IN EFI_STATUS Status,\r
1423 IN UINTN ExitDataSize,\r
1424 IN CHAR16 *ExitData OPTIONAL\r
1425 );\r
1426\r
1427\r
1428\r
1429/**\r
1430 Creates an event.\r
1431\r
1432 @param Type The type of event to create and its mode and\r
1433 attributes\r
1434 @param NotifyTpl The task priority level of event notifications\r
1435 @param NotifyFunction Pointer to the events notification function\r
1436 @param NotifyContext Pointer to the notification functions context;\r
1437 corresponds to parameter "Context" in the\r
1438 notification function\r
1439 @param Event Pointer to the newly created event if the call\r
1440 succeeds; undefined otherwise\r
1441\r
1442 @retval EFI_SUCCESS The event structure was created\r
1443 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value\r
1444 @retval EFI_OUT_OF_RESOURCES The event could not be allocated\r
1445\r
1446**/\r
1447EFI_STATUS\r
1448EFIAPI\r
1449CoreCreateEvent (\r
1450 IN UINT32 Type,\r
1451 IN EFI_TPL NotifyTpl,\r
1452 IN EFI_EVENT_NOTIFY NotifyFunction, OPTIONAL\r
1453 IN VOID *NotifyContext, OPTIONAL\r
1454 OUT EFI_EVENT *Event\r
1455 );\r
1456\r
1457\r
1458\r
1459/**\r
1460 Creates an event in a group.\r
1461\r
1462 @param Type The type of event to create and its mode and\r
1463 attributes\r
1464 @param NotifyTpl The task priority level of event notifications\r
1465 @param NotifyFunction Pointer to the events notification function\r
1466 @param NotifyContext Pointer to the notification functions context;\r
1467 corresponds to parameter "Context" in the\r
1468 notification function\r
1469 @param EventGroup GUID for EventGroup if NULL act the same as\r
1470 gBS->CreateEvent().\r
1471 @param Event Pointer to the newly created event if the call\r
1472 succeeds; undefined otherwise\r
1473\r
1474 @retval EFI_SUCCESS The event structure was created\r
1475 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value\r
1476 @retval EFI_OUT_OF_RESOURCES The event could not be allocated\r
1477\r
1478**/\r
1479EFI_STATUS\r
1480EFIAPI\r
1481CoreCreateEventEx (\r
1482 IN UINT32 Type,\r
1483 IN EFI_TPL NotifyTpl,\r
1484 IN EFI_EVENT_NOTIFY NotifyFunction, OPTIONAL\r
1485 IN CONST VOID *NotifyContext, OPTIONAL\r
1486 IN CONST EFI_GUID *EventGroup, OPTIONAL\r
1487 OUT EFI_EVENT *Event\r
1488 );\r
1489\r
1490/**\r
1491 Creates a general-purpose event structure\r
1492\r
1493 @param Type The type of event to create and its mode and\r
1494 attributes\r
1495 @param NotifyTpl The task priority level of event notifications\r
1496 @param NotifyFunction Pointer to the events notification function\r
1497 @param NotifyContext Pointer to the notification functions context;\r
1498 corresponds to parameter "Context" in the\r
1499 notification function\r
1500 @param EventGroup GUID for EventGroup if NULL act the same as\r
1501 gBS->CreateEvent().\r
1502 @param Event Pointer to the newly created event if the call\r
1503 succeeds; undefined otherwise\r
1504\r
1505 @retval EFI_SUCCESS The event structure was created\r
1506 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value\r
1507 @retval EFI_OUT_OF_RESOURCES The event could not be allocated\r
1508\r
1509**/\r
1510EFI_STATUS\r
1511EFIAPI\r
1512CoreCreateEventInternal (\r
1513 IN UINT32 Type,\r
1514 IN EFI_TPL NotifyTpl,\r
1515 IN EFI_EVENT_NOTIFY NotifyFunction, OPTIONAL\r
1516 IN CONST VOID *NotifyContext, OPTIONAL\r
1517 IN CONST EFI_GUID *EventGroup, OPTIONAL\r
1518 OUT EFI_EVENT *Event\r
1519 );\r
1520\r
1521/**\r
1522 Sets the type of timer and the trigger time for a timer event.\r
1523\r
1524 @param UserEvent The timer event that is to be signaled at the\r
1525 specified time\r
1526 @param Type The type of time that is specified in\r
1527 TriggerTime\r
1528 @param TriggerTime The number of 100ns units until the timer\r
1529 expires\r
1530\r
1531 @retval EFI_SUCCESS The event has been set to be signaled at the\r
1532 requested time\r
1533 @retval EFI_INVALID_PARAMETER Event or Type is not valid\r
1534\r
1535**/\r
1536EFI_STATUS\r
1537EFIAPI\r
1538CoreSetTimer (\r
1539 IN EFI_EVENT UserEvent,\r
1540 IN EFI_TIMER_DELAY Type,\r
1541 IN UINT64 TriggerTime\r
1542 );\r
1543\r
1544\r
1545\r
1546/**\r
1547 Signals the event. Queues the event to be notified if needed.\r
1548\r
1549 @param UserEvent The event to signal .\r
1550\r
1551 @retval EFI_INVALID_PARAMETER Parameters are not valid.\r
1552 @retval EFI_SUCCESS The event was signaled.\r
1553\r
1554**/\r
1555EFI_STATUS\r
1556EFIAPI\r
1557CoreSignalEvent (\r
1558 IN EFI_EVENT UserEvent\r
1559 );\r
1560\r
1561\r
1562\r
1563/**\r
1564 Stops execution until an event is signaled.\r
1565\r
1566 @param NumberOfEvents The number of events in the UserEvents array\r
1567 @param UserEvents An array of EFI_EVENT\r
1568 @param UserIndex Pointer to the index of the event which\r
1569 satisfied the wait condition\r
1570\r
1571 @retval EFI_SUCCESS The event indicated by Index was signaled.\r
1572 @retval EFI_INVALID_PARAMETER The event indicated by Index has a notification\r
1573 function or Event was not a valid type\r
1574 @retval EFI_UNSUPPORTED The current TPL is not TPL_APPLICATION\r
1575\r
1576**/\r
1577EFI_STATUS\r
1578EFIAPI\r
1579CoreWaitForEvent (\r
1580 IN UINTN NumberOfEvents,\r
1581 IN EFI_EVENT *UserEvents,\r
1582 OUT UINTN *UserIndex\r
1583 );\r
1584\r
1585\r
1586\r
1587/**\r
1588 Closes an event and frees the event structure.\r
1589\r
1590 @param UserEvent Event to close\r
1591\r
1592 @retval EFI_INVALID_PARAMETER Parameters are not valid.\r
1593 @retval EFI_SUCCESS The event has been closed\r
1594\r
1595**/\r
1596EFI_STATUS\r
1597EFIAPI\r
1598CoreCloseEvent (\r
1599 IN EFI_EVENT UserEvent\r
1600 );\r
1601\r
1602\r
1603\r
1604/**\r
1605 Check the status of an event.\r
1606\r
1607 @param UserEvent The event to check\r
1608\r
1609 @retval EFI_SUCCESS The event is in the signaled state\r
1610 @retval EFI_NOT_READY The event is not in the signaled state\r
1611 @retval EFI_INVALID_PARAMETER Event is of type EVT_NOTIFY_SIGNAL\r
1612\r
1613**/\r
1614EFI_STATUS\r
1615EFIAPI\r
1616CoreCheckEvent (\r
1617 IN EFI_EVENT UserEvent\r
1618 );\r
1619\r
1620\r
1621/**\r
1622 Adds reserved memory, system memory, or memory-mapped I/O resources to the\r
1623 global coherency domain of the processor.\r
1624\r
1625 @param GcdMemoryType Memory type of the memory space.\r
1626 @param BaseAddress Base address of the memory space.\r
1627 @param Length Length of the memory space.\r
1628 @param Capabilities alterable attributes of the memory space.\r
1629\r
1630 @retval EFI_SUCCESS Merged this memory space into GCD map.\r
1631\r
1632**/\r
1633EFI_STATUS\r
1634EFIAPI\r
1635CoreAddMemorySpace (\r
1636 IN EFI_GCD_MEMORY_TYPE GcdMemoryType,\r
1637 IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
1638 IN UINT64 Length,\r
1639 IN UINT64 Capabilities\r
1640 );\r
1641\r
1642\r
1643/**\r
1644 Allocates nonexistent memory, reserved memory, system memory, or memorymapped\r
1645 I/O resources from the global coherency domain of the processor.\r
1646\r
1647 @param GcdAllocateType The type of allocate operation\r
1648 @param GcdMemoryType The desired memory type\r
1649 @param Alignment Align with 2^Alignment\r
1650 @param Length Length to allocate\r
1651 @param BaseAddress Base address to allocate\r
1652 @param ImageHandle The image handle consume the allocated space.\r
1653 @param DeviceHandle The device handle consume the allocated space.\r
1654\r
1655 @retval EFI_INVALID_PARAMETER Invalid parameter.\r
1656 @retval EFI_NOT_FOUND No descriptor contains the desired space.\r
1657 @retval EFI_SUCCESS Memory space successfully allocated.\r
1658\r
1659**/\r
1660EFI_STATUS\r
1661EFIAPI\r
1662CoreAllocateMemorySpace (\r
1663 IN EFI_GCD_ALLOCATE_TYPE GcdAllocateType,\r
1664 IN EFI_GCD_MEMORY_TYPE GcdMemoryType,\r
1665 IN UINTN Alignment,\r
1666 IN UINT64 Length,\r
1667 IN OUT EFI_PHYSICAL_ADDRESS *BaseAddress,\r
1668 IN EFI_HANDLE ImageHandle,\r
1669 IN EFI_HANDLE DeviceHandle OPTIONAL\r
1670 );\r
1671\r
1672\r
1673/**\r
1674 Frees nonexistent memory, reserved memory, system memory, or memory-mapped\r
1675 I/O resources from the global coherency domain of the processor.\r
1676\r
1677 @param BaseAddress Base address of the memory space.\r
1678 @param Length Length of the memory space.\r
1679\r
1680 @retval EFI_SUCCESS Space successfully freed.\r
1681\r
1682**/\r
1683EFI_STATUS\r
1684EFIAPI\r
1685CoreFreeMemorySpace (\r
1686 IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
1687 IN UINT64 Length\r
1688 );\r
1689\r
1690\r
1691/**\r
1692 Removes reserved memory, system memory, or memory-mapped I/O resources from\r
1693 the global coherency domain of the processor.\r
1694\r
1695 @param BaseAddress Base address of the memory space.\r
1696 @param Length Length of the memory space.\r
1697\r
1698 @retval EFI_SUCCESS Successfully remove a segment of memory space.\r
1699\r
1700**/\r
1701EFI_STATUS\r
1702EFIAPI\r
1703CoreRemoveMemorySpace (\r
1704 IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
1705 IN UINT64 Length\r
1706 );\r
1707\r
1708\r
1709/**\r
1710 Retrieves the descriptor for a memory region containing a specified address.\r
1711\r
1712 @param BaseAddress Specified start address\r
1713 @param Descriptor Specified length\r
1714\r
1715 @retval EFI_INVALID_PARAMETER Invalid parameter\r
1716 @retval EFI_SUCCESS Successfully get memory space descriptor.\r
1717\r
1718**/\r
1719EFI_STATUS\r
1720EFIAPI\r
1721CoreGetMemorySpaceDescriptor (\r
1722 IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
1723 OUT EFI_GCD_MEMORY_SPACE_DESCRIPTOR *Descriptor\r
1724 );\r
1725\r
1726\r
1727/**\r
1728 Modifies the attributes for a memory region in the global coherency domain of the\r
1729 processor.\r
1730\r
1731 @param BaseAddress Specified start address\r
1732 @param Length Specified length\r
1733 @param Attributes Specified attributes\r
1734\r
1735 @retval EFI_SUCCESS The attributes were set for the memory region.\r
1736 @retval EFI_INVALID_PARAMETER Length is zero. \r
1737 @retval EFI_UNSUPPORTED The processor does not support one or more bytes of the memory\r
1738 resource range specified by BaseAddress and Length.\r
1739 @retval EFI_UNSUPPORTED The bit mask of attributes is not support for the memory resource\r
1740 range specified by BaseAddress and Length.\r
1741 @retval EFI_ACCESS_DEFINED The attributes for the memory resource range specified by\r
1742 BaseAddress and Length cannot be modified.\r
1743 @retval EFI_OUT_OF_RESOURCES There are not enough system resources to modify the attributes of\r
1744 the memory resource range.\r
1745 @retval EFI_NOT_AVAILABLE_YET The attributes cannot be set because CPU architectural protocol is\r
1746 not available yet.\r
1747\r
1748**/\r
1749EFI_STATUS\r
1750EFIAPI\r
1751CoreSetMemorySpaceAttributes (\r
1752 IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
1753 IN UINT64 Length,\r
1754 IN UINT64 Attributes\r
1755 );\r
1756\r
1757\r
1758/**\r
1759 Returns a map of the memory resources in the global coherency domain of the\r
1760 processor.\r
1761\r
1762 @param NumberOfDescriptors Number of descriptors.\r
1763 @param MemorySpaceMap Descriptor array\r
1764\r
1765 @retval EFI_INVALID_PARAMETER Invalid parameter\r
1766 @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate\r
1767 @retval EFI_SUCCESS Successfully get memory space map.\r
1768\r
1769**/\r
1770EFI_STATUS\r
1771EFIAPI\r
1772CoreGetMemorySpaceMap (\r
1773 OUT UINTN *NumberOfDescriptors,\r
1774 OUT EFI_GCD_MEMORY_SPACE_DESCRIPTOR **MemorySpaceMap\r
1775 );\r
1776\r
1777\r
1778/**\r
1779 Adds reserved I/O or I/O resources to the global coherency domain of the processor.\r
1780\r
1781 @param GcdIoType IO type of the segment.\r
1782 @param BaseAddress Base address of the segment.\r
1783 @param Length Length of the segment.\r
1784\r
1785 @retval EFI_SUCCESS Merged this segment into GCD map.\r
1786 @retval EFI_INVALID_PARAMETER Parameter not valid\r
1787\r
1788**/\r
1789EFI_STATUS\r
1790EFIAPI\r
1791CoreAddIoSpace (\r
1792 IN EFI_GCD_IO_TYPE GcdIoType,\r
1793 IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
1794 IN UINT64 Length\r
1795 );\r
1796\r
1797\r
1798/**\r
1799 Allocates nonexistent I/O, reserved I/O, or I/O resources from the global coherency\r
1800 domain of the processor.\r
1801\r
1802 @param GcdAllocateType The type of allocate operation\r
1803 @param GcdIoType The desired IO type\r
1804 @param Alignment Align with 2^Alignment\r
1805 @param Length Length to allocate\r
1806 @param BaseAddress Base address to allocate\r
1807 @param ImageHandle The image handle consume the allocated space.\r
1808 @param DeviceHandle The device handle consume the allocated space.\r
1809\r
1810 @retval EFI_INVALID_PARAMETER Invalid parameter.\r
1811 @retval EFI_NOT_FOUND No descriptor contains the desired space.\r
1812 @retval EFI_SUCCESS IO space successfully allocated.\r
1813\r
1814**/\r
1815EFI_STATUS\r
1816EFIAPI\r
1817CoreAllocateIoSpace (\r
1818 IN EFI_GCD_ALLOCATE_TYPE GcdAllocateType,\r
1819 IN EFI_GCD_IO_TYPE GcdIoType,\r
1820 IN UINTN Alignment,\r
1821 IN UINT64 Length,\r
1822 IN OUT EFI_PHYSICAL_ADDRESS *BaseAddress,\r
1823 IN EFI_HANDLE ImageHandle,\r
1824 IN EFI_HANDLE DeviceHandle OPTIONAL\r
1825 );\r
1826\r
1827\r
1828/**\r
1829 Frees nonexistent I/O, reserved I/O, or I/O resources from the global coherency\r
1830 domain of the processor.\r
1831\r
1832 @param BaseAddress Base address of the segment.\r
1833 @param Length Length of the segment.\r
1834\r
1835 @retval EFI_SUCCESS Space successfully freed.\r
1836\r
1837**/\r
1838EFI_STATUS\r
1839EFIAPI\r
1840CoreFreeIoSpace (\r
1841 IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
1842 IN UINT64 Length\r
1843 );\r
1844\r
1845\r
1846/**\r
1847 Removes reserved I/O or I/O resources from the global coherency domain of the\r
1848 processor.\r
1849\r
1850 @param BaseAddress Base address of the segment.\r
1851 @param Length Length of the segment.\r
1852\r
1853 @retval EFI_SUCCESS Successfully removed a segment of IO space.\r
1854\r
1855**/\r
1856EFI_STATUS\r
1857EFIAPI\r
1858CoreRemoveIoSpace (\r
1859 IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
1860 IN UINT64 Length\r
1861 );\r
1862\r
1863\r
1864/**\r
1865 Retrieves the descriptor for an I/O region containing a specified address.\r
1866\r
1867 @param BaseAddress Specified start address\r
1868 @param Descriptor Specified length\r
1869\r
1870 @retval EFI_INVALID_PARAMETER Descriptor is NULL.\r
1871 @retval EFI_SUCCESS Successfully get the IO space descriptor.\r
1872\r
1873**/\r
1874EFI_STATUS\r
1875EFIAPI\r
1876CoreGetIoSpaceDescriptor (\r
1877 IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
1878 OUT EFI_GCD_IO_SPACE_DESCRIPTOR *Descriptor\r
1879 );\r
1880\r
1881\r
1882/**\r
1883 Returns a map of the I/O resources in the global coherency domain of the processor.\r
1884\r
1885 @param NumberOfDescriptors Number of descriptors.\r
1886 @param IoSpaceMap Descriptor array\r
1887\r
1888 @retval EFI_INVALID_PARAMETER Invalid parameter\r
1889 @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate\r
1890 @retval EFI_SUCCESS Successfully get IO space map.\r
1891\r
1892**/\r
1893EFI_STATUS\r
1894EFIAPI\r
1895CoreGetIoSpaceMap (\r
1896 OUT UINTN *NumberOfDescriptors,\r
1897 OUT EFI_GCD_IO_SPACE_DESCRIPTOR **IoSpaceMap\r
1898 );\r
1899\r
1900\r
1901/**\r
1902 This is the main Dispatcher for DXE and it exits when there are no more\r
1903 drivers to run. Drain the mScheduledQueue and load and start a PE\r
1904 image for each driver. Search the mDiscoveredList to see if any driver can\r
1905 be placed on the mScheduledQueue. If no drivers are placed on the\r
1906 mScheduledQueue exit the function. On exit it is assumed the Bds()\r
1907 will be called, and when the Bds() exits the Dispatcher will be called\r
1908 again.\r
1909\r
1910 @retval EFI_ALREADY_STARTED The DXE Dispatcher is already running\r
1911 @retval EFI_NOT_FOUND No DXE Drivers were dispatched\r
1912 @retval EFI_SUCCESS One or more DXE Drivers were dispatched\r
1913\r
1914**/\r
1915EFI_STATUS\r
1916EFIAPI\r
1917CoreDispatcher (\r
1918 VOID\r
1919 );\r
1920\r
1921/**\r
1922 Check every driver and locate a matching one. If the driver is found, the Unrequested\r
1923 state flag is cleared.\r
1924\r
1925 @param FirmwareVolumeHandle The handle of the Firmware Volume that contains\r
1926 the firmware file specified by DriverName.\r
1927 @param DriverName The Driver name to put in the Dependent state.\r
1928\r
1929 @retval EFI_SUCCESS The DriverName was found and it's SOR bit was\r
1930 cleared\r
1931 @retval EFI_NOT_FOUND The DriverName does not exist or it's SOR bit was\r
1932 not set.\r
1933\r
1934**/\r
1935EFI_STATUS\r
1936EFIAPI\r
1937CoreSchedule (\r
1938 IN EFI_HANDLE FirmwareVolumeHandle,\r
1939 IN EFI_GUID *DriverName\r
1940 );\r
1941\r
1942\r
1943/**\r
1944 Convert a driver from the Untrused back to the Scheduled state.\r
1945\r
1946 @param FirmwareVolumeHandle The handle of the Firmware Volume that contains\r
1947 the firmware file specified by DriverName.\r
1948 @param DriverName The Driver name to put in the Scheduled state\r
1949\r
1950 @retval EFI_SUCCESS The file was found in the untrusted state, and it\r
1951 was promoted to the trusted state.\r
1952 @retval EFI_NOT_FOUND The file was not found in the untrusted state.\r
1953\r
1954**/\r
1955EFI_STATUS\r
1956EFIAPI\r
1957CoreTrust (\r
1958 IN EFI_HANDLE FirmwareVolumeHandle,\r
1959 IN EFI_GUID *DriverName\r
1960 );\r
1961\r
1962\r
1963/**\r
1964 This routine is the driver initialization entry point. It initializes the\r
1965 libraries, and registers two notification functions. These notification\r
1966 functions are responsible for building the FV stack dynamically.\r
1967\r
1968 @param ImageHandle The image handle.\r
1969 @param SystemTable The system table.\r
1970\r
1971 @retval EFI_SUCCESS Function successfully returned.\r
1972\r
1973**/\r
1974EFI_STATUS\r
1975EFIAPI\r
1976FwVolDriverInit (\r
1977 IN EFI_HANDLE ImageHandle,\r
1978 IN EFI_SYSTEM_TABLE *SystemTable\r
1979 );\r
1980\r
1981\r
1982/**\r
1983 Entry point of the section extraction code. Initializes an instance of the\r
1984 section extraction interface and installs it on a new handle.\r
1985\r
1986 @param ImageHandle A handle for the image that is initializing this driver\r
1987 @param SystemTable A pointer to the EFI system table\r
1988\r
1989 @retval EFI_SUCCESS Driver initialized successfully\r
1990 @retval EFI_OUT_OF_RESOURCES Could not allocate needed resources\r
1991\r
1992**/\r
1993EFI_STATUS\r
1994EFIAPI\r
1995InitializeSectionExtraction (\r
1996 IN EFI_HANDLE ImageHandle,\r
1997 IN EFI_SYSTEM_TABLE *SystemTable\r
1998 );\r
1999\r
2000\r
2001/**\r
2002 This DXE service routine is used to process a firmware volume. In\r
2003 particular, it can be called by BDS to process a single firmware\r
2004 volume found in a capsule.\r
2005\r
2006 @param FvHeader pointer to a firmware volume header\r
2007 @param Size the size of the buffer pointed to by FvHeader\r
2008 @param FVProtocolHandle the handle on which a firmware volume protocol\r
2009 was produced for the firmware volume passed in.\r
2010\r
2011 @retval EFI_OUT_OF_RESOURCES if an FVB could not be produced due to lack of\r
2012 system resources\r
2013 @retval EFI_VOLUME_CORRUPTED if the volume was corrupted\r
2014 @retval EFI_SUCCESS a firmware volume protocol was produced for the\r
2015 firmware volume\r
2016\r
2017**/\r
2018EFI_STATUS\r
2019EFIAPI\r
2020CoreProcessFirmwareVolume (\r
2021 IN VOID *FvHeader,\r
2022 IN UINTN Size,\r
2023 OUT EFI_HANDLE *FVProtocolHandle\r
2024 );\r
2025\r
2026//\r
2027//Functions used during debug buils\r
2028//\r
2029\r
2030/**\r
2031 Displays Architectural protocols that were not loaded and are required for DXE\r
2032 core to function. Only used in Debug Builds.\r
2033\r
2034**/\r
2035VOID\r
2036CoreDisplayMissingArchProtocols (\r
2037 VOID\r
2038 );\r
2039\r
2040\r
2041/**\r
2042 Traverse the discovered list for any drivers that were discovered but not loaded\r
2043 because the dependency experessions evaluated to false.\r
2044\r
2045**/\r
2046VOID\r
2047CoreDisplayDiscoveredNotDispatched (\r
2048 VOID\r
2049 );\r
2050\r
2051\r
2052/**\r
2053 Place holder function until all the Boot Services and Runtime Services are\r
2054 available.\r
2055\r
2056 @return EFI_NOT_AVAILABLE_YET\r
2057\r
2058**/\r
2059EFI_STATUS\r
2060EFIAPI\r
2061CoreEfiNotAvailableYetArg0 (\r
2062 VOID\r
2063 );\r
2064\r
2065\r
2066/**\r
2067 Place holder function until all the Boot Services and Runtime Services are\r
2068 available.\r
2069\r
2070 @param Arg1 Undefined\r
2071\r
2072 @return EFI_NOT_AVAILABLE_YET\r
2073\r
2074**/\r
2075EFI_STATUS\r
2076EFIAPI\r
2077CoreEfiNotAvailableYetArg1 (\r
2078 UINTN Arg1\r
2079 );\r
2080\r
2081\r
2082/**\r
2083 Place holder function until all the Boot Services and Runtime Services are available.\r
2084\r
2085 @param Arg1 Undefined\r
2086 @param Arg2 Undefined\r
2087\r
2088 @return EFI_NOT_AVAILABLE_YET\r
2089\r
2090**/\r
2091EFI_STATUS\r
2092EFIAPI\r
2093CoreEfiNotAvailableYetArg2 (\r
2094 UINTN Arg1,\r
2095 UINTN Arg2\r
2096 );\r
2097\r
2098\r
2099/**\r
2100 Place holder function until all the Boot Services and Runtime Services are available.\r
2101\r
2102 @param Arg1 Undefined\r
2103 @param Arg2 Undefined\r
2104 @param Arg3 Undefined\r
2105\r
2106 @return EFI_NOT_AVAILABLE_YET\r
2107\r
2108**/\r
2109EFI_STATUS\r
2110EFIAPI\r
2111CoreEfiNotAvailableYetArg3 (\r
2112 UINTN Arg1,\r
2113 UINTN Arg2,\r
2114 UINTN Arg3\r
2115 );\r
2116\r
2117\r
2118/**\r
2119 Place holder function until all the Boot Services and Runtime Services are available.\r
2120\r
2121 @param Arg1 Undefined\r
2122 @param Arg2 Undefined\r
2123 @param Arg3 Undefined\r
2124 @param Arg4 Undefined\r
2125\r
2126 @return EFI_NOT_AVAILABLE_YET\r
2127\r
2128**/\r
2129EFI_STATUS\r
2130EFIAPI\r
2131CoreEfiNotAvailableYetArg4 (\r
2132 UINTN Arg1,\r
2133 UINTN Arg2,\r
2134 UINTN Arg3,\r
2135 UINTN Arg4\r
2136 );\r
2137\r
2138\r
2139/**\r
2140 Place holder function until all the Boot Services and Runtime Services are available.\r
2141\r
2142 @param Arg1 Undefined\r
2143 @param Arg2 Undefined\r
2144 @param Arg3 Undefined\r
2145 @param Arg4 Undefined\r
2146 @param Arg5 Undefined\r
2147\r
2148 @return EFI_NOT_AVAILABLE_YET\r
2149\r
2150**/\r
2151EFI_STATUS\r
2152EFIAPI\r
2153CoreEfiNotAvailableYetArg5 (\r
2154 UINTN Arg1,\r
2155 UINTN Arg2,\r
2156 UINTN Arg3,\r
2157 UINTN Arg4,\r
2158 UINTN Arg5\r
2159 );\r
2160\r
2161\r
2162/**\r
2163 Given a compressed source buffer, this function retrieves the size of the\r
2164 uncompressed buffer and the size of the scratch buffer required to decompress\r
2165 the compressed source buffer.\r
2166\r
2167 The GetInfo() function retrieves the size of the uncompressed buffer and the\r
2168 temporary scratch buffer required to decompress the buffer specified by Source\r
2169 and SourceSize. If the size of the uncompressed buffer or the size of the\r
2170 scratch buffer cannot be determined from the compressed data specified by\r
2171 Source and SourceData, then EFI_INVALID_PARAMETER is returned. Otherwise, the\r
2172 size of the uncompressed buffer is returned in DestinationSize, the size of\r
2173 the scratch buffer is returned in ScratchSize, and EFI_SUCCESS is returned.\r
2174 The GetInfo() function does not have scratch buffer available to perform a\r
2175 thorough checking of the validity of the source data. It just retrieves the\r
2176 "Original Size" field from the beginning bytes of the source data and output\r
2177 it as DestinationSize. And ScratchSize is specific to the decompression\r
2178 implementation.\r
2179\r
2180 @param This A pointer to the EFI_DECOMPRESS_PROTOCOL instance.\r
2181 @param Source The source buffer containing the compressed data.\r
2182 @param SourceSize The size, in bytes, of the source buffer.\r
2183 @param DestinationSize A pointer to the size, in bytes, of the\r
2184 uncompressed buffer that will be generated when the\r
2185 compressed buffer specified by Source and\r
2186 SourceSize is decompressed.\r
2187 @param ScratchSize A pointer to the size, in bytes, of the scratch\r
2188 buffer that is required to decompress the\r
2189 compressed buffer specified by Source and\r
2190 SourceSize.\r
2191\r
2192 @retval EFI_SUCCESS The size of the uncompressed data was returned in\r
2193 DestinationSize and the size of the scratch buffer\r
2194 was returned in ScratchSize.\r
2195 @retval EFI_INVALID_PARAMETER The size of the uncompressed data or the size of\r
2196 the scratch buffer cannot be determined from the\r
2197 compressed data specified by Source and\r
2198 SourceSize.\r
2199\r
2200**/\r
2201EFI_STATUS\r
2202EFIAPI\r
2203DxeMainUefiDecompressGetInfo (\r
2204 IN EFI_DECOMPRESS_PROTOCOL *This,\r
2205 IN VOID *Source,\r
2206 IN UINT32 SourceSize,\r
2207 OUT UINT32 *DestinationSize,\r
2208 OUT UINT32 *ScratchSize\r
2209 );\r
2210\r
2211\r
2212/**\r
2213 Decompresses a compressed source buffer.\r
2214\r
2215 The Decompress() function extracts decompressed data to its original form.\r
2216 This protocol is designed so that the decompression algorithm can be\r
2217 implemented without using any memory services. As a result, the Decompress()\r
2218 Function is not allowed to call AllocatePool() or AllocatePages() in its\r
2219 implementation. It is the caller's responsibility to allocate and free the\r
2220 Destination and Scratch buffers.\r
2221 If the compressed source data specified by Source and SourceSize is\r
2222 sucessfully decompressed into Destination, then EFI_SUCCESS is returned. If\r
2223 the compressed source data specified by Source and SourceSize is not in a\r
2224 valid compressed data format, then EFI_INVALID_PARAMETER is returned.\r
2225\r
2226 @param This A pointer to the EFI_DECOMPRESS_PROTOCOL instance.\r
2227 @param Source The source buffer containing the compressed data.\r
2228 @param SourceSize SourceSizeThe size of source data.\r
2229 @param Destination On output, the destination buffer that contains\r
2230 the uncompressed data.\r
2231 @param DestinationSize The size of the destination buffer. The size of\r
2232 the destination buffer needed is obtained from\r
2233 EFI_DECOMPRESS_PROTOCOL.GetInfo().\r
2234 @param Scratch A temporary scratch buffer that is used to perform\r
2235 the decompression.\r
2236 @param ScratchSize The size of scratch buffer. The size of the\r
2237 scratch buffer needed is obtained from GetInfo().\r
2238\r
2239 @retval EFI_SUCCESS Decompression completed successfully, and the\r
2240 uncompressed buffer is returned in Destination.\r
2241 @retval EFI_INVALID_PARAMETER The source buffer specified by Source and\r
2242 SourceSize is corrupted (not in a valid\r
2243 compressed format).\r
2244\r
2245**/\r
2246EFI_STATUS\r
2247EFIAPI\r
2248DxeMainUefiDecompress (\r
2249 IN EFI_DECOMPRESS_PROTOCOL *This,\r
2250 IN VOID *Source,\r
2251 IN UINT32 SourceSize,\r
2252 IN OUT VOID *Destination,\r
2253 IN UINT32 DestinationSize,\r
2254 IN OUT VOID *Scratch,\r
2255 IN UINT32 ScratchSize\r
2256 );\r
2257\r
2258/**\r
2259 SEP member function. This function creates and returns a new section stream\r
2260 handle to represent the new section stream.\r
2261\r
2262 @param SectionStreamLength Size in bytes of the section stream.\r
2263 @param SectionStream Buffer containing the new section stream.\r
2264 @param SectionStreamHandle A pointer to a caller allocated UINTN that on\r
2265 output contains the new section stream handle.\r
2266\r
2267 @retval EFI_SUCCESS The section stream is created successfully.\r
2268 @retval EFI_OUT_OF_RESOURCES memory allocation failed.\r
2269 @retval EFI_INVALID_PARAMETER Section stream does not end concident with end\r
2270 of last section.\r
2271\r
2272**/\r
2273EFI_STATUS\r
2274EFIAPI\r
2275OpenSectionStream (\r
2276 IN UINTN SectionStreamLength,\r
2277 IN VOID *SectionStream,\r
2278 OUT UINTN *SectionStreamHandle\r
2279 );\r
2280\r
2281\r
2282\r
2283/**\r
2284 SEP member function. Retrieves requested section from section stream.\r
2285\r
2286 @param SectionStreamHandle The section stream from which to extract the\r
2287 requested section.\r
2288 @param SectionType A pointer to the type of section to search for.\r
2289 @param SectionDefinitionGuid If the section type is EFI_SECTION_GUID_DEFINED,\r
2290 then SectionDefinitionGuid indicates which of\r
2291 these types of sections to search for.\r
2292 @param SectionInstance Indicates which instance of the requested\r
2293 section to return.\r
2294 @param Buffer Double indirection to buffer. If *Buffer is\r
2295 non-null on input, then the buffer is caller\r
2296 allocated. If Buffer is NULL, then the buffer\r
2297 is callee allocated. In either case, the\r
2298 requried buffer size is returned in *BufferSize.\r
2299 @param BufferSize On input, indicates the size of *Buffer if\r
2300 *Buffer is non-null on input. On output,\r
2301 indicates the required size (allocated size if\r
2302 callee allocated) of *Buffer.\r
2303 @param AuthenticationStatus A pointer to a caller-allocated UINT32 that\r
2304 indicates the authentication status of the\r
2305 output buffer. If the input section's\r
2306 GuidedSectionHeader.Attributes field\r
2307 has the EFI_GUIDED_SECTION_AUTH_STATUS_VALID\r
2308 bit as clear, AuthenticationStatus must return\r
2309 zero. Both local bits (19:16) and aggregate\r
2310 bits (3:0) in AuthenticationStatus are returned\r
2311 by ExtractSection(). These bits reflect the\r
2312 status of the extraction operation. The bit\r
2313 pattern in both regions must be the same, as\r
2314 the local and aggregate authentication statuses\r
2315 have equivalent meaning at this level. If the\r
2316 function returns anything other than\r
2317 EFI_SUCCESS, the value of *AuthenticationStatus\r
2318 is undefined.\r
2319 @param IsFfs3Fv Indicates the FV format.\r
2320\r
2321 @retval EFI_SUCCESS Section was retrieved successfully\r
2322 @retval EFI_PROTOCOL_ERROR A GUID defined section was encountered in the\r
2323 section stream with its\r
2324 EFI_GUIDED_SECTION_PROCESSING_REQUIRED bit set,\r
2325 but there was no corresponding GUIDed Section\r
2326 Extraction Protocol in the handle database.\r
2327 *Buffer is unmodified.\r
2328 @retval EFI_NOT_FOUND An error was encountered when parsing the\r
2329 SectionStream. This indicates the SectionStream\r
2330 is not correctly formatted.\r
2331 @retval EFI_NOT_FOUND The requested section does not exist.\r
2332 @retval EFI_OUT_OF_RESOURCES The system has insufficient resources to process\r
2333 the request.\r
2334 @retval EFI_INVALID_PARAMETER The SectionStreamHandle does not exist.\r
2335 @retval EFI_WARN_TOO_SMALL The size of the caller allocated input buffer is\r
2336 insufficient to contain the requested section.\r
2337 The input buffer is filled and section contents\r
2338 are truncated.\r
2339\r
2340**/\r
2341EFI_STATUS\r
2342EFIAPI\r
2343GetSection (\r
2344 IN UINTN SectionStreamHandle,\r
2345 IN EFI_SECTION_TYPE *SectionType,\r
2346 IN EFI_GUID *SectionDefinitionGuid,\r
2347 IN UINTN SectionInstance,\r
2348 IN VOID **Buffer,\r
2349 IN OUT UINTN *BufferSize,\r
2350 OUT UINT32 *AuthenticationStatus,\r
2351 IN BOOLEAN IsFfs3Fv\r
2352 );\r
2353\r
2354\r
2355/**\r
2356 SEP member function. Deletes an existing section stream\r
2357\r
2358 @param StreamHandleToClose Indicates the stream to close\r
2359\r
2360 @retval EFI_SUCCESS The section stream is closed sucessfully.\r
2361 @retval EFI_OUT_OF_RESOURCES Memory allocation failed.\r
2362 @retval EFI_INVALID_PARAMETER Section stream does not end concident with end\r
2363 of last section.\r
2364\r
2365**/\r
2366EFI_STATUS\r
2367EFIAPI\r
2368CloseSectionStream (\r
2369 IN UINTN StreamHandleToClose\r
2370 );\r
2371\r
2372/**\r
2373 Creates and initializes the DebugImageInfo Table. Also creates the configuration\r
2374 table and registers it into the system table.\r
2375\r
2376 Note:\r
2377 This function allocates memory, frees it, and then allocates memory at an\r
2378 address within the initial allocation. Since this function is called early\r
2379 in DXE core initialization (before drivers are dispatched), this should not\r
2380 be a problem.\r
2381\r
2382**/\r
2383VOID\r
2384CoreInitializeDebugImageInfoTable (\r
2385 VOID\r
2386 );\r
2387\r
2388\r
2389/**\r
2390 Update the CRC32 in the Debug Table.\r
2391 Since the CRC32 service is made available by the Runtime driver, we have to\r
2392 wait for the Runtime Driver to be installed before the CRC32 can be computed.\r
2393 This function is called elsewhere by the core when the runtime architectural\r
2394 protocol is produced.\r
2395\r
2396**/\r
2397VOID\r
2398CoreUpdateDebugTableCrc32 (\r
2399 VOID\r
2400 );\r
2401\r
2402\r
2403/**\r
2404 Adds a new DebugImageInfo structure to the DebugImageInfo Table. Re-Allocates\r
2405 the table if it's not large enough to accomidate another entry.\r
2406\r
2407 @param ImageInfoType type of debug image information\r
2408 @param LoadedImage pointer to the loaded image protocol for the image being\r
2409 loaded\r
2410 @param ImageHandle image handle for the image being loaded\r
2411\r
2412**/\r
2413VOID\r
2414CoreNewDebugImageInfoEntry (\r
2415 IN UINT32 ImageInfoType,\r
2416 IN EFI_LOADED_IMAGE_PROTOCOL *LoadedImage,\r
2417 IN EFI_HANDLE ImageHandle\r
2418 );\r
2419\r
2420\r
2421/**\r
2422 Removes and frees an entry from the DebugImageInfo Table.\r
2423\r
2424 @param ImageHandle image handle for the image being unloaded\r
2425\r
2426**/\r
2427VOID\r
2428CoreRemoveDebugImageInfoEntry (\r
2429 EFI_HANDLE ImageHandle\r
2430 );\r
2431\r
2432\r
2433/**\r
2434 This routine consumes FV hobs and produces instances of FW_VOL_BLOCK_PROTOCOL as appropriate.\r
2435\r
2436 @param ImageHandle The image handle.\r
2437 @param SystemTable The system table.\r
2438\r
2439 @retval EFI_SUCCESS Successfully initialized firmware volume block\r
2440 driver.\r
2441\r
2442**/\r
2443EFI_STATUS\r
2444EFIAPI\r
2445FwVolBlockDriverInit (\r
2446 IN EFI_HANDLE ImageHandle,\r
2447 IN EFI_SYSTEM_TABLE *SystemTable\r
2448 );\r
2449\r
2450/**\r
2451\r
2452 Get FVB authentication status\r
2453\r
2454 @param FvbProtocol FVB protocol.\r
2455\r
2456 @return Authentication status.\r
2457\r
2458**/\r
2459UINT32\r
2460GetFvbAuthenticationStatus (\r
2461 IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *FvbProtocol\r
2462 );\r
2463\r
2464/**\r
2465 This routine produces a firmware volume block protocol on a given\r
2466 buffer.\r
2467\r
2468 @param BaseAddress base address of the firmware volume image\r
2469 @param Length length of the firmware volume image\r
2470 @param ParentHandle handle of parent firmware volume, if this image\r
2471 came from an FV image file and section in another firmware\r
2472 volume (ala capsules)\r
2473 @param AuthenticationStatus Authentication status inherited, if this image\r
2474 came from an FV image file and section in another firmware volume.\r
2475 @param FvProtocol Firmware volume block protocol produced.\r
2476\r
2477 @retval EFI_VOLUME_CORRUPTED Volume corrupted.\r
2478 @retval EFI_OUT_OF_RESOURCES No enough buffer to be allocated.\r
2479 @retval EFI_SUCCESS Successfully produced a FVB protocol on given\r
2480 buffer.\r
2481\r
2482**/\r
2483EFI_STATUS\r
2484ProduceFVBProtocolOnBuffer (\r
2485 IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
2486 IN UINT64 Length,\r
2487 IN EFI_HANDLE ParentHandle,\r
2488 IN UINT32 AuthenticationStatus,\r
2489 OUT EFI_HANDLE *FvProtocol OPTIONAL\r
2490 );\r
2491\r
2492\r
2493/**\r
2494 Raising to the task priority level of the mutual exclusion\r
2495 lock, and then acquires ownership of the lock.\r
2496\r
2497 @param Lock The lock to acquire\r
2498\r
2499 @return Lock owned\r
2500\r
2501**/\r
2502VOID\r
2503CoreAcquireLock (\r
2504 IN EFI_LOCK *Lock\r
2505 );\r
2506\r
2507\r
2508/**\r
2509 Initialize a basic mutual exclusion lock. Each lock\r
2510 provides mutual exclusion access at it's task priority\r
2511 level. Since there is no-premption (at any TPL) or\r
2512 multiprocessor support, acquiring the lock only consists\r
2513 of raising to the locks TPL.\r
2514\r
2515 @param Lock The EFI_LOCK structure to initialize\r
2516\r
2517 @retval EFI_SUCCESS Lock Owned.\r
2518 @retval EFI_ACCESS_DENIED Reentrant Lock Acquisition, Lock not Owned.\r
2519\r
2520**/\r
2521EFI_STATUS\r
2522CoreAcquireLockOrFail (\r
2523 IN EFI_LOCK *Lock\r
2524 );\r
2525\r
2526\r
2527/**\r
2528 Releases ownership of the mutual exclusion lock, and\r
2529 restores the previous task priority level.\r
2530\r
2531 @param Lock The lock to release\r
2532\r
2533 @return Lock unowned\r
2534\r
2535**/\r
2536VOID\r
2537CoreReleaseLock (\r
2538 IN EFI_LOCK *Lock\r
2539 );\r
2540\r
2541\r
2542/**\r
2543 An empty function to pass error checking of CreateEventEx ().\r
2544\r
2545 @param Event Event whose notification function is being invoked.\r
2546 @param Context Pointer to the notification function's context,\r
2547 which is implementation-dependent.\r
2548\r
2549**/\r
2550VOID\r
2551EFIAPI\r
2552CoreEmptyCallbackFunction (\r
2553 IN EFI_EVENT Event,\r
2554 IN VOID *Context\r
2555 );\r
2556\r
2557/**\r
2558 Read data from Firmware Block by FVB protocol Read. \r
2559 The data may cross the multi block ranges.\r
2560\r
2561 @param Fvb The FW_VOL_BLOCK_PROTOCOL instance from which to read data.\r
2562 @param StartLba Pointer to StartLba.\r
2563 On input, the start logical block index from which to read.\r
2564 On output,the end logical block index after reading.\r
2565 @param Offset Pointer to Offset\r
2566 On input, offset into the block at which to begin reading.\r
2567 On output, offset into the end block after reading.\r
2568 @param DataSize Size of data to be read.\r
2569 @param Data Pointer to Buffer that the data will be read into.\r
2570\r
2571 @retval EFI_SUCCESS Successfully read data from firmware block.\r
2572 @retval others\r
2573**/\r
2574EFI_STATUS\r
2575ReadFvbData (\r
2576 IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *Fvb,\r
2577 IN OUT EFI_LBA *StartLba,\r
2578 IN OUT UINTN *Offset,\r
2579 IN UINTN DataSize,\r
2580 OUT UINT8 *Data\r
2581 );\r
2582\r
2583/**\r
2584 Given the supplied FW_VOL_BLOCK_PROTOCOL, allocate a buffer for output and\r
2585 copy the real length volume header into it.\r
2586\r
2587 @param Fvb The FW_VOL_BLOCK_PROTOCOL instance from which to\r
2588 read the volume header\r
2589 @param FwVolHeader Pointer to pointer to allocated buffer in which\r
2590 the volume header is returned.\r
2591\r
2592 @retval EFI_OUT_OF_RESOURCES No enough buffer could be allocated.\r
2593 @retval EFI_SUCCESS Successfully read volume header to the allocated\r
2594 buffer.\r
2595\r
2596**/\r
2597EFI_STATUS\r
2598GetFwVolHeader (\r
2599 IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *Fvb,\r
2600 OUT EFI_FIRMWARE_VOLUME_HEADER **FwVolHeader\r
2601 );\r
2602\r
2603/**\r
2604 Verify checksum of the firmware volume header.\r
2605\r
2606 @param FvHeader Points to the firmware volume header to be checked\r
2607\r
2608 @retval TRUE Checksum verification passed\r
2609 @retval FALSE Checksum verification failed\r
2610\r
2611**/\r
2612BOOLEAN\r
2613VerifyFvHeaderChecksum (\r
2614 IN EFI_FIRMWARE_VOLUME_HEADER *FvHeader\r
2615 );\r
2616\r
2617#endif\r