]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Protocol/SmmPeriodicTimerDispatch2.h
Rename PI SMM definitions which has same name with those of Framework SMM spec but...
[mirror_edk2.git] / MdePkg / Include / Protocol / SmmPeriodicTimerDispatch2.h
CommitLineData
2b2cb0e8 1/** @file\r
2 SMM Periodic Timer Dispatch Protocol as defined in PI 1.1 Specification\r
3 Volume 4 System Management Mode Core Interface.\r
4\r
5 This protocol provides the parent dispatch service for the periodical timer SMI source generator.\r
6\r
7 Copyright (c) 2009, Intel Corporation\r
8 All rights reserved. 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.1.\r
18\r
19**/\r
20\r
21#ifndef _SMM_PERIODIC_TIMER_DISPATCH2_H_\r
22#define _SMM_PERIODIC_TIMER_DISPATCH2_H_\r
23\r
24#include <Pi/PiSmmCis.h>\r
25\r
a2bb197e 26///\r
27/// Note:\r
28/// To avoid name conflict between PI and Framework SMM spec, the following names defined\r
29/// in PI 1.2 SMM spec are renamed. These renamings are not yet in a public PI spec and errta.\r
30///\r
31/// EFI_SMM_PERIODIC_TIMER_REGISTER -> EFI_SMM_PERIODIC_TIMER_REGISTER2\r
32/// EFI_SMM_PERIODIC_TIMER_UNREGISTER -> EFI_SMM_PERIODIC_TIMER_UNREGISTER2\r
33/// EFI_SMM_PERIODIC_TIMER_INTERVAL -> EFI_SMM_PERIODIC_TIMER_INTERVAL2\r
34///\r
35\r
2b2cb0e8 36#define EFI_SMM_PERIODIC_TIMER_DISPATCH2_PROTOCOL_GUID \\r
37 { \\r
38 0x4cec368e, 0x8e8e, 0x4d71, {0x8b, 0xe1, 0x95, 0x8c, 0x45, 0xfc, 0x8a, 0x53 } \\r
39 }\r
40\r
41///\r
42/// Example: A chipset supports periodic SMIs on every 64ms or 2 seconds.\r
43/// A child wishes schedule a period SMI to fire on a period of 3 seconds, there\r
44/// are several ways to approach the problem:\r
45/// 1. The child may accept a 4 second periodic rate, in which case it registers with\r
46/// Period = 40000\r
47/// SmiTickInterval = 20000\r
48/// The resulting SMI will occur every 2 seconds with the child called back on\r
49/// every 2nd SMI.\r
50/// NOTE: the same result would occur if the child set SmiTickInterval = 0.\r
51/// 2. The child may choose the finer granularity SMI (64ms):\r
52/// Period = 30000\r
53/// SmiTickInterval = 640\r
54/// The resulting SMI will occur every 64ms with the child called back on\r
55/// every 47th SMI.\r
56/// NOTE: the child driver should be aware that this will result in more\r
57/// SMIs occuring during system runtime which can negatively impact system\r
58/// performance.\r
59///\r
60typedef struct {\r
61 ///\r
62 /// The minimum period of time in 100 nanosecond units that the child gets called. The \r
63 /// child will be called back after a time greater than the time Period.\r
64 ///\r
65 UINT64 Period;\r
66 ///\r
67 /// The period of time interval between SMIs. Children of this interface should use this \r
68 /// field when registering for periodic timer intervals when a finer granularity periodic \r
69 /// SMI is desired.\r
70 ///\r
71 UINT64 SmiTickInterval;\r
72} EFI_SMM_PERIODIC_TIMER_REGISTER_CONTEXT;\r
73\r
74///\r
75/// The DispatchFunction will be called with Context set to the same value as was passed into \r
76/// Register() in RegisterContext and with CommBuffer pointing to an instance of \r
77/// EFI_SMM_PERIODIC_TIMER_CONTEXT and CommBufferSize pointing to its size.\r
78///\r
79typedef struct {\r
80 ///\r
81 /// ElapsedTime is the actual time in 100 nanosecond units elapsed since last called, a\r
82 /// value of 0 indicates an unknown amount of time.\r
83 ///\r
84 UINT64 ElapsedTime;\r
85} EFI_SMM_PERIODIC_TIMER_CONTEXT;\r
86\r
87typedef struct _EFI_SMM_PERIODIC_TIMER_DISPATCH2_PROTOCOL EFI_SMM_PERIODIC_TIMER_DISPATCH2_PROTOCOL;\r
88\r
89/**\r
90 Register a child SMI source dispatch function for SMM periodic timer.\r
91\r
92 This service registers a function (DispatchFunction) which will be called when at least the \r
93 amount of time specified by RegisterContext has elapsed. On return, DispatchHandle \r
94 contains a unique handle which may be used later to unregister the function using UnRegister().\r
95 The DispatchFunction will be called with Context set to the same value as was passed into \r
96 this function in RegisterContext and with CommBuffer pointing to an instance of \r
97 EFI_SMM_PERIODIC_TIMER_CONTEXT and CommBufferSize pointing to its size.\r
98\r
99 @param[in] This Pointer to the EFI_SMM_PERIODIC_TIMER_DISPATCH2_PROTOCOL instance.\r
100 @param[in] DispatchFunction Function to register for handler when at least the specified amount\r
101 of time has elapsed. \r
102 @param[in] RegisterContext Pointer to the dispatch function's context.\r
103 The caller fills this context in before calling\r
104 the register function to indicate to the register\r
105 function the period at which the dispatch function\r
106 should be invoked.\r
107 @param[out] DispatchHandle Handle generated by the dispatcher to track the function instance. \r
108\r
109 @retval EFI_SUCCESS The dispatch function has been successfully\r
110 registered and the SMI source has been enabled.\r
111 @retval EFI_DEVICE_ERROR The driver was unable to enable the SMI source.\r
112 @retval EFI_INVALID_PARAMETER RegisterContext is invalid. The period input value\r
113 is not within valid range.\r
114 @retval EFI_OUT_OF_RESOURCES There is not enough memory (system or SMM) to manage this child.\r
115**/\r
116typedef\r
117EFI_STATUS\r
a2bb197e 118(EFIAPI *EFI_SMM_PERIODIC_TIMER_REGISTER2)(\r
2b2cb0e8 119 IN CONST EFI_SMM_PERIODIC_TIMER_DISPATCH2_PROTOCOL *This,\r
120 IN EFI_SMM_HANDLER_ENTRY_POINT2 DispatchFunction,\r
121 IN CONST EFI_SMM_PERIODIC_TIMER_REGISTER_CONTEXT *RegisterContext,\r
122 OUT EFI_HANDLE *DispatchHandle\r
123 );\r
124\r
125/**\r
126 Unregisters a periodic timer service.\r
127\r
128 This service removes the handler associated with DispatchHandle so that it will no longer be \r
129 called when the time has elapsed.\r
130\r
131 @param[in] This Pointer to the EFI_SMM_PERIODIC_TIMER_DISPATCH2_PROTOCOL instance.\r
132 @param[in] DispatchHandle Handle of the service to remove.\r
133\r
134 @retval EFI_SUCCESS The service has been successfully removed.\r
135 @retval EFI_INVALID_PARAMETER The DispatchHandle was not valid.\r
136**/\r
137typedef\r
138EFI_STATUS\r
a2bb197e 139(EFIAPI *EFI_SMM_PERIODIC_TIMER_UNREGISTER2)(\r
2b2cb0e8 140 IN CONST EFI_SMM_PERIODIC_TIMER_DISPATCH2_PROTOCOL *This,\r
141 IN EFI_HANDLE DispatchHandle\r
142 );\r
143\r
144/**\r
145 Returns the next SMI tick period supported by the chipset.\r
146\r
147 The order returned is from longest to shortest interval period.\r
148\r
149 @param[in] This Pointer to the EFI_SMM_PERIODIC_TIMER_DISPATCH2_PROTOCOL instance.\r
150 @param[in,out] SmiTickInterval Pointer to pointer of next shorter SMI interval\r
151 period supported by the child. This parameter works as a get-first,\r
152 get-next field.The first time this function is called, *SmiTickInterval\r
153 should be set to NULL to get the longest SMI interval.The returned\r
154 *SmiTickInterval should be passed in on subsequent calls to get the\r
155 next shorter interval period until *SmiTickInterval = NULL.\r
156\r
157 @retval EFI_SUCCESS The service returned successfully.\r
158**/\r
159typedef\r
160EFI_STATUS\r
a2bb197e 161(EFIAPI *EFI_SMM_PERIODIC_TIMER_INTERVAL2)(\r
2b2cb0e8 162 IN CONST EFI_SMM_PERIODIC_TIMER_DISPATCH2_PROTOCOL *This,\r
163 IN OUT UINT64 **SmiTickInterval\r
164 );\r
165\r
166///\r
167/// Interface structure for the SMM Periodic Timer Dispatch Protocol\r
168///\r
169/// This protocol provides the parent dispatch service for the periodical timer SMI source generator.\r
170///\r
171struct _EFI_SMM_PERIODIC_TIMER_DISPATCH2_PROTOCOL {\r
a2bb197e 172 EFI_SMM_PERIODIC_TIMER_REGISTER2 Register;\r
173 EFI_SMM_PERIODIC_TIMER_UNREGISTER2 UnRegister;\r
174 EFI_SMM_PERIODIC_TIMER_INTERVAL2 GetNextShorterInterval;\r
2b2cb0e8 175};\r
176\r
177extern EFI_GUID gEfiSmmPeriodicTimerDispatch2ProtocolGuid;\r
178\r
179#endif\r
180\r