Module Name:    src
Committed By:   mrg
Date:           Mon Jul 18 00:58:52 UTC 2011

Modified Files:
        src/sys/dev/ic: cd18xxvar.h midway.c midwayvar.h
        src/sys/dev/pci: if_en_pci.c
        src/sys/dev/sbus: if_en.c qe.c sio16.c spif.c spifvar.h stp4020.c
            xbox.c

Log Message:
convert the remaining dev/sbus drivers to CFATTACH_DECL_NEW, cfdata_t
and device_t, including the pci frontend and backend for en(4).


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/ic/cd18xxvar.h
cvs rdiff -u -r1.92 -r1.93 src/sys/dev/ic/midway.c
cvs rdiff -u -r1.17 -r1.18 src/sys/dev/ic/midwayvar.h
cvs rdiff -u -r1.34 -r1.35 src/sys/dev/pci/if_en_pci.c
cvs rdiff -u -r1.28 -r1.29 src/sys/dev/sbus/if_en.c
cvs rdiff -u -r1.58 -r1.59 src/sys/dev/sbus/qe.c
cvs rdiff -u -r1.23 -r1.24 src/sys/dev/sbus/sio16.c
cvs rdiff -u -r1.27 -r1.28 src/sys/dev/sbus/spif.c
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/sbus/spifvar.h
cvs rdiff -u -r1.64 -r1.65 src/sys/dev/sbus/stp4020.c
cvs rdiff -u -r1.20 -r1.21 src/sys/dev/sbus/xbox.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/dev/ic/cd18xxvar.h
diff -u src/sys/dev/ic/cd18xxvar.h:1.2 src/sys/dev/ic/cd18xxvar.h:1.3
--- src/sys/dev/ic/cd18xxvar.h:1.2	Thu May 29 14:51:27 2008
+++ src/sys/dev/ic/cd18xxvar.h	Mon Jul 18 00:58:51 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: cd18xxvar.h,v 1.2 2008/05/29 14:51:27 mrg Exp $	*/
+/*	$NetBSD: cd18xxvar.h,v 1.3 2011/07/18 00:58:51 mrg Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001 Matthew R. Green
@@ -97,8 +97,6 @@
 
 /* softc allocated per-cd18xx */
 struct cd18xx_softc {
-	struct device		sc_dev;
-
 	/* tag and handle for our registers (128 bytes) */
 	bus_space_tag_t		sc_tag;
 	bus_space_handle_t	sc_handle;

Index: src/sys/dev/ic/midway.c
diff -u src/sys/dev/ic/midway.c:1.92 src/sys/dev/ic/midway.c:1.93
--- src/sys/dev/ic/midway.c:1.92	Tue Feb  1 19:50:03 2011
+++ src/sys/dev/ic/midway.c	Mon Jul 18 00:58:51 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: midway.c,v 1.92 2011/02/01 19:50:03 chuck Exp $	*/
+/*	$NetBSD: midway.c,v 1.93 2011/07/18 00:58:51 mrg Exp $	*/
 /*	(sync'd to midway.c 1.68)	*/
 
 /*
@@ -61,7 +61,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: midway.c,v 1.92 2011/02/01 19:50:03 chuck Exp $");
+__KERNEL_RCSID(0, "$NetBSD: midway.c,v 1.93 2011/07/18 00:58:51 mrg Exp $");
 
 #include "opt_natm.h"
 
@@ -728,7 +728,7 @@
 
   reg = EN_READ(sc, MID_RESID);
 
-  aprint_normal_dev(&sc->sc_dev, 
+  aprint_normal_dev(sc->sc_dev, 
       "ATM midway v%d, board IDs %d.%d, %s%s%s, %ldKB on-board RAM\n",
 	MID_VER(reg), MID_MID(reg), MID_DID(reg),
 	(MID_IS_SABRE(reg)) ? "sabre controller, " : "",
@@ -738,19 +738,19 @@
 
   if (sc->is_adaptec) {
     if (sc->bestburstlen == 64 && sc->alburst == 0)
-      aprint_normal_dev(&sc->sc_dev, "passed 64 byte DMA test\n");
+      aprint_normal_dev(sc->sc_dev, "passed 64 byte DMA test\n");
     else
-      aprint_error_dev(&sc->sc_dev, "FAILED DMA TEST: burst=%d, alburst=%d\n",
+      aprint_error_dev(sc->sc_dev, "FAILED DMA TEST: burst=%d, alburst=%d\n",
 	    sc->bestburstlen, sc->alburst);
   } else {
-    aprint_normal_dev(&sc->sc_dev, "maximum DMA burst length = %d bytes%s\n",
+    aprint_normal_dev(sc->sc_dev, "maximum DMA burst length = %d bytes%s\n",
 	  sc->bestburstlen, (sc->alburst) ? " (must align)" : "");
   }
 
 #if 0		/* WMAYBE doesn't work, don't complain about it */
   /* check if en_dmaprobe disabled wmaybe */
   if (en_dmaplan == en_dma_planB)
-    aprint_normal_dev(&sc->sc_dev, "note: WMAYBE DMA has been disabled\n");
+    aprint_normal_dev(sc->sc_dev, "note: WMAYBE DMA has been disabled\n");
 #endif
 
   /*
@@ -758,7 +758,7 @@
    */
 
 #if defined(__NetBSD__) || defined(__OpenBSD__)
-  strlcpy(sc->enif.if_xname, device_xname(&sc->sc_dev), IFNAMSIZ);
+  strlcpy(sc->enif.if_xname, device_xname(sc->sc_dev), IFNAMSIZ);
 #endif
 #if !defined(MISSING_IF_SOFTC)
   sc->enif.if_softc = sc;
@@ -784,7 +784,7 @@
   ptr = roundup(ptr, EN_TXSZ * 1024);	/* align */
   sz = sz - (ptr - sav);
   if (EN_TXSZ*1024 * EN_NTX > sz) {
-    aprint_error_dev(&sc->sc_dev, "EN_NTX/EN_TXSZ too big\n");
+    aprint_error_dev(sc->sc_dev, "EN_NTX/EN_TXSZ too big\n");
     return;
   }
   for (lcv = 0 ; lcv < EN_NTX ; lcv++) {
@@ -800,7 +800,7 @@
     memset(&sc->txslot[lcv].indma, 0, sizeof(sc->txslot[lcv].indma));
     memset(&sc->txslot[lcv].q, 0, sizeof(sc->txslot[lcv].q));
 #ifdef EN_DEBUG
-    aprint_debug_dev(&sc->sc_dev, "tx%d: start 0x%x, stop 0x%x\n", lcv,
+    aprint_debug_dev(sc->sc_dev, "tx%d: start 0x%x, stop 0x%x\n", lcv,
 		sc->txslot[lcv].start, sc->txslot[lcv].stop);
 #endif
   }
@@ -810,7 +810,7 @@
   sz = sz - (ptr - sav);
   sc->en_nrx = sz / (EN_RXSZ * 1024);
   if (sc->en_nrx <= 0) {
-    aprint_error_dev(&sc->sc_dev, "EN_NTX/EN_TXSZ/EN_RXSZ too big\n");
+    aprint_error_dev(sc->sc_dev, "EN_NTX/EN_TXSZ/EN_RXSZ too big\n");
     return;
   }
 
@@ -838,7 +838,7 @@
 	(en_k2sz(EN_RXSZ) << MIDV_SZSHIFT) | MIDV_TRASH;
 
 #ifdef EN_DEBUG
-    aprint_debug_dev(&sc->sc_dev, "rx%d: start 0x%x, stop 0x%x, mode 0x%x\n",
+    aprint_debug_dev(sc->sc_dev, "rx%d: start 0x%x, stop 0x%x, mode 0x%x\n",
 	lcv, sc->rxslot[lcv].start, sc->rxslot[lcv].stop, sc->rxslot[lcv].mode);
 #endif
   }
@@ -852,11 +852,11 @@
 #endif
   sc->need_drqs = sc->need_dtqs = 0;
 
-  aprint_normal_dev(&sc->sc_dev,
+  aprint_normal_dev(sc->sc_dev,
 	"%d %dKB receive buffers, %d %dKB transmit buffers allocated\n",
 	sc->en_nrx, EN_RXSZ, EN_NTX, EN_TXSZ);
 
-  aprint_normal_dev(&sc->sc_dev, "End Station Identifier (mac address) %s\n",
+  aprint_normal_dev(sc->sc_dev, "End Station Identifier (mac address) %s\n",
         ether_sprintf(sc->macaddr));
 
   /*
@@ -945,7 +945,7 @@
   }
   if (EN_NOWMAYBE || fail) {
     if (fail)
-      aprint_error_dev(&sc->sc_dev, "WARNING: WMAYBE DMA test failed %d time(s)\n",
+      aprint_error_dev(sc->sc_dev, "WARNING: WMAYBE DMA test failed %d time(s)\n",
 	fail);
     en_dmaplan = en_dma_planB;		/* fall back to plan B */
   }
@@ -1025,14 +1025,14 @@
       DELAY(1);
       cnt--;
       if (cnt == 0) {
-	aprint_error_dev(&sc->sc_dev, "unexpected timeout in tx DMA test\n");
+	aprint_error_dev(sc->sc_dev, "unexpected timeout in tx DMA test\n");
 	return(retval);		/* timeout, give up */
       }
     }
     EN_WRAPADD(MID_DTQOFF, MID_DTQEND, sc->dtq_chip, 8);
     reg = EN_READ(sc, MID_INTACK);
     if ((reg & MID_INT_DMA_TX) != MID_INT_DMA_TX) {
-      aprint_error_dev(&sc->sc_dev, "unexpected status in tx DMA test: 0x%x\n",
+      aprint_error_dev(sc->sc_dev, "unexpected status in tx DMA test: 0x%x\n",
 		reg);
       return(retval);
     }
@@ -1051,14 +1051,14 @@
       DELAY(1);
       cnt--;
       if (cnt == 0) {
-	aprint_error_dev(&sc->sc_dev, "unexpected timeout in rx DMA test\n");
+	aprint_error_dev(sc->sc_dev, "unexpected timeout in rx DMA test\n");
 	return(retval);		/* timeout, give up */
       }
     }
     EN_WRAPADD(MID_DRQOFF, MID_DRQEND, sc->drq_chip, 8);
     reg = EN_READ(sc, MID_INTACK);
     if ((reg & MID_INT_DMA_RX) != MID_INT_DMA_RX) {
-      aprint_error_dev(&sc->sc_dev, "unexpected status in rx DMA test: 0x%x\n",
+      aprint_error_dev(sc->sc_dev, "unexpected status in rx DMA test: 0x%x\n",
 		reg);
       return(retval);
     }
@@ -1133,7 +1133,7 @@
 		}
 #ifdef EN_DEBUG
 		printf("%s: rxvci%d: turn %s raw (boodi) mode\n",
-			device_xname(&sc->sc_dev), ario->npcb->npcb_vci,
+			device_xname(sc->sc_dev), ario->npcb->npcb_vci,
 			(ario->rawvalue) ? "on" : "off");
 #endif
 		break;
@@ -1297,7 +1297,7 @@
   flags = ATM_PH_FLAGS(&pi->aph);
 
 #ifdef EN_DEBUG
-  printf("%s: %s vpi=%d, vci=%d, flags=%d\n", device_xname(&sc->sc_dev),
+  printf("%s: %s vpi=%d, vci=%d, flags=%d\n", device_xname(sc->sc_dev),
 	(on) ? "enable" : "disable", ATM_PH_VPI(&pi->aph), vci, flags);
 #endif
 
@@ -1368,7 +1368,7 @@
   }
   splx(s);		/* enable enintr() */
 #ifdef EN_DEBUG
-  printf("%s: rx%d: VCI %d is now %s\n", device_xname(&sc->sc_dev), slot, vci,
+  printf("%s: rx%d: VCI %d is now %s\n", device_xname(sc->sc_dev), slot, vci,
 	(sc->rxslot[slot].oth_flags & ENOTHER_DRAIN) ? "draining" : "free");
 #endif
   return(0);
@@ -1387,7 +1387,7 @@
   int lcv, slot;
 
 #ifdef EN_DEBUG
-  printf("%s: reset\n", device_xname(&sc->sc_dev));
+  printf("%s: reset\n", device_xname(sc->sc_dev));
 #endif
 
   if (sc->en_busreset)
@@ -1420,7 +1420,7 @@
       sc->rxslot[slot].oth_flags = ENOTHER_FREE;
       sc->rxvc2slot[lcv] = RX_NONE;
 #ifdef EN_DEBUG
-  printf("%s: rx%d: VCI %d is now free\n", device_xname(&sc->sc_dev), slot, lcv);
+  printf("%s: rx%d: VCI %d is now free\n", device_xname(sc->sc_dev), slot, lcv);
 #endif
     }
   }
@@ -1475,7 +1475,7 @@
     }
 #endif
 #ifdef EN_DEBUG
