TianoCore EDK2 master
Loading...
Searching...
No Matches
SmmPeriodicSmiLib.h File Reference

Go to the source code of this file.

Macros

#define PERIODIC_SMI_LIBRARY_ANY_CPU   0xffffffff
 

Typedefs

typedef VOID(EFIAPI * PERIODIC_SMI_LIBRARY_HANDLER) (IN CONST VOID *Context OPTIONAL, IN UINT64 ElapsedTime)
 

Functions

UINT64 *EFIAPI PeriodicSmiSupportedTickPeriod (VOID)
 
UINT64 EFIAPI PeriodicSmiExecutionTime (VOID)
 
VOID EFIAPI PeriodicSmiExit (VOID)
 
UINT64 EFIAPI PeriodicSmiYield (VOID)
 
EFI_STATUS EFIAPI PeriodicSmiEnable (IN OUT EFI_HANDLE *DispatchHandle OPTIONAL, IN PERIODIC_SMI_LIBRARY_HANDLER DispatchFunction, IN CONST VOID *Context OPTIONAL, IN UINT64 TickPeriod, IN UINTN Cpu, IN UINTN StackSize)
 
BOOLEAN EFIAPI PeriodicSmiDisable (IN EFI_HANDLE DispatchHandle OPTIONAL)
 

Detailed Description

Provides services to enable and disable periodic SMI handlers.

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

Definition in file SmmPeriodicSmiLib.h.

Macro Definition Documentation

◆ PERIODIC_SMI_LIBRARY_ANY_CPU

#define PERIODIC_SMI_LIBRARY_ANY_CPU   0xffffffff

Definition at line 12 of file SmmPeriodicSmiLib.h.

Typedef Documentation

◆ PERIODIC_SMI_LIBRARY_HANDLER

typedef VOID(EFIAPI * PERIODIC_SMI_LIBRARY_HANDLER) (IN CONST VOID *Context OPTIONAL, IN UINT64 ElapsedTime)

This function is a prototype for a periodic SMI handler function that may be enabled with PeriodicSmiEnable() and disabled with PeriodicSmiDisable().

Parameters
[in]ContextContent registered with PeriodicSmiEnable().
[in]ElapsedTimeThe actual time in 100ns units elapsed since this function was called. A value of 0 indicates an unknown amount of time.

Definition at line 98 of file SmmPeriodicSmiLib.h.

Function Documentation

◆ PeriodicSmiDisable()

BOOLEAN EFIAPI PeriodicSmiDisable ( IN EFI_HANDLE DispatchHandle  OPTIONAL)

This function disables a periodic SMI handler that has been previously enabled with PeriodicSmiEnable().

Parameters
[in]DispatchHandleA handle associated with a previously enabled periodic SMI handler. This is an optional parameter that may be NULL. If it is NULL, then the active periodic SMI handlers is disabled.
Return values
FALSEDispatchHandle is NULL and there is no active periodic SMI handler.
FALSEThe periodic SMI handler specified by DispatchHandle has not been enabled with PeriodicSmiEnable().
TRUEThe periodic SMI handler specified by DispatchHandle has been disabled. If DispatchHandle is NULL, then the active periodic SMI handler has been disabled.

Definition at line 1015 of file SmmPeriodicSmiLib.c.

◆ PeriodicSmiEnable()

EFI_STATUS EFIAPI PeriodicSmiEnable ( IN OUT EFI_HANDLE *DispatchHandle  OPTIONAL,
IN PERIODIC_SMI_LIBRARY_HANDLER  DispatchFunction,
IN CONST VOID *Context  OPTIONAL,
IN UINT64  TickPeriod,
IN UINTN  Cpu,
IN UINTN  StackSize 
)

This function enables a periodic SMI handler.

