{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 <subratabanik@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/87152
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Karthik Ramasubramanian <kramasub@google.com>
Reviewed-by: Julius Werner <jwerner@chromium.org>
Reviewed-by: Wonkyu Kim <wonkyu.kim@intel.com>
Reviewed-by: Kapil Porwal <kapilporwal@google.com>
Reviewed-by: Jayvik Desai <jayvik@google.com>
This commit is contained in:
Subrata Banik 2025-04-04 13:06:58 +05:30
commit 77d0313358
2 changed files with 6 additions and 2 deletions

View file

@ -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"),

View file

@ -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();