From patchwork Tue Aug 6 12:51:43 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: 817042 Delivered-To: patch@linaro.org Received: by 2002:adf:e00d:0:b0:367:895a:4699 with SMTP id s13csp1783066wrh; Tue, 6 Aug 2024 05:54:42 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCX+ZDuABbYcOTIZzeGlE3cbnT8KbqaVjl+bU3SD160yG5ExYwLMhPFIhiVB106eZff/NXxBeQMlhbbkyZRRDwoa X-Google-Smtp-Source: AGHT+IFOek1ZfkyvigM5/fP1U5uelifDRib4NhS4xPR5yWF+edWvnSiBNOmeMp3wEG3IYIMJTDSQ X-Received: by 2002:a05:6830:2105:b0:708:b083:86c8 with SMTP id 46e09a7af769-709b995c407mr22324109a34.21.1722948882295; Tue, 06 Aug 2024 05:54:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1722948882; cv=none; d=google.com; s=arc-20160816; b=GBGVdkkoisSZqi0Uyhq2yEjGbcjUZViu6XmHjow7knN1yewLXxHNSPaNTlQyhEgyLu RsSNjf0iIMMSQZES5PAkI5s5QThJofFTu/qUkblvEvtxZgDyfMLJIc0mRbvGdaZhX8QZ jrxJoEsAMNs/dyyvpYYgBXjwRhNilAsODflZ3IPwSriQu7pzIJGk0iAXkPrfDIrKS6X9 ggW+oryrwxt/xvSkpQA9vBXMiMgA6p1lryWdARkjgYOJgwWMUBz6NZe+hN8z/j05rIwt 7t1qVkTV72VPAJY9U4M8yr/nhxEXTis7J9Jr40wPPuFjMpuG+YL5YdJuRuWVwXjJX74F A1Rw== 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=wBx0ReACLauBHHw6c0ZSc7DkdUMOkNRvc02ZcjHiRGU=; fh=qtn8prgQtzf5IzCNvLChUZDElvNECP6ej9YfjQeBz3I=; b=CAFPt+ZusKtAOmFD7NCOFIJJllrDcOzphtdd4a3StPcFm7byzgzjhsA03ejqAJsTuf ANJLzX5SBK9f93x8uRr9H8MBN9dbRNwM1ygVExj8hBX/BnJZhiRwjEvT2sFcA682srvk 1qagZTY+jkqRkEq/81TtiGcEFcyco4c4/KWI+Jo0UNzjDUPlm3y2t6Zp27KtJ0xgtM1u 5jSLMhYRNj5tFqtG7A6UZSVM/BdhTw1aHdBAGgNZeEDlkuS51hltIperMzAswoQ7SVeG cwPeU54smJzkzOvT/x112VvwBvzNj7wXGxXq2r+jVl0NC9iqaqgtbNxs1lSS5+T5uhG2 Vebg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="uuGn/DaC"; 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-4518a6be307si128797151cf.93.2024.08.06.05.54.42 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 06 Aug 2024 05:54:42 -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="uuGn/DaC"; 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 1sbJh5-0004Q5-HN; Tue, 06 Aug 2024 08:53:39 -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 1sbJh3-0004AO-VT for qemu-devel@nongnu.org; Tue, 06 Aug 2024 08:53:37 -0400 Received: from mail-ed1-x530.google.com ([2a00:1450:4864:20::530]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sbJh2-00007e-2r for qemu-devel@nongnu.org; Tue, 06 Aug 2024 08:53:37 -0400 Received: by mail-ed1-x530.google.com with SMTP id 4fb4d7f45d1cf-5b8c2a6135dso940252a12.1 for ; Tue, 06 Aug 2024 05:53:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1722948814; x=1723553614; 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=wBx0ReACLauBHHw6c0ZSc7DkdUMOkNRvc02ZcjHiRGU=; b=uuGn/DaCJgBRtNzbOAUHwN+KNLYRPbOjcfyGa4hCpdrwWyfrBIjRldzj7zrDCMS1Mh qjKJW0KnyiZRqOs2rTPmiYEi1tByWhs36tDW86LIF5q3ui6xcvxZC84Q6tb57BSAPoUg FKS8Ae+fTNqSnTSSe+eXwq3JZ07Rws3PheoNAdGqfF3Yy42WgoOn40pwUzv+jU57QMQi pPukO1Y+lVyY2ux2C7/wSR9c+ccY/MEBJXzBxGPhtLfFrPT3+cyKJlzQ9mVcBPAaSZse nlPwQ5kWj7n4Z3QVQAvDfyncaolExF5BKKBBXsRcJ4yF5nMxs5jkFk+3t18XXsxzPm3h GYtA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722948814; x=1723553614; 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=wBx0ReACLauBHHw6c0ZSc7DkdUMOkNRvc02ZcjHiRGU=; b=UxBN2Xew4HmJw4VshbaO+fX5K2dEKNuJjnEKq0hy65EWY8NEZR12UoPlJp32PjFr0Q Y7BQHr/oHPABbJmwIFL/3hkKVUMUDNg9r2qcdjKjYC0nuEHr0KUFlgRWgeACg6XAwkR5 Jfke3FG8yOHBP5071K4Doq6LkKt4BcdnVFzBjyMBmPD6ut/5w9eKLXhPcm8mXKA5vXbQ EE46uOR5v1Z1khngMLbgg5Q3c/LQhAPt6y8V2dQDK/0IpnALwOm8sjtTkrbGQlxbm0t9 OWnEzxaP0SwQL9gyAikFIZtsQqmX6q+q6fSN7CqKj/OSvmDY6xcIJMEwwjWDMsLh+fSh 7Yug== X-Gm-Message-State: AOJu0Yz3rsHiJuTgVxvSvuQzO5f4OVvtqJL2MQBovFJ+U9QPXV9WFj7a IS1LLXrbREKZcir8uknlc/UNkVoRIJ8e11zYo0g3RB3V3/qBL6wgQVBZ1EMrBSTdn3xi4zhuH0v T X-Received: by 2002:a17:907:3f9d:b0:a7a:97ca:3059 with SMTP id a640c23a62f3a-a7dc4fbeb22mr1168855566b.34.1722948814075; Tue, 06 Aug 2024 05:53:34 -0700 (PDT) Received: from m1x-phil.lan (cor91-h02-176-184-30-206.dsl.sta.abo.bbox.fr. [176.184.30.206]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a7dc9d43920sm542964866b.102.2024.08.06.05.53.32 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 06 Aug 2024 05:53: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?= , Richard Henderson Subject: [PULL 15/28] hw/sd/sdcard: Explicit dummy byte value Date: Tue, 6 Aug 2024 14:51:43 +0200 Message-ID: <20240806125157.91185-16-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240806125157.91185-1-philmd@linaro.org> References: <20240806125157.91185-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::530; envelope-from=philmd@linaro.org; helo=mail-ed1-x530.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 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 Message-Id: <20240730092138.32443-2-philmd@linaro.org> --- 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..de27e34fc8 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 */ + 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); }