TianoCore EDK2 master
Loading...
Searching...
No Matches
MemoryProfileRecord.c File Reference
#include "DxeMain.h"
#include "Imem.h"

Go to the source code of this file.

Data Structures

struct  MEMORY_PROFILE_CONTEXT_DATA
 
struct  MEMORY_PROFILE_DRIVER_INFO_DATA
 
struct  MEMORY_PROFILE_ALLOC_INFO_DATA
 

Macros

#define IS_UEFI_MEMORY_PROFILE_ENABLED   ((PcdGet8 (PcdMemoryProfilePropertyMask) & BIT0) != 0)
 
#define GET_OCCUPIED_SIZE(ActualSize, Alignment)    ((ActualSize) + (((Alignment) - ((ActualSize) & ((Alignment) - 1))) & ((Alignment) - 1)))
 

Functions

EFI_STATUS EFIAPI ProfileProtocolGetData (IN EDKII_MEMORY_PROFILE_PROTOCOL *This, IN OUT UINT64 *ProfileSize, OUT VOID *ProfileBuffer)
 
EFI_STATUS EFIAPI ProfileProtocolRegisterImage (IN EDKII_MEMORY_PROFILE_PROTOCOL *This, IN EFI_DEVICE_PATH_PROTOCOL *FilePath, IN PHYSICAL_ADDRESS ImageBase, IN UINT64 ImageSize, IN EFI_FV_FILETYPE FileType)
 
EFI_STATUS EFIAPI ProfileProtocolUnregisterImage (IN EDKII_MEMORY_PROFILE_PROTOCOL *This, IN EFI_DEVICE_PATH_PROTOCOL *FilePath, IN PHYSICAL_ADDRESS ImageBase, IN UINT64 ImageSize)
 
EFI_STATUS EFIAPI ProfileProtocolGetRecordingState (IN EDKII_MEMORY_PROFILE_PROTOCOL *This, OUT BOOLEAN *RecordingState)
 
EFI_STATUS EFIAPI ProfileProtocolSetRecordingState (IN EDKII_MEMORY_PROFILE_PROTOCOL *This, IN BOOLEAN RecordingState)
 
EFI_STATUS EFIAPI ProfileProtocolRecord (IN EDKII_MEMORY_PROFILE_PROTOCOL *This, IN PHYSICAL_ADDRESS CallerAddress, IN MEMORY_PROFILE_ACTION Action, IN EFI_MEMORY_TYPE MemoryType, IN VOID *Buffer, IN UINTN Size, IN CHAR8 *ActionString OPTIONAL)
 
VOID CoreAcquireMemoryProfileLock (VOID)
 
VOID CoreReleaseMemoryProfileLock (VOID)
 
MEMORY_PROFILE_CONTEXT_DATAGetMemoryProfileContext (VOID)
 
UINT16 InternalPeCoffGetSubsystem (IN VOID *Pe32Data)
 
RETURN_STATUS InternalPeCoffGetEntryPoint (IN VOID *Pe32Data, OUT VOID **EntryPoint)
 
MEMORY_PROFILE_DRIVER_INFO_DATABuildDriverInfo (IN MEMORY_PROFILE_CONTEXT_DATA *ContextData, IN EFI_GUID *FileName, IN PHYSICAL_ADDRESS ImageBase, IN UINT64 ImageSize, IN PHYSICAL_ADDRESS EntryPoint, IN UINT16 ImageSubsystem, IN EFI_FV_FILETYPE FileType)
 
BOOLEAN NeedRecordThisDriver (IN EFI_DEVICE_PATH_PROTOCOL *DriverFilePath)
 
BOOLEAN RegisterDxeCore (IN VOID *HobStart, IN MEMORY_PROFILE_CONTEXT_DATA *ContextData)
 
VOID MemoryProfileInit (IN VOID *HobStart)
 
VOID MemoryProfileInstallProtocol (VOID)
 
EFI_GUIDGetFileNameFromFilePath (IN EFI_DEVICE_PATH_PROTOCOL *FilePath)
 
EFI_STATUS RegisterMemoryProfileImage (IN LOADED_IMAGE_PRIVATE_DATA *DriverEntry, IN EFI_FV_FILETYPE FileType)
 
MEMORY_PROFILE_DRIVER_INFO_DATAGetMemoryProfileDriverInfoByFileNameAndAddress (IN MEMORY_PROFILE_CONTEXT_DATA *ContextData, IN EFI_GUID *FileName, IN PHYSICAL_ADDRESS Address)
 
