Module Name:    src
Committed By:   tsutsui
Date:           Fri Jun  3 16:28:41 UTC 2011

Modified Files:
        src/sys/arch/hp700/gsc: if_ie_gsc.c
        src/sys/arch/sparc/dev: if_ie_obio.c
        src/sys/arch/sun2/dev: if_ie_mbmem.c if_ie_obio.c
        src/sys/dev/ic: i82586.c i82586var.h
        src/sys/dev/isa: if_ai.c if_ef.c if_ix.c
        src/sys/dev/mca: if_elmc_mca.c
        src/sys/dev/podulebus: if_ei.c
        src/sys/dev/vme: if_ie_vme.c

Log Message:
Split device_t/softc of i82586.  No crash on TME emulating sun2.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/hp700/gsc/if_ie_gsc.c
cvs rdiff -u -r1.38 -r1.39 src/sys/arch/sparc/dev/if_ie_obio.c
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/sun2/dev/if_ie_mbmem.c
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/sun2/dev/if_ie_obio.c
cvs rdiff -u -r1.68 -r1.69 src/sys/dev/ic/i82586.c
cvs rdiff -u -r1.22 -r1.23 src/sys/dev/ic/i82586var.h
cvs rdiff -u -r1.32 -r1.33 src/sys/dev/isa/if_ai.c
cvs rdiff -u -r1.30 -r1.31 src/sys/dev/isa/if_ef.c
cvs rdiff -u -r1.33 -r1.34 src/sys/dev/isa/if_ix.c
cvs rdiff -u -r1.29 -r1.30 src/sys/dev/mca/if_elmc_mca.c
cvs rdiff -u -r1.16 -r1.17 src/sys/dev/podulebus/if_ei.c
cvs rdiff -u -r1.29 -r1.30 src/sys/dev/vme/if_ie_vme.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/hp700/gsc/if_ie_gsc.c
diff -u src/sys/arch/hp700/gsc/if_ie_gsc.c:1.23 src/sys/arch/hp700/gsc/if_ie_gsc.c:1.24
--- src/sys/arch/hp700/gsc/if_ie_gsc.c:1.23	Tue Feb  1 18:33:24 2011
+++ src/sys/arch/hp700/gsc/if_ie_gsc.c	Fri Jun  3 16:28:40 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ie_gsc.c,v 1.23 2011/02/01 18:33:24 skrll Exp $	*/
+/*	$NetBSD: if_ie_gsc.c,v 1.24 2011/06/03 16:28:40 tsutsui Exp $	*/
 
 /*	$OpenBSD: if_ie_gsc.c,v 1.6 2001/01/12 22:57:04 mickey Exp $	*/
 
@@ -38,7 +38,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_ie_gsc.c,v 1.23 2011/02/01 18:33:24 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ie_gsc.c,v 1.24 2011/06/03 16:28:40 tsutsui Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -123,7 +123,7 @@
 int	ie_gsc_probe(device_t, cfdata_t, void *);
 void	ie_gsc_attach(device_t, device_t, void *);
 
-CFATTACH_DECL(ie_gsc, sizeof(struct ie_gsc_softc),
+CFATTACH_DECL_NEW(ie_gsc, sizeof(struct ie_gsc_softc),
     ie_gsc_probe, ie_gsc_attach, NULL, NULL);
 
 static int ie_gsc_media[] = {
@@ -340,7 +340,7 @@
 	/* Make sure that BUSY got cleared. */
 	if (sc->ie_bus_read16(sc, IE_ISCP_BUSY(sc->iscp))) {
 #if I82596_DEBUG
-		printf ("%s: ISCP set failed\n", sc->sc_dev.dv_xname);
+		printf ("%s: ISCP set failed\n", device_xname(sc->sc_dev));
 #endif
 		return 0;
 	}
@@ -360,7 +360,7 @@
 	printf (": test %x:%x\n%s",
 		*((volatile int32_t *)((char *)sc->sc_maddr + 0)),
 		*((volatile int32_t *)((char *)sc->sc_maddr + 4)),
-		sc->sc_dev.dv_xname);
+		device_xname(sc->sc_dev));
 #endif
 	return 1;
 }
@@ -407,6 +407,7 @@
 	}
 
 	/* Set up some initial glue. */
+	sc->sc_dev = self;
 	gsc->iot = ga->ga_iot;
 	gsc->iemt = ga->ga_dmatag;
 	sc->bt = ga->ga_iot;
@@ -471,7 +472,7 @@
 		(u_int)sc->sc_dmamap->dm_segs[0].ds_addr,
 		sc->sc_maddr,
 		sc->sc_msize,
-		sc->sc_dev.dv_xname);
+		device_xname(self));
 	sc->sc_debug = IED_ALL;
 #endif
 

Index: src/sys/arch/sparc/dev/if_ie_obio.c
diff -u src/sys/arch/sparc/dev/if_ie_obio.c:1.38 src/sys/arch/sparc/dev/if_ie_obio.c:1.39
--- src/sys/arch/sparc/dev/if_ie_obio.c:1.38	Tue Feb  1 20:19:31 2011
+++ src/sys/arch/sparc/dev/if_ie_obio.c	Fri Jun  3 16:28:40 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ie_obio.c,v 1.38 2011/02/01 20:19:31 chuck Exp $	*/
+/*	$NetBSD: if_ie_obio.c,v 1.39 2011/06/03 16:28:40 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -73,7 +73,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_ie_obio.c,v 1.38 2011/02/01 20:19:31 chuck Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ie_obio.c,v 1.39 2011/06/03 16:28:40 tsutsui Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -123,7 +123,7 @@
 int ie_obio_match(device_t, cfdata_t, void *);
 void ie_obio_attach(device_t, device_t, void *);
 
-CFATTACH_DECL(ie_obio, sizeof(struct ie_softc),
+CFATTACH_DECL_NEW(ie_obio, sizeof(struct ie_softc),
     ie_obio_match, ie_obio_attach, NULL, NULL);
 
 /* Supported media */
@@ -259,6 +259,7 @@
 	u_long iebase;
 	uint8_t myaddr[ETHER_ADDR_LEN];
 
+	sc->sc_dev = self;
 	sc->bt = oba->oba_bustag;
 
 	sc->hwreset = ie_obreset;

