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