MEMORY_PROFILE_DRIVER_INFO_DATAGetMemoryProfileDriverInfoFromAddress (IN MEMORY_PROFILE_CONTEXT_DATA *ContextData, IN PHYSICAL_ADDRESS Address)
 
EFI_STATUS UnregisterMemoryProfileImage (IN LOADED_IMAGE_PRIVATE_DATA *DriverEntry)
 
BOOLEAN CoreNeedRecordProfile (IN EFI_MEMORY_TYPE MemoryType)
 
UINTN GetProfileMemoryIndex (IN EFI_MEMORY_TYPE MemoryType)
 
EFI_STATUS CoreUpdateProfileAllocate (IN PHYSICAL_ADDRESS CallerAddress, IN MEMORY_PROFILE_ACTION Action, IN EFI_MEMORY_TYPE MemoryType, IN UINTN Size, IN VOID *Buffer, IN CHAR8 *ActionString OPTIONAL)
 
MEMORY_PROFILE_ALLOC_INFO_DATAGetMemoryProfileAllocInfoFromAddress (IN MEMORY_PROFILE_DRIVER_INFO_DATA *DriverInfoData, IN MEMORY_PROFILE_ACTION BasicAction, IN UINTN Size, IN VOID *Buffer)
 
EFI_STATUS CoreUpdateProfileFree (IN PHYSICAL_ADDRESS CallerAddress, IN MEMORY_PROFILE_ACTION Action, IN UINTN Size, IN VOID *Buffer)
 
EFI_STATUS EFIAPI CoreUpdateProfile (IN PHYSICAL_ADDRESS CallerAddress, IN MEMORY_PROFILE_ACTION Action, IN EFI_MEMORY_TYPE MemoryType, IN UINTN Size, IN VOID *Buffer, IN CHAR8 *ActionString OPTIONAL)
 
UINTN MemoryProfileGetDataSize (VOID)
 
VOID MemoryProfileCopyData (IN VOID *ProfileBuffer)
 

Variables

GLOBAL_REMOVE_IF_UNREFERENCED LIST_ENTRY mImageQueue = INITIALIZE_LIST_HEAD_VARIABLE (mImageQueue)
 
GLOBAL_REMOVE_IF_UNREFERENCED MEMORY_PROFILE_CONTEXT_DATA mMemoryProfileContext
 
GLOBAL_REMOVE_IF_UNREFERENCED MEMORY_PROFILE_CONTEXT_DATAmMemoryProfileContextPtr = NULL
 
GLOBAL_REMOVE_IF_UNREFERENCED EFI_LOCK mMemoryProfileLock = EFI_INITIALIZE_LOCK_VARIABLE (TPL_NOTIFY)
 
GLOBAL_REMOVE_IF_UNREFERENCED BOOLEAN mMemoryProfileGettingStatus = FALSE
 
GLOBAL_REMOVE_IF_UNREFERENCED BOOLEAN mMemoryProfileRecordingEnable = MEMORY_PROFILE_RECORDING_DISABLE
 
GLOBAL_REMOVE_IF_UNREFERENCED EFI_DEVICE_PATH_PROTOCOLmMemoryProfileDriverPath
 
GLOBAL_REMOVE_IF_UNREFERENCED UINTN mMemoryProfileDriverPathSize
 
GLOBAL_REMOVE_IF_UNREFERENCED EDKII_MEMORY_PROFILE_PROTOCOL mProfileProtocol
 

Detailed Description

Support routines for UEFI memory profile.

Copyright (c) 2014 - 2018, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file MemoryProfileRecord.c.

Macro Definition Documentation

◆ GET_OCCUPIED_SIZE

#define GET_OCCUPIED_SIZE (   ActualSize,
  Alignment 
)     ((ActualSize) + (((Alignment) - ((ActualSize) & ((Alignment) - 1))) & ((Alignment) - 1)))

Definition at line 14 of file MemoryProfileRecord.c.

◆ IS_UEFI_MEMORY_PROFILE_ENABLED

#define IS_UEFI_MEMORY_PROFILE_ENABLED   ((PcdGet8 (PcdMemoryProfilePropertyMask) & BIT0) != 0)

Definition at line 12 of file MemoryProfileRecord.c.

Function Documentation

