From patchwork Thu Jun 27 16:27:27 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: 807834 Delivered-To: patch@linaro.org Received: by 2002:adf:e842:0:b0:362:4979:7f74 with SMTP id d2csp891456wrn; Thu, 27 Jun 2024 09:29:20 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXj/gQN8O3sm5oQARuozPfCh1WUTwBzvn8kRwqDyWa7zoCCgDDxdYeteDH8AV0pqTTRVefNA9x/faTd15zGr2VP X-Google-Smtp-Source: AGHT+IEQU+XliqUNz+ZvF8tJuD07yWQdi8niWcHWEasHWF6bqIli24kT+NX67AVHxMnQZlLafyoe X-Received: by 2002:a05:6808:14c6:b0:3d2:2703:2573 with SMTP id 5614622812f47-3d543acb10cmr18350575b6e.8.1719505760025; Thu, 27 Jun 2024 09:29:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1719505759; cv=none; d=google.com; s=arc-20160816; b=OE4ZrWbHAPC46GExVUAAPMyxiOUwbJYlsIGtofFkWxsoNBwwcwdcuJ4bosBz9eypVJ 1cWz2UyodNETRo5JSllu3hGpSinF0ZtDymy458bod8j8xfn9rlVOOl82kurqtFZf0GxX cPgMlIZCLlFkRtgQY2tbkdFpCFEhBQwKE4zlN+LveQ554VKqhn0alHpxJz2chVLKboD7 63ED5f0LBAbs5mkn2xGQ8En0ZyJXsH7czElDJfyBXP6bz5bbUcC7qJY5i3D2ovQpbPne SMLRBZIT2XiF3zZ+ctR3vWDZmCrTfTptFS1EYEofDSgsawSUSuUtBTK/SXEnH+MPm4Ou /fAQ== 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=1KciARHbIYi2vnj7HB8fhMsqIK9cJrPhhDCahh6cG1M=; fh=CQ9QAhiPZZ1APu1JLxgbtxAnzrroUJn9RCDrjAjVXrk=; b=hbDa4g2SrdMI4HIEyEqUca+Grah2ECu6hp1gj3W6YGXNAozq4OxpQjk9UyChQEL9Rf SfWxC23s6SL1upJC1BEXtEVenbnvFsZQQufHa56Iat4INTRLzA6cuMZfqj8c1XQ+WzpL xarKrgfA+U1iFNduj0s5FVQlECSLvGp/HZzbQ9R4MIfGui2Q/EBiEEA6N06YiodDzME2 +QJrmaOI4TlF4JWoe6V3QM4nJ6y+TmiUzyLffYIfw8sKnkNhpGOPITX8EZHSD+DqhJCw r6nyeKOru/owtaIMnetPw+7+D2SOuNoGZzAxXCfY7SpRBgarLS4YhdygLwBLQkIqs+s3 SYDw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qvke0LxH; 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-44642245665si16080301cf.778.2024.06.27.09.29.19 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 27 Jun 2024 09:29:19 -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=qvke0LxH; 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 1sMrzg-0004yX-6M; Thu, 27 Jun 2024 12:29: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 1sMrze-0004sE-Uz for qemu-devel@nongnu.org; Thu, 27 Jun 2024 12:29:06 -0400 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sMrzd-0003ZC-7C for qemu-devel@nongnu.org; Thu, 27 Jun 2024 12:29:06 -0400 Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-424720e73e1so65536935e9.1 for ; Thu, 27 Jun 2024 09:29:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1719505743; x=1720110543; 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=1KciARHbIYi2vnj7HB8fhMsqIK9cJrPhhDCahh6cG1M=; b=qvke0LxHfA+oPmBvXwOWvEECPBfNBGeoJPSfT13JCrK0MbyDQAWGiVpCvPwqkQnBpy gdyMcIQMh2vo8xCEz8Gq7tJ3s7aUdXN2UkC9/6Q9dWXcMhSH69WfHTY8FLEuypzWudM8 zfwtzMDF5slvINtAAV/nZj1bUTb/2NRF/uLHqv9YbYNqPr3OMi0TU3OlId8V6pgkEAXY qUNyopUNeH8XUieIu/SrjFyR10DvZgNQGU+UDrsgPYin8CCCLtXQi/Kyvnbb2n/YABde Yf1mnIl076USdpYDqgSzp5vR9JrEZtWI0o760f/+RvpzmqRzxiXNiSqCEbytrple5YBt Paow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719505743; x=1720110543; 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=1KciARHbIYi2vnj7HB8fhMsqIK9cJrPhhDCahh6cG1M=; b=b0vmKCK8y89errjVjrzMdS4s6IFzcq50o6+1Dv/6CntCEXD0QxHff/fuBmcTfBTKTK RKrcmjNi58I1hm26MnLnFAjoIXTT0njxpilLCuUQ5g4rl8pAoueBLBUeSxoXYOzDydPe 9Gf/npzeL7GnzjiASNk3WYm6R4KNarkTlb7HHTiMec7UBaGbC5IvKIAteILZXF4YlBBW ESo9MN7G7oxnnwBEpGG6ZvuNhie1jtndl1vQxoegx3FJ0ylUvnuNMDFtVB4HyuOB+Upr zYq4QExkEDZ1JA7bpe94B/ahvshgqo9DarXTQBpx0AXE3QBbeolXTRdywM20wuFFB5kE 9+OQ== X-Gm-Message-State: AOJu0YzV71LhTxNQG1jCA9yJbtcsCbKR8sNxNcpEkgMmGjzqhT5oeFpJ yvSHJcBKYF/76yeUwlDh+kHZ8BRy86AJvdSOZBAGR8812v0tPipkPZghouWtaexbOu7M4Ua6mlD /S/8= X-Received: by 2002:a05:600c:a:b0:424:ad14:6b79 with SMTP id 5b1f17b1804b1-424ad146e41mr34288125e9.8.1719505743684; Thu, 27 Jun 2024 09:29: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-367436998fbsm2359860f8f.84.2024.06.27.09.28.59 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 27 Jun 2024 09:29:02 -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 09/11] hw/sd/sdcard: Convert SD_STATUS to generic_read_byte (ACMD13) Date: Thu, 27 Jun 2024 18:27:27 +0200 Message-ID: <20240627162729.80909-10-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::335; envelope-from=philmd@linaro.org; helo=mail-wm1-x335.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Signed-off-by: Philippe Mathieu-Daudé --- hw/sd/sd.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/hw/sd/sd.c b/hw/sd/sd.c index ccf81b9e59..1c4811f410 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -1703,10 +1703,9 @@ static sd_rsp_type_t sd_app_command(SDState *sd, case 13: /* ACMD13: SD_STATUS */ 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->sd_status, + sizeof(sd->sd_status)); default: break; @@ -2136,6 +2135,7 @@ uint8_t sd_read_byte(SDState *sd) case 6: /* CMD6: SWITCH_FUNCTION */ case 9: /* CMD9: SEND_CSD */ case 10: /* CMD10: SEND_CID */ + case 13: /* ACMD13: SD_STATUS */ case 17: /* CMD17: READ_SINGLE_BLOCK */ case 19: /* CMD19: SEND_TUNING_BLOCK (SD) */ case 30: /* CMD30: SEND_WRITE_PROT */ @@ -2143,13 +2143,6 @@ uint8_t sd_read_byte(SDState *sd) sd_generic_read_byte(sd, &ret); break; - case 13: /* ACMD13: SD_STATUS */ - ret = sd->sd_status[sd->data_offset ++]; - - if (sd->data_offset >= sizeof(sd->sd_status)) - 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",