From patchwork Tue Jul 2 09:20:00 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: 809056 Delivered-To: patch@linaro.org Received: by 2002:adf:a199:0:b0:367:895a:4699 with SMTP id u25csp116693wru; Tue, 2 Jul 2024 02:23:30 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUn1J5ro0BzkcTEy7E4G7/rO7zjMcMVfKSxL4Pb2aSAdNB7Ax4J6kz7kiNBkVMlsZmiHW8rFTxImtl6ERS6func X-Google-Smtp-Source: AGHT+IES2CTQJ7QA3QWuFHizLKhOu6bqwaaJ/41nlhUuOQwjsBe5wIvd1y3vZyH0XN+NQEc42cU7 X-Received: by 2002:a05:622a:1483:b0:43e:3a65:3295 with SMTP id d75a77b69052e-446615febc3mr132002381cf.14.1719912210385; Tue, 02 Jul 2024 02:23:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1719912210; cv=none; d=google.com; s=arc-20160816; b=ILsupCWKQEdzx6l3ozubeL59lupyTz4CebcVA5aRnJPu5RBPYUPJUir/WpXkYpwjlJ C+08trT3pro7EY0YSgdOWawvwUHk/erqydueiwrCIjUfGY0NfptX4SwuOzSnEjWWUtgU L5YqpnCDj7iXD/ZgdUSEiA1NfvKbbQm6eN7SVm1KVOX1b5M8xwq4XbTr/yWO/H0rvkzp EqIGdBKakyxBJdzCP2syPvpKoyclPxiX6KWjHPoZ6UamzEzWmWmn8Vf/oWq2q+w6Sr4e /eTQtoWTzSLv7ufMd9gKwOepZ7I/C0aJmZ0+UWE+ZhT2eMCtLoczU1zRGVT8hYHoa6qt tJCA== 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=uMKhvT1FGVOx323MVuTarj+/Z918eObPJs1bE9cIdjE=; fh=/TyiCVzPJVYkT4NtrOYZRXAcrkaiLXA/rwqp4QqIc5M=; b=vaDbI2xFtj7XLonLqHWbqrbFwVRVlf7RczpF7gjXzYRDI45+Y6xSREWAy4kcX1deyT CcbOxGkPZEvlv06N3yLruPsNEeVtuG0DXsdEG9VMHMtwYKZm03leTen2c7fCvUore8Al gmQTv5zAxhR6UG33XrEtq8qpEZoXZ9FbWayKxxBV2zP+Ig4Bm6F8HlowdnfJJgGnIVkP botub9wS+ieKYIcacrxOOBLwjYDIL8sJNDc/cEHXasHgatAlSDpHB+Bj9UBbsx4+cWVc IkFLPv1ezcLvfEInnyeZ7b2oKg4HlWeomYS13Uxxgzyt+rboz2bWl6XoW1/VJFsrMHTF SumQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="y/ICYbk2"; 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-446514e5508si97587221cf.764.2024.07.02.02.23.30 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 02 Jul 2024 02:23:30 -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="y/ICYbk2"; 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 1sOZiu-0003uI-OW; Tue, 02 Jul 2024 05:22:52 -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 1sOZis-0003kg-Fr for qemu-devel@nongnu.org; Tue, 02 Jul 2024 05:22:50 -0400 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sOZie-0006Y5-D7 for qemu-devel@nongnu.org; Tue, 02 Jul 2024 05:22:50 -0400 Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-4256eec963eso27758645e9.1 for ; Tue, 02 Jul 2024 02:22:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1719912154; x=1720516954; 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=uMKhvT1FGVOx323MVuTarj+/Z918eObPJs1bE9cIdjE=; b=y/ICYbk2DFgRAQ7/GP3L1w7BVKWdD2KDhjCMFJ7YVjKCpTCriBv/iUcnmj9ojfas70 DcxWDCgierEWzP4+iPrBiK1fIbBz4aIx9EoxjhULvCOkHOg39EI1VwwOr3Pw6An3NRI0 kycA29KrGjWY86pWlQPsTFg7QIr6WGhHc8jS6/AG5ifCEfN4u+Sz4X966y3a5U8gB03b J57nZ2+p/QpT1ohSKTYAxf8lYpOOQeDHrzjRuNgrjJYtajg7zHoWG73eKu0CLkSvsHIQ Nww/Lpxd92xtLpzjuAsIB1q7ON0AiMze2HzX+WdKEKmYdKbi/xX+M5WIV4cqxqIDLjEt hr0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719912154; x=1720516954; 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=uMKhvT1FGVOx323MVuTarj+/Z918eObPJs1bE9cIdjE=; b=O571jRmKdNhcJnuy8PxcSDFK5jHLc4Zgek5lNM1JcLR1hbtS7txEbtRm2dHzQJTVat 337bn0NXt2cxVqQq/AodJ5tcV1309Y8IR6k1t8uJw71kZYBrHq+WKPDgxPK/VP3P+Sq/ dFxKd+uNq//SJB17MPD/qR/ll+p8JMaj3UCSgML9wKaLeVqModzCPHK8F7cD+bM4jeaW KC9qOJIGPcDF14mCLEc0Z9F5k4s3f2Ap2P14N0/lfRZswU1sIuZh4nXJeGhzHCSEevpk 3d8Co55QwnXnrTCMVJlZrWVQSj04emaB8MP5x7i67UCY2r7K7A75fpiA+T3pndBYHNGz jiig== X-Gm-Message-State: AOJu0YwrXEGSYkUes69RzZJp5iaskw9QnRnE81XR98sZSNGtIZdKJKNP hVLAv7euBLOOCM4VfPneYhgeltHk1iodm5uR7QjgCYa+yr4og9F/HQPzyztSzPjq87xtmV4sN9u F X-Received: by 2002:a05:600c:181b:b0:421:7bed:5274 with SMTP id 5b1f17b1804b1-4257a02f7f0mr58623805e9.10.1719912153756; Tue, 02 Jul 2024 02:22:33 -0700 (PDT) Received: from m1x-phil.lan ([176.187.209.58]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4257cdf4982sm110284735e9.47.2024.07.02.02.22.32 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 02 Jul 2024 02:22:33 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?C?= =?utf-8?q?=C3=A9dric_Le_Goater?= Subject: [PULL 17/67] hw/sd/sdcard: Duplicate READ_SINGLE_BLOCK / READ_MULTIPLE_BLOCK cases Date: Tue, 2 Jul 2024 11:20:00 +0200 Message-ID: <20240702092051.45754-18-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240702092051.45754-1-philmd@linaro.org> References: <20240702092051.45754-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::329; envelope-from=philmd@linaro.org; helo=mail-wm1-x329.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, 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é Tested-by: Cédric Le Goater Reviewed-by: Cédric Le Goater Message-Id: <20240628070216.92609-22-philmd@linaro.org> --- hw/sd/sd.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/hw/sd/sd.c b/hw/sd/sd.c index 6b02e0a178..43e0a2d925 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -1390,6 +1390,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) {