-    printf("%s: going down\n", device_xname(&sc->sc_dev));
+    printf("%s: going down\n", device_xname(sc->sc_dev));
 #endif
     en_reset(sc);			/* to be safe */
     sc->enif.if_flags &= ~IFF_RUNNING;	/* disable */
@@ -1486,7 +1486,7 @@
  up:
 #endif
 #ifdef EN_DEBUG
-  printf("%s: going up\n", device_xname(&sc->sc_dev));
+  printf("%s: going up\n", device_xname(sc->sc_dev));
 #endif
   sc->enif.if_flags |= IFF_RUNNING;	/* enable */
 #ifdef ATM_PVCEXT
@@ -1535,7 +1535,7 @@
 
 #ifdef EN_DEBUG
   printf("%s: drq free/chip: %d/0x%x, dtq free/chip: %d/0x%x, hwslist: 0x%x\n",
-    device_xname(&sc->sc_dev), sc->drq_free, sc->drq_chip,
+    device_xname(sc->sc_dev), sc->drq_free, sc->drq_chip,
     sc->dtq_free, sc->dtq_chip, sc->hwslistp);
 #endif
 
@@ -1549,7 +1549,7 @@
     loc = loc >> MIDV_LOCTOPSHFT;	/* top 11 bits */
     EN_WRITE(sc, MIDX_PLACE(slot), MIDX_MKPLACE(en_k2sz(EN_TXSZ), loc));
 #ifdef EN_DEBUG
-    printf("%s: tx%d: place 0x%x\n", device_xname(&sc->sc_dev),  slot,
+    printf("%s: tx%d: place 0x%x\n", device_xname(sc->sc_dev),  slot,
 	EN_READ(sc, MIDX_PLACE(slot)));
 #endif
   }
@@ -1590,7 +1590,7 @@
   sc->rxslot[slot].cur = sc->rxslot[slot].start;
 
 #ifdef EN_DEBUG
-    printf("%s: rx%d: assigned to VCI %d\n", device_xname(&sc->sc_dev), slot, vc);
+    printf("%s: rx%d: assigned to VCI %d\n", device_xname(sc->sc_dev), slot, vc);
 #endif
 }
 
@@ -1679,7 +1679,7 @@
 
       if (atm_vpi || atm_vci >= MID_N_VC) {
 	printf("%s: output vpi=%d, vci=%d out of card range, dropping...\n",
-		device_xname(&sc->sc_dev), atm_vpi, atm_vci);
+		device_xname(sc->sc_dev), atm_vpi, atm_vci);
 	m_freem(m);
 	continue;
       }
@@ -1705,7 +1705,7 @@
 
 #ifdef EN_DEBUG
       printf("%s: txvci%d: mlen=%d, got=%d, need=%d, toadd=%d, cell#=%d\n",
-	device_xname(&sc->sc_dev), atm_vci, mlen, got, need, toadd, cellcnt);
+	device_xname(sc->sc_dev), atm_vci, mlen, got, need, toadd, cellcnt);
       printf("     leading_space=%d, trailing_space=%d\n",
 	M_LEADINGSPACE(m), M_TRAILINGSPACE(lastm));
 #endif
@@ -1761,7 +1761,7 @@
 	EN_COUNT(sc->txmbovr);
 	m_freem(m);
 #ifdef EN_DEBUG
