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