From patchwork Fri Jun 28 07:01:02 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: 808204 Delivered-To: patch@linaro.org Received: by 2002:adf:fe0a:0:b0:362:4979:7f74 with SMTP id n10csp224560wrr; Fri, 28 Jun 2024 00:12:38 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCU6WOtTMM+5pTKdEszimSb8zvBWMJBFZY9KbUSBwceMY9UW44khnUxRsCWe7iAwk2J11LSh84zWJLVKJoe/QHpW X-Google-Smtp-Source: AGHT+IFBaaL0xpcJsg5w57EEt/VD8c8FAtTJjsu4pBOY7dO2oIUN9v5mUaQJfL6rHFnmYqk++P07 X-Received: by 2002:ac8:5d8e:0:b0:444:f5f1:af3e with SMTP id d75a77b69052e-444f5f1b5abmr152039171cf.32.1719558757948; Fri, 28 Jun 2024 00:12:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1719558757; cv=none; d=google.com; s=arc-20160816; b=ErxTbAR/7TF/v5EMW5ooDh/UfU8gRjHGu8Xo1mlzm0cf4UsTuTxf+6Tl84hQ2RGBX+ FH0kyCEQAjkz/ZH5gNrerro/Myl1QFLUya8i95IyzXXQc/NPzAFW4KDcWSdMmE1L+4vN e/4Bii52D96EAI0uUWnviqnDytPKMxqZH8wtxSZERfUF7VmHDoC0sImPhsq4FfUYIJg0 qKc4slc9RtTpbzzzEhYMVXVAgoVHF8ZysBypA9M8mL5SvLXO3M14Adbg0mhM+odDUm+N kcGE7VuM6Lf6197srBQ3nnwaRzMgjd0lziX4juwzon6R63NcBDsVtdJZCFqtIAj1YqT9 qSPQ== 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:to:from :dkim-signature; bh=vHrlK0ssSPoiMv6JdxaV3fer0W42cR0Lk/0TJKW1fyM=; fh=Vqz0ILX7NeXJwCG5xiS+Wtk94IhOmAmLtOfN3kRbil4=; b=ktXlvsGxcrqWtA+C0Dyn5/2l18uvRlO85SwLJO8AgZx021GUMvCLeMnyMcahuTAbgv DOjhKt+35uva8P/m7shGWrddCEhcoz1vfBulPLT79dEPNWotlZ6L1CNCCRHptrjB84BM AtXogKJIwlBDPvmyKlDAaV7nyH9a7VWfBbwt9BiBVjJnzF5ZAIFEt76swoBBnATWTmst oK6aF6AxGBExCHKGdvFfw2LU7LKHS6+CQTEX145XaDDPMSvYoyESudkuRfEXlm5I/E1t 2NBqBBJ6fPV5QWVaz+h9DeBvaeuIfFHQkRbP653MjB6hD7LqN23sM9GWWXRVRtGEpQc7 W1Xg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=v+LyBQ2u; 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-446514c2632si12584781cf.550.2024.06.28.00.12.37 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 28 Jun 2024 00:12:37 -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=v+LyBQ2u; 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 1sN5fc-0005Um-Um; Fri, 28 Jun 2024 03:05: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 1sN5fR-0004fv-L7 for qemu-devel@nongnu.org; Fri, 28 Jun 2024 03:05:13 -0400 Received: from mail-lj1-x231.google.com ([2a00:1450:4864:20::231]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sN5fP-0000tL-Hf for qemu-devel@nongnu.org; Fri, 28 Jun 2024 03:05:09 -0400 Received: by mail-lj1-x231.google.com with SMTP id 38308e7fff4ca-2eaa89464a3so2279001fa.3 for ; Fri, 28 Jun 2024 00:05:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1719558305; x=1720163105; 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=vHrlK0ssSPoiMv6JdxaV3fer0W42cR0Lk/0TJKW1fyM=; b=v+LyBQ2ujnCM/IWL39NRPfLWAWv24mpi7J0dIQBpHeqgJuXcqthH3XUNvunWaIhuqw yt/eWkJE86qcL6VNRrhyyCkgT/Y3gLmZnAmYq4kNebnmcm9mtqjZ/87v9+J2H/OiYtaX mE14S/essPEif7yKaY7ENoFUPmSN70o57/vQblu472psovJ7OnxQl0NBI8nZODdUlk0O WDKQPQpNr3O4/CZQSDyJkpbSyxjLhNxRJhgu7pMfxLfydc1ewS1MXgwaot0foE+eP4Az LB2hchnt7vVFtEmXCn0618xz0vdamtQgOehWP6vFRYs/QfNZZl8G6UEGNb33ozIOdeqK wusA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719558305; x=1720163105; 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=vHrlK0ssSPoiMv6JdxaV3fer0W42cR0Lk/0TJKW1fyM=; b=LYhkHQc+nz8RVsxnMCZMgqAKBoUTn+TA3rBQuAweqFPkQA3qdrhS5aJyMHjjzI2XMx tDGa2h31jtdhqLzRe7bj6ZhsVMiz4Gh22ChjiQbfwoM5egAaOa5ZIU1pXv/A2ADC2Bnw QVxWf9BVDG7Fh5Af03NxASTiqCmc2fDM0RH71Q4GFfGj+O9NkusvFDxb2LSE+GY0b/kx O4iz+31NyZbtuS30w2nwhvMBnd3/3crxt30N0+xhLluWmpvm23A9zwgi4ID4XDqPCPgI s4OEck2VdRDjQoKIY5tTILDkZ+N5UHQv+QGNZf4WyXFeAeX8mUipCHCtAvbNVYhf7KnY R07g== X-Gm-Message-State: AOJu0YxxuO/wf+rPjYt86tM4QnN7mIRjsc5/n50MMlcJZy5/JqSZzaKV 6Oyv5X3/IwbFWYqsv4S3DgwFN3cMFcrnWGZjsHrE3r6nUTENtNt4vySkKc8zmnh/DWMwQbYOYXT S/Rs= X-Received: by 2002:a2e:3c03:0:b0:2ec:4529:9690 with SMTP id 38308e7fff4ca-2ec57967b72mr91283161fa.3.1719558305105; Fri, 28 Jun 2024 00:05:05 -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 5b1f17b1804b1-4256af3b8c0sm21400365e9.2.2024.06.28.00.05.04 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 28 Jun 2024 00:05:04 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, =?utf-8?q?C=C3=A9dric_Le_Goater?= Subject: [PATCH v42 26/98] hw/sd/sdcard: Convert SD_STATUS to generic_read_byte (ACMD13) Date: Fri, 28 Jun 2024 09:01:02 +0200 Message-ID: <20240628070216.92609-27-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 Received-SPF: pass client-ip=2a00:1450:4864:20::231; envelope-from=philmd@linaro.org; helo=mail-lj1-x231.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é Reviewed-by: Cédric Le Goater --- 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",