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