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