]> git.proxmox.com Git - mirror_edk2.git/blob - IntelFrameworkPkg/Include/Protocol/SmmPeriodicTimerDispatch.h
Update to BSD license header.
[mirror_edk2.git] / IntelFrameworkPkg / Include / Protocol / SmmPeriodicTimerDispatch.h
1 /** @file
2 This file declares EFI Smm Periodic Timer Smi Child Protocol
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 Nothing
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 Protocol instance pointer.
123 @param DispatchFunction Pointer to dispatch function to be invoked for
124 this SMI source
125 @param DispatchContext Pointer to the dispatch function's context.
126 The caller fills this context in before calling
127 the register function to indicate to the register
128 function the period at which the dispatch function
129 should be invoked.
130 @param DispatchHandle Handle of dispatch function, for when interfacing
131 with the parent Sx state SMM driver.
132
133 @retval EFI_SUCCESS The dispatch function has been successfully
134 registered and the SMI source has been enabled.
135 @retval EFI_DEVICE_ERROR The driver was unable to enable the SMI source.
136 @retval EFI_OUT_OF_RESOURCES Not enough memory (system or SMM) to manage this
137 child.
138 @retval EFI_INVALID_PARAMETER DispatchContext is invalid. The period input value
139 is not within valid range.
140
141 **/
142 typedef
143 EFI_STATUS
144 (EFIAPI *EFI_SMM_PERIODIC_TIMER_REGISTER) (
145 IN EFI_SMM_PERIODIC_TIMER_DISPATCH_PROTOCOL *This,
146 IN EFI_SMM_PERIODIC_TIMER_DISPATCH DispatchFunction,
147 IN EFI_SMM_PERIODIC_TIMER_DISPATCH_CONTEXT *DispatchContext,
148 OUT EFI_HANDLE *DispatchHandle
149 );
150
151 /**
152 Unregister a child SMI source dispatch function with a parent SMM driver
153
154 @param This Protocol instance pointer.
155 @param DispatchHandle Handle of dispatch function to deregister.
156
157 @retval EFI_SUCCESS The dispatch function has been successfully
158 unregistered and the SMI source has been disabled
159 if there are no other registered child dispatch
160 functions for this SMI source.
161 @retval EFI_INVALID_PARAMETER Handle is invalid.
162
163 **/
164 typedef
165 EFI_STATUS
166 (EFIAPI *EFI_SMM_PERIODIC_TIMER_UNREGISTER) (
167 IN EFI_SMM_PERIODIC_TIMER_DISPATCH_PROTOCOL *This,
168 IN EFI_HANDLE DispatchHandle
169 );
170
171 //
172 // Interface structure for the SMM Periodic Timer Dispatch Protocol
173 //
174 /**
175 @par Protocol Description:
176 Provides the parent dispatch service for the periodical timer SMI source generator.
177
178 @param Register
179 Installs a child service to be dispatched by this protocol.
180
181 @param UnRegister
182 Removes a child service dispatched by this protocol.
183
184 @param GetNextShorterInterval
185 Returns the next SMI tick period that is supported by the chipset.
186
187 **/
188 struct _EFI_SMM_PERIODIC_TIMER_DISPATCH_PROTOCOL {
189 EFI_SMM_PERIODIC_TIMER_REGISTER Register;
190 EFI_SMM_PERIODIC_TIMER_UNREGISTER UnRegister;
191 EFI_SMM_PERIODIC_TIMER_INTERVAL GetNextShorterInterval;
192 };
193
194 extern EFI_GUID gEfiSmmPeriodicTimerDispatchProtocolGuid;
195
196 #endif