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