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