From fc9b8b916f7bc0c6ac1579b915937ed23ea3327a Mon Sep 17 00:00:00 2001 From: Felix Held Date: Tue, 26 May 2020 23:31:56 +0200 Subject: [PATCH] soc/amd/picasso/smu: only print time for actual command execution When waiting for the SMU to be ready to accept a new command, the time spent waiting shouldn't be printed as command execution time. Also fix the time unit in the print statement. Change-Id: I6b97b11cd9efae7029779ee2096d4f2224cecd72 Signed-off-by: Felix Held Reviewed-on: https://review.coreboot.org/c/coreboot/+/41751 Tested-by: build bot (Jenkins) Reviewed-by: Raul Rangel --- src/soc/amd/picasso/smu.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/soc/amd/picasso/smu.c b/src/soc/amd/picasso/smu.c index cfe2240021..4a373ce273 100644 --- a/src/soc/amd/picasso/smu.c +++ b/src/soc/amd/picasso/smu.c @@ -23,7 +23,7 @@ static void smu_write32(uint32_t reg, uint32_t val) #define SMU_MESG_RESP_OK 0x01 /* returns SMU_MESG_RESP_OK, SMU_MESG_RESP_TIMEOUT or a negative number */ -static int32_t smu_poll_response(void) +static int32_t smu_poll_response(bool print_command_duration) { struct stopwatch sw; const long timeout_ms = 10 * MSECS_PER_SEC; @@ -34,7 +34,8 @@ static int32_t smu_poll_response(void) do { result = smu_read32(REG_ADDR_MESG_RESP); if (result) { - printk(BIOS_SPEW, "SMU command consumed %ld msecs\n", + if (print_command_duration) + printk(BIOS_SPEW, "SMU command consumed %ld usecs\n", stopwatch_duration_usecs(&sw)); return result; } @@ -53,7 +54,7 @@ enum cb_err send_smu_message(enum smu_message_id id, struct smu_payload *arg) size_t i; /* wait until SMU can process a new request; don't care if an old request failed */ - if (smu_poll_response() == SMU_MESG_RESP_TIMEOUT) + if (smu_poll_response(false) == SMU_MESG_RESP_TIMEOUT) return CB_ERR; /* clear response register */ @@ -67,7 +68,7 @@ enum cb_err send_smu_message(enum smu_message_id id, struct smu_payload *arg) smu_write32(REG_ADDR_MESG_ID, id); /* wait until SMU has processed the message and check if it was successful */ - if (smu_poll_response() != SMU_MESG_RESP_OK) + if (smu_poll_response(true) != SMU_MESG_RESP_OK) return CB_ERR; /* copy returned values */