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