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 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
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.
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/MemoryProfile.h>
74 #include <Library/DxeCoreEntryPoint.h>
75 #include <Library/DebugLib.h>
76 #include <Library/UefiLib.h>
77 #include <Library/BaseLib.h>
78 #include <Library/HobLib.h>
79 #include <Library/PerformanceLib.h>
80 #include <Library/UefiDecompressLib.h>
81 #include <Library/ExtractGuidedSectionLib.h>
82 #include <Library/CacheMaintenanceLib.h>
83 #include <Library/BaseMemoryLib.h>
84 #include <Library/PeCoffLib.h>
85 #include <Library/PeCoffGetEntryPointLib.h>
86 #include <Library/PeCoffExtraActionLib.h>
87 #include <Library/PcdLib.h>
88 #include <Library/MemoryAllocationLib.h>
89 #include <Library/DevicePathLib.h>
90 #include <Library/UefiBootServicesTableLib.h>
91 #include <Library/ReportStatusCodeLib.h>
92 #include <Library/DxeServicesLib.h>
93 #include <Library/DebugAgentLib.h>
94 #include <Library/CpuExceptionHandlerLib.h>
98 // attributes for reserved memory before it is promoted to system memory
100 #define EFI_MEMORY_PRESENT 0x0100000000000000ULL
101 #define EFI_MEMORY_INITIALIZED 0x0200000000000000ULL
102 #define EFI_MEMORY_TESTED 0x0400000000000000ULL
105 // range for memory mapped port I/O on IPF
107 #define EFI_MEMORY_PORT_IO 0x4000000000000000ULL
111 /// EFI_DEP_REPLACE_TRUE - Used to dynamically patch the dependency expression
112 /// to save time. A EFI_DEP_PUSH is evaluated one an
113 /// replaced with EFI_DEP_REPLACE_TRUE. If PI spec's Vol 2
114 /// Driver Execution Environment Core Interface use 0xff
115 /// as new DEPEX opcode. EFI_DEP_REPLACE_TRUE should be
116 /// defined to a new value that is not conflicting with PI spec.
118 #define EFI_DEP_REPLACE_TRUE 0xff
121 /// Define the initial size of the dependency expression evaluation stack
123 #define DEPEX_STACK_SIZE_INCREMENT 0x1000
126 EFI_GUID
*ProtocolGuid
;
131 } EFI_CORE_PROTOCOL_NOTIFY_ENTRY
;
134 // DXE Dispatcher Data structures
137 #define KNOWN_HANDLE_SIGNATURE SIGNATURE_32('k','n','o','w')
140 LIST_ENTRY Link
; // mFvHandleList
146 #define EFI_CORE_DRIVER_ENTRY_SIGNATURE SIGNATURE_32('d','r','v','r')
149 LIST_ENTRY Link
; // mDriverList
151 LIST_ENTRY ScheduledLink
; // mScheduledQueue
155 EFI_DEVICE_PATH_PROTOCOL
*FvFileDevicePath
;
156 EFI_FIRMWARE_VOLUME2_PROTOCOL
*Fv
;
163 EFI_GUID BeforeAfterGuid
;
170 BOOLEAN DepexProtocolError
;
172 EFI_HANDLE ImageHandle
;
175 } EFI_CORE_DRIVER_ENTRY
;
178 //The data structure of GCD memory map entry
180 #define EFI_GCD_MAP_SIGNATURE SIGNATURE_32('g','c','d','m')
184 EFI_PHYSICAL_ADDRESS BaseAddress
;
188 EFI_GCD_MEMORY_TYPE GcdMemoryType
;
189 EFI_GCD_IO_TYPE GcdIoType
;
190 EFI_HANDLE ImageHandle
;
191 EFI_HANDLE DeviceHandle
;
195 #define LOADED_IMAGE_PRIVATE_DATA_SIGNATURE SIGNATURE_32('l','d','r','i')
203 /// If entrypoint has been called
205 /// The image's entry point
206 EFI_IMAGE_ENTRY_POINT EntryPoint
;
207 /// loaded image protocol
208 EFI_LOADED_IMAGE_PROTOCOL Info
;
209 /// Location in memory
210 EFI_PHYSICAL_ADDRESS ImageBasePage
;
213 /// Original fixup data
215 /// Tpl of started image
217 /// Status returned by started image
219 /// Size of ExitData from started image
221 /// Pointer to exit data from started image
223 /// Pointer to pool allocation for context save/restore
225 /// Pointer to buffer for context save/restore
226 BASE_LIBRARY_JUMP_BUFFER
*JumpContext
;
227 /// Machine type from PE image
229 /// EBC Protocol pointer
230 EFI_EBC_PROTOCOL
*Ebc
;
231 /// Runtime image list
232 EFI_RUNTIME_IMAGE_ENTRY
*RuntimeData
;
233 /// Pointer to Loaded Image Device Path Protocol
234 EFI_DEVICE_PATH_PROTOCOL
*LoadedImageDevicePath
;
235 /// PeCoffLoader ImageContext
236 PE_COFF_LOADER_IMAGE_CONTEXT ImageContext
;
237 /// Status returned by LoadImage() service.
238 EFI_STATUS LoadImageStatus
;
239 } LOADED_IMAGE_PRIVATE_DATA
;
241 #define LOADED_IMAGE_PRIVATE_DATA_FROM_THIS(a) \
242 CR(a, LOADED_IMAGE_PRIVATE_DATA, Info, LOADED_IMAGE_PRIVATE_DATA_SIGNATURE)
244 #define IMAGE_PROPERTIES_RECORD_CODE_SECTION_SIGNATURE SIGNATURE_32 ('I','P','R','C')
249 EFI_PHYSICAL_ADDRESS CodeSegmentBase
;
250 UINT64 CodeSegmentSize
;
251 } IMAGE_PROPERTIES_RECORD_CODE_SECTION
;
253 #define IMAGE_PROPERTIES_RECORD_SIGNATURE SIGNATURE_32 ('I','P','R','D')
258 EFI_PHYSICAL_ADDRESS ImageBase
;
260 UINTN CodeSegmentCount
;
261 LIST_ENTRY CodeSegmentList
;
262 } IMAGE_PROPERTIES_RECORD
;
265 // DXE Core Global Variables
267 extern EFI_SYSTEM_TABLE
*gDxeCoreST
;
268 extern EFI_RUNTIME_SERVICES
*gDxeCoreRT
;
269 extern EFI_DXE_SERVICES
*gDxeCoreDS
;
270 extern EFI_HANDLE gDxeCoreImageHandle
;
272 extern BOOLEAN gMemoryMapTerminated
;
274 extern EFI_DECOMPRESS_PROTOCOL gEfiDecompress
;
276 extern EFI_RUNTIME_ARCH_PROTOCOL
*gRuntime
;
277 extern EFI_CPU_ARCH_PROTOCOL
*gCpu
;
278 extern EFI_WATCHDOG_TIMER_ARCH_PROTOCOL
*gWatchdogTimer
;
279 extern EFI_METRONOME_ARCH_PROTOCOL
*gMetronome
;
280 extern EFI_TIMER_ARCH_PROTOCOL
*gTimer
;
281 extern EFI_SECURITY_ARCH_PROTOCOL
*gSecurity
;
282 extern EFI_SECURITY2_ARCH_PROTOCOL
*gSecurity2
;
283 extern EFI_BDS_ARCH_PROTOCOL
*gBds
;
284 extern EFI_SMM_BASE2_PROTOCOL
*gSmmBase2
;
286 extern EFI_TPL gEfiCurrentTpl
;
288 extern EFI_GUID
*gDxeCoreFileName
;
289 extern EFI_LOADED_IMAGE_PROTOCOL
*gDxeCoreLoadedImage
;
291 extern EFI_MEMORY_TYPE_INFORMATION gMemoryTypeInformation
[EfiMaxMemoryType
+ 1];
293 extern BOOLEAN gDispatcherRunning
;
294 extern EFI_RUNTIME_ARCH_PROTOCOL gRuntimeTemplate
;
296 extern EFI_LOAD_FIXED_ADDRESS_CONFIGURATION_TABLE gLoadModuleAtFixAddressConfigurationTable
;
297 extern BOOLEAN gLoadFixedAddressCodeMemoryReady
;
299 // Service Initialization Functions
305 Called to initialize the pool.
315 Called to initialize the memory map and add descriptors to
316 the current descriptor list.
317 The first descriptor that is added must be general usable
318 memory as the addition allocates heap.
320 @param Type The type of memory to add
321 @param Start The starting address in the memory range Must be
323 @param NumberOfPages The number of pages in the range
324 @param Attribute Attributes of the memory to add
326 @return None. The range is added to the memory map
330 CoreAddMemoryDescriptor (
331 IN EFI_MEMORY_TYPE Type
,
332 IN EFI_PHYSICAL_ADDRESS Start
,
333 IN UINT64 NumberOfPages
,
339 Release memory lock on mGcdMemorySpaceLock.
343 CoreReleaseGcdMemoryLock (
349 Acquire memory lock on mGcdMemorySpaceLock.
353 CoreAcquireGcdMemoryLock (
359 External function. Initializes memory services based on the memory
360 descriptor HOBs. This function is responsible for priming the memory
361 map, so memory allocations and resource allocations can be made.
362 The first part of this function can not depend on any memory services
363 until at least one memory descriptor is provided to the memory services.
365 @param HobStart The start address of the HOB.
366 @param MemoryBaseAddress Start address of memory region found to init DXE
368 @param MemoryLength Length of memory region found to init DXE core.
370 @retval EFI_SUCCESS Memory services successfully initialized.
374 CoreInitializeMemoryServices (
376 OUT EFI_PHYSICAL_ADDRESS
*MemoryBaseAddress
,
377 OUT UINT64
*MemoryLength
383 External function. Initializes the GCD and memory services based on the memory
384 descriptor HOBs. This function is responsible for priming the GCD map and the
385 memory map, so memory allocations and resource allocations can be made. The
386 HobStart will be relocated to a pool buffer.
388 @param HobStart The start address of the HOB
389 @param MemoryBaseAddress Start address of memory region found to init DXE
391 @param MemoryLength Length of memory region found to init DXE core.
393 @retval EFI_SUCCESS GCD services successfully initialized.
397 CoreInitializeGcdServices (
398 IN OUT VOID
**HobStart
,
399 IN EFI_PHYSICAL_ADDRESS MemoryBaseAddress
,
400 IN UINT64 MemoryLength
405 Initializes "event" support.
407 @retval EFI_SUCCESS Always return success
411 CoreInitializeEventServices (
417 Add the Image Services to EFI Boot Services Table and install the protocol
418 interfaces for this image.
420 @param HobStart The HOB to initialize
426 CoreInitializeImageServices (
432 Creates an event that is fired everytime a Protocol of a specific type is installed.
436 CoreNotifyOnProtocolInstallation (
442 Return TRUE if all AP services are available.
444 @retval EFI_SUCCESS All AP services are available
445 @retval EFI_NOT_FOUND At least one AP service is not available
449 CoreAllEfiServicesAvailable (
455 Calcualte the 32-bit CRC in a EFI table using the service provided by the
458 @param Hdr Pointer to an EFI standard header
463 IN OUT EFI_TABLE_HEADER
*Hdr
468 Called by the platform code to process a tick.
470 @param Duration The number of 100ns elapsed since the last call
482 Initialize the dispatcher. Initialize the notification function that runs when
483 an FV2 protocol is added to the system.
487 CoreInitializeDispatcher (
493 This is the POSTFIX version of the dependency evaluator. This code does
494 not need to handle Before or After, as it is not valid to call this
495 routine in this case. The SOR is just ignored and is a nop in the grammer.
496 POSTFIX means all the math is done on top of the stack.
498 @param DriverEntry DriverEntry element to update.
500 @retval TRUE If driver is ready to run.
501 @retval FALSE If driver is not ready to run or some fatal error
507 IN EFI_CORE_DRIVER_ENTRY
*DriverEntry
512 Preprocess dependency expression and update DriverEntry to reflect the
513 state of Before, After, and SOR dependencies. If DriverEntry->Before
514 or DriverEntry->After is set it will never be cleared. If SOR is set
515 it will be cleared by CoreSchedule(), and then the driver can be
518 @param DriverEntry DriverEntry element to update .
520 @retval EFI_SUCCESS It always works.
524 CorePreProcessDepex (
525 IN EFI_CORE_DRIVER_ENTRY
*DriverEntry
531 Terminates all boot services.
533 @param ImageHandle Handle that identifies the exiting image.
534 @param MapKey Key to the latest memory map.
536 @retval EFI_SUCCESS Boot Services terminated
537 @retval EFI_INVALID_PARAMETER MapKey is incorrect.
542 CoreExitBootServices (
543 IN EFI_HANDLE ImageHandle
,
549 Make sure the memory map is following all the construction rules,
550 it is the last time to check memory map error before exit boot services.
552 @param MapKey Memory map key
554 @retval EFI_INVALID_PARAMETER Memory map not consistent with construction
556 @retval EFI_SUCCESS Valid memory map.
560 CoreTerminateMemoryMap (
566 Signals all events in the EventGroup.
568 @param EventGroup The list to signal
572 CoreNotifySignalList (
573 IN EFI_GUID
*EventGroup
579 Boot Service called to add, modify, or remove a system configuration table from
580 the EFI System Table.
582 @param Guid Pointer to the GUID for the entry to add, update, or
584 @param Table Pointer to the configuration table for the entry to add,
585 update, or remove, may be NULL.
587 @return EFI_SUCCESS Guid, Table pair added, updated, or removed.
588 @return EFI_INVALID_PARAMETER Input GUID not valid.
589 @return EFI_NOT_FOUND Attempted to delete non-existant entry
590 @return EFI_OUT_OF_RESOURCES Not enough memory available
595 CoreInstallConfigurationTable (
603 Raise the task priority level to the new level.
604 High level is implemented by disabling processor interrupts.
606 @param NewTpl New task priority level
608 @return The previous task priority level
620 Lowers the task priority to the previous value. If the new
621 priority unmasks events at a higher priority, they are dispatched.
623 @param NewTpl New, lower, task priority
635 Introduces a fine-grained stall.
637 @param Microseconds The number of microseconds to stall execution.
639 @retval EFI_SUCCESS Execution was stalled for at least the requested
640 amount of microseconds.
641 @retval EFI_NOT_AVAILABLE_YET gMetronome is not available yet
647 IN UINTN Microseconds
653 Sets the system's watchdog timer.
655 @param Timeout The number of seconds to set the watchdog timer to.
656 A value of zero disables the timer.
657 @param WatchdogCode The numeric code to log on a watchdog timer timeout
658 event. The firmware reserves codes 0x0000 to 0xFFFF.
659 Loaders and operating systems may use other timeout
661 @param DataSize The size, in bytes, of WatchdogData.
662 @param WatchdogData A data buffer that includes a Null-terminated Unicode
663 string, optionally followed by additional binary data.
664 The string is a description that the call may use to
665 further indicate the reason to be logged with a
668 @return EFI_SUCCESS Timeout has been set
669 @return EFI_NOT_AVAILABLE_YET WatchdogTimer is not available yet
670 @return EFI_UNSUPPORTED System does not have a timer (currently not used)
671 @return EFI_DEVICE_ERROR Could not complete due to hardware error
676 CoreSetWatchdogTimer (
678 IN UINT64 WatchdogCode
,
680 IN CHAR16
*WatchdogData OPTIONAL
686 Wrapper function to CoreInstallProtocolInterfaceNotify. This is the public API which
687 Calls the private one which contains a BOOLEAN parameter for notifications
689 @param UserHandle The handle to install the protocol handler on,
690 or NULL if a new handle is to be allocated
691 @param Protocol The protocol to add to the handle
692 @param InterfaceType Indicates whether Interface is supplied in
694 @param Interface The interface for the protocol being added
701 CoreInstallProtocolInterface (
702 IN OUT EFI_HANDLE
*UserHandle
,
703 IN EFI_GUID
*Protocol
,
704 IN EFI_INTERFACE_TYPE InterfaceType
,
710 Installs a protocol interface into the boot services environment.
712 @param UserHandle The handle to install the protocol handler on,
713 or NULL if a new handle is to be allocated
714 @param Protocol The protocol to add to the handle
715 @param InterfaceType Indicates whether Interface is supplied in
717 @param Interface The interface for the protocol being added
718 @param Notify indicates whether notify the notification list
721 @retval EFI_INVALID_PARAMETER Invalid parameter
722 @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate
723 @retval EFI_SUCCESS Protocol interface successfully installed
727 CoreInstallProtocolInterfaceNotify (
728 IN OUT EFI_HANDLE
*UserHandle
,
729 IN EFI_GUID
*Protocol
,
730 IN EFI_INTERFACE_TYPE InterfaceType
,
738 Installs a list of protocol interface into the boot services environment.
739 This function calls InstallProtocolInterface() in a loop. If any error
740 occures all the protocols added by this function are removed. This is
741 basically a lib function to save space.
743 @param Handle The handle to install the protocol handlers on,
744 or NULL if a new handle is to be allocated
745 @param ... EFI_GUID followed by protocol instance. A NULL
746 terminates the list. The pairs are the
747 arguments to InstallProtocolInterface(). All the
748 protocols are added to Handle.
750 @retval EFI_SUCCESS All the protocol interface was installed.
751 @retval EFI_OUT_OF_RESOURCES There was not enough memory in pool to install all the protocols.
752 @retval EFI_ALREADY_STARTED A Device Path Protocol instance was passed in that is already present in
754 @retval EFI_INVALID_PARAMETER Handle is NULL.
755 @retval EFI_INVALID_PARAMETER Protocol is already installed on the handle specified by Handle.
760 CoreInstallMultipleProtocolInterfaces (
761 IN OUT EFI_HANDLE
*Handle
,
768 Uninstalls a list of protocol interface in the boot services environment.
769 This function calls UnisatllProtocolInterface() in a loop. This is
770 basically a lib function to save space.
772 @param Handle The handle to uninstall the protocol
773 @param ... EFI_GUID followed by protocol instance. A NULL
774 terminates the list. The pairs are the
775 arguments to UninstallProtocolInterface(). All
776 the protocols are added to Handle.
783 CoreUninstallMultipleProtocolInterfaces (
784 IN EFI_HANDLE Handle
,
791 Reinstall a protocol interface on a device handle. The OldInterface for Protocol is replaced by the NewInterface.
793 @param UserHandle Handle on which the interface is to be
795 @param Protocol The numeric ID of the interface
796 @param OldInterface A pointer to the old interface
797 @param NewInterface A pointer to the new interface
799 @retval EFI_SUCCESS The protocol interface was installed
800 @retval EFI_NOT_FOUND The OldInterface on the handle was not found
801 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value
806 CoreReinstallProtocolInterface (
807 IN EFI_HANDLE UserHandle
,
808 IN EFI_GUID
*Protocol
,
809 IN VOID
*OldInterface
,
810 IN VOID
*NewInterface
816 Uninstalls all instances of a protocol:interfacer from a handle.
817 If the last protocol interface is remove from the handle, the
820 @param UserHandle The handle to remove the protocol handler from
821 @param Protocol The protocol, of protocol:interface, to remove
822 @param Interface The interface, of protocol:interface, to remove
824 @retval EFI_INVALID_PARAMETER Protocol is NULL.
825 @retval EFI_SUCCESS Protocol interface successfully uninstalled.
830 CoreUninstallProtocolInterface (
831 IN EFI_HANDLE UserHandle
,
832 IN EFI_GUID
*Protocol
,
839 Queries a handle to determine if it supports a specified protocol.
841 @param UserHandle The handle being queried.
842 @param Protocol The published unique identifier of the protocol.
843 @param Interface Supplies the address where a pointer to the
844 corresponding Protocol Interface is returned.
846 @return The requested protocol interface for the handle
852 IN EFI_HANDLE UserHandle
,
853 IN EFI_GUID
*Protocol
,
860 Locates the installed protocol handler for the handle, and
861 invokes it to obtain the protocol interface. Usage information
862 is registered in the protocol data base.
864 @param UserHandle The handle to obtain the protocol interface on
865 @param Protocol The ID of the protocol
866 @param Interface The location to return the protocol interface
867 @param ImageHandle The handle of the Image that is opening the
868 protocol interface specified by Protocol and
870 @param ControllerHandle The controller handle that is requiring this
872 @param Attributes The open mode of the protocol interface
873 specified by Handle and Protocol.
875 @retval EFI_INVALID_PARAMETER Protocol is NULL.
876 @retval EFI_SUCCESS Get the protocol interface.
882 IN EFI_HANDLE UserHandle
,
883 IN EFI_GUID
*Protocol
,
884 OUT VOID
**Interface OPTIONAL
,
885 IN EFI_HANDLE ImageHandle
,
886 IN EFI_HANDLE ControllerHandle
,
893 Return information about Opened protocols in the system
895 @param UserHandle The handle to close the protocol interface on
896 @param Protocol The ID of the protocol
897 @param EntryBuffer A pointer to a buffer of open protocol
898 information in the form of
899 EFI_OPEN_PROTOCOL_INFORMATION_ENTRY structures.
900 @param EntryCount Number of EntryBuffer entries
905 CoreOpenProtocolInformation (
906 IN EFI_HANDLE UserHandle
,
907 IN EFI_GUID
*Protocol
,
908 OUT EFI_OPEN_PROTOCOL_INFORMATION_ENTRY
**EntryBuffer
,
909 OUT UINTN
*EntryCount
915 Closes a protocol on a handle that was opened using OpenProtocol().
917 @param UserHandle The handle for the protocol interface that was
918 previously opened with OpenProtocol(), and is
920 @param Protocol The published unique identifier of the protocol.
921 It is the caller's responsibility to pass in a
923 @param AgentHandle The handle of the agent that is closing the
925 @param ControllerHandle If the agent that opened a protocol is a driver
926 that follows the EFI Driver Model, then this
927 parameter is the controller handle that required
928 the protocol interface. If the agent does not
929 follow the EFI Driver Model, then this parameter
930 is optional and may be NULL.
932 @retval EFI_SUCCESS The protocol instance was closed.
933 @retval EFI_INVALID_PARAMETER Handle, AgentHandle or ControllerHandle is not a
935 @retval EFI_NOT_FOUND Can not find the specified protocol or
942 IN EFI_HANDLE UserHandle
,
943 IN EFI_GUID
*Protocol
,
944 IN EFI_HANDLE AgentHandle
,
945 IN EFI_HANDLE ControllerHandle
951 Retrieves the list of protocol interface GUIDs that are installed on a handle in a buffer allocated
954 @param UserHandle The handle from which to retrieve the list of
955 protocol interface GUIDs.
956 @param ProtocolBuffer A pointer to the list of protocol interface GUID
957 pointers that are installed on Handle.
958 @param ProtocolBufferCount A pointer to the number of GUID pointers present
961 @retval EFI_SUCCESS The list of protocol interface GUIDs installed
962 on Handle was returned in ProtocolBuffer. The
963 number of protocol interface GUIDs was returned
964 in ProtocolBufferCount.
965 @retval EFI_INVALID_PARAMETER Handle is NULL.
966 @retval EFI_INVALID_PARAMETER Handle is not a valid EFI_HANDLE.
967 @retval EFI_INVALID_PARAMETER ProtocolBuffer is NULL.
968 @retval EFI_INVALID_PARAMETER ProtocolBufferCount is NULL.
969 @retval EFI_OUT_OF_RESOURCES There is not enough pool memory to store the
975 CoreProtocolsPerHandle (
976 IN EFI_HANDLE UserHandle
,
977 OUT EFI_GUID
***ProtocolBuffer
,
978 OUT UINTN
*ProtocolBufferCount
984 Add a new protocol notification record for the request protocol.
986 @param Protocol The requested protocol to add the notify
988 @param Event The event to signal
989 @param Registration Returns the registration record
991 @retval EFI_INVALID_PARAMETER Invalid parameter
992 @retval EFI_SUCCESS Successfully returned the registration record
998 CoreRegisterProtocolNotify (
999 IN EFI_GUID
*Protocol
,
1001 OUT VOID
**Registration
1006 Removes all the events in the protocol database that match Event.
1008 @param Event The event to search for in the protocol
1011 @return EFI_SUCCESS when done searching the entire database.
1015 CoreUnregisterProtocolNotify (
1021 Locates the requested handle(s) and returns them in Buffer.
1023 @param SearchType The type of search to perform to locate the
1025 @param Protocol The protocol to search for
1026 @param SearchKey Dependant on SearchType
1027 @param BufferSize On input the size of Buffer. On output the
1028 size of data returned.
1029 @param Buffer The buffer to return the results in
1031 @retval EFI_BUFFER_TOO_SMALL Buffer too small, required buffer size is
1032 returned in BufferSize.
1033 @retval EFI_INVALID_PARAMETER Invalid parameter
1034 @retval EFI_SUCCESS Successfully found the requested handle(s) and
1035 returns them in Buffer.
1041 IN EFI_LOCATE_SEARCH_TYPE SearchType
,
1042 IN EFI_GUID
*Protocol OPTIONAL
,
1043 IN VOID
*SearchKey OPTIONAL
,
1044 IN OUT UINTN
*BufferSize
,
1045 OUT EFI_HANDLE
*Buffer
1051 Locates the handle to a device on the device path that best matches the specified protocol.
1053 @param Protocol The protocol to search for.
1054 @param DevicePath On input, a pointer to a pointer to the device
1055 path. On output, the device path pointer is
1056 modified to point to the remaining part of the
1058 @param Device A pointer to the returned device handle.
1060 @retval EFI_SUCCESS The resulting handle was returned.
1061 @retval EFI_NOT_FOUND No handles matched the search.
1062 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
1067 CoreLocateDevicePath (
1068 IN EFI_GUID
*Protocol
,
1069 IN OUT EFI_DEVICE_PATH_PROTOCOL
**DevicePath
,
1070 OUT EFI_HANDLE
*Device
1076 Function returns an array of handles that support the requested protocol
1077 in a buffer allocated from pool. This is a version of CoreLocateHandle()
1078 that allocates a buffer for the caller.
1080 @param SearchType Specifies which handle(s) are to be returned.
1081 @param Protocol Provides the protocol to search by. This
1082 parameter is only valid for SearchType
1084 @param SearchKey Supplies the search key depending on the
1086 @param NumberHandles The number of handles returned in Buffer.
1087 @param Buffer A pointer to the buffer to return the requested
1088 array of handles that support Protocol.
1090 @retval EFI_SUCCESS The result array of handles was returned.
1091 @retval EFI_NOT_FOUND No handles match the search.
1092 @retval EFI_OUT_OF_RESOURCES There is not enough pool memory to store the
1094 @retval EFI_INVALID_PARAMETER One or more parameters are not valid.
1099 CoreLocateHandleBuffer (
1100 IN EFI_LOCATE_SEARCH_TYPE SearchType
,
1101 IN EFI_GUID
*Protocol OPTIONAL
,
1102 IN VOID
*SearchKey OPTIONAL
,
1103 IN OUT UINTN
*NumberHandles
,
1104 OUT EFI_HANDLE
**Buffer
1110 Return the first Protocol Interface that matches the Protocol GUID. If
1111 Registration is passed in, return a Protocol Instance that was just add
1112 to the system. If Registration is NULL return the first Protocol Interface
1115 @param Protocol The protocol to search for
1116 @param Registration Optional Registration Key returned from
1117 RegisterProtocolNotify()
1118 @param Interface Return the Protocol interface (instance).
1120 @retval EFI_SUCCESS If a valid Interface is returned
1121 @retval EFI_INVALID_PARAMETER Invalid parameter
1122 @retval EFI_NOT_FOUND Protocol interface not found
1127 CoreLocateProtocol (
1128 IN EFI_GUID
*Protocol
,
1129 IN VOID
*Registration OPTIONAL
,
1130 OUT VOID
**Interface
1135 return handle database key.
1138 @return Handle database key.
1142 CoreGetHandleDatabaseKey (
1148 Go connect any handles that were created or modified while a image executed.
1150 @param Key The Key to show that the handle has been
1155 CoreConnectHandlesByKey (
1162 Connects one or more drivers to a controller.
1164 @param ControllerHandle The handle of the controller to which driver(s) are to be connected.
1165 @param DriverImageHandle A pointer to an ordered list handles that support the
1166 EFI_DRIVER_BINDING_PROTOCOL.
1167 @param RemainingDevicePath A pointer to the device path that specifies a child of the
1168 controller specified by ControllerHandle.
1169 @param Recursive If TRUE, then ConnectController() is called recursively
1170 until the entire tree of controllers below the controller specified
1171 by ControllerHandle have been created. If FALSE, then
1172 the tree of controllers is only expanded one level.
1174 @retval EFI_SUCCESS 1) One or more drivers were connected to ControllerHandle.
1175 2) No drivers were connected to ControllerHandle, but
1176 RemainingDevicePath is not NULL, and it is an End Device
1178 @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.
1179 @retval EFI_NOT_FOUND 1) There are no EFI_DRIVER_BINDING_PROTOCOL instances
1180 present in the system.
1181 2) No drivers were connected to ControllerHandle.
1182 @retval EFI_SECURITY_VIOLATION
1183 The user has no permission to start UEFI device drivers on the device path
1184 associated with the ControllerHandle or specified by the RemainingDevicePath.
1189 CoreConnectController (
1190 IN EFI_HANDLE ControllerHandle
,
1191 IN EFI_HANDLE
*DriverImageHandle OPTIONAL
,
1192 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath OPTIONAL
,
1193 IN BOOLEAN Recursive
1199 Disonnects a controller from a driver
1201 @param ControllerHandle ControllerHandle The handle of
1202 the controller from which
1205 @param DriverImageHandle DriverImageHandle The driver to
1206 disconnect from ControllerHandle.
1207 @param ChildHandle ChildHandle The handle of the
1210 @retval EFI_SUCCESS One or more drivers were
1211 disconnected from the controller.
1212 @retval EFI_SUCCESS On entry, no drivers are managing
1214 @retval EFI_SUCCESS DriverImageHandle is not NULL,
1215 and on entry DriverImageHandle is
1216 not managing ControllerHandle.
1217 @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.
1218 @retval EFI_INVALID_PARAMETER DriverImageHandle is not NULL,
1219 and it is not a valid EFI_HANDLE.
1220 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL, and it
1221 is not a valid EFI_HANDLE.
1222 @retval EFI_OUT_OF_RESOURCES There are not enough resources
1223 available to disconnect any
1224 drivers from ControllerHandle.
1225 @retval EFI_DEVICE_ERROR The controller could not be
1226 disconnected because of a device
1232 CoreDisconnectController (
1233 IN EFI_HANDLE ControllerHandle
,
1234 IN EFI_HANDLE DriverImageHandle OPTIONAL
,
1235 IN EFI_HANDLE ChildHandle OPTIONAL
1241 Allocates pages from the memory map.
1243 @param Type The type of allocation to perform
1244 @param MemoryType The type of memory to turn the allocated pages
1246 @param NumberOfPages The number of pages to allocate
1247 @param Memory A pointer to receive the base allocated memory
1250 @return Status. On success, Memory is filled in with the base address allocated
1251 @retval EFI_INVALID_PARAMETER Parameters violate checking rules defined in
1253 @retval EFI_NOT_FOUND Could not allocate pages match the requirement.
1254 @retval EFI_OUT_OF_RESOURCES No enough pages to allocate.
1255 @retval EFI_SUCCESS Pages successfully allocated.
1261 IN EFI_ALLOCATE_TYPE Type
,
1262 IN EFI_MEMORY_TYPE MemoryType
,
1263 IN UINTN NumberOfPages
,
1264 IN OUT EFI_PHYSICAL_ADDRESS
*Memory
1268 Frees previous allocated pages.
1270 @param Memory Base address of memory being freed
1271 @param NumberOfPages The number of pages to free
1273 @retval EFI_NOT_FOUND Could not find the entry that covers the range
1274 @retval EFI_INVALID_PARAMETER Address not aligned
1275 @return EFI_SUCCESS -Pages successfully freed.
1281 IN EFI_PHYSICAL_ADDRESS Memory
,
1282 IN UINTN NumberOfPages
1286 This function returns a copy of the current memory map. The map is an array of
1287 memory descriptors, each of which describes a contiguous block of memory.
1289 @param MemoryMapSize A pointer to the size, in bytes, of the
1290 MemoryMap buffer. On input, this is the size of
1291 the buffer allocated by the caller. On output,
1292 it is the size of the buffer returned by the
1293 firmware if the buffer was large enough, or the
1294 size of the buffer needed to contain the map if
1295 the buffer was too small.
1296 @param MemoryMap A pointer to the buffer in which firmware places
1297 the current memory map.
1298 @param MapKey A pointer to the location in which firmware
1299 returns the key for the current memory map.
1300 @param DescriptorSize A pointer to the location in which firmware
1301 returns the size, in bytes, of an individual
1302 EFI_MEMORY_DESCRIPTOR.
1303 @param DescriptorVersion A pointer to the location in which firmware
1304 returns the version number associated with the
1305 EFI_MEMORY_DESCRIPTOR.
1307 @retval EFI_SUCCESS The memory map was returned in the MemoryMap
1309 @retval EFI_BUFFER_TOO_SMALL The MemoryMap buffer was too small. The current
1310 buffer size needed to hold the memory map is
1311 returned in MemoryMapSize.
1312 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
1318 IN OUT UINTN
*MemoryMapSize
,
1319 IN OUT EFI_MEMORY_DESCRIPTOR
*MemoryMap
,
1321 OUT UINTN
*DescriptorSize
,
1322 OUT UINT32
*DescriptorVersion
1328 Allocate pool of a particular type.
1330 @param PoolType Type of pool to allocate
1331 @param Size The amount of pool to allocate
1332 @param Buffer The address to return a pointer to the allocated
1335 @retval EFI_INVALID_PARAMETER PoolType not valid or Buffer is NULL
1336 @retval EFI_OUT_OF_RESOURCES Size exceeds max pool size or allocation failed.
1337 @retval EFI_SUCCESS Pool successfully allocated.
1343 IN EFI_MEMORY_TYPE PoolType
,
1349 Allocate pool of a particular type.
1351 @param PoolType Type of pool to allocate
1352 @param Size The amount of pool to allocate
1353 @param Buffer The address to return a pointer to the allocated
1356 @retval EFI_INVALID_PARAMETER PoolType not valid or Buffer is NULL
1357 @retval EFI_OUT_OF_RESOURCES Size exceeds max pool size or allocation failed.
1358 @retval EFI_SUCCESS Pool successfully allocated.
1363 CoreInternalAllocatePool (
1364 IN EFI_MEMORY_TYPE PoolType
,
1372 @param Buffer The allocated pool entry to free
1374 @retval EFI_INVALID_PARAMETER Buffer is not a valid value.
1375 @retval EFI_SUCCESS Pool successfully freed.
1387 @param Buffer The allocated pool entry to free
1388 @param PoolType Pointer to pool type
1390 @retval EFI_INVALID_PARAMETER Buffer is not a valid value.
1391 @retval EFI_SUCCESS Pool successfully freed.
1396 CoreInternalFreePool (
1398 OUT EFI_MEMORY_TYPE
*PoolType OPTIONAL
1402 Loads an EFI image into memory and returns a handle to the image.
1404 @param BootPolicy If TRUE, indicates that the request originates
1405 from the boot manager, and that the boot
1406 manager is attempting to load FilePath as a
1408 @param ParentImageHandle The caller's image handle.
1409 @param FilePath The specific file path from which the image is
1411 @param SourceBuffer If not NULL, a pointer to the memory location
1412 containing a copy of the image to be loaded.
1413 @param SourceSize The size in bytes of SourceBuffer.
1414 @param ImageHandle Pointer to the returned image handle that is
1415 created when the image is successfully loaded.
1417 @retval EFI_SUCCESS The image was loaded into memory.
1418 @retval EFI_NOT_FOUND The FilePath was not found.
1419 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
1420 @retval EFI_UNSUPPORTED The image type is not supported, or the device
1421 path cannot be parsed to locate the proper
1422 protocol for loading the file.
1423 @retval EFI_OUT_OF_RESOURCES Image was not loaded due to insufficient
1425 @retval EFI_LOAD_ERROR Image was not loaded because the image format was corrupt or not
1427 @retval EFI_DEVICE_ERROR Image was not loaded because the device returned a read error.
1428 @retval EFI_ACCESS_DENIED Image was not loaded because the platform policy prohibits the
1429 image from being loaded. NULL is returned in *ImageHandle.
1430 @retval EFI_SECURITY_VIOLATION Image was loaded and an ImageHandle was created with a
1431 valid EFI_LOADED_IMAGE_PROTOCOL. However, the current
1432 platform policy specifies that the image should not be started.
1438 IN BOOLEAN BootPolicy
,
1439 IN EFI_HANDLE ParentImageHandle
,
1440 IN EFI_DEVICE_PATH_PROTOCOL
*FilePath
,
1441 IN VOID
*SourceBuffer OPTIONAL
,
1442 IN UINTN SourceSize
,
1443 OUT EFI_HANDLE
*ImageHandle
1451 @param ImageHandle Handle that identifies the image to be
1454 @retval EFI_SUCCESS The image has been unloaded.
1455 @retval EFI_UNSUPPORTED The image has been started, and does not support
1457 @retval EFI_INVALID_PARAMPETER ImageHandle is not a valid image handle.
1463 IN EFI_HANDLE ImageHandle
1469 Transfer control to a loaded image's entry point.
1471 @param ImageHandle Handle of image to be started.
1472 @param ExitDataSize Pointer of the size to ExitData
1473 @param ExitData Pointer to a pointer to a data buffer that
1474 includes a Null-terminated string,
1475 optionally followed by additional binary data.
1476 The string is a description that the caller may
1477 use to further indicate the reason for the
1480 @retval EFI_INVALID_PARAMETER Invalid parameter
1481 @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate
1482 @retval EFI_SECURITY_VIOLATION The current platform policy specifies that the image should not be started.
1483 @retval EFI_SUCCESS Successfully transfer control to the image's
1490 IN EFI_HANDLE ImageHandle
,
1491 OUT UINTN
*ExitDataSize
,
1492 OUT CHAR16
**ExitData OPTIONAL
1498 Terminates the currently loaded EFI image and returns control to boot services.
1500 @param ImageHandle Handle that identifies the image. This
1501 parameter is passed to the image on entry.
1502 @param Status The image's exit code.
1503 @param ExitDataSize The size, in bytes, of ExitData. Ignored if
1504 ExitStatus is EFI_SUCCESS.
1505 @param ExitData Pointer to a data buffer that includes a
1506 Null-terminated Unicode string, optionally
1507 followed by additional binary data. The string
1508 is a description that the caller may use to
1509 further indicate the reason for the image's
1512 @retval EFI_INVALID_PARAMETER Image handle is NULL or it is not current
1514 @retval EFI_SUCCESS Successfully terminates the currently loaded
1516 @retval EFI_ACCESS_DENIED Should never reach there.
1517 @retval EFI_OUT_OF_RESOURCES Could not allocate pool
1523 IN EFI_HANDLE ImageHandle
,
1524 IN EFI_STATUS Status
,
1525 IN UINTN ExitDataSize
,
1526 IN CHAR16
*ExitData OPTIONAL
1534 @param Type The type of event to create and its mode and
1536 @param NotifyTpl The task priority level of event notifications
1537 @param NotifyFunction Pointer to the events notification function
1538 @param NotifyContext Pointer to the notification functions context;
1539 corresponds to parameter "Context" in the
1540 notification function
1541 @param Event Pointer to the newly created event if the call
1542 succeeds; undefined otherwise
1544 @retval EFI_SUCCESS The event structure was created
1545 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value
1546 @retval EFI_OUT_OF_RESOURCES The event could not be allocated
1553 IN EFI_TPL NotifyTpl
,
1554 IN EFI_EVENT_NOTIFY NotifyFunction
, OPTIONAL
1555 IN VOID
*NotifyContext
, OPTIONAL
1556 OUT EFI_EVENT
*Event
1562 Creates an event in a group.
1564 @param Type The type of event to create and its mode and
1566 @param NotifyTpl The task priority level of event notifications
1567 @param NotifyFunction Pointer to the events notification function
1568 @param NotifyContext Pointer to the notification functions context;
1569 corresponds to parameter "Context" in the
1570 notification function
1571 @param EventGroup GUID for EventGroup if NULL act the same as
1573 @param Event Pointer to the newly created event if the call
1574 succeeds; undefined otherwise
1576 @retval EFI_SUCCESS The event structure was created
1577 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value
1578 @retval EFI_OUT_OF_RESOURCES The event could not be allocated
1585 IN EFI_TPL NotifyTpl
,
1586 IN EFI_EVENT_NOTIFY NotifyFunction
, OPTIONAL
1587 IN CONST VOID
*NotifyContext
, OPTIONAL
1588 IN CONST EFI_GUID
*EventGroup
, OPTIONAL
1589 OUT EFI_EVENT
*Event
1593 Creates a general-purpose event structure
1595 @param Type The type of event to create and its mode and
1597 @param NotifyTpl The task priority level of event notifications
1598 @param NotifyFunction Pointer to the events notification function
1599 @param NotifyContext Pointer to the notification functions context;
1600 corresponds to parameter "Context" in the
1601 notification function
1602 @param EventGroup GUID for EventGroup if NULL act the same as
1604 @param Event Pointer to the newly created event if the call
1605 succeeds; undefined otherwise
1607 @retval EFI_SUCCESS The event structure was created
1608 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value
1609 @retval EFI_OUT_OF_RESOURCES The event could not be allocated
1614 CoreCreateEventInternal (
1616 IN EFI_TPL NotifyTpl
,
1617 IN EFI_EVENT_NOTIFY NotifyFunction
, OPTIONAL
1618 IN CONST VOID
*NotifyContext
, OPTIONAL
1619 IN CONST EFI_GUID
*EventGroup
, OPTIONAL
1620 OUT EFI_EVENT
*Event
1624 Sets the type of timer and the trigger time for a timer event.
1626 @param UserEvent The timer event that is to be signaled at the
1628 @param Type The type of time that is specified in
1630 @param TriggerTime The number of 100ns units until the timer
1633 @retval EFI_SUCCESS The event has been set to be signaled at the
1635 @retval EFI_INVALID_PARAMETER Event or Type is not valid
1641 IN EFI_EVENT UserEvent
,
1642 IN EFI_TIMER_DELAY Type
,
1643 IN UINT64 TriggerTime
1649 Signals the event. Queues the event to be notified if needed.
1651 @param UserEvent The event to signal .
1653 @retval EFI_INVALID_PARAMETER Parameters are not valid.
1654 @retval EFI_SUCCESS The event was signaled.
1660 IN EFI_EVENT UserEvent
1666 Stops execution until an event is signaled.
1668 @param NumberOfEvents The number of events in the UserEvents array
1669 @param UserEvents An array of EFI_EVENT
1670 @param UserIndex Pointer to the index of the event which
1671 satisfied the wait condition
1673 @retval EFI_SUCCESS The event indicated by Index was signaled.
1674 @retval EFI_INVALID_PARAMETER The event indicated by Index has a notification
1675 function or Event was not a valid type
1676 @retval EFI_UNSUPPORTED The current TPL is not TPL_APPLICATION
1682 IN UINTN NumberOfEvents
,
1683 IN EFI_EVENT
*UserEvents
,
1684 OUT UINTN
*UserIndex
1690 Closes an event and frees the event structure.
1692 @param UserEvent Event to close
1694 @retval EFI_INVALID_PARAMETER Parameters are not valid.
1695 @retval EFI_SUCCESS The event has been closed
1701 IN EFI_EVENT UserEvent
1707 Check the status of an event.
1709 @param UserEvent The event to check
1711 @retval EFI_SUCCESS The event is in the signaled state
1712 @retval EFI_NOT_READY The event is not in the signaled state
1713 @retval EFI_INVALID_PARAMETER Event is of type EVT_NOTIFY_SIGNAL
1719 IN EFI_EVENT UserEvent
1724 Adds reserved memory, system memory, or memory-mapped I/O resources to the
1725 global coherency domain of the processor.
1727 @param GcdMemoryType Memory type of the memory space.
1728 @param BaseAddress Base address of the memory space.
1729 @param Length Length of the memory space.
1730 @param Capabilities alterable attributes of the memory space.
1732 @retval EFI_SUCCESS Merged this memory space into GCD map.
1737 CoreAddMemorySpace (
1738 IN EFI_GCD_MEMORY_TYPE GcdMemoryType
,
1739 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1741 IN UINT64 Capabilities
1746 Allocates nonexistent memory, reserved memory, system memory, or memorymapped
1747 I/O resources from the global coherency domain of the processor.
1749 @param GcdAllocateType The type of allocate operation
1750 @param GcdMemoryType The desired memory type
1751 @param Alignment Align with 2^Alignment
1752 @param Length Length to allocate
1753 @param BaseAddress Base address to allocate
1754 @param ImageHandle The image handle consume the allocated space.
1755 @param DeviceHandle The device handle consume the allocated space.
1757 @retval EFI_INVALID_PARAMETER Invalid parameter.
1758 @retval EFI_NOT_FOUND No descriptor contains the desired space.
1759 @retval EFI_SUCCESS Memory space successfully allocated.
1764 CoreAllocateMemorySpace (
1765 IN EFI_GCD_ALLOCATE_TYPE GcdAllocateType
,
1766 IN EFI_GCD_MEMORY_TYPE GcdMemoryType
,
1769 IN OUT EFI_PHYSICAL_ADDRESS
*BaseAddress
,
1770 IN EFI_HANDLE ImageHandle
,
1771 IN EFI_HANDLE DeviceHandle OPTIONAL
1776 Frees nonexistent memory, reserved memory, system memory, or memory-mapped
1777 I/O resources from the global coherency domain of the processor.
1779 @param BaseAddress Base address of the memory space.
1780 @param Length Length of the memory space.
1782 @retval EFI_SUCCESS Space successfully freed.
1787 CoreFreeMemorySpace (
1788 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1794 Removes reserved memory, system memory, or memory-mapped I/O resources from
1795 the global coherency domain of the processor.
1797 @param BaseAddress Base address of the memory space.
1798 @param Length Length of the memory space.
1800 @retval EFI_SUCCESS Successfully remove a segment of memory space.
1805 CoreRemoveMemorySpace (
1806 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1812 Retrieves the descriptor for a memory region containing a specified address.
1814 @param BaseAddress Specified start address
1815 @param Descriptor Specified length
1817 @retval EFI_INVALID_PARAMETER Invalid parameter
1818 @retval EFI_SUCCESS Successfully get memory space descriptor.
1823 CoreGetMemorySpaceDescriptor (
1824 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1825 OUT EFI_GCD_MEMORY_SPACE_DESCRIPTOR
*Descriptor
1830 Modifies the attributes for a memory region in the global coherency domain of the
1833 @param BaseAddress Specified start address
1834 @param Length Specified length
1835 @param Attributes Specified attributes
1837 @retval EFI_SUCCESS The attributes were set for the memory region.
1838 @retval EFI_INVALID_PARAMETER Length is zero.
1839 @retval EFI_UNSUPPORTED The processor does not support one or more bytes of the memory
1840 resource range specified by BaseAddress and Length.
1841 @retval EFI_UNSUPPORTED The bit mask of attributes is not support for the memory resource
1842 range specified by BaseAddress and Length.
1843 @retval EFI_ACCESS_DENIED The attributes for the memory resource range specified by
1844 BaseAddress and Length cannot be modified.
1845 @retval EFI_OUT_OF_RESOURCES There are not enough system resources to modify the attributes of
1846 the memory resource range.
1847 @retval EFI_NOT_AVAILABLE_YET The attributes cannot be set because CPU architectural protocol is
1853 CoreSetMemorySpaceAttributes (
1854 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1856 IN UINT64 Attributes
1861 Modifies the capabilities for a memory region in the global coherency domain of the
1864 @param BaseAddress The physical address that is the start address of a memory region.
1865 @param Length The size in bytes of the memory region.
1866 @param Capabilities The bit mask of capabilities that the memory region supports.
1868 @retval EFI_SUCCESS The capabilities were set for the memory region.
1869 @retval EFI_INVALID_PARAMETER Length is zero.
1870 @retval EFI_UNSUPPORTED The capabilities specified by Capabilities do not include the
1871 memory region attributes currently in use.
1872 @retval EFI_ACCESS_DENIED The capabilities for the memory resource range specified by
1873 BaseAddress and Length cannot be modified.
1874 @retval EFI_OUT_OF_RESOURCES There are not enough system resources to modify the capabilities
1875 of the memory resource range.
1879 CoreSetMemorySpaceCapabilities (
1880 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1882 IN UINT64 Capabilities
1887 Returns a map of the memory resources in the global coherency domain of the
1890 @param NumberOfDescriptors Number of descriptors.
1891 @param MemorySpaceMap Descriptor array
1893 @retval EFI_INVALID_PARAMETER Invalid parameter
1894 @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate
1895 @retval EFI_SUCCESS Successfully get memory space map.
1900 CoreGetMemorySpaceMap (
1901 OUT UINTN
*NumberOfDescriptors
,
1902 OUT EFI_GCD_MEMORY_SPACE_DESCRIPTOR
**MemorySpaceMap
1907 Adds reserved I/O or I/O resources to the global coherency domain of the processor.
1909 @param GcdIoType IO type of the segment.
1910 @param BaseAddress Base address of the segment.
1911 @param Length Length of the segment.
1913 @retval EFI_SUCCESS Merged this segment into GCD map.
1914 @retval EFI_INVALID_PARAMETER Parameter not valid
1920 IN EFI_GCD_IO_TYPE GcdIoType
,
1921 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1927 Allocates nonexistent I/O, reserved I/O, or I/O resources from the global coherency
1928 domain of the processor.
1930 @param GcdAllocateType The type of allocate operation
1931 @param GcdIoType The desired IO type
1932 @param Alignment Align with 2^Alignment
1933 @param Length Length to allocate
1934 @param BaseAddress Base address to allocate
1935 @param ImageHandle The image handle consume the allocated space.
1936 @param DeviceHandle The device handle consume the allocated space.
1938 @retval EFI_INVALID_PARAMETER Invalid parameter.
1939 @retval EFI_NOT_FOUND No descriptor contains the desired space.
1940 @retval EFI_SUCCESS IO space successfully allocated.
1945 CoreAllocateIoSpace (
1946 IN EFI_GCD_ALLOCATE_TYPE GcdAllocateType
,
1947 IN EFI_GCD_IO_TYPE GcdIoType
,
1950 IN OUT EFI_PHYSICAL_ADDRESS
*BaseAddress
,
1951 IN EFI_HANDLE ImageHandle
,
1952 IN EFI_HANDLE DeviceHandle OPTIONAL
1957 Frees nonexistent I/O, reserved I/O, or I/O resources from the global coherency
1958 domain of the processor.
1960 @param BaseAddress Base address of the segment.
1961 @param Length Length of the segment.
1963 @retval EFI_SUCCESS Space successfully freed.
1969 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1975 Removes reserved I/O or I/O resources from the global coherency domain of the
1978 @param BaseAddress Base address of the segment.
1979 @param Length Length of the segment.
1981 @retval EFI_SUCCESS Successfully removed a segment of IO space.
1987 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1993 Retrieves the descriptor for an I/O region containing a specified address.
1995 @param BaseAddress Specified start address
1996 @param Descriptor Specified length
1998 @retval EFI_INVALID_PARAMETER Descriptor is NULL.
1999 @retval EFI_SUCCESS Successfully get the IO space descriptor.
2004 CoreGetIoSpaceDescriptor (
2005 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
2006 OUT EFI_GCD_IO_SPACE_DESCRIPTOR
*Descriptor
2011 Returns a map of the I/O resources in the global coherency domain of the processor.
2013 @param NumberOfDescriptors Number of descriptors.
2014 @param IoSpaceMap Descriptor array
2016 @retval EFI_INVALID_PARAMETER Invalid parameter
2017 @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate
2018 @retval EFI_SUCCESS Successfully get IO space map.
2024 OUT UINTN
*NumberOfDescriptors
,
2025 OUT EFI_GCD_IO_SPACE_DESCRIPTOR
**IoSpaceMap
2030 This is the main Dispatcher for DXE and it exits when there are no more
2031 drivers to run. Drain the mScheduledQueue and load and start a PE
2032 image for each driver. Search the mDiscoveredList to see if any driver can
2033 be placed on the mScheduledQueue. If no drivers are placed on the
2034 mScheduledQueue exit the function. On exit it is assumed the Bds()
2035 will be called, and when the Bds() exits the Dispatcher will be called
2038 @retval EFI_ALREADY_STARTED The DXE Dispatcher is already running
2039 @retval EFI_NOT_FOUND No DXE Drivers were dispatched
2040 @retval EFI_SUCCESS One or more DXE Drivers were dispatched
2050 Check every driver and locate a matching one. If the driver is found, the Unrequested
2051 state flag is cleared.
2053 @param FirmwareVolumeHandle The handle of the Firmware Volume that contains
2054 the firmware file specified by DriverName.
2055 @param DriverName The Driver name to put in the Dependent state.
2057 @retval EFI_SUCCESS The DriverName was found and it's SOR bit was
2059 @retval EFI_NOT_FOUND The DriverName does not exist or it's SOR bit was
2066 IN EFI_HANDLE FirmwareVolumeHandle
,
2067 IN EFI_GUID
*DriverName
2072 Convert a driver from the Untrused back to the Scheduled state.
2074 @param FirmwareVolumeHandle The handle of the Firmware Volume that contains
2075 the firmware file specified by DriverName.
2076 @param DriverName The Driver name to put in the Scheduled state
2078 @retval EFI_SUCCESS The file was found in the untrusted state, and it
2079 was promoted to the trusted state.
2080 @retval EFI_NOT_FOUND The file was not found in the untrusted state.
2086 IN EFI_HANDLE FirmwareVolumeHandle
,
2087 IN EFI_GUID
*DriverName
2092 This routine is the driver initialization entry point. It initializes the
2093 libraries, and registers two notification functions. These notification
2094 functions are responsible for building the FV stack dynamically.
2096 @param ImageHandle The image handle.
2097 @param SystemTable The system table.
2099 @retval EFI_SUCCESS Function successfully returned.
2105 IN EFI_HANDLE ImageHandle
,
2106 IN EFI_SYSTEM_TABLE
*SystemTable
2111 Entry point of the section extraction code. Initializes an instance of the
2112 section extraction interface and installs it on a new handle.
2114 @param ImageHandle A handle for the image that is initializing this driver
2115 @param SystemTable A pointer to the EFI system table
2117 @retval EFI_SUCCESS Driver initialized successfully
2118 @retval EFI_OUT_OF_RESOURCES Could not allocate needed resources
2123 InitializeSectionExtraction (
2124 IN EFI_HANDLE ImageHandle
,
2125 IN EFI_SYSTEM_TABLE
*SystemTable
2130 This DXE service routine is used to process a firmware volume. In
2131 particular, it can be called by BDS to process a single firmware
2132 volume found in a capsule.
2134 @param FvHeader pointer to a firmware volume header
2135 @param Size the size of the buffer pointed to by FvHeader
2136 @param FVProtocolHandle the handle on which a firmware volume protocol
2137 was produced for the firmware volume passed in.
2139 @retval EFI_OUT_OF_RESOURCES if an FVB could not be produced due to lack of
2141 @retval EFI_VOLUME_CORRUPTED if the volume was corrupted
2142 @retval EFI_SUCCESS a firmware volume protocol was produced for the
2148 CoreProcessFirmwareVolume (
2151 OUT EFI_HANDLE
*FVProtocolHandle
2155 //Functions used during debug buils
2159 Displays Architectural protocols that were not loaded and are required for DXE
2160 core to function. Only used in Debug Builds.
2164 CoreDisplayMissingArchProtocols (
2170 Traverse the discovered list for any drivers that were discovered but not loaded
2171 because the dependency experessions evaluated to false.
2175 CoreDisplayDiscoveredNotDispatched (
2182 Place holder function until all the Boot Services and Runtime Services are
2185 @param Arg1 Undefined
2187 @return EFI_NOT_AVAILABLE_YET
2192 CoreEfiNotAvailableYetArg1 (
2198 Place holder function until all the Boot Services and Runtime Services are available.
2200 @param Arg1 Undefined
2201 @param Arg2 Undefined
2203 @return EFI_NOT_AVAILABLE_YET
2208 CoreEfiNotAvailableYetArg2 (
2215 Place holder function until all the Boot Services and Runtime Services are available.
2217 @param Arg1 Undefined
2218 @param Arg2 Undefined
2219 @param Arg3 Undefined
2221 @return EFI_NOT_AVAILABLE_YET
2226 CoreEfiNotAvailableYetArg3 (
2234 Place holder function until all the Boot Services and Runtime Services are available.
2236 @param Arg1 Undefined
2237 @param Arg2 Undefined
2238 @param Arg3 Undefined
2239 @param Arg4 Undefined
2241 @return EFI_NOT_AVAILABLE_YET
2246 CoreEfiNotAvailableYetArg4 (
2255 Place holder function until all the Boot Services and Runtime Services are available.
2257 @param Arg1 Undefined
2258 @param Arg2 Undefined
2259 @param Arg3 Undefined
2260 @param Arg4 Undefined
2261 @param Arg5 Undefined
2263 @return EFI_NOT_AVAILABLE_YET
2268 CoreEfiNotAvailableYetArg5 (
2278 Given a compressed source buffer, this function retrieves the size of the
2279 uncompressed buffer and the size of the scratch buffer required to decompress
2280 the compressed source buffer.
2282 The GetInfo() function retrieves the size of the uncompressed buffer and the
2283 temporary scratch buffer required to decompress the buffer specified by Source
2284 and SourceSize. If the size of the uncompressed buffer or the size of the
2285 scratch buffer cannot be determined from the compressed data specified by
2286 Source and SourceData, then EFI_INVALID_PARAMETER is returned. Otherwise, the
2287 size of the uncompressed buffer is returned in DestinationSize, the size of
2288 the scratch buffer is returned in ScratchSize, and EFI_SUCCESS is returned.
2289 The GetInfo() function does not have scratch buffer available to perform a
2290 thorough checking of the validity of the source data. It just retrieves the
2291 "Original Size" field from the beginning bytes of the source data and output
2292 it as DestinationSize. And ScratchSize is specific to the decompression
2295 @param This A pointer to the EFI_DECOMPRESS_PROTOCOL instance.
2296 @param Source The source buffer containing the compressed data.
2297 @param SourceSize The size, in bytes, of the source buffer.
2298 @param DestinationSize A pointer to the size, in bytes, of the
2299 uncompressed buffer that will be generated when the
2300 compressed buffer specified by Source and
2301 SourceSize is decompressed.
2302 @param ScratchSize A pointer to the size, in bytes, of the scratch
2303 buffer that is required to decompress the
2304 compressed buffer specified by Source and
2307 @retval EFI_SUCCESS The size of the uncompressed data was returned in
2308 DestinationSize and the size of the scratch buffer
2309 was returned in ScratchSize.
2310 @retval EFI_INVALID_PARAMETER The size of the uncompressed data or the size of
2311 the scratch buffer cannot be determined from the
2312 compressed data specified by Source and
2318 DxeMainUefiDecompressGetInfo (
2319 IN EFI_DECOMPRESS_PROTOCOL
*This
,
2321 IN UINT32 SourceSize
,
2322 OUT UINT32
*DestinationSize
,
2323 OUT UINT32
*ScratchSize
2328 Decompresses a compressed source buffer.
2330 The Decompress() function extracts decompressed data to its original form.
2331 This protocol is designed so that the decompression algorithm can be
2332 implemented without using any memory services. As a result, the Decompress()
2333 Function is not allowed to call AllocatePool() or AllocatePages() in its
2334 implementation. It is the caller's responsibility to allocate and free the
2335 Destination and Scratch buffers.
2336 If the compressed source data specified by Source and SourceSize is
2337 sucessfully decompressed into Destination, then EFI_SUCCESS is returned. If
2338 the compressed source data specified by Source and SourceSize is not in a
2339 valid compressed data format, then EFI_INVALID_PARAMETER is returned.
2341 @param This A pointer to the EFI_DECOMPRESS_PROTOCOL instance.
2342 @param Source The source buffer containing the compressed data.
2343 @param SourceSize SourceSizeThe size of source data.
2344 @param Destination On output, the destination buffer that contains
2345 the uncompressed data.
2346 @param DestinationSize The size of the destination buffer. The size of
2347 the destination buffer needed is obtained from
2348 EFI_DECOMPRESS_PROTOCOL.GetInfo().
2349 @param Scratch A temporary scratch buffer that is used to perform
2351 @param ScratchSize The size of scratch buffer. The size of the
2352 scratch buffer needed is obtained from GetInfo().
2354 @retval EFI_SUCCESS Decompression completed successfully, and the
2355 uncompressed buffer is returned in Destination.
2356 @retval EFI_INVALID_PARAMETER The source buffer specified by Source and
2357 SourceSize is corrupted (not in a valid
2363 DxeMainUefiDecompress (
2364 IN EFI_DECOMPRESS_PROTOCOL
*This
,
2366 IN UINT32 SourceSize
,
2367 IN OUT VOID
*Destination
,
2368 IN UINT32 DestinationSize
,
2369 IN OUT VOID
*Scratch
,
2370 IN UINT32 ScratchSize
2374 SEP member function. This function creates and returns a new section stream
2375 handle to represent the new section stream.
2377 @param SectionStreamLength Size in bytes of the section stream.
2378 @param SectionStream Buffer containing the new section stream.
2379 @param SectionStreamHandle A pointer to a caller allocated UINTN that on
2380 output contains the new section stream handle.
2382 @retval EFI_SUCCESS The section stream is created successfully.
2383 @retval EFI_OUT_OF_RESOURCES memory allocation failed.
2384 @retval EFI_INVALID_PARAMETER Section stream does not end concident with end
2391 IN UINTN SectionStreamLength
,
2392 IN VOID
*SectionStream
,
2393 OUT UINTN
*SectionStreamHandle
2399 SEP member function. Retrieves requested section from section stream.
2401 @param SectionStreamHandle The section stream from which to extract the
2403 @param SectionType A pointer to the type of section to search for.
2404 @param SectionDefinitionGuid If the section type is EFI_SECTION_GUID_DEFINED,
2405 then SectionDefinitionGuid indicates which of
2406 these types of sections to search for.
2407 @param SectionInstance Indicates which instance of the requested
2409 @param Buffer Double indirection to buffer. If *Buffer is
2410 non-null on input, then the buffer is caller
2411 allocated. If Buffer is NULL, then the buffer
2412 is callee allocated. In either case, the
2413 required buffer size is returned in *BufferSize.
2414 @param BufferSize On input, indicates the size of *Buffer if
2415 *Buffer is non-null on input. On output,
2416 indicates the required size (allocated size if
2417 callee allocated) of *Buffer.
2418 @param AuthenticationStatus A pointer to a caller-allocated UINT32 that
2419 indicates the authentication status of the
2420 output buffer. If the input section's
2421 GuidedSectionHeader.Attributes field
2422 has the EFI_GUIDED_SECTION_AUTH_STATUS_VALID
2423 bit as clear, AuthenticationStatus must return
2424 zero. Both local bits (19:16) and aggregate
2425 bits (3:0) in AuthenticationStatus are returned
2426 by ExtractSection(). These bits reflect the
2427 status of the extraction operation. The bit
2428 pattern in both regions must be the same, as
2429 the local and aggregate authentication statuses
2430 have equivalent meaning at this level. If the
2431 function returns anything other than
2432 EFI_SUCCESS, the value of *AuthenticationStatus
2434 @param IsFfs3Fv Indicates the FV format.
2436 @retval EFI_SUCCESS Section was retrieved successfully
2437 @retval EFI_PROTOCOL_ERROR A GUID defined section was encountered in the
2438 section stream with its
2439 EFI_GUIDED_SECTION_PROCESSING_REQUIRED bit set,
2440 but there was no corresponding GUIDed Section
2441 Extraction Protocol in the handle database.
2442 *Buffer is unmodified.
2443 @retval EFI_NOT_FOUND An error was encountered when parsing the
2444 SectionStream. This indicates the SectionStream
2445 is not correctly formatted.
2446 @retval EFI_NOT_FOUND The requested section does not exist.
2447 @retval EFI_OUT_OF_RESOURCES The system has insufficient resources to process
2449 @retval EFI_INVALID_PARAMETER The SectionStreamHandle does not exist.
2450 @retval EFI_WARN_TOO_SMALL The size of the caller allocated input buffer is
2451 insufficient to contain the requested section.
2452 The input buffer is filled and section contents
2459 IN UINTN SectionStreamHandle
,
2460 IN EFI_SECTION_TYPE
*SectionType
,
2461 IN EFI_GUID
*SectionDefinitionGuid
,
2462 IN UINTN SectionInstance
,
2464 IN OUT UINTN
*BufferSize
,
2465 OUT UINT32
*AuthenticationStatus
,
2471 SEP member function. Deletes an existing section stream
2473 @param StreamHandleToClose Indicates the stream to close
2474 @param FreeStreamBuffer TRUE - Need to free stream buffer;
2475 FALSE - No need to free stream buffer.
2477 @retval EFI_SUCCESS The section stream is closed sucessfully.
2478 @retval EFI_OUT_OF_RESOURCES Memory allocation failed.
2479 @retval EFI_INVALID_PARAMETER Section stream does not end concident with end
2485 CloseSectionStream (
2486 IN UINTN StreamHandleToClose
,
2487 IN BOOLEAN FreeStreamBuffer
2491 Creates and initializes the DebugImageInfo Table. Also creates the configuration
2492 table and registers it into the system table.
2495 This function allocates memory, frees it, and then allocates memory at an
2496 address within the initial allocation. Since this function is called early
2497 in DXE core initialization (before drivers are dispatched), this should not
2502 CoreInitializeDebugImageInfoTable (
2508 Update the CRC32 in the Debug Table.
2509 Since the CRC32 service is made available by the Runtime driver, we have to
2510 wait for the Runtime Driver to be installed before the CRC32 can be computed.
2511 This function is called elsewhere by the core when the runtime architectural
2512 protocol is produced.
2516 CoreUpdateDebugTableCrc32 (
2522 Adds a new DebugImageInfo structure to the DebugImageInfo Table. Re-Allocates
2523 the table if it's not large enough to accomidate another entry.
2525 @param ImageInfoType type of debug image information
2526 @param LoadedImage pointer to the loaded image protocol for the image being
2528 @param ImageHandle image handle for the image being loaded
2532 CoreNewDebugImageInfoEntry (
2533 IN UINT32 ImageInfoType
,
2534 IN EFI_LOADED_IMAGE_PROTOCOL
*LoadedImage
,
2535 IN EFI_HANDLE ImageHandle
2540 Removes and frees an entry from the DebugImageInfo Table.
2542 @param ImageHandle image handle for the image being unloaded
2546 CoreRemoveDebugImageInfoEntry (
2547 EFI_HANDLE ImageHandle
2552 This routine consumes FV hobs and produces instances of FW_VOL_BLOCK_PROTOCOL as appropriate.
2554 @param ImageHandle The image handle.
2555 @param SystemTable The system table.
2557 @retval EFI_SUCCESS Successfully initialized firmware volume block
2563 FwVolBlockDriverInit (
2564 IN EFI_HANDLE ImageHandle
,
2565 IN EFI_SYSTEM_TABLE
*SystemTable
2570 Get FVB authentication status
2572 @param FvbProtocol FVB protocol.
2574 @return Authentication status.
2578 GetFvbAuthenticationStatus (
2579 IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL
*FvbProtocol
2583 This routine produces a firmware volume block protocol on a given
2586 @param BaseAddress base address of the firmware volume image
2587 @param Length length of the firmware volume image
2588 @param ParentHandle handle of parent firmware volume, if this image
2589 came from an FV image file and section in another firmware
2590 volume (ala capsules)
2591 @param AuthenticationStatus Authentication status inherited, if this image
2592 came from an FV image file and section in another firmware volume.
2593 @param FvProtocol Firmware volume block protocol produced.
2595 @retval EFI_VOLUME_CORRUPTED Volume corrupted.
2596 @retval EFI_OUT_OF_RESOURCES No enough buffer to be allocated.
2597 @retval EFI_SUCCESS Successfully produced a FVB protocol on given
2602 ProduceFVBProtocolOnBuffer (
2603 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
2605 IN EFI_HANDLE ParentHandle
,
2606 IN UINT32 AuthenticationStatus
,
2607 OUT EFI_HANDLE
*FvProtocol OPTIONAL
2612 Raising to the task priority level of the mutual exclusion
2613 lock, and then acquires ownership of the lock.
2615 @param Lock The lock to acquire
2627 Initialize a basic mutual exclusion lock. Each lock
2628 provides mutual exclusion access at it's task priority
2629 level. Since there is no-premption (at any TPL) or
2630 multiprocessor support, acquiring the lock only consists
2631 of raising to the locks TPL.
2633 @param Lock The EFI_LOCK structure to initialize
2635 @retval EFI_SUCCESS Lock Owned.
2636 @retval EFI_ACCESS_DENIED Reentrant Lock Acquisition, Lock not Owned.
2640 CoreAcquireLockOrFail (
2646 Releases ownership of the mutual exclusion lock, and
2647 restores the previous task priority level.
2649 @param Lock The lock to release
2651 @return Lock unowned
2660 Read data from Firmware Block by FVB protocol Read.
2661 The data may cross the multi block ranges.
2663 @param Fvb The FW_VOL_BLOCK_PROTOCOL instance from which to read data.
2664 @param StartLba Pointer to StartLba.
2665 On input, the start logical block index from which to read.
2666 On output,the end logical block index after reading.
2667 @param Offset Pointer to Offset
2668 On input, offset into the block at which to begin reading.
2669 On output, offset into the end block after reading.
2670 @param DataSize Size of data to be read.
2671 @param Data Pointer to Buffer that the data will be read into.
2673 @retval EFI_SUCCESS Successfully read data from firmware block.
2678 IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL
*Fvb
,
2679 IN OUT EFI_LBA
*StartLba
,
2680 IN OUT UINTN
*Offset
,
2686 Given the supplied FW_VOL_BLOCK_PROTOCOL, allocate a buffer for output and
2687 copy the real length volume header into it.
2689 @param Fvb The FW_VOL_BLOCK_PROTOCOL instance from which to
2690 read the volume header
2691 @param FwVolHeader Pointer to pointer to allocated buffer in which
2692 the volume header is returned.
2694 @retval EFI_OUT_OF_RESOURCES No enough buffer could be allocated.
2695 @retval EFI_SUCCESS Successfully read volume header to the allocated
2697 @retval EFI_INVALID_PARAMETER The FV Header signature is not as expected or
2698 the file system could not be understood.
2703 IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL
*Fvb
,
2704 OUT EFI_FIRMWARE_VOLUME_HEADER
**FwVolHeader
2708 Verify checksum of the firmware volume header.
2710 @param FvHeader Points to the firmware volume header to be checked
2712 @retval TRUE Checksum verification passed
2713 @retval FALSE Checksum verification failed
2717 VerifyFvHeaderChecksum (
2718 IN EFI_FIRMWARE_VOLUME_HEADER
*FvHeader
2722 Initialize memory profile.
2724 @param HobStart The start address of the HOB.
2733 Install memory profile protocol.
2737 MemoryProfileInstallProtocol (
2742 Register image to memory profile.
2744 @param DriverEntry Image info.
2745 @param FileType Image file type.
2747 @return EFI_SUCCESS Register successfully.
2748 @return EFI_UNSUPPORTED Memory profile unsupported,
2749 or memory profile for the image is not required.
2750 @return EFI_OUT_OF_RESOURCES No enough resource for this register.
2754 RegisterMemoryProfileImage (
2755 IN LOADED_IMAGE_PRIVATE_DATA
*DriverEntry
,
2756 IN EFI_FV_FILETYPE FileType
2760 Unregister image from memory profile.
2762 @param DriverEntry Image info.
2764 @return EFI_SUCCESS Unregister successfully.
2765 @return EFI_UNSUPPORTED Memory profile unsupported,
2766 or memory profile for the image is not required.
2767 @return EFI_NOT_FOUND The image is not found.
2771 UnregisterMemoryProfileImage (
2772 IN LOADED_IMAGE_PRIVATE_DATA
*DriverEntry
2776 Update memory profile information.
2778 @param CallerAddress Address of caller who call Allocate or Free.
2779 @param Action This Allocate or Free action.
2780 @param MemoryType Memory type.
2781 EfiMaxMemoryType means the MemoryType is unknown.
2782 @param Size Buffer size.
2783 @param Buffer Buffer address.
2784 @param ActionString String for memory profile action.
2785 Only needed for user defined allocate action.
2787 @return EFI_SUCCESS Memory profile is updated.
2788 @return EFI_UNSUPPORTED Memory profile is unsupported,
2789 or memory profile for the image is not required,
2790 or memory profile for the memory type is not required.
2791 @return EFI_ACCESS_DENIED It is during memory profile data getting.
2792 @return EFI_ABORTED Memory profile recording is not enabled.
2793 @return EFI_OUT_OF_RESOURCES No enough resource to update memory profile for allocate action.
2794 @return EFI_NOT_FOUND No matched allocate info found for free action.
2800 IN EFI_PHYSICAL_ADDRESS CallerAddress
,
2801 IN MEMORY_PROFILE_ACTION Action
,
2802 IN EFI_MEMORY_TYPE MemoryType
,
2803 IN UINTN Size
, // Valid for AllocatePages/FreePages/AllocatePool
2805 IN CHAR8
*ActionString OPTIONAL
2809 Internal function. Converts a memory range to use new attributes.
2811 @param Start The first address of the range Must be page
2813 @param NumberOfPages The number of pages to convert
2814 @param NewAttributes The new attributes value for the range.
2818 CoreUpdateMemoryAttributes (
2819 IN EFI_PHYSICAL_ADDRESS Start
,
2820 IN UINT64 NumberOfPages
,
2821 IN UINT64 NewAttributes
2825 Initialize PropertiesTable support.
2829 CoreInitializePropertiesTable (
2834 Initialize MemoryAttrubutesTable support.
2838 CoreInitializeMemoryAttributesTable (
2843 Initialize Memory Protection support.
2847 CoreInitializeMemoryProtection (
2852 Install MemoryAttributesTable on memory allocation.
2854 @param[in] MemoryType EFI memory type.
2857 InstallMemoryAttributesTableOnMemoryAllocation (
2858 IN EFI_MEMORY_TYPE MemoryType
2862 Insert image record.
2864 @param RuntimeImage Runtime image information
2868 IN EFI_RUNTIME_IMAGE_ENTRY
*RuntimeImage
2872 Remove Image record.
2874 @param RuntimeImage Runtime image information
2878 IN EFI_RUNTIME_IMAGE_ENTRY
*RuntimeImage
2884 @param[in] LoadedImage The loaded image protocol
2885 @param[in] LoadedImageDevicePath The loaded image device path protocol
2889 IN EFI_LOADED_IMAGE_PROTOCOL
*LoadedImage
,
2890 IN EFI_DEVICE_PATH_PROTOCOL
*LoadedImageDevicePath
2894 Unprotect UEFI image.
2896 @param[in] LoadedImage The loaded image protocol
2897 @param[in] LoadedImageDevicePath The loaded image device path protocol
2900 UnprotectUefiImage (
2901 IN EFI_LOADED_IMAGE_PROTOCOL
*LoadedImage
,
2902 IN EFI_DEVICE_PATH_PROTOCOL
*LoadedImageDevicePath
2906 ExitBootServices Callback function for memory protection.
2909 MemoryProtectionExitBootServicesCallback (
2914 Manage memory permission attributes on a memory range, according to the
2915 configured DXE memory protection policy.
2917 @param OldType The old memory type of the range
2918 @param NewType The new memory type of the range
2919 @param Memory The base address of the range
2920 @param Length The size of the range (in bytes)
2922 @return EFI_SUCCESS If the the CPU arch protocol is not installed yet
2923 @return EFI_SUCCESS If no DXE memory protection policy has been configured
2924 @return EFI_SUCCESS If OldType and NewType use the same permission attributes
2925 @return other Return value of gCpu->SetMemoryAttributes()
2930 ApplyMemoryProtectionPolicy (
2931 IN EFI_MEMORY_TYPE OldType
,
2932 IN EFI_MEMORY_TYPE NewType
,
2933 IN EFI_PHYSICAL_ADDRESS Memory
,
2938 Merge continous memory map entries whose have same attributes.
2940 @param MemoryMap A pointer to the buffer in which firmware places
2941 the current memory map.
2942 @param MemoryMapSize A pointer to the size, in bytes, of the
2943 MemoryMap buffer. On input, this is the size of
2944 the current memory map. On output,
2945 it is the size of new memory map after merge.
2946 @param DescriptorSize Size, in bytes, of an individual EFI_MEMORY_DESCRIPTOR.
2950 IN OUT EFI_MEMORY_DESCRIPTOR
*MemoryMap
,
2951 IN OUT UINTN
*MemoryMapSize
,
2952 IN UINTN DescriptorSize