From 2ed61fb57b960b1f94501de634da1b8c26ff520f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Date: Fri, 9 Mar 2018 17:09:44 +0000 Subject: sdcard: Display command name when tracing CMD/ACMD MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The SDBus will reuse these functions, so we put them in a new source file. Signed-off-by: Philippe Mathieu-Daudé Message-id: 20180309153654.13518-3-f4bug@amsat.org Reviewed-by: Peter Maydell [PMM: slight wordsmithing of comments, added note that string returned does not need to be freed] Signed-off-by: Peter Maydell --- hw/sd/sd.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'hw/sd/sd.c') diff --git a/hw/sd/sd.c b/hw/sd/sd.c index 4a9520e..bb149aa 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -875,8 +875,8 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req) * However there is no ACMD55, so we want to trace this particular case. */ if (req.cmd != 55 || sd->expecting_acmd) { - trace_sdcard_normal_command(req.cmd, req.arg, - sd_state_name(sd->state)); + trace_sdcard_normal_command(sd_cmd_name(req.cmd), req.cmd, + req.arg, sd_state_name(sd->state)); } /* Not interpreting this as an app command */ @@ -1455,7 +1455,8 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req) static sd_rsp_type_t sd_app_command(SDState *sd, SDRequest req) { - trace_sdcard_app_command(req.cmd, req.arg); + trace_sdcard_app_command(sd_acmd_name(req.cmd), + req.cmd, req.arg, sd_state_name(sd->state)); sd->card_status |= APP_CMD; switch (req.cmd) { case 6: /* ACMD6: SET_BUS_WIDTH */ @@ -1770,7 +1771,8 @@ void sd_write_data(SDState *sd, uint8_t value) if (sd->card_status & (ADDRESS_ERROR | WP_VIOLATION)) return; - trace_sdcard_write_data(sd->current_cmd, value); + trace_sdcard_write_data(sd_acmd_name(sd->current_cmd), + sd->current_cmd, value); switch (sd->current_cmd) { case 24: /* CMD24: WRITE_SINGLE_BLOCK */ sd->data[sd->data_offset ++] = value; @@ -1908,7 +1910,8 @@ uint8_t sd_read_data(SDState *sd) io_len = (sd->ocr & (1 << 30)) ? 512 : sd->blk_len; - trace_sdcard_read_data(sd->current_cmd, io_len); + trace_sdcard_read_data(sd_acmd_name(sd->current_cmd), + sd->current_cmd, io_len); switch (sd->current_cmd) { case 6: /* CMD6: SWITCH_FUNCTION */ ret = sd->data[sd->data_offset ++]; -- cgit v1.1