Index: src/sys/arch/sun2/dev/if_ie_mbmem.c
diff -u src/sys/arch/sun2/dev/if_ie_mbmem.c:1.10 src/sys/arch/sun2/dev/if_ie_mbmem.c:1.11
--- src/sys/arch/sun2/dev/if_ie_mbmem.c:1.10	Tue Feb  1 20:19:31 2011
+++ src/sys/arch/sun2/dev/if_ie_mbmem.c	Fri Jun  3 16:28:40 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ie_mbmem.c,v 1.10 2011/02/01 20:19:31 chuck Exp $	*/
+/*	$NetBSD: if_ie_mbmem.c,v 1.11 2011/06/03 16:28:40 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1995 Charles D. Cranor
@@ -140,7 +140,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_ie_mbmem.c,v 1.10 2011/02/01 20:19:31 chuck Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ie_mbmem.c,v 1.11 2011/06/03 16:28:40 tsutsui Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -232,8 +232,8 @@
 static void ie_mbmemrun(struct ie_softc *);
 static int  ie_mbmemintr(struct ie_softc *, int);
 
-int ie_mbmem_match(struct device *, struct cfdata *, void *);
-void ie_mbmem_attach(struct device *, struct device *, void *);
+int ie_mbmem_match(device_t, cfdata_t, void *);
+void ie_mbmem_attach(device_t, device_t, void *);
 
 struct ie_mbmem_softc {
 	struct ie_softc ie;
@@ -241,7 +241,7 @@
 	bus_space_handle_t ievh;
 };
 
-CFATTACH_DECL(ie_mbmem, sizeof(struct ie_mbmem_softc),
+CFATTACH_DECL_NEW(ie_mbmem, sizeof(struct ie_mbmem_softc),
     ie_mbmem_match, ie_mbmem_attach, NULL, NULL);
 
 #define read_iev(sc, reg) \
@@ -294,7 +294,7 @@
          */
 	if (read_iev(vsc, status) & IEMBMEM_PERR) {
 		printf("%s: parity error (ctrl 0x%x @ 0x%02x%04x)\n",
-		       sc->sc_dev.dv_xname, read_iev(vsc, pectrl),
+		       device_xname(sc->sc_dev), read_iev(vsc, pectrl),
 		       read_iev(vsc, pectrl) & IEMBMEM_HADDR,
 		       read_iev(vsc, peaddr));
 		write_iev(vsc, pectrl, read_iev(vsc, pectrl) | IEMBMEM_PARACK);
@@ -367,7 +367,7 @@
 }
 
 int 
-ie_mbmem_match(struct device *parent, struct cfdata *cf, void *aux)
+ie_mbmem_match(device_t parent, cfdata_t cf, void *aux)
 {
 	struct mbmem_attach_args *mbma = aux;
 	bus_space_handle_t bh;
@@ -394,10 +394,10 @@
 }
 
 void 
-ie_mbmem_attach(struct device *parent, struct device *self, void *aux)
+ie_mbmem_attach(device_t parent, device_t self, void *aux)
 {
 	uint8_t myaddr[ETHER_ADDR_LEN];
-	struct ie_mbmem_softc *vsc = (void *) self;
+	struct ie_mbmem_softc *vsc = device_private(self);
 	struct mbmem_attach_args *mbma = aux;
 	struct ie_softc *sc;
 	bus_size_t memsize;
@@ -405,6 +405,7 @@
 	int lcv;
 
 	sc = &vsc->ie;
+	sc->sc_dev = self;
 
 	sc->hwreset = ie_mbmemreset;
 	sc->hwinit = ie_mbmemrun;
@@ -486,7 +487,7 @@
 
 	sc->do_xmitnopchain = 0;
 
-	printf("\n%s:", self->dv_xname);
+	printf("\n%s:", device_xname(self));
 
 	/* Set the ethernet address. */
 	idprom_etheraddr(myaddr);

Index: src/sys/arch/sun2/dev/if_ie_obio.c
diff -u src/sys/arch/sun2/dev/if_ie_obio.c:1.14 src/sys/arch/sun2/dev/if_ie_obio.c:1.15
--- src/sys/arch/sun2/dev/if_ie_obio.c:1.14	Tue Feb  1 20:19:31 2011
+++ src/sys/arch/sun2/dev/if_ie_obio.c	Fri Jun  3 16:28:40 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ie_obio.c,v 1.14 2011/02/01 20:19:31 chuck Exp $	*/
+/*	$NetBSD: if_ie_obio.c,v 1.15 2011/06/03 16:28:40 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -73,7 +73,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_ie_obio.c,v 1.14 2011/02/01 20:19:31 chuck Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ie_obio.c,v 1.15 2011/06/03 16:28:40 tsutsui Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -121,10 +121,10 @@
 static void ie_obattend(struct ie_softc *, int);
 static void ie_obrun(struct ie_softc *);
 
-int ie_obio_match(struct device *, struct cfdata *, void *);
-void ie_obio_attach(struct device *, struct device *, void *);
+int ie_obio_match(device_t, cfdata_t, void *);
+void ie_obio_attach(device_t, device_t, void *);
 
-CFATTACH_DECL(ie_obio, sizeof(struct ie_softc),
+CFATTACH_DECL_NEW(ie_obio, sizeof(struct ie_softc),
     ie_obio_match, ie_obio_attach, NULL, NULL);
 
 /* Supported media */
@@ -220,7 +220,7 @@
 }
 
 int 
-ie_obio_match(struct device *parent, struct cfdata *cf, void *aux)
+ie_obio_match(device_t parent, cfdata_t cf, void *aux)
 {
 	struct obio_attach_args *oba = aux;
 	bus_space_handle_t bh;
@@ -250,10 +250,10 @@
 }
 
 void 
-ie_obio_attach(struct device *parent, struct device *self, void *aux)
+ie_obio_attach(device_t parent, device_t self, void *aux)
 {
 	struct obio_attach_args *oba = aux;
-	struct ie_softc *sc = (void *) self;
+	struct ie_softc *sc = device_private(self);
 	bus_dma_tag_t dmatag = oba->oba_dmatag;
 	bus_space_handle_t bh;
 	bus_dma_segment_t seg;
@@ -265,6 +265,7 @@
 	u_long iebase;
 	uint8_t myaddr[ETHER_ADDR_LEN];
 
+	sc->sc_dev = self;
 	sc->bt = oba->oba_bustag;
 
 	sc->hwreset = ie_obreset;
@@ -291,14 +292,14 @@
 					BUS_DMA_NOWAIT|BUS_DMA_24BIT,
 					&sc->sc_dmamap)) != 0) {
 		printf("%s: DMA map create error %d\n",
-			sc->sc_dev.dv_xname, error);
+			device_xname(self), error);
 		return;
 	}
 	if ((error = bus_dmamem_alloc(dmatag, memsize, 64*1024, 0,
 			     &seg, 1, &rseg,
 			     BUS_DMA_NOWAIT | BUS_DMA_24BIT)) != 0) {
 		printf("%s: DMA memory allocation error %d\n",
-			self->dv_xname, error);
+			device_xname(self), error);
 		return;
 	}
 
@@ -307,7 +308,7 @@
 				    (void **)&sc->sc_maddr,
 				    BUS_DMA_NOWAIT|BUS_DMA_COHERENT)) != 0) {
 		printf("%s: DMA buffer map error %d\n",
-			sc->sc_dev.dv_xname, error);
+			device_xname(self), error);
 		bus_dmamem_free(dmatag, &seg, rseg);
 		return;
 	}
