Message ID | 20250112221726.30206-10-philmd@linaro.org |
---|---|
State | New |
Headers | show
Delivered-To: patch@linaro.org Received: by 2002:a5d:525c:0:b0:385:e875:8a9e with SMTP id k28csp1179584wrc; Sun, 12 Jan 2025 14:24:41 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXwzsjRUENQQoKMM1HZJy6c8q7sATQDxYJj/qrCvtpreOf00LUsChX5bEOrr7++R4mbr4dLIw==@linaro.org X-Google-Smtp-Source: AGHT+IHSpRqcdVsd1JKZPWf09nE/ofedKckohRZyfIs2XVn3Xl8FZAbZT//bYFFI/ODeLseXO0FU X-Received: by 2002:a05:620a:1a0b:b0:7b6:f110:43d5 with SMTP id af79cd13be357-7bcd973a036mr2959309385a.18.1736720681249; Sun, 12 Jan 2025 14:24:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1736720681; cv=none; d=google.com; s=arc-20240605; b=Kd1SqgMjTX/gsLMC+JQMBA3n2RzWVFEHz7VX6HjTbXoVdnA5W2gBIbtiDsZ6AyrkdL Rw0iDQEp69Rl/bZ1sfL++5RDoxSpabyzO0532IG8L0Gfv+OtNOH/Ac5PDXPDcATAhztg 6j/ThhqBWf5OCnu/1fjg43rLJkDeivVRca1wyjeRUvp6BGFHz1i5oHubhWg1uQ/X5ys3 ly6Chh8iLHsqpsJ2mBCs6/u/2CE0yO+V1hDdTDPdAAZ/i3imX6H9DRbQGQ0mVrGscWmJ IRpKOXkEiOswZ8zMFdLnql1pp6q+9NwOwyz+4Dx3x6KLJ5mXkYtM74njfdcQWleyBN/u 4qOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=5FcvQxHKjjfdSZc8glJoiGuaRFxkcd8Ym5IYtsN/6Jw=; fh=lA8KdGRRCLcXxei5dR52XWsTSutqQE1F1yBegzCCPPE=; b=WI8+zMvgtZrY1QELe9L9HNDI/MnGA3zcrnuqX4n3a9wJt9PmEOwhznP2HKVfhQjh7B ij3HMlaRybRLEAtCjOx2usoSZjoRTKl6Elu/5HnjEswcFHm4mY8t8jmoQrCjYtf7VzMf JsnCvQnnND/P6YHhmSdZTOAceMrcLSv/W7THBznnRgpYWw4k3y6BMtNU26Y9HF1UChvF Z14Im7VBm19wqSkSaew5OIocWKhjv510fmtp3w4Y/ojNrSkqVxdIeOds3xQ0J3sXIffl mUIazOkZeHG92EfmBzevKoeXA6Y5meapD2pjr+ZuUwKekAETY43rNl5I3Q4/uNx2upnf eFEA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FgosoUDY; 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: <qemu-devel-bounces+patch=linaro.org@nongnu.org> Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7bce35048d3si958138985a.494.2025.01.12.14.24.41 for <patch@linaro.org> (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 12 Jan 2025 14:24:41 -0800 (PST) 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=FgosoUDY; 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 <qemu-devel-bounces@nongnu.org>) id 1tX6Hm-0007gw-1f; Sun, 12 Jan 2025 17:18:22 -0500 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 <philmd@linaro.org>) id 1tX6Hk-0007du-39 for qemu-devel@nongnu.org; Sun, 12 Jan 2025 17:18:20 -0500 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from <philmd@linaro.org>) id 1tX6Hf-0006Qv-9u for qemu-devel@nongnu.org; Sun, 12 Jan 2025 17:18:19 -0500 Received: by mail-wr1-x432.google.com with SMTP id ffacd0b85a97d-385de59c1a0so1809026f8f.2 for <qemu-devel@nongnu.org>; Sun, 12 Jan 2025 14:18:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1736720293; x=1737325093; 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=5FcvQxHKjjfdSZc8glJoiGuaRFxkcd8Ym5IYtsN/6Jw=; b=FgosoUDYBZS2aq8EEArShRNojN2x4C+eAhk08xRTICbxfyJeYp3c8afii0poe5L4Jp QCXgEJMyrQFZrnmY8WZwVSo0Bi8utW5CIVSbypU+PlhbLsLr0ChVT/y2clScCAijGC2v 19jWGBZYFp4+lC+4gxQhPk/9pxyAsT7rXqIaUeqwu+M2F+5MVLxYeboJ8FZDfpxUgLeV C/FO8/zF6FqwcK2JdyDIYuuxSFmPRV3i32Ib7GrDORuf+bk72IVafNKZ7dRFzx0LrM38 581BgpRQT4gOsi9ekYQKicZrGFN03vLNvR65wSdWxBXbPg0FjNpdvmcLR4Rms+zamkYg InrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736720293; x=1737325093; 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=5FcvQxHKjjfdSZc8glJoiGuaRFxkcd8Ym5IYtsN/6Jw=; b=jfYi8idkMMhl9UjOOM+fn7O41yqingqOk0b28YUDGBnExwsUaDS5LGSut3jjQQRCzl p7NP0qQQB5KCh3aoLFPNbz4c+1i0NjRBO8zc27S9Um1zIBHCcZzA39YxrdfgLan8z66s d6tic3MIeesU7daDxFuxfe+alDTw3LeH9XgAsfL+daU9dQCvsxV54LWcvRg2qnHzHkze wWsyLBJMy3vsYoVfNHtd5MWjh40hkWmJbAAmFNoQPoQ0EHcZHOrbBBrpq70bT0XG/+w+ IoMNmygFfqzrTxJckzqqmXJr/bS97LmcKOZeDExr4txqdFg1OA5pzTXPzOPxbmxbvaHB +VQA== X-Gm-Message-State: AOJu0YzEg6/F0npX1iveEhhxN6JLPqN/9O5dapxs3GelN6EmRZN4deCe EY6uHALPSxSfiDgUy69rbXaDY45GPzRPLaon7VcQ9MuB7ad5oVPgQpgR+Zbro7KRzKETWa7Qp4I IMp4= X-Gm-Gg: ASbGncvKXNnvQ8PAESlscuQRvETeW3veXDfaY/bM/EQNNrlvzbXvGf0m1ZLNrda3Q4R kZzFr7UFgCSkewgqPBBSPfkwOZs5xcLJbQLXZ08IIPm4FaCu9rejOvD5cNJvqf4qinvNoZrBGXl L6XGADgK2XTlyy4fzlJKW4xvSCYtpXu9GyPG90I1jZjXrldtvt0miDld9k3QdOmthb8ZYI4dXuZ qf2ocIaS0h3xfzGxiCzmeC4HRpsSzUBF/jQJlAUIDP3RzJ/gbf8CC2WbBZIx5eW7wgWT75NQLx6 X+4bBgF874gzMev4eXYK3H1GhSEmqRg= X-Received: by 2002:a5d:5f82:0:b0:385:e1a8:e28e with SMTP id ffacd0b85a97d-38a872faed5mr17067468f8f.10.1736720293328; Sun, 12 Jan 2025 14:18:13 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38a8e4c1dc6sm10634910f8f.96.2025.01.12.14.18.12 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 12 Jan 2025 14:18:12 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= <philmd@linaro.org> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= <philmd@linaro.org>, "Edgar E. Iglesias" <edgar.iglesias@amd.com> Subject: [PULL 09/49] hw/net/xilinx_ethlite: Introduce txbuf_ptr() helper Date: Sun, 12 Jan 2025 23:16:45 +0100 Message-ID: <20250112221726.30206-10-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250112221726.30206-1-philmd@linaro.org> References: <20250112221726.30206-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2a00:1450:4864:20::432; envelope-from=philmd@linaro.org; helo=mail-wr1-x432.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: <qemu-devel.nongnu.org> List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>, <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe> List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel> List-Post: <mailto:qemu-devel@nongnu.org> List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help> List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>, <mailto:qemu-devel-request@nongnu.org?subject=subscribe> Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org |
Series |
[PULL,01/49] pc-bios/meson.build: Silent unuseful DTC warnings
|
expand
|
diff --git a/hw/net/xilinx_ethlite.c b/hw/net/xilinx_ethlite.c index 442467abeb8..8df621904a1 100644 --- a/hw/net/xilinx_ethlite.c +++ b/hw/net/xilinx_ethlite.c @@ -27,6 +27,7 @@ #include "qemu/osdep.h" #include "qemu/module.h" +#include "qemu/bitops.h" #include "qom/object.h" #include "qapi/error.h" #include "exec/tswap.h" @@ -87,6 +88,18 @@ static inline void eth_pulse_irq(XlnxXpsEthLite *s) } } +static unsigned addr_to_port_index(hwaddr addr) +{ + return extract64(addr, 11, 1); +} + +static void *txbuf_ptr(XlnxXpsEthLite *s, unsigned port_index) +{ + unsigned int rxbase = port_index * (0x800 / 4); + + return &s->regs[rxbase + R_TX_BUF0]; +} + static uint64_t eth_read(void *opaque, hwaddr addr, unsigned int size) { @@ -119,6 +132,7 @@ eth_write(void *opaque, hwaddr addr, uint64_t val64, unsigned int size) { XlnxXpsEthLite *s = opaque; + unsigned int port_index = addr_to_port_index(addr); unsigned int base = 0; uint32_t value = val64; @@ -132,12 +146,12 @@ eth_write(void *opaque, hwaddr addr, if ((value & (CTRL_P | CTRL_S)) == CTRL_S) { qemu_send_packet(qemu_get_queue(s->nic), - (void *) &s->regs[base], + txbuf_ptr(s, port_index), s->regs[base + R_TX_LEN0]); if (s->regs[base + R_TX_CTRL0] & CTRL_I) eth_pulse_irq(s); } else if ((value & (CTRL_P | CTRL_S)) == (CTRL_P | CTRL_S)) { - memcpy(&s->conf.macaddr.a[0], &s->regs[base], 6); + memcpy(&s->conf.macaddr.a[0], txbuf_ptr(s, port_index), 6); if (s->regs[base + R_TX_CTRL0] & CTRL_I) eth_pulse_irq(s); }