Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 28 Jan 2008 01:28:23 GMT
From:      Sam Leffler <sam@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 134273 for review
Message-ID:  <200801280128.m0S1SNGl082146@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=134273

Change 134273 by sam@sam_ebb on 2008/01/28 01:27:40

	Cleanup debug support:
	o dev.ral.X.debug controls debug msgs for each device
	o DPRINTF* use varargs macros
	o remove painful interdependence of 2560+2661 debug code
	
	Temporarily enable debug msgs by default until the driver
	is fully funcitonal again.

Affected files ...

.. //depot/projects/vap/sys/dev/ral/rt2560.c#10 edit
.. //depot/projects/vap/sys/dev/ral/rt2560var.h#6 edit
.. //depot/projects/vap/sys/dev/ral/rt2661.c#8 edit
.. //depot/projects/vap/sys/dev/ral/rt2661var.h#5 edit

Differences ...

==== //depot/projects/vap/sys/dev/ral/rt2560.c#10 (text) ====

@@ -70,13 +70,19 @@
 	((rssi) > (RT2560_NOISE_FLOOR + (sc)->rssi_corr) ?	\
 	 ((rssi) - RT2560_NOISE_FLOOR - (sc)->rssi_corr) : 0)
 
+#define RAL_DEBUG
 #ifdef RAL_DEBUG
-#define DPRINTF(x)	do { if (ral_debug > 0) printf x; } while (0)
-#define DPRINTFN(n, x)	do { if (ral_debug >= (n)) printf x; } while (0)
-extern int ral_debug;
+#define DPRINTF(sc, fmt, ...) do {				\
+	if (sc->sc_debug > 0)					\
+		printf(fmt, __VA_ARGS__);			\
+} while (0)
+#define DPRINTFN(sc, n, fmt, ...) do {				\
+	if (sc->sc_debug >= (n))				\
+		printf(fmt, __VA_ARGS__);			\
+} while (0)
 #else