◆ BuildDriverInfo()

MEMORY_PROFILE_DRIVER_INFO_DATA * BuildDriverInfo ( IN MEMORY_PROFILE_CONTEXT_DATA ContextData,
IN EFI_GUID FileName,
IN PHYSICAL_ADDRESS  ImageBase,
IN UINT64  ImageSize,
IN PHYSICAL_ADDRESS  EntryPoint,
IN UINT16  ImageSubsystem,
IN EFI_FV_FILETYPE  FileType 
)

Build driver info.

Parameters
ContextDataMemory profile context.
FileNameFile name of the image.
ImageBaseImage base address.
ImageSizeImage size.
EntryPointEntry point of the image.
ImageSubsystemImage subsystem of the image.
FileTypeFile type of the image.
Returns
Pointer to memory profile driver info.

Definition at line 369 of file MemoryProfileRecord.c.

◆ CoreAcquireMemoryProfileLock()

VOID CoreAcquireMemoryProfileLock ( VOID  )

Acquire lock on mMemoryProfileLock.

Definition at line 218 of file MemoryProfileRecord.c.

◆ CoreNeedRecordProfile()

BOOLEAN CoreNeedRecordProfile ( IN EFI_MEMORY_TYPE  MemoryType)

Return if this memory type needs to be recorded into memory profile. If BIOS memory type (0 ~ EfiMaxMemoryType - 1), it checks bit (1 << MemoryType). If OS memory type (0x80000000 ~ 0xFFFFFFFF), it checks bit63 - 0x8000000000000000. If OEM memory type (0x70000000 ~ 0x7FFFFFFF), it checks bit62 - 0x4000000000000000.

Parameters
MemoryTypeMemory type.
Return values
TRUEThis memory type need to be recorded.
FALSEThis memory type need not to be recorded.

Definition at line 913 of file MemoryProfileRecord.c.

◆ CoreReleaseMemoryProfileLock()

VOID CoreReleaseMemoryProfileLock ( VOID  )

Release lock on mMemoryProfileLock.

Definition at line 229 of file MemoryProfileRecord.c.

◆ CoreUpdateProfile()

EFI_STATUS EFIAPI CoreUpdateProfile ( IN PHYSICAL_ADDRESS  CallerAddress,
IN MEMORY_PROFILE_ACTION  Action,
IN EFI_MEMORY_TYPE  MemoryType,
IN UINTN  Size,
IN VOID *  Buffer,
IN CHAR8 *ActionString  OPTIONAL 
)

Update memory profile information.

Parameters
CallerAddressAddress of caller who call Allocate or Free.
ActionThis Allocate or Free action.
MemoryTypeMemory type. EfiMaxMemoryType means the MemoryType is unknown.
SizeBuffer size.
BufferBuffer address.
ActionStringString for memory profile action. Only needed for user defined allocate action.
Returns
EFI_SUCCESS Memory profile is updated.
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.
EFI_ACCESS_DENIED It is during memory profile data getting.
EFI_ABORTED Memory profile recording is not enabled.
EFI_OUT_OF_RESOURCES No enough resource to update memory profile for allocate action.
EFI_NOT_FOUND No matched allocate info found for free action.

Definition at line 1357 of file MemoryProfileRecord.c.

◆ CoreUpdateProfileAllocate()

EFI_STATUS CoreUpdateProfileAllocate ( IN PHYSICAL_ADDRESS  CallerAddress,
IN MEMORY_PROFILE_ACTION  Action,
IN EFI_MEMORY_TYPE  MemoryType,
IN UINTN  Size,
IN VOID *  Buffer,
IN CHAR8 *ActionString  OPTIONAL 
)

Update memory profile Allocate information.

Parameters
CallerAddressAddress of caller who call Allocate.
ActionThis Allocate action.
MemoryTypeMemory type.
SizeBuffer size.
BufferBuffer address.
ActionStringString for memory profile action.
Returns
EFI_SUCCESS Memory profile is updated.
EFI_UNSUPPORTED Memory profile is unsupported, or memory profile for the image is not required.
EFI_OUT_OF_RESOURCES No enough resource to update memory profile for allocate action.

Definition at line 976 of file MemoryProfileRecord.c.

◆ CoreUpdateProfileFree()

EFI_STATUS CoreUpdateProfileFree ( IN PHYSICAL_ADDRESS  CallerAddress,
IN MEMORY_PROFILE_ACTION  Action,
IN UINTN  Size,
IN VOID *  Buffer 
)

