]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdePkg/Library/SmmPeriodicSmiLib/SmmPeriodicSmiLib.c
MdePkg: Clean up source files
[mirror_edk2.git] / MdePkg / Library / SmmPeriodicSmiLib / SmmPeriodicSmiLib.c
index ca6967c9beeb13d53f48f1c0e9778a15df121ce0..dc9250a1a300953646f67f187f73732e1730d25d 100644 (file)
@@ -62,13 +62,13 @@ typedef struct {
   ///\r
   UINT64                                   TickPeriod;\r
   ///\r
-  /// The Cpu number that is required to execute DispatchFunction.  If Cpu is \r
-  /// set to PERIODIC_SMI_LIBRARY_ANY_CPU, then DispatchFunction may be executed \r
+  /// The Cpu number that is required to execute DispatchFunction.  If Cpu is\r
+  /// set to PERIODIC_SMI_LIBRARY_ANY_CPU, then DispatchFunction may be executed\r
   /// on any CPU.\r
   ///\r
   UINTN                                    Cpu;\r
   ///\r
-  /// The size, in bytes, of the stack allocated for a periodic SMI handler.  \r
+  /// The size, in bytes, of the stack allocated for a periodic SMI handler.\r
   /// This value must be a multiple of EFI_PAGE_SIZE.\r
   ///\r
   UINTN                                    StackSize;\r
@@ -82,27 +82,27 @@ typedef struct {
   ///\r
   SPIN_LOCK                                DispatchLock;\r
   ///\r
-  /// The rate in Hz of the performance counter that is used to measure the \r
+  /// The rate in Hz of the performance counter that is used to measure the\r
   /// amount of time that a periodic SMI handler executes.\r
   ///\r
   UINT64                                   PerfomanceCounterRate;\r
   ///\r
-  /// The start count value of the performance counter that is used to measure \r
+  /// The start count value of the performance counter that is used to measure\r
   /// the amount of time that a periodic SMI handler executes.\r
   ///\r
   UINT64                                   PerfomanceCounterStartValue;\r
   ///\r
-  /// The end count value of the performance counter that is used to measure \r
+  /// The end count value of the performance counter that is used to measure\r
   /// the amount of time that a periodic SMI handler executes.\r
   ///\r
   UINT64                                   PerfomanceCounterEndValue;\r
   ///\r
-  /// The context record passed into the Register() function of the SMM Periodic \r
+  /// The context record passed into the Register() function of the SMM Periodic\r
   /// Timer Dispatch Protocol when a periodic SMI handler is enabled.\r
   ///\r
   EFI_SMM_PERIODIC_TIMER_REGISTER_CONTEXT  RegisterContext;\r
   ///\r
-  /// The handle returned from the Register() function of the SMM Periodic \r
+  /// The handle returned from the Register() function of the SMM Periodic\r
   /// Timer Dispatch Protocol when a periodic SMI handler is enabled.\r
   ///\r
   EFI_HANDLE                               DispatchHandle;\r
@@ -112,7 +112,7 @@ typedef struct {
   ///\r
   UINT64                                   DispatchTotalTime;\r
   ///\r
-  /// The performance counter value that was captured the last time that the \r
+  /// The performance counter value that was captured the last time that the\r
   /// periodic SMI handler called PeriodcSmiExecutionTime().  This allows the\r
   /// time value returned by PeriodcSmiExecutionTime() to be accurate even when\r
   /// the performance counter rolls over.\r
@@ -120,19 +120,19 @@ typedef struct {
   UINT64                                   DispatchCheckPointTime;\r
   ///\r
   /// Buffer used to save the context when control is transfer from this library\r
-  /// to an enabled periodic SMI handler.  This saved context is used when the \r
-  /// periodic SMI handler exits or yields.  \r
+  /// to an enabled periodic SMI handler.  This saved context is used when the\r
+  /// periodic SMI handler exits or yields.\r
   ///\r
   BASE_LIBRARY_JUMP_BUFFER                 DispatchJumpBuffer;\r
   ///\r
-  /// Flag that is set to TRUE when a periodic SMI handler requests to yield \r
-  /// using PeriodicSmiYield().  When this flag IS TRUE, YieldJumpBuffer is \r
+  /// Flag that is set to TRUE when a periodic SMI handler requests to yield\r
+  /// using PeriodicSmiYield().  When this flag IS TRUE, YieldJumpBuffer is\r
   /// valid.  When this flag is FALSE, YieldJumpBuffer is not valid.\r
   ///\r
   BOOLEAN                                  YieldFlag;\r
   ///\r
-  /// Buffer used to save the context when a periodic SMI handler requests to \r
-  /// yield using PeriodicSmiYield().  This context is used to resume the \r
+  /// Buffer used to save the context when a periodic SMI handler requests to\r
+  /// yield using PeriodicSmiYield().  This context is used to resume the\r
   /// execution of a periodic SMI handler the next time control is transferd\r
   /// to the periodic SMI handler that yielded.\r
   ///\r
@@ -145,7 +145,7 @@ typedef struct {
 } PERIODIC_SMI_LIBRARY_HANDLER_CONTEXT;\r
 \r
 /**\r
- Macro that returns a pointer to a PERIODIC_SMI_LIBRARY_HANDLER_CONTEXT \r
+ Macro that returns a pointer to a PERIODIC_SMI_LIBRARY_HANDLER_CONTEXT\r
  structure based on a pointer to a Link field.\r
 \r
 **/\r
@@ -163,10 +163,10 @@ typedef struct {
 EFI_SMM_PERIODIC_TIMER_DISPATCH2_PROTOCOL  *gSmmPeriodicTimerDispatch2           = NULL;\r
 \r
 ///\r
-/// Pointer to a table of supported periodic SMI tick periods in 100 ns units \r
+/// Pointer to a table of supported periodic SMI tick periods in 100 ns units\r
 /// sorted from largest to smallest terminated by a tick period value of 0.\r
-/// This table is allocated using AllocatePool() in the constructor and filled \r
-/// in based on the values returned from the SMM Periodic Timer Dispatch 2 Protocol \r
+/// This table is allocated using AllocatePool() in the constructor and filled\r
+/// in based on the values returned from the SMM Periodic Timer Dispatch 2 Protocol\r
 /// function GetNextShorterInterval().\r
 ///\r
 UINT64                                     *gSmiTickPeriodTable                  = NULL;\r
@@ -190,15 +190,15 @@ LIST_ENTRY                                 gPeriodicSmiLibraryHandlers
 PERIODIC_SMI_LIBRARY_HANDLER_CONTEXT       *gActivePeriodicSmiLibraryHandler     = NULL;\r
 \r
 /**\r
-  Internal worker function that returns a pointer to the \r
-  PERIODIC_SMI_LIBRARY_HANDLER_CONTEXT structure associated with the periodic \r
-  SMI handler that is currently being executed.  If a periodic SMI handler is \r
+  Internal worker function that returns a pointer to the\r
+  PERIODIC_SMI_LIBRARY_HANDLER_CONTEXT structure associated with the periodic\r
+  SMI handler that is currently being executed.  If a periodic SMI handler is\r
   not currently being executed, the NULL is returned.\r
-  \r
+\r
   @retval  NULL   A periodic SMI handler is not currently being executed.\r
   @retval  other  Pointer to the PERIODIC_SMI_LIBRARY_HANDLER_CONTEXT\r
                   associated with the active periodic SMI handler.\r
-  \r
+\r
 **/\r
 PERIODIC_SMI_LIBRARY_HANDLER_CONTEXT *\r
 GetActivePeriodicSmiLibraryHandler (\r
@@ -209,26 +209,26 @@ GetActivePeriodicSmiLibraryHandler (
 }\r
 \r
 /**\r
-  Internal worker function that returns a pointer to the \r
-  PERIODIC_SMI_LIBRARY_HANDLER_CONTEXT structure associated with the \r
+  Internal worker function that returns a pointer to the\r
+  PERIODIC_SMI_LIBRARY_HANDLER_CONTEXT structure associated with the\r
   DispatchHandle that was returned when the periodic SMI handler was enabled\r
-  with PeriodicSmiEnable().  If DispatchHandle is NULL, then the active \r
+  with PeriodicSmiEnable().  If DispatchHandle is NULL, then the active\r
   periodic SMI handler is returned.  If DispatchHandle is NULL and there is\r
   no active periodic SMI handler, then NULL is returned.\r
-  \r
-  @param[in] DispatchHandle  DispatchHandle that was returned when the periodic \r
-                             SMI handler was enabled with PeriodicSmiEnable().  \r
+\r
+  @param[in] DispatchHandle  DispatchHandle that was returned when the periodic\r
+                             SMI handler was enabled with PeriodicSmiEnable().\r
                              This is an optional parameter that may be NULL.\r
                              If this parameter is NULL, then the active periodic\r
                              SMI handler is returned.\r
-  \r
-  @retval  NULL   DispatchHandle is NULL and there is no active periodic SMI \r
+\r
+  @retval  NULL   DispatchHandle is NULL and there is no active periodic SMI\r
                   handler.\r
   @retval  NULL   DispatchHandle does not match any of the periodic SMI handlers\r
                   that have been enabled with PeriodicSmiEnable().\r
   @retval  other  Pointer to the PERIODIC_SMI_LIBRARY_HANDLER_CONTEXT\r
                   associated with the DispatchHandle.\r
-  \r
+\r
 **/\r
 PERIODIC_SMI_LIBRARY_HANDLER_CONTEXT *\r
 LookupPeriodicSmiLibraryHandler (\r
@@ -258,7 +258,7 @@ LookupPeriodicSmiLibraryHandler (
       return PeriodicSmiLibraryHandler;\r
     }\r
   }\r
-  \r
+\r
   //\r
   // No entries match DispatchHandle, so return NULL\r
   //\r
@@ -266,11 +266,11 @@ LookupPeriodicSmiLibraryHandler (
 }\r
 \r
 /**\r
-  Internal worker function that sets that active periodic SMI handler based on \r
+  Internal worker function that sets that active periodic SMI handler based on\r
   the DispatchHandle that was returned when the periodic SMI handler was enabled\r
-  with PeriodicSmiEnable(). If DispatchHandle is NULL, then the \r
+  with PeriodicSmiEnable(). If DispatchHandle is NULL, then the\r
   state is updated to show that there is not active periodic SMI handler.\r
-  A pointer to the active PERIODIC_SMI_LIBRARY_HANDLER_CONTEXT structure \r
+  A pointer to the active PERIODIC_SMI_LIBRARY_HANDLER_CONTEXT structure\r
   is returned.\r
 \r
   @param [in] DispatchHandle DispatchHandle that was returned when the periodic\r
@@ -281,7 +281,7 @@ LookupPeriodicSmiLibraryHandler (
   @retval  NULL   DispatchHandle is NULL.\r
   @retval  other  Pointer to the PERIODIC_SMI_LIBRARY_HANDLER_CONTEXT\r
                   associated with DispatchHandle.\r
-  \r
+\r
 **/\r
 PERIODIC_SMI_LIBRARY_HANDLER_CONTEXT *\r
 SetActivePeriodicSmiLibraryHandler (\r
@@ -354,10 +354,10 @@ EnlargeFreePeriodicSmiLibraryHandlerList (
   Internal worker function that returns a free entry for a new periodic\r
   SMI handler.  If no free entries are available, then additional\r
   entries are allocated.\r
-  \r
+\r
   @retval  NULL   There are not enough resources available to to allocate a free entry.\r
   @retval  other  Pointer to a free PERIODIC_SMI_LIBRARY_HANDLER_CONTEXT structure.\r
-  \r
+\r
 **/\r
 PERIODIC_SMI_LIBRARY_HANDLER_CONTEXT *\r
 FindFreePeriodicSmiLibraryHandler (\r
@@ -365,7 +365,7 @@ FindFreePeriodicSmiLibraryHandler (
   )\r
 {\r
   PERIODIC_SMI_LIBRARY_HANDLER_CONTEXT  *PeriodicSmiLibraryHandler;\r
-  \r
+\r
   if (IsListEmpty (&gFreePeriodicSmiLibraryHandlers)) {\r
     if (!EnlargeFreePeriodicSmiLibraryHandlerList ()) {\r
       return NULL;\r
@@ -386,15 +386,15 @@ FindFreePeriodicSmiLibraryHandler (
 \r
 /**\r
   This function returns a pointer to a table of supported periodic\r
-  SMI tick periods in 100 ns units sorted from largest to smallest.  \r
-  The table contains a array of UINT64 values terminated by a tick \r
+  SMI tick periods in 100 ns units sorted from largest to smallest.\r
+  The table contains a array of UINT64 values terminated by a tick\r
   period value of 0.  The returned table must be treated as read-only\r
   data and must not be freed.\r
-  \r
-  @return  A pointer to a table of UINT64 tick period values in \r
-           100ns units sorted from largest to smallest terminated \r
+\r
+  @return  A pointer to a table of UINT64 tick period values in\r
+           100ns units sorted from largest to smallest terminated\r
            by a tick period of 0.\r
-  \r
+\r
 **/\r
 UINT64 *\r
 EFIAPI\r
@@ -430,21 +430,21 @@ PeriodicSmiExecutionTime (
   UINT64                                Count;\r
 \r
   //\r
-  // If there is no active periodic SMI handler, then return 0 \r
+  // If there is no active periodic SMI handler, then return 0\r
   //\r
   PeriodicSmiLibraryHandler = GetActivePeriodicSmiLibraryHandler ();\r
   if (PeriodicSmiLibraryHandler == NULL) {\r
     return 0;\r
   }\r
-  \r
+\r
   //\r
   // Get the current performance counter value\r
   //\r
   Current = GetPerformanceCounter ();\r
-  \r
+\r
   //\r
-  // Count the number of performance counter ticks since the periodic SMI handler \r
-  // was dispatched or the last time this function was called. \r
+  // Count the number of performance counter ticks since the periodic SMI handler\r
+  // was dispatched or the last time this function was called.\r
   //\r
   if (PeriodicSmiLibraryHandler->PerfomanceCounterEndValue > PeriodicSmiLibraryHandler->PerfomanceCounterStartValue) {\r
     //\r
@@ -465,58 +465,58 @@ PeriodicSmiExecutionTime (
       Count = (PeriodicSmiLibraryHandler->DispatchCheckPointTime - PeriodicSmiLibraryHandler->PerfomanceCounterEndValue) + (PeriodicSmiLibraryHandler->PerfomanceCounterStartValue - Current);\r
     }\r
   }\r
-  \r
+\r
   //\r
-  // Accumulate the total number of performance counter ticks since the periodic \r
+  // Accumulate the total number of performance counter ticks since the periodic\r
   // SMI handler was dispatched or resumed.\r
   //\r
   PeriodicSmiLibraryHandler->DispatchTotalTime += Count;\r
-  \r
+\r
   //\r
   // Update the checkpoint value to the current performance counter value\r
   //\r
   PeriodicSmiLibraryHandler->DispatchCheckPointTime = Current;\r
-  \r
+\r
   //\r
   // Convert the total number of performance counter ticks to 100 ns units\r
   //\r
   return DivU64x64Remainder (\r
-           MultU64x32 (PeriodicSmiLibraryHandler->DispatchTotalTime, 10000000), \r
-           PeriodicSmiLibraryHandler->PerfomanceCounterRate, \r
+           MultU64x32 (PeriodicSmiLibraryHandler->DispatchTotalTime, 10000000),\r
+           PeriodicSmiLibraryHandler->PerfomanceCounterRate,\r
            NULL\r
            );\r
 }\r
 \r
 /**\r
-  This function returns control back to the SMM Foundation.  When the next \r
+  This function returns control back to the SMM Foundation.  When the next\r
   periodic SMI for the currently executing handler is triggered, the periodic\r
   SMI handler will restarted from its registered DispatchFunction entry point.\r
-  If this function is not called from within an enabled periodic SMI handler, \r
+  If this function is not called from within an enabled periodic SMI handler,\r
   then control is returned to the calling function.\r
 \r
 **/\r
 VOID\r
-EFIAPI  \r
+EFIAPI\r
 PeriodicSmiExit (\r
   VOID\r
   )\r
 {\r
   PERIODIC_SMI_LIBRARY_HANDLER_CONTEXT  *PeriodicSmiLibraryHandler;\r
-  \r
+\r
   //\r
-  // If there is no active periodic SMI handler, then return \r
+  // If there is no active periodic SMI handler, then return\r
   //\r
   PeriodicSmiLibraryHandler = GetActivePeriodicSmiLibraryHandler ();\r
   if (PeriodicSmiLibraryHandler == NULL) {\r
     return;\r
   }\r
-  \r
+\r
   //\r
-  // Perform a long jump back to the point when the currently executing dispatch \r
+  // Perform a long jump back to the point when the currently executing dispatch\r
   // function was dispatched.\r
   //\r
   LongJump (&PeriodicSmiLibraryHandler->DispatchJumpBuffer, 1);\r
-  \r
+\r
   //\r
   // Must never return\r
   //\r
@@ -525,16 +525,16 @@ PeriodicSmiExit (
 }\r
 \r
 /**\r
-  This function yields control back to the SMM Foundation.  When the next \r
+  This function yields control back to the SMM Foundation.  When the next\r
   periodic SMI for the currently executing handler is triggered, the periodic\r
-  SMI handler will be resumed and this function will return.  Use of this \r
+  SMI handler will be resumed and this function will return.  Use of this\r
   function requires a seperate stack for the periodic SMI handler.  A non zero\r
-  stack size must be specified in PeriodicSmiEnable() for this function to be \r
-  used.  \r
-  \r
+  stack size must be specified in PeriodicSmiEnable() for this function to be\r
+  used.\r
+\r
   If the stack size passed into PeriodicSmiEnable() was zero, the 0 is returned.\r
-  \r
-  If this function is not called from within an enabled periodic SMI handler, \r
+\r
+  If this function is not called from within an enabled periodic SMI handler,\r
   then 0 is returned.\r
 \r
   @return  The actual time in 100ns units elapsed since this function was\r
@@ -542,7 +542,7 @@ PeriodicSmiExit (
 \r
 **/\r
 UINT64\r
-EFIAPI  \r
+EFIAPI\r
 PeriodicSmiYield (\r
   VOID\r
   )\r
@@ -551,30 +551,30 @@ PeriodicSmiYield (
   UINTN                                 SetJumpFlag;\r
 \r
   //\r
-  // If there is no active periodic SMI handler, then return \r
+  // If there is no active periodic SMI handler, then return\r
   //\r
   PeriodicSmiLibraryHandler = GetActivePeriodicSmiLibraryHandler ();\r
   if (PeriodicSmiLibraryHandler == NULL) {\r
     return 0;\r
   }\r
-  \r
+\r
   //\r
-  // If PeriodicSmiYield() is called without an allocated stack, then just return \r
+  // If PeriodicSmiYield() is called without an allocated stack, then just return\r
   // immediately with an elapsed time of 0.\r
   //\r
   if (PeriodicSmiLibraryHandler->Stack == NULL) {\r
     return 0;\r
   }\r
-  \r
+\r
   //\r
-  // Set a flag so the next periodic SMI event will resume at where SetJump() \r
+  // Set a flag so the next periodic SMI event will resume at where SetJump()\r
   // is called below.\r
   //\r
   PeriodicSmiLibraryHandler->YieldFlag = TRUE;\r
 \r
   //\r
   // Save context in YieldJumpBuffer\r
-  //  \r
+  //\r
   SetJumpFlag = SetJump (&PeriodicSmiLibraryHandler->YieldJumpBuffer);\r
   if (SetJumpFlag == 0) {\r
     //\r
@@ -583,10 +583,10 @@ PeriodicSmiYield (
     //\r
     PeriodicSmiExit ();\r
   }\r
-  \r
+\r
   //\r
   // We get here when a LongJump is performed from PeriodicSmiDispatchFunctionOnCpu()\r
-  // to resume a periodic SMI handler that called PeriodicSmiYield() on the \r
+  // to resume a periodic SMI handler that called PeriodicSmiYield() on the\r
   // previous time this periodic SMI handler was dispatched.\r
   //\r
   // Clear the flag so the next periodic SMI dispatch will not resume.\r
@@ -595,14 +595,14 @@ PeriodicSmiYield (
 \r
   //\r
   // Return the amount elapsed time that occured while yielded\r
-  //  \r
+  //\r
   return PeriodicSmiLibraryHandler->ElapsedTime;\r
 }\r
 \r
 /**\r
-  Internal worker function that transfers control to an enabled periodic SMI \r
-  handler.  If the enabled periodic SMI handler was allocated its own stack, \r
-  then this function is called on that allocated stack through the BaseLin \r
+  Internal worker function that transfers control to an enabled periodic SMI\r
+  handler.  If the enabled periodic SMI handler was allocated its own stack,\r
+  then this function is called on that allocated stack through the BaseLin\r
   function SwitchStack().\r
 \r
   @param[in] Context1  Context1 parameter passed into SwitchStack().\r
@@ -619,37 +619,37 @@ PeriodicSmiDispatchFunctionSwitchStack (
   PERIODIC_SMI_LIBRARY_HANDLER_CONTEXT  *PeriodicSmiLibraryHandler;\r
 \r
   //\r
-  // Convert Context1 to PERIODIC_SMI_LIBRARY_HANDLER_CONTEXT * \r
-  //  \r
+  // Convert Context1 to PERIODIC_SMI_LIBRARY_HANDLER_CONTEXT *\r
+  //\r
   PeriodicSmiLibraryHandler = (PERIODIC_SMI_LIBRARY_HANDLER_CONTEXT *)Context1;\r
 \r
   //\r
   // Dispatch the registered handler passing in the context that was registered\r
-  // and the amount of time that has elapsed since the previous time this \r
+  // and the amount of time that has elapsed since the previous time this\r
   // periodic SMI handler was dispacthed.\r
-  //  \r
+  //\r
   PeriodicSmiLibraryHandler->DispatchFunction (\r
     PeriodicSmiLibraryHandler->Context,\r
     PeriodicSmiLibraryHandler->ElapsedTime\r
     );\r
-    \r
+\r
   //\r
   // If this DispatchFunction() returns, then unconditially call PeriodicSmiExit()\r
-  // to perform a LongJump() back to PeriodicSmiDispatchFunctionOnCpu(). The \r
+  // to perform a LongJump() back to PeriodicSmiDispatchFunctionOnCpu(). The\r
   // LongJump() will resume exection on the original stack.\r
-  //  \r
+  //\r
   PeriodicSmiExit ();\r
 }\r
 \r
 /**\r
-  Internal worker function that transfers control to an enabled periodic SMI \r
-  handler on the specified logial CPU.  This function determines if the periodic \r
-  SMI handler yielded and needs to be resumed.  It also and switches to an \r
+  Internal worker function that transfers control to an enabled periodic SMI\r
+  handler on the specified logial CPU.  This function determines if the periodic\r
+  SMI handler yielded and needs to be resumed.  It also and switches to an\r
   allocated stack if one was allocated in PeriodicSmiEnable().\r
 \r
   @param[in] PeriodicSmiLibraryHandler  A pointer to the context for the periodic\r
                                         SMI handler to execute.\r
-  \r
+\r
 **/\r
 VOID\r
 EFIAPI\r
@@ -658,44 +658,44 @@ PeriodicSmiDispatchFunctionOnCpu (
   )\r
 {\r
   //\r
-  // Save context in DispatchJumpBuffer.  The intial call to SetJump() always \r
-  // returns 0.  If this is the initial call, then either resume from a prior \r
-  // call to PeriodicSmiYield() or call the DispatchFunction registerd in \r
+  // Save context in DispatchJumpBuffer.  The intial call to SetJump() always\r
+  // returns 0.  If this is the initial call, then either resume from a prior\r
+  // call to PeriodicSmiYield() or call the DispatchFunction registerd in\r
   // PeriodicSmiEnable() using an allocated stack if one was specified.\r
-  //  \r
+  //\r
   if (SetJump (&PeriodicSmiLibraryHandler->DispatchJumpBuffer) != 0) {\r
     return;\r
   }\r
-  \r
+\r
   //\r
-  // Capture the performance counter value just before the periodic SMI handler \r
-  // is resumed so the amount of time the periodic SMI handler executes can be \r
+  // Capture the performance counter value just before the periodic SMI handler\r
+  // is resumed so the amount of time the periodic SMI handler executes can be\r
   // calculated.\r
   //\r
   PeriodicSmiLibraryHandler->DispatchTotalTime      = 0;\r
   PeriodicSmiLibraryHandler->DispatchCheckPointTime = GetPerformanceCounter();\r
-  \r
+\r
   if (PeriodicSmiLibraryHandler->YieldFlag) {\r
     //\r
-    // Perform a long jump back to the point where the previously dispatched \r
-    // function called PeriodicSmiYield(). \r
+    // Perform a long jump back to the point where the previously dispatched\r
+    // function called PeriodicSmiYield().\r
     //\r
     LongJump (&PeriodicSmiLibraryHandler->YieldJumpBuffer, 1);\r
   } else if (PeriodicSmiLibraryHandler->Stack == NULL) {\r
     //\r
-    // If Stack is NULL then call DispatchFunction using current stack passing \r
-    // in the context that was registered and the amount of time that has \r
+    // If Stack is NULL then call DispatchFunction using current stack passing\r
+    // in the context that was registered and the amount of time that has\r
     // elapsed since the previous time this periodic SMI handler was dispacthed.\r
-    //  \r
+    //\r
     PeriodicSmiLibraryHandler->DispatchFunction (\r
       PeriodicSmiLibraryHandler->Context,\r
       PeriodicSmiLibraryHandler->ElapsedTime\r
       );\r
-      \r
+\r
     //\r
     // If this DispatchFunction() returns, then unconditially call PeriodicSmiExit()\r
     // to perform a LongJump() back to this function.\r
-    //  \r
+    //\r
     PeriodicSmiExit ();\r
   } else {\r
     //\r
@@ -707,7 +707,7 @@ PeriodicSmiDispatchFunctionOnCpu (
       NULL,\r
       (UINT8 *)PeriodicSmiLibraryHandler->Stack + PeriodicSmiLibraryHandler->StackSize\r
       );\r
-  }    \r
+  }\r
 \r
   //\r
   // Must never return\r
@@ -717,10 +717,10 @@ PeriodicSmiDispatchFunctionOnCpu (
 }\r
 \r
 /**\r
-  Internal worker function that transfers control to an enabled periodic SMI \r
-  handler on the specified logial CPU.  This worker function is only called \r
-  using the SMM Services Table function SmmStartupThisAp() to execute the \r
-  periodic SMI handler on a logical CPU that is different than the one that is \r
+  Internal worker function that transfers control to an enabled periodic SMI\r
+  handler on the specified logial CPU.  This worker function is only called\r
+  using the SMM Services Table function SmmStartupThisAp() to execute the\r
+  periodic SMI handler on a logical CPU that is different than the one that is\r
   running the SMM Foundation.  When the periodic SMI handler returns, a lock is\r
   released to notify the CPU that is running the SMM Foundation that the periodic\r
   SMI handler execution has finished its execution.\r
@@ -735,17 +735,17 @@ PeriodicSmiDispatchFunctionWithLock (
   )\r
 {\r
   PERIODIC_SMI_LIBRARY_HANDLER_CONTEXT  *PeriodicSmiLibraryHandler;\r
-  \r
+\r
   //\r
   // Get context\r
-  //  \r
+  //\r
   PeriodicSmiLibraryHandler = (PERIODIC_SMI_LIBRARY_HANDLER_CONTEXT  *)Buffer;\r
 \r
   //\r
   // Execute dispatch function on the currently excuting logical CPU\r
-  //  \r
+  //\r
   PeriodicSmiDispatchFunctionOnCpu (PeriodicSmiLibraryHandler);\r
-  \r
+\r
   //\r
   // Release the dispatch spin lock\r
   //\r
@@ -756,12 +756,12 @@ PeriodicSmiDispatchFunctionWithLock (
   Internal worker function that transfers control to a periodic SMI handler that\r
   was enabled using PeriodicSmiEnable().\r
 \r
-  @param[in]     DispatchHandle  The unique handle assigned to this handler by \r
+  @param[in]     DispatchHandle  The unique handle assigned to this handler by\r
                                  SmiHandlerRegister().\r
-  @param[in]     Context         Points to an optional handler context which was \r
+  @param[in]     Context         Points to an optional handler context which was\r
                                  specified when the handler was registered.\r
   @param[in, out] CommBuffer     A pointer to a collection of data in memory that\r
-                                 will be conveyed from a non-SMM environment into \r
+                                 will be conveyed from a non-SMM environment into\r
                                  an SMM environment.\r
   @param[in, out] CommBufferSize The size of the CommBuffer.\r
 \r
@@ -772,7 +772,7 @@ PeriodicSmiDispatchFunctionWithLock (
   @retval EFI_WARN_INTERRUPT_SOURCE_PENDING   The interrupt is still pending and other\r
                                               handlers should still be called.\r
   @retval EFI_INTERRUPT_PENDING               The interrupt could not be quiesced.\r
-  \r
+\r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
@@ -786,15 +786,15 @@ PeriodicSmiDispatchFunction (
   PERIODIC_SMI_LIBRARY_HANDLER_CONTEXT  *PeriodicSmiLibraryHandler;\r
   EFI_SMM_PERIODIC_TIMER_CONTEXT        *TimerContext;\r
   EFI_STATUS                            Status;\r
-  \r
+\r
   //\r
   // Set the active periodic SMI handler\r
-  //  \r
+  //\r
   PeriodicSmiLibraryHandler = SetActivePeriodicSmiLibraryHandler (DispatchHandle);\r
   if (PeriodicSmiLibraryHandler == NULL) {\r
     return EFI_NOT_FOUND;\r
   }\r
-  \r
+\r
   //\r
   // Retrieve the elapsed time since the last time this periodic SMI handler was called\r
   //\r
@@ -821,9 +821,9 @@ PeriodicSmiDispatchFunction (
     // spin lock when it is done executing the periodic SMI handler.\r
     //\r
     AcquireSpinLock (&PeriodicSmiLibraryHandler->DispatchLock);\r
-  \r
+\r
     //\r
-    // Execute the periodic SMI handler on the CPU that was specified in \r
+    // Execute the periodic SMI handler on the CPU that was specified in\r
     // PeriodicSmiEnable().\r
     //\r
     Status = gSmst->SmmStartupThisAp (\r
@@ -839,7 +839,7 @@ PeriodicSmiDispatchFunction (
         CpuPause ();\r
       }\r
     }\r
-    \r
+\r
     //\r
     // Release the spin lock for the periodic SMI handler.\r
     //\r
@@ -852,56 +852,56 @@ PeriodicSmiDispatchFunction (
   if (PeriodicSmiLibraryHandler->DispatchHandle == NULL) {\r
     ReclaimPeriodicSmiLibraryHandler (PeriodicSmiLibraryHandler);\r
   }\r
-  \r
+\r
   //\r
   // Update state to show that there is no active periodic SMI handler\r
-  //  \r
+  //\r
   SetActivePeriodicSmiLibraryHandler (NULL);\r
 \r
   return EFI_SUCCESS;\r
 }\r
-  \r
+\r
 /**\r
   This function enables a periodic SMI handler.\r
-  \r
-  @param[in, out] DispatchHandle   A pointer to the handle associated with the \r
-                                   enabled periodic SMI handler.  This is an \r
-                                   optional parameter that may be NULL.  If it is \r
-                                   NULL, then the handle will not be returned, \r
-                                   which means that the periodic SMI handler can \r
+\r
+  @param[in, out] DispatchHandle   A pointer to the handle associated with the\r
+                                   enabled periodic SMI handler.  This is an\r
+                                   optional parameter that may be NULL.  If it is\r
+                                   NULL, then the handle will not be returned,\r
+                                   which means that the periodic SMI handler can\r
                                    never be disabled.\r
   @param[in]     DispatchFunction  A pointer to a periodic SMI handler function.\r
   @param[in]     Context           Optional content to pass into DispatchFunction.\r
-  @param[in]     TickPeriod        The requested tick period in 100ns units that \r
+  @param[in]     TickPeriod        The requested tick period in 100ns units that\r
                                    control should be givien to the periodic SMI\r
                                    handler.  Must be one of the supported values\r
                                    returned by PeriodicSmiSupportedPickPeriod().\r
   @param[in]     Cpu               Specifies the CPU that is required to execute\r
-                                   the periodic SMI handler.  If Cpu is \r
-                                   PERIODIC_SMI_LIBRARY_ANY_CPU, then the periodic \r
-                                   SMI handler will always be executed on the SMST \r
-                                   CurrentlyExecutingCpu, which may vary across \r
-                                   periodic SMIs.  If Cpu is between 0 and the SMST \r
+                                   the periodic SMI handler.  If Cpu is\r
+                                   PERIODIC_SMI_LIBRARY_ANY_CPU, then the periodic\r
+                                   SMI handler will always be executed on the SMST\r
+                                   CurrentlyExecutingCpu, which may vary across\r
+                                   periodic SMIs.  If Cpu is between 0 and the SMST\r
                                    NumberOfCpus, then the periodic SMI will always\r
                                    be executed on the requested CPU.\r
   @param[in]     StackSize         The size, in bytes, of the stack to allocate for\r
                                    use by the periodic SMI handler.  If 0, then the\r
                                    default stack will be used.\r
-                            \r
+\r
   @retval EFI_INVALID_PARAMETER  DispatchFunction is NULL.\r
-  @retval EFI_UNSUPPORTED        TickPeriod is not a supported tick period.  The \r
-                                 supported tick periods can be retrieved using \r
+  @retval EFI_UNSUPPORTED        TickPeriod is not a supported tick period.  The\r
+                                 supported tick periods can be retrieved using\r
                                  PeriodicSmiSupportedTickPeriod().\r
-  @retval EFI_INVALID_PARAMETER  Cpu is not PERIODIC_SMI_LIBRARY_ANY_CPU or in \r
+  @retval EFI_INVALID_PARAMETER  Cpu is not PERIODIC_SMI_LIBRARY_ANY_CPU or in\r
                                  the range 0 to SMST NumberOfCpus.\r
-  @retval EFI_OUT_OF_RESOURCES   There are not enough resources to enable the \r
+  @retval EFI_OUT_OF_RESOURCES   There are not enough resources to enable the\r
                                  periodic SMI handler.\r
-  @retval EFI_OUT_OF_RESOURCES   There are not enough resources to allocate the \r
+  @retval EFI_OUT_OF_RESOURCES   There are not enough resources to allocate the\r
                                  stack speficied by StackSize.\r
   @retval EFI_SUCCESS            The periodic SMI handler was enabled.\r
-  \r
+\r
 **/\r
-EFI_STATUS \r
+EFI_STATUS\r
 EFIAPI\r
 PeriodicSmiEnable (\r
   IN OUT EFI_HANDLE                    *DispatchHandle,    OPTIONAL\r
@@ -918,27 +918,27 @@ PeriodicSmiEnable (
 \r
   //\r
   // Make sure all the input parameters are valid\r
-  //  \r
+  //\r
   if (DispatchFunction == NULL) {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
-  \r
+\r
   for (Index = 0; gSmiTickPeriodTable[Index] != 0; Index++) {\r
     if (gSmiTickPeriodTable[Index] == TickPeriod) {\r
       break;\r
     }\r
-  }  \r
+  }\r
   if (gSmiTickPeriodTable[Index] == 0) {\r
     return EFI_UNSUPPORTED;\r
   }\r
-  \r
+\r
   if (Cpu != PERIODIC_SMI_LIBRARY_ANY_CPU && Cpu >= gSmst->NumberOfCpus) {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
   //\r
   // Find a free periodic SMI handler entry\r
-  //  \r
+  //\r
   PeriodicSmiLibraryHandler = FindFreePeriodicSmiLibraryHandler();\r
   if (PeriodicSmiLibraryHandler == NULL) {\r
     return EFI_OUT_OF_RESOURCES;\r
@@ -980,34 +980,34 @@ PeriodicSmiEnable (
     ReclaimPeriodicSmiLibraryHandler (PeriodicSmiLibraryHandler);\r
     return EFI_OUT_OF_RESOURCES;\r
   }\r
-  \r
+\r
   //\r
   // Return the registered handle if the optional DispatchHandle parameter is not NULL\r
   //\r
   if (DispatchHandle != NULL) {\r
     *DispatchHandle = PeriodicSmiLibraryHandler->DispatchHandle;\r
   }\r
-  return EFI_SUCCESS;                                         \r
+  return EFI_SUCCESS;\r
 }\r
 \r
 /**\r
   This function disables a periodic SMI handler that has been previously\r
   enabled with PeriodicSmiEnable().\r
-  \r
-  @param[in] DispatchHandle  A handle associated with a previously enabled periodic \r
+\r
+  @param[in] DispatchHandle  A handle associated with a previously enabled periodic\r
                              SMI handler.  This is an optional parameter that may\r
                              be NULL.  If it is NULL, then the active periodic SMI\r
                              handlers is disabled.\r
 \r
   @retval FALSE  DispatchHandle is NULL and there is no active periodic SMI handler.\r
-  @retval FALSE  The periodic SMI handler specified by DispatchHandle has \r
+  @retval FALSE  The periodic SMI handler specified by DispatchHandle has\r
                  not been enabled with PeriodicSmiEnable().\r
-  @retval TRUE   The periodic SMI handler specified by DispatchHandle has \r
+  @retval TRUE   The periodic SMI handler specified by DispatchHandle has\r
                  been disabled.  If DispatchHandle is NULL, then the active\r
                  periodic SMI handler has been disabled.\r
-  \r
+\r
 **/\r
-BOOLEAN \r
+BOOLEAN\r
 EFIAPI\r
 PeriodicSmiDisable (\r
   IN EFI_HANDLE  DispatchHandle    OPTIONAL\r
@@ -1023,7 +1023,7 @@ PeriodicSmiDisable (
   if (PeriodicSmiLibraryHandler == NULL) {\r
     return FALSE;\r
   }\r
-  \r
+\r
   //\r
   // Unregister the periodic SMI handler from the SMM Periodic Timer Dispatch 2 Protocol\r
   //\r
@@ -1049,7 +1049,7 @@ PeriodicSmiDisable (
 }\r
 \r
 /**\r
-  This constructor function caches the pointer to the SMM Periodic Timer \r
+  This constructor function caches the pointer to the SMM Periodic Timer\r
   Dispatch 2 Protocol and collects the list SMI tick rates that the hardware\r
   supports.\r
 \r
@@ -1082,7 +1082,7 @@ SmmPeriodicSmiLibConstructor (
   ASSERT (gSmmPeriodicTimerDispatch2 != NULL);\r
 \r
   //\r
-  // Count the number of periodic SMI tick intervals that the SMM Periodic Timer \r
+  // Count the number of periodic SMI tick intervals that the SMM Periodic Timer\r
   // Dipatch 2 Protocol supports.\r
   //\r
   SmiTickInterval = NULL;\r
@@ -1092,15 +1092,15 @@ SmmPeriodicSmiLibConstructor (
                                            gSmmPeriodicTimerDispatch2,\r
                                            &SmiTickInterval\r
                                            );\r
-    Count++;                                           \r
-  } while (SmiTickInterval != NULL);                                           \r
+    Count++;\r
+  } while (SmiTickInterval != NULL);\r
 \r
   //\r
   // Allocate a buffer for the table of supported periodic SMI tick periods.\r
-  //  \r
+  //\r
   gSmiTickPeriodTable = AllocateZeroPool (Count * sizeof (UINT64));\r
   ASSERT (gSmiTickPeriodTable != NULL);\r
-  \r
+\r
   //\r
   // Fill in the table of supported periodic SMI tick periods.\r
   //\r
@@ -1127,7 +1127,7 @@ SmmPeriodicSmiLibConstructor (
 }\r
 \r
 /**\r
-  The constructor function caches the pointer to the SMM Periodic Timer Dispatch 2 \r
+  The constructor function caches the pointer to the SMM Periodic Timer Dispatch 2\r
   Protocol and collects the list SMI tick rates that the hardware supports.\r
 \r
   @param[in] ImageHandle  The firmware allocated handle for the EFI image.\r
@@ -1165,7 +1165,7 @@ SmmPeriodicSmiLibDestructor (
   //\r
   // Free all the periodic SMI handler entries\r
   //\r
-  for (Link = GetFirstNode (&gFreePeriodicSmiLibraryHandlers); !IsNull (&gFreePeriodicSmiLibraryHandlers, Link);) {    \r
+  for (Link = GetFirstNode (&gFreePeriodicSmiLibraryHandlers); !IsNull (&gFreePeriodicSmiLibraryHandlers, Link);) {\r
     PeriodicSmiLibraryHandler = PERIODIC_SMI_LIBRARY_HANDLER_CONTEXT_FROM_LINK (Link);\r
     Link = RemoveEntryList (Link);\r
     FreePool (PeriodicSmiLibraryHandler);\r