-#define DPRINTF(x)
-#define DPRINTFN(n, x)
+#define DPRINTF(sc, fmt, ...)
+#define DPRINTFN(sc, n, fmt, ...)
 #endif
 
 static struct ieee80211vap *rt2560_vap_create(struct ieee80211com *,
@@ -315,6 +321,11 @@
 	/*
 	 * Add a few sysctl knobs.
 	 */
+#ifdef RAL_DEBUG
+	SYSCTL_ADD_INT(device_get_sysctl_ctx(dev),
+	    SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO,
+	    "debug", CTLFLAG_RW, &sc->sc_debug, 0, "debug msgs");
+#endif
 	SYSCTL_ADD_INT(device_get_sysctl_ctx(dev),
 	    SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO,
 	    "txantenna", CTLFLAG_RW, &sc->tx_ant, 0, "tx antenna (0=auto)");
@@ -920,8 +931,8 @@
 		/* mark the frame ready for transmission */
 		desc->flags |= htole32(RT2560_TX_BUSY | RT2560_TX_VALID);
 
-		DPRINTFN(15, ("encryption done idx=%u\n",
-		    sc->txq.next_encrypt));
+		DPRINTFN(sc, 15, "encryption done idx=%u\n",
+		    sc->txq.next_encrypt);
 
 		sc->txq.next_encrypt =
 		    (sc->txq.next_encrypt + 1) % RT2560_TX_RING_COUNT;
@@ -959,7 +970,7 @@
 
 		switch (le32toh(desc->flags) & RT2560_TX_RESULT_MASK) {
 		case RT2560_TX_SUCCESS:
-			DPRINTFN(10, ("data frame sent successfully\n"));
+			DPRINTFN(sc, 10, "%s\n", "data frame sent successfully");
 			if (data->id.id_node != NULL) {
 				ral_rssadapt_raise_rate(&rn->rssadapt,
 				    &data->id);
@@ -968,14 +979,14 @@
 			break;
 
 		case RT2560_TX_SUCCESS_RETRY:
-			DPRINTFN(9, ("data frame sent after %u retries\n",
-			    (le32toh(desc->flags) >> 5) & 0x7));
+			DPRINTFN(sc, 9, "data frame sent after %u retries\n",
+			    (le32toh(desc->flags) >> 5) & 0x7);
 			ifp->if_opackets++;
 			break;
 
 		case RT2560_TX_FAIL_RETRY:
-			DPRINTFN(9, ("sending data frame failed (too much "
-			    "retries)\n"));
+			DPRINTFN(sc, 9, "%s\n",
+			    "sending data frame failed (too much retries)");
 			if (data->id.id_node != NULL) {
 				ral_rssadapt_lower_rate(data->ni,
 				    &rn->rssadapt, &data->id);
@@ -1002,7 +1013,7 @@
 		/* descriptor is no longer valid */
 		desc->flags &= ~htole32(RT2560_TX_VALID);
 
-		DPRINTFN(15, ("tx done idx=%u\n", sc->txq.next));
+		DPRINTFN(sc, 15, "tx done idx=%u\n", sc->txq.next);
 
 		sc->txq.queued--;
 		sc->txq.next = (sc->txq.next + 1) % RT2560_TX_RING_COUNT;
@@ -1040,17 +1051,17 @@
 
 		switch (flags & RT2560_TX_RESULT_MASK) {
 		case RT2560_TX_SUCCESS:
-			DPRINTFN(10, ("mgt frame sent successfully\n"));
+			DPRINTFN(sc, 10, "%s\n", "mgt frame sent successfully");
 			break;
 
 		case RT2560_TX_SUCCESS_RETRY:
-			DPRINTFN(9, ("mgt frame sent after %u retries\n",
-			    (flags >> 5) & 0x7));
+			DPRINTFN(sc, 9, "mgt frame sent after %u retries\n",
+			    (flags >> 5) & 0x7);
 			break;
 
 		case RT2560_TX_FAIL_RETRY:
-			DPRINTFN(9, ("sending mgt frame failed (too much "
-			    "retries)\n"));
+			DPRINTFN(sc, 9, "%s\n",
+			    "sending mgt frame failed (too much retries)");
 			break;
 
 		case RT2560_TX_FAIL_INVALID:
@@ -1073,7 +1084,7 @@
 		/* descriptor is no longer valid */
 		desc->flags &= ~htole32(RT2560_TX_VALID);
 
-		DPRINTFN(15, ("prio done idx=%u\n", sc->prioq.next));
+		DPRINTFN(sc, 15, "prio done idx=%u\n", sc->prioq.next);
 
 		sc->prioq.queued--;
 		sc->prioq.next = (sc->prioq.next + 1) % RT2560_PRIO_RING_COUNT;
@@ -1230,7 +1241,7 @@
 		sc->sc_flags &= ~RAL_INPUT_RUNNING;
 skip:		desc->flags = htole32(RT2560_RX_BUSY);
 
-		DPRINTFN(15, ("decryption done idx=%u\n", sc->rxq.cur_decrypt));
+		DPRINTFN(sc, 15, "decryption done idx=%u\n", sc->rxq.cur_decrypt);
 
 		sc->rxq.cur_decrypt =
 		    (sc->rxq.cur_decrypt + 1) % RT2560_RX_RING_COUNT;
@@ -1269,20 +1280,20 @@
 			 * This should not happen since we did not request
 			 * to receive those frames when we filled RXCSR0.
 			 */
-			DPRINTFN(5, ("PHY or CRC error flags 0x%08x\n",
-			    le32toh(desc->flags)));
+			DPRINTFN(sc, 5, "PHY or CRC error flags 0x%08x\n",
+			    le32toh(desc->flags));
 			data->drop = 1;
 		}
 
 		if (((le32toh(desc->flags) >> 16) & 0xfff) > MCLBYTES) {
-			DPRINTFN(5, ("bad length\n"));
+			DPRINTFN(sc, 5, "%s\n", "bad length");
 			data->drop = 1;
 		}
 
 		/* mark the frame for decryption */
 		desc->flags |= htole32(RT2560_RX_CIPHER_BUSY);
 
-		DPRINTFN(15, ("rx done idx=%u\n", sc->rxq.cur));
+		DPRINTFN(sc, 15, "rx done idx=%u\n", sc->rxq.cur);
 
 		sc->rxq.cur = (sc->rxq.cur + 1) % RT2560_RX_RING_COUNT;
 	}
@@ -1334,7 +1345,7 @@
 
 	rt2560_tx_bcn(sc, data->m, data->ni);
 
-	DPRINTFN(15, ("beacon expired\n"));
+	DPRINTFN(sc, 15, "%s", "beacon expired\n");
 
 	sc->bcnq.next = (sc->bcnq.next + 1) % RT2560_BEACON_RING_COUNT;
 }
@@ -1343,7 +1354,7 @@
 static void
 rt2560_wakeup_expire(struct rt2560_softc *sc)
 {
-	DPRINTFN(2, ("wakeup expired\n"));
+	DPRINTFN(sc, 2, "%s", "wakeup expired\n");
 }
 
 void
@@ -1541,8 +1552,8 @@
 	rt2560_setup_tx_desc(sc, desc, RT2560_TX_IFS_NEWBACKOFF |
 	    RT2560_TX_TIMESTAMP, m0->m_pkthdr.len, rate, 0, segs->ds_addr);
 
-	DPRINTFN(10, ("sending beacon frame len=%u idx=%u rate=%u\n",
-	    m0->m_pkthdr.len, sc->bcnq.cur, rate));
+	DPRINTFN(sc, 10, "sending beacon frame len=%u idx=%u rate=%u\n",
+	    m0->m_pkthdr.len, sc->bcnq.cur, rate);
 
 	bus_dmamap_sync(sc->bcnq.data_dmat, data->map, BUS_DMASYNC_PREWRITE);
 	bus_dmamap_sync(sc->bcnq.desc_dmat, sc->bcnq.desc_map,
@@ -1630,8 +1641,8 @@
 	bus_dmamap_sync(sc->prioq.desc_dmat, sc->prioq.desc_map,
 	    BUS_DMASYNC_PREWRITE);
 
-	DPRINTFN(10, ("sending mgt frame len=%u idx=%u rate=%u\n",
-	    m0->m_pkthdr.len, sc->prioq.cur, rate));
+	DPRINTFN(sc, 10, "sending mgt frame len=%u idx=%u rate=%u\n",
+	    m0->m_pkthdr.len, sc->prioq.cur, rate);
 
 	/* kick prio */
 	sc->prioq.queued++;
@@ -1699,8 +1710,8 @@
 	bus_dmamap_sync(sc->prioq.desc_dmat, sc->prioq.desc_map,
 	    BUS_DMASYNC_PREWRITE);
 
-	DPRINTFN(10, ("sending raw frame len=%u idx=%u rate=%u\n",
-	    m0->m_pkthdr.len, sc->prioq.cur, rate));
+	DPRINTFN(sc, 10, "sending raw frame len=%u idx=%u rate=%u\n",
+	    m0->m_pkthdr.len, sc->prioq.cur, rate);
 
 	/* kick prio */
 	sc->prioq.queued++;
@@ -1926,8 +1937,8 @@
 	bus_dmamap_sync(sc->txq.desc_dmat, sc->txq.desc_map,
 	    BUS_DMASYNC_PREWRITE);
 
-	DPRINTFN(10, ("sending data frame len=%u idx=%u rate=%u\n",
-	    m0->m_pkthdr.len, sc->txq.cur_encrypt, rate));
+	DPRINTFN(sc, 10, "sending data frame len=%u idx=%u rate=%u\n",
+	    m0->m_pkthdr.len, sc->txq.cur_encrypt, rate);
 
 	/* kick encrypt */
 	sc->txq.queued++;
@@ -2043,7 +2054,7 @@
 	tmp = RT2560_BBP_WRITE | RT2560_BBP_BUSY | reg << 8 | val;
 	RAL_WRITE(sc, RT2560_BBPCSR, tmp);
 
-	DPRINTFN(15, ("BBP R%u <- 0x%02x\n", reg, val));
+	DPRINTFN(sc, 15, "BBP R%u <- 0x%02x\n", reg, val);
 }
 
 static uint8_t
@@ -2089,7 +2100,7 @@
 	/* remember last written value in sc */
 	sc->rf_regs[reg] = val;
 
-	DPRINTFN(15, ("RF R[%u] <- 0x%05x\n", reg & 0x3, val & 0xfffff));
+	DPRINTFN(sc, 15, "RF R[%u] <- 0x%05x\n", reg & 0x3, val & 0xfffff);
 }
 
 static void
@@ -2112,7 +2123,7 @@
 	/* adjust txpower using ifconfig settings */
 	power -= (100 - ic->ic_txpowlimit) / 8;
 
-	DPRINTFN(2, ("setting channel to %u, txpower to %u\n", chan, power));
+	DPRINTFN(sc, 2, "setting channel to %u, txpower to %u\n", chan, power);
 
 	switch (sc->rf_rev) {
 	case RT2560_RF_2522:
@@ -2222,7 +2233,7 @@
 	tmp = sc->rf_regs[RAL_RF3] & ~RAL_RF3_AUTOTUNE;
 	rt2560_rf_write(sc, RAL_RF3, tmp);
 
-	DPRINTFN(2, ("disabling RF autotune\n"));
+	DPRINTFN(sc, 2, "%s", "disabling RF autotune\n");
 }
 #endif
 
@@ -2260,7 +2271,7 @@
 		       RT2560_ENABLE_BEACON_GENERATOR;
 	RAL_WRITE(sc, RT2560_CSR14, tmp);
 
-	DPRINTF(("enabling TSF synchronization\n"));
+	DPRINTF(sc, "%s", "enabling TSF synchronization\n");
 }
 
 static void
