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, Intel Corporation
8 All rights reserved. This program and the accompanying materials
9 are licensed and made available under the terms and conditions of the BSD License
10 which accompanies this distribution. The full text of the license may be found at
11 http://opensource.org/licenses/bsd-license.php
13 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
14 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
16 @par Revision Reference:
17 This protocol is from PI Version 1.1.
21 #ifndef _SMM_PERIODIC_TIMER_DISPATCH2_H_
22 #define _SMM_PERIODIC_TIMER_DISPATCH2_H_
24 #include <Pi/PiSmmCis.h>
28 /// To avoid name conflict between PI and Framework SMM spec, the following names defined
29 /// in PI 1.2 SMM spec are renamed. These renamings are not yet in a public PI spec and errta.
31 /// EFI_SMM_PERIODIC_TIMER_REGISTER -> EFI_SMM_PERIODIC_TIMER_REGISTER2
32 /// EFI_SMM_PERIODIC_TIMER_UNREGISTER -> EFI_SMM_PERIODIC_TIMER_UNREGISTER2
33 /// EFI_SMM_PERIODIC_TIMER_INTERVAL -> EFI_SMM_PERIODIC_TIMER_INTERVAL2
36 #define EFI_SMM_PERIODIC_TIMER_DISPATCH2_PROTOCOL_GUID \
38 0x4cec368e, 0x8e8e, 0x4d71, {0x8b, 0xe1, 0x95, 0x8c, 0x45, 0xfc, 0x8a, 0x53 } \
42 /// Example: A chipset supports periodic SMIs on every 64ms or 2 seconds.
43 /// A child wishes schedule a period SMI to fire on a period of 3 seconds, there
44 /// are several ways to approach the problem:
45 /// 1. The child may accept a 4 second periodic rate, in which case it registers with
47 /// SmiTickInterval = 20000
48 /// The resulting SMI will occur every 2 seconds with the child called back on
50 /// NOTE: the same result would occur if the child set SmiTickInterval = 0.
51 /// 2. The child may choose the finer granularity SMI (64ms):
53 /// SmiTickInterval = 640
54 /// The resulting SMI will occur every 64ms with the child called back on
56 /// NOTE: the child driver should be aware that this will result in more
57 /// SMIs occuring during system runtime which can negatively impact system
62 /// The minimum period of time in 100 nanosecond units that the child gets called. The
63 /// child will be called back after a time greater than the time Period.
67 /// The period of time interval between SMIs. Children of this interface should use this
68 /// field when registering for periodic timer intervals when a finer granularity periodic
71 UINT64 SmiTickInterval
;
72 } EFI_SMM_PERIODIC_TIMER_REGISTER_CONTEXT
;
75 /// The DispatchFunction will be called with Context set to the same value as was passed into
76 /// Register() in RegisterContext and with CommBuffer pointing to an instance of
77 /// EFI_SMM_PERIODIC_TIMER_CONTEXT and CommBufferSize pointing to its size.
81 /// ElapsedTime is the actual time in 100 nanosecond units elapsed since last called, a
82 /// value of 0 indicates an unknown amount of time.
85 } EFI_SMM_PERIODIC_TIMER_CONTEXT
;
87 typedef struct _EFI_SMM_PERIODIC_TIMER_DISPATCH2_PROTOCOL EFI_SMM_PERIODIC_TIMER_DISPATCH2_PROTOCOL
;
90 Register a child SMI source dispatch function for SMM periodic timer.
92 This service registers a function (DispatchFunction) which will be called when at least the
93 amount of time specified by RegisterContext has elapsed. On return, DispatchHandle
94 contains a unique handle which may be used later to unregister the function using UnRegister().
95 The DispatchFunction will be called with Context set to the same value as was passed into
96 this function in RegisterContext and with CommBuffer pointing to an instance of
97 EFI_SMM_PERIODIC_TIMER_CONTEXT and CommBufferSize pointing to its size.
99 @param[in] This Pointer to the EFI_SMM_PERIODIC_TIMER_DISPATCH2_PROTOCOL instance.
100 @param[in] DispatchFunction Function to register for handler when at least the specified amount
102 @param[in] RegisterContext Pointer to the dispatch function's context.
103 The caller fills this context in before calling
104 the register function to indicate to the register
105 function the period at which the dispatch function
107 @param[out] DispatchHandle Handle generated by the dispatcher to track the function instance.
109 @retval EFI_SUCCESS The dispatch function has been successfully
110 registered and the SMI source has been enabled.
111 @retval EFI_DEVICE_ERROR The driver was unable to enable the SMI source.
112 @retval EFI_INVALID_PARAMETER RegisterContext is invalid. The period input value
113 is not within valid range.
114 @retval EFI_OUT_OF_RESOURCES There is not enough memory (system or SMM) to manage this child.
118 (EFIAPI
*EFI_SMM_PERIODIC_TIMER_REGISTER2
)(
119 IN CONST EFI_SMM_PERIODIC_TIMER_DISPATCH2_PROTOCOL
*This
,
120 IN EFI_SMM_HANDLER_ENTRY_POINT2 DispatchFunction
,
121 IN CONST EFI_SMM_PERIODIC_TIMER_REGISTER_CONTEXT
*RegisterContext
,
122 OUT EFI_HANDLE
*DispatchHandle
126 Unregisters a periodic timer service.
128 This service removes the handler associated with DispatchHandle so that it will no longer be
129 called when the time has elapsed.
131 @param[in] This Pointer to the EFI_SMM_PERIODIC_TIMER_DISPATCH2_PROTOCOL instance.
132 @param[in] DispatchHandle Handle of the service to remove.
134 @retval EFI_SUCCESS The service has been successfully removed.
135 @retval EFI_INVALID_PARAMETER The DispatchHandle was not valid.
139 (EFIAPI
*EFI_SMM_PERIODIC_TIMER_UNREGISTER2
)(
140 IN CONST EFI_SMM_PERIODIC_TIMER_DISPATCH2_PROTOCOL
*This
,
141 IN EFI_HANDLE DispatchHandle
145 Returns the next SMI tick period supported by the chipset.
147 The order returned is from longest to shortest interval period.
149 @param[in] This Pointer to the EFI_SMM_PERIODIC_TIMER_DISPATCH2_PROTOCOL instance.
150 @param[in,out] SmiTickInterval Pointer to pointer of next shorter SMI interval
151 period supported by the child. This parameter works as a get-first,
152 get-next field.The first time this function is called, *SmiTickInterval
153 should be set to NULL to get the longest SMI interval.The returned
154 *SmiTickInterval should be passed in on subsequent calls to get the
155 next shorter interval period until *SmiTickInterval = NULL.
157 @retval EFI_SUCCESS The service returned successfully.
161 (EFIAPI
*EFI_SMM_PERIODIC_TIMER_INTERVAL2
)(
162 IN CONST EFI_SMM_PERIODIC_TIMER_DISPATCH2_PROTOCOL
*This
,
163 IN OUT UINT64
**SmiTickInterval
167 /// Interface structure for the SMM Periodic Timer Dispatch Protocol
169 /// This protocol provides the parent dispatch service for the periodical timer SMI source generator.
171 struct _EFI_SMM_PERIODIC_TIMER_DISPATCH2_PROTOCOL
{
172 EFI_SMM_PERIODIC_TIMER_REGISTER2 Register
;
173 EFI_SMM_PERIODIC_TIMER_UNREGISTER2 UnRegister
;
174 EFI_SMM_PERIODIC_TIMER_INTERVAL2 GetNextShorterInterval
;
177 extern EFI_GUID gEfiSmmPeriodicTimerDispatch2ProtocolGuid
;