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
-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
+Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
+SPDX-License-Identifier: BSD-2-Clause-Patent\r
\r
**/\r
\r
#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
//\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
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
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
\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
// 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
@param ImageHandle The image handle of this driver.\r
@param SystemTable The pointer of EFI_SYSTEM_TABLE.\r
\r
- @return EFI_SUCCESS The initialization is successful.\r
+ @retval EFI_SUCCESS The initialization is successful.\r
\r
**/\r
EFI_STATUS\r
//\r
BufferSize = sizeof (UINT32);\r
Status = EfiGetVariable (\r
- mEfiMtcName,\r
- &mEfiMtcGuid,\r
+ MTC_VARIABLE_NAME,\r
+ &gMtcVendorGuid,\r
NULL,\r
&BufferSize,\r
&HighCount\r