X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=MdeModulePkg%2FCore%2FDxe%2FDxeMain.h;h=815a6b4bd844a452ace09c2e3932cfa03e3ecf2e;hb=1436aea4d5707e672672a11bda72be2c63c936c3;hp=e6b9114d2ee5aef564e6a642804d54902b4c69da;hpb=dea0d6bf2f19989f0583f8ae163571105645c6ca;p=mirror_edk2.git diff --git a/MdeModulePkg/Core/Dxe/DxeMain.h b/MdeModulePkg/Core/Dxe/DxeMain.h index e6b9114d2e..815a6b4bd8 100644 --- a/MdeModulePkg/Core/Dxe/DxeMain.h +++ b/MdeModulePkg/Core/Dxe/DxeMain.h @@ -2,22 +2,14 @@ The internal header file includes the common header files, defines internal structure and functions used by DxeCore module. -Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
-This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
+SPDX-License-Identifier: BSD-2-Clause-Patent **/ #ifndef _DXE_MAIN_H_ #define _DXE_MAIN_H_ - - #include #include @@ -42,7 +34,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include #include #include -#include #include #include #include @@ -53,6 +44,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include #include #include +#include #include #include #include @@ -69,7 +61,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include #include #include -#include #include #include @@ -90,12 +81,10 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include #include #include -#include #include #include #include - // // attributes for reserved memory before it is promoted to system memory // @@ -108,10 +97,9 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. // #define EFI_MEMORY_PORT_IO 0x4000000000000000ULL - /// -/// EFI_DEP_REPLACE_TRUE - Used to dynamically patch the dependecy expression -/// to save time. A EFI_DEP_PUSH is evauated one an +/// EFI_DEP_REPLACE_TRUE - Used to dynamically patch the dependency expression +/// to save time. A EFI_DEP_PUSH is evaluated one an /// replaced with EFI_DEP_REPLACE_TRUE. If PI spec's Vol 2 /// Driver Execution Environment Core Interface use 0xff /// as new DEPEX opcode. EFI_DEP_REPLACE_TRUE should be @@ -124,37 +112,12 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. /// #define DEPEX_STACK_SIZE_INCREMENT 0x1000 -#if defined (MDE_CPU_IPF) -/// -/// For Itanium machines make the default allocations 8K aligned -/// -#define EFI_ACPI_RUNTIME_PAGE_ALLOCATION_ALIGNMENT (EFI_PAGE_SIZE * 2) -#define DEFAULT_PAGE_ALLOCATION (EFI_PAGE_SIZE * 2) - -#elif defined (MDE_CPU_AARCH64) -/// -/// 64-bit ARM systems allow the OS to execute with 64 KB page size, -/// so for improved interoperability with the firmware, align the -/// runtime regions to 64 KB as well -/// -#define EFI_ACPI_RUNTIME_PAGE_ALLOCATION_ALIGNMENT (SIZE_64KB) -#define DEFAULT_PAGE_ALLOCATION (EFI_PAGE_SIZE) - -#else -/// -/// For genric EFI machines make the default allocations 4K aligned -/// -#define EFI_ACPI_RUNTIME_PAGE_ALLOCATION_ALIGNMENT (EFI_PAGE_SIZE) -#define DEFAULT_PAGE_ALLOCATION (EFI_PAGE_SIZE) - -#endif - typedef struct { - EFI_GUID *ProtocolGuid; - VOID **Protocol; - EFI_EVENT Event; - VOID *Registration; - BOOLEAN Present; + EFI_GUID *ProtocolGuid; + VOID **Protocol; + EFI_EVENT Event; + VOID *Registration; + BOOLEAN Present; } EFI_CORE_PROTOCOL_NOTIFY_ENTRY; // @@ -163,151 +126,166 @@ typedef struct { #define KNOWN_HANDLE_SIGNATURE SIGNATURE_32('k','n','o','w') typedef struct { - UINTN Signature; - LIST_ENTRY Link; // mFvHandleList - EFI_HANDLE Handle; - EFI_GUID FvNameGuid; + UINTN Signature; + LIST_ENTRY Link; // mFvHandleList + EFI_HANDLE Handle; + EFI_GUID FvNameGuid; } KNOWN_HANDLE; - -#define EFI_CORE_DRIVER_ENTRY_SIGNATURE SIGNATURE_32('d','r','v','r') +#define EFI_CORE_DRIVER_ENTRY_SIGNATURE SIGNATURE_32('d','r','v','r') typedef struct { - UINTN Signature; - LIST_ENTRY Link; // mDriverList + UINTN Signature; + LIST_ENTRY Link; // mDriverList - LIST_ENTRY ScheduledLink; // mScheduledQueue + LIST_ENTRY ScheduledLink; // mScheduledQueue - EFI_HANDLE FvHandle; - EFI_GUID FileName; - EFI_DEVICE_PATH_PROTOCOL *FvFileDevicePath; - EFI_FIRMWARE_VOLUME2_PROTOCOL *Fv; + EFI_HANDLE FvHandle; + EFI_GUID FileName; + EFI_DEVICE_PATH_PROTOCOL *FvFileDevicePath; + EFI_FIRMWARE_VOLUME2_PROTOCOL *Fv; - VOID *Depex; - UINTN DepexSize; + VOID *Depex; + UINTN DepexSize; - BOOLEAN Before; - BOOLEAN After; - EFI_GUID BeforeAfterGuid; + BOOLEAN Before; + BOOLEAN After; + EFI_GUID BeforeAfterGuid; - BOOLEAN Dependent; - BOOLEAN Unrequested; - BOOLEAN Scheduled; - BOOLEAN Untrusted; - BOOLEAN Initialized; - BOOLEAN DepexProtocolError; - - EFI_HANDLE ImageHandle; - BOOLEAN IsFvImage; + BOOLEAN Dependent; + BOOLEAN Unrequested; + BOOLEAN Scheduled; + BOOLEAN Untrusted; + BOOLEAN Initialized; + BOOLEAN DepexProtocolError; + EFI_HANDLE ImageHandle; + BOOLEAN IsFvImage; } EFI_CORE_DRIVER_ENTRY; // -//The data structure of GCD memory map entry +// The data structure of GCD memory map entry // #define EFI_GCD_MAP_SIGNATURE SIGNATURE_32('g','c','d','m') typedef struct { - UINTN Signature; - LIST_ENTRY Link; - EFI_PHYSICAL_ADDRESS BaseAddress; - UINT64 EndAddress; - UINT64 Capabilities; - UINT64 Attributes; - EFI_GCD_MEMORY_TYPE GcdMemoryType; - EFI_GCD_IO_TYPE GcdIoType; - EFI_HANDLE ImageHandle; - EFI_HANDLE DeviceHandle; + UINTN Signature; + LIST_ENTRY Link; + EFI_PHYSICAL_ADDRESS BaseAddress; + UINT64 EndAddress; + UINT64 Capabilities; + UINT64 Attributes; + EFI_GCD_MEMORY_TYPE GcdMemoryType; + EFI_GCD_IO_TYPE GcdIoType; + EFI_HANDLE ImageHandle; + EFI_HANDLE DeviceHandle; } EFI_GCD_MAP_ENTRY; - -#define LOADED_IMAGE_PRIVATE_DATA_SIGNATURE SIGNATURE_32('l','d','r','i') +#define LOADED_IMAGE_PRIVATE_DATA_SIGNATURE SIGNATURE_32('l','d','r','i') typedef struct { - UINTN Signature; + UINTN Signature; /// Image handle - EFI_HANDLE Handle; + EFI_HANDLE Handle; /// Image type - UINTN Type; + UINTN Type; /// If entrypoint has been called - BOOLEAN Started; + BOOLEAN Started; /// The image's entry point - EFI_IMAGE_ENTRY_POINT EntryPoint; + EFI_IMAGE_ENTRY_POINT EntryPoint; /// loaded image protocol - EFI_LOADED_IMAGE_PROTOCOL Info; + EFI_LOADED_IMAGE_PROTOCOL Info; /// Location in memory - EFI_PHYSICAL_ADDRESS ImageBasePage; + EFI_PHYSICAL_ADDRESS ImageBasePage; /// Number of pages - UINTN NumberOfPages; + UINTN NumberOfPages; /// Original fixup data - CHAR8 *FixupData; + CHAR8 *FixupData; /// Tpl of started image - EFI_TPL Tpl; + EFI_TPL Tpl; /// Status returned by started image - EFI_STATUS Status; + EFI_STATUS Status; /// Size of ExitData from started image - UINTN ExitDataSize; + UINTN ExitDataSize; /// Pointer to exit data from started image - VOID *ExitData; - /// Pointer to pool allocation for context save/retore - VOID *JumpBuffer; - /// Pointer to buffer for context save/retore - BASE_LIBRARY_JUMP_BUFFER *JumpContext; + VOID *ExitData; + /// Pointer to pool allocation for context save/restore + VOID *JumpBuffer; + /// Pointer to buffer for context save/restore + BASE_LIBRARY_JUMP_BUFFER *JumpContext; /// Machine type from PE image - UINT16 Machine; - /// EBC Protocol pointer - EFI_EBC_PROTOCOL *Ebc; + UINT16 Machine; + /// PE/COFF Image Emulator Protocol pointer + EDKII_PECOFF_IMAGE_EMULATOR_PROTOCOL *PeCoffEmu; /// Runtime image list - EFI_RUNTIME_IMAGE_ENTRY *RuntimeData; - /// Pointer to Loaded Image Device Path Protocl - EFI_DEVICE_PATH_PROTOCOL *LoadedImageDevicePath; + EFI_RUNTIME_IMAGE_ENTRY *RuntimeData; + /// Pointer to Loaded Image Device Path Protocol + EFI_DEVICE_PATH_PROTOCOL *LoadedImageDevicePath; /// PeCoffLoader ImageContext - PE_COFF_LOADER_IMAGE_CONTEXT ImageContext; + PE_COFF_LOADER_IMAGE_CONTEXT ImageContext; /// Status returned by LoadImage() service. - EFI_STATUS LoadImageStatus; + EFI_STATUS LoadImageStatus; } LOADED_IMAGE_PRIVATE_DATA; #define LOADED_IMAGE_PRIVATE_DATA_FROM_THIS(a) \ CR(a, LOADED_IMAGE_PRIVATE_DATA, Info, LOADED_IMAGE_PRIVATE_DATA_SIGNATURE) +#define IMAGE_PROPERTIES_RECORD_CODE_SECTION_SIGNATURE SIGNATURE_32 ('I','P','R','C') + +typedef struct { + UINT32 Signature; + LIST_ENTRY Link; + EFI_PHYSICAL_ADDRESS CodeSegmentBase; + UINT64 CodeSegmentSize; +} IMAGE_PROPERTIES_RECORD_CODE_SECTION; + +#define IMAGE_PROPERTIES_RECORD_SIGNATURE SIGNATURE_32 ('I','P','R','D') + +typedef struct { + UINT32 Signature; + LIST_ENTRY Link; + EFI_PHYSICAL_ADDRESS ImageBase; + UINT64 ImageSize; + UINTN CodeSegmentCount; + LIST_ENTRY CodeSegmentList; +} IMAGE_PROPERTIES_RECORD; + // // DXE Core Global Variables // -extern EFI_SYSTEM_TABLE *gDxeCoreST; -extern EFI_RUNTIME_SERVICES *gDxeCoreRT; -extern EFI_DXE_SERVICES *gDxeCoreDS; -extern EFI_HANDLE gDxeCoreImageHandle; +extern EFI_SYSTEM_TABLE *gDxeCoreST; +extern EFI_RUNTIME_SERVICES *gDxeCoreRT; +extern EFI_DXE_SERVICES *gDxeCoreDS; +extern EFI_HANDLE gDxeCoreImageHandle; -extern BOOLEAN gMemoryMapTerminated; +extern BOOLEAN gMemoryMapTerminated; -extern EFI_DECOMPRESS_PROTOCOL gEfiDecompress; +extern EFI_DECOMPRESS_PROTOCOL gEfiDecompress; -extern EFI_RUNTIME_ARCH_PROTOCOL *gRuntime; -extern EFI_CPU_ARCH_PROTOCOL *gCpu; -extern EFI_WATCHDOG_TIMER_ARCH_PROTOCOL *gWatchdogTimer; -extern EFI_METRONOME_ARCH_PROTOCOL *gMetronome; -extern EFI_TIMER_ARCH_PROTOCOL *gTimer; -extern EFI_SECURITY_ARCH_PROTOCOL *gSecurity; -extern EFI_SECURITY2_ARCH_PROTOCOL *gSecurity2; -extern EFI_BDS_ARCH_PROTOCOL *gBds; -extern EFI_SMM_BASE2_PROTOCOL *gSmmBase2; +extern EFI_RUNTIME_ARCH_PROTOCOL *gRuntime; +extern EFI_CPU_ARCH_PROTOCOL *gCpu; +extern EFI_WATCHDOG_TIMER_ARCH_PROTOCOL *gWatchdogTimer; +extern EFI_METRONOME_ARCH_PROTOCOL *gMetronome; +extern EFI_TIMER_ARCH_PROTOCOL *gTimer; +extern EFI_SECURITY_ARCH_PROTOCOL *gSecurity; +extern EFI_SECURITY2_ARCH_PROTOCOL *gSecurity2; +extern EFI_BDS_ARCH_PROTOCOL *gBds; +extern EFI_SMM_BASE2_PROTOCOL *gSmmBase2; -extern EFI_TPL gEfiCurrentTpl; +extern EFI_TPL gEfiCurrentTpl; -extern EFI_GUID *gDxeCoreFileName; -extern EFI_LOADED_IMAGE_PROTOCOL *gDxeCoreLoadedImage; +extern EFI_GUID *gDxeCoreFileName; +extern EFI_LOADED_IMAGE_PROTOCOL *gDxeCoreLoadedImage; -extern EFI_MEMORY_TYPE_INFORMATION gMemoryTypeInformation[EfiMaxMemoryType + 1]; +extern EFI_MEMORY_TYPE_INFORMATION gMemoryTypeInformation[EfiMaxMemoryType + 1]; -extern BOOLEAN gDispatcherRunning; -extern EFI_RUNTIME_ARCH_PROTOCOL gRuntimeTemplate; +extern BOOLEAN gDispatcherRunning; +extern EFI_RUNTIME_ARCH_PROTOCOL gRuntimeTemplate; -extern EFI_LOAD_FIXED_ADDRESS_CONFIGURATION_TABLE gLoadModuleAtFixAddressConfigurationTable; -extern BOOLEAN gLoadFixedAddressCodeMemoryReady; +extern EFI_LOAD_FIXED_ADDRESS_CONFIGURATION_TABLE gLoadModuleAtFixAddressConfigurationTable; +extern BOOLEAN gLoadFixedAddressCodeMemoryReady; // // Service Initialization Functions // - - /** Called to initialize the pool. @@ -317,7 +295,6 @@ CoreInitializePool ( VOID ); - /** Called to initialize the memory map and add descriptors to the current descriptor list. @@ -341,7 +318,6 @@ CoreAddMemoryDescriptor ( IN UINT64 Attribute ); - /** Release memory lock on mGcdMemorySpaceLock. @@ -351,7 +327,6 @@ CoreReleaseGcdMemoryLock ( VOID ); - /** Acquire memory lock on mGcdMemorySpaceLock. @@ -361,7 +336,6 @@ CoreAcquireGcdMemoryLock ( VOID ); - /** External function. Initializes memory services based on the memory descriptor HOBs. This function is responsible for priming the memory @@ -384,8 +358,6 @@ CoreInitializeMemoryServices ( OUT UINT64 *MemoryLength ); - - /** External function. Initializes the GCD and memory services based on the memory descriptor HOBs. This function is responsible for priming the GCD map and the @@ -407,7 +379,6 @@ CoreInitializeGcdServices ( IN UINT64 MemoryLength ); - /** Initializes "event" support. @@ -419,7 +390,6 @@ CoreInitializeEventServices ( VOID ); - /** Add the Image Services to EFI Boot Services Table and install the protocol interfaces for this image. @@ -431,10 +401,9 @@ CoreInitializeEventServices ( **/ EFI_STATUS CoreInitializeImageServices ( - IN VOID *HobStart + IN VOID *HobStart ); - /** Creates an event that is fired everytime a Protocol of a specific type is installed. @@ -444,9 +413,8 @@ CoreNotifyOnProtocolInstallation ( VOID ); - /** - Return TRUE if all AP services are availible. + Return TRUE if all AP services are available. @retval EFI_SUCCESS All AP services are available @retval EFI_NOT_FOUND At least one AP service is not available @@ -457,7 +425,6 @@ CoreAllEfiServicesAvailable ( VOID ); - /** Calcualte the 32-bit CRC in a EFI table using the service provided by the gRuntime service. @@ -467,24 +434,22 @@ CoreAllEfiServicesAvailable ( **/ VOID CalculateEfiHdrCrc ( - IN OUT EFI_TABLE_HEADER *Hdr + IN OUT EFI_TABLE_HEADER *Hdr ); - /** Called by the platform code to process a tick. - @param Duration The number of 100ns elasped since the last call + @param Duration The number of 100ns elapsed since the last call to TimerTick **/ VOID EFIAPI CoreTimerTick ( - IN UINT64 Duration + IN UINT64 Duration ); - /** Initialize the dispatcher. Initialize the notification function that runs when an FV2 protocol is added to the system. @@ -495,7 +460,6 @@ CoreInitializeDispatcher ( VOID ); - /** This is the POSTFIX version of the dependency evaluator. This code does not need to handle Before or After, as it is not valid to call this @@ -511,10 +475,9 @@ CoreInitializeDispatcher ( **/ BOOLEAN CoreIsSchedulable ( - IN EFI_CORE_DRIVER_ENTRY *DriverEntry + IN EFI_CORE_DRIVER_ENTRY *DriverEntry ); - /** Preprocess dependency expression and update DriverEntry to reflect the state of Before, After, and SOR dependencies. If DriverEntry->Before @@ -529,11 +492,9 @@ CoreIsSchedulable ( **/ EFI_STATUS CorePreProcessDepex ( - IN EFI_CORE_DRIVER_ENTRY *DriverEntry + IN EFI_CORE_DRIVER_ENTRY *DriverEntry ); - - /** Terminates all boot services. @@ -547,11 +508,10 @@ CorePreProcessDepex ( EFI_STATUS EFIAPI CoreExitBootServices ( - IN EFI_HANDLE ImageHandle, - IN UINTN MapKey + IN EFI_HANDLE ImageHandle, + IN UINTN MapKey ); - /** Make sure the memory map is following all the construction rules, it is the last time to check memory map error before exit boot services. @@ -565,10 +525,9 @@ CoreExitBootServices ( **/ EFI_STATUS CoreTerminateMemoryMap ( - IN UINTN MapKey + IN UINTN MapKey ); - /** Signals all events in the EventGroup. @@ -577,11 +536,9 @@ CoreTerminateMemoryMap ( **/ VOID CoreNotifySignalList ( - IN EFI_GUID *EventGroup + IN EFI_GUID *EventGroup ); - - /** Boot Service called to add, modify, or remove a system configuration table from the EFI System Table. @@ -600,12 +557,10 @@ CoreNotifySignalList ( EFI_STATUS EFIAPI CoreInstallConfigurationTable ( - IN EFI_GUID *Guid, - IN VOID *Table + IN EFI_GUID *Guid, + IN VOID *Table ); - - /** Raise the task priority level to the new level. High level is implemented by disabling processor interrupts. @@ -618,11 +573,9 @@ CoreInstallConfigurationTable ( EFI_TPL EFIAPI CoreRaiseTpl ( - IN EFI_TPL NewTpl + IN EFI_TPL NewTpl ); - - /** Lowers the task priority to the previous value. If the new priority unmasks events at a higher priority, they are dispatched. @@ -633,11 +586,9 @@ CoreRaiseTpl ( VOID EFIAPI CoreRestoreTpl ( - IN EFI_TPL NewTpl + IN EFI_TPL NewTpl ); - - /** Introduces a fine-grained stall. @@ -651,11 +602,9 @@ CoreRestoreTpl ( EFI_STATUS EFIAPI CoreStall ( - IN UINTN Microseconds + IN UINTN Microseconds ); - - /** Sets the system's watchdog timer. @@ -681,14 +630,12 @@ CoreStall ( EFI_STATUS EFIAPI CoreSetWatchdogTimer ( - IN UINTN Timeout, - IN UINT64 WatchdogCode, - IN UINTN DataSize, - IN CHAR16 *WatchdogData OPTIONAL + IN UINTN Timeout, + IN UINT64 WatchdogCode, + IN UINTN DataSize, + IN CHAR16 *WatchdogData OPTIONAL ); - - /** Wrapper function to CoreInstallProtocolInterfaceNotify. This is the public API which Calls the private one which contains a BOOLEAN parameter for notifications @@ -706,13 +653,12 @@ CoreSetWatchdogTimer ( EFI_STATUS EFIAPI CoreInstallProtocolInterface ( - IN OUT EFI_HANDLE *UserHandle, - IN EFI_GUID *Protocol, - IN EFI_INTERFACE_TYPE InterfaceType, - IN VOID *Interface + IN OUT EFI_HANDLE *UserHandle, + IN EFI_GUID *Protocol, + IN EFI_INTERFACE_TYPE InterfaceType, + IN VOID *Interface ); - /** Installs a protocol interface into the boot services environment. @@ -732,15 +678,13 @@ CoreInstallProtocolInterface ( **/ EFI_STATUS CoreInstallProtocolInterfaceNotify ( - IN OUT EFI_HANDLE *UserHandle, - IN EFI_GUID *Protocol, - IN EFI_INTERFACE_TYPE InterfaceType, - IN VOID *Interface, - IN BOOLEAN Notify + IN OUT EFI_HANDLE *UserHandle, + IN EFI_GUID *Protocol, + IN EFI_INTERFACE_TYPE InterfaceType, + IN VOID *Interface, + IN BOOLEAN Notify ); - - /** Installs a list of protocol interface into the boot services environment. This function calls InstallProtocolInterface() in a loop. If any error @@ -765,12 +709,10 @@ CoreInstallProtocolInterfaceNotify ( EFI_STATUS EFIAPI CoreInstallMultipleProtocolInterfaces ( - IN OUT EFI_HANDLE *Handle, + IN OUT EFI_HANDLE *Handle, ... ); - - /** Uninstalls a list of protocol interface in the boot services environment. This function calls UnisatllProtocolInterface() in a loop. This is @@ -788,12 +730,10 @@ CoreInstallMultipleProtocolInterfaces ( EFI_STATUS EFIAPI CoreUninstallMultipleProtocolInterfaces ( - IN EFI_HANDLE Handle, + IN EFI_HANDLE Handle, ... ); - - /** Reinstall a protocol interface on a device handle. The OldInterface for Protocol is replaced by the NewInterface. @@ -811,14 +751,12 @@ CoreUninstallMultipleProtocolInterfaces ( EFI_STATUS EFIAPI CoreReinstallProtocolInterface ( - IN EFI_HANDLE UserHandle, - IN EFI_GUID *Protocol, - IN VOID *OldInterface, - IN VOID *NewInterface + IN EFI_HANDLE UserHandle, + IN EFI_GUID *Protocol, + IN VOID *OldInterface, + IN VOID *NewInterface ); - - /** Uninstalls all instances of a protocol:interfacer from a handle. If the last protocol interface is remove from the handle, the @@ -835,13 +773,11 @@ CoreReinstallProtocolInterface ( EFI_STATUS EFIAPI CoreUninstallProtocolInterface ( - IN EFI_HANDLE UserHandle, - IN EFI_GUID *Protocol, - IN VOID *Interface + IN EFI_HANDLE UserHandle, + IN EFI_GUID *Protocol, + IN VOID *Interface ); - - /** Queries a handle to determine if it supports a specified protocol. @@ -856,13 +792,11 @@ CoreUninstallProtocolInterface ( EFI_STATUS EFIAPI CoreHandleProtocol ( - IN EFI_HANDLE UserHandle, - IN EFI_GUID *Protocol, - OUT VOID **Interface + IN EFI_HANDLE UserHandle, + IN EFI_GUID *Protocol, + OUT VOID **Interface ); - - /** Locates the installed protocol handler for the handle, and invokes it to obtain the protocol interface. Usage information @@ -886,16 +820,14 @@ CoreHandleProtocol ( EFI_STATUS EFIAPI CoreOpenProtocol ( - IN EFI_HANDLE UserHandle, - IN EFI_GUID *Protocol, - OUT VOID **Interface OPTIONAL, - IN EFI_HANDLE ImageHandle, - IN EFI_HANDLE ControllerHandle, - IN UINT32 Attributes + IN EFI_HANDLE UserHandle, + IN EFI_GUID *Protocol, + OUT VOID **Interface OPTIONAL, + IN EFI_HANDLE ImageHandle, + IN EFI_HANDLE ControllerHandle, + IN UINT32 Attributes ); - - /** Return information about Opened protocols in the system @@ -910,14 +842,12 @@ CoreOpenProtocol ( EFI_STATUS EFIAPI CoreOpenProtocolInformation ( - IN EFI_HANDLE UserHandle, - IN EFI_GUID *Protocol, - OUT EFI_OPEN_PROTOCOL_INFORMATION_ENTRY **EntryBuffer, - OUT UINTN *EntryCount + IN EFI_HANDLE UserHandle, + IN EFI_GUID *Protocol, + OUT EFI_OPEN_PROTOCOL_INFORMATION_ENTRY **EntryBuffer, + OUT UINTN *EntryCount ); - - /** Closes a protocol on a handle that was opened using OpenProtocol(). @@ -946,14 +876,12 @@ CoreOpenProtocolInformation ( EFI_STATUS EFIAPI CoreCloseProtocol ( - IN EFI_HANDLE UserHandle, - IN EFI_GUID *Protocol, - IN EFI_HANDLE AgentHandle, - IN EFI_HANDLE ControllerHandle + IN EFI_HANDLE UserHandle, + IN EFI_GUID *Protocol, + IN EFI_HANDLE AgentHandle, + IN EFI_HANDLE ControllerHandle ); - - /** Retrieves the list of protocol interface GUIDs that are installed on a handle in a buffer allocated from pool. @@ -980,13 +908,11 @@ CoreCloseProtocol ( EFI_STATUS EFIAPI CoreProtocolsPerHandle ( - IN EFI_HANDLE UserHandle, - OUT EFI_GUID ***ProtocolBuffer, - OUT UINTN *ProtocolBufferCount + IN EFI_HANDLE UserHandle, + OUT EFI_GUID ***ProtocolBuffer, + OUT UINTN *ProtocolBufferCount ); - - /** Add a new protocol notification record for the request protocol. @@ -1003,12 +929,11 @@ CoreProtocolsPerHandle ( EFI_STATUS EFIAPI CoreRegisterProtocolNotify ( - IN EFI_GUID *Protocol, - IN EFI_EVENT Event, - OUT VOID **Registration + IN EFI_GUID *Protocol, + IN EFI_EVENT Event, + OUT VOID **Registration ); - /** Removes all the events in the protocol database that match Event. @@ -1020,10 +945,9 @@ CoreRegisterProtocolNotify ( **/ EFI_STATUS CoreUnregisterProtocolNotify ( - IN EFI_EVENT Event + IN EFI_EVENT Event ); - /** Locates the requested handle(s) and returns them in Buffer. @@ -1045,15 +969,13 @@ CoreUnregisterProtocolNotify ( EFI_STATUS EFIAPI CoreLocateHandle ( - IN EFI_LOCATE_SEARCH_TYPE SearchType, - IN EFI_GUID *Protocol OPTIONAL, - IN VOID *SearchKey OPTIONAL, - IN OUT UINTN *BufferSize, - OUT EFI_HANDLE *Buffer + IN EFI_LOCATE_SEARCH_TYPE SearchType, + IN EFI_GUID *Protocol OPTIONAL, + IN VOID *SearchKey OPTIONAL, + IN OUT UINTN *BufferSize, + OUT EFI_HANDLE *Buffer ); - - /** Locates the handle to a device on the device path that best matches the specified protocol. @@ -1072,13 +994,11 @@ CoreLocateHandle ( EFI_STATUS EFIAPI CoreLocateDevicePath ( - IN EFI_GUID *Protocol, - IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath, - OUT EFI_HANDLE *Device + IN EFI_GUID *Protocol, + IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath, + OUT EFI_HANDLE *Device ); - - /** Function returns an array of handles that support the requested protocol in a buffer allocated from pool. This is a version of CoreLocateHandle() @@ -1098,21 +1018,19 @@ CoreLocateDevicePath ( @retval EFI_NOT_FOUND No handles match the search. @retval EFI_OUT_OF_RESOURCES There is not enough pool memory to store the matching results. - @retval EFI_INVALID_PARAMETER One or more paramters are not valid. + @retval EFI_INVALID_PARAMETER One or more parameters are not valid. **/ EFI_STATUS EFIAPI CoreLocateHandleBuffer ( - IN EFI_LOCATE_SEARCH_TYPE SearchType, - IN EFI_GUID *Protocol OPTIONAL, - IN VOID *SearchKey OPTIONAL, - IN OUT UINTN *NumberHandles, - OUT EFI_HANDLE **Buffer + IN EFI_LOCATE_SEARCH_TYPE SearchType, + IN EFI_GUID *Protocol OPTIONAL, + IN VOID *SearchKey OPTIONAL, + IN OUT UINTN *NumberHandles, + OUT EFI_HANDLE **Buffer ); - - /** Return the first Protocol Interface that matches the Protocol GUID. If Registration is passed in, return a Protocol Instance that was just add @@ -1137,7 +1055,6 @@ CoreLocateProtocol ( OUT VOID **Interface ); - /** return handle database key. @@ -1150,7 +1067,6 @@ CoreGetHandleDatabaseKey ( VOID ); - /** Go connect any handles that were created or modified while a image executed. @@ -1163,8 +1079,6 @@ CoreConnectHandlesByKey ( UINT64 Key ); - - /** Connects one or more drivers to a controller. @@ -1186,8 +1100,8 @@ CoreConnectHandlesByKey ( @retval EFI_NOT_FOUND 1) There are no EFI_DRIVER_BINDING_PROTOCOL instances present in the system. 2) No drivers were connected to ControllerHandle. - @retval EFI_SECURITY_VIOLATION - The user has no permission to start UEFI device drivers on the device path + @retval EFI_SECURITY_VIOLATION + The user has no permission to start UEFI device drivers on the device path associated with the ControllerHandle or specified by the RemainingDevicePath. **/ @@ -1200,8 +1114,6 @@ CoreConnectController ( IN BOOLEAN Recursive ); - - /** Disonnects a controller from a driver @@ -1242,8 +1154,6 @@ CoreDisconnectController ( IN EFI_HANDLE ChildHandle OPTIONAL ); - - /** Allocates pages from the memory map. @@ -1265,9 +1175,9 @@ CoreDisconnectController ( EFI_STATUS EFIAPI CoreAllocatePages ( - IN EFI_ALLOCATE_TYPE Type, - IN EFI_MEMORY_TYPE MemoryType, - IN UINTN NumberOfPages, + IN EFI_ALLOCATE_TYPE Type, + IN EFI_MEMORY_TYPE MemoryType, + IN UINTN NumberOfPages, IN OUT EFI_PHYSICAL_ADDRESS *Memory ); @@ -1285,8 +1195,8 @@ CoreAllocatePages ( EFI_STATUS EFIAPI CoreFreePages ( - IN EFI_PHYSICAL_ADDRESS Memory, - IN UINTN NumberOfPages + IN EFI_PHYSICAL_ADDRESS Memory, + IN UINTN NumberOfPages ); /** @@ -1329,8 +1239,6 @@ CoreGetMemoryMap ( OUT UINT32 *DescriptorVersion ); - - /** Allocate pool of a particular type. @@ -1385,7 +1293,7 @@ CoreInternalAllocatePool ( EFI_STATUS EFIAPI CoreFreePool ( - IN VOID *Buffer + IN VOID *Buffer ); /** @@ -1401,8 +1309,8 @@ CoreFreePool ( EFI_STATUS EFIAPI CoreInternalFreePool ( - IN VOID *Buffer, - OUT EFI_MEMORY_TYPE *PoolType OPTIONAL + IN VOID *Buffer, + OUT EFI_MEMORY_TYPE *PoolType OPTIONAL ); /** @@ -1432,26 +1340,24 @@ CoreInternalFreePool ( @retval EFI_LOAD_ERROR Image was not loaded because the image format was corrupt or not understood. @retval EFI_DEVICE_ERROR Image was not loaded because the device returned a read error. - @retval EFI_ACCESS_DENIED Image was not loaded because the platform policy prohibits the + @retval EFI_ACCESS_DENIED Image was not loaded because the platform policy prohibits the image from being loaded. NULL is returned in *ImageHandle. - @retval EFI_SECURITY_VIOLATION Image was loaded and an ImageHandle was created with a - valid EFI_LOADED_IMAGE_PROTOCOL. However, the current + @retval EFI_SECURITY_VIOLATION Image was loaded and an ImageHandle was created with a + valid EFI_LOADED_IMAGE_PROTOCOL. However, the current platform policy specifies that the image should not be started. **/ EFI_STATUS EFIAPI CoreLoadImage ( - IN BOOLEAN BootPolicy, - IN EFI_HANDLE ParentImageHandle, - IN EFI_DEVICE_PATH_PROTOCOL *FilePath, - IN VOID *SourceBuffer OPTIONAL, - IN UINTN SourceSize, - OUT EFI_HANDLE *ImageHandle + IN BOOLEAN BootPolicy, + IN EFI_HANDLE ParentImageHandle, + IN EFI_DEVICE_PATH_PROTOCOL *FilePath, + IN VOID *SourceBuffer OPTIONAL, + IN UINTN SourceSize, + OUT EFI_HANDLE *ImageHandle ); - - /** Unloads an image. @@ -1459,7 +1365,7 @@ CoreLoadImage ( unloaded. @retval EFI_SUCCESS The image has been unloaded. - @retval EFI_UNSUPPORTED The image has been sarted, and does not support + @retval EFI_UNSUPPORTED The image has been started, and does not support unload. @retval EFI_INVALID_PARAMPETER ImageHandle is not a valid image handle. @@ -1470,8 +1376,6 @@ CoreUnloadImage ( IN EFI_HANDLE ImageHandle ); - - /** Transfer control to a loaded image's entry point. @@ -1499,8 +1403,6 @@ CoreStartImage ( OUT CHAR16 **ExitData OPTIONAL ); - - /** Terminates the currently loaded EFI image and returns control to boot services. @@ -1533,8 +1435,6 @@ CoreExit ( IN CHAR16 *ExitData OPTIONAL ); - - /** Creates an event. @@ -1556,15 +1456,13 @@ CoreExit ( EFI_STATUS EFIAPI CoreCreateEvent ( - IN UINT32 Type, - IN EFI_TPL NotifyTpl, - IN EFI_EVENT_NOTIFY NotifyFunction, OPTIONAL - IN VOID *NotifyContext, OPTIONAL - OUT EFI_EVENT *Event + IN UINT32 Type, + IN EFI_TPL NotifyTpl, + IN EFI_EVENT_NOTIFY NotifyFunction OPTIONAL, + IN VOID *NotifyContext OPTIONAL, + OUT EFI_EVENT *Event ); - - /** Creates an event in a group. @@ -1588,12 +1486,12 @@ CoreCreateEvent ( EFI_STATUS EFIAPI CoreCreateEventEx ( - IN UINT32 Type, - IN EFI_TPL NotifyTpl, - IN EFI_EVENT_NOTIFY NotifyFunction, OPTIONAL - IN CONST VOID *NotifyContext, OPTIONAL - IN CONST EFI_GUID *EventGroup, OPTIONAL - OUT EFI_EVENT *Event + IN UINT32 Type, + IN EFI_TPL NotifyTpl, + IN EFI_EVENT_NOTIFY NotifyFunction OPTIONAL, + IN CONST VOID *NotifyContext OPTIONAL, + IN CONST EFI_GUID *EventGroup OPTIONAL, + OUT EFI_EVENT *Event ); /** @@ -1619,12 +1517,12 @@ CoreCreateEventEx ( EFI_STATUS EFIAPI CoreCreateEventInternal ( - IN UINT32 Type, - IN EFI_TPL NotifyTpl, - IN EFI_EVENT_NOTIFY NotifyFunction, OPTIONAL - IN CONST VOID *NotifyContext, OPTIONAL - IN CONST EFI_GUID *EventGroup, OPTIONAL - OUT EFI_EVENT *Event + IN UINT32 Type, + IN EFI_TPL NotifyTpl, + IN EFI_EVENT_NOTIFY NotifyFunction OPTIONAL, + IN CONST VOID *NotifyContext OPTIONAL, + IN CONST EFI_GUID *EventGroup OPTIONAL, + OUT EFI_EVENT *Event ); /** @@ -1645,13 +1543,11 @@ CoreCreateEventInternal ( EFI_STATUS EFIAPI CoreSetTimer ( - IN EFI_EVENT UserEvent, - IN EFI_TIMER_DELAY Type, - IN UINT64 TriggerTime + IN EFI_EVENT UserEvent, + IN EFI_TIMER_DELAY Type, + IN UINT64 TriggerTime ); - - /** Signals the event. Queues the event to be notified if needed. @@ -1664,11 +1560,9 @@ CoreSetTimer ( EFI_STATUS EFIAPI CoreSignalEvent ( - IN EFI_EVENT UserEvent + IN EFI_EVENT UserEvent ); - - /** Stops execution until an event is signaled. @@ -1686,13 +1580,11 @@ CoreSignalEvent ( EFI_STATUS EFIAPI CoreWaitForEvent ( - IN UINTN NumberOfEvents, - IN EFI_EVENT *UserEvents, - OUT UINTN *UserIndex + IN UINTN NumberOfEvents, + IN EFI_EVENT *UserEvents, + OUT UINTN *UserIndex ); - - /** Closes an event and frees the event structure. @@ -1705,11 +1597,9 @@ CoreWaitForEvent ( EFI_STATUS EFIAPI CoreCloseEvent ( - IN EFI_EVENT UserEvent + IN EFI_EVENT UserEvent ); - - /** Check the status of an event. @@ -1723,10 +1613,9 @@ CoreCloseEvent ( EFI_STATUS EFIAPI CoreCheckEvent ( - IN EFI_EVENT UserEvent + IN EFI_EVENT UserEvent ); - /** Adds reserved memory, system memory, or memory-mapped I/O resources to the global coherency domain of the processor. @@ -1748,7 +1637,6 @@ CoreAddMemorySpace ( IN UINT64 Capabilities ); - /** Allocates nonexistent memory, reserved memory, system memory, or memorymapped I/O resources from the global coherency domain of the processor. @@ -1778,7 +1666,6 @@ CoreAllocateMemorySpace ( IN EFI_HANDLE DeviceHandle OPTIONAL ); - /** Frees nonexistent memory, reserved memory, system memory, or memory-mapped I/O resources from the global coherency domain of the processor. @@ -1796,7 +1683,6 @@ CoreFreeMemorySpace ( IN UINT64 Length ); - /** Removes reserved memory, system memory, or memory-mapped I/O resources from the global coherency domain of the processor. @@ -1814,7 +1700,6 @@ CoreRemoveMemorySpace ( IN UINT64 Length ); - /** Retrieves the descriptor for a memory region containing a specified address. @@ -1832,7 +1717,6 @@ CoreGetMemorySpaceDescriptor ( OUT EFI_GCD_MEMORY_SPACE_DESCRIPTOR *Descriptor ); - /** Modifies the attributes for a memory region in the global coherency domain of the processor. @@ -1842,7 +1726,7 @@ CoreGetMemorySpaceDescriptor ( @param Attributes Specified attributes @retval EFI_SUCCESS The attributes were set for the memory region. - @retval EFI_INVALID_PARAMETER Length is zero. + @retval EFI_INVALID_PARAMETER Length is zero. @retval EFI_UNSUPPORTED The processor does not support one or more bytes of the memory resource range specified by BaseAddress and Length. @retval EFI_UNSUPPORTED The bit mask of attributes is not support for the memory resource @@ -1863,7 +1747,6 @@ CoreSetMemorySpaceAttributes ( IN UINT64 Attributes ); - /** Modifies the capabilities for a memory region in the global coherency domain of the processor. @@ -1889,7 +1772,6 @@ CoreSetMemorySpaceCapabilities ( IN UINT64 Capabilities ); - /** Returns a map of the memory resources in the global coherency domain of the processor. @@ -1909,7 +1791,6 @@ CoreGetMemorySpaceMap ( OUT EFI_GCD_MEMORY_SPACE_DESCRIPTOR **MemorySpaceMap ); - /** Adds reserved I/O or I/O resources to the global coherency domain of the processor. @@ -1929,7 +1810,6 @@ CoreAddIoSpace ( IN UINT64 Length ); - /** Allocates nonexistent I/O, reserved I/O, or I/O resources from the global coherency domain of the processor. @@ -1959,7 +1839,6 @@ CoreAllocateIoSpace ( IN EFI_HANDLE DeviceHandle OPTIONAL ); - /** Frees nonexistent I/O, reserved I/O, or I/O resources from the global coherency domain of the processor. @@ -1977,7 +1856,6 @@ CoreFreeIoSpace ( IN UINT64 Length ); - /** Removes reserved I/O or I/O resources from the global coherency domain of the processor. @@ -1995,7 +1873,6 @@ CoreRemoveIoSpace ( IN UINT64 Length ); - /** Retrieves the descriptor for an I/O region containing a specified address. @@ -2013,7 +1890,6 @@ CoreGetIoSpaceDescriptor ( OUT EFI_GCD_IO_SPACE_DESCRIPTOR *Descriptor ); - /** Returns a map of the I/O resources in the global coherency domain of the processor. @@ -2032,7 +1908,6 @@ CoreGetIoSpaceMap ( OUT EFI_GCD_IO_SPACE_DESCRIPTOR **IoSpaceMap ); - /** This is the main Dispatcher for DXE and it exits when there are no more drivers to run. Drain the mScheduledQueue and load and start a PE @@ -2074,7 +1949,6 @@ CoreSchedule ( IN EFI_GUID *DriverName ); - /** Convert a driver from the Untrused back to the Scheduled state. @@ -2094,7 +1968,6 @@ CoreTrust ( IN EFI_GUID *DriverName ); - /** This routine is the driver initialization entry point. It initializes the libraries, and registers two notification functions. These notification @@ -2109,11 +1982,10 @@ CoreTrust ( EFI_STATUS EFIAPI FwVolDriverInit ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable ); - /** Entry point of the section extraction code. Initializes an instance of the section extraction interface and installs it on a new handle. @@ -2128,11 +2000,10 @@ FwVolDriverInit ( EFI_STATUS EFIAPI InitializeSectionExtraction ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable ); - /** This DXE service routine is used to process a firmware volume. In particular, it can be called by BDS to process a single firmware @@ -2153,13 +2024,13 @@ InitializeSectionExtraction ( EFI_STATUS EFIAPI CoreProcessFirmwareVolume ( - IN VOID *FvHeader, - IN UINTN Size, - OUT EFI_HANDLE *FVProtocolHandle + IN VOID *FvHeader, + IN UINTN Size, + OUT EFI_HANDLE *FVProtocolHandle ); // -//Functions used during debug buils +// Functions used during debug buils // /** @@ -2172,7 +2043,6 @@ CoreDisplayMissingArchProtocols ( VOID ); - /** Traverse the discovered list for any drivers that were discovered but not loaded because the dependency experessions evaluated to false. @@ -2183,21 +2053,6 @@ CoreDisplayDiscoveredNotDispatched ( VOID ); - -/** - Place holder function until all the Boot Services and Runtime Services are - available. - - @return EFI_NOT_AVAILABLE_YET - -**/ -EFI_STATUS -EFIAPI -CoreEfiNotAvailableYetArg0 ( - VOID - ); - - /** Place holder function until all the Boot Services and Runtime Services are available. @@ -2210,10 +2065,9 @@ CoreEfiNotAvailableYetArg0 ( EFI_STATUS EFIAPI CoreEfiNotAvailableYetArg1 ( - UINTN Arg1 + UINTN Arg1 ); - /** Place holder function until all the Boot Services and Runtime Services are available. @@ -2226,11 +2080,10 @@ CoreEfiNotAvailableYetArg1 ( EFI_STATUS EFIAPI CoreEfiNotAvailableYetArg2 ( - UINTN Arg1, - UINTN Arg2 + UINTN Arg1, + UINTN Arg2 ); - /** Place holder function until all the Boot Services and Runtime Services are available. @@ -2244,12 +2097,11 @@ CoreEfiNotAvailableYetArg2 ( EFI_STATUS EFIAPI CoreEfiNotAvailableYetArg3 ( - UINTN Arg1, - UINTN Arg2, - UINTN Arg3 + UINTN Arg1, + UINTN Arg2, + UINTN Arg3 ); - /** Place holder function until all the Boot Services and Runtime Services are available. @@ -2264,13 +2116,12 @@ CoreEfiNotAvailableYetArg3 ( EFI_STATUS EFIAPI CoreEfiNotAvailableYetArg4 ( - UINTN Arg1, - UINTN Arg2, - UINTN Arg3, - UINTN Arg4 + UINTN Arg1, + UINTN Arg2, + UINTN Arg3, + UINTN Arg4 ); - /** Place holder function until all the Boot Services and Runtime Services are available. @@ -2286,14 +2137,13 @@ CoreEfiNotAvailableYetArg4 ( EFI_STATUS EFIAPI CoreEfiNotAvailableYetArg5 ( - UINTN Arg1, - UINTN Arg2, - UINTN Arg3, - UINTN Arg4, - UINTN Arg5 + UINTN Arg1, + UINTN Arg2, + UINTN Arg3, + UINTN Arg4, + UINTN Arg5 ); - /** Given a compressed source buffer, this function retrieves the size of the uncompressed buffer and the size of the scratch buffer required to decompress @@ -2336,14 +2186,13 @@ CoreEfiNotAvailableYetArg5 ( EFI_STATUS EFIAPI DxeMainUefiDecompressGetInfo ( - IN EFI_DECOMPRESS_PROTOCOL *This, - IN VOID *Source, - IN UINT32 SourceSize, - OUT UINT32 *DestinationSize, - OUT UINT32 *ScratchSize + IN EFI_DECOMPRESS_PROTOCOL *This, + IN VOID *Source, + IN UINT32 SourceSize, + OUT UINT32 *DestinationSize, + OUT UINT32 *ScratchSize ); - /** Decompresses a compressed source buffer. @@ -2381,13 +2230,13 @@ DxeMainUefiDecompressGetInfo ( EFI_STATUS EFIAPI DxeMainUefiDecompress ( - IN EFI_DECOMPRESS_PROTOCOL *This, - IN VOID *Source, - IN UINT32 SourceSize, - IN OUT VOID *Destination, - IN UINT32 DestinationSize, - IN OUT VOID *Scratch, - IN UINT32 ScratchSize + IN EFI_DECOMPRESS_PROTOCOL *This, + IN VOID *Source, + IN UINT32 SourceSize, + IN OUT VOID *Destination, + IN UINT32 DestinationSize, + IN OUT VOID *Scratch, + IN UINT32 ScratchSize ); /** @@ -2408,13 +2257,11 @@ DxeMainUefiDecompress ( EFI_STATUS EFIAPI OpenSectionStream ( - IN UINTN SectionStreamLength, - IN VOID *SectionStream, - OUT UINTN *SectionStreamHandle + IN UINTN SectionStreamLength, + IN VOID *SectionStream, + OUT UINTN *SectionStreamHandle ); - - /** SEP member function. Retrieves requested section from section stream. @@ -2430,7 +2277,7 @@ OpenSectionStream ( non-null on input, then the buffer is caller allocated. If Buffer is NULL, then the buffer is callee allocated. In either case, the - requried buffer size is returned in *BufferSize. + required buffer size is returned in *BufferSize. @param BufferSize On input, indicates the size of *Buffer if *Buffer is non-null on input. On output, indicates the required size (allocated size if @@ -2476,17 +2323,16 @@ OpenSectionStream ( EFI_STATUS EFIAPI GetSection ( - IN UINTN SectionStreamHandle, - IN EFI_SECTION_TYPE *SectionType, - IN EFI_GUID *SectionDefinitionGuid, - IN UINTN SectionInstance, - IN VOID **Buffer, - IN OUT UINTN *BufferSize, - OUT UINT32 *AuthenticationStatus, - IN BOOLEAN IsFfs3Fv + IN UINTN SectionStreamHandle, + IN EFI_SECTION_TYPE *SectionType, + IN EFI_GUID *SectionDefinitionGuid, + IN UINTN SectionInstance, + IN VOID **Buffer, + IN OUT UINTN *BufferSize, + OUT UINT32 *AuthenticationStatus, + IN BOOLEAN IsFfs3Fv ); - /** SEP member function. Deletes an existing section stream @@ -2503,8 +2349,8 @@ GetSection ( EFI_STATUS EFIAPI CloseSectionStream ( - IN UINTN StreamHandleToClose, - IN BOOLEAN FreeStreamBuffer + IN UINTN StreamHandleToClose, + IN BOOLEAN FreeStreamBuffer ); /** @@ -2523,7 +2369,6 @@ CoreInitializeDebugImageInfoTable ( VOID ); - /** Update the CRC32 in the Debug Table. Since the CRC32 service is made available by the Runtime driver, we have to @@ -2537,7 +2382,6 @@ CoreUpdateDebugTableCrc32 ( VOID ); - /** Adds a new DebugImageInfo structure to the DebugImageInfo Table. Re-Allocates the table if it's not large enough to accomidate another entry. @@ -2550,12 +2394,11 @@ CoreUpdateDebugTableCrc32 ( **/ VOID CoreNewDebugImageInfoEntry ( - IN UINT32 ImageInfoType, - IN EFI_LOADED_IMAGE_PROTOCOL *LoadedImage, - IN EFI_HANDLE ImageHandle + IN UINT32 ImageInfoType, + IN EFI_LOADED_IMAGE_PROTOCOL *LoadedImage, + IN EFI_HANDLE ImageHandle ); - /** Removes and frees an entry from the DebugImageInfo Table. @@ -2564,10 +2407,9 @@ CoreNewDebugImageInfoEntry ( **/ VOID CoreRemoveDebugImageInfoEntry ( - EFI_HANDLE ImageHandle + EFI_HANDLE ImageHandle ); - /** This routine consumes FV hobs and produces instances of FW_VOL_BLOCK_PROTOCOL as appropriate. @@ -2581,8 +2423,8 @@ CoreRemoveDebugImageInfoEntry ( EFI_STATUS EFIAPI FwVolBlockDriverInit ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable ); /** @@ -2596,7 +2438,7 @@ FwVolBlockDriverInit ( **/ UINT32 GetFvbAuthenticationStatus ( - IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *FvbProtocol + IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *FvbProtocol ); /** @@ -2620,14 +2462,13 @@ GetFvbAuthenticationStatus ( **/ EFI_STATUS ProduceFVBProtocolOnBuffer ( - IN EFI_PHYSICAL_ADDRESS BaseAddress, - IN UINT64 Length, - IN EFI_HANDLE ParentHandle, - IN UINT32 AuthenticationStatus, - OUT EFI_HANDLE *FvProtocol OPTIONAL + IN EFI_PHYSICAL_ADDRESS BaseAddress, + IN UINT64 Length, + IN EFI_HANDLE ParentHandle, + IN UINT32 AuthenticationStatus, + OUT EFI_HANDLE *FvProtocol OPTIONAL ); - /** Raising to the task priority level of the mutual exclusion lock, and then acquires ownership of the lock. @@ -2642,7 +2483,6 @@ CoreAcquireLock ( IN EFI_LOCK *Lock ); - /** Initialize a basic mutual exclusion lock. Each lock provides mutual exclusion access at it's task priority @@ -2661,7 +2501,6 @@ CoreAcquireLockOrFail ( IN EFI_LOCK *Lock ); - /** Releases ownership of the mutual exclusion lock, and restores the previous task priority level. @@ -2676,24 +2515,8 @@ CoreReleaseLock ( IN EFI_LOCK *Lock ); - -/** - An empty function to pass error checking of CreateEventEx (). - - @param Event Event whose notification function is being invoked. - @param Context Pointer to the notification function's context, - which is implementation-dependent. - -**/ -VOID -EFIAPI -CoreEmptyCallbackFunction ( - IN EFI_EVENT Event, - IN VOID *Context - ); - /** - Read data from Firmware Block by FVB protocol Read. + Read data from Firmware Block by FVB protocol Read. The data may cross the multi block ranges. @param Fvb The FW_VOL_BLOCK_PROTOCOL instance from which to read data. @@ -2711,11 +2534,11 @@ CoreEmptyCallbackFunction ( **/ EFI_STATUS ReadFvbData ( - IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *Fvb, - IN OUT EFI_LBA *StartLba, - IN OUT UINTN *Offset, - IN UINTN DataSize, - OUT UINT8 *Data + IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *Fvb, + IN OUT EFI_LBA *StartLba, + IN OUT UINTN *Offset, + IN UINTN DataSize, + OUT UINT8 *Data ); /** @@ -2736,8 +2559,8 @@ ReadFvbData ( **/ EFI_STATUS GetFwVolHeader ( - IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *Fvb, - OUT EFI_FIRMWARE_VOLUME_HEADER **FwVolHeader + IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *Fvb, + OUT EFI_FIRMWARE_VOLUME_HEADER **FwVolHeader ); /** @@ -2751,7 +2574,7 @@ GetFwVolHeader ( **/ BOOLEAN VerifyFvHeaderChecksum ( - IN EFI_FIRMWARE_VOLUME_HEADER *FvHeader + IN EFI_FIRMWARE_VOLUME_HEADER *FvHeader ); /** @@ -2762,7 +2585,7 @@ VerifyFvHeaderChecksum ( **/ VOID MemoryProfileInit ( - IN VOID *HobStart + IN VOID *HobStart ); /** @@ -2780,11 +2603,13 @@ MemoryProfileInstallProtocol ( @param DriverEntry Image info. @param FileType Image file type. - @retval TRUE Register success. - @retval FALSE Register fail. + @return EFI_SUCCESS Register successfully. + @return EFI_UNSUPPORTED Memory profile unsupported, + or memory profile for the image is not required. + @return EFI_OUT_OF_RESOURCES No enough resource for this register. **/ -BOOLEAN +EFI_STATUS RegisterMemoryProfileImage ( IN LOADED_IMAGE_PRIVATE_DATA *DriverEntry, IN EFI_FV_FILETYPE FileType @@ -2795,11 +2620,13 @@ RegisterMemoryProfileImage ( @param DriverEntry Image info. - @retval TRUE Unregister success. - @retval FALSE Unregister fail. + @return EFI_SUCCESS Unregister successfully. + @return EFI_UNSUPPORTED Memory profile unsupported, + or memory profile for the image is not required. + @return EFI_NOT_FOUND The image is not found. **/ -BOOLEAN +EFI_STATUS UnregisterMemoryProfileImage ( IN LOADED_IMAGE_PRIVATE_DATA *DriverEntry ); @@ -2810,20 +2637,31 @@ UnregisterMemoryProfileImage ( @param CallerAddress Address of caller who call Allocate or Free. @param Action This Allocate or Free action. @param MemoryType Memory type. + EfiMaxMemoryType means the MemoryType is unknown. @param Size Buffer size. @param Buffer Buffer address. + @param ActionString String for memory profile action. + Only needed for user defined allocate action. - @retval TRUE Profile udpate success. - @retval FALSE Profile update fail. + @return EFI_SUCCESS Memory profile is updated. + @return EFI_UNSUPPORTED Memory profile is unsupported, + or memory profile for the image is not required, + or memory profile for the memory type is not required. + @return EFI_ACCESS_DENIED It is during memory profile data getting. + @return EFI_ABORTED Memory profile recording is not enabled. + @return EFI_OUT_OF_RESOURCES No enough resource to update memory profile for allocate action. + @return EFI_NOT_FOUND No matched allocate info found for free action. **/ -BOOLEAN +EFI_STATUS +EFIAPI CoreUpdateProfile ( IN EFI_PHYSICAL_ADDRESS CallerAddress, IN MEMORY_PROFILE_ACTION Action, IN EFI_MEMORY_TYPE MemoryType, IN UINTN Size, // Valid for AllocatePages/FreePages/AllocatePool - IN VOID *Buffer + IN VOID *Buffer, + IN CHAR8 *ActionString OPTIONAL ); /** @@ -2843,20 +2681,20 @@ CoreUpdateMemoryAttributes ( ); /** - Initialize PropertiesTable support. + Initialize MemoryAttrubutesTable support. **/ VOID EFIAPI -CoreInitializePropertiesTable ( +CoreInitializeMemoryAttributesTable ( VOID ); /** - Initialize MemoryAttrubutesTable support. + Initialize Memory Protection support. **/ VOID EFIAPI -CoreInitializeMemoryAttributesTable ( +CoreInitializeMemoryProtection ( VOID ); @@ -2867,7 +2705,7 @@ CoreInitializeMemoryAttributesTable ( **/ VOID InstallMemoryAttributesTableOnMemoryAllocation ( - IN EFI_MEMORY_TYPE MemoryType + IN EFI_MEMORY_TYPE MemoryType ); /** @@ -2890,4 +2728,78 @@ RemoveImageRecord ( IN EFI_RUNTIME_IMAGE_ENTRY *RuntimeImage ); +/** + Protect UEFI image. + + @param[in] LoadedImage The loaded image protocol + @param[in] LoadedImageDevicePath The loaded image device path protocol +**/ +VOID +ProtectUefiImage ( + IN EFI_LOADED_IMAGE_PROTOCOL *LoadedImage, + IN EFI_DEVICE_PATH_PROTOCOL *LoadedImageDevicePath + ); + +/** + Unprotect UEFI image. + + @param[in] LoadedImage The loaded image protocol + @param[in] LoadedImageDevicePath The loaded image device path protocol +**/ +VOID +UnprotectUefiImage ( + IN EFI_LOADED_IMAGE_PROTOCOL *LoadedImage, + IN EFI_DEVICE_PATH_PROTOCOL *LoadedImageDevicePath + ); + +/** + ExitBootServices Callback function for memory protection. +**/ +VOID +MemoryProtectionExitBootServicesCallback ( + VOID + ); + +/** + Manage memory permission attributes on a memory range, according to the + configured DXE memory protection policy. + + @param OldType The old memory type of the range + @param NewType The new memory type of the range + @param Memory The base address of the range + @param Length The size of the range (in bytes) + + @return EFI_SUCCESS If the the CPU arch protocol is not installed yet + @return EFI_SUCCESS If no DXE memory protection policy has been configured + @return EFI_SUCCESS If OldType and NewType use the same permission attributes + @return other Return value of gCpu->SetMemoryAttributes() + +**/ +EFI_STATUS +EFIAPI +ApplyMemoryProtectionPolicy ( + IN EFI_MEMORY_TYPE OldType, + IN EFI_MEMORY_TYPE NewType, + IN EFI_PHYSICAL_ADDRESS Memory, + IN UINT64 Length + ); + +/** + Merge continous memory map entries whose have same attributes. + + @param MemoryMap A pointer to the buffer in which firmware places + the current memory map. + @param MemoryMapSize A pointer to the size, in bytes, of the + MemoryMap buffer. On input, this is the size of + the current memory map. On output, + it is the size of new memory map after merge. + @param DescriptorSize Size, in bytes, of an individual EFI_MEMORY_DESCRIPTOR. +**/ +VOID +MergeMemoryMap ( + IN OUT EFI_MEMORY_DESCRIPTOR *MemoryMap, + IN OUT UINTN *MemoryMapSize, + IN UINTN DescriptorSize + ); + #endif