[coreboot-gerrit] Change in coreboot[master]: soc/intel/cannonlake: Add utility to calculate TSC frequency

Andrey Petrov (Code Review) gerrit at coreboot.org
Wed Jun 7 03:03:26 CEST 2017


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 at 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);
+}

-- 
To view, visit https://review.coreboot.org/20062
To unsubscribe, visit https://review.coreboot.org/settings

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I76f7a102c8b13c402c5b3354f932cf75e001132e
Gerrit-Change-Number: 20062
Gerrit-PatchSet: 1
Gerrit-Owner: Andrey Petrov <andrey.petrov at intel.com>



More information about the coreboot-gerrit mailing list