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