Module Name:    src
Committed By:   matt
Date:           Wed Jun  9 14:22:17 UTC 2010

Modified Files:
        src/sys/arch/mips/sibyte/dev [matt-nb5-mips64]: sbgbus.c sbjcn.c
            sbjcnvar.h sbobio.c sbscd.c sbscn.c sbscnvar.h sbsmbus.c sbtimer.c
            sbwdog.c
        src/sys/arch/mips/sibyte/pci [matt-nb5-mips64]: sbbrz.c

Log Message:
Update to the device NWO:
Use CFATTACH_DECL_NEW
struct device * -> device_t
struct cfdata * -> cfdata_t
printf -> aprint_normal_*
Use device_* accessors


To generate a diff of this commit:
cvs rdiff -u -r1.10.96.1 -r1.10.96.2 src/sys/arch/mips/sibyte/dev/sbgbus.c
cvs rdiff -u -r1.21.14.1 -r1.21.14.2 src/sys/arch/mips/sibyte/dev/sbjcn.c
cvs rdiff -u -r1.2 -r1.2.126.1 src/sys/arch/mips/sibyte/dev/sbjcnvar.h
cvs rdiff -u -r1.16.98.1 -r1.16.98.2 src/sys/arch/mips/sibyte/dev/sbobio.c
cvs rdiff -u -r1.14 -r1.14.14.1 src/sys/arch/mips/sibyte/dev/sbscd.c
cvs rdiff -u -r1.27.14.2 -r1.27.14.3 src/sys/arch/mips/sibyte/dev/sbscn.c
cvs rdiff -u -r1.3 -r1.3.88.1 src/sys/arch/mips/sibyte/dev/sbscnvar.h
cvs rdiff -u -r1.13 -r1.13.84.1 src/sys/arch/mips/sibyte/dev/sbsmbus.c
cvs rdiff -u -r1.13.28.2 -r1.13.28.3 src/sys/arch/mips/sibyte/dev/sbtimer.c
cvs rdiff -u -r1.7.94.2 -r1.7.94.3 src/sys/arch/mips/sibyte/dev/sbwdog.c
cvs rdiff -u -r1.1.2.5 -r1.1.2.6 src/sys/arch/mips/sibyte/pci/sbbrz.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/sbgbus.c
diff -u src/sys/arch/mips/sibyte/dev/sbgbus.c:1.10.96.1 src/sys/arch/mips/sibyte/dev/sbgbus.c:1.10.96.2
--- src/sys/arch/mips/sibyte/dev/sbgbus.c:1.10.96.1	Mon Nov 23 18:28:46 2009
+++ src/sys/arch/mips/sibyte/dev/sbgbus.c	Wed Jun  9 14:22:16 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: sbgbus.c,v 1.10.96.1 2009/11/23 18:28:46 matt Exp $ */
+/* $NetBSD: sbgbus.c,v 1.10.96.2 2010/06/09 14:22:16 matt Exp $ */
 
 /*
  * Copyright 2000, 2001
@@ -33,7 +33,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sbgbus.c,v 1.10.96.1 2009/11/23 18:28:46 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sbgbus.c,v 1.10.96.2 2010/06/09 14:22:16 matt Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -47,18 +47,17 @@
 
 extern struct cfdriver sbgbus_cd;
 
-static int	sbgbus_match(struct device *, struct cfdata *, void *);
-static void	sbgbus_attach(struct device *, struct device *, void *);
+static int	sbgbus_match(device_t, cfdata_t, void *);
+static void	sbgbus_attach(device_t, device_t, void *);
 
-CFATTACH_DECL(sbgbus, sizeof(struct device),
+CFATTACH_DECL_NEW(sbgbus, 0,
     sbgbus_match, sbgbus_attach, NULL, NULL);
 
-static int	sbgbussearch(struct device *, struct cfdata *,
-			     const int *, void *);
+static int	sbgbussearch(device_t, cfdata_t, const int *, void *);
 static int	sbgbusprint(void *, const char *);
 
 static int
-sbgbus_match(struct device *parent, struct cfdata *match, void *aux)
+sbgbus_match(device_t parent, cfdata_t match, void *aux)
 {
 	struct sbobio_attach_args *sap = aux;
 
@@ -69,7 +68,7 @@
 }
 
 static void
-sbgbus_attach(struct device *parent, struct device *self, void *aux)
+sbgbus_attach(device_t parent, device_t self, void *aux)
 {
 
 	/* Configure children using indirect configuration. */
