From nobody Mon Nov 25 00:14:19 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1719507026; cv=none; d=zohomail.com; s=zohoarc; b=RxSY8iuq8U7BkHNAKwSUJ1h1Vga08ib9qvLz2c/WFoNIwhFK3VtxLflTjjAK0fn37Ax8BJMK/qJxxCOiHhK3kLKAqAv+UnB4XLwC6sirUZK813uxBcOyqwezOIoVb6ne812X6rYtQurRNx2EzCeTo9xi82sB/iHMtK2Y1DzxTE0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1719507026; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=1Ij5pjsDB8qqEoSZ8JFKxxVUAdb9cjcc9vXzXqWT+4A=; b=UbQcibS6R74GDmlMIIPmWcPDhnXCj5Gf+ixgu94iN2BUT9xnap/lLPj1U0cU/sigMq2HdBR5ASDQTyVsbvy26XQhnxZ+2r6im8N3z5uwM3ht1+9bbSu52yuWPO9e/e/ZHnySaSz9e/V47UQqE19pIsChQJOynHGj++a8qpr0VbE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1719507026916683.9541741558297; Thu, 27 Jun 2024 09:50:26 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sMsIy-0003nc-J4; Thu, 27 Jun 2024 12:49:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sMsIW-0003Iw-6i for qemu-devel@nongnu.org; Thu, 27 Jun 2024 12:48:41 -0400 Received: from mail-lf1-x12c.google.com ([2a00:1450:4864:20::12c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sMsIU-0001MK-D3 for qemu-devel@nongnu.org; Thu, 27 Jun 2024 12:48:35 -0400 Received: by mail-lf1-x12c.google.com with SMTP id 2adb3069b0e04-5295e488248so9700184e87.2 for ; Thu, 27 Jun 2024 09:48:33 -0700 (PDT) Received: from localhost.localdomain (33.red-95-127-46.staticip.rima-tde.net. [95.127.46.33]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4249b132fd1sm86086595e9.0.2024.06.27.09.48.28 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 27 Jun 2024 09:48:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1719506912; x=1720111712; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=1Ij5pjsDB8qqEoSZ8JFKxxVUAdb9cjcc9vXzXqWT+4A=; b=e57gx9OoF/TpjB0MXM8eKiIuGpIc2MoOKv68hXg+vwC0jQJIPApNctIl1NsAiOireS o2o8+ihlCoY8xB+PGsLb8cwOMQoELhSR4URPYEtRCcb4RgOci9Z1Ky+8z/PlKpMBh3l4 K2eCtv7/+tOMtWdxw7qKBMUfHOh/xxP3M1D7d5wL96KFUBeU6j2jrpvX192YJdnq8vR6 1Fc+UgJDzxjfM0AdkJEEEeD05YiQyCdVQhGNyuRbOILw6jWgRJF39oXotTIzi+GdQKcQ 8rv5i1rna+GhuBi/ZwEuWrotiWwy84RoN6mPEzV8gd7ZQV/402YVP49pmzSQEiWkwsY/ RinA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719506912; x=1720111712; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1Ij5pjsDB8qqEoSZ8JFKxxVUAdb9cjcc9vXzXqWT+4A=; b=gOr3u6bn6vjrurNb1Yb/V9S1wMoQELFsA6MJQVFzUwMRohnxibQkN2jzXn2+T8FIT/ N55IPyaIcuJSf00ZIyIdWF9hymtFScj90tLVkgq+LSPw8KU2tozF4SsL40Pvs0Ti7fhW rvYN2n0t3muHd0eGY7hBdUzxCuFbbm5H+ERKYgiJMzaWWbUWupm1bM6NhokyNAJ5wLx7 Rp6HjYeVVt6EtehmLLM/yI21mqIc+5A3/LkwiXIzu6lwQdEZYi5vOQGUZmxn8gO2R7jf EqY+io/6Z6Ro41k8C4OUg45D2XS4EqxL7kL+d8IoqjS80td2Ddb0LBsn5Lp4WaJYEDm1 XBTA== X-Gm-Message-State: AOJu0YwKXpLfrMu7Vb/0PJhuz1b8SjZnasjrXQDu/o3XgTnUJVg1mAau PEdrOhWTDSb2/xmFfazbmXT+G/9za8rzsVCaCCa8ptKYVhdg8zvkiGIIozxrW1n63ad2HyJZgoE kKSM= X-Google-Smtp-Source: AGHT+IFiwYt587NSyqOJ5rwwySHKEMWtgq9ROMygwkdC1L0QUxuIPIAfXAuo74ca24j4W/8GACvaWQ== X-Received: by 2002:a19:6453:0:b0:52d:8356:f6b9 with SMTP id 2adb3069b0e04-52d8356f710mr3846079e87.38.1719506911667; Thu, 27 Jun 2024 09:48:31 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Luc Michel , Bin Meng , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-block@nongnu.org, Francisco Iglesias , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Sai Pavan Boddu , Joel Stanley Subject: [PATCH 01/12] hw/sd/sdcard: Add sd_acmd_SET_BUS_WIDTH handler (ACMD6) Date: Thu, 27 Jun 2024 18:48:03 +0200 Message-ID: <20240627164815.82606-2-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240627164815.82606-1-philmd@linaro.org> References: <20240627164815.82606-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::12c; envelope-from=philmd@linaro.org; helo=mail-lf1-x12c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1719507028200100001 Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/sd/sd.c | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/hw/sd/sd.c b/hw/sd/sd.c index 2f853a89d1..0310a5a3a1 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -260,7 +260,6 @@ static const char *sd_cmd_name(SDState *sd, uint8_t cmd) static const char *sd_acmd_name(SDState *sd, uint8_t cmd) { static const char *acmd_abbrev[SDMMC_CMD_MAX] =3D { - [6] =3D "SET_BUS_WIDTH", [13] =3D "SD_STATUS", [14] =3D "DPS_spec", [15] =3D "DPS_spec", [16] =3D "DPS_spec", @@ -1672,6 +1671,18 @@ static sd_rsp_type_t spi_cmd_CRC_ON_OFF(SDState *sd,= SDRequest req) return sd_r1; } =20 +/* ACMD6 */ +static sd_rsp_type_t sd_acmd_SET_BUS_WIDTH(SDState *sd, SDRequest req) +{ + if (sd->state !=3D sd_transfer_state) { + return sd_invalid_state_for_cmd(sd, req); + } + + sd->sd_status[0] &=3D 0x3f; + sd->sd_status[0] |=3D (req.arg & 0x03) << 6; + return sd_r1; +} + static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req) { uint64_t addr; @@ -1780,18 +1791,6 @@ static sd_rsp_type_t sd_app_command(SDState *sd, } =20 switch (req.cmd) { - case 6: /* ACMD6: SET_BUS_WIDTH */ - switch (sd->state) { - case sd_transfer_state: - sd->sd_status[0] &=3D 0x3f; - sd->sd_status[0] |=3D (req.arg & 0x03) << 6; - return sd_r1; - - default: - break; - } - break; - case 13: /* ACMD13: SD_STATUS */ switch (sd->state) { case sd_transfer_state: @@ -2385,6 +2384,9 @@ static const SDProto sd_proto_sd =3D { [58] =3D {11, sd_adtc, "READ_EXTR_MULTI", sd_cmd_optional}, [59] =3D {11, sd_adtc, "WRITE_EXTR_MULTI", sd_cmd_optional}, }, + .acmd =3D { + [6] =3D {8, sd_ac, "SET_BUS_WIDTH", sd_acmd_SET_BUS_WIDTH}, + }, }; =20 static void sd_instance_init(Object *obj) --=20 2.41.0 From nobody Mon Nov 25 00:14:19 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1719550500; cv=none; d=zohomail.com; s=zohoarc; b=GUoRnk5fvY7qM5UAIpq8q5rkirwyzYU8fpXs5373HURnWiZa+X/ZyMKzswZ3zkEjsjHwpt6tPMBmbQWz8UNf9DX3jcQ8+vCKkbjfxbPZg2CCXjviVqctyIqPDkqcfgWgN5yTnSMzzYQnqB866ovravvDzeWYCO6QkU3lSZ0LDc8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1719550500; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=9vrkGwBcqZVZMukUtGlLs/nHFLle6eNwrj7janh4+hs=; b=lJ5rpAc5AYqt9vxJ8Iq71spG4Tr4AijHbk35+IAtiXpr3pab3a0+PdYmcCFerAspXbGUc8V5cPtFBbx+2SuD3h0PxY3z1bOK7UW9RZuHJbNF7GVAEw6dy/I4wQ0MXH+u/r+41b/5WDg83f4zuIqYIRbwNe5ZClAw/cqWdQucvTk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1719550500528688.2807259225532; Thu, 27 Jun 2024 21:55:00 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sN3cG-0008DN-J5; Fri, 28 Jun 2024 00:53:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sN3c4-0008Al-86 for qemu-devel@nongnu.org; Fri, 28 Jun 2024 00:53:33 -0400 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sN3c2-00083r-Ax for qemu-devel@nongnu.org; Fri, 28 Jun 2024 00:53:31 -0400 Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-4217c7eb6b4so1887815e9.2 for ; Thu, 27 Jun 2024 21:53:29 -0700 (PDT) Received: from m1x-phil.lan (cho94-h02-176-184-4-239.dsl.sta.abo.bbox.fr. [176.184.4.239]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4256b09a32asm17899595e9.31.2024.06.27.21.53.25 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 27 Jun 2024 21:53:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1719550408; x=1720155208; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=9vrkGwBcqZVZMukUtGlLs/nHFLle6eNwrj7janh4+hs=; b=nIiDPMkHIaq9c/7QxbDC4b+/Jty15PrIMFR9kMGXT2uQX+UIU4kPLESG2CpNPy7hpr B1RkwGaUohdC6mWz19h9DX1gaN4O8wslxsVN2XmoKZSkitLahX/XPRnU3O3FbtJw/4py zzOjyiKbayxUR4ICa8K9zNgKjDtefTBFuya5iPYwxJ+/prSmE6L20Xore2Ay8WNf3V0a qXN5K4pwVgMagvO8wm3HClapMjPp3SL9iK+Wl1rlmS2KBaeOLbF4gGkM3E/HwBEG16SE J631Mn5PVnMXBgDLr7QSVpSby/ho7h66dCLzUr+fL9X5b2itlcc0E2w/i9kzQz8SyffJ /ZGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719550408; x=1720155208; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9vrkGwBcqZVZMukUtGlLs/nHFLle6eNwrj7janh4+hs=; b=O+cvkr3A09ducrnbfO6hETkTYmV4piVNVSDC07g5Omd92RQRpK35T6hmJIdUcEGhq+ KSBH5T543/ukdRiugGXMiwzcF58ykC1K2qXATjKTI/5wKHhczHX7VuG/nT0lSGMlMGxA VSzWU0UBUuYHrAlhekwHXf7wvusalTZKaLLkxsnLFoSXukzkBEMDxkj+GTEp1JJOhpUc XOYlL7yPI1bsAw+aIUxLCJ5pacCK2rppcKbp8AoHOMu+pnxtLgOmXP5YX0B2tiXbuC2y B2TEAEdUEuLyGCjxUiuN3iZJ1AetAs41PZJjnhieDaCtv671G1IPYfsAeSayHNvHix0P fcnw== X-Gm-Message-State: AOJu0YzfWHx9O72+/GCjeAoFJKfOpFb+OzLKBKSLGd94v3+xwBPdk1Um QFTYfLFJPG4M1E2EASCJcu/OqZafDTthH6JMD6oQIWt40rSruw17p9jG2Y49V1gYX27wNNGZEeG g19CAdw== X-Google-Smtp-Source: AGHT+IF53qg/ECt1wXE7W7DeylbxfI5udPBJGVPBPA8HXv1Qm1q/Q70vB7/YT53N1cT/dtFikAUoFQ== X-Received: by 2002:a05:600c:12c5:b0:425:5fe5:f273 with SMTP id 5b1f17b1804b1-4255fe5f3d0mr42043715e9.26.1719550407561; Thu, 27 Jun 2024 21:53:27 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Luc Michel , Francisco Iglesias , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Sai Pavan Boddu , Joel Stanley , Bin Meng , qemu-block@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH 02/12] hw/sd/sdcard: Add sd_acmd_SD_STATUS handler (ACMD13) Date: Fri, 28 Jun 2024 06:53:13 +0200 Message-ID: <20240628045323.86308-1-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240627164815.82606-1-philmd@linaro.org> References: <20240627164815.82606-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::333; envelope-from=philmd@linaro.org; helo=mail-wm1-x333.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1719550502355100008 Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/sd/sd.c | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/hw/sd/sd.c b/hw/sd/sd.c index 0310a5a3a1..5323a42df2 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -260,7 +260,6 @@ static const char *sd_cmd_name(SDState *sd, uint8_t cmd) static const char *sd_acmd_name(SDState *sd, uint8_t cmd) { static const char *acmd_abbrev[SDMMC_CMD_MAX] =3D { - [13] =3D "SD_STATUS", [14] =3D "DPS_spec", [15] =3D "DPS_spec", [16] =3D "DPS_spec", [18] =3D "SECU_spec", @@ -1683,6 +1682,13 @@ static sd_rsp_type_t sd_acmd_SET_BUS_WIDTH(SDState *= sd, SDRequest req) return sd_r1; } =20 +/* ACMD13 */ +static sd_rsp_type_t sd_acmd_SD_STATUS(SDState *sd, SDRequest req) +{ + return sd_cmd_to_sendingdata(sd, req, 0, + sd->sd_status, sizeof(sd->sd_status)); +} + static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req) { uint64_t addr; @@ -1791,18 +1797,6 @@ static sd_rsp_type_t sd_app_command(SDState *sd, } =20 switch (req.cmd) { - case 13: /* ACMD13: SD_STATUS */ - switch (sd->state) { - case sd_transfer_state: - return sd_cmd_to_sendingdata(sd, req, 0, - sd->sd_status, - sizeof(sd->sd_status)); - - default: - break; - } - break; - case 22: /* ACMD22: SEND_NUM_WR_BLOCKS */ switch (sd->state) { case sd_transfer_state: @@ -2329,6 +2323,7 @@ static const SDProto sd_proto_spi =3D { [59] =3D {0, sd_spi, "CRC_ON_OFF", spi_cmd_CRC_ON_OFF}, }, .acmd =3D { + [13] =3D {8, sd_spi, "SD_STATUS", sd_acmd_SD_STATUS}, [41] =3D {8, sd_spi, "SEND_OP_COND", spi_cmd_SEND_OP_COND}, }, }; @@ -2386,6 +2381,7 @@ static const SDProto sd_proto_sd =3D { }, .acmd =3D { [6] =3D {8, sd_ac, "SET_BUS_WIDTH", sd_acmd_SET_BUS_WIDTH}, + [13] =3D {8, sd_adtc, "SD_STATUS", sd_acmd_SD_STATUS}, }, }; =20 --=20 2.41.0 From nobody Mon Nov 25 00:14:19 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1719550522; cv=none; d=zohomail.com; s=zohoarc; b=WfyYzofFKwPW4Vlz9z9Sn1VlMGl0hnRY3+TPZpKWMfJq2j/qVD7mIxPFl+yBJDgaeQKtCMKrsIS9AhUVUuX0VISnqDgobHQ0y6ZR9bM0pKmOLmnKcCNiXJZP8oL0UmBNloi4g2vpCYVVdDIQQSgVhm3VcBk504es0QanRYU+tSE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1719550522; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=JLfOaKjryvDgm8/tAb2iA3e2u5r9x8cBXXCm9JQWcag=; b=gEQD6gKZqKSKVLC7UEtAW4ywCLyScK2Y2N12QB0DzZJ2Q2Vx3wXC4QbJvVNGj3hyliwtNRt/acbgl+W4zIC98HUNU21rp/JBo6y4gm463rFIOr8hRP2t8Eg5Pjnn3419a00zSOqULse5LrVzD0FM9Yn7T7COhXVjYOddF95lS/o= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1719550522131419.3465186177867; Thu, 27 Jun 2024 21:55:22 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sN3cR-0008Fe-FG; Fri, 28 Jun 2024 00:53:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sN3c9-0008Bn-Mw for qemu-devel@nongnu.org; Fri, 28 Jun 2024 00:53:38 -0400 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sN3c8-0008TP-5z for qemu-devel@nongnu.org; Fri, 28 Jun 2024 00:53:37 -0400 Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-4248e28de9eso1960775e9.2 for ; Thu, 27 Jun 2024 21:53:35 -0700 (PDT) Received: from m1x-phil.lan (cho94-h02-176-184-4-239.dsl.sta.abo.bbox.fr. [176.184.4.239]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4256b0642acsm18165885e9.25.2024.06.27.21.53.32 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 27 Jun 2024 21:53:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1719550414; x=1720155214; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=JLfOaKjryvDgm8/tAb2iA3e2u5r9x8cBXXCm9JQWcag=; b=MGniMHVbfPFwk4ZmDvn/1W9t2cXnNsxkadB0mqVki0ArGPfLK5E6Gec9ctx97tyqvc 0WlbRS2IMNx5LiKkqh2nvUI7oJQKg5Q3NKMg4OK+4cmQEJw6y0+8p2tdGbMasDLWo1q4 //P9DYkxyJWxP3mS/9lW8PSiRwnGjJOToaRsDjZmH/JLQC2dbAbGXoWx3lbc8ognX/5l R2wa7vGXLTqbhy+zgIJ8g7327ZtG/CBL7ETrObOS3A5zHIPx+A7RQZmKwZOR7sPWCV6T I5X5ooXGtUsd8ob0EzoydQR3tB15mDnnu/IdejfnV1f/be7kVDf+31Q4rwBaiji4Qxxd y4WQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719550414; x=1720155214; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=JLfOaKjryvDgm8/tAb2iA3e2u5r9x8cBXXCm9JQWcag=; b=kJZRpbXekDovjOq/O+WBMLRZ1AnlmZAeSVdRPTZIM7QLb7SC8XnEzlimnSWtfiaebT v349UZ8ZKrTGp++JjouAn8R+uk/snlM5dgg1ZSHzKn3C/9eauWqsy6ZNJYbXRJ4kSVxq AXUYAYRklzfQngCyn32I7S3hepj/c9ReBw7bWhucXDMYdJjQFfIZRbNc2mkKakzIB0SA c0uJcPmKHi0uBTIBHEwlAYoKQYWaTI1ekbxS7JEArKWLWIzgqA7ZkMRA7VFaMTv1yauc OLh2+VV/hrvW8pI9uuuEnAzwEWXenUXnz8tQqTr/nGE4nZ1IDJ+Y5QdavPCTsuYKmFVE gN/Q== X-Gm-Message-State: AOJu0YxcnwIwhTFiMHhBpdwNTOmot6a+mLymzdT1HVByzMWIwBR8UUmI +b4laggOIbTqlqXd4zWyXCZRketV3xKJZfVaCoNMPxS1eZlUu5UJdNCRZMr0ENw2XNlnm3cnUlI 7NEG05g== X-Google-Smtp-Source: AGHT+IFf8zCe7rLf6YyxQ08v5dLuzr9h9IEbQHaOKi+JzQFKgLNQpxjEI5GK+Cjx5g6mZMP2ZchVAQ== X-Received: by 2002:a7b:cb17:0:b0:422:9c91:a26f with SMTP id 5b1f17b1804b1-4248cc3426bmr107515545e9.19.1719550413994; Thu, 27 Jun 2024 21:53:33 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Luc Michel , Francisco Iglesias , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Sai Pavan Boddu , Joel Stanley , Bin Meng , qemu-block@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH 03/12] hw/sd/sdcard: Add sd_acmd_SEND_NUM_WR_BLOCKS handler (ACMD22) Date: Fri, 28 Jun 2024 06:53:14 +0200 Message-ID: <20240628045323.86308-2-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240627164815.82606-1-philmd@linaro.org> References: <20240627164815.82606-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::329; envelope-from=philmd@linaro.org; helo=mail-wm1-x329.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1719550522387100001 Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/sd/sd.c | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/hw/sd/sd.c b/hw/sd/sd.c index 5323a42df2..9d66c3715a 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -263,7 +263,7 @@ static const char *sd_acmd_name(SDState *sd, uint8_t cm= d) [14] =3D "DPS_spec", [15] =3D "DPS_spec", [16] =3D "DPS_spec", [18] =3D "SECU_spec", - [22] =3D "SEND_NUM_WR_BLOCKS", [23] =3D "SET_WR_BLK_ERASE_C= OUNT", + [23] =3D "SET_WR_BLK_ERASE_COU= NT", [42] =3D "SET_CLR_CARD_DETECT", [51] =3D "SEND_SCR", [52] =3D "SECU_spec", [53] =3D "SECU_spec", @@ -1689,6 +1689,13 @@ static sd_rsp_type_t sd_acmd_SD_STATUS(SDState *sd, = SDRequest req) sd->sd_status, sizeof(sd->sd_status)); } =20 +/* ACMD22 */ +static sd_rsp_type_t sd_acmd_SEND_NUM_WR_BLOCKS(SDState *sd, SDRequest req) +{ + return sd_cmd_to_sendingdata(sd, req, 0, + &sd->blk_written, sizeof(sd->blk_written)= ); +} + static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req) { uint64_t addr; @@ -1797,18 +1804,6 @@ static sd_rsp_type_t sd_app_command(SDState *sd, } =20 switch (req.cmd) { - case 22: /* ACMD22: SEND_NUM_WR_BLOCKS */ - switch (sd->state) { - case sd_transfer_state: - return sd_cmd_to_sendingdata(sd, req, 0, - &sd->blk_written, - sizeof(sd->blk_written)); - - default: - break; - } - break; - case 23: /* ACMD23: SET_WR_BLK_ERASE_COUNT */ switch (sd->state) { case sd_transfer_state: @@ -2324,6 +2319,7 @@ static const SDProto sd_proto_spi =3D { }, .acmd =3D { [13] =3D {8, sd_spi, "SD_STATUS", sd_acmd_SD_STATUS}, + [22] =3D {8, sd_spi, "SEND_NUM_WR_BLOCKS", sd_acmd_SEND_NUM_WR_BL= OCKS}, [41] =3D {8, sd_spi, "SEND_OP_COND", spi_cmd_SEND_OP_COND}, }, }; @@ -2382,6 +2378,7 @@ static const SDProto sd_proto_sd =3D { .acmd =3D { [6] =3D {8, sd_ac, "SET_BUS_WIDTH", sd_acmd_SET_BUS_WIDTH}, [13] =3D {8, sd_adtc, "SD_STATUS", sd_acmd_SD_STATUS}, + [22] =3D {8, sd_adtc, "SEND_NUM_WR_BLOCKS", sd_acmd_SEND_NUM_WR_B= LOCKS}, }, }; =20 --=20 2.41.0 From nobody Mon Nov 25 00:14:19 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1719550500; cv=none; d=zohomail.com; s=zohoarc; b=cKMi8Kk7LaRs4VJeolPdAUMPUu0HcvW6tw3ScrlhobiWsvuOLfDc28Tm4U0nSMnHP60a94XUx4IuJZLMDA6LneYUuwZRx0nFz9EPw+4bD27Jrod96lNe0uQuTk0QddH9g1ObspsnOzm6WxE9UgHXqqL0ri8Ai0Mx/3qAy1XedLM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1719550500; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=if+k3pC7/tUCTUn2xmGg3zarIgu5LY5GHs2T467fbqI=; b=bDcH8NuWZfYl9JUfq4O4QNiHzG5gMZO0P3SJI1Q0I5Tj1BgdTHFisug4uipcO2vszC5slmTrBGPnIvz6TrWn94uoJ4uRdji97oIgCbVsgneSkuDHfR7HCbBRsv5Xs7EtaA5+c0OZZ4KAnzmZfxByOdGsSritAr14FjopJBL9xJY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1719550500430151.59599972829915; Thu, 27 Jun 2024 21:55:00 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sN3cU-0008Ge-JH; Fri, 28 Jun 2024 00:53:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sN3cG-0008Di-0D for qemu-devel@nongnu.org; Fri, 28 Jun 2024 00:53:44 -0400 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sN3cE-0000Wq-EC for qemu-devel@nongnu.org; Fri, 28 Jun 2024 00:53:43 -0400 Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-424a3ccd0c0so2035135e9.1 for ; Thu, 27 Jun 2024 21:53:42 -0700 (PDT) Received: from m1x-phil.lan (cho94-h02-176-184-4-239.dsl.sta.abo.bbox.fr. [176.184.4.239]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4256af54ecasm17849165e9.12.2024.06.27.21.53.38 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 27 Jun 2024 21:53:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1719550420; x=1720155220; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=if+k3pC7/tUCTUn2xmGg3zarIgu5LY5GHs2T467fbqI=; b=rfxyJ8Wd1lYrO0/S+FMK/iNcQa28OsAdX7QZIpR/NaMFUKaXAoe9Bf5F/aIKuMHOiO D1/Qk89vLQGyZbxyfdgPFWFVZ0dz+yT90JHsRxMnTQYKAPdsSh2yXpn9X4deMWhFN0DG 4NAZk0T3GmxcPuhErZQO6lSVn25P3hHaz/f98xkPgm2YOJErwKoVt8uCRdaH7qc6FsPc yS8MjwrqvlW2wvCagin5XcNQ7t5G+/Q9U5M9hwOcWgu7P9QPPw53+xicOvB+xqzQPQLv 55BP4atz4faUSHGDhcykHcggmsI1f+35T/M5iz616RayWOB6i3Nh5jqKk56Mn0U5+jos 5DBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719550420; x=1720155220; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=if+k3pC7/tUCTUn2xmGg3zarIgu5LY5GHs2T467fbqI=; b=s275s4KpcoZ2pmgpmjT52/ve9RP3aV8iFZvLNcAYWfSN4SpfL2tGrGRlsR5acFRGzw QvgbZfZk1wmh4JZCMYb1pkUcGSPEWra6JR5Xv8BBbs1Q+U7tKonhix9uUh0K/CxG/1KA xd2YKBDicloB7qz1HubsPKMbxPyci+mxt7W0zGllPogG4hpeyI40RP7bB+FhMgnAHcJm oRpRH6mR197FCmcvjNj1yB+SzTrRQW3Yr8suRiWKGX/ssSFd5fWDYrhewA16wBkxG6Ui fLLcAbCKCXRiIj/bHr6hFePQdOkqG2xrTtGICMElKK41pZBy6qRCu9PLKG7g8X/WDsMT 6U4A== X-Gm-Message-State: AOJu0YzKk4m77TfRw4IgwC04qPk5ESem2gTGsGdzOSlWHq58RtdN1oX+ O1T+Ma4Gi9VGqvCtgnws1+zmnFYZd8V9vUbz/OufM+6KaFg2PVDTb3jV08W14OYCErU+IX//ebg qp/gtBw== X-Google-Smtp-Source: AGHT+IGDmXtiWX2jJDTWU+jla3epsGjUJndSoFrVb5uDaux98SHygVlvGjOldNv8xum+ZAWzmKhoUQ== X-Received: by 2002:a05:600c:3b8b:b0:425:69b7:3361 with SMTP id 5b1f17b1804b1-42569b7352bmr10751715e9.18.1719550420364; Thu, 27 Jun 2024 21:53:40 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Luc Michel , Francisco Iglesias , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Sai Pavan Boddu , Joel Stanley , Bin Meng , qemu-block@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH 04/12] hw/sd/sdcard: Add sd_acmd_SET_WR_BLK_ERASE_COUNT handler (ACMD23) Date: Fri, 28 Jun 2024 06:53:15 +0200 Message-ID: <20240628045323.86308-3-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240627164815.82606-1-philmd@linaro.org> References: <20240627164815.82606-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32d; envelope-from=philmd@linaro.org; helo=mail-wm1-x32d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1719550502350100007 Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/sd/sd.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/hw/sd/sd.c b/hw/sd/sd.c index 9d66c3715a..cd207a3090 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -263,7 +263,6 @@ static const char *sd_acmd_name(SDState *sd, uint8_t cm= d) [14] =3D "DPS_spec", [15] =3D "DPS_spec", [16] =3D "DPS_spec", [18] =3D "SECU_spec", - [23] =3D "SET_WR_BLK_ERASE_COU= NT", [42] =3D "SET_CLR_CARD_DETECT", [51] =3D "SEND_SCR", [52] =3D "SECU_spec", [53] =3D "SECU_spec", @@ -1696,6 +1695,15 @@ static sd_rsp_type_t sd_acmd_SEND_NUM_WR_BLOCKS(SDSt= ate *sd, SDRequest req) &sd->blk_written, sizeof(sd->blk_written)= ); } =20 +/* ACMD23 */ +static sd_rsp_type_t sd_acmd_SET_WR_BLK_ERASE_COUNT(SDState *sd, SDRequest= req) +{ + if (sd->state !=3D sd_transfer_state) { + return sd_invalid_state_for_cmd(sd, req); + } + return sd_r1; +} + static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req) { uint64_t addr; @@ -1804,16 +1812,6 @@ static sd_rsp_type_t sd_app_command(SDState *sd, } =20 switch (req.cmd) { - case 23: /* ACMD23: SET_WR_BLK_ERASE_COUNT */ - switch (sd->state) { - case sd_transfer_state: - return sd_r1; - - default: - break; - } - break; - case 41: /* ACMD41: SD_APP_OP_COND */ if (sd->state !=3D sd_idle_state) { break; @@ -2320,6 +2318,7 @@ static const SDProto sd_proto_spi =3D { .acmd =3D { [13] =3D {8, sd_spi, "SD_STATUS", sd_acmd_SD_STATUS}, [22] =3D {8, sd_spi, "SEND_NUM_WR_BLOCKS", sd_acmd_SEND_NUM_WR_BL= OCKS}, + [23] =3D {8, sd_spi, "SET_WR_BLK_ERASE_COUNT", sd_acmd_SET_WR_BLK= _ERASE_COUNT}, [41] =3D {8, sd_spi, "SEND_OP_COND", spi_cmd_SEND_OP_COND}, }, }; @@ -2379,6 +2378,7 @@ static const SDProto sd_proto_sd =3D { [6] =3D {8, sd_ac, "SET_BUS_WIDTH", sd_acmd_SET_BUS_WIDTH}, [13] =3D {8, sd_adtc, "SD_STATUS", sd_acmd_SD_STATUS}, [22] =3D {8, sd_adtc, "SEND_NUM_WR_BLOCKS", sd_acmd_SEND_NUM_WR_B= LOCKS}, + [23] =3D {8, sd_ac, "SET_WR_BLK_ERASE_COUNT", sd_acmd_SET_WR_BL= K_ERASE_COUNT}, }, }; =20 --=20 2.41.0 From nobody Mon Nov 25 00:14:19 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1719550500; cv=none; d=zohomail.com; s=zohoarc; b=FIp2Gcn9EqPoRy1kpMLdIThDCw1KddAtLPrpPQzixoyx5Q8iiSxLm4EsXRL8nicF64rMDAggSSYACM4VhmLiMzXGyxfC7AcnQxraTRGn4yfJI6pHLDz1ZTQJIsJS5QevZm88/0XaizAS5elvlvVv4zXotDZlbmIMNm05aNh18sg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1719550500; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=bYEYJ2Wwx71dNKsAcy31SFsnrP/uSxrEAbuXlnudJVY=; b=AmLzxKsPPCAW3/mQYwyODUtUNr8a+E0HYKP6LQZ23sk0hDNftQHJSBRgtlddHN5SlXWUOPyeGNVfC4XqfXh1TFvtvckSpZCq0Xrfu5MznNAyLs9+LlBtVHk27hSHiSGBOeBVlBBOgPcgUHnBCVXfkPTYiLTg+bZiYbCpzoCwWns= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1719550500433463.1210958637146; Thu, 27 Jun 2024 21:55:00 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sN3cf-0008Hu-1E; Fri, 28 Jun 2024 00:54:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sN3cV-0008Gt-52 for qemu-devel@nongnu.org; Fri, 28 Jun 2024 00:53:59 -0400 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sN3cL-0000yR-Jp for qemu-devel@nongnu.org; Fri, 28 Jun 2024 00:53:51 -0400 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-424ad289949so1693045e9.2 for ; Thu, 27 Jun 2024 21:53:48 -0700 (PDT) Received: from m1x-phil.lan (cho94-h02-176-184-4-239.dsl.sta.abo.bbox.fr. [176.184.4.239]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4256b0676a3sm17725975e9.28.2024.06.27.21.53.45 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 27 Jun 2024 21:53:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1719550427; x=1720155227; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=bYEYJ2Wwx71dNKsAcy31SFsnrP/uSxrEAbuXlnudJVY=; b=NvKkGR4dZX69TRUprAurmT7zjgRF6itDIG4N8cZ6Fdb7fj/nmB7WmjWK5Qcf3GueMr TPKisfaQDmPcTI9IncGWzZhsDDpjhisWfhdFWGTjYPVcjZPe5tIO1OfPSFPB8bQGPH8h 4KmF8SvYAdrvCjtUhfbYCJ+2MQPVKjoNBvcm1sEnzBAVLAbFRN+SpAvDoFqY3sVQkRBM N9dT5NvzThcD4Ssleif91C3O9/hGM6DbxWVcqDicaiUS5rw2edgvAUtTj1F3ybeEwCuE wLVHJJOoEUG/yry7oudRVg+EI54AQYyt0G+qIj07lpIcaqsEm2xBi/8+7Iiz6J9muwIA AGSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719550427; x=1720155227; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=bYEYJ2Wwx71dNKsAcy31SFsnrP/uSxrEAbuXlnudJVY=; b=vOOQvWFvDQyA75KxdiMQTy69OAzVnyijTvqAzvguzTy9rjDlhNzx+/Dm2TVyC75X/B qFwNBtVmKxDrg0GMjZnMHrzzs9a3sixrsUJ7oCvivk2w2N6u4qur272EnNKU/UfYp3U+ TVk43w++9CdmEh5Se6U79yqGeZ6gRjFhu9/x3H6ezXrV5tQvS3zFTPHCVo6B082uQAzp Ci0iQMgbjUb8xBgPk3lz1Ypl0m8FoaSVMH0bneSqNlRp2jV3ZrNgFFvpdDmzmbBpYfj+ Ockr/G/4meCVG4CCYfYsNpVVGuUa0IIeCwsnChQzSYKvAySYyiRotd+jyXbG9GNo8Woc u/kQ== X-Gm-Message-State: AOJu0YzuFilUbyx/SSE59d2G4rSNOBLcVzXVYvSylii2TR0RuaVF3yaO exadjFANEMB0NkBLykcpUiHK6SNXdlfY/dvGfb/SnJQYPwyeWRgOLxzw+79RbUKkrYQGlrxC0SM 90xZAEA== X-Google-Smtp-Source: AGHT+IF2wuR/EsTUKhqwrXuCXID6JTSa05iGcVduS3p6PIItAp+gB+5A9DPsB9AKT/9iM3ekks4VEQ== X-Received: by 2002:a05:600c:1c90:b0:424:eeca:6bd0 with SMTP id 5b1f17b1804b1-424eeca6c69mr42766655e9.13.1719550427208; Thu, 27 Jun 2024 21:53:47 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Luc Michel , Francisco Iglesias , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Sai Pavan Boddu , Joel Stanley , Bin Meng , qemu-block@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH 05/12] hw/sd/sdcard: Add sd_acmd_SD_APP_OP_COND handler (ACMD41) Date: Fri, 28 Jun 2024 06:53:16 +0200 Message-ID: <20240628045323.86308-4-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240627164815.82606-1-philmd@linaro.org> References: <20240627164815.82606-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::332; envelope-from=philmd@linaro.org; helo=mail-wm1-x332.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1719550502426100013 Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/sd/sd.c | 82 ++++++++++++++++++++++++++++++------------------------ 1 file changed, 45 insertions(+), 37 deletions(-) diff --git a/hw/sd/sd.c b/hw/sd/sd.c index cd207a3090..167e1c517a 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -1704,6 +1704,50 @@ static sd_rsp_type_t sd_acmd_SET_WR_BLK_ERASE_COUNT(= SDState *sd, SDRequest req) return sd_r1; } =20 +/* ACMD41 */ +static sd_rsp_type_t sd_acmd_SD_APP_OP_COND(SDState *sd, SDRequest req) +{ + if (sd->state !=3D sd_idle_state) { + return sd_invalid_state_for_cmd(sd, req); + } + + /* + * If it's the first ACMD41 since reset, we need to decide + * whether to power up. If this is not an enquiry ACMD41, + * we immediately report power on and proceed below to the + * ready state, but if it is, we set a timer to model a + * delay for power up. This works around a bug in EDK2 + * UEFI, which sends an initial enquiry ACMD41, but + * assumes that the card is in ready state as soon as it + * sees the power up bit set. + */ + if (!FIELD_EX32(sd->ocr, OCR, CARD_POWER_UP)) { + if ((req.arg & ACMD41_ENQUIRY_MASK) !=3D 0) { + timer_del(sd->ocr_power_timer); + sd_ocr_powerup(sd); + } else { + trace_sdcard_inquiry_cmd41(); + if (!timer_pending(sd->ocr_power_timer)) { + timer_mod_ns(sd->ocr_power_timer, + (qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + + OCR_POWER_DELAY_NS)); + } + } + } + + if (FIELD_EX32(sd->ocr & req.arg, OCR, VDD_VOLTAGE_WINDOW)) { + /* + * We accept any voltage. 10000 V is nothing. + * + * Once we're powered up, we advance straight to ready state + * unless it's an enquiry ACMD41 (bits 23:0 =3D=3D 0). + */ + sd->state =3D sd_ready_state; + } + + return sd_r3; +} + static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req) { uint64_t addr; @@ -1812,43 +1856,6 @@ static sd_rsp_type_t sd_app_command(SDState *sd, } =20 switch (req.cmd) { - case 41: /* ACMD41: SD_APP_OP_COND */ - if (sd->state !=3D sd_idle_state) { - break; - } - /* If it's the first ACMD41 since reset, we need to decide - * whether to power up. If this is not an enquiry ACMD41, - * we immediately report power on and proceed below to the - * ready state, but if it is, we set a timer to model a - * delay for power up. This works around a bug in EDK2 - * UEFI, which sends an initial enquiry ACMD41, but - * assumes that the card is in ready state as soon as it - * sees the power up bit set. */ - if (!FIELD_EX32(sd->ocr, OCR, CARD_POWER_UP)) { - if ((req.arg & ACMD41_ENQUIRY_MASK) !=3D 0) { - timer_del(sd->ocr_power_timer); - sd_ocr_powerup(sd); - } else { - trace_sdcard_inquiry_cmd41(); - if (!timer_pending(sd->ocr_power_timer)) { - timer_mod_ns(sd->ocr_power_timer, - (qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) - + OCR_POWER_DELAY_NS)); - } - } - } - - if (FIELD_EX32(sd->ocr & req.arg, OCR, VDD_VOLTAGE_WINDOW)) { - /* We accept any voltage. 10000 V is nothing. - * - * Once we're powered up, we advance straight to ready state - * unless it's an enquiry ACMD41 (bits 23:0 =3D=3D 0). - */ - sd->state =3D sd_ready_state; - } - - return sd_r3; - case 42: /* ACMD42: SET_CLR_CARD_DETECT */ switch (sd->state) { case sd_transfer_state: @@ -2379,6 +2386,7 @@ static const SDProto sd_proto_sd =3D { [13] =3D {8, sd_adtc, "SD_STATUS", sd_acmd_SD_STATUS}, [22] =3D {8, sd_adtc, "SEND_NUM_WR_BLOCKS", sd_acmd_SEND_NUM_WR_B= LOCKS}, [23] =3D {8, sd_ac, "SET_WR_BLK_ERASE_COUNT", sd_acmd_SET_WR_BL= K_ERASE_COUNT}, + [41] =3D {8, sd_bcr, "SD_APP_OP_COND", sd_acmd_SD_APP_OP_COND}, }, }; =20 --=20 2.41.0 From nobody Mon Nov 25 00:14:19 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1719550503; cv=none; d=zohomail.com; s=zohoarc; b=mMbeYKqiafBCUVRl7VFMgg7vR+kzqHyOruNZvZHl6CWzlxdvZ8RAlyiNLf5U1s7AP6GcjFpt/w5BKFYW6kKirLT/EzLl5/Bns0syllsF6PxyzZoZZLZ2DahgFHQP4ZesYf0FPIEAXO8igtfFPtjQKgImP6dsb7TUtLbjfoVpFzE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1719550503; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=V0gZMlOJcmhezdd4Yk1lqkQI7yCyPoJydtauFHQrfjI=; b=nOcwlTCAqisB5dtw1zS57uGE6kJVa8x4w413YlVGAmUKrTc1GP7mhBmyALQomUWOMIKt8QKwyBD+E2UEzukYnSQshxyAxX4yGeJZBd9d1EsvkjYI5wpaY4wsCJc6ldX+p8UGlssQH14fsLP4xyEUc2ijM7C6vdW+ao/olhHJgQE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1719550502992939.3568575667068; Thu, 27 Jun 2024 21:55:02 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sN3d2-0008Tg-3r; Fri, 28 Jun 2024 00:54:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sN3cY-0008Hz-Gt for qemu-devel@nongnu.org; Fri, 28 Jun 2024 00:54:04 -0400 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sN3cU-0000zH-0S for qemu-devel@nongnu.org; Fri, 28 Jun 2024 00:54:00 -0400 Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-42561c16ffeso1875085e9.3 for ; Thu, 27 Jun 2024 21:53:54 -0700 (PDT) Received: from m1x-phil.lan (cho94-h02-176-184-4-239.dsl.sta.abo.bbox.fr. [176.184.4.239]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3675a0d8df0sm1064540f8f.29.2024.06.27.21.53.51 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 27 Jun 2024 21:53:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1719550433; x=1720155233; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=V0gZMlOJcmhezdd4Yk1lqkQI7yCyPoJydtauFHQrfjI=; b=usV2tdS7nqPVEOAl4conk4qZ/m2RHB6p9xOgQLBsDzGxFXoVAokRfgsfSeiytRBZq1 +g+FSjeQRN7FfUCcg7+6Pf7qXrB3mCxvkdIOS53kmdT5nGMH4EnIByikTJDUmK0vGnvS 5FZA+XeUFWDJkcIm14enr7JwY+FyE/bcvTlISzMmrFPjSG9U1x4ixDdhIcMQtICtKwGR FcPxevBGNSQqQlCY8alJtkjNvMGJxxlvzbHuuvoQslUPt8qEaO42an40oEA+ki+kGYb+ mBYSeuyNFuetfAkfDxprZtzsCzgsnELx2Ig/sSzxb4vler/dBE6/+g/4tg+REzl2o/0O zFMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719550433; x=1720155233; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=V0gZMlOJcmhezdd4Yk1lqkQI7yCyPoJydtauFHQrfjI=; b=FcvctY1gRjN5wS72/tD25Dppb2cxZwMgD+0NT5Hu/XOe17D6rA5URVOkVD6lFKBEaI FP8GMgAUpsjrfXY9vfHCw9CDvZ/ORU/awKh2fnQUU7HZLNbXR6ie9SWL1lip7vZf1+f8 0EUZYwAU38kb8X7+0HSh1UkY/Ntt1csd6OXOMKSXceNNImjVe/Rc0kM2DwXp7/YeNKu+ WeTocyUM+GY1wZO7rOCBlXo/gTJs2MNwBJ55ssLd5eKrvOTrBMyhiHoj4zNXYbIytw8r JgtUtAS8enWWskED+R7IQSvbeTkem4FjQMeRnbOAAZi18QDRHoba17Leudq7LZLZUaxa mMDg== X-Gm-Message-State: AOJu0YwuC+9GeDCFwwKxS32sKqGWjhf3dtv68WiNkCzIN7f3ds2KDyVV 863KSx4ykyYwZ6hLL4ib0R5nRxQrj5aSiySXlmXsG/u2Otoel342fiuOM1PdOghqkefhdCL5nzy NphA2pg== X-Google-Smtp-Source: AGHT+IFjZet+FWymQKxFtUYPOH65+BK/+GeCnJm/tCxrawI0AMd/5T3D5FPNza8eU++P9DM1khKcoA== X-Received: by 2002:a5d:58d2:0:b0:367:437f:1774 with SMTP id ffacd0b85a97d-367437f1ae7mr2505882f8f.14.1719550433476; Thu, 27 Jun 2024 21:53:53 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Luc Michel , Francisco Iglesias , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Sai Pavan Boddu , Joel Stanley , Bin Meng , qemu-block@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH 06/12] hw/sd/sdcard: Add sd_acmd_SET_CLR_CARD_DETECT handler (ACMD42) Date: Fri, 28 Jun 2024 06:53:17 +0200 Message-ID: <20240628045323.86308-5-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240627164815.82606-1-philmd@linaro.org> References: <20240627164815.82606-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32c; envelope-from=philmd@linaro.org; helo=mail-wm1-x32c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1719550504303100017 Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/sd/sd.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/hw/sd/sd.c b/hw/sd/sd.c index 167e1c517a..a27a7e0f24 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -263,7 +263,6 @@ static const char *sd_acmd_name(SDState *sd, uint8_t cm= d) [14] =3D "DPS_spec", [15] =3D "DPS_spec", [16] =3D "DPS_spec", [18] =3D "SECU_spec", - [42] =3D "SET_CLR_CARD_DETECT", [51] =3D "SEND_SCR", [52] =3D "SECU_spec", [53] =3D "SECU_spec", [54] =3D "SECU_spec", @@ -1748,6 +1747,17 @@ static sd_rsp_type_t sd_acmd_SD_APP_OP_COND(SDState = *sd, SDRequest req) return sd_r3; } =20 +/* ACMD42 */ +static sd_rsp_type_t sd_acmd_SET_CLR_CARD_DETECT(SDState *sd, SDRequest re= q) +{ + if (sd->state !=3D sd_transfer_state) { + return sd_invalid_state_for_cmd(sd, req); + } + + /* Bringing in the 50KOhm pull-up resistor... Done. */ + return sd_r1; +} + static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req) { uint64_t addr; @@ -1856,17 +1866,6 @@ static sd_rsp_type_t sd_app_command(SDState *sd, } =20 switch (req.cmd) { - case 42: /* ACMD42: SET_CLR_CARD_DETECT */ - switch (sd->state) { - case sd_transfer_state: - /* Bringing in the 50KOhm pull-up resistor... Done. */ - return sd_r1; - - default: - break; - } - break; - case 51: /* ACMD51: SEND_SCR */ switch (sd->state) { case sd_transfer_state: @@ -2327,6 +2326,7 @@ static const SDProto sd_proto_spi =3D { [22] =3D {8, sd_spi, "SEND_NUM_WR_BLOCKS", sd_acmd_SEND_NUM_WR_BL= OCKS}, [23] =3D {8, sd_spi, "SET_WR_BLK_ERASE_COUNT", sd_acmd_SET_WR_BLK= _ERASE_COUNT}, [41] =3D {8, sd_spi, "SEND_OP_COND", spi_cmd_SEND_OP_COND}, + [42] =3D {8, sd_spi, "SET_CLR_CARD_DETECT", sd_acmd_SET_CLR_CARD_= DETECT}, }, }; =20 @@ -2387,6 +2387,7 @@ static const SDProto sd_proto_sd =3D { [22] =3D {8, sd_adtc, "SEND_NUM_WR_BLOCKS", sd_acmd_SEND_NUM_WR_B= LOCKS}, [23] =3D {8, sd_ac, "SET_WR_BLK_ERASE_COUNT", sd_acmd_SET_WR_BL= K_ERASE_COUNT}, [41] =3D {8, sd_bcr, "SD_APP_OP_COND", sd_acmd_SD_APP_OP_COND}, + [42] =3D {8, sd_ac, "SET_CLR_CARD_DETECT", sd_acmd_SET_CLR_CARD= _DETECT}, }, }; =20 --=20 2.41.0 From nobody Mon Nov 25 00:14:19 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1719550520; cv=none; d=zohomail.com; s=zohoarc; b=WLEWAyKdos204fLAqzF4k4C3E1UJ3aA3HYHnfbMz4drVaA3BfGteqthYq9ewqOtcP8sdmNNmtPGymzmOWbQ2UA+SgyjOQY3ad2nThIpePQ3ZAEE3NHEgdkWWY1xKi6cxlwAjWxOkxZ1AB0YKl20CHpQXT+P87OnHI1afB5CE05I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1719550520; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=eSwX8/t3OMl0d9bqgd19YFhdT5y/t7Myi2nZ/gwkh2s=; b=Q4oTWKgYlyLvS5asGKOhGHQjaKGHe8qHJOY99vwWfOmgoWoZlYrX5AzzLlNZT/xMhqqdCdr9UKp0rmAESCjD+b70FQstphKhHEK9h5PeYyfVvCNtWqQFJA7wgD7QYQwHnKG0U8+2i8XIAdma6eNu1yoMElhtlKKwo1IYG4IpB4M= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1719550520907734.3191912542347; Thu, 27 Jun 2024 21:55:20 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sN3dK-0000PB-SC; Fri, 28 Jun 2024 00:54:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sN3cc-0008JX-OS for qemu-devel@nongnu.org; Fri, 28 Jun 2024 00:54:11 -0400 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sN3cZ-000107-5D for qemu-devel@nongnu.org; Fri, 28 Jun 2024 00:54:05 -0400 Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-42564316479so1597695e9.2 for ; Thu, 27 Jun 2024 21:54:01 -0700 (PDT) Received: from m1x-phil.lan (cho94-h02-176-184-4-239.dsl.sta.abo.bbox.fr. [176.184.4.239]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4256af59732sm17977125e9.11.2024.06.27.21.53.58 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 27 Jun 2024 21:53:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1719550440; x=1720155240; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=eSwX8/t3OMl0d9bqgd19YFhdT5y/t7Myi2nZ/gwkh2s=; b=yKHNNxKgY7ZX4YFKqfbMD5eiGC34iqqHsHNwkO6bFTSoIjKZURlX9+mcMApLMx1GSq SFqZDf5wG9IivNZVq/t8Oko+fT/OfVWnM3MrNj4RNN8pbcIn2VoKCVtCp08jG4Np0s4u Zihdc4VriTHx1hkYyIQ3thtKcvRD+bFU8WU/Nqd3Ua5PBSE5Gtbqj/tE31nbShfHFjeB nUWiHXF5OMaUyPzebbibFHwdU+JCWFyxfNa4gmsyZUZ25GIIDmZt7sCK/udn5/gm0QGV iUiC0I2BKy5HwukolIYHyjYcOLmXRNzpfoSYDZrIHeZJAc3EKr8FQ5aFHPqwqYk0gG6N PzLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719550440; x=1720155240; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=eSwX8/t3OMl0d9bqgd19YFhdT5y/t7Myi2nZ/gwkh2s=; b=kK/x0Wdy34wpXswITOH9gyQDJycyLY0GE/45evQucunTlZmhcQjR+RQ7MxjCQv7XZd slMVMdPndvGdAHuI6Z65gwZIvDegnWDUCYpHCvV707YeJ1m73U7btvHz4gKtQyoO8kP5 z4Ia0T28cBieaYMtBvOqxaTkezI6o+H0efpWW6u1/pHs4NCwOnrJWBFr99SjFuZem9iq uCOkMoUW/g+BUbmIVQ2THAjiG37atcUB6VqLdIwgZ0D73ecdIrj/oxjUA4PNO+86JlMD Mlw46YIOuNOz6GPYJyaZKQ4SQ7Y9Zpo8q0v/u8uUaFR//3XEvj+R4MPr/E6PnogXf5hP 7xbg== X-Gm-Message-State: AOJu0YwLbbWxpYdtjBR2c0wc4O7gdYPgMsVfZAfK2DMRJVEv2Z3Eob6v 3kjoWxXhtCwEHEZp9x8SGCbP/7KU18iWssnV34smlv4ZD0M5y4BA1/IB3gpvA79VfrKiLn/0ILr SHbQNkA== X-Google-Smtp-Source: AGHT+IHlXD0zkgfjs3w0IFmHdT1snza8t4ijzjhTrqN0Ae4teZsL+Nz44JFBZ9GgY1GkVKY/QXL9vg== X-Received: by 2002:a5d:5745:0:b0:364:81e7:3917 with SMTP id ffacd0b85a97d-366e946480fmr11211294f8f.3.1719550440322; Thu, 27 Jun 2024 21:54:00 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Luc Michel , Francisco Iglesias , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Sai Pavan Boddu , Joel Stanley , Bin Meng , qemu-block@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH 07/12] hw/sd/sdcard: Add sd_acmd_SEND_SCR handler (ACMD51) Date: Fri, 28 Jun 2024 06:53:18 +0200 Message-ID: <20240628045323.86308-6-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240627164815.82606-1-philmd@linaro.org> References: <20240627164815.82606-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::333; envelope-from=philmd@linaro.org; helo=mail-wm1-x333.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1719550522387100002 Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/sd/sd.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/hw/sd/sd.c b/hw/sd/sd.c index a27a7e0f24..6a9d611429 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -263,7 +263,6 @@ static const char *sd_acmd_name(SDState *sd, uint8_t cm= d) [14] =3D "DPS_spec", [15] =3D "DPS_spec", [16] =3D "DPS_spec", [18] =3D "SECU_spec", - [51] =3D "SEND_SCR", [52] =3D "SECU_spec", [53] =3D "SECU_spec", [54] =3D "SECU_spec", [56] =3D "SECU_spec", [57] =3D "SECU_spec", @@ -1758,6 +1757,12 @@ static sd_rsp_type_t sd_acmd_SET_CLR_CARD_DETECT(SDS= tate *sd, SDRequest req) return sd_r1; } =20 +/* ACMD51 */ +static sd_rsp_type_t sd_acmd_SEND_SCR(SDState *sd, SDRequest req) +{ + return sd_cmd_to_sendingdata(sd, req, 0, sd->scr, sizeof(sd->scr)); +} + static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req) { uint64_t addr; @@ -1866,16 +1871,6 @@ static sd_rsp_type_t sd_app_command(SDState *sd, } =20 switch (req.cmd) { - case 51: /* ACMD51: SEND_SCR */ - switch (sd->state) { - case sd_transfer_state: - return sd_cmd_to_sendingdata(sd, req, 0, sd->scr, sizeof(sd->s= cr)); - - default: - break; - } - break; - case 18: /* Reserved for SD security applications */ case 25: case 26: @@ -2327,6 +2322,7 @@ static const SDProto sd_proto_spi =3D { [23] =3D {8, sd_spi, "SET_WR_BLK_ERASE_COUNT", sd_acmd_SET_WR_BLK= _ERASE_COUNT}, [41] =3D {8, sd_spi, "SEND_OP_COND", spi_cmd_SEND_OP_COND}, [42] =3D {8, sd_spi, "SET_CLR_CARD_DETECT", sd_acmd_SET_CLR_CARD_= DETECT}, + [51] =3D {8, sd_spi, "SEND_SCR", sd_acmd_SEND_SCR}, }, }; =20 @@ -2388,6 +2384,7 @@ static const SDProto sd_proto_sd =3D { [23] =3D {8, sd_ac, "SET_WR_BLK_ERASE_COUNT", sd_acmd_SET_WR_BL= K_ERASE_COUNT}, [41] =3D {8, sd_bcr, "SD_APP_OP_COND", sd_acmd_SD_APP_OP_COND}, [42] =3D {8, sd_ac, "SET_CLR_CARD_DETECT", sd_acmd_SET_CLR_CARD= _DETECT}, + [51] =3D {8, sd_adtc, "SEND_SCR", sd_acmd_SEND_SCR}, }, }; =20 --=20 2.41.0 From nobody Mon Nov 25 00:14:19 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1719550548; cv=none; d=zohomail.com; s=zohoarc; b=C5/NDsdjLH/W2CON4nvn9bmRf5NZnBg5067DK0UPbZZN0a9i1TXE3wFpjuBYo9vWl0V04aW/ouFJWNenKgbp8hmz1EfJ5oesdnY8ttmOdqJVu2msPgiWy/8GdIWxNwZj8AGoX8iCwH11Bt1Pq0UTtonfQU9+Y6JwPEgzgp1U28c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1719550548; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=l1JW4AJQQbgrb8lXxKMuM1qRbY1uuDZlLJblyEzxQh4=; b=O11eqLO5XeodLTvGkFb0S5sHL4YGYFpjEvX47J1fwafgRNLnUEwcrzGQDAn1HbNiLfVe6iOMJG8hB/5692H6YLoV/RR/X3UxEzIy0TezMoc32+eMrUk81pO3EGAOTEnDTkXKCJLIMfAJf2l7APbXceJI2jXqYz5aEAmhEB2g/uI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1719550548766578.9265877107946; Thu, 27 Jun 2024 21:55:48 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sN3dM-0000dE-5Z; Fri, 28 Jun 2024 00:54:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sN3cj-0008KN-T2 for qemu-devel@nongnu.org; Fri, 28 Jun 2024 00:54:15 -0400 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sN3ce-00011D-My for qemu-devel@nongnu.org; Fri, 28 Jun 2024 00:54:10 -0400 Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-42565cdf99cso2210035e9.3 for ; Thu, 27 Jun 2024 21:54:08 -0700 (PDT) Received: from m1x-phil.lan (cho94-h02-176-184-4-239.dsl.sta.abo.bbox.fr. [176.184.4.239]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4256af3c2afsm18117245e9.2.2024.06.27.21.54.04 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 27 Jun 2024 21:54:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1719550446; x=1720155246; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=l1JW4AJQQbgrb8lXxKMuM1qRbY1uuDZlLJblyEzxQh4=; b=aFESUId6sKGtJtgaXKIHOEJqEOToclK7vaP0a2vvvdDTQvVvh6tXvmlX0RMOpNnsha 8Zacrs2ZhUOC9D/m82JdSIp7OTmKvkn8AWIoScqatOUSw6Sk2F5uqaF8Ew3tgNYqRML6 Z86p43D3AvfAetapuAmM4LAV0On2w2tgYID7TSDwSqzlP2+4AjCd12p1ASzX5AmPon5G h5cFVFuuil5vvKghLdctZJhCXMiYtfCM9d7yonfoEL0IZbKnRKLQkOXWOs7oVR6KLO+A gyrifAbO/1PRg+hKPhl1ntzGUIIX6aEYlB5ow0x8VVnjtrRTLonZa1EfXwUxbtXgnnxU jqeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719550446; x=1720155246; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=l1JW4AJQQbgrb8lXxKMuM1qRbY1uuDZlLJblyEzxQh4=; b=canzC4hrhZLVsaTuPDvKeJgrGg0sGTYE9t+vqNO4XN65+FMPCQOWlMErHeD4UaAix4 mAeEXX2NIGlTq3+mz1khIdP4RrmqCCb9eHvYNEm3VC11IInA1aQj3Td3XI5aIAW8+Rk+ KvvTC0V9uk4DPYxZ7BNiLP24FEDDwLgDAs+So+YtSE0ELAUEBdCCO2L1fiLhwgrvWye7 AG5kNqt8Cu70JzjikRVrO2mWDkcUcKA9NTt5Zuif3Lm0Jlm2hPAJxCgBdZA0wsIjsLtY dinh7NoahcDXawlTE8bKHqqLEJsmFOsdOQJgxgdzaR2Asrt/7hICUzObzZZciDe4fF9p uraQ== X-Gm-Message-State: AOJu0YxSv0cW4a7+DJMF9jUwnB100LjQT1etXsTO6d6eyzNDviC4e9Di 79LdXIoKbDWRnBSnW4WtKx0BWqf/63v5FA0AacJq+z8dd5iO0VqzgHtakwGFv/m+6bx/HRWkdjX pBIl6ZQ== X-Google-Smtp-Source: AGHT+IEWhmOU/D81BdfjCCs1DKW3lz2N1esxm3YQTepoMqzfPFaTdNAaXFPuCLpaPaO4WPynixn0lQ== X-Received: by 2002:a05:600c:68cc:b0:425:5eec:bb84 with SMTP id 5b1f17b1804b1-4255eecc517mr62922505e9.36.1719550446815; Thu, 27 Jun 2024 21:54:06 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Luc Michel , Francisco Iglesias , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Sai Pavan Boddu , Joel Stanley , Bin Meng , qemu-block@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH 08/12] hw/sd/sdcard: Remove sd_none enum from sd_cmd_type_t Date: Fri, 28 Jun 2024 06:53:19 +0200 Message-ID: <20240628045323.86308-7-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240627164815.82606-1-philmd@linaro.org> References: <20240627164815.82606-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32c; envelope-from=philmd@linaro.org; helo=mail-wm1-x32c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1719550550429100013 All handlers using the 'sd_none' enum got converted, remove it. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- include/hw/sd/sd.h | 1 - hw/sd/sd.c | 7 +------ 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/include/hw/sd/sd.h b/include/hw/sd/sd.h index 29c76935a0..c1a35ab420 100644 --- a/include/hw/sd/sd.h +++ b/include/hw/sd/sd.h @@ -76,7 +76,6 @@ typedef enum { } sd_uhs_mode_t; =20 typedef enum { - sd_none =3D 0, sd_spi, sd_bc, /* broadcast -- no response */ sd_bcr, /* broadcast with response */ diff --git a/hw/sd/sd.c b/hw/sd/sd.c index 6a9d611429..7f93d363c7 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -526,17 +526,12 @@ static void sd_set_rca(SDState *sd, uint16_t value) static uint16_t sd_req_get_rca(SDState *s, SDRequest req) { switch (s->proto->cmd[req.cmd].type) { - case sd_none: - /* Called from legacy code not ported to SDProto array */ - assert(!s->proto->cmd[req.cmd].handler); - /* fall-through */ case sd_ac: case sd_adtc: return req.arg >> 16; case sd_spi: - g_assert_not_reached(); default: - return 0; + g_assert_not_reached(); } } =20 --=20 2.41.0 From nobody Mon Nov 25 00:14:20 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1719550500; cv=none; d=zohomail.com; s=zohoarc; b=U1Ee/XPvtkY/viyT4JUP1TcBw9t5mHfZhLvM82aaiAOO5+wi4x9k6cM2DBuuIFPMW+VHOhGPzMFsJb9FUizEUsY7/4XZ1TwIsdukq6lZWEFphTO8KArla1AV3fH8ba5ZU2BzhrBFe0AkSdBQ8f9fypVUZwislwI5Zt8veTL56cQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1719550500; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=KLGQaIGJKgcmO8Q0mlDn8rOb//ZdpOwWSY8cFandEdQ=; b=KrpQ/3Fl1ss30la7t0IBkHJTq9G1IIo8TDTF/6ySfqS+mZZAk+7pnB8+oZrk7HooqTUPDbbbCZ+qZbI4LozhvHFD+CfSsFslTr5f1jG72+T6UeIS4FHdfoVfoH6DLUkE6EXIJuFSUSpSAwGL325BXsqMJ+MXlf7+CfYMg17jBkg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1719550500296300.32701456467294; Thu, 27 Jun 2024 21:55:00 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sN3dJ-0000NZ-8q; Fri, 28 Jun 2024 00:54:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sN3cz-0008TU-Ge for qemu-devel@nongnu.org; Fri, 28 Jun 2024 00:54:30 -0400 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sN3cn-00012A-Hu for qemu-devel@nongnu.org; Fri, 28 Jun 2024 00:54:24 -0400 Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-42562a984d3so1762645e9.3 for ; Thu, 27 Jun 2024 21:54:15 -0700 (PDT) Received: from m1x-phil.lan (cho94-h02-176-184-4-239.dsl.sta.abo.bbox.fr. [176.184.4.239]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4256af5ba67sm17879975e9.19.2024.06.27.21.54.11 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 27 Jun 2024 21:54:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1719550454; x=1720155254; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=KLGQaIGJKgcmO8Q0mlDn8rOb//ZdpOwWSY8cFandEdQ=; b=Y3CaqbJeXpnIB3ilJxyv90CVkxVjqwYgcy5Rh90JkMcU0zpHXvWu9vplkFrvsyaSHU KoxJ8Nt0dIGpWryr+KgQWkM/TXKBD1NfC8VdCzMziJ4ZRTsDcR7/pe07n0OCYJENPdON JIrfBg7fOivjDXmylZ7JSlsHNBDhVBmYez14zDn4U6e1NXJo1bzfqsLWrLRpKvyMdDnP z/JLqiBrWW/kpI9QZq1MragMWxh7fb+uu37W+6iyKt8cWOghHYXRi7vCpv9fZFtdQCe4 YItczNC/zpMUL2iCJTMM56N4viiKniB58ked3dOrSZhbS1cqLSMxkKjVzLphJ5cEaodQ KvAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719550454; x=1720155254; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=KLGQaIGJKgcmO8Q0mlDn8rOb//ZdpOwWSY8cFandEdQ=; b=mQm1j2y6xJ41h9lZanpQ4ZKV/zgVQhS8p8N2jOtTdIVkfGZyKPYnkZ52L5kBbjsXxz DWieY2RDFgi0X0rjlegn9FbnTCsUevt3IkQGGBMfuExxxZAT4P5PXQplREXykEiTr1Ig 2sZVayIM4UB14ZqPlvjtpHQt9ypGa3nLYlSWpUmcJi6Gwb+mcAlgUiuget02Rxpg7El2 XDEHx04X4OckCE9L8XMiU4zbinI5cPtluP0pcZuIuwJSqnURDYY0/llh7uBqfr02ocqm pEFfJbLFIi362qkwMIIWs2DC3kxIaSfGHBoycxhVhxcjaZk//y9YquHrwgEEu8KcxPBf vSVA== X-Gm-Message-State: AOJu0YxjxnjqkW4rTg66ZjS723EUJEcMSZGT4Mf7Mhcr/pWYDv16q9Qm zhvq3oaO2YYC6zmflInhLC5L/0wYdbn/5PLhu2ZWKcU7od17AoElbT3d0TXZvC4CyYMuxFapsEa mRf01Gg== X-Google-Smtp-Source: AGHT+IEzs4V1l7GJ0ciXSMktqi9UN+/b0nixvcq6WFqPsklpgTETUzMjmjeH/by1vNmbqk+DnsR+Vw== X-Received: by 2002:a05:600c:929:b0:425:65c5:79b4 with SMTP id 5b1f17b1804b1-42565c57b9amr26202885e9.26.1719550454028; Thu, 27 Jun 2024 21:54:14 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Luc Michel , Francisco Iglesias , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Sai Pavan Boddu , Joel Stanley , Bin Meng , qemu-block@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH 09/12] hw/sd/sdcard: Remove noise from sd_acmd_name() Date: Fri, 28 Jun 2024 06:53:20 +0200 Message-ID: <20240628045323.86308-8-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240627164815.82606-1-philmd@linaro.org> References: <20240627164815.82606-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::336; envelope-from=philmd@linaro.org; helo=mail-wm1-x336.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1719550502391100009 These ACMD names weren't really useful, "UNKNOWN_ACMD" is simpler. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/sd/sd.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/hw/sd/sd.c b/hw/sd/sd.c index 7f93d363c7..19322c558f 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -259,23 +259,13 @@ static const char *sd_cmd_name(SDState *sd, uint8_t c= md) =20 static const char *sd_acmd_name(SDState *sd, uint8_t cmd) { - static const char *acmd_abbrev[SDMMC_CMD_MAX] =3D { - [14] =3D "DPS_spec", [15] =3D "DPS_spec", - [16] =3D "DPS_spec", - [18] =3D "SECU_spec", - [52] =3D "SECU_spec", [53] =3D "SECU_spec", - [54] =3D "SECU_spec", - [56] =3D "SECU_spec", [57] =3D "SECU_spec", - [58] =3D "SECU_spec", [59] =3D "SECU_spec", - }; const SDProto *sdp =3D sd->proto; =20 if (sdp->acmd[cmd].handler) { - assert(!acmd_abbrev[cmd]); return sdp->acmd[cmd].name; } =20 - return acmd_abbrev[cmd] ? acmd_abbrev[cmd] : "UNKNOWN_ACMD"; + return "UNKNOWN_ACMD"; } =20 static uint8_t sd_get_dat_lines(SDState *sd) --=20 2.41.0 From nobody Mon Nov 25 00:14:20 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1719550548; cv=none; d=zohomail.com; s=zohoarc; b=XgpRfvFEqPIVPsTqE/DFLvUn9L79hXgXWEL4w2TR7RKCQIkkgfWFjqe6WwPdd8/+vVioOrFESp8htWLxcN/ThUcthCWNm+H6VERbWQ/0JeOvmxpzFiXRJAse7E38CHtDxBNRBaNLqdrc+/MZjy9cKamUT7MflDyPZp38Bw+Qo0w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1719550548; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Qw+zxMHTEIwsFcpzBJxdUQmKFi6OrynqizbQoSQ84sA=; b=nj7jT8VYOjeczVvp4g1vapSNfAh44xtObtqXA3DH+Bw8ObVzvJ5My8mO4CSO06ft7EGPXwAEuDmEDQNjfZP2VHVIF0k3Eq/+Zc25kzD7DBgjGFBDUxN+JxQBjXTBlt7SPXF4DitARLdyF2bS/A13sScEe2J7X7LGgnJJPn6Pwxw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1719550548007749.5406011597952; Thu, 27 Jun 2024 21:55:48 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sN3dO-0000yk-L6; Fri, 28 Jun 2024 00:54:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sN3d2-0008V6-AG for qemu-devel@nongnu.org; Fri, 28 Jun 2024 00:54:33 -0400 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sN3cz-000135-1s for qemu-devel@nongnu.org; Fri, 28 Jun 2024 00:54:30 -0400 Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-4256aee6d4fso1582405e9.3 for ; Thu, 27 Jun 2024 21:54:22 -0700 (PDT) Received: from m1x-phil.lan (cho94-h02-176-184-4-239.dsl.sta.abo.bbox.fr. [176.184.4.239]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4256af3cff9sm18049765e9.3.2024.06.27.21.54.18 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 27 Jun 2024 21:54:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1719550460; x=1720155260; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Qw+zxMHTEIwsFcpzBJxdUQmKFi6OrynqizbQoSQ84sA=; b=dTrd7ZsAyUIBRbfatnGcOSRC9nE7bleqU04iGxbyKLHjmtiAwQhXiCvVeOKicrUMX8 tmHkV2sXBkOsPqeRyB6q0SKFrNX2g67UTa3B0eCdBxfpeD5txWDE+frLny1AUrzMmP3W L8OsGsYqTrlLvruASYL5Ff7nVbhysE4v7/5zY3jo70avy5tiOvjFDztG9J+gUppuoM38 6dIb75a1ScWUGauu4hGB166GROZeROel688NCcWc3QcpmNTLh7ZOs17B8QeVZ9+OxraB /ATQ5ZEMq3ZWiN2hCuigt3OE/BbRyO0qzaIRyc3FBVNwefmn1O5hHTTj1OPDMdoJT3PM SMuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719550460; x=1720155260; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Qw+zxMHTEIwsFcpzBJxdUQmKFi6OrynqizbQoSQ84sA=; b=X4vi35ld1HuYhTw4aO5Z+EqluYLCl2HAwc27onX1YRNnwWnwajqppPeaEsC3pGkrvY uW7kMSATs/CmOmKgjdzE/WTX4z1Ew7CYYa87UEVQNFVWh6dRY5IJ8FWS/RHh+QvR/obj pHSC2r4igUWz39ROhe0tadYoksAkrWrOkAzSII1LGe8NbSulT+YT80WKUmo2fH0hMgSg fa6fOWE/ixrwnr9YeKX7iugF7XF0E7lm7rraz/ciprPUPpQJY2W8/xDzdfDjZcBx7UOx kErl9HLk5t5TuWFLg3To5VMS779DYaCY9q9KnR1xrT2eUOXOMwcLwkD7eDlkfpZtFfhB 8AXg== X-Gm-Message-State: AOJu0YwPFmr48eDiBw8cQVyFLaNcl5ijmNlH+P7UTquNtycUbjQQko7t FbhTwSlFyHPLtz5doiOi0SJjLxEEfbOCxEELRj7cUDPNahIet98Eyv5M4TITasi/81EUa2JAV16 MUBjYxA== X-Google-Smtp-Source: AGHT+IHPrW9G/FKMivbec7Oc3hjDbhQmupvP7KoNCLYPEIM+BcEnWTpPDR6qBOEhBIwZcgG+Tdk4mA== X-Received: by 2002:a05:600c:511b:b0:425:6510:d8ec with SMTP id 5b1f17b1804b1-4256510de8fmr25303495e9.23.1719550460708; Thu, 27 Jun 2024 21:54:20 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Luc Michel , Francisco Iglesias , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Sai Pavan Boddu , Joel Stanley , Bin Meng , qemu-block@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH 10/12] hw/sd/sdcard: Remove noise from sd_cmd_name() Date: Fri, 28 Jun 2024 06:53:21 +0200 Message-ID: <20240628045323.86308-9-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240627164815.82606-1-philmd@linaro.org> References: <20240627164815.82606-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32b; envelope-from=philmd@linaro.org; helo=mail-wm1-x32b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1719550548424100009 These CMD names weren't really useful, "UNKNOWN_CMD" is simpler. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/sd/sd.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/hw/sd/sd.c b/hw/sd/sd.c index 19322c558f..0a7b422b2c 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -241,12 +241,7 @@ static const char *sd_cmd_name(SDState *sd, uint8_t cm= d) { static const char *cmd_abbrev[SDMMC_CMD_MAX] =3D { [18] =3D "READ_MULTIPLE_BLOCK", - [21] =3D "DPS_spec", [25] =3D "WRITE_MULTIPLE_BL= OCK", - [26] =3D "MANUF_RSVD", - [40] =3D "DPS_spec", - [60] =3D "MANUF_RSVD", [61] =3D "MANUF_RSVD", - [62] =3D "MANUF_RSVD", [63] =3D "MANUF_RSVD", }; const SDProto *sdp =3D sd->proto; =20 --=20 2.41.0 From nobody Mon Nov 25 00:14:20 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1719550545; cv=none; d=zohomail.com; s=zohoarc; b=Nnp64rsbWAtMQPj08Hr7ym623lxahTSjbVpAMFlBRnhI3QkI2GPXyy2+HA8EaKZCFsqwSMrd61hT7clCwVVSHwxeNLhtlgE79YoYGR0WwM1i8fDHszSvlHFXQNUtyiXe/6RqFK/jgrKur2V3+YzKgtw35OxZh3SELkkOlYuCm40= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1719550545; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=t05HoVB9l7/y3jswyRpww8YiOUTnZmazAh4RttVAsxI=; b=Js4JaevWKtsFD0ewL7JW1ltb4IJN3bHIYWU2n0BXuzUJg1byxcSnDztctXw/5qhlkqUVk4wEXv3msmLdg25zUacQEMUOT3uDQA8arblcc2fzS5y8+CdoRNhbN5GS0OnekF8uh2PFkZJBLPbT+yIBsFFhI1WiSJ/kMCX+cn8XPgQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1719550545584247.15401365547314; Thu, 27 Jun 2024 21:55:45 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sN3dM-0000bw-2i; Fri, 28 Jun 2024 00:54:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sN3d3-0008WB-QE for qemu-devel@nongnu.org; Fri, 28 Jun 2024 00:54:33 -0400 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sN3cz-00013i-AV for qemu-devel@nongnu.org; Fri, 28 Jun 2024 00:54:31 -0400 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-42562e4b5d1so1751335e9.1 for ; Thu, 27 Jun 2024 21:54:28 -0700 (PDT) Received: from m1x-phil.lan (cho94-h02-176-184-4-239.dsl.sta.abo.bbox.fr. [176.184.4.239]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4256af5a3b0sm17938285e9.13.2024.06.27.21.54.25 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 27 Jun 2024 21:54:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1719550467; x=1720155267; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=t05HoVB9l7/y3jswyRpww8YiOUTnZmazAh4RttVAsxI=; b=XSCbUt99pRUHV2PB23piMtX6CxmHJAARni9MDY3d1X7vkcd/e0LBjV7SoQyhicXGG0 DxJ6atxvemE7EBMTng36R70nQIf21DMRgLFxgtvywqEx1jJhP/gzXNwI3qujKLDruOEE 5/oGoqgVH6bgy2lkmb+/JzaNXfLtn7LymNR2MAj6uzvkgFSeJ8jXujsHiqUvok14zykX bk5F8j1AWT7jrzgQeKe6RxdH6iy/Sz2PefPI4TKOCXywwmba85VeU04qbxAgGIWfwDgF uI8IB619Yoluu3i2cNnsDTSHyfJ5loq6CRB4wUthCaeYAoOxD+DYU9/xMCGBQT1qY4TU arRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719550467; x=1720155267; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=t05HoVB9l7/y3jswyRpww8YiOUTnZmazAh4RttVAsxI=; b=lJcBOiWG0cwML7aJ32hiHEzg9t4k/CwM5Kq5kgyRgnLkcroctZneQHe4MTmr26TSUV r/V7O19LxEyiUwtOMJj5XT3j8JrNlOc6tfZtPSp+0dV2Mam2OAwVys31WmX4TZHPyvwl RvUh46y0uLrsCF+pEvmYfZup2eQcq8WVnWat6LSTI0Kgkb4iajX0EmWC1wno1iRA6Dhf OOeSNduMZmE+kd8LYcHWQlAzmF1SM976uvPXpHWwrT1TkXpLWxQWBIUGx/mmVDBoC4jh /6OGxMLDx+mc7pggzhN6fep6IhwYsmB2uiNQcLbUFudmzP/iA0Wdu83Z4CMlqKJ49+o/ Kr7w== X-Gm-Message-State: AOJu0YwuwBUJI76wZ6unXaiizeX6cMNR4aG9+QDYXHQXStkYrqq0HE72 +fCyjpgQTxLTGFRTcIYSukVO4eCSr8Lo7L/FNsiNjkU03aHDYoTiXeQgp6PrUsHQqqg79E8gWNZ +IdQzpQ== X-Google-Smtp-Source: AGHT+IFFZV82gn2R5E+XeFgXRHfMeLpy8h1fvx7x9HN/YzKD/iJl6QsSsTULJJ4ZEgFCXpz9tWWqRg== X-Received: by 2002:a05:600c:138e:b0:424:7bcf:2486 with SMTP id 5b1f17b1804b1-42489e3708fmr106929975e9.4.1719550467159; Thu, 27 Jun 2024 21:54:27 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Luc Michel , Francisco Iglesias , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Sai Pavan Boddu , Joel Stanley , Bin Meng , qemu-block@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH 11/12] hw/sd/sdcard: Remove default case in read/write on DAT lines Date: Fri, 28 Jun 2024 06:53:22 +0200 Message-ID: <20240628045323.86308-10-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240627164815.82606-1-philmd@linaro.org> References: <20240627164815.82606-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::332; envelope-from=philmd@linaro.org; helo=mail-wm1-x332.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1719550546402100001 All read/write on DAT lines are explicitly handled. Reaching this point would be a programming error: replace by an assertion. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/sd/sd.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/hw/sd/sd.c b/hw/sd/sd.c index 0a7b422b2c..64621d4340 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -1951,7 +1951,6 @@ int sd_do_command(SDState *sd, SDRequest *req, /* Valid command, we can update the 'state before command' bits. * (Do this now so they appear in r1 responses.) */ - sd->current_cmd =3D req->cmd; sd->card_status =3D FIELD_DP32(sd->card_status, CSR, CURRENT_STATE, last_state); } @@ -2016,6 +2015,8 @@ send_response: qemu_hexdump(stderr, "Response", response, rsplen); #endif =20 + sd->current_cmd =3D rtype =3D=3D sd_illegal ? 0 : req->cmd; + return rsplen; } =20 @@ -2171,8 +2172,7 @@ void sd_write_byte(SDState *sd, uint8_t value) break; =20 default: - qemu_log_mask(LOG_GUEST_ERROR, "%s: unknown command\n", __func__); - break; + g_assert_not_reached(); } } =20 @@ -2238,8 +2238,7 @@ uint8_t sd_read_byte(SDState *sd) break; =20 default: - qemu_log_mask(LOG_GUEST_ERROR, "%s: unknown command\n", __func__); - return 0x00; + g_assert_not_reached(); } =20 return ret; --=20 2.41.0 From nobody Mon Nov 25 00:14:20 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1719550545; cv=none; d=zohomail.com; s=zohoarc; b=EU8V4lPMil+7FFa5dClzDjuxNYE7k89uMgkfzK/RHydW3fefzwVIS43L8M6lz3Fa8aYfHWNHMlIfGKVT9p18fzlHRsBs/h1BbhwYmpa8R4fvWrCWR4RxOmeytC3FT49LDJC6jKmmVWIXkyfVL9CHayRNyjZj0XdwbHOhrFPcwk4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1719550545; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=G214GiZ6GoHQbuSVeY1gM0sNgUJBhdD0Klfne+Cmhik=; b=eSgUJxup2k0EXcxH/KLEWsIbyI92x02JnwGr7RExQTbgrYVJZWVHUJzTyAXQ8TJHTDb4WCJ7mOQBi578HmA/7pak+tC3od56JGI+R46ft+8lOmSw/vzxnLG47q7BBxnkyPw5lwBiEmnPNmv7U2fv4GOJllQT9BvjgETI6LhWFy0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1719550545367509.1723896216786; Thu, 27 Jun 2024 21:55:45 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sN3dN-0000ki-5z; Fri, 28 Jun 2024 00:54:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sN3dF-0000Lg-F1 for qemu-devel@nongnu.org; Fri, 28 Jun 2024 00:54:46 -0400 Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sN3d7-00016e-14 for qemu-devel@nongnu.org; Fri, 28 Jun 2024 00:54:39 -0400 Received: by mail-wr1-x42e.google.com with SMTP id ffacd0b85a97d-362bc731810so153381f8f.1 for ; Thu, 27 Jun 2024 21:54:35 -0700 (PDT) Received: from m1x-phil.lan (cho94-h02-176-184-4-239.dsl.sta.abo.bbox.fr. [176.184.4.239]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3675a0ce6c9sm1077729f8f.22.2024.06.27.21.54.32 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 27 Jun 2024 21:54:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1719550474; x=1720155274; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=G214GiZ6GoHQbuSVeY1gM0sNgUJBhdD0Klfne+Cmhik=; b=RnU/JVJeMCLHmjCZE4W6ZnLLOqT4Dq9HEqJ8Oym3k87zOF+JF50Djm82F2DP8WTCjJ NyBfoICtIbf6LYAwKSNFDUahlhhMu4glmj2s+XjL7VHXGSMoEmMUbHdniUd3eEeIVmqC eLMgr8JxGw3GunIYUdGpdK4G/D0Oeuy08dNdNVueyEn3kPPKylf8kGU7xWz/zzZmAk6b a9uoIAVm0ztcBeTTMBBT/RTWpNIIKXZ+Pji9mAs52O6w4FzimyFzIpHcZdFmimyu2lm3 jcUHGEu1sm259k7jyATJhUUg/s0XykLQgL47Crl67YXhmgbzvr24QqJvLLrScuhUf12S ZRog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719550474; x=1720155274; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=G214GiZ6GoHQbuSVeY1gM0sNgUJBhdD0Klfne+Cmhik=; b=MSIMkAK9Hvl0tDcFWOyGy2/XLRhopVrZyXJHgGCAIeE6np7NwX238t/WfydJKsCZff ctdQRhUHM0NplWCOH3TWFVVPHuDy7Zgmjm10EXK5AmEpOS1x5Xr9Kn7fZ6NAdU00xTg8 +7bWCwL4TW3iWOLLJv5qdnt2Ud/O6asmQnPCc1ZenxnGkAgaLCMTfMOr22bz4jOZkQsw opAioRKQ71E794U5Wv3/RPI84yHumdjvbV5LtdgaMDU8ajLZ9TkhM5IVuylZ8H/lcByz B1IfNEArNA7nTIOixjgZYZUbWPvhfA8YKaBttbwR3rrr1RLrvuH2YwyR6ylQAZo7VSvX TxOA== X-Gm-Message-State: AOJu0Yxs1ezdpj8Gadwxy680uFEyvlVYfJ/Fx7EoMHtoAN9DjRlINc2J rqItny/tb4yZQvE+LWvfQgKfOif72BySedK1IMM7+QuN6L2tMRulV3zRmBu2glTgkn2NkBybUve P/LuoAA== X-Google-Smtp-Source: AGHT+IHYkBpse5piUiPKertkIwuXZHCuOiVZeo8C1GO8glaK8B15ageFzCHi+Jilc+35UZ4eZi0y5w== X-Received: by 2002:a5d:4b87:0:b0:366:f04d:676f with SMTP id ffacd0b85a97d-366f04d68f9mr11382349f8f.12.1719550473957; Thu, 27 Jun 2024 21:54:33 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Luc Michel , Francisco Iglesias , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Sai Pavan Boddu , Joel Stanley , Bin Meng , qemu-block@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH 12/12] hw/sd/sdcard: Trace length of data read on DAT lines Date: Fri, 28 Jun 2024 06:53:23 +0200 Message-ID: <20240628045323.86308-11-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240627164815.82606-1-philmd@linaro.org> References: <20240627164815.82606-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::42e; envelope-from=philmd@linaro.org; helo=mail-wr1-x42e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1719550546409100002 Some commands expect less than BLOCK_LENGTH. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/sd/sd.c | 4 ++-- hw/sd/trace-events | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/sd/sd.c b/hw/sd/sd.c index 64621d4340..a0da06e017 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -2197,8 +2197,8 @@ uint8_t sd_read_byte(SDState *sd) io_len =3D sd_blk_len(sd); =20 trace_sdcard_read_data(sd->proto->name, - sd->last_cmd_name, - sd->current_cmd, sd->data_offset, io_len); + sd->last_cmd_name, sd->current_cmd, + sd->data_offset, sd->data_size, io_len); switch (sd->current_cmd) { case 6: /* CMD6: SWITCH_FUNCTION */ case 9: /* CMD9: SEND_CSD */ diff --git a/hw/sd/trace-events b/hw/sd/trace-events index 6a51b0e906..5dfe6be7b7 100644 --- a/hw/sd/trace-events +++ b/hw/sd/trace-events @@ -55,7 +55,7 @@ sdcard_req_addr(uint32_t req_arg, uint64_t addr) "req 0x%= " PRIx32 " addr 0x%" PR 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 *proto, const char *cmd_desc, uint8_t cmd, ui= nt32_t offset, uint8_t value) "%s %20s/ CMD%02d ofs %"PRIu32" value 0x%02x" -sdcard_read_data(const char *proto, const char *cmd_desc, uint8_t cmd, uin= t32_t offset, uint32_t length) "%s %20s/ CMD%02d ofs %"PRIu32" len %" PRIu32 +sdcard_read_data(const char *proto, const char *cmd_desc, uint8_t cmd, uin= t32_t offset, uint64_t size, uint32_t blklen) "%s %20s/ CMD%02d ofs %"PRIu3= 2" size %"PRIu64" blklen %" PRIu32 sdcard_set_voltage(uint16_t millivolts) "%u mV" =20 # pxa2xx_mmci.c --=20 2.41.0