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