]> git.proxmox.com Git - mirror_edk2.git/blob - IntelFrameworkPkg/Include/Protocol/SmmPeriodicTimerDispatch.h
283f6bed0001850e44a5deeef38d3019bc0035df
[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 - 2009, 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 typedef struct {
41 ///
42 /// The minimum period of time in 100 nanosecond units that child gets called.
43 /// The child will be called back after a time greater than the time Period.
44 ///
45 UINT64 Period;
46 ///
47 /// The period of time interval between SMIs. Children of this interface
48 /// should use this field when registering for periodic timer intervals when a finer
49 /// granularity periodic SMI is desired. Valid values for this field are those returned
50 /// by GetNextInterval. A value of 0 indicates the parent is allowed to use any SMI
51 /// interval period to satisfy the requested period.
52 ///
53 UINT64 SmiTickInterval;
54 ///
55 /// The actual time in 100 nanosecond units elapsed since last called, a
56 /// value of 0 indicates an unknown amount of time.
57 ///
58 UINT64 ElapsedTime;
59 } EFI_SMM_PERIODIC_TIMER_DISPATCH_CONTEXT;
60
61 //
62 // Member functions
63 //
64 /**
65 Dispatch function for a Periodic Timer SMI handler.
66
67 @param DispatchHandle Handle of this dispatch function.
68 @param DispatchContext Pointer to the dispatch function's context.
69 The DispatchContext fields are filled in
70 by the dispatching driver prior to
71 invoking this dispatch function.
72
73 @return None
74
75 **/
76 typedef
77 VOID
78 (EFIAPI *EFI_SMM_PERIODIC_TIMER_DISPATCH)(
79 IN EFI_HANDLE DispatchHandle,
80 IN EFI_SMM_PERIODIC_TIMER_DISPATCH_CONTEXT *DispatchContext
81 );
82
83 /**
84 Returns the next SMI tick period supported by the chipset. The order
85 returned is from longest to shortest interval period.
86
87 @param This Protocol instance pointer.
88 @param SmiTickInterval Pointer to pointer of next shorter SMI interval
89 period supported by the child. This parameter works as a get-first,
90 get-next field.The first time this function is called, *SmiTickInterval
91 should be set to NULL to get the longest SMI interval.The returned
92 *SmiTickInterval should be passed in on subsequent calls to get the
93 next shorter interval period until *SmiTickInterval = NULL.
94
95 @retval EFI_SUCCESS The service returned successfully.
96
97 **/
98 typedef
99 EFI_STATUS
100 (EFIAPI *EFI_SMM_PERIODIC_TIMER_INTERVAL)(
101 IN EFI_SMM_PERIODIC_TIMER_DISPATCH_PROTOCOL *This,
102 IN OUT UINT64 **SmiTickInterval
103 );
104
105 /**
106 Register a child SMI source dispatch function with a parent SMM driver
107
108 @param This Pointer to the EFI_SMM_PERIODIC_TIMER_DISPATCH_PROTOCOL instance.
109 @param DispatchFunction Function to install.
110 @param DispatchContext Pointer to the dispatch function's context.
111 The caller fills this context in before calling
112 the register function to indicate to the register
113 function the period at which the dispatch function
114 should be invoked.
115 @param DispatchHandle Handle generated by the dispatcher to track the function instance.
116
117 @retval EFI_SUCCESS The dispatch function has been successfully
118 registered and the SMI source has been enabled.
119 @retval EFI_DEVICE_ERROR The driver was unable to enable the SMI source.
120 @retval EFI_OUT_OF_RESOURCES Not enough memory (system or SMM) to manage this
121 child.
122 @retval EFI_INVALID_PARAMETER DispatchContext is invalid. The period input value
123 is not within valid range.
124
125 **/
126 typedef
127 EFI_STATUS
128 (EFIAPI *EFI_SMM_PERIODIC_TIMER_REGISTER)(
129 IN EFI_SMM_PERIODIC_TIMER_DISPATCH_PROTOCOL *This,
130 IN EFI_SMM_PERIODIC_TIMER_DISPATCH DispatchFunction,
131 IN EFI_SMM_PERIODIC_TIMER_DISPATCH_CONTEXT *DispatchContext,
132 OUT EFI_HANDLE *DispatchHandle
133 );
134
135 /**
136 Unregisters a periodic timer service.
137
138 @param This Pointer to the EFI_SMM_PERIODIC_TIMER_DISPATCH_PROTOCOL instance.
139 @param DispatchHandle Handle of the service to remove.
140
141 @retval EFI_SUCCESS The dispatch function has been successfully
142 unregistered and the SMI source has been disabled
143 if there are no other registered child dispatch
144 functions for this SMI source.
145 @retval EFI_INVALID_PARAMETER Handle is invalid.
146
147 **/
148 typedef
149 EFI_STATUS
150 (EFIAPI *EFI_SMM_PERIODIC_TIMER_UNREGISTER)(
151 IN EFI_SMM_PERIODIC_TIMER_DISPATCH_PROTOCOL *This,
152 IN EFI_HANDLE DispatchHandle
153 );
154
155 //
156 // Interface structure for the SMM Periodic Timer Dispatch Protocol
157 //
158 /**
159 @par Protocol Description:
160 Provides the parent dispatch service for the periodical timer SMI source generator.
161
162 @param Register
163 Installs a child service to be dispatched by this protocol.
164
165 @param UnRegister
166 Removes a child service dispatched by this protocol.
167
168 @param GetNextShorterInterval
169 Returns the next SMI tick period that is supported by the chipset.
170
171 **/
172 struct _EFI_SMM_PERIODIC_TIMER_DISPATCH_PROTOCOL {
173 EFI_SMM_PERIODIC_TIMER_REGISTER Register;
174 EFI_SMM_PERIODIC_TIMER_UNREGISTER UnRegister;
175 EFI_SMM_PERIODIC_TIMER_INTERVAL GetNextShorterInterval;
176 };
177
178 extern EFI_GUID gEfiSmmPeriodicTimerDispatchProtocolGuid;
179
180 #endif