@@ -2283,8 +2294,8 @@
 		RAL_WRITE(sc, RT2560_PLCP11MCSR,  0x000b840b);
 	}
 
-	DPRINTF(("updating PLCP for %s preamble\n",
-	    (ic->ic_flags & IEEE80211_F_SHPREAMBLE) ? "short" : "long"));
+	DPRINTF(sc, "updating PLCP for %s preamble\n",
+	    (ic->ic_flags & IEEE80211_F_SHPREAMBLE) ? "short" : "long");
 }
 
 /*
@@ -2318,7 +2329,7 @@
 	tmp = eifs << 16 | tx_difs;
 	RAL_WRITE(sc, RT2560_CSR19, tmp);
 
-	DPRINTF(("setting slottime to %uus\n", slottime));
+	DPRINTF(sc, "setting slottime to %uus\n", slottime);
 }
 
 static void
@@ -2360,7 +2371,7 @@
 	tmp = bssid[4] | bssid[5] << 8;
 	RAL_WRITE(sc, RT2560_CSR6, tmp);
 
-	DPRINTF(("setting BSSID to %6D\n", bssid, ":"));
+	DPRINTF(sc, "setting BSSID to %6D\n", bssid, ":");
 }
 
 static void
@@ -2374,7 +2385,7 @@
 	tmp = addr[4] | addr[5] << 8;
 	RAL_WRITE(sc, RT2560_CSR4, tmp);
 
-	DPRINTF(("setting MAC address to %6D\n", addr, ":"));
+	DPRINTF(sc, "setting MAC address to %6D\n", addr, ":");
 }
 
 static void
@@ -2407,8 +2418,8 @@
 
 	RAL_WRITE(sc, RT2560_RXCSR0, tmp);
 
-	DPRINTF(("%s promiscuous mode\n", (ifp->if_flags & IFF_PROMISC) ?
-	    "entering" : "leaving"));
+	DPRINTF(sc, "%s promiscuous mode\n", (ifp->if_flags & IFF_PROMISC) ?
+	    "entering" : "leaving");
 }
 
 static const char *
@@ -2459,8 +2470,8 @@
 		sc->rssi_corr = RT2560_DEFAULT_RSSI_CORR;
 	else
 		sc->rssi_corr = val & 0xff;
-	DPRINTF(("rssi correction %d, calibrate 0x%02x\n",
-		 sc->rssi_corr, val));
+	DPRINTF(sc, "rssi correction %d, calibrate 0x%02x\n",
+		 sc->rssi_corr, val);
 }
 
 
@@ -2579,8 +2590,6 @@
 	uint32_t tmp;
 	int i;
 
-
-
 	rt2560_stop(sc);
 
 	RAL_LOCK(sc);

==== //depot/projects/vap/sys/dev/ral/rt2560var.h#6 (text) ====

@@ -120,6 +120,7 @@
 
 	int			sc_tx_timer;
 	int                     sc_invalid;
+	int			sc_debug;
 
 	const struct ieee80211_rate_table *sc_currates;
 /*

==== //depot/projects/vap/sys/dev/ral/rt2661.c#8 (text) ====

@@ -66,14 +66,19 @@
 #include <dev/ral/rt2661var.h>
 #include <dev/ral/rt2661_ucode.h>
 
+#define RAL_DEBUG
 #ifdef RAL_DEBUG
-#define DPRINTF(x)	do { if (ral_debug > 0) printf x; } while (0)
-#define DPRINTFN(n, x)	do { if (ral_debug >= (n)) printf x; } while (0)
-int ral_debug = 0;
-SYSCTL_INT(_debug, OID_AUTO, ral, CTLFLAG_RW, &ral_debug, 0, "ral debug level");
+#define DPRINTF(sc, fmt, ...) do {				\
+	if (sc->sc_debug > 0)					\
+		printf(fmt, __VA_ARGS__);			\
+} while (0)
+#define DPRINTFN(sc, n, fmt, ...) do {				\
+	if (sc->sc_debug >= (n))				\
+		printf(fmt, __VA_ARGS__);			\
+} while (0)
 #else
-#define DPRINTF(x)
-#define DPRINTFN(n, x)
+#define DPRINTF(sc, fmt, ...)
+#define DPRINTFN(sc, n, fmt, ...)
 #endif
 
 static struct ieee80211vap *rt2661_vap_create(struct ieee80211com *,
@@ -345,6 +350,11 @@
 	sc->sc_txtap.wt_ihdr.it_len = htole16(sc->sc_txtap_len);
 	sc->sc_txtap.wt_ihdr.it_present = htole32(RT2661_TX_RADIOTAP_PRESENT);
 
+#ifdef RAL_DEBUG
+	SYSCTL_ADD_INT(device_get_sysctl_ctx(dev),
+	    SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO,
+	    "debug", CTLFLAG_RW, &sc->sc_debug, 0, "debug msgs");
+#endif
 	if (bootverbose)
 		ieee80211_announce(ic);
 
@@ -947,8 +957,8 @@
 		case RT2661_TX_SUCCESS:
 			retrycnt = RT2661_TX_RETRYCNT(val);
 
-			DPRINTFN(10, ("data frame sent successfully after "
-			    "%d retries\n", retrycnt));
+			DPRINTFN(sc, 10, "data frame sent successfully after "
+			    "%d retries\n", retrycnt);
 			if (retrycnt == 0 && data->id.id_node != NULL) {
 				ral_rssadapt_raise_rate(&rn->rssadapt,
 				    &data->id);
@@ -957,8 +967,8 @@
 			break;
 
 		case RT2661_TX_RETRY_FAIL:
-			DPRINTFN(9, ("sending data frame failed (too much "
-			    "retries)\n"));
+			DPRINTFN(sc, 9, "%s\n",
+			    "sending data frame failed (too much retries)");
 			if (data->id.id_node != NULL) {
 				ral_rssadapt_lower_rate(ni,
 				    &rn->rssadapt, &data->id);
@@ -973,7 +983,7 @@
 			ifp->if_oerrors++;
 		}
 
-		DPRINTFN(15, ("tx done q=%d idx=%u\n", qid, txq->stat));
+		DPRINTFN(sc, 15, "tx done q=%d idx=%u\n", qid, txq->stat);
 
 		txq->queued--;
 		if (++txq->stat >= txq->count)	/* faster than % count */
