soc: Remove copyright notices
[coreboot.git] / src / soc / amd / stoneyridge / monotonic_timer.c
blob2211136ce257e35564e5e0c45eade422a10c8745
1 /*
2 * This file is part of the coreboot project.
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
15 #include <cpu/x86/msr.h>
16 #include <timer.h>
17 #include <timestamp.h>
19 #define CU_PTSC_MSR 0xc0010280
20 #define PTSC_FREQ_MHZ 100
22 void timer_monotonic_get(struct mono_time *mt)
24 mono_time_set_usecs(mt, timestamp_get());
27 uint64_t timestamp_get(void)
29 unsigned long long val;
30 msr_t msr;
32 msr = rdmsr(CU_PTSC_MSR);
34 val = ((unsigned long long)msr.hi << 32) | msr.lo;
36 return val / PTSC_FREQ_MHZ;