Update memory profile Free information.

Parameters
CallerAddressAddress of caller who call Free.
ActionThis Free action.
SizeBuffer size.
BufferBuffer address.
Returns
EFI_SUCCESS Memory profile is updated.
EFI_UNSUPPORTED Memory profile is unsupported.
EFI_NOT_FOUND No matched allocate info found for free action.

Definition at line 1173 of file MemoryProfileRecord.c.

◆ GetFileNameFromFilePath()

EFI_GUID * GetFileNameFromFilePath ( IN EFI_DEVICE_PATH_PROTOCOL FilePath)

Get the GUID file name from the file path.

Parameters
FilePathFile path.
Returns
The GUID file name from the file path.

Definition at line 658 of file MemoryProfileRecord.c.

◆ GetMemoryProfileAllocInfoFromAddress()

MEMORY_PROFILE_ALLOC_INFO_DATA * GetMemoryProfileAllocInfoFromAddress ( IN MEMORY_PROFILE_DRIVER_INFO_DATA DriverInfoData,
IN MEMORY_PROFILE_ACTION  BasicAction,
IN UINTN  Size,
IN VOID *  Buffer 
)

Get memory profile alloc info from memory profile.

Parameters
DriverInfoDataDriver info.
BasicActionThis Free basic action.
SizeBuffer size.
BufferBuffer address.
Returns
Pointer to memory profile alloc info.

Definition at line 1106 of file MemoryProfileRecord.c.

◆ GetMemoryProfileContext()

MEMORY_PROFILE_CONTEXT_DATA * GetMemoryProfileContext ( VOID  )

Return memory profile context.

Returns
Memory profile context.

Definition at line 243 of file MemoryProfileRecord.c.

◆ GetMemoryProfileDriverInfoByFileNameAndAddress()

MEMORY_PROFILE_DRIVER_INFO_DATA * GetMemoryProfileDriverInfoByFileNameAndAddress ( IN MEMORY_PROFILE_CONTEXT_DATA ContextData,
IN EFI_GUID FileName,
IN PHYSICAL_ADDRESS  Address 
)

Search image from memory profile.

Parameters
ContextDataMemory profile context.
FileNameImage file name.
AddressImage Address.
Returns
Pointer to memory profile driver info.

Definition at line 742 of file MemoryProfileRecord.c.

◆ GetMemoryProfileDriverInfoFromAddress()

MEMORY_PROFILE_DRIVER_INFO_DATA * GetMemoryProfileDriverInfoFromAddress ( IN MEMORY_PROFILE_CONTEXT_DATA ContextData,
IN PHYSICAL_ADDRESS  Address 
)

Search image from memory profile. It will return image, if (Address >= ImageBuffer) AND (Address < ImageBuffer + ImageSize).

Parameters
ContextDataMemory profile context.
AddressImage or Function address.
Returns
Pointer to memory profile driver info.

Definition at line 788 of file MemoryProfileRecord.c.

◆ GetProfileMemoryIndex()

UINTN GetProfileMemoryIndex ( IN EFI_MEMORY_TYPE  MemoryType)

Convert EFI memory type to profile memory index. The rule is: If BIOS memory type (0 ~ EfiMaxMemoryType - 1), ProfileMemoryIndex = MemoryType. If OS memory type (0x80000000 ~ 0xFFFFFFFF), ProfileMemoryIndex = EfiMaxMemoryType. If OEM memory type (0x70000000 ~ 0x7FFFFFFF), ProfileMemoryIndex = EfiMaxMemoryType + 1.

Parameters
MemoryTypeMemory type.
Returns
Profile memory index.

Definition at line 946 of file MemoryProfileRecord.c.

◆ InternalPeCoffGetEntryPoint()

RETURN_STATUS InternalPeCoffGetEntryPoint ( IN VOID *  Pe32Data,
OUT VOID **  EntryPoint 
)

Retrieves and returns a pointer to the entry point to a PE/COFF image that has been loaded into system memory with the PE/COFF Loader Library functions.

Retrieves the entry point to the PE/COFF image specified by Pe32Data and returns this entry point in EntryPoint. If the entry point could not be retrieved from the PE/COFF image, then return RETURN_INVALID_PARAMETER. Otherwise return RETURN_SUCCESS. If Pe32Data is NULL, then ASSERT(). If EntryPoint is NULL, then ASSERT().

