From nobody Thu May 16 06:30:31 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=1610129171; cv=none; d=zohomail.com; s=zohoarc; b=bF/ygx72SLXUEOgs2CTNfab9IXDQ/2Cy0ONTn4VsxUtId9APPW8PrbHnXfpEaWCoiBI91CTLMXBQFNvrimnCMqHDGfU/AbO37Ma4PoPKWvu3dm4ylRD9o/fkOErc3izSh9zcjzds/iS6Y0ZZX718bzcNZv0u4+QSndDd6aGkx1A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610129171; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=5ppBHYzxmgl5hzoC4HlriYit+ub13d9GiK837Ur2BnM=; b=Bof8a6E0IxmvCzaDH3P/BgCNn9Ni4Xy2x1Whcua6g+6dPNSb1DW+m7LPD9PbM1hAYH2xIDJLxoajJUpuZpPPiUyDdVJKJfGJ4zDwNrrXKnZxnXXbHmHsO1QX28iFT0b0U3SPWtaO4x8ead3NCvoXNu7FZLNWrnzH0kW/VvRwqfU= 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) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1610129171765506.1170049464188; Fri, 8 Jan 2021 10:06:11 -0800 (PST) Received: from localhost ([::1]:46314 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kxw9K-0001id-Kq for importer@patchew.org; Fri, 08 Jan 2021 13:06:10 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:47724) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kxw7N-0000Ib-E5 for qemu-devel@nongnu.org; Fri, 08 Jan 2021 13:04:09 -0500 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]:36113) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kxw7K-0000oi-HW for qemu-devel@nongnu.org; Fri, 08 Jan 2021 13:04:09 -0500 Received: by mail-wr1-x436.google.com with SMTP id t16so9866344wra.3 for ; Fri, 08 Jan 2021 10:04:05 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id s1sm13423029wrv.97.2021.01.08.10.04.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Jan 2021 10:04:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=5ppBHYzxmgl5hzoC4HlriYit+ub13d9GiK837Ur2BnM=; b=cYOu5ZhKgHgxLahkRk1JnxBaaA+Cae58P2KvgDh/HGo/HE0eDBuk8Y+iwi/y4invWN 1J20T+rA5UpvgHJmaGQJewAgCnICg8ToikH9EDtD6gGbqJWuQ9X5QKZ5FGgXvwGkxbRt /avwownMSmBSUOp434ehS08Z97XkIpLGIsNvUQU8Vi53Z1/QezIOJXdPfq7YI102kPic Luk3/mV7r5YtRP+LVSivaqOSdLQ8zDK9oLduG4AWgQxo6ckS3qSdYWPbIaNtwkrU3p9l BS6/Hd6jJbP+6jbXwXj8WWFzKjP5sTX0t+WjqRKkveVYqSTu/qwOt5hpTiOSOPzG7joa 2f5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=5ppBHYzxmgl5hzoC4HlriYit+ub13d9GiK837Ur2BnM=; b=Msb0wqKihHGl5qAus6g+b5F4t7wVpn1XdrrHMP7HpUHhuWS/FmQV5DSLWyhvzMRL/R dhNi6vsKQf0lTcf+8nECW3hMB6c0dTRmyJxzKhdPqg9h4sH4uiwwYrlQxTiK5Fkr0zK9 w47LMhj0d+65D2OEbzFFCw7K2m4VyFaeLpNx3apCXqzXHrjM39w7q0svSrXjJzlLdRYZ r39IPNb/UpKjJ17vmxxFFziG41qkMuTcC3+wZ+remNIyaLBnuSIq9XGBFWi7TFDQv813 vR+1dovdfioHfM7YRZUq6klMgBraT8nhNqo5z5cl+vW3QlQA/88D1E9KQ0Eh6S+b5GZr cGLA== X-Gm-Message-State: AOAM530j0Nfqjyil60CGqZ7xGbP8e97KVuAqPVji3nY6fD2T85CEPsCN avnJRLzdMsq7h6GZ0cIdndTk+23AJoVesA== X-Google-Smtp-Source: ABdhPJxiedntBPCu418+U3VaeN1srE1PVzk6avlZhNVFua3G5Lj0XroIZHwH3IRes00yNr3yZTzF6Q== X-Received: by 2002:a5d:4f8a:: with SMTP id d10mr4713721wru.219.1610129045021; Fri, 08 Jan 2021 10:04:05 -0800 (PST) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 1/2] hw/net/lan9118: Fix RX Status FIFO PEEK value Date: Fri, 8 Jan 2021 18:04:00 +0000 Message-Id: <20210108180401.2263-2-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210108180401.2263-1-peter.maydell@linaro.org> References: <20210108180401.2263-1-peter.maydell@linaro.org> MIME-Version: 1.0 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::436; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x436.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.23 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" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" A copy-and-paste error meant that the return value for register offset 0x44 (the RX Status FIFO PEEK register) returned a byte from a bogus offset in the rx status FIFO. Fix the typo. Cc: qemu-stable@nongnu.org Fixes: https://bugs.launchpad.net/qemu/+bug/1904954 Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/net/lan9118.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/net/lan9118.c b/hw/net/lan9118.c index ab57c02c8e1..13d469fe24f 100644 --- a/hw/net/lan9118.c +++ b/hw/net/lan9118.c @@ -1206,7 +1206,7 @@ static uint64_t lan9118_readl(void *opaque, hwaddr of= fset, case 0x40: return rx_status_fifo_pop(s); case 0x44: - return s->rx_status_fifo[s->tx_status_fifo_head]; + return s->rx_status_fifo[s->rx_status_fifo_head]; case 0x48: return tx_status_fifo_pop(s); case 0x4c: --=20 2.20.1 From nobody Thu May 16 06:30:31 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=1610129185; cv=none; d=zohomail.com; s=zohoarc; b=NWwRFWY1IfuiVqd3fNBveEzdWQAuaS1YMIt4XOBHC0AFYnhLHD9niu8+oeXtREB8SsJiT+po9VSP7rxMVKKO5DJM/8L4I2fUHqxEdkS6HTU8KTMObOTucA2KWcJIMO9a+2C9bGriojtkL8RBIezipt/8lcjyvZ8aTUyjSkCtfu0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610129185; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Cltfwd92MkrmvHsb6h8wjp9eDpmVWfQV41adHitKqbs=; b=Vi/5+DYfCcshqOhbwPQDdkeEuSVpaQntpzvKCp2xn4F5Px7GlpBynn4fjTh8HKgxM4mq/4v/v24uSg1iWqFG4xLsYSnKEdmIFuKNu0AI4eGe0wol/8TkQznOjkvVVSnyDRbBeh7SrO2LdyM3OgtkDhWeCbv/CMiy7c2UlqrcMW4= 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) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1610129185494182.6129966156767; Fri, 8 Jan 2021 10:06:25 -0800 (PST) Received: from localhost ([::1]:47398 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kxw9Y-0002CA-9w for importer@patchew.org; Fri, 08 Jan 2021 13:06:24 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:47748) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kxw7O-0000K4-LX for qemu-devel@nongnu.org; Fri, 08 Jan 2021 13:04:10 -0500 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]:46196) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kxw7L-0000pk-KI for qemu-devel@nongnu.org; Fri, 08 Jan 2021 13:04:10 -0500 Received: by mail-wr1-x434.google.com with SMTP id d13so9796112wrc.13 for ; Fri, 08 Jan 2021 10:04:07 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id s1sm13423029wrv.97.2021.01.08.10.04.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Jan 2021 10:04:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=Cltfwd92MkrmvHsb6h8wjp9eDpmVWfQV41adHitKqbs=; b=WWDNZg4XlRJ2pRMkulGUta0K4mI0jBtVsFYEQ6LH0w4kzci3R8+KHuWq0EFKgTCcAh Riaf9sXFozKBE0WusjFJq6QpnHbA+EP0XF8PZI4Yhdak5AOk/cqyAcDTY3qQhcbLpOyl tdUNEEpYcTjL6HYYs3KEqmVnK6CwL0a08o+bwMQSj26rnSNSx0e0w6efMBQ6BSEU4U9I b/kVt/Dxf1QOiEgzBjTjK5NUnTmWCH2bH4+ZWylIu1fNJsyLHcY+uaSR1ABGZMtqp6hs u48Ljkdb0nWSNHGyQ6LGJwgGFjj02C3pxY32oi/888GXDri46n35GLFZ2DDn778Ghq2g TC2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Cltfwd92MkrmvHsb6h8wjp9eDpmVWfQV41adHitKqbs=; b=NuV38r393OTU93kt8gn8N9wA84+ID+JhpZYK+SfbpnoTyx2e02gM/WVjyYTO9+9cwS 6U9LqOqzrRZlJ3ekbN7QOvsUFOc6dmc8OzhoA9EUkdQXTkX/345EBUIptC9dbkmABn0c FVrnLp8JDQLcepiBd2+qXC65BSgkZgN9URMO4d0WoPBCMU1nKhSsu7t/aldNy7ZdV6UB DGq5iECyRRyPsx/HRCgDKWMu/DElsxKk6WAdjto6TXlsKDRCQxGOoYPggplIF9o79ote uYu3E7BsDshETIw6nNb6axiwzpIRE/akFE3OiZ72tBNw2xVt6Mzny6grn7c+q+mZ6VlX 3nUA== X-Gm-Message-State: AOAM530/y57k0jbO874nx5wNIShmdlFo4+IKXvuVLpGatqtt3oxXt5pH 1Tmy2KizbDEdhE9PgGSSk4g6ow== X-Google-Smtp-Source: ABdhPJxPo1Z8Pih0fRnNAlF7tiD6eiEb4oHHwQo7MQPX6KqzOSbfR6dOQJeqbsbj1Y35iJcROiEelw== X-Received: by 2002:a5d:55c6:: with SMTP id i6mr4767784wrw.137.1610129046389; Fri, 08 Jan 2021 10:04:06 -0800 (PST) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 2/2] hw/net/lan9118: Add symbolic constants for register offsets Date: Fri, 8 Jan 2021 18:04:01 +0000 Message-Id: <20210108180401.2263-3-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210108180401.2263-1-peter.maydell@linaro.org> References: <20210108180401.2263-1-peter.maydell@linaro.org> MIME-Version: 1.0 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::434; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x434.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.23 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" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" The lan9118 code mostly uses symbolic constants for register offsets; the exceptions are those which the datasheet doesn't give an official symbolic name to. Add some names for the registers which don't already have them, based on the longer names they are given in the memory map. Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/net/lan9118.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/hw/net/lan9118.c b/hw/net/lan9118.c index 13d469fe24f..abc796285ab 100644 --- a/hw/net/lan9118.c +++ b/hw/net/lan9118.c @@ -40,6 +40,17 @@ do { hw_error("lan9118: error: " fmt , ## __VA_ARGS__);}= while (0) do { fprintf(stderr, "lan9118: error: " fmt , ## __VA_ARGS__);} while (0) #endif =20 +/* The tx and rx fifo ports are a range of aliased 32-bit registers */ +#define RX_DATA_FIFO_PORT_FIRST 0x00 +#define RX_DATA_FIFO_PORT_LAST 0x1f +#define TX_DATA_FIFO_PORT_FIRST 0x20 +#define TX_DATA_FIFO_PORT_LAST 0x3f + +#define RX_STATUS_FIFO_PORT 0x40 +#define RX_STATUS_FIFO_PEEK 0x44 +#define TX_STATUS_FIFO_PORT 0x48 +#define TX_STATUS_FIFO_PEEK 0x4c + #define CSR_ID_REV 0x50 #define CSR_IRQ_CFG 0x54 #define CSR_INT_STS 0x58 @@ -1020,7 +1031,8 @@ static void lan9118_writel(void *opaque, hwaddr offse= t, offset &=3D 0xff; =20 //DPRINTF("Write reg 0x%02x =3D 0x%08x\n", (int)offset, val); - if (offset >=3D 0x20 && offset < 0x40) { + if (offset >=3D TX_DATA_FIFO_PORT_FIRST && + offset <=3D TX_DATA_FIFO_PORT_LAST) { /* TX FIFO */ tx_fifo_push(s, val); return; @@ -1198,18 +1210,18 @@ static uint64_t lan9118_readl(void *opaque, hwaddr = offset, lan9118_state *s =3D (lan9118_state *)opaque; =20 //DPRINTF("Read reg 0x%02x\n", (int)offset); - if (offset < 0x20) { + if (offset <=3D RX_DATA_FIFO_PORT_LAST) { /* RX FIFO */ return rx_fifo_pop(s); } switch (offset) { - case 0x40: + case RX_STATUS_FIFO_PORT: return rx_status_fifo_pop(s); - case 0x44: + case RX_STATUS_FIFO_PEEK: return s->rx_status_fifo[s->rx_status_fifo_head]; - case 0x48: + case TX_STATUS_FIFO_PORT: return tx_status_fifo_pop(s); - case 0x4c: + case TX_STATUS_FIFO_PEEK: return s->tx_status_fifo[s->tx_status_fifo_head]; case CSR_ID_REV: return 0x01180001; --=20 2.20.1