Andrey Petrov has uploaded this change for review. ( https://review.coreboot.org/20062
Change subject: soc/intel/cannonlake: Add utility to calculate TSC frequency ......................................................................
soc/intel/cannonlake: Add utility to calculate TSC frequency
Change-Id: I76f7a102c8b13c402c5b3354f932cf75e001132e Signed-off-by: Andrey Petrov andrey.petrov@intel.com --- A src/soc/intel/cannonlake/tsc_freq.c 1 file changed, 28 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/62/20062/1
diff --git a/src/soc/intel/cannonlake/tsc_freq.c b/src/soc/intel/cannonlake/tsc_freq.c new file mode 100644 index 0000000..f8f91e6 --- /dev/null +++ b/src/soc/intel/cannonlake/tsc_freq.c @@ -0,0 +1,28 @@ +/* + * This file is part of the coreboot project. + * + * Copyright (C) 2014 Google Inc. + * Copyright (C) 2017 Intel Corporation. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include <cpu/x86/msr.h> +#include <cpu/x86/tsc.h> +#include <soc/cpu.h> +#include <soc/msr.h> + +unsigned long tsc_freq_mhz(void) +{ + msr_t platform_info; + + platform_info = rdmsr(MSR_PLATFORM_INFO); + return CPU_BCLK * ((platform_info.lo >> 8) & 0xff); +}