TianoCore EDK2 master
Loading...
Searching...
No Matches
PiSmmCore.h File Reference
#include <PiSmm.h>
#include <Protocol/DxeSmmReadyToLock.h>
#include <Protocol/SmmReadyToLock.h>
#include <Protocol/SmmEndOfDxe.h>
#include <Protocol/CpuIo2.h>
#include <Protocol/SmmCommunication.h>
#include <Protocol/SmmAccess2.h>
#include <Protocol/FirmwareVolume2.h>
#include <Protocol/LoadedImage.h>
#include <Protocol/DevicePath.h>
#include <Protocol/Security.h>
#include <Protocol/Security2.h>
#include <Protocol/SmmExitBootServices.h>
#include <Protocol/SmmLegacyBoot.h>
#include <Protocol/SmmReadyToBoot.h>
#include <Protocol/SmmMemoryAttribute.h>
#include <Protocol/SmmSxDispatch2.h>
#include <Guid/Apriori.h>
#include <Guid/EventGroup.h>
#include <Guid/EventLegacyBios.h>
#include <Guid/MemoryProfile.h>
#include <Guid/LoadModuleAtFixedAddress.h>
#include <Guid/SmiHandlerProfile.h>
#include <Guid/EndOfS3Resume.h>
#include <Guid/S3SmmInitDone.h>
#include <Library/BaseLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/PeCoffLib.h>
#include <Library/PeCoffGetEntryPointLib.h>
#include <Library/CacheMaintenanceLib.h>
#include <Library/DebugLib.h>
#include <Library/ReportStatusCodeLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/DevicePathLib.h>
#include <Library/UefiLib.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/PcdLib.h>
#include <Library/SmmCorePlatformHookLib.h>
#include <Library/PerformanceLib.h>
#include <Library/HobLib.h>
#include <Library/SmmMemLib.h>
#include <Library/SafeIntLib.h>
#include "PiSmmCorePrivateData.h"
#include "HeapGuard.h"

Go to the source code of this file.

Data Structures

struct  SMM_CORE_SMI_HANDLERS
 
struct  SMI_ENTRY
 
struct  SMI_HANDLER
 
struct  EFI_SMM_DRIVER_ENTRY
 
struct  IHANDLE
 
struct  PROTOCOL_ENTRY
 
struct  PROTOCOL_INTERFACE
 
struct  PROTOCOL_NOTIFY
 
struct  FREE_PAGE_LIST
 
struct  POOL_HEADER
 
struct  POOL_TAIL
 
struct  FREE_POOL_HEADER
 

Macros

#define SMI_ENTRY_SIGNATURE   SIGNATURE_32('s','m','i','e')
 
#define SMI_HANDLER_SIGNATURE   SIGNATURE_32('s','m','i','h')
 
#define EFI_SMM_DRIVER_ENTRY_SIGNATURE   SIGNATURE_32('s', 'd','r','v')
 
#define EFI_HANDLE_SIGNATURE   SIGNATURE_32('s','h','d','l')
 
#define ASSERT_IS_HANDLE(a)   ASSERT((a)->Signature == EFI_HANDLE_SIGNATURE)
 
#define PROTOCOL_ENTRY_SIGNATURE   SIGNATURE_32('s','p','t','e')
 
#define PROTOCOL_INTERFACE_SIGNATURE   SIGNATURE_32('s','p','i','f')
 
#define PROTOCOL_NOTIFY_SIGNATURE   SIGNATURE_32('s','p','t','n')
 
#define MIN_POOL_SHIFT   6
 
#define MIN_POOL_SIZE   (1 << MIN_POOL_SHIFT)
 
#define MAX_POOL_SHIFT   (EFI_PAGE_SHIFT - 1)
 
#define MAX_POOL_SIZE   (1 << MAX_POOL_SHIFT)
 
#define MAX_POOL_INDEX   (MAX_POOL_SHIFT - MIN_POOL_SHIFT + 1)
 
#define POOL_HEAD_SIGNATURE   SIGNATURE_32('s','p','h','d')
 
#define POOL_TAIL_SIGNATURE   SIGNATURE_32('s','p','t','l')
 
#define POOL_OVERHEAD   (sizeof(POOL_HEADER) + sizeof(POOL_TAIL))
 
#define HEAD_TO_TAIL(a)    ((POOL_TAIL *) (((CHAR8 *) (a)) + (a)->Size - sizeof(POOL_TAIL)));
 

Enumerations

enum  SMM_POOL_TYPE { SmmPoolTypeCode , SmmPoolTypeData , SmmPoolTypeMax }
 

Functions

VOID SmmInitializeMemoryServices (IN UINTN SmramRangeCount, IN EFI_SMRAM_DESCRIPTOR *SmramRanges)
 
EFI_STATUS EFIAPI SmmInstallConfigurationTable (IN CONST EFI_SMM_SYSTEM_TABLE2 *SystemTable, IN CONST EFI_GUID *Guid, IN VOID *Table, IN UINTN TableSize)
 
EFI_STATUS EFIAPI SmmInstallProtocolInterface (IN OUT EFI_HANDLE *UserHandle, IN EFI_GUID *Protocol, IN EFI_INTERFACE_TYPE InterfaceType, IN VOID *Interface)
 
EFI_STATUS EFIAPI SmmAllocatePages (IN EFI_ALLOCATE_TYPE Type, IN EFI_MEMORY_TYPE MemoryType, IN UINTN NumberOfPages, OUT EFI_PHYSICAL_ADDRESS *Memory)
 
EFI_STATUS EFIAPI SmmInternalAllocatePages (IN EFI_ALLOCATE_TYPE Type, IN EFI_MEMORY_TYPE MemoryType, IN UINTN NumberOfPages, OUT EFI_PHYSICAL_ADDRESS *Memory, IN BOOLEAN NeedGuard)
 
EFI_STATUS EFIAPI SmmFreePages (IN EFI_PHYSICAL_ADDRESS Memory, IN UINTN NumberOfPages)
 
EFI_STATUS EFIAPI SmmInternalFreePages (IN EFI_PHYSICAL_ADDRESS Memory, IN UINTN NumberOfPages, IN BOOLEAN IsGuarded)
 
EFI_STATUS EFIAPI SmmAllocatePool (IN EFI_MEMORY_TYPE PoolType, IN UINTN Size, OUT VOID **Buffer)
 
EFI_STATUS EFIAPI SmmInternalAllocatePool (IN EFI_MEMORY_TYPE PoolType, IN UINTN Size, OUT VOID **Buffer)
 
EFI_STATUS EFIAPI SmmFreePool (IN VOID *Buffer)
 
EFI_STATUS EFIAPI SmmInternalFreePool (IN VOID *Buffer)
 
EFI_STATUS SmmInstallProtocolInterfaceNotify (IN OUT EFI_HANDLE *UserHandle, IN EFI_GUID *Protocol, IN EFI_INTERFACE_TYPE InterfaceType, IN VOID *Interface, IN BOOLEAN Notify)
 
EFI_STATUS EFIAPI SmmUninstallProtocolInterface (IN EFI_HANDLE UserHandle, IN EFI_GUID *Protocol, IN VOID *Interface)
 
EFI_STATUS EFIAPI SmmHandleProtocol (IN EFI_HANDLE UserHandle, IN EFI_GUID *Protocol, OUT VOID **Interface)
 
EFI_STATUS EFIAPI SmmRegisterProtocolNotify (IN CONST EFI_GUID *Protocol, IN EFI_SMM_NOTIFY_FN Function, OUT VOID **Registration)
 
EFI_STATUS EFIAPI SmmLocateHandle (IN EFI_LOCATE_SEARCH_TYPE SearchType, IN EFI_GUID *Protocol OPTIONAL, IN VOID *SearchKey OPTIONAL, IN OUT UINTN *BufferSize, OUT EFI_HANDLE *Buffer)
 
EFI_STATUS EFIAPI SmmLocateProtocol (IN EFI_GUID *Protocol, IN VOID *Registration OPTIONAL, OUT VOID **Interface)
 
