Date: Mon, 3 Jun 2002 04:48:54 -0700 (PDT) From: Thomas Moestl <tmm@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 12319 for review Message-ID: <200206031148.g53BmsO31383@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://people.freebsd.org/~peter/p4db/chv.cgi?CH=12319 Change 12319 by tmm@tmm_sparc64 on 2002/06/03 04:48:51 Make this compile and fix a warning in the !GEM_DEBUG case. The GEMTR macros used for this are a bit clumsy, but I want to keep the traces in for a while without them getting in the way. Don't define GEM_DEBUG by default any more. Affected files ... ... //depot/projects/sparc64/sys/dev/gem/if_gem.c#16 edit Differences ... ==== //depot/projects/sparc64/sys/dev/gem/if_gem.c#16 (text+ko) ==== @@ -32,8 +32,6 @@ * Driver for Sun GEM ethernet controllers. */ -#define GEM_DEBUG - #include <sys/param.h> #include <sys/systm.h> #include <sys/bus.h> @@ -106,8 +104,20 @@ printf x #include <sys/ktr.h> #define KTR_GEM KTR_CT2 +#define GEMTR0(s) CTR0(KTR_GEM, s) +#define GEMTR1(s, a1) CTR1(KTR_GEM, s, a1) +#define GEMTR2(s, a1, a2) CTR2(KTR_GEM, s, a1, a2) +#define GEMTR3(s, a1, a2, a3) CTR3(KTR_GEM, s, a1, a2, a3) +#define GEMTR4(s, a1, a2, a3, a4) CTR4(KTR_GEM, s, a1, a2, a3, a4) +#define GEMTR5(s, a1, a2, a3, a4, a5) CTR5(KTR_GEM, s, a1, a2, a3, a4, a5) #else #define DPRINTF(sc, x) /* nothing */ +#define GEMTR0(s) +#define GEMTR1(s, a1) +#define GEMTR2(s, a1, a2) +#define GEMTR3(s, a1, a2, a3) +#define GEMTR4(s, a1, a2, a3, a4) +#define GEMTR5(s, a1, a2, a3, a4, a5) #endif #define GEM_NSEGS GEM_NTXSEGS @@ -399,7 +409,7 @@ "%lx, addr %#lx (%#lx)\n", seg, tx->txd_nexttx, segs[seg].ds_len, segs[seg].ds_addr, GEM_DMA_WRITE(tx->txd_sc, segs[seg].ds_addr))); - CTR5(KTR_GEM, "txdma_cb: mapping seg %d (txd %d), len " + GEMTR5("txdma_cb: mapping seg %d (txd %d), len " "%lx, addr %#lx (%#lx)", seg, tx->txd_nexttx, segs[seg].ds_len, segs[seg].ds_addr, GEM_DMA_WRITE(tx->txd_sc, segs[seg].ds_addr)); @@ -413,12 +423,12 @@ GEM_DMA_WRITE(tx->txd_sc, segs[seg].ds_addr); flags = segs[seg].ds_len & GEM_TD_BUFSIZE; if ((tx->txd_flags & GTXD_FIRST) != 0 && seg == 0) { - CTR2(KTR_GEM, "txdma_cb: start of packet at seg %d, " + GEMTR2("txdma_cb: start of packet at seg %d, " "tx %d", seg, tx->txd_nexttx); flags |= GEM_TD_START_OF_PACKET; } if ((tx->txd_flags & GTXD_LAST) != 0 && seg == nsegs - 1) { - CTR2(KTR_GEM, "txdma_cb: end of packet at seg %d, " + GEMTR2("txdma_cb: end of packet at seg %d, " "tx %d", seg, tx->txd_nexttx); flags |= GEM_TD_END_OF_PACKET; } @@ -470,7 +480,7 @@ s = splnet(); DPRINTF(sc, ("%s: gem_reset\n", device_get_name(sc->sc_dev))); - CTR1(KTR_GEM, "%s: gem_reset", device_get_name(sc->sc_dev)); + GEMTR1("%s: gem_reset", device_get_name(sc->sc_dev)); gem_reset_rx(sc); gem_reset_tx(sc); @@ -516,7 +526,7 @@ struct gem_txsoft *txs; DPRINTF(sc, ("%s: gem_stop\n", device_get_name(sc->sc_dev))); - CTR1(KTR_GEM, "%s: gem_stop", device_get_name(sc->sc_dev)); + GEMTR1("%s: gem_stop", device_get_name(sc->sc_dev)); callout_stop(&sc->sc_tick_ch); @@ -768,7 +778,7 @@ s = splnet(); DPRINTF(sc, ("%s: gem_init: calling stop\n", device_get_name(sc->sc_dev))); - CTR1(KTR_GEM, "%s: gem_init: calling stop", device_get_name(sc->sc_dev)); + GEMTR1("%s: gem_init: calling stop", device_get_name(sc->sc_dev)); /* * Initialization sequence. The numbered steps below correspond * to the sequence outlined in section 6.3.5.1 in the Ethernet @@ -780,7 +790,7 @@ gem_stop(&sc->sc_arpcom.ac_if, 0); gem_reset(sc); DPRINTF(sc, ("%s: gem_init: restarting\n", device_get_name(sc->sc_dev))); - CTR1(KTR_GEM, "%s: gem_init: restarting", device_get_name(sc->sc_dev)); + GEMTR1("%s: gem_init: restarting", device_get_name(sc->sc_dev)); /* Re-initialize the MIF */ gem_mifinit(sc); @@ -810,7 +820,7 @@ bus_space_write_4(t, h, GEM_RX_RING_PTR_LO, GEM_CDRXADDR(sc, 0)); DPRINTF(sc, ("loading rx ring %lx, tx ring %lx, cddma %lx\n", GEM_CDRXADDR(sc, 0), GEM_CDTXADDR(sc, 0), sc->sc_cddma)); - CTR3(KTR_GEM, "loading rx ring %lx, tx ring %lx, cddma %lx", + GEMTR3("loading rx ring %lx, tx ring %lx, cddma %lx", GEM_CDRXADDR(sc, 0), GEM_CDTXADDR(sc, 0), sc->sc_cddma); /* step 8. Global Configuration & Interrupt Mask */ @@ -949,7 +959,7 @@ txs->txs_firstdesc = txj->txj_nexttx; txs->txs_lastdesc = txd.txd_lasttx; txs->txs_ndescs = txd.txd_nsegs; - CTR3(KTR_GEM, "load_mbuf: setting firstdesc=%d, lastdesc=%d, " + GEMTR3("load_mbuf: setting firstdesc=%d, lastdesc=%d, " "ndescs=%d", txs->txs_firstdesc, txs->txs_lastdesc, txs->txs_ndescs); STAILQ_REMOVE_HEAD(&sc->sc_txfreeq, txs_q); @@ -962,7 +972,7 @@ return (0); fail: - CTR1(KTR_GEM, "gem_dmamap_load_mbuf failed (%d)", error); + GEMTR1("gem_dmamap_load_mbuf failed (%d)", error); gem_dmamap_unload_mbuf(sc, txj); return (error); } @@ -1088,7 +1098,10 @@ struct gem_softc *sc = (struct gem_softc *)ifp->if_softc; struct mbuf *m0 = NULL, *m; struct gem_txjob txj; - int firsttx, ofree, seg, ntx, txmfail; + int firsttx, ofree, ntx, txmfail; +#ifdef GEM_DEBUG + int seg; +#endif if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING) return; @@ -1102,7 +1115,7 @@ DPRINTF(sc, ("%s: gem_start: txfree %d, txnext %d\n", device_get_name(sc->sc_dev), ofree, firsttx)); - CTR3(KTR_GEM, "%s: gem_start: txfree %d, txnext %d", + GEMTR3("%s: gem_start: txfree %d, txnext %d", device_get_name(sc->sc_dev), ofree, firsttx); txj.txj_nexttx = firsttx; @@ -1236,7 +1249,7 @@ if (ntx > 0) { DPRINTF(sc, ("%s: packets enqueued, IC on %d, OWN on %d\n", device_get_name(sc->sc_dev), txj.txj_lasttx, firsttx)); - CTR3(KTR_GEM, "%s: packets enqueued, IC on %d, OWN on %d", + GEMTR3("%s: packets enqueued, IC on %d, OWN on %d", device_get_name(sc->sc_dev), txj.txj_lasttx, firsttx); /* * The entire packet chain is set up. @@ -1244,7 +1257,7 @@ */ DPRINTF(sc, ("%s: gem_start: kicking tx %d\n", device_get_name(sc->sc_dev), txj.txj_nexttx)); - CTR3(KTR_GEM, "%s: gem_start: kicking tx %d=%d", + GEMTR3("%s: gem_start: kicking tx %d=%d", device_get_name(sc->sc_dev), txj.txj_nexttx, sc->sc_txnext); bus_space_write_4(sc->sc_bustag, sc->sc_h, GEM_TX_KICK, @@ -1254,7 +1267,7 @@ ifp->if_timer = 5; DPRINTF(sc, ("%s: gem_start: watchdog %d\n", device_get_name(sc->sc_dev), ifp->if_timer)); - CTR2(KTR_GEM, "%s: gem_start: watchdog %d", + GEMTR2("%s: gem_start: watchdog %d", device_get_name(sc->sc_dev), ifp->if_timer); } } @@ -1274,7 +1287,7 @@ DPRINTF(sc, ("%s: gem_tint\n", device_get_name(sc->sc_dev))); - CTR1(KTR_GEM, "%s: gem_tint", device_get_name(sc->sc_dev)); + GEMTR1("%s: gem_tint", device_get_name(sc->sc_dev)); /* * Unload collision counters @@ -1329,7 +1342,7 @@ DPRINTF(sc, ("gem_tint: txs->txs_lastdesc = %d, txlast = %d\n", txs->txs_lastdesc, txlast)); - CTR3(KTR_GEM, "gem_tint: txs->txs_firstdesc = %d, " + GEMTR3("gem_tint: txs->txs_firstdesc = %d, " "txs->txs_lastdesc = %d, txlast = %d", txs->txs_firstdesc, txs->txs_lastdesc, txlast); if (txs->txs_firstdesc <= txs->txs_lastdesc) { @@ -1344,7 +1357,7 @@ } DPRINTF(sc, ("gem_tint: releasing a desc\n")); - CTR0(KTR_GEM, "gem_tint: releasing a desc"); + GEMTR0("gem_tint: releasing a desc"); STAILQ_REMOVE_HEAD(&sc->sc_txdirtyq, txs_q); sc->sc_txfree += txs->txs_ndescs; @@ -1371,7 +1384,7 @@ bus_space_read_4(sc->sc_bustag, sc->sc_h, GEM_TX_DATA_PTR_LO), bus_space_read_4(sc->sc_bustag, sc->sc_h, GEM_TX_COMPLETION))); - CTR3(KTR_GEM, "gem_tint: GEM_TX_STATE_MACHINE %x " + GEMTR3("gem_tint: GEM_TX_STATE_MACHINE %x " "GEM_TX_DATA_PTR %llx " "GEM_TX_COMPLETION %x", bus_space_read_4(sc->sc_bustag, sc->sc_h, GEM_TX_STATE_MACHINE), @@ -1387,7 +1400,7 @@ DPRINTF(sc, ("%s: gem_tint: watchdog %d\n", device_get_name(sc->sc_dev), ifp->if_timer)); - CTR2(KTR_GEM, "%s: gem_tint: watchdog %d", + GEMTR2("%s: gem_tint: watchdog %d", device_get_name(sc->sc_dev), ifp->if_timer); /* Freed some descriptors, so reset IFF_OACTIVE and restart. */ @@ -1421,13 +1434,13 @@ callout_stop(&sc->sc_rx_ch); DPRINTF(sc, ("%s: gem_rint\n", device_get_name(sc->sc_dev))); - CTR1(KTR_GEM, "%s: gem_rint", device_get_name(sc->sc_dev)); + GEMTR1("%s: gem_rint", device_get_name(sc->sc_dev)); /* * XXXX Read the lastrx only once at the top for speed. */ DPRINTF(sc, ("gem_rint: sc->rxptr %d, complete %d\n", sc->sc_rxptr, bus_space_read_4(t, h, GEM_RX_COMPLETION))); - CTR2(KTR_GEM, "gem_rint: sc->rxptr %d, complete %d", + GEMTR2("gem_rint: sc->rxptr %d, complete %d", sc->sc_rxptr, bus_space_read_4(t, h, GEM_RX_COMPLETION)); for (i = sc->sc_rxptr; i != bus_space_read_4(t, h, GEM_RX_COMPLETION); i = GEM_NEXTRX(i)) { @@ -1507,7 +1520,7 @@ DPRINTF(sc, ("gem_rint: done sc->rxptr %d, complete %d\n", sc->sc_rxptr, bus_space_read_4(t, h, GEM_RX_COMPLETION))); - CTR2(KTR_GEM, "gem_rint: done sc->rxptr %d, complete %d", + GEMTR2("gem_rint: done sc->rxptr %d, complete %d", sc->sc_rxptr, bus_space_read_4(t, h, GEM_RX_COMPLETION)); } @@ -1592,7 +1605,7 @@ DPRINTF(sc, ("%s: gem_intr: cplt %x, status %x\n", device_get_name(sc->sc_dev), (status>>19), (u_int)status)); - CTR3(KTR_GEM, "%s: gem_intr: cplt %x, status %x", + GEMTR3("%s: gem_intr: cplt %x, status %x", device_get_name(sc->sc_dev), (status>>19), (u_int)status); @@ -1634,12 +1647,12 @@ bus_space_read_4(sc->sc_bustag, sc->sc_h, GEM_RX_CONFIG), bus_space_read_4(sc->sc_bustag, sc->sc_h, GEM_MAC_RX_STATUS), bus_space_read_4(sc->sc_bustag, sc->sc_h, GEM_MAC_RX_CONFIG))); - CTR3(KTR_GEM, "gem_watchdog: GEM_RX_CONFIG %x GEM_MAC_RX_STATUS %x " + GEMTR3("gem_watchdog: GEM_RX_CONFIG %x GEM_MAC_RX_STATUS %x " "GEM_MAC_RX_CONFIG %x", bus_space_read_4(sc->sc_bustag, sc->sc_h, GEM_RX_CONFIG), bus_space_read_4(sc->sc_bustag, sc->sc_h, GEM_MAC_RX_STATUS), bus_space_read_4(sc->sc_bustag, sc->sc_h, GEM_MAC_RX_CONFIG)); - CTR3(KTR_GEM, "gem_watchdog: GEM_TX_CONFIG %x GEM_MAC_TX_STATUS %x " + GEMTR3("gem_watchdog: GEM_TX_CONFIG %x GEM_MAC_TX_STATUS %x " "GEM_MAC_TX_CONFIG %x", bus_space_read_4(sc->sc_bustag, sc->sc_h, GEM_TX_CONFIG), bus_space_read_4(sc->sc_bustag, sc->sc_h, GEM_MAC_TX_STATUS), To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe p4-projects" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200206031148.g53BmsO31383>