2 The internal header file includes the common header files, defines
3 internal structure and functions used by DxeCore module.
5 Copyright (c) 2006 - 2017, 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/TimerLib.h>
93 #include <Library/DxeServicesLib.h>
94 #include <Library/DebugAgentLib.h>
95 #include <Library/CpuExceptionHandlerLib.h>
99 // attributes for reserved memory before it is promoted to system memory
101 #define EFI_MEMORY_PRESENT 0x0100000000000000ULL
102 #define EFI_MEMORY_INITIALIZED 0x0200000000000000ULL
103 #define EFI_MEMORY_TESTED 0x0400000000000000ULL
106 // range for memory mapped port I/O on IPF
108 #define EFI_MEMORY_PORT_IO 0x4000000000000000ULL
112 /// EFI_DEP_REPLACE_TRUE - Used to dynamically patch the dependency expression
113 /// to save time. A EFI_DEP_PUSH is evaluated one an
114 /// replaced with EFI_DEP_REPLACE_TRUE. If PI spec's Vol 2
115 /// Driver Execution Environment Core Interface use 0xff
116 /// as new DEPEX opcode. EFI_DEP_REPLACE_TRUE should be
117 /// defined to a new value that is not conflicting with PI spec.
119 #define EFI_DEP_REPLACE_TRUE 0xff
122 /// Define the initial size of the dependency expression evaluation stack
124 #define DEPEX_STACK_SIZE_INCREMENT 0x1000
126 #if defined (MDE_CPU_IPF)
128 /// For Itanium machines make the default allocations 8K aligned
130 #define EFI_ACPI_RUNTIME_PAGE_ALLOCATION_ALIGNMENT (EFI_PAGE_SIZE * 2)
131 #define DEFAULT_PAGE_ALLOCATION (EFI_PAGE_SIZE * 2)
133 #elif defined (MDE_CPU_AARCH64)
135 /// 64-bit ARM systems allow the OS to execute with 64 KB page size,
136 /// so for improved interoperability with the firmware, align the
137 /// runtime regions to 64 KB as well
139 #define EFI_ACPI_RUNTIME_PAGE_ALLOCATION_ALIGNMENT (SIZE_64KB)
140 #define DEFAULT_PAGE_ALLOCATION (EFI_PAGE_SIZE)
144 /// For generic EFI machines make the default allocations 4K aligned
146 #define EFI_ACPI_RUNTIME_PAGE_ALLOCATION_ALIGNMENT (EFI_PAGE_SIZE)
147 #define DEFAULT_PAGE_ALLOCATION (EFI_PAGE_SIZE)
152 EFI_GUID
*ProtocolGuid
;
157 } EFI_CORE_PROTOCOL_NOTIFY_ENTRY
;
160 // DXE Dispatcher Data structures
163 #define KNOWN_HANDLE_SIGNATURE SIGNATURE_32('k','n','o','w')
166 LIST_ENTRY Link
; // mFvHandleList
172 #define EFI_CORE_DRIVER_ENTRY_SIGNATURE SIGNATURE_32('d','r','v','r')
175 LIST_ENTRY Link
; // mDriverList
177 LIST_ENTRY ScheduledLink
; // mScheduledQueue
181 EFI_DEVICE_PATH_PROTOCOL
*FvFileDevicePath
;
182 EFI_FIRMWARE_VOLUME2_PROTOCOL
*Fv
;
189 EFI_GUID BeforeAfterGuid
;
196 BOOLEAN DepexProtocolError
;
198 EFI_HANDLE ImageHandle
;
201 } EFI_CORE_DRIVER_ENTRY
;
204 //The data structure of GCD memory map entry
206 #define EFI_GCD_MAP_SIGNATURE SIGNATURE_32('g','c','d','m')
210 EFI_PHYSICAL_ADDRESS BaseAddress
;
214 EFI_GCD_MEMORY_TYPE GcdMemoryType
;
215 EFI_GCD_IO_TYPE GcdIoType
;
216 EFI_HANDLE ImageHandle
;
217 EFI_HANDLE DeviceHandle
;
221 #define LOADED_IMAGE_PRIVATE_DATA_SIGNATURE SIGNATURE_32('l','d','r','i')
229 /// If entrypoint has been called
231 /// The image's entry point
232 EFI_IMAGE_ENTRY_POINT EntryPoint
;
233 /// loaded image protocol
234 EFI_LOADED_IMAGE_PROTOCOL Info
;
235 /// Location in memory
236 EFI_PHYSICAL_ADDRESS ImageBasePage
;
239 /// Original fixup data
241 /// Tpl of started image
243 /// Status returned by started image
245 /// Size of ExitData from started image
247 /// Pointer to exit data from started image
249 /// Pointer to pool allocation for context save/restore
251 /// Pointer to buffer for context save/restore
252 BASE_LIBRARY_JUMP_BUFFER
*JumpContext
;
253 /// Machine type from PE image
255 /// EBC Protocol pointer
256 EFI_EBC_PROTOCOL
*Ebc
;
257 /// Runtime image list
258 EFI_RUNTIME_IMAGE_ENTRY
*RuntimeData
;
259 /// Pointer to Loaded Image Device Path Protocol
260 EFI_DEVICE_PATH_PROTOCOL
*LoadedImageDevicePath
;
261 /// PeCoffLoader ImageContext
262 PE_COFF_LOADER_IMAGE_CONTEXT ImageContext
;
263 /// Status returned by LoadImage() service.
264 EFI_STATUS LoadImageStatus
;
265 } LOADED_IMAGE_PRIVATE_DATA
;
267 #define LOADED_IMAGE_PRIVATE_DATA_FROM_THIS(a) \
268 CR(a, LOADED_IMAGE_PRIVATE_DATA, Info, LOADED_IMAGE_PRIVATE_DATA_SIGNATURE)
271 // DXE Core Global Variables
273 extern EFI_SYSTEM_TABLE
*gDxeCoreST
;
274 extern EFI_RUNTIME_SERVICES
*gDxeCoreRT
;
275 extern EFI_DXE_SERVICES
*gDxeCoreDS
;
276 extern EFI_HANDLE gDxeCoreImageHandle
;
278 extern BOOLEAN gMemoryMapTerminated
;
280 extern EFI_DECOMPRESS_PROTOCOL gEfiDecompress
;
282 extern EFI_RUNTIME_ARCH_PROTOCOL
*gRuntime
;
283 extern EFI_CPU_ARCH_PROTOCOL
*gCpu
;
284 extern EFI_WATCHDOG_TIMER_ARCH_PROTOCOL
*gWatchdogTimer
;
285 extern EFI_METRONOME_ARCH_PROTOCOL
*gMetronome
;
286 extern EFI_TIMER_ARCH_PROTOCOL
*gTimer
;
287 extern EFI_SECURITY_ARCH_PROTOCOL
*gSecurity
;
288 extern EFI_SECURITY2_ARCH_PROTOCOL
*gSecurity2
;
289 extern EFI_BDS_ARCH_PROTOCOL
*gBds
;
290 extern EFI_SMM_BASE2_PROTOCOL
*gSmmBase2
;
292 extern EFI_TPL gEfiCurrentTpl
;
294 extern EFI_GUID
*gDxeCoreFileName
;
295 extern EFI_LOADED_IMAGE_PROTOCOL
*gDxeCoreLoadedImage
;
297 extern EFI_MEMORY_TYPE_INFORMATION gMemoryTypeInformation
[EfiMaxMemoryType
+ 1];
299 extern BOOLEAN gDispatcherRunning
;
300 extern EFI_RUNTIME_ARCH_PROTOCOL gRuntimeTemplate
;
302 extern EFI_LOAD_FIXED_ADDRESS_CONFIGURATION_TABLE gLoadModuleAtFixAddressConfigurationTable
;
303 extern BOOLEAN gLoadFixedAddressCodeMemoryReady
;
305 // Service Initialization Functions
311 Called to initialize the pool.
321 Called to initialize the memory map and add descriptors to
322 the current descriptor list.
323 The first descriptor that is added must be general usable
324 memory as the addition allocates heap.
326 @param Type The type of memory to add
327 @param Start The starting address in the memory range Must be
329 @param NumberOfPages The number of pages in the range
330 @param Attribute Attributes of the memory to add
332 @return None. The range is added to the memory map
336 CoreAddMemoryDescriptor (
337 IN EFI_MEMORY_TYPE Type
,
338 IN EFI_PHYSICAL_ADDRESS Start
,
339 IN UINT64 NumberOfPages
,
345 Release memory lock on mGcdMemorySpaceLock.
349 CoreReleaseGcdMemoryLock (
355 Acquire memory lock on mGcdMemorySpaceLock.
359 CoreAcquireGcdMemoryLock (
365 External function. Initializes memory services based on the memory
366 descriptor HOBs. This function is responsible for priming the memory
367 map, so memory allocations and resource allocations can be made.
368 The first part of this function can not depend on any memory services
369 until at least one memory descriptor is provided to the memory services.
371 @param HobStart The start address of the HOB.
372 @param MemoryBaseAddress Start address of memory region found to init DXE
374 @param MemoryLength Length of memory region found to init DXE core.
376 @retval EFI_SUCCESS Memory services successfully initialized.
380 CoreInitializeMemoryServices (
382 OUT EFI_PHYSICAL_ADDRESS
*MemoryBaseAddress
,
383 OUT UINT64
*MemoryLength
389 External function. Initializes the GCD and memory services based on the memory
390 descriptor HOBs. This function is responsible for priming the GCD map and the
391 memory map, so memory allocations and resource allocations can be made. The
392 HobStart will be relocated to a pool buffer.
394 @param HobStart The start address of the HOB
395 @param MemoryBaseAddress Start address of memory region found to init DXE
397 @param MemoryLength Length of memory region found to init DXE core.
399 @retval EFI_SUCCESS GCD services successfully initialized.
403 CoreInitializeGcdServices (
404 IN OUT VOID
**HobStart
,
405 IN EFI_PHYSICAL_ADDRESS MemoryBaseAddress
,
406 IN UINT64 MemoryLength
411 Initializes "event" support.
413 @retval EFI_SUCCESS Always return success
417 CoreInitializeEventServices (
423 Add the Image Services to EFI Boot Services Table and install the protocol
424 interfaces for this image.
426 @param HobStart The HOB to initialize
432 CoreInitializeImageServices (
438 Creates an event that is fired everytime a Protocol of a specific type is installed.
442 CoreNotifyOnProtocolInstallation (
448 Return TRUE if all AP services are available.
450 @retval EFI_SUCCESS All AP services are available
451 @retval EFI_NOT_FOUND At least one AP service is not available
455 CoreAllEfiServicesAvailable (
461 Calcualte the 32-bit CRC in a EFI table using the service provided by the
464 @param Hdr Pointer to an EFI standard header
469 IN OUT EFI_TABLE_HEADER
*Hdr
474 Called by the platform code to process a tick.
476 @param Duration The number of 100ns elapsed since the last call
488 Initialize the dispatcher. Initialize the notification function that runs when
489 an FV2 protocol is added to the system.
493 CoreInitializeDispatcher (
499 This is the POSTFIX version of the dependency evaluator. This code does
500 not need to handle Before or After, as it is not valid to call this
501 routine in this case. The SOR is just ignored and is a nop in the grammer.
502 POSTFIX means all the math is done on top of the stack.
504 @param DriverEntry DriverEntry element to update.
506 @retval TRUE If driver is ready to run.
507 @retval FALSE If driver is not ready to run or some fatal error
513 IN EFI_CORE_DRIVER_ENTRY
*DriverEntry
518 Preprocess dependency expression and update DriverEntry to reflect the
519 state of Before, After, and SOR dependencies. If DriverEntry->Before
520 or DriverEntry->After is set it will never be cleared. If SOR is set
521 it will be cleared by CoreSchedule(), and then the driver can be
524 @param DriverEntry DriverEntry element to update .
526 @retval EFI_SUCCESS It always works.
530 CorePreProcessDepex (
531 IN EFI_CORE_DRIVER_ENTRY
*DriverEntry
537 Terminates all boot services.
539 @param ImageHandle Handle that identifies the exiting image.
540 @param MapKey Key to the latest memory map.
542 @retval EFI_SUCCESS Boot Services terminated
543 @retval EFI_INVALID_PARAMETER MapKey is incorrect.
548 CoreExitBootServices (
549 IN EFI_HANDLE ImageHandle
,
555 Make sure the memory map is following all the construction rules,
556 it is the last time to check memory map error before exit boot services.
558 @param MapKey Memory map key
560 @retval EFI_INVALID_PARAMETER Memory map not consistent with construction
562 @retval EFI_SUCCESS Valid memory map.
566 CoreTerminateMemoryMap (
572 Signals all events in the EventGroup.
574 @param EventGroup The list to signal
578 CoreNotifySignalList (
579 IN EFI_GUID
*EventGroup
585 Boot Service called to add, modify, or remove a system configuration table from
586 the EFI System Table.
588 @param Guid Pointer to the GUID for the entry to add, update, or
590 @param Table Pointer to the configuration table for the entry to add,
591 update, or remove, may be NULL.
593 @return EFI_SUCCESS Guid, Table pair added, updated, or removed.
594 @return EFI_INVALID_PARAMETER Input GUID not valid.
595 @return EFI_NOT_FOUND Attempted to delete non-existant entry
596 @return EFI_OUT_OF_RESOURCES Not enough memory available
601 CoreInstallConfigurationTable (
609 Raise the task priority level to the new level.
610 High level is implemented by disabling processor interrupts.
612 @param NewTpl New task priority level
614 @return The previous task priority level
626 Lowers the task priority to the previous value. If the new
627 priority unmasks events at a higher priority, they are dispatched.
629 @param NewTpl New, lower, task priority
641 Introduces a fine-grained stall.
643 @param Microseconds The number of microseconds to stall execution.
645 @retval EFI_SUCCESS Execution was stalled for at least the requested
646 amount of microseconds.
647 @retval EFI_NOT_AVAILABLE_YET gMetronome is not available yet
653 IN UINTN Microseconds
659 Sets the system's watchdog timer.
661 @param Timeout The number of seconds to set the watchdog timer to.
662 A value of zero disables the timer.
663 @param WatchdogCode The numeric code to log on a watchdog timer timeout
664 event. The firmware reserves codes 0x0000 to 0xFFFF.
665 Loaders and operating systems may use other timeout
667 @param DataSize The size, in bytes, of WatchdogData.
668 @param WatchdogData A data buffer that includes a Null-terminated Unicode
669 string, optionally followed by additional binary data.
670 The string is a description that the call may use to
671 further indicate the reason to be logged with a
674 @return EFI_SUCCESS Timeout has been set
675 @return EFI_NOT_AVAILABLE_YET WatchdogTimer is not available yet
676 @return EFI_UNSUPPORTED System does not have a timer (currently not used)
677 @return EFI_DEVICE_ERROR Could not complete due to hardware error
682 CoreSetWatchdogTimer (
684 IN UINT64 WatchdogCode
,
686 IN CHAR16
*WatchdogData OPTIONAL
692 Wrapper function to CoreInstallProtocolInterfaceNotify. This is the public API which
693 Calls the private one which contains a BOOLEAN parameter for notifications
695 @param UserHandle The handle to install the protocol handler on,
696 or NULL if a new handle is to be allocated
697 @param Protocol The protocol to add to the handle
698 @param InterfaceType Indicates whether Interface is supplied in
700 @param Interface The interface for the protocol being added
707 CoreInstallProtocolInterface (
708 IN OUT EFI_HANDLE
*UserHandle
,
709 IN EFI_GUID
*Protocol
,
710 IN EFI_INTERFACE_TYPE InterfaceType
,
716 Installs a protocol interface into the boot services environment.
718 @param UserHandle The handle to install the protocol handler on,
719 or NULL if a new handle is to be allocated
720 @param Protocol The protocol to add to the handle
721 @param InterfaceType Indicates whether Interface is supplied in
723 @param Interface The interface for the protocol being added
724 @param Notify indicates whether notify the notification list
727 @retval EFI_INVALID_PARAMETER Invalid parameter
728 @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate
729 @retval EFI_SUCCESS Protocol interface successfully installed
733 CoreInstallProtocolInterfaceNotify (
734 IN OUT EFI_HANDLE
*UserHandle
,
735 IN EFI_GUID
*Protocol
,
736 IN EFI_INTERFACE_TYPE InterfaceType
,
744 Installs a list of protocol interface into the boot services environment.
745 This function calls InstallProtocolInterface() in a loop. If any error
746 occures all the protocols added by this function are removed. This is
747 basically a lib function to save space.
749 @param Handle The handle to install the protocol handlers on,
750 or NULL if a new handle is to be allocated
751 @param ... EFI_GUID followed by protocol instance. A NULL
752 terminates the list. The pairs are the
753 arguments to InstallProtocolInterface(). All the
754 protocols are added to Handle.
756 @retval EFI_SUCCESS All the protocol interface was installed.
757 @retval EFI_OUT_OF_RESOURCES There was not enough memory in pool to install all the protocols.
758 @retval EFI_ALREADY_STARTED A Device Path Protocol instance was passed in that is already present in
760 @retval EFI_INVALID_PARAMETER Handle is NULL.
761 @retval EFI_INVALID_PARAMETER Protocol is already installed on the handle specified by Handle.
766 CoreInstallMultipleProtocolInterfaces (
767 IN OUT EFI_HANDLE
*Handle
,
774 Uninstalls a list of protocol interface in the boot services environment.
775 This function calls UnisatllProtocolInterface() in a loop. This is
776 basically a lib function to save space.
778 @param Handle The handle to uninstall the protocol
779 @param ... EFI_GUID followed by protocol instance. A NULL
780 terminates the list. The pairs are the
781 arguments to UninstallProtocolInterface(). All
782 the protocols are added to Handle.
789 CoreUninstallMultipleProtocolInterfaces (
790 IN EFI_HANDLE Handle
,
797 Reinstall a protocol interface on a device handle. The OldInterface for Protocol is replaced by the NewInterface.
799 @param UserHandle Handle on which the interface is to be
801 @param Protocol The numeric ID of the interface
802 @param OldInterface A pointer to the old interface
803 @param NewInterface A pointer to the new interface
805 @retval EFI_SUCCESS The protocol interface was installed
806 @retval EFI_NOT_FOUND The OldInterface on the handle was not found
807 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value
812 CoreReinstallProtocolInterface (
813 IN EFI_HANDLE UserHandle
,
814 IN EFI_GUID
*Protocol
,
815 IN VOID
*OldInterface
,
816 IN VOID
*NewInterface
822 Uninstalls all instances of a protocol:interfacer from a handle.
823 If the last protocol interface is remove from the handle, the
826 @param UserHandle The handle to remove the protocol handler from
827 @param Protocol The protocol, of protocol:interface, to remove
828 @param Interface The interface, of protocol:interface, to remove
830 @retval EFI_INVALID_PARAMETER Protocol is NULL.
831 @retval EFI_SUCCESS Protocol interface successfully uninstalled.
836 CoreUninstallProtocolInterface (
837 IN EFI_HANDLE UserHandle
,
838 IN EFI_GUID
*Protocol
,
845 Queries a handle to determine if it supports a specified protocol.
847 @param UserHandle The handle being queried.
848 @param Protocol The published unique identifier of the protocol.
849 @param Interface Supplies the address where a pointer to the
850 corresponding Protocol Interface is returned.
852 @return The requested protocol interface for the handle
858 IN EFI_HANDLE UserHandle
,
859 IN EFI_GUID
*Protocol
,
866 Locates the installed protocol handler for the handle, and
867 invokes it to obtain the protocol interface. Usage information
868 is registered in the protocol data base.
870 @param UserHandle The handle to obtain the protocol interface on
871 @param Protocol The ID of the protocol
872 @param Interface The location to return the protocol interface
873 @param ImageHandle The handle of the Image that is opening the
874 protocol interface specified by Protocol and
876 @param ControllerHandle The controller handle that is requiring this
878 @param Attributes The open mode of the protocol interface
879 specified by Handle and Protocol.
881 @retval EFI_INVALID_PARAMETER Protocol is NULL.
882 @retval EFI_SUCCESS Get the protocol interface.
888 IN EFI_HANDLE UserHandle
,
889 IN EFI_GUID
*Protocol
,
890 OUT VOID
**Interface OPTIONAL
,
891 IN EFI_HANDLE ImageHandle
,
892 IN EFI_HANDLE ControllerHandle
,
899 Return information about Opened protocols in the system
901 @param UserHandle The handle to close the protocol interface on
902 @param Protocol The ID of the protocol
903 @param EntryBuffer A pointer to a buffer of open protocol
904 information in the form of
905 EFI_OPEN_PROTOCOL_INFORMATION_ENTRY structures.
906 @param EntryCount Number of EntryBuffer entries
911 CoreOpenProtocolInformation (
912 IN EFI_HANDLE UserHandle
,
913 IN EFI_GUID
*Protocol
,
914 OUT EFI_OPEN_PROTOCOL_INFORMATION_ENTRY
**EntryBuffer
,
915 OUT UINTN
*EntryCount
921 Closes a protocol on a handle that was opened using OpenProtocol().
923 @param UserHandle The handle for the protocol interface that was
924 previously opened with OpenProtocol(), and is
926 @param Protocol The published unique identifier of the protocol.
927 It is the caller's responsibility to pass in a
929 @param AgentHandle The handle of the agent that is closing the
931 @param ControllerHandle If the agent that opened a protocol is a driver
932 that follows the EFI Driver Model, then this
933 parameter is the controller handle that required
934 the protocol interface. If the agent does not
935 follow the EFI Driver Model, then this parameter
936 is optional and may be NULL.
938 @retval EFI_SUCCESS The protocol instance was closed.
939 @retval EFI_INVALID_PARAMETER Handle, AgentHandle or ControllerHandle is not a
941 @retval EFI_NOT_FOUND Can not find the specified protocol or
948 IN EFI_HANDLE UserHandle
,
949 IN EFI_GUID
*Protocol
,
950 IN EFI_HANDLE AgentHandle
,
951 IN EFI_HANDLE ControllerHandle
957 Retrieves the list of protocol interface GUIDs that are installed on a handle in a buffer allocated
960 @param UserHandle The handle from which to retrieve the list of
961 protocol interface GUIDs.
962 @param ProtocolBuffer A pointer to the list of protocol interface GUID
963 pointers that are installed on Handle.
964 @param ProtocolBufferCount A pointer to the number of GUID pointers present
967 @retval EFI_SUCCESS The list of protocol interface GUIDs installed
968 on Handle was returned in ProtocolBuffer. The
969 number of protocol interface GUIDs was returned
970 in ProtocolBufferCount.
971 @retval EFI_INVALID_PARAMETER Handle is NULL.
972 @retval EFI_INVALID_PARAMETER Handle is not a valid EFI_HANDLE.
973 @retval EFI_INVALID_PARAMETER ProtocolBuffer is NULL.
974 @retval EFI_INVALID_PARAMETER ProtocolBufferCount is NULL.
975 @retval EFI_OUT_OF_RESOURCES There is not enough pool memory to store the
981 CoreProtocolsPerHandle (
982 IN EFI_HANDLE UserHandle
,
983 OUT EFI_GUID
***ProtocolBuffer
,
984 OUT UINTN
*ProtocolBufferCount
990 Add a new protocol notification record for the request protocol.
992 @param Protocol The requested protocol to add the notify
994 @param Event The event to signal
995 @param Registration Returns the registration record
997 @retval EFI_INVALID_PARAMETER Invalid parameter
998 @retval EFI_SUCCESS Successfully returned the registration record
1004 CoreRegisterProtocolNotify (
1005 IN EFI_GUID
*Protocol
,
1007 OUT VOID
**Registration
1012 Removes all the events in the protocol database that match Event.
1014 @param Event The event to search for in the protocol
1017 @return EFI_SUCCESS when done searching the entire database.
1021 CoreUnregisterProtocolNotify (
1027 Locates the requested handle(s) and returns them in Buffer.
1029 @param SearchType The type of search to perform to locate the
1031 @param Protocol The protocol to search for
1032 @param SearchKey Dependant on SearchType
1033 @param BufferSize On input the size of Buffer. On output the
1034 size of data returned.
1035 @param Buffer The buffer to return the results in
1037 @retval EFI_BUFFER_TOO_SMALL Buffer too small, required buffer size is
1038 returned in BufferSize.
1039 @retval EFI_INVALID_PARAMETER Invalid parameter
1040 @retval EFI_SUCCESS Successfully found the requested handle(s) and
1041 returns them in Buffer.
1047 IN EFI_LOCATE_SEARCH_TYPE SearchType
,
1048 IN EFI_GUID
*Protocol OPTIONAL
,
1049 IN VOID
*SearchKey OPTIONAL
,
1050 IN OUT UINTN
*BufferSize
,
1051 OUT EFI_HANDLE
*Buffer
1057 Locates the handle to a device on the device path that best matches the specified protocol.
1059 @param Protocol The protocol to search for.
1060 @param DevicePath On input, a pointer to a pointer to the device
1061 path. On output, the device path pointer is
1062 modified to point to the remaining part of the
1064 @param Device A pointer to the returned device handle.
1066 @retval EFI_SUCCESS The resulting handle was returned.
1067 @retval EFI_NOT_FOUND No handles matched the search.
1068 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
1073 CoreLocateDevicePath (
1074 IN EFI_GUID
*Protocol
,
1075 IN OUT EFI_DEVICE_PATH_PROTOCOL
**DevicePath
,
1076 OUT EFI_HANDLE
*Device
1082 Function returns an array of handles that support the requested protocol
1083 in a buffer allocated from pool. This is a version of CoreLocateHandle()
1084 that allocates a buffer for the caller.
1086 @param SearchType Specifies which handle(s) are to be returned.
1087 @param Protocol Provides the protocol to search by. This
1088 parameter is only valid for SearchType
1090 @param SearchKey Supplies the search key depending on the
1092 @param NumberHandles The number of handles returned in Buffer.
1093 @param Buffer A pointer to the buffer to return the requested
1094 array of handles that support Protocol.
1096 @retval EFI_SUCCESS The result array of handles was returned.
1097 @retval EFI_NOT_FOUND No handles match the search.
1098 @retval EFI_OUT_OF_RESOURCES There is not enough pool memory to store the
1100 @retval EFI_INVALID_PARAMETER One or more parameters are not valid.
1105 CoreLocateHandleBuffer (
1106 IN EFI_LOCATE_SEARCH_TYPE SearchType
,
1107 IN EFI_GUID
*Protocol OPTIONAL
,
1108 IN VOID
*SearchKey OPTIONAL
,
1109 IN OUT UINTN
*NumberHandles
,
1110 OUT EFI_HANDLE
**Buffer
1116 Return the first Protocol Interface that matches the Protocol GUID. If
1117 Registration is passed in, return a Protocol Instance that was just add
1118 to the system. If Registration is NULL return the first Protocol Interface
1121 @param Protocol The protocol to search for
1122 @param Registration Optional Registration Key returned from
1123 RegisterProtocolNotify()
1124 @param Interface Return the Protocol interface (instance).
1126 @retval EFI_SUCCESS If a valid Interface is returned
1127 @retval EFI_INVALID_PARAMETER Invalid parameter
1128 @retval EFI_NOT_FOUND Protocol interface not found
1133 CoreLocateProtocol (
1134 IN EFI_GUID
*Protocol
,
1135 IN VOID
*Registration OPTIONAL
,
1136 OUT VOID
**Interface
1141 return handle database key.
1144 @return Handle database key.
1148 CoreGetHandleDatabaseKey (
1154 Go connect any handles that were created or modified while a image executed.
1156 @param Key The Key to show that the handle has been
1161 CoreConnectHandlesByKey (
1168 Connects one or more drivers to a controller.
1170 @param ControllerHandle The handle of the controller to which driver(s) are to be connected.
1171 @param DriverImageHandle A pointer to an ordered list handles that support the
1172 EFI_DRIVER_BINDING_PROTOCOL.
1173 @param RemainingDevicePath A pointer to the device path that specifies a child of the
1174 controller specified by ControllerHandle.
1175 @param Recursive If TRUE, then ConnectController() is called recursively
1176 until the entire tree of controllers below the controller specified
1177 by ControllerHandle have been created. If FALSE, then
1178 the tree of controllers is only expanded one level.
1180 @retval EFI_SUCCESS 1) One or more drivers were connected to ControllerHandle.
1181 2) No drivers were connected to ControllerHandle, but
1182 RemainingDevicePath is not NULL, and it is an End Device
1184 @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.
1185 @retval EFI_NOT_FOUND 1) There are no EFI_DRIVER_BINDING_PROTOCOL instances
1186 present in the system.
1187 2) No drivers were connected to ControllerHandle.
1188 @retval EFI_SECURITY_VIOLATION
1189 The user has no permission to start UEFI device drivers on the device path
1190 associated with the ControllerHandle or specified by the RemainingDevicePath.
1195 CoreConnectController (
1196 IN EFI_HANDLE ControllerHandle
,
1197 IN EFI_HANDLE
*DriverImageHandle OPTIONAL
,
1198 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath OPTIONAL
,
1199 IN BOOLEAN Recursive
1205 Disonnects a controller from a driver
1207 @param ControllerHandle ControllerHandle The handle of
1208 the controller from which
1211 @param DriverImageHandle DriverImageHandle The driver to
1212 disconnect from ControllerHandle.
1213 @param ChildHandle ChildHandle The handle of the
1216 @retval EFI_SUCCESS One or more drivers were
1217 disconnected from the controller.
1218 @retval EFI_SUCCESS On entry, no drivers are managing
1220 @retval EFI_SUCCESS DriverImageHandle is not NULL,
1221 and on entry DriverImageHandle is
1222 not managing ControllerHandle.
1223 @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.
1224 @retval EFI_INVALID_PARAMETER DriverImageHandle is not NULL,
1225 and it is not a valid EFI_HANDLE.
1226 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL, and it
1227 is not a valid EFI_HANDLE.
1228 @retval EFI_OUT_OF_RESOURCES There are not enough resources
1229 available to disconnect any
1230 drivers from ControllerHandle.
1231 @retval EFI_DEVICE_ERROR The controller could not be
1232 disconnected because of a device
1238 CoreDisconnectController (
1239 IN EFI_HANDLE ControllerHandle
,
1240 IN EFI_HANDLE DriverImageHandle OPTIONAL
,
1241 IN EFI_HANDLE ChildHandle OPTIONAL
1247 Allocates pages from the memory map.
1249 @param Type The type of allocation to perform
1250 @param MemoryType The type of memory to turn the allocated pages
1252 @param NumberOfPages The number of pages to allocate
1253 @param Memory A pointer to receive the base allocated memory
1256 @return Status. On success, Memory is filled in with the base address allocated
1257 @retval EFI_INVALID_PARAMETER Parameters violate checking rules defined in
1259 @retval EFI_NOT_FOUND Could not allocate pages match the requirement.
1260 @retval EFI_OUT_OF_RESOURCES No enough pages to allocate.
1261 @retval EFI_SUCCESS Pages successfully allocated.
1267 IN EFI_ALLOCATE_TYPE Type
,
1268 IN EFI_MEMORY_TYPE MemoryType
,
1269 IN UINTN NumberOfPages
,
1270 IN OUT EFI_PHYSICAL_ADDRESS
*Memory
1274 Frees previous allocated pages.
1276 @param Memory Base address of memory being freed
1277 @param NumberOfPages The number of pages to free
1279 @retval EFI_NOT_FOUND Could not find the entry that covers the range
1280 @retval EFI_INVALID_PARAMETER Address not aligned
1281 @return EFI_SUCCESS -Pages successfully freed.
1287 IN EFI_PHYSICAL_ADDRESS Memory
,
1288 IN UINTN NumberOfPages
1292 This function returns a copy of the current memory map. The map is an array of
1293 memory descriptors, each of which describes a contiguous block of memory.
1295 @param MemoryMapSize A pointer to the size, in bytes, of the
1296 MemoryMap buffer. On input, this is the size of
1297 the buffer allocated by the caller. On output,
1298 it is the size of the buffer returned by the
1299 firmware if the buffer was large enough, or the
1300 size of the buffer needed to contain the map if
1301 the buffer was too small.
1302 @param MemoryMap A pointer to the buffer in which firmware places
1303 the current memory map.
1304 @param MapKey A pointer to the location in which firmware
1305 returns the key for the current memory map.
1306 @param DescriptorSize A pointer to the location in which firmware
1307 returns the size, in bytes, of an individual
1308 EFI_MEMORY_DESCRIPTOR.
1309 @param DescriptorVersion A pointer to the location in which firmware
1310 returns the version number associated with the
1311 EFI_MEMORY_DESCRIPTOR.
1313 @retval EFI_SUCCESS The memory map was returned in the MemoryMap
1315 @retval EFI_BUFFER_TOO_SMALL The MemoryMap buffer was too small. The current
1316 buffer size needed to hold the memory map is
1317 returned in MemoryMapSize.
1318 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
1324 IN OUT UINTN
*MemoryMapSize
,
1325 IN OUT EFI_MEMORY_DESCRIPTOR
*MemoryMap
,
1327 OUT UINTN
*DescriptorSize
,
1328 OUT UINT32
*DescriptorVersion
1334 Allocate pool of a particular type.
1336 @param PoolType Type of pool to allocate
1337 @param Size The amount of pool to allocate
1338 @param Buffer The address to return a pointer to the allocated
1341 @retval EFI_INVALID_PARAMETER PoolType not valid or Buffer is NULL
1342 @retval EFI_OUT_OF_RESOURCES Size exceeds max pool size or allocation failed.
1343 @retval EFI_SUCCESS Pool successfully allocated.
1349 IN EFI_MEMORY_TYPE PoolType
,
1355 Allocate pool of a particular type.
1357 @param PoolType Type of pool to allocate
1358 @param Size The amount of pool to allocate
1359 @param Buffer The address to return a pointer to the allocated
1362 @retval EFI_INVALID_PARAMETER PoolType not valid or Buffer is NULL
1363 @retval EFI_OUT_OF_RESOURCES Size exceeds max pool size or allocation failed.
1364 @retval EFI_SUCCESS Pool successfully allocated.
1369 CoreInternalAllocatePool (
1370 IN EFI_MEMORY_TYPE PoolType
,
1378 @param Buffer The allocated pool entry to free
1380 @retval EFI_INVALID_PARAMETER Buffer is not a valid value.
1381 @retval EFI_SUCCESS Pool successfully freed.
1393 @param Buffer The allocated pool entry to free
1394 @param PoolType Pointer to pool type
1396 @retval EFI_INVALID_PARAMETER Buffer is not a valid value.
1397 @retval EFI_SUCCESS Pool successfully freed.
1402 CoreInternalFreePool (
1404 OUT EFI_MEMORY_TYPE
*PoolType OPTIONAL
1408 Loads an EFI image into memory and returns a handle to the image.
1410 @param BootPolicy If TRUE, indicates that the request originates
1411 from the boot manager, and that the boot
1412 manager is attempting to load FilePath as a
1414 @param ParentImageHandle The caller's image handle.
1415 @param FilePath The specific file path from which the image is
1417 @param SourceBuffer If not NULL, a pointer to the memory location
1418 containing a copy of the image to be loaded.
1419 @param SourceSize The size in bytes of SourceBuffer.
1420 @param ImageHandle Pointer to the returned image handle that is
1421 created when the image is successfully loaded.
1423 @retval EFI_SUCCESS The image was loaded into memory.
1424 @retval EFI_NOT_FOUND The FilePath was not found.
1425 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
1426 @retval EFI_UNSUPPORTED The image type is not supported, or the device
1427 path cannot be parsed to locate the proper
1428 protocol for loading the file.
1429 @retval EFI_OUT_OF_RESOURCES Image was not loaded due to insufficient
1431 @retval EFI_LOAD_ERROR Image was not loaded because the image format was corrupt or not
1433 @retval EFI_DEVICE_ERROR Image was not loaded because the device returned a read error.
1434 @retval EFI_ACCESS_DENIED Image was not loaded because the platform policy prohibits the
1435 image from being loaded. NULL is returned in *ImageHandle.
1436 @retval EFI_SECURITY_VIOLATION Image was loaded and an ImageHandle was created with a
1437 valid EFI_LOADED_IMAGE_PROTOCOL. However, the current
1438 platform policy specifies that the image should not be started.
1444 IN BOOLEAN BootPolicy
,
1445 IN EFI_HANDLE ParentImageHandle
,
1446 IN EFI_DEVICE_PATH_PROTOCOL
*FilePath
,
1447 IN VOID
*SourceBuffer OPTIONAL
,
1448 IN UINTN SourceSize
,
1449 OUT EFI_HANDLE
*ImageHandle
1457 @param ImageHandle Handle that identifies the image to be
1460 @retval EFI_SUCCESS The image has been unloaded.
1461 @retval EFI_UNSUPPORTED The image has been started, and does not support
1463 @retval EFI_INVALID_PARAMPETER ImageHandle is not a valid image handle.
1469 IN EFI_HANDLE ImageHandle
1475 Transfer control to a loaded image's entry point.
1477 @param ImageHandle Handle of image to be started.
1478 @param ExitDataSize Pointer of the size to ExitData
1479 @param ExitData Pointer to a pointer to a data buffer that
1480 includes a Null-terminated string,
1481 optionally followed by additional binary data.
1482 The string is a description that the caller may
1483 use to further indicate the reason for the
1486 @retval EFI_INVALID_PARAMETER Invalid parameter
1487 @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate
1488 @retval EFI_SECURITY_VIOLATION The current platform policy specifies that the image should not be started.
1489 @retval EFI_SUCCESS Successfully transfer control to the image's
1496 IN EFI_HANDLE ImageHandle
,
1497 OUT UINTN
*ExitDataSize
,
1498 OUT CHAR16
**ExitData OPTIONAL
1504 Terminates the currently loaded EFI image and returns control to boot services.
1506 @param ImageHandle Handle that identifies the image. This
1507 parameter is passed to the image on entry.
1508 @param Status The image's exit code.
1509 @param ExitDataSize The size, in bytes, of ExitData. Ignored if
1510 ExitStatus is EFI_SUCCESS.
1511 @param ExitData Pointer to a data buffer that includes a
1512 Null-terminated Unicode string, optionally
1513 followed by additional binary data. The string
1514 is a description that the caller may use to
1515 further indicate the reason for the image's
1518 @retval EFI_INVALID_PARAMETER Image handle is NULL or it is not current
1520 @retval EFI_SUCCESS Successfully terminates the currently loaded
1522 @retval EFI_ACCESS_DENIED Should never reach there.
1523 @retval EFI_OUT_OF_RESOURCES Could not allocate pool
1529 IN EFI_HANDLE ImageHandle
,
1530 IN EFI_STATUS Status
,
1531 IN UINTN ExitDataSize
,
1532 IN CHAR16
*ExitData OPTIONAL
1540 @param Type The type of event to create and its mode and
1542 @param NotifyTpl The task priority level of event notifications
1543 @param NotifyFunction Pointer to the events notification function
1544 @param NotifyContext Pointer to the notification functions context;
1545 corresponds to parameter "Context" in the
1546 notification function
1547 @param Event Pointer to the newly created event if the call
1548 succeeds; undefined otherwise
1550 @retval EFI_SUCCESS The event structure was created
1551 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value
1552 @retval EFI_OUT_OF_RESOURCES The event could not be allocated
1559 IN EFI_TPL NotifyTpl
,
1560 IN EFI_EVENT_NOTIFY NotifyFunction
, OPTIONAL
1561 IN VOID
*NotifyContext
, OPTIONAL
1562 OUT EFI_EVENT
*Event
1568 Creates an event in a group.
1570 @param Type The type of event to create and its mode and
1572 @param NotifyTpl The task priority level of event notifications
1573 @param NotifyFunction Pointer to the events notification function
1574 @param NotifyContext Pointer to the notification functions context;
1575 corresponds to parameter "Context" in the
1576 notification function
1577 @param EventGroup GUID for EventGroup if NULL act the same as
1579 @param Event Pointer to the newly created event if the call
1580 succeeds; undefined otherwise
1582 @retval EFI_SUCCESS The event structure was created
1583 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value
1584 @retval EFI_OUT_OF_RESOURCES The event could not be allocated
1591 IN EFI_TPL NotifyTpl
,
1592 IN EFI_EVENT_NOTIFY NotifyFunction
, OPTIONAL
1593 IN CONST VOID
*NotifyContext
, OPTIONAL
1594 IN CONST EFI_GUID
*EventGroup
, OPTIONAL
1595 OUT EFI_EVENT
*Event
1599 Creates a general-purpose event structure
1601 @param Type The type of event to create and its mode and
1603 @param NotifyTpl The task priority level of event notifications
1604 @param NotifyFunction Pointer to the events notification function
1605 @param NotifyContext Pointer to the notification functions context;
1606 corresponds to parameter "Context" in the
1607 notification function
1608 @param EventGroup GUID for EventGroup if NULL act the same as
1610 @param Event Pointer to the newly created event if the call
1611 succeeds; undefined otherwise
1613 @retval EFI_SUCCESS The event structure was created
1614 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value
1615 @retval EFI_OUT_OF_RESOURCES The event could not be allocated
1620 CoreCreateEventInternal (
1622 IN EFI_TPL NotifyTpl
,
1623 IN EFI_EVENT_NOTIFY NotifyFunction
, OPTIONAL
1624 IN CONST VOID
*NotifyContext
, OPTIONAL
1625 IN CONST EFI_GUID
*EventGroup
, OPTIONAL
1626 OUT EFI_EVENT
*Event
1630 Sets the type of timer and the trigger time for a timer event.
1632 @param UserEvent The timer event that is to be signaled at the
1634 @param Type The type of time that is specified in
1636 @param TriggerTime The number of 100ns units until the timer
1639 @retval EFI_SUCCESS The event has been set to be signaled at the
1641 @retval EFI_INVALID_PARAMETER Event or Type is not valid
1647 IN EFI_EVENT UserEvent
,
1648 IN EFI_TIMER_DELAY Type
,
1649 IN UINT64 TriggerTime
1655 Signals the event. Queues the event to be notified if needed.
1657 @param UserEvent The event to signal .
1659 @retval EFI_INVALID_PARAMETER Parameters are not valid.
1660 @retval EFI_SUCCESS The event was signaled.
1666 IN EFI_EVENT UserEvent
1672 Stops execution until an event is signaled.
1674 @param NumberOfEvents The number of events in the UserEvents array
1675 @param UserEvents An array of EFI_EVENT
1676 @param UserIndex Pointer to the index of the event which
1677 satisfied the wait condition
1679 @retval EFI_SUCCESS The event indicated by Index was signaled.
1680 @retval EFI_INVALID_PARAMETER The event indicated by Index has a notification
1681 function or Event was not a valid type
1682 @retval EFI_UNSUPPORTED The current TPL is not TPL_APPLICATION
1688 IN UINTN NumberOfEvents
,
1689 IN EFI_EVENT
*UserEvents
,
1690 OUT UINTN
*UserIndex
1696 Closes an event and frees the event structure.
1698 @param UserEvent Event to close
1700 @retval EFI_INVALID_PARAMETER Parameters are not valid.
1701 @retval EFI_SUCCESS The event has been closed
1707 IN EFI_EVENT UserEvent
1713 Check the status of an event.
1715 @param UserEvent The event to check
1717 @retval EFI_SUCCESS The event is in the signaled state
1718 @retval EFI_NOT_READY The event is not in the signaled state
1719 @retval EFI_INVALID_PARAMETER Event is of type EVT_NOTIFY_SIGNAL
1725 IN EFI_EVENT UserEvent
1730 Adds reserved memory, system memory, or memory-mapped I/O resources to the
1731 global coherency domain of the processor.
1733 @param GcdMemoryType Memory type of the memory space.
1734 @param BaseAddress Base address of the memory space.
1735 @param Length Length of the memory space.
1736 @param Capabilities alterable attributes of the memory space.
1738 @retval EFI_SUCCESS Merged this memory space into GCD map.
1743 CoreAddMemorySpace (
1744 IN EFI_GCD_MEMORY_TYPE GcdMemoryType
,
1745 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1747 IN UINT64 Capabilities
1752 Allocates nonexistent memory, reserved memory, system memory, or memorymapped
1753 I/O resources from the global coherency domain of the processor.
1755 @param GcdAllocateType The type of allocate operation
1756 @param GcdMemoryType The desired memory type
1757 @param Alignment Align with 2^Alignment
1758 @param Length Length to allocate
1759 @param BaseAddress Base address to allocate
1760 @param ImageHandle The image handle consume the allocated space.
1761 @param DeviceHandle The device handle consume the allocated space.
1763 @retval EFI_INVALID_PARAMETER Invalid parameter.
1764 @retval EFI_NOT_FOUND No descriptor contains the desired space.
1765 @retval EFI_SUCCESS Memory space successfully allocated.
1770 CoreAllocateMemorySpace (
1771 IN EFI_GCD_ALLOCATE_TYPE GcdAllocateType
,
1772 IN EFI_GCD_MEMORY_TYPE GcdMemoryType
,
1775 IN OUT EFI_PHYSICAL_ADDRESS
*BaseAddress
,
1776 IN EFI_HANDLE ImageHandle
,
1777 IN EFI_HANDLE DeviceHandle OPTIONAL
1782 Frees nonexistent memory, reserved memory, system memory, or memory-mapped
1783 I/O resources from the global coherency domain of the processor.
1785 @param BaseAddress Base address of the memory space.
1786 @param Length Length of the memory space.
1788 @retval EFI_SUCCESS Space successfully freed.
1793 CoreFreeMemorySpace (
1794 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1800 Removes reserved memory, system memory, or memory-mapped I/O resources from
1801 the global coherency domain of the processor.
1803 @param BaseAddress Base address of the memory space.
1804 @param Length Length of the memory space.
1806 @retval EFI_SUCCESS Successfully remove a segment of memory space.
1811 CoreRemoveMemorySpace (
1812 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1818 Retrieves the descriptor for a memory region containing a specified address.
1820 @param BaseAddress Specified start address
1821 @param Descriptor Specified length
1823 @retval EFI_INVALID_PARAMETER Invalid parameter
1824 @retval EFI_SUCCESS Successfully get memory space descriptor.
1829 CoreGetMemorySpaceDescriptor (
1830 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1831 OUT EFI_GCD_MEMORY_SPACE_DESCRIPTOR
*Descriptor
1836 Modifies the attributes for a memory region in the global coherency domain of the
1839 @param BaseAddress Specified start address
1840 @param Length Specified length
1841 @param Attributes Specified attributes
1843 @retval EFI_SUCCESS The attributes were set for the memory region.
1844 @retval EFI_INVALID_PARAMETER Length is zero.
1845 @retval EFI_UNSUPPORTED The processor does not support one or more bytes of the memory
1846 resource range specified by BaseAddress and Length.
1847 @retval EFI_UNSUPPORTED The bit mask of attributes is not support for the memory resource
1848 range specified by BaseAddress and Length.
1849 @retval EFI_ACCESS_DENIED The attributes for the memory resource range specified by
1850 BaseAddress and Length cannot be modified.
1851 @retval EFI_OUT_OF_RESOURCES There are not enough system resources to modify the attributes of
1852 the memory resource range.
1853 @retval EFI_NOT_AVAILABLE_YET The attributes cannot be set because CPU architectural protocol is
1859 CoreSetMemorySpaceAttributes (
1860 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1862 IN UINT64 Attributes
1867 Modifies the capabilities for a memory region in the global coherency domain of the
1870 @param BaseAddress The physical address that is the start address of a memory region.
1871 @param Length The size in bytes of the memory region.
1872 @param Capabilities The bit mask of capabilities that the memory region supports.
1874 @retval EFI_SUCCESS The capabilities were set for the memory region.
1875 @retval EFI_INVALID_PARAMETER Length is zero.
1876 @retval EFI_UNSUPPORTED The capabilities specified by Capabilities do not include the
1877 memory region attributes currently in use.
1878 @retval EFI_ACCESS_DENIED The capabilities for the memory resource range specified by
1879 BaseAddress and Length cannot be modified.
1880 @retval EFI_OUT_OF_RESOURCES There are not enough system resources to modify the capabilities
1881 of the memory resource range.
1885 CoreSetMemorySpaceCapabilities (
1886 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1888 IN UINT64 Capabilities
1893 Returns a map of the memory resources in the global coherency domain of the
1896 @param NumberOfDescriptors Number of descriptors.
1897 @param MemorySpaceMap Descriptor array
1899 @retval EFI_INVALID_PARAMETER Invalid parameter
1900 @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate
1901 @retval EFI_SUCCESS Successfully get memory space map.
1906 CoreGetMemorySpaceMap (
1907 OUT UINTN
*NumberOfDescriptors
,
1908 OUT EFI_GCD_MEMORY_SPACE_DESCRIPTOR
**MemorySpaceMap
1913 Adds reserved I/O or I/O resources to the global coherency domain of the processor.
1915 @param GcdIoType IO type of the segment.
1916 @param BaseAddress Base address of the segment.
1917 @param Length Length of the segment.
1919 @retval EFI_SUCCESS Merged this segment into GCD map.
1920 @retval EFI_INVALID_PARAMETER Parameter not valid
1926 IN EFI_GCD_IO_TYPE GcdIoType
,
1927 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1933 Allocates nonexistent I/O, reserved I/O, or I/O resources from the global coherency
1934 domain of the processor.
1936 @param GcdAllocateType The type of allocate operation
1937 @param GcdIoType The desired IO type
1938 @param Alignment Align with 2^Alignment
1939 @param Length Length to allocate
1940 @param BaseAddress Base address to allocate
1941 @param ImageHandle The image handle consume the allocated space.
1942 @param DeviceHandle The device handle consume the allocated space.
1944 @retval EFI_INVALID_PARAMETER Invalid parameter.
1945 @retval EFI_NOT_FOUND No descriptor contains the desired space.
1946 @retval EFI_SUCCESS IO space successfully allocated.
1951 CoreAllocateIoSpace (
1952 IN EFI_GCD_ALLOCATE_TYPE GcdAllocateType
,
1953 IN EFI_GCD_IO_TYPE GcdIoType
,
1956 IN OUT EFI_PHYSICAL_ADDRESS
*BaseAddress
,
1957 IN EFI_HANDLE ImageHandle
,
1958 IN EFI_HANDLE DeviceHandle OPTIONAL
1963 Frees nonexistent I/O, reserved I/O, or I/O resources from the global coherency
1964 domain of the processor.
1966 @param BaseAddress Base address of the segment.
1967 @param Length Length of the segment.
1969 @retval EFI_SUCCESS Space successfully freed.
1975 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1981 Removes reserved I/O or I/O resources from the global coherency domain of the
1984 @param BaseAddress Base address of the segment.
1985 @param Length Length of the segment.
1987 @retval EFI_SUCCESS Successfully removed a segment of IO space.
1993 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1999 Retrieves the descriptor for an I/O region containing a specified address.
2001 @param BaseAddress Specified start address
2002 @param Descriptor Specified length
2004 @retval EFI_INVALID_PARAMETER Descriptor is NULL.
2005 @retval EFI_SUCCESS Successfully get the IO space descriptor.
2010 CoreGetIoSpaceDescriptor (
2011 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
2012 OUT EFI_GCD_IO_SPACE_DESCRIPTOR
*Descriptor
2017 Returns a map of the I/O resources in the global coherency domain of the processor.
2019 @param NumberOfDescriptors Number of descriptors.
2020 @param IoSpaceMap Descriptor array
2022 @retval EFI_INVALID_PARAMETER Invalid parameter
2023 @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate
2024 @retval EFI_SUCCESS Successfully get IO space map.
2030 OUT UINTN
*NumberOfDescriptors
,
2031 OUT EFI_GCD_IO_SPACE_DESCRIPTOR
**IoSpaceMap
2036 This is the main Dispatcher for DXE and it exits when there are no more
2037 drivers to run. Drain the mScheduledQueue and load and start a PE
2038 image for each driver. Search the mDiscoveredList to see if any driver can
2039 be placed on the mScheduledQueue. If no drivers are placed on the
2040 mScheduledQueue exit the function. On exit it is assumed the Bds()
2041 will be called, and when the Bds() exits the Dispatcher will be called
2044 @retval EFI_ALREADY_STARTED The DXE Dispatcher is already running
2045 @retval EFI_NOT_FOUND No DXE Drivers were dispatched
2046 @retval EFI_SUCCESS One or more DXE Drivers were dispatched
2056 Check every driver and locate a matching one. If the driver is found, the Unrequested
2057 state flag is cleared.
2059 @param FirmwareVolumeHandle The handle of the Firmware Volume that contains
2060 the firmware file specified by DriverName.
2061 @param DriverName The Driver name to put in the Dependent state.
2063 @retval EFI_SUCCESS The DriverName was found and it's SOR bit was
2065 @retval EFI_NOT_FOUND The DriverName does not exist or it's SOR bit was
2072 IN EFI_HANDLE FirmwareVolumeHandle
,
2073 IN EFI_GUID
*DriverName
2078 Convert a driver from the Untrused back to the Scheduled state.
2080 @param FirmwareVolumeHandle The handle of the Firmware Volume that contains
2081 the firmware file specified by DriverName.
2082 @param DriverName The Driver name to put in the Scheduled state
2084 @retval EFI_SUCCESS The file was found in the untrusted state, and it
2085 was promoted to the trusted state.
2086 @retval EFI_NOT_FOUND The file was not found in the untrusted state.
2092 IN EFI_HANDLE FirmwareVolumeHandle
,
2093 IN EFI_GUID
*DriverName
2098 This routine is the driver initialization entry point. It initializes the
2099 libraries, and registers two notification functions. These notification
2100 functions are responsible for building the FV stack dynamically.
2102 @param ImageHandle The image handle.
2103 @param SystemTable The system table.
2105 @retval EFI_SUCCESS Function successfully returned.
2111 IN EFI_HANDLE ImageHandle
,
2112 IN EFI_SYSTEM_TABLE
*SystemTable
2117 Entry point of the section extraction code. Initializes an instance of the
2118 section extraction interface and installs it on a new handle.
2120 @param ImageHandle A handle for the image that is initializing this driver
2121 @param SystemTable A pointer to the EFI system table
2123 @retval EFI_SUCCESS Driver initialized successfully
2124 @retval EFI_OUT_OF_RESOURCES Could not allocate needed resources
2129 InitializeSectionExtraction (
2130 IN EFI_HANDLE ImageHandle
,
2131 IN EFI_SYSTEM_TABLE
*SystemTable
2136 This DXE service routine is used to process a firmware volume. In
2137 particular, it can be called by BDS to process a single firmware
2138 volume found in a capsule.
2140 @param FvHeader pointer to a firmware volume header
2141 @param Size the size of the buffer pointed to by FvHeader
2142 @param FVProtocolHandle the handle on which a firmware volume protocol
2143 was produced for the firmware volume passed in.
2145 @retval EFI_OUT_OF_RESOURCES if an FVB could not be produced due to lack of
2147 @retval EFI_VOLUME_CORRUPTED if the volume was corrupted
2148 @retval EFI_SUCCESS a firmware volume protocol was produced for the
2154 CoreProcessFirmwareVolume (
2157 OUT EFI_HANDLE
*FVProtocolHandle
2161 //Functions used during debug buils
2165 Displays Architectural protocols that were not loaded and are required for DXE
2166 core to function. Only used in Debug Builds.
2170 CoreDisplayMissingArchProtocols (
2176 Traverse the discovered list for any drivers that were discovered but not loaded
2177 because the dependency experessions evaluated to false.
2181 CoreDisplayDiscoveredNotDispatched (
2187 Place holder function until all the Boot Services and Runtime Services are
2190 @return EFI_NOT_AVAILABLE_YET
2195 CoreEfiNotAvailableYetArg0 (
2201 Place holder function until all the Boot Services and Runtime Services are
2204 @param Arg1 Undefined
2206 @return EFI_NOT_AVAILABLE_YET
2211 CoreEfiNotAvailableYetArg1 (
2217 Place holder function until all the Boot Services and Runtime Services are available.
2219 @param Arg1 Undefined
2220 @param Arg2 Undefined
2222 @return EFI_NOT_AVAILABLE_YET
2227 CoreEfiNotAvailableYetArg2 (
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
2240 @return EFI_NOT_AVAILABLE_YET
2245 CoreEfiNotAvailableYetArg3 (
2253 Place holder function until all the Boot Services and Runtime Services are available.
2255 @param Arg1 Undefined
2256 @param Arg2 Undefined
2257 @param Arg3 Undefined
2258 @param Arg4 Undefined
2260 @return EFI_NOT_AVAILABLE_YET
2265 CoreEfiNotAvailableYetArg4 (
2274 Place holder function until all the Boot Services and Runtime Services are available.
2276 @param Arg1 Undefined
2277 @param Arg2 Undefined
2278 @param Arg3 Undefined
2279 @param Arg4 Undefined
2280 @param Arg5 Undefined
2282 @return EFI_NOT_AVAILABLE_YET
2287 CoreEfiNotAvailableYetArg5 (
2297 Given a compressed source buffer, this function retrieves the size of the
2298 uncompressed buffer and the size of the scratch buffer required to decompress
2299 the compressed source buffer.
2301 The GetInfo() function retrieves the size of the uncompressed buffer and the
2302 temporary scratch buffer required to decompress the buffer specified by Source
2303 and SourceSize. If the size of the uncompressed buffer or the size of the
2304 scratch buffer cannot be determined from the compressed data specified by
2305 Source and SourceData, then EFI_INVALID_PARAMETER is returned. Otherwise, the
2306 size of the uncompressed buffer is returned in DestinationSize, the size of
2307 the scratch buffer is returned in ScratchSize, and EFI_SUCCESS is returned.
2308 The GetInfo() function does not have scratch buffer available to perform a
2309 thorough checking of the validity of the source data. It just retrieves the
2310 "Original Size" field from the beginning bytes of the source data and output
2311 it as DestinationSize. And ScratchSize is specific to the decompression
2314 @param This A pointer to the EFI_DECOMPRESS_PROTOCOL instance.
2315 @param Source The source buffer containing the compressed data.
2316 @param SourceSize The size, in bytes, of the source buffer.
2317 @param DestinationSize A pointer to the size, in bytes, of the
2318 uncompressed buffer that will be generated when the
2319 compressed buffer specified by Source and
2320 SourceSize is decompressed.
2321 @param ScratchSize A pointer to the size, in bytes, of the scratch
2322 buffer that is required to decompress the
2323 compressed buffer specified by Source and
2326 @retval EFI_SUCCESS The size of the uncompressed data was returned in
2327 DestinationSize and the size of the scratch buffer
2328 was returned in ScratchSize.
2329 @retval EFI_INVALID_PARAMETER The size of the uncompressed data or the size of
2330 the scratch buffer cannot be determined from the
2331 compressed data specified by Source and
2337 DxeMainUefiDecompressGetInfo (
2338 IN EFI_DECOMPRESS_PROTOCOL
*This
,
2340 IN UINT32 SourceSize
,
2341 OUT UINT32
*DestinationSize
,
2342 OUT UINT32
*ScratchSize
2347 Decompresses a compressed source buffer.
2349 The Decompress() function extracts decompressed data to its original form.
2350 This protocol is designed so that the decompression algorithm can be
2351 implemented without using any memory services. As a result, the Decompress()
2352 Function is not allowed to call AllocatePool() or AllocatePages() in its
2353 implementation. It is the caller's responsibility to allocate and free the
2354 Destination and Scratch buffers.
2355 If the compressed source data specified by Source and SourceSize is
2356 sucessfully decompressed into Destination, then EFI_SUCCESS is returned. If
2357 the compressed source data specified by Source and SourceSize is not in a
2358 valid compressed data format, then EFI_INVALID_PARAMETER is returned.
2360 @param This A pointer to the EFI_DECOMPRESS_PROTOCOL instance.
2361 @param Source The source buffer containing the compressed data.
2362 @param SourceSize SourceSizeThe size of source data.
2363 @param Destination On output, the destination buffer that contains
2364 the uncompressed data.
2365 @param DestinationSize The size of the destination buffer. The size of
2366 the destination buffer needed is obtained from
2367 EFI_DECOMPRESS_PROTOCOL.GetInfo().
2368 @param Scratch A temporary scratch buffer that is used to perform
2370 @param ScratchSize The size of scratch buffer. The size of the
2371 scratch buffer needed is obtained from GetInfo().
2373 @retval EFI_SUCCESS Decompression completed successfully, and the
2374 uncompressed buffer is returned in Destination.
2375 @retval EFI_INVALID_PARAMETER The source buffer specified by Source and
2376 SourceSize is corrupted (not in a valid
2382 DxeMainUefiDecompress (
2383 IN EFI_DECOMPRESS_PROTOCOL
*This
,
2385 IN UINT32 SourceSize
,
2386 IN OUT VOID
*Destination
,
2387 IN UINT32 DestinationSize
,
2388 IN OUT VOID
*Scratch
,
2389 IN UINT32 ScratchSize
2393 SEP member function. This function creates and returns a new section stream
2394 handle to represent the new section stream.
2396 @param SectionStreamLength Size in bytes of the section stream.
2397 @param SectionStream Buffer containing the new section stream.
2398 @param SectionStreamHandle A pointer to a caller allocated UINTN that on
2399 output contains the new section stream handle.
2401 @retval EFI_SUCCESS The section stream is created successfully.
2402 @retval EFI_OUT_OF_RESOURCES memory allocation failed.
2403 @retval EFI_INVALID_PARAMETER Section stream does not end concident with end
2410 IN UINTN SectionStreamLength
,
2411 IN VOID
*SectionStream
,
2412 OUT UINTN
*SectionStreamHandle
2418 SEP member function. Retrieves requested section from section stream.
2420 @param SectionStreamHandle The section stream from which to extract the
2422 @param SectionType A pointer to the type of section to search for.
2423 @param SectionDefinitionGuid If the section type is EFI_SECTION_GUID_DEFINED,
2424 then SectionDefinitionGuid indicates which of
2425 these types of sections to search for.
2426 @param SectionInstance Indicates which instance of the requested
2428 @param Buffer Double indirection to buffer. If *Buffer is
2429 non-null on input, then the buffer is caller
2430 allocated. If Buffer is NULL, then the buffer
2431 is callee allocated. In either case, the
2432 required buffer size is returned in *BufferSize.
2433 @param BufferSize On input, indicates the size of *Buffer if
2434 *Buffer is non-null on input. On output,
2435 indicates the required size (allocated size if
2436 callee allocated) of *Buffer.
2437 @param AuthenticationStatus A pointer to a caller-allocated UINT32 that
2438 indicates the authentication status of the
2439 output buffer. If the input section's
2440 GuidedSectionHeader.Attributes field
2441 has the EFI_GUIDED_SECTION_AUTH_STATUS_VALID
2442 bit as clear, AuthenticationStatus must return
2443 zero. Both local bits (19:16) and aggregate
2444 bits (3:0) in AuthenticationStatus are returned
2445 by ExtractSection(). These bits reflect the
2446 status of the extraction operation. The bit
2447 pattern in both regions must be the same, as
2448 the local and aggregate authentication statuses
2449 have equivalent meaning at this level. If the
2450 function returns anything other than
2451 EFI_SUCCESS, the value of *AuthenticationStatus
2453 @param IsFfs3Fv Indicates the FV format.
2455 @retval EFI_SUCCESS Section was retrieved successfully
2456 @retval EFI_PROTOCOL_ERROR A GUID defined section was encountered in the
2457 section stream with its
2458 EFI_GUIDED_SECTION_PROCESSING_REQUIRED bit set,
2459 but there was no corresponding GUIDed Section
2460 Extraction Protocol in the handle database.
2461 *Buffer is unmodified.
2462 @retval EFI_NOT_FOUND An error was encountered when parsing the
2463 SectionStream. This indicates the SectionStream
2464 is not correctly formatted.
2465 @retval EFI_NOT_FOUND The requested section does not exist.
2466 @retval EFI_OUT_OF_RESOURCES The system has insufficient resources to process
2468 @retval EFI_INVALID_PARAMETER The SectionStreamHandle does not exist.
2469 @retval EFI_WARN_TOO_SMALL The size of the caller allocated input buffer is
2470 insufficient to contain the requested section.
2471 The input buffer is filled and section contents
2478 IN UINTN SectionStreamHandle
,
2479 IN EFI_SECTION_TYPE
*SectionType
,
2480 IN EFI_GUID
*SectionDefinitionGuid
,
2481 IN UINTN SectionInstance
,
2483 IN OUT UINTN
*BufferSize
,
2484 OUT UINT32
*AuthenticationStatus
,
2490 SEP member function. Deletes an existing section stream
2492 @param StreamHandleToClose Indicates the stream to close
2493 @param FreeStreamBuffer TRUE - Need to free stream buffer;
2494 FALSE - No need to free stream buffer.
2496 @retval EFI_SUCCESS The section stream is closed sucessfully.
2497 @retval EFI_OUT_OF_RESOURCES Memory allocation failed.
2498 @retval EFI_INVALID_PARAMETER Section stream does not end concident with end
2504 CloseSectionStream (
2505 IN UINTN StreamHandleToClose
,
2506 IN BOOLEAN FreeStreamBuffer
2510 Creates and initializes the DebugImageInfo Table. Also creates the configuration
2511 table and registers it into the system table.
2514 This function allocates memory, frees it, and then allocates memory at an
2515 address within the initial allocation. Since this function is called early
2516 in DXE core initialization (before drivers are dispatched), this should not
2521 CoreInitializeDebugImageInfoTable (
2527 Update the CRC32 in the Debug Table.
2528 Since the CRC32 service is made available by the Runtime driver, we have to
2529 wait for the Runtime Driver to be installed before the CRC32 can be computed.
2530 This function is called elsewhere by the core when the runtime architectural
2531 protocol is produced.
2535 CoreUpdateDebugTableCrc32 (
2541 Adds a new DebugImageInfo structure to the DebugImageInfo Table. Re-Allocates
2542 the table if it's not large enough to accomidate another entry.
2544 @param ImageInfoType type of debug image information
2545 @param LoadedImage pointer to the loaded image protocol for the image being
2547 @param ImageHandle image handle for the image being loaded
2551 CoreNewDebugImageInfoEntry (
2552 IN UINT32 ImageInfoType
,
2553 IN EFI_LOADED_IMAGE_PROTOCOL
*LoadedImage
,
2554 IN EFI_HANDLE ImageHandle
2559 Removes and frees an entry from the DebugImageInfo Table.
2561 @param ImageHandle image handle for the image being unloaded
2565 CoreRemoveDebugImageInfoEntry (
2566 EFI_HANDLE ImageHandle
2571 This routine consumes FV hobs and produces instances of FW_VOL_BLOCK_PROTOCOL as appropriate.
2573 @param ImageHandle The image handle.
2574 @param SystemTable The system table.
2576 @retval EFI_SUCCESS Successfully initialized firmware volume block
2582 FwVolBlockDriverInit (
2583 IN EFI_HANDLE ImageHandle
,
2584 IN EFI_SYSTEM_TABLE
*SystemTable
2589 Get FVB authentication status
2591 @param FvbProtocol FVB protocol.
2593 @return Authentication status.
2597 GetFvbAuthenticationStatus (
2598 IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL
*FvbProtocol
2602 This routine produces a firmware volume block protocol on a given
2605 @param BaseAddress base address of the firmware volume image
2606 @param Length length of the firmware volume image
2607 @param ParentHandle handle of parent firmware volume, if this image
2608 came from an FV image file and section in another firmware
2609 volume (ala capsules)
2610 @param AuthenticationStatus Authentication status inherited, if this image
2611 came from an FV image file and section in another firmware volume.
2612 @param FvProtocol Firmware volume block protocol produced.
2614 @retval EFI_VOLUME_CORRUPTED Volume corrupted.
2615 @retval EFI_OUT_OF_RESOURCES No enough buffer to be allocated.
2616 @retval EFI_SUCCESS Successfully produced a FVB protocol on given
2621 ProduceFVBProtocolOnBuffer (
2622 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
2624 IN EFI_HANDLE ParentHandle
,
2625 IN UINT32 AuthenticationStatus
,
2626 OUT EFI_HANDLE
*FvProtocol OPTIONAL
2631 Raising to the task priority level of the mutual exclusion
2632 lock, and then acquires ownership of the lock.
2634 @param Lock The lock to acquire
2646 Initialize a basic mutual exclusion lock. Each lock
2647 provides mutual exclusion access at it's task priority
2648 level. Since there is no-premption (at any TPL) or
2649 multiprocessor support, acquiring the lock only consists
2650 of raising to the locks TPL.
2652 @param Lock The EFI_LOCK structure to initialize
2654 @retval EFI_SUCCESS Lock Owned.
2655 @retval EFI_ACCESS_DENIED Reentrant Lock Acquisition, Lock not Owned.
2659 CoreAcquireLockOrFail (
2665 Releases ownership of the mutual exclusion lock, and
2666 restores the previous task priority level.
2668 @param Lock The lock to release
2670 @return Lock unowned
2679 Read data from Firmware Block by FVB protocol Read.
2680 The data may cross the multi block ranges.
2682 @param Fvb The FW_VOL_BLOCK_PROTOCOL instance from which to read data.
2683 @param StartLba Pointer to StartLba.
2684 On input, the start logical block index from which to read.
2685 On output,the end logical block index after reading.
2686 @param Offset Pointer to Offset
2687 On input, offset into the block at which to begin reading.
2688 On output, offset into the end block after reading.
2689 @param DataSize Size of data to be read.
2690 @param Data Pointer to Buffer that the data will be read into.
2692 @retval EFI_SUCCESS Successfully read data from firmware block.
2697 IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL
*Fvb
,
2698 IN OUT EFI_LBA
*StartLba
,
2699 IN OUT UINTN
*Offset
,
2705 Given the supplied FW_VOL_BLOCK_PROTOCOL, allocate a buffer for output and
2706 copy the real length volume header into it.
2708 @param Fvb The FW_VOL_BLOCK_PROTOCOL instance from which to
2709 read the volume header
2710 @param FwVolHeader Pointer to pointer to allocated buffer in which
2711 the volume header is returned.
2713 @retval EFI_OUT_OF_RESOURCES No enough buffer could be allocated.
2714 @retval EFI_SUCCESS Successfully read volume header to the allocated
2716 @retval EFI_INVALID_PARAMETER The FV Header signature is not as expected or
2717 the file system could not be understood.
2722 IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL
*Fvb
,
2723 OUT EFI_FIRMWARE_VOLUME_HEADER
**FwVolHeader
2727 Verify checksum of the firmware volume header.
2729 @param FvHeader Points to the firmware volume header to be checked
2731 @retval TRUE Checksum verification passed
2732 @retval FALSE Checksum verification failed
2736 VerifyFvHeaderChecksum (
2737 IN EFI_FIRMWARE_VOLUME_HEADER
*FvHeader
2741 Initialize memory profile.
2743 @param HobStart The start address of the HOB.
2752 Install memory profile protocol.
2756 MemoryProfileInstallProtocol (
2761 Register image to memory profile.
2763 @param DriverEntry Image info.
2764 @param FileType Image file type.
2766 @return EFI_SUCCESS Register successfully.
2767 @return EFI_UNSUPPORTED Memory profile unsupported,
2768 or memory profile for the image is not required.
2769 @return EFI_OUT_OF_RESOURCES No enough resource for this register.
2773 RegisterMemoryProfileImage (
2774 IN LOADED_IMAGE_PRIVATE_DATA
*DriverEntry
,
2775 IN EFI_FV_FILETYPE FileType
2779 Unregister image from memory profile.
2781 @param DriverEntry Image info.
2783 @return EFI_SUCCESS Unregister successfully.
2784 @return EFI_UNSUPPORTED Memory profile unsupported,
2785 or memory profile for the image is not required.
2786 @return EFI_NOT_FOUND The image is not found.
2790 UnregisterMemoryProfileImage (
2791 IN LOADED_IMAGE_PRIVATE_DATA
*DriverEntry
2795 Update memory profile information.
2797 @param CallerAddress Address of caller who call Allocate or Free.
2798 @param Action This Allocate or Free action.
2799 @param MemoryType Memory type.
2800 EfiMaxMemoryType means the MemoryType is unknown.
2801 @param Size Buffer size.
2802 @param Buffer Buffer address.
2803 @param ActionString String for memory profile action.
2804 Only needed for user defined allocate action.
2806 @return EFI_SUCCESS Memory profile is updated.
2807 @return EFI_UNSUPPORTED Memory profile is unsupported,
2808 or memory profile for the image is not required,
2809 or memory profile for the memory type is not required.
2810 @return EFI_ACCESS_DENIED It is during memory profile data getting.
2811 @return EFI_ABORTED Memory profile recording is not enabled.
2812 @return EFI_OUT_OF_RESOURCES No enough resource to update memory profile for allocate action.
2813 @return EFI_NOT_FOUND No matched allocate info found for free action.
2819 IN EFI_PHYSICAL_ADDRESS CallerAddress
,
2820 IN MEMORY_PROFILE_ACTION Action
,
2821 IN EFI_MEMORY_TYPE MemoryType
,
2822 IN UINTN Size
, // Valid for AllocatePages/FreePages/AllocatePool
2824 IN CHAR8
*ActionString OPTIONAL
2828 Internal function. Converts a memory range to use new attributes.
2830 @param Start The first address of the range Must be page
2832 @param NumberOfPages The number of pages to convert
2833 @param NewAttributes The new attributes value for the range.
2837 CoreUpdateMemoryAttributes (
2838 IN EFI_PHYSICAL_ADDRESS Start
,
2839 IN UINT64 NumberOfPages
,
2840 IN UINT64 NewAttributes
2844 Initialize PropertiesTable support.
2848 CoreInitializePropertiesTable (
2853 Initialize MemoryAttrubutesTable support.
2857 CoreInitializeMemoryAttributesTable (
2862 Install MemoryAttributesTable on memory allocation.
2864 @param[in] MemoryType EFI memory type.
2867 InstallMemoryAttributesTableOnMemoryAllocation (
2868 IN EFI_MEMORY_TYPE MemoryType
2872 Insert image record.
2874 @param RuntimeImage Runtime image information
2878 IN EFI_RUNTIME_IMAGE_ENTRY
*RuntimeImage
2882 Remove Image record.
2884 @param RuntimeImage Runtime image information
2888 IN EFI_RUNTIME_IMAGE_ENTRY
*RuntimeImage