EFI_STATUS EFIAPI SmmLocateHandleBuffer (IN EFI_LOCATE_SEARCH_TYPE SearchType, IN EFI_GUID *Protocol OPTIONAL, IN VOID *SearchKey OPTIONAL, IN OUT UINTN *NumberHandles, OUT EFI_HANDLE **Buffer)
 
EFI_STATUS EFIAPI SmiManage (IN CONST EFI_GUID *HandlerType, IN CONST VOID *Context OPTIONAL, IN OUT VOID *CommBuffer OPTIONAL, IN OUT UINTN *CommBufferSize OPTIONAL)
 
EFI_STATUS EFIAPI SmiHandlerRegister (IN EFI_SMM_HANDLER_ENTRY_POINT2 Handler, IN CONST EFI_GUID *HandlerType OPTIONAL, OUT EFI_HANDLE *DispatchHandle)
 
EFI_STATUS EFIAPI SmiHandlerUnRegister (IN EFI_HANDLE DispatchHandle)
 
EFI_STATUS EFIAPI SmmDriverDispatchHandler (IN EFI_HANDLE DispatchHandle, IN CONST VOID *Context OPTIONAL, IN OUT VOID *CommBuffer OPTIONAL, IN OUT UINTN *CommBufferSize OPTIONAL)
 
EFI_STATUS EFIAPI SmmLegacyBootHandler (IN EFI_HANDLE DispatchHandle, IN CONST VOID *Context OPTIONAL, IN OUT VOID *CommBuffer OPTIONAL, IN OUT UINTN *CommBufferSize OPTIONAL)
 
EFI_STATUS EFIAPI SmmReadyToLockHandler (IN EFI_HANDLE DispatchHandle, IN CONST VOID *Context OPTIONAL, IN OUT VOID *CommBuffer OPTIONAL, IN OUT UINTN *CommBufferSize OPTIONAL)
 
EFI_STATUS EFIAPI SmmEndOfDxeHandler (IN EFI_HANDLE DispatchHandle, IN CONST VOID *Context OPTIONAL, IN OUT VOID *CommBuffer OPTIONAL, IN OUT UINTN *CommBufferSize OPTIONAL)
 
EFI_STATUS EFIAPI SmmExitBootServicesHandler (IN EFI_HANDLE DispatchHandle, IN CONST VOID *Context OPTIONAL, IN OUT VOID *CommBuffer OPTIONAL, IN OUT UINTN *CommBufferSize OPTIONAL)
 
EFI_STATUS EFIAPI SmmReadyToBootHandler (IN EFI_HANDLE DispatchHandle, IN CONST VOID *Context OPTIONAL, IN OUT VOID *CommBuffer OPTIONAL, IN OUT UINTN *CommBufferSize OPTIONAL)
 
EFI_STATUS EFIAPI SmmS3SmmInitDoneHandler (IN EFI_HANDLE DispatchHandle, IN CONST VOID *Context OPTIONAL, IN OUT VOID *CommBuffer OPTIONAL, IN OUT UINTN *CommBufferSize OPTIONAL)
 
EFI_STATUS EFIAPI SmmEndOfS3ResumeHandler (IN EFI_HANDLE DispatchHandle, IN CONST VOID *Context OPTIONAL, IN OUT VOID *CommBuffer OPTIONAL, IN OUT UINTN *CommBufferSize OPTIONAL)
 
EFI_STATUS EFIAPI SmmEfiNotAvailableYetArg5 (UINTN Arg1, UINTN Arg2, UINTN Arg3, UINTN Arg4, UINTN Arg5)
 
VOID SmmDisplayDiscoveredNotDispatched (VOID)
 
VOID SmmAddMemoryRegion (IN EFI_PHYSICAL_ADDRESS MemBase, IN UINT64 MemLength, IN EFI_MEMORY_TYPE Type, IN UINT64 Attributes)
 
PROTOCOL_ENTRYSmmFindProtocolEntry (IN EFI_GUID *Protocol, IN BOOLEAN Create)
 
VOID SmmNotifyProtocol (IN PROTOCOL_INTERFACE *Prot)
 
PROTOCOL_INTERFACESmmFindProtocolInterface (IN IHANDLE *Handle, IN EFI_GUID *Protocol, IN VOID *Interface)
 
PROTOCOL_INTERFACESmmRemoveInterfaceFromProtocol (IN IHANDLE *Handle, IN EFI_GUID *Protocol, IN VOID *Interface)
 
BOOLEAN SmmIsSchedulable (IN EFI_SMM_DRIVER_ENTRY *DriverEntry)
 
VOID SmramProfileInit (VOID)
 
VOID SmramProfileInstallProtocol (VOID)
 
EFI_STATUS RegisterSmramProfileImage (IN EFI_SMM_DRIVER_ENTRY *DriverEntry, IN BOOLEAN RegisterToDxe)
 
EFI_STATUS UnregisterSmramProfileImage (IN EFI_SMM_DRIVER_ENTRY *DriverEntry, IN BOOLEAN UnregisterToDxe)
 
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)
 
VOID RegisterSmramProfileHandler (VOID)
 
VOID SmramProfileReadyToLock (VOID)
 
VOID EFIAPI SmmCoreInitializeMemoryAttributesTable (VOID)
 
EFI_STATUS EFIAPI SmmCoreGetMemoryMap (IN OUT UINTN *MemoryMapSize, IN OUT EFI_MEMORY_DESCRIPTOR *MemoryMap, OUT UINTN *MapKey, OUT UINTN *DescriptorSize, OUT UINT32 *DescriptorVersion)
 
VOID SmmCoreInitializeSmiHandlerProfile (VOID)
 
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)
 
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)
 
UINTN InternalAllocPagesOnOneNode (IN OUT FREE_PAGE_LIST *Pages, IN UINTN NumberOfPages, IN UINTN MaxAddress)
 
VOID ConvertSmmMemoryMapEntry (IN EFI_MEMORY_TYPE Type, IN EFI_PHYSICAL_ADDRESS Memory, IN UINTN NumberOfPages, IN BOOLEAN AddRegion)
 
VOID CoreFreeMemoryMapStack (VOID)
 
EFI_STATUS SmmInternalFreePagesEx (IN EFI_PHYSICAL_ADDRESS Memory, IN UINTN NumberOfPages, IN BOOLEAN AddRegion)
 
VOID SmmEntryPointMemoryManagementHook (VOID)
 

Variables

SMM_CORE_PRIVATE_DATAgSmmCorePrivate
 
EFI_SMM_SYSTEM_TABLE2 gSmmCoreSmst
 
LIST_ENTRY gHandleList
 
EFI_PHYSICAL_ADDRESS gLoadModuleAtFixAddressSmramBase
 
UINTN mFullSmramRangeCount
 
EFI_SMRAM_DESCRIPTORmFullSmramRanges
 
EFI_SMM_DRIVER_ENTRYmSmmCoreDriverEntry
 
EFI_LOADED_IMAGE_PROTOCOLmSmmCoreLoadedImage
 
LIST_ENTRY mSmmMemoryMap
 
LIST_ENTRY mSmmPoolLists [SmmPoolTypeMax][MAX_POOL_INDEX]
 

Detailed Description

The internal header file includes the common header files, defines internal structure and functions used by SmmCore module.

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

Definition in file PiSmmCore.h.

Macro Definition Documentation

◆ ASSERT_IS_HANDLE

#define ASSERT_IS_HANDLE (   a)    ASSERT((a)->Signature == EFI_HANDLE_SIGNATURE)

Definition at line 159 of file PiSmmCore.h.

◆ EFI_HANDLE_SIGNATURE

#define EFI_HANDLE_SIGNATURE   SIGNATURE_32('s','h','d','l')

Definition at line 145 of file PiSmmCore.h.

◆ EFI_SMM_DRIVER_ENTRY_SIGNATURE

#define EFI_SMM_DRIVER_ENTRY_SIGNATURE   SIGNATURE_32('s', 'd','r','v')

