Tim Wawrzynczak has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/31649
Change subject: console: Add timestamp prints to boot stages. ......................................................................
console: Add timestamp prints to boot stages.
When a new bootstage starts, if it has console support and the RTC enabled, the current RTC timestamp will be printed.
Change-Id: I27676ceac8bccc56ac3d775915f217c8b3c47f4d Signed-off-by: Tim Wawrzynczak twawrzynczak@chromium.org --- M src/console/init.c M src/drivers/pc80/rtc/Makefile.inc M src/lib/Makefile.inc 3 files changed, 30 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/49/31649/1
diff --git a/src/console/init.c b/src/console/init.c index 7d1f31a..630478a 100644 --- a/src/console/init.c +++ b/src/console/init.c @@ -21,6 +21,7 @@ #include <device/pci.h> #include <option.h> #include <version.h> +#include <rtc.h>
/* Mutable console log level only allowed when RAM comes online. */ #if defined(__PRE_RAM__) @@ -84,4 +85,10 @@ printk(BIOS_NOTICE, "\n\ncoreboot-%s%s %s " ENV_STRING " starting (log level: %i)...\n", coreboot_version, coreboot_extra_version, coreboot_build, get_log_level()); + +#if IS_ENABLED(CONFIG_RTC) + struct rtc_time tm; + if (!rtc_get(&tm)) + rtc_display(&tm); +#endif } diff --git a/src/drivers/pc80/rtc/Makefile.inc b/src/drivers/pc80/rtc/Makefile.inc index 998b7e7..9047536 100644 --- a/src/drivers/pc80/rtc/Makefile.inc +++ b/src/drivers/pc80/rtc/Makefile.inc @@ -7,6 +7,14 @@ ramstage-$(CONFIG_DRIVERS_MC146818) += mc146818rtc.c smm-$(CONFIG_DRIVERS_MC146818) += mc146818rtc.c
+bootblock-$(CONFIG_RTC) += mc146818rtc_boot.c +bootblock-$(CONFIG_RTC) += mc146818rtc.c +postcar-$(CONFIG_RTC) += mc146818rtc.c +romstage-$(CONFIG_RTC) += mc146818rtc.c +ramstage-$(CONFIG_RTC) += mc146818rtc.c +smm-$(CONFIG_RTC) += mc146818rtc.c +verstage-$(CONFIG_RTC) += mc146818rtc.c + ifeq ($(CONFIG_USE_OPTION_TABLE),y) cbfs-files-$(CONFIG_HAVE_CMOS_DEFAULT) += cmos.default cmos.default-file = $(CONFIG_CMOS_DEFAULT_FILE):nvramtool diff --git a/src/lib/Makefile.inc b/src/lib/Makefile.inc index fa1ff8b..86a17b2 100644 --- a/src/lib/Makefile.inc +++ b/src/lib/Makefile.inc @@ -36,6 +36,10 @@ bootblock-y += bootblock.c endif
+ifeq ($(CONFIG_BOOTBLOCK_CONSOLE),y) +bootblock-$(CONFIG_RTC) += rtc.c +endif + bootblock-y += prog_loaders.c bootblock-y += prog_ops.c bootblock-y += cbfs.c @@ -66,6 +70,7 @@
verstage-$(CONFIG_GENERIC_UDELAY) += timer.c verstage-$(CONFIG_GENERIC_GPIO_LIB) += gpio.c +verstage-$(CONFIG_RTC) += rtc.c
romstage-y += prog_loaders.c romstage-y += prog_ops.c @@ -109,6 +114,8 @@
romstage-$(CONFIG_GENERIC_UDELAY) += timer.c
+romstage-$(CONFIG_RTC) += rtc.c + ramstage-y += prog_loaders.c ramstage-y += prog_ops.c ramstage-y += hardwaremain.c @@ -165,6 +172,10 @@ postcar-y += imd.c postcar-y += romstage_handoff.c
+ifeq ($(CONFIG_POSTCAR_CONSOLE),y) +postcar-$(CONFIG_RTC) += rtc.c +endif + bootblock-y += hexdump.c ramstage-y += hexdump.c romstage-y += hexdump.c @@ -196,6 +207,10 @@ smm-y += cbfs.c memcmp.c smm-$(CONFIG_GENERIC_UDELAY) += timer.c
+ifeq ($(CONFIG_DEBUG_SMI),y) +smm-$(CONFIG_RTC) += rtc.c +endif + bootblock-y += version.c romstage-y += version.c ramstage-y += version.c
Julius Werner has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/31649 )
Change subject: console: Add timestamp prints to boot stages. ......................................................................
Patch Set 2:
This isn't gonna work on many platforms. RTCs can be hooked up via many different interfaces which may have prerequisites that will only get set up in later stages (possibly even only after ramstage starts). console_init() is pretty much the first thing that runs in the bootblock.
What is the main goal here, why do you want to log the RTC time for every stage? Most normal boots take less than a second so you'll likely just log the same string 3 times. Wouldn't a single timestamp at the end of ramstage would be enough (in fact, boards configured for using ELOG, like all Chromebooks, already print the RTC time there as part of logging the boot event)? If you wanted to figure out when the other stages started, you could just use coreboot's much more accurate subsecond timestamps to calculate backwards from there.
Tim Wawrzynczak has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/31649 )
Change subject: console: Add timestamp prints to boot stages. ......................................................................
Patch Set 2:
Patch Set 2:
This isn't gonna work on many platforms. RTCs can be hooked up via many different interfaces which may have prerequisites that will only get set up in later stages (possibly even only after ramstage starts). console_init() is pretty much the first thing that runs in the bootblock.
What is the main goal here, why do you want to log the RTC time for every stage? Most normal boots take less than a second so you'll likely just log the same string 3 times. Wouldn't a single timestamp at the end of ramstage would be enough (in fact, boards configured for using ELOG, like all Chromebooks, already print the RTC time there as part of logging the boot event)? If you wanted to figure out when the other stages started, you could just use coreboot's much more accurate subsecond timestamps to calculate backwards from there.
The purpose is to be able to match up events between coreboot's logs and say, an EC log as well. I have a corresponding patch in the ChromeOS EC codebase which prints the RTC time at certain stages in the boot sequence as well.
Hello build bot (Jenkins), Furquan Shaikh, Patrick Georgi, Martin Roth,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/31649
to look at the new patch set (#3).
Change subject: console: Add timestamp prints to boot stages. ......................................................................
console: Add timestamp prints to boot stages.
When a new bootstage starts, if it has console support and the RTC enabled, the current RTC timestamp will be printed.
BUG=b:111675966 BRANCH=none TEST=verify RTC timestamps printed out at each bootstage
Change-Id: I27676ceac8bccc56ac3d775915f217c8b3c47f4d Signed-off-by: Tim Wawrzynczak twawrzynczak@chromium.org --- M src/console/init.c M src/drivers/pc80/rtc/Makefile.inc M src/lib/Makefile.inc 3 files changed, 30 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/49/31649/3
Julius Werner has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/31649 )
Change subject: console: Add timestamp prints to boot stages. ......................................................................
Patch Set 3:
The purpose is to be able to match up events between coreboot's logs and say, an EC log as well. I have a corresponding patch in the ChromeOS EC codebase which prints the RTC time at certain stages in the boot sequence as well.
Well, so for Chrome OS, don't we already have that? Every boot should include a
ELOG: Event(17) added with size 13 at 2018-05-24 02:19:10 UTC
line somewhere in ramstage. Just use that? No need to more RTC queries than needed (they aren't always cheap).
Tim Wawrzynczak has abandoned this change. ( https://review.coreboot.org/c/coreboot/+/31649 )
Change subject: console: Add timestamp prints to boot stages. ......................................................................
Abandoned