Module Name:    src
Committed By:   matt
Date:           Tue Feb  1 06:13:08 UTC 2011

Modified Files:
        src/sys/arch/mips/sibyte/dev: sbgbusvar.h sbjcn.c sbmac.c sbobio.c
            sbscd.c sbscn.c sbsmbus.c sbtimer.c sbwdog.c

Log Message:
Use aprint_* and misc cleanup.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/mips/sibyte/dev/sbgbusvar.h
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/mips/sibyte/dev/sbjcn.c
cvs rdiff -u -r1.38 -r1.39 src/sys/arch/mips/sibyte/dev/sbmac.c
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/mips/sibyte/dev/sbobio.c
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/mips/sibyte/dev/sbscd.c \
    src/sys/arch/mips/sibyte/dev/sbtimer.c
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/mips/sibyte/dev/sbscn.c
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/mips/sibyte/dev/sbsmbus.c
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/mips/sibyte/dev/sbwdog.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/mips/sibyte/dev/sbgbusvar.h
diff -u src/sys/arch/mips/sibyte/dev/sbgbusvar.h:1.2 src/sys/arch/mips/sibyte/dev/sbgbusvar.h:1.3
--- src/sys/arch/mips/sibyte/dev/sbgbusvar.h:1.2	Fri Feb  7 17:38:49 2003
+++ src/sys/arch/mips/sibyte/dev/sbgbusvar.h	Tue Feb  1 06:13:08 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: sbgbusvar.h,v 1.2 2003/02/07 17:38:49 cgd Exp $ */
+/* $NetBSD: sbgbusvar.h,v 1.3 2011/02/01 06:13:08 matt Exp $ */
 
 /*
  * Copyright 2000, 2001
@@ -38,7 +38,7 @@
 struct sbgbus_attach_args {
 	/* from locators */
 	u_int		sga_chipsel;
-	u_int		sga_offset;
+	u_long		sga_offset;
 	u_int		sga_intr[2];
 
 	/* calculated by sbgbus */

