]> git.proxmox.com Git - mirror_edk2.git/blame - IntelFrameworkPkg/Include/Protocol/SmmPeriodicTimerDispatch.h
Initial directory structure of IntelFrameworkPkg.
[mirror_edk2.git] / IntelFrameworkPkg / Include / Protocol / SmmPeriodicTimerDispatch.h
CommitLineData
79964ac8 1/** @file\r
2 This file declares EFI Smm Periodic Timer Smi Child Protocol\r
3\r
4 Copyright (c) 2007, Intel Corporation\r
5 All rights reserved. This program and the accompanying materials\r
6 are licensed and made available under the terms and conditions of the BSD License\r
7 which accompanies this distribution. The full text of the license may be found at\r
8 http://opensource.org/licenses/bsd-license.php\r
9\r
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12\r
13 Module Name: SmmPeriodicTimerDispatch.h\r
14\r
15 @par Revision Reference:\r
16 This Protocol is defined in Framework of EFI SMM Core Interface Spec\r
17 Version 0.9.\r
18\r
19**/\r
20\r
21#ifndef _EFI_SMM_PERIODIC_TIMER_DISPATCH_H_\r
22#define _EFI_SMM_PERIODIC_TIMER_DISPATCH_H_\r
23\r
24//\r
25// Global ID for the Periodic Timer SMI Protocol\r
26//\r
27#define EFI_SMM_PERIODIC_TIMER_DISPATCH_PROTOCOL_GUID \\r
28 { \\r
29 0x9cca03fc, 0x4c9e, 0x4a19, {0x9b, 0x6, 0xed, 0x7b, 0x47, 0x9b, 0xde, 0x55 } \\r
30 }\r
31\r
32typedef struct _EFI_SMM_PERIODIC_TIMER_DISPATCH_PROTOCOL EFI_SMM_PERIODIC_TIMER_DISPATCH_PROTOCOL;\r
33\r
34//\r
35// Related Definitions\r
36//\r
37//\r
38// Period is the minimum period of time in 100 nanosecond units that child gets called.\r
39// The child will be called back after a time greater than the time Period.\r
40//\r
41// SmiTickInterval is the period of time interval between SMIs. Children of this interface\r
42// should use this field when registering for periodic timer intervals when a finer\r
43// granularity periodic SMI is desired. Valid values for this field are those returned\r
44// by GetNextInterval. A value of 0 indicates the parent is allowed to use any SMI\r
45// interval period to satisfy the requested period.\r
46// Example: A chipset supports periodic SMIs on every 64ms or 2 seconds.\r
47// A child wishes schedule a period SMI to fire on a period of 3 seconds, there\r
48// are several ways to approach the problem:\r
49// 1. The child may accept a 4 second periodic rate, in which case it registers with\r
50// Period = 40000\r
51// SmiTickInterval = 20000\r
52// The resulting SMI will occur every 2 seconds with the child called back on\r
53// every 2nd SMI.\r
54// NOTE: the same result would occur if the child set SmiTickInterval = 0.\r
55// 2. The child may choose the finer granularity SMI (64ms):\r
56// Period = 30000\r
57// SmiTickInterval = 640\r
58// The resulting SMI will occur every 64ms with the child called back on\r
59// every 47th SMI.\r
60// NOTE: the child driver should be aware that this will result in more\r
61// SMIs occuring during system runtime which can negatively impact system\r
62// performance.\r
63//\r
64// ElapsedTime is the actual time in 100 nanosecond units elapsed since last called, a\r
65// value of 0 indicates an unknown amount of time.\r
66//\r
67typedef struct {\r
68 UINT64 Period;\r
69 UINT64 SmiTickInterval;\r
70 UINT64 ElapsedTime;\r
71} EFI_SMM_PERIODIC_TIMER_DISPATCH_CONTEXT;\r
72\r
73//\r
74// Member functions\r
75//\r
76/**\r
77 Dispatch function for a Periodic Timer SMI handler.\r
78\r
79 @param DispatchHandle Handle of this dispatch function.\r
80 @param DispatchContext Pointer to the dispatch function's context.\r
81 The DispatchContext fields are filled in\r
82 by the dispatching driver prior to\r
83 invoking this dispatch function.\r
84\r
85 Nothing\r
86\r
87**/\r
88typedef\r
89VOID\r
90(EFIAPI *EFI_SMM_PERIODIC_TIMER_DISPATCH) (\r
91 IN EFI_HANDLE DispatchHandle,\r
92 IN EFI_SMM_PERIODIC_TIMER_DISPATCH_CONTEXT *DispatchContext\r
93 );\r
94\r
95/**\r
96 Returns the next SMI tick period supported by the chipset. The order\r
97 returned is from longest to shortest interval period.\r
98\r
99 @param This Protocol instance pointer.\r
100 @param SmiTickInterval Pointer to pointer of next shorter SMI interval\r
101 period supported by the child. This parameter works as a get-first,\r
102 get-next field.The first time this function is called, *SmiTickInterval\r
103 should be set to NULL to get the longest SMI interval.The returned\r
104 *SmiTickInterval should be passed in on subsequent calls to get the\r
105 next shorter interval period until *SmiTickInterval = NULL.\r
106\r
107 @retval EFI_SUCCESS The service returned successfully.\r
108\r
109**/\r
110typedef\r
111EFI_STATUS\r
112(EFIAPI *EFI_SMM_PERIODIC_TIMER_INTERVAL) (\r
113 IN EFI_SMM_PERIODIC_TIMER_DISPATCH_PROTOCOL *This,\r
114 IN OUT UINT64 **SmiTickInterval\r
115 );\r
116\r
117/**\r
118 Register a child SMI source dispatch function with a parent SMM driver\r
119\r
120 @param This Protocol instance pointer.\r
121 @param DispatchFunction Pointer to dispatch function to be invoked for\r
122 this SMI source\r
123 @param DispatchContext Pointer to the dispatch function's context.\r
124 The caller fills this context in before calling\r
125 the register function to indicate to the register\r
126 function the period at which the dispatch function\r
127 should be invoked.\r
128 @param DispatchHandle Handle of dispatch function, for when interfacing\r
129 with the parent Sx state SMM driver.\r
130\r
131 @retval EFI_SUCCESS The dispatch function has been successfully\r
132 registered and the SMI source has been enabled.\r
133 @retval EFI_DEVICE_ERROR The driver was unable to enable the SMI source.\r
134 @retval EFI_OUT_OF_RESOURCES Not enough memory (system or SMM) to manage this\r
135 child.\r
136 @retval EFI_INVALID_PARAMETER DispatchContext is invalid. The period input value\r
137 is not within valid range.\r
138\r
139**/\r
140typedef\r
141EFI_STATUS\r
142(EFIAPI *EFI_SMM_PERIODIC_TIMER_REGISTER) (\r
143 IN EFI_SMM_PERIODIC_TIMER_DISPATCH_PROTOCOL *This,\r
144 IN EFI_SMM_PERIODIC_TIMER_DISPATCH DispatchFunction,\r
145 IN EFI_SMM_PERIODIC_TIMER_DISPATCH_CONTEXT *DispatchContext,\r
146 OUT EFI_HANDLE *DispatchHandle\r
147 );\r
148\r
149/**\r
150 Unregister a child SMI source dispatch function with a parent SMM driver\r
151\r
152 @param This Protocol instance pointer.\r
153 @param DispatchHandle Handle of dispatch function to deregister.\r
154\r
155 @retval EFI_SUCCESS The dispatch function has been successfully\r
156 unregistered and the SMI source has been disabled\r
157 if there are no other registered child dispatch\r
158 functions for this SMI source.\r
159 @retval EFI_INVALID_PARAMETER Handle is invalid.\r
160\r
161**/\r
162typedef\r
163EFI_STATUS\r
164(EFIAPI *EFI_SMM_PERIODIC_TIMER_UNREGISTER) (\r
165 IN EFI_SMM_PERIODIC_TIMER_DISPATCH_PROTOCOL *This,\r
166 IN EFI_HANDLE DispatchHandle\r
167 );\r
168\r
169//\r
170// Interface structure for the SMM Periodic Timer Dispatch Protocol\r
171//\r
172/**\r
173 @par Protocol Description:\r
174 Provides the parent dispatch service for the periodical timer SMI source generator.\r
175\r
176 @param Register\r
177 Installs a child service to be dispatched by this protocol.\r
178\r
179 @param UnRegister\r
180 Removes a child service dispatched by this protocol.\r
181\r
182 @param GetNextShorterInterval\r
183 Returns the next SMI tick period that is supported by the chipset.\r
184\r
185**/\r
186struct _EFI_SMM_PERIODIC_TIMER_DISPATCH_PROTOCOL {\r
187 EFI_SMM_PERIODIC_TIMER_REGISTER Register;\r
188 EFI_SMM_PERIODIC_TIMER_UNREGISTER UnRegister;\r
189 EFI_SMM_PERIODIC_TIMER_INTERVAL GetNextShorterInterval;\r
190};\r
191\r
192extern EFI_GUID gEfiSmmPeriodicTimerDispatchProtocolGuid;\r
193\r
194#endif\r