From nobody Mon Nov 25 01:34:19 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1719295895; cv=none; d=zohomail.com; s=zohoarc; b=PFYeNvycKGfzNcKsUCh9+1asynxs1hh8AIPWgnURWwgTGrNMhCwfH7u8eCCBhuO3adgnanNOxexr00EocsIjvkXr6Czj6ZsVIGicC4r3SA/FYq4lnoRVLIwK5Uc0L3xkTxs7yoGgiwKubltDucQTxtYWCViokNc2PkmSh5UN2uM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1719295895; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=uU8msdfI4FBbYYSxzgmdaaqhmtNKe2zgeh42ZfcMs0o=; b=koImtClihLikOEALeIO2ci9gmeKADmIFRK7MOQfraeTnNQZECJXdLlAtJs2NGosTXmgmeYVWZ3FoSXf58NrAH+bOA4Qi4Xq2znuCbbnbkqnWmkGd85DfbzNdjuI+hylAZcvOnAjFw73IF4YayCOfIb0w2rgkKfP6zN1yJotzKRk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 17192958957941014.7923542260958; Mon, 24 Jun 2024 23:11:35 -0700 (PDT) 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) 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) 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-Google-Smtp-Source: AGHT+IEQX7noy1synhblTSoxNbfXczeShx3yEU/gGbPMqgRvoETfNdLb9MXJgdKwxTN8t43Zf/xTuA== 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) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , qemu-block@nongnu.org, Bin Meng , =?UTF-8?q?Philippe=20Mathieu-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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1719295897242100007 In order to modify the READ_SINGLE_BLOCK case in the next commit, duplicate it first. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- 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; =20 case 17: /* CMD17: READ_SINGLE_BLOCK */ + addr =3D sd_req_get_address(sd, req); + switch (sd->state) { + case sd_transfer_state: + + if (!address_in_range(sd, "READ_SINGLE_BLOCK", addr, sd->blk_l= en)) { + return sd_r1; + } + + sd->state =3D sd_sendingdata_state; + sd->data_start =3D addr; + sd->data_offset =3D 0; + return sd_r1; + + default: + break; + } + break; + case 18: /* CMD18: READ_MULTIPLE_BLOCK */ addr =3D sd_req_get_address(sd, req); switch (sd->state) { --=20 2.41.0