Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/pci Back out the following changes:



details:   https://anonhg.NetBSD.org/src/rev/29ce22fa9287
branches:  trunk
changeset: 379544:29ce22fa9287
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Sat Jun 05 14:28:28 2021 +0000

description:
Back out the following changes:

  http://mail-index.netbsd.org/source-changes/2020/02/29/msg114581.html
  http://mail-index.netbsd.org/source-changes/2020/02/29/msg114583.html

They have reportedly caused some issues with link detection, and will
be revisited later.

diffstat:

 sys/dev/pci/if_ti.c    |  63 +++++++++++++++++++------------------------------
 sys/dev/pci/if_tireg.h |  16 +++++++++++-
 2 files changed, 39 insertions(+), 40 deletions(-)

diffs (223 lines):

diff -r cc10f872f49a -r 29ce22fa9287 sys/dev/pci/if_ti.c
--- a/sys/dev/pci/if_ti.c       Sat Jun 05 08:26:34 2021 +0000
+++ b/sys/dev/pci/if_ti.c       Sat Jun 05 14:28:28 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_ti.c,v 1.120 2020/03/05 15:45:48 msaitoh Exp $ */
+/* $NetBSD: if_ti.c,v 1.121 2021/06/05 14:28:28 thorpej Exp $ */
 
 /*
  * Copyright (c) 1997, 1998, 1999
@@ -81,7 +81,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_ti.c,v 1.120 2020/03/05 15:45:48 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ti.c,v 1.121 2021/06/05 14:28:28 thorpej Exp $");
 
 #include "opt_inet.h"
 
@@ -123,16 +123,6 @@
 #include <dev/microcode/tigon/ti_fw.h>
 #include <dev/microcode/tigon/ti_fw2.h>
 
-#define        TI_HOSTADDR(x, y)                                               \
-       do {                                                            \
-               (x).ti_addr_lo = (uint32_t)(y);                         \
-               if (sizeof(bus_addr_t) == 8)                            \
-                       (x).ti_addr_hi =                                \
-                           (uint32_t)(((uint64_t)(y) >> 32));          \
-               else                                                    \
-                       (x).ti_addr_hi = 0;                             \
-       } while (/*CONSTCOND*/0)
-
 /*
  * Various supported device vendors/types and their names.
  */