@@ -1014,7 +1024,7 @@
 		/* descriptor is no longer valid */
 		desc->flags &= ~htole32(RT2661_TX_VALID);
 
-		DPRINTFN(15, ("tx dma done q=%p idx=%u\n", txq, txq->next));
+		DPRINTFN(sc, 15, "tx dma done q=%p idx=%u\n", txq, txq->next);
 
 		if (++txq->next >= txq->count)	/* faster than % count */
 			txq->next = 0;
@@ -1055,8 +1065,8 @@
 			 * This should not happen since we did not request
 			 * to receive those frames when we filled TXRX_CSR0.
 			 */
-			DPRINTFN(5, ("PHY or CRC error flags 0x%08x\n",
-			    le32toh(desc->flags)));
+			DPRINTFN(sc, 5, "PHY or CRC error flags 0x%08x\n",
+			    le32toh(desc->flags));
 			ifp->if_ierrors++;
 			goto skip;
 		}
@@ -1164,7 +1174,7 @@
 
 skip:		desc->flags |= htole32(RT2661_RX_BUSY);
 
-		DPRINTFN(15, ("rx intr idx=%u\n", sc->rxq.cur));
+		DPRINTFN(sc, 15, "rx intr idx=%u\n", sc->rxq.cur);
 
 		sc->rxq.cur = (sc->rxq.cur + 1) % RT2661_RX_RING_COUNT;
 	}
