From 77d0313358de7996985340a7aff26ac8039619f5 Mon Sep 17 00:00:00 2001 From: Subrata Banik Date: Fri, 4 Apr 2025 13:06:58 +0530 Subject: [PATCH] {commonlib, lib}: Add timestamp for early chip initialization This commit introduces a new timestamp `TS_DEVICE_INIT_CHIPS` to specifically mark the start of the `dev_initialize_chips()` function. Previously, the `TS_DEVICE_ENUMERATE` timestamp was incorrectly associated with the `bs_dev_init_chips` function. This patch corrects this by: - Adding the `TS_DEVICE_INIT_CHIPS` enum and name definition. - Updating `bs_dev_init_chips` in `src/lib/hardwaremain.c` to use `TS_DEVICE_INIT_CHIPS`. - Moving the `TS_DEVICE_ENUMERATE` timestamp addition to the `bs_dev_enumerate` function where device enumeration actually begins. This change provides a more accurate and meaningful timestamp for the early chipset initialization phase. TEST=Able to build and boot google/fatcat. ``` 971:loading FSP-S 836,277 (10,658) 17:starting LZ4 decompress (ignore for x86) 847,297 (11,019) 18:finished LZ4 decompress (ignore for x86) 847,376 (79) 30:early chipset initialization 854,579 (7,203) 17:starting LZ4 decompress (ignore for x86) 863,483 (8,903) 18:finished LZ4 decompress (ignore for x86) 863,490 (6) 17:starting LZ4 decompress (ignore for x86) 875,196 (11,705) 18:finished LZ4 decompress (ignore for x86) 875,237 (41) 954:calling FspSiliconInit 875,344 (107) 955:returning from FspSiliconInit 942,740 (67,396) 962:calling FspMultiPhaseSiInit 942,744 (4) 963:returning from FspMultiPhaseSiInit 1,081,355 (138,610) 31:device enumeration 1,081,708 (352) 40:device configuration 1,085,721 (4,013) 50:device enable 1,091,517 (5,795) ``` Change-Id: Ib6860901c6b1528ec5098fc93240c6e65777642b Signed-off-by: Subrata Banik Reviewed-on: https://review.coreboot.org/c/coreboot/+/87152 Tested-by: build bot (Jenkins) Reviewed-by: Karthik Ramasubramanian Reviewed-by: Julius Werner Reviewed-by: Wonkyu Kim Reviewed-by: Kapil Porwal Reviewed-by: Jayvik Desai --- src/commonlib/include/commonlib/timestamp_serialized.h | 4 +++- src/lib/hardwaremain.c | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/commonlib/include/commonlib/timestamp_serialized.h b/src/commonlib/include/commonlib/timestamp_serialized.h index f60e040c3b..6bcbabc890 100644 --- a/src/commonlib/include/commonlib/timestamp_serialized.h +++ b/src/commonlib/include/commonlib/timestamp_serialized.h @@ -37,7 +37,8 @@ enum timestamp_id { TS_ULZMA_END = 16, TS_ULZ4F_START = 17, TS_ULZ4F_END = 18, - TS_DEVICE_ENUMERATE = 30, + TS_DEVICE_INIT_CHIPS = 30, + TS_DEVICE_ENUMERATE = 31, TS_DEVICE_CONFIGURE = 40, TS_DEVICE_ENABLE = 50, TS_DEVICE_INITIALIZE = 60, @@ -218,6 +219,7 @@ static const struct timestamp_id_to_name { TS_NAME_DEF(TS_ULZMA_END, 0, "finished LZMA decompress (ignore for x86)"), TS_NAME_DEF(TS_ULZ4F_START, TS_ULZ4F_END, "starting LZ4 decompress (ignore for x86)"), TS_NAME_DEF(TS_ULZ4F_END, 0, "finished LZ4 decompress (ignore for x86)"), + TS_NAME_DEF(TS_DEVICE_INIT_CHIPS, TS_DEVICE_ENUMERATE, "early chipset initialization"), TS_NAME_DEF(TS_DEVICE_ENUMERATE, TS_DEVICE_CONFIGURE, "device enumeration"), TS_NAME_DEF(TS_DEVICE_CONFIGURE, TS_DEVICE_ENABLE, "device configuration"), TS_NAME_DEF(TS_DEVICE_ENABLE, TS_DEVICE_INITIALIZE, "device enable"), diff --git a/src/lib/hardwaremain.c b/src/lib/hardwaremain.c index fda6c62d2e..7e5d848af9 100644 --- a/src/lib/hardwaremain.c +++ b/src/lib/hardwaremain.c @@ -93,7 +93,7 @@ static boot_state_t bs_pre_device(void *arg) static boot_state_t bs_dev_init_chips(void *arg) { - timestamp_add_now(TS_DEVICE_ENUMERATE); + timestamp_add_now(TS_DEVICE_INIT_CHIPS); /* Initialize chips early, they might disable unused devices. */ dev_initialize_chips(); @@ -103,6 +103,8 @@ static boot_state_t bs_dev_init_chips(void *arg) static boot_state_t bs_dev_enumerate(void *arg) { + timestamp_add_now(TS_DEVICE_ENUMERATE); + /* Find the devices we don't have hard coded knowledge about. */ dev_enumerate();