Definition at line 102 of file PiSmmCore.h.

◆ HEAD_TO_TAIL

#define HEAD_TO_TAIL (   a)     ((POOL_TAIL *) (((CHAR8 *) (a)) + (a)->Size - sizeof(POOL_TAIL)));

Definition at line 1269 of file PiSmmCore.h.

◆ MAX_POOL_INDEX

#define MAX_POOL_INDEX   (MAX_POOL_SHIFT - MIN_POOL_SHIFT + 1)

Definition at line 1248 of file PiSmmCore.h.

◆ MAX_POOL_SHIFT

#define MAX_POOL_SHIFT   (EFI_PAGE_SHIFT - 1)

Definition at line 1242 of file PiSmmCore.h.

◆ MAX_POOL_SIZE

#define MAX_POOL_SIZE   (1 << MAX_POOL_SHIFT)

Definition at line 1243 of file PiSmmCore.h.

◆ MIN_POOL_SHIFT

#define MIN_POOL_SHIFT   6

Definition at line 1236 of file PiSmmCore.h.

◆ MIN_POOL_SIZE

#define MIN_POOL_SIZE   (1 << MIN_POOL_SHIFT)

Definition at line 1237 of file PiSmmCore.h.

◆ POOL_HEAD_SIGNATURE

#define POOL_HEAD_SIGNATURE   SIGNATURE_32('s','p','h','d')

Definition at line 1250 of file PiSmmCore.h.

◆ POOL_OVERHEAD

#define POOL_OVERHEAD   (sizeof(POOL_HEADER) + sizeof(POOL_TAIL))

Definition at line 1267 of file PiSmmCore.h.

◆ POOL_TAIL_SIGNATURE

#define POOL_TAIL_SIGNATURE   SIGNATURE_32('s','p','t','l')

Definition at line 1259 of file PiSmmCore.h.

◆ PROTOCOL_ENTRY_SIGNATURE

#define PROTOCOL_ENTRY_SIGNATURE   SIGNATURE_32('s','p','t','e')

Definition at line 161 of file PiSmmCore.h.

◆ PROTOCOL_INTERFACE_SIGNATURE

#define PROTOCOL_INTERFACE_SIGNATURE   SIGNATURE_32('s','p','i','f')

Definition at line 180 of file PiSmmCore.h.

◆ PROTOCOL_NOTIFY_SIGNATURE

#define PROTOCOL_NOTIFY_SIGNATURE   SIGNATURE_32('s','p','t','n')

Definition at line 200 of file PiSmmCore.h.

◆ SMI_ENTRY_SIGNATURE

#define SMI_ENTRY_SIGNATURE   SIGNATURE_32('s','m','i','e')

Definition at line 76 of file PiSmmCore.h.

◆ SMI_HANDLER_SIGNATURE

#define SMI_HANDLER_SIGNATURE   SIGNATURE_32('s','m','i','h')

Definition at line 86 of file PiSmmCore.h.

Enumeration Type Documentation

◆ SMM_POOL_TYPE

enum SMM_POOL_TYPE

Definition at line 1277 of file PiSmmCore.h.

Function Documentation

◆ ConvertSmmMemoryMapEntry()

VOID ConvertSmmMemoryMapEntry ( IN EFI_MEMORY_TYPE  Type,
IN EFI_PHYSICAL_ADDRESS  Memory,
IN UINTN  NumberOfPages,
IN BOOLEAN  AddRegion 
)

Update SMM memory map entry.

Parameters
[in]TypeThe type of allocation to perform.
[in]MemoryThe base of memory address.
[in]NumberOfPagesThe number of pages to allocate.
[in]AddRegionIf this memory is new added region.

Definition at line 256 of file Page.c.

◆ CoreFreeMemoryMapStack()

VOID CoreFreeMemoryMapStack ( VOID  )

Internal function. Moves any memory descriptors that are on the temporary descriptor stack to heap.

Definition at line 314 of file Page.c.

◆ InternalAllocPagesOnOneNode()

UINTN InternalAllocPagesOnOneNode ( IN OUT FREE_PAGE_LIST Pages,
IN UINTN  NumberOfPages,
IN UINTN  MaxAddress 
)

Internal Function. Allocate n pages from given free page node.

Parameters
PagesThe free page node.
NumberOfPagesNumber of pages to be allocated.
MaxAddressRequest to allocate memory below this address.
Returns
Memory address of allocated pages.

Definition at line 463 of file Page.c.

◆ RegisterSmramProfileHandler()

VOID RegisterSmramProfileHandler ( VOID  )

Register SMRAM profile handler.

Definition at line 2416 of file SmramProfileRecord.c.

◆ RegisterSmramProfileImage()

EFI_STATUS RegisterSmramProfileImage ( IN EFI_SMM_DRIVER_ENTRY DriverEntry,
IN BOOLEAN  RegisterToDxe 
)

Register SMM image to SMRAM profile.

Parameters
DriverEntrySMM image info.
RegisterToDxeRegister image to DXE.
Returns
EFI_SUCCESS Register successfully.
EFI_UNSUPPORTED Memory profile unsupported, or memory profile for the image is not required.
EFI_OUT_OF_RESOURCES No enough resource for this register.

Register SMM image to SMRAM profile.

Parameters
DriverEntrySMM image info.
RegisterToDxeRegister image to DXE.
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 756 of file SmramProfileRecord.c.

◆ SmiHandlerProfileRegisterHandler()

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.

Parameters
ThisThe protocol instance
HandlerGuidThe GUID to identify the type of the handler. For the SmmChildDispatch protocol, the HandlerGuid must be the GUID of SmmChildDispatch protocol.
HandlerThe SMI handler.
CallerAddressThe address of the module who registers the SMI handler.
ContextThe context of the SMI handler. For the SmmChildDispatch protocol, the Context must match the one defined for SmmChildDispatch protocol.
ContextSizeThe size of the context in bytes. For the SmmChildDispatch protocol, the Context must match the one defined for SmmChildDispatch protocol.
Return values
EFI_SUCCESSThe information is recorded.
EFI_OUT_OF_RESOURCESThere is no enough resource to record the information.

Definition at line 1238 of file SmiHandlerProfile.c.

◆ SmiHandlerProfileUnregisterHandler()

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.

Parameters
ThisThe protocol instance
HandlerGuidThe GUID to identify the type of the handler. For the SmmChildDispatch protocol, the HandlerGuid must be the GUID of SmmChildDispatch protocol.
HandlerThe SMI handler.
ContextThe context of the SMI handler. If it is NOT NULL, it will be used to check what is registered.
ContextSizeThe size of the context in bytes. If Context is NOT NULL, it will be used to check what is registered.
Return values
EFI_SUCCESSThe original record is removed.
EFI_NOT_FOUNDThere is no record for the HandlerGuid and handler.

Definition at line 1319 of file SmiHandlerProfile.c.

◆ SmiHandlerRegister()

EFI_STATUS EFIAPI SmiHandlerRegister ( IN EFI_SMM_HANDLER_ENTRY_POINT2  Handler,
IN CONST EFI_GUID *HandlerType  OPTIONAL,
OUT EFI_HANDLE DispatchHandle 
)

Registers a handler to execute within SMM.

Parameters
HandlerHandler service function pointer.
HandlerTypePoints to the handler type or NULL for root SMI handlers.
DispatchHandleOn return, contains a unique handle which can be used to later unregister the handler function.
Return values
EFI_SUCCESSHandler register success.
EFI_INVALID_PARAMETERHandler or DispatchHandle is NULL.

Definition at line 334 of file Smi.c.

◆ SmiHandlerUnRegister()

EFI_STATUS EFIAPI SmiHandlerUnRegister ( IN EFI_HANDLE  DispatchHandle)

Unregister a handler in SMM.

Parameters
DispatchHandleThe handle that was specified when the handler was registered.
Return values
EFI_SUCCESSHandler function was successfully unregistered.
EFI_INVALID_PARAMETERDispatchHandle does not refer to a valid handle.

