diff options
Diffstat (limited to 'MdeModulePkg/Universal/TimestampDxe')
4 files changed, 238 insertions, 238 deletions
diff --git a/MdeModulePkg/Universal/TimestampDxe/TimestampDxe.c b/MdeModulePkg/Universal/TimestampDxe/TimestampDxe.c index c6ac039219..39133607ac 100644 --- a/MdeModulePkg/Universal/TimestampDxe/TimestampDxe.c +++ b/MdeModulePkg/Universal/TimestampDxe/TimestampDxe.c @@ -1,162 +1,162 @@ -/** @file
- Implementation of Timestamp Protocol using UEFI APIs.
-
-Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#include <Uefi.h>
-#include <Library/DebugLib.h>
-#include <Library/UefiDriverEntryPoint.h>
-#include <Library/UefiBootServicesTableLib.h>
-#include <Library/TimerLib.h>
-#include <Library/BaseMemoryLib.h>
-#include <Protocol/Timestamp.h>
-
-//
-// The StartValue in TimerLib
-//
-UINT64 mTimerLibStartValue = 0;
-
-//
-// The EndValue in TimerLib
-//
-UINT64 mTimerLibEndValue = 0;
-
-//
-// The properties of timestamp
-//
-EFI_TIMESTAMP_PROPERTIES mTimestampProperties = {
- 0,
- 0
-};
-
-/**
- Retrieves the current value of a 64-bit free running timestamp counter.
-
- The counter shall count up in proportion to the amount of time that has passed. The counter value
- will always roll over to zero. The properties of the counter can be retrieved from GetProperties().
- The caller should be prepared for the function to return the same value twice across successive calls.
- The counter value will not go backwards other than when wrapping, as defined by EndValue in GetProperties().
- The frequency of the returned timestamp counter value must remain constant. Power management operations that
- affect clocking must not change the returned counter frequency. The quantization of counter value updates may
- vary as long as the value reflecting time passed remains consistent.
-
- @retval The current value of the free running timestamp counter.
-
-**/
-UINT64
-EFIAPI
-TimestampDriverGetTimestamp (
- VOID
- )
-{
- //
- // The timestamp of Timestamp Protocol
- //
- UINT64 TimestampValue;
-
- TimestampValue = 0;
-
- //
- // Get the timestamp
- //
- if (mTimerLibStartValue > mTimerLibEndValue) {
- TimestampValue = mTimerLibStartValue - GetPerformanceCounter ();
- } else {
- TimestampValue = GetPerformanceCounter () - mTimerLibStartValue;
- }
-
- return TimestampValue;
-}
-
-/**
- Obtains timestamp counter properties including frequency and value limits.
-
- @param[out] Properties The properties of the timestamp counter.
-
- @retval EFI_SUCCESS The properties were successfully retrieved.
- @retval EFI_DEVICE_ERROR An error occurred trying to retrieve the properties of the timestamp
- counter subsystem. Properties is not pedated.
- @retval EFI_INVALID_PARAMETER Properties is NULL.
-
-**/
-EFI_STATUS
-EFIAPI
-TimestampDriverGetProperties (
- OUT EFI_TIMESTAMP_PROPERTIES *Properties
- )
-{
- if (Properties == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- //
- // Get timestamp properties
- //
- CopyMem ((VOID *)Properties, (VOID *)&mTimestampProperties, sizeof (mTimestampProperties));
-
- return EFI_SUCCESS;
-}
-
-//
-// The Timestamp Protocol instance produced by this driver
-//
-EFI_TIMESTAMP_PROTOCOL mTimestamp = {
- TimestampDriverGetTimestamp,
- TimestampDriverGetProperties
-};
-
-/**
- Entry point of the Timestamp Protocol driver.
-
- @param ImageHandle The image handle of this driver.
- @param SystemTable The pointer of EFI_SYSTEM_TABLE.
-
- @retval EFI_SUCCESS Watchdog Timer Architectural Protocol successfully installed.
-
-**/
-EFI_STATUS
-EFIAPI
-TimestampDriverInitialize (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-{
- EFI_STATUS Status;
-
- EFI_HANDLE TimestampHandle;
-
- TimestampHandle = NULL;
-
- //
- // Get the start value, end value and frequency in Timerlib
- //
- mTimestampProperties.Frequency = GetPerformanceCounterProperties (&mTimerLibStartValue, &mTimerLibEndValue);
-
- //
- // Set the EndValue
- //
- if (mTimerLibEndValue > mTimerLibStartValue) {
- mTimestampProperties.EndValue = mTimerLibEndValue - mTimerLibStartValue;
- } else {
- mTimestampProperties.EndValue = mTimerLibStartValue - mTimerLibEndValue;
- }
-
- DEBUG ((DEBUG_INFO, "TimerFrequency:0x%lx, TimerLibStartTime:0x%lx, TimerLibEndtime:0x%lx\n", mTimestampProperties.Frequency, mTimerLibStartValue, mTimerLibEndValue));
-
- //
- // Install the Timestamp Protocol onto a new handle
- //
- Status = gBS->InstallMultipleProtocolInterfaces (
- &TimestampHandle,
- &gEfiTimestampProtocolGuid,
- &mTimestamp,
- NULL
- );
-
- ASSERT_EFI_ERROR (Status);
-
- return EFI_SUCCESS;
-}
+/** @file + Implementation of Timestamp Protocol using UEFI APIs. + +Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved.<BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include <Uefi.h> +#include <Library/DebugLib.h> +#include <Library/UefiDriverEntryPoint.h> +#include <Library/UefiBootServicesTableLib.h> +#include <Library/TimerLib.h> +#include <Library/BaseMemoryLib.h> +#include <Protocol/Timestamp.h> + +// +// The StartValue in TimerLib +// +UINT64 mTimerLibStartValue = 0; + +// +// The EndValue in TimerLib +// +UINT64 mTimerLibEndValue = 0; + +// +// The properties of timestamp +// +EFI_TIMESTAMP_PROPERTIES mTimestampProperties = { + 0, + 0 +}; + +/** + Retrieves the current value of a 64-bit free running timestamp counter. + + The counter shall count up in proportion to the amount of time that has passed. The counter value + will always roll over to zero. The properties of the counter can be retrieved from GetProperties(). + The caller should be prepared for the function to return the same value twice across successive calls. + The counter value will not go backwards other than when wrapping, as defined by EndValue in GetProperties(). + The frequency of the returned timestamp counter value must remain constant. Power management operations that + affect clocking must not change the returned counter frequency. The quantization of counter value updates may + vary as long as the value reflecting time passed remains consistent. + + @retval The current value of the free running timestamp counter. + +**/ +UINT64 +EFIAPI +TimestampDriverGetTimestamp ( + VOID + ) +{ + // + // The timestamp of Timestamp Protocol + // + UINT64 TimestampValue; + + TimestampValue = 0; + + // + // Get the timestamp + // + if (mTimerLibStartValue > mTimerLibEndValue) { + TimestampValue = mTimerLibStartValue - GetPerformanceCounter (); + } else { + TimestampValue = GetPerformanceCounter () - mTimerLibStartValue; + } + + return TimestampValue; +} + +/** + Obtains timestamp counter properties including frequency and value limits. + + @param[out] Properties The properties of the timestamp counter. + + @retval EFI_SUCCESS The properties were successfully retrieved. + @retval EFI_DEVICE_ERROR An error occurred trying to retrieve the properties of the timestamp + counter subsystem. Properties is not pedated. + @retval EFI_INVALID_PARAMETER Properties is NULL. + +**/ +EFI_STATUS +EFIAPI +TimestampDriverGetProperties ( + OUT EFI_TIMESTAMP_PROPERTIES *Properties + ) +{ + if (Properties == NULL) { + return EFI_INVALID_PARAMETER; + } + + // + // Get timestamp properties + // + CopyMem ((VOID *)Properties, (VOID *)&mTimestampProperties, sizeof (mTimestampProperties)); + + return EFI_SUCCESS; +} + +// +// The Timestamp Protocol instance produced by this driver +// +EFI_TIMESTAMP_PROTOCOL mTimestamp = { + TimestampDriverGetTimestamp, + TimestampDriverGetProperties +}; + +/** + Entry point of the Timestamp Protocol driver. + + @param ImageHandle The image handle of this driver. + @param SystemTable The pointer of EFI_SYSTEM_TABLE. + + @retval EFI_SUCCESS Watchdog Timer Architectural Protocol successfully installed. + +**/ +EFI_STATUS +EFIAPI +TimestampDriverInitialize ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + EFI_STATUS Status; + + EFI_HANDLE TimestampHandle; + + TimestampHandle = NULL; + + // + // Get the start value, end value and frequency in Timerlib + // + mTimestampProperties.Frequency = GetPerformanceCounterProperties (&mTimerLibStartValue, &mTimerLibEndValue); + + // + // Set the EndValue + // + if (mTimerLibEndValue > mTimerLibStartValue) { + mTimestampProperties.EndValue = mTimerLibEndValue - mTimerLibStartValue; + } else { + mTimestampProperties.EndValue = mTimerLibStartValue - mTimerLibEndValue; + } + + DEBUG ((DEBUG_INFO, "TimerFrequency:0x%lx, TimerLibStartTime:0x%lx, TimerLibEndtime:0x%lx\n", mTimestampProperties.Frequency, mTimerLibStartValue, mTimerLibEndValue)); + + // + // Install the Timestamp Protocol onto a new handle + // + Status = gBS->InstallMultipleProtocolInterfaces ( + &TimestampHandle, + &gEfiTimestampProtocolGuid, + &mTimestamp, + NULL + ); + + ASSERT_EFI_ERROR (Status); + + return EFI_SUCCESS; +} diff --git a/MdeModulePkg/Universal/TimestampDxe/TimestampDxe.inf b/MdeModulePkg/Universal/TimestampDxe/TimestampDxe.inf index 13825bcae9..a388a0238c 100644 --- a/MdeModulePkg/Universal/TimestampDxe/TimestampDxe.inf +++ b/MdeModulePkg/Universal/TimestampDxe/TimestampDxe.inf @@ -1,46 +1,46 @@ -## @file
-# Generic Timestamp driver producing Timestamp Protocol using UEFI APIs.
-#
-# Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved.<BR>
-#
-# SPDX-License-Identifier: BSD-2-Clause-Patent
-#
-#
-##
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = TimestampDxe
- MODULE_UNI_FILE = TimestampDxe.uni
- FILE_GUID = C10194E7-DEB2-4AF4-9EEE-BFFDE4D7D4C7
- MODULE_TYPE = DXE_DRIVER
- VERSION_STRING = 1.0
- ENTRY_POINT = TimestampDriverInitialize
-
-#
-# The following information is for reference only and not required by the build tools.
-#
-# VALID_ARCHITECTURES = IA32 X64 EBC
-#
-
-[Packages]
- MdePkg/MdePkg.dec
-
-[Sources]
- TimestampDxe.c
-
-[LibraryClasses]
- UefiBootServicesTableLib
- UefiDriverEntryPoint
- TimerLib
- BaseMemoryLib
- DebugLib
-
-[Protocols]
- gEfiTimestampProtocolGuid ## PRODUCES
-
-[depex]
- TRUE
-
-[UserExtensions.TianoCore."ExtraFiles"]
- TimestampDxeExtra.uni
+## @file +# Generic Timestamp driver producing Timestamp Protocol using UEFI APIs. +# +# Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved.<BR> +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +# +## + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = TimestampDxe + MODULE_UNI_FILE = TimestampDxe.uni + FILE_GUID = C10194E7-DEB2-4AF4-9EEE-BFFDE4D7D4C7 + MODULE_TYPE = DXE_DRIVER + VERSION_STRING = 1.0 + ENTRY_POINT = TimestampDriverInitialize + +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 EBC +# + +[Packages] + MdePkg/MdePkg.dec + +[Sources] + TimestampDxe.c + +[LibraryClasses] + UefiBootServicesTableLib + UefiDriverEntryPoint + TimerLib + BaseMemoryLib + DebugLib + +[Protocols] + gEfiTimestampProtocolGuid ## PRODUCES + +[depex] + TRUE + +[UserExtensions.TianoCore."ExtraFiles"] + TimestampDxeExtra.uni diff --git a/MdeModulePkg/Universal/TimestampDxe/TimestampDxe.uni b/MdeModulePkg/Universal/TimestampDxe/TimestampDxe.uni index 1ae482aca5..b03655184d 100644 --- a/MdeModulePkg/Universal/TimestampDxe/TimestampDxe.uni +++ b/MdeModulePkg/Universal/TimestampDxe/TimestampDxe.uni @@ -1,16 +1,16 @@ -// /** @file
-// Generic Timestamp driver producing Timestamp Protocol using UEFI APIs.
-//
-// A generic Timestamp driver producing Timestamp Protocol using UEFI APIs.
-//
-// Copyright (c) 2013 - 2014, Intel Corporation. All rights reserved.<BR>
-//
-// SPDX-License-Identifier: BSD-2-Clause-Patent
-//
-// **/
-
-
-#string STR_MODULE_ABSTRACT #language en-US "Generic Timestamp driver producing Timestamp Protocol using UEFI APIs."
-
-#string STR_MODULE_DESCRIPTION #language en-US "A generic Timestamp driver producing Timestamp Protocol using UEFI APIs."
-
+// /** @file +// Generic Timestamp driver producing Timestamp Protocol using UEFI APIs. +// +// A generic Timestamp driver producing Timestamp Protocol using UEFI APIs. +// +// Copyright (c) 2013 - 2014, Intel Corporation. All rights reserved.<BR> +// +// SPDX-License-Identifier: BSD-2-Clause-Patent +// +// **/ + + +#string STR_MODULE_ABSTRACT #language en-US "Generic Timestamp driver producing Timestamp Protocol using UEFI APIs." + +#string STR_MODULE_DESCRIPTION #language en-US "A generic Timestamp driver producing Timestamp Protocol using UEFI APIs." + diff --git a/MdeModulePkg/Universal/TimestampDxe/TimestampDxeExtra.uni b/MdeModulePkg/Universal/TimestampDxe/TimestampDxeExtra.uni index 619cadf33a..e7d2289243 100644 --- a/MdeModulePkg/Universal/TimestampDxe/TimestampDxeExtra.uni +++ b/MdeModulePkg/Universal/TimestampDxe/TimestampDxeExtra.uni @@ -1,14 +1,14 @@ -// /** @file
-// TimestampDxe Localized Strings and Content
-//
-// Copyright (c) 2014 - 2018, Intel Corporation. All rights reserved.<BR>
-//
-// SPDX-License-Identifier: BSD-2-Clause-Patent
-//
-// **/
-
-#string STR_PROPERTIES_MODULE_NAME
-#language en-US
-"Timestamp DXE Driver"
-
-
+// /** @file +// TimestampDxe Localized Strings and Content +// +// Copyright (c) 2014 - 2018, Intel Corporation. All rights reserved.<BR> +// +// SPDX-License-Identifier: BSD-2-Clause-Patent +// +// **/ + +#string STR_PROPERTIES_MODULE_NAME +#language en-US +"Timestamp DXE Driver" + + |
