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