Parameters
Pe32DataThe pointer to the PE/COFF image that is loaded in system memory.
EntryPointThe pointer to entry point to the PE/COFF image to return.
Return values
RETURN_SUCCESSEntryPoint was returned.
RETURN_INVALID_PARAMETERThe entry point could not be found in the PE/COFF image.

Definition at line 315 of file MemoryProfileRecord.c.

◆ InternalPeCoffGetSubsystem()

UINT16 InternalPeCoffGetSubsystem ( IN VOID *  Pe32Data)

Retrieves and returns the Subsystem of a PE/COFF image that has been loaded into system memory. If Pe32Data is NULL, then ASSERT().

Parameters
Pe32DataThe pointer to the PE/COFF image that is loaded in system memory.
Returns
The Subsystem of the PE/COFF image.

Definition at line 260 of file MemoryProfileRecord.c.

◆ MemoryProfileCopyData()

VOID MemoryProfileCopyData ( IN VOID *  ProfileBuffer)

Copy memory profile data.

Parameters
ProfileBufferThe buffer to hold memory profile data.

Definition at line 1496 of file MemoryProfileRecord.c.

◆ MemoryProfileGetDataSize()

UINTN MemoryProfileGetDataSize ( VOID  )

Get memory profile data size.

Returns
Memory profile data size.

Definition at line 1438 of file MemoryProfileRecord.c.

◆ MemoryProfileInit()

VOID MemoryProfileInit ( IN VOID *  HobStart)

Initialize memory profile.

Parameters
HobStartThe start address of the HOB.

Definition at line 592 of file MemoryProfileRecord.c.

◆ MemoryProfileInstallProtocol()

VOID MemoryProfileInstallProtocol ( VOID  )

Install memory profile protocol.

Definition at line 628 of file MemoryProfileRecord.c.

◆ NeedRecordThisDriver()

BOOLEAN NeedRecordThisDriver ( IN EFI_DEVICE_PATH_PROTOCOL DriverFilePath)

Return if record for this driver is needed..

Parameters
DriverFilePathDriver file path.
Return values
TRUERecord for this driver is needed.
FALSERecord for this driver is not needed.

Definition at line 469 of file MemoryProfileRecord.c.

◆ ProfileProtocolGetData()

EFI_STATUS EFIAPI ProfileProtocolGetData ( IN EDKII_MEMORY_PROFILE_PROTOCOL This,
IN OUT UINT64 *  ProfileSize,
OUT VOID *  ProfileBuffer 
)

Get memory profile data.

Parameters
[in]ThisThe EDKII_MEMORY_PROFILE_PROTOCOL instance.
[in,out]ProfileSizeOn entry, points to the size in bytes of the ProfileBuffer. On return, points to the size of the data returned in ProfileBuffer.
[out]ProfileBufferProfile buffer.
Returns
EFI_SUCCESS Get the memory profile data successfully.
EFI_UNSUPPORTED Memory profile is unsupported.
EFI_BUFFER_TO_SMALL The ProfileSize is too small for the resulting data. ProfileSize is updated with the size required.

Definition at line 1581 of file MemoryProfileRecord.c.

◆ ProfileProtocolGetRecordingState()

EFI_STATUS EFIAPI ProfileProtocolGetRecordingState ( IN EDKII_MEMORY_PROFILE_PROTOCOL This,
OUT BOOLEAN *  RecordingState 
)

Get memory profile recording state.

Parameters
[in]ThisThe EDKII_MEMORY_PROFILE_PROTOCOL instance.
[out]RecordingStateRecording state.
Returns
EFI_SUCCESS Memory profile recording state is returned.
EFI_UNSUPPORTED Memory profile is unsupported.
EFI_INVALID_PARAMETER RecordingState is NULL.

Definition at line 1706 of file MemoryProfileRecord.c.

◆ ProfileProtocolRecord()

EFI_STATUS EFIAPI ProfileProtocolRecord ( IN EDKII_MEMORY_PROFILE_PROTOCOL This,
IN PHYSICAL_ADDRESS  CallerAddress,
IN MEMORY_PROFILE_ACTION  Action,
IN EFI_MEMORY_TYPE  MemoryType,
IN VOID *  Buffer,
IN UINTN  Size,
IN CHAR8 *ActionString  OPTIONAL 
)

Record memory profile of multilevel caller.

