From patchwork Thu Jun 27 16:27:29 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: 807836 Delivered-To: patch@linaro.org Received: by 2002:adf:e842:0:b0:362:4979:7f74 with SMTP id d2csp891553wrn; Thu, 27 Jun 2024 09:29:34 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVCEsYTkfjXt9JbyrSFJL3KUCBSzFiP8fmRIdtihsYu1ux9MLxowSwMa//12j63CZaLyAa66l8VTb05PD18R2Yo X-Google-Smtp-Source: AGHT+IG0dwfuTQvOV7ogOF2NSV8vppbhMgUnBIky2IbUJtaREQS0fsKjrXG+LGV1CAdFDdwfR9cq X-Received: by 2002:ac8:7e8f:0:b0:445:3f1:4715 with SMTP id d75a77b69052e-44503f14c47mr66290031cf.36.1719505774385; Thu, 27 Jun 2024 09:29:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1719505774; cv=none; d=google.com; s=arc-20160816; b=fm4U1Ip9VyGdlA8wznFQXfwHOuMoG4ogamV3+im0tUK+ovaN7CY7Lky1WgK8/1GC+k mSz4J6uLs9KyG4A4UQ3SwZC4jKpX/qgm2c529ZFFvn33K6bd05aG/9e7KCaymWDIxS0Z cwTDupjlf5lGLLWPxba5MIaJRH7NYq6yOTSgG83gM5HIpFVUwrsL2jiBULslsbbSlq+9 45qd+p9S6cOkNNzutR7XKU9DkH3iddk0uU2N8RUP83LZjmgf+criO0trEn5k610A+Ljl K0143YJ4veyMR95+TRwZZI4vHIcnoOW+otGXr5hYKAj6rbLa1d4ZNmpz+b1v73et1xuX udOw== 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=SsWzBaT42Pcps68Pqu01vvv+C6po3s8FyjpSWrBt7mI=; fh=CQ9QAhiPZZ1APu1JLxgbtxAnzrroUJn9RCDrjAjVXrk=; b=lTsf5bdpLf7WhteEsNEOQ4B5uGBsjx3C8E1HjWjJ/Z/m961VuVyzVmkdQpfxeI/il8 WU75eGLCKo1XgrWPqZZAS1Hyk0qO4NIwcKIt7U4mjoIRXWSYWch0qHrnB72Bc5sklkQZ jmL5jW71HkiEuPYz8l2T7U3FTDq5Bw+gbFq6n5kScz+QqclD6bvRcJi2zLrM/nrIZOJh XpVEtFo3WzgN3mYk53sAlvOnD5+gPNV5LBDm/QJJbdss0YD5zRqcjC6m3C5bhUI4KwL+ 2Dur2PoiYRJC+u4a/r7vUDYgjjFYCLzhN3LsUP1HTe4RrdIPgbPCXIbZgg95tI7XLMmQ 6MAQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Dcfd+7nl; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-4464221c49fsi15766491cf.676.2024.06.27.09.29.34 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 27 Jun 2024 09:29:34 -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=Dcfd+7nl; 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 1sMs02-0007AM-Sg; Thu, 27 Jun 2024 12:29:30 -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 1sMs01-00074B-1n for qemu-devel@nongnu.org; Thu, 27 Jun 2024 12:29:29 -0400 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sMrzz-0003bX-HC for qemu-devel@nongnu.org; Thu, 27 Jun 2024 12:29:28 -0400 Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-424a3ccd0c0so27143405e9.1 for ; Thu, 27 Jun 2024 09:29:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1719505766; x=1720110566; 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=SsWzBaT42Pcps68Pqu01vvv+C6po3s8FyjpSWrBt7mI=; b=Dcfd+7nlE+ewoAwUDSjc/r/mqsb3XPO8/+oXQ56IWGPFPKdqLhRvqHmYl8CcTXo4ak yHUWHtg7JaMIB3SR5j78jMboWsk0hBPyHUoQGYQi1f3/V18M2XfdNpHdfjZklHjfsEGh lNzCxsgjOEtkfudVR16vfmWCieT1QmrKQQOt7Ivbcth2xxVVf6vZBqZlEXiZRs7M+YCA R2H8k+MtfdEC9sb/IuHcPx20wItTZX0WuKDJiGntrX+r449qJ072cMKg5Tar52y74/ql xf/iHAENHPfumpn/2Eg1djK7y5EV14nm+rHUEvUqBbBgYRFkLAbcRyfqo849l/hpfx1P iZcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719505766; x=1720110566; 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=SsWzBaT42Pcps68Pqu01vvv+C6po3s8FyjpSWrBt7mI=; b=fp5+N7emuU5Zj/vdrOGoOhrE1wxHVAE5zUYKLEZ4LPdM+6r7FLvSS18OmzEog1QvLE rrqiF+d430wGKF/Szm+r5Uc/xNK6HeAroZwXLoDIPsaUh5V9EiOI6SL5frZnjQohYR53 nJw3AvVfG4nGeE+Cns2aBldjmC1X2n9TrhpDcchG6ksB2PIpQ13oKWm+J2pwZntgDdxd rSqHHmdq3Q/hTTZlJSOvKjRrLWgGiipdt+jl9Vh0pglR6Vrfn6DjlYtG+zuJWjmb8b7L a+UHfnfmkR+g4eR5zeH4L6j9POXTf22qY6IO5/u4WFQaCj8PGfXtT/oIeYEsGJRAUpR9 qAlQ== X-Gm-Message-State: AOJu0Yz2yh9L+ZBo+4tLnUc6gtg3SunhiBAQ9nNpNJYoKcDKbf1ag3O2 fun3trwgklWh39B8RNx7TO95Y5qjLm6ysTDSeZdLVGz15ShBEiZrm69XTdmFQWbYOHxRF7wlteM lt1w= X-Received: by 2002:a05:600c:3b8b:b0:425:69b7:3361 with SMTP id 5b1f17b1804b1-42569b7352bmr1511495e9.18.1719505765858; Thu, 27 Jun 2024 09:29:25 -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-424c82515a1sm74222825e9.12.2024.06.27.09.29.22 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 27 Jun 2024 09:29:25 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, =?utf-8?q?C=C3=A9dric_Le_Goater?= , Francisco Iglesias , Bin Meng , Sai Pavan Boddu , Joel Stanley , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Luc Michel Subject: [PATCH v2 11/11] hw/sd/sdcard: Convert SEND_SCR to generic_read_byte (ACMD51) Date: Thu, 27 Jun 2024 18:27:29 +0200 Message-ID: <20240627162729.80909-12-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240627162729.80909-1-philmd@linaro.org> References: <20240627162729.80909-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::336; envelope-from=philmd@linaro.org; helo=mail-wm1-x336.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Signed-off-by: Philippe Mathieu-Daudé --- hw/sd/sd.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/hw/sd/sd.c b/hw/sd/sd.c index 8d02cd9a26..cd308e9a89 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -1785,10 +1785,7 @@ static sd_rsp_type_t sd_app_command(SDState *sd, case 51: /* ACMD51: SEND_SCR */ switch (sd->state) { case sd_transfer_state: - sd->state = sd_sendingdata_state; - sd->data_start = 0; - sd->data_offset = 0; - return sd_r1; + return sd_cmd_to_sendingdata(sd, req, 0, sd->scr, sizeof(sd->scr)); default: break; @@ -2138,6 +2135,7 @@ uint8_t sd_read_byte(SDState *sd) case 19: /* CMD19: SEND_TUNING_BLOCK (SD) */ case 22: /* ACMD22: SEND_NUM_WR_BLOCKS */ case 30: /* CMD30: SEND_WRITE_PROT */ + case 51: /* ACMD51: SEND_SCR */ case 56: /* CMD56: GEN_CMD */ sd_generic_read_byte(sd, &ret); break; @@ -2166,13 +2164,6 @@ uint8_t sd_read_byte(SDState *sd) } break; - case 51: /* ACMD51: SEND_SCR */ - ret = sd->scr[sd->data_offset ++]; - - if (sd->data_offset >= sizeof(sd->scr)) - sd->state = sd_transfer_state; - break; - default: qemu_log_mask(LOG_GUEST_ERROR, "%s: unknown command\n", __func__); return 0x00;