Index: src/sys/arch/mips/sibyte/dev/sbjcn.c
diff -u src/sys/arch/mips/sibyte/dev/sbjcn.c:1.25 src/sys/arch/mips/sibyte/dev/sbjcn.c:1.26
--- src/sys/arch/mips/sibyte/dev/sbjcn.c:1.25	Tue Feb  1 03:16:54 2011
+++ src/sys/arch/mips/sibyte/dev/sbjcn.c	Tue Feb  1 06:13:08 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: sbjcn.c,v 1.25 2011/02/01 03:16:54 matt Exp $ */
+/* $NetBSD: sbjcn.c,v 1.26 2011/02/01 06:13:08 matt Exp $ */
 
 /*
  * Copyright 2000, 2001
@@ -103,7 +103,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sbjcn.c,v 1.25 2011/02/01 03:16:54 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sbjcn.c,v 1.26 2011/02/01 06:13:08 matt Exp $");
 
 #define	SBJCN_DEBUG
 
@@ -237,9 +237,9 @@
 static int
 sbjcn_match(device_t parent, cfdata_t match, void *aux)
 {
-	struct sbscd_attach_args *sap = aux;
+	struct sbscd_attach_args *sa = aux;
 
-	if (sap->sa_locs.sa_type != SBSCD_DEVTYPE_JTAGCONS)
+	if (sa->sa_locs.sa_type != SBSCD_DEVTYPE_JTAGCONS)
 		return (0);
 
 	return 1;
@@ -249,13 +249,13 @@
 sbjcn_attach(device_t parent, device_t self, void *aux)
 {
 	struct sbjcn_softc *sc = device_private(self);
-	struct sbscd_attach_args *sap = aux;
+	struct sbscd_attach_args *sa = aux;
 
 	sc->sc_dev = self;
-	sc->sc_addr = sap->sa_base + sap->sa_locs.sa_offset;
+	sc->sc_addr = sa->sa_base + sa->sa_locs.sa_offset;
 
-	printf("\n");
-	sbjcn_attach_channel(sc, 0, sap->sa_locs.sa_intr[0]);
+	aprint_normal("\n");
+	sbjcn_attach_channel(sc, 0, sa->sa_locs.sa_intr[0]);
 }
 
 void
@@ -312,8 +312,9 @@
 	ch->ch_tty = tp;
 	ch->ch_rbuf = malloc(sbjcn_rbuf_size << 1, M_DEVBUF, M_NOWAIT);
 	if (ch->ch_rbuf == NULL) {
-		printf("%s: channel %d: unable to allocate ring buffer\n",
-		    sc->sc_dev.dv_xname, chan);
+		aprint_error_dev(sc->sc_dev,
+		    "channel %d: unable to allocate ring buffer\n",
+		    chan);
 		return;
 	}
 	ch->ch_ebuf = ch->ch_rbuf + (sbjcn_rbuf_size << 1);
@@ -327,9 +328,10 @@
 		maj = cdevsw_lookup_major(&sbjcn_cdevsw);
 
 		cn_tab->cn_dev = makedev(maj,
-		    (device_unit(&sc->sc_dev) << 1) + chan);
+		    (device_unit(sc->sc_dev) << 1) + chan);
 
-		printf("%s: channel %d: console\n", sc->sc_dev.dv_xname, chan);
+		aprint_normal_dev(sc->sc_dev, "channel %d: %s\n",
+		    chan, "console");
 	}
 
 #ifdef KGDB
@@ -342,7 +344,8 @@
 		sbjcn_kgdb_attached = 1;
 
 		SET(ch->ch_hwflags, SBJCN_HW_KGDB);
-		printf("%s: channel %d: kgdb\n", sc->sc_dev.dv_xname, chan);
+		aprint_normal_dev(sc->sc_dev, "channel %d: %s\n",
+		    chan, "kgdb");
 	}
 #endif
 
@@ -390,16 +393,18 @@
 	struct sbjcn_softc *sc = ch->ch_sc;
 	struct tty *tp = ch->ch_tty;
 
-	printf("%s: chan %d: %s %sclocal  %sdcd %sts_carr_on %sdtr %stx_stopped\n",
-	    sc->sc_dev.dv_xname, ch->ch_num, str,
+	aprint_normal_dev(sc->sc_dev,
+	    "chan %d: %s %sclocal  %sdcd %sts_carr_on %sdtr %stx_stopped\n",
+	    ch->ch_num, str,
 	    ISSET(tp->t_cflag, CLOCAL) ? "+" : "-",
 	    ISSET(ch->ch_iports, ch->ch_i_dcd) ? "+" : "-",
 	    ISSET(tp->t_state, TS_CARR_ON) ? "+" : "-",
 	    ISSET(ch->ch_oports, ch->ch_o_dtr) ? "+" : "-",
 	    ch->ch_tx_stopped ? "+" : "-");
 
-	printf("%s: chan %d: %s %scrtscts %scts %sts_ttstop  %srts %xrx_flags\n",
-	    sc->sc_dev.dv_xname, ch->ch_num, str,
+	aprint_normal_dev(sc->sc_dev,
+	    "chan %d: %s %scrtscts %scts %sts_ttstop  %srts %xrx_flags\n",
+	    ch->ch_num, str,
 	    ISSET(tp->t_cflag, CRTSCTS) ? "+" : "-",
 	    ISSET(ch->ch_iports, ch->ch_i_cts) ? "+" : "-",
 	    ISSET(tp->t_state, TS_TTSTOP) ? "+" : "-",
@@ -1042,8 +1047,8 @@
 
 #ifdef DIAGNOSTIC
 	if (!timo)
-		printf("%s: sbjcn_iflush timeout %02x\n",
-		    ch->ch_sc->sc_dev.dv_xname, reg);
+		aprint_error_dev(ch->ch_sc->sc_dev,
+		    "sbjcn_iflush timeout %02x\n", reg);
 #endif
 }
 
@@ -1196,7 +1201,7 @@
 	splx(s);
 
 	log(LOG_WARNING, "%s: channel %d: %d fifo overflow%s, %d ibuf flood%s\n",
-	    sc->sc_dev.dv_xname, ch->ch_num,
+	    device_xname(sc->sc_dev), ch->ch_num,
 	    overflows, overflows == 1 ? "" : "s",
 	    floods, floods == 1 ? "" : "s");
 }

Index: src/sys/arch/mips/sibyte/dev/sbmac.c
diff -u src/sys/arch/mips/sibyte/dev/sbmac.c:1.38 src/sys/arch/mips/sibyte/dev/sbmac.c:1.39
--- src/sys/arch/mips/sibyte/dev/sbmac.c:1.38	Tue Feb  1 03:16:54 2011
+++ src/sys/arch/mips/sibyte/dev/sbmac.c	Tue Feb  1 06:13:08 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: sbmac.c,v 1.38 2011/02/01 03:16:54 matt Exp $ */
+/* $NetBSD: sbmac.c,v 1.39 2011/02/01 06:13:08 matt Exp $ */
 
 /*
  * Copyright 2000, 2001, 2004
@@ -33,7 +33,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sbmac.c,v 1.38 2011/02/01 03:16:54 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sbmac.c,v 1.39 2011/02/01 06:13:08 matt Exp $");
 
 #include "opt_inet.h"
 #include "opt_ns.h"
@@ -232,35 +232,33 @@
 
 /* Prototypes */
 