@@ -752,7 +742,7 @@ ti_newbuf_std(struct ti_softc *sc, int i
 
        sc->ti_cdata.ti_rx_std_chain[i] = m_new;
        r = &sc->ti_rdata->ti_rx_std_ring[i];
-       TI_HOSTADDR(r->ti_addr, dmamap->dm_segs[0].ds_addr);
+       TI_HOSTADDR(r->ti_addr) = dmamap->dm_segs[0].ds_addr;
        r->ti_type = TI_BDTYPE_RECV_BD;
        r->ti_flags = 0;
        if (sc->ethercom.ec_if.if_capenable & IFCAP_CSUM_IPv4_Rx)
@@ -819,7 +809,7 @@ ti_newbuf_mini(struct ti_softc *sc, int 
 
        r = &sc->ti_rdata->ti_rx_mini_ring[i];
        sc->ti_cdata.ti_rx_mini_chain[i] = m_new;
-       TI_HOSTADDR(r->ti_addr, dmamap->dm_segs[0].ds_addr);
+       TI_HOSTADDR(r->ti_addr) = dmamap->dm_segs[0].ds_addr;
        r->ti_type = TI_BDTYPE_RECV_BD;
        r->ti_flags = TI_BDFLAG_MINI_RING;
        if (sc->ethercom.ec_if.if_capenable & IFCAP_CSUM_IPv4_Rx)
@@ -878,8 +868,8 @@ ti_newbuf_jumbo(struct ti_softc *sc, int
        /* Set up the descriptor. */
        r = &sc->ti_rdata->ti_rx_jumbo_ring[i];
        sc->ti_cdata.ti_rx_jumbo_chain[i] = m_new;
-       TI_HOSTADDR(r->ti_addr, sc->jumbo_dmaaddr +
-           (mtod(m_new, char *) - (char *)sc->ti_cdata.ti_jumbo_buf));
+       TI_HOSTADDR(r->ti_addr) = sc->jumbo_dmaaddr +
+               (mtod(m_new, char *) - (char *)sc->ti_cdata.ti_jumbo_buf);
        r->ti_type = TI_BDTYPE_RECV_JUMBO_BD;
        r->ti_flags = TI_BDFLAG_JUMBO_RING;
        if (sc->ethercom.ec_if.if_capenable & IFCAP_CSUM_IPv4_Rx)
@@ -1426,10 +1416,10 @@ ti_gibinit(struct ti_softc *sc)
        /* Set up the event ring and producer pointer. */
        rcb = &sc->ti_rdata->ti_info.ti_ev_rcb;
 
-       TI_HOSTADDR(rcb->ti_hostaddr, TI_CDEVENTADDR(sc, 0));
+       TI_HOSTADDR(rcb->ti_hostaddr) = TI_CDEVENTADDR(sc, 0);
        rcb->ti_flags = 0;
-       TI_HOSTADDR(sc->ti_rdata->ti_info.ti_ev_prodidx_ptr,
-           TI_CDEVPRODADDR(sc));
+       TI_HOSTADDR(sc->ti_rdata->ti_info.ti_ev_prodidx_ptr) =
+           TI_CDEVPRODADDR(sc);
 
        sc->ti_ev_prodidx.ti_idx = 0;
        CSR_WRITE_4(sc, TI_GCR_EVENTCONS_IDX, 0);
@@ -1438,7 +1428,7 @@ ti_gibinit(struct ti_softc *sc)
        /* Set up the command ring and producer mailbox. */
        rcb = &sc->ti_rdata->ti_info.ti_cmd_rcb;
 
-       TI_HOSTADDR(rcb->ti_hostaddr, TI_GCR_NIC_ADDR(TI_GCR_CMDRING));
+       TI_HOSTADDR(rcb->ti_hostaddr) = TI_GCR_NIC_ADDR(TI_GCR_CMDRING);
        rcb->ti_flags = 0;
        rcb->ti_max_len = 0;
        for (i = 0; i < TI_CMD_RING_CNT; i++) {
@@ -1453,12 +1443,12 @@ ti_gibinit(struct ti_softc *sc)
         * We re-use the current stats buffer for this to
         * conserve memory.
         */
-       TI_HOSTADDR(sc->ti_rdata->ti_info.ti_refresh_stats_ptr,
-           TI_CDSTATSADDR(sc));
+       TI_HOSTADDR(sc->ti_rdata->ti_info.ti_refresh_stats_ptr) =
+           TI_CDSTATSADDR(sc);
 
        /* Set up the standard receive ring. */
        rcb = &sc->ti_rdata->ti_info.ti_std_rx_rcb;
-       TI_HOSTADDR(rcb->ti_hostaddr, TI_CDRXSTDADDR(sc, 0));
+       TI_HOSTADDR(rcb->ti_hostaddr) = TI_CDRXSTDADDR(sc, 0);
        rcb->ti_max_len = ETHER_MAX_LEN;
        rcb->ti_flags = 0;
        if (ifp->if_capenable & IFCAP_CSUM_IPv4_Rx)
@@ -1470,7 +1460,7 @@ ti_gibinit(struct ti_softc *sc)
 
        /* Set up the jumbo receive ring. */
        rcb = &sc->ti_rdata->ti_info.ti_jumbo_rx_rcb;
-       TI_HOSTADDR(rcb->ti_hostaddr, TI_CDRXJUMBOADDR(sc, 0));
+       TI_HOSTADDR(rcb->ti_hostaddr) = TI_CDRXJUMBOADDR(sc, 0);
        rcb->ti_max_len = ETHER_MAX_LEN_JUMBO;
        rcb->ti_flags = 0;
        if (ifp->if_capenable & IFCAP_CSUM_IPv4_Rx)
@@ -1486,7 +1476,7 @@ ti_gibinit(struct ti_softc *sc)
         * still there on the Tigon 1.
         */
        rcb = &sc->ti_rdata->ti_info.ti_mini_rx_rcb;
-       TI_HOSTADDR(rcb->ti_hostaddr, TI_CDRXMINIADDR(sc, 0));
+       TI_HOSTADDR(rcb->ti_hostaddr) = TI_CDRXMINIADDR(sc, 0);
        rcb->ti_max_len = MHLEN - ETHER_ALIGN;
        if (sc->ti_hwrev == TI_HWREV_TIGON)
                rcb->ti_flags = TI_RCB_FLAG_RING_DISABLED;
@@ -1503,11 +1493,11 @@ ti_gibinit(struct ti_softc *sc)
         * Set up the receive return ring.
         */
        rcb = &sc->ti_rdata->ti_info.ti_return_rcb;
-       TI_HOSTADDR(rcb->ti_hostaddr, TI_CDRXRTNADDR(sc, 0));
+       TI_HOSTADDR(rcb->ti_hostaddr) = TI_CDRXRTNADDR(sc, 0);
        rcb->ti_flags = 0;
        rcb->ti_max_len = TI_RETURN_RING_CNT;
-       TI_HOSTADDR(sc->ti_rdata->ti_info.ti_return_prodidx_ptr,
-           TI_CDRTNPRODADDR(sc));
+       TI_HOSTADDR(sc->ti_rdata->ti_info.ti_return_prodidx_ptr) =
+           TI_CDRTNPRODADDR(sc);
 
        /*
         * Set up the tx ring. Note: for the Tigon 2, we have the option
@@ -1544,11 +1534,11 @@ ti_gibinit(struct ti_softc *sc)
                rcb->ti_flags |= TI_RCB_FLAG_VLAN_ASSIST;
        rcb->ti_max_len = TI_TX_RING_CNT;
        if (sc->ti_hwrev == TI_HWREV_TIGON)
-               TI_HOSTADDR(rcb->ti_hostaddr, TI_TX_RING_BASE);
+               TI_HOSTADDR(rcb->ti_hostaddr) = TI_TX_RING_BASE;
        else
-               TI_HOSTADDR(rcb->ti_hostaddr, TI_CDTXADDR(sc, 0));
-       TI_HOSTADDR(sc->ti_rdata->ti_info.ti_tx_considx_ptr,
-           TI_CDTXCONSADDR(sc));
+               TI_HOSTADDR(rcb->ti_hostaddr) = TI_CDTXADDR(sc, 0);
+       TI_HOSTADDR(sc->ti_rdata->ti_info.ti_tx_considx_ptr) =
+           TI_CDTXCONSADDR(sc);
 
        /*
         * We're done frobbing the General Information Block.  Sync
@@ -1740,10 +1730,7 @@ ti_attach(device_t parent, device_t self
         */
        aprint_normal_dev(self, "Ethernet address %s\n", ether_sprintf(eaddr));
 
-       if (pci_dma64_available(pa))
-               sc->sc_dmat = pa->pa_dmat64;
-       else
-               sc->sc_dmat = pa->pa_dmat;
+       sc->sc_dmat = pa->pa_dmat;
 
        /* Allocate the general information block and ring buffers. */
        if ((error = bus_dmamem_alloc(sc->sc_dmat,
@@ -2273,7 +2260,7 @@ ti_encap_tigon1(struct ti_softc *sc, str
                f = &sc->ti_tx_ring_nic[frag % 128];
                if (sc->ti_cdata.ti_tx_chain[frag] != NULL)
                        break;
-               TI_HOSTADDR(f->ti_addr, dmamap->dm_segs[i].ds_addr);
+               TI_HOSTADDR(f->ti_addr) = dmamap->dm_segs[i].ds_addr;
                f->ti_len = dmamap->dm_segs[i].ds_len;
                f->ti_flags = csum_flags;
                if (vlan_has_tag(m_head)) {
@@ -2364,7 +2351,7 @@ ti_encap_tigon2(struct ti_softc *sc, str
                f = &sc->ti_rdata->ti_tx_ring[frag];
                if (sc->ti_cdata.ti_tx_chain[frag] != NULL)
                        break;
-               TI_HOSTADDR(f->ti_addr, dmamap->dm_segs[i].ds_addr);
+               TI_HOSTADDR(f->ti_addr) = dmamap->dm_segs[i].ds_addr;
                f->ti_len = dmamap->dm_segs[i].ds_len;
                f->ti_flags = csum_flags;
                if (vlan_has_tag(m_head)) {
diff -r cc10f872f49a -r 29ce22fa9287 sys/dev/pci/if_tireg.h
--- a/sys/dev/pci/if_tireg.h    Sat Jun 05 08:26:34 2021 +0000
+++ b/sys/dev/pci/if_tireg.h    Sat Jun 05 14:28:28 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_tireg.h,v 1.30 2020/04/02 16:18:51 msaitoh Exp $ */
+/* $NetBSD: if_tireg.h,v 1.31 2021/06/05 14:28:28 thorpej Exp $ */
 
 /*
  * Copyright (c) 1997, 1998, 1999
@@ -270,7 +270,7 @@
 #define TI_GCR_RXRETURNCONS_IDX                0x680
 #define TI_GCR_CMDRING                 0x700
 
-#define TI_GCR_NIC_ADDR(x)             (x - TI_GCR_BASE)
+#define TI_GCR_NIC_ADDR(x)             (x - TI_GCR_BASE);
 
 /*
  * Local memory window. The local memory window is a 2K shared
@@ -373,10 +373,22 @@
  */
 #define TI_MEM_MAX             0x7FFFFF
 
+/*
+ * Even on the alpha, pci addresses are 32-bit quantities
+ */
+
+#ifdef __64_bit_pci_addressing__
+typedef struct {
+       u_int64_t               ti_addr;
+} ti_hostaddr;
+#define TI_HOSTADDR(x) x.ti_addr
+#else
 typedef struct {
        uint32_t        ti_addr_hi;
        uint32_t        ti_addr_lo;
 } ti_hostaddr;
+#define TI_HOSTADDR(x) x.ti_addr_lo
+#endif
 
 /*
  * Ring control block structure. The rules for the max_len field



Home | Main Index | Thread Index | Old Index