Parameters
[in]ThisThe EDKII_MEMORY_PROFILE_PROTOCOL instance.
[in]CallerAddressAddress of caller.
[in]ActionMemory profile action.
[in]MemoryTypeMemory type. EfiMaxMemoryType means the MemoryType is unknown.
[in]BufferBuffer address.
[in]SizeBuffer size.
[in]ActionStringString for memory profile action. Only needed for user defined allocate action.
Returns
EFI_SUCCESS Memory profile is updated.
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.
EFI_ACCESS_DENIED It is during memory profile data getting.
EFI_ABORTED Memory profile recording is not enabled.
EFI_OUT_OF_RESOURCES No enough resource to update memory profile for allocate action.
EFI_NOT_FOUND No matched allocate info found for free action.

Definition at line 1779 of file MemoryProfileRecord.c.

◆ ProfileProtocolRegisterImage()

EFI_STATUS EFIAPI ProfileProtocolRegisterImage ( IN EDKII_MEMORY_PROFILE_PROTOCOL This,
IN EFI_DEVICE_PATH_PROTOCOL FilePath,
IN PHYSICAL_ADDRESS  ImageBase,
IN UINT64  ImageSize,
IN EFI_FV_FILETYPE  FileType 
)

Register image to memory profile.

Parameters
[in]ThisThe EDKII_MEMORY_PROFILE_PROTOCOL instance.
[in]FilePathFile path of the image.
[in]ImageBaseImage base address.
[in]ImageSizeImage size.
[in]FileTypeFile type of the image.
Returns
EFI_SUCCESS Register successfully.
EFI_UNSUPPORTED Memory profile is unsupported, or memory profile for the image is not required.
EFI_OUT_OF_RESOURCE No enough resource for this register.

Register image to memory profile.

Parameters
[in]ThisThe EDKII_MEMORY_PROFILE_PROTOCOL instance.
[in]FilePathFile path of the image.
[in]ImageBaseImage base address.
[in]ImageSizeImage size.
[in]FileTypeFile type of the image.
Returns
EFI_SUCCESS Register successfully.
EFI_UNSUPPORTED Memory profile is unsupported, or memory profile for the image is not required.
EFI_OUT_OF_RESOURCES No enough resource for this register.

Definition at line 1631 of file MemoryProfileRecord.c.

◆ ProfileProtocolSetRecordingState()

EFI_STATUS EFIAPI ProfileProtocolSetRecordingState ( IN EDKII_MEMORY_PROFILE_PROTOCOL This,
IN BOOLEAN  RecordingState 
)

Set memory profile recording state.

Parameters
[in]ThisThe EDKII_MEMORY_PROFILE_PROTOCOL instance.
[in]RecordingStateRecording state.
Returns
EFI_SUCCESS Set memory profile recording state successfully.
EFI_UNSUPPORTED Memory profile is unsupported.

Definition at line 1738 of file MemoryProfileRecord.c.

◆ ProfileProtocolUnregisterImage()

EFI_STATUS EFIAPI ProfileProtocolUnregisterImage ( IN EDKII_MEMORY_PROFILE_PROTOCOL This,
IN EFI_DEVICE_PATH_PROTOCOL FilePath,
IN PHYSICAL_ADDRESS  ImageBase,
IN UINT64  ImageSize 
)

Unregister image from memory profile.

Parameters
[in]ThisThe EDKII_MEMORY_PROFILE_PROTOCOL instance.
[in]FilePathFile path of the image.
[in]ImageBaseImage base address.
[in]ImageSizeImage size.
Returns
EFI_SUCCESS Unregister successfully.
EFI_UNSUPPORTED Memory profile is unsupported, or memory profile for the image is not required.
EFI_NOT_FOUND The image is not found.

Definition at line 1671 of file MemoryProfileRecord.c.

◆ RegisterDxeCore()

BOOLEAN RegisterDxeCore ( IN VOID *  HobStart,
IN MEMORY_PROFILE_CONTEXT_DATA ContextData 
)

Register DXE Core to memory profile.

Parameters
HobStartThe start address of the HOB.
ContextDataMemory profile context.
Return values
TRUERegister success.
FALSERegister fail.

Definition at line 530 of file MemoryProfileRecord.c.

◆ RegisterMemoryProfileImage()