Definition at line 394 of file Smi.c.

◆ SmiManage()

EFI_STATUS EFIAPI SmiManage ( IN CONST EFI_GUID HandlerType,
IN CONST VOID *Context  OPTIONAL,
IN OUT VOID *CommBuffer  OPTIONAL,
IN OUT UINTN *CommBufferSize  OPTIONAL 
)

Manage SMI of a particular type.

Parameters
HandlerTypePoints to the handler type or NULL for root SMI handlers.
ContextPoints to an optional context buffer.
CommBufferPoints to the optional communication buffer.
CommBufferSizePoints to the size of the optional communication buffer.
Return values
EFI_SUCCESSInterrupt source was processed successfully but not quiesced.
EFI_INTERRUPT_PENDINGOne or more SMI sources could not be quiesced.
EFI_WARN_INTERRUPT_SOURCE_PENDINGInterrupt source was not handled or quiesced.
EFI_WARN_INTERRUPT_SOURCE_QUIESCEDInterrupt source was handled and quiesced.

Manage SMI of a particular type.

Parameters
HandlerTypePoints to the handler type or NULL for root SMI handlers.
ContextPoints to an optional context buffer.
CommBufferPoints to the optional communication buffer.
CommBufferSizePoints to the size of the optional communication buffer.
Return values
EFI_WARN_INTERRUPT_SOURCE_PENDINGInterrupt source was processed successfully but not quiesced.
EFI_INTERRUPT_PENDINGOne or more SMI sources could not be quiesced.
EFI_NOT_FOUNDInterrupt source was not handled or quiesced.
EFI_SUCCESSInterrupt source was handled and quiesced.

Definition at line 137 of file Smi.c.

◆ SmmAddMemoryRegion()

VOID SmmAddMemoryRegion ( IN EFI_PHYSICAL_ADDRESS  MemBase,
IN UINT64  MemLength,
IN EFI_MEMORY_TYPE  Type,
IN UINT64  Attributes 
)

Add free SMRAM region for use by memory service.

Parameters
MemBaseBase address of memory region.
MemLengthLength of the memory region.
TypeMemory type.
AttributesMemory region state.

Definition at line 972 of file Page.c.

◆ SmmAllocatePages()

EFI_STATUS EFIAPI SmmAllocatePages ( IN EFI_ALLOCATE_TYPE  Type,
IN EFI_MEMORY_TYPE  MemoryType,
IN UINTN  NumberOfPages,
OUT EFI_PHYSICAL_ADDRESS Memory 
)

Allocates pages from the memory map.

Parameters
TypeThe type of allocation to perform
MemoryTypeThe type of memory to turn the allocated pages into
NumberOfPagesThe number of pages to allocate
MemoryA pointer to receive the base allocated memory address
Return values
EFI_INVALID_PARAMETERParameters violate checking rules defined in spec.
EFI_NOT_FOUNDCould not allocate pages match the requirement.
EFI_OUT_OF_RESOURCESNo enough pages to allocate.
EFI_SUCCESSPages successfully allocated.

Allocates pages from the memory map.

Parameters
TypeThe type of allocation to perform.
MemoryTypeThe type of memory to turn the allocated pages into.
NumberOfPagesThe number of pages to allocate.
MemoryA pointer to receive the base allocated memory address.
Return values
EFI_INVALID_PARAMETERParameters violate checking rules defined in spec.
EFI_NOT_FOUNDCould not allocate pages match the requirement.
EFI_OUT_OF_RESOURCESNo enough pages to allocate.
EFI_SUCCESSPages successfully allocated.

Definition at line 723 of file Page.c.

◆ SmmAllocatePool()

EFI_STATUS EFIAPI SmmAllocatePool ( IN EFI_MEMORY_TYPE  PoolType,
IN UINTN  Size,
OUT VOID **  Buffer 
)

Allocate pool of a particular type.

Parameters
PoolTypeType of pool to allocate
SizeThe amount of pool to allocate
BufferThe address to return a pointer to the allocated pool
Return values
EFI_INVALID_PARAMETERPoolType not valid
EFI_OUT_OF_RESOURCESSize exceeds max pool size or allocation failed.
EFI_SUCCESSPool successfully allocated.

Allocate pool of a particular type.

Parameters
PoolTypeType of pool to allocate.
SizeThe amount of pool to allocate.
BufferThe address to return a pointer to the allocated pool.
Return values
EFI_INVALID_PARAMETERPoolType not valid.
EFI_OUT_OF_RESOURCESSize exceeds max pool size or allocation failed.
EFI_SUCCESSPool successfully allocated.

Definition at line 338 of file Pool.c.

◆ SmmCoreGetMemoryMap()

EFI_STATUS EFIAPI SmmCoreGetMemoryMap ( IN OUT UINTN MemoryMapSize,
IN OUT EFI_MEMORY_DESCRIPTOR MemoryMap,
OUT UINTN MapKey,
OUT UINTN DescriptorSize,
OUT UINT32 *  DescriptorVersion 
)

This function returns a copy of the current memory map. The map is an array of memory descriptors, each of which describes a contiguous block of memory.

Parameters
[in,out]MemoryMapSizeA pointer to the size, in bytes, of the MemoryMap buffer. On input, this is the size of the buffer allocated by the caller. On output, it is the size of the buffer returned by the firmware if the buffer was large enough, or the size of the buffer needed to contain the map if the buffer was too small.
[in,out]MemoryMapA pointer to the buffer in which firmware places the current memory map.
[out]MapKeyA pointer to the location in which firmware returns the key for the current memory map.
[out]DescriptorSizeA pointer to the location in which firmware returns the size, in bytes, of an individual EFI_MEMORY_DESCRIPTOR.
[out]DescriptorVersionA pointer to the location in which firmware returns the version number associated with the EFI_MEMORY_DESCRIPTOR.
Return values
EFI_SUCCESSThe memory map was returned in the MemoryMap buffer.
EFI_BUFFER_TOO_SMALLThe MemoryMap buffer was too small. The current buffer size needed to hold the memory map is returned in MemoryMapSize.
EFI_INVALID_PARAMETEROne of the parameters has an invalid value.

Definition at line 1042 of file Page.c.

◆ SmmCoreInitializeMemoryAttributesTable()

VOID EFIAPI SmmCoreInitializeMemoryAttributesTable ( VOID  )

Initialize MemoryAttributes support.

Initialize MemoryAttributesTable support.

Definition at line 518 of file MemoryAttributesTable.c.

◆ SmmCoreInitializeSmiHandlerProfile()

VOID SmmCoreInitializeSmiHandlerProfile ( VOID  )

Initialize SmiHandler profile feature.

Definition at line 1401 of file SmiHandlerProfile.c.

◆ SmmCoreUpdateProfile()

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.

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 1476 of file SmramProfileRecord.c.

◆ SmmDisplayDiscoveredNotDispatched()

VOID SmmDisplayDiscoveredNotDispatched ( VOID  )

Traverse the discovered list for any drivers that were discovered but not loaded because the dependency expressions evaluated to false.

Definition at line 1526 of file Dispatcher.c.

◆ SmmDriverDispatchHandler()

EFI_STATUS EFIAPI SmmDriverDispatchHandler ( IN EFI_HANDLE  DispatchHandle,
IN CONST VOID *Context  OPTIONAL,
IN OUT VOID *CommBuffer  OPTIONAL,
IN OUT UINTN *CommBufferSize  OPTIONAL 
)

This function is the main entry point for an SMM handler dispatch or communicate-based callback.

Parameters
DispatchHandleThe unique handle assigned to this handler by SmiHandlerRegister().
ContextPoints to an optional handler context which was specified when the handler was registered.
CommBufferA pointer to a collection of data in memory that will be conveyed from a non-SMM environment into an SMM environment.
CommBufferSizeThe size of the CommBuffer.
Returns
Status Code

This function is the main entry point for an SMM handler dispatch or communicate-based callback.

