blob: 711c38e23b31905b8fcbc58ad02e7644aa963ded [file] [log] [blame]
Stefan Reinauer3a6550d2013-08-01 13:31:44 -07001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright 2013 Google Inc.
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; version 2 of the License.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
Stefan Reinauer3a6550d2013-08-01 13:31:44 -070014 */
15
16#include <cpu/x86/tsc.h>
17#include <timestamp.h>
18
19uint64_t timestamp_get(void)
20{
21 return rdtscll();
22}
Aaron Durbinc49014e2015-08-30 21:19:55 -050023
24unsigned long __attribute__((weak)) tsc_freq_mhz(void)
25{
26 /* Default to not knowing TSC frequency. cbmem will have to fallback
27 * on trying to determine it in userspace. */
28 return 0;
29}
30
31int timestamp_tick_freq_mhz(void)
32{
33 /* Chipsets that have a constant TSC provide this value correctly. */
34 return tsc_freq_mhz();
35}