]>
git.ipfire.org Git - people/ms/u-boot.git/blob - arch/x86/cpu/coreboot/timestamp.c
2 * This file is part of the coreboot project.
4 * Copyright (C) 2011 The ChromiumOS Authors. All rights reserved.
6 * SPDX-License-Identifier: GPL-2.0+
10 #include <asm/arch/timestamp.h>
11 #include <asm/arch/sysinfo.h>
12 #include <linux/compiler.h>
14 struct timestamp_entry
{
19 struct timestamp_table
{
23 struct timestamp_entry entries
[0]; /* Variable number of entries */
26 static struct timestamp_table
*ts_table
__attribute__((section(".data")));
28 void timestamp_init(void)
30 timestamp_add_now(TS_U_BOOT_INITTED
);
33 void timestamp_add(enum timestamp_id id
, uint64_t ts_time
)
35 struct timestamp_entry
*tse
;
37 if (!ts_table
|| (ts_table
->num_entries
== ts_table
->max_entries
))
40 tse
= &ts_table
->entries
[ts_table
->num_entries
++];
42 tse
->entry_stamp
= ts_time
- ts_table
->base_time
;
45 void timestamp_add_now(enum timestamp_id id
)
47 timestamp_add(id
, rdtsc());
50 int timestamp_add_to_bootstage(void)
57 for (i
= 0; i
< ts_table
->num_entries
; i
++) {
58 struct timestamp_entry
*tse
= &ts_table
->entries
[i
];
59 const char *name
= NULL
;
61 switch (tse
->entry_id
) {
62 case TS_START_ROMSTAGE
:
63 name
= "start-romstage";
65 case TS_BEFORE_INITRAM
:
66 name
= "before-initram";
68 case TS_DEVICE_INITIALIZE
:
69 name
= "device-initialize";
74 case TS_SELFBOOT_JUMP
:
75 name
= "selfboot-jump";
79 bootstage_add_record(0, name
, BOOTSTAGEF_ALLOC
,