From patchwork Tue Jul 2 09:20:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 809059 Delivered-To: patch@linaro.org Received: by 2002:adf:a199:0:b0:367:895a:4699 with SMTP id u25csp116771wru; Tue, 2 Jul 2024 02:23:51 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXlkiiV1cB8DR7pzSBXkt+FmBun9tONhFzUr/kt7FF31pnwd2r3dbubAX2K226gFxWIBXVYdeFix0APn5o++kna X-Google-Smtp-Source: AGHT+IH7t9v+kI+pRRh0AAiUgpq/uEfPtEyYgc+1Ek+MKR/t1n/pu7CgYcQ4Wuo9gQPc0D2emfu2 X-Received: by 2002:a05:6214:5299:b0:6b5:4249:7c5 with SMTP id 6a1803df08f44-6b5b70cf238mr96914266d6.36.1719912230862; Tue, 02 Jul 2024 02:23:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1719912230; cv=none; d=google.com; s=arc-20160816; b=1JR2/58qPDteK2K9fEdW9TB8EX0RbCvfnZxzNbG82m/nwYeQzkZtNapUDMejRWEYtF 2wo02eeZvPdIz1fLGaOdXTYZXm3T14lzCGyBebvBiqBgbMbTPFbRrM3fGKRW0zqE8gtO +BBEV8S8PXGHwb14d3CwGQm4/ROEeuoSxj8pOrtSkMp9R8KG2qNVU/uXuDAqLVSL7094 Vpe29Ae3c3tDlUAbNhoUCe4UrFHyR7Pj7KycAOt5knXPsksIy8wZM1uOu5i54q+swC1B hg7ob814XQzL+K62+HnZDYt+iZaGdLrjGr4Uji9NzXmWKzKJGySnn6DTkFmavB++NIj4 GWDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=fq0Hp2Una8Cq+xwhreR1xxCEuiahEpzKceutH3MuTZk=; fh=SWrD6ZzKChsLNd0MI2/W9aN13/YqYpoy69YA//3JWDk=; b=oQUePtCpeuE+ePf8cLlq0O3lDlDC81nBXpsYKoYyrvWYeq3dS3nNeFR2R7wcVe4DqJ 9h2/zSW+eUCPzgb4PLIdxj2pKbp3eqzv7HMYrVgTvRhEx6FCpVAkJWpd6rbxcEq9tE5y 8ndDo4kPz9YISToyOgM0VQ/ebQITxe4adnulyWbD/4wwkR2+x+5PEwCObvX2aX3Egnoa EiKhh7QC/Rr61mKAyJwxHLvamXG0Aj88iGsKwjC0O5B2mb60nHC9euxu/immrf7OXgH/ f90k2ujmAmlcfcgXtUVQ3v/O668PhkOJnp211zxaLFDWbUWpyx9Fp0J3+Vw4dgqZwmEn G8MQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qdt+3ZWJ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6b59e363cadsi98311486d6.12.2024.07.02.02.23.50 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 02 Jul 2024 02:23:50 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qdt+3ZWJ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sOZip-0003TX-Ci; Tue, 02 Jul 2024 05:22:47 -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 1sOZil-0003B5-J9 for qemu-devel@nongnu.org; Tue, 02 Jul 2024 05:22:43 -0400 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sOZij-0006Yl-F2 for qemu-devel@nongnu.org; Tue, 02 Jul 2024 05:22:43 -0400 Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-42564a0d3ceso24429365e9.0 for ; Tue, 02 Jul 2024 02:22:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1719912159; x=1720516959; 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=fq0Hp2Una8Cq+xwhreR1xxCEuiahEpzKceutH3MuTZk=; b=qdt+3ZWJqTeRbVKd8w7QB40JOUqY74DrAxG+IkeApxtHylJaQEtIFRTE7jk4UZU9QJ y8HnzQRnw8rzPbuLEyQ3CBUpwgNayjK4MBEtYnuAFRuwqtzTnUpvrRzCvEV2naV7oQ2s o+uf5KHVFmagKSVaeTuWlQbIaDThUS8KM8UuSbbczhh8wBPtublHpOjwa8CjjHrxctHX BZEVDBGXl3XK9KVhMkH1PTHQ/u4H0COp2106FmqAz6ko9dQXcaWIFvMETt04mJ4nvZ9/ tfrVIDxkAO2jzCtpzXeyrx1hQchm4cGaAxVfTrt6sAm7LFE0Dcr5oER0wm0MC+yGH6ml FKZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719912159; x=1720516959; 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=fq0Hp2Una8Cq+xwhreR1xxCEuiahEpzKceutH3MuTZk=; b=PKomb9TEompUIvxIA5lQPHI59X6GaAMHWFbY3AOxYMPJIvkHYZ1SxUuTNTw/A0HHCr mlWul0qbe+Uf3/oaHycd0Sdi9eG1WiklI3nHJ/hey744IKl0uCBlf43ZS00iwPGSP0nI LoDIq/Bvij1YTsZ9rHz2i7Qu8ACQC0vHvuwswb1Dp5G0VZFgFgfPBJkYvXKcpV8iiCmo s9FzYouyYAJhubmXNq66oqWZi1LhvC/z3wFcPi8pXlJI1CKQwTOjpbLBujDZno+6/jT1 I8XNOkv49gw2+oExMIRDjWdFTo0DTFv8o66dj3YiFtD755shwWeLG299atlezQyOvLY0 E2mA== X-Gm-Message-State: AOJu0YzpGD6CX34QivM5zFp/xwHk97N86gUxqNaNd67Q1qL2hMBcvZNs coqwijrbHlfmE9maam+ktaUp9A5B1BkFrIpoXSufzH51i8LLXg4FkkMsZa81tD9jFEjvzPSLEaM 6 X-Received: by 2002:a05:600c:1d21:b0:423:394:cd28 with SMTP id 5b1f17b1804b1-4257a04fe67mr53501255e9.25.1719912159574; Tue, 02 Jul 2024 02:22:39 -0700 (PDT) Received: from m1x-phil.lan ([176.187.209.58]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3675a0d8cd8sm12607603f8f.27.2024.07.02.02.22.38 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 02 Jul 2024 02:22:39 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Phi?= =?utf-8?q?lippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?C=C3=A9?= =?utf-8?q?dric_Le_Goater?= Subject: [PULL 18/67] hw/sd/sdcard: Convert READ_SINGLE_BLOCK to generic_read_byte (CMD17) Date: Tue, 2 Jul 2024 11:20:01 +0200 Message-ID: <20240702092051.45754-19-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240702092051.45754-1-philmd@linaro.org> References: <20240702092051.45754-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32e; envelope-from=philmd@linaro.org; helo=mail-wm1-x32e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Philippe Mathieu-Daudé Signed-off-by: Philippe Mathieu-Daudé Signed-off-by: Philippe Mathieu-Daudé Tested-by: Cédric Le Goater Reviewed-by: Cédric Le Goater Message-Id: <20240628070216.92609-23-philmd@linaro.org> --- hw/sd/sd.c | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/hw/sd/sd.c b/hw/sd/sd.c index 43e0a2d925..8415c23e20 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -1397,11 +1397,8 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req) if (!address_in_range(sd, "READ_SINGLE_BLOCK", addr, sd->blk_len)) { return sd_r1; } - - sd->state = sd_sendingdata_state; - sd->data_start = addr; - sd->data_offset = 0; - return sd_r1; + sd_blk_read(sd, addr, sd->blk_len); + return sd_cmd_to_sendingdata(sd, req, addr, NULL, sd->blk_len); default: break; @@ -2137,6 +2134,7 @@ uint8_t sd_read_byte(SDState *sd) case 6: /* CMD6: SWITCH_FUNCTION */ case 9: /* CMD9: SEND_CSD */ case 10: /* CMD10: SEND_CID */ + case 17: /* CMD17: READ_SINGLE_BLOCK */ sd_generic_read_byte(sd, &ret); break; @@ -2147,16 +2145,6 @@ uint8_t sd_read_byte(SDState *sd) sd->state = sd_transfer_state; break; - case 17: /* CMD17: READ_SINGLE_BLOCK */ - if (sd->data_offset == 0) { - sd_blk_read(sd, sd->data_start, io_len); - } - ret = sd->data[sd->data_offset ++]; - - if (sd->data_offset >= io_len) - sd->state = sd_transfer_state; - break; - case 18: /* CMD18: READ_MULTIPLE_BLOCK */ if (sd->data_offset == 0) { if (!address_in_range(sd, "READ_MULTIPLE_BLOCK",