]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounter.c
MdeModulePkg: Minor comments update to GetNextHighMonotonicCount()
[mirror_edk2.git] / MdeModulePkg / Universal / MonotonicCounterRuntimeDxe / MonotonicCounter.c
index 20f9111204abe78d4f29d8556600e7a450e0ba00..2bfede668106bf7bec27e0eba317108298451174 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 - 2016, 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,22 +40,12 @@ 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
   This function returns a 64-bit value that is numerically larger then the last\r
   time the function was called.\r
-  The platform\92s monotonic counter is comprised of two parts: the high 32 bits\r
+  The platform monotonic counter is comprised of two parts: the high 32 bits\r
   and the low 32 bits. The low 32-bit value is volatile and is reset to zero on\r
   every system reset. It is increased by 1 on every call to GetNextMonotonicCount().\r
   The high 32-bit value is nonvolatile and is increased by one on whenever the\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
@@ -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