-	printf("%s: tx%d: buffer space shortage\n", device_xname(&sc->sc_dev),
+	printf("%s: tx%d: buffer space shortage\n", device_xname(sc->sc_dev),
 		txchan);
 #endif
 	continue;
@@ -1771,7 +1771,7 @@
 
 #ifdef EN_DEBUG
       printf("%s: tx%d: VPI=%d, VCI=%d, FLAGS=0x%x, speed=0x%x\n",
-	device_xname(&sc->sc_dev), txchan, atm_vpi, atm_vci, atm_flags,
+	device_xname(sc->sc_dev), txchan, atm_vpi, atm_vci, atm_flags,
 	sc->txspeed[atm_vci]);
       printf("     adjusted mlen=%d, mbsize=%d\n", mlen,
 		sc->txslot[txchan].mbsize);
@@ -1802,7 +1802,7 @@
 
   EN_COUNT(sc->mfix);			/* count # of calls */
 #ifdef EN_DEBUG
-  printf("%s: mfix mbuf m_data=%p, m_len=%d\n", device_xname(&sc->sc_dev),
+  printf("%s: mfix mbuf m_data=%p, m_len=%d\n", device_xname(sc->sc_dev),
 	m->m_data, m->m_len);
 #endif
 
@@ -1876,7 +1876,7 @@
     if (m->m_flags & M_EXT) {
 	if (m->m_ext.ext_free) {
 	    /* external buffer isn't an ordinary mbuf cluster! */
-	    aprint_error_dev(&sc->sc_dev, "mfix: special buffer! can't make a copy!\n");
+	    aprint_error_dev(sc->sc_dev, "mfix: special buffer! can't make a copy!\n");
 	    return (0);
 	}
 
@@ -1933,7 +1933,7 @@
 
   EN_COUNT(sc->mfix);			/* count # of calls */
 #ifdef EN_DEBUG
-  printf("%s: mfix mbuf m_data=0x%x, m_len=%d\n", device_xname(&sc->sc_dev),
+  printf("%s: mfix mbuf m_data=0x%x, m_len=%d\n", device_xname(sc->sc_dev),
 	m->m_data, m->m_len);
 #endif
 
@@ -2007,7 +2007,7 @@
   memset(&launch, 0, sizeof launch);	/* XXX gcc */
 
 #ifdef EN_DEBUG
-  printf("%s: tx%d: starting...\n", device_xname(&sc->sc_dev), chan);
+  printf("%s: tx%d: starting...\n", device_xname(sc->sc_dev), chan);
 #endif
 
   /*
@@ -2028,7 +2028,7 @@
 
   if (launch.t == NULL) {
 #ifdef EN_DEBUG
-    printf("%s: tx%d: ...done!\n", device_xname(&sc->sc_dev), chan);
+    printf("%s: tx%d: ...done!\n", device_xname(sc->sc_dev), chan);
 #endif
     return;	/* >>> exit here if no data waiting for DMA <<< */
   }
@@ -2101,7 +2101,7 @@
 
   if (launch.need > EN_TXSZ * 1024) {
     printf("%s: tx%d: packet larger than xmit buffer (%d > %d)\n",
-      device_xname(&sc->sc_dev), chan, launch.need, EN_TXSZ * 1024);
+      device_xname(sc->sc_dev), chan, launch.need, EN_TXSZ * 1024);
     goto dequeue_drop;
   }
 
@@ -2115,7 +2115,7 @@
   if (launch.need >= sc->txslot[chan].bfree) {
     EN_COUNT(sc->txoutspace);
 #ifdef EN_DEBUG
-    printf("%s: tx%d: out of transmit space\n", device_xname(&sc->sc_dev), chan);
+    printf("%s: tx%d: out of transmit space\n", device_xname(sc->sc_dev), chan);
 #endif
     return;		/* >>> exit here if out of obmem buffer space <<< */
   }
@@ -2131,7 +2131,7 @@
     sc->need_dtqs = 1;
     EN_COUNT(sc->txdtqout);
 #ifdef EN_DEBUG
-    printf("%s: tx%d: out of transmit DTQs\n", device_xname(&sc->sc_dev), chan);
+    printf("%s: tx%d: out of transmit DTQs\n", device_xname(sc->sc_dev), chan);
 #endif
     return;		/* >>> exit here if out of dtqs <<< */
   }
@@ -2255,12 +2255,12 @@
 
 #ifdef EN_DIAG
   if ((need - MID_TBD_SIZE) % MID_ATMDATASZ)
-    printf("%s: tx%d: bogus transmit needs (%d)\n", device_xname(&sc->sc_dev), chan,
+    printf("%s: tx%d: bogus transmit needs (%d)\n", device_xname(sc->sc_dev), chan,
 		need);
 #endif
 #ifdef EN_DEBUG
   printf("%s: tx%d: launch mbuf %p!   cur=0x%x[%d], need=%d, addtail=%d\n",
-	device_xname(&sc->sc_dev), chan, l->t, cur, (cur-start)/4, need, addtail);
+	device_xname(sc->sc_dev), chan, l->t, cur, (cur-start)/4, need, addtail);
   count = EN_READ(sc, MIDX_PLACE(chan));
   printf("     HW: base_address=0x%x, size=%d, read=%d, descstart=%d\n",
 	MIDX_BASE(count), MIDX_SZ(count), EN_READ(sc, MIDX_READPTR(chan)),
@@ -2274,7 +2274,7 @@
 
   if ((l->atm_flags & EN_OBHDR) == 0) {
 #ifdef EN_DEBUG
-    printf("%s: tx%d: insert header 0x%x 0x%x\n", device_xname(&sc->sc_dev),
+    printf("%s: tx%d: insert header 0x%x 0x%x\n", device_xname(sc->sc_dev),
 	chan, l->tbd1, l->tbd2);
 #endif
     EN_WRITE(sc, cur, l->tbd1);
@@ -2321,7 +2321,7 @@
       need -= len;
 #ifdef EN_DEBUG
       printf("%s: tx%d: copied %d bytes (%d left, cur now 0x%x)\n",
-		device_xname(&sc->sc_dev), chan, len, need, cur);
+		device_xname(sc->sc_dev), chan, len, need, cur);
 #endif
       continue;		/* continue on to next mbuf */
     }
@@ -2331,7 +2331,7 @@
       EN_DTQADD(sc, WORD_IDX(start,cur), chan, MIDDMA_JK, 0, 0, 0);
 #ifdef EN_DEBUG
       printf("%s: tx%d: dtq_sync: advance pointer to %d\n",
-		device_xname(&sc->sc_dev), chan, cur);
+		device_xname(sc->sc_dev), chan, cur);
 #endif
     }
 
@@ -2359,7 +2359,7 @@
       EN_WRAPADD(start, stop, cur, len);
 #ifdef EN_DEBUG
       printf("%s: tx%d: adp_dma %d bytes (%d left, cur now 0x%x)\n",
-              device_xname(&sc->sc_dev), chan, len, need, cur);
+              device_xname(sc->sc_dev), chan, len, need, cur);
 #endif
       end = (need == 0) ? MID_DMA_END : 0;
       EN_DTQADD(sc, len, chan, 0, vtophys((vaddr_t)data), l->mlen, end);
@@ -2393,7 +2393,7 @@
       EN_WRAPADD(start, stop, cur, cnt);
 #ifdef EN_DEBUG
       printf("%s: tx%d: small al_dma %d bytes (%d left, cur now 0x%x)\n",
-              device_xname(&sc->sc_dev), chan, cnt, need, cur);
+              device_xname(sc->sc_dev), chan, cnt, need, cur);
 #endif
       len -= cnt;
       end = (need == 0) ? MID_DMA_END : 0;
@@ -2422,7 +2422,7 @@
       EN_WRAPADD(start, stop, cur, cnt);
 #ifdef EN_DEBUG
       printf("%s: tx%d: al_dma %d bytes (%d left, cur now 0x%x)\n",
-		device_xname(&sc->sc_dev), chan, cnt, need, cur);
+		device_xname(sc->sc_dev), chan, cnt, need, cur);
 #endif
       len -= cnt;
       end = (need == 0) ? MID_DMA_END : 0;
@@ -2441,7 +2441,7 @@
       EN_WRAPADD(start, stop, cur, cnt);
 #ifdef EN_DEBUG
       printf("%s: tx%d: best_dma %d bytes (%d left, cur now 0x%x)\n",
-		device_xname(&sc->sc_dev), chan, cnt, need, cur);
+		device_xname(sc->sc_dev), chan, cnt, need, cur);
 #endif
       len -= cnt;
       end = (need == 0) ? MID_DMA_END : 0;
@@ -2461,7 +2461,7 @@
       EN_WRAPADD(start, stop, cur, cnt);
 #ifdef EN_DEBUG
       printf("%s: tx%d: cleanup_dma %d bytes (%d left, cur now 0x%x)\n",
-		device_xname(&sc->sc_dev), chan, cnt, need, cur);
+		device_xname(sc->sc_dev), chan, cnt, need, cur);
 #endif
       len -= cnt;
       end = (need == 0) ? MID_DMA_END : 0;
@@ -2485,7 +2485,7 @@
       EN_WRAPADD(start, stop, cur, len);
 #ifdef EN_DEBUG
       printf("%s: tx%d: byte cleanup_dma %d bytes (%d left, cur now 0x%x)\n",
-		device_xname(&sc->sc_dev), chan, len, need, cur);
+		device_xname(sc->sc_dev), chan, len, need, cur);
 #endif
       end = (need == 0) ? MID_DMA_END : 0;
       EN_DTQADD(sc, count, chan, bcode, vtophys((vaddr_t)data), l->mlen, end);