@@ -95,7 +94,7 @@
 }
 
 static int
-sbgbussearch(struct device *parent, struct cfdata *cf,
+sbgbussearch(device_t parent, cfdata_t cf,
 	     const int *ldesc, void *aux)
 {
 	struct sbgbus_attach_args sga;

Index: src/sys/arch/mips/sibyte/dev/sbjcn.c
diff -u src/sys/arch/mips/sibyte/dev/sbjcn.c:1.21.14.1 src/sys/arch/mips/sibyte/dev/sbjcn.c:1.21.14.2
--- src/sys/arch/mips/sibyte/dev/sbjcn.c:1.21.14.1	Mon Nov 23 18:28:46 2009
+++ src/sys/arch/mips/sibyte/dev/sbjcn.c	Wed Jun  9 14:22:16 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: sbjcn.c,v 1.21.14.1 2009/11/23 18:28:46 matt Exp $ */
+/* $NetBSD: sbjcn.c,v 1.21.14.2 2010/06/09 14:22:16 matt Exp $ */
 
 /*
  * Copyright 2000, 2001
@@ -103,7 +103,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sbjcn.c,v 1.21.14.1 2009/11/23 18:28:46 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sbjcn.c,v 1.21.14.2 2010/06/09 14:22:16 matt Exp $");
 
 #define	SBJCN_DEBUG
 
@@ -219,10 +219,10 @@
 void	sbjcn_kgdb_putc(void *, int);
 #endif /* KGDB */
 
-static int	sbjcn_match(struct device *, struct cfdata *, void *);
-static void	sbjcn_attach(struct device *, struct device *, void *);
+static int	sbjcn_match(device_t, cfdata_t, void *);
+static void	sbjcn_attach(device_t, device_t, void *);
 
-CFATTACH_DECL(sbjcn, sizeof(struct sbjcn_softc),
+CFATTACH_DECL_NEW(sbjcn, sizeof(struct sbjcn_softc),
     sbjcn_match, sbjcn_attach, NULL, NULL);
 
 #define	READ_REG(rp)		(mips3_ld((volatile uint64_t *)(rp)))
@@ -237,7 +237,7 @@
 
 
 static int
-sbjcn_match(struct device *parent, struct cfdata *match, void *aux)
+sbjcn_match(device_t parent, cfdata_t match, void *aux)
 {
 	struct sbscd_attach_args *sap = aux;
 
@@ -248,14 +248,15 @@
 }
 
 static void
-sbjcn_attach(struct device *parent, struct device *self, void *aux)
+sbjcn_attach(device_t parent, device_t self, void *aux)
 {
-	struct sbjcn_softc *sc = (struct sbjcn_softc *)self;
+	struct sbjcn_softc *sc = device_private(self);
 	struct sbscd_attach_args *sap = aux;
 
+	sc->sc_dev = self;
 	sc->sc_addr = sap->sa_base + sap->sa_locs.sa_offset;
 
-	printf("\n");
+	aprint_normal("\n");
 	sbjcn_attach_channel(sc, 0, sap->sa_locs.sa_intr[0]);
 }
 
@@ -313,8 +314,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);
@@ -328,9 +330,9 @@
 		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: console\n", chan);
 	}
 
 #ifdef KGDB
@@ -343,7 +345,7 @@
 		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: kgdb\n", chan);
 	}
 #endif
 
@@ -391,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) ? "+" : "-",
@@ -1046,8 +1050,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,
+		    "%s: sbjcn_iflush timeout %02x\n", reg);
 #endif
 }
 