-static void sbdma_initctx(sbmacdma_t *d, struct sbmac_softc *s, int chan,
-    int txrx, int maxdescr);
-static void sbdma_channel_start(sbmacdma_t *d);
-static int sbdma_add_rcvbuffer(sbmacdma_t *d, struct mbuf *m);
-static int sbdma_add_txbuffer(sbmacdma_t *d, struct mbuf *m);
-static void sbdma_emptyring(sbmacdma_t *d);
-static void sbdma_fillring(sbmacdma_t *d);
-static void sbdma_rx_process(struct sbmac_softc *sc, sbmacdma_t *d);
-static void sbdma_tx_process(struct sbmac_softc *sc, sbmacdma_t *d);
-static void sbmac_initctx(struct sbmac_softc *s);
-static void sbmac_channel_start(struct sbmac_softc *s);
-static void sbmac_channel_stop(struct sbmac_softc *s);
+static void sbdma_initctx(sbmacdma_t *, struct sbmac_softc *, int, int, int);
+static void sbdma_channel_start(sbmacdma_t *);
+static int sbdma_add_rcvbuffer(sbmacdma_t *, struct mbuf *);
+static int sbdma_add_txbuffer(sbmacdma_t *, struct mbuf *);
+static void sbdma_emptyring(sbmacdma_t *);
+static void sbdma_fillring(sbmacdma_t *);
+static void sbdma_rx_process(struct sbmac_softc *, sbmacdma_t *);
+static void sbdma_tx_process(struct sbmac_softc *, sbmacdma_t *);
+static void sbmac_initctx(struct sbmac_softc *);
+static void sbmac_channel_start(struct sbmac_softc *);
+static void sbmac_channel_stop(struct sbmac_softc *);
 static sbmac_state_t sbmac_set_channel_state(struct sbmac_softc *,
     sbmac_state_t);
-static void sbmac_promiscuous_mode(struct sbmac_softc *sc, int onoff);
-static void sbmac_init_and_start(struct sbmac_softc *sc);
-static uint64_t sbmac_addr2reg(u_char *ptr);
-static void sbmac_intr(void *xsc, uint32_t status, vaddr_t pc);
-static void sbmac_start(struct ifnet *ifp);
-static void sbmac_setmulti(struct sbmac_softc *sc);
-static int sbmac_ether_ioctl(struct ifnet *ifp, u_long cmd, void *data);
+static void sbmac_promiscuous_mode(struct sbmac_softc *, bool);
+static void sbmac_init_and_start(struct sbmac_softc *);
+static uint64_t sbmac_addr2reg(u_char *);
+static void sbmac_intr(void *, uint32_t, vaddr_t);
+static void sbmac_start(struct ifnet *);
+static void sbmac_setmulti(struct sbmac_softc *);
+static int sbmac_ether_ioctl(struct ifnet *, u_long, void *);
 static int sbmac_ioctl(struct ifnet *, u_long, void *);
-static void sbmac_watchdog(struct ifnet *ifp);
-static int sbmac_match(device_t parent, cfdata_t match, void *aux);
-static void sbmac_attach(device_t parent, device_t self, void *aux);
-static int sbmac_set_speed(struct sbmac_softc *s, sbmac_speed_t speed);
-static int sbmac_set_duplex(struct sbmac_softc *s, sbmac_duplex_t duplex,
-    sbmac_fc_t fc);
-static void sbmac_tick(void *arg);
+static void sbmac_watchdog(struct ifnet *);
+static int sbmac_match(device_t, cfdata_t, void *);
+static void sbmac_attach(device_t, device_t, void *);
+static bool sbmac_set_speed(struct sbmac_softc *, sbmac_speed_t);
+static bool sbmac_set_duplex(struct sbmac_softc *, sbmac_duplex_t, sbmac_fc_t);
+static void sbmac_tick(void *);
 
 
 /* Globals */
@@ -372,7 +370,7 @@
  *
  *  Input parameters:
  *	d - sbmacdma_t structure (DMA channel context)
