1 /** @file 2 Provides the parent dispatch service for the periodical timer SMI source generator. 3 4 Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR> 5 This program and the accompanying materials are licensed and made available under 6 the terms and conditions of the BSD License that accompanies this distribution. 7 The full text of the license may be found at 8 http://opensource.org/licenses/bsd-license.php. 9 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 13 @par Revision Reference: 14 This Protocol is defined in Framework of EFI SMM Core Interface Spec 15 Version 0.9. 16 17 **/ 18 19 #ifndef _EFI_SMM_PERIODIC_TIMER_DISPATCH_H_ 20 #define _EFI_SMM_PERIODIC_TIMER_DISPATCH_H_ 21 22 23 // 24 // Global ID for the Periodic Timer SMI Protocol 25 // 26 #define EFI_SMM_PERIODIC_TIMER_DISPATCH_PROTOCOL_GUID \ 27 { \ 28 0x9cca03fc, 0x4c9e, 0x4a19, {0x9b, 0x6, 0xed, 0x7b, 0x47, 0x9b, 0xde, 0x55 } \ 29 } 30 31 typedef struct _EFI_SMM_PERIODIC_TIMER_DISPATCH_PROTOCOL EFI_SMM_PERIODIC_TIMER_DISPATCH_PROTOCOL; 32 33 // 34 // Related Definitions 35 // 36 37 typedef struct { 38 /// 39 /// The minimum period of time that the child gets called, in 100 nanosecond units. 40 /// The child will be called back after a time greater than the time Period. 41 /// 42 UINT64 Period; 43 /// 44 /// The period of time interval between SMIs. Children of this interface 45 /// should use this field when registering for periodic timer intervals when a finer 46 /// granularity periodic SMI is desired. Valid values for this field are those returned 47 /// by GetNextInterval. A value of 0 indicates the parent is allowed to use any SMI 48 /// interval period to satisfy the requested period. 49 /// 50 UINT64 SmiTickInterval; 51 /// 52 /// The actual time in 100 nanosecond units elapsed since last called. A 53 /// value of 0 indicates an unknown amount of time. 54 /// 55 UINT64 ElapsedTime; 56 } EFI_SMM_PERIODIC_TIMER_DISPATCH_CONTEXT; 57 58 // 59 // Member functions 60 // 61 /** 62 Dispatch function for a Periodic Timer SMI handler. 63 64 @param DispatchHandle The handle of this dispatch function. 65 @param DispatchContext The pointer to the dispatch function's context. 66 The DispatchContext fields are filled in 67 by the dispatching driver prior to 68 invoking this dispatch function. 69 70 @return None 71 72 **/ 73 typedef 74 VOID 75 (EFIAPI *EFI_SMM_PERIODIC_TIMER_DISPATCH)( 76 IN EFI_HANDLE DispatchHandle, 77 IN EFI_SMM_PERIODIC_TIMER_DISPATCH_CONTEXT *DispatchContext 78 ); 79 80 /** 81 Returns the next SMI tick period supported by the chipset. The order 82 returned is from longest to shortest interval period. 83 84 @param This The protocol instance pointer. 85 @param SmiTickInterval The pointer to pointer of next shorter SMI interval 86 period supported by the child. This parameter works as a get-first, 87 get-next field. The first time this function is called, *SmiTickInterval 88 should be set to NULL to get the longest SMI interval. The returned 89 *SmiTickInterval should be passed in on subsequent calls to get the 90 next shorter interval period until *SmiTickInterval = NULL. 91 92 @retval EFI_SUCCESS The service returned successfully. 93 94 **/ 95 typedef 96 EFI_STATUS 97 (EFIAPI *EFI_SMM_PERIODIC_TIMER_INTERVAL)( 98 IN EFI_SMM_PERIODIC_TIMER_DISPATCH_PROTOCOL *This, 99 IN OUT UINT64 **SmiTickInterval 100 ); 101 102 /** 103 Register a child SMI source dispatch function with a parent SMM driver 104 105 @param This The pointer to the EFI_SMM_PERIODIC_TIMER_DISPATCH_PROTOCOL instance. 106 @param DispatchFunction The function to install. 107 @param DispatchContext The pointer to the dispatch function's context. 108 Indicates to the register 109 function the period at which the dispatch function 110 should be invoked. 111 @param DispatchHandle The handle generated by the dispatcher to track the function instance. 112 113 @retval EFI_SUCCESS The dispatch function has been successfully 114 registered, and the SMI source has been enabled. 115 @retval EFI_DEVICE_ERROR The driver was unable to enable the SMI source. 116 @retval EFI_OUT_OF_RESOURCES Not enough memory (system or SMM) to manage this 117 child. 118 @retval EFI_INVALID_PARAMETER DispatchContext is invalid. The period input value 119 is not within valid range. 120 121 **/ 122 typedef 123 EFI_STATUS 124 (EFIAPI *EFI_SMM_PERIODIC_TIMER_REGISTER)( 125 IN EFI_SMM_PERIODIC_TIMER_DISPATCH_PROTOCOL *This, 126 IN EFI_SMM_PERIODIC_TIMER_DISPATCH DispatchFunction, 127 IN EFI_SMM_PERIODIC_TIMER_DISPATCH_CONTEXT *DispatchContext, 128 OUT EFI_HANDLE *DispatchHandle 129 ); 130 131 /** 132 Unregisters a periodic timer service. 133 134 @param This The pointer to the EFI_SMM_PERIODIC_TIMER_DISPATCH_PROTOCOL instance. 135 @param DispatchHandle The handle of the service to remove. 136 137 @retval EFI_SUCCESS The dispatch function has been successfully 138 unregistered, and the SMI source has been disabled 139 if there are no other registered child dispatch 140 functions for this SMI source. 141 @retval EFI_INVALID_PARAMETER The handle is invalid. 142 143 **/ 144 typedef 145 EFI_STATUS 146 (EFIAPI *EFI_SMM_PERIODIC_TIMER_UNREGISTER)( 147 IN EFI_SMM_PERIODIC_TIMER_DISPATCH_PROTOCOL *This, 148 IN EFI_HANDLE DispatchHandle 149 ); 150 151 // 152 // Interface structure for the SMM Periodic Timer Dispatch Protocol 153 // 154 /** 155 Provides the parent dispatch service for the periodical timer SMI source generator. 156 **/ 157 struct _EFI_SMM_PERIODIC_TIMER_DISPATCH_PROTOCOL { 158 /// 159 /// Installs a child service to be dispatched by this protocol. 160 /// 161 EFI_SMM_PERIODIC_TIMER_REGISTER Register; 162 163 /// 164 /// Removes a child service dispatched by this protocol. 165 /// 166 EFI_SMM_PERIODIC_TIMER_UNREGISTER UnRegister; 167 168 /// 169 /// Returns the next SMI tick period that is supported by the chipset. 170 /// 171 EFI_SMM_PERIODIC_TIMER_INTERVAL GetNextShorterInterval; 172 }; 173 174 extern EFI_GUID gEfiSmmPeriodicTimerDispatchProtocolGuid; 175 176 #endif 177