2011-02-11 01:09:16 +01:00
|
|
|
/** @file
|
|
|
|
Provides services to enable and disable periodic SMI handlers.
|
|
|
|
|
2018-06-27 15:11:33 +02:00
|
|
|
Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
|
2011-02-11 01:09:16 +01:00
|
|
|
This program and the accompanying materials
|
|
|
|
are licensed and made available under the terms and conditions of the BSD License
|
|
|
|
which accompanies this distribution. The full text of the license may be found at
|
|
|
|
http://opensource.org/licenses/bsd-license.php
|
|
|
|
|
|
|
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|
|
|
|
|
|
|
**/
|
|
|
|
|
|
|
|
#ifndef __PERIODIC_SMI_LIB_H__
|
|
|
|
#define __PERIODIC_SMI_LIB_H__
|
|
|
|
|
|
|
|
#define PERIODIC_SMI_LIBRARY_ANY_CPU 0xffffffff
|
|
|
|
|
|
|
|
/**
|
|
|
|
This function returns a pointer to a table of supported periodic
|
2018-06-27 15:11:33 +02:00
|
|
|
SMI tick periods in 100 ns units sorted from largest to smallest.
|
|
|
|
The table contains a array of UINT64 values terminated by a tick
|
2011-02-11 01:09:16 +01:00
|
|
|
period value of 0. The returned table must be treated as read-only
|
|
|
|
data and must not be freed.
|
2018-06-27 15:11:33 +02:00
|
|
|
|
|
|
|
@return A pointer to a table of UINT64 tick period values in
|
|
|
|
100ns units sorted from largest to smallest terminated
|
2011-02-11 01:09:16 +01:00
|
|
|
by a tick period of 0.
|
2018-06-27 15:11:33 +02:00
|
|
|
|
2011-02-11 01:09:16 +01:00
|
|
|
**/
|
|
|
|
UINT64 *
|
|
|
|
EFIAPI
|
|
|
|
PeriodicSmiSupportedTickPeriod (
|
|
|
|
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.
|
|
|
|
|
|
|
|
@return 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.
|
|
|
|
|
|
|
|
**/
|
|
|
|
UINT64
|
|
|
|
EFIAPI
|
|
|
|
PeriodicSmiExecutionTime (
|
|
|
|
VOID
|
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
2018-06-27 15:11:33 +02:00
|
|
|
This function returns control back to the SMM Foundation. When the next
|
2011-02-11 01:09:16 +01:00
|
|
|
periodic SMI for the currently executing handler is triggered, the periodic
|
|
|
|
SMI handler will restarted from its registered DispatchFunction entry point.
|
2018-06-27 15:11:33 +02:00
|
|
|
If this function is not called from within an enabled periodic SMI handler,
|
2011-02-11 01:09:16 +01:00
|
|
|
then control is returned to the calling function.
|
|
|
|
|
|
|
|
**/
|
|
|
|
VOID
|
2018-06-27 15:11:33 +02:00
|
|
|
EFIAPI
|
2011-02-11 01:09:16 +01:00
|
|
|
PeriodicSmiExit (
|
|
|
|
VOID
|
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
2018-06-27 15:11:33 +02:00
|
|
|
This function yields control back to the SMM Foundation. When the next
|
2011-02-11 01:09:16 +01:00
|
|
|
periodic SMI for the currently executing handler is triggered, the periodic
|
2018-06-27 15:11:33 +02:00
|
|
|
SMI handler will be resumed and this function will return. Use of this
|
2011-02-11 01:09:16 +01:00
|
|
|
function requires a seperate stack for the periodic SMI handler. A non zero
|
2018-06-27 15:11:33 +02:00
|
|
|
stack size must be specified in PeriodicSmiEnable() for this function to be
|
|
|
|
used.
|
|
|
|
|
2011-02-11 01:09:16 +01:00
|
|
|
If the stack size passed into PeriodicSmiEnable() was zero, the 0 is returned.
|
2018-06-27 15:11:33 +02:00
|
|
|
|
|
|
|
If this function is not called from within an enabled periodic SMI handler,
|
2011-02-11 01:09:16 +01:00
|
|
|
then 0 is returned.
|
|
|
|
|
2016-10-19 09:01:27 +02:00
|
|
|
@return The actual time in 100ns units elapsed since this function was
|
2011-02-11 01:09:16 +01:00
|
|
|
called. A value of 0 indicates an unknown amount of time.
|
|
|
|
|
|
|
|
**/
|
|
|
|
UINT64
|
2018-06-27 15:11:33 +02:00
|
|
|
EFIAPI
|
2011-02-11 01:09:16 +01:00
|
|
|
PeriodicSmiYield (
|
|
|
|
VOID
|
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
2018-06-27 15:11:33 +02:00
|
|
|
This function is a prototype for a periodic SMI handler function
|
2011-02-11 01:09:16 +01:00
|
|
|
that may be enabled with PeriodicSmiEnable() and disabled with
|
|
|
|
PeriodicSmiDisable().
|
|
|
|
|
|
|
|
@param[in] Context Content registered with PeriodicSmiEnable().
|
2016-10-19 09:01:27 +02:00
|
|
|
@param[in] ElapsedTime The actual time in 100ns units elapsed since
|
2018-06-27 15:11:33 +02:00
|
|
|
this function was called. A value of 0 indicates
|
2011-02-11 01:09:16 +01:00
|
|
|
an unknown amount of time.
|
2018-06-27 15:11:33 +02:00
|
|
|
|
2011-02-11 01:09:16 +01:00
|
|
|
**/
|
|
|
|
typedef
|
|
|
|
VOID
|
|
|
|
(EFIAPI *PERIODIC_SMI_LIBRARY_HANDLER) (
|
|
|
|
IN CONST VOID *Context OPTIONAL,
|
|
|
|
IN UINT64 ElapsedTime
|
|
|
|
);
|
2018-06-27 15:11:33 +02:00
|
|
|
|
2011-02-11 01:09:16 +01:00
|
|
|
/**
|
|
|
|
This function enables a periodic SMI handler.
|
2018-06-27 15:11:33 +02:00
|
|
|
|
|
|
|
@param[in, out] DispatchHandle A 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
|
2011-02-11 01:09:16 +01:00
|
|
|
never be disabled.
|
|
|
|
@param[in] DispatchFunction A pointer to a periodic SMI handler function.
|
|
|
|
@param[in] Context Optional content to pass into DispatchFunction.
|
2018-06-27 15:11:33 +02:00
|
|
|
@param[in] TickPeriod The requested tick period in 100ns units that
|
2011-02-11 01:09:16 +01:00
|
|
|
control should be givien to the periodic SMI
|
|
|
|
handler. Must be one of the supported values
|
|
|
|
returned by PeriodicSmiSupportedPickPeriod().
|
|
|
|
@param[in] Cpu Specifies the CPU that is required to execute
|
2018-06-27 15:11:33 +02:00
|
|
|
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
|
2011-02-11 01:09:16 +01:00
|
|
|
NumberOfCpus, then the periodic SMI will always
|
|
|
|
be executed on the requested CPU.
|
|
|
|
@param[in] StackSize The size, in bytes, of the stack to allocate for
|
|
|
|
use by the periodic SMI handler. If 0, then the
|
|
|
|
default stack will be used.
|
2018-06-27 15:11:33 +02:00
|
|
|
|
2011-02-11 01:09:16 +01:00
|
|
|
@retval EFI_INVALID_PARAMETER DispatchFunction is NULL.
|
2018-06-27 15:11:33 +02:00
|
|
|
@retval EFI_UNSUPPORTED TickPeriod is not a supported tick period. The
|
|
|
|
supported tick periods can be retrieved using
|
2011-02-11 01:09:16 +01:00
|
|
|
PeriodicSmiSupportedTickPeriod().
|
2018-06-27 15:11:33 +02:00
|
|
|
@retval EFI_INVALID_PARAMETER Cpu is not PERIODIC_SMI_LIBRARY_ANY_CPU or in
|
2011-02-11 01:09:16 +01:00
|
|
|
the range 0 to SMST NumberOfCpus.
|
2018-06-27 15:11:33 +02:00
|
|
|
@retval EFI_OUT_OF_RESOURCES There are not enough resources to enable the
|
2011-02-11 01:09:16 +01:00
|
|
|
periodic SMI handler.
|
2018-06-27 15:11:33 +02:00
|
|
|
@retval EFI_OUT_OF_RESOURCES There are not enough resources to allocate the
|
2011-02-11 01:09:16 +01:00
|
|
|
stack speficied by StackSize.
|
|
|
|
@retval EFI_SUCCESS The periodic SMI handler was enabled.
|
2018-06-27 15:11:33 +02:00
|
|
|
|
2011-02-11 01:09:16 +01:00
|
|
|
**/
|
2018-06-27 15:11:33 +02:00
|
|
|
EFI_STATUS
|
2011-02-11 01:09:16 +01:00
|
|
|
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 disables a periodic SMI handler that has been previously
|
|
|
|
enabled with PeriodicSmiEnable().
|
2018-06-27 15:11:33 +02:00
|
|
|
|
|
|
|
@param[in] DispatchHandle A handle associated with a previously enabled periodic
|
2011-02-11 01:09:16 +01:00
|
|
|
SMI handler. This is an optional parameter that may
|
|
|
|
be NULL. If it is NULL, then the active periodic SMI
|
|
|
|
handlers is disabled.
|
|
|
|
|
|
|
|
@retval FALSE DispatchHandle is NULL and there is no active periodic SMI handler.
|
2018-06-27 15:11:33 +02:00
|
|
|
@retval FALSE The periodic SMI handler specified by DispatchHandle has
|
2011-02-11 01:09:16 +01:00
|
|
|
not been enabled with PeriodicSmiEnable().
|
2018-06-27 15:11:33 +02:00
|
|
|
@retval TRUE The periodic SMI handler specified by DispatchHandle has
|
2011-02-11 01:09:16 +01:00
|
|
|
been disabled. If DispatchHandle is NULL, then the active
|
|
|
|
periodic SMI handler has been disabled.
|
2018-06-27 15:11:33 +02:00
|
|
|
|
2011-02-11 01:09:16 +01:00
|
|
|
**/
|
2018-06-27 15:11:33 +02:00
|
|
|
BOOLEAN
|
2011-02-11 01:09:16 +01:00
|
|
|
EFIAPI
|
|
|
|
PeriodicSmiDisable (
|
|
|
|
IN EFI_HANDLE DispatchHandle OPTIONAL
|
|
|
|
);
|
2018-06-27 15:11:33 +02:00
|
|
|
|
2011-02-11 01:09:16 +01:00
|
|
|
#endif
|