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