@@ -1524,8 +1534,8 @@
 	bus_dmamap_sync(sc->mgtq.desc_dmat, sc->mgtq.desc_map,
 	    BUS_DMASYNC_PREWRITE);
 
-	DPRINTFN(10, ("sending mgt frame len=%u idx=%u rate=%u\n",
-	    m0->m_pkthdr.len, sc->mgtq.cur, rate));
+	DPRINTFN(sc, 10, "sending mgt frame len=%u idx=%u rate=%u\n",
+	    m0->m_pkthdr.len, sc->mgtq.cur, rate);
 
 	/* kick mgt */
 	sc->mgtq.queued++;
@@ -1754,8 +1764,8 @@
 	bus_dmamap_sync(txq->data_dmat, data->map, BUS_DMASYNC_PREWRITE);
 	bus_dmamap_sync(txq->desc_dmat, txq->desc_map, BUS_DMASYNC_PREWRITE);
 
-	DPRINTFN(10, ("sending data frame len=%u idx=%u rate=%u\n",
-	    m0->m_pkthdr.len, txq->cur, rate));
+	DPRINTFN(sc, 10, "sending data frame len=%u idx=%u rate=%u\n",
+	    m0->m_pkthdr.len, txq->cur, rate);
 
 	/* kick Tx */
 	txq->queued++;
