From patchwork Tue Jul 30 09:21:34 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: 815276 Delivered-To: patch@linaro.org Received: by 2002:a5d:4acf:0:b0:367:895a:4699 with SMTP id y15csp210515wrs; Tue, 30 Jul 2024 02:23:24 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXpJjPmIp6/1YBaOe1FA+3c6djQpFcmavcgOspkM5AVmnpvqDowf7dsN3rgsHCehSRFxbr+iGn+IJfRjjJxliVL X-Google-Smtp-Source: AGHT+IGZjGkIoYxh1GP0Nc01oORSnPRr6VDmiQ6Qo6YJQM+S2VLMi+8qYKzHygTwQ551KnOEv8LZ X-Received: by 2002:a05:620a:1aa7:b0:79e:f9c8:a223 with SMTP id af79cd13be357-7a1e522f758mr1179172785a.6.1722331404741; Tue, 30 Jul 2024 02:23:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1722331404; cv=none; d=google.com; s=arc-20160816; b=PW5G6ip9chx19f1coKSEAhEZVpu3xfiASCPOn37VoFjR2nNa1Qr4SlRe/MntgsSFGr 7bkNnFo8IkWZYV7CM/vhFXCgTJGgQYzDAfyjioBfcWexEdwJq1EZGYiOg8Jluix2iCPf jcx5BOWBGFmNhCNOZylCQf5ADOYYlAjMDi6t9TI5pfCWI4TjhIdiiBoxZKFtTjOxS9DP CcqtWhxCMtj2x1dwAJh6bwnoMbPae7qFD3MrBer3J5x+0gOIU18b/hfACy/xyQK9AqdB 8VYN1ybMfawiTi0pe80qA+HV/4I0OKF3ZjVdZ2BL7YGnVSyK/J8tIIJFUcNS/vlZY2A3 NgYA== 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=tfhmWzmqXV6T/58ejZO+cBX3Heov2WpdbfnG9/jIhv0=; fh=0a1hE22G74W5F4G5a1EIh7TNSrHN0drAqcdv1Y9cvc8=; b=EZUlEwIMiuSMT16vgE4r2vZ7DOicdz74JwRZqEpSyCKotYBuAeFrcSjK74VQnFSqSg +PLmumnTa+bpLjgWozmhxVSyUvzlQHiWtcwtbqKUEfUivlZRIlfyRsexIH+YmE6mMj8n 2B+2d6GwnYLyngI6Xbr8ItmHt7ZRc6P808qfs82S8weNU/NVeNhAzHQsuU1tp/RY1lbr DDliXmq4CuEYWtVXKZMo7zs075e8nF0//XNoggpRGwFqzhpmB3mKAVcafBhGRq44eRLK PKFCTHBy9hMvMaqqZD/rj9d10+hDA7ej5hIn0Oz6+LRbV8o6YG0U93lOaVtBrgu84try RtKQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=nd1IN17c; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-450217803fdsi44449931cf.58.2024.07.30.02.23.24 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 30 Jul 2024 02:23:24 -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=nd1IN17c; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sYj3M-0008Ug-4i; Tue, 30 Jul 2024 05:21:56 -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 1sYj3L-0008Tk-1y for qemu-devel@nongnu.org; Tue, 30 Jul 2024 05:21:55 -0400 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sYj3J-0005jE-Ip for qemu-devel@nongnu.org; Tue, 30 Jul 2024 05:21:54 -0400 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-42808071810so24871735e9.1 for ; Tue, 30 Jul 2024 02:21:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1722331311; x=1722936111; 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=tfhmWzmqXV6T/58ejZO+cBX3Heov2WpdbfnG9/jIhv0=; b=nd1IN17c5Q+jk12PJtBiKJWLm4w56bTH+wCRPTl7UzRfOye6+pw/hCt/5ubHCNJp90 fU5Jwbxh26oQe0vu8GIShd0zkm6fVhcPhoMHJ/Ufd+XUAzkKU5YP4D2Ac5DqqhjvMQNt tWdormQguZm5x3PyzSeS1YQKo21TVXraS/pFkiZVv1vLb+9gelkFmZTTIpO9CBuYIpCz RTN6Q3DSsg+I2N6B5fKI4z2LnoqgpACnc0W/WyTu56oIoTylaeDeNilw0D/JIEsl86vv RvMR5RI25hjtjn4OQROkE4DkBJAPG/5y7v48HBbubsvLbRRb48xI7rN+SeOaKCoVc+JP aFXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722331311; x=1722936111; 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=tfhmWzmqXV6T/58ejZO+cBX3Heov2WpdbfnG9/jIhv0=; b=bTz0sHfM+/R5rY6JjOmaE++pjoSUXAYNdnP0XjwnmPTrvZ+Z8GRJfX1WWTMfV61Bfl j/HCPsgfkicYJny5fdvzsCPdJ63W6RogPsr8nXZXH7CzuEEeuIj/rf52YnlCI5pPTA5n nJAHkosXli1R+SUH2MgNk+hoSf/bk4bfEPacQD7Ej7zBZQudfgyYIyQ9WqnAKj9IfA2k PtDkqH0ZT9+9ie9p3Ui4aBINlWUhMIAbQ6fFLa+pYFrDUMfSqetNynli9K0hMMHfa5li 9F6NYwhIsi3wYZ2jGMXQdxgBzW289fMDgo14N8KDLExvQ7LzG/3h67eZRHpFNM8ANJqt iYzw== X-Gm-Message-State: AOJu0YxSOmX7jOTKWU/OuqJ/+zhIWbJooj/BlP6YmEJ0v76gTWoPx1GB 58tksf3ARXUShzFG9/DRj9VTKSzA/jMTogezmgqy/ijtifx819Qr99qSAWpMLMy3QrZiyrnn3II ZL6E= X-Received: by 2002:a5d:6188:0:b0:364:d2b6:4520 with SMTP id ffacd0b85a97d-36b5cdca638mr7523428f8f.0.1722331311572; Tue, 30 Jul 2024 02:21:51 -0700 (PDT) Received: from localhost.localdomain (82.red-88-28-10.dynamicip.rima-tde.net. [88.28.10.82]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-36b367fc7c3sm14119489f8f.49.2024.07.30.02.21.49 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 30 Jul 2024 02:21:51 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Bin Meng , Zheyu Ma , qemu-block@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH-for-9.1 1/5] hw/sd/sdcard: Explicit dummy byte value Date: Tue, 30 Jul 2024 11:21:34 +0200 Message-ID: <20240730092138.32443-2-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240730092138.32443-1-philmd@linaro.org> References: <20240730092138.32443-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::332; envelope-from=philmd@linaro.org; helo=mail-wm1-x332.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 On error the DAT lines are left unmodified to their previous states. QEMU returns 0x00 for convenience. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- hw/sd/sd.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/hw/sd/sd.c b/hw/sd/sd.c index 07cb97d88c..c02f04f1ea 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -2478,20 +2478,22 @@ void sd_write_byte(SDState *sd, uint8_t value) uint8_t sd_read_byte(SDState *sd) { /* TODO: Append CRCs */ + static const uint8_t dummy_byte = 0x00; uint8_t ret; uint32_t io_len; if (!sd->blk || !blk_is_inserted(sd->blk) || !sd->enable) - return 0x00; + return dummy_byte; if (sd->state != sd_sendingdata_state) { qemu_log_mask(LOG_GUEST_ERROR, "%s: not in Sending-Data state\n", __func__); - return 0x00; + return dummy_byte; } - if (sd->card_status & (ADDRESS_ERROR | WP_VIOLATION)) - return 0x00; + if (sd->card_status & (ADDRESS_ERROR | WP_VIOLATION)) { + return dummy_byte; + } io_len = sd_blk_len(sd); @@ -2517,7 +2519,7 @@ uint8_t sd_read_byte(SDState *sd) if (sd->data_offset == 0) { if (!address_in_range(sd, "READ_MULTIPLE_BLOCK", sd->data_start, io_len)) { - return 0x00; + return dummy_byte; } sd_blk_read(sd, sd->data_start, io_len); }