From nobody Sun Dec 29 01:37:08 2024 Delivered-To: importer2@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+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1719558391; cv=none; d=zohomail.com; s=zohoarc; b=Du4ML6h6tT7M60v20PLgtUoitW02KlGIZDCJIOsfJIAJOOZ+Z5zQtzPPNaYFuqFtYTO4rjATDOclK3+8k7EWuxup4X8xA9U7tQ3fpyfH1l4crx98PLFd9Ah0mh2DcorJfbk979bSe4WvI8NtHY91ZIcNO7EqfvD0TPvcRBLAPgM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1719558391; h=Content-Type:Content-Transfer-Encoding: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:Cc; bh=IlTxhpvzZWvkbW0VpI4omM+WCLHLk77/0zlyk24X1aE=; b=jHtXSpn16wwvd8N373B7w+8gSXdzgrdktDXlZP27Pd1+kR5uMzstsDO6/ayz4PPsLIglQv6BAmouzxNARpZNZ+6sCbAZBZE0DmE3Te6bmC+COTr5cZgoKh+faI3563UBDL1eaxB3NRY14wn5Vn9PG/wNY2OXjjoN4X4T25hkg0I= 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+importer2=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 1719558391917417.49494881230487; Fri, 28 Jun 2024 00:06:31 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sN5fa-0005DY-2Y; Fri, 28 Jun 2024 03:05:18 -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 1sN5fM-0004eB-5Z for qemu-devel@nongnu.org; Fri, 28 Jun 2024 03:05:06 -0400 Received: from mail-wr1-x433.google.com ([2a00:1450:4864:20::433]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sN5fK-0000I9-7i for qemu-devel@nongnu.org; Fri, 28 Jun 2024 03:05:03 -0400 Received: by mail-wr1-x433.google.com with SMTP id ffacd0b85a97d-3636c572257so239853f8f.0 for ; Fri, 28 Jun 2024 00:05:01 -0700 (PDT) Received: from m1x-phil.lan (cho94-h02-176-184-4-239.dsl.sta.abo.bbox.fr. [176.184.4.239]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3675a0d9ca8sm1333096f8f.43.2024.06.28.00.04.59 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 28 Jun 2024 00:04:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1719558300; x=1720163100; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=IlTxhpvzZWvkbW0VpI4omM+WCLHLk77/0zlyk24X1aE=; b=thWkcIzMoz96tW9QOly6jjBETWrN2poA5vCM+vMOj/481Doirk+yVIMRXXRlHpVf69 YP0ANHChMiT/qCBfY88yuroVoK7YOiNgenNOrg1s6AF2+IyBR+O9jCbfk/3zwZy4P2v4 CfY4QSrJpPKg0g/L6Jvig3InkYXVFPp0PnG6wFu8hb/Z4w1rjlHQaGzAQEVvS03RvDHW aHtB4qIkPHyPsqbnaDbugjkK/To+kaJFdqh4Heia53f7qaTdkl2hh7A1lpwxe9AP8yNx RDptmSVebVbE6amAZb52g4FPKcgTvuTQhLy7l2rqwJo6AbOQPWL+CrgRWw5CHa3Balk/ 20/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719558300; x=1720163100; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=IlTxhpvzZWvkbW0VpI4omM+WCLHLk77/0zlyk24X1aE=; b=DkBybdT89Z3MxEDgdGinXtrlaPLxyEvBUtQHQqZoy5/ysy7DoW2Bx3J21B2YpmhFmL RWvn2+nzO8K5tczjLq6Ffe/XZyNQMwgrAmLtiIDO67xlrZFcnt+qE0/qKCSct9umz/KQ Y0r3y8hfPXTBdsPrrR/kRPR/asIKmwSrsojhMy9HOFSoei01qIpsnwU2pl1YNC6H0ulT pBT4M/M5jLxp6FBACbmm+01V0/A/ljApTycFX+T4EcXUltnZlYx5703Xvz6tnkiyp0yG uJ7FOXHzm/J9DscLej09OG06s0TqsRHYUjewWE2iXuxyKkGAPb0OPvLAheUqfn2ph3S+ ZjBA== X-Gm-Message-State: AOJu0YzH88nRpYqGn12n0/AB2TehVJqUPi5P1S0kukqbj8xeaBSJMTKf hkJJy8jGNxWt9KEyQVR3s2KZJKCSWIwjB+JYDnwzyyVn7rwLUk2OSdCzl0Fo+WHjR1nGtuDKj5h UWfA= X-Google-Smtp-Source: AGHT+IGxz4BNfNyAWYnNVCW0TJxgokxcLXGaDc83PfIxFnw/GnqNAosXeeS9yp3qwI2LCovgUYel4Q== X-Received: by 2002:a5d:628b:0:b0:35f:16c9:a5bd with SMTP id ffacd0b85a97d-366e949a664mr12647407f8f.23.1719558300072; Fri, 28 Jun 2024 00:05:00 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Subject: [PATCH v42 25/98] hw/sd/sdcard: Convert GEN_CMD to generic_read_byte (CMD56) Date: Fri, 28 Jun 2024 09:01:01 +0200 Message-ID: <20240628070216.92609-26-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240628070216.92609-1-philmd@linaro.org> References: <20240628070216.92609-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+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::433; envelope-from=philmd@linaro.org; helo=mail-wr1-x433.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+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1719558393485100003 From: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: C=C3=A9dric Le Goater --- hw/sd/sd.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/hw/sd/sd.c b/hw/sd/sd.c index bf922da2cc..ccf81b9e59 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -1648,10 +1648,12 @@ static sd_rsp_type_t sd_normal_command(SDState *sd,= SDRequest req) switch (sd->state) { case sd_transfer_state: sd->data_offset =3D 0; - if (req.arg & 1) - sd->state =3D sd_sendingdata_state; - else - sd->state =3D sd_receivingdata_state; + if (req.arg & 1) { + return sd_cmd_to_sendingdata(sd, req, 0, + sd->vendor_data, + sizeof(sd->vendor_data)); + } + sd->state =3D sd_receivingdata_state; return sd_r1; =20 default: @@ -2137,6 +2139,7 @@ uint8_t sd_read_byte(SDState *sd) case 17: /* CMD17: READ_SINGLE_BLOCK */ case 19: /* CMD19: SEND_TUNING_BLOCK (SD) */ case 30: /* CMD30: SEND_WRITE_PROT */ + case 56: /* CMD56: GEN_CMD */ sd_generic_read_byte(sd, &ret); break; =20 @@ -2185,14 +2188,6 @@ uint8_t sd_read_byte(SDState *sd) sd->state =3D sd_transfer_state; break; =20 - case 56: /* CMD56: GEN_CMD */ - ret =3D sd->vendor_data[sd->data_offset ++]; - - if (sd->data_offset >=3D sizeof(sd->vendor_data)) { - sd->state =3D sd_transfer_state; - } - break; - default: qemu_log_mask(LOG_GUEST_ERROR, "%s: unknown command\n", __func__); return 0x00; --=20 2.41.0