EFI_STATUS RegisterMemoryProfileImage ( IN LOADED_IMAGE_PRIVATE_DATA DriverEntry,
IN EFI_FV_FILETYPE  FileType 
)

Register image to memory profile.

Parameters
DriverEntryImage info.
FileTypeImage file type.
Returns
EFI_SUCCESS Register successfully.
EFI_UNSUPPORTED Memory profile is unsupported, or memory profile for the image is not required.
EFI_OUT_OF_RESOURCES No enough resource for this register.

Definition at line 694 of file MemoryProfileRecord.c.

◆ UnregisterMemoryProfileImage()

EFI_STATUS UnregisterMemoryProfileImage ( IN LOADED_IMAGE_PRIVATE_DATA DriverEntry)

Unregister image from memory profile.

Parameters
DriverEntryImage info.
Returns
EFI_SUCCESS Unregister successfully.
EFI_UNSUPPORTED Memory profile is unsupported, or memory profile for the image is not required.
EFI_NOT_FOUND The image is not found.

Definition at line 833 of file MemoryProfileRecord.c.

Variable Documentation

◆ mImageQueue

Definition at line 38 of file MemoryProfileRecord.c.

◆ mMemoryProfileContext

Initial value:
= {
MEMORY_PROFILE_CONTEXT_SIGNATURE,
{
{
MEMORY_PROFILE_CONTEXT_SIGNATURE,
MEMORY_PROFILE_CONTEXT_REVISION
},
0,
0,
{ 0 },
{ 0 },
0,
0,
0
},
&mImageQueue,
}

Definition at line 39 of file MemoryProfileRecord.c.

◆ mMemoryProfileContextPtr

Definition at line 57 of file MemoryProfileRecord.c.

◆ mMemoryProfileDriverPath

Definition at line 62 of file MemoryProfileRecord.c.

◆ mMemoryProfileDriverPathSize

GLOBAL_REMOVE_IF_UNREFERENCED UINTN mMemoryProfileDriverPathSize

Definition at line 63 of file MemoryProfileRecord.c.

◆ mMemoryProfileGettingStatus

GLOBAL_REMOVE_IF_UNREFERENCED BOOLEAN mMemoryProfileGettingStatus = FALSE

Definition at line 60 of file MemoryProfileRecord.c.

◆ mMemoryProfileLock

Definition at line 59 of file MemoryProfileRecord.c.

◆ mMemoryProfileRecordingEnable

GLOBAL_REMOVE_IF_UNREFERENCED BOOLEAN mMemoryProfileRecordingEnable = MEMORY_PROFILE_RECORDING_DISABLE

Definition at line 61 of file MemoryProfileRecord.c.

◆ mProfileProtocol

Initial value:
= {
}
EFI_STATUS EFIAPI ProfileProtocolUnregisterImage(IN EDKII_MEMORY_PROFILE_PROTOCOL *This, IN EFI_DEVICE_PATH_PROTOCOL *FilePath, IN PHYSICAL_ADDRESS ImageBase, IN UINT64 ImageSize)
EFI_STATUS EFIAPI ProfileProtocolGetData(IN EDKII_MEMORY_PROFILE_PROTOCOL *This, IN OUT UINT64 *ProfileSize, OUT VOID *ProfileBuffer)
EFI_STATUS EFIAPI ProfileProtocolRecord(IN EDKII_MEMORY_PROFILE_PROTOCOL *This, IN PHYSICAL_ADDRESS CallerAddress, IN MEMORY_PROFILE_ACTION Action, IN EFI_MEMORY_TYPE MemoryType, IN VOID *Buffer, IN UINTN Size, IN CHAR8 *ActionString OPTIONAL)
EFI_STATUS EFIAPI ProfileProtocolSetRecordingState(IN EDKII_MEMORY_PROFILE_PROTOCOL *This, IN BOOLEAN RecordingState)
EFI_STATUS EFIAPI ProfileProtocolGetRecordingState(IN EDKII_MEMORY_PROFILE_PROTOCOL *This, OUT BOOLEAN *RecordingState)
EFI_STATUS EFIAPI ProfileProtocolRegisterImage(IN EDKII_MEMORY_PROFILE_PROTOCOL *This, IN EFI_DEVICE_PATH_PROTOCOL *FilePath, IN PHYSICAL_ADDRESS ImageBase, IN UINT64 ImageSize, IN EFI_FV_FILETYPE FileType)

Definition at line 205 of file MemoryProfileRecord.c.