|
TianoCore EDK2 master
|
#include "PiSmmCore.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 |
| struct | ACTION_STRING |
| struct | PROFILE_MEMORY_TYPE_STRING |
Macros | |
| #define | IS_SMRAM_PROFILE_ENABLED ((PcdGet8 (PcdMemoryProfilePropertyMask) & BIT1) != 0) |
| #define | IS_UEFI_MEMORY_PROFILE_ENABLED ((PcdGet8 (PcdMemoryProfilePropertyMask) & BIT0) != 0) |
| #define | GET_OCCUPIED_SIZE(ActualSize, Alignment) ((ActualSize) + (((Alignment) - ((ActualSize) & ((Alignment) - 1))) & ((Alignment) - 1))) |
| #define | SMRAM_INFO_DUMP_PAGE_THRESHOLD 4 |
Support routines for SMRAM profile.
Copyright (c) 2014 - 2018, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
Definition in file SmramProfileRecord.c.
| #define GET_OCCUPIED_SIZE | ( | ActualSize, | |
| Alignment | |||
| ) | ((ActualSize) + (((Alignment) - ((ActualSize) & ((Alignment) - 1))) & ((Alignment) - 1))) |
Definition at line 14 of file SmramProfileRecord.c.
| #define IS_SMRAM_PROFILE_ENABLED ((PcdGet8 (PcdMemoryProfilePropertyMask) & BIT1) != 0) |
Definition at line 11 of file SmramProfileRecord.c.
| #define IS_UEFI_MEMORY_PROFILE_ENABLED ((PcdGet8 (PcdMemoryProfilePropertyMask) & BIT0) != 0) |
Definition at line 12 of file SmramProfileRecord.c.
| #define SMRAM_INFO_DUMP_PAGE_THRESHOLD 4 |
Definition at line 41 of file SmramProfileRecord.c.
| 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.
| ContextData | Memory profile context. |
| FileName | File name of the image. |
| ImageBase | Image base address. |
| ImageSize | Image size. |
| EntryPoint | Entry point of the image. |
| ImageSubsystem | Image subsystem of the image. |
| FileType | File type of the image. |
Definition at line 371 of file SmramProfileRecord.c.
Dump SMRAM free page list.
Definition at line 2485 of file SmramProfileRecord.c.
Dump SMRAM free pool list.
Definition at line 2528 of file SmramProfileRecord.c.
Dump SMRAM information.
Definition at line 2801 of file SmramProfileRecord.c.
Dump SMRAM profile.
Definition at line 2682 of file SmramProfileRecord.c.
Dump SMRAM range.
Definition at line 2446 of file SmramProfileRecord.c.
| EFI_GUID * GetFileNameFromFilePath | ( | IN EFI_DEVICE_PATH_PROTOCOL * | FilePath | ) |
Get the GUID file name from the file path.
| FilePath | File path. |
Definition at line 720 of file SmramProfileRecord.c.
| 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
| DriverInfoData | Driver info |
| BasicAction | This Free basic action |
| Size | Buffer size |
| Buffer | Buffer address |
Definition at line 1225 of file SmramProfileRecord.c.
| 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.
| ContextData | Memory profile context. |
| FileName | Image file name. |
| Address | Image Address. |
Definition at line 819 of file SmramProfileRecord.c.
| 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)
| ContextData | Memory profile context. |
| Address | Image or Function address. |
Definition at line 865 of file SmramProfileRecord.c.
| EFI_MEMORY_TYPE 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. As SMRAM profile is only to record EfiRuntimeServicesCode and EfiRuntimeServicesData, so return input memory type directly.
| MemoryType | Memory type. |
Definition at line 1037 of file SmramProfileRecord.c.
| MEMORY_PROFILE_CONTEXT_DATA * GetSmramProfileContext | ( | VOID | ) |
Return SMRAM profile context.
Definition at line 245 of file SmramProfileRecord.c.
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().
| Pe32Data | The pointer to the PE/COFF image that is loaded in system memory. |
| EntryPoint | The pointer to entry point to the PE/COFF image to return. |
| RETURN_SUCCESS | EntryPoint was returned. |
| RETURN_INVALID_PARAMETER | The entry point could not be found in the PE/COFF image. |
Definition at line 317 of file SmramProfileRecord.c.
Retrieves and returns the Subsystem of a PE/COFF image that has been loaded into system memory. If Pe32Data is NULL, then ASSERT().
| Pe32Data | The pointer to the PE/COFF image that is loaded in system memory. |
Definition at line 262 of file SmramProfileRecord.c.
| BOOLEAN NeedRecordThisDriver | ( | IN EFI_DEVICE_PATH_PROTOCOL * | DriverFilePath | ) |
Return if record for this driver is needed..
| DriverFilePath | Driver file path. |
| TRUE | Record for this driver is needed. |
| FALSE | Record for this driver is not needed. |
Definition at line 548 of file SmramProfileRecord.c.
| CHAR8 * ProfileActionToStr | ( | IN MEMORY_PROFILE_ACTION | Action | ) |
Action to string.
| [in] | Action | Profile action. |
Definition at line 2653 of file SmramProfileRecord.c.
| CHAR8 * ProfileMemoryTypeToStr | ( | IN EFI_MEMORY_TYPE | MemoryType | ) |
Memory type to string.
| [in] | MemoryType | Memory type. |
Definition at line 2629 of file SmramProfileRecord.c.
| VOID RegisterImageToDxe | ( | IN EFI_GUID * | FileName, |
| IN PHYSICAL_ADDRESS | ImageBase, | ||
| IN UINT64 | ImageSize, | ||
| IN EFI_FV_FILETYPE | FileType | ||
| ) |
Register image to DXE.
| FileName | File name of the image. |
| ImageBase | Image base address. |
| ImageSize | Image size. |
| FileType | File type of the image. |
Definition at line 471 of file SmramProfileRecord.c.
| BOOLEAN RegisterSmmCore | ( | IN MEMORY_PROFILE_CONTEXT_DATA * | ContextData | ) |
Register SMM Core to SMRAM profile.
| ContextData | SMRAM profile context. |
| TRUE | Register success. |
| FALSE | Register fail. |
Definition at line 608 of file SmramProfileRecord.c.
Register SMRAM profile handler.
Definition at line 2420 of file SmramProfileRecord.c.
| EFI_STATUS RegisterSmramProfileImage | ( | IN EFI_SMM_DRIVER_ENTRY * | DriverEntry, |
| IN BOOLEAN | RegisterToDxe | ||
| ) |
Register SMM image to SMRAM profile.
| DriverEntry | SMM image info. |
| RegisterToDxe | Register image to DXE. |
Definition at line 756 of file SmramProfileRecord.c.
| BOOLEAN SmmCoreNeedRecordProfile | ( | IN EFI_MEMORY_TYPE | MemoryType | ) |
Return if this memory type needs to be recorded into memory profile. Only need to record EfiRuntimeServicesCode and EfiRuntimeServicesData for SMRAM profile.
| MemoryType | Memory type. |
| TRUE | This memory type need to be recorded. |
| FALSE | This memory type need not to be recorded. |
Definition at line 1004 of file SmramProfileRecord.c.
| EFI_STATUS EFIAPI SmmCoreUpdateProfile | ( | 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 SMRAM profile information.
| CallerAddress | Address of caller who call Allocate or Free. |
| Action | This Allocate or Free action. |
| MemoryType | Memory type. EfiMaxMemoryType means the MemoryType is unknown. |
| Size | Buffer size. |
| Buffer | Buffer address. |
| ActionString | String for memory profile action. Only needed for user defined allocate action. |
Definition at line 1479 of file SmramProfileRecord.c.
| EFI_STATUS SmmCoreUpdateProfileAllocate | ( | 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 SMRAM profile Allocate information.
| CallerAddress | Address of caller who call Allocate. |
| Action | This Allocate action. |
| MemoryType | Memory type. |
| Size | Buffer size. |
| Buffer | Buffer address. |
| ActionString | String for memory profile action. |
Definition at line 1094 of file SmramProfileRecord.c.
| EFI_STATUS SmmCoreUpdateProfileFree | ( | IN PHYSICAL_ADDRESS | CallerAddress, |
| IN MEMORY_PROFILE_ACTION | Action, | ||
| IN UINTN | Size, | ||
| IN VOID * | Buffer | ||
| ) |
Update SMRAM profile Free information.
| CallerAddress | Address of caller who call Free. |
| Action | This Free action. |
| Size | Buffer size. |
| Buffer | Buffer address. |
Definition at line 1292 of file SmramProfileRecord.c.
| VOID SmramProfileCopyData | ( | OUT VOID * | ProfileBuffer, |
| IN OUT UINT64 * | ProfileSize, | ||
| IN OUT UINT64 * | ProfileOffset | ||
| ) |
Copy SMRAM profile data.
| ProfileBuffer | The buffer to hold SMRAM profile data. |
| ProfileSize | On input, profile buffer size. On output, actual profile data size copied. |
| ProfileOffset | On input, profile buffer offset to copy. On output, next time profile buffer offset to copy. |
Definition at line 1670 of file SmramProfileRecord.c.
Get SMRAM profile data size.
Definition at line 1574 of file SmramProfileRecord.c.
| EFI_STATUS EFIAPI SmramProfileHandler | ( | IN EFI_HANDLE | DispatchHandle, |
| IN CONST VOID *Context | OPTIONAL, | ||
| IN OUT VOID *CommBuffer | OPTIONAL, | ||
| IN OUT UINTN *CommBufferSize | OPTIONAL | ||
| ) |
Dispatch function for a Software SMI handler.
Caution: This function may receive untrusted input. Communicate buffer and buffer size are external input, so this function will do basic validation.
| DispatchHandle | The unique handle assigned to this handler by SmiHandlerRegister(). |
| Context | Points to an optional handler context which was specified when the handler was registered. |
| CommBuffer | A pointer to a collection of data in memory that will be conveyed from a non-SMM environment into an SMM environment. |
| CommBufferSize | The size of the CommBuffer. |
| EFI_SUCCESS | Command is handled successfully. |
Definition at line 2305 of file SmramProfileRecord.c.
| VOID SmramProfileHandlerGetData | ( | IN SMRAM_PROFILE_PARAMETER_GET_PROFILE_DATA * | SmramProfileParameterGetData | ) |
SMRAM profile handler to get profile data.
| SmramProfileParameterGetData | The parameter of SMM profile get data. |
Definition at line 2198 of file SmramProfileRecord.c.
| VOID SmramProfileHandlerGetDataByOffset | ( | IN SMRAM_PROFILE_PARAMETER_GET_PROFILE_DATA_BY_OFFSET * | SmramProfileParameterGetDataByOffset | ) |
SMRAM profile handler to get profile data by offset.
| SmramProfileParameterGetDataByOffset | The parameter of SMM profile get data by offset. |
Definition at line 2252 of file SmramProfileRecord.c.
| VOID SmramProfileHandlerGetInfo | ( | IN SMRAM_PROFILE_PARAMETER_GET_PROFILE_INFO * | SmramProfileParameterGetInfo | ) |
SMRAM profile handler to get profile info.
| SmramProfileParameterGetInfo | The parameter of SMM profile get size. |
Definition at line 2170 of file SmramProfileRecord.c.
Initialize SMRAM profile.
Definition at line 647 of file SmramProfileRecord.c.
Install SMRAM profile protocol.
Definition at line 690 of file SmramProfileRecord.c.
| EFI_STATUS EFIAPI SmramProfileProtocolGetData | ( | IN EDKII_SMM_MEMORY_PROFILE_PROTOCOL * | This, |
| IN OUT UINT64 * | ProfileSize, | ||
| OUT VOID * | ProfileBuffer | ||
| ) |
Get memory profile data.
| [in] | This | The EDKII_SMM_MEMORY_PROFILE_PROTOCOL instance. |
| [in,out] | ProfileSize | On entry, points to the size in bytes of the ProfileBuffer. On return, points to the size of the data returned in ProfileBuffer. |
| [out] | ProfileBuffer | Profile buffer. |
Definition at line 1941 of file SmramProfileRecord.c.
| EFI_STATUS EFIAPI SmramProfileProtocolGetRecordingState | ( | IN EDKII_SMM_MEMORY_PROFILE_PROTOCOL * | This, |
| OUT BOOLEAN * | RecordingState | ||
| ) |
Get memory profile recording state.
| [in] | This | The EDKII_SMM_MEMORY_PROFILE_PROTOCOL instance. |
| [out] | RecordingState | Recording state. |
Definition at line 2077 of file SmramProfileRecord.c.
| EFI_STATUS EFIAPI SmramProfileProtocolRecord | ( | IN EDKII_SMM_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.
| [in] | This | The EDKII_SMM_MEMORY_PROFILE_PROTOCOL instance. |
| [in] | CallerAddress | Address of caller. |
| [in] | Action | Memory profile action. |
| [in] | MemoryType | Memory type. EfiMaxMemoryType means the MemoryType is unknown. |
| [in] | Buffer | Buffer address. |
| [in] | Size | Buffer size. |
| [in] | ActionString | String for memory profile action. Only needed for user defined allocate action. |
Definition at line 2150 of file SmramProfileRecord.c.
| EFI_STATUS EFIAPI SmramProfileProtocolRegisterImage | ( | IN EDKII_SMM_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.
| [in] | This | The EDKII_SMM_MEMORY_PROFILE_PROTOCOL instance. |
| [in] | FilePath | File path of the image. |
| [in] | ImageBase | Image base address. |
| [in] | ImageSize | Image size. |
| [in] | FileType | File type of the image. |
Register image to memory profile.
| [in] | This | The EDKII_SMM_MEMORY_PROFILE_PROTOCOL instance. |
| [in] | FilePath | File path of the image. |
| [in] | ImageBase | Image base address. |
| [in] | ImageSize | Image size. |
| [in] | FileType | File type of the image. |
Definition at line 1993 of file SmramProfileRecord.c.
| EFI_STATUS EFIAPI SmramProfileProtocolSetRecordingState | ( | IN EDKII_SMM_MEMORY_PROFILE_PROTOCOL * | This, |
| IN BOOLEAN | RecordingState | ||
| ) |
Set memory profile recording state.
| [in] | This | The EDKII_SMM_MEMORY_PROFILE_PROTOCOL instance. |
| [in] | RecordingState | Recording state. |
Definition at line 2109 of file SmramProfileRecord.c.
| EFI_STATUS EFIAPI SmramProfileProtocolUnregisterImage | ( | IN EDKII_SMM_MEMORY_PROFILE_PROTOCOL * | This, |
| IN EFI_DEVICE_PATH_PROTOCOL * | FilePath, | ||
| IN PHYSICAL_ADDRESS | ImageBase, | ||
| IN UINT64 | ImageSize | ||
| ) |
Unregister image from memory profile.
| [in] | This | The EDKII_SMM_MEMORY_PROFILE_PROTOCOL instance. |
| [in] | FilePath | File path of the image. |
| [in] | ImageBase | Image base address. |
| [in] | ImageSize | Image size. |
Definition at line 2037 of file SmramProfileRecord.c.
SMRAM profile ready to lock callback function.
Definition at line 1553 of file SmramProfileRecord.c.
| VOID SmramProfileUpdateFreePages | ( | IN MEMORY_PROFILE_CONTEXT_DATA * | ContextData | ) |
Update SMRAM profile FreeMemoryPages information
| ContextData | Memory profile context. |
Definition at line 1051 of file SmramProfileRecord.c.
| VOID UnregisterImageFromDxe | ( | IN EFI_GUID * | FileName, |
| IN PHYSICAL_ADDRESS | ImageBase, | ||
| IN UINT64 | ImageSize | ||
| ) |
Unregister image from DXE.
| FileName | File name of the image. |
| ImageBase | Image base address. |
| ImageSize | Image size. |
Definition at line 510 of file SmramProfileRecord.c.
| EFI_STATUS UnregisterSmramProfileImage | ( | IN EFI_SMM_DRIVER_ENTRY * | DriverEntry, |
| IN BOOLEAN | UnregisterFromDxe | ||
| ) |
Unregister image from SMRAM profile.
| DriverEntry | SMM image info. |
| UnregisterFromDxe | Unregister image from DXE. |
Definition at line 911 of file SmramProfileRecord.c.
| GLOBAL_REMOVE_IF_UNREFERENCED ACTION_STRING mExtActionString[] |
Definition at line 2586 of file SmramProfileRecord.c.
| GLOBAL_REMOVE_IF_UNREFERENCED LIST_ENTRY mImageQueue = INITIALIZE_LIST_HEAD_VARIABLE (mImageQueue) |
Definition at line 53 of file SmramProfileRecord.c.
| GLOBAL_REMOVE_IF_UNREFERENCED PROFILE_MEMORY_TYPE_STRING mMemoryTypeString[] |
Definition at line 2615 of file SmramProfileRecord.c.
| GLOBAL_REMOVE_IF_UNREFERENCED CHAR8* mSmmActionString[] |
Definition at line 2573 of file SmramProfileRecord.c.
| GLOBAL_REMOVE_IF_UNREFERENCED EDKII_SMM_MEMORY_PROFILE_PROTOCOL mSmmProfileProtocol |
Definition at line 229 of file SmramProfileRecord.c.
| GLOBAL_REMOVE_IF_UNREFERENCED MEMORY_PROFILE_FREE_MEMORY mSmramFreeMemory |
Definition at line 43 of file SmramProfileRecord.c.
| GLOBAL_REMOVE_IF_UNREFERENCED MEMORY_PROFILE_CONTEXT_DATA mSmramProfileContext |
Definition at line 54 of file SmramProfileRecord.c.
| GLOBAL_REMOVE_IF_UNREFERENCED MEMORY_PROFILE_CONTEXT_DATA* mSmramProfileContextPtr = NULL |
Definition at line 72 of file SmramProfileRecord.c.
| GLOBAL_REMOVE_IF_UNREFERENCED EFI_DEVICE_PATH_PROTOCOL* mSmramProfileDriverPath |
Definition at line 77 of file SmramProfileRecord.c.
| GLOBAL_REMOVE_IF_UNREFERENCED UINTN mSmramProfileDriverPathSize |
Definition at line 78 of file SmramProfileRecord.c.
| GLOBAL_REMOVE_IF_UNREFERENCED BOOLEAN mSmramProfileGettingStatus = FALSE |
Definition at line 75 of file SmramProfileRecord.c.
| GLOBAL_REMOVE_IF_UNREFERENCED BOOLEAN mSmramProfileRecordingEnable = MEMORY_PROFILE_RECORDING_DISABLE |
Definition at line 76 of file SmramProfileRecord.c.
| GLOBAL_REMOVE_IF_UNREFERENCED BOOLEAN mSmramReadyToLock |
Definition at line 74 of file SmramProfileRecord.c.