|
TianoCore EDK2 master
|
#include <PiSmm.h>#include <Library/BaseLib.h>#include <Library/BaseMemoryLib.h>#include <Library/MemoryAllocationLib.h>#include <Library/UefiBootServicesTableLib.h>#include <Library/SmmServicesTableLib.h>#include <Library/DebugLib.h>#include <Library/PrintLib.h>#include <Library/UefiLib.h>#include <Library/DevicePathLib.h>#include <Library/PeCoffGetEntryPointLib.h>#include <Protocol/LoadedImage.h>#include <Protocol/SmmAccess2.h>#include <Protocol/SmmReadyToLock.h>#include <Protocol/SmmEndOfDxe.h>#include <Guid/SmiHandlerProfile.h>#include "PiSmmCore.h"Go to the source code of this file.
Data Structures | |
| struct | IMAGE_STRUCT |
Macros | |
| #define | GET_OCCUPIED_SIZE(ActualSize, Alignment) ((ActualSize) + (((Alignment) - ((ActualSize) & ((Alignment) - 1))) & ((Alignment) - 1))) |
SMI handler profile support.
Copyright (c) 2017, Intel Corporation. All rights reserved.
Copyright (c) Microsoft Corporation. SPDX-License-Identifier: BSD-2-Clause-Patent
Definition in file SmiHandlerProfile.c.
| #define GET_OCCUPIED_SIZE | ( | ActualSize, | |
| Alignment | |||
| ) | ((ActualSize) + (((Alignment) - ((ActualSize) & ((Alignment) - 1))) & ((Alignment) - 1))) |
Definition at line 30 of file SmiHandlerProfile.c.
| VOID AddImageStruct | ( | IN PHYSICAL_ADDRESS | ImageBase, |
| IN UINT64 | ImageSize, | ||
| IN PHYSICAL_ADDRESS | EntryPoint, | ||
| IN EFI_GUID * | Guid, | ||
| IN CHAR8 * | PdbString | ||
| ) |
Add image structure.
| ImageBase | image base |
| ImageSize | image size |
| EntryPoint | image entry point |
| Guid | FFS GUID of the image |
| PdbString | image PDB string |
Definition at line 172 of file SmiHandlerProfile.c.
return an image reference index based upon image address.
| Address | image address |
Definition at line 236 of file SmiHandlerProfile.c.
| IMAGE_STRUCT * AddressToImageStruct | ( | IN UINTN | Address | ) |
return an image structure based upon image address.
| Address | image address |
Definition at line 211 of file SmiHandlerProfile.c.
Build SMI handler profile database.
Definition at line 879 of file SmiHandlerProfile.c.
| SMI_HANDLER_PROFILE_SW_REGISTER_CONTEXT * ConvertSmiHandlerSwContext | ( | IN EFI_SMM_SW_REGISTER_CONTEXT * | SwContext, |
| IN UINTN | SwContextSize, | ||
| OUT UINTN * | SmiHandlerSwContextSize | ||
| ) |
Convert EFI_SMM_SW_REGISTER_CONTEXT to SMI_HANDLER_PROFILE_SW_REGISTER_CONTEXT.
| SwContext | A pointer to EFI_SMM_SW_REGISTER_CONTEXT |
| SwContextSize | The size of EFI_SMM_SW_REGISTER_CONTEXT in bytes |
| SmiHandlerSwContextSize | The size of SMI_HANDLER_PROFILE_SW_REGISTER_CONTEXT in bytes |
Definition at line 1197 of file SmiHandlerProfile.c.
| SMI_HANDLER_PROFILE_USB_REGISTER_CONTEXT * ConvertSmiHandlerUsbContext | ( | IN EFI_SMM_USB_REGISTER_CONTEXT * | UsbContext, |
| IN UINTN | UsbContextSize, | ||
| OUT UINTN * | SmiHandlerUsbContextSize | ||
| ) |
Convert EFI_SMM_USB_REGISTER_CONTEXT to SMI_HANDLER_PROFILE_USB_REGISTER_CONTEXT.
| UsbContext | A pointer to EFI_SMM_USB_REGISTER_CONTEXT |
| UsbContextSize | The size of EFI_SMM_USB_REGISTER_CONTEXT in bytes |
| SmiHandlerUsbContextSize | The size of SMI_HANDLER_PROFILE_USB_REGISTER_CONTEXT in bytes |
Definition at line 1162 of file SmiHandlerProfile.c.
Dump SMI child context.
| HandlerType | the handler type |
| Context | the handler context |
| ContextSize | the handler context size |
Definition at line 372 of file SmiHandlerProfile.c.
| VOID DumpSmiEntryList | ( | IN LIST_ENTRY * | SmiEntryList | ) |
Dump all SMI entry on the list.
| SmiEntryList | a list of SMI entry. |
Definition at line 469 of file SmiHandlerProfile.c.
Dump all SMI handlers associated with SmiEntry.
| SmiEntry | SMI entry. |
Definition at line 418 of file SmiHandlerProfile.c.
| VOID GetDriverGuid | ( | IN EFI_LOADED_IMAGE_PROTOCOL * | LoadedImage, |
| OUT EFI_GUID * | Guid | ||
| ) |
Get GUID name for an image.
| [in] | LoadedImage | LoadedImage protocol. |
| [out] | Guid | Guid of the FFS |
Definition at line 141 of file SmiHandlerProfile.c.
| EFI_STATUS GetSmiHandlerProfileDatabaseData | ( | IN OUT VOID * | Data | ) |
Get SMI handler profile database.
| Data | the buffer to hold SMI handler profile database |
| EFI_SUCCESS | the database is got. |
| EFI_INVALID_PARAMETER | the database size mismatch. |
Definition at line 838 of file SmiHandlerProfile.c.
return SMI handler profile database size.
Definition at line 639 of file SmiHandlerProfile.c.
get SMM image database.
| Data | The buffer to hold SMM image database |
| ExpectedSize | The expected size of the SMM image database |
Definition at line 660 of file SmiHandlerProfile.c.
returns SMM image data base size.
Definition at line 559 of file SmiHandlerProfile.c.
Collect SMM image information based upon loaded image protocol.
Definition at line 254 of file SmiHandlerProfile.c.
| UINTN GetSmmSmiDatabaseData | ( | IN LIST_ENTRY * | SmiEntryList, |
| IN UINT32 | HandlerCategory, | ||
| IN OUT VOID * | Data, | ||
| IN UINTN | ExpectedSize | ||
| ) |
get all SMI handler database on the SMI entry list.
| SmiEntryList | a list of SMI entry. |
| HandlerCategory | The handler category |
| Data | The buffer to hold all SMI handler database |
| ExpectedSize | The expected size of the SMM image database |
Definition at line 779 of file SmiHandlerProfile.c.
| UINTN GetSmmSmiDatabaseSize | ( | IN LIST_ENTRY * | SmiEntryList | ) |
return all SMI handler database size on the SMI entry list.
| SmiEntryList | a list of SMI entry. |
Definition at line 611 of file SmiHandlerProfile.c.
| UINTN GetSmmSmiHandlerDataOnSmiEntry | ( | IN SMI_ENTRY * | SmiEntry, |
| IN OUT VOID * | Data, | ||
| IN UINTN | MaxSize, | ||
| OUT UINT32 * | Count | ||
| ) |
get all SMI handler data associated with SmiEntry.
| SmiEntry | SMI entry. |
| Data | The buffer to hold all SMI handler data |
| MaxSize | The max size of the SMM image database |
| Count | The count of the SMI handler. |
Definition at line 717 of file SmiHandlerProfile.c.
returns all SMI handlers' size associated with SmiEntry.
| SmiEntry | SMI entry. |
Definition at line 582 of file SmiHandlerProfile.c.
This function dump raw data.
| Data | raw data |
| Size | raw data size |
Definition at line 122 of file SmiHandlerProfile.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 315 of file MemoryProfileRecord.c.
Register SMI handler profile handler.
Definition at line 1077 of file SmiHandlerProfile.c.
| VOID SmiHandlerProfileCopyData | ( | OUT VOID * | DataBuffer, |
| IN OUT UINT64 * | DataSize, | ||
| IN OUT UINT64 * | DataOffset | ||
| ) |
Copy SMI handler profile data.
| DataBuffer | The buffer to hold SMI handler profile data. |
| DataSize | On input, data buffer size. On output, actual data buffer size copied. |
| DataOffset | On input, data buffer offset to copy. On output, next time data buffer offset to copy. |
Definition at line 909 of file SmiHandlerProfile.c.
| EFI_STATUS EFIAPI SmiHandlerProfileHandler | ( | 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 1007 of file SmiHandlerProfile.c.
| VOID SmiHandlerProfileHandlerGetDataByOffset | ( | IN SMI_HANDLER_PROFILE_PARAMETER_GET_DATA_BY_OFFSET * | SmiHandlerProfileParameterGetDataByOffset | ) |
SMI handler profile handler to get data by offset.
| SmiHandlerProfileParameterGetDataByOffset | The parameter of SMI handler profile get data by offset. |
Definition at line 961 of file SmiHandlerProfile.c.
| VOID SmiHandlerProfileHandlerGetInfo | ( | IN SMI_HANDLER_PROFILE_PARAMETER_GET_INFO * | SmiHandlerProfileParameterGetInfo | ) |
SMI handler profile handler to get info.
| SmiHandlerProfileParameterGetInfo | The parameter of SMI handler profile get info. |
Definition at line 939 of file SmiHandlerProfile.c.
| EFI_STATUS EFIAPI SmiHandlerProfileRegisterHandler | ( | IN SMI_HANDLER_PROFILE_PROTOCOL * | This, |
| IN EFI_GUID * | HandlerGuid, | ||
| IN EFI_SMM_HANDLER_ENTRY_POINT2 | Handler, | ||
| IN PHYSICAL_ADDRESS | CallerAddress, | ||
| IN VOID *Context | OPTIONAL, | ||
| IN UINTN ContextSize | OPTIONAL | ||
| ) |
This function is called by SmmChildDispatcher module to report a new SMI handler is registered, to SmmCore.
| This | The protocol instance |
| HandlerGuid | The GUID to identify the type of the handler. For the SmmChildDispatch protocol, the HandlerGuid must be the GUID of SmmChildDispatch protocol. |
| Handler | The SMI handler. |
| CallerAddress | The address of the module who registers the SMI handler. |
| Context | The context of the SMI handler. For the SmmChildDispatch protocol, the Context must match the one defined for SmmChildDispatch protocol. |
| ContextSize | The size of the context in bytes. For the SmmChildDispatch protocol, the Context must match the one defined for SmmChildDispatch protocol. |
| EFI_SUCCESS | The information is recorded. |
| EFI_OUT_OF_RESOURCES | There is no enough resource to record the information. |
Definition at line 1240 of file SmiHandlerProfile.c.
| EFI_STATUS EFIAPI SmiHandlerProfileUnregisterHandler | ( | IN SMI_HANDLER_PROFILE_PROTOCOL * | This, |
| IN EFI_GUID * | HandlerGuid, | ||
| IN EFI_SMM_HANDLER_ENTRY_POINT2 | Handler, | ||
| IN VOID *Context | OPTIONAL, | ||
| IN UINTN ContextSize | OPTIONAL | ||
| ) |
This function is called by SmmChildDispatcher module to report an existing SMI handler is unregistered, to SmmCore.
| This | The protocol instance |
| HandlerGuid | The GUID to identify the type of the handler. For the SmmChildDispatch protocol, the HandlerGuid must be the GUID of SmmChildDispatch protocol. |
| Handler | The SMI handler. |
| Context | The context of the SMI handler. If it is NOT NULL, it will be used to check what is registered. |
| ContextSize | The size of the context in bytes. If Context is NOT NULL, it will be used to check what is registered. |
| EFI_SUCCESS | The original record is removed. |
| EFI_NOT_FOUND | There is no record for the HandlerGuid and handler. |
Definition at line 1321 of file SmiHandlerProfile.c.
Finds the SMI entry for the requested handler type.
| HandlerType | The type of the interrupt |
| Create | Create a new entry if not found |
Definition at line 1101 of file SmiHandlerProfile.c.
Initialize SmiHandler profile feature.
Definition at line 1403 of file SmiHandlerProfile.c.
| EFI_STATUS EFIAPI SmmReadyToLockInSmiHandlerProfile | ( | IN CONST EFI_GUID * | Protocol, |
| IN VOID * | Interface, | ||
| IN EFI_HANDLE | Handle | ||
| ) |
SMM Ready To Lock event notification handler.
This function collects all SMM image information and build SmiHandleProfile database, and register SmiHandlerProfile SMI handler.
| [in] | Protocol | Points to the protocol's unique identifier. |
| [in] | Interface | Points to the interface instance. |
| [in] | Handle | The handle on which the interface was installed. |
| EFI_SUCCESS | Notification handler runs successfully. |
Definition at line 503 of file SmiHandlerProfile.c.
| GLOBAL_REMOVE_IF_UNREFERENCED LIST_ENTRY mHardwareSmiEntryList = INITIALIZE_LIST_HEAD_VARIABLE (mHardwareSmiEntryList) |
Definition at line 88 of file SmiHandlerProfile.c.
| GLOBAL_REMOVE_IF_UNREFERENCED IMAGE_STRUCT* mImageStruct |
Definition at line 96 of file SmiHandlerProfile.c.
| GLOBAL_REMOVE_IF_UNREFERENCED UINT32 mImageStructCount |
Definition at line 98 of file SmiHandlerProfile.c.
| GLOBAL_REMOVE_IF_UNREFERENCED UINT32 mImageStructCountMax |
Definition at line 97 of file SmiHandlerProfile.c.
| GLOBAL_REMOVE_IF_UNREFERENCED LIST_ENTRY mRootSmiEntryList = INITIALIZE_LIST_HEAD_VARIABLE (mRootSmiEntryList) |
Definition at line 90 of file SmiHandlerProfile.c.
|
extern |
| GLOBAL_REMOVE_IF_UNREFERENCED SMI_HANDLER_PROFILE_PROTOCOL mSmiHandlerProfile |
Definition at line 110 of file SmiHandlerProfile.c.
| GLOBAL_REMOVE_IF_UNREFERENCED VOID* mSmiHandlerProfileDatabase |
Definition at line 100 of file SmiHandlerProfile.c.
| GLOBAL_REMOVE_IF_UNREFERENCED UINTN mSmiHandlerProfileDatabaseSize |
Definition at line 101 of file SmiHandlerProfile.c.
| GLOBAL_REMOVE_IF_UNREFERENCED BOOLEAN mSmiHandlerProfileRecordingStatus |
Definition at line 108 of file SmiHandlerProfile.c.
| GLOBAL_REMOVE_IF_UNREFERENCED LIST_ENTRY* mSmmCoreHardwareSmiEntryList = &mHardwareSmiEntryList |
Definition at line 94 of file SmiHandlerProfile.c.
| GLOBAL_REMOVE_IF_UNREFERENCED LIST_ENTRY* mSmmCoreRootSmiEntryList = &mRootSmiEntryList |
Definition at line 92 of file SmiHandlerProfile.c.
| GLOBAL_REMOVE_IF_UNREFERENCED LIST_ENTRY* mSmmCoreSmiEntryList = &mSmiEntryList |
Definition at line 93 of file SmiHandlerProfile.c.
| GLOBAL_REMOVE_IF_UNREFERENCED UINTN mSmmHardwareSmiDatabaseSize |
Definition at line 106 of file SmiHandlerProfile.c.
| GLOBAL_REMOVE_IF_UNREFERENCED UINTN mSmmImageDatabaseSize |
Definition at line 103 of file SmiHandlerProfile.c.
| GLOBAL_REMOVE_IF_UNREFERENCED UINTN mSmmRootSmiDatabaseSize |
Definition at line 104 of file SmiHandlerProfile.c.
| GLOBAL_REMOVE_IF_UNREFERENCED UINTN mSmmSmiDatabaseSize |
Definition at line 105 of file SmiHandlerProfile.c.