2 SMM Periodic Timer Dispatch Protocol as defined in PI 1.1 Specification
3 Volume 4 System Management Mode Core Interface.
5 This protocol provides the parent dispatch service for the periodical timer SMI source generator.
7 Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
8 SPDX-License-Identifier: BSD-2-Clause-Patent
10 @par Revision Reference:
11 This protocol is from PI Version 1.1.
15 #ifndef _SMM_PERIODIC_TIMER_DISPATCH2_H_
16 #define _SMM_PERIODIC_TIMER_DISPATCH2_H_
18 #include <Pi/PiSmmCis.h>
19 #include <Protocol/MmPeriodicTimerDispatch.h>
21 #define EFI_SMM_PERIODIC_TIMER_DISPATCH2_PROTOCOL_GUID EFI_MM_PERIODIC_TIMER_DISPATCH_PROTOCOL_GUID
24 /// Example: A chipset supports periodic SMIs on every 64ms or 2 seconds.
25 /// A child wishes schedule a period SMI to fire on a period of 3 seconds, there
26 /// are several ways to approach the problem:
27 /// 1. The child may accept a 4 second periodic rate, in which case it registers with
29 /// SmiTickInterval = 20000
30 /// The resulting SMI will occur every 2 seconds with the child called back on
32 /// NOTE: the same result would occur if the child set SmiTickInterval = 0.
33 /// 2. The child may choose the finer granularity SMI (64ms):
35 /// SmiTickInterval = 640
36 /// The resulting SMI will occur every 64ms with the child called back on
38 /// NOTE: the child driver should be aware that this will result in more
39 /// SMIs occuring during system runtime which can negatively impact system
44 /// The minimum period of time in 100 nanosecond units that the child gets called. The
45 /// child will be called back after a time greater than the time Period.
49 /// The period of time interval between SMIs. Children of this interface should use this
50 /// field when registering for periodic timer intervals when a finer granularity periodic
53 UINT64 SmiTickInterval
;
54 } EFI_SMM_PERIODIC_TIMER_REGISTER_CONTEXT
;
57 /// The DispatchFunction will be called with Context set to the same value as was passed into
58 /// Register() in RegisterContext and with CommBuffer pointing to an instance of
59 /// EFI_SMM_PERIODIC_TIMER_CONTEXT and CommBufferSize pointing to its size.
61 typedef EFI_MM_PERIODIC_TIMER_CONTEXT EFI_SMM_PERIODIC_TIMER_CONTEXT
;
63 typedef struct _EFI_SMM_PERIODIC_TIMER_DISPATCH2_PROTOCOL EFI_SMM_PERIODIC_TIMER_DISPATCH2_PROTOCOL
;
66 Register a child SMI source dispatch function for SMM periodic timer.
68 This service registers a function (DispatchFunction) which will be called when at least the
69 amount of time specified by RegisterContext has elapsed. On return, DispatchHandle
70 contains a unique handle which may be used later to unregister the function using UnRegister().
71 The DispatchFunction will be called with Context set to the same value as was passed into
72 this function in RegisterContext and with CommBuffer pointing to an instance of
73 EFI_SMM_PERIODIC_TIMER_CONTEXT and CommBufferSize pointing to its size.
75 @param[in] This Pointer to the EFI_SMM_PERIODIC_TIMER_DISPATCH2_PROTOCOL instance.
76 @param[in] DispatchFunction Function to register for handler when at least the specified amount
78 @param[in] RegisterContext Pointer to the dispatch function's context.
79 The caller fills this context in before calling
80 the register function to indicate to the register
81 function the period at which the dispatch function
83 @param[out] DispatchHandle Handle generated by the dispatcher to track the function instance.
85 @retval EFI_SUCCESS The dispatch function has been successfully
86 registered and the SMI source has been enabled.
87 @retval EFI_DEVICE_ERROR The driver was unable to enable the SMI source.
88 @retval EFI_INVALID_PARAMETER RegisterContext is invalid. The period input value
89 is not within valid range.
90 @retval EFI_OUT_OF_RESOURCES There is not enough memory (system or SMM) to manage this child.
94 (EFIAPI
*EFI_SMM_PERIODIC_TIMER_REGISTER2
)(
95 IN CONST EFI_SMM_PERIODIC_TIMER_DISPATCH2_PROTOCOL
*This
,
96 IN EFI_SMM_HANDLER_ENTRY_POINT2 DispatchFunction
,
97 IN CONST EFI_SMM_PERIODIC_TIMER_REGISTER_CONTEXT
*RegisterContext
,
98 OUT EFI_HANDLE
*DispatchHandle
102 Unregisters a periodic timer service.
104 This service removes the handler associated with DispatchHandle so that it will no longer be
105 called when the time has elapsed.
107 @param[in] This Pointer to the EFI_SMM_PERIODIC_TIMER_DISPATCH2_PROTOCOL instance.
108 @param[in] DispatchHandle Handle of the service to remove.
110 @retval EFI_SUCCESS The service has been successfully removed.
111 @retval EFI_INVALID_PARAMETER The DispatchHandle was not valid.
115 (EFIAPI
*EFI_SMM_PERIODIC_TIMER_UNREGISTER2
)(
116 IN CONST EFI_SMM_PERIODIC_TIMER_DISPATCH2_PROTOCOL
*This
,
117 IN EFI_HANDLE DispatchHandle
121 Returns the next SMI tick period supported by the chipset.
123 The order returned is from longest to shortest interval period.
125 @param[in] This Pointer to the EFI_SMM_PERIODIC_TIMER_DISPATCH2_PROTOCOL instance.
126 @param[in,out] SmiTickInterval Pointer to pointer of next shorter SMI interval
127 period supported by the child. This parameter works as a get-first,
128 get-next field.The first time this function is called, *SmiTickInterval
129 should be set to NULL to get the longest SMI interval.The returned
130 *SmiTickInterval should be passed in on subsequent calls to get the
131 next shorter interval period until *SmiTickInterval = NULL.
133 @retval EFI_SUCCESS The service returned successfully.
137 (EFIAPI
*EFI_SMM_PERIODIC_TIMER_INTERVAL2
)(
138 IN CONST EFI_SMM_PERIODIC_TIMER_DISPATCH2_PROTOCOL
*This
,
139 IN OUT UINT64
**SmiTickInterval
143 /// Interface structure for the SMM Periodic Timer Dispatch Protocol
145 /// This protocol provides the parent dispatch service for the periodical timer SMI source generator.
147 struct _EFI_SMM_PERIODIC_TIMER_DISPATCH2_PROTOCOL
{
148 EFI_SMM_PERIODIC_TIMER_REGISTER2 Register
;
149 EFI_SMM_PERIODIC_TIMER_UNREGISTER2 UnRegister
;
150 EFI_SMM_PERIODIC_TIMER_INTERVAL2 GetNextShorterInterval
;
153 extern EFI_GUID gEfiSmmPeriodicTimerDispatch2ProtocolGuid
;