2 MM Periodic Timer Dispatch Protocol as defined in PI 1.5 Specification
3 Volume 4 Management Mode Core Interface.
5 This protocol provides the parent dispatch service for the periodical timer MMI source generator.
7 Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
8 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.5.
21 #ifndef _MM_PERIODIC_TIMER_DISPATCH_H_
22 #define _MM_PERIODIC_TIMER_DISPATCH_H_
24 #include <Pi/PiMmCis.h>
26 #define EFI_MM_PERIODIC_TIMER_DISPATCH_PROTOCOL_GUID \
28 0x4cec368e, 0x8e8e, 0x4d71, {0x8b, 0xe1, 0x95, 0x8c, 0x45, 0xfc, 0x8a, 0x53 } \
32 /// Example: A chipset supports periodic MMIs on every 64ms or 2 seconds.
33 /// A child wishes schedule a period MMI to fire on a period of 3 seconds, there
34 /// are several ways to approach the problem:
35 /// 1. The child may accept a 4 second periodic rate, in which case it registers with
37 /// MmiTickInterval = 20000
38 /// The resulting MMI will occur every 2 seconds with the child called back on
40 /// NOTE: the same result would occur if the child set MmiTickInterval = 0.
41 /// 2. The child may choose the finer granularity MMI (64ms):
43 /// MmiTickInterval = 640
44 /// The resulting MMI will occur every 64ms with the child called back on
46 /// NOTE: the child driver should be aware that this will result in more
47 /// MMIs occuring during system runtime which can negatively impact system
52 /// The minimum period of time in 100 nanosecond units that the child gets called. The
53 /// child will be called back after a time greater than the time Period.
57 /// The period of time interval between MMIs. Children of this interface should use this
58 /// field when registering for periodic timer intervals when a finer granularity periodic
61 UINT64 MmiTickInterval
;
62 } EFI_MM_PERIODIC_TIMER_REGISTER_CONTEXT
;
65 /// The DispatchFunction will be called with Context set to the same value as was passed into
66 /// Register() in RegisterContext and with CommBuffer pointing to an instance of
67 /// EFI_MM_PERIODIC_TIMER_CONTEXT and CommBufferSize pointing to its size.
71 /// ElapsedTime is the actual time in 100 nanosecond units elapsed since last called, a
72 /// value of 0 indicates an unknown amount of time.
75 } EFI_MM_PERIODIC_TIMER_CONTEXT
;
77 typedef struct _EFI_MM_PERIODIC_TIMER_DISPATCH_PROTOCOL EFI_MM_PERIODIC_TIMER_DISPATCH_PROTOCOL
;
80 Register a child MMI source dispatch function for MM periodic timer.
82 This service registers a function (DispatchFunction) which will be called when at least the
83 amount of time specified by RegisterContext has elapsed. On return, DispatchHandle
84 contains a unique handle which may be used later to unregister the function using UnRegister().
85 The DispatchFunction will be called with Context set to the same value as was passed into
86 this function in RegisterContext and with CommBuffer pointing to an instance of
87 EFI_MM_PERIODIC_TIMER_CONTEXT and CommBufferSize pointing to its size.
89 @param[in] This Pointer to the EFI_MM_PERIODIC_TIMER_DISPATCH_PROTOCOL instance.
90 @param[in] DispatchFunction Function to register for handler when at least the specified amount
92 @param[in] RegisterContext Pointer to the dispatch function's context.
93 The caller fills this context in before calling
94 the register function to indicate to the register
95 function the period at which the dispatch function
97 @param[out] DispatchHandle Handle generated by the dispatcher to track the function instance.
99 @retval EFI_SUCCESS The dispatch function has been successfully
100 registered and the MMI source has been enabled.
101 @retval EFI_DEVICE_ERROR The driver was unable to enable the MMI source.
102 @retval EFI_INVALID_PARAMETER RegisterContext is invalid. The period input value
103 is not within valid range.
104 @retval EFI_OUT_OF_RESOURCES There is not enough memory (system or MM) to manage this child.
108 (EFIAPI
*EFI_MM_PERIODIC_TIMER_REGISTER
)(
109 IN CONST EFI_MM_PERIODIC_TIMER_DISPATCH_PROTOCOL
*This
,
110 IN EFI_MM_HANDLER_ENTRY_POINT DispatchFunction
,
111 IN CONST EFI_MM_PERIODIC_TIMER_REGISTER_CONTEXT
*RegisterContext
,
112 OUT EFI_HANDLE
*DispatchHandle
116 Unregisters a periodic timer service.
118 This service removes the handler associated with DispatchHandle so that it will no longer be
119 called when the time has elapsed.
121 @param[in] This Pointer to the EFI_MM_PERIODIC_TIMER_DISPATCH_PROTOCOL instance.
122 @param[in] DispatchHandle Handle of the service to remove.
124 @retval EFI_SUCCESS The service has been successfully removed.
125 @retval EFI_INVALID_PARAMETER The DispatchHandle was not valid.
129 (EFIAPI
*EFI_MM_PERIODIC_TIMER_UNREGISTER
)(
130 IN CONST EFI_MM_PERIODIC_TIMER_DISPATCH_PROTOCOL
*This
,
131 IN EFI_HANDLE DispatchHandle
135 Returns the next MMI tick period supported by the chipset.
137 The order returned is from longest to shortest interval period.
139 @param[in] This Pointer to the EFI_MM_PERIODIC_TIMER_DISPATCH_PROTOCOL instance.
140 @param[in,out] MmiTickInterval Pointer to pointer of next shorter MMI interval
141 period supported by the child. This parameter works as a get-first,
142 get-next field.The first time this function is called, *MmiTickInterval
143 should be set to NULL to get the longest MMI interval.The returned
144 *MmiTickInterval should be passed in on subsequent calls to get the
145 next shorter interval period until *MmiTickInterval = NULL.
147 @retval EFI_SUCCESS The service returned successfully.
151 (EFIAPI
*EFI_MM_PERIODIC_TIMER_INTERVAL
)(
152 IN CONST EFI_MM_PERIODIC_TIMER_DISPATCH_PROTOCOL
*This
,
153 IN OUT UINT64
**MmiTickInterval
157 /// Interface structure for the MM Periodic Timer Dispatch Protocol
159 /// This protocol provides the parent dispatch service for the periodical timer MMI source generator.
161 struct _EFI_MM_PERIODIC_TIMER_DISPATCH_PROTOCOL
{
162 EFI_MM_PERIODIC_TIMER_REGISTER Register
;
163 EFI_MM_PERIODIC_TIMER_UNREGISTER UnRegister
;
164 EFI_MM_PERIODIC_TIMER_INTERVAL GetNextShorterInterval
;
167 extern EFI_GUID gEfiMmPeriodicTimerDispatchProtocolGuid
;