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