2 The internal header file includes the common header files, defines
3 internal structure and functions used by DxeCore module.
5 Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
6 This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
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/ZeroGuid.h>
73 #include <Guid/MemoryProfile.h>
75 #include <Library/DxeCoreEntryPoint.h>
76 #include <Library/DebugLib.h>
77 #include <Library/UefiLib.h>
78 #include <Library/BaseLib.h>
79 #include <Library/HobLib.h>
80 #include <Library/PerformanceLib.h>
81 #include <Library/UefiDecompressLib.h>
82 #include <Library/ExtractGuidedSectionLib.h>
83 #include <Library/CacheMaintenanceLib.h>
84 #include <Library/BaseMemoryLib.h>
85 #include <Library/PeCoffLib.h>
86 #include <Library/PeCoffGetEntryPointLib.h>
87 #include <Library/PeCoffExtraActionLib.h>
88 #include <Library/PcdLib.h>
89 #include <Library/MemoryAllocationLib.h>
90 #include <Library/DevicePathLib.h>
91 #include <Library/UefiBootServicesTableLib.h>
92 #include <Library/ReportStatusCodeLib.h>
93 #include <Library/TimerLib.h>
94 #include <Library/DxeServicesLib.h>
95 #include <Library/DebugAgentLib.h>
96 #include <Library/CpuExceptionHandlerLib.h>
100 // attributes for reserved memory before it is promoted to system memory
102 #define EFI_MEMORY_PRESENT 0x0100000000000000ULL
103 #define EFI_MEMORY_INITIALIZED 0x0200000000000000ULL
104 #define EFI_MEMORY_TESTED 0x0400000000000000ULL
107 // range for memory mapped port I/O on IPF
109 #define EFI_MEMORY_PORT_IO 0x4000000000000000ULL
113 /// EFI_DEP_REPLACE_TRUE - Used to dynamically patch the dependecy expression
114 /// to save time. A EFI_DEP_PUSH is evauated one an
115 /// replaced with EFI_DEP_REPLACE_TRUE. If PI spec's Vol 2
116 /// Driver Execution Environment Core Interface use 0xff
117 /// as new DEPEX opcode. EFI_DEP_REPLACE_TRUE should be
118 /// defined to a new value that is not conflicting with PI spec.
120 #define EFI_DEP_REPLACE_TRUE 0xff
123 /// Define the initial size of the dependency expression evaluation stack
125 #define DEPEX_STACK_SIZE_INCREMENT 0x1000
128 EFI_GUID
*ProtocolGuid
;
133 } EFI_CORE_PROTOCOL_NOTIFY_ENTRY
;
136 // DXE Dispatcher Data structures
139 #define KNOWN_HANDLE_SIGNATURE SIGNATURE_32('k','n','o','w')
142 LIST_ENTRY Link
; // mFvHandleList
148 #define EFI_CORE_DRIVER_ENTRY_SIGNATURE SIGNATURE_32('d','r','v','r')
151 LIST_ENTRY Link
; // mDriverList
153 LIST_ENTRY ScheduledLink
; // mScheduledQueue
157 EFI_DEVICE_PATH_PROTOCOL
*FvFileDevicePath
;
158 EFI_FIRMWARE_VOLUME2_PROTOCOL
*Fv
;
165 EFI_GUID BeforeAfterGuid
;
172 BOOLEAN DepexProtocolError
;
174 EFI_HANDLE ImageHandle
;
177 } EFI_CORE_DRIVER_ENTRY
;
180 //The data structure of GCD memory map entry
182 #define EFI_GCD_MAP_SIGNATURE SIGNATURE_32('g','c','d','m')
186 EFI_PHYSICAL_ADDRESS BaseAddress
;
190 EFI_GCD_MEMORY_TYPE GcdMemoryType
;
191 EFI_GCD_IO_TYPE GcdIoType
;
192 EFI_HANDLE ImageHandle
;
193 EFI_HANDLE DeviceHandle
;
197 #define LOADED_IMAGE_PRIVATE_DATA_SIGNATURE SIGNATURE_32('l','d','r','i')
205 /// If entrypoint has been called
207 /// The image's entry point
208 EFI_IMAGE_ENTRY_POINT EntryPoint
;
209 /// loaded image protocol
210 EFI_LOADED_IMAGE_PROTOCOL Info
;
211 /// Location in memory
212 EFI_PHYSICAL_ADDRESS ImageBasePage
;
215 /// Original fixup data
217 /// Tpl of started image
219 /// Status returned by started image
221 /// Size of ExitData from started image
223 /// Pointer to exit data from started image
225 /// Pointer to pool allocation for context save/retore
227 /// Pointer to buffer for context save/retore
228 BASE_LIBRARY_JUMP_BUFFER
*JumpContext
;
229 /// Machine type from PE image
231 /// EBC Protocol pointer
232 EFI_EBC_PROTOCOL
*Ebc
;
233 /// Runtime image list
234 EFI_RUNTIME_IMAGE_ENTRY
*RuntimeData
;
235 /// Pointer to Loaded Image Device Path Protocl
236 EFI_DEVICE_PATH_PROTOCOL
*LoadedImageDevicePath
;
237 /// PeCoffLoader ImageContext
238 PE_COFF_LOADER_IMAGE_CONTEXT ImageContext
;
239 /// Status returned by LoadImage() service.
240 EFI_STATUS LoadImageStatus
;
241 } LOADED_IMAGE_PRIVATE_DATA
;
243 #define LOADED_IMAGE_PRIVATE_DATA_FROM_THIS(a) \
244 CR(a, LOADED_IMAGE_PRIVATE_DATA, Info, LOADED_IMAGE_PRIVATE_DATA_SIGNATURE)
247 // DXE Core Global Variables
249 extern EFI_SYSTEM_TABLE
*gDxeCoreST
;
250 extern EFI_RUNTIME_SERVICES
*gDxeCoreRT
;
251 extern EFI_DXE_SERVICES
*gDxeCoreDS
;
252 extern EFI_HANDLE gDxeCoreImageHandle
;
254 extern EFI_DECOMPRESS_PROTOCOL gEfiDecompress
;
256 extern EFI_RUNTIME_ARCH_PROTOCOL
*gRuntime
;
257 extern EFI_CPU_ARCH_PROTOCOL
*gCpu
;
258 extern EFI_WATCHDOG_TIMER_ARCH_PROTOCOL
*gWatchdogTimer
;
259 extern EFI_METRONOME_ARCH_PROTOCOL
*gMetronome
;
260 extern EFI_TIMER_ARCH_PROTOCOL
*gTimer
;
261 extern EFI_SECURITY_ARCH_PROTOCOL
*gSecurity
;
262 extern EFI_SECURITY2_ARCH_PROTOCOL
*gSecurity2
;
263 extern EFI_BDS_ARCH_PROTOCOL
*gBds
;
264 extern EFI_SMM_BASE2_PROTOCOL
*gSmmBase2
;
266 extern EFI_TPL gEfiCurrentTpl
;
268 extern EFI_GUID
*gDxeCoreFileName
;
269 extern EFI_LOADED_IMAGE_PROTOCOL
*gDxeCoreLoadedImage
;
271 extern EFI_MEMORY_TYPE_INFORMATION gMemoryTypeInformation
[EfiMaxMemoryType
+ 1];
273 extern BOOLEAN gDispatcherRunning
;
274 extern EFI_RUNTIME_ARCH_PROTOCOL gRuntimeTemplate
;
276 extern EFI_LOAD_FIXED_ADDRESS_CONFIGURATION_TABLE gLoadModuleAtFixAddressConfigurationTable
;
277 extern BOOLEAN gLoadFixedAddressCodeMemoryReady
;
279 // Service Initialization Functions
285 Called to initialize the pool.
295 Called to initialize the memory map and add descriptors to
296 the current descriptor list.
297 The first descriptor that is added must be general usable
298 memory as the addition allocates heap.
300 @param Type The type of memory to add
301 @param Start The starting address in the memory range Must be
303 @param NumberOfPages The number of pages in the range
304 @param Attribute Attributes of the memory to add
306 @return None. The range is added to the memory map
310 CoreAddMemoryDescriptor (
311 IN EFI_MEMORY_TYPE Type
,
312 IN EFI_PHYSICAL_ADDRESS Start
,
313 IN UINT64 NumberOfPages
,
319 Release memory lock on mGcdMemorySpaceLock.
323 CoreReleaseGcdMemoryLock (
329 Acquire memory lock on mGcdMemorySpaceLock.
333 CoreAcquireGcdMemoryLock (
339 External function. Initializes memory services based on the memory
340 descriptor HOBs. This function is responsible for priming the memory
341 map, so memory allocations and resource allocations can be made.
342 The first part of this function can not depend on any memory services
343 until at least one memory descriptor is provided to the memory services.
345 @param HobStart The start address of the HOB.
346 @param MemoryBaseAddress Start address of memory region found to init DXE
348 @param MemoryLength Length of memory region found to init DXE core.
350 @retval EFI_SUCCESS Memory services successfully initialized.
354 CoreInitializeMemoryServices (
356 OUT EFI_PHYSICAL_ADDRESS
*MemoryBaseAddress
,
357 OUT UINT64
*MemoryLength
363 External function. Initializes the GCD and memory services based on the memory
364 descriptor HOBs. This function is responsible for priming the GCD map and the
365 memory map, so memory allocations and resource allocations can be made. The
366 HobStart will be relocated to a pool buffer.
368 @param HobStart The start address of the HOB
369 @param MemoryBaseAddress Start address of memory region found to init DXE
371 @param MemoryLength Length of memory region found to init DXE core.
373 @retval EFI_SUCCESS GCD services successfully initialized.
377 CoreInitializeGcdServices (
378 IN OUT VOID
**HobStart
,
379 IN EFI_PHYSICAL_ADDRESS MemoryBaseAddress
,
380 IN UINT64 MemoryLength
385 Initializes "event" support.
387 @retval EFI_SUCCESS Always return success
391 CoreInitializeEventServices (
397 Add the Image Services to EFI Boot Services Table and install the protocol
398 interfaces for this image.
400 @param HobStart The HOB to initialize
406 CoreInitializeImageServices (
412 Creates an event that is fired everytime a Protocol of a specific type is installed.
416 CoreNotifyOnProtocolInstallation (
422 Return TRUE if all AP services are availible.
424 @retval EFI_SUCCESS All AP services are available
425 @retval EFI_NOT_FOUND At least one AP service is not available
429 CoreAllEfiServicesAvailable (
435 Calcualte the 32-bit CRC in a EFI table using the service provided by the
438 @param Hdr Pointer to an EFI standard header
443 IN OUT EFI_TABLE_HEADER
*Hdr
448 Called by the platform code to process a tick.
450 @param Duration The number of 100ns elasped since the last call
462 Initialize the dispatcher. Initialize the notification function that runs when
463 an FV2 protocol is added to the system.
467 CoreInitializeDispatcher (
473 This is the POSTFIX version of the dependency evaluator. This code does
474 not need to handle Before or After, as it is not valid to call this
475 routine in this case. The SOR is just ignored and is a nop in the grammer.
476 POSTFIX means all the math is done on top of the stack.
478 @param DriverEntry DriverEntry element to update.
480 @retval TRUE If driver is ready to run.
481 @retval FALSE If driver is not ready to run or some fatal error
487 IN EFI_CORE_DRIVER_ENTRY
*DriverEntry
492 Preprocess dependency expression and update DriverEntry to reflect the
493 state of Before, After, and SOR dependencies. If DriverEntry->Before
494 or DriverEntry->After is set it will never be cleared. If SOR is set
495 it will be cleared by CoreSchedule(), and then the driver can be
498 @param DriverEntry DriverEntry element to update .
500 @retval EFI_SUCCESS It always works.
504 CorePreProcessDepex (
505 IN EFI_CORE_DRIVER_ENTRY
*DriverEntry
511 Terminates all boot services.
513 @param ImageHandle Handle that identifies the exiting image.
514 @param MapKey Key to the latest memory map.
516 @retval EFI_SUCCESS Boot Services terminated
517 @retval EFI_INVALID_PARAMETER MapKey is incorrect.
522 CoreExitBootServices (
523 IN EFI_HANDLE ImageHandle
,
529 Make sure the memory map is following all the construction rules,
530 it is the last time to check memory map error before exit boot services.
532 @param MapKey Memory map key
534 @retval EFI_INVALID_PARAMETER Memory map not consistent with construction
536 @retval EFI_SUCCESS Valid memory map.
540 CoreTerminateMemoryMap (
546 Signals all events in the EventGroup.
548 @param EventGroup The list to signal
552 CoreNotifySignalList (
553 IN EFI_GUID
*EventGroup
559 Boot Service called to add, modify, or remove a system configuration table from
560 the EFI System Table.
562 @param Guid Pointer to the GUID for the entry to add, update, or
564 @param Table Pointer to the configuration table for the entry to add,
565 update, or remove, may be NULL.
567 @return EFI_SUCCESS Guid, Table pair added, updated, or removed.
568 @return EFI_INVALID_PARAMETER Input GUID not valid.
569 @return EFI_NOT_FOUND Attempted to delete non-existant entry
570 @return EFI_OUT_OF_RESOURCES Not enough memory available
575 CoreInstallConfigurationTable (
583 Raise the task priority level to the new level.
584 High level is implemented by disabling processor interrupts.
586 @param NewTpl New task priority level
588 @return The previous task priority level
600 Lowers the task priority to the previous value. If the new
601 priority unmasks events at a higher priority, they are dispatched.
603 @param NewTpl New, lower, task priority
615 Introduces a fine-grained stall.
617 @param Microseconds The number of microseconds to stall execution.
619 @retval EFI_SUCCESS Execution was stalled for at least the requested
620 amount of microseconds.
621 @retval EFI_NOT_AVAILABLE_YET gMetronome is not available yet
627 IN UINTN Microseconds
633 Sets the system's watchdog timer.
635 @param Timeout The number of seconds to set the watchdog timer to.
636 A value of zero disables the timer.
637 @param WatchdogCode The numeric code to log on a watchdog timer timeout
638 event. The firmware reserves codes 0x0000 to 0xFFFF.
639 Loaders and operating systems may use other timeout
641 @param DataSize The size, in bytes, of WatchdogData.
642 @param WatchdogData A data buffer that includes a Null-terminated Unicode
643 string, optionally followed by additional binary data.
644 The string is a description that the call may use to
645 further indicate the reason to be logged with a
648 @return EFI_SUCCESS Timeout has been set
649 @return EFI_NOT_AVAILABLE_YET WatchdogTimer is not available yet
650 @return EFI_UNSUPPORTED System does not have a timer (currently not used)
651 @return EFI_DEVICE_ERROR Could not complete due to hardware error
656 CoreSetWatchdogTimer (
658 IN UINT64 WatchdogCode
,
660 IN CHAR16
*WatchdogData OPTIONAL
666 Wrapper function to CoreInstallProtocolInterfaceNotify. This is the public API which
667 Calls the private one which contains a BOOLEAN parameter for notifications
669 @param UserHandle The handle to install the protocol handler on,
670 or NULL if a new handle is to be allocated
671 @param Protocol The protocol to add to the handle
672 @param InterfaceType Indicates whether Interface is supplied in
674 @param Interface The interface for the protocol being added
681 CoreInstallProtocolInterface (
682 IN OUT EFI_HANDLE
*UserHandle
,
683 IN EFI_GUID
*Protocol
,
684 IN EFI_INTERFACE_TYPE InterfaceType
,
690 Installs a protocol interface into the boot services environment.
692 @param UserHandle The handle to install the protocol handler on,
693 or NULL if a new handle is to be allocated
694 @param Protocol The protocol to add to the handle
695 @param InterfaceType Indicates whether Interface is supplied in
697 @param Interface The interface for the protocol being added
698 @param Notify indicates whether notify the notification list
701 @retval EFI_INVALID_PARAMETER Invalid parameter
702 @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate
703 @retval EFI_SUCCESS Protocol interface successfully installed
707 CoreInstallProtocolInterfaceNotify (
708 IN OUT EFI_HANDLE
*UserHandle
,
709 IN EFI_GUID
*Protocol
,
710 IN EFI_INTERFACE_TYPE InterfaceType
,
718 Installs a list of protocol interface into the boot services environment.
719 This function calls InstallProtocolInterface() in a loop. If any error
720 occures all the protocols added by this function are removed. This is
721 basically a lib function to save space.
723 @param Handle The handle to install the protocol handlers on,
724 or NULL if a new handle is to be allocated
725 @param ... EFI_GUID followed by protocol instance. A NULL
726 terminates the list. The pairs are the
727 arguments to InstallProtocolInterface(). All the
728 protocols are added to Handle.
730 @retval EFI_SUCCESS All the protocol interface was installed.
731 @retval EFI_OUT_OF_RESOURCES There was not enough memory in pool to install all the protocols.
732 @retval EFI_ALREADY_STARTED A Device Path Protocol instance was passed in that is already present in
734 @retval EFI_INVALID_PARAMETER Handle is NULL.
735 @retval EFI_INVALID_PARAMETER Protocol is already installed on the handle specified by Handle.
740 CoreInstallMultipleProtocolInterfaces (
741 IN OUT EFI_HANDLE
*Handle
,
748 Uninstalls a list of protocol interface in the boot services environment.
749 This function calls UnisatllProtocolInterface() in a loop. This is
750 basically a lib function to save space.
752 @param Handle The handle to uninstall the protocol
753 @param ... EFI_GUID followed by protocol instance. A NULL
754 terminates the list. The pairs are the
755 arguments to UninstallProtocolInterface(). All
756 the protocols are added to Handle.
763 CoreUninstallMultipleProtocolInterfaces (
764 IN EFI_HANDLE Handle
,
771 Reinstall a protocol interface on a device handle. The OldInterface for Protocol is replaced by the NewInterface.
773 @param UserHandle Handle on which the interface is to be
775 @param Protocol The numeric ID of the interface
776 @param OldInterface A pointer to the old interface
777 @param NewInterface A pointer to the new interface
779 @retval EFI_SUCCESS The protocol interface was installed
780 @retval EFI_NOT_FOUND The OldInterface on the handle was not found
781 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value
786 CoreReinstallProtocolInterface (
787 IN EFI_HANDLE UserHandle
,
788 IN EFI_GUID
*Protocol
,
789 IN VOID
*OldInterface
,
790 IN VOID
*NewInterface
796 Uninstalls all instances of a protocol:interfacer from a handle.
797 If the last protocol interface is remove from the handle, the
800 @param UserHandle The handle to remove the protocol handler from
801 @param Protocol The protocol, of protocol:interface, to remove
802 @param Interface The interface, of protocol:interface, to remove
804 @retval EFI_INVALID_PARAMETER Protocol is NULL.
805 @retval EFI_SUCCESS Protocol interface successfully uninstalled.
810 CoreUninstallProtocolInterface (
811 IN EFI_HANDLE UserHandle
,
812 IN EFI_GUID
*Protocol
,
819 Queries a handle to determine if it supports a specified protocol.
821 @param UserHandle The handle being queried.
822 @param Protocol The published unique identifier of the protocol.
823 @param Interface Supplies the address where a pointer to the
824 corresponding Protocol Interface is returned.
826 @return The requested protocol interface for the handle
832 IN EFI_HANDLE UserHandle
,
833 IN EFI_GUID
*Protocol
,
840 Locates the installed protocol handler for the handle, and
841 invokes it to obtain the protocol interface. Usage information
842 is registered in the protocol data base.
844 @param UserHandle The handle to obtain the protocol interface on
845 @param Protocol The ID of the protocol
846 @param Interface The location to return the protocol interface
847 @param ImageHandle The handle of the Image that is opening the
848 protocol interface specified by Protocol and
850 @param ControllerHandle The controller handle that is requiring this
852 @param Attributes The open mode of the protocol interface
853 specified by Handle and Protocol.
855 @retval EFI_INVALID_PARAMETER Protocol is NULL.
856 @retval EFI_SUCCESS Get the protocol interface.
862 IN EFI_HANDLE UserHandle
,
863 IN EFI_GUID
*Protocol
,
864 OUT VOID
**Interface OPTIONAL
,
865 IN EFI_HANDLE ImageHandle
,
866 IN EFI_HANDLE ControllerHandle
,
873 Return information about Opened protocols in the system
875 @param UserHandle The handle to close the protocol interface on
876 @param Protocol The ID of the protocol
877 @param EntryBuffer A pointer to a buffer of open protocol
878 information in the form of
879 EFI_OPEN_PROTOCOL_INFORMATION_ENTRY structures.
880 @param EntryCount Number of EntryBuffer entries
885 CoreOpenProtocolInformation (
886 IN EFI_HANDLE UserHandle
,
887 IN EFI_GUID
*Protocol
,
888 OUT EFI_OPEN_PROTOCOL_INFORMATION_ENTRY
**EntryBuffer
,
889 OUT UINTN
*EntryCount
895 Closes a protocol on a handle that was opened using OpenProtocol().
897 @param UserHandle The handle for the protocol interface that was
898 previously opened with OpenProtocol(), and is
900 @param Protocol The published unique identifier of the protocol.
901 It is the caller's responsibility to pass in a
903 @param AgentHandle The handle of the agent that is closing the
905 @param ControllerHandle If the agent that opened a protocol is a driver
906 that follows the EFI Driver Model, then this
907 parameter is the controller handle that required
908 the protocol interface. If the agent does not
909 follow the EFI Driver Model, then this parameter
910 is optional and may be NULL.
912 @retval EFI_SUCCESS The protocol instance was closed.
913 @retval EFI_INVALID_PARAMETER Handle, AgentHandle or ControllerHandle is not a
915 @retval EFI_NOT_FOUND Can not find the specified protocol or
922 IN EFI_HANDLE UserHandle
,
923 IN EFI_GUID
*Protocol
,
924 IN EFI_HANDLE AgentHandle
,
925 IN EFI_HANDLE ControllerHandle
931 Retrieves the list of protocol interface GUIDs that are installed on a handle in a buffer allocated
934 @param UserHandle The handle from which to retrieve the list of
935 protocol interface GUIDs.
936 @param ProtocolBuffer A pointer to the list of protocol interface GUID
937 pointers that are installed on Handle.
938 @param ProtocolBufferCount A pointer to the number of GUID pointers present
941 @retval EFI_SUCCESS The list of protocol interface GUIDs installed
942 on Handle was returned in ProtocolBuffer. The
943 number of protocol interface GUIDs was returned
944 in ProtocolBufferCount.
945 @retval EFI_INVALID_PARAMETER Handle is NULL.
946 @retval EFI_INVALID_PARAMETER Handle is not a valid EFI_HANDLE.
947 @retval EFI_INVALID_PARAMETER ProtocolBuffer is NULL.
948 @retval EFI_INVALID_PARAMETER ProtocolBufferCount is NULL.
949 @retval EFI_OUT_OF_RESOURCES There is not enough pool memory to store the
955 CoreProtocolsPerHandle (
956 IN EFI_HANDLE UserHandle
,
957 OUT EFI_GUID
***ProtocolBuffer
,
958 OUT UINTN
*ProtocolBufferCount
964 Add a new protocol notification record for the request protocol.
966 @param Protocol The requested protocol to add the notify
968 @param Event The event to signal
969 @param Registration Returns the registration record
971 @retval EFI_INVALID_PARAMETER Invalid parameter
972 @retval EFI_SUCCESS Successfully returned the registration record
978 CoreRegisterProtocolNotify (
979 IN EFI_GUID
*Protocol
,
981 OUT VOID
**Registration
986 Removes all the events in the protocol database that match Event.
988 @param Event The event to search for in the protocol
991 @return EFI_SUCCESS when done searching the entire database.
995 CoreUnregisterProtocolNotify (
1001 Locates the requested handle(s) and returns them in Buffer.
1003 @param SearchType The type of search to perform to locate the
1005 @param Protocol The protocol to search for
1006 @param SearchKey Dependant on SearchType
1007 @param BufferSize On input the size of Buffer. On output the
1008 size of data returned.
1009 @param Buffer The buffer to return the results in
1011 @retval EFI_BUFFER_TOO_SMALL Buffer too small, required buffer size is
1012 returned in BufferSize.
1013 @retval EFI_INVALID_PARAMETER Invalid parameter
1014 @retval EFI_SUCCESS Successfully found the requested handle(s) and
1015 returns them in Buffer.
1021 IN EFI_LOCATE_SEARCH_TYPE SearchType
,
1022 IN EFI_GUID
*Protocol OPTIONAL
,
1023 IN VOID
*SearchKey OPTIONAL
,
1024 IN OUT UINTN
*BufferSize
,
1025 OUT EFI_HANDLE
*Buffer
1031 Locates the handle to a device on the device path that best matches the specified protocol.
1033 @param Protocol The protocol to search for.
1034 @param DevicePath On input, a pointer to a pointer to the device
1035 path. On output, the device path pointer is
1036 modified to point to the remaining part of the
1038 @param Device A pointer to the returned device handle.
1040 @retval EFI_SUCCESS The resulting handle was returned.
1041 @retval EFI_NOT_FOUND No handles matched the search.
1042 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
1047 CoreLocateDevicePath (
1048 IN EFI_GUID
*Protocol
,
1049 IN OUT EFI_DEVICE_PATH_PROTOCOL
**DevicePath
,
1050 OUT EFI_HANDLE
*Device
1056 Function returns an array of handles that support the requested protocol
1057 in a buffer allocated from pool. This is a version of CoreLocateHandle()
1058 that allocates a buffer for the caller.
1060 @param SearchType Specifies which handle(s) are to be returned.
1061 @param Protocol Provides the protocol to search by. This
1062 parameter is only valid for SearchType
1064 @param SearchKey Supplies the search key depending on the
1066 @param NumberHandles The number of handles returned in Buffer.
1067 @param Buffer A pointer to the buffer to return the requested
1068 array of handles that support Protocol.
1070 @retval EFI_SUCCESS The result array of handles was returned.
1071 @retval EFI_NOT_FOUND No handles match the search.
1072 @retval EFI_OUT_OF_RESOURCES There is not enough pool memory to store the
1074 @retval EFI_INVALID_PARAMETER One or more paramters are not valid.
1079 CoreLocateHandleBuffer (
1080 IN EFI_LOCATE_SEARCH_TYPE SearchType
,
1081 IN EFI_GUID
*Protocol OPTIONAL
,
1082 IN VOID
*SearchKey OPTIONAL
,
1083 IN OUT UINTN
*NumberHandles
,
1084 OUT EFI_HANDLE
**Buffer
1090 Return the first Protocol Interface that matches the Protocol GUID. If
1091 Registration is passed in, return a Protocol Instance that was just add
1092 to the system. If Registration is NULL return the first Protocol Interface
1095 @param Protocol The protocol to search for
1096 @param Registration Optional Registration Key returned from
1097 RegisterProtocolNotify()
1098 @param Interface Return the Protocol interface (instance).
1100 @retval EFI_SUCCESS If a valid Interface is returned
1101 @retval EFI_INVALID_PARAMETER Invalid parameter
1102 @retval EFI_NOT_FOUND Protocol interface not found
1107 CoreLocateProtocol (
1108 IN EFI_GUID
*Protocol
,
1109 IN VOID
*Registration OPTIONAL
,
1110 OUT VOID
**Interface
1115 return handle database key.
1118 @return Handle database key.
1122 CoreGetHandleDatabaseKey (
1128 Go connect any handles that were created or modified while a image executed.
1130 @param Key The Key to show that the handle has been
1135 CoreConnectHandlesByKey (
1142 Connects one or more drivers to a controller.
1144 @param ControllerHandle The handle of the controller to which driver(s) are to be connected.
1145 @param DriverImageHandle A pointer to an ordered list handles that support the
1146 EFI_DRIVER_BINDING_PROTOCOL.
1147 @param RemainingDevicePath A pointer to the device path that specifies a child of the
1148 controller specified by ControllerHandle.
1149 @param Recursive If TRUE, then ConnectController() is called recursively
1150 until the entire tree of controllers below the controller specified
1151 by ControllerHandle have been created. If FALSE, then
1152 the tree of controllers is only expanded one level.
1154 @retval EFI_SUCCESS 1) One or more drivers were connected to ControllerHandle.
1155 2) No drivers were connected to ControllerHandle, but
1156 RemainingDevicePath is not NULL, and it is an End Device
1158 @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.
1159 @retval EFI_NOT_FOUND 1) There are no EFI_DRIVER_BINDING_PROTOCOL instances
1160 present in the system.
1161 2) No drivers were connected to ControllerHandle.
1162 @retval EFI_SECURITY_VIOLATION
1163 The user has no permission to start UEFI device drivers on the device path
1164 associated with the ControllerHandle or specified by the RemainingDevicePath.
1169 CoreConnectController (
1170 IN EFI_HANDLE ControllerHandle
,
1171 IN EFI_HANDLE
*DriverImageHandle OPTIONAL
,
1172 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath OPTIONAL
,
1173 IN BOOLEAN Recursive
1179 Disonnects a controller from a driver
1181 @param ControllerHandle ControllerHandle The handle of
1182 the controller from which
1185 @param DriverImageHandle DriverImageHandle The driver to
1186 disconnect from ControllerHandle.
1187 @param ChildHandle ChildHandle The handle of the
1190 @retval EFI_SUCCESS One or more drivers were
1191 disconnected from the controller.
1192 @retval EFI_SUCCESS On entry, no drivers are managing
1194 @retval EFI_SUCCESS DriverImageHandle is not NULL,
1195 and on entry DriverImageHandle is
1196 not managing ControllerHandle.
1197 @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.
1198 @retval EFI_INVALID_PARAMETER DriverImageHandle is not NULL,
1199 and it is not a valid EFI_HANDLE.
1200 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL, and it
1201 is not a valid EFI_HANDLE.
1202 @retval EFI_OUT_OF_RESOURCES There are not enough resources
1203 available to disconnect any
1204 drivers from ControllerHandle.
1205 @retval EFI_DEVICE_ERROR The controller could not be
1206 disconnected because of a device
1212 CoreDisconnectController (
1213 IN EFI_HANDLE ControllerHandle
,
1214 IN EFI_HANDLE DriverImageHandle OPTIONAL
,
1215 IN EFI_HANDLE ChildHandle OPTIONAL
1221 Allocates pages from the memory map.
1223 @param Type The type of allocation to perform
1224 @param MemoryType The type of memory to turn the allocated pages
1226 @param NumberOfPages The number of pages to allocate
1227 @param Memory A pointer to receive the base allocated memory
1230 @return Status. On success, Memory is filled in with the base address allocated
1231 @retval EFI_INVALID_PARAMETER Parameters violate checking rules defined in
1233 @retval EFI_NOT_FOUND Could not allocate pages match the requirement.
1234 @retval EFI_OUT_OF_RESOURCES No enough pages to allocate.
1235 @retval EFI_SUCCESS Pages successfully allocated.
1241 IN EFI_ALLOCATE_TYPE Type
,
1242 IN EFI_MEMORY_TYPE MemoryType
,
1243 IN UINTN NumberOfPages
,
1244 IN OUT EFI_PHYSICAL_ADDRESS
*Memory
1248 Allocates pages from the memory map.
1250 @param Type The type of allocation to perform
1251 @param MemoryType The type of memory to turn the allocated pages
1253 @param NumberOfPages The number of pages to allocate
1254 @param Memory A pointer to receive the base allocated memory
1257 @return Status. On success, Memory is filled in with the base address allocated
1258 @retval EFI_INVALID_PARAMETER Parameters violate checking rules defined in
1260 @retval EFI_NOT_FOUND Could not allocate pages match the requirement.
1261 @retval EFI_OUT_OF_RESOURCES No enough pages to allocate.
1262 @retval EFI_SUCCESS Pages successfully allocated.
1267 CoreInternalAllocatePages (
1268 IN EFI_ALLOCATE_TYPE Type
,
1269 IN EFI_MEMORY_TYPE MemoryType
,
1270 IN UINTN NumberOfPages
,
1271 IN OUT EFI_PHYSICAL_ADDRESS
*Memory
1275 Frees previous allocated pages.
1277 @param Memory Base address of memory being freed
1278 @param NumberOfPages The number of pages to free
1280 @retval EFI_NOT_FOUND Could not find the entry that covers the range
1281 @retval EFI_INVALID_PARAMETER Address not aligned
1282 @return EFI_SUCCESS -Pages successfully freed.
1288 IN EFI_PHYSICAL_ADDRESS Memory
,
1289 IN UINTN NumberOfPages
1293 Frees previous allocated pages.
1295 @param Memory Base address of memory being freed
1296 @param NumberOfPages The number of pages to free
1298 @retval EFI_NOT_FOUND Could not find the entry that covers the range
1299 @retval EFI_INVALID_PARAMETER Address not aligned
1300 @return EFI_SUCCESS -Pages successfully freed.
1305 CoreInternalFreePages (
1306 IN EFI_PHYSICAL_ADDRESS Memory
,
1307 IN UINTN NumberOfPages
1311 This function returns a copy of the current memory map. The map is an array of
1312 memory descriptors, each of which describes a contiguous block of memory.
1314 @param MemoryMapSize A pointer to the size, in bytes, of the
1315 MemoryMap buffer. On input, this is the size of
1316 the buffer allocated by the caller. On output,
1317 it is the size of the buffer returned by the
1318 firmware if the buffer was large enough, or the
1319 size of the buffer needed to contain the map if
1320 the buffer was too small.
1321 @param MemoryMap A pointer to the buffer in which firmware places
1322 the current memory map.
1323 @param MapKey A pointer to the location in which firmware
1324 returns the key for the current memory map.
1325 @param DescriptorSize A pointer to the location in which firmware
1326 returns the size, in bytes, of an individual
1327 EFI_MEMORY_DESCRIPTOR.
1328 @param DescriptorVersion A pointer to the location in which firmware
1329 returns the version number associated with the
1330 EFI_MEMORY_DESCRIPTOR.
1332 @retval EFI_SUCCESS The memory map was returned in the MemoryMap
1334 @retval EFI_BUFFER_TOO_SMALL The MemoryMap buffer was too small. The current
1335 buffer size needed to hold the memory map is
1336 returned in MemoryMapSize.
1337 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
1343 IN OUT UINTN
*MemoryMapSize
,
1344 IN OUT EFI_MEMORY_DESCRIPTOR
*MemoryMap
,
1346 OUT UINTN
*DescriptorSize
,
1347 OUT UINT32
*DescriptorVersion
1353 Allocate pool of a particular type.
1355 @param PoolType Type of pool to allocate
1356 @param Size The amount of pool to allocate
1357 @param Buffer The address to return a pointer to the allocated
1360 @retval EFI_INVALID_PARAMETER PoolType not valid or Buffer is NULL
1361 @retval EFI_OUT_OF_RESOURCES Size exceeds max pool size or allocation failed.
1362 @retval EFI_SUCCESS Pool successfully allocated.
1368 IN EFI_MEMORY_TYPE PoolType
,
1374 Allocate pool of a particular type.
1376 @param PoolType Type of pool to allocate
1377 @param Size The amount of pool to allocate
1378 @param Buffer The address to return a pointer to the allocated
1381 @retval EFI_INVALID_PARAMETER PoolType not valid or Buffer is NULL
1382 @retval EFI_OUT_OF_RESOURCES Size exceeds max pool size or allocation failed.
1383 @retval EFI_SUCCESS Pool successfully allocated.
1388 CoreInternalAllocatePool (
1389 IN EFI_MEMORY_TYPE PoolType
,
1397 @param Buffer The allocated pool entry to free
1399 @retval EFI_INVALID_PARAMETER Buffer is not a valid value.
1400 @retval EFI_SUCCESS Pool successfully freed.
1412 @param Buffer The allocated pool entry to free
1414 @retval EFI_INVALID_PARAMETER Buffer is not a valid value.
1415 @retval EFI_SUCCESS Pool successfully freed.
1420 CoreInternalFreePool (
1425 Loads an EFI image into memory and returns a handle to the image.
1427 @param BootPolicy If TRUE, indicates that the request originates
1428 from the boot manager, and that the boot
1429 manager is attempting to load FilePath as a
1431 @param ParentImageHandle The caller's image handle.
1432 @param FilePath The specific file path from which the image is
1434 @param SourceBuffer If not NULL, a pointer to the memory location
1435 containing a copy of the image to be loaded.
1436 @param SourceSize The size in bytes of SourceBuffer.
1437 @param ImageHandle Pointer to the returned image handle that is
1438 created when the image is successfully loaded.
1440 @retval EFI_SUCCESS The image was loaded into memory.
1441 @retval EFI_NOT_FOUND The FilePath was not found.
1442 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
1443 @retval EFI_UNSUPPORTED The image type is not supported, or the device
1444 path cannot be parsed to locate the proper
1445 protocol for loading the file.
1446 @retval EFI_OUT_OF_RESOURCES Image was not loaded due to insufficient
1448 @retval EFI_LOAD_ERROR Image was not loaded because the image format was corrupt or not
1450 @retval EFI_DEVICE_ERROR Image was not loaded because the device returned a read error.
1451 @retval EFI_ACCESS_DENIED Image was not loaded because the platform policy prohibits the
1452 image from being loaded. NULL is returned in *ImageHandle.
1453 @retval EFI_SECURITY_VIOLATION Image was loaded and an ImageHandle was created with a
1454 valid EFI_LOADED_IMAGE_PROTOCOL. However, the current
1455 platform policy specifies that the image should not be started.
1461 IN BOOLEAN BootPolicy
,
1462 IN EFI_HANDLE ParentImageHandle
,
1463 IN EFI_DEVICE_PATH_PROTOCOL
*FilePath
,
1464 IN VOID
*SourceBuffer OPTIONAL
,
1465 IN UINTN SourceSize
,
1466 OUT EFI_HANDLE
*ImageHandle
1474 @param ImageHandle Handle that identifies the image to be
1477 @retval EFI_SUCCESS The image has been unloaded.
1478 @retval EFI_UNSUPPORTED The image has been sarted, and does not support
1480 @retval EFI_INVALID_PARAMPETER ImageHandle is not a valid image handle.
1486 IN EFI_HANDLE ImageHandle
1492 Transfer control to a loaded image's entry point.
1494 @param ImageHandle Handle of image to be started.
1495 @param ExitDataSize Pointer of the size to ExitData
1496 @param ExitData Pointer to a pointer to a data buffer that
1497 includes a Null-terminated string,
1498 optionally followed by additional binary data.
1499 The string is a description that the caller may
1500 use to further indicate the reason for the
1503 @retval EFI_INVALID_PARAMETER Invalid parameter
1504 @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate
1505 @retval EFI_SECURITY_VIOLATION The current platform policy specifies that the image should not be started.
1506 @retval EFI_SUCCESS Successfully transfer control to the image's
1513 IN EFI_HANDLE ImageHandle
,
1514 OUT UINTN
*ExitDataSize
,
1515 OUT CHAR16
**ExitData OPTIONAL
1521 Terminates the currently loaded EFI image and returns control to boot services.
1523 @param ImageHandle Handle that identifies the image. This
1524 parameter is passed to the image on entry.
1525 @param Status The image's exit code.
1526 @param ExitDataSize The size, in bytes, of ExitData. Ignored if
1527 ExitStatus is EFI_SUCCESS.
1528 @param ExitData Pointer to a data buffer that includes a
1529 Null-terminated Unicode string, optionally
1530 followed by additional binary data. The string
1531 is a description that the caller may use to
1532 further indicate the reason for the image's
1535 @retval EFI_INVALID_PARAMETER Image handle is NULL or it is not current
1537 @retval EFI_SUCCESS Successfully terminates the currently loaded
1539 @retval EFI_ACCESS_DENIED Should never reach there.
1540 @retval EFI_OUT_OF_RESOURCES Could not allocate pool
1546 IN EFI_HANDLE ImageHandle
,
1547 IN EFI_STATUS Status
,
1548 IN UINTN ExitDataSize
,
1549 IN CHAR16
*ExitData OPTIONAL
1557 @param Type The type of event to create and its mode and
1559 @param NotifyTpl The task priority level of event notifications
1560 @param NotifyFunction Pointer to the events notification function
1561 @param NotifyContext Pointer to the notification functions context;
1562 corresponds to parameter "Context" in the
1563 notification function
1564 @param Event Pointer to the newly created event if the call
1565 succeeds; undefined otherwise
1567 @retval EFI_SUCCESS The event structure was created
1568 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value
1569 @retval EFI_OUT_OF_RESOURCES The event could not be allocated
1576 IN EFI_TPL NotifyTpl
,
1577 IN EFI_EVENT_NOTIFY NotifyFunction
, OPTIONAL
1578 IN VOID
*NotifyContext
, OPTIONAL
1579 OUT EFI_EVENT
*Event
1585 Creates an event in a group.
1587 @param Type The type of event to create and its mode and
1589 @param NotifyTpl The task priority level of event notifications
1590 @param NotifyFunction Pointer to the events notification function
1591 @param NotifyContext Pointer to the notification functions context;
1592 corresponds to parameter "Context" in the
1593 notification function
1594 @param EventGroup GUID for EventGroup if NULL act the same as
1596 @param Event Pointer to the newly created event if the call
1597 succeeds; undefined otherwise
1599 @retval EFI_SUCCESS The event structure was created
1600 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value
1601 @retval EFI_OUT_OF_RESOURCES The event could not be allocated
1608 IN EFI_TPL NotifyTpl
,
1609 IN EFI_EVENT_NOTIFY NotifyFunction
, OPTIONAL
1610 IN CONST VOID
*NotifyContext
, OPTIONAL
1611 IN CONST EFI_GUID
*EventGroup
, OPTIONAL
1612 OUT EFI_EVENT
*Event
1616 Creates a general-purpose event structure
1618 @param Type The type of event to create and its mode and
1620 @param NotifyTpl The task priority level of event notifications
1621 @param NotifyFunction Pointer to the events notification function
1622 @param NotifyContext Pointer to the notification functions context;
1623 corresponds to parameter "Context" in the
1624 notification function
1625 @param EventGroup GUID for EventGroup if NULL act the same as
1627 @param Event Pointer to the newly created event if the call
1628 succeeds; undefined otherwise
1630 @retval EFI_SUCCESS The event structure was created
1631 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value
1632 @retval EFI_OUT_OF_RESOURCES The event could not be allocated
1637 CoreCreateEventInternal (
1639 IN EFI_TPL NotifyTpl
,
1640 IN EFI_EVENT_NOTIFY NotifyFunction
, OPTIONAL
1641 IN CONST VOID
*NotifyContext
, OPTIONAL
1642 IN CONST EFI_GUID
*EventGroup
, OPTIONAL
1643 OUT EFI_EVENT
*Event
1647 Sets the type of timer and the trigger time for a timer event.
1649 @param UserEvent The timer event that is to be signaled at the
1651 @param Type The type of time that is specified in
1653 @param TriggerTime The number of 100ns units until the timer
1656 @retval EFI_SUCCESS The event has been set to be signaled at the
1658 @retval EFI_INVALID_PARAMETER Event or Type is not valid
1664 IN EFI_EVENT UserEvent
,
1665 IN EFI_TIMER_DELAY Type
,
1666 IN UINT64 TriggerTime
1672 Signals the event. Queues the event to be notified if needed.
1674 @param UserEvent The event to signal .
1676 @retval EFI_INVALID_PARAMETER Parameters are not valid.
1677 @retval EFI_SUCCESS The event was signaled.
1683 IN EFI_EVENT UserEvent
1689 Stops execution until an event is signaled.
1691 @param NumberOfEvents The number of events in the UserEvents array
1692 @param UserEvents An array of EFI_EVENT
1693 @param UserIndex Pointer to the index of the event which
1694 satisfied the wait condition
1696 @retval EFI_SUCCESS The event indicated by Index was signaled.
1697 @retval EFI_INVALID_PARAMETER The event indicated by Index has a notification
1698 function or Event was not a valid type
1699 @retval EFI_UNSUPPORTED The current TPL is not TPL_APPLICATION
1705 IN UINTN NumberOfEvents
,
1706 IN EFI_EVENT
*UserEvents
,
1707 OUT UINTN
*UserIndex
1713 Closes an event and frees the event structure.
1715 @param UserEvent Event to close
1717 @retval EFI_INVALID_PARAMETER Parameters are not valid.
1718 @retval EFI_SUCCESS The event has been closed
1724 IN EFI_EVENT UserEvent
1730 Check the status of an event.
1732 @param UserEvent The event to check
1734 @retval EFI_SUCCESS The event is in the signaled state
1735 @retval EFI_NOT_READY The event is not in the signaled state
1736 @retval EFI_INVALID_PARAMETER Event is of type EVT_NOTIFY_SIGNAL
1742 IN EFI_EVENT UserEvent
1747 Adds reserved memory, system memory, or memory-mapped I/O resources to the
1748 global coherency domain of the processor.
1750 @param GcdMemoryType Memory type of the memory space.
1751 @param BaseAddress Base address of the memory space.
1752 @param Length Length of the memory space.
1753 @param Capabilities alterable attributes of the memory space.
1755 @retval EFI_SUCCESS Merged this memory space into GCD map.
1760 CoreAddMemorySpace (
1761 IN EFI_GCD_MEMORY_TYPE GcdMemoryType
,
1762 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1764 IN UINT64 Capabilities
1769 Allocates nonexistent memory, reserved memory, system memory, or memorymapped
1770 I/O resources from the global coherency domain of the processor.
1772 @param GcdAllocateType The type of allocate operation
1773 @param GcdMemoryType The desired memory type
1774 @param Alignment Align with 2^Alignment
1775 @param Length Length to allocate
1776 @param BaseAddress Base address to allocate
1777 @param ImageHandle The image handle consume the allocated space.
1778 @param DeviceHandle The device handle consume the allocated space.
1780 @retval EFI_INVALID_PARAMETER Invalid parameter.
1781 @retval EFI_NOT_FOUND No descriptor contains the desired space.
1782 @retval EFI_SUCCESS Memory space successfully allocated.
1787 CoreAllocateMemorySpace (
1788 IN EFI_GCD_ALLOCATE_TYPE GcdAllocateType
,
1789 IN EFI_GCD_MEMORY_TYPE GcdMemoryType
,
1792 IN OUT EFI_PHYSICAL_ADDRESS
*BaseAddress
,
1793 IN EFI_HANDLE ImageHandle
,
1794 IN EFI_HANDLE DeviceHandle OPTIONAL
1799 Frees nonexistent memory, reserved memory, system memory, or memory-mapped
1800 I/O resources from the global coherency domain of the processor.
1802 @param BaseAddress Base address of the memory space.
1803 @param Length Length of the memory space.
1805 @retval EFI_SUCCESS Space successfully freed.
1810 CoreFreeMemorySpace (
1811 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1817 Removes reserved memory, system memory, or memory-mapped I/O resources from
1818 the global coherency domain of the processor.
1820 @param BaseAddress Base address of the memory space.
1821 @param Length Length of the memory space.
1823 @retval EFI_SUCCESS Successfully remove a segment of memory space.
1828 CoreRemoveMemorySpace (
1829 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1835 Retrieves the descriptor for a memory region containing a specified address.
1837 @param BaseAddress Specified start address
1838 @param Descriptor Specified length
1840 @retval EFI_INVALID_PARAMETER Invalid parameter
1841 @retval EFI_SUCCESS Successfully get memory space descriptor.
1846 CoreGetMemorySpaceDescriptor (
1847 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1848 OUT EFI_GCD_MEMORY_SPACE_DESCRIPTOR
*Descriptor
1853 Modifies the attributes for a memory region in the global coherency domain of the
1856 @param BaseAddress Specified start address
1857 @param Length Specified length
1858 @param Attributes Specified attributes
1860 @retval EFI_SUCCESS The attributes were set for the memory region.
1861 @retval EFI_INVALID_PARAMETER Length is zero.
1862 @retval EFI_UNSUPPORTED The processor does not support one or more bytes of the memory
1863 resource range specified by BaseAddress and Length.
1864 @retval EFI_UNSUPPORTED The bit mask of attributes is not support for the memory resource
1865 range specified by BaseAddress and Length.
1866 @retval EFI_ACCESS_DENIED The attributes for the memory resource range specified by
1867 BaseAddress and Length cannot be modified.
1868 @retval EFI_OUT_OF_RESOURCES There are not enough system resources to modify the attributes of
1869 the memory resource range.
1870 @retval EFI_NOT_AVAILABLE_YET The attributes cannot be set because CPU architectural protocol is
1876 CoreSetMemorySpaceAttributes (
1877 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1879 IN UINT64 Attributes
1884 Modifies the capabilities for a memory region in the global coherency domain of the
1887 @param BaseAddress The physical address that is the start address of a memory region.
1888 @param Length The size in bytes of the memory region.
1889 @param Capabilities The bit mask of capabilities that the memory region supports.
1891 @retval EFI_SUCCESS The capabilities were set for the memory region.
1892 @retval EFI_INVALID_PARAMETER Length is zero.
1893 @retval EFI_UNSUPPORTED The capabilities specified by Capabilities do not include the
1894 memory region attributes currently in use.
1895 @retval EFI_ACCESS_DENIED The capabilities for the memory resource range specified by
1896 BaseAddress and Length cannot be modified.
1897 @retval EFI_OUT_OF_RESOURCES There are not enough system resources to modify the capabilities
1898 of the memory resource range.
1902 CoreSetMemorySpaceCapabilities (
1903 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1905 IN UINT64 Capabilities
1910 Returns a map of the memory resources in the global coherency domain of the
1913 @param NumberOfDescriptors Number of descriptors.
1914 @param MemorySpaceMap Descriptor array
1916 @retval EFI_INVALID_PARAMETER Invalid parameter
1917 @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate
1918 @retval EFI_SUCCESS Successfully get memory space map.
1923 CoreGetMemorySpaceMap (
1924 OUT UINTN
*NumberOfDescriptors
,
1925 OUT EFI_GCD_MEMORY_SPACE_DESCRIPTOR
**MemorySpaceMap
1930 Adds reserved I/O or I/O resources to the global coherency domain of the processor.
1932 @param GcdIoType IO type of the segment.
1933 @param BaseAddress Base address of the segment.
1934 @param Length Length of the segment.
1936 @retval EFI_SUCCESS Merged this segment into GCD map.
1937 @retval EFI_INVALID_PARAMETER Parameter not valid
1943 IN EFI_GCD_IO_TYPE GcdIoType
,
1944 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1950 Allocates nonexistent I/O, reserved I/O, or I/O resources from the global coherency
1951 domain of the processor.
1953 @param GcdAllocateType The type of allocate operation
1954 @param GcdIoType The desired IO type
1955 @param Alignment Align with 2^Alignment
1956 @param Length Length to allocate
1957 @param BaseAddress Base address to allocate
1958 @param ImageHandle The image handle consume the allocated space.
1959 @param DeviceHandle The device handle consume the allocated space.
1961 @retval EFI_INVALID_PARAMETER Invalid parameter.
1962 @retval EFI_NOT_FOUND No descriptor contains the desired space.
1963 @retval EFI_SUCCESS IO space successfully allocated.
1968 CoreAllocateIoSpace (
1969 IN EFI_GCD_ALLOCATE_TYPE GcdAllocateType
,
1970 IN EFI_GCD_IO_TYPE GcdIoType
,
1973 IN OUT EFI_PHYSICAL_ADDRESS
*BaseAddress
,
1974 IN EFI_HANDLE ImageHandle
,
1975 IN EFI_HANDLE DeviceHandle OPTIONAL
1980 Frees nonexistent I/O, reserved I/O, or I/O resources from the global coherency
1981 domain of the processor.
1983 @param BaseAddress Base address of the segment.
1984 @param Length Length of the segment.
1986 @retval EFI_SUCCESS Space successfully freed.
1992 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1998 Removes reserved I/O or I/O resources from the global coherency domain of the
2001 @param BaseAddress Base address of the segment.
2002 @param Length Length of the segment.
2004 @retval EFI_SUCCESS Successfully removed a segment of IO space.
2010 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
2016 Retrieves the descriptor for an I/O region containing a specified address.
2018 @param BaseAddress Specified start address
2019 @param Descriptor Specified length
2021 @retval EFI_INVALID_PARAMETER Descriptor is NULL.
2022 @retval EFI_SUCCESS Successfully get the IO space descriptor.
2027 CoreGetIoSpaceDescriptor (
2028 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
2029 OUT EFI_GCD_IO_SPACE_DESCRIPTOR
*Descriptor
2034 Returns a map of the I/O resources in the global coherency domain of the processor.
2036 @param NumberOfDescriptors Number of descriptors.
2037 @param IoSpaceMap Descriptor array
2039 @retval EFI_INVALID_PARAMETER Invalid parameter
2040 @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate
2041 @retval EFI_SUCCESS Successfully get IO space map.
2047 OUT UINTN
*NumberOfDescriptors
,
2048 OUT EFI_GCD_IO_SPACE_DESCRIPTOR
**IoSpaceMap
2053 This is the main Dispatcher for DXE and it exits when there are no more
2054 drivers to run. Drain the mScheduledQueue and load and start a PE
2055 image for each driver. Search the mDiscoveredList to see if any driver can
2056 be placed on the mScheduledQueue. If no drivers are placed on the
2057 mScheduledQueue exit the function. On exit it is assumed the Bds()
2058 will be called, and when the Bds() exits the Dispatcher will be called
2061 @retval EFI_ALREADY_STARTED The DXE Dispatcher is already running
2062 @retval EFI_NOT_FOUND No DXE Drivers were dispatched
2063 @retval EFI_SUCCESS One or more DXE Drivers were dispatched
2073 Check every driver and locate a matching one. If the driver is found, the Unrequested
2074 state flag is cleared.
2076 @param FirmwareVolumeHandle The handle of the Firmware Volume that contains
2077 the firmware file specified by DriverName.
2078 @param DriverName The Driver name to put in the Dependent state.
2080 @retval EFI_SUCCESS The DriverName was found and it's SOR bit was
2082 @retval EFI_NOT_FOUND The DriverName does not exist or it's SOR bit was
2089 IN EFI_HANDLE FirmwareVolumeHandle
,
2090 IN EFI_GUID
*DriverName
2095 Convert a driver from the Untrused back to the Scheduled state.
2097 @param FirmwareVolumeHandle The handle of the Firmware Volume that contains
2098 the firmware file specified by DriverName.
2099 @param DriverName The Driver name to put in the Scheduled state
2101 @retval EFI_SUCCESS The file was found in the untrusted state, and it
2102 was promoted to the trusted state.
2103 @retval EFI_NOT_FOUND The file was not found in the untrusted state.
2109 IN EFI_HANDLE FirmwareVolumeHandle
,
2110 IN EFI_GUID
*DriverName
2115 This routine is the driver initialization entry point. It initializes the
2116 libraries, and registers two notification functions. These notification
2117 functions are responsible for building the FV stack dynamically.
2119 @param ImageHandle The image handle.
2120 @param SystemTable The system table.
2122 @retval EFI_SUCCESS Function successfully returned.
2128 IN EFI_HANDLE ImageHandle
,
2129 IN EFI_SYSTEM_TABLE
*SystemTable
2134 Entry point of the section extraction code. Initializes an instance of the
2135 section extraction interface and installs it on a new handle.
2137 @param ImageHandle A handle for the image that is initializing this driver
2138 @param SystemTable A pointer to the EFI system table
2140 @retval EFI_SUCCESS Driver initialized successfully
2141 @retval EFI_OUT_OF_RESOURCES Could not allocate needed resources
2146 InitializeSectionExtraction (
2147 IN EFI_HANDLE ImageHandle
,
2148 IN EFI_SYSTEM_TABLE
*SystemTable
2153 This DXE service routine is used to process a firmware volume. In
2154 particular, it can be called by BDS to process a single firmware
2155 volume found in a capsule.
2157 @param FvHeader pointer to a firmware volume header
2158 @param Size the size of the buffer pointed to by FvHeader
2159 @param FVProtocolHandle the handle on which a firmware volume protocol
2160 was produced for the firmware volume passed in.
2162 @retval EFI_OUT_OF_RESOURCES if an FVB could not be produced due to lack of
2164 @retval EFI_VOLUME_CORRUPTED if the volume was corrupted
2165 @retval EFI_SUCCESS a firmware volume protocol was produced for the
2171 CoreProcessFirmwareVolume (
2174 OUT EFI_HANDLE
*FVProtocolHandle
2178 //Functions used during debug buils
2182 Displays Architectural protocols that were not loaded and are required for DXE
2183 core to function. Only used in Debug Builds.
2187 CoreDisplayMissingArchProtocols (
2193 Traverse the discovered list for any drivers that were discovered but not loaded
2194 because the dependency experessions evaluated to false.
2198 CoreDisplayDiscoveredNotDispatched (
2204 Place holder function until all the Boot Services and Runtime Services are
2207 @return EFI_NOT_AVAILABLE_YET
2212 CoreEfiNotAvailableYetArg0 (
2218 Place holder function until all the Boot Services and Runtime Services are
2221 @param Arg1 Undefined
2223 @return EFI_NOT_AVAILABLE_YET
2228 CoreEfiNotAvailableYetArg1 (
2234 Place holder function until all the Boot Services and Runtime Services are available.
2236 @param Arg1 Undefined
2237 @param Arg2 Undefined
2239 @return EFI_NOT_AVAILABLE_YET
2244 CoreEfiNotAvailableYetArg2 (
2251 Place holder function until all the Boot Services and Runtime Services are available.
2253 @param Arg1 Undefined
2254 @param Arg2 Undefined
2255 @param Arg3 Undefined
2257 @return EFI_NOT_AVAILABLE_YET
2262 CoreEfiNotAvailableYetArg3 (
2270 Place holder function until all the Boot Services and Runtime Services are available.
2272 @param Arg1 Undefined
2273 @param Arg2 Undefined
2274 @param Arg3 Undefined
2275 @param Arg4 Undefined
2277 @return EFI_NOT_AVAILABLE_YET
2282 CoreEfiNotAvailableYetArg4 (
2291 Place holder function until all the Boot Services and Runtime Services are available.
2293 @param Arg1 Undefined
2294 @param Arg2 Undefined
2295 @param Arg3 Undefined
2296 @param Arg4 Undefined
2297 @param Arg5 Undefined
2299 @return EFI_NOT_AVAILABLE_YET
2304 CoreEfiNotAvailableYetArg5 (
2314 Given a compressed source buffer, this function retrieves the size of the
2315 uncompressed buffer and the size of the scratch buffer required to decompress
2316 the compressed source buffer.
2318 The GetInfo() function retrieves the size of the uncompressed buffer and the
2319 temporary scratch buffer required to decompress the buffer specified by Source
2320 and SourceSize. If the size of the uncompressed buffer or the size of the
2321 scratch buffer cannot be determined from the compressed data specified by
2322 Source and SourceData, then EFI_INVALID_PARAMETER is returned. Otherwise, the
2323 size of the uncompressed buffer is returned in DestinationSize, the size of
2324 the scratch buffer is returned in ScratchSize, and EFI_SUCCESS is returned.
2325 The GetInfo() function does not have scratch buffer available to perform a
2326 thorough checking of the validity of the source data. It just retrieves the
2327 "Original Size" field from the beginning bytes of the source data and output
2328 it as DestinationSize. And ScratchSize is specific to the decompression
2331 @param This A pointer to the EFI_DECOMPRESS_PROTOCOL instance.
2332 @param Source The source buffer containing the compressed data.
2333 @param SourceSize The size, in bytes, of the source buffer.
2334 @param DestinationSize A pointer to the size, in bytes, of the
2335 uncompressed buffer that will be generated when the
2336 compressed buffer specified by Source and
2337 SourceSize is decompressed.
2338 @param ScratchSize A pointer to the size, in bytes, of the scratch
2339 buffer that is required to decompress the
2340 compressed buffer specified by Source and
2343 @retval EFI_SUCCESS The size of the uncompressed data was returned in
2344 DestinationSize and the size of the scratch buffer
2345 was returned in ScratchSize.
2346 @retval EFI_INVALID_PARAMETER The size of the uncompressed data or the size of
2347 the scratch buffer cannot be determined from the
2348 compressed data specified by Source and
2354 DxeMainUefiDecompressGetInfo (
2355 IN EFI_DECOMPRESS_PROTOCOL
*This
,
2357 IN UINT32 SourceSize
,
2358 OUT UINT32
*DestinationSize
,
2359 OUT UINT32
*ScratchSize
2364 Decompresses a compressed source buffer.
2366 The Decompress() function extracts decompressed data to its original form.
2367 This protocol is designed so that the decompression algorithm can be
2368 implemented without using any memory services. As a result, the Decompress()
2369 Function is not allowed to call AllocatePool() or AllocatePages() in its
2370 implementation. It is the caller's responsibility to allocate and free the
2371 Destination and Scratch buffers.
2372 If the compressed source data specified by Source and SourceSize is
2373 sucessfully decompressed into Destination, then EFI_SUCCESS is returned. If
2374 the compressed source data specified by Source and SourceSize is not in a
2375 valid compressed data format, then EFI_INVALID_PARAMETER is returned.
2377 @param This A pointer to the EFI_DECOMPRESS_PROTOCOL instance.
2378 @param Source The source buffer containing the compressed data.
2379 @param SourceSize SourceSizeThe size of source data.
2380 @param Destination On output, the destination buffer that contains
2381 the uncompressed data.
2382 @param DestinationSize The size of the destination buffer. The size of
2383 the destination buffer needed is obtained from
2384 EFI_DECOMPRESS_PROTOCOL.GetInfo().
2385 @param Scratch A temporary scratch buffer that is used to perform
2387 @param ScratchSize The size of scratch buffer. The size of the
2388 scratch buffer needed is obtained from GetInfo().
2390 @retval EFI_SUCCESS Decompression completed successfully, and the
2391 uncompressed buffer is returned in Destination.
2392 @retval EFI_INVALID_PARAMETER The source buffer specified by Source and
2393 SourceSize is corrupted (not in a valid
2399 DxeMainUefiDecompress (
2400 IN EFI_DECOMPRESS_PROTOCOL
*This
,
2402 IN UINT32 SourceSize
,
2403 IN OUT VOID
*Destination
,
2404 IN UINT32 DestinationSize
,
2405 IN OUT VOID
*Scratch
,
2406 IN UINT32 ScratchSize
2410 SEP member function. This function creates and returns a new section stream
2411 handle to represent the new section stream.
2413 @param SectionStreamLength Size in bytes of the section stream.
2414 @param SectionStream Buffer containing the new section stream.
2415 @param SectionStreamHandle A pointer to a caller allocated UINTN that on
2416 output contains the new section stream handle.
2418 @retval EFI_SUCCESS The section stream is created successfully.
2419 @retval EFI_OUT_OF_RESOURCES memory allocation failed.
2420 @retval EFI_INVALID_PARAMETER Section stream does not end concident with end
2427 IN UINTN SectionStreamLength
,
2428 IN VOID
*SectionStream
,
2429 OUT UINTN
*SectionStreamHandle
2435 SEP member function. Retrieves requested section from section stream.
2437 @param SectionStreamHandle The section stream from which to extract the
2439 @param SectionType A pointer to the type of section to search for.
2440 @param SectionDefinitionGuid If the section type is EFI_SECTION_GUID_DEFINED,
2441 then SectionDefinitionGuid indicates which of
2442 these types of sections to search for.
2443 @param SectionInstance Indicates which instance of the requested
2445 @param Buffer Double indirection to buffer. If *Buffer is
2446 non-null on input, then the buffer is caller
2447 allocated. If Buffer is NULL, then the buffer
2448 is callee allocated. In either case, the
2449 requried buffer size is returned in *BufferSize.
2450 @param BufferSize On input, indicates the size of *Buffer if
2451 *Buffer is non-null on input. On output,
2452 indicates the required size (allocated size if
2453 callee allocated) of *Buffer.
2454 @param AuthenticationStatus A pointer to a caller-allocated UINT32 that
2455 indicates the authentication status of the
2456 output buffer. If the input section's
2457 GuidedSectionHeader.Attributes field
2458 has the EFI_GUIDED_SECTION_AUTH_STATUS_VALID
2459 bit as clear, AuthenticationStatus must return
2460 zero. Both local bits (19:16) and aggregate
2461 bits (3:0) in AuthenticationStatus are returned
2462 by ExtractSection(). These bits reflect the
2463 status of the extraction operation. The bit
2464 pattern in both regions must be the same, as
2465 the local and aggregate authentication statuses
2466 have equivalent meaning at this level. If the
2467 function returns anything other than
2468 EFI_SUCCESS, the value of *AuthenticationStatus
2470 @param IsFfs3Fv Indicates the FV format.
2472 @retval EFI_SUCCESS Section was retrieved successfully
2473 @retval EFI_PROTOCOL_ERROR A GUID defined section was encountered in the
2474 section stream with its
2475 EFI_GUIDED_SECTION_PROCESSING_REQUIRED bit set,
2476 but there was no corresponding GUIDed Section
2477 Extraction Protocol in the handle database.
2478 *Buffer is unmodified.
2479 @retval EFI_NOT_FOUND An error was encountered when parsing the
2480 SectionStream. This indicates the SectionStream
2481 is not correctly formatted.
2482 @retval EFI_NOT_FOUND The requested section does not exist.
2483 @retval EFI_OUT_OF_RESOURCES The system has insufficient resources to process
2485 @retval EFI_INVALID_PARAMETER The SectionStreamHandle does not exist.
2486 @retval EFI_WARN_TOO_SMALL The size of the caller allocated input buffer is
2487 insufficient to contain the requested section.
2488 The input buffer is filled and section contents
2495 IN UINTN SectionStreamHandle
,
2496 IN EFI_SECTION_TYPE
*SectionType
,
2497 IN EFI_GUID
*SectionDefinitionGuid
,
2498 IN UINTN SectionInstance
,
2500 IN OUT UINTN
*BufferSize
,
2501 OUT UINT32
*AuthenticationStatus
,
2507 SEP member function. Deletes an existing section stream
2509 @param StreamHandleToClose Indicates the stream to close
2510 @param FreeStreamBuffer TRUE - Need to free stream buffer;
2511 FALSE - No need to free stream buffer.
2513 @retval EFI_SUCCESS The section stream is closed sucessfully.
2514 @retval EFI_OUT_OF_RESOURCES Memory allocation failed.
2515 @retval EFI_INVALID_PARAMETER Section stream does not end concident with end
2521 CloseSectionStream (
2522 IN UINTN StreamHandleToClose
,
2523 IN BOOLEAN FreeStreamBuffer
2527 Creates and initializes the DebugImageInfo Table. Also creates the configuration
2528 table and registers it into the system table.
2531 This function allocates memory, frees it, and then allocates memory at an
2532 address within the initial allocation. Since this function is called early
2533 in DXE core initialization (before drivers are dispatched), this should not
2538 CoreInitializeDebugImageInfoTable (
2544 Update the CRC32 in the Debug Table.
2545 Since the CRC32 service is made available by the Runtime driver, we have to
2546 wait for the Runtime Driver to be installed before the CRC32 can be computed.
2547 This function is called elsewhere by the core when the runtime architectural
2548 protocol is produced.
2552 CoreUpdateDebugTableCrc32 (
2558 Adds a new DebugImageInfo structure to the DebugImageInfo Table. Re-Allocates
2559 the table if it's not large enough to accomidate another entry.
2561 @param ImageInfoType type of debug image information
2562 @param LoadedImage pointer to the loaded image protocol for the image being
2564 @param ImageHandle image handle for the image being loaded
2568 CoreNewDebugImageInfoEntry (
2569 IN UINT32 ImageInfoType
,
2570 IN EFI_LOADED_IMAGE_PROTOCOL
*LoadedImage
,
2571 IN EFI_HANDLE ImageHandle
2576 Removes and frees an entry from the DebugImageInfo Table.
2578 @param ImageHandle image handle for the image being unloaded
2582 CoreRemoveDebugImageInfoEntry (
2583 EFI_HANDLE ImageHandle
2588 This routine consumes FV hobs and produces instances of FW_VOL_BLOCK_PROTOCOL as appropriate.
2590 @param ImageHandle The image handle.
2591 @param SystemTable The system table.
2593 @retval EFI_SUCCESS Successfully initialized firmware volume block
2599 FwVolBlockDriverInit (
2600 IN EFI_HANDLE ImageHandle
,
2601 IN EFI_SYSTEM_TABLE
*SystemTable
2606 Get FVB authentication status
2608 @param FvbProtocol FVB protocol.
2610 @return Authentication status.
2614 GetFvbAuthenticationStatus (
2615 IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL
*FvbProtocol
2619 This routine produces a firmware volume block protocol on a given
2622 @param BaseAddress base address of the firmware volume image
2623 @param Length length of the firmware volume image
2624 @param ParentHandle handle of parent firmware volume, if this image
2625 came from an FV image file and section in another firmware
2626 volume (ala capsules)
2627 @param AuthenticationStatus Authentication status inherited, if this image
2628 came from an FV image file and section in another firmware volume.
2629 @param FvProtocol Firmware volume block protocol produced.
2631 @retval EFI_VOLUME_CORRUPTED Volume corrupted.
2632 @retval EFI_OUT_OF_RESOURCES No enough buffer to be allocated.
2633 @retval EFI_SUCCESS Successfully produced a FVB protocol on given
2638 ProduceFVBProtocolOnBuffer (
2639 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
2641 IN EFI_HANDLE ParentHandle
,
2642 IN UINT32 AuthenticationStatus
,
2643 OUT EFI_HANDLE
*FvProtocol OPTIONAL
2648 Raising to the task priority level of the mutual exclusion
2649 lock, and then acquires ownership of the lock.
2651 @param Lock The lock to acquire
2663 Initialize a basic mutual exclusion lock. Each lock
2664 provides mutual exclusion access at it's task priority
2665 level. Since there is no-premption (at any TPL) or
2666 multiprocessor support, acquiring the lock only consists
2667 of raising to the locks TPL.
2669 @param Lock The EFI_LOCK structure to initialize
2671 @retval EFI_SUCCESS Lock Owned.
2672 @retval EFI_ACCESS_DENIED Reentrant Lock Acquisition, Lock not Owned.
2676 CoreAcquireLockOrFail (
2682 Releases ownership of the mutual exclusion lock, and
2683 restores the previous task priority level.
2685 @param Lock The lock to release
2687 @return Lock unowned
2697 An empty function to pass error checking of CreateEventEx ().
2699 @param Event Event whose notification function is being invoked.
2700 @param Context Pointer to the notification function's context,
2701 which is implementation-dependent.
2706 CoreEmptyCallbackFunction (
2712 Read data from Firmware Block by FVB protocol Read.
2713 The data may cross the multi block ranges.
2715 @param Fvb The FW_VOL_BLOCK_PROTOCOL instance from which to read data.
2716 @param StartLba Pointer to StartLba.
2717 On input, the start logical block index from which to read.
2718 On output,the end logical block index after reading.
2719 @param Offset Pointer to Offset
2720 On input, offset into the block at which to begin reading.
2721 On output, offset into the end block after reading.
2722 @param DataSize Size of data to be read.
2723 @param Data Pointer to Buffer that the data will be read into.
2725 @retval EFI_SUCCESS Successfully read data from firmware block.
2730 IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL
*Fvb
,
2731 IN OUT EFI_LBA
*StartLba
,
2732 IN OUT UINTN
*Offset
,
2738 Given the supplied FW_VOL_BLOCK_PROTOCOL, allocate a buffer for output and
2739 copy the real length volume header into it.
2741 @param Fvb The FW_VOL_BLOCK_PROTOCOL instance from which to
2742 read the volume header
2743 @param FwVolHeader Pointer to pointer to allocated buffer in which
2744 the volume header is returned.
2746 @retval EFI_OUT_OF_RESOURCES No enough buffer could be allocated.
2747 @retval EFI_SUCCESS Successfully read volume header to the allocated
2749 @retval EFI_INVALID_PARAMETER The FV Header signature is not as expected or
2750 the file system could not be understood.
2755 IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL
*Fvb
,
2756 OUT EFI_FIRMWARE_VOLUME_HEADER
**FwVolHeader
2760 Verify checksum of the firmware volume header.
2762 @param FvHeader Points to the firmware volume header to be checked
2764 @retval TRUE Checksum verification passed
2765 @retval FALSE Checksum verification failed
2769 VerifyFvHeaderChecksum (
2770 IN EFI_FIRMWARE_VOLUME_HEADER
*FvHeader
2774 Initialize memory profile.
2776 @param HobStart The start address of the HOB.
2785 Install memory profile protocol.
2789 MemoryProfileInstallProtocol (
2794 Register image to memory profile.
2796 @param DriverEntry Image info.
2797 @param FileType Image file type.
2799 @retval TRUE Register success.
2800 @retval FALSE Register fail.
2804 RegisterMemoryProfileImage (
2805 IN LOADED_IMAGE_PRIVATE_DATA
*DriverEntry
,
2806 IN EFI_FV_FILETYPE FileType
2810 Unregister image from memory profile.
2812 @param DriverEntry Image info.
2814 @retval TRUE Unregister success.
2815 @retval FALSE Unregister fail.
2819 UnregisterMemoryProfileImage (
2820 IN LOADED_IMAGE_PRIVATE_DATA
*DriverEntry
2824 Update memory profile information.
2826 @param CallerAddress Address of caller who call Allocate or Free.
2827 @param Action This Allocate or Free action.
2828 @param MemoryType Memory type.
2829 @param Size Buffer size.
2830 @param Buffer Buffer address.
2832 @retval TRUE Profile udpate success.
2833 @retval FALSE Profile update fail.
2838 IN EFI_PHYSICAL_ADDRESS CallerAddress
,
2839 IN MEMORY_PROFILE_ACTION Action
,
2840 IN EFI_MEMORY_TYPE MemoryType
, // Valid for AllocatePages/AllocatePool
2841 IN UINTN Size
, // Valid for AllocatePages/FreePages/AllocatePool
2846 Internal function. Converts a memory range to use new attributes.
2848 @param Start The first address of the range Must be page
2850 @param NumberOfPages The number of pages to convert
2851 @param NewAttributes The new attributes value for the range.
2855 CoreUpdateMemoryAttributes (
2856 IN EFI_PHYSICAL_ADDRESS Start
,
2857 IN UINT64 NumberOfPages
,
2858 IN UINT64 NewAttributes
2862 Initialize PropertiesTable support.
2866 CoreInitializePropertiesTable (
2871 Insert image record.
2873 @param RuntimeImage Runtime image information
2877 IN EFI_RUNTIME_IMAGE_ENTRY
*RuntimeImage
2881 Remove Image record.
2883 @param RuntimeImage Runtime image information
2887 IN EFI_RUNTIME_IMAGE_ENTRY
*RuntimeImage