]>
Commit | Line | Data |
---|---|---|
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 | |
26 | #define EFI_SMM_PERIODIC_TIMER_DISPATCH2_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 SMIs on every 64ms or 2 seconds.\r | |
33 | /// A child wishes schedule a period SMI 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 | /// SmiTickInterval = 20000\r | |
38 | /// The resulting SMI will occur every 2 seconds with the child called back on\r | |
39 | /// every 2nd SMI.\r | |
40 | /// NOTE: the same result would occur if the child set SmiTickInterval = 0.\r | |
41 | /// 2. The child may choose the finer granularity SMI (64ms):\r | |
42 | /// Period = 30000\r | |
43 | /// SmiTickInterval = 640\r | |
44 | /// The resulting SMI will occur every 64ms with the child called back on\r | |
45 | /// every 47th SMI.\r | |
46 | /// NOTE: the child driver should be aware that this will result in more\r | |
47 | /// SMIs occuring during system runtime which can negatively impact system\r | |
48 | /// performance.\r | |
49 | ///\r | |
50 | typedef 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 SMIs. Children of this interface should use this \r | |
58 | /// field when registering for periodic timer intervals when a finer granularity periodic \r | |
59 | /// SMI is desired.\r | |
60 | ///\r | |
61 | UINT64 SmiTickInterval;\r | |
62 | } EFI_SMM_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_SMM_PERIODIC_TIMER_CONTEXT and CommBufferSize pointing to its size.\r | |
68 | ///\r | |
69 | typedef 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_SMM_PERIODIC_TIMER_CONTEXT;\r | |
76 | \r | |
77 | typedef struct _EFI_SMM_PERIODIC_TIMER_DISPATCH2_PROTOCOL EFI_SMM_PERIODIC_TIMER_DISPATCH2_PROTOCOL;\r | |
78 | \r | |
79 | /**\r | |
80 | Register a child SMI source dispatch function for SMM 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_SMM_PERIODIC_TIMER_CONTEXT and CommBufferSize pointing to its size.\r | |
88 | \r | |
89 | @param[in] This Pointer to the EFI_SMM_PERIODIC_TIMER_DISPATCH2_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 SMI source has been enabled.\r | |
101 | @retval EFI_DEVICE_ERROR The driver was unable to enable the SMI 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 SMM) to manage this child.\r | |
105 | **/\r | |
106 | typedef\r | |
107 | EFI_STATUS\r | |
108 | (EFIAPI *EFI_SMM_PERIODIC_TIMER_REGISTER)(\r | |
109 | IN CONST EFI_SMM_PERIODIC_TIMER_DISPATCH2_PROTOCOL *This,\r | |
110 | IN EFI_SMM_HANDLER_ENTRY_POINT2 DispatchFunction,\r | |
111 | IN CONST EFI_SMM_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_SMM_PERIODIC_TIMER_DISPATCH2_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 | |
127 | typedef\r | |
128 | EFI_STATUS\r | |
129 | (EFIAPI *EFI_SMM_PERIODIC_TIMER_UNREGISTER)(\r | |
130 | IN CONST EFI_SMM_PERIODIC_TIMER_DISPATCH2_PROTOCOL *This,\r | |
131 | IN EFI_HANDLE DispatchHandle\r | |
132 | );\r | |
133 | \r | |
134 | /**\r | |
135 | Returns the next SMI 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_SMM_PERIODIC_TIMER_DISPATCH2_PROTOCOL instance.\r | |
140 | @param[in,out] SmiTickInterval Pointer to pointer of next shorter SMI 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, *SmiTickInterval\r | |
143 | should be set to NULL to get the longest SMI interval.The returned\r | |
144 | *SmiTickInterval should be passed in on subsequent calls to get the\r | |
145 | next shorter interval period until *SmiTickInterval = NULL.\r | |
146 | \r | |
147 | @retval EFI_SUCCESS The service returned successfully.\r | |
148 | **/\r | |
149 | typedef\r | |
150 | EFI_STATUS\r | |
151 | (EFIAPI *EFI_SMM_PERIODIC_TIMER_INTERVAL)(\r | |
152 | IN CONST EFI_SMM_PERIODIC_TIMER_DISPATCH2_PROTOCOL *This,\r | |
153 | IN OUT UINT64 **SmiTickInterval\r | |
154 | );\r | |
155 | \r | |
156 | ///\r | |
157 | /// Interface structure for the SMM Periodic Timer Dispatch Protocol\r | |
158 | ///\r | |
159 | /// This protocol provides the parent dispatch service for the periodical timer SMI source generator.\r | |
160 | ///\r | |
161 | struct _EFI_SMM_PERIODIC_TIMER_DISPATCH2_PROTOCOL {\r | |
162 | EFI_SMM_PERIODIC_TIMER_REGISTER Register;\r | |
163 | EFI_SMM_PERIODIC_TIMER_UNREGISTER UnRegister;\r | |
164 | EFI_SMM_PERIODIC_TIMER_INTERVAL GetNextShorterInterval;\r | |
165 | };\r | |
166 | \r | |
167 | extern EFI_GUID gEfiSmmPeriodicTimerDispatch2ProtocolGuid;\r | |
168 | \r | |
169 | #endif\r | |
170 | \r |