]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Protocol/MmPeriodicTimerDispatch.h
MdeModulePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / MdePkg / Include / Protocol / MmPeriodicTimerDispatch.h
CommitLineData
07c6a47e
ED
1/** @file\r
2 MM Periodic Timer Dispatch Protocol as defined in PI 1.5 Specification\r
3 Volume 4 Management Mode Core Interface.\r
4\r
5 This protocol provides the parent dispatch service for the periodical timer MMI source generator.\r
6\r
7 Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>\r
8 This program and the accompanying materials\r
9 are licensed and made available under the terms and conditions of the BSD License\r
10 which accompanies this distribution. The full text of the license may be found at\r
11 http://opensource.org/licenses/bsd-license.php\r
12\r
13 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
14 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
15\r
16 @par Revision Reference:\r
17 This protocol is from PI Version 1.5.\r
18\r
19**/\r
20\r
21#ifndef _MM_PERIODIC_TIMER_DISPATCH_H_\r
22#define _MM_PERIODIC_TIMER_DISPATCH_H_\r
23\r
24#include <Pi/PiMmCis.h>\r
25\r
26#define EFI_MM_PERIODIC_TIMER_DISPATCH_PROTOCOL_GUID \\r
27 { \\r
28 0x4cec368e, 0x8e8e, 0x4d71, {0x8b, 0xe1, 0x95, 0x8c, 0x45, 0xfc, 0x8a, 0x53 } \\r
29 }\r
30\r
31///\r
32/// Example: A chipset supports periodic MMIs on every 64ms or 2 seconds.\r
33/// A child wishes schedule a period MMI to fire on a period of 3 seconds, there\r
34/// are several ways to approach the problem:\r
35/// 1. The child may accept a 4 second periodic rate, in which case it registers with\r
36/// Period = 40000\r
37/// MmiTickInterval = 20000\r
38/// The resulting MMI will occur every 2 seconds with the child called back on\r
39/// every 2nd MMI.\r
40/// NOTE: the same result would occur if the child set MmiTickInterval = 0.\r
41/// 2. The child may choose the finer granularity MMI (64ms):\r
42/// Period = 30000\r
43/// MmiTickInterval = 640\r
44/// The resulting MMI will occur every 64ms with the child called back on\r
45/// every 47th MMI.\r
46/// NOTE: the child driver should be aware that this will result in more\r
47/// MMIs occuring during system runtime which can negatively impact system\r
48/// performance.\r
49///\r
50typedef struct {\r
51 ///\r
52 /// The minimum period of time in 100 nanosecond units that the child gets called. The\r
53 /// child will be called back after a time greater than the time Period.\r
54 ///\r
55 UINT64 Period;\r
56 ///\r
57 /// The period of time interval between MMIs. Children of this interface should use this\r
58 /// field when registering for periodic timer intervals when a finer granularity periodic\r
59 /// MMI is desired.\r
60 ///\r
61 UINT64 MmiTickInterval;\r
62} EFI_MM_PERIODIC_TIMER_REGISTER_CONTEXT;\r
63\r
64///\r
65/// The DispatchFunction will be called with Context set to the same value as was passed into\r
66/// Register() in RegisterContext and with CommBuffer pointing to an instance of\r
67/// EFI_MM_PERIODIC_TIMER_CONTEXT and CommBufferSize pointing to its size.\r
68///\r
69typedef struct {\r
70 ///\r
71 /// ElapsedTime is the actual time in 100 nanosecond units elapsed since last called, a\r
72 /// value of 0 indicates an unknown amount of time.\r
73 ///\r
74 UINT64 ElapsedTime;\r
75} EFI_MM_PERIODIC_TIMER_CONTEXT;\r
76\r
77typedef struct _EFI_MM_PERIODIC_TIMER_DISPATCH_PROTOCOL EFI_MM_PERIODIC_TIMER_DISPATCH_PROTOCOL;\r
78\r
79/**\r
80 Register a child MMI source dispatch function for MM periodic timer.\r
81\r
82 This service registers a function (DispatchFunction) which will be called when at least the\r
83 amount of time specified by RegisterContext has elapsed. On return, DispatchHandle\r
84 contains a unique handle which may be used later to unregister the function using UnRegister().\r
85 The DispatchFunction will be called with Context set to the same value as was passed into\r
86 this function in RegisterContext and with CommBuffer pointing to an instance of\r
87 EFI_MM_PERIODIC_TIMER_CONTEXT and CommBufferSize pointing to its size.\r
88\r
89 @param[in] This Pointer to the EFI_MM_PERIODIC_TIMER_DISPATCH_PROTOCOL instance.\r
90 @param[in] DispatchFunction Function to register for handler when at least the specified amount\r
91 of time has elapsed.\r
92 @param[in] RegisterContext Pointer to the dispatch function's context.\r
93 The caller fills this context in before calling\r
94 the register function to indicate to the register\r
95 function the period at which the dispatch function\r
96 should be invoked.\r
97 @param[out] DispatchHandle Handle generated by the dispatcher to track the function instance.\r
98\r
99 @retval EFI_SUCCESS The dispatch function has been successfully\r
100 registered and the MMI source has been enabled.\r
101 @retval EFI_DEVICE_ERROR The driver was unable to enable the MMI source.\r
102 @retval EFI_INVALID_PARAMETER RegisterContext is invalid. The period input value\r
103 is not within valid range.\r
104 @retval EFI_OUT_OF_RESOURCES There is not enough memory (system or MM) to manage this child.\r
105**/\r
106typedef\r
107EFI_STATUS\r
108(EFIAPI *EFI_MM_PERIODIC_TIMER_REGISTER)(\r
109 IN CONST EFI_MM_PERIODIC_TIMER_DISPATCH_PROTOCOL *This,\r
110 IN EFI_MM_HANDLER_ENTRY_POINT DispatchFunction,\r
111 IN CONST EFI_MM_PERIODIC_TIMER_REGISTER_CONTEXT *RegisterContext,\r
112 OUT EFI_HANDLE *DispatchHandle\r
113 );\r
114\r
115/**\r
116 Unregisters a periodic timer service.\r
117\r
118 This service removes the handler associated with DispatchHandle so that it will no longer be\r
119 called when the time has elapsed.\r
120\r
121 @param[in] This Pointer to the EFI_MM_PERIODIC_TIMER_DISPATCH_PROTOCOL instance.\r
122 @param[in] DispatchHandle Handle of the service to remove.\r
123\r
124 @retval EFI_SUCCESS The service has been successfully removed.\r
125 @retval EFI_INVALID_PARAMETER The DispatchHandle was not valid.\r
126**/\r
127typedef\r
128EFI_STATUS\r
129(EFIAPI *EFI_MM_PERIODIC_TIMER_UNREGISTER)(\r
130 IN CONST EFI_MM_PERIODIC_TIMER_DISPATCH_PROTOCOL *This,\r
131 IN EFI_HANDLE DispatchHandle\r
132 );\r
133\r
134/**\r
135 Returns the next MMI tick period supported by the chipset.\r
136\r
137 The order returned is from longest to shortest interval period.\r
138\r
139 @param[in] This Pointer to the EFI_MM_PERIODIC_TIMER_DISPATCH_PROTOCOL instance.\r
140 @param[in,out] MmiTickInterval Pointer to pointer of next shorter MMI interval\r
141 period supported by the child. This parameter works as a get-first,\r
142 get-next field.The first time this function is called, *MmiTickInterval\r
143 should be set to NULL to get the longest MMI interval.The returned\r
144 *MmiTickInterval should be passed in on subsequent calls to get the\r
145 next shorter interval period until *MmiTickInterval = NULL.\r
146\r
147 @retval EFI_SUCCESS The service returned successfully.\r
148**/\r
149typedef\r
150EFI_STATUS\r
151(EFIAPI *EFI_MM_PERIODIC_TIMER_INTERVAL)(\r
152 IN CONST EFI_MM_PERIODIC_TIMER_DISPATCH_PROTOCOL *This,\r
153 IN OUT UINT64 **MmiTickInterval\r
154 );\r
155\r
156///\r
157/// Interface structure for the MM Periodic Timer Dispatch Protocol\r
158///\r
159/// This protocol provides the parent dispatch service for the periodical timer MMI source generator.\r
160///\r
161struct _EFI_MM_PERIODIC_TIMER_DISPATCH_PROTOCOL {\r
162 EFI_MM_PERIODIC_TIMER_REGISTER Register;\r
163 EFI_MM_PERIODIC_TIMER_UNREGISTER UnRegister;\r
164 EFI_MM_PERIODIC_TIMER_INTERVAL GetNextShorterInterval;\r
165};\r
166\r
167extern EFI_GUID gEfiMmPeriodicTimerDispatchProtocolGuid;\r
168\r
169#endif\r
170\r