From patchwork Thu Jun 27 16:38:33 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: 807847 Delivered-To: patch@linaro.org Received: by 2002:adf:e842:0:b0:362:4979:7f74 with SMTP id d2csp896716wrn; Thu, 27 Jun 2024 09:40:03 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXbpwU4TIZweY2Azg2BSuGF75jHG5cpVxUuQpucP1ZntFxlBn5jrMV8O7U0sE5/CVvx1NZN7IFTiPF9DFSAbZu1 X-Google-Smtp-Source: AGHT+IF1jiBY10t1Y6okNweubHnwfcQEayv6wgptyai2ygE1aDEcgNbi/o0sRvX8BtfZE/YNPi1l X-Received: by 2002:ac8:58ce:0:b0:43b:1472:1685 with SMTP id d75a77b69052e-444d9215274mr158229671cf.51.1719506403387; Thu, 27 Jun 2024 09:40:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1719506403; cv=none; d=google.com; s=arc-20160816; b=uE72fx5IjnAmCZPvGrmVwgeETkkQ6Iw23sQ2nnfaaFRWX1i5wXVVBbD3AqIkpSNXss iC2AY8F1ez6yRs3uBMzbDP4C/KNbIpf38Hwtm2ocwfmVE0NW+heBrdJpgreevo5Rvsxf xerH6S1aBjSabhwnCqUUTZc/Wmu337lgZ/oz9HgDHhju0tVMsXReIYz+USMWlH/6nkNg bD7Q2CiPBL3k/5lKw4lFWgMYQRuFcCBPhgrIDbyxKdj7B5A0wocDkfGsSTu28ORnCXdJ gwcL7hzy8X8R1UuTi3qppfxXn9EGy91s/Mc+RdelPhBFDPiCh927MIVsdVH1gqFetA7/ u0AQ== 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=bHvyGuDRbuJRmw1vnphLPFr0BQjrkrSSL7KeWPzCQwM=; fh=E5m7+9HN0zGcNIUskxjX+xkpcxQksSinAMYSY8RmZaI=; b=ZcGxrm9uP6910RdZSFRVl7qAQDVxd21iY5OdPWXVqeA3rZM61gLkPSyptdIlKPCpGc ERUPkpST3hrP1+Ua2YfrwW62Q/zlV1sf6kxDRYYguAKu1OkKhgLlL8luVbNSpBKOSvSV t2jUaoOgM8p6ajRGLaq0GH4DDzgPlVud2W2D13ULPMJqB8XmC1ZFFaTxle4Vdc1UbWSa s43X1ik5OKOYpGWxKqA7v5Vup9GCEgQ+8Py9EvQ52AoCqxKVIyIy0DPXVY8xdkqdro/C QrR9yvvHSUmMvPizf+BDdOqQTqRgTSWeDJPkLZRdZZlraY+hhS3k6+JFkkPbZfDwaeIX q6aQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jvMEFO3u; 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-44649eb8cb4si6155271cf.383.2024.06.27.09.40.03 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 27 Jun 2024 09:40:03 -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=jvMEFO3u; 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 1sMs9M-000128-16; Thu, 27 Jun 2024 12:39:08 -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 1sMs9J-000112-UB for qemu-devel@nongnu.org; Thu, 27 Jun 2024 12:39:06 -0400 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sMs9H-0006rt-Vk for qemu-devel@nongnu.org; Thu, 27 Jun 2024 12:39:05 -0400 Received: by mail-wr1-x436.google.com with SMTP id ffacd0b85a97d-366edce6493so3350148f8f.3 for ; Thu, 27 Jun 2024 09:39:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1719506342; x=1720111142; 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=bHvyGuDRbuJRmw1vnphLPFr0BQjrkrSSL7KeWPzCQwM=; b=jvMEFO3udVFDwOlb9v6NwkMGycnSPIeHIm3P2XWRsTt7I0GlmSPlWHaXAGQfU6JsTO TX0voPv6wlVxM8BhwsEBAmyd+b//iXqsU8Nnn2ZRiPuAxPCVLc4vps3DFgsZeTVSyA0I fU0O83TAN2x1gQOTv06zz3YeQ/xfElHpncjSfBWTX9E4zzFiZ4IiU/egUNkEAU0Dl7Zs xCJ/ftTEtIHqPI3ZP4rSCRB2BGslvhKnJnzt1sK9NsOU71wLJOupwRVtK0m4Us25+8k/ V+FSVQK0FMICKkKbqy3TGeUcSM6a1IRe4ywzdzmpDizS+EFG8R5GfxcQqVpber8nctFR uZ4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719506342; x=1720111142; 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=bHvyGuDRbuJRmw1vnphLPFr0BQjrkrSSL7KeWPzCQwM=; b=thLq0eUYgkxyUgVyl9N7SftqGqG3mUx/CucldKUeEG6Gq1AtDSSWyY8w5YKU2ll4Ow UcoPYa5mT2/sM58ppnjWsOrwGNLZP34H/owVPyVAdWApHWrE1dJi+NtWBFHW1lHXm863 KvMXnwD0c4Kg1a8U9ooQFNVB3p2TT6Ksp8e9aVob2W57CEF2h+UScyqzVrfjEKG2TiZL eMHe8Vzkt08OedHs14puM+55kExz2A1HSRwBt1KrX383kTX8W32Sx+ojWUb+rUVajlG9 6jgsqmaQRfAOUCvAY4NTB2M4bPsm9Av13vYLFB5o/GlcfQh/lwG288P2dGp1j1R+sFPn V/Eg== X-Gm-Message-State: AOJu0YzzkxcydAMP3LF+npMJWf9ssS0Iqp8Xc3mJTyUJCBEtxgR5IrQo FyC/SMoqZqly/6cdDVNlJMvm/R4s2LtzL9M5epCyorr8n/T4o45Jt7LI4KYynoqUm2GM7Ai7VTJ pxUE= X-Received: by 2002:adf:e881:0:b0:367:3d12:4ffd with SMTP id ffacd0b85a97d-3673d125212mr2476490f8f.18.1719506342079; Thu, 27 Jun 2024 09:39:02 -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 ffacd0b85a97d-367436997a8sm2411947f8f.81.2024.06.27.09.38.58 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 27 Jun 2024 09:39:01 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Joel Stanley , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Francisco Iglesias , qemu-block@nongnu.org, Sai Pavan Boddu , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= , Bin Meng , Luc Michel Subject: [PATCH 01/11] hw/sd/sdcard: Move sd_[a]cmd_name() methods to sd.c Date: Thu, 27 Jun 2024 18:38:33 +0200 Message-ID: <20240627163843.81592-2-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240627163843.81592-1-philmd@linaro.org> References: <20240627163843.81592-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::436; envelope-from=philmd@linaro.org; helo=mail-wr1-x436.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 Merge sdmmc-internal.c into sd.c by moving sd_cmd_name() and sd_acmd_name() and updating meson.build. Signed-off-by: Philippe Mathieu-Daudé --- hw/sd/sdmmc-internal.h | 26 --------------- hw/sd/sd.c | 62 ++++++++++++++++++++++++++++++++++++ hw/sd/sdmmc-internal.c | 72 ------------------------------------------ hw/sd/meson.build | 2 +- 4 files changed, 63 insertions(+), 99 deletions(-) delete mode 100644 hw/sd/sdmmc-internal.c diff --git a/hw/sd/sdmmc-internal.h b/hw/sd/sdmmc-internal.h index 306ffa7f53..20d85aea6d 100644 --- a/hw/sd/sdmmc-internal.h +++ b/hw/sd/sdmmc-internal.h @@ -108,30 +108,4 @@ #define EXT_CSD_PART_CONFIG_EN_BOOT0 (0x1 << 3) #define EXT_CSD_PART_CONFIG_EN_USER (0x7 << 3) -#define SDMMC_CMD_MAX 64 - -/** - * sd_cmd_name: - * @cmd: A SD "normal" command, up to SDMMC_CMD_MAX. - * - * Returns a human-readable name describing the command. - * The return value is always a static string which does not need - * to be freed after use. - * - * Returns: The command name of @cmd or "UNKNOWN_CMD". - */ -const char *sd_cmd_name(uint8_t cmd); - -/** - * sd_acmd_name: - * @cmd: A SD "Application-Specific" command, up to SDMMC_CMD_MAX. - * - * Returns a human-readable name describing the application command. - * The return value is always a static string which does not need - * to be freed after use. - * - * Returns: The application command name of @cmd or "UNKNOWN_ACMD". - */ -const char *sd_acmd_name(uint8_t cmd); - #endif diff --git a/hw/sd/sd.c b/hw/sd/sd.c index f9708064d0..93a4a4e1b4 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -88,6 +88,8 @@ enum SDCardStates { sd_disconnect_state = 8, }; +#define SDMMC_CMD_MAX 64 + typedef sd_rsp_type_t (*sd_cmd_handler)(SDState *sd, SDRequest req); typedef struct SDProto { @@ -231,6 +233,66 @@ static const char *sd_response_name(sd_rsp_type_t rsp) return response_name[rsp]; } +static const char *sd_cmd_name(uint8_t cmd) +{ + static const char *cmd_abbrev[SDMMC_CMD_MAX] = { + [0] = "GO_IDLE_STATE", [1] = "SEND_OP_COND", + [2] = "ALL_SEND_CID", [3] = "SEND_RELATIVE_ADDR", + [4] = "SET_DSR", [5] = "IO_SEND_OP_COND", + [6] = "SWITCH_FUNC", [7] = "SELECT/DESELECT_CARD", + [8] = "SEND_IF_COND", [9] = "SEND_CSD", + [10] = "SEND_CID", [11] = "VOLTAGE_SWITCH", + [12] = "STOP_TRANSMISSION", [13] = "SEND_STATUS", + [15] = "GO_INACTIVE_STATE", + [16] = "SET_BLOCKLEN", [17] = "READ_SINGLE_BLOCK", + [18] = "READ_MULTIPLE_BLOCK", [19] = "SEND_TUNING_BLOCK", + [20] = "SPEED_CLASS_CONTROL", [21] = "DPS_spec", + [23] = "SET_BLOCK_COUNT", + [24] = "WRITE_BLOCK", [25] = "WRITE_MULTIPLE_BLOCK", + [26] = "MANUF_RSVD", [27] = "PROGRAM_CSD", + [28] = "SET_WRITE_PROT", [29] = "CLR_WRITE_PROT", + [30] = "SEND_WRITE_PROT", + [32] = "ERASE_WR_BLK_START", [33] = "ERASE_WR_BLK_END", + [34] = "SW_FUNC_RSVD", [35] = "SW_FUNC_RSVD", + [36] = "SW_FUNC_RSVD", [37] = "SW_FUNC_RSVD", + [38] = "ERASE", + [40] = "DPS_spec", + [42] = "LOCK_UNLOCK", [43] = "Q_MANAGEMENT", + [44] = "Q_TASK_INFO_A", [45] = "Q_TASK_INFO_B", + [46] = "Q_RD_TASK", [47] = "Q_WR_TASK", + [48] = "READ_EXTR_SINGLE", [49] = "WRITE_EXTR_SINGLE", + [50] = "SW_FUNC_RSVD", + [52] = "IO_RW_DIRECT", [53] = "IO_RW_EXTENDED", + [54] = "SDIO_RSVD", [55] = "APP_CMD", + [56] = "GEN_CMD", [57] = "SW_FUNC_RSVD", + [58] = "READ_EXTR_MULTI", [59] = "WRITE_EXTR_MULTI", + [60] = "MANUF_RSVD", [61] = "MANUF_RSVD", + [62] = "MANUF_RSVD", [63] = "MANUF_RSVD", + }; + return cmd_abbrev[cmd] ? cmd_abbrev[cmd] : "UNKNOWN_CMD"; +} + +static const char *sd_acmd_name(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", + [18] = "SECU_spec", + [22] = "SEND_NUM_WR_BLOCKS", [23] = "SET_WR_BLK_ERASE_COUNT", + [41] = "SD_SEND_OP_COND", + [42] = "SET_CLR_CARD_DETECT", + [51] = "SEND_SCR", + [52] = "SECU_spec", [53] = "SECU_spec", + [54] = "SECU_spec", + [56] = "SECU_spec", [57] = "SECU_spec", + [58] = "SECU_spec", [59] = "SECU_spec", + }; + + return acmd_abbrev[cmd] ? acmd_abbrev[cmd] : "UNKNOWN_ACMD"; +} + static uint8_t sd_get_dat_lines(SDState *sd) { return sd->enable ? sd->dat_lines : 0; diff --git a/hw/sd/sdmmc-internal.c b/hw/sd/sdmmc-internal.c deleted file mode 100644 index c1d5508ae6..0000000000 --- a/hw/sd/sdmmc-internal.c +++ /dev/null @@ -1,72 +0,0 @@ -/* - * SD/MMC cards common helpers - * - * Copyright (c) 2018 Philippe Mathieu-Daudé - * - * This work is licensed under the terms of the GNU GPL, version 2 or later. - * See the COPYING file in the top-level directory. - * SPDX-License-Identifier: GPL-2.0-or-later - */ - -#include "qemu/osdep.h" -#include "sdmmc-internal.h" - -const char *sd_cmd_name(uint8_t cmd) -{ - static const char *cmd_abbrev[SDMMC_CMD_MAX] = { - [0] = "GO_IDLE_STATE", [1] = "SEND_OP_COND", - [2] = "ALL_SEND_CID", [3] = "SEND_RELATIVE_ADDR", - [4] = "SET_DSR", [5] = "IO_SEND_OP_COND", - [6] = "SWITCH_FUNC", [7] = "SELECT/DESELECT_CARD", - [8] = "SEND_IF_COND", [9] = "SEND_CSD", - [10] = "SEND_CID", [11] = "VOLTAGE_SWITCH", - [12] = "STOP_TRANSMISSION", [13] = "SEND_STATUS", - [15] = "GO_INACTIVE_STATE", - [16] = "SET_BLOCKLEN", [17] = "READ_SINGLE_BLOCK", - [18] = "READ_MULTIPLE_BLOCK", [19] = "SEND_TUNING_BLOCK", - [20] = "SPEED_CLASS_CONTROL", [21] = "DPS_spec", - [23] = "SET_BLOCK_COUNT", - [24] = "WRITE_BLOCK", [25] = "WRITE_MULTIPLE_BLOCK", - [26] = "MANUF_RSVD", [27] = "PROGRAM_CSD", - [28] = "SET_WRITE_PROT", [29] = "CLR_WRITE_PROT", - [30] = "SEND_WRITE_PROT", - [32] = "ERASE_WR_BLK_START", [33] = "ERASE_WR_BLK_END", - [34] = "SW_FUNC_RSVD", [35] = "SW_FUNC_RSVD", - [36] = "SW_FUNC_RSVD", [37] = "SW_FUNC_RSVD", - [38] = "ERASE", - [40] = "DPS_spec", - [42] = "LOCK_UNLOCK", [43] = "Q_MANAGEMENT", - [44] = "Q_TASK_INFO_A", [45] = "Q_TASK_INFO_B", - [46] = "Q_RD_TASK", [47] = "Q_WR_TASK", - [48] = "READ_EXTR_SINGLE", [49] = "WRITE_EXTR_SINGLE", - [50] = "SW_FUNC_RSVD", - [52] = "IO_RW_DIRECT", [53] = "IO_RW_EXTENDED", - [54] = "SDIO_RSVD", [55] = "APP_CMD", - [56] = "GEN_CMD", [57] = "SW_FUNC_RSVD", - [58] = "READ_EXTR_MULTI", [59] = "WRITE_EXTR_MULTI", - [60] = "MANUF_RSVD", [61] = "MANUF_RSVD", - [62] = "MANUF_RSVD", [63] = "MANUF_RSVD", - }; - return cmd_abbrev[cmd] ? cmd_abbrev[cmd] : "UNKNOWN_CMD"; -} - -const char *sd_acmd_name(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", - [18] = "SECU_spec", - [22] = "SEND_NUM_WR_BLOCKS", [23] = "SET_WR_BLK_ERASE_COUNT", - [41] = "SD_SEND_OP_COND", - [42] = "SET_CLR_CARD_DETECT", - [51] = "SEND_SCR", - [52] = "SECU_spec", [53] = "SECU_spec", - [54] = "SECU_spec", - [56] = "SECU_spec", [57] = "SECU_spec", - [58] = "SECU_spec", [59] = "SECU_spec", - }; - - return acmd_abbrev[cmd] ? acmd_abbrev[cmd] : "UNKNOWN_ACMD"; -} diff --git a/hw/sd/meson.build b/hw/sd/meson.build index abfac9e461..bbb75af0c9 100644 --- a/hw/sd/meson.build +++ b/hw/sd/meson.build @@ -1,5 +1,5 @@ system_ss.add(when: 'CONFIG_PL181', if_true: files('pl181.c')) -system_ss.add(when: 'CONFIG_SD', if_true: files('sd.c', 'core.c', 'sdmmc-internal.c')) +system_ss.add(when: 'CONFIG_SD', if_true: files('sd.c', 'core.c')) system_ss.add(when: 'CONFIG_SDHCI', if_true: files('sdhci.c')) system_ss.add(when: 'CONFIG_SDHCI_PCI', if_true: files('sdhci-pci.c')) system_ss.add(when: 'CONFIG_SSI_SD', if_true: files('ssi-sd.c')) From patchwork Thu Jun 27 16:38:34 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: 807848 Delivered-To: patch@linaro.org Received: by 2002:adf:e842:0:b0:362:4979:7f74 with SMTP id d2csp896753wrn; Thu, 27 Jun 2024 09:40:08 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUfL9Up7fc75pnCghAFpwavyQMQEhjmvNZUtrh34g3TmZKTavq+BaUp3tT0B7ssvA0GNSaQSOvA1OyWvED7I1Ym X-Google-Smtp-Source: AGHT+IGsfohCPoTnBlWzJ1l14fSJsqPaeO8ZXohK1t4sjLQIhrKBM/uAQxv8LYUcK8Aym4t2Sheu X-Received: by 2002:a05:6214:104f:b0:6b5:37f4:8945 with SMTP id 6a1803df08f44-6b537f48ba1mr162979796d6.9.1719506407777; Thu, 27 Jun 2024 09:40:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1719506407; cv=none; d=google.com; s=arc-20160816; b=iYQzIY42KWzdVu/7j6ZRq3LU8e/uKvb108KrJei8IvbJAiE7hYnq/Xx8VV4CVy4Z0u B9CfY6NzUqj5dWF96BknSfhrgYSp3a6/C1RAYMncigIxka199KU87l/jCcJhhroLti1F vxWSAGxG2EpiomSbNzqn28/fxxZ0uY0qiq1DQvQSYVJrOatwD09S99i9xtRNiH+qvEzO JFyeac+Pt5MaO8n/zpH49aROvohXduSz7uH9hA+5jCOaE3FwLhDVojQLscqz+KqBtfk+ bAeL8/MBl+wpR3hpebcc+3yNiDEtZ5yDCknxFtg4eeLFgLHdpfFp1Hqteril5jWc117R QJkw== 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=0hugKoDWkNwghwH1h1z7n8tbSuuJya6Cw/1S35GizWg=; fh=E5m7+9HN0zGcNIUskxjX+xkpcxQksSinAMYSY8RmZaI=; b=cA7tX9C/NFS4YYm4p6eY6MOFg/4i4wXQLnIcVAksS5IMBAcXHb4lx/mnWzW8/LVnat TF4Z0pSAgnYrTUusiCUgQOKTnVEmQqQ+p4Jk3BQniYsDPOakLivOI9uYwYDN5kkaj39G oGe6meB4VSjxlUWK5APo8YYxV3rMBe6S/SLq+zZU+X9kfHseW/0GTziRNBUilROs1L7b NN/fdZH5LjEoddo45g052QNZffkMsPIGHC4+h4Qp4b7ba6uNbVsTcFelTSVMXnzV09ya 2Y9o5uKzD93iSY0UDvr5iQJJT1w79eWV7o0Gg8jSqoe7qHgqe9Yn1wDaFHxRLgLiCmRo I3kw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IZkqlfHn; 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-6b59e36c130si304906d6.138.2024.06.27.09.40.07 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 27 Jun 2024 09:40:07 -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=IZkqlfHn; 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 1sMs9V-0001Ak-C9; Thu, 27 Jun 2024 12:39:17 -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 1sMs9U-00018M-Hk for qemu-devel@nongnu.org; Thu, 27 Jun 2024 12:39:16 -0400 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sMs9S-0006sv-R2 for qemu-devel@nongnu.org; Thu, 27 Jun 2024 12:39:16 -0400 Received: by mail-wr1-x42c.google.com with SMTP id ffacd0b85a97d-354b722fe81so5420883f8f.3 for ; Thu, 27 Jun 2024 09:39:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1719506352; x=1720111152; 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=0hugKoDWkNwghwH1h1z7n8tbSuuJya6Cw/1S35GizWg=; b=IZkqlfHn2xRbZiTMTpxadh8ibDKPx4JoyV7me9WQwHciw729I9kPF+N3LSSpOS4VTt rNE61ayGllO1s+yEDEJi4dGx8vm3H55L0np98B29mkwOLlEXwsoN8ieyuc/jyx/z7Uz+ bYY5XAUeVnLMtm1D0QRo2Y3mgYeb+q2f/qc9NSJ4eRay+o2X7qtC4Eue9jANfH8+V1Gs l/RFfwnGffPFUStRjHUrtXXnvUFc2ABk9OONnySjidFDiQt4HNs5bUkbf9+MR8cBffuo qH9E97YjsOkTu+n1HBrwuPAt0z8Hv7mNurp5UxghlyC1stFoSJ+PsZ+WnIN315JrHVSu 5LKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719506352; x=1720111152; 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=0hugKoDWkNwghwH1h1z7n8tbSuuJya6Cw/1S35GizWg=; b=cI71m+tdvBaToZloEDNcHcAgTzUQSnDO1p96oUR0vYOOgirbt8pyCrw00Ncxxirq9R Za/f7hOdBWrvtr5XuujxmmsAelxQ9GVqVfo+IVRMUCRtoAL3KHkqZALm6IjzyjURVHiv Q29vy4M5Q8w2h1NDqT5ZUb6DouBk13/UN3kF3L3IBwrgr52CgbRYu8rrLoN7SD76la1i 0u3ckrFEXFAZxl0bkuzSAjT0/QW1ZAuMxhEQVbwOPZ0ykRmrGqnYcruDVn8thwZ962wD cyChElKk0WoF2AehxxseuMFDVgfGqEKSjOH9ondymZ6htHXQ2QHObNr+O+9w3vjoSpCD ALXQ== X-Gm-Message-State: AOJu0YxO1/o1cC/9q7XlPDhc+RtkaDw2lRRCor7ZObPbUkEOpIC48ZX+ YlU3uYR3riPyTV/Mpei02S8YIdJ+C5/J6FjEegA/yuH/IOSS9paspaX+pAjQTSCuxjpByKWYzIc 14U8= X-Received: by 2002:a05:6000:d0a:b0:362:80af:1adc with SMTP id ffacd0b85a97d-366e4f00a9fmr9077082f8f.53.1719506352181; Thu, 27 Jun 2024 09:39:12 -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 ffacd0b85a97d-3674369ed92sm2384487f8f.105.2024.06.27.09.39.09 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 27 Jun 2024 09:39:11 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Joel Stanley , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Francisco Iglesias , qemu-block@nongnu.org, Sai Pavan Boddu , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= , Bin Meng , Luc Michel Subject: [PATCH 02/11] hw/sd/sdcard: Pass SDState as argument to sd_[a]cmd_name() Date: Thu, 27 Jun 2024 18:38:34 +0200 Message-ID: <20240627163843.81592-3-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240627163843.81592-1-philmd@linaro.org> References: <20240627163843.81592-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42c; envelope-from=philmd@linaro.org; helo=mail-wr1-x42c.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 In order to access SDState::SDProto from sd_[a]cmd_name(), pass SDState as argument. Signed-off-by: Philippe Mathieu-Daudé --- hw/sd/sd.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hw/sd/sd.c b/hw/sd/sd.c index 93a4a4e1b4..f4bdd12b26 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -233,7 +233,7 @@ static const char *sd_response_name(sd_rsp_type_t rsp) return response_name[rsp]; } -static const char *sd_cmd_name(uint8_t cmd) +static const char *sd_cmd_name(SDState *sd, uint8_t cmd) { static const char *cmd_abbrev[SDMMC_CMD_MAX] = { [0] = "GO_IDLE_STATE", [1] = "SEND_OP_COND", @@ -272,7 +272,7 @@ static const char *sd_cmd_name(uint8_t cmd) return cmd_abbrev[cmd] ? cmd_abbrev[cmd] : "UNKNOWN_CMD"; } -static const char *sd_acmd_name(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", @@ -1281,7 +1281,7 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req) uint64_t addr; uint32_t data; - sd->last_cmd_name = sd_cmd_name(req.cmd); + sd->last_cmd_name = sd_cmd_name(sd, req.cmd); /* CMD55 precedes an ACMD, so we are not interested in tracing it. * However there is no ACMD55, so we want to trace this particular case. */ @@ -1748,7 +1748,7 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req) static sd_rsp_type_t sd_app_command(SDState *sd, SDRequest req) { - sd->last_cmd_name = sd_acmd_name(req.cmd); + sd->last_cmd_name = sd_acmd_name(sd, req.cmd); trace_sdcard_app_command(sd->proto->name, sd->last_cmd_name, req.cmd, req.arg, sd_state_name(sd->state)); sd->card_status |= APP_CMD; From patchwork Thu Jun 27 16:38:35 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: 807846 Delivered-To: patch@linaro.org Received: by 2002:adf:e842:0:b0:362:4979:7f74 with SMTP id d2csp896710wrn; Thu, 27 Jun 2024 09:40:02 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVfWsVfndAWy2sOZ2eqjVQs5QNDhadJi9H0tiSP91KQPTlahx8gZNfQaT3QmFoKK3xBTf2ye6a8ZQSP3lvEGkSv X-Google-Smtp-Source: AGHT+IFXzRnt4jfdTBWuufptKiSnO3gROzXP6w6CWrfqvElEUzNd/VB6njingV3wQ7gsG+f57WqH X-Received: by 2002:a05:622a:46:b0:440:5256:9a7f with SMTP id d75a77b69052e-444f8a4152bmr97088251cf.56.1719506402678; Thu, 27 Jun 2024 09:40:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1719506402; cv=none; d=google.com; s=arc-20160816; b=LHPbEbo9o+yC18yR8XwRHCirg/bA4r4b7P1uT8uX1q8Cwmv/GNy0WobXUEcpLq3VLr uf3ZC8IrfpLuBz0/o/BifrpPPRi0vYdKlf18MYpJJwvEtuc7gvwv/B4wjo/TX9LeJxlJ GoUoIrb6ko0XHj1+OMbu4yMGZT6OqHzUEOobifFc7lkwfLETUUwaM1kzpw36nYR6AzLQ dJHqVPBtSlSGackgiG90fbKPq3Tc+PbLcur8AZ+IELo5QPjYAbEBhRisJs/Mfx2nK5L8 WytykTYrZyQVw6uMb0xpStQS0CLlVKHeSxCQMprYriY7l3UIaKbHHAcBu0XgZpTAkD8u Ld0A== 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=/ayYPHbFG82day0p5Ydj8QW5gkkALIElfBxZi1L4r4c=; fh=E5m7+9HN0zGcNIUskxjX+xkpcxQksSinAMYSY8RmZaI=; b=bp4kclAf3t3PRJvVaVlekceIalBFtdrtkmSpsUPQeiFI6dpJ9cztgpow6e69W5m270 BMAozQsWJ+lwCQkm77/59OgWb10txl+RIgFBJwBpaD7bgwlcpxyKtgKb9cU1esVcHbGh qnPAT66ECFx4MjFYdDInn3TOV8LJkfbor8lCmY85LWLKFicRrlYAVUWxLFQuF50HOmiu Y7d27oAzwjehnzU6mFU+stSPHHBfLvlCUGcNEfaq30Vz72ED9ABemvKXSnq/2qVi4bI7 vgBtl1eCyKnY1hTMUc1qp8syBSfbD/x0naf4oNtVbGtCqN5urEFK8BUpMZmpLXLW+zPi dvcw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UYIChhUm; 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-44641f4bdfbsi16161301cf.216.2024.06.27.09.40.02 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 27 Jun 2024 09:40: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=UYIChhUm; 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 1sMs9p-0001Y8-9H; Thu, 27 Jun 2024 12:39:37 -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 1sMs9h-0001Nu-H0 for qemu-devel@nongnu.org; Thu, 27 Jun 2024 12:39:31 -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 1sMs9d-0006te-5S for qemu-devel@nongnu.org; Thu, 27 Jun 2024 12:39:27 -0400 Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-42562fde108so11848395e9.0 for ; Thu, 27 Jun 2024 09:39:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1719506362; x=1720111162; 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=/ayYPHbFG82day0p5Ydj8QW5gkkALIElfBxZi1L4r4c=; b=UYIChhUmOJcnleBmcpREt/DgJPWddMA2TOthXEsrrf63wYXiX223GYMFacMhUe/KtA wiMXXb6HOokSRjOD8UsltcKZL3gTlr4FFR2H4SSFqoB8eOuXYrgfUZdi1AW7/e32MOw0 ZvO3W8DhsmjyT8JXWlLgtUddPOGEuooc/Lqr6+t47ZX873Dc0THTqNHkgll6Pv4fFex3 5GT6O9O/u44Nj1xgRV7/3DqvRtGXlRU9okjVXnDaBwoHMaOoFPcfaL+hFDfhIYAzPCsh 2eHq8I7wBjF/7ca1lrqizMsXPpOSrCFw++d0YbGYmu43H74Bnt5DEfU+puWWuWmqKFfs d7OA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719506362; x=1720111162; 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=/ayYPHbFG82day0p5Ydj8QW5gkkALIElfBxZi1L4r4c=; b=tXZ4uJBAn9b9fTEyJzD8fQYjKKJ6q10NjjtOFPl594DGiU9OmKJZQKGCYshA5fo1e9 3FxGJiC4mY1W8r16uE15hT3tdUVaUIILaM9TMQ4zVUqHmXVVvwNOtzjUJwy6JNNz3sGE L7vheatvzaQZ97HPwGrGOS8lSdSAP5BAcnWyQdBgpyx7RI9l3KLBAbKM+7aUtJ/b6ICC L4/NXuqqqrsxQrkuW+kH6KvNfUgCFrdlrywXbawhQ4KoBBmxUpQTXU+6XXQwuJG24+da XYcXUnqa+Qdtr0W1BRTnU/WoiHr62/VhtE/m9WcEUU9PAUsE/mXZjYbf3ytwH6izLPjc 3DZg== X-Gm-Message-State: AOJu0Yz6/Dcdg/2g9cLOwbOt5vZA7izJBnJSVFzZx85yJYInQmnwwAKx 6NWr9u1GOTaIkN8756n9PRO5WTQtKMDtr1/9pJY1YqDLJJ4Lv3stavnj5RQOMIYh3zgaJQBWmfT cPbI= X-Received: by 2002:a05:600c:4451:b0:422:62db:5a02 with SMTP id 5b1f17b1804b1-4248cc586ddmr104512195e9.32.1719506362086; Thu, 27 Jun 2024 09:39:22 -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-42564bb6d33sm35884925e9.37.2024.06.27.09.39.18 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 27 Jun 2024 09:39:21 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Joel Stanley , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Francisco Iglesias , qemu-block@nongnu.org, Sai Pavan Boddu , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= , Bin Meng , Luc Michel Subject: [PATCH 03/11] hw/sd/sdcard: Prepare SDProto to contain more fields Date: Thu, 27 Jun 2024 18:38:35 +0200 Message-ID: <20240627163843.81592-4-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240627163843.81592-1-philmd@linaro.org> References: <20240627163843.81592-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 Convert array of command handlers to array of structures. The structure contains the command handler. No logical change intended. Signed-off-by: Philippe Mathieu-Daudé --- hw/sd/sd.c | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/hw/sd/sd.c b/hw/sd/sd.c index f4bdd12b26..558c39419d 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -94,8 +94,9 @@ typedef sd_rsp_type_t (*sd_cmd_handler)(SDState *sd, SDRequest req); typedef struct SDProto { const char *name; - sd_cmd_handler cmd[SDMMC_CMD_MAX]; - sd_cmd_handler acmd[SDMMC_CMD_MAX]; + struct { + sd_cmd_handler handler; + } cmd[SDMMC_CMD_MAX], acmd[SDMMC_CMD_MAX]; } SDProto; struct SDState { @@ -1305,8 +1306,8 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req) return sd_illegal; } - if (sd->proto->cmd[req.cmd]) { - return sd->proto->cmd[req.cmd](sd, req); + if (sd->proto->cmd[req.cmd].handler) { + return sd->proto->cmd[req.cmd].handler(sd, req); } switch (req.cmd) { @@ -1753,8 +1754,8 @@ static sd_rsp_type_t sd_app_command(SDState *sd, req.cmd, req.arg, sd_state_name(sd->state)); sd->card_status |= APP_CMD; - if (sd->proto->acmd[req.cmd]) { - return sd->proto->acmd[req.cmd](sd, req); + if (sd->proto->acmd[req.cmd].handler) { + return sd->proto->acmd[req.cmd].handler(sd, req); } switch (req.cmd) { @@ -2267,22 +2268,22 @@ void sd_enable(SDState *sd, bool enable) static const SDProto sd_proto_spi = { .name = "SPI", .cmd = { - [0] = sd_cmd_GO_IDLE_STATE, - [1] = spi_cmd_SEND_OP_COND, + [0] = {sd_cmd_GO_IDLE_STATE}, + [1] = {spi_cmd_SEND_OP_COND}, }, .acmd = { - [41] = spi_cmd_SEND_OP_COND, + [41] = {spi_cmd_SEND_OP_COND}, }, }; static const SDProto sd_proto_sd = { .name = "SD", .cmd = { - [0] = sd_cmd_GO_IDLE_STATE, - [2] = sd_cmd_ALL_SEND_CID, - [3] = sd_cmd_SEND_RELATIVE_ADDR, - [19] = sd_cmd_SEND_TUNING_BLOCK, - [23] = sd_cmd_SET_BLOCK_COUNT, + [0] = {sd_cmd_GO_IDLE_STATE}, + [2] = {sd_cmd_ALL_SEND_CID}, + [3] = {sd_cmd_SEND_RELATIVE_ADDR}, + [19] = {sd_cmd_SEND_TUNING_BLOCK}, + [23] = {sd_cmd_SET_BLOCK_COUNT}, }, }; From patchwork Thu Jun 27 16:38:36 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: 807853 Delivered-To: patch@linaro.org Received: by 2002:adf:e842:0:b0:362:4979:7f74 with SMTP id d2csp897015wrn; Thu, 27 Jun 2024 09:40:42 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCV+WtRCJyzmlSoabZuEpJFwdvfaIl0oLzmaIDV7+7OrQal4suIYN5vWgPl9wV4LtVaipbC6IgcFKgjdItJvUrFo X-Google-Smtp-Source: AGHT+IGL7UUARICBZ3vgmo/M/idqChkM/M1KNApvs+lykwWjab8VzMcUdgAMT4emMB9HE3VlOsT7 X-Received: by 2002:ac8:594a:0:b0:444:a454:8922 with SMTP id d75a77b69052e-444d91a467emr146542831cf.27.1719506442203; Thu, 27 Jun 2024 09:40:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1719506442; cv=none; d=google.com; s=arc-20160816; b=MV2E2QYnVxTxnPDwR5NRgJG9xZELT8mYAjxLpjkOXkyFf9QRu2Sh5t6CNJVZY3yCcI vJoWafLPBWhEQsPloMnuNmBLzNOOslN73kvlyPnPH3V7bTdJTcZArLj8Ws25mL3pLpCR h8LZDO/Kqb4icTwtx3To8gfS6+crUBAfYOQq6g0hxlICYL7ncVVFt4v1Bgnn1vgzrcGx Wb06vccEBW+jDx9iH7rptAnmh7u6BPSvYyGfhaPN/N5z88x1xvZ8OfXqFAy10c95HU+V RoVgrxZs8xf+LDvRMPH5mCksc58c+tmBPh4yDe4pZgJtEAX9Y/Z9PGKquc7xeQJGa+0p kUIQ== 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=YXDu/2edCnmMgqMgCJOWOkUUywr5VZFDkGviAHlkFf4=; fh=E5m7+9HN0zGcNIUskxjX+xkpcxQksSinAMYSY8RmZaI=; b=CVjuU58Zjb7GOgTqJv/sB4rCEgRne4t2Wc7KbE7oZAraxDAPazLf1jmyNJbZEsD1cG j8N+YFOdiyBgfVnNWsdl7hwei2iWHeN2vATEON0+JjRc5O8n9QXyIrOsszQm5dmGAAYd +89sVbzxwyNWLoIcGjcW57uhm+EM9dlYjl15y1z3dVgn7fj3GLDqNLMh8uxw2W9s8gZc 4DMihLwvF3hy0bmhaPOZRZX21C/mkpi9NFdoFwVJUdvNI57JNo4Y2Knlw6SNr0vDyDMV rxFuVnjRm70kkRMMTBgmn56VtyKz5OYESw4m4nxfHVZq8dEevi29+Tq2Bqzs9SQkUcL7 WCJA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=URXHyzaY; 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-44641ef9196si15679961cf.87.2024.06.27.09.40.42 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 27 Jun 2024 09:40:42 -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=URXHyzaY; 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 1sMsA6-0001kV-5J; Thu, 27 Jun 2024 12:39: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 1sMs9r-0001fV-Hx for qemu-devel@nongnu.org; Thu, 27 Jun 2024 12:39:41 -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 1sMs9p-0006ug-Qc for qemu-devel@nongnu.org; Thu, 27 Jun 2024 12:39:39 -0400 Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-424aa70fbc4so19168125e9.1 for ; Thu, 27 Jun 2024 09:39:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1719506374; x=1720111174; 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=YXDu/2edCnmMgqMgCJOWOkUUywr5VZFDkGviAHlkFf4=; b=URXHyzaYJFwTWnRi5TxkntlLX27tOhs8s2iw6Brj7udNdOI6gT6lNjEWCIH/Z6M9Eu 5P/wMsxHmshHy8gdpDxiEbMTT2zrrRtlbGiZMohcY4TqnmY55M3oh5CRLbPYID7mLbuu R0EHq4Ty1XmJpXh1CNkMMRIkJ1Egnem6HweSvUdn2znNmEatBmEuiNDHCSguD2l5VLn9 JQ1DfQWq5cZBXNVj4r2W8riZ57PbBVcZDOLznEZaHHclTA2JomOdcnlEszCqR7lBQGij BG5X2RfZBg5nz3Trta3R3MuTJ+Hn/wwus1b0h69qlvM3YJOZa7XbzE39SylvTSlXADbp Sr0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719506374; x=1720111174; 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=YXDu/2edCnmMgqMgCJOWOkUUywr5VZFDkGviAHlkFf4=; b=vasUM70tlc/3zCJx+luDKOM08oZPx0ZGpQ0nAqdRLcYi0fZsP65m1OKWXD1aklZuP/ mrSx1jyQPJWpFVykRgzXgkm0n1jO5TfdRHAl4EOIrzXgiBX9c8ToTHtNwdNGqmCxdpgl krftnnbesgE/Gi7Hd2Slm/CiH5P/WMZkBJOsGXnwi1CW4OmFfJIx8vGstFeWOoDKWAsr 4QBQmXuKDPf1or6fAWBNKL5kB2h+LS/ymAHcOww/x909X+eKm4UCtqIPqDr2/bXFBxex Pf7KhEfN950yJOrlqUO2TxdlrWgKL8dywmr34tnDCcYxxWI7U4LUGNvTOl4p7kBypWNv dG4g== X-Gm-Message-State: AOJu0YwybmFeDHt0l+BZV6mz2oS3pC/MXva/a2QXPTtuRHcd4qrreOfH 7yrMOwUIhDh3Tjyk431zMpRzqo4qfJw1FS9jQW3crwvlI3M5IVGjKzPXhgxpLAgLBJh/86EZKP8 enDk= X-Received: by 2002:a05:600c:4994:b0:425:5f6d:2f3c with SMTP id 5b1f17b1804b1-4255f6d32cfmr34598845e9.39.1719506374004; Thu, 27 Jun 2024 09:39:34 -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-42564a4f024sm35025525e9.1.2024.06.27.09.39.30 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 27 Jun 2024 09:39:33 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Joel Stanley , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Francisco Iglesias , qemu-block@nongnu.org, Sai Pavan Boddu , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= , Bin Meng , Luc Michel Subject: [PATCH 04/11] hw/sd/sdcard: Store command name in SDProto Date: Thu, 27 Jun 2024 18:38:36 +0200 Message-ID: <20240627163843.81592-5-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240627163843.81592-1-philmd@linaro.org> References: <20240627163843.81592-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=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 We already have a const array where command handlers are listed. Store the command name there too. Signed-off-by: Philippe Mathieu-Daudé --- hw/sd/sd.c | 35 ++++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/hw/sd/sd.c b/hw/sd/sd.c index 558c39419d..97fb3785ee 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -95,6 +95,7 @@ typedef sd_rsp_type_t (*sd_cmd_handler)(SDState *sd, SDRequest req); typedef struct SDProto { const char *name; struct { + const char *name; sd_cmd_handler handler; } cmd[SDMMC_CMD_MAX], acmd[SDMMC_CMD_MAX]; } SDProto; @@ -237,8 +238,6 @@ static const char *sd_response_name(sd_rsp_type_t rsp) static const char *sd_cmd_name(SDState *sd, uint8_t cmd) { static const char *cmd_abbrev[SDMMC_CMD_MAX] = { - [0] = "GO_IDLE_STATE", [1] = "SEND_OP_COND", - [2] = "ALL_SEND_CID", [3] = "SEND_RELATIVE_ADDR", [4] = "SET_DSR", [5] = "IO_SEND_OP_COND", [6] = "SWITCH_FUNC", [7] = "SELECT/DESELECT_CARD", [8] = "SEND_IF_COND", [9] = "SEND_CSD", @@ -246,9 +245,8 @@ static const char *sd_cmd_name(SDState *sd, uint8_t cmd) [12] = "STOP_TRANSMISSION", [13] = "SEND_STATUS", [15] = "GO_INACTIVE_STATE", [16] = "SET_BLOCKLEN", [17] = "READ_SINGLE_BLOCK", - [18] = "READ_MULTIPLE_BLOCK", [19] = "SEND_TUNING_BLOCK", + [18] = "READ_MULTIPLE_BLOCK", [20] = "SPEED_CLASS_CONTROL", [21] = "DPS_spec", - [23] = "SET_BLOCK_COUNT", [24] = "WRITE_BLOCK", [25] = "WRITE_MULTIPLE_BLOCK", [26] = "MANUF_RSVD", [27] = "PROGRAM_CSD", [28] = "SET_WRITE_PROT", [29] = "CLR_WRITE_PROT", @@ -270,6 +268,12 @@ static const char *sd_cmd_name(SDState *sd, uint8_t cmd) [60] = "MANUF_RSVD", [61] = "MANUF_RSVD", [62] = "MANUF_RSVD", [63] = "MANUF_RSVD", }; + const SDProto *sdp = sd->proto; + + if (sdp->cmd[cmd].handler) { + assert(!cmd_abbrev[cmd]); + return sdp->cmd[cmd].name; + } return cmd_abbrev[cmd] ? cmd_abbrev[cmd] : "UNKNOWN_CMD"; } @@ -282,7 +286,6 @@ static const char *sd_acmd_name(SDState *sd, uint8_t cmd) [16] = "DPS_spec", [18] = "SECU_spec", [22] = "SEND_NUM_WR_BLOCKS", [23] = "SET_WR_BLK_ERASE_COUNT", - [41] = "SD_SEND_OP_COND", [42] = "SET_CLR_CARD_DETECT", [51] = "SEND_SCR", [52] = "SECU_spec", [53] = "SECU_spec", @@ -290,6 +293,12 @@ static const char *sd_acmd_name(SDState *sd, uint8_t cmd) [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"; } @@ -2268,22 +2277,22 @@ void sd_enable(SDState *sd, bool enable) static const SDProto sd_proto_spi = { .name = "SPI", .cmd = { - [0] = {sd_cmd_GO_IDLE_STATE}, - [1] = {spi_cmd_SEND_OP_COND}, + [0] = { "GO_IDLE_STATE", sd_cmd_GO_IDLE_STATE}, + [1] = { "SEND_OP_COND", spi_cmd_SEND_OP_COND}, }, .acmd = { - [41] = {spi_cmd_SEND_OP_COND}, + [41] = { "SEND_OP_COND", spi_cmd_SEND_OP_COND}, }, }; static const SDProto sd_proto_sd = { .name = "SD", .cmd = { - [0] = {sd_cmd_GO_IDLE_STATE}, - [2] = {sd_cmd_ALL_SEND_CID}, - [3] = {sd_cmd_SEND_RELATIVE_ADDR}, - [19] = {sd_cmd_SEND_TUNING_BLOCK}, - [23] = {sd_cmd_SET_BLOCK_COUNT}, + [0] = { "GO_IDLE_STATE", sd_cmd_GO_IDLE_STATE}, + [2] = { "ALL_SEND_CID", sd_cmd_ALL_SEND_CID}, + [3] = { "SEND_RELATIVE_ADDR", sd_cmd_SEND_RELATIVE_ADDR}, + [19] = { "SEND_TUNING_BLOCK", sd_cmd_SEND_TUNING_BLOCK}, + [23] = { "SET_BLOCK_COUNT", sd_cmd_SET_BLOCK_COUNT}, }, }; From patchwork Thu Jun 27 16:38:37 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: 807849 Delivered-To: patch@linaro.org Received: by 2002:adf:e842:0:b0:362:4979:7f74 with SMTP id d2csp896756wrn; Thu, 27 Jun 2024 09:40:08 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUL/6lBFjM2V+JuGN6t5mk3orje9GuuJslchPPIKUs4eZPrisMvmUI1JjY7DaWhGOLPqywfngD1RTZQsqBbMUsq X-Google-Smtp-Source: AGHT+IF3FqApE91wR5FLgwRLvQk3wJglOygf32cv4s+Ob6ljGFXA/Sj1sRKTDNVqilL3gIVrRyGy X-Received: by 2002:a05:622a:95:b0:446:4c01:1f79 with SMTP id d75a77b69052e-4464c0123f0mr10854421cf.39.1719506408028; Thu, 27 Jun 2024 09:40:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1719506408; cv=none; d=google.com; s=arc-20160816; b=lV375INuOUCma2KpvPivar9qmtK6yw3H/yEeFtLjxdtgl7n3VERgfRzW1qV4PXFeRr QTr61lTyfIECxZMZfGnsUQRgCKnbz39a+OEuBdlZRxdQ88/GM4anrFrA7Uwflp7u2wYQ mS00nbrFaUNYyVe1yRWwit/qPJDCyewSxpMR35aA2D6VXXCnY96+foaWaa5/TBtf3eXd 7Zc21w+6XwpWPuOdulv0K6HuQvnN1OeT9XHuxIc006Ba8xVS8V023ACyWV30mtdLvaQS WMeg1v8xZxWJSddfo7FXr+3Y8RTDWMqDZak/UMHvMBeZVuj3WwZPnW38VmmPSgQ3A7B9 KrOQ== 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=FQYmSrnXt5mY866BTgrOijDYx76JFvHs12wH0ygKj7I=; fh=E5m7+9HN0zGcNIUskxjX+xkpcxQksSinAMYSY8RmZaI=; b=Ig9yT517VubaLKe9zRpkctuZe/nXHtHW5x9cXxgMO7MIyKMl92GEg+fx/nGST+Ut0J E3XUXSOsYKe1mg3NdnFVXQIEbulkIOiFzg9pxb45fti/+88ZzSi3BBlAz4HNRAZK+67U aL+oJLHEoO5DalebCX6qA3U+GeWexurM+0oXJZaRvLnSfJujf3Yk9VCDqW7NnNCyW09s mXtePHnyXolQU9slsTEyL6SePxj2tSLFRVcHTWBN2SKinT5a/bFBEW0BttrkmwG8KMx1 30wjuSLHbXcJsGHV062RIZ+v6nR0ZJO6d5I9gFsIAQOeGa3MzC5JedvIAcv/LQlLXKk8 ma6A==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Qlb2GJxX; 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-446421f8e99si15762061cf.606.2024.06.27.09.40.07 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 27 Jun 2024 09:40:08 -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=Qlb2GJxX; 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 1sMsA9-00024O-GX; Thu, 27 Jun 2024 12:39:57 -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 1sMsA3-0001mg-Bo for qemu-devel@nongnu.org; Thu, 27 Jun 2024 12:39:52 -0400 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sMs9w-0006vW-PE for qemu-devel@nongnu.org; Thu, 27 Jun 2024 12:39:51 -0400 Received: by mail-wr1-x432.google.com with SMTP id ffacd0b85a97d-36733f09305so943456f8f.3 for ; Thu, 27 Jun 2024 09:39:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1719506383; x=1720111183; 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=FQYmSrnXt5mY866BTgrOijDYx76JFvHs12wH0ygKj7I=; b=Qlb2GJxXRJ97tVKLuaQka19908qnT7nwtxqhPCOvAsRgOiN19IqBHpQLE3dFgr9+Sd sPSfIL9Ys8lGjIPRsDdawuSiv8HWgggTq3kBfI4RMkEihnZQ1hU1pj0umKyUbPP/qbCi mK+lQYv7KS0mmVuhqfZDhCAQlletdK+oOVEMjqsKp6Z6BoCUOvtb9MTcGI7cw7zaeCHr CMXK0AJiGlAeCpjZtGBYfoyLUyjpE0uuB3wMfSBlNWoUttoDG8D7NKWEGaTuEEaobBJc YaT7DcTr0gJpSjRsJvM/rbiMQGxdBjAXvxp5Q1p0eLPy5V1mGEzEEnAk1UOVBQLzezDZ 0vZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719506383; x=1720111183; 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=FQYmSrnXt5mY866BTgrOijDYx76JFvHs12wH0ygKj7I=; b=OlngTSKO/1fZtpEIJ8vgeyf/gm4AznuIxDCmGOS9aA9RX8CFFJzAZEKDEQ3BwK1XsW 5JBJ4/ZPJq3iWv3+Pyiam/l7oMJg7pcHRstQvCNfskBYOKUqES3qEufNWWLDn+EhPROX roygS8jqNsyY8HbZ0XCr6v7D+603lo6JVP5kjhJR296ox04evJjQrJI65mQndbS++ag0 bUTW+CpDQQMCPBA03u9St0ZS977VajLLEwnlH0WmZehDOtikPrr9RGaLBgX+sJB95wG9 VQI677oKZ7znVb/8aQ6gshWmYLzntdJFfTwxxwl5BhKJJC/mCZH3D7Prw+L93eK/vq1/ FWDA== X-Gm-Message-State: AOJu0YzcxrPwLK1MHwPNOlmnb1aRAryQOhoK2JP7jAjzrBwOjff4VBKF 6WvqtJCaYHx1uwRCnBaM+NnunYuAeMrwqhRJVStZ2UIP1wgdTVqtPgnvk9Y7UGmTedfHkuh+OAG BsEo= X-Received: by 2002:a5d:6487:0:b0:362:5a6e:2649 with SMTP id ffacd0b85a97d-366e7a56dedmr13977062f8f.56.1719506383178; Thu, 27 Jun 2024 09:39:43 -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 ffacd0b85a97d-3674357c089sm2442223f8f.7.2024.06.27.09.39.39 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 27 Jun 2024 09:39:42 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Joel Stanley , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Francisco Iglesias , qemu-block@nongnu.org, Sai Pavan Boddu , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= , Bin Meng , Luc Michel Subject: [PATCH 05/11] hw/sd/sdcard: Store command type in SDProto Date: Thu, 27 Jun 2024 18:38:37 +0200 Message-ID: <20240627163843.81592-6-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240627163843.81592-1-philmd@linaro.org> References: <20240627163843.81592-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::432; envelope-from=philmd@linaro.org; helo=mail-wr1-x432.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 Store the command type altogether with the command handler and name. Signed-off-by: Philippe Mathieu-Daudé --- include/hw/sd/sd.h | 5 +++-- hw/sd/sd.c | 44 ++++++++++++++++++++------------------------ 2 files changed, 23 insertions(+), 26 deletions(-) diff --git a/include/hw/sd/sd.h b/include/hw/sd/sd.h index 2c8748fb9b..29c76935a0 100644 --- a/include/hw/sd/sd.h +++ b/include/hw/sd/sd.h @@ -76,8 +76,9 @@ typedef enum { } sd_uhs_mode_t; typedef enum { - sd_none = -1, - sd_bc = 0, /* broadcast -- no response */ + sd_none = 0, + sd_spi, + sd_bc, /* broadcast -- no response */ sd_bcr, /* broadcast with response */ sd_ac, /* addressed -- no data transfer */ sd_adtc, /* addressed with data transfer */ diff --git a/hw/sd/sd.c b/hw/sd/sd.c index 97fb3785ee..c4cc48926d 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -95,6 +95,7 @@ typedef sd_rsp_type_t (*sd_cmd_handler)(SDState *sd, SDRequest req); typedef struct SDProto { const char *name; struct { + const sd_cmd_type_t type; const char *name; sd_cmd_handler handler; } cmd[SDMMC_CMD_MAX], acmd[SDMMC_CMD_MAX]; @@ -351,20 +352,6 @@ static void sd_set_mode(SDState *sd) } } -static const sd_cmd_type_t sd_cmd_type[SDMMC_CMD_MAX] = { - sd_bc, sd_none, sd_bcr, sd_bcr, sd_none, sd_none, sd_none, sd_ac, - sd_bcr, sd_ac, sd_ac, sd_adtc, sd_ac, sd_ac, sd_none, sd_ac, - /* 16 */ - sd_ac, sd_adtc, sd_adtc, sd_none, sd_none, sd_none, sd_none, sd_none, - sd_adtc, sd_adtc, sd_adtc, sd_adtc, sd_ac, sd_ac, sd_adtc, sd_none, - /* 32 */ - sd_ac, sd_ac, sd_none, sd_none, sd_none, sd_none, sd_ac, sd_none, - sd_none, sd_none, sd_bc, sd_none, sd_none, sd_none, sd_none, sd_none, - /* 48 */ - sd_none, sd_none, sd_none, sd_none, sd_none, sd_none, sd_none, sd_ac, - sd_adtc, sd_none, sd_none, sd_none, sd_none, sd_none, sd_none, sd_none, -}; - static const int sd_cmd_class[SDMMC_CMD_MAX] = { 0, 0, 0, 0, 0, 9, 10, 0, 0, 0, 0, 1, 0, 0, 0, 0, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 6, 6, 6, 6, @@ -571,10 +558,19 @@ static void sd_set_rca(SDState *sd, uint16_t value) static uint16_t sd_req_get_rca(SDState *s, SDRequest req) { - if (sd_cmd_type[req.cmd] == sd_ac || sd_cmd_type[req.cmd] == sd_adtc) { + 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; } - return 0; } /* Card Status register */ @@ -2277,22 +2273,22 @@ void sd_enable(SDState *sd, bool enable) static const SDProto sd_proto_spi = { .name = "SPI", .cmd = { - [0] = { "GO_IDLE_STATE", sd_cmd_GO_IDLE_STATE}, - [1] = { "SEND_OP_COND", spi_cmd_SEND_OP_COND}, + [0] = { sd_spi, "GO_IDLE_STATE", sd_cmd_GO_IDLE_STATE}, + [1] = { sd_spi, "SEND_OP_COND", spi_cmd_SEND_OP_COND}, }, .acmd = { - [41] = { "SEND_OP_COND", spi_cmd_SEND_OP_COND}, + [41] = { sd_spi, "SEND_OP_COND", spi_cmd_SEND_OP_COND}, }, }; static const SDProto sd_proto_sd = { .name = "SD", .cmd = { - [0] = { "GO_IDLE_STATE", sd_cmd_GO_IDLE_STATE}, - [2] = { "ALL_SEND_CID", sd_cmd_ALL_SEND_CID}, - [3] = { "SEND_RELATIVE_ADDR", sd_cmd_SEND_RELATIVE_ADDR}, - [19] = { "SEND_TUNING_BLOCK", sd_cmd_SEND_TUNING_BLOCK}, - [23] = { "SET_BLOCK_COUNT", sd_cmd_SET_BLOCK_COUNT}, + [0] = { sd_bc, "GO_IDLE_STATE", sd_cmd_GO_IDLE_STATE}, + [2] = { sd_bcr, "ALL_SEND_CID", sd_cmd_ALL_SEND_CID}, + [3] = { sd_bcr, "SEND_RELATIVE_ADDR", sd_cmd_SEND_RELATIVE_ADDR}, + [19] = { sd_adtc, "SEND_TUNING_BLOCK", sd_cmd_SEND_TUNING_BLOCK}, + [23] = { sd_ac, "SET_BLOCK_COUNT", sd_cmd_SET_BLOCK_COUNT}, }, }; From patchwork Thu Jun 27 16:38:38 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: 807850 Delivered-To: patch@linaro.org Received: by 2002:adf:e842:0:b0:362:4979:7f74 with SMTP id d2csp896908wrn; Thu, 27 Jun 2024 09:40:27 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCX6tQKQSlvnlpdTVsfIcos0KH4sHcRyA+P2UuzyMhHCmkni9GZdz+Utfq9uwoVpNxrT98aHpeFY7Lk0MHxObgZf X-Google-Smtp-Source: AGHT+IGEI+GCJWQlr+TNpwSfrq3VZ+IZjjAT+ZQC/UpfGEvG+S0dxqK0XfSRPMmzr/q4yeaVuvYH X-Received: by 2002:a05:620a:170f:b0:79a:2fcb:ed5a with SMTP id af79cd13be357-79be0bfd6f3mr1666207585a.11.1719506427210; Thu, 27 Jun 2024 09:40:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1719506427; cv=none; d=google.com; s=arc-20160816; b=Uta2BpeawW2gqC9qnl1Ytx/+DUU4Hqza2ZDw6O+ThywbrS09zKNvNXSIKx0qJ+oIxu m78IdlgAvOv6sGlg7GG0hH/eSkkvZvIkEJniWiK27MfsvVlE94UWulrisMn3++FrmSp1 063K9yVuWHW2NaiW5xeSZGzkgio+3WiI6LWFyEDrKgLsUvcuJ6NTzfl2bGXQdLmt5vUr GdbRD+P72H113SKU5p6+dIKWPryWTlzh2YaqwH7p7UtgI7h2Y0xvKa4OliHgAFyOgUh9 Aq0sOFMgE7l5rSgMzzAmD8rHnZ11HJGZoJCVNXGHLWelxhMVVB9h+nJS8r0CWoT01neR 30ng== 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=O7w8iWHuHLj1qqdMh1OWVQD6LygpPO88gA0me6KT8+s=; fh=E5m7+9HN0zGcNIUskxjX+xkpcxQksSinAMYSY8RmZaI=; b=dQZ9amrkx17xGbpOGxU9+DbXR4y3v7vu/b18k6Xwm5nXJGU4FWfJvnpJY7GRUj1+dD 6yT07ZqyTipMNxWnvJ6vZOxh6wD76L6mb9qFf4kPB/t0iOf/GK8Jsro52QDGlIN+BYqZ sugTUK4uMQnK5zAjQ++zKM5EZm+qvggMd8VqdQRyP+YSPVEEwemisq+S6IQ0FBi41OlC soyYCGHnRuPje7crAGVcbmJYnK8tm8HG4cx/JDroxVQGGB2XbiMt/uKR5ZHdgwnNVIKd jU7+VIOw39kzBsVSfEfeTJgZm9GoKl8n/RmxyeKc6Gylu4ZhlCFljm3oru+3wR7FsR9u 0KYw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=xulGlB35; 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-79d5c8e1b3dsi165930385a.693.2024.06.27.09.40.26 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 27 Jun 2024 09:40:27 -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=xulGlB35; 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 1sMsAC-0002Jm-MG; Thu, 27 Jun 2024 12:40:01 -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 1sMsAA-0002Cn-GI for qemu-devel@nongnu.org; Thu, 27 Jun 2024 12:39:58 -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 1sMsA7-0006wM-BE for qemu-devel@nongnu.org; Thu, 27 Jun 2024 12:39:58 -0400 Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-42122ac2f38so13077225e9.1 for ; Thu, 27 Jun 2024 09:39:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1719506393; x=1720111193; 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=O7w8iWHuHLj1qqdMh1OWVQD6LygpPO88gA0me6KT8+s=; b=xulGlB35WaTYVPJLVTnASDz/Udifw7yu7EcAf/k8MV/U8fdDRRaHqh/g3NC41JHlqK u+S+gix1r+k8ZM/CQdhGyyda7YPZ1YKPXWbwfsZXJVhtzIFEcrgxBbiDQSXP6IzzKOZ5 wWPwQX5Z/umc/UHqyhBeMDqUdJG3NWckRZBg1d++fCsjokVSd8XBfwLm8pjxvX+VQ1VU DLHSnbKZhFp7fI4me+Eo0yMeCdzt1uqZ2pC30L+F+m2Yf8L27SyeTNvzW67ubxrz6rXU aQCU3Wt3dek9BNZvT7c0WUTQBCrGV8cOODhd3NtH9TQPOoyJp7oHzEp6rTMtEMUktzeV timg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719506393; x=1720111193; 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=O7w8iWHuHLj1qqdMh1OWVQD6LygpPO88gA0me6KT8+s=; b=GJwhaRdVqVHXt1vc3XzOe/6xSXinAapHss7YXI6Nb7rZnUpAD2ilKheLQ/I4Gf8HXU ZpOurDl6c+e5UN6A5OgBKtJsIgxK8OOndb5r4+Vmsb/qXg9wPfqpAJ7pB2b7iFvRKG7x hhWbFGYzKWYR+XxcIREiJf8m1tW+hBrbbNwEfFk3/1+AdRJxxjlvbTA+mdSFEFdOJ7er y30v6npYof704cZzw8KxAyHhnzvqWOwA9zvDjjRxR+diS1aBl5RWeK4WTmGQxlsYB1rE abAJ8nQI9LrxVQWMIoPF/AHKGJ+CwxmFsBZey1BcEE3lM3/HQ+ZnhDFw3wrg8E2dlVlW GNGg== X-Gm-Message-State: AOJu0YyEPUABeC7Sp/DAZ/504xBBUSLip+CWd/A0Xo355i480l0159al N/GzL2C2SwTqudbnsVh8leB5GYPFS2EJyLv4FzCeLRF294CYDCXP8sIxR3zZfcNE/hIJPOlItDp W3wc= X-Received: by 2002:a05:600c:4a06:b0:421:8234:9bb4 with SMTP id 5b1f17b1804b1-42563126c2dmr32558455e9.19.1719506393602; Thu, 27 Jun 2024 09:39:53 -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-424c82519c8sm77443365e9.16.2024.06.27.09.39.49 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 27 Jun 2024 09:39:53 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Joel Stanley , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Francisco Iglesias , qemu-block@nongnu.org, Sai Pavan Boddu , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= , Bin Meng , Luc Michel Subject: [PATCH 06/11] hw/sd/sdcard: Store command class in SDProto Date: Thu, 27 Jun 2024 18:38:38 +0200 Message-ID: <20240627163843.81592-7-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240627163843.81592-1-philmd@linaro.org> References: <20240627163843.81592-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 Store the command class altogether with the other command fields (handler, name and type). Signed-off-by: Philippe Mathieu-Daudé --- hw/sd/sd.c | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/hw/sd/sd.c b/hw/sd/sd.c index c4cc48926d..a816493d37 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -95,6 +95,7 @@ typedef sd_rsp_type_t (*sd_cmd_handler)(SDState *sd, SDRequest req); typedef struct SDProto { const char *name; struct { + const unsigned class; const sd_cmd_type_t type; const char *name; sd_cmd_handler handler; @@ -352,13 +353,6 @@ static void sd_set_mode(SDState *sd) } } -static const int sd_cmd_class[SDMMC_CMD_MAX] = { - 0, 0, 0, 0, 0, 9, 10, 0, 0, 0, 0, 1, 0, 0, 0, 0, - 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 6, 6, 6, 6, - 5, 5, 10, 10, 10, 10, 5, 9, 9, 9, 7, 7, 7, 7, 7, 7, - 7, 7, 10, 7, 9, 9, 9, 8, 8, 10, 8, 8, 8, 8, 8, 8, -}; - static uint8_t sd_crc7(const void *message, size_t width) { int i, bit; @@ -1306,7 +1300,8 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req) sd->multi_blk_cnt = 0; } - if (sd_cmd_class[req.cmd] == 6 && FIELD_EX32(sd->ocr, OCR, CARD_CAPACITY)) { + if (sd->proto->cmd[req.cmd].class == 6 && FIELD_EX32(sd->ocr, OCR, + CARD_CAPACITY)) { /* Only Standard Capacity cards support class 6 commands */ return sd_illegal; } @@ -1891,6 +1886,8 @@ static sd_rsp_type_t sd_app_command(SDState *sd, static bool cmd_valid_while_locked(SDState *sd, unsigned cmd) { + unsigned cmd_class; + /* Valid commands in locked state: * basic class (0) * lock card class (7) @@ -1905,7 +1902,12 @@ static bool cmd_valid_while_locked(SDState *sd, unsigned cmd) if (cmd == 16 || cmd == 55) { return true; } - return sd_cmd_class[cmd] == 0 || sd_cmd_class[cmd] == 7; + if (!sd->proto->cmd[cmd].handler) { + return false; + } + cmd_class = sd->proto->cmd[cmd].class; + + return cmd_class == 0 || cmd_class == 7; } int sd_do_command(SDState *sd, SDRequest *req, @@ -2273,22 +2275,22 @@ void sd_enable(SDState *sd, bool enable) static const SDProto sd_proto_spi = { .name = "SPI", .cmd = { - [0] = { sd_spi, "GO_IDLE_STATE", sd_cmd_GO_IDLE_STATE}, - [1] = { sd_spi, "SEND_OP_COND", spi_cmd_SEND_OP_COND}, + [0] = {0, sd_spi, "GO_IDLE_STATE", sd_cmd_GO_IDLE_STATE}, + [1] = {0, sd_spi, "SEND_OP_COND", spi_cmd_SEND_OP_COND}, }, .acmd = { - [41] = { sd_spi, "SEND_OP_COND", spi_cmd_SEND_OP_COND}, + [41] = {8, sd_spi, "SEND_OP_COND", spi_cmd_SEND_OP_COND}, }, }; static const SDProto sd_proto_sd = { .name = "SD", .cmd = { - [0] = { sd_bc, "GO_IDLE_STATE", sd_cmd_GO_IDLE_STATE}, - [2] = { sd_bcr, "ALL_SEND_CID", sd_cmd_ALL_SEND_CID}, - [3] = { sd_bcr, "SEND_RELATIVE_ADDR", sd_cmd_SEND_RELATIVE_ADDR}, - [19] = { sd_adtc, "SEND_TUNING_BLOCK", sd_cmd_SEND_TUNING_BLOCK}, - [23] = { sd_ac, "SET_BLOCK_COUNT", sd_cmd_SET_BLOCK_COUNT}, + [0] = {0, sd_bc, "GO_IDLE_STATE", sd_cmd_GO_IDLE_STATE}, + [2] = {0, sd_bcr, "ALL_SEND_CID", sd_cmd_ALL_SEND_CID}, + [3] = {0, sd_bcr, "SEND_RELATIVE_ADDR", sd_cmd_SEND_RELATIVE_ADDR}, + [19] = {2, sd_adtc, "SEND_TUNING_BLOCK", sd_cmd_SEND_TUNING_BLOCK}, + [23] = {2, sd_ac, "SET_BLOCK_COUNT", sd_cmd_SET_BLOCK_COUNT}, }, }; From patchwork Thu Jun 27 16:38:39 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: 807851 Delivered-To: patch@linaro.org Received: by 2002:adf:e842:0:b0:362:4979:7f74 with SMTP id d2csp896914wrn; Thu, 27 Jun 2024 09:40:28 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVru4iQZjWoeiWTTiV9wfCI9BXV3MKmvc9sTPC421w6fMnsC06S9ZrMLv9P+8r35hrx+zSkNUuNuBmep5mripq7 X-Google-Smtp-Source: AGHT+IFF6TDz4V6O68xl3mzwWLAc2nQuhYrQDTGLHS689KdcuVbLD1bq+LNF7m/zxCrUIJsBZhqZ X-Received: by 2002:a05:622a:3d1:b0:446:448d:8e26 with SMTP id d75a77b69052e-446448daf96mr17170621cf.54.1719506427806; Thu, 27 Jun 2024 09:40:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1719506427; cv=none; d=google.com; s=arc-20160816; b=Gf+MoGZ08f0JMtYmyvKP4/mekiUpt6b8/2srdzcSI0JEwmdH0DK60ebBWwCHKvuLwt OuYJRDQSIBQoec6pJzPuVo+1KjN8UKNoVtmT/lE1h2KrFVEtNicEzNML2/hTDxubn3Zb /mO1GXHfFfxFgO3w23iV9QihgtGLlrf+SeYV4LcBpA6s8fmD0pN80gjfEDU/1xFf37oP or1OVlUJG/HZyZs+R5f8TlSS5eGJNgl9lbDXcMHpN0RRWCHbKSfEYAzXcnxEFORRBDCN TK+DOXrx2VieXTlYG1bMsu8byxpR6MQpGsheM23ZRO079kY/IqLHcMxGemFwBWNfQh6R E71w== 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=W8MZ6mDUZDTzEHMhB6amOhsFMea88t3Iug/OVUXgLHk=; fh=E5m7+9HN0zGcNIUskxjX+xkpcxQksSinAMYSY8RmZaI=; b=WSLzzuU2mIq5DwgoFokuJWJPYXwMoGiZEVn4Xtu1D0lEHn8MGSakMAHG7+bT61fN2x QcDXt9o0plNvDOzDeAs/XlDPeLFzZSwUtzMj7J0Z7VM8avEYuZ/iu3Cnc19lYsM4JMnJ XcU6trkXfrar5p+d1lCFAsWsbw3gXncina2d3Zs0yKIZZBUshKadQ03XkEriwzz/uvDk 25DCHRa6Iz0+HYAR+Ul2LLtfLPyuAt6HRrp1hi3SI1I6St7Yx5tad+FBDULXUlQa0FfW /mt9YZ5Sy42aimXJFo9+7yiJEglUfIVgd6QWD48omLA0C957ytii5GuNx64Jx7G+TuYB BU5g==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=nyIWwoFQ; 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-44642029419si18028631cf.247.2024.06.27.09.40.27 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 27 Jun 2024 09:40:27 -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=nyIWwoFQ; 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 1sMsAW-000328-QY; Thu, 27 Jun 2024 12:40:20 -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 1sMsAT-0002pr-Ch for qemu-devel@nongnu.org; Thu, 27 Jun 2024 12:40:19 -0400 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sMsAJ-0007B2-59 for qemu-devel@nongnu.org; Thu, 27 Jun 2024 12:40:17 -0400 Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-42561c16ffeso13608125e9.3 for ; Thu, 27 Jun 2024 09:40:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1719506405; x=1720111205; 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=W8MZ6mDUZDTzEHMhB6amOhsFMea88t3Iug/OVUXgLHk=; b=nyIWwoFQj97vio3Q/DVDtQKN1qy6wevdFZ01B2rGvAOtPi1dmNgkq+I3TGLYllPf5T jCBnA5CRdu5bj+4tbsc48C+f4TjTRNC3Kj3ALcHDGnEeIXxPI4pJ38PyDJOdjzbPNJWB DiriMu7WGcq6QCYGh+cBHsAiD64JAGV0b701vVV1jEWddw+cBa6bF9yCivtBFAGjRpDA HldaINXLxig5ZSGf4R+nF8WDiveDA3zn4AWUunokNIe6aJk3idSopcycfXB2n2tCmBhg k+xZr6eyQYwgJF7debx9OWbuWoZpIOAv/O151iDV1Fasgi1B74Ggg+BlSr/o4B0mype0 Oh3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719506405; x=1720111205; 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=W8MZ6mDUZDTzEHMhB6amOhsFMea88t3Iug/OVUXgLHk=; b=A2aC+RWggtbzqlZ+b+3x9RD8ZAXzckKel5PAefY5XdbvlTLB1+8SRsfneo71P+Obc/ ebXJXsdhcKIzncQssw3HAy7C/DbV0djbB0mUPn3Os5YOR1J2C7WcohvkZZvjmGc9eiqf nxKlr7znSpLLGHPbrPNU62ENv/URKkMOYou4miKOx0LnLPdJA25IsgLObY6YZHxHtm9o gFqSlrR/Zkn/mQcDzF2CHNfG/k7z0+GeeC8vUDNjK3N/S9H/HDELfcfZLFagr70d+BYV 5ZekH3JBsxReN8UH+XgZ7JstWnwomekzb3zp3HdykJK5PM6aw1fVF1ggOqiUEd4MVFsV su8A== X-Gm-Message-State: AOJu0YyJFmpwpNogE6dwLWg1ZekijQAr0AGjxHew3u+CmcNCVu+RRtfm Wzc86BD7K0xocA6QugvPh6vNGuHmO2ibQEq706pbCumxlKmSMCUxcvAszDjLcwDu4ym9d0tqPS2 ixVU= X-Received: by 2002:a5d:640a:0:b0:360:791c:aff2 with SMTP id ffacd0b85a97d-366e95dc73emr8915932f8f.47.1719506405159; Thu, 27 Jun 2024 09:40:05 -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 ffacd0b85a97d-3674369ed92sm2386851f8f.105.2024.06.27.09.39.59 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 27 Jun 2024 09:40:04 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Joel Stanley , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Francisco Iglesias , qemu-block@nongnu.org, Sai Pavan Boddu , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= , Bin Meng , Luc Michel Subject: [PATCH 07/11] hw/sd/sdcard: Remove SEND_DSR dead case (CMD4) Date: Thu, 27 Jun 2024 18:38:39 +0200 Message-ID: <20240627163843.81592-8-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240627163843.81592-1-philmd@linaro.org> References: <20240627163843.81592-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::330; envelope-from=philmd@linaro.org; helo=mail-wm1-x330.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, 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 The CSD::CSR_IMP bit defines whether the Driver Stage Register (DSR) is implemented or not. We do not set this bit in CSD: static void sd_set_csd(SDState *sd, uint64_t size) { ... if (size <= SDSC_MAX_CAPACITY) { /* Standard Capacity SD */ ... sd->csd[6] = 0xe0 | /* Partial block for read allowed */ ((csize >> 10) & 0x03); ... } else { /* SDHC */ ... sd->csd[6] = 0x00; ... } ... } The sd_normal_command() switch case for the SEND_DSR command do nothing and fallback to "illegal command". Since the command is mandatory (although the register isn't...) call the sd_cmd_unimplemented() handler. Signed-off-by: Philippe Mathieu-Daudé --- hw/sd/sd.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/hw/sd/sd.c b/hw/sd/sd.c index a816493d37..097cb0f2e2 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -240,7 +240,7 @@ static const char *sd_response_name(sd_rsp_type_t rsp) static const char *sd_cmd_name(SDState *sd, uint8_t cmd) { static const char *cmd_abbrev[SDMMC_CMD_MAX] = { - [4] = "SET_DSR", [5] = "IO_SEND_OP_COND", + [5] = "IO_SEND_OP_COND", [6] = "SWITCH_FUNC", [7] = "SELECT/DESELECT_CARD", [8] = "SEND_IF_COND", [9] = "SEND_CSD", [10] = "SEND_CID", [11] = "VOLTAGE_SWITCH", @@ -1153,7 +1153,6 @@ static sd_rsp_type_t sd_cmd_illegal(SDState *sd, SDRequest req) } /* Commands that are recognised but not yet implemented. */ -__attribute__((unused)) static sd_rsp_type_t sd_cmd_unimplemented(SDState *sd, SDRequest req) { qemu_log_mask(LOG_UNIMP, "%s: CMD%i not implemented\n", @@ -1312,16 +1311,6 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req) switch (req.cmd) { /* Basic commands (Class 0 and Class 1) */ - case 4: /* CMD4: SEND_DSR */ - switch (sd->state) { - case sd_standby_state: - break; - - default: - break; - } - break; - case 6: /* CMD6: SWITCH_FUNCTION */ if (sd->mode != sd_data_transfer_mode) { return sd_invalid_mode_for_cmd(sd, req); @@ -2289,6 +2278,7 @@ static const SDProto sd_proto_sd = { [0] = {0, sd_bc, "GO_IDLE_STATE", sd_cmd_GO_IDLE_STATE}, [2] = {0, sd_bcr, "ALL_SEND_CID", sd_cmd_ALL_SEND_CID}, [3] = {0, sd_bcr, "SEND_RELATIVE_ADDR", sd_cmd_SEND_RELATIVE_ADDR}, + [4] = {0, sd_bc, "SEND_DSR", sd_cmd_unimplemented}, [19] = {2, sd_adtc, "SEND_TUNING_BLOCK", sd_cmd_SEND_TUNING_BLOCK}, [23] = {2, sd_ac, "SET_BLOCK_COUNT", sd_cmd_SET_BLOCK_COUNT}, }, From patchwork Thu Jun 27 16:38:40 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: 807852 Delivered-To: patch@linaro.org Received: by 2002:adf:e842:0:b0:362:4979:7f74 with SMTP id d2csp896967wrn; Thu, 27 Jun 2024 09:40:36 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUOYdq++MvB3zFIab1wRfjiu4ndDemNweSvUL7cq381vJLckEFuVQFf9+j3BpoS408c2H5ka3nZBlH/BQcS51QD X-Google-Smtp-Source: AGHT+IFouDsPkiHhwCat0tP6KzqWtCfdERvVrz0hihPEvtgjQDlDG5DcMza+ujXW3ezn1qSkPnyv X-Received: by 2002:ad4:44b2:0:b0:6b4:ff58:854a with SMTP id 6a1803df08f44-6b58d36dd90mr40505856d6.17.1719506435902; Thu, 27 Jun 2024 09:40:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1719506435; cv=none; d=google.com; s=arc-20160816; b=PG4XvitEE473fwlYe9h/LJ+04Rylg14gO8BhtaKXFe6f+IAQkrN6xPDcl9JTtlx/P7 ZkzFwmuX5rt4dchHmVbp1BkxjfiwJsiSe7UNVDgNagHPCTnJ47n94vx94xWdlqvlPC/L 6PDvcbSHbV6PiBL8ljIwEapaylIUKalRvpjECVrkvalcnnrgLcEbsukVn4RAnvBCQJpg TGNSKpE/IX2Mpw+1e9gfZTkImRFI/4B8l4YQaA1SXnsj0fTVnfrxu71UvAIZaJiZ6d/e dHJ9TdPnGA+0R988p6yma+3CvaTR9v63khRL7imlIcZhop63NdFirxqLkmuScDSuEwq9 dvyQ== 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=Kx/xpSwqNNbWf+vNm/3cxS62PiRf/NP5lc+BI6XCrgc=; fh=E5m7+9HN0zGcNIUskxjX+xkpcxQksSinAMYSY8RmZaI=; b=0yqHHrF2SuuJj2RiHSbzLJ+Z5RQ/14ZV/FX3RLnQ4fymTWDMjpy8cspm2pduapG1Pn sYMY2MEtSqUZaEATjw6MHuFEUMzsUoHU/lvx733Wv+VAdALiuDqnqUs9cDwhWOl4VJt2 pFhHXs8h5TWWtbSLicElbO8DfLsm64iHieCkUJMV3XPCXja06gB+qohMyqf3m8n6NI9t DltR96yG+IHSb1W4shjP0/nKVDgmoX3vh5KXVVCc1uPgrkj3AWd2XJYnpFwnA5I8FAUs /u1f4S5yUb0SoOBR3wmX/y1uj/qnryE48MGaiWrZOzQ2IZUj9nLlFNYtUUDTLgoz+dJl 9Mgg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=whuIXdUY; 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-6b59e3634f0si313396d6.106.2024.06.27.09.40.35 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 27 Jun 2024 09:40:35 -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=whuIXdUY; 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 1sMsAX-0003C0-T6; Thu, 27 Jun 2024 12:40:21 -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 1sMsAW-0002zC-Cy for qemu-devel@nongnu.org; Thu, 27 Jun 2024 12:40:20 -0400 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sMsAU-0007DO-M8 for qemu-devel@nongnu.org; Thu, 27 Jun 2024 12:40:20 -0400 Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-425680b1d3aso3551465e9.2 for ; Thu, 27 Jun 2024 09:40:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1719506416; x=1720111216; 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=Kx/xpSwqNNbWf+vNm/3cxS62PiRf/NP5lc+BI6XCrgc=; b=whuIXdUYtzldTcgAzi+KNkePEXcQfE4GJenDts2rGSSl31O5O6awObUJMXtt46y74b NucmhhPJ8QpBSYnDRMCjNYClXoW0ZHUIoFiKKAZ/QaNs+Ivi4d+dkoks2Nx3S2Wty2tc IIXKh2xnOzPakwAG02LVVW684yrrUd7x2FYs1ug+Rta+Lux2UBJZl9iqm92fseS3Kn2Z 88TNfqjIlTQAPB6Jmx/rY3/UBfp5e0WjAFd63e5f8Dh3inlyERnNDPNjz+CdQSWsitx8 ZjRTz81BoqOdGlI8wFyNov9ZnnLTNA448BRaPhSextRhz9CdmjlD+/ByNF7rhGt7f/EB jjVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719506416; x=1720111216; 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=Kx/xpSwqNNbWf+vNm/3cxS62PiRf/NP5lc+BI6XCrgc=; b=buzaDBFEbF/+iqt+P7awXHmREpQBtV9U6O4Eq0UsGdJg/k5UN8hr/FdbuPknQ+ioof UQsIoTuVOoOxC9astcsXBkAOnJIWb7WAXgJngRExpMmw6SW3zZ5MwngVm1RoaEbOuPrB DBf7AbIqKNH60HxsCevjtmfBrJUmJHJViyfXuxK+sjudcrVLpKntfhxb1plRV2vH895n zKrzp+kf1KW1ZMRk9f7EqrAzNQywgVbEeZGYfwFuKUkahMfatuSAQ2ulo2HXeTfsD8+B UFxPOYQE4g7YwrU4hVycbHOtHuDxhNwIHGtOJJZicUNHBJm1t9wNHQVPK82c4quAUiuF di9A== X-Gm-Message-State: AOJu0YyGGQPA6bdxImF50nZZYXbHKXIWjyxzE6+Ux/0EKo2wB+OC4CV3 eoNG1DNTKhRsqIu73M7Cfuo8Xt+rgMUA7OX78N0m1U9e9rH7E5TGAlMgzWHt2iGzf/5Lb25DCTl zWdg= X-Received: by 2002:a5d:6489:0:b0:367:277e:bd64 with SMTP id ffacd0b85a97d-367277ebe90mr4396390f8f.71.1719506415732; Thu, 27 Jun 2024 09:40:15 -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 ffacd0b85a97d-3674369ecdesm2403649f8f.108.2024.06.27.09.40.12 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 27 Jun 2024 09:40:15 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Joel Stanley , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Francisco Iglesias , qemu-block@nongnu.org, Sai Pavan Boddu , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= , Bin Meng , Luc Michel Subject: [PATCH 08/11] hw/sd/sdcard: Register generic optional handlers (CMD11 and CMD20) Date: Thu, 27 Jun 2024 18:38:40 +0200 Message-ID: <20240627163843.81592-9-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240627163843.81592-1-philmd@linaro.org> References: <20240627163843.81592-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::334; envelope-from=philmd@linaro.org; helo=mail-wm1-x334.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 | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/hw/sd/sd.c b/hw/sd/sd.c index 097cb0f2e2..74aa38a442 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -243,12 +243,12 @@ static const char *sd_cmd_name(SDState *sd, uint8_t cmd) [5] = "IO_SEND_OP_COND", [6] = "SWITCH_FUNC", [7] = "SELECT/DESELECT_CARD", [8] = "SEND_IF_COND", [9] = "SEND_CSD", - [10] = "SEND_CID", [11] = "VOLTAGE_SWITCH", + [10] = "SEND_CID", [12] = "STOP_TRANSMISSION", [13] = "SEND_STATUS", [15] = "GO_INACTIVE_STATE", [16] = "SET_BLOCKLEN", [17] = "READ_SINGLE_BLOCK", [18] = "READ_MULTIPLE_BLOCK", - [20] = "SPEED_CLASS_CONTROL", [21] = "DPS_spec", + [21] = "DPS_spec", [24] = "WRITE_BLOCK", [25] = "WRITE_MULTIPLE_BLOCK", [26] = "MANUF_RSVD", [27] = "PROGRAM_CSD", [28] = "SET_WRITE_PROT", [29] = "CLR_WRITE_PROT", @@ -1161,6 +1161,14 @@ static sd_rsp_type_t sd_cmd_unimplemented(SDState *sd, SDRequest req) return sd_illegal; } +static sd_rsp_type_t sd_cmd_optional(SDState *sd, SDRequest req) +{ + qemu_log_mask(LOG_UNIMP, "%s: Optional CMD%i not implemented\n", + sd->proto->name, req.cmd); + + return sd_illegal; +} + /* Configure fields for following sd_generic_write_byte() calls */ static sd_rsp_type_t sd_cmd_to_receivingdata(SDState *sd, SDRequest req, uint64_t start, size_t size) @@ -2279,7 +2287,9 @@ static const SDProto sd_proto_sd = { [2] = {0, sd_bcr, "ALL_SEND_CID", sd_cmd_ALL_SEND_CID}, [3] = {0, sd_bcr, "SEND_RELATIVE_ADDR", sd_cmd_SEND_RELATIVE_ADDR}, [4] = {0, sd_bc, "SEND_DSR", sd_cmd_unimplemented}, + [11] = {0, sd_ac, "VOLTAGE_SWITCH", sd_cmd_optional}, [19] = {2, sd_adtc, "SEND_TUNING_BLOCK", sd_cmd_SEND_TUNING_BLOCK}, + [20] = {2, sd_ac, "SPEED_CLASS_CONTROL", sd_cmd_optional}, [23] = {2, sd_ac, "SET_BLOCK_COUNT", sd_cmd_SET_BLOCK_COUNT}, }, }; From patchwork Thu Jun 27 16:38:41 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: 807854 Delivered-To: patch@linaro.org Received: by 2002:adf:e842:0:b0:362:4979:7f74 with SMTP id d2csp897020wrn; Thu, 27 Jun 2024 09:40:42 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCX4ziZBFefEURQveLr9hzN0Zl6Z92vqcqe0KQYzsrzXHp2oTk5PHbVu2CbXnRv1lb0wwmZ6thX4DESBJrxXU2+4 X-Google-Smtp-Source: AGHT+IEHLxGgJGwLsNDyRZgHy+YsVwFDOPgjjB5UqxunJ1oNUz+ln99HrggPnbNauCH3rDIzam9t X-Received: by 2002:ad4:5d4c:0:b0:6b5:8fdd:baa6 with SMTP id 6a1803df08f44-6b58fddbc5cmr33817616d6.51.1719506442542; Thu, 27 Jun 2024 09:40:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1719506442; cv=none; d=google.com; s=arc-20160816; b=TQ/nCeqBvJB+6YXZ3CCqbF+07hNpF8wS7rP7cFMe6hHWq8MmondoE8XlBjcVqI13mH g0XjNMuJyD6bMjeeuCjcmMBYxsZ74UToGx4PdG1BW63VEiI1FmiqTRzYAlvQosrpuAk/ yOs1bEWE1tuzlGg/g8s4Ed81nDfU4PMxlpr1MlYCh+fpSkafHah21X5ExPPZMXnu9E1p 17vzKvqP57yTtwOYI8eV+Cg5vZ1ytZDFJuaIFWAqh4IJsf3C4VMI8fdFNShzbdEVIK2q 0U0rE8KkItCqaNmdy9HKhoEhah0esN9AfMSgsy+BwI3XjLBdLQZ6qbT8rj5qYW9wvIUs GnRQ== 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=HjpgRXrOQ8bkyegxRpfboHEk5IA653f08nTp/+XGbbA=; fh=E5m7+9HN0zGcNIUskxjX+xkpcxQksSinAMYSY8RmZaI=; b=VDOndcIPLTLPgS+mSXUroP9huqDr33Yp/vH/LmPB4URhVFC7wCLoGe+D3gY4qXRB68 hxSf3soYwy+bcjbJs0499l97poxvw9bnIBMLhyYvIajgboQAPCqWwprMkPPP5dfnL6SL RybL8dVYS8c1VoITyF9PQiSJUJbNbGAYB6qgHPmD7KDxDghCKRTwtuAQ1LySUGLyAx3/ POKzj7+ZtiRIHSCchelOIF3JRi04sGkibzy03wsx9o5fVYSphIQbHt7w2+Gafwkjt8jQ /YeEVnpiaZs2wQrFTbM62z2p8CwXM3A1QqFUCHfq/BtioxJgzJpWsfO4VqGpP6kuUiJN 0l3g==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=EXwZ0GPj; 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-6b59e5f3575si144626d6.419.2024.06.27.09.40.42 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 27 Jun 2024 09:40:42 -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=EXwZ0GPj; 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 1sMsAi-0004OR-Nq; Thu, 27 Jun 2024 12:40: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 1sMsAh-0004C1-7h for qemu-devel@nongnu.org; Thu, 27 Jun 2024 12:40:31 -0400 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sMsAf-0007J0-CZ for qemu-devel@nongnu.org; Thu, 27 Jun 2024 12:40:30 -0400 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-424adaa6ceeso16687685e9.1 for ; Thu, 27 Jun 2024 09:40:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1719506427; x=1720111227; 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=HjpgRXrOQ8bkyegxRpfboHEk5IA653f08nTp/+XGbbA=; b=EXwZ0GPjC8Pl3xdRMuumsXoGHLMNptZHhd/gkdHU/+QFJuxnjH8Ivlg5wshnyQZwAf If4C7yIi26V+tgDMLfbjtzzILTZo/2rnBsV1cAPCYj77qTe5b++HREzx4IGijKHO8FaQ LXeWOSujXbyXGaYePYRw/SaOTXFdtP0Lgyg0Wxkq7VLdgJ1hRT3zUgQx4NIjSndBmm3v 0dL99WjX5RtfSGplUc4FUNS2XF+fTJGZgV3HCE/XSmpXVw6Iw56YzEEunAH9BZm4Lyf8 Ra82JZYRmTxnLz+u5xyOIOsvjLnfOaWLwgCH7wGXShB4yyobCJTbj0gV3fOFL7mpSgxT itSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719506427; x=1720111227; 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=HjpgRXrOQ8bkyegxRpfboHEk5IA653f08nTp/+XGbbA=; b=Fg1i47YUlarhgOMX7L9g5V4V+aPDUzlW5Ohtckt+kttVqfLRDKJAYQno/vQnGb4MNS XrHLCIBjcOtPmORJhh+erMbDSX+5vEWRRnOlBolgbFOBLBKdiqNBbqAe1SkAoc0vBjst aB+vOniYHm4JsFBFQ+TuXG1oAoV5ggszhmsnVYCJCA9zMAQ1f0uz5Fv7c2F0iE4bXCOo 6hsLtF7uMBgeIrGkD6T8/mdrHkicI3Wodu3ZWA1Ra7SDw97keq9t8wJb238jm6ilhDG0 /NlKualyqmw3+qS9TWZU/H+7M9oGsA5w1kcD0aoeNbo6zDao/9xqAtB3RqPH6xe8+3AI fUlA== X-Gm-Message-State: AOJu0YwbCY9b5vID8z8OcA3x/cvNGEPtbQqq9a/hSddlfO9v6Nja+h6h f5+c1P2WsPSN6BYurhSe2jihNaQr31cNMA7dZ5jI/kjeM9wfmoknbhDdQK9mGUDTBnwUHjyFDGy dlcs= X-Received: by 2002:a05:600c:2d55:b0:424:a319:6b46 with SMTP id 5b1f17b1804b1-424a3196b9fmr52640135e9.18.1719506426883; Thu, 27 Jun 2024 09:40:26 -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-424c82515a1sm74632735e9.12.2024.06.27.09.40.21 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 27 Jun 2024 09:40:25 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Joel Stanley , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Francisco Iglesias , qemu-block@nongnu.org, Sai Pavan Boddu , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= , Bin Meng , Luc Michel Subject: [PATCH 09/11] hw/sd/sdcard: Register optional handlers from spec v6.00 Date: Thu, 27 Jun 2024 18:38:41 +0200 Message-ID: <20240627163843.81592-10-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240627163843.81592-1-philmd@linaro.org> References: <20240627163843.81592-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32f; envelope-from=philmd@linaro.org; helo=mail-wm1-x32f.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 | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/hw/sd/sd.c b/hw/sd/sd.c index 74aa38a442..406fadb3b4 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -258,15 +258,11 @@ static const char *sd_cmd_name(SDState *sd, uint8_t cmd) [36] = "SW_FUNC_RSVD", [37] = "SW_FUNC_RSVD", [38] = "ERASE", [40] = "DPS_spec", - [42] = "LOCK_UNLOCK", [43] = "Q_MANAGEMENT", - [44] = "Q_TASK_INFO_A", [45] = "Q_TASK_INFO_B", - [46] = "Q_RD_TASK", [47] = "Q_WR_TASK", - [48] = "READ_EXTR_SINGLE", [49] = "WRITE_EXTR_SINGLE", + [42] = "LOCK_UNLOCK", [50] = "SW_FUNC_RSVD", [52] = "IO_RW_DIRECT", [53] = "IO_RW_EXTENDED", [54] = "SDIO_RSVD", [55] = "APP_CMD", [56] = "GEN_CMD", [57] = "SW_FUNC_RSVD", - [58] = "READ_EXTR_MULTI", [59] = "WRITE_EXTR_MULTI", [60] = "MANUF_RSVD", [61] = "MANUF_RSVD", [62] = "MANUF_RSVD", [63] = "MANUF_RSVD", }; @@ -2291,6 +2287,15 @@ static const SDProto sd_proto_sd = { [19] = {2, sd_adtc, "SEND_TUNING_BLOCK", sd_cmd_SEND_TUNING_BLOCK}, [20] = {2, sd_ac, "SPEED_CLASS_CONTROL", sd_cmd_optional}, [23] = {2, sd_ac, "SET_BLOCK_COUNT", sd_cmd_SET_BLOCK_COUNT}, + [43] = {1, sd_ac, "Q_MANAGEMENT", sd_cmd_optional}, + [44] = {1, sd_ac, "Q_TASK_INFO_A", sd_cmd_optional}, + [45] = {1, sd_ac, "Q_TASK_INFO_B", sd_cmd_optional}, + [46] = {1, sd_adtc, "Q_RD_TASK", sd_cmd_optional}, + [47] = {1, sd_adtc, "Q_WR_TASK", sd_cmd_optional}, + [48] = {1, sd_adtc, "READ_EXTR_SINGLE", sd_cmd_optional}, + [49] = {1, sd_adtc, "WRITE_EXTR_SINGLE", sd_cmd_optional}, + [58] = {11, sd_adtc, "READ_EXTR_MULTI", sd_cmd_optional}, + [59] = {11, sd_adtc, "WRITE_EXTR_MULTI", sd_cmd_optional}, }, }; From patchwork Thu Jun 27 16:38:42 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: 807855 Delivered-To: patch@linaro.org Received: by 2002:adf:e842:0:b0:362:4979:7f74 with SMTP id d2csp897163wrn; Thu, 27 Jun 2024 09:40:58 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVBeotSCFwTC62XMfgVemSj5OdEqCoswEdn+fKUQhCqHsXicYGhBNDIB4erahPPVhIgRY1eeMz34sukJWauIkuU X-Google-Smtp-Source: AGHT+IG0YNaAKtyBHhqGQes9ykU93neAZCLv65raNj4iJylYdglfljSXy0S3mhhUE/j1BfucN3/D X-Received: by 2002:a25:838e:0:b0:e02:b8f6:b274 with SMTP id 3f1490d57ef6-e030402dc46mr14485725276.65.1719506458207; Thu, 27 Jun 2024 09:40:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1719506458; cv=none; d=google.com; s=arc-20160816; b=B6VNdiW8ZrsJ7JENRNl6IHbntHtNR3PKt8KlNEv5OJEdsYWxpUNH0XfBnNrh9lqWlX SbD7R1CC0e38PnBOcA6IP1sxCOvzGAfoN1E4e/Hs7zINYDjxt8X5p4/88QPxUQO2ZFMG w6LZyW1LbRhqxNSYzmjxepVJ9noldJZ+Bk+vOWDXCXj6c+lB6LCAZJ9kGsnzTlYC4ylZ hg0sAdCHiB7y0DAdfsEZRbFcd2Fc3g42bpSKIsHzbxH0Rfg8/foulqaZoN4ccLfsQx7E ss85tVSJEFWGxa4lMGlw9GPIs+OVN9HGObmnh9XmMM0GGqyjdwKXzKs31n7pM1Z6R6yv SSDQ== 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=ESvyw3GYgt7hOD38NPh8gyks0iX0X2xZyRHCeLbcWRk=; fh=E5m7+9HN0zGcNIUskxjX+xkpcxQksSinAMYSY8RmZaI=; b=0Swzb8i4vFmwYgZ5MzOz3f9S5sMrWr3ykIP8eWziWdst6mtEYfPxabByTPAv3oodjo WwWVFX929PNKpE0CvZUBHxAXW6APkBh6z9pErs4LEwYXM0iYWklKIgWw8v02ar19rEZk vz6OgP5Tw611gyf19ua0pmD1jUkZC3njMvmLpJ6AmaqOzogT5nQQu1Twu01ndN88V8fo lHnGc2DeLbajFqK/UcgSPJzv8zd0IHgdn8i1RfB/F3VBozjnmwBHJ8mj1rIft9BnlXvo b7GKTgFGho7D5y6QOXiDSwtDtI454TFfgVqXOgOo6PGe7Fu2wFZIVNMZdYBkvQ+pXpD7 13eQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WsiMnvvg; 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-446421c9ceasi15747661cf.565.2024.06.27.09.40.58 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 27 Jun 2024 09:40:58 -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=WsiMnvvg; 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 1sMsAt-0005St-U4; Thu, 27 Jun 2024 12:40:44 -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 1sMsAr-0005Ck-NR for qemu-devel@nongnu.org; Thu, 27 Jun 2024 12:40:41 -0400 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sMsAp-0007KR-Mh for qemu-devel@nongnu.org; Thu, 27 Jun 2024 12:40:41 -0400 Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-424ad991c1cso25013835e9.1 for ; Thu, 27 Jun 2024 09:40:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1719506437; x=1720111237; 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=ESvyw3GYgt7hOD38NPh8gyks0iX0X2xZyRHCeLbcWRk=; b=WsiMnvvgWyL+/Zh0x0wjpNtGCwSEJCLJIROZTzOvNfNk008fC6Ty16w8r+bI7ZZyYS 4qLNjwRZrYPwM5VkZr96c6+5/ICOKleGm/jMfdO8XZH6vjlTMYkFs0UEQMuiEgXKi1ui /+BQzslb56zxNpejIjVdtbkN6zU4SWtfjKoMOkSCtHgtRSrA27Ue0Svu3XJQT0/N2oC/ FyHEWaYWJ3p8BJbWnd4MzxXEKoJeGoomW9tZ+tIdFulh6ChAh/Hkow/ojPdye5+sqLRO ARRGClmAoto6sHsD+FvMIgF3rt/0xiScRZj/LTiZUrjSee5XRSDhPvUawmlSxyT2Xd6Q KlSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719506437; x=1720111237; 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=ESvyw3GYgt7hOD38NPh8gyks0iX0X2xZyRHCeLbcWRk=; b=tXyEkMothGgGgbDyWcYd4mIabuNodtpb87WP7t/5i/PFIlQOCKHttqWd3409wpcw2K FZYwF8Oq1f485o67dzRad0u7ETycfG8IGmMGqm0y2EkxQ55yD7h3NtEhoxaZe/8NXyxh em8d0smYIEMPF4iFMv6OX+5NT6DlhcVJzjNlzDZ89xSW4qTdTSdJCr3qerrZPS2GHdD+ DwN6wo1peh6cHCbcEwxD2KUI/v+es4vCXef6THvTGtjXTm5rE9rjXyUu+mJdMuo6MCQS UUsjD3u5odJ+aBBv87C3SNjhsfrewgmYiSmIUa4ABe2wDK8bQ0x5AKWS9hG/4/cz5kAe TfUg== X-Gm-Message-State: AOJu0YzCTl+nL31IrZQHhDghPbg3uh9ATg6yNA2s7McN7+WQk/ERNLw7 H2lQWyfEjsKNf9Qy1klQ/jE+dcrcscVMzznYI7x6hsEYos4y0JUcxwQInV9X+gdGWWFa0bcGp8g V1/I= X-Received: by 2002:a05:600c:6d48:b0:424:a308:1746 with SMTP id 5b1f17b1804b1-424a30817fbmr70016325e9.16.1719506437058; Thu, 27 Jun 2024 09:40:37 -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-42564bc4f70sm37303905e9.39.2024.06.27.09.40.32 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 27 Jun 2024 09:40:36 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Joel Stanley , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Francisco Iglesias , qemu-block@nongnu.org, Sai Pavan Boddu , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= , Bin Meng , Luc Michel Subject: [PATCH 10/11] hw/sd/sdcard: Register SDIO optional handlers Date: Thu, 27 Jun 2024 18:38:42 +0200 Message-ID: <20240627163843.81592-11-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240627163843.81592-1-philmd@linaro.org> References: <20240627163843.81592-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::331; envelope-from=philmd@linaro.org; helo=mail-wm1-x331.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 See "SD Input/Output Card Specification" v1.00. Signed-off-by: Philippe Mathieu-Daudé --- hw/sd/sd.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/hw/sd/sd.c b/hw/sd/sd.c index 406fadb3b4..87bfd0fd56 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -240,7 +240,6 @@ static const char *sd_response_name(sd_rsp_type_t rsp) static const char *sd_cmd_name(SDState *sd, uint8_t cmd) { static const char *cmd_abbrev[SDMMC_CMD_MAX] = { - [5] = "IO_SEND_OP_COND", [6] = "SWITCH_FUNC", [7] = "SELECT/DESELECT_CARD", [8] = "SEND_IF_COND", [9] = "SEND_CSD", [10] = "SEND_CID", @@ -260,7 +259,6 @@ static const char *sd_cmd_name(SDState *sd, uint8_t cmd) [40] = "DPS_spec", [42] = "LOCK_UNLOCK", [50] = "SW_FUNC_RSVD", - [52] = "IO_RW_DIRECT", [53] = "IO_RW_EXTENDED", [54] = "SDIO_RSVD", [55] = "APP_CMD", [56] = "GEN_CMD", [57] = "SW_FUNC_RSVD", [60] = "MANUF_RSVD", [61] = "MANUF_RSVD", @@ -2270,6 +2268,9 @@ static const SDProto sd_proto_spi = { .cmd = { [0] = {0, sd_spi, "GO_IDLE_STATE", sd_cmd_GO_IDLE_STATE}, [1] = {0, sd_spi, "SEND_OP_COND", spi_cmd_SEND_OP_COND}, + [5] = {9, sd_spi, "IO_SEND_OP_COND", sd_cmd_optional}, + [52] = {9, sd_spi, "IO_RW_DIRECT", sd_cmd_optional}, + [53] = {9, sd_spi, "IO_RW_EXTENDED", sd_cmd_optional}, }, .acmd = { [41] = {8, sd_spi, "SEND_OP_COND", spi_cmd_SEND_OP_COND}, @@ -2283,6 +2284,7 @@ static const SDProto sd_proto_sd = { [2] = {0, sd_bcr, "ALL_SEND_CID", sd_cmd_ALL_SEND_CID}, [3] = {0, sd_bcr, "SEND_RELATIVE_ADDR", sd_cmd_SEND_RELATIVE_ADDR}, [4] = {0, sd_bc, "SEND_DSR", sd_cmd_unimplemented}, + [5] = {9, sd_bc, "IO_SEND_OP_COND", sd_cmd_optional}, [11] = {0, sd_ac, "VOLTAGE_SWITCH", sd_cmd_optional}, [19] = {2, sd_adtc, "SEND_TUNING_BLOCK", sd_cmd_SEND_TUNING_BLOCK}, [20] = {2, sd_ac, "SPEED_CLASS_CONTROL", sd_cmd_optional}, @@ -2294,6 +2296,8 @@ static const SDProto sd_proto_sd = { [47] = {1, sd_adtc, "Q_WR_TASK", sd_cmd_optional}, [48] = {1, sd_adtc, "READ_EXTR_SINGLE", sd_cmd_optional}, [49] = {1, sd_adtc, "WRITE_EXTR_SINGLE", sd_cmd_optional}, + [52] = {9, sd_bc, "IO_RW_DIRECT", sd_cmd_optional}, + [53] = {9, sd_bc, "IO_RW_EXTENDED", sd_cmd_optional}, [58] = {11, sd_adtc, "READ_EXTR_MULTI", sd_cmd_optional}, [59] = {11, sd_adtc, "WRITE_EXTR_MULTI", sd_cmd_optional}, }, From patchwork Thu Jun 27 16:38:43 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: 807856 Delivered-To: patch@linaro.org Received: by 2002:adf:e842:0:b0:362:4979:7f74 with SMTP id d2csp897383wrn; Thu, 27 Jun 2024 09:41:25 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXF1jSp7rTfpR5BaJjkgJH+Wzn79nh2Wvq1JJ4sX0iw10ThXgnZKE3cRdjlvgtIEDZ2wBiP27kO6Ok1gOIEKs0b X-Google-Smtp-Source: AGHT+IGHKtNWL/37h6kWWn8tc9tQPLwQI4dSzuRE/Ty2uRVrFVEie1Uxg9AP0UhifdkOQ9lAS1dt X-Received: by 2002:a05:6808:17a3:b0:3d6:2ad7:db3e with SMTP id 5614622812f47-3d62ad7deaamr2745864b6e.19.1719506485184; Thu, 27 Jun 2024 09:41:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1719506485; cv=none; d=google.com; s=arc-20160816; b=GAZ70HCFZ9/Il3y8X4SHxggQ0OoRRlIhUoGv8A6b9Q+kvDYsnqiZrEZY4Ad/R2m4D4 oFK/usda4rjk6yenO0owEtd7w9LJ7kwdZeZ9LA38wR2N8lBdl9K4wy0mzQHHvAlAk0Pp gGZ07N+K+RUKqGOe5OD4ALao0UGe7u82lLYB0zZjiU3mUHryUC7XpnhhuU4N3QeDbIA+ 79bE0LNDaheBPndb0hHt1Nd/iLi6QW2bxO+4Ag5B5xruETiMv2kpAIZR5p37KGqYTfyq SmCjKXKHMspXd0GM9It0wEmw3jfGnaiJMke2wSaT8TcerkeVz1830LblsJBRT8zgMrKJ xrCg== 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=1fY9Hw86o5iLpIx4cOdBUGuwKgpX9A8Bw42XBcw/lnQ=; fh=E5m7+9HN0zGcNIUskxjX+xkpcxQksSinAMYSY8RmZaI=; b=PQcs4Zeo/KZJ/mrdKrSbGahTN4TT7bIQervgo+wi3JYswBTRI7iaHb8l9weLp59rCW d1GqAKPKhDbifSXvUediWYKzQViVp+Axopd7uvtqU2E4o/PYmx3/dA8vkaFTfdpSiqKQ yhLnVWDxtUsaOq7qoMltFb1pjcgNaLdcBM178+JdzykpLdkEceQmt8Msk3SP9APZRSop OkDZttTKO8IY8jk50VRMnf4HuuDCCYQ1Dxsft9tpE2tfUxIALAQ7ZfwxqzeJIBwvGO1I tmZK2Zimg63Algbo8XNZHpV7KZCTaz9RhRGPIKLBlSZDZmX88rxpCTpmxlGt6KCJn58L cw7g==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NY8fR6bW; 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-446421994efsi15515431cf.502.2024.06.27.09.41.24 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 27 Jun 2024 09:41:25 -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=NY8fR6bW; 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 1sMsB5-0006wF-3A; Thu, 27 Jun 2024 12:40:55 -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 1sMsB2-0006d3-7f for qemu-devel@nongnu.org; Thu, 27 Jun 2024 12:40:52 -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 1sMsAz-0007L1-Dd for qemu-devel@nongnu.org; Thu, 27 Jun 2024 12:40:51 -0400 Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-42562a984d3so11665895e9.3 for ; Thu, 27 Jun 2024 09:40:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1719506446; x=1720111246; 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=1fY9Hw86o5iLpIx4cOdBUGuwKgpX9A8Bw42XBcw/lnQ=; b=NY8fR6bW+NKZ5p8wgp6/GPHSTu03mJKLLvYqpC2JxKvJ3G6YRyRmaGrwEXdijzTZRp iV4kKotiG4lGG7N880Wm4JiDiwAgYjkXGlkjNZ3eUYJmAEuV0UaQ/pdeU7nMG/NouvSY wlPt1uDQ4Zg0Amf+Y+EK5nfQmHxy5FOUKekUHvcT716r/cgkD+lVV2JpgckIEx65AEhK Ayov/y4pq7r0gUny7jvc0h0HY07ro0SEhrXXNuxx8LYvT/vVVWjp5N+bhFRHq+GSlKaW FofuhKfiTgi2b1UNaqKljoXDcTVM17UCjMb9NEnifCnzfsLrQnheFA/NdH1CYdWmdGfE 3e9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719506446; x=1720111246; 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=1fY9Hw86o5iLpIx4cOdBUGuwKgpX9A8Bw42XBcw/lnQ=; b=X5bFksViUDnPjpF6a2XMS4/CvfQoEnN5nxIx8l9wTQ8uZ89CmaxiuOHybtp+AY22qk aV2/cFdWXXWGcaeEMttTXFB/VXbpq/b8DiXFQLHhJfv6CQniszmaPCHQEpNPOdhq7VUR gap2SwtWp1qOOTHTmjw9ATcGHVNm2BqE6nx0aDwBVe+4PwTLt2vbV21xTdHmyM45i75s Wq8GnhWwa7YErJABkqaqYJVvAJs7F5tkOp89jAjAN2yHdlw4m9Jos35UF+jLsd+/VRPa tPE4/AlPwMv5KRoXaMIf4dtytoDcwp3Ciky+xQACE53vOofEjSLOJESfiYek3dcoqRir Ua9g== X-Gm-Message-State: AOJu0Yw9HX+vGVS6A+NxBE0cX4iFSgDGWVb03FjiN9V56pPzm2+dqA/6 2Due3U1pA0ctAMLwseJcu6I2o+VQmt2xro3zbW94a8j2dpt+Aiy48tV+2IhCotM7w0hwdZdCeUa CjAk= X-Received: by 2002:a05:600c:16c4:b0:425:5ec3:570b with SMTP id 5b1f17b1804b1-4255ec35786mr31261075e9.35.1719506446666; Thu, 27 Jun 2024 09:40:46 -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-424c84692b5sm74980905e9.40.2024.06.27.09.40.43 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 27 Jun 2024 09:40:46 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Joel Stanley , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Francisco Iglesias , qemu-block@nongnu.org, Sai Pavan Boddu , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= , Bin Meng , Luc Michel Subject: [PATCH 11/11] hw/sd/sdcard: Register Security Extension optional handlers Date: Thu, 27 Jun 2024 18:38:43 +0200 Message-ID: <20240627163843.81592-12-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240627163843.81592-1-philmd@linaro.org> References: <20240627163843.81592-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=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 See "Advanced Security SD Extension Specification" v2.00. Signed-off-by: Philippe Mathieu-Daudé --- hw/sd/sd.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/hw/sd/sd.c b/hw/sd/sd.c index 87bfd0fd56..e4941cfdab 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -253,14 +253,11 @@ static const char *sd_cmd_name(SDState *sd, uint8_t cmd) [28] = "SET_WRITE_PROT", [29] = "CLR_WRITE_PROT", [30] = "SEND_WRITE_PROT", [32] = "ERASE_WR_BLK_START", [33] = "ERASE_WR_BLK_END", - [34] = "SW_FUNC_RSVD", [35] = "SW_FUNC_RSVD", - [36] = "SW_FUNC_RSVD", [37] = "SW_FUNC_RSVD", [38] = "ERASE", [40] = "DPS_spec", [42] = "LOCK_UNLOCK", - [50] = "SW_FUNC_RSVD", [54] = "SDIO_RSVD", [55] = "APP_CMD", - [56] = "GEN_CMD", [57] = "SW_FUNC_RSVD", + [56] = "GEN_CMD", [60] = "MANUF_RSVD", [61] = "MANUF_RSVD", [62] = "MANUF_RSVD", [63] = "MANUF_RSVD", }; @@ -2269,8 +2266,14 @@ static const SDProto sd_proto_spi = { [0] = {0, sd_spi, "GO_IDLE_STATE", sd_cmd_GO_IDLE_STATE}, [1] = {0, sd_spi, "SEND_OP_COND", spi_cmd_SEND_OP_COND}, [5] = {9, sd_spi, "IO_SEND_OP_COND", sd_cmd_optional}, + [34] = {10, sd_spi, "READ_SEC_CMD", sd_cmd_optional}, + [35] = {10, sd_spi, "WRITE_SEC_CMD", sd_cmd_optional}, + [36] = {10, sd_spi, "SEND_PSI", sd_cmd_optional}, + [37] = {10, sd_spi, "CONTROL_ASSD_SYSTEM", sd_cmd_optional}, + [50] = {10, sd_spi, "DIRECT_SECURE_READ", sd_cmd_optional}, [52] = {9, sd_spi, "IO_RW_DIRECT", sd_cmd_optional}, [53] = {9, sd_spi, "IO_RW_EXTENDED", sd_cmd_optional}, + [57] = {10, sd_spi, "DIRECT_SECURE_WRITE", sd_cmd_optional}, }, .acmd = { [41] = {8, sd_spi, "SEND_OP_COND", spi_cmd_SEND_OP_COND}, @@ -2289,6 +2292,10 @@ static const SDProto sd_proto_sd = { [19] = {2, sd_adtc, "SEND_TUNING_BLOCK", sd_cmd_SEND_TUNING_BLOCK}, [20] = {2, sd_ac, "SPEED_CLASS_CONTROL", sd_cmd_optional}, [23] = {2, sd_ac, "SET_BLOCK_COUNT", sd_cmd_SET_BLOCK_COUNT}, + [34] = {10, sd_adtc, "READ_SEC_CMD", sd_cmd_optional}, + [35] = {10, sd_adtc, "WRITE_SEC_CMD", sd_cmd_optional}, + [36] = {10, sd_adtc, "SEND_PSI", sd_cmd_optional}, + [37] = {10, sd_ac, "CONTROL_ASSD_SYSTEM", sd_cmd_optional}, [43] = {1, sd_ac, "Q_MANAGEMENT", sd_cmd_optional}, [44] = {1, sd_ac, "Q_TASK_INFO_A", sd_cmd_optional}, [45] = {1, sd_ac, "Q_TASK_INFO_B", sd_cmd_optional}, @@ -2296,8 +2303,10 @@ static const SDProto sd_proto_sd = { [47] = {1, sd_adtc, "Q_WR_TASK", sd_cmd_optional}, [48] = {1, sd_adtc, "READ_EXTR_SINGLE", sd_cmd_optional}, [49] = {1, sd_adtc, "WRITE_EXTR_SINGLE", sd_cmd_optional}, + [50] = {10, sd_adtc, "DIRECT_SECURE_READ", sd_cmd_optional}, [52] = {9, sd_bc, "IO_RW_DIRECT", sd_cmd_optional}, [53] = {9, sd_bc, "IO_RW_EXTENDED", sd_cmd_optional}, + [57] = {10, sd_adtc, "DIRECT_SECURE_WRITE", sd_cmd_optional}, [58] = {11, sd_adtc, "READ_EXTR_MULTI", sd_cmd_optional}, [59] = {11, sd_adtc, "WRITE_EXTR_MULTI", sd_cmd_optional}, },