2 The internal header file includes the common header files, defines
3 internal structure and functions used by DxeCore module.
5 Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
6 SPDX-License-Identifier: BSD-2-Clause-Patent
17 #include <Protocol/LoadedImage.h>
18 #include <Protocol/GuidedSectionExtraction.h>
19 #include <Protocol/DevicePath.h>
20 #include <Protocol/Runtime.h>
21 #include <Protocol/LoadFile.h>
22 #include <Protocol/LoadFile2.h>
23 #include <Protocol/DriverBinding.h>
24 #include <Protocol/VariableWrite.h>
25 #include <Protocol/PlatformDriverOverride.h>
26 #include <Protocol/Variable.h>
27 #include <Protocol/Timer.h>
28 #include <Protocol/SimpleFileSystem.h>
29 #include <Protocol/Bds.h>
30 #include <Protocol/RealTimeClock.h>
31 #include <Protocol/WatchdogTimer.h>
32 #include <Protocol/FirmwareVolume2.h>
33 #include <Protocol/MonotonicCounter.h>
34 #include <Protocol/StatusCode.h>
35 #include <Protocol/Decompress.h>
36 #include <Protocol/LoadPe32Image.h>
37 #include <Protocol/Security.h>
38 #include <Protocol/Security2.h>
39 #include <Protocol/Ebc.h>
40 #include <Protocol/Reset.h>
41 #include <Protocol/Cpu.h>
42 #include <Protocol/Metronome.h>
43 #include <Protocol/FirmwareVolumeBlock.h>
44 #include <Protocol/Capsule.h>
45 #include <Protocol/BusSpecificDriverOverride.h>
46 #include <Protocol/DriverFamilyOverride.h>
47 #include <Protocol/TcgService.h>
48 #include <Protocol/HiiPackageList.h>
49 #include <Protocol/SmmBase2.h>
50 #include <Guid/MemoryTypeInformation.h>
51 #include <Guid/FirmwareFileSystem2.h>
52 #include <Guid/FirmwareFileSystem3.h>
53 #include <Guid/HobList.h>
54 #include <Guid/DebugImageInfoTable.h>
55 #include <Guid/FileInfo.h>
56 #include <Guid/Apriori.h>
57 #include <Guid/DxeServices.h>
58 #include <Guid/MemoryAllocationHob.h>
59 #include <Guid/EventLegacyBios.h>
60 #include <Guid/EventGroup.h>
61 #include <Guid/EventExitBootServiceFailed.h>
62 #include <Guid/LoadModuleAtFixedAddress.h>
63 #include <Guid/IdleLoopEvent.h>
64 #include <Guid/VectorHandoffTable.h>
65 #include <Ppi/VectorHandoffInfo.h>
66 #include <Guid/MemoryProfile.h>
68 #include <Library/DxeCoreEntryPoint.h>
69 #include <Library/DebugLib.h>
70 #include <Library/UefiLib.h>
71 #include <Library/BaseLib.h>
72 #include <Library/HobLib.h>
73 #include <Library/PerformanceLib.h>
74 #include <Library/UefiDecompressLib.h>
75 #include <Library/ExtractGuidedSectionLib.h>
76 #include <Library/CacheMaintenanceLib.h>
77 #include <Library/BaseMemoryLib.h>
78 #include <Library/PeCoffLib.h>
79 #include <Library/PeCoffGetEntryPointLib.h>
80 #include <Library/PeCoffExtraActionLib.h>
81 #include <Library/PcdLib.h>
82 #include <Library/MemoryAllocationLib.h>
83 #include <Library/DevicePathLib.h>
84 #include <Library/UefiBootServicesTableLib.h>
85 #include <Library/ReportStatusCodeLib.h>
86 #include <Library/DxeServicesLib.h>
87 #include <Library/DebugAgentLib.h>
88 #include <Library/CpuExceptionHandlerLib.h>
92 // attributes for reserved memory before it is promoted to system memory
94 #define EFI_MEMORY_PRESENT 0x0100000000000000ULL
95 #define EFI_MEMORY_INITIALIZED 0x0200000000000000ULL
96 #define EFI_MEMORY_TESTED 0x0400000000000000ULL
99 // range for memory mapped port I/O on IPF
101 #define EFI_MEMORY_PORT_IO 0x4000000000000000ULL
105 /// EFI_DEP_REPLACE_TRUE - Used to dynamically patch the dependency expression
106 /// to save time. A EFI_DEP_PUSH is evaluated one an
107 /// replaced with EFI_DEP_REPLACE_TRUE. If PI spec's Vol 2
108 /// Driver Execution Environment Core Interface use 0xff
109 /// as new DEPEX opcode. EFI_DEP_REPLACE_TRUE should be
110 /// defined to a new value that is not conflicting with PI spec.
112 #define EFI_DEP_REPLACE_TRUE 0xff
115 /// Define the initial size of the dependency expression evaluation stack
117 #define DEPEX_STACK_SIZE_INCREMENT 0x1000
120 EFI_GUID
*ProtocolGuid
;
125 } EFI_CORE_PROTOCOL_NOTIFY_ENTRY
;
128 // DXE Dispatcher Data structures
131 #define KNOWN_HANDLE_SIGNATURE SIGNATURE_32('k','n','o','w')
134 LIST_ENTRY Link
; // mFvHandleList
140 #define EFI_CORE_DRIVER_ENTRY_SIGNATURE SIGNATURE_32('d','r','v','r')
143 LIST_ENTRY Link
; // mDriverList
145 LIST_ENTRY ScheduledLink
; // mScheduledQueue
149 EFI_DEVICE_PATH_PROTOCOL
*FvFileDevicePath
;
150 EFI_FIRMWARE_VOLUME2_PROTOCOL
*Fv
;
157 EFI_GUID BeforeAfterGuid
;
164 BOOLEAN DepexProtocolError
;
166 EFI_HANDLE ImageHandle
;
169 } EFI_CORE_DRIVER_ENTRY
;
172 //The data structure of GCD memory map entry
174 #define EFI_GCD_MAP_SIGNATURE SIGNATURE_32('g','c','d','m')
178 EFI_PHYSICAL_ADDRESS BaseAddress
;
182 EFI_GCD_MEMORY_TYPE GcdMemoryType
;
183 EFI_GCD_IO_TYPE GcdIoType
;
184 EFI_HANDLE ImageHandle
;
185 EFI_HANDLE DeviceHandle
;
189 #define LOADED_IMAGE_PRIVATE_DATA_SIGNATURE SIGNATURE_32('l','d','r','i')
197 /// If entrypoint has been called
199 /// The image's entry point
200 EFI_IMAGE_ENTRY_POINT EntryPoint
;
201 /// loaded image protocol
202 EFI_LOADED_IMAGE_PROTOCOL Info
;
203 /// Location in memory
204 EFI_PHYSICAL_ADDRESS ImageBasePage
;
207 /// Original fixup data
209 /// Tpl of started image
211 /// Status returned by started image
213 /// Size of ExitData from started image
215 /// Pointer to exit data from started image
217 /// Pointer to pool allocation for context save/restore
219 /// Pointer to buffer for context save/restore
220 BASE_LIBRARY_JUMP_BUFFER
*JumpContext
;
221 /// Machine type from PE image
223 /// EBC Protocol pointer
224 EFI_EBC_PROTOCOL
*Ebc
;
225 /// Runtime image list
226 EFI_RUNTIME_IMAGE_ENTRY
*RuntimeData
;
227 /// Pointer to Loaded Image Device Path Protocol
228 EFI_DEVICE_PATH_PROTOCOL
*LoadedImageDevicePath
;
229 /// PeCoffLoader ImageContext
230 PE_COFF_LOADER_IMAGE_CONTEXT ImageContext
;
231 /// Status returned by LoadImage() service.
232 EFI_STATUS LoadImageStatus
;
233 } LOADED_IMAGE_PRIVATE_DATA
;
235 #define LOADED_IMAGE_PRIVATE_DATA_FROM_THIS(a) \
236 CR(a, LOADED_IMAGE_PRIVATE_DATA, Info, LOADED_IMAGE_PRIVATE_DATA_SIGNATURE)
238 #define IMAGE_PROPERTIES_RECORD_CODE_SECTION_SIGNATURE SIGNATURE_32 ('I','P','R','C')
243 EFI_PHYSICAL_ADDRESS CodeSegmentBase
;
244 UINT64 CodeSegmentSize
;
245 } IMAGE_PROPERTIES_RECORD_CODE_SECTION
;
247 #define IMAGE_PROPERTIES_RECORD_SIGNATURE SIGNATURE_32 ('I','P','R','D')
252 EFI_PHYSICAL_ADDRESS ImageBase
;
254 UINTN CodeSegmentCount
;
255 LIST_ENTRY CodeSegmentList
;
256 } IMAGE_PROPERTIES_RECORD
;
259 // DXE Core Global Variables
261 extern EFI_SYSTEM_TABLE
*gDxeCoreST
;
262 extern EFI_RUNTIME_SERVICES
*gDxeCoreRT
;
263 extern EFI_DXE_SERVICES
*gDxeCoreDS
;
264 extern EFI_HANDLE gDxeCoreImageHandle
;
266 extern BOOLEAN gMemoryMapTerminated
;
268 extern EFI_DECOMPRESS_PROTOCOL gEfiDecompress
;
270 extern EFI_RUNTIME_ARCH_PROTOCOL
*gRuntime
;
271 extern EFI_CPU_ARCH_PROTOCOL
*gCpu
;
272 extern EFI_WATCHDOG_TIMER_ARCH_PROTOCOL
*gWatchdogTimer
;
273 extern EFI_METRONOME_ARCH_PROTOCOL
*gMetronome
;
274 extern EFI_TIMER_ARCH_PROTOCOL
*gTimer
;
275 extern EFI_SECURITY_ARCH_PROTOCOL
*gSecurity
;
276 extern EFI_SECURITY2_ARCH_PROTOCOL
*gSecurity2
;
277 extern EFI_BDS_ARCH_PROTOCOL
*gBds
;
278 extern EFI_SMM_BASE2_PROTOCOL
*gSmmBase2
;
280 extern EFI_TPL gEfiCurrentTpl
;
282 extern EFI_GUID
*gDxeCoreFileName
;
283 extern EFI_LOADED_IMAGE_PROTOCOL
*gDxeCoreLoadedImage
;
285 extern EFI_MEMORY_TYPE_INFORMATION gMemoryTypeInformation
[EfiMaxMemoryType
+ 1];
287 extern BOOLEAN gDispatcherRunning
;
288 extern EFI_RUNTIME_ARCH_PROTOCOL gRuntimeTemplate
;
290 extern EFI_LOAD_FIXED_ADDRESS_CONFIGURATION_TABLE gLoadModuleAtFixAddressConfigurationTable
;
291 extern BOOLEAN gLoadFixedAddressCodeMemoryReady
;
293 // Service Initialization Functions
299 Called to initialize the pool.
309 Called to initialize the memory map and add descriptors to
310 the current descriptor list.
311 The first descriptor that is added must be general usable
312 memory as the addition allocates heap.
314 @param Type The type of memory to add
315 @param Start The starting address in the memory range Must be
317 @param NumberOfPages The number of pages in the range
318 @param Attribute Attributes of the memory to add
320 @return None. The range is added to the memory map
324 CoreAddMemoryDescriptor (
325 IN EFI_MEMORY_TYPE Type
,
326 IN EFI_PHYSICAL_ADDRESS Start
,
327 IN UINT64 NumberOfPages
,
333 Release memory lock on mGcdMemorySpaceLock.
337 CoreReleaseGcdMemoryLock (
343 Acquire memory lock on mGcdMemorySpaceLock.
347 CoreAcquireGcdMemoryLock (
353 External function. Initializes memory services based on the memory
354 descriptor HOBs. This function is responsible for priming the memory
355 map, so memory allocations and resource allocations can be made.
356 The first part of this function can not depend on any memory services
357 until at least one memory descriptor is provided to the memory services.
359 @param HobStart The start address of the HOB.
360 @param MemoryBaseAddress Start address of memory region found to init DXE
362 @param MemoryLength Length of memory region found to init DXE core.
364 @retval EFI_SUCCESS Memory services successfully initialized.
368 CoreInitializeMemoryServices (
370 OUT EFI_PHYSICAL_ADDRESS
*MemoryBaseAddress
,
371 OUT UINT64
*MemoryLength
377 External function. Initializes the GCD and memory services based on the memory
378 descriptor HOBs. This function is responsible for priming the GCD map and the
379 memory map, so memory allocations and resource allocations can be made. The
380 HobStart will be relocated to a pool buffer.
382 @param HobStart The start address of the HOB
383 @param MemoryBaseAddress Start address of memory region found to init DXE
385 @param MemoryLength Length of memory region found to init DXE core.
387 @retval EFI_SUCCESS GCD services successfully initialized.
391 CoreInitializeGcdServices (
392 IN OUT VOID
**HobStart
,
393 IN EFI_PHYSICAL_ADDRESS MemoryBaseAddress
,
394 IN UINT64 MemoryLength
399 Initializes "event" support.
401 @retval EFI_SUCCESS Always return success
405 CoreInitializeEventServices (
411 Add the Image Services to EFI Boot Services Table and install the protocol
412 interfaces for this image.
414 @param HobStart The HOB to initialize
420 CoreInitializeImageServices (
426 Creates an event that is fired everytime a Protocol of a specific type is installed.
430 CoreNotifyOnProtocolInstallation (
436 Return TRUE if all AP services are available.
438 @retval EFI_SUCCESS All AP services are available
439 @retval EFI_NOT_FOUND At least one AP service is not available
443 CoreAllEfiServicesAvailable (
449 Calcualte the 32-bit CRC in a EFI table using the service provided by the
452 @param Hdr Pointer to an EFI standard header
457 IN OUT EFI_TABLE_HEADER
*Hdr
462 Called by the platform code to process a tick.
464 @param Duration The number of 100ns elapsed since the last call
476 Initialize the dispatcher. Initialize the notification function that runs when
477 an FV2 protocol is added to the system.
481 CoreInitializeDispatcher (
487 This is the POSTFIX version of the dependency evaluator. This code does
488 not need to handle Before or After, as it is not valid to call this
489 routine in this case. The SOR is just ignored and is a nop in the grammer.
490 POSTFIX means all the math is done on top of the stack.
492 @param DriverEntry DriverEntry element to update.
494 @retval TRUE If driver is ready to run.
495 @retval FALSE If driver is not ready to run or some fatal error
501 IN EFI_CORE_DRIVER_ENTRY
*DriverEntry
506 Preprocess dependency expression and update DriverEntry to reflect the
507 state of Before, After, and SOR dependencies. If DriverEntry->Before
508 or DriverEntry->After is set it will never be cleared. If SOR is set
509 it will be cleared by CoreSchedule(), and then the driver can be
512 @param DriverEntry DriverEntry element to update .
514 @retval EFI_SUCCESS It always works.
518 CorePreProcessDepex (
519 IN EFI_CORE_DRIVER_ENTRY
*DriverEntry
525 Terminates all boot services.
527 @param ImageHandle Handle that identifies the exiting image.
528 @param MapKey Key to the latest memory map.
530 @retval EFI_SUCCESS Boot Services terminated
531 @retval EFI_INVALID_PARAMETER MapKey is incorrect.
536 CoreExitBootServices (
537 IN EFI_HANDLE ImageHandle
,
543 Make sure the memory map is following all the construction rules,
544 it is the last time to check memory map error before exit boot services.
546 @param MapKey Memory map key
548 @retval EFI_INVALID_PARAMETER Memory map not consistent with construction
550 @retval EFI_SUCCESS Valid memory map.
554 CoreTerminateMemoryMap (
560 Signals all events in the EventGroup.
562 @param EventGroup The list to signal
566 CoreNotifySignalList (
567 IN EFI_GUID
*EventGroup
573 Boot Service called to add, modify, or remove a system configuration table from
574 the EFI System Table.
576 @param Guid Pointer to the GUID for the entry to add, update, or
578 @param Table Pointer to the configuration table for the entry to add,
579 update, or remove, may be NULL.
581 @return EFI_SUCCESS Guid, Table pair added, updated, or removed.
582 @return EFI_INVALID_PARAMETER Input GUID not valid.
583 @return EFI_NOT_FOUND Attempted to delete non-existant entry
584 @return EFI_OUT_OF_RESOURCES Not enough memory available
589 CoreInstallConfigurationTable (
597 Raise the task priority level to the new level.
598 High level is implemented by disabling processor interrupts.
600 @param NewTpl New task priority level
602 @return The previous task priority level
614 Lowers the task priority to the previous value. If the new
615 priority unmasks events at a higher priority, they are dispatched.
617 @param NewTpl New, lower, task priority
629 Introduces a fine-grained stall.
631 @param Microseconds The number of microseconds to stall execution.
633 @retval EFI_SUCCESS Execution was stalled for at least the requested
634 amount of microseconds.
635 @retval EFI_NOT_AVAILABLE_YET gMetronome is not available yet
641 IN UINTN Microseconds
647 Sets the system's watchdog timer.
649 @param Timeout The number of seconds to set the watchdog timer to.
650 A value of zero disables the timer.
651 @param WatchdogCode The numeric code to log on a watchdog timer timeout
652 event. The firmware reserves codes 0x0000 to 0xFFFF.
653 Loaders and operating systems may use other timeout
655 @param DataSize The size, in bytes, of WatchdogData.
656 @param WatchdogData A data buffer that includes a Null-terminated Unicode
657 string, optionally followed by additional binary data.
658 The string is a description that the call may use to
659 further indicate the reason to be logged with a
662 @return EFI_SUCCESS Timeout has been set
663 @return EFI_NOT_AVAILABLE_YET WatchdogTimer is not available yet
664 @return EFI_UNSUPPORTED System does not have a timer (currently not used)
665 @return EFI_DEVICE_ERROR Could not complete due to hardware error
670 CoreSetWatchdogTimer (
672 IN UINT64 WatchdogCode
,
674 IN CHAR16
*WatchdogData OPTIONAL
680 Wrapper function to CoreInstallProtocolInterfaceNotify. This is the public API which
681 Calls the private one which contains a BOOLEAN parameter for notifications
683 @param UserHandle The handle to install the protocol handler on,
684 or NULL if a new handle is to be allocated
685 @param Protocol The protocol to add to the handle
686 @param InterfaceType Indicates whether Interface is supplied in
688 @param Interface The interface for the protocol being added
695 CoreInstallProtocolInterface (
696 IN OUT EFI_HANDLE
*UserHandle
,
697 IN EFI_GUID
*Protocol
,
698 IN EFI_INTERFACE_TYPE InterfaceType
,
704 Installs a protocol interface into the boot services environment.
706 @param UserHandle The handle to install the protocol handler on,
707 or NULL if a new handle is to be allocated
708 @param Protocol The protocol to add to the handle
709 @param InterfaceType Indicates whether Interface is supplied in
711 @param Interface The interface for the protocol being added
712 @param Notify indicates whether notify the notification list
715 @retval EFI_INVALID_PARAMETER Invalid parameter
716 @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate
717 @retval EFI_SUCCESS Protocol interface successfully installed
721 CoreInstallProtocolInterfaceNotify (
722 IN OUT EFI_HANDLE
*UserHandle
,
723 IN EFI_GUID
*Protocol
,
724 IN EFI_INTERFACE_TYPE InterfaceType
,
732 Installs a list of protocol interface into the boot services environment.
733 This function calls InstallProtocolInterface() in a loop. If any error
734 occures all the protocols added by this function are removed. This is
735 basically a lib function to save space.
737 @param Handle The handle to install the protocol handlers on,
738 or NULL if a new handle is to be allocated
739 @param ... EFI_GUID followed by protocol instance. A NULL
740 terminates the list. The pairs are the
741 arguments to InstallProtocolInterface(). All the
742 protocols are added to Handle.
744 @retval EFI_SUCCESS All the protocol interface was installed.
745 @retval EFI_OUT_OF_RESOURCES There was not enough memory in pool to install all the protocols.
746 @retval EFI_ALREADY_STARTED A Device Path Protocol instance was passed in that is already present in
748 @retval EFI_INVALID_PARAMETER Handle is NULL.
749 @retval EFI_INVALID_PARAMETER Protocol is already installed on the handle specified by Handle.
754 CoreInstallMultipleProtocolInterfaces (
755 IN OUT EFI_HANDLE
*Handle
,
762 Uninstalls a list of protocol interface in the boot services environment.
763 This function calls UnisatllProtocolInterface() in a loop. This is
764 basically a lib function to save space.
766 @param Handle The handle to uninstall the protocol
767 @param ... EFI_GUID followed by protocol instance. A NULL
768 terminates the list. The pairs are the
769 arguments to UninstallProtocolInterface(). All
770 the protocols are added to Handle.
777 CoreUninstallMultipleProtocolInterfaces (
778 IN EFI_HANDLE Handle
,
785 Reinstall a protocol interface on a device handle. The OldInterface for Protocol is replaced by the NewInterface.
787 @param UserHandle Handle on which the interface is to be
789 @param Protocol The numeric ID of the interface
790 @param OldInterface A pointer to the old interface
791 @param NewInterface A pointer to the new interface
793 @retval EFI_SUCCESS The protocol interface was installed
794 @retval EFI_NOT_FOUND The OldInterface on the handle was not found
795 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value
800 CoreReinstallProtocolInterface (
801 IN EFI_HANDLE UserHandle
,
802 IN EFI_GUID
*Protocol
,
803 IN VOID
*OldInterface
,
804 IN VOID
*NewInterface
810 Uninstalls all instances of a protocol:interfacer from a handle.
811 If the last protocol interface is remove from the handle, the
814 @param UserHandle The handle to remove the protocol handler from
815 @param Protocol The protocol, of protocol:interface, to remove
816 @param Interface The interface, of protocol:interface, to remove
818 @retval EFI_INVALID_PARAMETER Protocol is NULL.
819 @retval EFI_SUCCESS Protocol interface successfully uninstalled.
824 CoreUninstallProtocolInterface (
825 IN EFI_HANDLE UserHandle
,
826 IN EFI_GUID
*Protocol
,
833 Queries a handle to determine if it supports a specified protocol.
835 @param UserHandle The handle being queried.
836 @param Protocol The published unique identifier of the protocol.
837 @param Interface Supplies the address where a pointer to the
838 corresponding Protocol Interface is returned.
840 @return The requested protocol interface for the handle
846 IN EFI_HANDLE UserHandle
,
847 IN EFI_GUID
*Protocol
,
854 Locates the installed protocol handler for the handle, and
855 invokes it to obtain the protocol interface. Usage information
856 is registered in the protocol data base.
858 @param UserHandle The handle to obtain the protocol interface on
859 @param Protocol The ID of the protocol
860 @param Interface The location to return the protocol interface
861 @param ImageHandle The handle of the Image that is opening the
862 protocol interface specified by Protocol and
864 @param ControllerHandle The controller handle that is requiring this
866 @param Attributes The open mode of the protocol interface
867 specified by Handle and Protocol.
869 @retval EFI_INVALID_PARAMETER Protocol is NULL.
870 @retval EFI_SUCCESS Get the protocol interface.
876 IN EFI_HANDLE UserHandle
,
877 IN EFI_GUID
*Protocol
,
878 OUT VOID
**Interface OPTIONAL
,
879 IN EFI_HANDLE ImageHandle
,
880 IN EFI_HANDLE ControllerHandle
,
887 Return information about Opened protocols in the system
889 @param UserHandle The handle to close the protocol interface on
890 @param Protocol The ID of the protocol
891 @param EntryBuffer A pointer to a buffer of open protocol
892 information in the form of
893 EFI_OPEN_PROTOCOL_INFORMATION_ENTRY structures.
894 @param EntryCount Number of EntryBuffer entries
899 CoreOpenProtocolInformation (
900 IN EFI_HANDLE UserHandle
,
901 IN EFI_GUID
*Protocol
,
902 OUT EFI_OPEN_PROTOCOL_INFORMATION_ENTRY
**EntryBuffer
,
903 OUT UINTN
*EntryCount
909 Closes a protocol on a handle that was opened using OpenProtocol().
911 @param UserHandle The handle for the protocol interface that was
912 previously opened with OpenProtocol(), and is
914 @param Protocol The published unique identifier of the protocol.
915 It is the caller's responsibility to pass in a
917 @param AgentHandle The handle of the agent that is closing the
919 @param ControllerHandle If the agent that opened a protocol is a driver
920 that follows the EFI Driver Model, then this
921 parameter is the controller handle that required
922 the protocol interface. If the agent does not
923 follow the EFI Driver Model, then this parameter
924 is optional and may be NULL.
926 @retval EFI_SUCCESS The protocol instance was closed.
927 @retval EFI_INVALID_PARAMETER Handle, AgentHandle or ControllerHandle is not a
929 @retval EFI_NOT_FOUND Can not find the specified protocol or
936 IN EFI_HANDLE UserHandle
,
937 IN EFI_GUID
*Protocol
,
938 IN EFI_HANDLE AgentHandle
,
939 IN EFI_HANDLE ControllerHandle
945 Retrieves the list of protocol interface GUIDs that are installed on a handle in a buffer allocated
948 @param UserHandle The handle from which to retrieve the list of
949 protocol interface GUIDs.
950 @param ProtocolBuffer A pointer to the list of protocol interface GUID
951 pointers that are installed on Handle.
952 @param ProtocolBufferCount A pointer to the number of GUID pointers present
955 @retval EFI_SUCCESS The list of protocol interface GUIDs installed
956 on Handle was returned in ProtocolBuffer. The
957 number of protocol interface GUIDs was returned
958 in ProtocolBufferCount.
959 @retval EFI_INVALID_PARAMETER Handle is NULL.
960 @retval EFI_INVALID_PARAMETER Handle is not a valid EFI_HANDLE.
961 @retval EFI_INVALID_PARAMETER ProtocolBuffer is NULL.
962 @retval EFI_INVALID_PARAMETER ProtocolBufferCount is NULL.
963 @retval EFI_OUT_OF_RESOURCES There is not enough pool memory to store the
969 CoreProtocolsPerHandle (
970 IN EFI_HANDLE UserHandle
,
971 OUT EFI_GUID
***ProtocolBuffer
,
972 OUT UINTN
*ProtocolBufferCount
978 Add a new protocol notification record for the request protocol.
980 @param Protocol The requested protocol to add the notify
982 @param Event The event to signal
983 @param Registration Returns the registration record
985 @retval EFI_INVALID_PARAMETER Invalid parameter
986 @retval EFI_SUCCESS Successfully returned the registration record
992 CoreRegisterProtocolNotify (
993 IN EFI_GUID
*Protocol
,
995 OUT VOID
**Registration
1000 Removes all the events in the protocol database that match Event.
1002 @param Event The event to search for in the protocol
1005 @return EFI_SUCCESS when done searching the entire database.
1009 CoreUnregisterProtocolNotify (
1015 Locates the requested handle(s) and returns them in Buffer.
1017 @param SearchType The type of search to perform to locate the
1019 @param Protocol The protocol to search for
1020 @param SearchKey Dependant on SearchType
1021 @param BufferSize On input the size of Buffer. On output the
1022 size of data returned.
1023 @param Buffer The buffer to return the results in
1025 @retval EFI_BUFFER_TOO_SMALL Buffer too small, required buffer size is
1026 returned in BufferSize.
1027 @retval EFI_INVALID_PARAMETER Invalid parameter
1028 @retval EFI_SUCCESS Successfully found the requested handle(s) and
1029 returns them in Buffer.
1035 IN EFI_LOCATE_SEARCH_TYPE SearchType
,
1036 IN EFI_GUID
*Protocol OPTIONAL
,
1037 IN VOID
*SearchKey OPTIONAL
,
1038 IN OUT UINTN
*BufferSize
,
1039 OUT EFI_HANDLE
*Buffer
1045 Locates the handle to a device on the device path that best matches the specified protocol.
1047 @param Protocol The protocol to search for.
1048 @param DevicePath On input, a pointer to a pointer to the device
1049 path. On output, the device path pointer is
1050 modified to point to the remaining part of the
1052 @param Device A pointer to the returned device handle.
1054 @retval EFI_SUCCESS The resulting handle was returned.
1055 @retval EFI_NOT_FOUND No handles matched the search.
1056 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
1061 CoreLocateDevicePath (
1062 IN EFI_GUID
*Protocol
,
1063 IN OUT EFI_DEVICE_PATH_PROTOCOL
**DevicePath
,
1064 OUT EFI_HANDLE
*Device
1070 Function returns an array of handles that support the requested protocol
1071 in a buffer allocated from pool. This is a version of CoreLocateHandle()
1072 that allocates a buffer for the caller.
1074 @param SearchType Specifies which handle(s) are to be returned.
1075 @param Protocol Provides the protocol to search by. This
1076 parameter is only valid for SearchType
1078 @param SearchKey Supplies the search key depending on the
1080 @param NumberHandles The number of handles returned in Buffer.
1081 @param Buffer A pointer to the buffer to return the requested
1082 array of handles that support Protocol.
1084 @retval EFI_SUCCESS The result array of handles was returned.
1085 @retval EFI_NOT_FOUND No handles match the search.
1086 @retval EFI_OUT_OF_RESOURCES There is not enough pool memory to store the
1088 @retval EFI_INVALID_PARAMETER One or more parameters are not valid.
1093 CoreLocateHandleBuffer (
1094 IN EFI_LOCATE_SEARCH_TYPE SearchType
,
1095 IN EFI_GUID
*Protocol OPTIONAL
,
1096 IN VOID
*SearchKey OPTIONAL
,
1097 IN OUT UINTN
*NumberHandles
,
1098 OUT EFI_HANDLE
**Buffer
1104 Return the first Protocol Interface that matches the Protocol GUID. If
1105 Registration is passed in, return a Protocol Instance that was just add
1106 to the system. If Registration is NULL return the first Protocol Interface
1109 @param Protocol The protocol to search for
1110 @param Registration Optional Registration Key returned from
1111 RegisterProtocolNotify()
1112 @param Interface Return the Protocol interface (instance).
1114 @retval EFI_SUCCESS If a valid Interface is returned
1115 @retval EFI_INVALID_PARAMETER Invalid parameter
1116 @retval EFI_NOT_FOUND Protocol interface not found
1121 CoreLocateProtocol (
1122 IN EFI_GUID
*Protocol
,
1123 IN VOID
*Registration OPTIONAL
,
1124 OUT VOID
**Interface
1129 return handle database key.
1132 @return Handle database key.
1136 CoreGetHandleDatabaseKey (
1142 Go connect any handles that were created or modified while a image executed.
1144 @param Key The Key to show that the handle has been
1149 CoreConnectHandlesByKey (
1156 Connects one or more drivers to a controller.
1158 @param ControllerHandle The handle of the controller to which driver(s) are to be connected.
1159 @param DriverImageHandle A pointer to an ordered list handles that support the
1160 EFI_DRIVER_BINDING_PROTOCOL.
1161 @param RemainingDevicePath A pointer to the device path that specifies a child of the
1162 controller specified by ControllerHandle.
1163 @param Recursive If TRUE, then ConnectController() is called recursively
1164 until the entire tree of controllers below the controller specified
1165 by ControllerHandle have been created. If FALSE, then
1166 the tree of controllers is only expanded one level.
1168 @retval EFI_SUCCESS 1) One or more drivers were connected to ControllerHandle.
1169 2) No drivers were connected to ControllerHandle, but
1170 RemainingDevicePath is not NULL, and it is an End Device
1172 @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.
1173 @retval EFI_NOT_FOUND 1) There are no EFI_DRIVER_BINDING_PROTOCOL instances
1174 present in the system.
1175 2) No drivers were connected to ControllerHandle.
1176 @retval EFI_SECURITY_VIOLATION
1177 The user has no permission to start UEFI device drivers on the device path
1178 associated with the ControllerHandle or specified by the RemainingDevicePath.
1183 CoreConnectController (
1184 IN EFI_HANDLE ControllerHandle
,
1185 IN EFI_HANDLE
*DriverImageHandle OPTIONAL
,
1186 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath OPTIONAL
,
1187 IN BOOLEAN Recursive
1193 Disonnects a controller from a driver
1195 @param ControllerHandle ControllerHandle The handle of
1196 the controller from which
1199 @param DriverImageHandle DriverImageHandle The driver to
1200 disconnect from ControllerHandle.
1201 @param ChildHandle ChildHandle The handle of the
1204 @retval EFI_SUCCESS One or more drivers were
1205 disconnected from the controller.
1206 @retval EFI_SUCCESS On entry, no drivers are managing
1208 @retval EFI_SUCCESS DriverImageHandle is not NULL,
1209 and on entry DriverImageHandle is
1210 not managing ControllerHandle.
1211 @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.
1212 @retval EFI_INVALID_PARAMETER DriverImageHandle is not NULL,
1213 and it is not a valid EFI_HANDLE.
1214 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL, and it
1215 is not a valid EFI_HANDLE.
1216 @retval EFI_OUT_OF_RESOURCES There are not enough resources
1217 available to disconnect any
1218 drivers from ControllerHandle.
1219 @retval EFI_DEVICE_ERROR The controller could not be
1220 disconnected because of a device
1226 CoreDisconnectController (
1227 IN EFI_HANDLE ControllerHandle
,
1228 IN EFI_HANDLE DriverImageHandle OPTIONAL
,
1229 IN EFI_HANDLE ChildHandle OPTIONAL
1235 Allocates pages from the memory map.
1237 @param Type The type of allocation to perform
1238 @param MemoryType The type of memory to turn the allocated pages
1240 @param NumberOfPages The number of pages to allocate
1241 @param Memory A pointer to receive the base allocated memory
1244 @return Status. On success, Memory is filled in with the base address allocated
1245 @retval EFI_INVALID_PARAMETER Parameters violate checking rules defined in
1247 @retval EFI_NOT_FOUND Could not allocate pages match the requirement.
1248 @retval EFI_OUT_OF_RESOURCES No enough pages to allocate.
1249 @retval EFI_SUCCESS Pages successfully allocated.
1255 IN EFI_ALLOCATE_TYPE Type
,
1256 IN EFI_MEMORY_TYPE MemoryType
,
1257 IN UINTN NumberOfPages
,
1258 IN OUT EFI_PHYSICAL_ADDRESS
*Memory
1262 Frees previous allocated pages.
1264 @param Memory Base address of memory being freed
1265 @param NumberOfPages The number of pages to free
1267 @retval EFI_NOT_FOUND Could not find the entry that covers the range
1268 @retval EFI_INVALID_PARAMETER Address not aligned
1269 @return EFI_SUCCESS -Pages successfully freed.
1275 IN EFI_PHYSICAL_ADDRESS Memory
,
1276 IN UINTN NumberOfPages
1280 This function returns a copy of the current memory map. The map is an array of
1281 memory descriptors, each of which describes a contiguous block of memory.
1283 @param MemoryMapSize A pointer to the size, in bytes, of the
1284 MemoryMap buffer. On input, this is the size of
1285 the buffer allocated by the caller. On output,
1286 it is the size of the buffer returned by the
1287 firmware if the buffer was large enough, or the
1288 size of the buffer needed to contain the map if
1289 the buffer was too small.
1290 @param MemoryMap A pointer to the buffer in which firmware places
1291 the current memory map.
1292 @param MapKey A pointer to the location in which firmware
1293 returns the key for the current memory map.
1294 @param DescriptorSize A pointer to the location in which firmware
1295 returns the size, in bytes, of an individual
1296 EFI_MEMORY_DESCRIPTOR.
1297 @param DescriptorVersion A pointer to the location in which firmware
1298 returns the version number associated with the
1299 EFI_MEMORY_DESCRIPTOR.
1301 @retval EFI_SUCCESS The memory map was returned in the MemoryMap
1303 @retval EFI_BUFFER_TOO_SMALL The MemoryMap buffer was too small. The current
1304 buffer size needed to hold the memory map is
1305 returned in MemoryMapSize.
1306 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
1312 IN OUT UINTN
*MemoryMapSize
,
1313 IN OUT EFI_MEMORY_DESCRIPTOR
*MemoryMap
,
1315 OUT UINTN
*DescriptorSize
,
1316 OUT UINT32
*DescriptorVersion
1322 Allocate pool of a particular type.
1324 @param PoolType Type of pool to allocate
1325 @param Size The amount of pool to allocate
1326 @param Buffer The address to return a pointer to the allocated
1329 @retval EFI_INVALID_PARAMETER PoolType not valid or Buffer is NULL
1330 @retval EFI_OUT_OF_RESOURCES Size exceeds max pool size or allocation failed.
1331 @retval EFI_SUCCESS Pool successfully allocated.
1337 IN EFI_MEMORY_TYPE PoolType
,
1343 Allocate pool of a particular type.
1345 @param PoolType Type of pool to allocate
1346 @param Size The amount of pool to allocate
1347 @param Buffer The address to return a pointer to the allocated
1350 @retval EFI_INVALID_PARAMETER PoolType not valid or Buffer is NULL
1351 @retval EFI_OUT_OF_RESOURCES Size exceeds max pool size or allocation failed.
1352 @retval EFI_SUCCESS Pool successfully allocated.
1357 CoreInternalAllocatePool (
1358 IN EFI_MEMORY_TYPE PoolType
,
1366 @param Buffer The allocated pool entry to free
1368 @retval EFI_INVALID_PARAMETER Buffer is not a valid value.
1369 @retval EFI_SUCCESS Pool successfully freed.
1381 @param Buffer The allocated pool entry to free
1382 @param PoolType Pointer to pool type
1384 @retval EFI_INVALID_PARAMETER Buffer is not a valid value.
1385 @retval EFI_SUCCESS Pool successfully freed.
1390 CoreInternalFreePool (
1392 OUT EFI_MEMORY_TYPE
*PoolType OPTIONAL
1396 Loads an EFI image into memory and returns a handle to the image.
1398 @param BootPolicy If TRUE, indicates that the request originates
1399 from the boot manager, and that the boot
1400 manager is attempting to load FilePath as a
1402 @param ParentImageHandle The caller's image handle.
1403 @param FilePath The specific file path from which the image is
1405 @param SourceBuffer If not NULL, a pointer to the memory location
1406 containing a copy of the image to be loaded.
1407 @param SourceSize The size in bytes of SourceBuffer.
1408 @param ImageHandle Pointer to the returned image handle that is
1409 created when the image is successfully loaded.
1411 @retval EFI_SUCCESS The image was loaded into memory.
1412 @retval EFI_NOT_FOUND The FilePath was not found.
1413 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
1414 @retval EFI_UNSUPPORTED The image type is not supported, or the device
1415 path cannot be parsed to locate the proper
1416 protocol for loading the file.
1417 @retval EFI_OUT_OF_RESOURCES Image was not loaded due to insufficient
1419 @retval EFI_LOAD_ERROR Image was not loaded because the image format was corrupt or not
1421 @retval EFI_DEVICE_ERROR Image was not loaded because the device returned a read error.
1422 @retval EFI_ACCESS_DENIED Image was not loaded because the platform policy prohibits the
1423 image from being loaded. NULL is returned in *ImageHandle.
1424 @retval EFI_SECURITY_VIOLATION Image was loaded and an ImageHandle was created with a
1425 valid EFI_LOADED_IMAGE_PROTOCOL. However, the current
1426 platform policy specifies that the image should not be started.
1432 IN BOOLEAN BootPolicy
,
1433 IN EFI_HANDLE ParentImageHandle
,
1434 IN EFI_DEVICE_PATH_PROTOCOL
*FilePath
,
1435 IN VOID
*SourceBuffer OPTIONAL
,
1436 IN UINTN SourceSize
,
1437 OUT EFI_HANDLE
*ImageHandle
1445 @param ImageHandle Handle that identifies the image to be
1448 @retval EFI_SUCCESS The image has been unloaded.
1449 @retval EFI_UNSUPPORTED The image has been started, and does not support
1451 @retval EFI_INVALID_PARAMPETER ImageHandle is not a valid image handle.
1457 IN EFI_HANDLE ImageHandle
1463 Transfer control to a loaded image's entry point.
1465 @param ImageHandle Handle of image to be started.
1466 @param ExitDataSize Pointer of the size to ExitData
1467 @param ExitData Pointer to a pointer to a data buffer that
1468 includes a Null-terminated string,
1469 optionally followed by additional binary data.
1470 The string is a description that the caller may
1471 use to further indicate the reason for the
1474 @retval EFI_INVALID_PARAMETER Invalid parameter
1475 @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate
1476 @retval EFI_SECURITY_VIOLATION The current platform policy specifies that the image should not be started.
1477 @retval EFI_SUCCESS Successfully transfer control to the image's
1484 IN EFI_HANDLE ImageHandle
,
1485 OUT UINTN
*ExitDataSize
,
1486 OUT CHAR16
**ExitData OPTIONAL
1492 Terminates the currently loaded EFI image and returns control to boot services.
1494 @param ImageHandle Handle that identifies the image. This
1495 parameter is passed to the image on entry.
1496 @param Status The image's exit code.
1497 @param ExitDataSize The size, in bytes, of ExitData. Ignored if
1498 ExitStatus is EFI_SUCCESS.
1499 @param ExitData Pointer to a data buffer that includes a
1500 Null-terminated Unicode string, optionally
1501 followed by additional binary data. The string
1502 is a description that the caller may use to
1503 further indicate the reason for the image's
1506 @retval EFI_INVALID_PARAMETER Image handle is NULL or it is not current
1508 @retval EFI_SUCCESS Successfully terminates the currently loaded
1510 @retval EFI_ACCESS_DENIED Should never reach there.
1511 @retval EFI_OUT_OF_RESOURCES Could not allocate pool
1517 IN EFI_HANDLE ImageHandle
,
1518 IN EFI_STATUS Status
,
1519 IN UINTN ExitDataSize
,
1520 IN CHAR16
*ExitData OPTIONAL
1528 @param Type The type of event to create and its mode and
1530 @param NotifyTpl The task priority level of event notifications
1531 @param NotifyFunction Pointer to the events notification function
1532 @param NotifyContext Pointer to the notification functions context;
1533 corresponds to parameter "Context" in the
1534 notification function
1535 @param Event Pointer to the newly created event if the call
1536 succeeds; undefined otherwise
1538 @retval EFI_SUCCESS The event structure was created
1539 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value
1540 @retval EFI_OUT_OF_RESOURCES The event could not be allocated
1547 IN EFI_TPL NotifyTpl
,
1548 IN EFI_EVENT_NOTIFY NotifyFunction
, OPTIONAL
1549 IN VOID
*NotifyContext
, OPTIONAL
1550 OUT EFI_EVENT
*Event
1556 Creates an event in a group.
1558 @param Type The type of event to create and its mode and
1560 @param NotifyTpl The task priority level of event notifications
1561 @param NotifyFunction Pointer to the events notification function
1562 @param NotifyContext Pointer to the notification functions context;
1563 corresponds to parameter "Context" in the
1564 notification function
1565 @param EventGroup GUID for EventGroup if NULL act the same as
1567 @param Event Pointer to the newly created event if the call
1568 succeeds; undefined otherwise
1570 @retval EFI_SUCCESS The event structure was created
1571 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value
1572 @retval EFI_OUT_OF_RESOURCES The event could not be allocated
1579 IN EFI_TPL NotifyTpl
,
1580 IN EFI_EVENT_NOTIFY NotifyFunction
, OPTIONAL
1581 IN CONST VOID
*NotifyContext
, OPTIONAL
1582 IN CONST EFI_GUID
*EventGroup
, OPTIONAL
1583 OUT EFI_EVENT
*Event
1587 Creates a general-purpose event structure
1589 @param Type The type of event to create and its mode and
1591 @param NotifyTpl The task priority level of event notifications
1592 @param NotifyFunction Pointer to the events notification function
1593 @param NotifyContext Pointer to the notification functions context;
1594 corresponds to parameter "Context" in the
1595 notification function
1596 @param EventGroup GUID for EventGroup if NULL act the same as
1598 @param Event Pointer to the newly created event if the call
1599 succeeds; undefined otherwise
1601 @retval EFI_SUCCESS The event structure was created
1602 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value
1603 @retval EFI_OUT_OF_RESOURCES The event could not be allocated
1608 CoreCreateEventInternal (
1610 IN EFI_TPL NotifyTpl
,
1611 IN EFI_EVENT_NOTIFY NotifyFunction
, OPTIONAL
1612 IN CONST VOID
*NotifyContext
, OPTIONAL
1613 IN CONST EFI_GUID
*EventGroup
, OPTIONAL
1614 OUT EFI_EVENT
*Event
1618 Sets the type of timer and the trigger time for a timer event.
1620 @param UserEvent The timer event that is to be signaled at the
1622 @param Type The type of time that is specified in
1624 @param TriggerTime The number of 100ns units until the timer
1627 @retval EFI_SUCCESS The event has been set to be signaled at the
1629 @retval EFI_INVALID_PARAMETER Event or Type is not valid
1635 IN EFI_EVENT UserEvent
,
1636 IN EFI_TIMER_DELAY Type
,
1637 IN UINT64 TriggerTime
1643 Signals the event. Queues the event to be notified if needed.
1645 @param UserEvent The event to signal .
1647 @retval EFI_INVALID_PARAMETER Parameters are not valid.
1648 @retval EFI_SUCCESS The event was signaled.
1654 IN EFI_EVENT UserEvent
1660 Stops execution until an event is signaled.
1662 @param NumberOfEvents The number of events in the UserEvents array
1663 @param UserEvents An array of EFI_EVENT
1664 @param UserIndex Pointer to the index of the event which
1665 satisfied the wait condition
1667 @retval EFI_SUCCESS The event indicated by Index was signaled.
1668 @retval EFI_INVALID_PARAMETER The event indicated by Index has a notification
1669 function or Event was not a valid type
1670 @retval EFI_UNSUPPORTED The current TPL is not TPL_APPLICATION
1676 IN UINTN NumberOfEvents
,
1677 IN EFI_EVENT
*UserEvents
,
1678 OUT UINTN
*UserIndex
1684 Closes an event and frees the event structure.
1686 @param UserEvent Event to close
1688 @retval EFI_INVALID_PARAMETER Parameters are not valid.
1689 @retval EFI_SUCCESS The event has been closed
1695 IN EFI_EVENT UserEvent
1701 Check the status of an event.
1703 @param UserEvent The event to check
1705 @retval EFI_SUCCESS The event is in the signaled state
1706 @retval EFI_NOT_READY The event is not in the signaled state
1707 @retval EFI_INVALID_PARAMETER Event is of type EVT_NOTIFY_SIGNAL
1713 IN EFI_EVENT UserEvent
1718 Adds reserved memory, system memory, or memory-mapped I/O resources to the
1719 global coherency domain of the processor.
1721 @param GcdMemoryType Memory type of the memory space.
1722 @param BaseAddress Base address of the memory space.
1723 @param Length Length of the memory space.
1724 @param Capabilities alterable attributes of the memory space.
1726 @retval EFI_SUCCESS Merged this memory space into GCD map.
1731 CoreAddMemorySpace (
1732 IN EFI_GCD_MEMORY_TYPE GcdMemoryType
,
1733 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1735 IN UINT64 Capabilities
1740 Allocates nonexistent memory, reserved memory, system memory, or memorymapped
1741 I/O resources from the global coherency domain of the processor.
1743 @param GcdAllocateType The type of allocate operation
1744 @param GcdMemoryType The desired memory type
1745 @param Alignment Align with 2^Alignment
1746 @param Length Length to allocate
1747 @param BaseAddress Base address to allocate
1748 @param ImageHandle The image handle consume the allocated space.
1749 @param DeviceHandle The device handle consume the allocated space.
1751 @retval EFI_INVALID_PARAMETER Invalid parameter.
1752 @retval EFI_NOT_FOUND No descriptor contains the desired space.
1753 @retval EFI_SUCCESS Memory space successfully allocated.
1758 CoreAllocateMemorySpace (
1759 IN EFI_GCD_ALLOCATE_TYPE GcdAllocateType
,
1760 IN EFI_GCD_MEMORY_TYPE GcdMemoryType
,
1763 IN OUT EFI_PHYSICAL_ADDRESS
*BaseAddress
,
1764 IN EFI_HANDLE ImageHandle
,
1765 IN EFI_HANDLE DeviceHandle OPTIONAL
1770 Frees nonexistent memory, reserved memory, system memory, or memory-mapped
1771 I/O resources from the global coherency domain of the processor.
1773 @param BaseAddress Base address of the memory space.
1774 @param Length Length of the memory space.
1776 @retval EFI_SUCCESS Space successfully freed.
1781 CoreFreeMemorySpace (
1782 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1788 Removes reserved memory, system memory, or memory-mapped I/O resources from
1789 the global coherency domain of the processor.
1791 @param BaseAddress Base address of the memory space.
1792 @param Length Length of the memory space.
1794 @retval EFI_SUCCESS Successfully remove a segment of memory space.
1799 CoreRemoveMemorySpace (
1800 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1806 Retrieves the descriptor for a memory region containing a specified address.
1808 @param BaseAddress Specified start address
1809 @param Descriptor Specified length
1811 @retval EFI_INVALID_PARAMETER Invalid parameter
1812 @retval EFI_SUCCESS Successfully get memory space descriptor.
1817 CoreGetMemorySpaceDescriptor (
1818 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1819 OUT EFI_GCD_MEMORY_SPACE_DESCRIPTOR
*Descriptor
1824 Modifies the attributes for a memory region in the global coherency domain of the
1827 @param BaseAddress Specified start address
1828 @param Length Specified length
1829 @param Attributes Specified attributes
1831 @retval EFI_SUCCESS The attributes were set for the memory region.
1832 @retval EFI_INVALID_PARAMETER Length is zero.
1833 @retval EFI_UNSUPPORTED The processor does not support one or more bytes of the memory
1834 resource range specified by BaseAddress and Length.
1835 @retval EFI_UNSUPPORTED The bit mask of attributes is not support for the memory resource
1836 range specified by BaseAddress and Length.
1837 @retval EFI_ACCESS_DENIED The attributes for the memory resource range specified by
1838 BaseAddress and Length cannot be modified.
1839 @retval EFI_OUT_OF_RESOURCES There are not enough system resources to modify the attributes of
1840 the memory resource range.
1841 @retval EFI_NOT_AVAILABLE_YET The attributes cannot be set because CPU architectural protocol is
1847 CoreSetMemorySpaceAttributes (
1848 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1850 IN UINT64 Attributes
1855 Modifies the capabilities for a memory region in the global coherency domain of the
1858 @param BaseAddress The physical address that is the start address of a memory region.
1859 @param Length The size in bytes of the memory region.
1860 @param Capabilities The bit mask of capabilities that the memory region supports.
1862 @retval EFI_SUCCESS The capabilities were set for the memory region.
1863 @retval EFI_INVALID_PARAMETER Length is zero.
1864 @retval EFI_UNSUPPORTED The capabilities specified by Capabilities do not include the
1865 memory region attributes currently in use.
1866 @retval EFI_ACCESS_DENIED The capabilities 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 capabilities
1869 of the memory resource range.
1873 CoreSetMemorySpaceCapabilities (
1874 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1876 IN UINT64 Capabilities
1881 Returns a map of the memory resources in the global coherency domain of the
1884 @param NumberOfDescriptors Number of descriptors.
1885 @param MemorySpaceMap Descriptor array
1887 @retval EFI_INVALID_PARAMETER Invalid parameter
1888 @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate
1889 @retval EFI_SUCCESS Successfully get memory space map.
1894 CoreGetMemorySpaceMap (
1895 OUT UINTN
*NumberOfDescriptors
,
1896 OUT EFI_GCD_MEMORY_SPACE_DESCRIPTOR
**MemorySpaceMap
1901 Adds reserved I/O or I/O resources to the global coherency domain of the processor.
1903 @param GcdIoType IO type of the segment.
1904 @param BaseAddress Base address of the segment.
1905 @param Length Length of the segment.
1907 @retval EFI_SUCCESS Merged this segment into GCD map.
1908 @retval EFI_INVALID_PARAMETER Parameter not valid
1914 IN EFI_GCD_IO_TYPE GcdIoType
,
1915 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1921 Allocates nonexistent I/O, reserved I/O, or I/O resources from the global coherency
1922 domain of the processor.
1924 @param GcdAllocateType The type of allocate operation
1925 @param GcdIoType The desired IO type
1926 @param Alignment Align with 2^Alignment
1927 @param Length Length to allocate
1928 @param BaseAddress Base address to allocate
1929 @param ImageHandle The image handle consume the allocated space.
1930 @param DeviceHandle The device handle consume the allocated space.
1932 @retval EFI_INVALID_PARAMETER Invalid parameter.
1933 @retval EFI_NOT_FOUND No descriptor contains the desired space.
1934 @retval EFI_SUCCESS IO space successfully allocated.
1939 CoreAllocateIoSpace (
1940 IN EFI_GCD_ALLOCATE_TYPE GcdAllocateType
,
1941 IN EFI_GCD_IO_TYPE GcdIoType
,
1944 IN OUT EFI_PHYSICAL_ADDRESS
*BaseAddress
,
1945 IN EFI_HANDLE ImageHandle
,
1946 IN EFI_HANDLE DeviceHandle OPTIONAL
1951 Frees nonexistent I/O, reserved I/O, or I/O resources from the global coherency
1952 domain of the processor.
1954 @param BaseAddress Base address of the segment.
1955 @param Length Length of the segment.
1957 @retval EFI_SUCCESS Space successfully freed.
1963 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1969 Removes reserved I/O or I/O resources from the global coherency domain of the
1972 @param BaseAddress Base address of the segment.
1973 @param Length Length of the segment.
1975 @retval EFI_SUCCESS Successfully removed a segment of IO space.
1981 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1987 Retrieves the descriptor for an I/O region containing a specified address.
1989 @param BaseAddress Specified start address
1990 @param Descriptor Specified length
1992 @retval EFI_INVALID_PARAMETER Descriptor is NULL.
1993 @retval EFI_SUCCESS Successfully get the IO space descriptor.
1998 CoreGetIoSpaceDescriptor (
1999 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
2000 OUT EFI_GCD_IO_SPACE_DESCRIPTOR
*Descriptor
2005 Returns a map of the I/O resources in the global coherency domain of the processor.
2007 @param NumberOfDescriptors Number of descriptors.
2008 @param IoSpaceMap Descriptor array
2010 @retval EFI_INVALID_PARAMETER Invalid parameter
2011 @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate
2012 @retval EFI_SUCCESS Successfully get IO space map.
2018 OUT UINTN
*NumberOfDescriptors
,
2019 OUT EFI_GCD_IO_SPACE_DESCRIPTOR
**IoSpaceMap
2024 This is the main Dispatcher for DXE and it exits when there are no more
2025 drivers to run. Drain the mScheduledQueue and load and start a PE
2026 image for each driver. Search the mDiscoveredList to see if any driver can
2027 be placed on the mScheduledQueue. If no drivers are placed on the
2028 mScheduledQueue exit the function. On exit it is assumed the Bds()
2029 will be called, and when the Bds() exits the Dispatcher will be called
2032 @retval EFI_ALREADY_STARTED The DXE Dispatcher is already running
2033 @retval EFI_NOT_FOUND No DXE Drivers were dispatched
2034 @retval EFI_SUCCESS One or more DXE Drivers were dispatched
2044 Check every driver and locate a matching one. If the driver is found, the Unrequested
2045 state flag is cleared.
2047 @param FirmwareVolumeHandle The handle of the Firmware Volume that contains
2048 the firmware file specified by DriverName.
2049 @param DriverName The Driver name to put in the Dependent state.
2051 @retval EFI_SUCCESS The DriverName was found and it's SOR bit was
2053 @retval EFI_NOT_FOUND The DriverName does not exist or it's SOR bit was
2060 IN EFI_HANDLE FirmwareVolumeHandle
,
2061 IN EFI_GUID
*DriverName
2066 Convert a driver from the Untrused back to the Scheduled state.
2068 @param FirmwareVolumeHandle The handle of the Firmware Volume that contains
2069 the firmware file specified by DriverName.
2070 @param DriverName The Driver name to put in the Scheduled state
2072 @retval EFI_SUCCESS The file was found in the untrusted state, and it
2073 was promoted to the trusted state.
2074 @retval EFI_NOT_FOUND The file was not found in the untrusted state.
2080 IN EFI_HANDLE FirmwareVolumeHandle
,
2081 IN EFI_GUID
*DriverName
2086 This routine is the driver initialization entry point. It initializes the
2087 libraries, and registers two notification functions. These notification
2088 functions are responsible for building the FV stack dynamically.
2090 @param ImageHandle The image handle.
2091 @param SystemTable The system table.
2093 @retval EFI_SUCCESS Function successfully returned.
2099 IN EFI_HANDLE ImageHandle
,
2100 IN EFI_SYSTEM_TABLE
*SystemTable
2105 Entry point of the section extraction code. Initializes an instance of the
2106 section extraction interface and installs it on a new handle.
2108 @param ImageHandle A handle for the image that is initializing this driver
2109 @param SystemTable A pointer to the EFI system table
2111 @retval EFI_SUCCESS Driver initialized successfully
2112 @retval EFI_OUT_OF_RESOURCES Could not allocate needed resources
2117 InitializeSectionExtraction (
2118 IN EFI_HANDLE ImageHandle
,
2119 IN EFI_SYSTEM_TABLE
*SystemTable
2124 This DXE service routine is used to process a firmware volume. In
2125 particular, it can be called by BDS to process a single firmware
2126 volume found in a capsule.
2128 @param FvHeader pointer to a firmware volume header
2129 @param Size the size of the buffer pointed to by FvHeader
2130 @param FVProtocolHandle the handle on which a firmware volume protocol
2131 was produced for the firmware volume passed in.
2133 @retval EFI_OUT_OF_RESOURCES if an FVB could not be produced due to lack of
2135 @retval EFI_VOLUME_CORRUPTED if the volume was corrupted
2136 @retval EFI_SUCCESS a firmware volume protocol was produced for the
2142 CoreProcessFirmwareVolume (
2145 OUT EFI_HANDLE
*FVProtocolHandle
2149 //Functions used during debug buils
2153 Displays Architectural protocols that were not loaded and are required for DXE
2154 core to function. Only used in Debug Builds.
2158 CoreDisplayMissingArchProtocols (
2164 Traverse the discovered list for any drivers that were discovered but not loaded
2165 because the dependency experessions evaluated to false.
2169 CoreDisplayDiscoveredNotDispatched (
2176 Place holder function until all the Boot Services and Runtime Services are
2179 @param Arg1 Undefined
2181 @return EFI_NOT_AVAILABLE_YET
2186 CoreEfiNotAvailableYetArg1 (
2192 Place holder function until all the Boot Services and Runtime Services are available.
2194 @param Arg1 Undefined
2195 @param Arg2 Undefined
2197 @return EFI_NOT_AVAILABLE_YET
2202 CoreEfiNotAvailableYetArg2 (
2209 Place holder function until all the Boot Services and Runtime Services are available.
2211 @param Arg1 Undefined
2212 @param Arg2 Undefined
2213 @param Arg3 Undefined
2215 @return EFI_NOT_AVAILABLE_YET
2220 CoreEfiNotAvailableYetArg3 (
2228 Place holder function until all the Boot Services and Runtime Services are available.
2230 @param Arg1 Undefined
2231 @param Arg2 Undefined
2232 @param Arg3 Undefined
2233 @param Arg4 Undefined
2235 @return EFI_NOT_AVAILABLE_YET
2240 CoreEfiNotAvailableYetArg4 (
2249 Place holder function until all the Boot Services and Runtime Services are available.
2251 @param Arg1 Undefined
2252 @param Arg2 Undefined
2253 @param Arg3 Undefined
2254 @param Arg4 Undefined
2255 @param Arg5 Undefined
2257 @return EFI_NOT_AVAILABLE_YET
2262 CoreEfiNotAvailableYetArg5 (
2272 Given a compressed source buffer, this function retrieves the size of the
2273 uncompressed buffer and the size of the scratch buffer required to decompress
2274 the compressed source buffer.
2276 The GetInfo() function retrieves the size of the uncompressed buffer and the
2277 temporary scratch buffer required to decompress the buffer specified by Source
2278 and SourceSize. If the size of the uncompressed buffer or the size of the
2279 scratch buffer cannot be determined from the compressed data specified by
2280 Source and SourceData, then EFI_INVALID_PARAMETER is returned. Otherwise, the
2281 size of the uncompressed buffer is returned in DestinationSize, the size of
2282 the scratch buffer is returned in ScratchSize, and EFI_SUCCESS is returned.
2283 The GetInfo() function does not have scratch buffer available to perform a
2284 thorough checking of the validity of the source data. It just retrieves the
2285 "Original Size" field from the beginning bytes of the source data and output
2286 it as DestinationSize. And ScratchSize is specific to the decompression
2289 @param This A pointer to the EFI_DECOMPRESS_PROTOCOL instance.
2290 @param Source The source buffer containing the compressed data.
2291 @param SourceSize The size, in bytes, of the source buffer.
2292 @param DestinationSize A pointer to the size, in bytes, of the
2293 uncompressed buffer that will be generated when the
2294 compressed buffer specified by Source and
2295 SourceSize is decompressed.
2296 @param ScratchSize A pointer to the size, in bytes, of the scratch
2297 buffer that is required to decompress the
2298 compressed buffer specified by Source and
2301 @retval EFI_SUCCESS The size of the uncompressed data was returned in
2302 DestinationSize and the size of the scratch buffer
2303 was returned in ScratchSize.
2304 @retval EFI_INVALID_PARAMETER The size of the uncompressed data or the size of
2305 the scratch buffer cannot be determined from the
2306 compressed data specified by Source and
2312 DxeMainUefiDecompressGetInfo (
2313 IN EFI_DECOMPRESS_PROTOCOL
*This
,
2315 IN UINT32 SourceSize
,
2316 OUT UINT32
*DestinationSize
,
2317 OUT UINT32
*ScratchSize
2322 Decompresses a compressed source buffer.
2324 The Decompress() function extracts decompressed data to its original form.
2325 This protocol is designed so that the decompression algorithm can be
2326 implemented without using any memory services. As a result, the Decompress()
2327 Function is not allowed to call AllocatePool() or AllocatePages() in its
2328 implementation. It is the caller's responsibility to allocate and free the
2329 Destination and Scratch buffers.
2330 If the compressed source data specified by Source and SourceSize is
2331 sucessfully decompressed into Destination, then EFI_SUCCESS is returned. If
2332 the compressed source data specified by Source and SourceSize is not in a
2333 valid compressed data format, then EFI_INVALID_PARAMETER is returned.
2335 @param This A pointer to the EFI_DECOMPRESS_PROTOCOL instance.
2336 @param Source The source buffer containing the compressed data.
2337 @param SourceSize SourceSizeThe size of source data.
2338 @param Destination On output, the destination buffer that contains
2339 the uncompressed data.
2340 @param DestinationSize The size of the destination buffer. The size of
2341 the destination buffer needed is obtained from
2342 EFI_DECOMPRESS_PROTOCOL.GetInfo().
2343 @param Scratch A temporary scratch buffer that is used to perform
2345 @param ScratchSize The size of scratch buffer. The size of the
2346 scratch buffer needed is obtained from GetInfo().
2348 @retval EFI_SUCCESS Decompression completed successfully, and the
2349 uncompressed buffer is returned in Destination.
2350 @retval EFI_INVALID_PARAMETER The source buffer specified by Source and
2351 SourceSize is corrupted (not in a valid
2357 DxeMainUefiDecompress (
2358 IN EFI_DECOMPRESS_PROTOCOL
*This
,
2360 IN UINT32 SourceSize
,
2361 IN OUT VOID
*Destination
,
2362 IN UINT32 DestinationSize
,
2363 IN OUT VOID
*Scratch
,
2364 IN UINT32 ScratchSize
2368 SEP member function. This function creates and returns a new section stream
2369 handle to represent the new section stream.
2371 @param SectionStreamLength Size in bytes of the section stream.
2372 @param SectionStream Buffer containing the new section stream.
2373 @param SectionStreamHandle A pointer to a caller allocated UINTN that on
2374 output contains the new section stream handle.
2376 @retval EFI_SUCCESS The section stream is created successfully.
2377 @retval EFI_OUT_OF_RESOURCES memory allocation failed.
2378 @retval EFI_INVALID_PARAMETER Section stream does not end concident with end
2385 IN UINTN SectionStreamLength
,
2386 IN VOID
*SectionStream
,
2387 OUT UINTN
*SectionStreamHandle
2393 SEP member function. Retrieves requested section from section stream.
2395 @param SectionStreamHandle The section stream from which to extract the
2397 @param SectionType A pointer to the type of section to search for.
2398 @param SectionDefinitionGuid If the section type is EFI_SECTION_GUID_DEFINED,
2399 then SectionDefinitionGuid indicates which of
2400 these types of sections to search for.
2401 @param SectionInstance Indicates which instance of the requested
2403 @param Buffer Double indirection to buffer. If *Buffer is
2404 non-null on input, then the buffer is caller
2405 allocated. If Buffer is NULL, then the buffer
2406 is callee allocated. In either case, the
2407 required buffer size is returned in *BufferSize.
2408 @param BufferSize On input, indicates the size of *Buffer if
2409 *Buffer is non-null on input. On output,
2410 indicates the required size (allocated size if
2411 callee allocated) of *Buffer.
2412 @param AuthenticationStatus A pointer to a caller-allocated UINT32 that
2413 indicates the authentication status of the
2414 output buffer. If the input section's
2415 GuidedSectionHeader.Attributes field
2416 has the EFI_GUIDED_SECTION_AUTH_STATUS_VALID
2417 bit as clear, AuthenticationStatus must return
2418 zero. Both local bits (19:16) and aggregate
2419 bits (3:0) in AuthenticationStatus are returned
2420 by ExtractSection(). These bits reflect the
2421 status of the extraction operation. The bit
2422 pattern in both regions must be the same, as
2423 the local and aggregate authentication statuses
2424 have equivalent meaning at this level. If the
2425 function returns anything other than
2426 EFI_SUCCESS, the value of *AuthenticationStatus
2428 @param IsFfs3Fv Indicates the FV format.
2430 @retval EFI_SUCCESS Section was retrieved successfully
2431 @retval EFI_PROTOCOL_ERROR A GUID defined section was encountered in the
2432 section stream with its
2433 EFI_GUIDED_SECTION_PROCESSING_REQUIRED bit set,
2434 but there was no corresponding GUIDed Section
2435 Extraction Protocol in the handle database.
2436 *Buffer is unmodified.
2437 @retval EFI_NOT_FOUND An error was encountered when parsing the
2438 SectionStream. This indicates the SectionStream
2439 is not correctly formatted.
2440 @retval EFI_NOT_FOUND The requested section does not exist.
2441 @retval EFI_OUT_OF_RESOURCES The system has insufficient resources to process
2443 @retval EFI_INVALID_PARAMETER The SectionStreamHandle does not exist.
2444 @retval EFI_WARN_TOO_SMALL The size of the caller allocated input buffer is
2445 insufficient to contain the requested section.
2446 The input buffer is filled and section contents
2453 IN UINTN SectionStreamHandle
,
2454 IN EFI_SECTION_TYPE
*SectionType
,
2455 IN EFI_GUID
*SectionDefinitionGuid
,
2456 IN UINTN SectionInstance
,
2458 IN OUT UINTN
*BufferSize
,
2459 OUT UINT32
*AuthenticationStatus
,
2465 SEP member function. Deletes an existing section stream
2467 @param StreamHandleToClose Indicates the stream to close
2468 @param FreeStreamBuffer TRUE - Need to free stream buffer;
2469 FALSE - No need to free stream buffer.
2471 @retval EFI_SUCCESS The section stream is closed sucessfully.
2472 @retval EFI_OUT_OF_RESOURCES Memory allocation failed.
2473 @retval EFI_INVALID_PARAMETER Section stream does not end concident with end
2479 CloseSectionStream (
2480 IN UINTN StreamHandleToClose
,
2481 IN BOOLEAN FreeStreamBuffer
2485 Creates and initializes the DebugImageInfo Table. Also creates the configuration
2486 table and registers it into the system table.
2489 This function allocates memory, frees it, and then allocates memory at an
2490 address within the initial allocation. Since this function is called early
2491 in DXE core initialization (before drivers are dispatched), this should not
2496 CoreInitializeDebugImageInfoTable (
2502 Update the CRC32 in the Debug Table.
2503 Since the CRC32 service is made available by the Runtime driver, we have to
2504 wait for the Runtime Driver to be installed before the CRC32 can be computed.
2505 This function is called elsewhere by the core when the runtime architectural
2506 protocol is produced.
2510 CoreUpdateDebugTableCrc32 (
2516 Adds a new DebugImageInfo structure to the DebugImageInfo Table. Re-Allocates
2517 the table if it's not large enough to accomidate another entry.
2519 @param ImageInfoType type of debug image information
2520 @param LoadedImage pointer to the loaded image protocol for the image being
2522 @param ImageHandle image handle for the image being loaded
2526 CoreNewDebugImageInfoEntry (
2527 IN UINT32 ImageInfoType
,
2528 IN EFI_LOADED_IMAGE_PROTOCOL
*LoadedImage
,
2529 IN EFI_HANDLE ImageHandle
2534 Removes and frees an entry from the DebugImageInfo Table.
2536 @param ImageHandle image handle for the image being unloaded
2540 CoreRemoveDebugImageInfoEntry (
2541 EFI_HANDLE ImageHandle
2546 This routine consumes FV hobs and produces instances of FW_VOL_BLOCK_PROTOCOL as appropriate.
2548 @param ImageHandle The image handle.
2549 @param SystemTable The system table.
2551 @retval EFI_SUCCESS Successfully initialized firmware volume block
2557 FwVolBlockDriverInit (
2558 IN EFI_HANDLE ImageHandle
,
2559 IN EFI_SYSTEM_TABLE
*SystemTable
2564 Get FVB authentication status
2566 @param FvbProtocol FVB protocol.
2568 @return Authentication status.
2572 GetFvbAuthenticationStatus (
2573 IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL
*FvbProtocol
2577 This routine produces a firmware volume block protocol on a given
2580 @param BaseAddress base address of the firmware volume image
2581 @param Length length of the firmware volume image
2582 @param ParentHandle handle of parent firmware volume, if this image
2583 came from an FV image file and section in another firmware
2584 volume (ala capsules)
2585 @param AuthenticationStatus Authentication status inherited, if this image
2586 came from an FV image file and section in another firmware volume.
2587 @param FvProtocol Firmware volume block protocol produced.
2589 @retval EFI_VOLUME_CORRUPTED Volume corrupted.
2590 @retval EFI_OUT_OF_RESOURCES No enough buffer to be allocated.
2591 @retval EFI_SUCCESS Successfully produced a FVB protocol on given
2596 ProduceFVBProtocolOnBuffer (
2597 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
2599 IN EFI_HANDLE ParentHandle
,
2600 IN UINT32 AuthenticationStatus
,
2601 OUT EFI_HANDLE
*FvProtocol OPTIONAL
2606 Raising to the task priority level of the mutual exclusion
2607 lock, and then acquires ownership of the lock.
2609 @param Lock The lock to acquire
2621 Initialize a basic mutual exclusion lock. Each lock
2622 provides mutual exclusion access at it's task priority
2623 level. Since there is no-premption (at any TPL) or
2624 multiprocessor support, acquiring the lock only consists
2625 of raising to the locks TPL.
2627 @param Lock The EFI_LOCK structure to initialize
2629 @retval EFI_SUCCESS Lock Owned.
2630 @retval EFI_ACCESS_DENIED Reentrant Lock Acquisition, Lock not Owned.
2634 CoreAcquireLockOrFail (
2640 Releases ownership of the mutual exclusion lock, and
2641 restores the previous task priority level.
2643 @param Lock The lock to release
2645 @return Lock unowned
2654 Read data from Firmware Block by FVB protocol Read.
2655 The data may cross the multi block ranges.
2657 @param Fvb The FW_VOL_BLOCK_PROTOCOL instance from which to read data.
2658 @param StartLba Pointer to StartLba.
2659 On input, the start logical block index from which to read.
2660 On output,the end logical block index after reading.
2661 @param Offset Pointer to Offset
2662 On input, offset into the block at which to begin reading.
2663 On output, offset into the end block after reading.
2664 @param DataSize Size of data to be read.
2665 @param Data Pointer to Buffer that the data will be read into.
2667 @retval EFI_SUCCESS Successfully read data from firmware block.
2672 IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL
*Fvb
,
2673 IN OUT EFI_LBA
*StartLba
,
2674 IN OUT UINTN
*Offset
,
2680 Given the supplied FW_VOL_BLOCK_PROTOCOL, allocate a buffer for output and
2681 copy the real length volume header into it.
2683 @param Fvb The FW_VOL_BLOCK_PROTOCOL instance from which to
2684 read the volume header
2685 @param FwVolHeader Pointer to pointer to allocated buffer in which
2686 the volume header is returned.
2688 @retval EFI_OUT_OF_RESOURCES No enough buffer could be allocated.
2689 @retval EFI_SUCCESS Successfully read volume header to the allocated
2691 @retval EFI_INVALID_PARAMETER The FV Header signature is not as expected or
2692 the file system could not be understood.
2697 IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL
*Fvb
,
2698 OUT EFI_FIRMWARE_VOLUME_HEADER
**FwVolHeader
2702 Verify checksum of the firmware volume header.
2704 @param FvHeader Points to the firmware volume header to be checked
2706 @retval TRUE Checksum verification passed
2707 @retval FALSE Checksum verification failed
2711 VerifyFvHeaderChecksum (
2712 IN EFI_FIRMWARE_VOLUME_HEADER
*FvHeader
2716 Initialize memory profile.
2718 @param HobStart The start address of the HOB.
2727 Install memory profile protocol.
2731 MemoryProfileInstallProtocol (
2736 Register image to memory profile.
2738 @param DriverEntry Image info.
2739 @param FileType Image file type.
2741 @return EFI_SUCCESS Register successfully.
2742 @return EFI_UNSUPPORTED Memory profile unsupported,
2743 or memory profile for the image is not required.
2744 @return EFI_OUT_OF_RESOURCES No enough resource for this register.
2748 RegisterMemoryProfileImage (
2749 IN LOADED_IMAGE_PRIVATE_DATA
*DriverEntry
,
2750 IN EFI_FV_FILETYPE FileType
2754 Unregister image from memory profile.
2756 @param DriverEntry Image info.
2758 @return EFI_SUCCESS Unregister successfully.
2759 @return EFI_UNSUPPORTED Memory profile unsupported,
2760 or memory profile for the image is not required.
2761 @return EFI_NOT_FOUND The image is not found.
2765 UnregisterMemoryProfileImage (
2766 IN LOADED_IMAGE_PRIVATE_DATA
*DriverEntry
2770 Update memory profile information.
2772 @param CallerAddress Address of caller who call Allocate or Free.
2773 @param Action This Allocate or Free action.
2774 @param MemoryType Memory type.
2775 EfiMaxMemoryType means the MemoryType is unknown.
2776 @param Size Buffer size.
2777 @param Buffer Buffer address.
2778 @param ActionString String for memory profile action.
2779 Only needed for user defined allocate action.
2781 @return EFI_SUCCESS Memory profile is updated.
2782 @return EFI_UNSUPPORTED Memory profile is unsupported,
2783 or memory profile for the image is not required,
2784 or memory profile for the memory type is not required.
2785 @return EFI_ACCESS_DENIED It is during memory profile data getting.
2786 @return EFI_ABORTED Memory profile recording is not enabled.
2787 @return EFI_OUT_OF_RESOURCES No enough resource to update memory profile for allocate action.
2788 @return EFI_NOT_FOUND No matched allocate info found for free action.
2794 IN EFI_PHYSICAL_ADDRESS CallerAddress
,
2795 IN MEMORY_PROFILE_ACTION Action
,
2796 IN EFI_MEMORY_TYPE MemoryType
,
2797 IN UINTN Size
, // Valid for AllocatePages/FreePages/AllocatePool
2799 IN CHAR8
*ActionString OPTIONAL
2803 Internal function. Converts a memory range to use new attributes.
2805 @param Start The first address of the range Must be page
2807 @param NumberOfPages The number of pages to convert
2808 @param NewAttributes The new attributes value for the range.
2812 CoreUpdateMemoryAttributes (
2813 IN EFI_PHYSICAL_ADDRESS Start
,
2814 IN UINT64 NumberOfPages
,
2815 IN UINT64 NewAttributes
2819 Initialize PropertiesTable support.
2823 CoreInitializePropertiesTable (
2828 Initialize MemoryAttrubutesTable support.
2832 CoreInitializeMemoryAttributesTable (
2837 Initialize Memory Protection support.
2841 CoreInitializeMemoryProtection (
2846 Install MemoryAttributesTable on memory allocation.
2848 @param[in] MemoryType EFI memory type.
2851 InstallMemoryAttributesTableOnMemoryAllocation (
2852 IN EFI_MEMORY_TYPE MemoryType
2856 Insert image record.
2858 @param RuntimeImage Runtime image information
2862 IN EFI_RUNTIME_IMAGE_ENTRY
*RuntimeImage
2866 Remove Image record.
2868 @param RuntimeImage Runtime image information
2872 IN EFI_RUNTIME_IMAGE_ENTRY
*RuntimeImage
2878 @param[in] LoadedImage The loaded image protocol
2879 @param[in] LoadedImageDevicePath The loaded image device path protocol
2883 IN EFI_LOADED_IMAGE_PROTOCOL
*LoadedImage
,
2884 IN EFI_DEVICE_PATH_PROTOCOL
*LoadedImageDevicePath
2888 Unprotect UEFI image.
2890 @param[in] LoadedImage The loaded image protocol
2891 @param[in] LoadedImageDevicePath The loaded image device path protocol
2894 UnprotectUefiImage (
2895 IN EFI_LOADED_IMAGE_PROTOCOL
*LoadedImage
,
2896 IN EFI_DEVICE_PATH_PROTOCOL
*LoadedImageDevicePath
2900 ExitBootServices Callback function for memory protection.
2903 MemoryProtectionExitBootServicesCallback (
2908 Manage memory permission attributes on a memory range, according to the
2909 configured DXE memory protection policy.
2911 @param OldType The old memory type of the range
2912 @param NewType The new memory type of the range
2913 @param Memory The base address of the range
2914 @param Length The size of the range (in bytes)
2916 @return EFI_SUCCESS If the the CPU arch protocol is not installed yet
2917 @return EFI_SUCCESS If no DXE memory protection policy has been configured
2918 @return EFI_SUCCESS If OldType and NewType use the same permission attributes
2919 @return other Return value of gCpu->SetMemoryAttributes()
2924 ApplyMemoryProtectionPolicy (
2925 IN EFI_MEMORY_TYPE OldType
,
2926 IN EFI_MEMORY_TYPE NewType
,
2927 IN EFI_PHYSICAL_ADDRESS Memory
,
2932 Merge continous memory map entries whose have same attributes.
2934 @param MemoryMap A pointer to the buffer in which firmware places
2935 the current memory map.
2936 @param MemoryMapSize A pointer to the size, in bytes, of the
2937 MemoryMap buffer. On input, this is the size of
2938 the current memory map. On output,
2939 it is the size of new memory map after merge.
2940 @param DescriptorSize Size, in bytes, of an individual EFI_MEMORY_DESCRIPTOR.
2944 IN OUT EFI_MEMORY_DESCRIPTOR
*MemoryMap
,
2945 IN OUT UINTN
*MemoryMapSize
,
2946 IN UINTN DescriptorSize