Event notification that is fired every time a FV dispatch protocol is added. More than one protocol may have been added when this event is fired, so you must loop on SmmLocateHandle () to see how many protocols were added and do the following to each FV: If the Fv has already been processed, skip it. If the Fv has not been processed then mark it as being processed, as we are about to process it. Read the Fv and add any driver in the Fv to the mDiscoveredList.The mDiscoveredList is never free'ed and contains variables that define the other states the SMM driver transitions to.. While you are at it read the A Priori file into memory. Place drivers in the A Priori list onto the mScheduledQueue.

Parameters
DispatchHandleThe unique handle assigned to this handler by SmiHandlerRegister().
ContextPoints to an optional handler context which was specified when the handler was registered.
CommBufferA pointer to a collection of data in memory that will be conveyed from a non-SMM environment into an SMM environment.
CommBufferSizeThe size of the CommBuffer.
Returns
Status Code

Definition at line 1284 of file Dispatcher.c.

◆ SmmEfiNotAvailableYetArg5()

EFI_STATUS EFIAPI SmmEfiNotAvailableYetArg5 ( UINTN  Arg1,
UINTN  Arg2,
UINTN  Arg3,
UINTN  Arg4,
UINTN  Arg5 
)

Place holder function until all the SMM System Table Service are available.

Parameters
Arg1Undefined
Arg2Undefined
Arg3Undefined
Arg4Undefined
Arg5Undefined
Returns
EFI_NOT_AVAILABLE_YET

Place holder function until all the SMM System Table Service are available.

Note: This function is only used by SMRAM invocation. It is never used by DXE invocation.

Parameters
Arg1Undefined
Arg2Undefined
Arg3Undefined
Arg4Undefined
Arg5Undefined
Returns
EFI_NOT_AVAILABLE_YET

Definition at line 125 of file PiSmmCore.c.

◆ SmmEndOfDxeHandler()

EFI_STATUS EFIAPI SmmEndOfDxeHandler ( IN EFI_HANDLE  DispatchHandle,
IN CONST VOID *Context  OPTIONAL,
IN OUT VOID *CommBuffer  OPTIONAL,
IN OUT UINTN *CommBufferSize  OPTIONAL 
)

This function is the main entry point for an SMM handler dispatch or communicate-based callback.

Parameters
DispatchHandleThe unique handle assigned to this handler by SmiHandlerRegister().
ContextPoints to an optional handler context which was specified when the handler was registered.
CommBufferA pointer to a collection of data in memory that will be conveyed from a non-SMM environment into an SMM environment.
CommBufferSizeThe size of the CommBuffer.
Returns
Status Code

Software SMI handler that is called when the EndOfDxe event is signalled. This function installs the SMM EndOfDxe Protocol so SMM Drivers are informed that platform code will invoke 3rd part code.

Parameters
DispatchHandleThe unique handle assigned to this handler by SmiHandlerRegister().
ContextPoints to an optional handler context which was specified when the handler was registered.
CommBufferA pointer to a collection of data in memory that will be conveyed from a non-SMM environment into an SMM environment.
CommBufferSizeThe size of the CommBuffer.
Returns
Status Code

Definition at line 436 of file PiSmmCore.c.

◆ SmmEndOfS3ResumeHandler()

EFI_STATUS EFIAPI SmmEndOfS3ResumeHandler ( IN EFI_HANDLE  DispatchHandle,
IN CONST VOID *Context  OPTIONAL,
IN OUT VOID *CommBuffer  OPTIONAL,
IN OUT UINTN *CommBufferSize  OPTIONAL 
)

Software SMI handler that is called when the EndOfS3Resume event is trigged. This function installs the SMM EndOfS3Resume Protocol so SMM Drivers are informed that S3 resume has finished.

Parameters
DispatchHandleThe unique handle assigned to this handler by SmiHandlerRegister().
ContextPoints to an optional handler context which was specified when the handler was registered.
CommBufferA pointer to a collection of data in memory that will be conveyed from a non-SMM environment into an SMM environment.
CommBufferSizeThe size of the CommBuffer.
Returns
Status Code

Software SMI handler that is called when the EndOfS3Resume signal is triggered. This function installs the SMM EndOfS3Resume Protocol so SMM Drivers are informed that S3 resume has finished.

Parameters
DispatchHandleThe unique handle assigned to this handler by SmiHandlerRegister().
ContextPoints to an optional handler context which was specified when the handler was registered.
CommBufferA pointer to a collection of data in memory that will be conveyed from a non-SMM environment into an SMM environment.
CommBufferSizeThe size of the CommBuffer.
Returns
Status Code

Definition at line 569 of file PiSmmCore.c.

◆ SmmEntryPointMemoryManagementHook()

VOID SmmEntryPointMemoryManagementHook ( VOID  )

Hook function used to set all Guard pages after entering SMM mode.

Definition at line 1218 of file HeapGuard.c.

◆ SmmExitBootServicesHandler()

EFI_STATUS EFIAPI SmmExitBootServicesHandler ( IN EFI_HANDLE  DispatchHandle,
IN CONST VOID *Context  OPTIONAL,
IN OUT VOID *CommBuffer  OPTIONAL,
IN OUT UINTN *CommBufferSize  OPTIONAL 
)

This function is the main entry point for an SMM handler dispatch or communicate-based callback.

Parameters
DispatchHandleThe unique handle assigned to this handler by SmiHandlerRegister().
ContextPoints to an optional handler context which was specified when the handler was registered.
CommBufferA pointer to a collection of data in memory that will be conveyed from a non-SMM environment into an SMM environment.
CommBufferSizeThe size of the CommBuffer.
Returns
Status Code

Software SMI handler that is called when an Exit Boot Services event is signalled. Then the SMM Core also install SMM Exit Boot Services protocol to notify SMM driver that system enter exit boot services.

Parameters
DispatchHandleThe unique handle assigned to this handler by SmiHandlerRegister().
ContextPoints to an optional handler context which was specified when the handler was registered.
CommBufferA pointer to a collection of data in memory that will be conveyed from a non-SMM environment into an SMM environment.
CommBufferSizeThe size of the CommBuffer.
Returns
Status Code

Definition at line 214 of file PiSmmCore.c.

◆ SmmFindProtocolEntry()

PROTOCOL_ENTRY * SmmFindProtocolEntry ( IN EFI_GUID Protocol,
IN BOOLEAN  Create 
)

Finds the protocol entry for the requested protocol.

Parameters
ProtocolThe ID of the protocol
CreateCreate a new entry if not found
Returns
Protocol entry

Definition at line 56 of file Handle.c.

◆ SmmFindProtocolInterface()

PROTOCOL_INTERFACE * SmmFindProtocolInterface ( IN IHANDLE Handle,
IN EFI_GUID Protocol,
IN VOID *  Interface 
)

Finds the protocol instance for the requested handle and protocol. Note: This function doesn't do parameters checking, it's caller's responsibility to pass in valid parameters.

Parameters
HandleThe handle to search the protocol on
ProtocolGUID of the protocol
InterfaceThe interface for the protocol being searched
Returns
Protocol instance (NULL: Not found)

Definition at line 122 of file Handle.c.

◆ SmmFreePages()

EFI_STATUS EFIAPI SmmFreePages ( IN EFI_PHYSICAL_ADDRESS  Memory,
IN UINTN  NumberOfPages 
)

Frees previous allocated pages.

Parameters
MemoryBase address of memory being freed
NumberOfPagesThe number of pages to free
Return values
EFI_NOT_FOUNDCould not find the entry that covers the range
EFI_INVALID_PARAMETERAddress not aligned, Address is zero or NumberOfPages is zero.
Returns
EFI_SUCCESS Pages successfully freed.

Frees previous allocated pages.

Parameters
MemoryBase address of memory being freed.
NumberOfPagesThe number of pages to free.
Return values
EFI_NOT_FOUNDCould not find the entry that covers the range.
EFI_INVALID_PARAMETERAddress not aligned, Address is zero or NumberOfPages is zero.
Returns
EFI_SUCCESS Pages successfully freed.

