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