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