summaryrefslogtreecommitdiff
path: root/src/soc/amd/picasso
diff options
context:
space:
mode:
authorFelix Held <felix.held@amd.corp-partner.google.com>2020-05-26 23:31:56 +0200
committerFelix Held <felix-coreboot@felixheld.de>2020-05-27 22:00:22 +0000
commitfc9b8b916f7bc0c6ac1579b915937ed23ea3327a (patch)
treeb1ac151d8d1ac1de1a6610a6aa8806484688ff50 /src/soc/amd/picasso
parent01a9493cfc2d79306053f6b5c96b0c916170ed28 (diff)
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 <felix-coreboot@felixheld.de> Reviewed-on: https://review.coreboot.org/c/coreboot/+/41751 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Raul Rangel <rrangel@chromium.org>
Diffstat (limited to 'src/soc/amd/picasso')
-rw-r--r--src/soc/amd/picasso/smu.c9
1 files 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 */