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 <yidilin@chromium.org>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/86325
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Yu-Ping Wu <yupingso@google.com>
This commit is contained in:
Yidi Lin 2025-02-08 12:17:59 +08:00 committed by Matt DeVillier
commit 04ccbbc464

View file

@ -3,6 +3,7 @@
#include <cbfs.h>
#include <console/console.h>
#include <soc/mtk_fsp.h>
#include <timer.h>
#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;
}