@@ -1940,7 +1950,7 @@
 	tmp = RT2661_BBP_BUSY | (reg & 0x7f) << 8 | val;
 	RAL_WRITE(sc, RT2661_PHY_CSR3, tmp);
 
-	DPRINTFN(15, ("BBP R%u <- 0x%02x\n", reg, val));
+	DPRINTFN(sc, 15, "BBP R%u <- 0x%02x\n", reg, val);
 }
 
 static uint8_t
@@ -1996,7 +2006,7 @@
 	/* remember last written value in sc */
 	sc->rf_regs[reg] = val;
 
-	DPRINTFN(15, ("RF R[%u] <- 0x%05x\n", reg & 3, val & 0x1fffff));
+	DPRINTFN(sc, 15, "RF R[%u] <- 0x%05x\n", reg & 3, val & 0x1fffff);
 }
 
 static int
@@ -2096,7 +2106,7 @@
 
 	RAL_WRITE(sc, RT2661_TXRX_CSR5, mask);
 
-	DPRINTF(("Setting basic rate mask to 0x%x\n", mask));
+	DPRINTF(sc, "Setting basic rate mask to 0x%x\n", mask);
 #undef RV
 }
 
@@ -2258,8 +2268,8 @@
 
 	RAL_WRITE(sc, RT2661_TXRX_CSR0, tmp);
 
