--- /dev/null
+/** @file\r
+ SMM Periodic Timer Dispatch Protocol as defined in PI 1.1 Specification\r
+ Volume 4 System Management Mode Core Interface.\r
+\r
+ This protocol provides the parent dispatch service for the periodical timer SMI source generator.\r
+\r
+ Copyright (c) 2009, Intel Corporation\r
+ All rights reserved. This program and the accompanying materials\r
+ are licensed and made available under the terms and conditions of the BSD License\r
+ which accompanies this distribution. The full text of the license may be found at\r
+ http://opensource.org/licenses/bsd-license.php\r
+\r
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+ @par Revision Reference:\r
+ This protocol is from PI Version 1.1.\r
+\r
+**/\r
+\r
+#ifndef _SMM_PERIODIC_TIMER_DISPATCH2_H_\r
+#define _SMM_PERIODIC_TIMER_DISPATCH2_H_\r
+\r
+#include <Pi/PiSmmCis.h>\r
+\r
+#define EFI_SMM_PERIODIC_TIMER_DISPATCH2_PROTOCOL_GUID \\r
+ { \\r
+ 0x4cec368e, 0x8e8e, 0x4d71, {0x8b, 0xe1, 0x95, 0x8c, 0x45, 0xfc, 0x8a, 0x53 } \\r
+ }\r
+\r
+///\r
+/// Example: A chipset supports periodic SMIs on every 64ms or 2 seconds.\r
+/// A child wishes schedule a period SMI to fire on a period of 3 seconds, there\r
+/// are several ways to approach the problem:\r
+/// 1. The child may accept a 4 second periodic rate, in which case it registers with\r
+/// Period = 40000\r
+/// SmiTickInterval = 20000\r
+/// The resulting SMI will occur every 2 seconds with the child called back on\r
+/// every 2nd SMI.\r
+/// NOTE: the same result would occur if the child set SmiTickInterval = 0.\r
+/// 2. The child may choose the finer granularity SMI (64ms):\r
+/// Period = 30000\r
+/// SmiTickInterval = 640\r
+/// The resulting SMI will occur every 64ms with the child called back on\r
+/// every 47th SMI.\r
+/// NOTE: the child driver should be aware that this will result in more\r
+/// SMIs occuring during system runtime which can negatively impact system\r
+/// performance.\r
+///\r
+typedef struct {\r
+ ///\r
+ /// The minimum period of time in 100 nanosecond units that the child gets called. The \r
+ /// child will be called back after a time greater than the time Period.\r
+ ///\r
+ UINT64 Period;\r
+ ///\r
+ /// The period of time interval between SMIs. Children of this interface should use this \r
+ /// field when registering for periodic timer intervals when a finer granularity periodic \r
+ /// SMI is desired.\r
+ ///\r
+ UINT64 SmiTickInterval;\r
+} EFI_SMM_PERIODIC_TIMER_REGISTER_CONTEXT;\r
+\r
+///\r
+/// The DispatchFunction will be called with Context set to the same value as was passed into \r
+/// Register() in RegisterContext and with CommBuffer pointing to an instance of \r
+/// EFI_SMM_PERIODIC_TIMER_CONTEXT and CommBufferSize pointing to its size.\r
+///\r
+typedef struct {\r
+ ///\r
+ /// ElapsedTime is the actual time in 100 nanosecond units elapsed since last called, a\r
+ /// value of 0 indicates an unknown amount of time.\r
+ ///\r
+ UINT64 ElapsedTime;\r
+} EFI_SMM_PERIODIC_TIMER_CONTEXT;\r
+\r
+typedef struct _EFI_SMM_PERIODIC_TIMER_DISPATCH2_PROTOCOL EFI_SMM_PERIODIC_TIMER_DISPATCH2_PROTOCOL;\r
+\r
+/**\r
+ Register a child SMI source dispatch function for SMM periodic timer.\r
+\r
+ This service registers a function (DispatchFunction) which will be called when at least the \r
+ amount of time specified by RegisterContext has elapsed. On return, DispatchHandle \r
+ contains a unique handle which may be used later to unregister the function using UnRegister().\r
+ The DispatchFunction will be called with Context set to the same value as was passed into \r
+ this function in RegisterContext and with CommBuffer pointing to an instance of \r
+ EFI_SMM_PERIODIC_TIMER_CONTEXT and CommBufferSize pointing to its size.\r
+\r
+ @param[in] This Pointer to the EFI_SMM_PERIODIC_TIMER_DISPATCH2_PROTOCOL instance.\r
+ @param[in] DispatchFunction Function to register for handler when at least the specified amount\r
+ of time has elapsed. \r
+ @param[in] RegisterContext Pointer to the dispatch function's context.\r
+ The caller fills this context in before calling\r
+ the register function to indicate to the register\r
+ function the period at which the dispatch function\r
+ should be invoked.\r
+ @param[out] DispatchHandle Handle generated by the dispatcher to track the function instance. \r
+\r
+ @retval EFI_SUCCESS The dispatch function has been successfully\r
+ registered and the SMI source has been enabled.\r
+ @retval EFI_DEVICE_ERROR The driver was unable to enable the SMI source.\r
+ @retval EFI_INVALID_PARAMETER RegisterContext is invalid. The period input value\r
+ is not within valid range.\r
+ @retval EFI_OUT_OF_RESOURCES There is not enough memory (system or SMM) to manage this child.\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_SMM_PERIODIC_TIMER_REGISTER)(\r
+ IN CONST EFI_SMM_PERIODIC_TIMER_DISPATCH2_PROTOCOL *This,\r
+ IN EFI_SMM_HANDLER_ENTRY_POINT2 DispatchFunction,\r
+ IN CONST EFI_SMM_PERIODIC_TIMER_REGISTER_CONTEXT *RegisterContext,\r
+ OUT EFI_HANDLE *DispatchHandle\r
+ );\r
+\r
+/**\r
+ Unregisters a periodic timer service.\r
+\r
+ This service removes the handler associated with DispatchHandle so that it will no longer be \r
+ called when the time has elapsed.\r
+\r
+ @param[in] This Pointer to the EFI_SMM_PERIODIC_TIMER_DISPATCH2_PROTOCOL instance.\r
+ @param[in] DispatchHandle Handle of the service to remove.\r
+\r
+ @retval EFI_SUCCESS The service has been successfully removed.\r
+ @retval EFI_INVALID_PARAMETER The DispatchHandle was not valid.\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_SMM_PERIODIC_TIMER_UNREGISTER)(\r
+ IN CONST EFI_SMM_PERIODIC_TIMER_DISPATCH2_PROTOCOL *This,\r
+ IN EFI_HANDLE DispatchHandle\r
+ );\r
+\r
+/**\r
+ Returns the next SMI tick period supported by the chipset.\r
+\r
+ The order returned is from longest to shortest interval period.\r
+\r
+ @param[in] This Pointer to the EFI_SMM_PERIODIC_TIMER_DISPATCH2_PROTOCOL instance.\r
+ @param[in,out] SmiTickInterval Pointer to pointer of next shorter SMI interval\r
+ period supported by the child. This parameter works as a get-first,\r
+ get-next field.The first time this function is called, *SmiTickInterval\r
+ should be set to NULL to get the longest SMI interval.The returned\r
+ *SmiTickInterval should be passed in on subsequent calls to get the\r
+ next shorter interval period until *SmiTickInterval = NULL.\r
+\r
+ @retval EFI_SUCCESS The service returned successfully.\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_SMM_PERIODIC_TIMER_INTERVAL)(\r
+ IN CONST EFI_SMM_PERIODIC_TIMER_DISPATCH2_PROTOCOL *This,\r
+ IN OUT UINT64 **SmiTickInterval\r
+ );\r
+\r
+///\r
+/// Interface structure for the SMM Periodic Timer Dispatch Protocol\r
+///\r
+/// This protocol provides the parent dispatch service for the periodical timer SMI source generator.\r
+///\r
+struct _EFI_SMM_PERIODIC_TIMER_DISPATCH2_PROTOCOL {\r
+ EFI_SMM_PERIODIC_TIMER_REGISTER Register;\r
+ EFI_SMM_PERIODIC_TIMER_UNREGISTER UnRegister;\r
+ EFI_SMM_PERIODIC_TIMER_INTERVAL GetNextShorterInterval;\r
+};\r
+\r
+extern EFI_GUID gEfiSmmPeriodicTimerDispatch2ProtocolGuid;\r
+\r
+#endif\r
+\r