8b9a89a2b8aca89d5187c246ba1cf29bb70a6f73
[coreboot.git] / src / include / timestamp.h
1 /*
2  * This file is part of the coreboot project.
3  *
4  * Copyright (C) 2011 The ChromiumOS Authors.  All rights reserved.
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.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA, 02110-1301 USA
18  */
19
20 #ifndef __TIMESTAMP_H__
21 #define __TIMESTAMP_H__
22
23 #include <cpu/x86/tsc.h>
24
25 struct timestamp_entry {
26         uint32_t        entry_id;
27         uint64_t        entry_stamp;
28 } __attribute__((packed));
29
30 struct timestamp_table {
31         uint64_t        base_time;
32         uint32_t        max_entries;
33         uint32_t        num_entries;
34         struct timestamp_entry entries[0]; /* Variable number of entries */
35 } __attribute__((packed));
36
37 enum timestamp_id {
38         TS_BEFORE_INITRAM = 1,
39         TS_AFTER_INITRAM = 2,
40         TS_ACPI_WAKE_JUMP = 98,
41         TS_SELFBOOT_JUMP = 99,
42 };
43
44 void timestamp_init(tsc_t base);
45 void timestamp_add(enum timestamp_id id, tsc_t ts_time);
46 void timestamp_add_now(enum timestamp_id id);
47
48 #endif