Definition at line 934 of file Page.c.

◆ SmmFreePool()

EFI_STATUS EFIAPI SmmFreePool ( IN VOID *  Buffer)

Frees pool.

Parameters
BufferThe allocated pool entry to free
Return values
EFI_INVALID_PARAMETERBuffer is not a valid value.
EFI_SUCCESSPool successfully freed.

Frees pool.

Parameters
BufferThe allocated pool entry to free.
Return values
EFI_INVALID_PARAMETERBuffer is not a valid value.
EFI_SUCCESSPool successfully freed.

Definition at line 445 of file Pool.c.

◆ SmmHandleProtocol()

EFI_STATUS EFIAPI SmmHandleProtocol ( IN EFI_HANDLE  UserHandle,
IN EFI_GUID Protocol,
OUT VOID **  Interface 
)

Queries a handle to determine if it supports a specified protocol.

Parameters
UserHandleThe handle being queried.
ProtocolThe published unique identifier of the protocol.
InterfaceSupplies the address where a pointer to the corresponding Protocol Interface is returned.
Returns
The requested protocol interface for the handle

Queries a handle to determine if it supports a specified protocol.

Parameters
UserHandleThe handle being queried.
ProtocolThe published unique identifier of the protocol.
InterfaceSupplies the address where a pointer to the corresponding Protocol Interface is returned.
Return values
EFI_SUCCESSThe interface information for the specified protocol was returned.
EFI_UNSUPPORTEDThe device does not support the specified protocol.
EFI_INVALID_PARAMETERHandle is not a valid EFI_HANDLE..
EFI_INVALID_PARAMETERProtocol is NULL.
EFI_INVALID_PARAMETERInterface is NULL.

Definition at line 491 of file Handle.c.

◆ SmmInitializeMemoryServices()

VOID SmmInitializeMemoryServices ( IN UINTN  SmramRangeCount,
IN EFI_SMRAM_DESCRIPTOR SmramRanges 
)

Called to initialize the memory service.

Parameters
SmramRangeCountNumber of SMRAM Regions
SmramRangesPointer to SMRAM Descriptors

Definition at line 49 of file Pool.c.

◆ SmmInstallConfigurationTable()

EFI_STATUS EFIAPI SmmInstallConfigurationTable ( IN CONST EFI_SMM_SYSTEM_TABLE2 SystemTable,
IN CONST EFI_GUID Guid,
IN VOID *  Table,
IN UINTN  TableSize 
)

The SmmInstallConfigurationTable() function is used to maintain the list of configuration tables that are stored in the System Management System Table. The list is stored as an array of (GUID, Pointer) pairs. The list must be allocated from pool memory with PoolType set to EfiRuntimeServicesData.

Parameters
SystemTableA pointer to the SMM System Table (SMST).
GuidA pointer to the GUID for the entry to add, update, or remove.
TableA pointer to the buffer of the table to add.
TableSizeThe size of the table to install.
Return values
EFI_SUCCESSThe (Guid, Table) pair was added, updated, or removed.
EFI_INVALID_PARAMETERGuid is not valid.
EFI_NOT_FOUNDAn attempt was made to delete a non-existent entry.
EFI_OUT_OF_RESOURCESThere is not enough memory available to complete the operation.

Definition at line 34 of file InstallConfigurationTable.c.

◆ SmmInstallProtocolInterface()

EFI_STATUS EFIAPI SmmInstallProtocolInterface ( IN OUT EFI_HANDLE UserHandle,
IN EFI_GUID Protocol,
IN EFI_INTERFACE_TYPE  InterfaceType,
IN VOID *  Interface 
)

Wrapper function to SmmInstallProtocolInterfaceNotify. This is the public API which Calls the private one which contains a BOOLEAN parameter for notifications

Parameters
UserHandleThe handle to install the protocol handler on, or NULL if a new handle is to be allocated
ProtocolThe protocol to add to the handle
InterfaceTypeIndicates whether Interface is supplied in native form.
InterfaceThe interface for the protocol being added
Returns
Status code

Definition at line 174 of file Handle.c.

◆ SmmInstallProtocolInterfaceNotify()

EFI_STATUS SmmInstallProtocolInterfaceNotify ( IN OUT EFI_HANDLE UserHandle,
IN EFI_GUID Protocol,
IN EFI_INTERFACE_TYPE  InterfaceType,
IN VOID *  Interface,
IN BOOLEAN  Notify 
)

Installs a protocol interface into the boot services environment.

Parameters
UserHandleThe handle to install the protocol handler on, or NULL if a new handle is to be allocated
ProtocolThe protocol to add to the handle
InterfaceTypeIndicates whether Interface is supplied in native form.
InterfaceThe interface for the protocol being added
Notifyindicates whether notify the notification list for this protocol
Return values
EFI_INVALID_PARAMETERInvalid parameter
EFI_OUT_OF_RESOURCESNo enough buffer to allocate
EFI_SUCCESSProtocol interface successfully installed

Definition at line 208 of file Handle.c.

◆ SmmInternalAllocatePages()

EFI_STATUS EFIAPI SmmInternalAllocatePages ( IN EFI_ALLOCATE_TYPE  Type,
IN EFI_MEMORY_TYPE  MemoryType,
IN UINTN  NumberOfPages,
OUT EFI_PHYSICAL_ADDRESS Memory,
IN BOOLEAN  NeedGuard 
)

Allocates pages from the memory map.

Parameters
TypeThe type of allocation to perform
MemoryTypeThe type of memory to turn the allocated pages into
NumberOfPagesThe number of pages to allocate
MemoryA pointer to receive the base allocated memory address
NeedGuardFlag to indicate Guard page is needed or not
Return values
EFI_INVALID_PARAMETERParameters violate checking rules defined in spec.
EFI_NOT_FOUNDCould not allocate pages match the requirement.
EFI_OUT_OF_RESOURCESNo enough pages to allocate.
EFI_SUCCESSPages successfully allocated.

Allocates pages from the memory map.

Parameters
[in]TypeThe type of allocation to perform.
[in]MemoryTypeThe type of memory to turn the allocated pages into.
[in]NumberOfPagesThe number of pages to allocate.
[out]MemoryA pointer to receive the base allocated memory address.
[in]NeedGuardFlag to indicate Guard page is needed or not
Return values
EFI_INVALID_PARAMETERParameters violate checking rules defined in spec.
EFI_NOT_FOUNDCould not allocate pages match the requirement.
EFI_OUT_OF_RESOURCESNo enough pages to allocate.
EFI_SUCCESSPages successfully allocated.

Definition at line 687 of file Page.c.

◆ SmmInternalAllocatePool()

EFI_STATUS EFIAPI SmmInternalAllocatePool ( IN EFI_MEMORY_TYPE  PoolType,
IN UINTN  Size,
OUT VOID **  Buffer 
)

Allocate pool of a particular type.

Parameters
PoolTypeType of pool to allocate
SizeThe amount of pool to allocate
BufferThe address to return a pointer to the allocated pool
Return values
EFI_INVALID_PARAMETERPoolType not valid
EFI_OUT_OF_RESOURCESSize exceeds max pool size or allocation failed.
EFI_SUCCESSPool successfully allocated.

Allocate pool of a particular type.

Parameters
PoolTypeType of pool to allocate.
SizeThe amount of pool to allocate.
BufferThe address to return a pointer to the allocated pool.
Return values
EFI_INVALID_PARAMETERPoolType not valid.
EFI_OUT_OF_RESOURCESSize exceeds max pool size or allocation failed.
EFI_SUCCESSPool successfully allocated.

Definition at line 235 of file Pool.c.

◆ SmmInternalFreePages()

EFI_STATUS EFIAPI SmmInternalFreePages ( IN EFI_PHYSICAL_ADDRESS  Memory,
IN UINTN  NumberOfPages,
IN BOOLEAN  IsGuarded 
)

Frees previous allocated pages.

