From nobody Wed Nov 27 18:45:16 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=reject dis=none) header.from=google.com ARC-Seal: i=1; a=rsa-sha256; t=1697583944; cv=none; d=zohomail.com; s=zohoarc; b=QsQFN4QWB1ZYaVuQyRWI7owfx24A0VFsqHPvnUPK+4DT2/Y3Z9GaUTqd3mqgPqppbiN7o6xsLCv+a0CLS/Pgz3WJoFdP5lWLot2xO4Rz7jv9HRzVl2eT1wjIxO1O4SPMsDxi/OZSGzIxwSxCJx7BAjMb/4kbQ2CZc6FBaU5cWFA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697583944; h=Content-Type:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=EAtEr99rC6tR+Poq46AXfIcwPYtFsd+EnFbPTVl0Xms=; b=SGMkahBPVmHfG9mVk7owiq2CGWiNNtXXXsHSpwZY7xpZ57AVdeNS5d1NdyNa9ElAbwLPiQZrZjMSHqyybVN6p7mT+J8phxutYAWG/hhf5X9jDw4XVsV2J+MtnAFqIgC9QmO03W10zTcoac/8AGpcI1HJjYg4zNdAdPJ69+RBdh8= 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=reject dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1697583944053535.5818966974504; Tue, 17 Oct 2023 16:05:44 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qst6e-0006MF-D5; Tue, 17 Oct 2023 19:04:08 -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 <34xIvZQwKCvQjWXedaopabWjckkcha.Ykimaiq-Zarahjkjcjq.knc@flex--nabihestefan.bounces.google.com>) id 1qst6c-0006Lj-S1 for qemu-devel@nongnu.org; Tue, 17 Oct 2023 19:04:06 -0400 Received: from mail-yw1-x1149.google.com ([2607:f8b0:4864:20::1149]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from <34xIvZQwKCvQjWXedaopabWjckkcha.Ykimaiq-Zarahjkjcjq.knc@flex--nabihestefan.bounces.google.com>) id 1qst6a-0002Kc-MK for qemu-devel@nongnu.org; Tue, 17 Oct 2023 19:04:06 -0400 Received: by mail-yw1-x1149.google.com with SMTP id 00721157ae682-5a7a6fd18abso95648617b3.1 for ; Tue, 17 Oct 2023 16:04:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1697583843; x=1698188643; darn=nongnu.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=EAtEr99rC6tR+Poq46AXfIcwPYtFsd+EnFbPTVl0Xms=; b=yVlC4rT8+z6eKbaDRm68f9tOz38lhwCdr84wmc64MfxMcvRuKC+IF51Z3wlsh0KCYu u0FgETc3c8GALBuv0H1LssIP99bXDSLc9pWuisggmLpAWARQE8oJz5C+7foQkb3/Cpfg mTKz2oI5UcIspadE1lU+UahecAoeckZz0VVzjc/5rUzN+w/+NeJfINzsyjiW26KmM70c 9iuRwSfbX08jl1O7gi0nx9ZPOGDiibsZUzfeLy/i3B0MwVAYCmPNBC0qV2JI+LjK1cz3 IlMK+cCKACon0XniKiH2l7IfxAW6Pm7tqURb95+aKLb2v/HOULH5uBqopdB2qQjCQwZ8 mGEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697583843; x=1698188643; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=EAtEr99rC6tR+Poq46AXfIcwPYtFsd+EnFbPTVl0Xms=; b=cEWKWe8Jr2UzKgiLGGEHm2Pvy6sxL+ocp8wU1nOiGa6Xv8Uq2Ex55UEijSjUL7VV9C dTm//lCcdQTSXhdpqxR1Kksqd6Ouj0XE/FwjK6UNYHklGH7MJleZGneZvUcLxALGB4n6 hQeyLkXkTDDGCgH22Z/kjsvzgJnq5t/gjG9DGEgz/Uoq14QfpFGr58pdpCLWNYdeLmjm zIGbHO0Pq4+0slNeuUA+qPW+710Hj8oGfYCzLUBdYxfi6iG/3iP+PXPKVAHvFnZ2iGil 9wn73OuvPBV/jGp0WTo7nmV6pjUTaD0dRtCXpzsuWS73hS3gXRxYCIQA2RhYZx3XAEcy G74A== X-Gm-Message-State: AOJu0Yx3mw0rTI0UMflahHMtPJhx6IQXGOtrqMrU4Ks2y082MIZIdO/K fSsrJxIoVRvUMSn0tLMISEq1C+ToN7+BnlJTyyg= X-Google-Smtp-Source: AGHT+IGGWO/Iaf/x1e5ensgtpetKiMd+j7e4L/fZQKbftpSHcLGSA5DJkuCQsgShIGjVCJtc4hnstRjC2W1vxNLXkqM= X-Received: from nabihestefan.c.googlers.com ([fda3:e722:ac3:cc00:20:ed76:c0a8:2737]) (user=nabihestefan job=sendgmr) by 2002:a0d:d848:0:b0:59b:ec33:ec6d with SMTP id a69-20020a0dd848000000b0059bec33ec6dmr90055ywe.5.1697583843494; Tue, 17 Oct 2023 16:04:03 -0700 (PDT) Date: Tue, 17 Oct 2023 23:03:38 +0000 In-Reply-To: <20231017230342.311227-1-nabihestefan@google.com> Mime-Version: 1.0 References: <20231017230342.311227-1-nabihestefan@google.com> X-Mailer: git-send-email 2.42.0.655.g421f12c284-goog Message-ID: <20231017230342.311227-8-nabihestefan@google.com> Subject: [PATCH v3 07/11] include/hw/net: Implemented Classes and Masks for GMAC Descriptors From: Nabih Estefan To: peter.maydell@linaro.org Cc: qemu-arm@nongnu.org, qemu-devel@nongnu.org, kfting@nuvoton.com, wuhaotsh@google.com, jasonwang@redhat.com, avi.fishman@nuvoton.com, Nabih Estefan Diaz 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=2607:f8b0:4864:20::1149; envelope-from=34xIvZQwKCvQjWXedaopabWjckkcha.Ykimaiq-Zarahjkjcjq.knc@flex--nabihestefan.bounces.google.com; helo=mail-yw1-x1149.google.com X-Spam_score_int: -95 X-Spam_score: -9.6 X-Spam_bar: --------- X-Spam_report: (-9.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_MED=-0.001, 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, USER_IN_DEF_DKIM_WL=-7.5 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @google.com) X-ZM-MESSAGEID: 1697583946084100001 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Nabih Estefan Diaz - Implemeted classes for GMAC Receive and Transmit Descriptors - Implemented Masks for said descriptors Signed-off-by: Nabih Estefan Diaz Reviewed-by: Hao Wu --- hw/net/npcm_gmac.c | 183 +++++++++++++++++++++++++++-------- hw/net/trace-events | 9 ++ include/hw/net/npcm_gmac.h | 2 - tests/qtest/npcm_gmac-test.c | 2 +- 4 files changed, 150 insertions(+), 46 deletions(-) diff --git a/hw/net/npcm_gmac.c b/hw/net/npcm_gmac.c index 5ce632858d..6f8109e0ee 100644 --- a/hw/net/npcm_gmac.c +++ b/hw/net/npcm_gmac.c @@ -32,7 +32,7 @@ REG32(NPCM_DMA_BUS_MODE, 0x1000) REG32(NPCM_DMA_XMT_POLL_DEMAND, 0x1004) REG32(NPCM_DMA_RCV_POLL_DEMAND, 0x1008) -REG32(NPCM_DMA_RCV_BASE_ADDR, 0x100c) +REG32(NPCM_DMA_RX_BASE_ADDR, 0x100c) REG32(NPCM_DMA_TX_BASE_ADDR, 0x1010) REG32(NPCM_DMA_STATUS, 0x1014) REG32(NPCM_DMA_CONTROL, 0x1018) @@ -91,7 +91,8 @@ REG32(NPCM_GMAC_PTP_TTSR, 0x71c) #define NPCM_DMA_BUS_MODE_SWR BIT(0) =20 static const uint32_t npcm_gmac_cold_reset_values[NPCM_GMAC_NR_REGS] =3D { - [R_NPCM_GMAC_VERSION] =3D 0x00001037, + /* Reduce version to 3.2 so that the kernel can enable interrupt. */ + [R_NPCM_GMAC_VERSION] =3D 0x00001032, [R_NPCM_GMAC_TIMER_CTRL] =3D 0x03e80000, [R_NPCM_GMAC_MAC0_ADDR_HI] =3D 0x8000ffff, [R_NPCM_GMAC_MAC0_ADDR_LO] =3D 0xffffffff, @@ -125,12 +126,12 @@ static const uint16_t phy_reg_init[] =3D { [MII_EXTSTAT] =3D 0x3000, /* 1000BASTE_T full-duplex capable */ }; =20 -static void npcm_gmac_soft_reset(NPCMGMACState *s) +static void npcm_gmac_soft_reset(NPCMGMACState *gmac) { - memcpy(s->regs, npcm_gmac_cold_reset_values, + memcpy(gmac->regs, npcm_gmac_cold_reset_values, NPCM_GMAC_NR_REGS * sizeof(uint32_t)); /* Clear reset bits */ - s->regs[R_NPCM_DMA_BUS_MODE] &=3D ~NPCM_DMA_BUS_MODE_SWR; + gmac->regs[R_NPCM_DMA_BUS_MODE] &=3D ~NPCM_DMA_BUS_MODE_SWR; } =20 static void gmac_phy_set_link(NPCMGMACState *s, bool active) @@ -148,11 +149,53 @@ static bool gmac_can_receive(NetClientState *nc) return true; } =20 -static ssize_t gmac_receive(NetClientState *nc, const uint8_t *buf, size_t= len1) +/* + * Function that updates the GMAC IRQ + * It find the logical OR of the enabled bits for NIS (if enabled) + * It find the logical OR of the enabled bits for AIS (if enabled) + */ +static void gmac_update_irq(NPCMGMACState *gmac) { - return 0; + /* + * Check if the normal interrupts summery is enabled + * if so, add the bits for the summary that are enabled + */ + if (gmac->regs[R_NPCM_DMA_INTR_ENA] & gmac->regs[R_NPCM_DMA_STATUS] & + (NPCM_DMA_INTR_ENAB_NIE_BITS)) + { + gmac->regs[R_NPCM_DMA_STATUS] |=3D NPCM_DMA_STATUS_NIS; + } + /* + * Check if the abnormal interrupts summery is enabled + * if so, add the bits for the summary that are enabled + */ + if (gmac->regs[R_NPCM_DMA_INTR_ENA] & gmac->regs[R_NPCM_DMA_STATUS] & + (NPCM_DMA_INTR_ENAB_AIE_BITS)) + { + gmac->regs[R_NPCM_DMA_STATUS] |=3D NPCM_DMA_STATUS_AIS; + } + + /* Get the logical OR of both normal and abnormal interrupts */ + int level =3D !!((gmac->regs[R_NPCM_DMA_STATUS] & + gmac->regs[R_NPCM_DMA_INTR_ENA] & + NPCM_DMA_STATUS_NIS) | + (gmac->regs[R_NPCM_DMA_STATUS] & + gmac->regs[R_NPCM_DMA_INTR_ENA] & + NPCM_DMA_STATUS_AIS)); + + /* Set the IRQ */ + trace_npcm_gmac_update_irq(DEVICE(gmac)->canonical_path, + gmac->regs[R_NPCM_DMA_STATUS], + gmac->regs[R_NPCM_DMA_INTR_ENA], + level); + qemu_set_irq(gmac->irq, level); } =20 +static ssize_t gmac_receive(NetClientState *nc, const uint8_t *buf, size_t= len) +{ + /* Placeholder */ + return 0; +} static void gmac_cleanup(NetClientState *nc) { /* Nothing to do yet. */ @@ -166,7 +209,7 @@ static void gmac_set_link(NetClientState *nc) gmac_phy_set_link(s, !nc->link_down); } =20 -static void npcm_gmac_mdio_access(NPCMGMACState *s, uint16_t v) +static void npcm_gmac_mdio_access(NPCMGMACState *gmac, uint16_t v) { bool busy =3D v & NPCM_GMAC_MII_ADDR_BUSY; uint8_t is_write; @@ -183,33 +226,38 @@ static void npcm_gmac_mdio_access(NPCMGMACState *s, u= int16_t v) =20 =20 if (v & NPCM_GMAC_MII_ADDR_WRITE) { - data =3D s->regs[R_NPCM_GMAC_MII_DATA]; + data =3D gmac->regs[R_NPCM_GMAC_MII_DATA]; /* Clear reset bit for BMCR register */ switch (gr) { case MII_BMCR: data &=3D ~MII_BMCR_RESET; - /* Complete auto-negotiation immediately and set as comple= te */ - if (data & MII_BMCR_AUTOEN) { + /* Autonegotiation is a W1C bit*/ + if (data & MII_BMCR_ANRESTART) { /* Tells autonegotiation to not restart again */ data &=3D ~MII_BMCR_ANRESTART; + } + if ((data & MII_BMCR_AUTOEN) && + !(gmac->phy_regs[pa][MII_BMSR] & MII_BMSR_AN_COMP)) { /* sets autonegotiation as complete */ - s->phy_regs[pa][MII_BMSR] |=3D MII_BMSR_AN_COMP; + gmac->phy_regs[pa][MII_BMSR] |=3D MII_BMSR_AN_COMP; + /* Resolve AN automatically->need to set this */ + gmac->phy_regs[0][MII_ANLPAR] =3D 0x0000; } } - s->phy_regs[pa][gr] =3D data; + gmac->phy_regs[pa][gr] =3D data; } else { - data =3D s->phy_regs[pa][gr]; - s->regs[R_NPCM_GMAC_MII_DATA] =3D data; + data =3D gmac->phy_regs[pa][gr]; + gmac->regs[R_NPCM_GMAC_MII_DATA] =3D data; } - trace_npcm_gmac_mdio_access(DEVICE(s)->canonical_path, is_write, p= a, - gr, data); + trace_npcm_gmac_mdio_access(DEVICE(gmac)->canonical_path, is_write= , pa, + gr, data); } - s->regs[R_NPCM_GMAC_MII_ADDR] =3D v & ~NPCM_GMAC_MII_ADDR_BUSY; + gmac->regs[R_NPCM_GMAC_MII_ADDR] =3D v & ~NPCM_GMAC_MII_ADDR_BUSY; } =20 static uint64_t npcm_gmac_read(void *opaque, hwaddr offset, unsigned size) { - NPCMGMACState *s =3D opaque; + NPCMGMACState *gmac =3D opaque; uint32_t v =3D 0; =20 switch (offset) { @@ -218,22 +266,25 @@ static uint64_t npcm_gmac_read(void *opaque, hwaddr o= ffset, unsigned size) case A_NPCM_DMA_RCV_POLL_DEMAND: qemu_log_mask(LOG_GUEST_ERROR, "%s: Read of write-only reg: offset: 0x%04" HWADDR_P= RIx - "\n", DEVICE(s)->canonical_path, offset); + "\n", DEVICE(gmac)->canonical_path, offset); break; =20 default: - v =3D s->regs[offset / sizeof(uint32_t)]; + v =3D gmac->regs[offset / sizeof(uint32_t)]; } - trace_npcm_gmac_reg_read(DEVICE(s)->canonical_path, offset, v); + + trace_npcm_gmac_reg_read(DEVICE(gmac)->canonical_path, offset, v); return v; } =20 static void npcm_gmac_write(void *opaque, hwaddr offset, uint64_t v, unsigned size) { - NPCMGMACState *s =3D opaque; + NPCMGMACState *gmac =3D opaque; + uint32_t prev; + + trace_npcm_gmac_reg_write(DEVICE(gmac)->canonical_path, offset, v); =20 - trace_npcm_gmac_reg_write(DEVICE(s)->canonical_path, offset, v); switch (offset) { /* Read only registers */ case A_NPCM_GMAC_VERSION: @@ -250,25 +301,44 @@ static void npcm_gmac_write(void *opaque, hwaddr offs= et, qemu_log_mask(LOG_GUEST_ERROR, "%s: Write of read-only reg: offset: 0x%04" HWADDR_P= RIx ", value: 0x%04" PRIx64 "\n", - DEVICE(s)->canonical_path, offset, v); + DEVICE(gmac)->canonical_path, offset, v); + break; + + case A_NPCM_GMAC_MAC_CONFIG: + prev =3D gmac->regs[offset / sizeof(uint32_t)]; + gmac->regs[offset / sizeof(uint32_t)] =3D v; + + /* If transmit is being enabled for first time, update desc addr */ + if (~(prev & NPCM_GMAC_MAC_CONFIG_TX_EN) & + (v & NPCM_GMAC_MAC_CONFIG_TX_EN)) { + gmac->regs[R_NPCM_DMA_HOST_TX_DESC] =3D + gmac->regs[R_NPCM_DMA_TX_BASE_ADDR]; + } + + /* If receive is being enabled for first time, update desc addr */ + if (~(prev & NPCM_GMAC_MAC_CONFIG_RX_EN) & + (v & NPCM_GMAC_MAC_CONFIG_RX_EN)) { + gmac->regs[R_NPCM_DMA_HOST_RX_DESC] =3D + gmac->regs[R_NPCM_DMA_RX_BASE_ADDR]; + } break; =20 case A_NPCM_GMAC_MII_ADDR: - npcm_gmac_mdio_access(s, v); + npcm_gmac_mdio_access(gmac, v); break; =20 case A_NPCM_GMAC_MAC0_ADDR_HI: - s->regs[offset / sizeof(uint32_t)] =3D v; - s->conf.macaddr.a[0] =3D v >> 8; - s->conf.macaddr.a[1] =3D v >> 0; + gmac->regs[offset / sizeof(uint32_t)] =3D v; + gmac->conf.macaddr.a[0] =3D v >> 8; + gmac->conf.macaddr.a[1] =3D v >> 0; break; =20 case A_NPCM_GMAC_MAC0_ADDR_LO: - s->regs[offset / sizeof(uint32_t)] =3D v; - s->conf.macaddr.a[2] =3D v >> 24; - s->conf.macaddr.a[3] =3D v >> 16; - s->conf.macaddr.a[4] =3D v >> 8; - s->conf.macaddr.a[5] =3D v >> 0; + gmac->regs[offset / sizeof(uint32_t)] =3D v; + gmac->conf.macaddr.a[2] =3D v >> 24; + gmac->conf.macaddr.a[3] =3D v >> 16; + gmac->conf.macaddr.a[4] =3D v >> 8; + gmac->conf.macaddr.a[5] =3D v >> 0; break; =20 case A_NPCM_GMAC_MAC1_ADDR_HI: @@ -277,33 +347,60 @@ static void npcm_gmac_write(void *opaque, hwaddr offs= et, case A_NPCM_GMAC_MAC2_ADDR_LO: case A_NPCM_GMAC_MAC3_ADDR_HI: case A_NPCM_GMAC_MAC3_ADDR_LO: - s->regs[offset / sizeof(uint32_t)] =3D v; + gmac->regs[offset / sizeof(uint32_t)] =3D v; qemu_log_mask(LOG_UNIMP, "%s: Only MAC Address 0 is supported. This request " - "is ignored.\n", DEVICE(s)->canonical_path); + "is ignored.\n", DEVICE(gmac)->canonical_path); break; =20 case A_NPCM_DMA_BUS_MODE: - s->regs[offset / sizeof(uint32_t)] =3D v; + gmac->regs[offset / sizeof(uint32_t)] =3D v; if (v & NPCM_DMA_BUS_MODE_SWR) { - npcm_gmac_soft_reset(s); + npcm_gmac_soft_reset(gmac); + } + break; + + case A_NPCM_DMA_RCV_POLL_DEMAND: + /* We dont actually care about the value */ + break; + + case A_NPCM_DMA_STATUS: + /* Check that RO bits are not written to */ + if (NPCM_DMA_STATUS_RO_MASK(v)) { + qemu_log_mask(LOG_GUEST_ERROR, + "%s: Write of read-only bits of reg: offset: 0x%= 04" + HWADDR_PRIx ", value: 0x%04" PRIx64 "\n", + DEVICE(gmac)->canonical_path, offset, v); + } else { + /* for W1c bits, implement W1C */ + gmac->regs[offset / sizeof(uint32_t)] &=3D + ~NPCM_DMA_STATUS_W1C_MASK(v); + if (v & NPCM_DMA_STATUS_NIS_BITS) { + gmac->regs[offset / sizeof(uint32_t)] &=3D ~NPCM_DMA_STATU= S_NIS; + } + if (v & NPCM_DMA_STATUS_AIS_BITS) { + gmac->regs[offset / sizeof(uint32_t)] &=3D ~NPCM_DMA_STATU= S_AIS; + } } break; =20 default: - s->regs[offset / sizeof(uint32_t)] =3D v; + gmac->regs[offset / sizeof(uint32_t)] =3D v; break; } + + gmac_update_irq(gmac); } =20 static void npcm_gmac_reset(DeviceState *dev) { - NPCMGMACState *s =3D NPCM_GMAC(dev); + NPCMGMACState *gmac =3D NPCM_GMAC(dev); =20 - npcm_gmac_soft_reset(s); - memcpy(s->phy_regs[0], phy_reg_init, sizeof(phy_reg_init)); + npcm_gmac_soft_reset(gmac); + memcpy(gmac->phy_regs[0], phy_reg_init, sizeof(phy_reg_init)); =20 - trace_npcm_gmac_reset(DEVICE(s)->canonical_path, s->phy_regs[0][MII_BM= SR]); + trace_npcm_gmac_reset(DEVICE(gmac)->canonical_path, + gmac->phy_regs[0][MII_BMSR]); } =20 static NetClientInfo net_npcm_gmac_info =3D { diff --git a/hw/net/trace-events b/hw/net/trace-events index 1dbb5d2d64..2843f1eaf8 100644 --- a/hw/net/trace-events +++ b/hw/net/trace-events @@ -472,6 +472,15 @@ npcm_gmac_reg_write(const char *name, uint64_t offset,= uint32_t value) "%s: offs npcm_gmac_mdio_access(const char *name, uint8_t is_write, uint8_t pa, uint= 8_t gr, uint16_t val) "%s: is_write: %" PRIu8 " pa: %" PRIu8 " gr: %" PRIu8= " val: 0x%04" PRIx16 npcm_gmac_reset(const char *name, uint16_t value) "%s: phy_regs[0][1]: 0x%= 04" PRIx16 npcm_gmac_set_link(bool active) "Set link: active=3D%u" +npcm_gmac_update_irq(const char *name, uint32_t status, uint32_t intr_en, = int level) "%s: Status Reg: 0x%04" PRIX32 " Interrupt Enable Reg: 0x%04" PR= IX32 " IRQ Set: %d" +npcm_gmac_packet_desc_read(const char* name, uint32_t desc_addr) "%s: atte= mpting to read descriptor @0x%04" PRIX32 +npcm_gmac_packet_receive(const char* name, uint32_t len) "%s: RX packet le= ngth: 0x%04" PRIX32 +npcm_gmac_packet_receiving_buffer(const char* name, uint32_t buf_len, uint= 32_t rx_buf_addr) "%s: Receiving into Buffer size: 0x%04" PRIX32 " at addre= ss 0x%04" PRIX32 +npcm_gmac_packet_received(const char* name, uint32_t len) "%s: Reception f= inished, packet left: 0x%04" PRIX32 +npcm_gmac_packet_transmit(const char* name, uint16_t len) "%s: TX transmis= sion start, packed length 0x%04" PRIX16 +npcm_gmac_packet_sent(const char* name, uint16_t len) "%s: TX packet sent!= , length: 0x%04" PRIX16 +npcm_gmac_debug_desc_data(const char* name, void* addr, uint32_t des0, uin= t32_t des1, uint32_t des2, uint32_t des3)"%s: Address: %p Descriptor 0: 0x%= 04" PRIX32 " Descriptor 1: 0x%04" PRIX32 "Descriptor 2: 0x%04" PRIX32 " Des= criptor 3: 0x%04" PRIX32 +npcm_gmac_packet_tx_desc_data(const char* name, uint32_t tdes0, uint32_t t= des1) "%s: Tdes0: 0x%04" PRIX32 " Tdes1: 0x%04" PRIX32 =20 # npcm_pcs.c npcm_pcs_reg_read(const char *name, uint16_t indirect_access_baes, uint64_= t offset, uint16_t value) "%s: IND: 0x%02" PRIx16 " offset: 0x%04" PRIx64 "= value: 0x%04" PRIx16 diff --git a/include/hw/net/npcm_gmac.h b/include/hw/net/npcm_gmac.h index a92a654278..e5729e83ea 100644 --- a/include/hw/net/npcm_gmac.h +++ b/include/hw/net/npcm_gmac.h @@ -37,8 +37,6 @@ struct NPCMGMACRxDesc { /* RDES2 and RDES3 are buffer address pointers */ /* Owner: 0 =3D software, 1 =3D gmac */ #define RX_DESC_RDES0_OWNER_MASK BIT(31) -/* Owner*/ -#define RX_DESC_RDES0_OWNER_SHIFT 31 /* Destination Address Filter Fail */ #define RX_DESC_RDES0_DEST_ADDR_FILT_FAIL_MASK BIT(30) /* Frame length*/ diff --git a/tests/qtest/npcm_gmac-test.c b/tests/qtest/npcm_gmac-test.c index 30d27e8dcc..84511fd915 100644 --- a/tests/qtest/npcm_gmac-test.c +++ b/tests/qtest/npcm_gmac-test.c @@ -154,7 +154,7 @@ static void test_init(gconstpointer test_data) CHECK_REG32(NPCM_GMAC_MII_DATA, 0); CHECK_REG32(NPCM_GMAC_FLOW_CTRL, 0); CHECK_REG32(NPCM_GMAC_VLAN_FLAG, 0); - CHECK_REG32(NPCM_GMAC_VERSION, 0x00001037); + CHECK_REG32(NPCM_GMAC_VERSION, 0x00001032); CHECK_REG32(NPCM_GMAC_WAKEUP_FILTER, 0); CHECK_REG32(NPCM_GMAC_PMT, 0); CHECK_REG32(NPCM_GMAC_LPI_CTRL, 0); --=20 2.42.0.655.g421f12c284-goog