]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Library/SmmPeriodicSmiLib.h
MdePkg: fix comment typo in DebugLib.h
[mirror_edk2.git] / MdePkg / Include / Library / SmmPeriodicSmiLib.h
CommitLineData
40039e28 1/** @file\r
2 Provides services to enable and disable periodic SMI handlers.\r
3\r
4Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>\r
5This program and the accompanying materials\r
6are licensed and made available under the terms and conditions of the BSD License\r
7which accompanies this distribution. The full text of the license may be found at\r
8http://opensource.org/licenses/bsd-license.php\r
9\r
10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12\r
13**/\r
14\r
15#ifndef __PERIODIC_SMI_LIB_H__\r
16#define __PERIODIC_SMI_LIB_H__\r
17\r
18#define PERIODIC_SMI_LIBRARY_ANY_CPU 0xffffffff\r
19\r
20/**\r
21 This function returns a pointer to a table of supported periodic\r
22 SMI tick periods in 100 ns units sorted from largest to smallest. \r
23 The table contains a array of UINT64 values terminated by a tick \r
24 period value of 0. The returned table must be treated as read-only\r
25 data and must not be freed.\r
26 \r
27 @return A pointer to a table of UINT64 tick period values in \r
28 100ns units sorted from largest to smallest terminated \r
29 by a tick period of 0.\r
30 \r
31**/\r
32UINT64 *\r
33EFIAPI\r
34PeriodicSmiSupportedTickPeriod (\r
35 VOID\r
36 );\r
37\r
38/**\r
39 This function returns the time in 100ns units since the periodic SMI\r
40 handler function was called. If the periodic SMI handler was resumed\r
41 through PeriodicSmiYield(), then the time returned is the time in\r
42 100ns units since PeriodicSmiYield() returned.\r
43\r
44 @return The actual time in 100ns units that the periodic SMI handler\r
45 has been executing. If this function is not called from within\r
46 an enabled periodic SMI handler, then 0 is returned.\r
47\r
48**/\r
49UINT64\r
50EFIAPI\r
51PeriodicSmiExecutionTime (\r
52 VOID\r
53 );\r
54\r
55/**\r
56 This function returns control back to the SMM Foundation. When the next \r
57 periodic SMI for the currently executing handler is triggered, the periodic\r
58 SMI handler will restarted from its registered DispatchFunction entry point.\r
59 If this function is not called from within an enabled periodic SMI handler, \r
60 then control is returned to the calling function.\r
61\r
62**/\r
63VOID\r
64EFIAPI \r
65PeriodicSmiExit (\r
66 VOID\r
67 );\r
68\r
69/**\r
70 This function yields control back to the SMM Foundation. When the next \r
71 periodic SMI for the currently executing handler is triggered, the periodic\r
72 SMI handler will be resumed and this function will return. Use of this \r
73 function requires a seperate stack for the periodic SMI handler. A non zero\r
74 stack size must be specified in PeriodicSmiEnable() for this function to be \r
75 used. \r
76 \r
77 If the stack size passed into PeriodicSmiEnable() was zero, the 0 is returned.\r
78 \r
79 If this function is not called from within an enabled periodic SMI handler, \r
80 then 0 is returned.\r
81\r
82 @return The actual time in 100ns units elasped since this function was\r
83 called. A value of 0 indicates an unknown amount of time.\r
84\r
85**/\r
86UINT64\r
87EFIAPI \r
88PeriodicSmiYield (\r
89 VOID\r
90 );\r
91\r
92/**\r
93 This function is a prototype for a periodic SMI handler function \r
94 that may be enabled with PeriodicSmiEnable() and disabled with\r
95 PeriodicSmiDisable().\r
96\r
97 @param[in] Context Content registered with PeriodicSmiEnable().\r
98 @param[in] ElapsedTime The actual time in 100ns units elasped since \r
99 this function was called. A value of 0 indicates \r
100 an unknown amount of time.\r
101 \r
102**/\r
103typedef\r
104VOID\r
105(EFIAPI *PERIODIC_SMI_LIBRARY_HANDLER) (\r
106 IN CONST VOID *Context OPTIONAL,\r
107 IN UINT64 ElapsedTime\r
108 );\r
109 \r
110/**\r
111 This function enables a periodic SMI handler.\r
112 \r
ba319b96 113 @param[in, out] DispatchHandle A pointer to the handle associated with the \r
40039e28 114 enabled periodic SMI handler. This is an \r
115 optional parameter that may be NULL. If it is \r
116 NULL, then the handle will not be returned, \r
117 which means that the periodic SMI handler can \r
118 never be disabled.\r
119 @param[in] DispatchFunction A pointer to a periodic SMI handler function.\r
120 @param[in] Context Optional content to pass into DispatchFunction.\r
121 @param[in] TickPeriod The requested tick period in 100ns units that \r
122 control should be givien to the periodic SMI\r
123 handler. Must be one of the supported values\r
124 returned by PeriodicSmiSupportedPickPeriod().\r
125 @param[in] Cpu Specifies the CPU that is required to execute\r
126 the periodic SMI handler. If Cpu is \r
127 PERIODIC_SMI_LIBRARY_ANY_CPU, then the periodic \r
128 SMI handler will always be executed on the SMST \r
129 CurrentlyExecutingCpu, which may vary across \r
130 periodic SMIs. If Cpu is between 0 and the SMST \r
131 NumberOfCpus, then the periodic SMI will always\r
132 be executed on the requested CPU.\r
133 @param[in] StackSize The size, in bytes, of the stack to allocate for\r
134 use by the periodic SMI handler. If 0, then the\r
135 default stack will be used.\r
136 \r
137 @retval EFI_INVALID_PARAMETER DispatchFunction is NULL.\r
138 @retval EFI_UNSUPPORTED TickPeriod is not a supported tick period. The \r
139 supported tick periods can be retrieved using \r
140 PeriodicSmiSupportedTickPeriod().\r
141 @retval EFI_INVALID_PARAMETER Cpu is not PERIODIC_SMI_LIBRARY_ANY_CPU or in \r
142 the range 0 to SMST NumberOfCpus.\r
143 @retval EFI_OUT_OF_RESOURCES There are not enough resources to enable the \r
144 periodic SMI handler.\r
145 @retval EFI_OUT_OF_RESOURCES There are not enough resources to allocate the \r
146 stack speficied by StackSize.\r
147 @retval EFI_SUCCESS The periodic SMI handler was enabled.\r
148 \r
149**/\r
150EFI_STATUS \r
151EFIAPI\r
152PeriodicSmiEnable (\r
153 IN OUT EFI_HANDLE *DispatchHandle, OPTIONAL\r
154 IN PERIODIC_SMI_LIBRARY_HANDLER DispatchFunction,\r
155 IN CONST VOID *Context, OPTIONAL\r
156 IN UINT64 TickPeriod,\r
157 IN UINTN Cpu,\r
158 IN UINTN StackSize\r
159 );\r
160\r
161/**\r
162 This function disables a periodic SMI handler that has been previously\r
163 enabled with PeriodicSmiEnable().\r
164 \r
165 @param[in] DispatchHandle A handle associated with a previously enabled periodic \r
166 SMI handler. This is an optional parameter that may\r
167 be NULL. If it is NULL, then the active periodic SMI\r
168 handlers is disabled.\r
169\r
170 @retval FALSE DispatchHandle is NULL and there is no active periodic SMI handler.\r
171 @retval FALSE The periodic SMI handler specified by DispatchHandle has \r
172 not been enabled with PeriodicSmiEnable().\r
173 @retval TRUE The periodic SMI handler specified by DispatchHandle has \r
174 been disabled. If DispatchHandle is NULL, then the active\r
175 periodic SMI handler has been disabled.\r
176 \r
177**/\r
178BOOLEAN \r
179EFIAPI\r
180PeriodicSmiDisable (\r
181 IN EFI_HANDLE DispatchHandle OPTIONAL\r
182 );\r
183 \r
184#endif\r