@@ -317,7 +318,7 @@
 				     sc->sc_maddr, memsize, NULL,
 				     BUS_DMA_NOWAIT)) != 0) {
 		printf("%s: DMA buffer map load error %d\n",
-			sc->sc_dev.dv_xname, error);
+			device_xname(self), error);
 		bus_dmamem_unmap(dmatag, sc->sc_maddr, memsize);
 		bus_dmamem_free(dmatag, &seg, rseg);
 		return;

Index: src/sys/dev/ic/i82586.c
diff -u src/sys/dev/ic/i82586.c:1.68 src/sys/dev/ic/i82586.c:1.69
--- src/sys/dev/ic/i82586.c:1.68	Mon Apr  5 07:19:34 2010
+++ src/sys/dev/ic/i82586.c	Fri Jun  3 16:28:40 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: i82586.c,v 1.68 2010/04/05 07:19:34 joerg Exp $	*/
+/*	$NetBSD: i82586.c,v 1.69 2011/06/03 16:28:40 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -137,7 +137,7 @@
 */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: i82586.c,v 1.68 2010/04/05 07:19:34 joerg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i82586.c,v 1.69 2011/06/03 16:28:40 tsutsui Exp $");
 
 
 #include <sys/param.h>
@@ -236,7 +236,7 @@
 	int i;
 	struct ifnet *ifp = &sc->sc_ethercom.ec_if;
 
-	strlcpy(ifp->if_xname, device_xname(&sc->sc_dev), IFNAMSIZ);
+	strlcpy(ifp->if_xname, device_xname(sc->sc_dev), IFNAMSIZ);
 	ifp->if_softc = sc;
 	ifp->if_start = i82586_start;
 	ifp->if_ioctl = i82586_ioctl;
@@ -262,7 +262,7 @@
 		padbuf = malloc(ETHER_MIN_LEN - ETHER_CRC_LEN, M_DEVBUF,
 		    M_ZERO | M_NOWAIT);
 		if (padbuf == NULL) {
-			 aprint_error_dev(&sc->sc_dev, "can't allocate pad buffer\n");
+			 aprint_error_dev(sc->sc_dev, "can't allocate pad buffer\n");
 			 return;
 		}
 	}
@@ -285,7 +285,7 @@
 {
 	struct ie_softc *sc = ifp->if_softc;
 
-	log(LOG_ERR, "%s: device timeout\n", device_xname(&sc->sc_dev));
+	log(LOG_ERR, "%s: device timeout\n", device_xname(sc->sc_dev));
 	++ifp->if_oerrors;
 
 	i82586_reset(sc, 1);
@@ -424,7 +424,7 @@
 	char bits[128];
 	snprintb(bits, sizeof(bits), IE_FD_STATUSBITS, status);
 	log(LOG_ERR, "%s: rx error (frame# %d): %s\n",
-	    device_xname(&sc->sc_dev), fn, bits);
+	    device_xname(sc->sc_dev), fn, bits);
 	    
 }
 
@@ -472,7 +472,7 @@
 
 #if I82586_DEBUG
 	if ((status & IE_ST_CNA) && (sc->sc_debug & IED_CNA))
-		printf("%s: cna; status=0x%x\n", device_xname(&sc->sc_dev), status);
+		printf("%s: cna; status=0x%x\n", device_xname(sc->sc_dev), status);
 #endif
 	if (sc->intrhook)
 		(sc->intrhook)(sc, INTR_LOOP);
@@ -516,7 +516,7 @@
 #if I82586_DEBUG
 	if (sc->sc_debug & IED_RINT)
 		printf("%s: rint: status 0x%x\n",
-			device_xname(&sc->sc_dev), scbstatus);
+			device_xname(sc->sc_dev), scbstatus);
 #endif
 
 	for (;;) {
@@ -530,12 +530,12 @@
 #if I82586_DEBUG
 		if (sc->sc_debug & IED_RINT)
 			printf("%s: rint: frame(%d) status 0x%x\n",
-				device_xname(&sc->sc_dev), i, status);
+				device_xname(sc->sc_dev), i, status);
 #endif
 		if ((status & IE_FD_COMPLETE) == 0) {
 			if ((status & IE_FD_OK) != 0) {
 				printf("%s: rint: weird: ",
-					device_xname(&sc->sc_dev));
+					device_xname(sc->sc_dev));
 				i82586_rx_errors(sc, i, status);
 				break;
 			}
@@ -558,7 +558,7 @@
 #if I82586_DEBUG
 		if ((status & IE_FD_BUSY) != 0)
 			printf("%s: rint: frame(%d) busy; status=0x%x\n",
-				device_xname(&sc->sc_dev), i, status);
+				device_xname(sc->sc_dev), i, status);
 #endif
 
 
@@ -616,7 +616,7 @@
 				scbstatus);
 			if (i82586_start_cmd(sc, IE_RUC_RESUME, 0, 0, 0) == 0)
 				return (0);
-			aprint_error_dev(&sc->sc_dev, "RU RESUME command timed out\n");
+			aprint_error_dev(sc->sc_dev, "RU RESUME command timed out\n");
 			return (1);	/* Ask for a reset */
 		}
 
@@ -645,7 +645,7 @@
 			return (0);
 		} else
 			printf("%s: receiver not ready; scbstatus=0x%x\n",
-				device_xname(&sc->sc_dev), scbstatus);
+				device_xname(sc->sc_dev), scbstatus);
 
 		sc->sc_ethercom.ec_if.if_ierrors++;
 		return (1);	/* Ask for a reset */
@@ -682,7 +682,7 @@
 #if I82586_DEBUG
 	if (sc->sc_debug & IED_TINT)
 		printf("%s: tint: SCB status 0x%x; xmit status 0x%x\n",
-			device_xname(&sc->sc_dev), scbstatus, status);
+			device_xname(sc->sc_dev), scbstatus, status);
 #endif
 
 	if ((status & IE_STAT_COMPL) == 0 || (status & IE_STAT_BUSY)) {
@@ -701,15 +701,15 @@
 		 * What if more than one bit is set?
 		 */
 		if (status & IE_STAT_ABORT)
-			aprint_error_dev(&sc->sc_dev, "send aborted\n");
+			aprint_error_dev(sc->sc_dev, "send aborted\n");
 		else if (status & IE_XS_NOCARRIER)
-			aprint_error_dev(&sc->sc_dev, "no carrier\n");
+			aprint_error_dev(sc->sc_dev, "no carrier\n");
 		else if (status & IE_XS_LOSTCTS)
-			aprint_error_dev(&sc->sc_dev, "lost CTS\n");
+			aprint_error_dev(sc->sc_dev, "lost CTS\n");
 		else if (status & IE_XS_UNDERRUN)
-			aprint_error_dev(&sc->sc_dev, "DMA underrun\n");
+			aprint_error_dev(sc->sc_dev, "DMA underrun\n");
 		else if (status & IE_XS_EXCMAX) {
-			aprint_error_dev(&sc->sc_dev, "too many collisions\n");
+			aprint_error_dev(sc->sc_dev, "too many collisions\n");
 			sc->sc_ethercom.ec_if.if_collisions += 16;
 		}
 	}
