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