@@ -1200,7 +1204,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/sbjcnvar.h
diff -u src/sys/arch/mips/sibyte/dev/sbjcnvar.h:1.2 src/sys/arch/mips/sibyte/dev/sbjcnvar.h:1.2.126.1
--- src/sys/arch/mips/sibyte/dev/sbjcnvar.h:1.2	Fri Feb  7 17:38:49 2003
+++ src/sys/arch/mips/sibyte/dev/sbjcnvar.h	Wed Jun  9 14:22:16 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: sbjcnvar.h,v 1.2 2003/02/07 17:38:49 cgd Exp $ */
+/* $NetBSD: sbjcnvar.h,v 1.2.126.1 2010/06/09 14:22:16 matt Exp $ */
 
 /*
  * Copyright 2000, 2001
@@ -163,7 +163,7 @@
 };
 
 struct sbjcn_softc {
-	struct device	sc_dev;		/* base device */
+	device_t	sc_dev;		/* base device */
 
 	/* shared data structures */
 	u_long		sc_addr;	/* phys addr of JTAG console bus_space */

Index: src/sys/arch/mips/sibyte/dev/sbobio.c
diff -u src/sys/arch/mips/sibyte/dev/sbobio.c:1.16.98.1 src/sys/arch/mips/sibyte/dev/sbobio.c:1.16.98.2
--- src/sys/arch/mips/sibyte/dev/sbobio.c:1.16.98.1	Mon Nov 23 18:28:47 2009
+++ src/sys/arch/mips/sibyte/dev/sbobio.c	Wed Jun  9 14:22:16 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: sbobio.c,v 1.16.98.1 2009/11/23 18:28:47 matt Exp $ */
+/* $NetBSD: sbobio.c,v 1.16.98.2 2010/06/09 14:22:16 matt Exp $ */
 
 /*
  * Copyright 2000, 2001
@@ -33,7 +33,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sbobio.c,v 1.16.98.1 2009/11/23 18:28:47 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sbobio.c,v 1.16.98.2 2010/06/09 14:22:16 matt Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
@@ -47,10 +47,10 @@
 
 #include "locators.h"
 
-static int	sbobio_match(struct device *, struct cfdata *, void *);
-static void	sbobio_attach(struct device *, struct device *, void *);
+static int	sbobio_match(device_t, cfdata_t, void *);
+static void	sbobio_attach(device_t, device_t, void *);
 
-CFATTACH_DECL(sbobio, sizeof(struct device),
+CFATTACH_DECL_NEW(sbobio, 0,
     sbobio_match, sbobio_attach, NULL, NULL);
 
 static int	sbobio_print(void *, const char *);
@@ -104,7 +104,7 @@
     sizeof sb112x_sbobio_devs / sizeof sb112x_sbobio_devs[0];
 
 static int
-sbobio_match(struct device *parent, struct cfdata *match, void *aux)
+sbobio_match(device_t parent, cfdata_t match, void *aux)
 {
 	struct zbbus_attach_args *zap = aux;
 	uint64_t sysrev;
@@ -128,7 +128,7 @@
 }
 
 static void
-sbobio_attach(struct device *parent, struct device *self, void *aux)
+sbobio_attach(device_t parent, device_t self, void *aux)
 {
 	struct sbobio_attach_args sa;
 	const char *dscr;
@@ -163,7 +163,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.14 src/sys/arch/mips/sibyte/dev/sbscd.c:1.14.14.1
--- src/sys/arch/mips/sibyte/dev/sbscd.c:1.14	Mon Jun 16 08:36:51 2008
+++ src/sys/arch/mips/sibyte/dev/sbscd.c	Wed Jun  9 14:22:17 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: sbscd.c,v 1.14 2008/06/16 08:36:51 cegger Exp $ */
+/* $NetBSD: sbscd.c,v 1.14.14.1 2010/06/09 14:22:17 matt Exp $ */
 
 /*
  * Copyright 2000, 2001
@@ -33,7 +33,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sbscd.c,v 1.14 2008/06/16 08:36:51 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sbscd.c,v 1.14.14.1 2010/06/09 14:22:17 matt Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
@@ -44,10 +44,10 @@
 
 #include "locators.h"
 
-static int	sbscd_match(struct device *, struct cfdata *, void *);
-static void	sbscd_attach(struct device *, struct device *, void *);
+static int	sbscd_match(device_t, cfdata_t, void *);
+static void	sbscd_attach(device_t, device_t, void *);
 
-CFATTACH_DECL(sbscd, sizeof(struct device),
+CFATTACH_DECL_NEW(sbscd, 0,
     sbscd_match, sbscd_attach, NULL, NULL);
 
 static int	sbscd_print(void *, const char *);
@@ -69,7 +69,7 @@
 static const int sb1250_sbscd_dev_count = __arraycount(sb1250_sbscd_devs);
 
 static int
-sbscd_match(struct device *parent, struct cfdata *match, void *aux)
+sbscd_match(device_t parent, cfdata_t match, void *aux)
 {
 	struct zbbus_attach_args *zap = aux;
 
@@ -80,13 +80,13 @@
 }
 
 static void
-sbscd_attach(struct device *parent, struct device *self, void *aux)
+sbscd_attach(device_t parent, device_t self, void *aux)
 {
 	struct sbscd_attach_args sa;
 	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/sbscn.c
diff -u src/sys/arch/mips/sibyte/dev/sbscn.c:1.27.14.2 src/sys/arch/mips/sibyte/dev/sbscn.c:1.27.14.3
--- src/sys/arch/mips/sibyte/dev/sbscn.c:1.27.14.2	Mon Nov 23 18:46:50 2009
+++ src/sys/arch/mips/sibyte/dev/sbscn.c	Wed Jun  9 14:22:17 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: sbscn.c,v 1.27.14.2 2009/11/23 18:46:50 matt Exp $ */
+/* $NetBSD: sbscn.c,v 1.27.14.3 2010/06/09 14:22:17 matt Exp $ */
 
 /*
  * Copyright 2000, 2001
@@ -109,7 +109,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sbscn.c,v 1.27.14.2 2009/11/23 18:46:50 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sbscn.c,v 1.27.14.3 2010/06/09 14:22:17 matt Exp $");
 
 #define	SBSCN_DEBUG
 
@@ -229,10 +229,10 @@
 void	sbscn_kgdb_putc(void *, int);
 #endif /* KGDB */
 
