mirror of https://github.com/acidanthera/audk.git
Add SmmPeriodicSmiLib to MdePkg.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11302 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
784ce12727
commit
40039e28ed
|
@ -0,0 +1,184 @@
|
|||
/** @file
|
||||
Provides services to enable and disable periodic SMI handlers.
|
||||
|
||||
Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
|
||||
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
|
||||
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.
|
||||
|
||||
@return 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.
|
||||
|
||||
**/
|
||||
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
|
||||
);
|
||||
|
||||
/**
|
||||
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.
|
||||
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
PeriodicSmiExit (
|
||||
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 seperate 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.
|
||||
|
||||
@return The actual time in 100ns units elasped since this function was
|
||||
called. A value of 0 indicates an unknown amount of time.
|
||||
|
||||
**/
|
||||
UINT64
|
||||
EFIAPI
|
||||
PeriodicSmiYield (
|
||||
VOID
|
||||
);
|
||||
|
||||
/**
|
||||
This function is a prototype for a periodic SMI handler function
|
||||
that may be enabled with PeriodicSmiEnable() and disabled with
|
||||
PeriodicSmiDisable().
|
||||
|
||||
@param[in] Context Content registered with PeriodicSmiEnable().
|
||||
@param[in] ElapsedTime The actual time in 100ns units elasped since
|
||||
this function was called. A value of 0 indicates
|
||||
an unknown amount of time.
|
||||
|
||||
**/
|
||||
typedef
|
||||
VOID
|
||||
(EFIAPI *PERIODIC_SMI_LIBRARY_HANDLER) (
|
||||
IN CONST VOID *Context OPTIONAL,
|
||||
IN UINT64 ElapsedTime
|
||||
);
|
||||
|
||||
/**
|
||||
This function enables a periodic SMI handler.
|
||||
|
||||
@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
|
||||
never be disabled.
|
||||
@param[in] DispatchFunction A pointer to a periodic SMI handler function.
|
||||
@param[in] Context Optional content to pass into DispatchFunction.
|
||||
@param[in] TickPeriod The requested tick period in 100ns units that
|
||||
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
|
||||
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.
|
||||
@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.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER DispatchFunction is NULL.
|
||||
@retval EFI_UNSUPPORTED TickPeriod is not a supported tick period. The
|
||||
supported tick periods can be retrieved using
|
||||
PeriodicSmiSupportedTickPeriod().
|
||||
@retval EFI_INVALID_PARAMETER Cpu is not PERIODIC_SMI_LIBRARY_ANY_CPU or in
|
||||
the range 0 to SMST NumberOfCpus.
|
||||
@retval EFI_OUT_OF_RESOURCES There are not enough resources to enable the
|
||||
periodic SMI handler.
|
||||
@retval EFI_OUT_OF_RESOURCES There are not enough resources to allocate the
|
||||
stack speficied by StackSize.
|
||||
@retval EFI_SUCCESS The periodic SMI handler was enabled.
|
||||
|
||||
**/
|
||||
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 disables a periodic SMI handler that has been previously
|
||||
enabled with PeriodicSmiEnable().
|
||||
|
||||
@param[in] DispatchHandle A 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.
|
||||
|
||||
@retval FALSE DispatchHandle is NULL and there is no active periodic SMI handler.
|
||||
@retval FALSE The periodic SMI handler specified by DispatchHandle has
|
||||
not been enabled with PeriodicSmiEnable().
|
||||
@retval TRUE The periodic SMI handler specified by DispatchHandle has
|
||||
been disabled. If DispatchHandle is NULL, then the active
|
||||
periodic SMI handler has been disabled.
|
||||
|
||||
**/
|
||||
BOOLEAN
|
||||
EFIAPI
|
||||
PeriodicSmiDisable (
|
||||
IN EFI_HANDLE DispatchHandle OPTIONAL
|
||||
);
|
||||
|
||||
#endif
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,50 @@
|
|||
## @file
|
||||
# SMM Periodic SMI Library.
|
||||
#
|
||||
# Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
#
|
||||
##
|
||||
|
||||
[Defines]
|
||||
INF_VERSION = 0x00010005
|
||||
BASE_NAME = SmmPeriodicSmiLib
|
||||
FILE_GUID = AED5F3FB-4CFF-4b60-9E43-1541B55C8267
|
||||
MODULE_TYPE = DXE_SMM_DRIVER
|
||||
VERSION_STRING = 1.0
|
||||
LIBRARY_CLASS = SmmPeriodicSmiLib|DXE_SMM_DRIVER
|
||||
PI_SPECIFICATION_VERSION = 0x0001000A
|
||||
CONSTRUCTOR = SmmPeriodicSmiLibConstructor
|
||||
DESTRUCTOR = SmmPeriodicSmiLibDestructor
|
||||
|
||||
#
|
||||
# VALID_ARCHITECTURES = IA32 X64
|
||||
#
|
||||
|
||||
[Sources]
|
||||
SmmPeriodicSmiLib.c
|
||||
|
||||
[Packages]
|
||||
MdePkg/MdePkg.dec
|
||||
|
||||
[LibraryClasses]
|
||||
BaseLib
|
||||
BaseMemoryLib
|
||||
SynchronizationLib
|
||||
DebugLib
|
||||
TimerLib
|
||||
MemoryAllocationLib
|
||||
SmmServicesTableLib
|
||||
|
||||
[Protocols]
|
||||
gEfiSmmPeriodicTimerDispatch2ProtocolGuid
|
||||
|
||||
[Depex]
|
||||
gEfiSmmPeriodicTimerDispatch2ProtocolGuid
|
|
@ -5,7 +5,7 @@
|
|||
# It also provides the definitions(including PPIs/PROTOCOLs/GUIDs) of
|
||||
# EFI1.10/UEFI2.3/PI1.2 and some Industry Standards.
|
||||
#
|
||||
# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
|
||||
# Copyright (c) 2007 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||
# Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
|
||||
#
|
||||
# This program and the accompanying materials are licensed and made available under
|
||||
|
@ -200,6 +200,10 @@
|
|||
# Only available to SMM/DXE Combined and SMM module types.
|
||||
SmmServicesTableLib|Include/Library/SmmServicesTableLib.h
|
||||
|
||||
## @libraryclass Provides services to enable/disable periodic SMI handlers.
|
||||
#
|
||||
SmmPeriodicSmiLib|Include/Library/SmmPeriodicSmiLib.h
|
||||
|
||||
[LibraryClasses.IPF]
|
||||
## @libraryclass The SAL Library provides a service to make a SAL CALL.
|
||||
SalLib|Include/Library/SalLib.h
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
## @file
|
||||
# EFI/PI MdePkg Package
|
||||
#
|
||||
# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
|
||||
# Copyright (c) 2007 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||
# Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
|
||||
#
|
||||
# This program and the accompanying materials
|
||||
|
@ -139,6 +139,7 @@
|
|||
MdePkg/Library/SmmPciLibPciRootBridgeIo/SmmPciLibPciRootBridgeIo.inf
|
||||
MdePkg/Library/SmmServicesTableLib/SmmServicesTableLib.inf
|
||||
MdePkg/Library/SmmMemoryAllocationLib/SmmMemoryAllocationLib.inf
|
||||
MdePkg/Library/SmmPeriodicSmiLib/SmmPeriodicSmiLib.inf
|
||||
|
||||
[Components.IPF]
|
||||
MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf
|
||||
|
@ -149,7 +150,6 @@
|
|||
MdePkg/Library/UefiPalLib/UefiPalLib.inf
|
||||
MdePkg/Library/UefiSalLib/UefiSalLib.inf
|
||||
|
||||
|
||||
[Components.EBC]
|
||||
MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.inf
|
||||
|
||||
|
|
Loading…
Reference in New Issue