@@ -2527,7 +2527,7 @@
       need -= pad;
 #ifdef EN_DEBUG
       printf("%s: tx%d: pad/FLUSH DMA %d bytes (%d left, cur now 0x%x)\n",
-		device_xname(&sc->sc_dev), chan, pad, need, cur);
+		device_xname(sc->sc_dev), chan, pad, need, cur);
 #endif
     }
 
@@ -2537,7 +2537,7 @@
       pad -= 2;
 #ifdef EN_DEBUG
       printf("%s: tx%d: padding %d bytes (cur now 0x%x)\n",
-		device_xname(&sc->sc_dev), chan, pad * sizeof(u_int32_t), cur);
+		device_xname(sc->sc_dev), chan, pad * sizeof(u_int32_t), cur);
 #endif
     while (pad--) {
       EN_WRITEDAT(sc, cur, 0);	/* no byte order issues with zero */
@@ -2561,7 +2561,7 @@
   sc->txslot[chan].cur = cur;
 #ifdef EN_DEBUG
       printf("%s: tx%d: DONE!   cur now = 0x%x\n",
-		device_xname(&sc->sc_dev), chan, cur);
+		device_xname(sc->sc_dev), chan, cur);
 #endif
 
   return;
@@ -2591,7 +2591,7 @@
     char sbuf[256];
 
     snprintb(sbuf, sizeof(sbuf), MID_INTBITS, reg);
-    printf("%s: interrupt=0x%s\n", device_xname(&sc->sc_dev), sbuf);
+    printf("%s: interrupt=0x%s\n", device_xname(sc->sc_dev), sbuf);
   }
 #endif
 
@@ -2604,7 +2604,7 @@
 
     snprintb(sbuf, sizeof(sbuf), MID_INTBITS, reg);
     printf("%s: unexpected interrupt=0x%s, resetting card\n",
-           device_xname(&sc->sc_dev), sbuf);
+           device_xname(sc->sc_dev), sbuf);
 #ifdef EN_DEBUG
 #ifdef DDB
 #ifdef __FreeBSD__
@@ -2645,7 +2645,7 @@
 	  sc->txslot[lcv].bfree = (val + (EN_TXSZ*1024)) - sc->txslot[lcv].cur;
 #ifdef EN_DEBUG
 	printf("%s: tx%d: transmit done.   %d bytes now free in buffer\n",
-		device_xname(&sc->sc_dev), lcv, sc->txslot[lcv].bfree);
+		device_xname(sc->sc_dev), lcv, sc->txslot[lcv].bfree);
 #endif
       }
     }
@@ -2664,7 +2664,7 @@
       kick = MID_NTX_CH - 1;		/* assume power of 2, kick all! */
       sc->need_dtqs = 0;		/* recalculated in "kick" loop below */
 #ifdef EN_DEBUG
-      printf("%s: cleared need DTQ condition\n", device_xname(&sc->sc_dev));
+      printf("%s: cleared need DTQ condition\n", device_xname(sc->sc_dev));
 #endif
     }
     while (idx != val) {
@@ -2677,7 +2677,7 @@
 	sc->txslot[slot].mbsize -= EN_DQ_LEN(dtq);
 #ifdef EN_DEBUG
 	printf("%s: tx%d: free %d DMA bytes, mbsize now %d\n",
-		device_xname(&sc->sc_dev), slot, EN_DQ_LEN(dtq),
+		device_xname(sc->sc_dev), slot, EN_DQ_LEN(dtq),
 		sc->txslot[slot].mbsize);
 #endif
 	m_freem(m);
@@ -2694,7 +2694,7 @@
 
   if (kick) {
 #ifdef EN_DEBUG
-  printf("%s: tx kick mask = 0x%x\n", device_xname(&sc->sc_dev), kick);
+  printf("%s: tx kick mask = 0x%x\n", device_xname(sc->sc_dev), kick);
 #endif
     for (mask = 1, lcv = 0 ; lcv < EN_NTX ; lcv++, mask = mask * 2) {
       if ((kick & mask) && sc->txslot[lcv].q.ifq_head) {
@@ -2726,7 +2726,7 @@
 	  IF_DEQUEUE(&sc->rxslot[slot].indma, m);
 	  if (!m)
 	    panic("enintr: drqsync: %s: lost mbuf in slot %d!",
-		  device_xname(&sc->sc_dev), slot);
+		  device_xname(sc->sc_dev), slot);
         }
 	/* do something with this mbuf */
 	if (sc->rxslot[slot].oth_flags & ENOTHER_DRAIN) {  /* drain? */
@@ -2741,7 +2741,7 @@
 	    sc->rxslot[slot].atm_vci = RX_NONE;
 	    sc->rxvc2slot[vci] = RX_NONE;
 #ifdef EN_DEBUG
-	    printf("%s: rx%d: VCI %d now free\n", device_xname(&sc->sc_dev),
+	    printf("%s: rx%d: VCI %d now free\n", device_xname(sc->sc_dev),
 			slot, vci);
 #endif
 	  }
@@ -2751,7 +2751,7 @@
 	  ATM_PH_SETVCI(&ah, sc->rxslot[slot].atm_vci);
 #ifdef EN_DEBUG
 	  printf("%s: rx%d: rxvci%d: atm_input, mbuf %p, len %d, hand %p\n",
-		device_xname(&sc->sc_dev), slot, sc->rxslot[slot].atm_vci, m,
+		device_xname(sc->sc_dev), slot, sc->rxslot[slot].atm_vci, m,
 		EN_DQ_LEN(drq), sc->rxslot[slot].rxhand);
 #endif
 
@@ -2779,7 +2779,7 @@
       need_softserv = 1;
       sc->need_drqs = 0;
 #ifdef EN_DEBUG
-	printf("%s: cleared need DRQ condition\n", device_xname(&sc->sc_dev));
+	printf("%s: cleared need DRQ condition\n", device_xname(sc->sc_dev));
 #endif
     }
   }
@@ -2800,7 +2800,7 @@
       if (slot == RX_NONE) {
 #ifdef EN_DEBUG
 	printf("%s: unexpected rx interrupt on VCI %d\n",
-		device_xname(&sc->sc_dev), vci);
+		device_xname(sc->sc_dev), vci);
 #endif
 	EN_WRITE(sc, MID_VC(vci), MIDV_TRASH);  /* rx off, damn it! */
 	continue;				/* next */
@@ -2809,7 +2809,7 @@
       EN_COUNT(sc->hwpull);
 
 #ifdef EN_DEBUG
-      printf("%s: pulled VCI %d off hwslist\n", device_xname(&sc->sc_dev), vci);
+      printf("%s: pulled VCI %d off hwslist\n", device_xname(sc->sc_dev), vci);
 #endif
 
       /* add it to the software service list (if needed) */
@@ -2821,7 +2821,7 @@
 	EN_WRAPADD(0, MID_SL_N, sc->swsl_tail, 1);
 	sc->swsl_size++;
 #ifdef EN_DEBUG
-      printf("%s: added VCI %d to swslist\n", device_xname(&sc->sc_dev), vci);
+      printf("%s: added VCI %d to swslist\n", device_xname(sc->sc_dev), vci);
 #endif
       }
     };
@@ -2841,7 +2841,7 @@
   if (reg & MID_INT_DMA_OVR) {
     EN_COUNT(sc->dmaovr);
 #ifdef EN_DEBUG
-    printf("%s: MID_INT_DMA_OVR\n", device_xname(&sc->sc_dev));
+    printf("%s: MID_INT_DMA_OVR\n", device_xname(sc->sc_dev));
 #endif
   }
   reg = EN_READ(sc, MID_STAT);
@@ -2883,7 +2883,7 @@
 next_vci:
   if (sc->swsl_size == 0) {
 #ifdef EN_DEBUG
-    printf("%s: en_service done\n", device_xname(&sc->sc_dev));
+    printf("%s: en_service done\n", device_xname(sc->sc_dev));
 #endif
     return;		/* >>> exit here if swsl now empty <<< */
   }
@@ -2909,7 +2909,7 @@
 
 #ifdef EN_DEBUG
   printf("%s: rx%d: service vci=%d raw=%d start/stop/cur=0x%x 0x%x 0x%x\n",
-	device_xname(&sc->sc_dev), slot, vci, raw, start, stop, cur);
+	device_xname(sc->sc_dev), slot, vci, raw, start, stop, cur);
 #endif
 
 same_vci:
@@ -2925,7 +2925,7 @@
 					/* >>> remove from swslist <<< */
 #ifdef EN_DEBUG
     printf("%s: rx%d: remove vci %d from swslist\n",
-	device_xname(&sc->sc_dev), slot, vci);
+	device_xname(sc->sc_dev), slot, vci);
 #endif
     goto next_vci;
   }
@@ -2978,11 +2978,11 @@
 	static int first = 1;
 
 	if (first) {
-	  printf("%s: %s, dropping frame\n", device_xname(&sc->sc_dev),
+	  printf("%s: %s, dropping frame\n", device_xname(sc->sc_dev),
 		 (rbd & MID_RBD_CRCERR) ?
 		 "CRC error" : "invalid AAL5 PDU length");
 	  printf("%s: got %d cells (%d bytes), AAL5 len is %d bytes (pdu=0x%x)\n",
-		 device_xname(&sc->sc_dev), MID_RBD_CNT(rbd),
+		 device_xname(sc->sc_dev), MID_RBD_CNT(rbd),
 		 tlen - MID_RBD_SIZE, MID_PDU_LEN(pdu), pdu);
 #ifndef EN_DEBUG
 	  printf("CRC error report disabled from now on!\n");
@@ -3024,7 +3024,7 @@
     if (sav[0] != cur) {
 #ifdef EN_DEBUG
       printf("%s: rx%d: q'ed mbuf %p not ours\n",
-		device_xname(&sc->sc_dev), slot, m);
+		device_xname(sc->sc_dev), slot, m);
 #endif
       m = NULL;			/* wasn't ours */
       EN_COUNT(sc->rxqnotus);
@@ -3034,7 +3034,7 @@
       drqneed = sav[1];
 #ifdef EN_DEBUG
       printf("%s: rx%d: recovered q'ed mbuf %p (drqneed=%d)\n",
-	device_xname(&sc->sc_dev), slot, m, drqneed);
+	device_xname(sc->sc_dev), slot, m, drqneed);
 #endif
     }
   }
@@ -3046,18 +3046,18 @@
       mlen = 0;
       EN_COUNT(sc->rxmbufout);
 #ifdef EN_DEBUG
-      printf("%s: rx%d: out of mbufs\n", device_xname(&sc->sc_dev), slot);
+      printf("%s: rx%d: out of mbufs\n", device_xname(sc->sc_dev), slot);
 #endif
     }
 #ifdef EN_DEBUG
     printf("%s: rx%d: allocate mbuf %p, mlen=%d, drqneed=%d\n",
-	device_xname(&sc->sc_dev), slot, m, mlen, drqneed);
+	device_xname(sc->sc_dev), slot, m, mlen, drqneed);
 #endif
   }
 
 #ifdef EN_DEBUG
   printf("%s: rx%d: VCI %d, mbuf_chain %p, mlen %d, fill %d\n",
-	device_xname(&sc->sc_dev), slot, vci, m, mlen, fill);
+	device_xname(sc->sc_dev), slot, vci, m, mlen, fill);
 #endif
 
   /*
@@ -3071,7 +3071,7 @@
     if (m == NULL) {
       EN_COUNT(sc->rxoutboth);
 #ifdef EN_DEBUG
-      printf("%s: rx%d: out of DRQs *and* mbufs!\n", device_xname(&sc->sc_dev), slot);
+      printf("%s: rx%d: out of DRQs *and* mbufs!\n", device_xname(sc->sc_dev), slot);
 #endif
       return;		/* >>> exit here if out of both mbufs and DRQs <<< */
     }
@@ -3081,7 +3081,7 @@
     IF_ENQUEUE(&sc->rxslot[slot].q, m);
     EN_COUNT(sc->rxdrqout);
 #ifdef EN_DEBUG
-    printf("%s: rx%d: out of DRQs\n", device_xname(&sc->sc_dev), slot);
+    printf("%s: rx%d: out of DRQs\n", device_xname(sc->sc_dev), slot);
 #endif
     return;		/* >>> exit here if out of DRQs <<< */
   }
@@ -3111,7 +3111,7 @@
 
 #ifdef EN_DEBUG
     printf("%s: rx%d: load mbuf %p, m_len=%d, m_data=%p, tlen=%d\n",
-	device_xname(&sc->sc_dev), slot, tmp, tmp->m_len, tmp->m_data, tlen);
+	device_xname(sc->sc_dev), slot, tmp, tmp->m_len, tmp->m_data, tlen);
 #endif
 
     /* copy data */
@@ -3126,7 +3126,7 @@
       need -= tlen;
 #ifdef EN_DEBUG
       printf("%s: rx%d: vci%d: copied %d bytes (%d left)\n",
-		device_xname(&sc->sc_dev), slot, vci, tlen, need);
+		device_xname(sc->sc_dev), slot, vci, tlen, need);
 #endif
       continue;
     }
@@ -3136,7 +3136,7 @@
       EN_DRQADD(sc, WORD_IDX(start,cur), vci, MIDDMA_JK, 0, 0, 0, 0);
 #ifdef EN_DEBUG
       printf("%s: rx%d: vci%d: drq_sync: advance pointer to %d\n",
-		device_xname(&sc->sc_dev), slot, vci, cur);
+		device_xname(sc->sc_dev), slot, vci, cur);
 #endif
     }
 
@@ -3151,7 +3151,7 @@
       EN_WRAPADD(start, stop, cur, tlen);
 #ifdef EN_DEBUG
       printf("%s: rx%d: vci%d: adp_dma %d bytes (%d left)\n",
-		device_xname(&sc->sc_dev), slot, vci, tlen, need);
+		device_xname(sc->sc_dev), slot, vci, tlen, need);
 #endif
       end = (need == 0 && !fill) ? MID_DMA_END : 0;
       EN_DRQADD(sc, tlen, vci, 0, vtophys((vaddr_t)data), mlen, slot, end);
@@ -3186,7 +3186,7 @@
       EN_WRAPADD(start, stop, cur, cnt);
 #ifdef EN_DEBUG
       printf("%s: rx%d: vci%d: al_dma %d bytes (%d left)\n",
-		device_xname(&sc->sc_dev), slot, vci, cnt, need);
+		device_xname(sc->sc_dev), slot, vci, cnt, need);
 #endif
       tlen -= cnt;
       end = (need == 0 && !fill) ? MID_DMA_END : 0;
@@ -3205,7 +3205,7 @@
       EN_WRAPADD(start, stop, cur, cnt);
 #ifdef EN_DEBUG
       printf("%s: rx%d: vci%d: best_dma %d bytes (%d left)\n",
-		device_xname(&sc->sc_dev), slot, vci, cnt, need);
+		device_xname(sc->sc_dev), slot, vci, cnt, need);
 #endif
       tlen -= cnt;
       end = (need == 0 && !fill) ? MID_DMA_END : 0;
@@ -3224,7 +3224,7 @@
       EN_WRAPADD(start, stop, cur, tlen);
 #ifdef EN_DEBUG
       printf("%s: rx%d: vci%d: cleanup_dma %d bytes (%d left)\n",
-		device_xname(&sc->sc_dev), slot, vci, tlen, need);
+		device_xname(sc->sc_dev), slot, vci, tlen, need);
 #endif
       end = (need == 0 && !fill) ? MID_DMA_END : 0;
       EN_DRQADD(sc, count, vci, bcode, vtophys((vaddr_t)data), mlen, slot, end);
@@ -3243,10 +3243,10 @@
 #ifdef EN_DEBUG
       if (fill)
         printf("%s: rx%d: vci%d: skipping %d bytes of fill\n",
-		device_xname(&sc->sc_dev), slot, vci, fill);
+		device_xname(sc->sc_dev), slot, vci, fill);
       else
         printf("%s: rx%d: vci%d: syncing chip from 0x%x to 0x%x [cur]\n",
-		device_xname(&sc->sc_dev), slot, vci, dma, cur);
+		device_xname(sc->sc_dev), slot, vci, dma, cur);
 #endif
     EN_WRAPADD(start, stop, cur, fill);
     EN_DRQADD(sc, WORD_IDX(start,cur), vci, MIDDMA_JK, 0, mlen,
@@ -3276,7 +3276,7 @@
 
 #ifdef EN_DEBUG
   printf("%s: rx%d: vci%d: DONE!   cur now =0x%x\n",
-	device_xname(&sc->sc_dev), slot, vci, cur);
+	device_xname(sc->sc_dev), slot, vci, cur);
 #endif
 
   goto same_vci;	/* get next packet in this slot */
@@ -3317,7 +3317,7 @@
       continue;
 
     snprintb(sbuf, sizeof(sbuf), END_BITS, level);