-static int	sbscn_match(struct device *, struct cfdata *, void *);
-static void	sbscn_attach(struct device *, struct device *, void *);
+static int	sbscn_match(device_t, cfdata_t, void *);
+static void	sbscn_attach(device_t, device_t, void *);
 
-CFATTACH_DECL(sbscn, sizeof(struct sbscn_softc),
+CFATTACH_DECL_NEW(sbscn, sizeof(struct sbscn_softc),
     sbscn_match, sbscn_attach, NULL, NULL);
 
 #define	READ_REG(rp)		(mips3_ld((volatile uint64_t *)(rp)))
@@ -259,7 +259,7 @@
     } while (0)
 
 static int
-sbscn_match(struct device *parent, struct cfdata *match, void *aux)
+sbscn_match(device_t parent, cfdata_t match, void *aux)
 {
 	struct sbobio_attach_args *sap = aux;
 
@@ -270,15 +270,16 @@
 }
 
 static void
-sbscn_attach(struct device *parent, struct device *self, void *aux)
+sbscn_attach(device_t parent, device_t self, void *aux)
 {
-	struct sbscn_softc *sc = (struct sbscn_softc *)self;
+	struct sbscn_softc *sc = device_private(self);
 	struct sbobio_attach_args *sap = aux;
 	int i;
 
+	sc->sc_dev = self;
 	sc->sc_addr = sap->sa_base + sap->sa_locs.sa_offset;
 
-	printf("\n");
+	aprint_normal("\n");
 	for (i = 0; i < 2; i++)
 		sbscn_attach_channel(sc, i, sap->sa_locs.sa_intr[i]);
 
@@ -344,8 +345,9 @@
 	ch->ch_tty = tp;
 	ch->ch_rbuf = malloc(sbscn_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 + (sbscn_rbuf_size << 1);
@@ -359,9 +361,9 @@
 		maj = cdevsw_lookup_major(&sbscn_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: console\n", chan);
 	}
 
 #ifdef KGDB
@@ -374,14 +376,14 @@
 		sbscn_kgdb_attached = 1;
 
 		SET(sc->sc_hwflags, SBSCN_HW_KGDB);
-		printf("%s: channel %d: kgdb\n", sc->sc_dev.dv_xname, chan);
+		aprint_normal_dev(sc->sc_dev, "channel %d: kgdb\n", chan);
 	}
 #endif
 
 	ch->ch_si = softint_establish(SOFTINT_SERIAL, sbscn_soft, ch);
 
 #if NRND > 0 && defined(RND_SBSCN)
-	rnd_attach_source(&ch->ch_rnd_source, sc->sc_dev.dv_xname,
+	rnd_attach_source(&ch->ch_rnd_source, device_xname(sc->sc_dev),
 			  RND_TYPE_TTY, 0);
 #endif
 
@@ -427,16 +429,18 @@
 	struct sbscn_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) ? "+" : "-",
@@ -1139,8 +1143,9 @@
 		    READ_REG(ch->ch_base + 0x60);
 #ifdef DIAGNOSTIC
 	if (!timo)
-		printf("%s: sbscn_iflush timeout %02x\n",
-		    ch->ch_sc->sc_dev.dv_xname, reg & 0xff);
+		aprint_error_dev(ch->ch_sc->sc_dev,
+		    "sbscn_iflush timeout %02x\n",
+		    reg & 0xff);
 #endif
 }
 
