From nobody Thu Oct 05 15:35:15 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4S1bGq3Rfvz4vnX8; Thu, 5 Oct 2023 15:35:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S1bGq2Rdwz4dyq; Thu, 5 Oct 2023 15:35:15 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696520115; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=blrq6vEuZl9xhk5SH2C/0TuhPHpkEyTp1dhghMXgnjc=; b=EQ9pwr42l7VDg9Z+qqg2wkDfYETcLutVd5aWSmwU+1Ei3FaY0/cOGSzBZx6l5z6j7V+6w6 c2qPkfGRQmd3IQM1o74ckxigjB+N4BTgxZdCgaY83iFgx1mEZZYxIOwtRtz8lC9zoF/ytv jbS6d7pdL131cj0vpmyBTgVP0WkyZPqwZS1Fd1efZsfPgOmdUYhO3Sap+UICL1mpkT1Hsx a6X1z7oFzHHZvZD+SnJGs1gVDOmEVWb/5OlDfL5C2YPfWv+ajuKevodiswoVGknjvOXqx4 Z1UmCv9HmbIIOWChq8CTtY1d45IpaDRGegV9yNdB+qTHwyD+jSzfYneZ3hGtbA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696520115; a=rsa-sha256; cv=none; b=XnA7oxmhDrz4lPnZnJRge2xomCRIBQm6JFHUL84nzFLqnUpa57aGsprxnQdZ8Z9ahbRshv 4d2Nx8uw4QC4PxsZyTL7EnKIASa0+tLAFvH/fo+6G87AZkK4jtyrp3ou2w5ZJili4RpUIY exmQtWAM2fcLX0K1CbficqiMYzUhFr6SOR25ju7YgWC+YHwYzptIC5TVpKRFLjVZnBUiDD /fZBnZJNPh0cmebcl0YA5m6wDLC+vujT0JXUDmqai10Teh2lf6x+PUVY2HuvB7kmnAGz79 crZeshbfskA3HekbO3T3i6v1tgizNHlC/vTFp2zEc2BUZSpAUc0Za+KfO0Tchg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696520115; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=blrq6vEuZl9xhk5SH2C/0TuhPHpkEyTp1dhghMXgnjc=; b=sVDCFaqPu4y9YwgE6kVjQUxuYO1yrZroOsd/wVSMNJFdSdAmM7eOFJIPDemrBSXqw4DHaW CVdkwPshZJ+UeVGoDlhvVO2dQL8N/sJKN9oSz0gaWBAQoYFOQ/6xks04r6TOfdQRUQqgox RrMVcr2uX7Y/+fc90xucEDi4RXpRRiBY0RJ6pED/5ePcuMCGiHb7i7MJA2Hyj3OKy2XO4a CN4LV568KtlNMy5gLqAc+roiWj5oj92C4+8uOrxto84uZ/ygQzvO/2yFFJ/2VBg/ls0tyJ 4gXd/BQIsZOKmz0ymxxKHRatWPVXrG/6BtEpb5YZNyE3CNFXWI5/rQnmjz3lGw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4S1bGq1NYRz1Q71; Thu, 5 Oct 2023 15:35:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 395FZFxf013078; Thu, 5 Oct 2023 15:35:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 395FZFJG013075; Thu, 5 Oct 2023 15:35:15 GMT (envelope-from git) Date: Thu, 5 Oct 2023 15:35:15 GMT Message-Id: <202310051535.395FZFJG013075@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: 4b7975ecdc36 - main - dwc: Remove if_dwc_mac_type List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4b7975ecdc3631beac717d4addc71006cdc665c5 Auto-Submitted: auto-generated The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=4b7975ecdc3631beac717d4addc71006cdc665c5 commit 4b7975ecdc3631beac717d4addc71006cdc665c5 Author: Emmanuel Vadot AuthorDate: 2023-10-04 19:10:47 +0000 Commit: Emmanuel Vadot CommitDate: 2023-10-05 15:34:40 +0000 dwc: Remove if_dwc_mac_type This doesn't represent the mac_type but if the DMA engine support extended descriptors. Read the HW_FEATURE register to learn if the DMA engine supports it. No functional changes intended. --- sys/dev/dwc/dwc1000_core.c | 14 +++++++++++--- sys/dev/dwc/dwc1000_dma.c | 12 ++++++++---- sys/dev/dwc/dwc1000_reg.h | 2 ++ sys/dev/dwc/if_dwc.c | 1 - sys/dev/dwc/if_dwc_aw.c | 8 -------- sys/dev/dwc/if_dwc_if.m | 13 ------------- sys/dev/dwc/if_dwc_rk.c | 8 -------- sys/dev/dwc/if_dwc_socfpga.c | 8 -------- sys/dev/dwc/if_dwcvar.h | 2 +- 9 files changed, 22 insertions(+), 46 deletions(-) diff --git a/sys/dev/dwc/dwc1000_core.c b/sys/dev/dwc/dwc1000_core.c index 6cf836f87be2..872d1a488454 100644 --- a/sys/dev/dwc/dwc1000_core.c +++ b/sys/dev/dwc/dwc1000_core.c @@ -281,7 +281,11 @@ dwc_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) crc = ether_crc32_le(LLADDR(sdl), ETHER_ADDR_LEN); /* Take lower 8 bits and reverse it */ val = bitreverse(~crc & 0xff); - if (ctx->sc->mactype != DWC_GMAC_EXT_DESC) + /* + * TODO: There is probably a HW_FEATURES bit which isn't + * related to the extended descriptors that describe this + */ + if (!ctx->sc->dma_ext_desc) val >>= 2; /* Only need lower 6 bits */ hashreg = (val >> 5); hashbit = (val & 31); @@ -302,7 +306,11 @@ dwc1000_setup_rxfilter(struct dwc_softc *sc) DWC_ASSERT_LOCKED(sc); ifp = sc->ifp; - nhash = sc->mactype != DWC_GMAC_EXT_DESC ? 2 : 8; + /* + * TODO: There is probably a HW_FEATURES bit which isn't + * related to the extended descriptors that describe this + */ + nhash = sc->dma_ext_desc == false ? 2 : 8; /* * Set the multicast (group) filter hash. @@ -335,7 +343,7 @@ dwc1000_setup_rxfilter(struct dwc_softc *sc) WRITE4(sc, MAC_ADDRESS_LOW(0), lo); WRITE4(sc, MAC_ADDRESS_HIGH(0), hi); WRITE4(sc, MAC_FRAME_FILTER, ffval); - if (sc->mactype != DWC_GMAC_EXT_DESC) { + if (!sc->dma_ext_desc) { WRITE4(sc, GMAC_MAC_HTLOW, ctx.hash[0]); WRITE4(sc, GMAC_MAC_HTHIGH, ctx.hash[1]); } else { diff --git a/sys/dev/dwc/dwc1000_dma.c b/sys/dev/dwc/dwc1000_dma.c index 16b2b2a3241d..7c5924296894 100644 --- a/sys/dev/dwc/dwc1000_dma.c +++ b/sys/dev/dwc/dwc1000_dma.c @@ -201,7 +201,7 @@ dwc_setup_txdesc(struct dwc_softc *sc, int idx, bus_addr_t paddr, desc1 = 0; --sc->tx_desccount; } else { - if (sc->mactype != DWC_GMAC_EXT_DESC) { + if (!sc->dma_ext_desc) { desc0 = 0; desc1 = NTDESC1_TCH | len | flags; if (first) @@ -233,7 +233,7 @@ dwc_setup_rxdesc(struct dwc_softc *sc, int idx, bus_addr_t paddr) nidx = next_rxidx(sc, idx); sc->rxdesc_ring[idx].addr2 = sc->rxdesc_ring_paddr + (nidx * sizeof(struct dwc_hwdesc)); - if (sc->mactype != DWC_GMAC_EXT_DESC) + if (!sc->dma_ext_desc) sc->rxdesc_ring[idx].desc1 = NRDESC1_RCH | MIN(MCLBYTES, NRDESC1_RBS1_MASK); else @@ -282,12 +282,12 @@ dma1000_setup_txbuf(struct dwc_softc *sc, int idx, struct mbuf **mp) if ((m->m_pkthdr.csum_flags & CSUM_IP) != 0) { if ((m->m_pkthdr.csum_flags & (CSUM_TCP|CSUM_UDP)) != 0) { - if (sc->mactype != DWC_GMAC_EXT_DESC) + if (!sc->dma_ext_desc) flags = NTDESC1_CIC_FULL; else flags = ETDESC0_CIC_FULL; } else { - if (sc->mactype != DWC_GMAC_EXT_DESC) + if (!sc->dma_ext_desc) flags = NTDESC1_CIC_HDR; else flags = ETDESC0_CIC_HDR; @@ -646,6 +646,10 @@ dma1000_init(struct dwc_softc *sc) WRITE4(sc, BUS_MODE, reg); + reg = READ4(sc, HW_FEATURE); + if (reg & HW_FEATURE_EXT_DESCRIPTOR) + sc->dma_ext_desc = true; + /* * DMA must be stop while changing descriptor list addresses. */ diff --git a/sys/dev/dwc/dwc1000_reg.h b/sys/dev/dwc/dwc1000_reg.h index 768da530bf7c..f581bf135cd8 100644 --- a/sys/dev/dwc/dwc1000_reg.h +++ b/sys/dev/dwc/dwc1000_reg.h @@ -275,7 +275,9 @@ #define CURRENT_HOST_RECEIVE_DESCR 0x104C #define CURRENT_HOST_TRANSMIT_BUF_ADDR 0x1050 #define CURRENT_HOST_RECEIVE_BUF_ADDR 0x1054 + #define HW_FEATURE 0x1058 +#define HW_FEATURE_EXT_DESCRIPTOR (1 << 24) #define DWC_GMAC_NORMAL_DESC 0x1 #define DWC_GMAC_EXT_DESC 0x2 diff --git a/sys/dev/dwc/if_dwc.c b/sys/dev/dwc/if_dwc.c index 9e17d67d434d..ffcf3e8d6afd 100644 --- a/sys/dev/dwc/if_dwc.c +++ b/sys/dev/dwc/if_dwc.c @@ -505,7 +505,6 @@ dwc_attach(device_t dev) sc->tx_desccount = TX_DESC_COUNT; sc->tx_mapcount = 0; sc->mii_clk = IF_DWC_MII_CLK(dev); - sc->mactype = IF_DWC_MAC_TYPE(dev); sc->node = ofw_bus_get_node(dev); sc->phy_mode = mii_fdt_get_contype(sc->node); diff --git a/sys/dev/dwc/if_dwc_aw.c b/sys/dev/dwc/if_dwc_aw.c index 5ad1d14b385b..6419c9dedca8 100644 --- a/sys/dev/dwc/if_dwc_aw.c +++ b/sys/dev/dwc/if_dwc_aw.c @@ -122,13 +122,6 @@ a20_if_dwc_init(device_t dev) return (0); } -static int -a20_if_dwc_mac_type(device_t dev) -{ - - return (DWC_GMAC_NORMAL_DESC); -} - static int a20_if_dwc_mii_clk(device_t dev) { @@ -140,7 +133,6 @@ static device_method_t a20_dwc_methods[] = { DEVMETHOD(device_probe, a20_if_dwc_probe), DEVMETHOD(if_dwc_init, a20_if_dwc_init), - DEVMETHOD(if_dwc_mac_type, a20_if_dwc_mac_type), DEVMETHOD(if_dwc_mii_clk, a20_if_dwc_mii_clk), DEVMETHOD_END diff --git a/sys/dev/dwc/if_dwc_if.m b/sys/dev/dwc/if_dwc_if.m index 0d0d9ee114f7..aea61579946e 100644 --- a/sys/dev/dwc/if_dwc_if.m +++ b/sys/dev/dwc/if_dwc_if.m @@ -36,12 +36,6 @@ CODE { return (0); } - static int - if_dwc_default_mac_type(device_t dev) - { - return (DWC_GMAC_EXT_DESC); - } - static int if_dwc_default_mii_clk(device_t dev) { @@ -65,13 +59,6 @@ METHOD int init { device_t dev; } DEFAULT if_dwc_default_init; -# -# Return the DWC MAC type (descriptor type). -# -METHOD int mac_type { - device_t dev; -} DEFAULT if_dwc_default_mac_type; - # # Return the DWC MII clock for a specific hardware. # diff --git a/sys/dev/dwc/if_dwc_rk.c b/sys/dev/dwc/if_dwc_rk.c index 51edd2450b42..43d4e4847c62 100644 --- a/sys/dev/dwc/if_dwc_rk.c +++ b/sys/dev/dwc/if_dwc_rk.c @@ -578,13 +578,6 @@ if_dwc_rk_init(device_t dev) return (0); } -static int -if_dwc_rk_mac_type(device_t dev) -{ - - return (DWC_GMAC_NORMAL_DESC); -} - static int if_dwc_rk_mii_clk(device_t dev) { @@ -610,7 +603,6 @@ static device_method_t if_dwc_rk_methods[] = { DEVMETHOD(device_probe, if_dwc_rk_probe), DEVMETHOD(if_dwc_init, if_dwc_rk_init), - DEVMETHOD(if_dwc_mac_type, if_dwc_rk_mac_type), DEVMETHOD(if_dwc_mii_clk, if_dwc_rk_mii_clk), DEVMETHOD(if_dwc_set_speed, if_dwc_rk_set_speed), diff --git a/sys/dev/dwc/if_dwc_socfpga.c b/sys/dev/dwc/if_dwc_socfpga.c index 7b4ead1a940c..867c09109d2a 100644 --- a/sys/dev/dwc/if_dwc_socfpga.c +++ b/sys/dev/dwc/if_dwc_socfpga.c @@ -75,13 +75,6 @@ if_dwc_socfpga_init(device_t dev) return (0); } -static int -if_dwc_socfpga_mac_type(device_t dev) -{ - - return (DWC_GMAC_EXT_DESC); -} - static int if_dwc_socfpga_mii_clk(device_t dev) { @@ -100,7 +93,6 @@ static device_method_t dwc_socfpga_methods[] = { DEVMETHOD(device_probe, if_dwc_socfpga_probe), DEVMETHOD(if_dwc_init, if_dwc_socfpga_init), - DEVMETHOD(if_dwc_mac_type, if_dwc_socfpga_mac_type), DEVMETHOD(if_dwc_mii_clk, if_dwc_socfpga_mii_clk), DEVMETHOD_END diff --git a/sys/dev/dwc/if_dwcvar.h b/sys/dev/dwc/if_dwcvar.h index ca0a91d6bf12..e21e256852fa 100644 --- a/sys/dev/dwc/if_dwcvar.h +++ b/sys/dev/dwc/if_dwcvar.h @@ -61,7 +61,6 @@ struct dwc_softc { struct resource *res[2]; device_t dev; phandle_t node; - int mactype; int mii_clk; device_t miibus; struct mii_data * mii_softc; @@ -90,6 +89,7 @@ struct dwc_softc { bool fixed_burst; bool mixed_burst; bool aal; + bool dma_ext_desc; /* RX */ bus_dma_tag_t rxdesc_tag;