]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounter.c
MdeModulePkg: Clean up source files
[mirror_edk2.git] / MdeModulePkg / Universal / MonotonicCounterRuntimeDxe / MonotonicCounter.c
index af75e204c083144bd7623cceaea19bc5f1ef3679..2f9d2df914c7fdd039778c2376c6db3e63a57fd1 100644 (file)
@@ -2,8 +2,8 @@
   Produce the UEFI boot service GetNextMonotonicCount() and runtime service\r
   GetNextHighMonotonicCount().\r
 \r
-Copyright (c) 2006 - 2008, Intel Corporation\r
-All rights reserved. This program and the accompanying materials\r
+Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
+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
@@ -16,6 +16,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <Uefi.h>\r
 \r
 #include <Protocol/MonotonicCounter.h>\r
+#include <Guid/MtcVendor.h>\r
 \r
 #include <Library/BaseLib.h>\r
 #include <Library/UefiDriverEntryPoint.h>\r
@@ -39,16 +40,6 @@ UINT64      mEfiMtc;
 //\r
 EFI_EVENT   mEfiMtcEvent;\r
 \r
-//\r
-// Name of the variable for the high part of monotonic counter\r
-//\r
-CHAR16      *mEfiMtcName = (CHAR16 *) L"MTC";\r
-\r
-//\r
-// Vendor GUID of the variable for the high part of monotonic counter\r
-//\r
-EFI_GUID    mEfiMtcGuid = { 0xeb704011, 0x1402, 0x11d3, { 0x8e, 0x77, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b } };\r
-\r
 /**\r
   Returns a monotonically increasing count for the platform.\r
 \r
@@ -60,7 +51,7 @@ EFI_GUID    mEfiMtcGuid = { 0xeb704011, 0x1402, 0x11d3, { 0x8e, 0x77, 0x0, 0xa0,
   The high 32-bit value is nonvolatile and is increased by one on whenever the\r
   system resets or the low 32-bit counter overflows.\r
 \r
-  @param  Count                        Pointer to returned value.\r
+  @param  Count                  Pointer to returned value.\r
 \r
   @retval EFI_SUCCESS           The next monotonic count was returned.\r
   @retval EFI_DEVICE_ERROR      The device is not functioning properly.\r
@@ -116,8 +107,9 @@ MonotonicCounterDriverGetNextMonotonicCount (
   comprised of two 32 bit quantities:  the high 32 bits and the low 32 bits.\r
   During boot service time the low 32 bit value is volatile:  it is reset to\r
   zero on every system reset and is increased by 1 on every call to GetNextMonotonicCount().\r
-  The high 32 bit value is non-volatile and is increased by 1 whenever the system resets\r
-  or whenever the low 32 bit count [returned by GetNextMonoticCount()] overflows.\r
+  The high 32 bit value is non-volatile and is increased by 1 whenever the system resets,\r
+  whenever GetNextHighMonotonicCount() is called, or whenever the low 32 bit count\r
+  (returned by GetNextMonoticCount()) overflows.\r
   The GetNextMonotonicCount() function is only available at boot services time.\r
   If the operating system wishes to extend the platform monotonic counter to runtime,\r
   it may do so by utilizing GetNextHighMonotonicCount().  To do this, before calling\r
@@ -131,7 +123,7 @@ MonotonicCounterDriverGetNextMonotonicCount (
 \r
   This function may only be called at Runtime.\r
 \r
-  @param  HighCount                Pointer to returned value.\r
+  @param  HighCount              Pointer to returned value.\r
 \r
   @retval EFI_SUCCESS           The next high monotonic count was returned.\r
   @retval EFI_INVALID_PARAMETER HighCount is NULL.\r
@@ -171,8 +163,8 @@ MonotonicCounterDriverGetNextHighMonotonicCount (
   // Update the NV variable to match the new high part\r
   //\r
   return EfiSetVariable (\r
-           mEfiMtcName,\r
-           &mEfiMtcGuid,\r
+           MTC_VARIABLE_NAME,\r
+           &gMtcVendorGuid,\r
            EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_BOOTSERVICE_ACCESS,\r
            sizeof (UINT32),\r
            HighCount\r
@@ -241,8 +233,8 @@ MonotonicCounterDriverInitialize (
   //\r
   BufferSize = sizeof (UINT32);\r
   Status = EfiGetVariable (\r
-             mEfiMtcName,\r
-             &mEfiMtcGuid,\r
+             MTC_VARIABLE_NAME,\r
+             &gMtcVendorGuid,\r
              NULL,\r
              &BufferSize,\r
              &HighCount\r