From nobody Sun Nov 24 23:42:23 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1719506404; cv=none; d=zohomail.com; s=zohoarc; b=Qy/7Vh2Pbl1ZmFA3Id2saVlymmaSvniF3rWfflSfzS+2BULyswa1vlO8l2v5jZvM7avddSBcminM4JtebNgLb+RWnLyT4Q+WdFOZRUSgWaKsvAe4oLrjFYNZ0dUGeifCC8a220pgcc4BYfDbDCNafQnGR+FziHghP+KOOWnXt0A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1719506404; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=bHvyGuDRbuJRmw1vnphLPFr0BQjrkrSSL7KeWPzCQwM=; b=Y14pG3dEEz4GesbVh+34Mtt44345ya+rxu493glRSftS5io04z3qTL8GRGqtDfgEBd6dKBxArybL5aqzH3QABO+waqZEFONZSmFfLlkFatHCD5HVgZxTYpJVBznpSpD+a7RQC7ZoouqNwi0p8ko47p11ioSAJSgKYT21eYtvxks= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1719506404071513.9882317453194; Thu, 27 Jun 2024 09:40:04 -0700 (PDT) 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) 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) 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-Google-Smtp-Source: AGHT+IGfls9xI5I8i1CqTaa8dlEairQQMgH7WTprXA6kG2VNQfa3NFokRunHrQYMKVdKGrZFtJo5mw== 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) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Joel Stanley , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Francisco Iglesias , qemu-block@nongnu.org, Sai Pavan Boddu , =?UTF-8?q?Philippe=20Mathieu-Daud=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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1719506405132100004 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=C3=A9 --- 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) =20 -#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 =3D 8, }; =20 +#define SDMMC_CMD_MAX 64 + typedef sd_rsp_type_t (*sd_cmd_handler)(SDState *sd, SDRequest req); =20 typedef struct SDProto { @@ -231,6 +233,66 @@ static const char *sd_response_name(sd_rsp_type_t rsp) return response_name[rsp]; } =20 +static const char *sd_cmd_name(uint8_t cmd) +{ + static const char *cmd_abbrev[SDMMC_CMD_MAX] =3D { + [0] =3D "GO_IDLE_STATE", [1] =3D "SEND_OP_COND", + [2] =3D "ALL_SEND_CID", [3] =3D "SEND_RELATIVE_A= DDR", + [4] =3D "SET_DSR", [5] =3D "IO_SEND_OP_COND= ", + [6] =3D "SWITCH_FUNC", [7] =3D "SELECT/DESELECT= _CARD", + [8] =3D "SEND_IF_COND", [9] =3D "SEND_CSD", + [10] =3D "SEND_CID", [11] =3D "VOLTAGE_SWITCH", + [12] =3D "STOP_TRANSMISSION", [13] =3D "SEND_STATUS", + [15] =3D "GO_INACTIVE_STATE= ", + [16] =3D "SET_BLOCKLEN", [17] =3D "READ_SINGLE_BLO= CK", + [18] =3D "READ_MULTIPLE_BLOCK", [19] =3D "SEND_TUNING_BLO= CK", + [20] =3D "SPEED_CLASS_CONTROL", [21] =3D "DPS_spec", + [23] =3D "SET_BLOCK_COUNT", + [24] =3D "WRITE_BLOCK", [25] =3D "WRITE_MULTIPLE_= BLOCK", + [26] =3D "MANUF_RSVD", [27] =3D "PROGRAM_CSD", + [28] =3D "SET_WRITE_PROT", [29] =3D "CLR_WRITE_PROT", + [30] =3D "SEND_WRITE_PROT", + [32] =3D "ERASE_WR_BLK_START", [33] =3D "ERASE_WR_BLK_EN= D", + [34] =3D "SW_FUNC_RSVD", [35] =3D "SW_FUNC_RSVD", + [36] =3D "SW_FUNC_RSVD", [37] =3D "SW_FUNC_RSVD", + [38] =3D "ERASE", + [40] =3D "DPS_spec", + [42] =3D "LOCK_UNLOCK", [43] =3D "Q_MANAGEMENT", + [44] =3D "Q_TASK_INFO_A", [45] =3D "Q_TASK_INFO_B", + [46] =3D "Q_RD_TASK", [47] =3D "Q_WR_TASK", + [48] =3D "READ_EXTR_SINGLE", [49] =3D "WRITE_EXTR_SING= LE", + [50] =3D "SW_FUNC_RSVD", + [52] =3D "IO_RW_DIRECT", [53] =3D "IO_RW_EXTENDED", + [54] =3D "SDIO_RSVD", [55] =3D "APP_CMD", + [56] =3D "GEN_CMD", [57] =3D "SW_FUNC_RSVD", + [58] =3D "READ_EXTR_MULTI", [59] =3D "WRITE_EXTR_MULT= I", + [60] =3D "MANUF_RSVD", [61] =3D "MANUF_RSVD", + [62] =3D "MANUF_RSVD", [63] =3D "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] =3D { + [6] =3D "SET_BUS_WIDTH", + [13] =3D "SD_STATUS", + [14] =3D "DPS_spec", [15] =3D "DPS_spec", + [16] =3D "DPS_spec", + [18] =3D "SECU_spec", + [22] =3D "SEND_NUM_WR_BLOCKS", [23] =3D "SET_WR_BLK_ERASE_C= OUNT", + [41] =3D "SD_SEND_OP_COND", + [42] =3D "SET_CLR_CARD_DETECT", + [51] =3D "SEND_SCR", + [52] =3D "SECU_spec", [53] =3D "SECU_spec", + [54] =3D "SECU_spec", + [56] =3D "SECU_spec", [57] =3D "SECU_spec", + [58] =3D "SECU_spec", [59] =3D "SECU_spec", + }; + + 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=C3=A9 - * - * This work is licensed under the terms of the GNU GPL, version 2 or late= r. - * 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] =3D { - [0] =3D "GO_IDLE_STATE", [1] =3D "SEND_OP_COND", - [2] =3D "ALL_SEND_CID", [3] =3D "SEND_RELATIVE_A= DDR", - [4] =3D "SET_DSR", [5] =3D "IO_SEND_OP_COND= ", - [6] =3D "SWITCH_FUNC", [7] =3D "SELECT/DESELECT= _CARD", - [8] =3D "SEND_IF_COND", [9] =3D "SEND_CSD", - [10] =3D "SEND_CID", [11] =3D "VOLTAGE_SWITCH", - [12] =3D "STOP_TRANSMISSION", [13] =3D "SEND_STATUS", - [15] =3D "GO_INACTIVE_STATE= ", - [16] =3D "SET_BLOCKLEN", [17] =3D "READ_SINGLE_BLO= CK", - [18] =3D "READ_MULTIPLE_BLOCK", [19] =3D "SEND_TUNING_BLO= CK", - [20] =3D "SPEED_CLASS_CONTROL", [21] =3D "DPS_spec", - [23] =3D "SET_BLOCK_COUNT", - [24] =3D "WRITE_BLOCK", [25] =3D "WRITE_MULTIPLE_= BLOCK", - [26] =3D "MANUF_RSVD", [27] =3D "PROGRAM_CSD", - [28] =3D "SET_WRITE_PROT", [29] =3D "CLR_WRITE_PROT", - [30] =3D "SEND_WRITE_PROT", - [32] =3D "ERASE_WR_BLK_START", [33] =3D "ERASE_WR_BLK_EN= D", - [34] =3D "SW_FUNC_RSVD", [35] =3D "SW_FUNC_RSVD", - [36] =3D "SW_FUNC_RSVD", [37] =3D "SW_FUNC_RSVD", - [38] =3D "ERASE", - [40] =3D "DPS_spec", - [42] =3D "LOCK_UNLOCK", [43] =3D "Q_MANAGEMENT", - [44] =3D "Q_TASK_INFO_A", [45] =3D "Q_TASK_INFO_B", - [46] =3D "Q_RD_TASK", [47] =3D "Q_WR_TASK", - [48] =3D "READ_EXTR_SINGLE", [49] =3D "WRITE_EXTR_SING= LE", - [50] =3D "SW_FUNC_RSVD", - [52] =3D "IO_RW_DIRECT", [53] =3D "IO_RW_EXTENDED", - [54] =3D "SDIO_RSVD", [55] =3D "APP_CMD", - [56] =3D "GEN_CMD", [57] =3D "SW_FUNC_RSVD", - [58] =3D "READ_EXTR_MULTI", [59] =3D "WRITE_EXTR_MULT= I", - [60] =3D "MANUF_RSVD", [61] =3D "MANUF_RSVD", - [62] =3D "MANUF_RSVD", [63] =3D "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] =3D { - [6] =3D "SET_BUS_WIDTH", - [13] =3D "SD_STATUS", - [14] =3D "DPS_spec", [15] =3D "DPS_spec", - [16] =3D "DPS_spec", - [18] =3D "SECU_spec", - [22] =3D "SEND_NUM_WR_BLOCKS", [23] =3D "SET_WR_BLK_ERASE_C= OUNT", - [41] =3D "SD_SEND_OP_COND", - [42] =3D "SET_CLR_CARD_DETECT", - [51] =3D "SEND_SCR", - [52] =3D "SECU_spec", [53] =3D "SECU_spec", - [54] =3D "SECU_spec", - [56] =3D "SECU_spec", [57] =3D "SECU_spec", - [58] =3D "SECU_spec", [59] =3D "SECU_spec", - }; - - 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-i= nternal.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')) --=20 2.41.0 From nobody Sun Nov 24 23:42:23 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1719506408; cv=none; d=zohomail.com; s=zohoarc; b=b/GzEhbrSuNOhUYUNTj+inBiO2w+BSw1DyqS5RKywc6zhVFfuJ1SwlGYuYsVPzJIlCKlaCSJ6uBHcborYWPWQ2Lox11KM7i/IIxA/kJvcnY00m8I+TPqePuAVAAbPAUIM9+vZn3b/QfCv825lkUVg2vlVgiFVcEOgn0W/Hk45l0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1719506408; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=0hugKoDWkNwghwH1h1z7n8tbSuuJya6Cw/1S35GizWg=; b=gWC/NxeOftZiZ0CObS+y1um+AAsqxbaQeuAwEHh0vbH1GEC8LAYeOMnoaUzUNQ3/Yu9QXFwW+ZiiZ4cCDgeAeYlqnTcbHYUneCwLf39n56mxOH/rLWOIHIOK1DOxjmJ6HFa+jmgFtdGic/QvayQD8nzDWlIs66k9BORUpDTvcPU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1719506408328924.6406518802346; Thu, 27 Jun 2024 09:40:08 -0700 (PDT) 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) 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) 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-Google-Smtp-Source: AGHT+IHiRvZE5umc0s9ZHDgHFXiV7jcjsQQkSpQ9P4dX0L5s2m/JtYZUx896sYCUBp9zHhiuzqfbjg== 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) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Joel Stanley , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Francisco Iglesias , qemu-block@nongnu.org, Sai Pavan Boddu , =?UTF-8?q?Philippe=20Mathieu-Daud=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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1719506409154100001 In order to access SDState::SDProto from sd_[a]cmd_name(), pass SDState as argument. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- 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]; } =20 -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] =3D { [0] =3D "GO_IDLE_STATE", [1] =3D "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"; } =20 -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] =3D { [6] =3D "SET_BUS_WIDTH", @@ -1281,7 +1281,7 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, S= DRequest req) uint64_t addr; uint32_t data; =20 - sd->last_cmd_name =3D sd_cmd_name(req.cmd); + sd->last_cmd_name =3D 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 cas= e. */ @@ -1748,7 +1748,7 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, S= DRequest req) static sd_rsp_type_t sd_app_command(SDState *sd, SDRequest req) { - sd->last_cmd_name =3D sd_acmd_name(req.cmd); + sd->last_cmd_name =3D 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 |=3D APP_CMD; --=20 2.41.0 From nobody Sun Nov 24 23:42:23 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1719506403; cv=none; d=zohomail.com; s=zohoarc; b=kI0bbb3LrpfpbHUSkL9OF9WAKVLuB1MPDb4ieoXHWndvKq5czQlVi2iXqSSH4TBOoiZu1LUd+dUeLP2H3Iwl92YQyfiQY/TRrz1WLYjcmsQOczzC9MQraSYKd4BimxF/XsG2F0EeFHwWrDgZAKCJ8Vsmbqs7VkkwPRCJ8uvvk0A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1719506403; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=/ayYPHbFG82day0p5Ydj8QW5gkkALIElfBxZi1L4r4c=; b=eXac59Lx+rkQFdpmSeW0BwufgUAUU48/j9eUjb9ahB/qiwPq7cOKhRyGIXHoW8TQ6A1BTTp3XgDao377JNONUXC7D8O5JGJbDEKhKqiJwtSzOSshvF1QqL+6Mi03Knp/wKcSAmoCj+8s3D3vq61KzVA7nfJmrA4Lab+aMEcCCV4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1719506403072172.72737891816257; Thu, 27 Jun 2024 09:40:03 -0700 (PDT) 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) 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) 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-Google-Smtp-Source: AGHT+IGvXVVqSPczH3o6EFhpIxgBRbgwc4AtnPWHCM8jhIBb5EPC3AN0isqR0HoBNGq3FBvQ/OuVSA== 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) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Joel Stanley , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Francisco Iglesias , qemu-block@nongnu.org, Sai Pavan Boddu , =?UTF-8?q?Philippe=20Mathieu-Daud=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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::333; envelope-from=philmd@linaro.org; helo=mail-wm1-x333.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1719506405104100003 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=C3=A9 --- 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, SDRe= quest req); =20 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; =20 struct SDState { @@ -1305,8 +1306,8 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, S= DRequest req) return sd_illegal; } =20 - 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); } =20 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 |=3D APP_CMD; =20 - 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); } =20 switch (req.cmd) { @@ -2267,22 +2268,22 @@ void sd_enable(SDState *sd, bool enable) static const SDProto sd_proto_spi =3D { .name =3D "SPI", .cmd =3D { - [0] =3D sd_cmd_GO_IDLE_STATE, - [1] =3D spi_cmd_SEND_OP_COND, + [0] =3D {sd_cmd_GO_IDLE_STATE}, + [1] =3D {spi_cmd_SEND_OP_COND}, }, .acmd =3D { - [41] =3D spi_cmd_SEND_OP_COND, + [41] =3D {spi_cmd_SEND_OP_COND}, }, }; =20 static const SDProto sd_proto_sd =3D { .name =3D "SD", .cmd =3D { - [0] =3D sd_cmd_GO_IDLE_STATE, - [2] =3D sd_cmd_ALL_SEND_CID, - [3] =3D sd_cmd_SEND_RELATIVE_ADDR, - [19] =3D sd_cmd_SEND_TUNING_BLOCK, - [23] =3D sd_cmd_SET_BLOCK_COUNT, + [0] =3D {sd_cmd_GO_IDLE_STATE}, + [2] =3D {sd_cmd_ALL_SEND_CID}, + [3] =3D {sd_cmd_SEND_RELATIVE_ADDR}, + [19] =3D {sd_cmd_SEND_TUNING_BLOCK}, + [23] =3D {sd_cmd_SET_BLOCK_COUNT}, }, }; =20 --=20 2.41.0 From nobody Sun Nov 24 23:42:23 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1719506441; cv=none; d=zohomail.com; s=zohoarc; b=GfoWBVQt/wKzOAzccBkKGPL7dF3Z6veSQbinJlpmaRVFv8cm21pWNbMT2A4qORFjn6wlrZSD5H41eo4Ar4/Y5BwktplGFooUmun6WLcoC0zgbY3wqgZSo/rYAUoftszoRTEPxTr4z4DQEpQXn3zf/eDetm8zmMkjRwZmdssZEyI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1719506441; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=YXDu/2edCnmMgqMgCJOWOkUUywr5VZFDkGviAHlkFf4=; b=F1GjZm3/x4gC8hQWDpxR/nMZGqspeiI//yW5RJkI/3dHTL8qcwytyaHZkAJUSWA24SxmABsVIwmtKVQifrWrZwWjHA2g1iU+4B9cWgzRlb6JrYRpzrKM9l7m744YL7gmC/IveJXfCLGudGcRgD1dCGz9EPL7w/0kK7CSeT3NQ/k= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1719506441740884.0711249851894; Thu, 27 Jun 2024 09:40:41 -0700 (PDT) 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) 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) 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-Google-Smtp-Source: AGHT+IHxwSzBQDPFgEAPDJXXSSUKuzF7EfYzW5dax+fd4Cz7Sy6IKe+iGAtFxAzIklELg+4EPDdRvw== 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) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Joel Stanley , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Francisco Iglesias , qemu-block@nongnu.org, Sai Pavan Boddu , =?UTF-8?q?Philippe=20Mathieu-Daud=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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::333; envelope-from=philmd@linaro.org; helo=mail-wm1-x333.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1719506443253100005 We already have a const array where command handlers are listed. Store the command name there too. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- 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, SDRe= quest 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] =3D { - [0] =3D "GO_IDLE_STATE", [1] =3D "SEND_OP_COND", - [2] =3D "ALL_SEND_CID", [3] =3D "SEND_RELATIVE_A= DDR", [4] =3D "SET_DSR", [5] =3D "IO_SEND_OP_COND= ", [6] =3D "SWITCH_FUNC", [7] =3D "SELECT/DESELECT= _CARD", [8] =3D "SEND_IF_COND", [9] =3D "SEND_CSD", @@ -246,9 +245,8 @@ static const char *sd_cmd_name(SDState *sd, uint8_t cmd) [12] =3D "STOP_TRANSMISSION", [13] =3D "SEND_STATUS", [15] =3D "GO_INACTIVE_STATE= ", [16] =3D "SET_BLOCKLEN", [17] =3D "READ_SINGLE_BLO= CK", - [18] =3D "READ_MULTIPLE_BLOCK", [19] =3D "SEND_TUNING_BLO= CK", + [18] =3D "READ_MULTIPLE_BLOCK", [20] =3D "SPEED_CLASS_CONTROL", [21] =3D "DPS_spec", - [23] =3D "SET_BLOCK_COUNT", [24] =3D "WRITE_BLOCK", [25] =3D "WRITE_MULTIPLE_= BLOCK", [26] =3D "MANUF_RSVD", [27] =3D "PROGRAM_CSD", [28] =3D "SET_WRITE_PROT", [29] =3D "CLR_WRITE_PROT", @@ -270,6 +268,12 @@ static const char *sd_cmd_name(SDState *sd, uint8_t cm= d) [60] =3D "MANUF_RSVD", [61] =3D "MANUF_RSVD", [62] =3D "MANUF_RSVD", [63] =3D "MANUF_RSVD", }; + const SDProto *sdp =3D 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"; } =20 @@ -282,7 +286,6 @@ static const char *sd_acmd_name(SDState *sd, uint8_t cm= d) [16] =3D "DPS_spec", [18] =3D "SECU_spec", [22] =3D "SEND_NUM_WR_BLOCKS", [23] =3D "SET_WR_BLK_ERASE_C= OUNT", - [41] =3D "SD_SEND_OP_COND", [42] =3D "SET_CLR_CARD_DETECT", [51] =3D "SEND_SCR", [52] =3D "SECU_spec", [53] =3D "SECU_spec", @@ -290,6 +293,12 @@ static const char *sd_acmd_name(SDState *sd, uint8_t c= md) [56] =3D "SECU_spec", [57] =3D "SECU_spec", [58] =3D "SECU_spec", [59] =3D "SECU_spec", }; + const SDProto *sdp =3D sd->proto; + + if (sdp->acmd[cmd].handler) { + assert(!acmd_abbrev[cmd]); + return sdp->acmd[cmd].name; + } =20 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 =3D { .name =3D "SPI", .cmd =3D { - [0] =3D {sd_cmd_GO_IDLE_STATE}, - [1] =3D {spi_cmd_SEND_OP_COND}, + [0] =3D { "GO_IDLE_STATE", sd_cmd_GO_IDLE_STATE}, + [1] =3D { "SEND_OP_COND", spi_cmd_SEND_OP_COND}, }, .acmd =3D { - [41] =3D {spi_cmd_SEND_OP_COND}, + [41] =3D { "SEND_OP_COND", spi_cmd_SEND_OP_COND}, }, }; =20 static const SDProto sd_proto_sd =3D { .name =3D "SD", .cmd =3D { - [0] =3D {sd_cmd_GO_IDLE_STATE}, - [2] =3D {sd_cmd_ALL_SEND_CID}, - [3] =3D {sd_cmd_SEND_RELATIVE_ADDR}, - [19] =3D {sd_cmd_SEND_TUNING_BLOCK}, - [23] =3D {sd_cmd_SET_BLOCK_COUNT}, + [0] =3D { "GO_IDLE_STATE", sd_cmd_GO_IDLE_STATE}, + [2] =3D { "ALL_SEND_CID", sd_cmd_ALL_SEND_CID}, + [3] =3D { "SEND_RELATIVE_ADDR", sd_cmd_SEND_RELATIVE_= ADDR}, + [19] =3D { "SEND_TUNING_BLOCK", sd_cmd_SEND_TUNING_BLO= CK}, + [23] =3D { "SET_BLOCK_COUNT", sd_cmd_SET_BLOCK_COUNT}, }, }; =20 --=20 2.41.0 From nobody Sun Nov 24 23:42:23 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1719506408; cv=none; d=zohomail.com; s=zohoarc; b=HaKxGsLyMij4JhewAq9oEr4TtxQi3Bt2EtQtwTZVjoj14JlewnHztJBE1aKvt3/l/xkiQvUr5LuXzZ3UJzaprNmIBE+qfgbGQQx/PNplEjE6sU5a0Oll1yLWgw46w27QLo0DOgxKy4POssLGhEAT5XftEXCIP6HH41bW4BJ5/0w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1719506408; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=FQYmSrnXt5mY866BTgrOijDYx76JFvHs12wH0ygKj7I=; b=bynhkHXB4Y+QReu/aLuxEGSGaZAZxzhTWO1VPB1pI05rtnDKpGnJjAebQ/w2SXGkrUzXHWsDAVMyw3rATM6DIPB5qiT4lgeIvRm09d3MvipnduQ6oey8T4RBvk8M5W0W9j1UnqXSie493IBGb5ZcMv89I3RCTnZ/bEm4TcnfQQw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1719506408298506.1805087288045; Thu, 27 Jun 2024 09:40:08 -0700 (PDT) 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) 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) 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-Google-Smtp-Source: AGHT+IHQbmsC0HWVvuB1JR5LM4eXxNJkSJgXyyXasmZf2+ytQyFcgNKpcceNRUPLeAX3r+AyAtphdQ== 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) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Joel Stanley , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Francisco Iglesias , qemu-block@nongnu.org, Sai Pavan Boddu , =?UTF-8?q?Philippe=20Mathieu-Daud=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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1719506409164100002 Store the command type altogether with the command handler and name. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- 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; =20 typedef enum { - sd_none =3D -1, - sd_bc =3D 0, /* broadcast -- no response */ + sd_none =3D 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, SDRe= quest 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) } } =20 -static const sd_cmd_type_t sd_cmd_type[SDMMC_CMD_MAX] =3D { - 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] =3D { 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) =20 static uint16_t sd_req_get_rca(SDState *s, SDRequest req) { - if (sd_cmd_type[req.cmd] =3D=3D sd_ac || sd_cmd_type[req.cmd] =3D=3D s= d_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; } =20 /* Card Status register */ @@ -2277,22 +2273,22 @@ void sd_enable(SDState *sd, bool enable) static const SDProto sd_proto_spi =3D { .name =3D "SPI", .cmd =3D { - [0] =3D { "GO_IDLE_STATE", sd_cmd_GO_IDLE_STATE}, - [1] =3D { "SEND_OP_COND", spi_cmd_SEND_OP_COND}, + [0] =3D { sd_spi, "GO_IDLE_STATE", sd_cmd_GO_IDLE_STATE}, + [1] =3D { sd_spi, "SEND_OP_COND", spi_cmd_SEND_OP_COND}, }, .acmd =3D { - [41] =3D { "SEND_OP_COND", spi_cmd_SEND_OP_COND}, + [41] =3D { sd_spi, "SEND_OP_COND", spi_cmd_SEND_OP_COND}, }, }; =20 static const SDProto sd_proto_sd =3D { .name =3D "SD", .cmd =3D { - [0] =3D { "GO_IDLE_STATE", sd_cmd_GO_IDLE_STATE}, - [2] =3D { "ALL_SEND_CID", sd_cmd_ALL_SEND_CID}, - [3] =3D { "SEND_RELATIVE_ADDR", sd_cmd_SEND_RELATIVE_= ADDR}, - [19] =3D { "SEND_TUNING_BLOCK", sd_cmd_SEND_TUNING_BLO= CK}, - [23] =3D { "SET_BLOCK_COUNT", sd_cmd_SET_BLOCK_COUNT}, + [0] =3D { sd_bc, "GO_IDLE_STATE", sd_cmd_GO_IDLE_STATE}, + [2] =3D { sd_bcr, "ALL_SEND_CID", sd_cmd_ALL_SEND_CID}, + [3] =3D { sd_bcr, "SEND_RELATIVE_ADDR", sd_cmd_SEND_RELATIVE_= ADDR}, + [19] =3D { sd_adtc, "SEND_TUNING_BLOCK", sd_cmd_SEND_TUNING_BLO= CK}, + [23] =3D { sd_ac, "SET_BLOCK_COUNT", sd_cmd_SET_BLOCK_COUNT}, }, }; =20 --=20 2.41.0 From nobody Sun Nov 24 23:42:23 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1719506427; cv=none; d=zohomail.com; s=zohoarc; b=A9+NIUSQy10qD33JZx3vjWIwhz+KAjU9yU1a2SOqermtQz0L6Eb5lMuprA4IbY1X5gtdRinZGhiMLbppGhYZ4/ogUN3VCmtw0kj00HbrHjWjRnHbqNOMzHDYFw+pl+bawmG1PzUtAiwnBdkh30qddCijKwkFkjbwflREwe5zCak= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1719506427; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=O7w8iWHuHLj1qqdMh1OWVQD6LygpPO88gA0me6KT8+s=; b=k3Ouph5hviS/j0r1rMKHDtF7C2KNHOm2cftPXFRz6ms68D2Jh1aoc/bxMK0lKfFYTrODtGP9Lai5v97eq5mxvKdcw5c9zdh9cwXa0VB9FFCEgPogdj44dvmTtrTG7QQBicMGOa3GfqrmVvgJEALMncA3Q7sAPMW+fjOYi3+9SVM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1719506427388154.8728885669783; Thu, 27 Jun 2024 09:40:27 -0700 (PDT) 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) 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) 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-Google-Smtp-Source: AGHT+IHz4JjI/2GXWRzm1fXsk+9MIfvigT1nS3xwfMxaU1tdycBy3ddrHKtK8IfTzbTauNVuzP0kww== 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) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Joel Stanley , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Francisco Iglesias , qemu-block@nongnu.org, Sai Pavan Boddu , =?UTF-8?q?Philippe=20Mathieu-Daud=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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32d; envelope-from=philmd@linaro.org; helo=mail-wm1-x32d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1719506429205100004 Store the command class altogether with the other command fields (handler, name and type). Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- 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, SDRe= quest 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) } } =20 -static const int sd_cmd_class[SDMMC_CMD_MAX] =3D { - 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, S= DRequest req) sd->multi_blk_cnt =3D 0; } =20 - if (sd_cmd_class[req.cmd] =3D=3D 6 && FIELD_EX32(sd->ocr, OCR, CARD_CA= PACITY)) { + if (sd->proto->cmd[req.cmd].class =3D=3D 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, =20 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, unsi= gned cmd) if (cmd =3D=3D 16 || cmd =3D=3D 55) { return true; } - return sd_cmd_class[cmd] =3D=3D 0 || sd_cmd_class[cmd] =3D=3D 7; + if (!sd->proto->cmd[cmd].handler) { + return false; + } + cmd_class =3D sd->proto->cmd[cmd].class; + + return cmd_class =3D=3D 0 || cmd_class =3D=3D 7; } =20 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 =3D { .name =3D "SPI", .cmd =3D { - [0] =3D { sd_spi, "GO_IDLE_STATE", sd_cmd_GO_IDLE_STATE}, - [1] =3D { sd_spi, "SEND_OP_COND", spi_cmd_SEND_OP_COND}, + [0] =3D {0, sd_spi, "GO_IDLE_STATE", sd_cmd_GO_IDLE_STATE}, + [1] =3D {0, sd_spi, "SEND_OP_COND", spi_cmd_SEND_OP_COND}, }, .acmd =3D { - [41] =3D { sd_spi, "SEND_OP_COND", spi_cmd_SEND_OP_COND}, + [41] =3D {8, sd_spi, "SEND_OP_COND", spi_cmd_SEND_OP_COND}, }, }; =20 static const SDProto sd_proto_sd =3D { .name =3D "SD", .cmd =3D { - [0] =3D { sd_bc, "GO_IDLE_STATE", sd_cmd_GO_IDLE_STATE}, - [2] =3D { sd_bcr, "ALL_SEND_CID", sd_cmd_ALL_SEND_CID}, - [3] =3D { sd_bcr, "SEND_RELATIVE_ADDR", sd_cmd_SEND_RELATIVE_= ADDR}, - [19] =3D { sd_adtc, "SEND_TUNING_BLOCK", sd_cmd_SEND_TUNING_BLO= CK}, - [23] =3D { sd_ac, "SET_BLOCK_COUNT", sd_cmd_SET_BLOCK_COUNT}, + [0] =3D {0, sd_bc, "GO_IDLE_STATE", sd_cmd_GO_IDLE_STATE}, + [2] =3D {0, sd_bcr, "ALL_SEND_CID", sd_cmd_ALL_SEND_CID}, + [3] =3D {0, sd_bcr, "SEND_RELATIVE_ADDR", sd_cmd_SEND_RELATIVE_= ADDR}, + [19] =3D {2, sd_adtc, "SEND_TUNING_BLOCK", sd_cmd_SEND_TUNING_BLO= CK}, + [23] =3D {2, sd_ac, "SET_BLOCK_COUNT", sd_cmd_SET_BLOCK_COUNT}, }, }; =20 --=20 2.41.0 From nobody Sun Nov 24 23:42:23 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1719506428; cv=none; d=zohomail.com; s=zohoarc; b=Lm/X7OoqY3QnhQFsuGuo6/E2RQvoBogTw5ZhfPzfpPWu5cNTPi3RgDihxN7CxKqk+kEnGFOX9RcqNerRL+FoIbod/YTGuzBrzzy5e/izbRAfRV8Pmi/qgwmahxiCE0GJTDrz6s9TERnoNi9Pl0ivcovxAafc7VAiqPmv21LIuoQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1719506428; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=W8MZ6mDUZDTzEHMhB6amOhsFMea88t3Iug/OVUXgLHk=; b=X1pbxMrm8/lVrqpWegHHzSN0fNUFBJTV/mIMd1wGCwLywMEIVos+SQKjQMydfl05j3nIrIzYX8LaIMyQZCFGiVWycaoGlpRlamY0khfQ6ayGBiaLvCoS5zftUyFVgi01cAYrSDc96qDGs6/i+OaPYSYUaN0/IObocATFQqaJ44M= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1719506428117545.5940495623345; Thu, 27 Jun 2024 09:40:28 -0700 (PDT) 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) 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) 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-Google-Smtp-Source: AGHT+IFASbCFBjpGiWVDsNWkrlHZ73fhz2u9Xj8DTnsiMAfK+PxGDrjDb9t5Isl35i7+klHHRNIX+Q== 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) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Joel Stanley , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Francisco Iglesias , qemu-block@nongnu.org, Sai Pavan Boddu , =?UTF-8?q?Philippe=20Mathieu-Daud=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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1719506429188100003 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 <=3D SDSC_MAX_CAPACITY) { /* Standard Capacity SD */ ... sd->csd[6] =3D 0xe0 | /* Partial block for read allowed */ ((csize >> 10) & 0x03); ... } else { /* SDHC */ ... sd->csd[6] =3D 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=C3=A9 --- 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] =3D { - [4] =3D "SET_DSR", [5] =3D "IO_SEND_OP_COND= ", + [5] =3D "IO_SEND_OP_COND", [6] =3D "SWITCH_FUNC", [7] =3D "SELECT/DESELECT= _CARD", [8] =3D "SEND_IF_COND", [9] =3D "SEND_CSD", [10] =3D "SEND_CID", [11] =3D "VOLTAGE_SWITCH", @@ -1153,7 +1153,6 @@ static sd_rsp_type_t sd_cmd_illegal(SDState *sd, SDRe= quest req) } =20 /* 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) =20 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 !=3D sd_data_transfer_mode) { return sd_invalid_mode_for_cmd(sd, req); @@ -2289,6 +2278,7 @@ static const SDProto sd_proto_sd =3D { [0] =3D {0, sd_bc, "GO_IDLE_STATE", sd_cmd_GO_IDLE_STATE}, [2] =3D {0, sd_bcr, "ALL_SEND_CID", sd_cmd_ALL_SEND_CID}, [3] =3D {0, sd_bcr, "SEND_RELATIVE_ADDR", sd_cmd_SEND_RELATIVE_= ADDR}, + [4] =3D {0, sd_bc, "SEND_DSR", sd_cmd_unimplemented}, [19] =3D {2, sd_adtc, "SEND_TUNING_BLOCK", sd_cmd_SEND_TUNING_BLO= CK}, [23] =3D {2, sd_ac, "SET_BLOCK_COUNT", sd_cmd_SET_BLOCK_COUNT}, }, --=20 2.41.0 From nobody Sun Nov 24 23:42:23 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1719506436; cv=none; d=zohomail.com; s=zohoarc; b=KwV3iFaRX7zNGmJsAtiYIsLFJJ41gyJmBptmuLPuorNS0kdFjsC0YxktJsGvmFt8o2VP8w/S8N1HBdZwvoM/oSPmCfEdMkLcIU5fti+Tpdum55qPrQe1YWqXm9nbfN+BXyZWbSJ7/qAWOrV/hksH6pcq02n4Gc1/XCVA/bPZFMw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1719506436; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Kx/xpSwqNNbWf+vNm/3cxS62PiRf/NP5lc+BI6XCrgc=; b=W44FnPyBUMljP80N9kGg94qUFkbU0kENCeG3L+mz9RbLfs/XfF2wD1tXUZtGbo2RL/aEB8m3xgxppJMrY6QV36mS6O6pXTGhfOAs3yFaa9jgEz4ECyWzEFeS8VhWvitvCAjfmOH8FZ/jd22fKny4EqyDMtzlzbI1TpZuvdU+Gh4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1719506436247404.87406786104555; Thu, 27 Jun 2024 09:40:36 -0700 (PDT) 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) 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) 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-Google-Smtp-Source: AGHT+IG91xcM3GK0FBkwgHVq714GQqaMO/l0IINWenxiAF3IljOSjewlsHO2ZmDIauwms/NSQ/3gng== 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) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Joel Stanley , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Francisco Iglesias , qemu-block@nongnu.org, Sai Pavan Boddu , =?UTF-8?q?Philippe=20Mathieu-Daud=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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1719506437284100001 Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- 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 c= md) [5] =3D "IO_SEND_OP_COND", [6] =3D "SWITCH_FUNC", [7] =3D "SELECT/DESELECT= _CARD", [8] =3D "SEND_IF_COND", [9] =3D "SEND_CSD", - [10] =3D "SEND_CID", [11] =3D "VOLTAGE_SWITCH", + [10] =3D "SEND_CID", [12] =3D "STOP_TRANSMISSION", [13] =3D "SEND_STATUS", [15] =3D "GO_INACTIVE_STATE= ", [16] =3D "SET_BLOCKLEN", [17] =3D "READ_SINGLE_BLO= CK", [18] =3D "READ_MULTIPLE_BLOCK", - [20] =3D "SPEED_CLASS_CONTROL", [21] =3D "DPS_spec", + [21] =3D "DPS_spec", [24] =3D "WRITE_BLOCK", [25] =3D "WRITE_MULTIPLE_= BLOCK", [26] =3D "MANUF_RSVD", [27] =3D "PROGRAM_CSD", [28] =3D "SET_WRITE_PROT", [29] =3D "CLR_WRITE_PROT", @@ -1161,6 +1161,14 @@ static sd_rsp_type_t sd_cmd_unimplemented(SDState *s= d, SDRequest req) return sd_illegal; } =20 +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 =3D { [2] =3D {0, sd_bcr, "ALL_SEND_CID", sd_cmd_ALL_SEND_CID}, [3] =3D {0, sd_bcr, "SEND_RELATIVE_ADDR", sd_cmd_SEND_RELATIVE_= ADDR}, [4] =3D {0, sd_bc, "SEND_DSR", sd_cmd_unimplemented}, + [11] =3D {0, sd_ac, "VOLTAGE_SWITCH", sd_cmd_optional}, [19] =3D {2, sd_adtc, "SEND_TUNING_BLOCK", sd_cmd_SEND_TUNING_BLO= CK}, + [20] =3D {2, sd_ac, "SPEED_CLASS_CONTROL", sd_cmd_optional}, [23] =3D {2, sd_ac, "SET_BLOCK_COUNT", sd_cmd_SET_BLOCK_COUNT}, }, }; --=20 2.41.0 From nobody Sun Nov 24 23:42:23 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1719506441; cv=none; d=zohomail.com; s=zohoarc; b=la5bmRz+Usl8R2G7+bUKbqphoqcKIapS8ZljsI/4H35ezuLVW+yn7ehkdYERTLV2K3UCddtwbr8kD+s07vl/Yb4cB0ysjFUVSXnZL74pW8wnbTxJJMSqwPyYDBVEYwObEdlR6xpCbr7WTfGgVjA6U3bVRRwXEWIyB+xI7pdOb6w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1719506441; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=HjpgRXrOQ8bkyegxRpfboHEk5IA653f08nTp/+XGbbA=; b=Mq6wWCRxMKpZVVhcjEgHgSa8Uem3F8SrnXRN1WV7a4P1ebrmZNFbUuorwciH2Oe/JpvpCRV4S83RgxPq5+591sbG4ltslCko0IFY7vZ8BdrwWNwZFXtLsDGp2S1eyc4nI1Q47s/EUO5bRBbRbR8VJEpmu8trxZSDOr2VGyu92Mc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1719506441867327.7525919839726; Thu, 27 Jun 2024 09:40:41 -0700 (PDT) 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) 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) 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-Google-Smtp-Source: AGHT+IE37qh25axZ4lkptls5MsV0ofskVlBhbm4NNT8UrY+LvZiH3JPSBvRuWxCzYLqkmbrypFDyuQ== 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) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Joel Stanley , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Francisco Iglesias , qemu-block@nongnu.org, Sai Pavan Boddu , =?UTF-8?q?Philippe=20Mathieu-Daud=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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1719506443269100006 Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- 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 c= md) [36] =3D "SW_FUNC_RSVD", [37] =3D "SW_FUNC_RSVD", [38] =3D "ERASE", [40] =3D "DPS_spec", - [42] =3D "LOCK_UNLOCK", [43] =3D "Q_MANAGEMENT", - [44] =3D "Q_TASK_INFO_A", [45] =3D "Q_TASK_INFO_B", - [46] =3D "Q_RD_TASK", [47] =3D "Q_WR_TASK", - [48] =3D "READ_EXTR_SINGLE", [49] =3D "WRITE_EXTR_SING= LE", + [42] =3D "LOCK_UNLOCK", [50] =3D "SW_FUNC_RSVD", [52] =3D "IO_RW_DIRECT", [53] =3D "IO_RW_EXTENDED", [54] =3D "SDIO_RSVD", [55] =3D "APP_CMD", [56] =3D "GEN_CMD", [57] =3D "SW_FUNC_RSVD", - [58] =3D "READ_EXTR_MULTI", [59] =3D "WRITE_EXTR_MULT= I", [60] =3D "MANUF_RSVD", [61] =3D "MANUF_RSVD", [62] =3D "MANUF_RSVD", [63] =3D "MANUF_RSVD", }; @@ -2291,6 +2287,15 @@ static const SDProto sd_proto_sd =3D { [19] =3D {2, sd_adtc, "SEND_TUNING_BLOCK", sd_cmd_SEND_TUNING_BLO= CK}, [20] =3D {2, sd_ac, "SPEED_CLASS_CONTROL", sd_cmd_optional}, [23] =3D {2, sd_ac, "SET_BLOCK_COUNT", sd_cmd_SET_BLOCK_COUNT}, + [43] =3D {1, sd_ac, "Q_MANAGEMENT", sd_cmd_optional}, + [44] =3D {1, sd_ac, "Q_TASK_INFO_A", sd_cmd_optional}, + [45] =3D {1, sd_ac, "Q_TASK_INFO_B", sd_cmd_optional}, + [46] =3D {1, sd_adtc, "Q_RD_TASK", sd_cmd_optional}, + [47] =3D {1, sd_adtc, "Q_WR_TASK", sd_cmd_optional}, + [48] =3D {1, sd_adtc, "READ_EXTR_SINGLE", sd_cmd_optional}, + [49] =3D {1, sd_adtc, "WRITE_EXTR_SINGLE", sd_cmd_optional}, + [58] =3D {11, sd_adtc, "READ_EXTR_MULTI", sd_cmd_optional}, + [59] =3D {11, sd_adtc, "WRITE_EXTR_MULTI", sd_cmd_optional}, }, }; =20 --=20 2.41.0 From nobody Sun Nov 24 23:42:23 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1719506458; cv=none; d=zohomail.com; s=zohoarc; b=dW6MdBUaTNsE+YECY4KKDLyvndSWKNlAMedn3+q+RsU/ONBQC5bZl73MWbzu9EQjgSt9jgpF3z7GtlS5nyIX//3RDcdtKsaII/efIpGjRz6U5AMs/EOuyIY2fmnhWbAgjbHw1VY9PxPZ+02x7+yw71SIA8Mdsh3XgbPxILSCrzY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1719506458; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=ESvyw3GYgt7hOD38NPh8gyks0iX0X2xZyRHCeLbcWRk=; b=KiGrEp7yVpbdkBa8sqXU32hKfxZK48qvaHNy7WMwZleeOjloNvlN0Fr3twqpnMy0i58QZgFaEtPRrbsszHhENL+EwaH9tWQC1z6oMaLQ27NQS0TZ2ecS6U5+9bfcNO7LvpiGASA2cGX8cNKjOVdJz9XH5uqqeobz5/0wmEvMOiM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1719506458137409.2082710758675; Thu, 27 Jun 2024 09:40:58 -0700 (PDT) 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) 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) 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-Google-Smtp-Source: AGHT+IHT7K4aApbjb0kSCXmlT9hqe0Oxd19JfVBxa7YEqQxvRLLMB989eJwMiQlHywi9juNDIj1Eng== 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) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Joel Stanley , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Francisco Iglesias , qemu-block@nongnu.org, Sai Pavan Boddu , =?UTF-8?q?Philippe=20Mathieu-Daud=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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1719506459372100001 See "SD Input/Output Card Specification" v1.00. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- 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] =3D { - [5] =3D "IO_SEND_OP_COND", [6] =3D "SWITCH_FUNC", [7] =3D "SELECT/DESELECT= _CARD", [8] =3D "SEND_IF_COND", [9] =3D "SEND_CSD", [10] =3D "SEND_CID", @@ -260,7 +259,6 @@ static const char *sd_cmd_name(SDState *sd, uint8_t cmd) [40] =3D "DPS_spec", [42] =3D "LOCK_UNLOCK", [50] =3D "SW_FUNC_RSVD", - [52] =3D "IO_RW_DIRECT", [53] =3D "IO_RW_EXTENDED", [54] =3D "SDIO_RSVD", [55] =3D "APP_CMD", [56] =3D "GEN_CMD", [57] =3D "SW_FUNC_RSVD", [60] =3D "MANUF_RSVD", [61] =3D "MANUF_RSVD", @@ -2270,6 +2268,9 @@ static const SDProto sd_proto_spi =3D { .cmd =3D { [0] =3D {0, sd_spi, "GO_IDLE_STATE", sd_cmd_GO_IDLE_STATE}, [1] =3D {0, sd_spi, "SEND_OP_COND", spi_cmd_SEND_OP_COND}, + [5] =3D {9, sd_spi, "IO_SEND_OP_COND", sd_cmd_optional}, + [52] =3D {9, sd_spi, "IO_RW_DIRECT", sd_cmd_optional}, + [53] =3D {9, sd_spi, "IO_RW_EXTENDED", sd_cmd_optional}, }, .acmd =3D { [41] =3D {8, sd_spi, "SEND_OP_COND", spi_cmd_SEND_OP_COND}, @@ -2283,6 +2284,7 @@ static const SDProto sd_proto_sd =3D { [2] =3D {0, sd_bcr, "ALL_SEND_CID", sd_cmd_ALL_SEND_CID}, [3] =3D {0, sd_bcr, "SEND_RELATIVE_ADDR", sd_cmd_SEND_RELATIVE_= ADDR}, [4] =3D {0, sd_bc, "SEND_DSR", sd_cmd_unimplemented}, + [5] =3D {9, sd_bc, "IO_SEND_OP_COND", sd_cmd_optional}, [11] =3D {0, sd_ac, "VOLTAGE_SWITCH", sd_cmd_optional}, [19] =3D {2, sd_adtc, "SEND_TUNING_BLOCK", sd_cmd_SEND_TUNING_BLO= CK}, [20] =3D {2, sd_ac, "SPEED_CLASS_CONTROL", sd_cmd_optional}, @@ -2294,6 +2296,8 @@ static const SDProto sd_proto_sd =3D { [47] =3D {1, sd_adtc, "Q_WR_TASK", sd_cmd_optional}, [48] =3D {1, sd_adtc, "READ_EXTR_SINGLE", sd_cmd_optional}, [49] =3D {1, sd_adtc, "WRITE_EXTR_SINGLE", sd_cmd_optional}, + [52] =3D {9, sd_bc, "IO_RW_DIRECT", sd_cmd_optional}, + [53] =3D {9, sd_bc, "IO_RW_EXTENDED", sd_cmd_optional}, [58] =3D {11, sd_adtc, "READ_EXTR_MULTI", sd_cmd_optional}, [59] =3D {11, sd_adtc, "WRITE_EXTR_MULTI", sd_cmd_optional}, }, --=20 2.41.0 From nobody Sun Nov 24 23:42:23 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1719506485; cv=none; d=zohomail.com; s=zohoarc; b=Bf4g+x3hPjhrbsj3NhkFwx4FxJEOsOZMRR27LsivyqUVT13eA3HeH5TOFpinC4KKoqIvVL6M6/s2IGtRgrszcSle/W09U7a3cZ/XZDJWYbcZm9ugKgf2vyrluncuIdyNK6BiaVnvLuetaOCGsFvjvaaGaxNvD6XoS17tK2yUuY4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1719506485; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=1fY9Hw86o5iLpIx4cOdBUGuwKgpX9A8Bw42XBcw/lnQ=; b=N5kPNSZQ47WZO0iBuOh4lwLA4hxJLiF2LZoCKOcQtKbss2hvJ5pMHaW5/kV1BuY8ZpbseRi1sHvcLpJQEJwm37mUlREThbi90H/+eutsBRBQRUHHuFX0skGtg8JzfHp8lAnwO7ZaUnnlKyfYVvekK+MJigBhuc3X5oFMeXB0Iu4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1719506485562203.46248608326562; Thu, 27 Jun 2024 09:41:25 -0700 (PDT) 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) 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) 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-Google-Smtp-Source: AGHT+IH+/jB7l3PR5anxBoTRXRp7IJbR7yL5BmLIuxVduKPntxcMQRjPrsMkU0Vc4oCJTj5X1PG4iA== 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) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Joel Stanley , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Francisco Iglesias , qemu-block@nongnu.org, Sai Pavan Boddu , =?UTF-8?q?Philippe=20Mathieu-Daud=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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::329; envelope-from=philmd@linaro.org; helo=mail-wm1-x329.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1719506487497100003 See "Advanced Security SD Extension Specification" v2.00. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- 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 c= md) [28] =3D "SET_WRITE_PROT", [29] =3D "CLR_WRITE_PROT", [30] =3D "SEND_WRITE_PROT", [32] =3D "ERASE_WR_BLK_START", [33] =3D "ERASE_WR_BLK_EN= D", - [34] =3D "SW_FUNC_RSVD", [35] =3D "SW_FUNC_RSVD", - [36] =3D "SW_FUNC_RSVD", [37] =3D "SW_FUNC_RSVD", [38] =3D "ERASE", [40] =3D "DPS_spec", [42] =3D "LOCK_UNLOCK", - [50] =3D "SW_FUNC_RSVD", [54] =3D "SDIO_RSVD", [55] =3D "APP_CMD", - [56] =3D "GEN_CMD", [57] =3D "SW_FUNC_RSVD", + [56] =3D "GEN_CMD", [60] =3D "MANUF_RSVD", [61] =3D "MANUF_RSVD", [62] =3D "MANUF_RSVD", [63] =3D "MANUF_RSVD", }; @@ -2269,8 +2266,14 @@ static const SDProto sd_proto_spi =3D { [0] =3D {0, sd_spi, "GO_IDLE_STATE", sd_cmd_GO_IDLE_STATE}, [1] =3D {0, sd_spi, "SEND_OP_COND", spi_cmd_SEND_OP_COND}, [5] =3D {9, sd_spi, "IO_SEND_OP_COND", sd_cmd_optional}, + [34] =3D {10, sd_spi, "READ_SEC_CMD", sd_cmd_optional}, + [35] =3D {10, sd_spi, "WRITE_SEC_CMD", sd_cmd_optional}, + [36] =3D {10, sd_spi, "SEND_PSI", sd_cmd_optional}, + [37] =3D {10, sd_spi, "CONTROL_ASSD_SYSTEM", sd_cmd_optional}, + [50] =3D {10, sd_spi, "DIRECT_SECURE_READ", sd_cmd_optional}, [52] =3D {9, sd_spi, "IO_RW_DIRECT", sd_cmd_optional}, [53] =3D {9, sd_spi, "IO_RW_EXTENDED", sd_cmd_optional}, + [57] =3D {10, sd_spi, "DIRECT_SECURE_WRITE", sd_cmd_optional}, }, .acmd =3D { [41] =3D {8, sd_spi, "SEND_OP_COND", spi_cmd_SEND_OP_COND}, @@ -2289,6 +2292,10 @@ static const SDProto sd_proto_sd =3D { [19] =3D {2, sd_adtc, "SEND_TUNING_BLOCK", sd_cmd_SEND_TUNING_BLO= CK}, [20] =3D {2, sd_ac, "SPEED_CLASS_CONTROL", sd_cmd_optional}, [23] =3D {2, sd_ac, "SET_BLOCK_COUNT", sd_cmd_SET_BLOCK_COUNT}, + [34] =3D {10, sd_adtc, "READ_SEC_CMD", sd_cmd_optional}, + [35] =3D {10, sd_adtc, "WRITE_SEC_CMD", sd_cmd_optional}, + [36] =3D {10, sd_adtc, "SEND_PSI", sd_cmd_optional}, + [37] =3D {10, sd_ac, "CONTROL_ASSD_SYSTEM", sd_cmd_optional}, [43] =3D {1, sd_ac, "Q_MANAGEMENT", sd_cmd_optional}, [44] =3D {1, sd_ac, "Q_TASK_INFO_A", sd_cmd_optional}, [45] =3D {1, sd_ac, "Q_TASK_INFO_B", sd_cmd_optional}, @@ -2296,8 +2303,10 @@ static const SDProto sd_proto_sd =3D { [47] =3D {1, sd_adtc, "Q_WR_TASK", sd_cmd_optional}, [48] =3D {1, sd_adtc, "READ_EXTR_SINGLE", sd_cmd_optional}, [49] =3D {1, sd_adtc, "WRITE_EXTR_SINGLE", sd_cmd_optional}, + [50] =3D {10, sd_adtc, "DIRECT_SECURE_READ", sd_cmd_optional}, [52] =3D {9, sd_bc, "IO_RW_DIRECT", sd_cmd_optional}, [53] =3D {9, sd_bc, "IO_RW_EXTENDED", sd_cmd_optional}, + [57] =3D {10, sd_adtc, "DIRECT_SECURE_WRITE", sd_cmd_optional}, [58] =3D {11, sd_adtc, "READ_EXTR_MULTI", sd_cmd_optional}, [59] =3D {11, sd_adtc, "WRITE_EXTR_MULTI", sd_cmd_optional}, }, --=20 2.41.0