@@ -763,7 +763,7 @@
 #endif
 			log(LOG_ERR,
 			    "%s: receive descriptors out of sync at %d\n",
-			    device_xname(&sc->sc_dev), rbindex);
+			    device_xname(sc->sc_dev), rbindex);
 			return (0);
 		}
 		plen += (rbdstatus & IE_RBD_CNTMASK);
@@ -850,7 +850,7 @@
 			/* `rbtail' and EOL flag out of sync */
 			log(LOG_ERR,
 			    "%s: rx buffer descriptors out of sync at %d\n",
-			    device_xname(&sc->sc_dev), n);
+			    device_xname(sc->sc_dev), n);
 			return (1);
 		}
 
@@ -864,7 +864,7 @@
 			/* `rftail' and EOL flag out of sync */
 			log(LOG_ERR,
 			    "%s: rx frame list out of sync at %d\n",
-			    device_xname(&sc->sc_dev), n);
+			    device_xname(sc->sc_dev), n);
 			return (1);
 		}
 	}
@@ -1026,7 +1026,7 @@
 		struct ether_header *eh = mtod(m, struct ether_header *);
 
 		printf("%s: frame from ether %s type 0x%x len %d\n",
-			device_xname(&sc->sc_dev),
+			device_xname(sc->sc_dev),
 			ether_sprintf(eh->ether_shost),
 			(u_int)ntohs(eh->ether_type),
 			pktlen);
@@ -1059,7 +1059,7 @@
 
 #if I82586_DEBUG
 	if (sc->sc_debug & IED_XMIT)
-		printf("%s: xmit buffer %d\n", device_xname(&sc->sc_dev), cur);
+		printf("%s: xmit buffer %d\n", device_xname(sc->sc_dev), cur);
 #endif
 
 	/*
@@ -1112,7 +1112,7 @@
 		IE_BUS_BARRIER(sc, off, 2, BUS_SPACE_BARRIER_READ);
 
 		if (i82586_start_cmd(sc, IE_CUC_START, 0, 0, 1))
-			aprint_error_dev(&sc->sc_dev, "iexmit: start xmit command timed out\n");
+			aprint_error_dev(sc->sc_dev, "iexmit: start xmit command timed out\n");
 	}
 
 	sc->sc_ethercom.ec_if.if_timer = 5;
@@ -1156,12 +1156,12 @@
 
 #if I82586_DEBUG
 		if (sc->sc_debug & IED_ENQ)
-			printf("%s: fill buffer %d\n", device_xname(&sc->sc_dev),
+			printf("%s: fill buffer %d\n", device_xname(sc->sc_dev),
 				sc->xchead);
 #endif
 
 		if (m0->m_pkthdr.len > IE_TBUF_SIZE)
-			printf("%s: tbuf overflow\n", device_xname(&sc->sc_dev));
+			printf("%s: tbuf overflow\n", device_xname(sc->sc_dev));
 
 		buffer = IE_XBUF_ADDR(sc, head);
 		for (m = m0; m != 0; m = m->m_next) {
@@ -1244,7 +1244,7 @@
 	int s = splnet();
 
 	if (hard)
-		printf("%s: reset\n", device_xname(&sc->sc_dev));
+		printf("%s: reset\n", device_xname(sc->sc_dev));
 
 	/* Clear OACTIVE in case we're called from watchdog (frozen xmit). */
 	sc->sc_ethercom.ec_if.if_timer = 0;
@@ -1254,7 +1254,7 @@
 	 * Stop i82586 dead in its tracks.
 	 */
 	if (i82586_start_cmd(sc, IE_RUC_ABORT | IE_CUC_ABORT, 0, 0, 0))
-		aprint_error_dev(&sc->sc_dev, "abort commands timed out\n");
+		aprint_error_dev(sc->sc_dev, "abort commands timed out\n");
 
 	/*
 	 * This can really slow down the i82586_reset() on some cards, but it's
@@ -1314,17 +1314,17 @@
 		return;
 
 	if (result & 0x10000)
-		aprint_error_dev(&sc->sc_dev, "TDR command failed\n");
+		aprint_error_dev(sc->sc_dev, "TDR command failed\n");
 	else if (result & IE_TDR_XCVR)
-		aprint_error_dev(&sc->sc_dev, "transceiver problem\n");
+		aprint_error_dev(sc->sc_dev, "transceiver problem\n");
 	else if (result & IE_TDR_OPEN)
-		aprint_error_dev(&sc->sc_dev, "TDR detected incorrect termination %d clocks away\n",
+		aprint_error_dev(sc->sc_dev, "TDR detected incorrect termination %d clocks away\n",
 			result & IE_TDR_TIME);
 	else if (result & IE_TDR_SHORT)
-		aprint_error_dev(&sc->sc_dev, "TDR detected a short circuit %d clocks away\n",
+		aprint_error_dev(sc->sc_dev, "TDR detected a short circuit %d clocks away\n",
 			result & IE_TDR_TIME);
 	else
-		aprint_error_dev(&sc->sc_dev, "TDR returned unknown status 0x%x\n",
+		aprint_error_dev(sc->sc_dev, "TDR returned unknown status 0x%x\n",
 			result);
 }
 
@@ -1401,7 +1401,7 @@
 	ptr += sc->nrxbuf * IE_RBUF_SIZE;
 
 #if I82586_DEBUG
-	printf("%s: %d frames %d bufs\n", device_xname(&sc->sc_dev), sc->nframes,
+	printf("%s: %d frames %d bufs\n", device_xname(sc->sc_dev), sc->nframes,
 		sc->nrxbuf);
 #endif
 
@@ -1489,7 +1489,7 @@
 /* link in recv frames * and buffer into the scb. */
 #if I82586_DEBUG
 	printf("%s: reserved %d bytes\n",
-		device_xname(&sc->sc_dev), ptr - sc->buf_area);
+		device_xname(sc->sc_dev), ptr - sc->buf_area);
 #endif
 }
 