-    printf("dumping device %s at level 0x%s\n", device_xname(&sc->sc_dev), sbuf);
+    printf("dumping device %s at level 0x%s\n", device_xname(sc->sc_dev), sbuf);
 
     if (sc->dtq_us == 0) {
       printf("<hasn't been en_init'd yet>\n");

Index: src/sys/dev/ic/midwayvar.h
diff -u src/sys/dev/ic/midwayvar.h:1.17 src/sys/dev/ic/midwayvar.h:1.18
--- src/sys/dev/ic/midwayvar.h:1.17	Tue Feb  1 19:50:03 2011
+++ src/sys/dev/ic/midwayvar.h	Mon Jul 18 00:58:51 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: midwayvar.h,v 1.17 2011/02/01 19:50:03 chuck Exp $	*/
+/*	$NetBSD: midwayvar.h,v 1.18 2011/07/18 00:58:51 mrg Exp $	*/
 
 /*
  * Copyright (c) 1996 Charles D. Cranor and Washington University.
@@ -100,7 +100,7 @@
 
 struct en_softc {
   /* bsd glue */
-  struct device sc_dev;		/* system device */
+  device_t sc_dev;		/* system device */
   struct ifnet enif;		/* network ifnet handle */
 
   /* bus glue */

Index: src/sys/dev/pci/if_en_pci.c
diff -u src/sys/dev/pci/if_en_pci.c:1.34 src/sys/dev/pci/if_en_pci.c:1.35
--- src/sys/dev/pci/if_en_pci.c:1.34	Tue Feb  1 19:50:03 2011
+++ src/sys/dev/pci/if_en_pci.c	Mon Jul 18 00:58:51 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_en_pci.c,v 1.34 2011/02/01 19:50:03 chuck Exp $	*/
+/*	$NetBSD: if_en_pci.c,v 1.35 2011/07/18 00:58:51 mrg Exp $	*/
 
 /*
  * Copyright (c) 1996 Charles D. Cranor and Washington University.
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_en_pci.c,v 1.34 2011/02/01 19:50:03 chuck Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_en_pci.c,v 1.35 2011/07/18 00:58:51 mrg Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -61,7 +61,7 @@
 
 struct en_pci_softc {
   /* bus independent stuff */
-  struct en_softc esc;		/* includes "device" structure */
+  struct en_softc esc;
 
   /* PCI bus glue */
   void *sc_ih;			/* interrupt handle */
@@ -119,7 +119,7 @@
  * PCI autoconfig attachments
  */
 
-CFATTACH_DECL(en_pci, sizeof(struct en_pci_softc),
+CFATTACH_DECL_NEW(en_pci, sizeof(struct en_pci_softc),
     en_pci_match, en_pci_attach, NULL, NULL);
 
 #if !defined(MIDWAY_ENIONLY)
@@ -187,6 +187,8 @@
   const char *intrstr;
   int retval;
 
+  sc->sc_dev = self;
+
   aprint_naive(": ATM controller\n");
   aprint_normal("\n");
 
@@ -205,19 +207,19 @@
    */
 
   if (pci_intr_map(pa, &ih)) {
-    aprint_error_dev(&sc->sc_dev, "couldn't map interrupt\n");
+    aprint_error_dev(sc->sc_dev, "couldn't map interrupt\n");
     return;
   }
   intrstr = pci_intr_string(scp->en_pc, ih);
   scp->sc_ih = pci_intr_establish(scp->en_pc, ih, IPL_NET, en_intr, sc);
   if (scp->sc_ih == NULL) {
-    aprint_error_dev(&sc->sc_dev, "couldn't establish interrupt\n");
+    aprint_error_dev(sc->sc_dev, "couldn't establish interrupt\n");
     if (intrstr != NULL)
       aprint_error(" at %s", intrstr);
     aprint_error("\n");
     return;
   }
-  aprint_normal_dev(&sc->sc_dev, "interrupting at %s\n", intrstr);
+  aprint_normal_dev(sc->sc_dev, "interrupting at %s\n", intrstr);
   sc->ipl = 1; /* XXX */
 
   /*
@@ -228,7 +230,7 @@
 			  PCI_MAPREG_TYPE_MEM | PCI_MAPREG_MEM_TYPE_32BIT, 0,
 			  &sc->en_memt, &sc->en_base, NULL, &sc->en_obmemsz);
   if (retval) {
-    aprint_error_dev(&sc->sc_dev, "couldn't map memory\n");
+    aprint_error_dev(sc->sc_dev, "couldn't map memory\n");
     return;
   }
 

Index: src/sys/dev/sbus/if_en.c
diff -u src/sys/dev/sbus/if_en.c:1.28 src/sys/dev/sbus/if_en.c:1.29
--- src/sys/dev/sbus/if_en.c:1.28	Tue Feb  1 19:50:04 2011
+++ src/sys/dev/sbus/if_en.c	Mon Jul 18 00:58:52 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_en.c,v 1.28 2011/02/01 19:50:04 chuck Exp $	*/
+/*	$NetBSD: if_en.c,v 1.29 2011/07/18 00:58:52 mrg Exp $	*/
 
 /*
  * Copyright (c) 1996 Charles D. Cranor and Washington University.
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_en.c,v 1.28 2011/02/01 19:50:04 chuck Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_en.c,v 1.29 2011/07/18 00:58:52 mrg Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -58,17 +58,6 @@
 
 
 /*
- * local structures
- */
-struct en_sbus_softc {
-	/* bus independent stuff */
-	struct en_softc	sc_en;		/* includes "device" structure */
-
-	/* sbus glue */
-};
-
-
-/*
  * prototypes
  */
 static	int en_sbus_match(device_t, cfdata_t, void *);
@@ -78,7 +67,7 @@
  * SBus autoconfig attachments
  */
 
-CFATTACH_DECL(en_sbus, sizeof(struct en_sbus_softc),
+CFATTACH_DECL_NEW(en_sbus, sizeof(struct en_softc),
     en_sbus_match, en_sbus_attach, NULL, NULL);
 
 /***********************************************************************/
@@ -111,8 +100,9 @@
 en_sbus_attach(device_t parent, device_t self, void *aux)
 {
 	struct sbus_attach_args *sa = aux;
-	struct en_sbus_softc *ssc = device_private(self);
-	struct en_softc *sc = &ssc->sc_en;
+	struct en_softc *sc = device_private(self);
+
+	sc->sc_dev = self;
 
 	printf("\n");
 

Index: src/sys/dev/sbus/qe.c
diff -u src/sys/dev/sbus/qe.c:1.58 src/sys/dev/sbus/qe.c:1.59
--- src/sys/dev/sbus/qe.c:1.58	Mon Apr  5 07:21:47 2010
+++ src/sys/dev/sbus/qe.c	Mon Jul 18 00:58:52 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: qe.c,v 1.58 2010/04/05 07:21:47 joerg Exp $	*/
+/*	$NetBSD: qe.c,v 1.59 2011/07/18 00:58:52 mrg Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: qe.c,v 1.58 2010/04/05 07:21:47 joerg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: qe.c,v 1.59 2011/07/18 00:58:52 mrg Exp $");
 
 #define QEDEBUG
 
@@ -117,7 +117,7 @@
 #include <dev/sbus/qereg.h>
 
 struct qe_softc {
-	struct	device	sc_dev;		/* base device */
+	device_t	sc_dev;
 	bus_space_tag_t	sc_bustag;	/* bus & DMA tags */
 	bus_dma_tag_t	sc_dmatag;
 	bus_dmamap_t	sc_dmamap;
@@ -169,7 +169,7 @@
 void	qe_ifmedia_sts(struct ifnet *, struct ifmediareq *);
 int	qe_ifmedia_upd(struct ifnet *);
 
-CFATTACH_DECL(qe, sizeof(struct qe_softc),
+CFATTACH_DECL_NEW(qe, sizeof(struct qe_softc),
     qematch, qeattach, NULL, NULL);
 
 int
@@ -193,6 +193,8 @@
 	bus_size_t size;
 	int rseg, error;
 
+	sc->sc_dev = self;
+
 	if (sa->sa_nreg < 2) {
 		printf("%s: only %d register sets\n",
 			device_xname(self), sa->sa_nreg);
@@ -542,7 +544,7 @@
 {
 	struct qe_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++;
 
 	qereset(sc);
@@ -697,7 +699,7 @@
 #ifdef QEDEBUG
 	if (npackets == 0 && sc->sc_debug)
 		printf("%s: rint: no packets; rb index %d; status 0x%x\n",
-			device_xname(&sc->sc_dev), bix, len);
+			device_xname(sc->sc_dev), bix, len);
 #endif
 
 	sc->sc_rb.rb_rdtail = bix;
@@ -712,23 +714,24 @@
 qe_eint(struct qe_softc *sc, uint32_t why)
 {
 	struct ifnet *ifp = &sc->sc_ethercom.ec_if;
-	device_t self = &sc->sc_dev;
+	device_t self = sc->sc_dev;
+	const char *xname = device_xname(self);
 	int r = 0, rst = 0;
 
 	if (why & QE_CR_STAT_EDEFER) {
-		printf("%s: excessive tx defers.\n", device_xname(self));
+		printf("%s: excessive tx defers.\n", xname);
 		r |= 1;
 		ifp->if_oerrors++;
 	}
 
 	if (why & QE_CR_STAT_CLOSS) {
-		printf("%s: no carrier, link down?\n", device_xname(self));
+		printf("%s: no carrier, link down?\n", xname);
 		ifp->if_oerrors++;
 		r |= 1;
 	}
 
 	if (why & QE_CR_STAT_ERETRIES) {
-		printf("%s: excessive tx retries\n", device_xname(self));
+		printf("%s: excessive tx retries\n", xname);
 		ifp->if_oerrors++;
 		r |= 1;
 		rst = 1;
@@ -736,26 +739,26 @@
 
 
 	if (why & QE_CR_STAT_LCOLL) {
-		printf("%s: late tx transmission\n", device_xname(self));
+		printf("%s: late tx transmission\n", xname);
 		ifp->if_oerrors++;
 		r |= 1;
 		rst = 1;
 	}
 
 	if (why & QE_CR_STAT_FUFLOW) {
-		printf("%s: tx fifo underflow\n", device_xname(self));
+		printf("%s: tx fifo underflow\n", xname);
 		ifp->if_oerrors++;
 		r |= 1;
 		rst = 1;
 	}
 
 	if (why & QE_CR_STAT_JERROR) {
-		printf("%s: jabber seen\n", device_xname(self));
+		printf("%s: jabber seen\n", xname);
 		r |= 1;
 	}
 
 	if (why & QE_CR_STAT_BERROR) {
-		printf("%s: babble seen\n", device_xname(self));
+		printf("%s: babble seen\n", xname);
 		r |= 1;
 	}
 
@@ -766,27 +769,27 @@
 	}
 
 	if (why & QE_CR_STAT_TXDERROR) {
-		printf("%s: tx descriptor is bad\n", device_xname(self));
+		printf("%s: tx descriptor is bad\n", xname);
 		rst = 1;
 		r |= 1;
 	}
 
 	if (why & QE_CR_STAT_TXLERR) {
-		printf("%s: tx late error\n", device_xname(self));
+		printf("%s: tx late error\n", xname);
 		ifp->if_oerrors++;
 		rst = 1;
 		r |= 1;
 	}
 
 	if (why & QE_CR_STAT_TXPERR) {
-		printf("%s: tx DMA parity error\n", device_xname(self));
+		printf("%s: tx DMA parity error\n", xname);
 		ifp->if_oerrors++;
 		rst = 1;
 		r |= 1;
 	}
 
 	if (why & QE_CR_STAT_TXSERR) {
-		printf("%s: tx DMA sbus error ack\n", device_xname(self));
+		printf("%s: tx DMA sbus error ack\n", xname);
 		ifp->if_oerrors++;
 		rst = 1;
 		r |= 1;
@@ -809,13 +812,13 @@
 	}
 
 	if (why & QE_CR_STAT_RXFOFLOW) {
-		printf("%s: rx fifo overflow\n", device_xname(self));
+		printf("%s: rx fifo overflow\n", xname);
 		ifp->if_ierrors++;
 		r |= 1;
 	}
 
 	if (why & QE_CR_STAT_RLCOLL) {
-		printf("%s: rx late collision\n", device_xname(self));
+		printf("%s: rx late collision\n", xname);
 		ifp->if_ierrors++;
 		ifp->if_collisions++;
 		r |= 1;
@@ -832,34 +835,34 @@
 	}
 
 	if (why & QE_CR_STAT_RXDROP) {
-		printf("%s: rx packet dropped\n", device_xname(self));
+		printf("%s: rx packet dropped\n", xname);
 		ifp->if_ierrors++;
 		r |= 1;
 	}
 
 	if (why & QE_CR_STAT_RXSMALL) {
-		printf("%s: rx buffer too small\n", device_xname(self));
+		printf("%s: rx buffer too small\n", xname);
 		ifp->if_ierrors++;
 		r |= 1;
 		rst = 1;
 	}
 
 	if (why & QE_CR_STAT_RXLERR) {
-		printf("%s: rx late error\n", device_xname(self));
+		printf("%s: rx late error\n", xname);
 		ifp->if_ierrors++;
 		r |= 1;
 		rst = 1;
 	}
 
 	if (why & QE_CR_STAT_RXPERR) {
-		printf("%s: rx DMA parity error\n", device_xname(self));
+		printf("%s: rx DMA parity error\n", xname);
 		ifp->if_ierrors++;
 		r |= 1;
 		rst = 1;
 	}
 
 	if (why & QE_CR_STAT_RXSERR) {
-		printf("%s: rx DMA sbus error ack\n", device_xname(self));
+		printf("%s: rx DMA sbus error ack\n", xname);
 		ifp->if_ierrors++;
 		r |= 1;
 		rst = 1;
@@ -870,7 +873,7 @@
 			why);
 
 	if (rst) {
-		printf("%s: resetting...\n", device_xname(self));
+		printf("%s: resetting...\n", xname);
 		qereset(sc);
 		return (-1);
 	}

Index: src/sys/dev/sbus/sio16.c
diff -u src/sys/dev/sbus/sio16.c:1.23 src/sys/dev/sbus/sio16.c:1.24
--- src/sys/dev/sbus/sio16.c:1.23	Fri Sep 18 12:23:16 2009
+++ src/sys/dev/sbus/sio16.c	Mon Jul 18 00:58:52 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: sio16.c,v 1.23 2009/09/18 12:23:16 tsutsui Exp $	*/
+/*	$NetBSD: sio16.c,v 1.24 2011/07/18 00:58:52 mrg Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001 Matthew R. Green
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sio16.c,v 1.23 2009/09/18 12:23:16 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sio16.c,v 1.24 2011/07/18 00:58:52 mrg Exp $");
 
 #include <sys/param.h>
 #include <sys/conf.h>
@@ -72,7 +72,7 @@
  * define the sio16 per-device softc.
  */
 struct sio16_softc {
-	struct device	sc_dev;			/* must be first */
+	device_t sc_dev;
 
 	/* sbus information */
 	bus_space_tag_t	sc_tag;			/* bus tag for below */
@@ -88,7 +88,7 @@
 
 };
 
-CFATTACH_DECL(siosixteen, sizeof(struct sio16_softc),
+CFATTACH_DECL_NEW(siosixteen, sizeof(struct sio16_softc),
     sio16_match, sio16_attach, NULL, NULL);
 
 struct sio16_attach_args {
@@ -130,6 +130,8 @@
 	char *mode, *model;
 	int i;
 
+	sc->sc_dev = self;
+
 	if (sa->sa_nreg != 4)
 		panic("sio16_attach: got %d registers intead of 4",
 		    sa->sa_nreg);
@@ -255,7 +257,7 @@
 		break;
 	default:
 		panic("%s: sio16_ackfunc: unknown ackfunc %d",
-		    device_xname(&sc->sc_dev), who);
+		    device_xname(sc->sc_dev), who);
 	}
 	return (bus_space_read_1(sc->sc_tag, sc->sc_ack, addr));
 }
@@ -267,7 +269,7 @@
 static int	clcd_match(device_t, cfdata_t, void *);
 static void	clcd_attach(device_t, device_t, void *);
 
-CFATTACH_DECL(clcd, sizeof(struct cd18xx_softc),
+CFATTACH_DECL_NEW(clcd, sizeof(struct cd18xx_softc),
     clcd_match, clcd_attach, NULL, NULL);
 
 static int

Index: src/sys/dev/sbus/spif.c
diff -u src/sys/dev/sbus/spif.c:1.27 src/sys/dev/sbus/spif.c:1.28
--- src/sys/dev/sbus/spif.c:1.27	Sat Jul  2 13:21:30 2011
+++ src/sys/dev/sbus/spif.c	Mon Jul 18 00:58:52 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: spif.c,v 1.27 2011/07/02 13:21:30 mrg Exp $	*/
+/*	$NetBSD: spif.c,v 1.28 2011/07/18 00:58:52 mrg Exp $	*/
 /*	$OpenBSD: spif.c,v 1.12 2003/10/03 16:44:51 miod Exp $	*/
 
 /*
@@ -41,7 +41,7 @@
 
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: spif.c,v 1.27 2011/07/02 13:21:30 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: spif.c,v 1.28 2011/07/18 00:58:52 mrg Exp $");
 
 #include "spif.h"
 #if NSPIF > 0
@@ -75,13 +75,13 @@
 
 /* Autoconfig stuff */
 
-CFATTACH_DECL(spif, sizeof(struct spif_softc),
+CFATTACH_DECL_NEW(spif, sizeof(struct spif_softc),
     spif_match, spif_attach, NULL, NULL);
 
-CFATTACH_DECL(stty, sizeof(struct stty_softc),
+CFATTACH_DECL_NEW(stty, sizeof(struct stty_softc),
     stty_match, stty_attach, NULL, NULL);
 
-CFATTACH_DECL(sbpp, sizeof(struct sbpp_softc),
+CFATTACH_DECL_NEW(sbpp, sizeof(struct sbpp_softc),
     sbpp_match, sbpp_attach, NULL, NULL);
 
 dev_type_open(stty_open);
@@ -156,6 +156,8 @@
 	struct spif_softc *sc = device_private(self);
 	struct sbus_attach_args *sa = aux;
 
+	sc->sc_dev = self;
+
 	if (sa->sa_nintr != 2) {
 		printf(": expected %d interrupts, got %d\n", 2, sa->sa_nintr);
 		return;
@@ -280,6 +282,7 @@
 	struct stty_softc *ssc = device_private(dev);
 	int port;
 
+	sc->sc_dev = dev;
 	sc->sc_ttys = ssc;
 
 	for (port = 0; port < sc->sc_nser; port++) {
@@ -924,7 +927,7 @@
 
 			if (ISSET(flags, STTYF_RING_OVERFLOW)) {
 				log(LOG_WARNING, "%s-%x: ring overflow\n",
-					device_xname(&stc->sc_dev), i);
+					device_xname(stc->sc_dev), i);
 				r = 1;
 			}
 
@@ -947,7 +950,7 @@
 	while (STC_READ(sc, STC_CCR) && tries--)
 		/*EMPTY*/;
 	if (tries == 0)
-		aprint_error_dev(&sc->sc_dev, "ccr timeout\n");
+		aprint_error_dev(sc->sc_dev, "ccr timeout\n");
 	STC_WRITE(sc, STC_CCR, val);
 }
 

Index: src/sys/dev/sbus/spifvar.h
diff -u src/sys/dev/sbus/spifvar.h:1.3 src/sys/dev/sbus/spifvar.h:1.4
--- src/sys/dev/sbus/spifvar.h:1.3	Thu Sep 17 16:28:12 2009
+++ src/sys/dev/sbus/spifvar.h	Mon Jul 18 00:58:52 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: spifvar.h,v 1.3 2009/09/17 16:28:12 tsutsui Exp $	*/
+/*	$NetBSD: spifvar.h,v 1.4 2011/07/18 00:58:52 mrg Exp $	*/
 /*	$OpenBSD: spifvar.h,v 1.3 2003/06/02 18:32:41 jason Exp $	*/
 
 /*
@@ -53,18 +53,17 @@
 };
 
 struct stty_softc {
-	struct	device sc_dev;		/* base device */
+	device_t sc_dev;
 	int	sc_nports;		/* number of serial ports */
 	struct	stty_port sc_port[SPIF_MAX_SERIAL];
 };
 
 struct sbpp_softc {
-	struct	device sc_dev;		/* base device */
 	int	sc_nports;		/* number of parallel ports */
 };
 
 struct spif_softc {
-	struct	device sc_dev;		/* base device */
+	device_t sc_dev;
 	void *sc_stcih;			/* stc interrupt vector */
 	void *sc_ppcih;			/* ppc interrut vector */
 	void *sc_softih;		/* soft interrupt vector */

Index: src/sys/dev/sbus/stp4020.c
diff -u src/sys/dev/sbus/stp4020.c:1.64 src/sys/dev/sbus/stp4020.c:1.65
--- src/sys/dev/sbus/stp4020.c:1.64	Sat Sep 19 11:58:06 2009
+++ src/sys/dev/sbus/stp4020.c	Mon Jul 18 00:58:52 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: stp4020.c,v 1.64 2009/09/19 11:58:06 tsutsui Exp $ */
+/*	$NetBSD: stp4020.c,v 1.65 2011/07/18 00:58:52 mrg Exp $ */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: stp4020.c,v 1.64 2009/09/19 11:58:06 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: stp4020.c,v 1.65 2011/07/18 00:58:52 mrg Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -120,7 +120,7 @@
 };
 
 struct stp4020_softc {
-	struct device	sc_dev;		/* Base device */
+	device_t		sc_dev;
 	pcmcia_chipset_tag_t	sc_pct;	/* Chipset methods */
 
 	struct lwp	*event_thread;		/* event handling thread */
@@ -143,7 +143,7 @@
 static void	stp4020_intr_dispatch(void *arg);
 #endif
 
-CFATTACH_DECL(nell, sizeof(struct stp4020_softc),
+CFATTACH_DECL_NEW(nell, sizeof(struct stp4020_softc),
     stp4020match, stp4020attach, NULL, NULL);
 
 #ifdef STP4020_DEBUG
@@ -330,6 +330,8 @@
 	int rev, i, sbus_intno, hw_ipl;
 	bus_space_handle_t bh;
 
+	sc->sc_dev = self;
+
 	/* Transfer bus tags */
 #ifdef SUN4U
 	tag = sa->sa_bustag;
@@ -513,7 +515,7 @@
 	paa.iobase = 0;
 	paa.iosize = STP4020_WINDOW_SIZE;
 
-	h->pcmcia = config_found(&h->sc->sc_dev, &paa, stp4020print);
+	h->pcmcia = config_found(h->sc->sc_dev, &paa, stp4020print);
 
 	if (h->pcmcia == NULL)
 		return;
@@ -996,14 +998,14 @@
 		h->int_enable = v;
 		h->int_disable = v & ~STP4020_ICR0_IOIE;
 #endif
-		DPRINTF(("%s: configuring card for IO useage\n", device_xname(&h->sc->sc_dev)));
+		DPRINTF(("%s: configuring card for IO useage\n", device_xname(h->sc->sc_dev)));
 	} else {
 		v |= STP4020_ICR0_IFTYPE_MEM;
 #ifndef SUN4U
 		h->int_enable = h->int_disable = v;
 #endif
-		DPRINTF(("%s: configuring card for IO useage\n", device_xname(&h->sc->sc_dev)));
-		DPRINTF(("%s: configuring card for MEM ONLY useage\n", device_xname(&h->sc->sc_dev)));
+		DPRINTF(("%s: configuring card for IO useage\n", device_xname(h->sc->sc_dev)));
+		DPRINTF(("%s: configuring card for MEM ONLY useage\n", device_xname(h->sc->sc_dev)));
 	}
 	stp4020_wr_sockctl(h, STP4020_ICR0_IDX, v);
 }

Index: src/sys/dev/sbus/xbox.c
diff -u src/sys/dev/sbus/xbox.c:1.20 src/sys/dev/sbus/xbox.c:1.21
--- src/sys/dev/sbus/xbox.c:1.20	Fri Sep 18 12:23:16 2009
+++ src/sys/dev/sbus/xbox.c	Mon Jul 18 00:58:52 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: xbox.c,v 1.20 2009/09/18 12:23:16 tsutsui Exp $ */
+/*	$NetBSD: xbox.c,v 1.21 2011/07/18 00:58:52 mrg Exp $ */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xbox.c,v 1.20 2009/09/18 12:23:16 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xbox.c,v 1.21 2011/07/18 00:58:52 mrg Exp $");
 
 #include <sys/param.h>
 #include <sys/malloc.h>
@@ -86,16 +86,15 @@
 #define XBOX_NREG		13
 
 struct xbox_softc {
-	struct device	sc_dev;		/* base device */
 	int		sc_key;		/* this xbox's unique key */
 };
 
 /* autoconfiguration driver */
 int	xbox_match(device_t, cfdata_t, void *);
 void	xbox_attach(device_t, device_t, void *);
-int	xbox_print( void *, const char *);
+int	xbox_print(void *, const char *);
 
-CFATTACH_DECL(xbox, sizeof(struct xbox_softc),
+CFATTACH_DECL_NEW(xbox, sizeof(struct xbox_softc),
     xbox_match, xbox_attach, NULL, NULL);
 
 int

Reply via email to