Parameters
[in,out]DispatchHandleA pointer to the handle associated with the enabled periodic SMI handler. This is an optional parameter that may be NULL. If it is NULL, then the handle will not be returned, which means that the periodic SMI handler can never be disabled.
[in]DispatchFunctionA pointer to a periodic SMI handler function.
[in]ContextOptional content to pass into DispatchFunction.
[in]TickPeriodThe requested tick period in 100ns units that control should be given to the periodic SMI handler. Must be one of the supported values returned by PeriodicSmiSupportedPickPeriod().
[in]CpuSpecifies the CPU that is required to execute the periodic SMI handler. If Cpu is PERIODIC_SMI_LIBRARY_ANY_CPU, then the periodic SMI handler will always be executed on the SMST CurrentlyExecutingCpu, which may vary across periodic SMIs. If Cpu is between 0 and the SMST NumberOfCpus, then the periodic SMI will always be executed on the requested CPU.
[in]StackSizeThe size, in bytes, of the stack to allocate for use by the periodic SMI handler. If 0, then the default stack will be used.
Return values
EFI_INVALID_PARAMETERDispatchFunction is NULL.
EFI_UNSUPPORTEDTickPeriod is not a supported tick period. The supported tick periods can be retrieved using PeriodicSmiSupportedTickPeriod().
EFI_INVALID_PARAMETERCpu is not PERIODIC_SMI_LIBRARY_ANY_CPU or in the range 0 to SMST NumberOfCpus.
EFI_OUT_OF_RESOURCESThere are not enough resources to enable the periodic SMI handler.
EFI_OUT_OF_RESOURCESThere are not enough resources to allocate the stack specified by StackSize.
EFI_SUCCESSThe periodic SMI handler was enabled.

Definition at line 905 of file SmmPeriodicSmiLib.c.

◆ PeriodicSmiExecutionTime()

UINT64 EFIAPI PeriodicSmiExecutionTime ( VOID  )

This function returns the time in 100ns units since the periodic SMI handler function was called. If the periodic SMI handler was resumed through PeriodicSmiYield(), then the time returned is the time in 100ns units since PeriodicSmiYield() returned.

Returns
The actual time in 100ns units that the periodic SMI handler has been executing. If this function is not called from within an enabled periodic SMI handler, then 0 is returned.

Definition at line 422 of file SmmPeriodicSmiLib.c.

◆ PeriodicSmiExit()

VOID EFIAPI PeriodicSmiExit ( VOID  )

This function returns control back to the SMM Foundation. When the next periodic SMI for the currently executing handler is triggered, the periodic SMI handler will restarted from its registered DispatchFunction entry point. If this function is not called from within an enabled periodic SMI handler, then control is returned to the calling function.

Definition at line 498 of file SmmPeriodicSmiLib.c.

◆ PeriodicSmiSupportedTickPeriod()

UINT64 *EFIAPI PeriodicSmiSupportedTickPeriod ( VOID  )

This function returns a pointer to a table of supported periodic SMI tick periods in 100 ns units sorted from largest to smallest. The table contains a array of UINT64 values terminated by a tick period value of 0. The returned table must be treated as read-only data and must not be freed.

Returns
A pointer to a table of UINT64 tick period values in 100ns units sorted from largest to smallest terminated by a tick period of 0.

Definition at line 399 of file SmmPeriodicSmiLib.c.

◆ PeriodicSmiYield()

UINT64 EFIAPI PeriodicSmiYield ( VOID  )

This function yields control back to the SMM Foundation. When the next periodic SMI for the currently executing handler is triggered, the periodic SMI handler will be resumed and this function will return. Use of this function requires a separate stack for the periodic SMI handler. A non zero stack size must be specified in PeriodicSmiEnable() for this function to be used.

If the stack size passed into PeriodicSmiEnable() was zero, the 0 is returned.

If this function is not called from within an enabled periodic SMI handler, then 0 is returned.

Returns
The actual time in 100ns units elapsed since this function was called. A value of 0 indicates an unknown amount of time.

Definition at line 544 of file SmmPeriodicSmiLib.c.