blob: 9ebe3cb382087c5492fbc9c03d915531cf36aa0c [file] [log] [blame]
Lee Leahyb0005132015-05-12 18:19:47 -07001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2014 Google Inc.
Lee Leahy1d14b3e2015-05-12 18:23:27 -07005 * Copyright (C) 2015 Intel Corporation.
Lee Leahyb0005132015-05-12 18:19:47 -07006 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 2 of the License.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
Lee Leahyb0005132015-05-12 18:19:47 -070015 */
16
17#include <stdint.h>
18#include <cpu/x86/msr.h>
19#include <cpu/x86/tsc.h>
20#include <soc/cpu.h>
21#include <soc/msr.h>
22
23unsigned long tsc_freq_mhz(void)
24{
25 msr_t platform_info;
26
27 platform_info = rdmsr(MSR_PLATFORM_INFO);
28 return CPU_BCLK * ((platform_info.lo >> 8) & 0xff);
29}