@@ -1305,7 +1310,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/sbscnvar.h
diff -u src/sys/arch/mips/sibyte/dev/sbscnvar.h:1.3 src/sys/arch/mips/sibyte/dev/sbscnvar.h:1.3.88.1
--- src/sys/arch/mips/sibyte/dev/sbscnvar.h:1.3	Tue Mar  7 14:01:41 2006
+++ src/sys/arch/mips/sibyte/dev/sbscnvar.h	Wed Jun  9 14:22:17 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: sbscnvar.h,v 1.3 2006/03/07 14:01:41 he Exp $ */
+/* $NetBSD: sbscnvar.h,v 1.3.88.1 2010/06/09 14:22:17 matt Exp $ */
 
 /*
  * Copyright 2000, 2001
@@ -162,7 +162,7 @@
 };
 
 struct sbscn_softc {
-	struct device	sc_dev;		/* base device */
+	device_t	sc_dev;		/* base device */
 
 	/* shared data structures */
 	u_long	sc_addr;	/* phys addr of DUART XXX bus_space */

Index: src/sys/arch/mips/sibyte/dev/sbsmbus.c
diff -u src/sys/arch/mips/sibyte/dev/sbsmbus.c:1.13 src/sys/arch/mips/sibyte/dev/sbsmbus.c:1.13.84.1
--- src/sys/arch/mips/sibyte/dev/sbsmbus.c:1.13	Tue Mar 28 17:38:25 2006
+++ src/sys/arch/mips/sibyte/dev/sbsmbus.c	Wed Jun  9 14:22:17 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: sbsmbus.c,v 1.13 2006/03/28 17:38:25 thorpej Exp $ */
+/* $NetBSD: sbsmbus.c,v 1.13.84.1 2010/06/09 14:22:17 matt Exp $ */
 
 /*
  * Copyright 2002 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sbsmbus.c,v 1.13 2006/03/28 17:38:25 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sbsmbus.c,v 1.13.84.1 2010/06/09 14:22:17 matt Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
@@ -50,11 +50,11 @@
 
 #include "locators.h"
 
-static int smbus_match(struct device *, struct cfdata *, void *);
-static void smbus_attach(struct device *, struct device *, void *);
+static int smbus_match(device_t, cfdata_t, void *);
+static void smbus_attach(device_t, device_t, void *);
 static int smbus_print(void *, const char *);
 
-CFATTACH_DECL(smbus, sizeof(struct device),
+CFATTACH_DECL_NEW(smbus, 0,
     smbus_match, smbus_attach, NULL, NULL);
 
 /* autoconfiguration match information for zbbus children */
@@ -73,7 +73,7 @@
 static int found = 0;
 
 static int
-smbus_match(struct device *parent, struct cfdata *match, void *aux)
+smbus_match(device_t parent, cfdata_t match, void *aux)
 {
 
 	/* 2 SMBus's on the BCM112x and BCM1250 */
@@ -81,14 +81,14 @@
 }
 
 static void