- *	s - sbmac_softc structure (pointer to a MAC)
+ *	sc - sbmac_softc structure (pointer to a MAC)
  *	chan - channel number (0..1 right now)
  *	txrx - Identifies DMA_TX or DMA_RX for channel direction
  *	maxdescr - number of descriptors
@@ -1053,7 +1051,7 @@
  *  interface up/down
  *
  *  Input parameters:
- *	s - sbmac context structure
+ *	sc - sbmac context structure
  *
  *  Return value:
  *	0
@@ -1062,7 +1060,6 @@
 static void
 sbmac_initctx(struct sbmac_softc *sc)
 {
-	const char * const xname = device_xname(sc->sc_dev);
 	uint64_t sysrev;
 
 	/*
@@ -1109,6 +1106,7 @@
 			    (SYS_SOC_TYPE(sysrev) == K_SYS_SOC_TYPE_BCM1250 &&
 			     G_SYS_REVISION(sysrev) >= K_SYS_REVISION_BCM1250_PASS3));
 #ifdef SBMAC_EVENT_COUNTERS
+	const char * const xname = device_xname(sc->sc_dev);
 	evcnt_attach_dynamic(&sc->sbm_ev_rxintr, EVCNT_TYPE_INTR,
 	    NULL, xname, "rxintr");
 	evcnt_attach_dynamic(&sc->sbm_ev_txintr, EVCNT_TYPE_INTR,
@@ -1132,7 +1130,7 @@
  *  Start packet processing on this MAC.
  *
  *  Input parameters:
- *	s - sbmac structure
+ *	sc - sbmac structure
  *
  *  Return value:
  *	nothing
@@ -1327,7 +1325,7 @@
 	 */
 
 	if (sc->sc_ethercom.ec_if.if_flags & IFF_PROMISC)
-		sbmac_promiscuous_mode(sc, 1);
+		sbmac_promiscuous_mode(sc, true);
 
 	/*
 	 * Turn on the once-per-second timer
@@ -1342,7 +1340,7 @@
  *  Stop packet processing on this MAC.
  *
  *  Input parameters:
- *	s - sbmac structure
+ *	sc - sbmac structure
  *
  *  Return value:
  *	nothing
@@ -1425,27 +1423,27 @@
 }
 
 /*
- *  SBMAC_PROMISCUOUS_MODE(sc, onoff)
+ *  SBMAC_PROMISCUOUS_MODE(sc, enabled)
  *
  *  Turn on or off promiscuous mode
  *
  *  Input parameters:
  *	sc - softc
- *	onoff - 1 to turn on, 0 to turn off
+ *	enabled - true to turn on, false to turn off
  *
  *  Return value:
  *	nothing
  */
 
 static void
-sbmac_promiscuous_mode(struct sbmac_softc *sc, int onoff)
+sbmac_promiscuous_mode(struct sbmac_softc *sc, bool enabled)
 {
 	uint64_t reg;
 
 	if (sc->sbm_state != sbmac_state_on)
 		return;
 
-	if (onoff) {
+	if (enabled) {
 		reg = SBMAC_READCSR(sc->sbm_rxfilter);
 		reg |= M_MAC_ALLPKT_EN;
 		SBMAC_WRITECSR(sc->sbm_rxfilter, reg);
@@ -1517,21 +1515,21 @@
 }
 
 /*
- *  SBMAC_SET_SPEED(s, speed)
+ *  SBMAC_SET_SPEED(sc, speed)
  *
  *  Configure LAN speed for the specified MAC.
  *  Warning: must be called when MAC is off!
  *
  *  Input parameters:
- *	s - sbmac structure
+ *	sc - sbmac structure
  *	speed - speed to set MAC to (see sbmac_speed_t enum)
  *
  *  Return value:
- *	1 if successful
- *	0 indicates invalid parameters
+ *	true if successful
+ *	false indicates invalid parameters
  */
 
-static int
+static bool
 sbmac_set_speed(struct sbmac_softc *sc, sbmac_speed_t speed)
 {
 	uint64_t cfg;
@@ -1593,7 +1591,7 @@
 	case sbmac_speed_auto:		/* XXX not implemented */
 		/* fall through */
 	default:
-		return 0;
+		return false;
 	}
 
 	/*
@@ -1603,7 +1601,7 @@
 	SBMAC_WRITECSR(sc->sbm_framecfg, framecfg);
 	SBMAC_WRITECSR(sc->sbm_maccfg, cfg);
 
-	return 1;
+	return true;
 }
 
 /*
@@ -1613,16 +1611,16 @@
  *  Warning: must be called when MAC is off!
  *
  *  Input parameters:
- *	s - sbmac structure
+ *	sc - sbmac structure
  *	duplex - duplex setting (see sbmac_duplex_t)
  *	fc - flow control setting (see sbmac_fc_t)
  *
  *  Return value:
- *	1 if ok
- *	0 if an invalid parameter combination was specified
+ *	true if ok
+ *	false if an invalid parameter combination was specified
  */
 
-static int
+static bool
 sbmac_set_duplex(struct sbmac_softc *sc, sbmac_duplex_t duplex, sbmac_fc_t fc)
 {
 	uint64_t cfg;
@@ -1670,7 +1668,7 @@
 		default:			/* invalid selection */
 			panic("%s: invalid half duplex fc selection %d",
 			    device_xname(sc->sc_dev), fc);
-			return 0;
+			return false;
 		}
 		break;
 
@@ -1691,7 +1689,7 @@
 		default:
 			panic("%s: invalid full duplex fc selection %d",
 			    device_xname(sc->sc_dev), fc);
-			return 0;
+			return false;
 		}
 		break;
 
@@ -1709,7 +1707,7 @@
 
 	SBMAC_WRITECSR(sc->sbm_maccfg, cfg);
 
-	return 1;
+	return true;
 }
 
 /*
@@ -2035,11 +2033,11 @@
 			if ((ifp->if_flags & IFF_RUNNING) &&
 			    (ifp->if_flags & IFF_PROMISC)) {
 				/* turn on promiscuous mode */
-				sbmac_promiscuous_mode(sc, 1);
+				sbmac_promiscuous_mode(sc, true);
 			} else if (ifp->if_flags & IFF_RUNNING &&
 			    !(ifp->if_flags & IFF_PROMISC)) {
 			    /* turn off promiscuous mode */
-			    sbmac_promiscuous_mode(sc, 0);
+			    sbmac_promiscuous_mode(sc, false);
 			} else
 			    sbmac_set_channel_state(sc, sbmac_state_on);
 		} else {
@@ -2153,13 +2151,12 @@
 static int
 sbmac_match(device_t parent, cfdata_t match, void *aux)
 {
-	struct sbobio_attach_args *sap = aux;
+	struct sbobio_attach_args *sa = aux;
 
 	/*
 	 * Make sure it's a MAC
 	 */
-
-	if (sap->sa_locs.sa_type != SBOBIO_DEVTYPE_MAC)
+	if (sa->sa_locs.sa_type != SBOBIO_DEVTYPE_MAC)
 		return 0;
 
 	/*
@@ -2264,10 +2261,9 @@
 static void
 sbmac_attach(device_t parent, device_t self, void *aux)
 {
-	struct ifnet *ifp;
-	struct sbmac_softc *sc = device_private(self);
-	const char * const xname = device_xname(self);
-	struct sbobio_attach_args *sap = aux;
+	struct sbmac_softc * const sc = device_private(self);
+	struct ifnet * const ifp = &sc->sc_ethercom.ec_if;
+	struct sbobio_attach_args * const sa = aux;
 	u_char *eaddr;
 	static int unit = 0;	/* XXX */
 	uint64_t ea_reg;
@@ -2277,7 +2273,7 @@
 
 	/* Determine controller base address */
 
-	sc->sbm_base = sap->sa_locs.sa_addr;
+	sc->sbm_base = sa->sa_locs.sa_addr;
 
 	eaddr = sc->sbm_hwaddr;
 
@@ -2335,9 +2331,8 @@
 	 * Set up ifnet structure
 	 */
 
-	ifp = &sc->sc_ethercom.ec_if;
 	ifp->if_softc = sc;
-	memcpy(ifp->if_xname, xname, IFNAMSIZ);
+	memcpy(ifp->if_xname, device_xname(sc->sc_dev), IFNAMSIZ);
 	ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST |
 	    IFF_NOTRAILERS;
 	ifp->if_ioctl = sbmac_ioctl;
@@ -2374,7 +2369,7 @@
 	 * map/route interrupt
 	 */
 
-	sc->sbm_intrhand = cpu_intr_establish(sap->sa_locs.sa_intr[0], IPL_NET,
+	sc->sbm_intrhand = cpu_intr_establish(sa->sa_locs.sa_intr[0], IPL_NET,
 	    sbmac_intr, sc);
 
 	/*

Index: src/sys/arch/mips/sibyte/dev/sbobio.c
diff -u src/sys/arch/mips/sibyte/dev/sbobio.c:1.19 src/sys/arch/mips/sibyte/dev/sbobio.c:1.20
--- src/sys/arch/mips/sibyte/dev/sbobio.c:1.19	Tue Feb  1 03:16:54 2011
+++ src/sys/arch/mips/sibyte/dev/sbobio.c	Tue Feb  1 06:13:08 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: sbobio.c,v 1.19 2011/02/01 03:16:54 matt Exp $ */
+/* $NetBSD: sbobio.c,v 1.20 2011/02/01 06:13:08 matt Exp $ */
 
 /*
  * Copyright 2000, 2001
@@ -33,7 +33,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sbobio.c,v 1.19 2011/02/01 03:16:54 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sbobio.c,v 1.20 2011/02/01 06:13:08 matt Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
@@ -230,7 +230,7 @@
 		break;
 	}
 
-	printf(": %s peripherals\n", dscr);
+	aprint_normal(": %s peripherals\n", dscr);
 
 	for (i = 0; i < devcount; i++) {
 		memset(&sa, 0, sizeof sa);

Index: src/sys/arch/mips/sibyte/dev/sbscd.c
diff -u src/sys/arch/mips/sibyte/dev/sbscd.c:1.16 src/sys/arch/mips/sibyte/dev/sbscd.c:1.17
--- src/sys/arch/mips/sibyte/dev/sbscd.c:1.16	Tue Feb  1 03:16:54 2011
+++ src/sys/arch/mips/sibyte/dev/sbscd.c	Tue Feb  1 06:13:08 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: sbscd.c,v 1.16 2011/02/01 03:16:54 matt Exp $ */
+/* $NetBSD: sbscd.c,v 1.17 2011/02/01 06:13:08 matt Exp $ */
 
 /*
  * Copyright 2000, 2001
@@ -33,7 +33,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sbscd.c,v 1.16 2011/02/01 03:16:54 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sbscd.c,v 1.17 2011/02/01 06:13:08 matt Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
@@ -105,7 +105,7 @@
 	int i;
 	int locs[SBSCDCF_NLOCS];
 
-	printf("\n");
+	aprint_normal("\n");
 
 	for (i = 0; i < sb1250_sbscd_dev_count; i++) {
 		memset(&sa, 0, sizeof sa);
Index: src/sys/arch/mips/sibyte/dev/sbtimer.c
diff -u src/sys/arch/mips/sibyte/dev/sbtimer.c:1.16 src/sys/arch/mips/sibyte/dev/sbtimer.c:1.17
--- src/sys/arch/mips/sibyte/dev/sbtimer.c:1.16	Tue Feb  1 03:16:54 2011
+++ src/sys/arch/mips/sibyte/dev/sbtimer.c	Tue Feb  1 06:13:08 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: sbtimer.c,v 1.16 2011/02/01 03:16:54 matt Exp $ */
+/* $NetBSD: sbtimer.c,v 1.17 2011/02/01 06:13:08 matt Exp $ */
 
 /*
  * Copyright 2000, 2001
@@ -33,7 +33,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sbtimer.c,v 1.16 2011/02/01 03:16:54 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sbtimer.c,v 1.17 2011/02/01 06:13:08 matt Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
@@ -100,7 +100,7 @@
 	sc->sc_addr_cfg = (uint64_t *)MIPS_PHYS_TO_KSEG1(sa->sa_locs.sa_addr +
 	    R_SCD_TIMER_CFG);
 
-	printf(": ");
+	aprint_normal(": ");
 	if ((sc->sc_flags & SBTIMER_CLOCK) != 0) {
 		ipl = IPL_CLOCK;
 		fun = sbtimer_clockintr;
@@ -111,7 +111,7 @@
 			comment = " (not system timer)";
 			goto not_really;
 		}
-		printf("system timer");
+		aprint_normal("system timer");
 	} else if ((sc->sc_flags & SBTIMER_STATCLOCK) != 0) {
 		ipl = IPL_HIGH;
 		fun = sbtimer_statclockintr;
@@ -123,14 +123,14 @@
 			comment = " (not system statistics timer)";
 			goto not_really;
 		}
-		printf("system statistics timer");
+		aprint_normal("system statistics timer");
 	} else {
 not_really:
 		ipl = IPL_BIO;			/* XXX -- pretty low */
 		fun = sbtimer_miscintr;
-		printf("general-purpose timer%s", comment);
+		aprint_normal("general-purpose timer%s", comment);
 	}
-	printf("\n");
+	aprint_normal("\n");
 
 	/* clear intr & disable timer. */
 	WRITE_REG(sc->sc_addr_cfg, 0x00);		/* XXX */
@@ -143,21 +143,20 @@
 sbtimer_clock_init(void *arg)
 {
 	struct sbtimer_softc *sc = arg;
-	const char * const xname = device_xname(sc->sc_dev);
 
-	printf("%s: ", xname);
-	if ((1000000 % hz) == 0)
-		printf("%dHz system timer\n", hz);
-	else {
-		printf("cannot get %dHz clock; using 1000Hz\n", hz);
+	if ((1000000 % hz) == 0) {
+		aprint_normal_dev(sc->sc_dev, "%dHz system timer\n", hz);
+	} else {
+		aprint_error_dev(sc->sc_dev,
+		    "cannot get %dHz clock; using 1000Hz\n", hz);
 		hz = 1000;
 		tick = 1000000 / hz;
 	}
 
 	WRITE_REG(sc->sc_addr_cfg, 0x00);		/* XXX */
 	if (G_SYS_PLL_DIV(READ_REG(MIPS_PHYS_TO_KSEG1(A_SCD_SYSTEM_CFG))) == 0) {
-		printf("%s: PLL_DIV == 0; speeding up clock ticks for simulator\n",
-		    xname);
+		aprint_debug_dev(sc->sc_dev,
+		    "PLL_DIV == 0; speeding up clock ticks for simulator\n");
 		WRITE_REG(sc->sc_addr_icnt, (tick/100) - 1); /* XXX */
 	} else {
 		WRITE_REG(sc->sc_addr_icnt, tick - 1);	/* XXX */

Index: src/sys/arch/mips/sibyte/dev/sbscn.c
diff -u src/sys/arch/mips/sibyte/dev/sbscn.c:1.32 src/sys/arch/mips/sibyte/dev/sbscn.c:1.33
--- src/sys/arch/mips/sibyte/dev/sbscn.c:1.32	Tue Feb  1 03:16:54 2011
+++ src/sys/arch/mips/sibyte/dev/sbscn.c	Tue Feb  1 06:13:08 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: sbscn.c,v 1.32 2011/02/01 03:16:54 matt Exp $ */
+/* $NetBSD: sbscn.c,v 1.33 2011/02/01 06:13:08 matt Exp $ */
 
 /*
  * Copyright 2000, 2001
@@ -109,7 +109,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sbscn.c,v 1.32 2011/02/01 03:16:54 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sbscn.c,v 1.33 2011/02/01 06:13:08 matt Exp $");
 
 #define	SBSCN_DEBUG
 
@@ -259,9 +259,9 @@
 static int
 sbscn_match(device_t parent, cfdata_t match, void *aux)
 {
-	struct sbobio_attach_args *sap = aux;
+	struct sbobio_attach_args *sa = aux;
 
-	if (sap->sa_locs.sa_type != SBOBIO_DEVTYPE_DUART)
+	if (sa->sa_locs.sa_type != SBOBIO_DEVTYPE_DUART)
 		return (0);
 
 	return 1;
@@ -271,14 +271,15 @@
 sbscn_attach(device_t parent, device_t self, void *aux)
 {
 	struct sbscn_softc *sc = device_private(self);
-	struct sbobio_attach_args *sap = aux;
+	struct sbobio_attach_args *sa = aux;
 	int i;
 
-	sc->sc_addr = sap->sa_locs.sa_addr;
+	sc->sc_dev = self;
+	sc->sc_addr = sa->sa_locs.sa_addr;
 
-	printf("\n");
+	aprint_normal("\n");
 	for (i = 0; i < 2; i++)
-		sbscn_attach_channel(sc, i, sap->sa_locs.sa_intr[i]);
+		sbscn_attach_channel(sc, i, sa->sa_locs.sa_intr[i]);
 
 	/* init duart_opcr */
 	WRITE_REG(MIPS_PHYS_TO_KSEG1(sc->sc_addr + 0x270), 0);
@@ -427,18 +428,19 @@
 {
 	struct sbscn_softc *sc = ch->ch_sc;
 	struct tty *tp = ch->ch_tty;
-	const char * const xname = device_xname(sc->sc_dev);
 
-	printf("%s: chan %d: %s %sclocal  %sdcd %sts_carr_on %sdtr %stx_stopped\n",
-	    xname, ch->ch_num, str,
+	aprint_normal_dev(sc->sc_dev,
+	    "chan %d: %s %sclocal  %sdcd %sts_carr_on %sdtr %stx_stopped\n",
+	    ch->ch_num, str,
 	    ISSET(tp->t_cflag, CLOCAL) ? "+" : "-",
 	    ISSET(ch->ch_iports, ch->ch_i_dcd) ? "+" : "-",
 	    ISSET(tp->t_state, TS_CARR_ON) ? "+" : "-",
 	    ISSET(ch->ch_oports, ch->ch_o_dtr) ? "+" : "-",
 	    ch->ch_tx_stopped ? "+" : "-");
 
-	printf("%s: chan %d: %s %scrtscts %scts %sts_ttstop  %srts %xrx_flags\n",
-	    xname, ch->ch_num, str,
+	aprint_normal_dev(sc->sc_dev,
+	    "chan %d: %s %scrtscts %scts %sts_ttstop  %srts %xrx_flags\n",
+	    ch->ch_num, str,
 	    ISSET(tp->t_cflag, CRTSCTS) ? "+" : "-",
 	    ISSET(ch->ch_iports, ch->ch_i_cts) ? "+" : "-",
 	    ISSET(tp->t_state, TS_TTSTOP) ? "+" : "-",

Index: src/sys/arch/mips/sibyte/dev/sbsmbus.c
diff -u src/sys/arch/mips/sibyte/dev/sbsmbus.c:1.14 src/sys/arch/mips/sibyte/dev/sbsmbus.c:1.15
--- src/sys/arch/mips/sibyte/dev/sbsmbus.c:1.14	Tue Feb  1 03:16:54 2011
+++ src/sys/arch/mips/sibyte/dev/sbsmbus.c	Tue Feb  1 06:13:08 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: sbsmbus.c,v 1.14 2011/02/01 03:16:54 matt Exp $ */
+/* $NetBSD: sbsmbus.c,v 1.15 2011/02/01 06:13:08 matt Exp $ */
 
 /*
  * Copyright 2002 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sbsmbus.c,v 1.14 2011/02/01 03:16:54 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sbsmbus.c,v 1.15 2011/02/01 06:13:08 matt Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
@@ -68,7 +68,6 @@
 	{ X1241_SMBUS_CHAN,	X1241_RTC_SLAVEADDR },
 	{ M41T81_SMBUS_CHAN,	M41T81_SLAVEADDR },
 };
-static const int smbus_dev_count = sizeof smbus_devs / sizeof smbus_devs[0];
 
 static int found = 0;
 
@@ -88,9 +87,9 @@
 	int locs[SMBUSCF_NLOCS];
 
 	found++;
-	printf("\n");
+	aprint_normal("\n");
 
-	for (i = 0; i < smbus_dev_count; i++) {
+	for (i = 0; i < __arraycount(smbus_devs); i++) {
 		if (device_unit(self) != smbus_devs[i].sa_interface)
 			continue;
 

Index: src/sys/arch/mips/sibyte/dev/sbwdog.c
diff -u src/sys/arch/mips/sibyte/dev/sbwdog.c:1.10 src/sys/arch/mips/sibyte/dev/sbwdog.c:1.11
--- src/sys/arch/mips/sibyte/dev/sbwdog.c:1.10	Tue Feb  1 03:16:54 2011
+++ src/sys/arch/mips/sibyte/dev/sbwdog.c	Tue Feb  1 06:13:08 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: sbwdog.c,v 1.10 2011/02/01 03:16:54 matt Exp $ */
+/* $NetBSD: sbwdog.c,v 1.11 2011/02/01 06:13:08 matt Exp $ */
 
 /*
  * Copyright (c) 2002 Wasabi Systems, Inc.
@@ -40,7 +40,9 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sbwdog.c,v 1.10 2011/02/01 03:16:54 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sbwdog.c,v 1.11 2011/02/01 06:13:08 matt Exp $");
+
+#include "locators.h"
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -106,8 +108,7 @@
 	sc->sc_smw.smw_period = sc->sc_wdog_period;
 
 	if (sysmon_wdog_register(&sc->sc_smw) != 0)
-		aprint_error_dev(sc->sc_dev,
-		    "unable to register with sysmon\n");
+		aprint_error_dev(self, "unable to register with sysmon\n");
 }
 
 static int

Reply via email to