]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Include/Protocol/SmmPeriodicTimerDispatch2.h
MdePkg FirmwareManagement.h: Fix typo EFI_SECURITY_VIOLATIO
[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 - 2017, Intel Corporation. All rights reserved.<BR>
8 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 #include <Protocol/MmPeriodicTimerDispatch.h>
26
27 #define EFI_SMM_PERIODIC_TIMER_DISPATCH2_PROTOCOL_GUID EFI_MM_PERIODIC_TIMER_DISPATCH_PROTOCOL_GUID
28
29 ///
30 /// Example: A chipset supports periodic SMIs on every 64ms or 2 seconds.
31 /// A child wishes schedule a period SMI to fire on a period of 3 seconds, there
32 /// are several ways to approach the problem:
33 /// 1. The child may accept a 4 second periodic rate, in which case it registers with
34 /// Period = 40000
35 /// SmiTickInterval = 20000
36 /// The resulting SMI will occur every 2 seconds with the child called back on
37 /// every 2nd SMI.
38 /// NOTE: the same result would occur if the child set SmiTickInterval = 0.
39 /// 2. The child may choose the finer granularity SMI (64ms):
40 /// Period = 30000
41 /// SmiTickInterval = 640
42 /// The resulting SMI will occur every 64ms with the child called back on
43 /// every 47th SMI.
44 /// NOTE: the child driver should be aware that this will result in more
45 /// SMIs occuring during system runtime which can negatively impact system
46 /// performance.
47 ///
48 typedef struct {
49 ///
50 /// The minimum period of time in 100 nanosecond units that the child gets called. The
51 /// child will be called back after a time greater than the time Period.
52 ///
53 UINT64 Period;
54 ///
55 /// The period of time interval between SMIs. Children of this interface should use this
56 /// field when registering for periodic timer intervals when a finer granularity periodic
57 /// SMI is desired.
58 ///
59 UINT64 SmiTickInterval;
60 } EFI_SMM_PERIODIC_TIMER_REGISTER_CONTEXT;
61
62 ///
63 /// The DispatchFunction will be called with Context set to the same value as was passed into
64 /// Register() in RegisterContext and with CommBuffer pointing to an instance of
65 /// EFI_SMM_PERIODIC_TIMER_CONTEXT and CommBufferSize pointing to its size.
66 ///
67 typedef EFI_MM_PERIODIC_TIMER_CONTEXT EFI_SMM_PERIODIC_TIMER_CONTEXT;
68
69 typedef struct _EFI_SMM_PERIODIC_TIMER_DISPATCH2_PROTOCOL EFI_SMM_PERIODIC_TIMER_DISPATCH2_PROTOCOL;
70
71 /**
72 Register a child SMI source dispatch function for SMM periodic timer.
73
74 This service registers a function (DispatchFunction) which will be called when at least the
75 amount of time specified by RegisterContext has elapsed. On return, DispatchHandle
76 contains a unique handle which may be used later to unregister the function using UnRegister().
77 The DispatchFunction will be called with Context set to the same value as was passed into
78 this function in RegisterContext and with CommBuffer pointing to an instance of
79 EFI_SMM_PERIODIC_TIMER_CONTEXT and CommBufferSize pointing to its size.
80
81 @param[in] This Pointer to the EFI_SMM_PERIODIC_TIMER_DISPATCH2_PROTOCOL instance.
82 @param[in] DispatchFunction Function to register for handler when at least the specified amount
83 of time has elapsed.
84 @param[in] RegisterContext Pointer to the dispatch function's context.
85 The caller fills this context in before calling
86 the register function to indicate to the register
87 function the period at which the dispatch function
88 should be invoked.
89 @param[out] DispatchHandle Handle generated by the dispatcher to track the function instance.
90
91 @retval EFI_SUCCESS The dispatch function has been successfully
92 registered and the SMI source has been enabled.
93 @retval EFI_DEVICE_ERROR The driver was unable to enable the SMI source.
94 @retval EFI_INVALID_PARAMETER RegisterContext is invalid. The period input value
95 is not within valid range.
96 @retval EFI_OUT_OF_RESOURCES There is not enough memory (system or SMM) to manage this child.
97 **/
98 typedef
99 EFI_STATUS
100 (EFIAPI *EFI_SMM_PERIODIC_TIMER_REGISTER2)(
101 IN CONST EFI_SMM_PERIODIC_TIMER_DISPATCH2_PROTOCOL *This,
102 IN EFI_SMM_HANDLER_ENTRY_POINT2 DispatchFunction,
103 IN CONST EFI_SMM_PERIODIC_TIMER_REGISTER_CONTEXT *RegisterContext,
104 OUT EFI_HANDLE *DispatchHandle
105 );
106
107 /**
108 Unregisters a periodic timer service.
109
110 This service removes the handler associated with DispatchHandle so that it will no longer be
111 called when the time has elapsed.
112
113 @param[in] This Pointer to the EFI_SMM_PERIODIC_TIMER_DISPATCH2_PROTOCOL instance.
114 @param[in] DispatchHandle Handle of the service to remove.
115
116 @retval EFI_SUCCESS The service has been successfully removed.
117 @retval EFI_INVALID_PARAMETER The DispatchHandle was not valid.
118 **/
119 typedef
120 EFI_STATUS
121 (EFIAPI *EFI_SMM_PERIODIC_TIMER_UNREGISTER2)(
122 IN CONST EFI_SMM_PERIODIC_TIMER_DISPATCH2_PROTOCOL *This,
123 IN EFI_HANDLE DispatchHandle
124 );
125
126 /**
127 Returns the next SMI tick period supported by the chipset.
128
129 The order returned is from longest to shortest interval period.
130
131 @param[in] This Pointer to the EFI_SMM_PERIODIC_TIMER_DISPATCH2_PROTOCOL instance.
132 @param[in,out] SmiTickInterval Pointer to pointer of next shorter SMI interval
133 period supported by the child. This parameter works as a get-first,
134 get-next field.The first time this function is called, *SmiTickInterval
135 should be set to NULL to get the longest SMI interval.The returned
136 *SmiTickInterval should be passed in on subsequent calls to get the
137 next shorter interval period until *SmiTickInterval = NULL.
138
139 @retval EFI_SUCCESS The service returned successfully.
140 **/
141 typedef
142 EFI_STATUS
143 (EFIAPI *EFI_SMM_PERIODIC_TIMER_INTERVAL2)(
144 IN CONST EFI_SMM_PERIODIC_TIMER_DISPATCH2_PROTOCOL *This,
145 IN OUT UINT64 **SmiTickInterval
146 );
147
148 ///
149 /// Interface structure for the SMM Periodic Timer Dispatch Protocol
150 ///
151 /// This protocol provides the parent dispatch service for the periodical timer SMI source generator.
152 ///
153 struct _EFI_SMM_PERIODIC_TIMER_DISPATCH2_PROTOCOL {
154 EFI_SMM_PERIODIC_TIMER_REGISTER2 Register;
155 EFI_SMM_PERIODIC_TIMER_UNREGISTER2 UnRegister;
156 EFI_SMM_PERIODIC_TIMER_INTERVAL2 GetNextShorterInterval;
157 };
158
159 extern EFI_GUID gEfiSmmPeriodicTimerDispatch2ProtocolGuid;
160
161 #endif
162