@@ -1518,11 +1518,11 @@
 	cmdresult = i82586_start_cmd(sc, IE_CUC_START, cmd, IE_STAT_COMPL, 0);
 	status = sc->ie_bus_read16(sc, IE_CMD_COMMON_STATUS(cmd));
 	if (cmdresult != 0) {
-		aprint_error_dev(&sc->sc_dev, "configure command timed out; status %x\n", status);
+		aprint_error_dev(sc->sc_dev, "configure command timed out; status %x\n", status);
 		return (0);
 	}
 	if ((status & IE_STAT_OK) == 0) {
-		aprint_error_dev(&sc->sc_dev, "configure command failed; status %x\n", status);
+		aprint_error_dev(sc->sc_dev, "configure command failed; status %x\n", status);
 		return (0);
 	}
 
@@ -1545,11 +1545,11 @@
 	cmdresult = i82586_start_cmd(sc, IE_CUC_START, cmdbuf, IE_STAT_COMPL, 0);
 	status = sc->ie_bus_read16(sc, IE_CMD_COMMON_STATUS(cmdbuf));
 	if (cmdresult != 0) {
-		aprint_error_dev(&sc->sc_dev, "individual address command timed out; status %x\n", status);
+		aprint_error_dev(sc->sc_dev, "individual address command timed out; status %x\n", status);
 		return (0);
 	}
 	if ((status & IE_STAT_OK) == 0) {
-		aprint_error_dev(&sc->sc_dev, "individual address command failed; status %x\n", status);
+		aprint_error_dev(sc->sc_dev, "individual address command failed; status %x\n", status);
 		return (0);
 	}
 
@@ -1583,11 +1583,11 @@
 	cmdresult = i82586_start_cmd(sc, IE_CUC_START, cmdbuf, IE_STAT_COMPL, 0);
 	status = sc->ie_bus_read16(sc, IE_CMD_COMMON_STATUS(cmdbuf));
 	if (cmdresult != 0) {
-		aprint_error_dev(&sc->sc_dev, "multicast setup command timed out; status %x\n", status);
+		aprint_error_dev(sc->sc_dev, "multicast setup command timed out; status %x\n", status);
 		return (0);
 	}
 	if ((status & IE_STAT_OK) == 0) {
-		aprint_error_dev(&sc->sc_dev, "multicast setup command failed; status %x\n",
+		aprint_error_dev(sc->sc_dev, "multicast setup command failed; status %x\n",
 			status);
 		return (0);
 	}
@@ -1680,7 +1680,7 @@
 	if (sc->do_xmitnopchain) {
 		/* Stop transmit command chain */
 		if (i82586_start_cmd(sc, IE_CUC_SUSPEND|IE_RUC_SUSPEND, 0, 0, 0))
-			aprint_error_dev(&sc->sc_dev, "CU/RU stop command timed out\n");
+			aprint_error_dev(sc->sc_dev, "CU/RU stop command timed out\n");
 
 		/* Start the receiver & transmitter chain */
 		/* sc->scb->ie_command_list =
@@ -1691,10 +1691,10 @@
 					(sc->xctail + NTXBUF - 1) % NTXBUF));
 
 		if (i82586_start_cmd(sc, IE_CUC_START|IE_RUC_START, 0, 0, 0))
-			aprint_error_dev(&sc->sc_dev, "CU/RU command timed out\n");
+			aprint_error_dev(sc->sc_dev, "CU/RU command timed out\n");
 	} else {
 		if (i82586_start_cmd(sc, IE_RUC_START, 0, 0, 0))
-			aprint_error_dev(&sc->sc_dev, "RU command timed out\n");
+			aprint_error_dev(sc->sc_dev, "RU command timed out\n");
 	}
 }
 
@@ -1706,7 +1706,7 @@
 	struct ie_softc *sc = ifp->if_softc;
 
 	if (i82586_start_cmd(sc, IE_RUC_SUSPEND | IE_CUC_SUSPEND, 0, 0, 0))
-		aprint_error_dev(&sc->sc_dev, "iestop: disable commands timed out\n");
+		aprint_error_dev(sc->sc_dev, "iestop: disable commands timed out\n");
 }
 
 int

Index: src/sys/dev/ic/i82586var.h
diff -u src/sys/dev/ic/i82586var.h:1.22 src/sys/dev/ic/i82586var.h:1.23
--- src/sys/dev/ic/i82586var.h:1.22	Mon Apr 28 20:23:50 2008
+++ src/sys/dev/ic/i82586var.h	Fri Jun  3 16:28:40 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: i82586var.h,v 1.22 2008/04/28 20:23:50 martin Exp $	*/
+/*	$NetBSD: i82586var.h,v 1.23 2011/06/03 16:28:40 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -166,7 +166,7 @@
  */
 
 struct ie_softc {
-	struct device sc_dev;   /* device structure */
+	device_t sc_dev;	/* device structure */
 
 	bus_space_tag_t	bt;	/* bus-space tag of card memory */
 	bus_space_handle_t bh;	/* bus-space handle of card memory */

Index: src/sys/dev/isa/if_ai.c
diff -u src/sys/dev/isa/if_ai.c:1.32 src/sys/dev/isa/if_ai.c:1.33
--- src/sys/dev/isa/if_ai.c:1.32	Tue May 12 09:10:15 2009
+++ src/sys/dev/isa/if_ai.c	Fri Jun  3 16:28:40 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ai.c,v 1.32 2009/05/12 09:10:15 cegger Exp $	*/
+/*	$NetBSD: if_ai.c,v 1.33 2011/06/03 16:28:40 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_ai.c,v 1.32 2009/05/12 09:10:15 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ai.c,v 1.33 2011/06/03 16:28:40 tsutsui Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -304,7 +304,7 @@
 void
 ai_attach(device_t parent, device_t self, void *aux)
 {
-	struct ai_softc *asc = (void *)self;
+	struct ai_softc *asc = device_private(self);
 	struct ie_softc *sc = &asc->sc_ie;
 	struct isa_attach_args *ia = aux;
 
@@ -313,10 +313,12 @@
 	u_int8_t ethaddr[ETHER_ADDR_LEN];
 	char name[80];
 
+	sc->sc_dev = self;
+
 	if (bus_space_map(ia->ia_iot, ia->ia_io[0].ir_addr,
 			  ia->ia_io[0].ir_size, 0, &ioh) != 0) {
 		DPRINTF(("\n%s: can't map i/o space 0x%x-0x%x\n",
-			 device_xname(&sc->sc_dev),
+			 device_xname(self),
 		         ia->ia_io[0].ir_addr, ia->ia_io[0].ir_addr +
 		         ia->ia_io[0].ir_size - 1));
 		return;
@@ -325,7 +327,7 @@
 	if (bus_space_map(ia->ia_memt, ia->ia_iomem[0].ir_addr,
 			  ia->ia_iomem[0].ir_size, 0, &memh) != 0) {
 		DPRINTF(("\n%s: can't map iomem space 0x%x-0x%x\n",
-			 device_xname(&sc->sc_dev),
+			 device_xname(self),
 			 ia->ia_iomem[0].ir_addr, ia->ia_iomem[0].ir_addr +
 			 ia->ia_iomem[0].ir_size - 1));
 		bus_space_unmap(ia->ia_iot, ioh, ia->ia_io[0].ir_size);
@@ -386,7 +388,7 @@
 			  BUS_SPACE_BARRIER_WRITE);
 	if (!i82586_proberam(sc)) {
 		DPRINTF(("\n%s: can't talk to i82586!\n",
-			device_xname(&sc->sc_dev)));
+			device_xname(self)));
 		bus_space_unmap(ia->ia_iot, ioh, ia->ia_io[0].ir_size);
 		bus_space_unmap(ia->ia_memt, memh, ia->ia_iomem[0].ir_size);
 		return;
@@ -404,7 +406,7 @@
 	    IST_EDGE, IPL_NET, i82586_intr, sc);
 	if (asc->sc_ih == NULL) {
 		DPRINTF(("\n%s: can't establish interrupt\n",
-			device_xname(&sc->sc_dev)));
+			device_xname(self)));
 	}
 }
 
@@ -475,5 +477,5 @@
 	return (size);
 }
 
-CFATTACH_DECL(ai, sizeof(struct ai_softc),
+CFATTACH_DECL_NEW(ai, sizeof(struct ai_softc),
     ai_match, ai_attach, NULL, NULL);

Index: src/sys/dev/isa/if_ef.c
diff -u src/sys/dev/isa/if_ef.c:1.30 src/sys/dev/isa/if_ef.c:1.31
--- src/sys/dev/isa/if_ef.c:1.30	Tue May 12 09:10:15 2009
+++ src/sys/dev/isa/if_ef.c	Fri Jun  3 16:28:40 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ef.c,v 1.30 2009/05/12 09:10:15 cegger Exp $	*/
+/*	$NetBSD: if_ef.c,v 1.31 2011/06/03 16:28:40 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_ef.c,v 1.30 2009/05/12 09:10:15 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ef.c,v 1.31 2011/06/03 16:28:40 tsutsui Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -472,7 +472,7 @@
 void
 ef_attach(device_t parent, device_t self, void *aux)
 {
-	struct ef_softc *esc = (void *)self;
+	struct ef_softc *esc = device_private(self);
 	struct ie_softc *sc = &esc->sc_ie;
 	struct isa_attach_args *ia = aux;
 	bus_space_tag_t iot = ia->ia_iot;
@@ -484,6 +484,7 @@
 	bus_space_handle_t ioh, memh;
 	u_int8_t ethaddr[ETHER_ADDR_LEN];
 
+	sc->sc_dev = self;
 	sc->hwinit = ef_hwinit;
 	sc->hwreset = ef_reset;
 	sc->chan_attn = ef_atten;
@@ -518,14 +519,14 @@
 	}
 
 	if (bus == NULL)
-		panic("%s: Can't find parent bus!", device_xname(&sc->sc_dev));
+		panic("%s: Can't find parent bus!", device_xname(self));
 
 
 	/* If the bus hasn't been transitioned to the RUN state, do so now */
 	if (bus->bus_state == 1) {
 		if (bus_space_map(iot, ELINK_ID_PORT, 1, 0, &ioh) != 0) {
 			DPRINTF(("\n%s: Can't map Elink ID port!\n",
-				device_xname(&sc->sc_dev)));
+				device_xname(self)));
 			return;
 		}
 
@@ -542,7 +543,7 @@
 			  ia->ia_io[0].ir_size, 0, &ioh) != 0) {
 
 		DPRINTF(("\n%s: can't map i/o space 0x%x-0x%x\n",
-			  device_xname(&sc->sc_dev), ia->ia_io[0].ir_addr,
+			  device_xname(self), ia->ia_io[0].ir_addr,
 			  ia->ia_io[0].ir_addr + ia->ia_io[0].ir_size - 1));
 		return;
 	}
