]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounter.c
MdeModulePkg: Apply uncrustify changes
[mirror_edk2.git] / MdeModulePkg / Universal / MonotonicCounterRuntimeDxe / MonotonicCounter.c
index f74b0b8a19b4b69e1cb586a65af9b1cb2acdf561..60b6e9350b7f762f531487e570ecb311a99f22bc 100644 (file)
@@ -27,12 +27,12 @@ EFI_HANDLE  mMonotonicCounterHandle = NULL;
 //\r
 // The current monotonic counter value\r
 //\r
-UINT64      mEfiMtc;\r
+UINT64  mEfiMtc;\r
 \r
 //\r
 // Event to update the monotonic Counter's high part when low part overflows.\r
 //\r
-EFI_EVENT   mEfiMtcEvent;\r
+EFI_EVENT  mEfiMtcEvent;\r
 \r
 /**\r
   Returns a monotonically increasing count for the platform.\r
@@ -59,7 +59,7 @@ MonotonicCounterDriverGetNextMonotonicCount (
   OUT UINT64  *Count\r
   )\r
 {\r
-  EFI_TPL OldTpl;\r
+  EFI_TPL  OldTpl;\r
 \r
   //\r
   // Cannot be called after ExitBootServices()\r
@@ -67,17 +67,19 @@ MonotonicCounterDriverGetNextMonotonicCount (
   if (EfiAtRuntime ()) {\r
     return EFI_UNSUPPORTED;\r
   }\r
+\r
   //\r
   // Check input parameters\r
   //\r
   if (Count == NULL) {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
+\r
   //\r
   // Update the monotonic counter with a lock\r
   //\r
-  OldTpl  = gBS->RaiseTPL (TPL_HIGH_LEVEL);\r
-  *Count  = mEfiMtc;\r
+  OldTpl = gBS->RaiseTPL (TPL_HIGH_LEVEL);\r
+  *Count = mEfiMtc;\r
   mEfiMtc++;\r
   gBS->RestoreTPL (OldTpl);\r
 \r
@@ -85,14 +87,13 @@ MonotonicCounterDriverGetNextMonotonicCount (
   // If the low 32-bit counter overflows (MSB bit toggled),\r
   // then signal that the high part needs update now.\r
   //\r
-  if ((((UINT32) mEfiMtc) ^ ((UINT32) *Count)) & BIT31) {\r
+  if ((((UINT32)mEfiMtc) ^ ((UINT32)*Count)) & BIT31) {\r
     gBS->SignalEvent (mEfiMtcEvent);\r
   }\r
 \r
   return EFI_SUCCESS;\r
 }\r
 \r
-\r
 /**\r
   Returns the next high 32 bits of the platform's monotonic counter.\r
 \r
@@ -132,7 +133,7 @@ MonotonicCounterDriverGetNextHighMonotonicCount (
   OUT UINT32  *HighCount\r
   )\r
 {\r
-  EFI_TPL     OldTpl;\r
+  EFI_TPL  OldTpl;\r
 \r
   //\r
   // Check input parameters\r
@@ -145,14 +146,15 @@ MonotonicCounterDriverGetNextHighMonotonicCount (
     //\r
     // Use a lock if called before ExitBootServices()\r
     //\r
-    OldTpl      = gBS->RaiseTPL (TPL_HIGH_LEVEL);\r
-    *HighCount  = (UINT32) RShiftU64 (mEfiMtc, 32) + 1;\r
-    mEfiMtc     = LShiftU64 (*HighCount, 32);\r
+    OldTpl     = gBS->RaiseTPL (TPL_HIGH_LEVEL);\r
+    *HighCount = (UINT32)RShiftU64 (mEfiMtc, 32) + 1;\r
+    mEfiMtc    = LShiftU64 (*HighCount, 32);\r
     gBS->RestoreTPL (OldTpl);\r
   } else {\r
-    *HighCount  = (UINT32) RShiftU64 (mEfiMtc, 32) + 1;\r
-    mEfiMtc     = LShiftU64 (*HighCount, 32);\r
+    *HighCount = (UINT32)RShiftU64 (mEfiMtc, 32) + 1;\r
+    mEfiMtc    = LShiftU64 (*HighCount, 32);\r
   }\r
+\r
   //\r
   // Update the NV variable to match the new high part\r
   //\r
@@ -163,7 +165,6 @@ MonotonicCounterDriverGetNextHighMonotonicCount (
            sizeof (UINT32),\r
            HighCount\r
            );\r
-\r
 }\r
 \r
 /**\r
@@ -176,8 +177,8 @@ MonotonicCounterDriverGetNextHighMonotonicCount (
 VOID\r
 EFIAPI\r
 EfiMtcEventHandler (\r
-  IN EFI_EVENT                Event,\r
-  IN VOID                     *Context\r
+  IN EFI_EVENT  Event,\r
+  IN VOID       *Context\r
   )\r
 {\r
   UINT32  HighCount;\r
@@ -226,16 +227,17 @@ MonotonicCounterDriverInitialize (
   // Read the last high part\r
   //\r
   BufferSize = sizeof (UINT32);\r
-  Status = EfiGetVariable (\r
-             MTC_VARIABLE_NAME,\r
-             &gMtcVendorGuid,\r
-             NULL,\r
-             &BufferSize,\r
-             &HighCount\r
-             );\r
+  Status     = EfiGetVariable (\r
+                 MTC_VARIABLE_NAME,\r
+                 &gMtcVendorGuid,\r
+                 NULL,\r
+                 &BufferSize,\r
+                 &HighCount\r
+                 );\r
   if (EFI_ERROR (Status)) {\r
     HighCount = 0;\r
   }\r
+\r
   //\r
   // Set the current value\r
   //\r
@@ -251,8 +253,8 @@ MonotonicCounterDriverInitialize (
   //\r
   // Fill in the EFI Boot Services and EFI Runtime Services Monotonic Counter Fields\r
   //\r
-  gBS->GetNextMonotonicCount      = MonotonicCounterDriverGetNextMonotonicCount;\r
-  gRT->GetNextHighMonotonicCount  = MonotonicCounterDriverGetNextHighMonotonicCount;\r
+  gBS->GetNextMonotonicCount     = MonotonicCounterDriverGetNextMonotonicCount;\r
+  gRT->GetNextHighMonotonicCount = MonotonicCounterDriverGetNextHighMonotonicCount;\r
 \r
   //\r
   // Install the Monotonic Counter Architctural Protocol onto a new handle\r