Andrey Petrov | 87fb1a6 | 2016-02-10 17:47:03 -0800 | [diff] [blame] | 1 | /* |
| 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 Roth | ebabfad | 2016-04-10 11:09:16 -0600 | [diff] [blame] | 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. |
Andrey Petrov | 87fb1a6 | 2016-02-10 17:47:03 -0800 | [diff] [blame] | 15 | */ |
| 16 | |
| 17 | #include <cpu/x86/msr.h> |
| 18 | #include <cpu/x86/tsc.h> |
| 19 | #include <soc/cpu.h> |
| 20 | |
| 21 | unsigned long tsc_freq_mhz(void) |
| 22 | { |
| 23 | msr_t msr = rdmsr(MSR_PLATFORM_INFO); |
| 24 | return (BASE_CLOCK_MHZ * ((msr.lo >> 8) & 0xff)); |
| 25 | } |