-smbus_attach(struct device *parent, struct device *self, void *aux)
+smbus_attach(device_t parent, device_t self, void *aux)
 {
 	struct smbus_attach_args sa;
 	int i;
 	int locs[SMBUSCF_NLOCS];
 
 	found++;
-	printf("\n");
+	aprint_normal("\n");
 
 	for (i = 0; i < smbus_dev_count; i++) {
 		if (device_unit(self) != smbus_devs[i].sa_interface)

Index: src/sys/arch/mips/sibyte/dev/sbtimer.c
diff -u src/sys/arch/mips/sibyte/dev/sbtimer.c:1.13.28.2 src/sys/arch/mips/sibyte/dev/sbtimer.c:1.13.28.3
--- src/sys/arch/mips/sibyte/dev/sbtimer.c:1.13.28.2	Mon Nov 23 18:46:50 2009
+++ src/sys/arch/mips/sibyte/dev/sbtimer.c	Wed Jun  9 14:22:17 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: sbtimer.c,v 1.13.28.2 2009/11/23 18:46:50 matt Exp $ */
+/* $NetBSD: sbtimer.c,v 1.13.28.3 2010/06/09 14:22:17 matt Exp $ */
 
 /*
  * Copyright 2000, 2001
@@ -33,7 +33,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sbtimer.c,v 1.13.28.2 2009/11/23 18:46:50 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sbtimer.c,v 1.13.28.3 2010/06/09 14:22:17 matt Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
@@ -47,7 +47,7 @@
 #include <mips/sibyte/dev/sbscdvar.h>
 
 struct sbtimer_softc {
-	struct device sc_dev;
+	device_t sc_dev;
 	void	*sc_intrhand;
 	int	sc_flags;
 	void	*sc_addr_icnt, *sc_addr_cnt, *sc_addr_cfg;
@@ -58,10 +58,10 @@
 #define	READ_REG(rp)		(mips3_ld((volatile uint64_t *)(rp)))
 #define	WRITE_REG(rp, val)	(mips3_sd((volatile uint64_t *)(rp), (val)))
 
-static int	sbtimer_match(struct device *, struct cfdata *, void *);
-static void	sbtimer_attach(struct device *, struct device *, void *);
+static int	sbtimer_match(device_t, cfdata_t, void *);
+static void	sbtimer_attach(device_t, device_t, void *);
 
-CFATTACH_DECL(sbtimer, sizeof(struct sbtimer_softc),
+CFATTACH_DECL_NEW(sbtimer, sizeof(struct sbtimer_softc),
     sbtimer_match, sbtimer_attach, NULL, NULL);
 
 static void	sbtimer_clockintr(void *arg, uint32_t status, vaddr_t pc);
@@ -71,7 +71,7 @@
 static void	sbtimer_clock_init(void *arg);
 
 static int
-sbtimer_match(struct device *parent, struct cfdata *match, void *aux)
+sbtimer_match(device_t parent, cfdata_t match, void *aux)
 {
 	struct sbscd_attach_args *sap = aux;
 
@@ -82,15 +82,16 @@
 }
 
 static void
-sbtimer_attach(struct device *parent, struct device *self, void *aux)
+sbtimer_attach(device_t parent, device_t self, void *aux)
 {
 	struct sbscd_attach_args *sa = aux;
-	struct sbtimer_softc *sc = (struct sbtimer_softc *)self;
+	struct sbtimer_softc *sc = device_private(self);
 	void (*fun)(void *, uint32_t, vaddr_t);
 	int ipl;
 	const char *comment = "";
 
-	sc->sc_flags = device_cfdata(&sc->sc_dev)->cf_flags;
+	sc->sc_dev = self;
+	sc->sc_flags = device_cfdata(sc->sc_dev)->cf_flags;
 	sc->sc_addr_icnt = (uint64_t *)MIPS_PHYS_TO_KSEG1(sa->sa_base +
 	    sa->sa_locs.sa_offset + R_SCD_TIMER_INIT);
 	sc->sc_addr_cnt = (uint64_t *)MIPS_PHYS_TO_KSEG1(sa->sa_base +
@@ -98,7 +99,7 @@
 	sc->sc_addr_cfg = (uint64_t *)MIPS_PHYS_TO_KSEG1(sa->sa_base +
 	    sa->sa_locs.sa_offset + R_SCD_TIMER_CFG);
 
-	printf(": ");
+	aprint_normal(": ");
 	if ((sc->sc_flags & SBTIMER_CLOCK) != 0) {
 		ipl = IPL_CLOCK;
 		fun = sbtimer_clockintr;
@@ -109,7 +110,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;
@@ -121,14 +122,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 */
@@ -142,19 +143,19 @@
 {
 	struct sbtimer_softc *sc = arg;
 
-	printf("%s: ", sc->sc_dev.dv_xname);
 	if ((1000000 % hz) == 0)
-		printf("%dHz system timer\n", hz);
+		aprint_normal_dev(sc->sc_dev, "%dHz system timer\n", hz);
 	else {
-		printf("cannot get %dHz clock; using 1000Hz\n", hz);
+		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",
-		    sc->sc_dev.dv_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/sbwdog.c
diff -u src/sys/arch/mips/sibyte/dev/sbwdog.c:1.7.94.2 src/sys/arch/mips/sibyte/dev/sbwdog.c:1.7.94.3
--- src/sys/arch/mips/sibyte/dev/sbwdog.c:1.7.94.2	Sat May 15 06:22:38 2010
+++ src/sys/arch/mips/sibyte/dev/sbwdog.c	Wed Jun  9 14:22:17 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: sbwdog.c,v 1.7.94.2 2010/05/15 06:22:38 matt Exp $ */
+/* $NetBSD: sbwdog.c,v 1.7.94.3 2010/06/09 14:22:17 matt Exp $ */
 
 /*
  * Copyright (c) 2002 Wasabi Systems, Inc.
@@ -40,7 +40,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sbwdog.c,v 1.7.94.2 2010/05/15 06:22:38 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sbwdog.c,v 1.7.94.3 2010/06/09 14:22:17 matt Exp $");
 
 #include "locators.h"
 #include <sys/param.h>
@@ -66,8 +66,8 @@
 	int sc_wdog_period;
 };
 
-static int sbwdog_match(struct device *, struct cfdata *, void *);
-static void sbwdog_attach(struct device *, struct device *, void *);
+static int sbwdog_match(device_t, cfdata_t, void *);
+static void sbwdog_attach(device_t, device_t, void *);
 static int sbwdog_tickle(struct sysmon_wdog *);
 static int sbwdog_setmode(struct sysmon_wdog *);
 static void sbwdog_intr(void *, uint32_t, vaddr_t);
@@ -79,7 +79,7 @@
 #define	WRITE_REG(rp, val)	(mips3_sd((volatile uint64_t *)(rp), (val)))
 
 static int
-sbwdog_match(struct device *parent, struct cfdata *cf, void *aux)
+sbwdog_match(device_t parent, cfdata_t cf, void *aux)
 {
 	struct sbscd_attach_args *sa = aux;
 
@@ -90,7 +90,7 @@
 }
 
 static void
-sbwdog_attach(struct device *parent, struct device *self, void *aux)
+sbwdog_attach(device_t parent, device_t self, void *aux)
 {
 	struct sbwdog_softc *sc = device_private(self);
 	struct sbscd_attach_args *sa = aux;

Index: src/sys/arch/mips/sibyte/pci/sbbrz.c
diff -u src/sys/arch/mips/sibyte/pci/sbbrz.c:1.1.2.5 src/sys/arch/mips/sibyte/pci/sbbrz.c:1.1.2.6
--- src/sys/arch/mips/sibyte/pci/sbbrz.c:1.1.2.5	Tue Feb 23 20:33:48 2010
+++ src/sys/arch/mips/sibyte/pci/sbbrz.c	Wed Jun  9 14:22:17 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: sbbrz.c,v 1.1.2.5 2010/02/23 20:33:48 matt Exp $ */
+/* $NetBSD: sbbrz.c,v 1.1.2.6 2010/06/09 14:22:17 matt Exp $ */
 
 /*
  * Copyright 2000, 2001
@@ -212,10 +212,10 @@
 	/* only PCIs can attach to sbbrz; easy. */
 	if (pnp)
 #if _has_pba_busname
-		printf("%s at %s\n", pba->pba_busname, pnp);
+		aprint_normal("%s at %s\n", pba->pba_busname, pnp);
 #else
-		printf("\n* sbbrz_pci at %s", pnp);
+		aprint_normal("\n* sbbrz_pci at %s", pnp);
 #endif
-	printf(" bus %d", pba->pba_bus);
+	aprint_normal(" bus %d", pba->pba_bus);
 	return (UNCONF);
 }       

Reply via email to