blob: 9dd1dea990d8cb056e7d0f5b5f4664b7c4d9d579 [file] [log] [blame]
Andrey Petrov87fb1a62016-02-10 17:47:03 -08001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2015 Intel Corp.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
Martin Rothebabfad2016-04-10 11:09:16 -060010 *
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.
Andrey Petrov87fb1a62016-02-10 17:47:03 -080015 */
16
17#include <cpu/x86/msr.h>
18#include <cpu/x86/tsc.h>
19#include <soc/cpu.h>
20
21unsigned long tsc_freq_mhz(void)
22{
23 msr_t msr = rdmsr(MSR_PLATFORM_INFO);
24 return (BASE_CLOCK_MHZ * ((msr.lo >> 8) & 0xff));
25}