Parameters
MemoryBase address of memory being freed
NumberOfPagesThe number of pages to free
IsGuardedFlag to indicate if the memory is guarded or not
Return values
EFI_NOT_FOUNDCould not find the entry that covers the range
EFI_INVALID_PARAMETERAddress not aligned, Address is zero or NumberOfPages is zero.
Returns
EFI_SUCCESS Pages successfully freed.

Frees previous allocated pages.

Parameters
[in]MemoryBase address of memory being freed.
[in]NumberOfPagesThe number of pages to free.
[in]IsGuardedIs the memory to free guarded or not.
Return values
EFI_NOT_FOUNDCould not find the entry that covers the range.
EFI_INVALID_PARAMETERAddress not aligned, Address is zero or NumberOfPages is zero.
Returns
EFI_SUCCESS Pages successfully freed.

Definition at line 873 of file Page.c.

◆ SmmInternalFreePagesEx()

EFI_STATUS SmmInternalFreePagesEx ( IN EFI_PHYSICAL_ADDRESS  Memory,
IN UINTN  NumberOfPages,
IN BOOLEAN  AddRegion 
)

Frees previous allocated pages.

Parameters
[in]MemoryBase address of memory being freed.
[in]NumberOfPagesThe number of pages to free.
[in]AddRegionIf this memory is new added region.
Return values
EFI_NOT_FOUNDCould not find the entry that covers the range.
EFI_INVALID_PARAMETERAddress not aligned, Address is zero or NumberOfPages is zero.
Returns
EFI_SUCCESS Pages successfully freed.

Definition at line 797 of file Page.c.

◆ SmmInternalFreePool()

EFI_STATUS EFIAPI SmmInternalFreePool ( IN VOID *  Buffer)

Frees pool.

Parameters
BufferThe allocated pool entry to free
Return values
EFI_INVALID_PARAMETERBuffer is not a valid value.
EFI_SUCCESSPool successfully freed.

Frees pool.

Parameters
BufferThe allocated pool entry to free.
Return values
EFI_INVALID_PARAMETERBuffer is not a valid value.
EFI_SUCCESSPool successfully freed.

Definition at line 372 of file Pool.c.

◆ SmmIsSchedulable()

BOOLEAN SmmIsSchedulable ( IN EFI_SMM_DRIVER_ENTRY DriverEntry)

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 routine in this case. POSTFIX means all the math is done on top of the stack.

Parameters
DriverEntryDriverEntry element to update.
Return values
TRUEIf driver is ready to run.
FALSEIf driver is not ready to run or some fatal error was found.

Definition at line 168 of file Dependency.c.

◆ SmmLegacyBootHandler()

EFI_STATUS EFIAPI SmmLegacyBootHandler ( IN EFI_HANDLE  DispatchHandle,
IN CONST VOID *Context  OPTIONAL,
IN OUT VOID *CommBuffer  OPTIONAL,
IN OUT UINTN *CommBufferSize  OPTIONAL 
)

This function is the main entry point for an SMM handler dispatch or communicate-based callback.

Parameters
DispatchHandleThe unique handle assigned to this handler by SmiHandlerRegister().
ContextPoints to an optional handler context which was specified when the handler was registered.
CommBufferA pointer to a collection of data in memory that will be conveyed from a non-SMM environment into an SMM environment.
CommBufferSizeThe size of the CommBuffer.
Returns
Status Code

Software SMI handler that is called when a Legacy Boot event is signalled. The SMM Core uses this signal to know that a Legacy Boot has been performed and that gSmmCorePrivate that is shared between the UEFI and SMM execution environments can not be accessed from SMM anymore since that structure is considered free memory by a legacy OS. Then the SMM Core also install SMM Legacy Boot protocol to notify SMM driver that system enter legacy boot.

Parameters
DispatchHandleThe unique handle assigned to this handler by SmiHandlerRegister().
ContextPoints to an optional handler context which was specified when the handler was registered.
CommBufferA pointer to a collection of data in memory that will be conveyed from a non-SMM environment into an SMM environment.
CommBufferSizeThe size of the CommBuffer.
Returns
Status Code

Definition at line 159 of file PiSmmCore.c.

◆ SmmLocateHandle()

