From patchwork Tue Jun 25 06:10:08 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: 807256 Delivered-To: patch@linaro.org Received: by 2002:a5d:508d:0:b0:362:4979:7f74 with SMTP id a13csp2199943wrt; Mon, 24 Jun 2024 23:11:35 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXbtHi6WuGq3mKK0d5REKW+iJJE5k45wBTS0p213mJHJj9nnmWho6yqQB+SjiwpdkjKcxSpkOk0LiQnRPSWTV/W X-Google-Smtp-Source: AGHT+IG2lDAtsULVb8uQfclBWqBrgqkTFBXnvTQlVDc0anHKXFcbS3bKSpXReBVbExOix36l4kaP X-Received: by 2002:a05:620a:2484:b0:794:e711:953d with SMTP id af79cd13be357-79be6e8b076mr645720885a.41.1719295895511; Mon, 24 Jun 2024 23:11:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1719295895; cv=none; d=google.com; s=arc-20160816; b=uoBdXGBtpZrzsyQ3ctYGlsC+TDKjQzV+Bg75IbwpNmYWTI6fvbqSC8YD2XKs4bwERc O4Reig3p7iNysGzvFwj+dR5FZ+0ucRp0ShPw0WQnp0vmxd97UPDG+0bvJWRgUH1TcWBl sCdD3R9ABRmKMKLcofP+agOehW9zMbo8aLGEmoHRQxQBub6BgiG3YR7xANj3aYwGXHDX 8LTMtv461CVbl+qULj9ZoIt9NIzuV6+VGPv/sLKTcDcpdVycw21bcc2WQ+dhMrQ5wKBW AcKdMJGSHoH8y/BOh3C3B0APKHBoKeJfdD1nEefb2TmJ2bEA3xrvJlaUhYTSSEIfmUrp t9Wg== 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=uU8msdfI4FBbYYSxzgmdaaqhmtNKe2zgeh42ZfcMs0o=; fh=/JlK2oR+rOwYm4wA2OuQV1gEZ6kNvrQcYuDHZ182k9M=; b=jQSse5mfJIX30FutgoOYoOBVjpmbtKZ5bG+ggb3MAatIH2vgBTlfnnvXzG8q87cU3u EfEqCQy2UJ/2oSXmAfDvssu4gVrKP08VNBvgi3RKOcMeV5hx4/o49rMNyIZ+qzg4R6Jq 63V9HJcI1j0k8ItiV3t/iGClY6a5Q0DCszcwVXkF+qVUtmGbEv3a88VU4ws64k+IX0U7 +IAEcutLWB6iy1PhJnta4RWsuMgTlypyNIy+chpdBlF7rWiSlfJ/hXKAIEpUxgYp9ot6 htTyPPYmAiXcovFGMfTLE2DVYu2YchJJlTYdMCJxnpX+sgeC0+wgwDd8C+eEyC5iHeZD LTxA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GatTWml4; 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 af79cd13be357-79bce92df09si989725285a.494.2024.06.24.23.11.35 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 24 Jun 2024 23:11:35 -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=GatTWml4; 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 1sLzOI-0000Ci-3Q; Tue, 25 Jun 2024 02:10:54 -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 1sLzOB-0008GJ-Ab for qemu-devel@nongnu.org; Tue, 25 Jun 2024 02:10:49 -0400 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sLzO9-0005dC-MA for qemu-devel@nongnu.org; Tue, 25 Jun 2024 02:10:47 -0400 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-42189d3c7efso56282325e9.2 for ; Mon, 24 Jun 2024 23:10:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1719295844; x=1719900644; 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=uU8msdfI4FBbYYSxzgmdaaqhmtNKe2zgeh42ZfcMs0o=; b=GatTWml4m5ZLmjyEyDSV3UPo5zFfadDGOTt9lhrPn3dwsvp1KY6FEufVnpR/xdMEfD vCIZK9HK8wp0c2pSoI1aH10HMVrmdAExL2qdIpPGRjyac8VvP/PfMqgHo7+c9ORncXtk MErqLwCLA6GZD+bRgBbAGwYOp8TvZvPn+oa0u+h3N8CCkeLNsva2AWrdN46zRPogbc6e rOLsni7FNVJ3YdJbVdMncakhQYIITYDCRUT8rTNsi0NpKWLkbruJjNLKNlZaYSwusWRX LOtOypQeWVDnrPZMaobS793lEBjgII6OWGo7otiB7Y9n1+r7bojdJWBmpdPz/b8AdRJe SmvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719295844; x=1719900644; 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=uU8msdfI4FBbYYSxzgmdaaqhmtNKe2zgeh42ZfcMs0o=; b=wWWCXo6M8mt2rnuMoUM+W3tyuUUaoN4304MKTMsCFLe5yyevri4dPgMnqgoO6vWrry Mh9uNW2ntFtt7rzMKHfNNy1d5BYDS8PiqNKmfod65oiIkLmohQq9+10STAKDFZd49iO2 EpFyoA0e5T3wJNk7s5BfBdqTF9/ocBQYnfZ08NyYwbTJfOMck8lmA7dEM6DfWfm1nzOG p2JlAWIfe+BhCixeFqkaBvofpIW2gM+svfDWuC+y3a0Nqm6uFUuNtpvfc3l0t+ZuZKnP IDDI1G2SccOtRs0SUUbkYr9flwGnvFh4Zyw8NoE/F6ezKL0tkN8IRMhdYs1dbUkQSKBg 2q/g== X-Gm-Message-State: AOJu0Yw9g5LLLq/FJvDZ6ENIWR1EwRtBXRSVMZ7TX75oUHPc2gkTDpL2 vkgdYHWQaCAWy6NXY9Om1AEgkUf1XEabOZEb4RH/ODOMhRf8zbSXw+WmdqqeSDYXqjk2XmQfOVF e X-Received: by 2002:a05:600c:5692:b0:424:8dba:4a43 with SMTP id 5b1f17b1804b1-4248dba4d52mr51090685e9.5.1719295843947; Mon, 24 Jun 2024 23:10:43 -0700 (PDT) Received: from m1x-phil.lan (bd137-h02-176-184-46-22.dsl.sta.abo.bbox.fr. [176.184.46.22]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42481910f64sm162488035e9.34.2024.06.24.23.10.42 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 24 Jun 2024 23:10:43 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?C=C3=A9dric_Le_Goater?= , qemu-block@nongnu.org, Bin Meng , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH 04/11] hw/sd/sdcard: Duplicate READ_SINGLE_BLOCK / READ_MULTIPLE_BLOCK cases Date: Tue, 25 Jun 2024 08:10:08 +0200 Message-ID: <20240625061015.24095-5-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240625061015.24095-1-philmd@linaro.org> References: <20240625061015.24095-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32f; envelope-from=philmd@linaro.org; helo=mail-wm1-x32f.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 In order to modify the READ_SINGLE_BLOCK case in the next commit, duplicate it first. Signed-off-by: Philippe Mathieu-Daudé --- hw/sd/sd.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/hw/sd/sd.c b/hw/sd/sd.c index 346bd657a7..9aaa78a334 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -1376,6 +1376,24 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req) break; case 17: /* CMD17: READ_SINGLE_BLOCK */ + addr = sd_req_get_address(sd, req); + switch (sd->state) { + case sd_transfer_state: + + 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; + + default: + break; + } + break; + case 18: /* CMD18: READ_MULTIPLE_BLOCK */ addr = sd_req_get_address(sd, req); switch (sd->state) {