From nobody Wed Feb 11 08:38:12 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of _spf.google.com designates 209.85.216.195 as permitted sender) client-ip=209.85.216.195; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-qt0-f195.google.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of _spf.google.com designates 209.85.216.195 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com Received: from mail-qt0-f195.google.com (mail-qt0-f195.google.com [209.85.216.195]) by mx.zohomail.com with SMTPS id 1518732385029388.69613128321; Thu, 15 Feb 2018 14:06:25 -0800 (PST) Received: by mail-qt0-f195.google.com with SMTP id d8so1629944qtm.0 for ; Thu, 15 Feb 2018 14:06:24 -0800 (PST) Return-Path: Return-Path: Received: from x1.lan ([138.117.48.219]) by smtp.gmail.com with ESMTPSA id h200sm6330991qke.66.2018.02.15.14.06.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 15 Feb 2018 14:06:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=xf9HJZ0oJ9R354tjG0KetzdQLzJ95Chy4YMCHqkZt5s=; b=CWibFrTn++aT+g0B0BvZ8po2j9npju2x3wgtGpwGEB9R8HQ1nNJlscS8WgyYv7EvFy 3BHFBWcGDCXGKZhr2e/T+ACf+aegpneYlm5gklf1BoufiG04fmmM2vuM968PpPDcqupY X8t4qS5hfDo556QvKC1RzDa9s9o2+E/Qsxvw45NTFNVKiGuDi4eEKDNI4sXHvdtj3dHF PGChbv24jxgr+426wAbNkB5JIUFGq+PMIxmbOopugKk/8o2dtUlnK9QRyIjorMwPvB7q Beq/WCX2ZK+cGZ/nrDxmgQhJ0tDzYrQOORxHfr7+gUPBOGPQNpTOKLKGIw3Mh05HUA6S r1uw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=xf9HJZ0oJ9R354tjG0KetzdQLzJ95Chy4YMCHqkZt5s=; b=dNOxAKA6JU4CcWHkJXRMQEtl++YgnvupagOyG0+Zcir0WRSa8taEP8oNikhMSG4kRG tI+MlOajkJPZSSz26uzXlAoO63NP72HfBsIWLJUk8VLSVc4fZ4Ey2Qhj9hsyHiHV52Qe zpybwbCBzIpAnfu6z0gjeh6NNB9kktYwfy0qEivfOKeaPutVIFXG2/B5UEiOiKSqWlE8 2SyVHzFU3kBlCRZuKAPTJcTkCtzVOKJPUBrmKTFrDO1yuYUPmrIl3rQZkrUaAm3C+6Ej Y+G+Wb7GGYkjtl+Obg9Sf0AdnmJdOlyLKUtQIYMYPU4/DOImCMXUHU/u4uyMgBjGgB0d 2RtA== X-Gm-Message-State: APf1xPDigW7OSaibgPibmCarWfPk6UPI+G5NpNdZgjqIincSTTzXn9BW T/d8iuc5dWy5b2HgOIDd8kc= X-Google-Smtp-Source: AH8x225GqwTJyvij5Zoi9a3CuB9G6hb3/SJhsuN1Vs3ZDiBvIn4rkXjMcRGvKyMxEPMk/+2+N8lPdg== X-Received: by 10.200.45.217 with SMTP id q25mr6676376qta.215.1518732383972; Thu, 15 Feb 2018 14:06:23 -0800 (PST) Sender: =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: Alistair Francis , Peter Maydell , Igor Mitsyanko Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-devel@nongnu.org, "Edgar E . Iglesias" , Prasad J Pandit , Andrzej Zaborowski Subject: [PATCH v4 09/11] sdcard: display protocol used when tracing Date: Thu, 15 Feb 2018 19:05:38 -0300 Message-Id: <20180215220540.6556-10-f4bug@amsat.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180215220540.6556-1-f4bug@amsat.org> References: <20180215220540.6556-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZohoMail: RDKM_0 RSF_0 Z_629925259 SPT_0 put the function in sdmmc-common.c since we will reuse it in hw/sd/core.c Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Peter Maydell --- hw/sd/sd.c | 14 ++++++++++---- hw/sd/trace-events | 8 ++++---- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/hw/sd/sd.c b/hw/sd/sd.c index 666ff3873f..6760815045 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -122,6 +122,7 @@ struct SDState { qemu_irq readonly_cb; qemu_irq inserted_cb; QEMUTimer *ocr_power_timer; + const char *proto_name; bool enable; uint8_t dat_lines; bool cmd_line; @@ -828,7 +829,8 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDR= equest req) uint64_t addr =3D (sd->ocr & (1 << 30)) ? (uint64_t) req.arg << 9 : re= q.arg; =20 if (req.cmd !=3D 55 || sd->expecting_acmd) { - trace_sdcard_normal_command(sd_cmd_name(req.cmd), req.cmd, + trace_sdcard_normal_command(sd->proto_name, + sd_cmd_name(req.cmd), req.cmd, req.arg, sd_state_name(sd->state)); } =20 @@ -1400,7 +1402,7 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, S= DRequest req) static sd_rsp_type_t sd_app_command(SDState *sd, SDRequest req) { - trace_sdcard_app_command(sd_acmd_name(req.cmd), + trace_sdcard_app_command(sd->proto_name, sd_acmd_name(req.cmd), req.cmd, req.arg, sd_state_name(sd->state)); sd->card_status |=3D APP_CMD; switch (req.cmd) { @@ -1699,7 +1701,8 @@ void sd_write_data(SDState *sd, uint8_t value) if (sd->card_status & (ADDRESS_ERROR | WP_VIOLATION)) return; =20 - trace_sdcard_write_data(sd_acmd_name(sd->current_cmd), + trace_sdcard_write_data(sd->proto_name, + sd_acmd_name(sd->current_cmd), sd->current_cmd, value); switch (sd->current_cmd) { case 24: /* CMD24: WRITE_SINGLE_BLOCK */ @@ -1838,7 +1841,8 @@ uint8_t sd_read_data(SDState *sd) =20 io_len =3D (sd->ocr & (1 << 30)) ? 512 : sd->blk_len; =20 - trace_sdcard_read_data(sd_acmd_name(sd->current_cmd), + trace_sdcard_read_data(sd->proto_name, + sd_acmd_name(sd->current_cmd), sd->current_cmd, io_len); switch (sd->current_cmd) { case 6: /* CMD6: SWITCH_FUNCTION */ @@ -1980,6 +1984,8 @@ static void sd_realize(DeviceState *dev, Error **errp) SDState *sd =3D SD_CARD(dev); int ret; =20 + sd->proto_name =3D sd->spi ? "SPI" : "SD"; + if (sd->blk && blk_is_read_only(sd->blk)) { error_setg(errp, "Cannot use read-only drive as SD card"); return; diff --git a/hw/sd/trace-events b/hw/sd/trace-events index cdddca3dbf..2059ace61f 100644 --- a/hw/sd/trace-events +++ b/hw/sd/trace-events @@ -24,8 +24,8 @@ sdhci_write_dataport(uint16_t data_count) "write buffer f= illed with %u bytes of sdhci_capareg(const char *desc, uint16_t val) "%s: %u" =20 # hw/sd/sd.c -sdcard_normal_command(const char *cmd_desc, uint8_t cmd, uint32_t arg, con= st char *state) "%20s/ CMD%02d arg 0x%08x (state %s)" -sdcard_app_command(const char *acmd_desc, uint8_t acmd, uint32_t arg, cons= t char *state) "%23s/ACMD%02d arg 0x%08x (state %s)" +sdcard_normal_command(const char *proto, const char *cmd_desc, uint8_t cmd= , uint32_t arg, const char *state) "%s %20s/ CMD%02d arg 0x%08x (state %s)" +sdcard_app_command(const char *proto, const char *acmd_desc, uint8_t acmd,= uint32_t arg, const char *state) "%s %23s/ACMD%02d arg 0x%08x (state %s)" sdcard_response(const char *rspdesc, int rsplen) "%s (sz:%d)" sdcard_powerup(void) "" sdcard_inquiry_cmd41(void) "" @@ -39,8 +39,8 @@ sdcard_lock(void) "" sdcard_unlock(void) "" sdcard_read_block(uint64_t addr, uint32_t len) "addr 0x%" PRIx64 " size 0x= %x" sdcard_write_block(uint64_t addr, uint32_t len) "addr 0x%" PRIx64 " size 0= x%x" -sdcard_write_data(const char *cmd_desc, uint8_t cmd, uint8_t value) "%20s/= CMD%02d value 0x%02x" -sdcard_read_data(const char *cmd_desc, uint8_t cmd, int length) "%20s/ CMD= %02d len %d" +sdcard_write_data(const char *proto, const char *cmd_desc, uint8_t cmd, ui= nt8_t value) "%s %20s/ CMD%02d value 0x%02x" +sdcard_read_data(const char *proto, const char *cmd_desc, uint8_t cmd, int= length) "%s %20s/ CMD%02d len %d" sdcard_set_voltage(uint16_t millivolts) "%u mV" =20 # hw/sd/milkymist-memcard.c --=20 2.16.1