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