-	DPRINTF(("%s promiscuous mode\n", (ifp->if_flags & IFF_PROMISC) ?
-	    "entering" : "leaving"));
+	DPRINTF(sc, "%s promiscuous mode\n", (ifp->if_flags & IFF_PROMISC) ?
+	    "entering" : "leaving");
 }
 
 /*
@@ -2363,14 +2373,14 @@
 	sc->tx_ant   = (val >> 2)  & 0x3;
 	sc->nb_ant   = val & 0x3;
 
-	DPRINTF(("RF revision=%d\n", sc->rf_rev));
+	DPRINTF(sc, "RF revision=%d\n", sc->rf_rev);
 
 	val = rt2661_eeprom_read(sc, RT2661_EEPROM_CONFIG2);
 	sc->ext_5ghz_lna = (val >> 6) & 0x1;
 	sc->ext_2ghz_lna = (val >> 4) & 0x1;
 
-	DPRINTF(("External 2GHz LNA=%d\nExternal 5GHz LNA=%d\n",
-	    sc->ext_2ghz_lna, sc->ext_5ghz_lna));
+	DPRINTF(sc, "External 2GHz LNA=%d\nExternal 5GHz LNA=%d\n",
+	    sc->ext_2ghz_lna, sc->ext_5ghz_lna);
 
 	val = rt2661_eeprom_read(sc, RT2661_EEPROM_RSSI_2GHZ_OFFSET);
 	if ((val & 0xff) != 0xff)
@@ -2394,8 +2404,8 @@
 	if (sc->ext_5ghz_lna)
 		sc->rssi_5ghz_corr -= 14;
 
-	DPRINTF(("RSSI 2GHz corr=%d\nRSSI 5GHz corr=%d\n",
-	    sc->rssi_2ghz_corr, sc->rssi_5ghz_corr));
+	DPRINTF(sc, "RSSI 2GHz corr=%d\nRSSI 5GHz corr=%d\n",
+	    sc->rssi_2ghz_corr, sc->rssi_5ghz_corr);
 
 	val = rt2661_eeprom_read(sc, RT2661_EEPROM_FREQ_OFFSET);
 	if ((val >> 8) != 0xff)
@@ -2403,17 +2413,17 @@
 	if ((val & 0xff) != 0xff)
 		sc->rffreq = val & 0xff;
 
-	DPRINTF(("RF prog=%d\nRF freq=%d\n", sc->rfprog, sc->rffreq));
+	DPRINTF(sc, "RF prog=%d\nRF freq=%d\n", sc->rfprog, sc->rffreq);
 
 	/* read Tx power for all a/b/g channels */
 	for (i = 0; i < 19; i++) {
 		val = rt2661_eeprom_read(sc, RT2661_EEPROM_TXPOWER + i);
 		sc->txpow[i * 2] = (int8_t)(val >> 8);		/* signed */
-		DPRINTF(("Channel=%d Tx power=%d\n",
-		    rt2661_rf5225_1[i * 2].chan, sc->txpow[i * 2]));
+		DPRINTF(sc, "Channel=%d Tx power=%d\n",
+		    rt2661_rf5225_1[i * 2].chan, sc->txpow[i * 2]);
 		sc->txpow[i * 2 + 1] = (int8_t)(val & 0xff);	/* signed */
-		DPRINTF(("Channel=%d Tx power=%d\n",
-		    rt2661_rf5225_1[i * 2 + 1].chan, sc->txpow[i * 2 + 1]));
+		DPRINTF(sc, "Channel=%d Tx power=%d\n",
+		    rt2661_rf5225_1[i * 2 + 1].chan, sc->txpow[i * 2 + 1]);
 	}
 
 	/* read vendor-specific BBP values */
@@ -2423,8 +2433,8 @@
 			continue;	/* skip invalid entries */
 		sc->bbp_prom[i].reg = val >> 8;
 		sc->bbp_prom[i].val = val & 0xff;
-		DPRINTF(("BBP R%d=%02x\n", sc->bbp_prom[i].reg,
-		    sc->bbp_prom[i].val));
+		DPRINTF(sc, "BBP R%d=%02x\n", sc->bbp_prom[i].reg,
+		    sc->bbp_prom[i].val);
 	}
 }
 

==== //depot/projects/vap/sys/dev/ral/rt2661var.h#5 (text) ====

@@ -112,6 +112,7 @@
 
 	int				sc_tx_timer;
 	int                             sc_invalid;
+	int				sc_debug;
 /*
  * The same in both up to here
  * ------------------------------------------------



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200801280128.m0S1SNGl082146>