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>
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
;
32 msr
= rdmsr(CU_PTSC_MSR
);
34 val
= ((unsigned long long)msr
.hi
<< 32) | msr
.lo
;
36 return val
/ PTSC_FREQ_MHZ
;