@@ -554,7 +555,7 @@
 			  ia->ia_iomem[0].ir_size, 0, &memh) != 0) {
 
 		DPRINTF(("\n%s: can't map iomem space 0x%x-0x%x\n",
-			device_xname(&sc->sc_dev), ia->ia_maddr,
+			device_xname(self), ia->ia_maddr,
 			ia->ia_maddr + ia->ia_msize - 1));
 		bus_space_unmap(ia->ia_iot, ioh, ia->ia_io[0].ir_size);
 		return;
@@ -592,7 +593,7 @@
 			  BUS_SPACE_BARRIER_WRITE);
 	if (!i82586_proberam(sc)) {
 		DPRINTF(("\n%s: can't talk to i82586!\n",
-			device_xname(&sc->sc_dev)));
+			device_xname(self)));
 		bus_space_unmap(ia->ia_iot, ioh, ia->ia_io[0].ir_size);
 		bus_space_unmap(ia->ia_memt, memh, ia->ia_iomem[0].ir_size);
 		return;
@@ -644,7 +645,7 @@
 	    IST_EDGE, IPL_NET, i82586_intr, sc);
 	if (esc->sc_ih == NULL) {
 		DPRINTF(("\n%s: can't establish interrupt\n",
-			device_xname(&sc->sc_dev)));
+			device_xname(self)));
 	}
 }
 
@@ -669,6 +670,6 @@
 	return 1;
 }
 
-CFATTACH_DECL(ef, sizeof(struct ef_softc),
+CFATTACH_DECL_NEW(ef, sizeof(struct ef_softc),
     ef_match, ef_attach, NULL, NULL);
 

Index: src/sys/dev/isa/if_ix.c
diff -u src/sys/dev/isa/if_ix.c:1.33 src/sys/dev/isa/if_ix.c:1.34
--- src/sys/dev/isa/if_ix.c:1.33	Tue May 12 09:10:15 2009
+++ src/sys/dev/isa/if_ix.c	Fri Jun  3 16:28:40 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ix.c,v 1.33 2009/05/12 09:10:15 cegger Exp $	*/
+/*	$NetBSD: if_ix.c,v 1.34 2011/06/03 16:28:40 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_ix.c,v 1.33 2009/05/12 09:10:15 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ix.c,v 1.34 2011/06/03 16:28:40 tsutsui Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -674,7 +674,7 @@
 void
 ix_attach(device_t parent, device_t self, void *aux)
 {
-	struct ix_softc *isc = (void *)self;
+	struct ix_softc *isc = device_private(self);
 	struct ie_softc *sc = &isc->sc_ie;
 	struct isa_attach_args *ia = aux;
 
@@ -688,6 +688,7 @@
 	u_short irq_encoded;
 	u_int8_t ethaddr[ETHER_ADDR_LEN];
 
+	sc->sc_dev = self;
 	iot = ia->ia_iot;
 
 	/*
@@ -701,7 +702,7 @@
 			  ia->ia_io[0].ir_size, 0, &ioh) != 0) {
 
 		DPRINTF(("\n%s: can't map i/o space 0x%x-0x%x\n",
-			  device_xname(&sc->sc_dev), ia->ia_[0].ir_addr,
+			  device_xname(self), ia->ia_[0].ir_addr,
 			  ia->ia_io[0].ir_addr + ia->ia_io[0].ir_size - 1));
 		return;
 	}
@@ -711,7 +712,7 @@
 	if (bus_space_map(ia->ia_memt, ia->ia_iomem[0].ir_addr,
 			  ia->ia_iomem[0].ir_size, 0, &memh) != 0) {
 		DPRINTF(("\n%s: can't map iomem space 0x%x-0x%x\n",
-			device_xname(&sc->sc_dev), ia->ia_iomem[0].ir_addr,
+			device_xname(self), ia->ia_iomem[0].ir_addr,
 			ia->ia_iomem[0].ir_addr + ia->ia_iomem[0].ir_size - 1));
 		bus_space_unmap(iot, ioh, ia->ia_io[0].ir_size);
 		return;
@@ -849,7 +850,7 @@
 		/* Memory tests failed, punt... */
 		if (memsize == 0)  {
 			DPRINTF(("\n%s: can't determine size of on-card RAM\n",
-				device_xname(&sc->sc_dev)));
+				device_xname(self)));
 			bus_space_unmap(iot, ioh, ia->ia_io[0].ir_size);
 			return;
 		}
