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