From 04ccbbc4640ad59ab17ca7494ebf3ea042a8ff0e Mon Sep 17 00:00:00 2001 From: Yidi Lin Date: Sat, 8 Feb 2025 12:17:59 +0800 Subject: [PATCH] soc/mediatek/common: Measure mtk_fsp_load_and_run() execution time Measure mtk_fsp_load_and_run() execution time. This info helps AP boot time analysis. The logs show as below. [INFO ] mtk_fsp_load_and_run: run fallback/mtk_fsp_romstage at phase 0x30 in 0 msecs [INFO ] mtk_fsp_load_and_run: run fallback/mtk_fsp_ramstage at phase 0x50 in 41 msecs BUG=none BRANCH=rauru TEST=cbmem -1|grep "mtk_fsp_load_and_run" Change-Id: I61706952bef4590c5bfd09707a08a4f1a25fbda2 Signed-off-by: Yidi Lin Reviewed-on: https://review.coreboot.org/c/coreboot/+/86325 Tested-by: build bot (Jenkins) Reviewed-by: Yu-Ping Wu --- src/soc/mediatek/common/mtk_fsp.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/soc/mediatek/common/mtk_fsp.c b/src/soc/mediatek/common/mtk_fsp.c index bc1b5d5f08..073a0798cc 100644 --- a/src/soc/mediatek/common/mtk_fsp.c +++ b/src/soc/mediatek/common/mtk_fsp.c @@ -3,6 +3,7 @@ #include #include #include +#include #define MAX_PARAM_ENTRIES 32 #define FSP_INTF_SIZE (sizeof(struct mtk_fsp_intf) + \ @@ -82,7 +83,9 @@ static const char *mtk_fsp_file(void) enum cb_err mtk_fsp_load_and_run(void) { struct prog fsp = PROG_INIT(PROG_REFCODE, mtk_fsp_file()); + struct stopwatch sw; + stopwatch_init(&sw); if (cbfs_prog_stage_load(&fsp)) { printk(BIOS_ERR, "%s: CBFS load program failed\n", __func__); return CB_ERR; @@ -101,8 +104,8 @@ enum cb_err mtk_fsp_load_and_run(void) return CB_ERR; } - printk(BIOS_INFO, "%s: run %s at phase %#x done\n", - __func__, mtk_fsp_file(), intf->phase); + printk(BIOS_INFO, "%s: run %s at phase %#x in %lld msecs\n", + __func__, mtk_fsp_file(), intf->phase, stopwatch_duration_msecs(&sw)); return CB_SUCCESS; }