@@ -913,7 +914,7 @@
 
 	if (!i82586_proberam(sc)) {
 		DPRINTF(("\n%s: Can't talk to i82586!\n",
-			device_xname(&sc->sc_dev)));
+			device_xname(self)));
 		bus_space_unmap(iot, ioh, ia->ia_io[0].ir_size);
 
 		if (ia->ia_iomem[0].ir_size)
@@ -957,15 +958,15 @@
 		      ix_media, NIX_MEDIA, media);
 
 	if (isc->use_pio)
-		aprint_error_dev(&sc->sc_dev, "unsupported memory config, using PIO to access %d bytes of memory\n", sc->sc_msize);
+		aprint_error_dev(self, "unsupported memory config, using PIO to access %d bytes of memory\n", sc->sc_msize);
 
 	isc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq[0].ir_irq,
 	    IST_EDGE, IPL_NET, i82586_intr, sc);
 	if (isc->sc_ih == NULL) {
 		DPRINTF(("\n%s: can't establish interrupt\n",
-			device_xname(&sc->sc_dev)));
+			device_xname(self)));
 	}
 }
 
-CFATTACH_DECL(ix, sizeof(struct ix_softc),
+CFATTACH_DECL_NEW(ix, sizeof(struct ix_softc),
     ix_match, ix_attach, NULL, NULL);

Index: src/sys/dev/mca/if_elmc_mca.c
diff -u src/sys/dev/mca/if_elmc_mca.c:1.29 src/sys/dev/mca/if_elmc_mca.c:1.30
--- src/sys/dev/mca/if_elmc_mca.c:1.29	Tue May 12 14:31:00 2009
+++ src/sys/dev/mca/if_elmc_mca.c	Fri Jun  3 16:28:40 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_elmc_mca.c,v 1.29 2009/05/12 14:31:00 cegger Exp $	*/
+/*	$NetBSD: if_elmc_mca.c,v 1.30 2011/06/03 16:28:40 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_elmc_mca.c,v 1.29 2009/05/12 14:31:00 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_elmc_mca.c,v 1.30 2011/06/03 16:28:40 tsutsui Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -144,6 +144,7 @@
 		return;
 	}
 
+	sc->sc_dev = self;
 	pbram_addr = ELMC_MADDR_BASE + (((pos2 & 0x18) >> 3) * 0x8000);
 
 	printf(" slot %d irq %d: 3Com EtherLink/MC Ethernet Adapter (3C523)\n",
@@ -151,7 +152,7 @@
 
 	/* map the pio registers */
 	if (bus_space_map(ma->ma_iot, iobase, ELMC_IOADDR_SIZE, 0, &ioh)) {
-		aprint_error_dev(&sc->sc_dev, "unable to map i/o space\n");
+		aprint_error_dev(self, "unable to map i/o space\n");
 		return;
 	}
 
@@ -161,9 +162,9 @@
 	 * about. Just use the first 16K.
 	 */
 	if (bus_space_map(ma->ma_memt, pbram_addr, ELMC_MADDR_SIZE, 0, &memh)) {
-		aprint_error_dev(&sc->sc_dev, "unable to map memory space\n");
+		aprint_error_dev(self, "unable to map memory space\n");
 		if (pbram_addr == 0xc0000) {
-			aprint_error_dev(&sc->sc_dev, "memory space 0xc0000 may conflict with vga\n");
+			aprint_error_dev(self, "memory space 0xc0000 may conflict with vga\n");
 		}
 
 		bus_space_unmap(ma->ma_iot, ioh, ELMC_IOADDR_SIZE);
@@ -234,7 +235,7 @@
 	bus_space_barrier(sc->bt, sc->bh, 0, sc->sc_msize,
 			  BUS_SPACE_BARRIER_WRITE);
 	if (!i82586_proberam(sc)) {
-		aprint_error_dev(&sc->sc_dev, "can't talk to i82586!\n");
+		aprint_error_dev(self, "can't talk to i82586!\n");
 
 		bus_space_unmap(asc->sc_regt, asc->sc_regh, ELMC_IOADDR_SIZE);
 		bus_space_unmap(sc->bt, sc->bh, ELMC_MADDR_SIZE);
@@ -247,7 +248,7 @@
 
 	/* dump known info */
 	printf("%s: rev %d, i/o %#04x-%#04x, mem %#06x-%#06x, %sternal xcvr\n",
-		device_xname(&sc->sc_dev), revision,
+		device_xname(self), revision,
 		iobase, iobase + ELMC_IOADDR_SIZE - 1,
 		pbram_addr, pbram_addr + ELMC_MADDR_SIZE - 1,
 		(pos2 & 0x20) ? "ex" : "in");
@@ -259,14 +260,14 @@
 	for(i=0; i < MIN(6, ETHER_ADDR_LEN); i++)
 		myaddr[i] = bus_space_read_1(asc->sc_regt, asc->sc_regh, i);
 
-	printf("%s:", device_xname(&sc->sc_dev));
-	i82586_attach((void *)sc, "3C523", myaddr, NULL, 0, 0);
+	printf("%s:", device_xname(self));
+	i82586_attach(sc, "3C523", myaddr, NULL, 0, 0);
 
 	/* establish interrupt handler */
 	asc->sc_ih = mca_intr_establish(ma->ma_mc, irq, IPL_NET, i82586_intr,
 			sc);
 	if (asc->sc_ih == NULL) {
-		aprint_error_dev(&sc->sc_dev, "couldn't establish interrupt handler\n");
+		aprint_error_dev(self, "couldn't establish interrupt handler\n");
 		return;
 	}
 }
@@ -405,5 +406,5 @@
 	return (0);
 }
 
-CFATTACH_DECL(elmc_mca, sizeof(struct elmc_mca_softc),
+CFATTACH_DECL_NEW(elmc_mca, sizeof(struct elmc_mca_softc),
     elmc_mca_match, elmc_mca_attach, NULL, NULL);

Index: src/sys/dev/podulebus/if_ei.c
diff -u src/sys/dev/podulebus/if_ei.c:1.16 src/sys/dev/podulebus/if_ei.c:1.17
--- src/sys/dev/podulebus/if_ei.c:1.16	Tue May 12 14:42:58 2009
+++ src/sys/dev/podulebus/if_ei.c	Fri Jun  3 16:28:40 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: if_ei.c,v 1.16 2009/05/12 14:42:58 cegger Exp $ */
+/* $NetBSD: if_ei.c,v 1.17 2011/06/03 16:28:40 tsutsui Exp $ */
 
 /*-
  * Copyright (c) 2000, 2001 Ben Harris
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_ei.c,v 1.16 2009/05/12 14:42:58 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ei.c,v 1.17 2011/06/03 16:28:40 tsutsui Exp $");
 
 #include <sys/param.h>
 
@@ -85,7 +85,7 @@
 	struct		evcnt	sc_intrcnt;
 };
 
-CFATTACH_DECL(ei, sizeof(struct ei_softc),
+CFATTACH_DECL_NEW(ei, sizeof(struct ei_softc),
     ei_match, ei_attach, NULL, NULL);
 
 static inline void
@@ -118,6 +118,8 @@
 	int i;
 	char descr[16];
 
+	sc->sc_ie.sc_dev = self;
+
 	/* Set up bus spaces */
 	sc->sc_ctl_t = sc->sc_mem_t = pa->pa_fast_t;
 	bus_space_map(pa->pa_fast_t, pa->pa_fast_base, EI_MEMOFF, 0,
@@ -252,7 +254,7 @@
 
 #ifdef DIAGNOSTIC
 	if (src % 2 != 0 || !ALIGNED_POINTER(dest, u_int16_t))
-		panic("%s: unaligned copyin", device_xname(&sc_ie->sc_dev));
+		panic("%s: unaligned copyin", device_xname(sc_ie->sc_dev));
 #endif
 	wptr = dest;
 	extra_byte = size % 2;
@@ -292,13 +294,13 @@
 
 #ifdef DIAGNOSTIC
 	if (dest % 2 != 0)
-		panic("%s: unaligned copyout", device_xname(&sc_ie->sc_dev));
+		panic("%s: unaligned copyout", device_xname(sc_ie->sc_dev));
 #endif
 	if (!ALIGNED_POINTER(src, u_int16_t)) {
 		bounce = (u_int16_t *) malloc(size, M_DEVBUF, M_NOWAIT);
 		if (bounce == NULL)
 			panic("%s: no memory to align copyout",
-			      device_xname(&sc_ie->sc_dev));
+			      device_xname(sc_ie->sc_dev));
 		memcpy(bounce, src, size);
 		src = bounce;
 	}
@@ -331,7 +333,7 @@
 
 #ifdef DIAGNOSTIC
 	if (addr % 2 != 0)
-		panic("%s: unaligned read16", device_xname(&sc_ie->sc_dev));
+		panic("%s: unaligned read16", device_xname(sc_ie->sc_dev));
 #endif
 	s = splnet();
 	ei_setpage(sc, ei_atop(addr));
@@ -349,7 +351,7 @@
 
 #ifdef DIAGNOSTIC
 	if (addr % 2 != 0)
-		panic("%s: unaligned write16", device_xname(&sc_ie->sc_dev));
+		panic("%s: unaligned write16", device_xname(sc_ie->sc_dev));
 #endif
 	s = splnet();
 	ei_setpage(sc, ei_atop(addr));
@@ -365,7 +367,7 @@
 
 #ifdef DIAGNOSTIC
 	if (addr % 2 != 0)
-		panic("%s: unaligned write24", device_xname(&sc_ie->sc_dev));
+		panic("%s: unaligned write24", device_xname(sc_ie->sc_dev));
 #endif
 	s = splnet();
 	ei_write16(sc_ie, addr, value & 0xffff);

Index: src/sys/dev/vme/if_ie_vme.c
diff -u src/sys/dev/vme/if_ie_vme.c:1.29 src/sys/dev/vme/if_ie_vme.c:1.30
--- src/sys/dev/vme/if_ie_vme.c:1.29	Tue Feb  1 19:36:24 2011
+++ src/sys/dev/vme/if_ie_vme.c	Fri Jun  3 16:28:41 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ie_vme.c,v 1.29 2011/02/01 19:36:24 chuck Exp $	*/
+/*	$NetBSD: if_ie_vme.c,v 1.30 2011/06/03 16:28:41 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1995 Charles D. Cranor
@@ -140,7 +140,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_ie_vme.c,v 1.29 2011/02/01 19:36:24 chuck Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ie_vme.c,v 1.30 2011/06/03 16:28:41 tsutsui Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -239,7 +239,7 @@
 	bus_space_handle_t ievh;
 };
 
-CFATTACH_DECL(ie_vme, sizeof(struct ie_vme_softc),
+CFATTACH_DECL_NEW(ie_vme, sizeof(struct ie_vme_softc),
     ie_vme_match, ie_vme_attach, NULL, NULL);
 
 #define read_iev(sc, reg) \
@@ -291,7 +291,7 @@
          * check for parity error
          */
 	if (read_iev(vsc, status) & IEVME_PERR) {
-		aprint_error_dev(&sc->sc_dev, "parity error (ctrl 0x%x @ 0x%02x%04x)\n",
+		aprint_error_dev(sc->sc_dev, "parity error (ctrl 0x%x @ 0x%02x%04x)\n",
 		       read_iev(vsc, pectrl),
 		       read_iev(vsc, pectrl) & IEVME_HADDR,
 		       read_iev(vsc, peaddr));
@@ -459,7 +459,7 @@
 ie_vme_attach(device_t parent, device_t self, void *aux)
 {
 	u_int8_t myaddr[ETHER_ADDR_LEN];
-	struct ie_vme_softc *vsc = (void *) self;
+	struct ie_vme_softc *vsc = device_private(self);
 	struct vme_attach_args *va = aux;
 	vme_chipset_tag_t ct = va->va_vct;
 	struct ie_softc *sc;
@@ -484,6 +484,7 @@
 		panic("if_ie: vme alloc");
 
 	sc = &vsc->ie;
+	sc->sc_dev = self;
 
 	sc->hwreset = ie_vmereset;
 	sc->hwinit = ie_vmerun;

Reply via email to