You've already forked slimbootloader
mirror of
https://github.com/Dasharo/slimbootloader.git
synced 2026-03-06 15:26:20 -08:00
9a4407018d
This patch fixed NOOPT build failure for QEMU. It fixed #871. Signed-off-by: Maurice Ma <maurice.ma@intel.com>
47 lines
687 B
C
47 lines
687 B
C
/** @file
|
|
|
|
Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
|
|
SPDX-License-Identifier: BSD-2-Clause-Patent
|
|
|
|
**/
|
|
|
|
#include <Library/BaseLib.h>
|
|
|
|
/**
|
|
Read current timestamp.
|
|
|
|
@return 64 bit current timestampe value.
|
|
|
|
**/
|
|
UINT64
|
|
EFIAPI
|
|
ReadTimeStamp (
|
|
VOID
|
|
)
|
|
{
|
|
return AsmReadTsc();
|
|
}
|
|
|
|
/**
|
|
Get timestamp frequency in KHZ.
|
|
|
|
@return Timestamp frequency in KHZ.
|
|
|
|
**/
|
|
UINT32
|
|
EFIAPI
|
|
GetTimeStampFrequency (
|
|
VOID
|
|
)
|
|
{
|
|
UINT8 Ratio;
|
|
|
|
Ratio = (UINT8)((UINT32)AsmReadMsr64 (0xCE) >> 8);
|
|
if (Ratio == 0) {
|
|
// This might be QEMU case
|
|
Ratio = 8;
|
|
}
|
|
// Ratio * 100000
|
|
return (UINT32)(Ratio * 100000);
|
|
}
|