EFI_STATUS EFIAPI SmmLocateHandle ( 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 requested handle(s) and returns them in Buffer.

Parameters
SearchTypeThe type of search to perform to locate the handles
ProtocolThe protocol to search for
SearchKeyDependant on SearchType
BufferSizeOn input the size of Buffer. On output the size of data returned.
BufferThe buffer to return the results in
Return values
EFI_BUFFER_TOO_SMALLBuffer too small, required buffer size is returned in BufferSize.
EFI_INVALID_PARAMETERInvalid parameter
EFI_SUCCESSSuccessfully found the requested handle(s) and returns them in Buffer.

Definition at line 271 of file Locate.c.

◆ SmmLocateHandleBuffer()

EFI_STATUS EFIAPI SmmLocateHandleBuffer ( IN EFI_LOCATE_SEARCH_TYPE  SearchType,
IN EFI_GUID *Protocol  OPTIONAL,
IN VOID *SearchKey  OPTIONAL,
IN OUT UINTN NumberHandles,
OUT EFI_HANDLE **  Buffer 
)

Function returns an array of handles that support the requested protocol in a buffer allocated from pool. This is a version of SmmLocateHandle() that allocates a buffer for the caller.

Parameters
SearchTypeSpecifies which handle(s) are to be returned.
ProtocolProvides the protocol to search by. This parameter is only valid for SearchType ByProtocol.
SearchKeySupplies the search key depending on the SearchType.
NumberHandlesThe number of handles returned in Buffer.
BufferA pointer to the buffer to return the requested array of handles that support Protocol.
Return values
EFI_SUCCESSThe result array of handles was returned.
EFI_NOT_FOUNDNo handles match the search.
EFI_OUT_OF_RESOURCESThere is not enough pool memory to store the matching results.
EFI_INVALID_PARAMETEROne or more parameters are not valid.

Definition at line 435 of file Locate.c.

◆ SmmLocateProtocol()

EFI_STATUS EFIAPI SmmLocateProtocol ( IN EFI_GUID Protocol,
IN VOID *Registration  OPTIONAL,
OUT VOID **  Interface 
)

Return the first Protocol Interface that matches the Protocol GUID. If Registration is pasased in return a Protocol Instance that was just add to the system. If Registration is NULL return the first Protocol Interface you find.

Parameters
ProtocolThe protocol to search for
RegistrationOptional Registration Key returned from RegisterProtocolNotify()
InterfaceReturn the Protocol interface (instance).
Return values
EFI_SUCCESSIf a valid Interface is returned
EFI_INVALID_PARAMETERInvalid parameter
EFI_NOT_FOUNDProtocol interface not found

Definition at line 194 of file Locate.c.

◆ SmmNotifyProtocol()

VOID SmmNotifyProtocol ( IN PROTOCOL_INTERFACE Prot)

Signal event for every protocol in protocol entry.

Parameters
ProtProtocol interface

Definition at line 18 of file Notify.c.

◆ SmmReadyToBootHandler()

EFI_STATUS EFIAPI SmmReadyToBootHandler ( IN EFI_HANDLE  DispatchHandle,
IN CONST VOID *Context  OPTIONAL,
IN OUT VOID *CommBuffer  OPTIONAL,
IN OUT UINTN *CommBufferSize  OPTIONAL 
)

This function is the main entry point for an SMM handler dispatch or communicate-based callback.

Parameters
DispatchHandleThe unique handle assigned to this handler by SmiHandlerRegister().
ContextPoints to an optional handler context which was specified when the handler was registered.
CommBufferA pointer to a collection of data in memory that will be conveyed from a non-SMM environment into an SMM environment.
CommBufferSizeThe size of the CommBuffer.
Returns
Status Code

Software SMI handler that is called when an Ready To Boot event is signalled. Then the SMM Core also install SMM Ready To Boot protocol to notify SMM driver that system enter ready to boot.

Parameters
DispatchHandleThe unique handle assigned to this handler by SmiHandlerRegister().
ContextPoints to an optional handler context which was specified when the handler was registered.
CommBufferA pointer to a collection of data in memory that will be conveyed from a non-SMM environment into an SMM environment.
CommBufferSizeThe size of the CommBuffer.
Returns
Status Code

Definition at line 298 of file PiSmmCore.c.

◆ SmmReadyToLockHandler()

EFI_STATUS EFIAPI SmmReadyToLockHandler ( IN EFI_HANDLE  DispatchHandle,
IN CONST VOID *Context  OPTIONAL,
IN OUT VOID *CommBuffer  OPTIONAL,
IN OUT UINTN *CommBufferSize  OPTIONAL 
)

This function is the main entry point for an SMM handler dispatch or communicate-based callback.

Parameters
DispatchHandleThe unique handle assigned to this handler by SmiHandlerRegister().
ContextPoints to an optional handler context which was specified when the handler was registered.
CommBufferA pointer to a collection of data in memory that will be conveyed from a non-SMM environment into an SMM environment.
CommBufferSizeThe size of the CommBuffer.
Returns
Status Code

Software SMI handler that is called when the DxeSmmReadyToLock protocol is added or if gEfiEventReadyToBootGuid is signalled. This function unregisters the Software SMIs that are nor required after SMRAM is locked and installs the SMM Ready To Lock Protocol so SMM Drivers are informed that SMRAM is about to be locked. It also verifies the SMM CPU I/O 2 Protocol has been installed and NULLs gBS and gST because they can not longer be used after SMRAM is locked.

Parameters
DispatchHandleThe unique handle assigned to this handler by SmiHandlerRegister().
ContextPoints to an optional handler context which was specified when the handler was registered.
CommBufferA pointer to a collection of data in memory that will be conveyed from a non-SMM environment into an SMM environment.
CommBufferSizeThe size of the CommBuffer.
Returns
Status Code

Definition at line 346 of file PiSmmCore.c.

◆ SmmRegisterProtocolNotify()

EFI_STATUS EFIAPI SmmRegisterProtocolNotify ( IN CONST EFI_GUID Protocol,
IN EFI_SMM_NOTIFY_FN  Function,
OUT VOID **  Registration 
)

Add a new protocol notification record for the request protocol.

Parameters
ProtocolThe requested protocol to add the notify registration
FunctionPoints to the notification function
RegistrationReturns the registration record
Return values
EFI_INVALID_PARAMETERInvalid parameter
EFI_SUCCESSSuccessfully returned the registration record that has been added

Add a new protocol notification record for the request protocol.

Parameters
ProtocolThe requested protocol to add the notify registration
FunctionPoints to the notification function
RegistrationReturns the registration record
Return values
EFI_SUCCESSSuccessfully returned the registration record that has been added or unhooked
EFI_INVALID_PARAMETERProtocol is NULL or Registration is NULL
EFI_OUT_OF_RESOURCESNot enough memory resource to finish the request
EFI_NOT_FOUNDIf the registration is not found when Function == NULL

Definition at line 96 of file Notify.c.

◆ SmmRemoveInterfaceFromProtocol()

PROTOCOL_INTERFACE * SmmRemoveInterfaceFromProtocol ( IN IHANDLE Handle,
IN EFI_GUID Protocol,
IN VOID *  Interface 
)

Removes Protocol from the protocol list (but not the handle list).

Parameters
HandleThe handle to remove protocol on.
ProtocolGUID of the protocol to be moved
InterfaceThe interface of the protocol
Returns
Protocol Entry

Definition at line 44 of file Notify.c.

◆ SmmS3SmmInitDoneHandler()

EFI_STATUS EFIAPI SmmS3SmmInitDoneHandler ( IN EFI_HANDLE  DispatchHandle,
IN CONST VOID *Context  OPTIONAL,
IN OUT VOID *CommBuffer  OPTIONAL,
IN OUT UINTN *CommBufferSize  OPTIONAL 
)

Software SMI handler that is called when the S3SmmInitDone signal is triggered. This function installs the SMM S3SmmInitDone Protocol so SMM Drivers are informed that S3 SMM initialization has been done.

Parameters
DispatchHandleThe unique handle assigned to this handler by SmiHandlerRegister().
ContextPoints to an optional handler context which was specified when the handler was registered.
CommBufferA pointer to a collection of data in memory that will be conveyed from a non-SMM environment into an SMM environment.
CommBufferSizeThe size of the CommBuffer.
Returns
Status Code

Definition at line 510 of file PiSmmCore.c.

◆ SmmUninstallProtocolInterface()

EFI_STATUS EFIAPI SmmUninstallProtocolInterface ( IN EFI_HANDLE  UserHandle,
IN EFI_GUID Protocol,
IN VOID *  Interface 
)

Uninstalls all instances of a protocol:interfacer from a handle. If the last protocol interface is remove from the handle, the handle is freed.

Parameters
UserHandleThe handle to remove the protocol handler from
ProtocolThe protocol, of protocol:interface, to remove
InterfaceThe interface, of protocol:interface, to remove
Return values
EFI_INVALID_PARAMETERProtocol is NULL.
EFI_SUCCESSProtocol interface successfully uninstalled.

Definition at line 366 of file Handle.c.

◆ SmramProfileInit()

VOID SmramProfileInit ( VOID  )

Initialize SMRAM profile.

Definition at line 647 of file SmramProfileRecord.c.

◆ SmramProfileInstallProtocol()

VOID SmramProfileInstallProtocol ( VOID  )

Install SMRAM profile protocol.

Definition at line 690 of file SmramProfileRecord.c.

◆ SmramProfileReadyToLock()

VOID SmramProfileReadyToLock ( VOID  )

SMRAM profile ready to lock callback function.

Definition at line 1550 of file SmramProfileRecord.c.

◆ UnregisterSmramProfileImage()

EFI_STATUS UnregisterSmramProfileImage ( IN EFI_SMM_DRIVER_ENTRY DriverEntry,
IN BOOLEAN  UnregisterFromDxe 
)

Unregister image from SMRAM profile.

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

Unregister image from SMRAM profile.

Parameters
DriverEntrySMM image info.
UnregisterFromDxeUnregister image from DXE.
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 911 of file SmramProfileRecord.c.

Variable Documentation

◆ gHandleList

LIST_ENTRY gHandleList
extern

Definition at line 19 of file Handle.c.

◆ gLoadModuleAtFixAddressSmramBase

EFI_PHYSICAL_ADDRESS gLoadModuleAtFixAddressSmramBase
extern

Definition at line 16 of file Pool.c.

◆ gSmmCorePrivate

SMM_CORE_PRIVATE_DATA* gSmmCorePrivate
extern

Definition at line 14 of file PiSmmCore.c.

◆ gSmmCoreSmst

EFI_SMM_SYSTEM_TABLE2 gSmmCoreSmst
extern

Definition at line 19 of file PiSmmCore.c.

◆ mFullSmramRangeCount

UINTN mFullSmramRangeCount
extern

Definition at line 102 of file PiSmmCore.c.

◆ mFullSmramRanges

EFI_SMRAM_DESCRIPTOR* mFullSmramRanges
extern

Definition at line 103 of file PiSmmCore.c.

◆ mSmmCoreDriverEntry

EFI_SMM_DRIVER_ENTRY* mSmmCoreDriverEntry
extern

Definition at line 105 of file PiSmmCore.c.

◆ mSmmCoreLoadedImage

EFI_LOADED_IMAGE_PROTOCOL* mSmmCoreLoadedImage
extern

Definition at line 107 of file PiSmmCore.c.

◆ mSmmMemoryMap

LIST_ENTRY mSmmMemoryMap
extern

Definition at line 14 of file Page.c.

◆ mSmmPoolLists

LIST_ENTRY mSmmPoolLists[SmmPoolTypeMax][MAX_POOL_INDEX]
extern

Definition at line 11 of file Pool.c.