From patchwork Thu Jun 27 16:48:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 807880 Delivered-To: patch@linaro.org Received: by 2002:adf:e842:0:b0:362:4979:7f74 with SMTP id d2csp901314wrn; Thu, 27 Jun 2024 09:50:26 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVK2K8EB3Dtk2YS8gdZ3HEw4d5DIrAFSPmt2nQ3Qm3Bv3g4hDYCeITqjkYFICsKCiMAuXAV+6jRV73bCCJj2Hph X-Google-Smtp-Source: AGHT+IEosctL9SJfw0uTFEvytnFyECUMtWZAVdBQYoZQFbia9wff5IAzPuy0n6RKEfSUgSs1T9ta X-Received: by 2002:a05:6214:518c:b0:6b5:49c9:ed4f with SMTP id 6a1803df08f44-6b549c9ef73mr189406886d6.34.1719507026789; Thu, 27 Jun 2024 09:50:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1719507026; cv=none; d=google.com; s=arc-20160816; b=D3+y8fotJ72fV9nSey395XOH5wPLgIN0D3ks+VlYSt52xn4p4hRdqhBZQQTNs1j8l9 Qbu4ji+I8hrbKsSK2VaADDDsPv1P5ghHSlNprD5/1WgmNw63zrxaTDSB78i/CEEzUL5x 8mQF3arXn61BaI1QEYypn4ONBRkcXuduGl7bv870rfhIBRkoxfP2JpdvPCKMLrEF10Dn VCm0JxJbOeuZWhe5kpHxY4OefrNzUdBvbtaB7h3X7Ktz17GVXPINQz+00/Q3Ara6AEVZ jdSi4d0Q18f55BWUGjfrHj99mtNq18hfuo8RZKvCUhyS1UBVWlEorwAZrnnax0B1aFGm CH0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=1Ij5pjsDB8qqEoSZ8JFKxxVUAdb9cjcc9vXzXqWT+4A=; fh=V4NeP5EGwZI2cEWTm44CEZUrO7PEICad1nYA6B1zf0E=; b=z4f6o9B/10XUNFC5onesk1VYde6viQknJaZdzc4cKB1uwG1MIfcHk1iJoOZEmER+bq 8APWn7Afu2VfIEIIot5Q2l4yvSJRUmiCxeJEJKrc4w+ykJGICuJ0ebxIAe4Q+KxTeEbt +etceYgNRelqAI5haT2ViNMfXD0f3xMVWzZjnMd+93JLTXh+WHdugD4nXutae0D/7hIo BOglQrvWD6X9qb5zTlKOmHUljdLsDMqFx2p85jNGLhTEBZsR7+kDQzY+urbBpZ4L3eX1 1LwkP+N5zi2q+R0Wn0CeRdNYMzPpPAGEyjv3423H/c51p1+iQBDm3mVlA8CMhdNegnzf D1vg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=e57gx9Oo; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6b59e5f26fasi310966d6.426.2024.06.27.09.50.26 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 27 Jun 2024 09:50:26 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=e57gx9Oo; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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) 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-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) 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) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Luc Michel , Bin Meng , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , qemu-block@nongnu.org, Francisco Iglesias , =?utf-8?q?C=C3=A9dric_Le_Goater?= , 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Signed-off-by: Philippe Mathieu-Daudé --- 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] = { - [6] = "SET_BUS_WIDTH", [13] = "SD_STATUS", [14] = "DPS_spec", [15] = "DPS_spec", [16] = "DPS_spec", @@ -1672,6 +1671,18 @@ static sd_rsp_type_t spi_cmd_CRC_ON_OFF(SDState *sd, SDRequest req) return sd_r1; } +/* ACMD6 */ +static sd_rsp_type_t sd_acmd_SET_BUS_WIDTH(SDState *sd, SDRequest req) +{ + if (sd->state != sd_transfer_state) { + return sd_invalid_state_for_cmd(sd, req); + } + + sd->sd_status[0] &= 0x3f; + sd->sd_status[0] |= (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, } switch (req.cmd) { - case 6: /* ACMD6: SET_BUS_WIDTH */ - switch (sd->state) { - case sd_transfer_state: - sd->sd_status[0] &= 0x3f; - sd->sd_status[0] |= (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 = { [58] = {11, sd_adtc, "READ_EXTR_MULTI", sd_cmd_optional}, [59] = {11, sd_adtc, "WRITE_EXTR_MULTI", sd_cmd_optional}, }, + .acmd = { + [6] = {8, sd_ac, "SET_BUS_WIDTH", sd_acmd_SET_BUS_WIDTH}, + }, }; static void sd_instance_init(Object *obj) From patchwork Fri Jun 28 04:53:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 808123 Delivered-To: patch@linaro.org Received: by 2002:adf:fe0a:0:b0:362:4979:7f74 with SMTP id n10csp187708wrr; Thu, 27 Jun 2024 21:55:00 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVq7D1l7NEkcwXSLS0+MQCH7/YwLg/vVIvQUu+IxleKwmznuuyJaADdlMdiGrn88uNflzO+fS74m9lYPzJIdWYd X-Google-Smtp-Source: AGHT+IGOUNryZ5VJ8v4AbdCS5Jxs3SHcGYIXmpkYkAYS1VZ0o9tN5bNmzN8vUWLsndkkw23OEPdT X-Received: by 2002:a05:620a:4493:b0:795:5a78:6fc7 with SMTP id af79cd13be357-79be0c64f17mr1875518085a.42.1719550500231; Thu, 27 Jun 2024 21:55:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1719550500; cv=none; d=google.com; s=arc-20160816; b=TRs26TEqYohheFHtadNpw3viBrofKRCHByzsBzs5/mXjVyYLrr+tU/GZ4qFASm24vX P0ZCefcwe71yiMZIgYSkf0ndBCFDYLTz/fLkN0erPxyGN50DIUcKAezyhMPvgp8NHfZj 7WIZhDpZidds/BQ/iD31hi8Qt+2c19f+k3f8U+hoxIoYxeAJ+HiBrahUvuQK0eG3cQ+e v7zfZIAWVlEd4Klnj9wp4lj3lyYCBEmKCUtBeF2bZjclfBc1Ie+Hf/w50jvmXIDVE/m7 utldrZ94CdABZ2clJFRjJ8LYxopO6iNZCOkaJa3oZuFVqRNcvBTafj4iWajWX50U7JH7 RcDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=9vrkGwBcqZVZMukUtGlLs/nHFLle6eNwrj7janh4+hs=; fh=mJ33vrhGd/NTdd5lBDp0lE29qLMBB1Ua1MFYaTj7EB4=; b=SgZ7cpkmaX1sgMwMz7F4grmbnPQ8L22QhL8ti6um7Cfv42AsupDY7W4DWYb4naMDvR 7s0PixhYnopjrY0JGP2V5UVWhJ/d0QnD/Bip/SzMvBjlTp2c50ZNOQxfK+h8Pmjnkj95 5JEF1jxbb858ELo0Vf6dUZxxjiE2DYRzX30UbWQ8wYISB94Th05kIZetcOgrzPs+m1iX P+W5JMBXWulkRiExQj4XdPEzPtGTZJQrh/joXt5lyV1cyJKotBcjl1OwcF/YKHPx7gCa lfM3TtrA0u/AsuHWDM54GidlNJ6HSjmtH1o3IcoMRC8CsRjX2WEwWGmiTKp55K0IRHRk 8h4A==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=nIiDPMkH; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-79d69339d4fsi102177385a.568.2024.06.27.21.55.00 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 27 Jun 2024 21:55:00 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=nIiDPMkH; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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) 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-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) 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) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Luc Michel , Francisco Iglesias , =?utf-8?q?C=C3=A9dric_Le_G?= =?utf-8?q?oater?= , Sai Pavan Boddu , Joel Stanley , Bin Meng , qemu-block@nongnu.org, =?utf-8?q?Philippe_Mathieu-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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Signed-off-by: Philippe Mathieu-Daudé --- 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] = { - [13] = "SD_STATUS", [14] = "DPS_spec", [15] = "DPS_spec", [16] = "DPS_spec", [18] = "SECU_spec", @@ -1683,6 +1682,13 @@ static sd_rsp_type_t sd_acmd_SET_BUS_WIDTH(SDState *sd, SDRequest req) return sd_r1; } +/* 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, } 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 = { [59] = {0, sd_spi, "CRC_ON_OFF", spi_cmd_CRC_ON_OFF}, }, .acmd = { + [13] = {8, sd_spi, "SD_STATUS", sd_acmd_SD_STATUS}, [41] = {8, sd_spi, "SEND_OP_COND", spi_cmd_SEND_OP_COND}, }, }; @@ -2386,6 +2381,7 @@ static const SDProto sd_proto_sd = { }, .acmd = { [6] = {8, sd_ac, "SET_BUS_WIDTH", sd_acmd_SET_BUS_WIDTH}, + [13] = {8, sd_adtc, "SD_STATUS", sd_acmd_SD_STATUS}, }, }; From patchwork Fri Jun 28 04:53:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 808129 Delivered-To: patch@linaro.org Received: by 2002:adf:fe0a:0:b0:362:4979:7f74 with SMTP id n10csp187799wrr; Thu, 27 Jun 2024 21:55:22 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUriiGu99dPBRqClg7S6k60dcLeKg2rjpy+pVvD1d1L0roXc9DcaSw1gsUPotoF2NNcD2UfWoUIaY/jrZuumenW X-Google-Smtp-Source: AGHT+IFRK4uKGVBBSTl3S3gxcECYEDhlEzGVK3qsZDQYEAKnugnDlcpFtjVcFKIk/Np8mUsJkot/ X-Received: by 2002:a05:6214:3012:b0:6b4:fea6:4df8 with SMTP id 6a1803df08f44-6b5a543d60emr10234596d6.19.1719550522092; Thu, 27 Jun 2024 21:55:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1719550522; cv=none; d=google.com; s=arc-20160816; b=kj0jeqzBttDgrfv0fXuoUFMNFtETkt3I4UhROLjRh71axD27p26OUvEpR/H2ZChRrz DHe9ypT4ZbpGnf2iaKHAYc4pZ/4W0NWbIM71DCus80brx2a819OXzAPJzdwF6CPPgS/u t2Pam4NBReS16MPYU1LOZ8SFRsNVyOJr+fLzIGXkO2opX41FwPip3SRbKWigdI0unGZD dHIxQ2BaIgd2zytUFDoZoruCIWfP3SqBLbgdvk2YQXDtqEQgvMaEHOGPLA5Qq1DDWGum Vdpjk+QmKgspI1fTN7eeYwb4Grgw3UA91k80YgpbSkKfjI8YHaXrimFYWyDjm/PLTJKO NrCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=JLfOaKjryvDgm8/tAb2iA3e2u5r9x8cBXXCm9JQWcag=; fh=mJ33vrhGd/NTdd5lBDp0lE29qLMBB1Ua1MFYaTj7EB4=; b=mtt7IPrP5NTcAbcWbshDkRtY6ksfXzIbR0hXQdgbWfEKLqfJUIQwZ600LZ5V7gTcUr 2ttPvHKTx3+CKpdnjqYmJV9sVy5rSYQ/YiUGuM8YTnfRfig1QAa2FqDopKlS8cUxCH5B rypZFDtHb7hscmcGb+e35x3zFed9ged2fKZszrWmlxGJ/pWXSvvOForcNDO7gIJXDnet S81lk0R62EWO4B15ZXYwB8K7SBcvuQv2ZX7TtqlMegDgTGxydqrGN4vPmw+6NwxLBcyW iSukABGYA3gaifbLfEYw92OzmAHZNpufrZD1OBmqMD3U5LA6QtNiDZd03F9WWOzr3r8M /v+A==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MGniMHVb; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6b59e5acb30si12275576d6.307.2024.06.27.21.55.21 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 27 Jun 2024 21:55:22 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MGniMHVb; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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) 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-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) 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) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Luc Michel , Francisco Iglesias , =?utf-8?q?C=C3=A9dric_Le_G?= =?utf-8?q?oater?= , Sai Pavan Boddu , Joel Stanley , Bin Meng , qemu-block@nongnu.org, =?utf-8?q?Philippe_Mathieu-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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Signed-off-by: Philippe Mathieu-Daudé --- 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 cmd) [14] = "DPS_spec", [15] = "DPS_spec", [16] = "DPS_spec", [18] = "SECU_spec", - [22] = "SEND_NUM_WR_BLOCKS", [23] = "SET_WR_BLK_ERASE_COUNT", + [23] = "SET_WR_BLK_ERASE_COUNT", [42] = "SET_CLR_CARD_DETECT", [51] = "SEND_SCR", [52] = "SECU_spec", [53] = "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)); } +/* 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, } 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 = { }, .acmd = { [13] = {8, sd_spi, "SD_STATUS", sd_acmd_SD_STATUS}, + [22] = {8, sd_spi, "SEND_NUM_WR_BLOCKS", sd_acmd_SEND_NUM_WR_BLOCKS}, [41] = {8, sd_spi, "SEND_OP_COND", spi_cmd_SEND_OP_COND}, }, }; @@ -2382,6 +2378,7 @@ static const SDProto sd_proto_sd = { .acmd = { [6] = {8, sd_ac, "SET_BUS_WIDTH", sd_acmd_SET_BUS_WIDTH}, [13] = {8, sd_adtc, "SD_STATUS", sd_acmd_SD_STATUS}, + [22] = {8, sd_adtc, "SEND_NUM_WR_BLOCKS", sd_acmd_SEND_NUM_WR_BLOCKS}, }, }; From patchwork Fri Jun 28 04:53:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 808125 Delivered-To: patch@linaro.org Received: by 2002:adf:fe0a:0:b0:362:4979:7f74 with SMTP id n10csp187709wrr; Thu, 27 Jun 2024 21:55:00 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUXWcccDum31qYYARddX42h/9o6hrfJBbEXcVcKGBe1UvYmJj7pMhQd6qPe7T/1Y0cJMbJToid87nldSguHNXnC X-Google-Smtp-Source: AGHT+IFkcOSkqyr/UQBBVjjdUzvLNJwOfsU9KMr6Gbtwe4GXu7yL6wEmdWn/VuJ8fN7FsVyZ5JMO X-Received: by 2002:a81:91cb:0:b0:64a:e2ab:be33 with SMTP id 00721157ae682-64ae2abcb89mr6983827b3.22.1719550500267; Thu, 27 Jun 2024 21:55:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1719550500; cv=none; d=google.com; s=arc-20160816; b=mpftNevILv2yXgezO9lt1MBj9NvNWRq3kgCE3yL009gJci2E57IOK+zVxSC50H8vZ6 vUEyPuAuWeMiJ+9WISVzLq2qusaW/hpdozM1TKFqhyuXmeVx9lfI8j+7WTbYYorc8pcc c8VPCMy1NCp0+zidnBuVnHcwtVcjnyesNcNVmtLX8/CqEgGLsl4PcfA7VL6NlYHIQb42 mxZN19e0cRUlR7SFvy4dJCc/iWYNVLYX9WXMqCV2seIe3epyanvXGCVtm8BqKct+1KV0 pTpVihw8wGC/tatQIrAlG5aCfEW6ndbZeH8r5BuogT1sdspAwBSVZPFLQCmLxPznTvpQ JrHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=if+k3pC7/tUCTUn2xmGg3zarIgu5LY5GHs2T467fbqI=; fh=mJ33vrhGd/NTdd5lBDp0lE29qLMBB1Ua1MFYaTj7EB4=; b=dr2b4ox0GSZfzdZLZeaAqIaVImgjYCVUZ8kriwKrqYltuwjXMX7Rdtf+eVZht+vvkO VuEMEAdAYP8qzIe9pqFmwMF2CXcPsyUXtXH8K1M9TA3WoGbNIIz5DwK/UXcZJaQFbRwT 0Vl2pqcu/K/aiRHXfgYKiLTxI6iagxqw7TdOlOHX24svRX2t6eDVEFEHzeGN4ErSv7YP 2lxk5Hp/DjfADoVklLWdvuvxIS4RK9/U/DeiUUS+M/8GFsfFHb+o2wO4xhDqUtA5iXBf 5H1kMFa8aRR17styy/Gf6wSSMmNJ8tFjzvXrwv5IVqND7f13LimJkbu7MPwNSq9gcBXM 3TnQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=rfxyJ8Wd; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-446514a59f0si11527971cf.492.2024.06.27.21.55.00 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 27 Jun 2024 21:55:00 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=rfxyJ8Wd; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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) 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-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) 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) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Luc Michel , Francisco Iglesias , =?utf-8?q?C=C3=A9dric_Le_G?= =?utf-8?q?oater?= , Sai Pavan Boddu , Joel Stanley , Bin Meng , qemu-block@nongnu.org, =?utf-8?q?Philippe_Mathieu-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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Signed-off-by: Philippe Mathieu-Daudé --- 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 cmd) [14] = "DPS_spec", [15] = "DPS_spec", [16] = "DPS_spec", [18] = "SECU_spec", - [23] = "SET_WR_BLK_ERASE_COUNT", [42] = "SET_CLR_CARD_DETECT", [51] = "SEND_SCR", [52] = "SECU_spec", [53] = "SECU_spec", @@ -1696,6 +1695,15 @@ static sd_rsp_type_t sd_acmd_SEND_NUM_WR_BLOCKS(SDState *sd, SDRequest req) &sd->blk_written, sizeof(sd->blk_written)); } +/* ACMD23 */ +static sd_rsp_type_t sd_acmd_SET_WR_BLK_ERASE_COUNT(SDState *sd, SDRequest req) +{ + if (sd->state != 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, } 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 != sd_idle_state) { break; @@ -2320,6 +2318,7 @@ static const SDProto sd_proto_spi = { .acmd = { [13] = {8, sd_spi, "SD_STATUS", sd_acmd_SD_STATUS}, [22] = {8, sd_spi, "SEND_NUM_WR_BLOCKS", sd_acmd_SEND_NUM_WR_BLOCKS}, + [23] = {8, sd_spi, "SET_WR_BLK_ERASE_COUNT", sd_acmd_SET_WR_BLK_ERASE_COUNT}, [41] = {8, sd_spi, "SEND_OP_COND", spi_cmd_SEND_OP_COND}, }, }; @@ -2379,6 +2378,7 @@ static const SDProto sd_proto_sd = { [6] = {8, sd_ac, "SET_BUS_WIDTH", sd_acmd_SET_BUS_WIDTH}, [13] = {8, sd_adtc, "SD_STATUS", sd_acmd_SD_STATUS}, [22] = {8, sd_adtc, "SEND_NUM_WR_BLOCKS", sd_acmd_SEND_NUM_WR_BLOCKS}, + [23] = {8, sd_ac, "SET_WR_BLK_ERASE_COUNT", sd_acmd_SET_WR_BLK_ERASE_COUNT}, }, }; From patchwork Fri Jun 28 04:53:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 808126 Delivered-To: patch@linaro.org Received: by 2002:adf:fe0a:0:b0:362:4979:7f74 with SMTP id n10csp187710wrr; Thu, 27 Jun 2024 21:55:00 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCU8Ci15TGbtb5SO7HsDnS/tFbhyIHxzPUr7gf28j/zAro7a+2TonfYaFXcvIYmK4PJSM0DsU/sDJI7Hqjj9QSih X-Google-Smtp-Source: AGHT+IGtbCm1rSX+Xll15zp1IDOuRWBqRkA1fODkdSX+wfP7ZnGZajvIRejLL16pusVqxCKTcrTZ X-Received: by 2002:a05:6122:1ad0:b0:4ef:6530:4ced with SMTP id 71dfb90a1353d-4ef6d7d0ad4mr14324578e0c.2.1719550500283; Thu, 27 Jun 2024 21:55:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1719550500; cv=none; d=google.com; s=arc-20160816; b=TdVqEhUNW+Pj8E3czraOcQSI7eboxxhH5zERpZ60YdiAJEh2AKs4NqbutLt8blgSVh 6/7uJ2PqDr1Ul/3jivDxl/RvKfctovwO7BxRLnNrSSnGCHrZ7Tzxj2FofqMHmORx00oE idg0kv52ig87gBnQ15cg7RQ1wWuCzADUyN1oQzwoAzlDkk0TNIZDrIo5MB1yadCMQH/M Q0ADEjLvawDVmNo9LEN1Y8DO+PXTC+y/LC1f5bhHY2qsIGRWliBZ3ENbZNGqf66ZLcwB u04aTQ77JDDLzI8TY0rOZwhXEKy2aUdTqxPh9x8/8HPeTyuxuHEhuy8wi+jpmVJ5SSjh gIeg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=bYEYJ2Wwx71dNKsAcy31SFsnrP/uSxrEAbuXlnudJVY=; fh=mJ33vrhGd/NTdd5lBDp0lE29qLMBB1Ua1MFYaTj7EB4=; b=X2R3k9TS3Gr1p7cSCXCcvbDF1p37+iGmRBaA2cOhDTSlrwlqf27vBVVd12pJDd5ljV y7KeF1yTqwMlpCxtE24v6JqpxncNUv/LoAcJ6dEyPd4uP95slxi+0Y1yNW9inIjntPAn 8mO4fqfB32nEP0WV79MUpiensqFANIr7am7y3HaYfJ9tCXtRHK0OcmRPc4Cxp3J49nRl YKf+sIY3nEDMFMomGCRzNcsrMX/4WZ3IN42BTWJKX/GdDjI7bmTpgp48dwuHnzkFW53c srY0kxX9ZU2sN48OkFmijpuuN6Iz2DZiNGwQ45T23lOdn7q/+MTQE5TU3bUNLj39c6Zy CFdQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NvKkGR4d; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-79d6934d378si102987885a.752.2024.06.27.21.55.00 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 27 Jun 2024 21:55:00 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NvKkGR4d; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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) 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-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) 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) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Luc Michel , Francisco Iglesias , =?utf-8?q?C=C3=A9dric_Le_G?= =?utf-8?q?oater?= , Sai Pavan Boddu , Joel Stanley , Bin Meng , qemu-block@nongnu.org, =?utf-8?q?Philippe_Mathieu-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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Signed-off-by: Philippe Mathieu-Daudé --- 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; } +/* ACMD41 */ +static sd_rsp_type_t sd_acmd_SD_APP_OP_COND(SDState *sd, SDRequest req) +{ + if (sd->state != 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) != 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 == 0). + */ + sd->state = 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, } switch (req.cmd) { - case 41: /* ACMD41: SD_APP_OP_COND */ - if (sd->state != 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) != 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 == 0). - */ - sd->state = 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 = { [13] = {8, sd_adtc, "SD_STATUS", sd_acmd_SD_STATUS}, [22] = {8, sd_adtc, "SEND_NUM_WR_BLOCKS", sd_acmd_SEND_NUM_WR_BLOCKS}, [23] = {8, sd_ac, "SET_WR_BLK_ERASE_COUNT", sd_acmd_SET_WR_BLK_ERASE_COUNT}, + [41] = {8, sd_bcr, "SD_APP_OP_COND", sd_acmd_SD_APP_OP_COND}, }, }; From patchwork Fri Jun 28 04:53:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 808127 Delivered-To: patch@linaro.org Received: by 2002:adf:fe0a:0:b0:362:4979:7f74 with SMTP id n10csp187719wrr; Thu, 27 Jun 2024 21:55:02 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVaaOjVyqA8DRuy9Un7Gktz5Ylb50UcO7MI5Bxy4Pi3mbOTPRYBy9YyrL7B1VubGrO1yuDuw077hvuyiwNEJPb6 X-Google-Smtp-Source: AGHT+IEYCkicuRdXs05y5nLlwk1XSjVnLB1waphZha692i2z4hGaKZyFgEj++3hNpLca+TpMrqVr X-Received: by 2002:ac8:5992:0:b0:446:51d0:814 with SMTP id d75a77b69052e-44651d00862mr13515151cf.57.1719550502557; Thu, 27 Jun 2024 21:55:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1719550502; cv=none; d=google.com; s=arc-20160816; b=QiYlEY4LhawfcJd/wmuNgV/A0Fui+7PETuq9aPR4O9ILRWeXVP3Lj0CDzcMI0bQ0jO gMTktprI+xHhCSyf4SzUjIWG33w8zf4dKBanwZEb5vjC0Yq3PI6HOKgWKRYiSe1AW/mg qm97FFuWA9KlLvBPZaU5MZtehPH/7kLjVvOZ8Ay7QxiFshseiDA6cU/ndeqvMm0UH2Tf VJhTVjU9OptuLupBy1GnDnpzx7b5Q4VmU9bOIKg+oXdDdiLBQ05amzy9coLNkyHos4jG CeiyzG+uFruTNNFghZqVHSpIPDULbyuU/XYWgQOXQ7yaXlj69pufMJ7zTxD3jM9/goqJ FOYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=V0gZMlOJcmhezdd4Yk1lqkQI7yCyPoJydtauFHQrfjI=; fh=mJ33vrhGd/NTdd5lBDp0lE29qLMBB1Ua1MFYaTj7EB4=; b=jQDj5oQx1v+PEIOSAuEAHCKUg/n/Reg89FNobwGhCj0LTPlzbw6Ij9KzlKR2JfafvW 85iLqDbzkd7EFB17w0tsCKlZFp7vSipR6JNR19IfnLl9ep+zeWj67QJss7LDu+0Nc4P3 i2Zly+uMA0vAhY7gAoJKh3s27JLxPQUuTZ8KrwTBE+yQqsK9T4CUZZiWOpOotbrtuadk XOMq6pDdJIdlCgJHFnwqMimtJYmMf7Xy010wSKq78MKcOb7IjZrF1iFy+G1JaYaQEGmG vsGWaLM7uGVs5QFdKA4pEt3rGYZzfJdY7hjQFrgSKrDVgM0uFtVAjegZ5Bs/OFwUOl9Z 6YCA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=usV2tdS7; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-446512ccafesi11777591cf.82.2024.06.27.21.55.02 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 27 Jun 2024 21:55:02 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=usV2tdS7; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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) 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-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) 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) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Luc Michel , Francisco Iglesias , =?utf-8?q?C=C3=A9dric_Le_G?= =?utf-8?q?oater?= , Sai Pavan Boddu , Joel Stanley , Bin Meng , qemu-block@nongnu.org, =?utf-8?q?Philippe_Mathieu-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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Signed-off-by: Philippe Mathieu-Daudé --- 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 cmd) [14] = "DPS_spec", [15] = "DPS_spec", [16] = "DPS_spec", [18] = "SECU_spec", - [42] = "SET_CLR_CARD_DETECT", [51] = "SEND_SCR", [52] = "SECU_spec", [53] = "SECU_spec", [54] = "SECU_spec", @@ -1748,6 +1747,17 @@ static sd_rsp_type_t sd_acmd_SD_APP_OP_COND(SDState *sd, SDRequest req) return sd_r3; } +/* ACMD42 */ +static sd_rsp_type_t sd_acmd_SET_CLR_CARD_DETECT(SDState *sd, SDRequest req) +{ + if (sd->state != 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, } 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 = { [22] = {8, sd_spi, "SEND_NUM_WR_BLOCKS", sd_acmd_SEND_NUM_WR_BLOCKS}, [23] = {8, sd_spi, "SET_WR_BLK_ERASE_COUNT", sd_acmd_SET_WR_BLK_ERASE_COUNT}, [41] = {8, sd_spi, "SEND_OP_COND", spi_cmd_SEND_OP_COND}, + [42] = {8, sd_spi, "SET_CLR_CARD_DETECT", sd_acmd_SET_CLR_CARD_DETECT}, }, }; @@ -2387,6 +2387,7 @@ static const SDProto sd_proto_sd = { [22] = {8, sd_adtc, "SEND_NUM_WR_BLOCKS", sd_acmd_SEND_NUM_WR_BLOCKS}, [23] = {8, sd_ac, "SET_WR_BLK_ERASE_COUNT", sd_acmd_SET_WR_BLK_ERASE_COUNT}, [41] = {8, sd_bcr, "SD_APP_OP_COND", sd_acmd_SD_APP_OP_COND}, + [42] = {8, sd_ac, "SET_CLR_CARD_DETECT", sd_acmd_SET_CLR_CARD_DETECT}, }, }; From patchwork Fri Jun 28 04:53:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 808128 Delivered-To: patch@linaro.org Received: by 2002:adf:fe0a:0:b0:362:4979:7f74 with SMTP id n10csp187785wrr; Thu, 27 Jun 2024 21:55:20 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXZiYUrM6rKvkEYOve7TSG4bDb8fIbke9P6S2Tt9a1YQ6Gk+0/v9bje11CaQwabob+0BxDU/iuSGvM9S3j1MX85 X-Google-Smtp-Source: AGHT+IH3mUMy038rwAYmhb/1m0MDeYYeEExH9ZQsW1mVgvO5dOfDXxQicGaX/kbaG0ayQ5MvADJm X-Received: by 2002:a05:6214:d4b:b0:6b0:68b6:4605 with SMTP id 6a1803df08f44-6b5409cac6cmr223295016d6.23.1719550520579; Thu, 27 Jun 2024 21:55:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1719550520; cv=none; d=google.com; s=arc-20160816; b=v0Pul1JBJ0I78qIUbuPTJFvHi6vPqu+Pw1MYgAKUWGWKfdZIugLl5D+n6pt06fMbz0 dmXdyIrjclx/S5IEd7DPLMrvEBudbK0XUghzTanhuD1uJVDdXCSKFFFid4a5nI7J6J6j yOtruB9eh0xFb26R0zp6kGm14b83cruI/6ytJoEppfJAXFZUZeVQpR08TxlKkK1Euslg ympR76Z30lERognb8IKfxsCcOKGmic0FUCrVoFzYuDHl1QtFXELO0JY2NquWDrB2xWAh pYYEZHg0Hv0ZySRkE555OFuS6h12rBi9xv7YU+JYrucSoKZZAH8/POJZl+BeeTF04a/H XdfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=eSwX8/t3OMl0d9bqgd19YFhdT5y/t7Myi2nZ/gwkh2s=; fh=mJ33vrhGd/NTdd5lBDp0lE29qLMBB1Ua1MFYaTj7EB4=; b=Y9ZhJrP06ArGmbwagQnLyLWUMaGlMeQHx6m4N2ZnM3k25apbBaxU8vuKqtKYYESHfM +bxEqzqXPCIrH5lfHsEFodR5XwT8dlKLfHXh2j0PonFKRmnLGT/Wc7eToxmAvUfePI52 fmy3SZdJrbpCLHd/dq7+Ux7QH/IEl7QeU0CJc/VEMDLaRutxH2Tz/FktYApkgc4grV0E 4WU2tGvz6oenZfthaDk9dLJZofVoLrh7sqjWr3T0uHQjh3s8UpWjY/BxVvBS67eg+0+G EDclRdYWs/4HEIw4ziBODAe8JSYFfO2YKnuf9oqfsmpdEDrKayEkakqC2RehETys0ZS5 X6Xg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=yKHNNxKg; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6b59e5ad980si12078216d6.249.2024.06.27.21.55.20 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 27 Jun 2024 21:55:20 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=yKHNNxKg; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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) 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-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) 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) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Luc Michel , Francisco Iglesias , =?utf-8?q?C=C3=A9dric_Le_G?= =?utf-8?q?oater?= , Sai Pavan Boddu , Joel Stanley , Bin Meng , qemu-block@nongnu.org, =?utf-8?q?Philippe_Mathieu-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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Signed-off-by: Philippe Mathieu-Daudé --- 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 cmd) [14] = "DPS_spec", [15] = "DPS_spec", [16] = "DPS_spec", [18] = "SECU_spec", - [51] = "SEND_SCR", [52] = "SECU_spec", [53] = "SECU_spec", [54] = "SECU_spec", [56] = "SECU_spec", [57] = "SECU_spec", @@ -1758,6 +1757,12 @@ static sd_rsp_type_t sd_acmd_SET_CLR_CARD_DETECT(SDState *sd, SDRequest req) return sd_r1; } +/* 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, } 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->scr)); - - default: - break; - } - break; - case 18: /* Reserved for SD security applications */ case 25: case 26: @@ -2327,6 +2322,7 @@ static const SDProto sd_proto_spi = { [23] = {8, sd_spi, "SET_WR_BLK_ERASE_COUNT", sd_acmd_SET_WR_BLK_ERASE_COUNT}, [41] = {8, sd_spi, "SEND_OP_COND", spi_cmd_SEND_OP_COND}, [42] = {8, sd_spi, "SET_CLR_CARD_DETECT", sd_acmd_SET_CLR_CARD_DETECT}, + [51] = {8, sd_spi, "SEND_SCR", sd_acmd_SEND_SCR}, }, }; @@ -2388,6 +2384,7 @@ static const SDProto sd_proto_sd = { [23] = {8, sd_ac, "SET_WR_BLK_ERASE_COUNT", sd_acmd_SET_WR_BLK_ERASE_COUNT}, [41] = {8, sd_bcr, "SD_APP_OP_COND", sd_acmd_SD_APP_OP_COND}, [42] = {8, sd_ac, "SET_CLR_CARD_DETECT", sd_acmd_SET_CLR_CARD_DETECT}, + [51] = {8, sd_adtc, "SEND_SCR", sd_acmd_SEND_SCR}, }, }; From patchwork Fri Jun 28 04:53:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 808133 Delivered-To: patch@linaro.org Received: by 2002:adf:fe0a:0:b0:362:4979:7f74 with SMTP id n10csp187874wrr; Thu, 27 Jun 2024 21:55:48 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWWJwRt2sqQXK8YV1LbsdaIYv3eLxlj0W38gocb5UqXa5vT/BBCC3lGUIWR5kvICRLCuu7cCHutnNXdAcqD0GLQ X-Google-Smtp-Source: AGHT+IHBCF6cgLfVUYXI8l2nRTjOMGSvMET183dhA/vZHVYXhOiiFXYBwxLXv6FrxY14GM4P4ixq X-Received: by 2002:a05:620a:4627:b0:79d:6a47:94bf with SMTP id af79cd13be357-79d6a479656mr114548785a.41.1719550548434; Thu, 27 Jun 2024 21:55:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1719550548; cv=none; d=google.com; s=arc-20160816; b=XZdpUQT7lsx/Oe3MvYvL57kger8hYLINvyDWXh2l2QL4QqjcVwZtP+qeOUVltvKKTn A7L03KTDVhi8MQkl4cMfA4Ip00usn0FH37mvSTt692FnWHlfmAsO+YE3FckZKVCFcGl2 jIJ//+efltmaABMiAJOus7EdiGMZG0JA8M4eXQfd47eC4LcuLb0hzvBkPGMCE7Bn47P5 YENI3BU+tKCaMmEpaURjWnh4mycN13A9LaY7xEH0xS/5M3vwmZ4vHcHjUnl5OXneK3B8 L1X4GMNJ1MprKzVoDN4hhVlYiaXMQt9cVx0h/0cQZw2JJHbAH7nGanNvW9qGaHioMG4M WxEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=l1JW4AJQQbgrb8lXxKMuM1qRbY1uuDZlLJblyEzxQh4=; fh=mJ33vrhGd/NTdd5lBDp0lE29qLMBB1Ua1MFYaTj7EB4=; b=bli+aksdQbmmhef8P8qoMvVZakbsdlLL/E18MCfL2SlcUGtlIAw1GL8MNbJrnX0oMV 9S1bjUL9t7/SgJxrsRRIesE9Jn67gPmiKFHUL9CB1TOK17CjwyTtIGHExDoYSHBLS0Mh spdpM4EhYfCEMDcPRM96pzXMPfkWTEw2iqMK/tLUuKVFTi1At3BkvTD/thlNBerJQk9t afV0jPuUgFK1f0tkHX+Eyn4GtjkrGScIOQFwuMjlnwFiltuTYY5B21KNb5JgzvsQ99Zi 7D8/ZdFVXg4YxQPDk8KQi7FDROj/KgIkmNCNzBG7bL2Cdrtdz5HYIM+ktD6fj8+hE+au MLwg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=aFESUId6; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-79d69260df5si105086085a.110.2024.06.27.21.55.48 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 27 Jun 2024 21:55:48 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=aFESUId6; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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) 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-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) 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) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Luc Michel , Francisco Iglesias , =?utf-8?q?C=C3=A9dric_Le_G?= =?utf-8?q?oater?= , Sai Pavan Boddu , Joel Stanley , Bin Meng , qemu-block@nongnu.org, =?utf-8?q?Philippe_Mathieu-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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org All handlers using the 'sd_none' enum got converted, remove it. Signed-off-by: Philippe Mathieu-Daudé --- 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; typedef enum { - sd_none = 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(); } } From patchwork Fri Jun 28 04:53:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 808124 Delivered-To: patch@linaro.org Received: by 2002:adf:fe0a:0:b0:362:4979:7f74 with SMTP id n10csp187707wrr; Thu, 27 Jun 2024 21:55:00 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUI8dmIfbu2lUnJeeswxUxzsNB2Qt7APxMAfVpBMFk//kivAUNM/mGPeaak43YqS/wTG/ASpHqpocMHlUeG8abF X-Google-Smtp-Source: AGHT+IEto9Iy2+//varQc8fqpXT+FezyaZ4M5IAvQ+SZzPLbuGS2BCLeMnnOWHOHEAhS3sG8BKVY X-Received: by 2002:ad4:574b:0:b0:6b0:7b86:7c4d with SMTP id 6a1803df08f44-6b540a950f3mr193364846d6.50.1719550500068; Thu, 27 Jun 2024 21:55:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1719550500; cv=none; d=google.com; s=arc-20160816; b=YtykLCx3hFjKZ6LBMkHLtvcMHEpNaxcqAhh0e830CIYa38236jKEyshgiqtWGdHQzw e/fbMtFyrGqATk8wNapNdXToYOuv2P3t5BYmsZ8yCj6drSmUbtZNViLIa+4+oMCBw+Py NNXtpdDj9ezTKteaTmbMyeV8DcynuCqAwda3VlBSCQidtmcK/agBr0mFagWRyUooIaNj e2MBJe1SHWEhnj4WY+IkRP4+PCYWwoyJ+qC6Uu8b1nAf6LbguzJGWJYbljcD121mzSyv le0YqrNKq6cYhxEOqYynbWGGD+tbp4i9EQFm3bwvl5CyJdaVqT9+uPYiMZ9d4+GvAKE/ Yb0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=KLGQaIGJKgcmO8Q0mlDn8rOb//ZdpOwWSY8cFandEdQ=; fh=mJ33vrhGd/NTdd5lBDp0lE29qLMBB1Ua1MFYaTj7EB4=; b=G4SmMXNKiReQq+g0bXUI3tU8bDRvhWcFdaI+023rCyh15xlMnQZUJhnc0q8eAIjWqE Lo7uwEEonrvX+NmscAD8CNWTsPw/brI7H8y4IrThhur9AEjgog2FRqwLF9K3JhvwVU+q Qwdae9bWnC0hNu4Tk0fpIVToolHFXanySzXXBU/lwxnAZFrDRyk1JWXSfJv0oXSFYtEy Uko3eiH1Tou1gQwOb/FUNt1UGuhRmwxhHeCx0AE4H/sKHmgyGOkAlRGnngXwNsbgfY+B W7xXJbx6KOzE8gjuv8aMtx0DHk0jcTNqiGiXs17s++Et4UFIY6NRopJ9GRsYp/0CT9KY SJ9Q==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Y3CaqbJe; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6b59e615dd6si11740876d6.550.2024.06.27.21.54.59 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 27 Jun 2024 21:55:00 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Y3CaqbJe; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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) 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-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) 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) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Luc Michel , Francisco Iglesias , =?utf-8?q?C=C3=A9dric_Le_G?= =?utf-8?q?oater?= , Sai Pavan Boddu , Joel Stanley , Bin Meng , qemu-block@nongnu.org, =?utf-8?q?Philippe_Mathieu-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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org These ACMD names weren't really useful, "UNKNOWN_ACMD" is simpler. Signed-off-by: Philippe Mathieu-Daudé --- 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 cmd) static const char *sd_acmd_name(SDState *sd, uint8_t cmd) { - static const char *acmd_abbrev[SDMMC_CMD_MAX] = { - [14] = "DPS_spec", [15] = "DPS_spec", - [16] = "DPS_spec", - [18] = "SECU_spec", - [52] = "SECU_spec", [53] = "SECU_spec", - [54] = "SECU_spec", - [56] = "SECU_spec", [57] = "SECU_spec", - [58] = "SECU_spec", [59] = "SECU_spec", - }; const SDProto *sdp = sd->proto; if (sdp->acmd[cmd].handler) { - assert(!acmd_abbrev[cmd]); return sdp->acmd[cmd].name; } - return acmd_abbrev[cmd] ? acmd_abbrev[cmd] : "UNKNOWN_ACMD"; + return "UNKNOWN_ACMD"; } static uint8_t sd_get_dat_lines(SDState *sd) From patchwork Fri Jun 28 04:53:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 808132 Delivered-To: patch@linaro.org Received: by 2002:adf:fe0a:0:b0:362:4979:7f74 with SMTP id n10csp187869wrr; Thu, 27 Jun 2024 21:55:48 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUjayomT3Fug95lHsiKwsSvCYPTRCALqdYT+sLgQePhXxOBpxm5cZCU3KDo033WkLSyBWd0aB+UxcvBHqHbj/Fl X-Google-Smtp-Source: AGHT+IG10r+xvKAdB/hbcVg+yXpc5bsbYIMgmFyhGaBEs7hbMJeKOzPLeXb53ru5RgIjgKQS6uMZ X-Received: by 2002:a05:620a:394c:b0:79b:f641:e6c with SMTP id af79cd13be357-79bf6410e7cmr1495649985a.14.1719550547974; Thu, 27 Jun 2024 21:55:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1719550547; cv=none; d=google.com; s=arc-20160816; b=hr/vSuHrekjjbuAUpbHDfmJaA2esy0Tx7wcsBwq6U9YEYMdxH52ouKn38Ke9SnWUWW RD9sML0abLNsX/RxOdF1FWmkgd0jyyGWCIggEz6Fi/iElFGhtjTV7v6V08vxgiuTCkww jVYbJ4n5d/fxXnaxERsldHTwMwII6lBmUSeTP4mClOs2Tqz7bixrU+yCr/J7blSQONnM kT+CGy7kii2akMwXhdpl2H0SnJdwArVBLBroAqKDB9qo0IugL5LLsdFcJwGJ5LngM8s2 f4kS28fRUOzL0zjnxKdZr6bZIhMGt9CcYvBN+Uo4XKp0YCyvo2tGYOrxMWUYXYdjN6JN msNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Qw+zxMHTEIwsFcpzBJxdUQmKFi6OrynqizbQoSQ84sA=; fh=mJ33vrhGd/NTdd5lBDp0lE29qLMBB1Ua1MFYaTj7EB4=; b=ZMv6Xtnd8zJ1nf9rOpqdNok04uipvo2SjoE0q/pxBeCEsDpw9jUd2Zs/WRS3pVxKqC LlNJOFL/D10XyYN6GGTbz79Ss9j4JYqRyZdViWbZgNS5aoXPE6D3a300qq6LT1Zd2toC cl9gkotpKDVskFvPYC8T9LUDzya4VXUmnnDl/I1AXooTlnYr6d9PhwTvk0npCXlDVgFa vdQghO5lTLou8aQwO4h0G6ucYE4p4JoBpADulhvvQafOVpa9oYe5CxogAzFvWYm4eFNt fCHUaHvwDwI2E+NerE8WdxyFyuub1uQMSc5ZAmOKKwmqGF2jqzUGkm6y/JqseOaShTEW rHMg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dTrd7ZsA; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-79d69262c62si107292585a.52.2024.06.27.21.55.47 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 27 Jun 2024 21:55:47 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dTrd7ZsA; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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) 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-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) 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) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Luc Michel , Francisco Iglesias , =?utf-8?q?C=C3=A9dric_Le_G?= =?utf-8?q?oater?= , Sai Pavan Boddu , Joel Stanley , Bin Meng , qemu-block@nongnu.org, =?utf-8?q?Philippe_Mathieu-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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org These CMD names weren't really useful, "UNKNOWN_CMD" is simpler. Signed-off-by: Philippe Mathieu-Daudé --- 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 cmd) { static const char *cmd_abbrev[SDMMC_CMD_MAX] = { [18] = "READ_MULTIPLE_BLOCK", - [21] = "DPS_spec", [25] = "WRITE_MULTIPLE_BLOCK", - [26] = "MANUF_RSVD", - [40] = "DPS_spec", - [60] = "MANUF_RSVD", [61] = "MANUF_RSVD", - [62] = "MANUF_RSVD", [63] = "MANUF_RSVD", }; const SDProto *sdp = sd->proto; From patchwork Fri Jun 28 04:53:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 808131 Delivered-To: patch@linaro.org Received: by 2002:adf:fe0a:0:b0:362:4979:7f74 with SMTP id n10csp187863wrr; Thu, 27 Jun 2024 21:55:46 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXgumSwImHkHons8nP1ZPtKXSTFNCthzGeEXT+qS2gCZ+X1bZtti9hgqA5uwEmyrbRfcnJwcE3o9ReHBmFT0dL2 X-Google-Smtp-Source: AGHT+IGpj3i3M3D97pCgj84tmoYupZp1RA1wntAYXFkNYMkjGn3q4EyxyBTcSb49PKp/3e9A2uSP X-Received: by 2002:a05:622a:1a01:b0:442:1bdc:2a6 with SMTP id d75a77b69052e-44655742f88mr7728931cf.30.1719550546238; Thu, 27 Jun 2024 21:55:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1719550546; cv=none; d=google.com; s=arc-20160816; b=Dcr6SA1jrIMOdHuPDrYyxfQ2+8K2usXsx1A58jPSnJS1ru5kAjouAwWzwQYilefI4w ANkJIkNvbqDpaUBe86gnTYbyKAj7s0RY2W5ShGeW8ujfnlS9Yx/M+NZgEGE3U4OVfvZW OjGVAk3QedP/oFWEPrl6J4DKFLq8yrtNts9wM4lBE7hklNl0ZSTeh7KJTHnaUPVlbovn hQX3GVxpx9Oj9OzJQb/Wb0tZn0NgzyGeHERERuGL1PATgny2FtSMgZO3BS+h6a1VHIU4 bsHm+R/6gXNrvjkpIUceHp4fgj7SzIJccThSb4irIkC/FGi/nB03f0FyYTMlUPoQd6CQ 9feA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=t05HoVB9l7/y3jswyRpww8YiOUTnZmazAh4RttVAsxI=; fh=mJ33vrhGd/NTdd5lBDp0lE29qLMBB1Ua1MFYaTj7EB4=; b=TSKmQIqM1/yxbBboTGCoXWsAyArnTBLeufKTTa6rh9rw0Z6e7VsGZqneGfx2VDBGLP 09aG8UjndSvug3X63Nw3Lrz9tY7Dqzcc7LcuNWKcjJCC8FQiK5uTPovoWnR9QBxNSOV+ ik4DJoiSJ3xn7pjDccTENlU7jfWihE/b/GhKxQjXBqzckSj0UmmMFNQ3ljod9DTlwJs+ r7caIIOqosSpjYlD/eDxT7XcoVoH93E8mAlSfFUMHy9jLomEv4Q8/0IiwtFaxn9Y0GHt VGhh3/K4fFAhuaZbjhacnwWQOXt6LXT4Pk0v7wanIAZ+nkjXVPTf4bfc9voan52hioHF IwlA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XSCbUt99; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-44651487961si11400361cf.364.2024.06.27.21.55.46 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 27 Jun 2024 21:55:46 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XSCbUt99; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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) 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-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) 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) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Luc Michel , Francisco Iglesias , =?utf-8?q?C=C3=A9dric_Le_G?= =?utf-8?q?oater?= , Sai Pavan Boddu , Joel Stanley , Bin Meng , qemu-block@nongnu.org, =?utf-8?q?Philippe_Mathieu-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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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é --- 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 = req->cmd; sd->card_status = FIELD_DP32(sd->card_status, CSR, CURRENT_STATE, last_state); } @@ -2016,6 +2015,8 @@ send_response: qemu_hexdump(stderr, "Response", response, rsplen); #endif + sd->current_cmd = rtype == sd_illegal ? 0 : req->cmd; + return rsplen; } @@ -2171,8 +2172,7 @@ void sd_write_byte(SDState *sd, uint8_t value) break; default: - qemu_log_mask(LOG_GUEST_ERROR, "%s: unknown command\n", __func__); - break; + g_assert_not_reached(); } } @@ -2238,8 +2238,7 @@ uint8_t sd_read_byte(SDState *sd) break; default: - qemu_log_mask(LOG_GUEST_ERROR, "%s: unknown command\n", __func__); - return 0x00; + g_assert_not_reached(); } return ret; From patchwork Fri Jun 28 04:53:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 808130 Delivered-To: patch@linaro.org Received: by 2002:adf:fe0a:0:b0:362:4979:7f74 with SMTP id n10csp187862wrr; Thu, 27 Jun 2024 21:55:46 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWG5Rp2ATL3+tDPqQ2s6r1cm5NFpfUWgYLMP+EZOj03p5zIrDJGk3LtxoNtzB1A7Yz2qt5+Lv7NPovigL3UjDKo X-Google-Smtp-Source: AGHT+IGLP+xHZ0EezcLgawzsX3N74zu0HSrnMpxluNBUh3RkaFpXFL8+JKHY5KL3t9lOhGiRouc2 X-Received: by 2002:ac8:5712:0:b0:446:51f3:1869 with SMTP id d75a77b69052e-44651f31da6mr12510661cf.29.1719550545866; Thu, 27 Jun 2024 21:55:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1719550545; cv=none; d=google.com; s=arc-20160816; b=z4on9o/HbuXzZQnIEI+bGqzbSQRpUJpGxYxmlk4v5Y5cWD3iMqI+U+rpO8e37JJQOu 5zv6HFma6uQzsLBbBvudpPicwq9nfB9PfJLh961kbF0Ry3TF/ptmdYGJqfojeAMEDM+V r+VVHxzYYn9nSwo1e4MoxyefBOnWgRA8bVfpWfgrrmfahS2ubx1x0eiGc3K2jahfHtdC TinS79uhYQJmQA9JIOs6AhII/4efnDu5rnnu1nfhV8wYIyjuxgcohBZk9eOlEdFvacH1 k5d36MG8zxZqDMQrGuDXx64sg2Wnkme5zgdrIsvWP9G0BKZM2tpjeY8ZzRGRWMJwKFDd 85Dg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=G214GiZ6GoHQbuSVeY1gM0sNgUJBhdD0Klfne+Cmhik=; fh=mJ33vrhGd/NTdd5lBDp0lE29qLMBB1Ua1MFYaTj7EB4=; b=gmDy/fZzC17rBS5qjghE0zJwr5RiewwwXwifpG56SmbMHb2dkFuZ8GB3z3awYceynf 1Xw9F4D4rutXH5uAYdkaN9LNnBmJAXINZFXwAWBeeElGqQ1BVjfgD1cgAQ8hPH/4dKyi Vnh92gKRj/MCm6+l7s73340ajGZz4ZAUMv1H6d+yyyjxqgEO/2vnLjsVhdSSakNYdi2i eU+aj4Yg7JX8kjUb8XY66C+HfPgkeGIhogRVwFM52jJCRQFJPDM3AANHxaYNwTs5R+h8 v4dcGhzDrdBBLFNylDQ8vHmBhbRf4iLhqBpHFY23sUqTjfYxDHzQWnYIZhE1/fAb9jKV cpwg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="RnU/JVJe"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-446514c6786si10990291cf.629.2024.06.27.21.55.45 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 27 Jun 2024 21:55:45 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="RnU/JVJe"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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) 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-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) 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) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Luc Michel , Francisco Iglesias , =?utf-8?q?C=C3=A9dric_Le_G?= =?utf-8?q?oater?= , Sai Pavan Boddu , Joel Stanley , Bin Meng , qemu-block@nongnu.org, =?utf-8?q?Philippe_Mathieu-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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Some commands expect less than BLOCK_LENGTH. Signed-off-by: Philippe Mathieu-Daudé --- 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 = sd_blk_len(sd); 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 0x%x" sdcard_write_data(const char *proto, const char *cmd_desc, uint8_t cmd, uint32_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, uint32_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, uint32_t offset, uint64_t size, uint32_t blklen) "%s %20s/ CMD%02d ofs %"PRIu32" size %"PRIu64" blklen %" PRIu32 sdcard_set_voltage(uint16_t millivolts) "%u mV" # pxa2xx_mmci.c