/** @file\r
Implementation of Timestamp Protocol using UEFI APIs.\r
- \r
-Copyright (c) 2013, 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
\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) 2013 - 2018, Intel Corporation. All rights reserved.<BR>\r
+SPDX-License-Identifier: BSD-2-Clause-Patent\r
\r
**/\r
\r
//\r
// The StartValue in TimerLib\r
//\r
-UINT64 mTimerLibStartValue = 0;\r
+UINT64 mTimerLibStartValue = 0;\r
\r
//\r
// The EndValue in TimerLib\r
//\r
-UINT64 mTimerLibEndValue = 0;\r
+UINT64 mTimerLibEndValue = 0;\r
\r
//\r
// The properties of timestamp\r
//\r
-EFI_TIMESTAMP_PROPERTIES mTimestampProperties = {\r
+EFI_TIMESTAMP_PROPERTIES mTimestampProperties = {\r
0,\r
0\r
};\r
will always roll over to zero. The properties of the counter can be retrieved from GetProperties().\r
The caller should be prepared for the function to return the same value twice across successive calls.\r
The counter value will not go backwards other than when wrapping, as defined by EndValue in GetProperties().\r
- The frequency of the returned timestamp counter value must remain constant. Power management operations that \r
- affect clocking must not change the returned counter frequency. The quantization of counter value updates may \r
- vary as long as the value reflecting time passed remains consistent. \r
+ The frequency of the returned timestamp counter value must remain constant. Power management operations that\r
+ affect clocking must not change the returned counter frequency. The quantization of counter value updates may\r
+ vary as long as the value reflecting time passed remains consistent.\r
\r
@retval The current value of the free running timestamp counter.\r
\r
// The timestamp of Timestamp Protocol\r
//\r
UINT64 TimestampValue;\r
+\r
TimestampValue = 0;\r
- \r
+\r
//\r
// Get the timestamp\r
//\r
if (mTimerLibStartValue > mTimerLibEndValue) {\r
- TimestampValue = mTimerLibStartValue - GetPerformanceCounter();\r
+ TimestampValue = mTimerLibStartValue - GetPerformanceCounter ();\r
} else {\r
- TimestampValue = GetPerformanceCounter() - mTimerLibStartValue;\r
+ TimestampValue = GetPerformanceCounter () - mTimerLibStartValue;\r
}\r
- \r
+\r
return TimestampValue;\r
}\r
\r
\r
@param[out] Properties The properties of the timestamp counter.\r
\r
- @retval EFI_SUCCESS The properties were successfully retrieved. \r
- @retval EFI_DEVICE_ERROR An error occurred trying to retrieve the properties of the timestamp \r
- counter subsystem. Properties is not pedated. \r
+ @retval EFI_SUCCESS The properties were successfully retrieved.\r
+ @retval EFI_DEVICE_ERROR An error occurred trying to retrieve the properties of the timestamp\r
+ counter subsystem. Properties is not pedated.\r
@retval EFI_INVALID_PARAMETER Properties is NULL.\r
\r
**/\r
EFI_STATUS\r
EFIAPI\r
-TimestampDriverGetProperties(\r
- OUT EFI_TIMESTAMP_PROPERTIES *Properties\r
+TimestampDriverGetProperties (\r
+ OUT EFI_TIMESTAMP_PROPERTIES *Properties\r
)\r
{\r
if (Properties == NULL) {\r
return EFI_INVALID_PARAMETER;\r
}\r
- \r
+\r
//\r
// Get timestamp properties\r
//\r
- CopyMem((VOID *) Properties, (VOID *) &mTimestampProperties, sizeof (mTimestampProperties));\r
- \r
+ CopyMem ((VOID *)Properties, (VOID *)&mTimestampProperties, sizeof (mTimestampProperties));\r
+\r
return EFI_SUCCESS;\r
}\r
\r
)\r
{\r
EFI_STATUS Status;\r
- \r
+\r
EFI_HANDLE TimestampHandle;\r
+\r
TimestampHandle = NULL;\r
- \r
+\r
//\r
// Get the start value, end value and frequency in Timerlib\r
//\r
- mTimestampProperties.Frequency = GetPerformanceCounterProperties(&mTimerLibStartValue, &mTimerLibEndValue);\r
- \r
+ mTimestampProperties.Frequency = GetPerformanceCounterProperties (&mTimerLibStartValue, &mTimerLibEndValue);\r
+\r
//\r
- // Set the EndValue \r
+ // Set the EndValue\r
//\r
if (mTimerLibEndValue > mTimerLibStartValue) {\r
mTimestampProperties.EndValue = mTimerLibEndValue - mTimerLibStartValue;\r
} else {\r
mTimestampProperties.EndValue = mTimerLibStartValue - mTimerLibEndValue;\r
}\r
- \r
- DEBUG ((EFI_D_INFO, "TimerFrequency:0x%lx, TimerLibStartTime:0x%lx, TimerLibEndtime:0x%lx\n", mTimestampProperties.Frequency, mTimerLibStartValue, mTimerLibEndValue));\r
- \r
+\r
+ DEBUG ((DEBUG_INFO, "TimerFrequency:0x%lx, TimerLibStartTime:0x%lx, TimerLibEndtime:0x%lx\n", mTimestampProperties.Frequency, mTimerLibStartValue, mTimerLibEndValue));\r
+\r
//\r
// Install the Timestamp Protocol onto a new handle\r
//\r
&mTimestamp,\r
NULL\r
);\r
- \r
+\r
ASSERT_EFI_ERROR (Status);\r
\r
return EFI_SUCCESS;\r