Index: sys/arch/acorn26/acorn26/fpu.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/acorn26/acorn26/fpu.c,v retrieving revision 1.13 diff -u -p -r1.13 fpu.c --- sys/arch/acorn26/acorn26/fpu.c 3 Jun 2011 07:08:48 -0000 1.13 +++ sys/arch/acorn26/acorn26/fpu.c 26 Sep 2012 21:42:13 -0000 @@ -50,7 +50,7 @@ static int fpu_match(device_t, cfdata_t, static void fpu_attach(device_t, device_t, void *); static register_t fpu_identify(void); -CFATTACH_DECL(fpu, sizeof(struct fpu_softc), +CFATTACH_DECL_NEW(fpu, sizeof(struct fpu_softc), fpu_match, fpu_attach, NULL, NULL); struct fpu_softc *the_fpu; @@ -65,8 +65,8 @@ fpu_match(device_t parent, cfdata_t cf, static void fpu_attach(device_t parent, device_t self, void *aux) { - int supported; struct fpu_softc *sc = device_private(self); + int supported; the_fpu = sc; printf(": "); Index: sys/arch/acorn26/acorn26/fpuvar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/acorn26/acorn26/fpuvar.h,v retrieving revision 1.3 diff -u -p -r1.3 fpuvar.h --- sys/arch/acorn26/acorn26/fpuvar.h 14 Jan 2011 02:06:22 -0000 1.3 +++ sys/arch/acorn26/acorn26/fpuvar.h 26 Sep 2012 21:41:52 -0000 @@ -36,7 +36,6 @@ struct proc; struct fpu_softc { - struct device sc_dev; register_t sc_fputype; void (*sc_ctxload)(struct fpframe *); void (*sc_ctxsave)(struct fpframe *); Index: sys/arch/acorn26/iobus/upc_iobus.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/acorn26/iobus/upc_iobus.c,v retrieving revision 1.9 diff -u -p -r1.9 upc_iobus.c --- sys/arch/acorn26/iobus/upc_iobus.c 6 Jan 2009 23:51:34 -0000 1.9 +++ sys/arch/acorn26/iobus/upc_iobus.c 26 Sep 2012 21:43:43 -0000 @@ -60,7 +60,7 @@ struct upc_iobus_softc { struct evcnt sc_intrcntp; }; -CFATTACH_DECL(upc_iobus, sizeof(struct upc_iobus_softc), +CFATTACH_DECL_NEW(upc_iobus, sizeof(struct upc_iobus_softc), upc_iobus_match, upc_iobus_attach, NULL, NULL); static device_t the_upc_iobus; @@ -88,6 +88,7 @@ upc_iobus_attach(device_t parent, device struct upc_iobus_softc *sc = device_private(self); struct upc_softc *upc = &sc->sc_upc; + upc->sc_dev = self; upc->sc_iot = ioa->ioa_tag; bus_space_map(ioa->ioa_tag, ioa->ioa_base, UPC_BUS_SIZE, 0, &upc->sc_ioh); Index: sys/arch/acorn26/ioc/ioeb.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/acorn26/ioc/ioeb.c,v retrieving revision 1.7 diff -u -p -r1.7 ioeb.c --- sys/arch/acorn26/ioc/ioeb.c 19 Jul 2011 16:05:11 -0000 1.7 +++ sys/arch/acorn26/ioc/ioeb.c 26 Sep 2012 21:46:46 -0000 @@ -40,7 +40,6 @@ __KERNEL_RCSID(0, "$NetBSD: ioeb.c,v 1.7 #include struct ioeb_softc { - struct device sc_dev; bus_space_tag_t sc_iot; bus_space_handle_t sc_ioh; }; @@ -48,7 +47,7 @@ struct ioeb_softc { static int ioeb_match(device_t, cfdata_t, void *); static void ioeb_attach(device_t, device_t, void *); -CFATTACH_DECL(ioeb, sizeof(struct ioeb_softc), +CFATTACH_DECL_NEW(ioeb, sizeof(struct ioeb_softc), ioeb_match, ioeb_attach, NULL, NULL); device_t the_ioeb; Index: sys/arch/acorn26/ioc/ssn.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/acorn26/ioc/ssn.c,v retrieving revision 1.11 diff -u -p -r1.11 ssn.c --- sys/arch/acorn26/ioc/ssn.c 11 May 2012 15:39:18 -0000 1.11 +++ sys/arch/acorn26/ioc/ssn.c 26 Sep 2012 21:47:07 -0000 @@ -41,7 +41,6 @@ __KERNEL_RCSID(0, "$NetBSD: ssn.c,v 1.11 #include struct ssn_softc { - struct device sc_dev; struct ds_handle sc_dsh; device_t sc_ioc; int sc_timebase; @@ -50,7 +49,7 @@ struct ssn_softc { static int ssn_match(device_t, cfdata_t, void *); static void ssn_attach(device_t, device_t, void *); -CFATTACH_DECL(ssn, sizeof(struct ssn_softc), +CFATTACH_DECL_NEW(ssn, sizeof(struct ssn_softc), ssn_match, ssn_attach, NULL, NULL); static int ds_ioc_read_bit(void *); Index: sys/arch/acorn32/eb7500atx/rsbus.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/acorn32/eb7500atx/rsbus.c,v retrieving revision 1.9 diff -u -p -r1.9 rsbus.c --- sys/arch/acorn32/eb7500atx/rsbus.c 19 Jul 2011 15:59:52 -0000 1.9 +++ sys/arch/acorn32/eb7500atx/rsbus.c 26 Sep 2012 21:47:45 -0000 @@ -50,7 +50,7 @@ static int rsbus_print(void *, const cha static int rsbus_search(device_t, cfdata_t, const int *, void *); -CFATTACH_DECL(rsbus, sizeof(struct rsbus_softc), +CFATTACH_DECL_NEW(rsbus, sizeof(struct rsbus_softc), rsbus_match, rsbus_attach, NULL, NULL); static int Index: sys/arch/acorn32/eb7500atx/rsbus.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/acorn32/eb7500atx/rsbus.h,v retrieving revision 1.3 diff -u -p -r1.3 rsbus.h --- sys/arch/acorn32/eb7500atx/rsbus.h 19 Jul 2011 15:59:52 -0000 1.3 +++ sys/arch/acorn32/eb7500atx/rsbus.h 26 Sep 2012 21:48:02 -0000 @@ -9,7 +9,6 @@ #include struct rsbus_softc { - struct device sc_dev; bus_space_tag_t sc_iot; bus_space_handle_t sc_ioh; }; Index: sys/arch/acorn32/mainbus/fd.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/acorn32/mainbus/fd.c,v retrieving revision 1.51 diff -u -p -r1.51 fd.c --- sys/arch/acorn32/mainbus/fd.c 19 Jul 2011 15:59:53 -0000 1.51 +++ sys/arch/acorn32/mainbus/fd.c 26 Sep 2012 21:52:22 -0000 @@ -152,7 +152,7 @@ enum fdc_state { /* software state, per controller */ struct fdc_softc { - struct device sc_dev; /* boilerplate */ + device_t sc_dev; /* boilerplate */ void *sc_ih; bus_space_tag_t sc_iot; /* ISA i/o space identifier */ @@ -178,7 +178,7 @@ int fdcprobe(device_t, cfdata_t, void *) int fdprint(void *, const char *); void fdcattach(device_t, device_t, void *); -CFATTACH_DECL(fdc, sizeof(struct fdc_softc), +CFATTACH_DECL_NEW(fdc, sizeof(struct fdc_softc), fdcprobe, fdcattach, NULL, NULL); /* @@ -216,7 +216,7 @@ struct fd_type fd_types[] = { /* software state, per disk (with up to 4 disks per ctlr) */ struct fd_softc { - struct device sc_dev; + device_t sc_dev; struct disk sc_dk; struct fd_type *sc_deftype; /* default type descriptor */ @@ -255,7 +255,7 @@ void fdattach(device_t, device_t, void * extern char floppy_read_fiq[], floppy_read_fiq_end[]; extern char floppy_write_fiq[], floppy_write_fiq_end[]; -CFATTACH_DECL(fd, sizeof(struct fd_softc), +CFATTACH_DECL_NEW(fd, sizeof(struct fd_softc), fdprobe, fdattach, NULL, NULL); extern struct cfdriver fd_cd; @@ -376,6 +376,7 @@ fdcattach(device_t parent, device_t self if (bus_space_map(iot, pa->pa_iobase + pa->pa_offset, FDC_NPORT, 0, &ioh)) panic("fdcattach: couldn't map I/O ports"); + fdc->sc_dev = self; fdc->sc_iot = iot; fdc->sc_ioh = ioh; @@ -398,7 +399,7 @@ fdcattach(device_t parent, device_t self * The NVRAM info only tells us about the first two disks on the * `primary' floppy controller. */ - if (device_unit(&fdc->sc_dev) == 0) + if (device_unit(fdc->sc_dev) == 0) type = mc146818_read(NULL, NVRAM_DISKETTE); /* XXX softc */ else type = -1; @@ -408,7 +409,7 @@ fdcattach(device_t parent, device_t self /* physical limit: four drives per controller. */ for (fa.fa_drive = 0; fa.fa_drive < 4; fa.fa_drive++) { if (type >= 0 && fa.fa_drive < 2) - fa.fa_deftype = fd_nvtotype(device_xname(&fdc->sc_dev), + fa.fa_deftype = fd_nvtotype(device_xname(fdc->sc_dev), type, fa.fa_drive); else fa.fa_deftype = NULL; /* unknown */ @@ -480,6 +481,8 @@ fdattach(device_t parent, device_t self, struct fd_type *type = fa->fa_deftype; int drive = fa->fa_drive; + fd->sc_dev = self; + callout_init(&fd->sc_motoron_ch, 0); callout_init(&fd->sc_motoroff_ch, 0); @@ -500,7 +503,7 @@ fdattach(device_t parent, device_t self, /* * Initialize and attach the disk structure. */ - disk_init(&fd->sc_dk, device_xname(&fd->sc_dev), &fddkdriver); + disk_init(&fd->sc_dk, device_xname(fd->sc_dev), &fddkdriver); disk_attach(&fd->sc_dk); /* Needed to power off if the motor is on when we halt. */ @@ -596,7 +599,7 @@ fdstrategy(struct buf *bp) #ifdef DIAGNOSTIC else { struct fdc_softc *fdc = - device_private(device_parent(&fd->sc_dev)); + device_private(device_parent(fd->sc_dev)); if (fdc->sc_state == DEVIDLE) { printf("fdstrategy: controller inactive\n"); fdcstart(fdc); @@ -615,7 +618,7 @@ done: void fdstart(struct fd_softc *fd) { - struct fdc_softc *fdc = (void *) device_parent(&fd->sc_dev); + struct fdc_softc *fdc = device_private(device_parent(fd->sc_dev)); int active = fdc->sc_drives.tqh_first != 0; /* Link into controller queue. */ @@ -630,7 +633,7 @@ fdstart(struct fd_softc *fd) void fdfinish(struct fd_softc *fd, struct buf *bp) { - struct fdc_softc *fdc = (void *) device_parent(&fd->sc_dev); + struct fdc_softc *fdc = device_private(device_parent(fd->sc_dev)); /* * Move this drive to the end of the queue to give others a `fair' @@ -697,7 +700,7 @@ fd_motor_off(void *arg) s = splbio(); fd->sc_flags &= ~(FD_MOTOR | FD_MOTOR_WAIT); - fd_set_motor((struct fdc_softc *) device_parent(&fd->sc_dev), 0); + fd_set_motor(device_private(device_parent(fd->sc_dev)), 0); splx(s); } @@ -705,7 +708,7 @@ void fd_motor_on(void *arg) { struct fd_softc *fd = arg; - struct fdc_softc *fdc = (void *) device_parent(&fd->sc_dev); + struct fdc_softc *fdc = device_private(device_parent(fd->sc_dev)); int s; s = splbio(); @@ -842,7 +845,7 @@ fdcpstatus(int n, struct fdc_softc *fdc) void fdcstatus(device_t dv, int n, const char *s) { - struct fdc_softc *fdc = (void *) device_parent(dv); + struct fdc_softc *fdc = device_private(device_parent(dv)); if (n == 0) { out_fdc(fdc->sc_iot, fdc->sc_ioh, NE7CMD_SENSEI); @@ -865,7 +868,7 @@ fdctimeout(void *arg) #ifdef DEBUG log(LOG_ERR,"fdctimeout: state %d\n", fdc->sc_state); #endif - fdcstatus(&fd->sc_dev, 0, "timeout"); + fdcstatus(fd->sc_dev, 0, "timeout"); if (bufq_peek(fd->sc_q) != NULL) fdc->sc_state++; @@ -1029,7 +1032,7 @@ loop: #endif if (fiq_claim(&fdc->sc_fh) == -1) panic("%s: Cannot claim FIQ vector", - device_xname(&fdc->sc_dev)); + device_xname(fdc->sc_dev)); IOMD_WRITE_BYTE(IOMD_FIQMSK, 0x01); bus_space_write_2(iot, ioh, fdctl, type->rate); #ifdef FD_DEBUG @@ -1089,7 +1092,7 @@ loop: if (fdcresult(fdc) != 2 || (st0 & 0xf8) != 0x20 || cyl != bp->b_cylinder * fd->sc_type->step) { #ifdef FD_DEBUG - fdcstatus(&fd->sc_dev, 2, "seek failed"); + fdcstatus(fd->sc_dev, 2, "seek failed"); #endif fdcretry(fdc); goto loop; @@ -1116,7 +1119,7 @@ loop: fiq_release(&fdc->sc_fh); IOMD_WRITE_BYTE(IOMD_FIQMSK, 0x00); #ifdef FD_DEBUG - fdcstatus(&fd->sc_dev, 7, bp->b_flags & B_READ ? + fdcstatus(fd->sc_dev, 7, bp->b_flags & B_READ ? "read failed" : "write failed"); printf("blkno %d nblks %d\n", fd->sc_blkno, fd->sc_nblks); @@ -1182,7 +1185,7 @@ loop: out_fdc(iot, ioh, NE7CMD_SENSEI); if (fdcresult(fdc) != 2 || (st0 & 0xf8) != 0x20 || cyl != 0) { #ifdef FD_DEBUG - fdcstatus(&fd->sc_dev, 2, "recalibrate failed"); + fdcstatus(fd->sc_dev, 2, "recalibrate failed"); #endif fdcretry(fdc); goto loop; @@ -1196,7 +1199,7 @@ loop: goto doseek; default: - fdcstatus(&fd->sc_dev, 0, "stray interrupt"); + fdcstatus(fd->sc_dev, 0, "stray interrupt"); return 1; } #ifdef DIAGNOSTIC Index: sys/arch/acorn32/mainbus/pioc.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/acorn32/mainbus/pioc.c,v retrieving revision 1.17 diff -u -p -r1.17 pioc.c --- sys/arch/acorn32/mainbus/pioc.c 19 Jul 2011 15:59:53 -0000 1.17 +++ sys/arch/acorn32/mainbus/pioc.c 9 Oct 2012 01:02:34 -0000 @@ -70,7 +70,6 @@ __KERNEL_RCSID(0, "$NetBSD: pioc.c,v 1.1 */ struct pioc_softc { - struct device sc_dev; /* device node */ bus_space_tag_t sc_iot; /* bus tag */ bus_space_handle_t sc_ioh; /* bus handle */ bus_addr_t sc_iobase; /* IO base address */ @@ -104,7 +103,7 @@ static void piocgetid(bus_space_tag_t io /* device attach and driver structure */ -CFATTACH_DECL(pioc, sizeof(struct pioc_softc), +CFATTACH_DECL_NEW(pioc, sizeof(struct pioc_softc), piocmatch, piocattach, NULL, NULL); /* @@ -298,7 +297,7 @@ piocattach(device_t parent, device_t sel iot = sc->sc_iot = mb->mb_iot; if (bus_space_map(iot, sc->sc_iobase, PIOC_SIZE, 0, &ioh)) - panic("%s: couldn't map I/O space", self->dv_xname); + panic("%s: couldn't map I/O space", device_xname(self)); sc->sc_ioh = ioh; piocgetid(iot, ioh, PIOC_CM_ENTER_665, &id, &rev); Index: sys/arch/acorn32/podulebus/amps.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/acorn32/podulebus/amps.c,v retrieving revision 1.19 diff -u -p -r1.19 amps.c --- sys/arch/acorn32/podulebus/amps.c 19 Jul 2011 15:59:54 -0000 1.19 +++ sys/arch/acorn32/podulebus/amps.c 9 Oct 2012 01:02:34 -0000 @@ -79,7 +79,7 @@ __KERNEL_RCSID(0, "$NetBSD: amps.c,v 1.1 */ struct amps_softc { - struct device sc_dev; /* device node */ + device_t sc_dev; /* device node */ podule_t *sc_podule; /* Our podule info */ int sc_podule_number; /* Our podule number */ bus_space_tag_t sc_iot; /* Bus tag */ @@ -88,7 +88,7 @@ struct amps_softc { int amps_probe(device_t, cfdata_t, void *); void amps_attach(device_t, device_t, void *); -CFATTACH_DECL(amps, sizeof(struct amps_softc), +CFATTACH_DECL_NEW(amps, sizeof(struct amps_softc), amps_probe, amps_attach, NULL, NULL); int amps_print(void *, const char *); @@ -156,6 +156,7 @@ amps_attach(device_t parent, device_t se if (pa->pa_podule_number == -1) panic("Podule has disappeared !"); + sc->sc_dev = self; sc->sc_podule_number = pa->pa_podule_number; sc->sc_podule = pa->pa_podule; podules[sc->sc_podule_number].attached = 1; @@ -164,7 +165,7 @@ amps_attach(device_t parent, device_t se /* Install a clean up handler to make sure IRQ's are disabled */ /* if (shutdownhook_establish(amps_shutdown, (void *)sc) == NULL) - panic("%s: Cannot install shutdown handler", self->dv_xname);*/ + panic("%s: Cannot install shutdown handler", device_xname(self));*/ /* Set the interrupt info for this podule */ Index: sys/arch/acorn32/podulebus/asc.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/acorn32/podulebus/asc.c,v retrieving revision 1.18 diff -u -p -r1.18 asc.c --- sys/arch/acorn32/podulebus/asc.c 19 Jul 2011 15:59:54 -0000 1.18 +++ sys/arch/acorn32/podulebus/asc.c 29 Sep 2012 11:08:24 -0000 @@ -146,7 +146,7 @@ void asc_dump (void); int asc_dmadebug = 0; #endif -CFATTACH_DECL(asc, sizeof(struct asc_softc), +CFATTACH_DECL_NEW(asc, sizeof(struct asc_softc), ascmatch, ascattach, NULL, NULL); extern struct cfdriver asc_cd; @@ -160,9 +160,9 @@ int asc_poll = 0; #endif int -ascmatch(device_t pdp, cfdata_t cf, void *auxp) +ascmatch(device_t parent, cfdata_t cf, void *aux) { - struct podule_attach_args *pa = (struct podule_attach_args *)auxp; + struct podule_attach_args *pa = auxp; /* Look for the card */ @@ -181,19 +181,20 @@ ascmatch(device_t pdp, cfdata_t cf, void } void -ascattach(device_t pdp, device_t dp, void *auxp) +ascattach(device_t parent, device_t self, void *aux) { /* volatile struct sdmac *rp;*/ struct asc_softc *sc; struct sbic_softc *sbic; struct podule_attach_args *pa; - sc = (struct asc_softc *)dp; - pa = (struct podule_attach_args *)auxp; + sc = device_private(self); + pa = aux; if (pa->pa_podule_number == -1) panic("Podule has disappeared !"); + sc->sc_dev = self; sc->sc_podule_number = pa->pa_podule_number; sc->sc_podule = pa->pa_podule; podules[sc->sc_podule_number].attached = 1; @@ -212,11 +213,11 @@ ascattach(device_t pdp, device_t dp, voi if (bus_space_map (sbic->sc_sbicp.sc_sbiciot, sc->sc_podule->mod_base + ASC_SBIC, ASC_SBIC_SPACE, 0, &sbic->sc_sbicp.sc_sbicioh)) - panic("%s: Cannot map SBIC", dp->dv_xname); + panic("%s: Cannot map SBIC", device_xname(self)); sbic->sc_clkfreq = sbic_clock_override ? sbic_clock_override : 143; - sbic->sc_adapter.adapt_dev = &sbic->sc_dev; + sbic->sc_adapter.adapt_dev = self; sbic->sc_adapter.adapt_nchannels = 1; sbic->sc_adapter.adapt_openings = 7; sbic->sc_adapter.adapt_max_periph = 1; @@ -268,17 +269,17 @@ ascattach(device_t pdp, device_t dp, voi #endif { evcnt_attach_dynamic(&sc->sc_intrcnt, EVCNT_TYPE_INTR, NULL, - device_xname(dp), "intr"); + device_xname(self), "intr"); sc->sc_ih = podulebus_irq_establish(pa->pa_ih, IPL_BIO, asc_intr, sc, &sc->sc_intrcnt); if (sc->sc_ih == NULL) - panic("%s: Cannot claim podule IRQ", dp->dv_xname); + panic("%s: Cannot claim podule IRQ", device_xname(self)); } /* * attach all scsi units on us */ - config_found(dp, &sbic->sc_channel, scsiprint); + config_found(self, &sbic->sc_channel, scsiprint); } @@ -379,4 +380,3 @@ asc_minphys(struct buf *bp) #endif minphys(bp); } - Index: sys/arch/acorn32/podulebus/cosc.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/acorn32/podulebus/cosc.c,v retrieving revision 1.17 diff -u -p -r1.17 cosc.c --- sys/arch/acorn32/podulebus/cosc.c 3 Jun 2011 07:35:37 -0000 1.17 +++ sys/arch/acorn32/podulebus/cosc.c 26 Sep 2012 21:59:07 -0000 @@ -68,7 +68,7 @@ __KERNEL_RCSID(0, "$NetBSD: cosc.c,v 1.1 void coscattach(device_t, device_t, void *); int coscmatch(device_t, cfdata_t, void *); -CFATTACH_DECL(cosc, sizeof(struct cosc_softc), +CFATTACH_DECL_NEW(cosc, sizeof(struct cosc_softc), coscmatch, coscattach, NULL, NULL); int cosc_intr(void *); @@ -236,7 +236,8 @@ coscattach(device_t parent, device_t sel escinitialize(&sc->sc_softc); - sc->sc_softc.sc_adapter.adapt_dev = &sc->sc_softc.sc_dev; + sc->sc_softc.sc_dev = self; + sc->sc_softc.sc_adapter.adapt_dev = sc->sc_softc.sc_dev; sc->sc_softc.sc_adapter.adapt_nchannels = 1; sc->sc_softc.sc_adapter.adapt_openings = 7; sc->sc_softc.sc_adapter.adapt_max_periph = 1; Index: sys/arch/acorn32/podulebus/csa.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/acorn32/podulebus/csa.c,v retrieving revision 1.10 diff -u -p -r1.10 csa.c --- sys/arch/acorn32/podulebus/csa.c 28 Apr 2008 20:23:10 -0000 1.10 +++ sys/arch/acorn32/podulebus/csa.c 9 Oct 2012 01:02:34 -0000 @@ -135,7 +135,7 @@ csa_attach(device_t parent, device_t sel struct ncr5380_softc *ncr_sc = &sc->sc_ncr5380; struct podule_attach_args *pa = aux; uint8_t *iobase; - char hi_option[sizeof(self->dv_xname) + 8]; + char hi_option[sizeof(device_xname(self)) + 8]; ncr_sc->sc_dev = self; Index: sys/arch/acorn32/podulebus/csc.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/acorn32/podulebus/csc.c,v retrieving revision 1.17 diff -u -p -r1.17 csc.c --- sys/arch/acorn32/podulebus/csc.c 3 Jun 2011 07:35:37 -0000 1.17 +++ sys/arch/acorn32/podulebus/csc.c 28 Sep 2012 23:12:05 -0000 @@ -60,7 +60,7 @@ __KERNEL_RCSID(0, "$NetBSD: csc.c,v 1.17 int cscmatch(device_t, cfdata_t, void *); void cscattach(device_t, device_t, void *); -CFATTACH_DECL(csc, sizeof(struct csc_softc), +CFATTACH_DECL_NEW(csc, sizeof(struct csc_softc), cscmatch, cscattach, NULL, NULL); int csc_intr(void *); @@ -77,9 +77,9 @@ void csc_set_dma_mode(struct sfas_softc * if we are a Cumana SCSI-2 card */ int -cscmatch(device_t pdp, cfdata_t cf, void *auxp) +cscmatch(device_t parent, cfdata_t cf, void *aux) { - struct podule_attach_args *pa = (struct podule_attach_args *)auxp; + struct podule_attach_args *pa = aux; /* Look for the card */ if (pa->pa_product == PODULE_CUMANA_SCSI2) @@ -95,15 +95,15 @@ cscmatch(device_t pdp, cfdata_t cf, void } void -cscattach(device_t pdp, device_t dp, void *auxp) +cscattach(device_t parent, device_t self, void *aux) { - struct csc_softc *sc = (struct csc_softc *)dp; + struct csc_softc *sc = device_private(self); struct podule_attach_args *pa; csc_regmap_p rp = &sc->sc_regmap; vu_char *fas; int loop; - pa = (struct podule_attach_args *)auxp; + pa = aux; if (pa->pa_podule_number == -1) panic("Podule has disappeared !"); @@ -134,6 +134,7 @@ cscattach(device_t pdp, device_t dp, voi rp->FAS216.sfas_tc_high = &fas[CSC_FAS_OFFSET_TCH]; rp->FAS216.sfas_fifo_bot = &fas[CSC_FAS_OFFSET_FIFOBOT]; + sc->sc_softc.sc_dev = self; sc->sc_softc.sc_fas = (sfas_regmap_p)rp; sc->sc_softc.sc_spec = &sc->sc_specific; @@ -153,7 +154,7 @@ cscattach(device_t pdp, device_t dp, voi sfasinitialize((struct sfas_softc *)sc); - sc->sc_softc.sc_adapter.adapt_dev = &sc->sc_softc.sc_dev; + sc->sc_softc.sc_adapter.adapt_dev = self; sc->sc_softc.sc_adapter.adapt_nchannels = 1; sc->sc_softc.sc_adapter.adapt_openings = 7; sc->sc_softc.sc_adapter.adapt_max_periph = 1; @@ -184,11 +185,11 @@ cscattach(device_t pdp, device_t dp, voi #if CSC_POLL == 0 evcnt_attach_dynamic(&sc->sc_softc.sc_intrcnt, EVCNT_TYPE_INTR, NULL, - device_xname(dp), "intr"); + device_xname(self), "intr"); sc->sc_softc.sc_ih = podulebus_irq_establish(pa->pa_ih, IPL_BIO, csc_intr, &sc->sc_softc, &sc->sc_softc.sc_intrcnt); if (sc->sc_softc.sc_ih == NULL) - panic("%s: Cannot install IRQ handler", dp->dv_xname); + panic("%s: Cannot install IRQ handler", device_xname(self)); #else printf(" polling"); sc->sc_softc.sc_adapter.adapt_flags |= SCSIPI_ADAPT_POLL_ONLY; @@ -196,7 +197,7 @@ cscattach(device_t pdp, device_t dp, voi printf("\n"); /* attach all scsi units on us */ - config_found(dp, &sc->sc_softc.sc_channel, scsiprint); + config_found(self, &sc->sc_softc.sc_channel, scsiprint); } Index: sys/arch/acorn32/podulebus/esc.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/acorn32/podulebus/esc.c,v retrieving revision 1.24 diff -u -p -r1.24 esc.c --- sys/arch/acorn32/podulebus/esc.c 9 Dec 2010 05:14:48 -0000 1.24 +++ sys/arch/acorn32/podulebus/esc.c 28 Sep 2012 17:47:34 -0000 @@ -267,7 +267,7 @@ esc_scsi_request(struct scsipi_channel * void *arg) { struct scsipi_xfer *xs; - struct esc_softc *dev = (void *)chan->chan_adapter->adapt_dev; + struct esc_softc *dev = device_private(chan->chan_adapter->adapt_dev); struct scsipi_periph *periph; struct esc_pending *pendp; int flags, s, target; Index: sys/arch/acorn32/podulebus/escvar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/acorn32/podulebus/escvar.h,v retrieving revision 1.7 diff -u -p -r1.7 escvar.h --- sys/arch/acorn32/podulebus/escvar.h 14 Mar 2009 14:45:51 -0000 1.7 +++ sys/arch/acorn32/podulebus/escvar.h 26 Sep 2012 21:58:05 -0000 @@ -151,7 +151,7 @@ struct nexus { #define ESC_NF_DEBUG 0x8000 /* As it says: DEBUG */ struct esc_softc { - struct device sc_dev; /* System required struct */ + device_t sc_dev; /* System required struct */ struct scsipi_channel sc_channel; /* For sub devices */ struct scsipi_adapter sc_adapter; irqhandler_t sc_ih; /* Interrupt chain struct */ Index: sys/arch/acorn32/podulebus/if_ie.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/acorn32/podulebus/if_ie.c,v retrieving revision 1.31 diff -u -p -r1.31 if_ie.c --- sys/arch/acorn32/podulebus/if_ie.c 10 May 2012 10:27:10 -0000 1.31 +++ sys/arch/acorn32/podulebus/if_ie.c 9 Oct 2012 01:18:48 -0000 @@ -125,7 +125,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_ie.c,v 1. /* Some data structres local to this file */ struct ie_softc { - struct device sc_dev; + device_t sc_dev; int sc_podule_number; podule_t *sc_podule; irqhandler_t sc_ih; @@ -198,7 +198,7 @@ static void start_receiver(struct ie_sof * Our cfattach structure for the autoconfig system to chew on */ -CFATTACH_DECL(ie, sizeof(struct ie_softc), +CFATTACH_DECL_NEW(ie, sizeof(struct ie_softc), ieprobe, ieattach, NULL, NULL); /* Let's go! */ @@ -305,7 +305,8 @@ ieprobe(device_t parent, cfdata_t cf, vo * Attach our driver to the interfaces it uses */ -void ieattach ( device_t parent, device_t self, void *aux ) +void +ieattach(device_t parent, device_t self, void *aux) { struct ie_softc *sc = device_private(self); struct podule_attach_args *pa = aux; @@ -319,6 +320,7 @@ void ieattach ( device_t parent, device_ if (pa->pa_podule_number == -1) panic("Podule has disappeared !"); + sc->sc_dev = self; sc->sc_podule_number = pa->pa_podule_number; sc->sc_podule = pa->pa_podule; podules[sc->sc_podule_number].attached = 1; @@ -447,7 +449,7 @@ void ieattach ( device_t parent, device_ /* Fill in my application form to attach to the inet system */ - memcpy(ifp->if_xname, device_xname(&sc->sc_dev), IFNAMSIZ); + memcpy(ifp->if_xname, device_xname(sc->sc_dev), IFNAMSIZ); ifp->if_softc = sc; ifp->if_start = iestart; ifp->if_ioctl = ieioctl; @@ -475,7 +477,7 @@ void ieattach ( device_t parent, device_ if (irq_claim(sc->sc_podule->interrupt, &sc->sc_ih)) { sc->sc_irqmode = 0; printf(" POLLED"); - panic("%s: Cannot install IRQ handler", sc->sc_dev.dv_xname); + panic("%s: Cannot install IRQ handler", device_xname(sc->sc_dev)); } else { sc->sc_irqmode = 1; printf(" IRQ"); @@ -682,7 +684,7 @@ iewatchdog(struct ifnet *ifp) { 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; iereset(sc); } @@ -870,13 +872,13 @@ ieinit(struct ie_softc *sc) if ( command_and_wait(sc, IE_CU_START, &scb, &cmd, ptr, sizeof cmd, IE_STAT_COMPL) ) { - printf ( "%s: command failed: timeout\n", device_xname(&sc->sc_dev)); + printf ( "%s: command failed: timeout\n", device_xname(sc->sc_dev)); return 0; } if ( !(cmd.com.ie_cmd_status & IE_STAT_OK) ) { - printf ( "%s: command failed: !IE_STAT_OK\n", device_xname(&sc->sc_dev)); + printf ( "%s: command failed: !IE_STAT_OK\n", device_xname(sc->sc_dev)); return 0; } @@ -892,13 +894,13 @@ ieinit(struct ie_softc *sc) if ( command_and_wait(sc, IE_CU_START, &scb, &iasetup_cmd, ptr, sizeof cmd, IE_STAT_COMPL) ) { - printf ( "%s: iasetup failed : timeout\n", device_xname(&sc->sc_dev)); + printf ( "%s: iasetup failed : timeout\n", device_xname(sc->sc_dev)); return 0; } if ( !(cmd.com.ie_cmd_status & IE_STAT_OK) ) { - printf ( "%s: iasetup failed : !IE_STAT_OK\n", device_xname(&sc->sc_dev)); + printf ( "%s: iasetup failed : !IE_STAT_OK\n", device_xname(sc->sc_dev)); return 0; } Index: sys/arch/acorn32/podulebus/ptsc.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/acorn32/podulebus/ptsc.c,v retrieving revision 1.17 diff -u -p -r1.17 ptsc.c --- sys/arch/acorn32/podulebus/ptsc.c 3 Jun 2011 07:35:37 -0000 1.17 +++ sys/arch/acorn32/podulebus/ptsc.c 26 Sep 2012 22:02:31 -0000 @@ -101,7 +101,7 @@ __KERNEL_RCSID(0, "$NetBSD: ptsc.c,v 1.1 int ptscmatch(device_t, cfdata_t, void *); void ptscattach(device_t, device_t, void *); -CFATTACH_DECL(ptsc, sizeof(struct ptsc_softc), +CFATTACH_DECL_NEW(ptsc, sizeof(struct ptsc_softc), ptscmatch, ptscattach, NULL, NULL); int ptsc_intr(void *); @@ -176,6 +176,7 @@ ptscattach(device_t parent, device_t sel rp->FAS216.sfas_tc_high = &fas[PTSC_FASOFFSET_TCH]; rp->FAS216.sfas_fifo_bot = &fas[PTSC_FASOFFSET_FIFOBOTTOM]; + sc->sc_softc.sc_dev = self; sc->sc_softc.sc_fas = (sfas_regmap_p)rp; sc->sc_softc.sc_spec = &sc->sc_specific; @@ -195,7 +196,7 @@ ptscattach(device_t parent, device_t sel sfasinitialize((struct sfas_softc *)sc); - sc->sc_softc.sc_adapter.adapt_dev = &sc->sc_softc.sc_dev; + sc->sc_softc.sc_adapter.adapt_dev = sc->sc_softc.sc_dev; sc->sc_softc.sc_adapter.adapt_nchannels = 1; sc->sc_softc.sc_adapter.adapt_openings = 7; sc->sc_softc.sc_adapter.adapt_max_periph = 1; Index: sys/arch/acorn32/podulebus/sbic.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/acorn32/podulebus/sbic.c,v retrieving revision 1.16 diff -u -p -r1.16 sbic.c --- sys/arch/acorn32/podulebus/sbic.c 19 Jul 2011 15:59:54 -0000 1.16 +++ sys/arch/acorn32/podulebus/sbic.c 29 Sep 2012 11:43:32 -0000 @@ -349,7 +349,7 @@ sbic_scsi_request(struct scsipi_channel { struct scsipi_xfer *xs; struct sbic_acb *acb; - struct sbic_softc *dev = (void *)chan->chan_adapter->adapt_dev; + struct sbic_softc *dev = device_private(chan->chan_adapter->adapt_dev); struct scsipi_periph *periph; int flags, s, stat; @@ -527,7 +527,7 @@ sbic_scsidone(struct sbic_acb *acb, int xs = acb->xs; periph = xs->xs_periph; - dev = (void *)periph->periph_channel->chan_adapter->adapt_dev; + dev = device_private(periph->periph_channel->chan_adapter->adapt_dev); SBIC_TRACE(dev); #ifdef DIAGNOSTIC if (acb == NULL || xs == NULL) { @@ -586,7 +586,7 @@ sbic_scsidone(struct sbic_acb *acb, int TAILQ_REMOVE(&dev->ready_list, acb, chain); } else { printf("%s: can't find matching acb\n", - device_xname(&dev->sc_dev)); + device_xname(dev->sc_dev)); #ifdef DDB Debugger(); #endif @@ -643,7 +643,7 @@ sbicabort(struct sbic_softc *dev, sbic_r GET_SBIC_csr(regs, csr); printf ("%s: abort %s: csr = 0x%02x, asr = 0x%02x\n", - device_xname(&dev->sc_dev), where, csr, asr); + device_xname(dev->sc_dev), where, csr, asr); #if 0 @@ -665,7 +665,7 @@ sbicabort(struct sbic_softc *dev, sbic_r /* But we don't know what direction it needs to go */ GET_SBIC_data(regs, asr); printf("%s: abort %s: clearing data buffer 0x%02x\n", - device_xname(&dev->sc_dev), where, asr); + device_xname(dev->sc_dev), where, asr); GET_SBIC_asr(regs, asr); /* Not the read direction, then */ if (asr & SBIC_ASR_DBR) @@ -674,7 +674,7 @@ sbicabort(struct sbic_softc *dev, sbic_r } WAIT_CIP(regs); printf("%s: sbicabort - sending ABORT command\n", - device_xname(&dev->sc_dev)); + device_xname(dev->sc_dev)); SET_SBIC_cmd(regs, SBIC_CMD_ABORT); WAIT_CIP(regs); @@ -683,13 +683,13 @@ sbicabort(struct sbic_softc *dev, sbic_r /* ok, get more drastic.. */ printf("%s: sbicabort - asr %x, trying to reset\n", - device_xname(&dev->sc_dev), asr); + device_xname(dev->sc_dev), asr); sbicreset(dev); dev->sc_flags &= ~SBICF_SELECTED; return -1; } printf("%s: sbicabort - sending DISC command\n", - device_xname(&dev->sc_dev)); + device_xname(dev->sc_dev)); SET_SBIC_cmd(regs, SBIC_CMD_DISC); do { @@ -763,7 +763,7 @@ sbicinit(struct sbic_softc *dev) shift_nosync += 8; DBGPRINTF(("%s: Inhibiting synchronous transfer %02x\n", - device_xname(&dev->sc_dev), inhibit_sync), inhibit_sync); + device_xname(dev->sc_dev), inhibit_sync), inhibit_sync); for (i = 0; i < 8; ++i) if (inhibit_sync & (1 << i)) @@ -889,7 +889,7 @@ sbicerror(struct sbic_softc *dev, sbic_r if (dev->sc_nexus->xs->xs_control & XS_CTL_SILENT) return; - printf("%s: ", device_xname(&dev->sc_dev)); + printf("%s: ", device_xname(dev->sc_dev)); printf("csr == 0x%02x\n", csr); /* XXX */ } @@ -1978,7 +1978,7 @@ sbicmsgin(struct sbic_softc *dev) dev->sc_sync[dev->target].period)); printf("%s: target %d now synchronous," " period=%dns, offset=%d.\n", - device_xname(&dev->sc_dev), dev->target, + device_xname(dev->sc_dev), dev->target, dev->sc_msg[3] * 4, dev->sc_msg[4]); } else { @@ -2240,7 +2240,7 @@ sbicnextstate(struct sbic_softc *dev, u_ if (dev->sc_nexus) { DBGPRINTF(("%s: reselect %s with active command\n", - device_xname(&dev->sc_dev), + device_xname(dev->sc_dev), csr == SBIC_CSR_RSLT_NI ? "NI" : "IFY"), reselect_debug > 1); #if defined(DDB) && defined (DEBUG) @@ -2273,7 +2273,7 @@ sbicnextstate(struct sbic_softc *dev, u_ } if (acb == NULL) { printf("%s: reselect %s targ %d not in nexus_list %p\n", - device_xname(&dev->sc_dev), + device_xname(dev->sc_dev), csr == SBIC_CSR_RSLT_NI ? "NI" : "IFY", newtarget, &dev->nexus_list.tqh_first); panic("bad reselect in sbic"); @@ -2379,7 +2379,7 @@ sbictimeout(struct sbic_softc *dev) if (dev->sc_dmatimo) { if (dev->sc_dmatimo > 1) { printf("%s: DMA timeout #%d\n", - device_xname(&dev->sc_dev), dev->sc_dmatimo - 1); + device_xname(dev->sc_dev), dev->sc_dmatimo - 1); GET_SBIC_asr(&dev->sc_sbicp, asr); if (asr & SBIC_ASR_INT) { /* We need to service a missed IRQ */ @@ -2536,7 +2536,7 @@ sbic_dump(struct sbic_softc *dev) GET_SBIC_csr(regs, csr); else csr = 0; - printf("%s@%p regs %p asr %x csr %x\n", device_xname(&dev->sc_dev), + printf("%s@%p regs %p asr %x csr %x\n", device_xname(dev->sc_dev), dev, regs, asr, csr); if ((acb = dev->free_list.tqh_first)) { printf("Free list:\n"); Index: sys/arch/acorn32/podulebus/sfas.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/acorn32/podulebus/sfas.c,v retrieving revision 1.21 diff -u -p -r1.21 sfas.c --- sys/arch/acorn32/podulebus/sfas.c 9 Dec 2010 05:14:48 -0000 1.21 +++ sys/arch/acorn32/podulebus/sfas.c 28 Sep 2012 17:47:47 -0000 @@ -263,7 +263,7 @@ sfas_scsi_request(struct scsipi_channel void *arg) { struct scsipi_xfer *xs; - struct sfas_softc *dev = (void *)chan->chan_adapter->adapt_dev; + struct sfas_softc *dev = device_private(chan->chan_adapter->adapt_dev); struct scsipi_periph *periph; struct sfas_pending *pendp; int flags, s, target; Index: sys/arch/acorn32/podulebus/sfasvar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/acorn32/podulebus/sfasvar.h,v retrieving revision 1.6 diff -u -p -r1.6 sfasvar.h --- sys/arch/acorn32/podulebus/sfasvar.h 14 Mar 2009 14:45:52 -0000 1.6 +++ sys/arch/acorn32/podulebus/sfasvar.h 28 Sep 2012 23:11:50 -0000 @@ -150,7 +150,7 @@ struct nexus { #define SFAS_NF_DEBUG 0x8000 /* As it says: DEBUG */ struct sfas_softc { - struct device sc_dev; /* System required struct */ + device_t sc_dev; /* System required struct */ struct scsipi_channel sc_channel; struct scsipi_adapter sc_adapter; void *sc_ih; Index: sys/arch/algor/algor/autoconf.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/algor/algor/autoconf.c,v retrieving revision 1.21 diff -u -p -r1.21 autoconf.c --- sys/arch/algor/algor/autoconf.c 29 Jul 2012 18:05:39 -0000 1.21 +++ sys/arch/algor/algor/autoconf.c 9 Oct 2012 01:19:01 -0000 @@ -94,9 +94,9 @@ cpu_rootconf(void) #endif void -device_register(struct device *dev, void *aux) +device_register(device_t dev, void *aux) { - struct device *pdev; + device_t pdev; /* * We don't ever know the boot device. But that's because the @@ -117,7 +117,7 @@ device_register(struct device *dev, void if (prop_dictionary_set(device_properties(dev), "mac-address", pd) == false) { printf("WARNING: unable to set mac-addr " - "property for %s\n", dev->dv_xname); + "property for %s\n", device_xname(dev)); } prop_object_release(pd); #if defined(ALGOR_P4032) Index: sys/arch/algor/dev/bonito_mainbus.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/algor/dev/bonito_mainbus.c,v retrieving revision 1.14 diff -u -p -r1.14 bonito_mainbus.c --- sys/arch/algor/dev/bonito_mainbus.c 9 Jul 2011 16:03:01 -0000 1.14 +++ sys/arch/algor/dev/bonito_mainbus.c 26 Sep 2012 22:03:38 -0000 @@ -50,19 +50,18 @@ __KERNEL_RCSID(0, "$NetBSD: bonito_mainb #endif struct bonito_softc { - struct device sc_dev; struct bonito_config *sc_bonito; }; -int bonito_mainbus_match(struct device *, struct cfdata *, void *); -void bonito_mainbus_attach(struct device *, struct device *, void *); +int bonito_mainbus_match(device_t, cfdata_t, void *); +void bonito_mainbus_attach(device_t, device_t, void *); -CFATTACH_DECL(bonito_mainbus, sizeof(struct bonito_softc), +CFATTACH_DECL_NEW(bonito_mainbus, sizeof(struct bonito_softc), bonito_mainbus_match, bonito_mainbus_attach, NULL, NULL); extern struct cfdriver bonito_cd; int -bonito_mainbus_match(struct device *parent, struct cfdata *cf, void *aux) +bonito_mainbus_match(device_t parent, cfdata_t cf, void *aux) { struct mainbus_attach_args *ma = aux; @@ -73,9 +72,9 @@ bonito_mainbus_match(struct device *pare } void -bonito_mainbus_attach(struct device *parent, struct device *self, void *aux) +bonito_mainbus_attach(device_t parent, device_t self, void *aux) { - struct bonito_softc *sc = (void *) self; + struct bonito_softc *sc = device_private(self); struct pcibus_attach_args pba; struct bonito_config *bc; pcireg_t rev; Index: sys/arch/algor/dev/vtpbc_mainbus.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/algor/dev/vtpbc_mainbus.c,v retrieving revision 1.18 diff -u -p -r1.18 vtpbc_mainbus.c --- sys/arch/algor/dev/vtpbc_mainbus.c 9 Jul 2011 16:03:01 -0000 1.18 +++ sys/arch/algor/dev/vtpbc_mainbus.c 26 Sep 2012 22:04:47 -0000 @@ -55,19 +55,18 @@ __KERNEL_RCSID(0, "$NetBSD: vtpbc_mainbu #endif struct vtpbc_softc { - struct device sc_dev; struct vtpbc_config *sc_vtpbc; }; -int vtpbc_mainbus_match(struct device *, struct cfdata *, void *); -void vtpbc_mainbus_attach(struct device *, struct device *, void *); +int vtpbc_mainbus_match(device_t, cfdata_t, void *); +void vtpbc_mainbus_attach(device_t, device_t, void *); -CFATTACH_DECL(vtpbc_mainbus, sizeof(struct vtpbc_softc), +CFATTACH_DECL_NEW(vtpbc_mainbus, sizeof(struct vtpbc_softc), vtpbc_mainbus_match, vtpbc_mainbus_attach, NULL, NULL); extern struct cfdriver vtpbc_cd; int -vtpbc_mainbus_match(struct device *parent, struct cfdata *cf, void *aux) +vtpbc_mainbus_match(device_t parent, cfdata_t cf, void *aux) { struct mainbus_attach_args *ma = aux; @@ -78,9 +77,9 @@ vtpbc_mainbus_match(struct device *paren } void -vtpbc_mainbus_attach(struct device *parent, struct device *self, void *aux) +vtpbc_mainbus_attach(device_t parent, device_t self, void *aux) { - struct vtpbc_softc *sc = (void *) self; + struct vtpbc_softc *sc = device_private(self); struct pcibus_attach_args pba; struct vtpbc_config *vt; @@ -95,9 +94,9 @@ vtpbc_mainbus_attach(struct device *pare else printf(": V3 V962, unknown revision %d\n", vt->vt_rev); - printf("%s: PCI memory space base: 0x%08lx\n", sc->sc_dev.dv_xname, + printf("%s: PCI memory space base: 0x%08lx\n", device_xname(self), (u_long) vt->vt_pci_membase); - printf("%s: PCI DMA window base: 0x%08lx\n", sc->sc_dev.dv_xname, + printf("%s: PCI DMA window base: 0x%08lx\n", device_xname(self), (u_long) vt->vt_dma_winbase); pba.pba_flags = PCI_FLAGS_IO_OKAY | PCI_FLAGS_MEM_OKAY; Index: sys/arch/algor/pci/vtpbc.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/algor/pci/vtpbc.c,v retrieving revision 1.8 diff -u -p -r1.8 vtpbc.c --- sys/arch/algor/pci/vtpbc.c 1 Jul 2011 18:31:32 -0000 1.8 +++ sys/arch/algor/pci/vtpbc.c 29 Sep 2012 10:49:57 -0000 @@ -67,7 +67,7 @@ const char *vtpbc_revs[] = { }; const int vtpbc_nrevs = sizeof(vtpbc_revs) / sizeof(vtpbc_revs[0]); -void vtpbc_attach_hook(struct device *, struct device *, +void vtpbc_attach_hook(device_t, device_t, struct pcibus_attach_args *); int vtpbc_bus_maxdevs(void *, int); pcitag_t vtpbc_make_tag(void *, int, int, int); @@ -128,7 +128,7 @@ vtpbc_init(pci_chipset_tag_t pc, struct } void -vtpbc_attach_hook(struct device *parent, struct device *self, +vtpbc_attach_hook(device_t parent, device_t self, struct pcibus_attach_args *pba) { } Index: sys/arch/alpha/alpha/dec_3000_300.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/alpha/alpha/dec_3000_300.c,v retrieving revision 1.47 diff -u -p -r1.47 dec_3000_300.c --- sys/arch/alpha/alpha/dec_3000_300.c 6 Feb 2012 02:14:10 -0000 1.47 +++ sys/arch/alpha/alpha/dec_3000_300.c 29 Sep 2012 13:12:44 -0000 @@ -185,7 +185,7 @@ dec_3000_300_device_register(device_t de device_is_a(dev, "asc")) { struct tcdsdev_attach_args *ta = aux; - if (parent != (device_t)tcdsdev) + if (parent != tcdsdev) return; if (ta->tcdsda_chip != b->channel) Index: sys/arch/alpha/alpha/dec_3000_500.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/alpha/alpha/dec_3000_500.c,v retrieving revision 1.46 diff -u -p -r1.46 dec_3000_500.c --- sys/arch/alpha/alpha/dec_3000_500.c 6 Feb 2012 02:14:10 -0000 1.46 +++ sys/arch/alpha/alpha/dec_3000_500.c 29 Sep 2012 13:12:33 -0000 @@ -205,7 +205,7 @@ dec_3000_500_device_register(device_t de device_is_a(dev, "asc")) { struct tcdsdev_attach_args *ta = aux; - if (parent != (device_t)tcdsdev) + if (parent != tcdsdev) return; if (ta->tcdsda_chip != b->channel) Index: sys/arch/amiga/amiga/autoconf.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/amiga/amiga/autoconf.c,v retrieving revision 1.113 diff -u -p -r1.113 autoconf.c --- sys/arch/amiga/amiga/autoconf.c 29 Jul 2012 18:05:39 -0000 1.113 +++ sys/arch/amiga/amiga/autoconf.c 9 Oct 2012 02:53:15 -0000 @@ -156,34 +156,52 @@ matchname(const char *fp, const char *sp * always tell the difference betwean the real and console init * by checking for NULL. */ +struct qq { + int q; + int c; +} qq; + int -amiga_config_found(cfdata_t pcfp, device_t pdp, void *auxp, cfprint_t pfn) +amiga_config_found(cfdata_t pcfp, device_t parent, void *aux, cfprint_t pfn) { struct device temp; cfdata_t cf; const struct cfattach *ca; +qq.c++; +qq.q = 0xab01; if (amiga_realconfig) - return(config_found(pdp, auxp, pfn) != NULL); + return(config_found(parent, aux, pfn) != NULL); - if (pdp == NULL) { +qq.q = 0xab02; + if (parent == NULL) { memset(&temp, 0, sizeof temp); - pdp = &temp; + parent = &temp; } - pdp->dv_cfdata = pcfp; - pdp->dv_cfdriver = config_cfdriver_lookup(pcfp->cf_name); - pdp->dv_unit = pcfp->cf_unit; +qq.q = 0xab03; + parent->dv_cfdata = pcfp; +qq.q = 0xab04; + parent->dv_cfdriver = config_cfdriver_lookup(pcfp->cf_name); +qq.q = 0xab05; + parent->dv_unit = pcfp->cf_unit; +qq.q = 0xab06; - if ((cf = config_search_ia(NULL, pdp, NULL, auxp)) != NULL) { + if ((cf = config_search_ia(NULL, parent, NULL, aux)) != NULL) { +qq.q = 0xab07; ca = config_cfattach_lookup(cf->cf_name, cf->cf_atname); +qq.q = 0xab08; if (ca != NULL) { - (*ca->ca_attach)(pdp, NULL, auxp); - pdp->dv_cfdata = NULL; +qq.q = 0xab09; + (*ca->ca_attach)(parent, NULL, aux); +qq.q = 0xab0a; + parent->dv_cfdata = NULL; +qq.q = 0xab0b; return(1); } } - pdp->dv_cfdata = NULL; +qq.q = 0xab0c; + parent->dv_cfdata = NULL; return(0); } @@ -206,18 +224,20 @@ config_console(void) if (cf == NULL) { panic("no mainbus"); } + /* * delay clock calibration. */ amiga_config_found(cf, NULL, __UNCONST("clock"), NULL); - /* * internal grf. */ +qq.q = 0xaa04; #ifdef DRACO if (!(is_draco())) #endif amiga_config_found(cf, NULL, __UNCONST("grfcc"), NULL); +qq.q = 0xaa05; /* * zbus knows when its not for real and will @@ -233,7 +253,7 @@ CFATTACH_DECL_NEW(mainbus, 0, mbmatch, mbattach, NULL, NULL); int -mbmatch(device_t pdp, cfdata_t cfp, void *auxp) +mbmatch(device_t parent, cfdata_t cf, void *aux) { #if 0 /* * XXX is this right? but we need to be found twice @@ -254,52 +274,52 @@ mbmatch(device_t pdp, cfdata_t cfp, void * "find" all the things that should be there. */ void -mbattach(device_t pdp, device_t dp, void *auxp) +mbattach(device_t parent, device_t self, void *aux) { printf("\n"); - config_found(dp, __UNCONST("clock"), simple_devprint); + config_found(self, __UNCONST("clock"), simple_devprint); if (is_a3000() || is_a4000()) { - config_found(dp, __UNCONST("a34kbbc"), simple_devprint); + config_found(self, __UNCONST("a34kbbc"), simple_devprint); } else #ifdef DRACO if (!is_draco()) #endif { - config_found(dp, __UNCONST("a2kbbc"), simple_devprint); + config_found(self, __UNCONST("a2kbbc"), simple_devprint); } #ifdef DRACO if (is_draco()) { - config_found(dp, __UNCONST("drbbc"), simple_devprint); - config_found(dp, __UNCONST("kbd"), simple_devprint); - config_found(dp, __UNCONST("drsc"), simple_devprint); - config_found(dp, __UNCONST("drsupio"), simple_devprint); + config_found(self, __UNCONST("drbbc"), simple_devprint); + config_found(self, __UNCONST("kbd"), simple_devprint); + config_found(self, __UNCONST("drsc"), simple_devprint); + config_found(self, __UNCONST("drsupio"), simple_devprint); } else #endif { - config_found(dp, __UNCONST("ser"), simple_devprint); - config_found(dp, __UNCONST("par"), simple_devprint); - config_found(dp, __UNCONST("kbd"), simple_devprint); - config_found(dp, __UNCONST("ms"), simple_devprint); - config_found(dp, __UNCONST("grfcc"), simple_devprint); - config_found(dp, __UNCONST("amidisplaycc"), simple_devprint); - config_found(dp, __UNCONST("fdc"), simple_devprint); + config_found(self, __UNCONST("ser"), simple_devprint); + config_found(self, __UNCONST("par"), simple_devprint); + config_found(self, __UNCONST("kbd"), simple_devprint); + config_found(self, __UNCONST("ms"), simple_devprint); + config_found(self, __UNCONST("grfcc"), simple_devprint); + config_found(self, __UNCONST("amidisplaycc"), simple_devprint); + config_found(self, __UNCONST("fdc"), simple_devprint); } if (is_a4000() || is_a1200() || is_a600()) - config_found(dp, __UNCONST("wdc"), simple_devprint); + config_found(self, __UNCONST("wdc"), simple_devprint); if (is_a4000()) /* Try to configure A4000T SCSI */ - config_found(dp, __UNCONST("afsc"), simple_devprint); + config_found(self, __UNCONST("afsc"), simple_devprint); if (is_a3000()) - config_found(dp, __UNCONST("ahsc"), simple_devprint); + config_found(self, __UNCONST("ahsc"), simple_devprint); if (is_a600() || is_a1200()) - config_found(dp, __UNCONST("pccard"), simple_devprint); + config_found(self, __UNCONST("pccard"), simple_devprint); if (is_a1200()) - config_found(dp, __UNCONST("a1k2cp"), simple_devprint); + config_found(self, __UNCONST("a1k2cp"), simple_devprint); #ifdef DRACO if (!is_draco()) #endif - config_found(dp, __UNCONST("aucc"), simple_devprint); + config_found(self, __UNCONST("aucc"), simple_devprint); - config_found(dp, __UNCONST("zbus"), simple_devprint); + config_found(self, __UNCONST("zbus"), simple_devprint); } int @@ -388,7 +408,7 @@ findroot(void) * Find the disk corresponding to the current * device. */ - devs = (device_t *)sd_cd.cd_devs; + devs = sd_cd.cd_devs; if ((dkp = disk_find(device_xname(device_lookup(&sd_cd, unit)))) == NULL) continue; @@ -589,4 +609,3 @@ device_register(device_t dev, void *aux) p5pb_device_register(dev, aux); #endif /* P5PB_CONSOLE */ } - Index: sys/arch/amiga/amiga/device.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/amiga/amiga/device.h,v retrieving revision 1.13 diff -u -p -r1.13 device.h --- sys/arch/amiga/amiga/device.h 9 Feb 2010 18:13:09 -0000 1.13 +++ sys/arch/amiga/amiga/device.h 1 Oct 2012 16:57:15 -0000 @@ -38,7 +38,7 @@ * passed in some cases and the devices will deal with it) */ void config_console(void); -int amiga_config_found(struct cfdata *, struct device *, void *, cfprint_t ); +int amiga_config_found(cfdata_t, device_t, void *, cfprint_t); int simple_devprint(void *, const char *); int matchname(const char *, const char *); /* Index: sys/arch/amiga/clockport/a1k2cp.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/amiga/clockport/a1k2cp.c,v retrieving revision 1.2 diff -u -p -r1.2 a1k2cp.c --- sys/arch/amiga/clockport/a1k2cp.c 28 Jun 2012 18:55:03 -0000 1.2 +++ sys/arch/amiga/clockport/a1k2cp.c 29 Sep 2012 10:51:37 -0000 @@ -52,8 +52,8 @@ #define A1K2CP_BASE 0xD80001 -static int a1k2cp_match(struct device *pdp, struct cfdata *cfp, void *aux); -static void a1k2cp_attach(device_t parent, device_t self, void *aux); +static int a1k2cp_match(device_t, cfdata_t, void *); +static void a1k2cp_attach(device_t, device_t, void *); struct a1k2cp_softc { device_t sc_dev; @@ -63,7 +63,7 @@ CFATTACH_DECL_NEW(a1k2cp, sizeof(struct a1k2cp_match, a1k2cp_attach, NULL, NULL); static int -a1k2cp_match(struct device *pdp, struct cfdata *cfp, void *aux) +a1k2cp_match(device_t parent, cfdata_t cf, void *aux) { static int a1k2cp_matched = 0; @@ -106,4 +106,3 @@ a1k2cp_attach(device_t parent, device_t config_found(sc->sc_dev, &a1k2cp_aa, 0); } - Index: sys/arch/amiga/clockport/clockport.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/amiga/clockport/clockport.c,v retrieving revision 1.3 diff -u -p -r1.3 clockport.c --- sys/arch/amiga/clockport/clockport.c 28 Jun 2012 18:55:03 -0000 1.3 +++ sys/arch/amiga/clockport/clockport.c 29 Sep 2012 13:44:13 -0000 @@ -42,10 +42,8 @@ static int clockport_match(device_t, cfdata_t , void *); static void clockport_attach(device_t, device_t, void *); -static int clockport_print(struct clockport_attach_args *a, - const char *str); -static int clockport_submatch(device_t cpbus, cfdata_t dev, - const int *ldesc, void *aux); +static int clockport_print(void *, const char *); +static int clockport_submatch(device_t, cfdata_t, const int *, void *); CFATTACH_DECL_NEW(clockport, sizeof(struct clockportbus_softc), clockport_match, clockport_attach, NULL, NULL); @@ -70,19 +68,19 @@ clockport_attach(device_t parent, device } static int -clockport_submatch(device_t cpbus, cfdata_t dev, const int *ldesc, void *aux) +clockport_submatch(device_t parent, cfdata_t cf, const int *ldesc, void *aux) { struct clockportbus_softc *sc; struct clockport_attach_args a; - sc = device_private(cpbus); + sc = device_private(parent); /* XXX: copy bus_space_tag and intr routine for now... */ a.cp_iot = sc->cpb_aa->cp_iot; a.cp_intr_establish = sc->cpb_aa->cp_intr_establish; - if(config_match(cpbus, dev, &a)) { - config_attach(cpbus, dev, &a, (cfprint_t) clockport_print); + if (config_match(parent, cf, &a)) { + config_attach(parent, cf, &a, clockport_print); return 1; } @@ -90,8 +88,9 @@ clockport_submatch(device_t cpbus, cfdat } static int -clockport_print(struct clockport_attach_args *a, const char *str) +clockport_print(void *aux, const char *str) { + if (str == NULL) return 0; @@ -99,4 +98,3 @@ clockport_print(struct clockport_attach_ return 0; } - Index: sys/arch/amiga/clockport/gencp_xsurf.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/amiga/clockport/gencp_xsurf.c,v retrieving revision 1.1 diff -u -p -r1.1 gencp_xsurf.c --- sys/arch/amiga/clockport/gencp_xsurf.c 15 May 2012 17:35:43 -0000 1.1 +++ sys/arch/amiga/clockport/gencp_xsurf.c 29 Sep 2012 10:51:02 -0000 @@ -49,19 +49,19 @@ #include -static int gencp_xsurf_match(struct device *pdp, struct cfdata *cfp, void *aux); -static void gencp_xsurf_attach(device_t parent, device_t self, void *aux); +static int gencp_xsurf_match(device_t, cfdata_t, void *); +static void gencp_xsurf_attach(device_t, device_t, void *); CFATTACH_DECL_NEW(gencp_xsurf, sizeof(struct gencp_softc), gencp_xsurf_match, gencp_xsurf_attach, NULL, NULL); static int -gencp_xsurf_match(struct device *pdp, struct cfdata *cfp, void *aux) +gencp_xsurf_match(device_t parent, cfdata_t cf, void *aux) { struct xsurfbus_attach_args *xsb_aa; static int attach_count = 0; - xsb_aa = (struct xsurfbus_attach_args *) aux; + xsb_aa = aux; if (strcmp(xsb_aa->xaa_name, "gencp_xsurf") != 0) return 0; @@ -83,7 +83,7 @@ gencp_xsurf_attach(device_t parent, devi struct clockportbus_attach_args cpb_aa; struct xsurfbus_attach_args *xsb_aa; - xsb_aa = (struct xsurfbus_attach_args *) aux; + xsb_aa = aux; sc = device_private(self); sc->sc_dev = self; sc->cpb_aa = &cpb_aa; @@ -96,4 +96,3 @@ gencp_xsurf_attach(device_t parent, devi gencp_attach(sc); } - Index: sys/arch/amiga/dev/a2kbbc.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/amiga/dev/a2kbbc.c,v retrieving revision 1.23 diff -u -p -r1.23 a2kbbc.c --- sys/arch/amiga/dev/a2kbbc.c 3 Jun 2011 00:52:22 -0000 1.23 +++ sys/arch/amiga/dev/a2kbbc.c 29 Sep 2012 11:06:39 -0000 @@ -67,12 +67,12 @@ int a2kusettod(todr_chip_handle_t, struc static struct todr_chip_handle a2ktodr; int -a2kbbc_match(device_t pdp, cfdata_t cfp, void *auxp) +a2kbbc_match(device_t parent, cfdata_t cf, void *aux) { struct clock_ymdhms dt; static int a2kbbc_matched = 0; - if (!matchname("a2kbbc", auxp)) + if (!matchname("a2kbbc", aux)) return (0); /* Allow only one instance. */ @@ -98,7 +98,7 @@ a2kbbc_match(device_t pdp, cfdata_t cfp, * Attach us to the rtc function pointers. */ void -a2kbbc_attach(device_t pdp, device_t dp, void *auxp) +a2kbbc_attach(device_t parent, device_t self, void *aux) { printf("\n"); a2kclockaddr = (void *)__UNVOLATILE(ztwomap(0xdc0000)); Index: sys/arch/amiga/dev/a34kbbc.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/amiga/dev/a34kbbc.c,v retrieving revision 1.22 diff -u -p -r1.22 a34kbbc.c --- sys/arch/amiga/dev/a34kbbc.c 3 Jun 2011 00:52:22 -0000 1.22 +++ sys/arch/amiga/dev/a34kbbc.c 29 Sep 2012 11:06:15 -0000 @@ -67,12 +67,12 @@ int a34kusettod(todr_chip_handle_t, stru static struct todr_chip_handle a34ktodr; int -a34kbbc_match(device_t pdp, cfdata_t cfp, void *auxp) +a34kbbc_match(device_t parent, cfdata_t cf, void *aux) { struct clock_ymdhms dt; static int a34kbbc_matched = 0; - if (!matchname("a34kbbc", auxp)) + if (!matchname("a34kbbc", aux)) return(0); /* Allow only one instance. */ @@ -94,7 +94,7 @@ a34kbbc_match(device_t pdp, cfdata_t cfp * Attach us to the rtc function pointers. */ void -a34kbbc_attach(device_t pdp, device_t dp, void *auxp) +a34kbbc_attach(device_t parent, device_t self, void *aux) { printf("\n"); a34kclockaddr = (void *)__UNVOLATILE(ztwomap(0xdc0000)); Index: sys/arch/amiga/dev/afsc.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/amiga/dev/afsc.c,v retrieving revision 1.43 diff -u -p -r1.43 afsc.c --- sys/arch/amiga/dev/afsc.c 20 Dec 2010 00:25:25 -0000 1.43 +++ sys/arch/amiga/dev/afsc.c 28 Sep 2012 05:15:27 -0000 @@ -81,8 +81,8 @@ __KERNEL_RCSID(0, "$NetBSD: afsc.c,v 1.4 #define badaddr(a) badaddr_read(a, 2, NULL) #endif -void afscattach(struct device *, struct device *, void *); -int afscmatch(struct device *, struct cfdata *, void *); +void afscattach(device_t, device_t, void *); +int afscmatch(device_t, cfdata_t, void *); int afsc_dmaintr(void *); #ifdef DEBUG void afsc_dump(void); @@ -92,17 +92,17 @@ void afsc_dump(void); #ifdef DEBUG #endif -CFATTACH_DECL(afsc, sizeof(struct siop_softc), +CFATTACH_DECL_NEW(afsc, sizeof(struct siop_softc), afscmatch, afscattach, NULL, NULL); -CFATTACH_DECL(aftsc, sizeof(struct siop_softc), +CFATTACH_DECL_NEW(aftsc, sizeof(struct siop_softc), afscmatch, afscattach, NULL, NULL); /* * if we are a Commodore Amiga A4091 or possibly an A4000T */ int -afscmatch(struct device *pdp, struct cfdata *cfp, void *auxp) +afscmatch(device_t parent, cfdata_t cf, void *auxp) { struct zbus_args *zap; siop_regmap_p rp; @@ -132,9 +132,9 @@ afscmatch(struct device *pdp, struct cfd } void -afscattach(struct device *pdp, struct device *dp, void *auxp) +afscattach(device_t parent, device_t self, void *auxp) { - struct siop_softc *sc = (struct siop_softc *)dp; + struct siop_softc *sc = device_private(self); struct zbus_args *zap; siop_regmap_p rp; struct scsipi_adapter *adapt = &sc->sc_adapter; @@ -142,6 +142,7 @@ afscattach(struct device *pdp, struct de printf("\n"); + sc->sc_dev = self; zap = auxp; if (zap->manid == 514 && zap->prodid == 84) @@ -161,7 +162,7 @@ afscattach(struct device *pdp, struct de * Fill in the scsipi_adapter. */ memset(adapt, 0, sizeof(*adapt)); - adapt->adapt_dev = &sc->sc_dev; + adapt->adapt_dev = self; adapt->adapt_nchannels = 1; adapt->adapt_openings = 7; adapt->adapt_max_periph = 1; @@ -189,7 +190,7 @@ afscattach(struct device *pdp, struct de /* * attach all scsi units on us */ - config_found(dp, chan, scsiprint); + config_found(self, chan, scsiprint); } int Index: sys/arch/amiga/dev/ahsc.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/amiga/dev/ahsc.c,v retrieving revision 1.37 diff -u -p -r1.37 ahsc.c --- sys/arch/amiga/dev/ahsc.c 5 Feb 2010 12:13:36 -0000 1.37 +++ sys/arch/amiga/dev/ahsc.c 9 Oct 2012 01:19:20 -0000 @@ -88,8 +88,8 @@ __KERNEL_RCSID(0, "$NetBSD: ahsc.c,v 1.3 #include -void ahscattach(struct device *, struct device *, void *); -int ahscmatch(struct device *, struct cfdata *, void *); +void ahscattach(device_t, device_t, void *); +int ahscmatch(device_t, cfdata_t, void *); void ahsc_enintr(struct sbic_softc *); void ahsc_dmastop(struct sbic_softc *); @@ -105,14 +105,14 @@ void ahsc_dump(void); int ahsc_dmadebug = 0; #endif -CFATTACH_DECL(ahsc, sizeof(struct sbic_softc), +CFATTACH_DECL_NEW(ahsc, sizeof(struct sbic_softc), ahscmatch, ahscattach, NULL, NULL); /* * if we are an A3000 we are here. */ int -ahscmatch(struct device *pdp, struct cfdata *cfp, void *auxp) +ahscmatch(device_t parent, cfdata_t cf, void *auxp) { char *mbusstr; @@ -123,14 +123,16 @@ ahscmatch(struct device *pdp, struct cfd } void -ahscattach(struct device *pdp, struct device *dp, void *auxp) +ahscattach(device_t parent, device_t self, void *auxp) { volatile struct sdmac *rp; - struct sbic_softc *sc = (struct sbic_softc *)dp; + struct sbic_softc *sc = device_private(self); struct cfdev *cdp, *ecdp; struct scsipi_adapter *adapt = &sc->sc_adapter; struct scsipi_channel *chan = &sc->sc_channel; + sc->sc_dev = self; + ecdp = &cfdev[ncfdev]; for (cdp = cfdev; cdp < ecdp; cdp++) { @@ -174,7 +176,7 @@ ahscattach(struct device *pdp, struct de * Fill in the scsipi_adapter. */ memset(adapt, 0, sizeof(*adapt)); - adapt->adapt_dev = &sc->sc_dev; + adapt->adapt_dev = self; adapt->adapt_nchannels = 1; adapt->adapt_openings = 7; adapt->adapt_max_periph = 1; @@ -202,7 +204,7 @@ ahscattach(struct device *pdp, struct de /* * attach all scsi units on us */ - config_found(dp, chan, scsiprint); + config_found(self, chan, scsiprint); } void @@ -300,7 +302,7 @@ ahsc_dmaintr(void *arg) #ifdef DEBUG if (ahsc_dmadebug & DDB_FOLLOW) - printf("%s: dmaintr 0x%x\n", dev->sc_dev.dv_xname, stat); + printf("%s: dmaintr 0x%x\n", device_xname(dev->sc_dev), stat); #endif /* Index: sys/arch/amiga/dev/amidisplaycc.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/amiga/dev/amidisplaycc.c,v retrieving revision 1.25 diff -u -p -r1.25 amidisplaycc.c --- sys/arch/amiga/dev/amidisplaycc.c 11 Jan 2012 21:14:33 -0000 1.25 +++ sys/arch/amiga/dev/amidisplaycc.c 28 Sep 2012 17:39:29 -0000 @@ -77,8 +77,6 @@ __KERNEL_RCSID(0, "$NetBSD: amidisplaycc struct amidisplaycc_screen; struct amidisplaycc_softc { - struct device dev; - struct amidisplaycc_screen * currentscreen; /* display turned on? */ @@ -97,10 +95,10 @@ struct amidisplaycc_softc * Configuration stuff. */ -static int amidisplaycc_match(struct device *, struct cfdata *, void *); -static void amidisplaycc_attach(struct device *, struct device *, void *); +static int amidisplaycc_match(device_t, cfdata_t, void *); +static void amidisplaycc_attach(device_t, device_t, void *); -CFATTACH_DECL(amidisplaycc, sizeof(struct amidisplaycc_softc), +CFATTACH_DECL_NEW(amidisplaycc, sizeof(struct amidisplaycc_softc), amidisplaycc_match, amidisplaycc_attach, NULL, NULL); static int amidisplaycc_attached; @@ -405,7 +403,7 @@ amidisplaycc_cninit(struct consdev * cd } static int -amidisplaycc_match(struct device *pdp, struct cfdata *cfp, void *auxp) +amidisplaycc_match(device_t parent, cfdata_t cf, void *auxp) { char *name = auxp; @@ -421,14 +419,14 @@ amidisplaycc_match(struct device *pdp, s /* ARGSUSED */ static void -amidisplaycc_attach(struct device *pdp, struct device *dp, void *auxp) +amidisplaycc_attach(device_t parent, device_t self, void *auxp) { struct wsemuldisplaydev_attach_args waa; struct amidisplaycc_softc * adp; amidisplaycc_attached = 1; - adp = (struct amidisplaycc_softc*)dp; + adp = device_private(self); grfcc_probe(); @@ -477,8 +475,8 @@ amidisplaycc_attach(struct device *pdp, waa.scrdata = &amidisplaycc_screenlist; waa.console = amidisplaycc_consolescreen.isconsole; waa.accessops = &amidisplaycc_accessops; - waa.accesscookie = dp; - config_found(dp, &waa, wsemuldisplaydevprint); + waa.accesscookie = adp; + config_found(self, &waa, wsemuldisplaydevprint); wsfont_init(); } Index: sys/arch/amiga/dev/aster.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/amiga/dev/aster.c,v retrieving revision 1.22 diff -u -p -r1.22 aster.c --- sys/arch/amiga/dev/aster.c 19 Jul 2011 15:55:26 -0000 1.22 +++ sys/arch/amiga/dev/aster.c 2 Oct 2012 03:08:06 -0000 @@ -38,8 +38,8 @@ __KERNEL_RCSID(0, "$NetBSD: aster.c,v 1. #include -#include #include +#include #include #include #include @@ -54,19 +54,18 @@ __KERNEL_RCSID(0, "$NetBSD: aster.c,v 1. struct aster_softc { - struct device sc_dev; struct bus_space_tag sc_bst; }; -int astermatch(struct device *, struct cfdata *, void *); -void asterattach(struct device *, struct device *, void *); +int astermatch(device_t, cfdata_t, void *); +void asterattach(device_t, device_t, void *); int asterprint(void *auxp, const char *); -CFATTACH_DECL(aster, sizeof(struct aster_softc), +CFATTACH_DECL_NEW(aster, sizeof(struct aster_softc), astermatch, asterattach, NULL, NULL); int -astermatch(struct device *parent, struct cfdata *cfp, void *auxp) +astermatch(device_t parent, cfdata_t cf, void *auxp) { struct zbus_args *zap; @@ -93,13 +92,13 @@ astermatch(struct device *parent, struct } void -asterattach(struct device *parent, struct device *self, void *auxp) +asterattach(device_t parent, device_t self, void *auxp) { struct aster_softc *astrsc; struct zbus_args *zap; struct supio_attach_args supa; - astrsc = (struct aster_softc *)self; + astrsc = device_private(self); zap = auxp; astrsc->sc_bst.base = (u_long)zap->va + 0; Index: sys/arch/amiga/dev/atzsc.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/amiga/dev/atzsc.c,v retrieving revision 1.42 diff -u -p -r1.42 atzsc.c --- sys/arch/amiga/dev/atzsc.c 9 Feb 2010 18:13:10 -0000 1.42 +++ sys/arch/amiga/dev/atzsc.c 29 Sep 2012 11:52:38 -0000 @@ -87,8 +87,8 @@ __KERNEL_RCSID(0, "$NetBSD: atzsc.c,v 1. #include #include -void atzscattach(struct device *, struct device *, void *); -int atzscmatch(struct device *, struct cfdata *, void *); +void atzscattach(device_t, device_t, void *); +int atzscmatch(device_t, cfdata_t, void *); void atzsc_enintr(struct sbic_softc *); void atzsc_dmastop(struct sbic_softc *); @@ -104,14 +104,14 @@ void atzsc_dump(void); int atzsc_dmadebug = 0; #endif -CFATTACH_DECL(atzsc, sizeof(struct sbic_softc), +CFATTACH_DECL_NEW(atzsc, sizeof(struct sbic_softc), atzscmatch, atzscattach, NULL, NULL); /* * if we are a A2091 SCSI */ int -atzscmatch(struct device *pdp, struct cfdata *cfp, void *auxp) +atzscmatch(device_t parent, cfdata_t cf, void *auxp) { struct zbus_args *zap; @@ -128,16 +128,17 @@ atzscmatch(struct device *pdp, struct cf } void -atzscattach(struct device *pdp, struct device *dp, void *auxp) +atzscattach(device_t parent, device_t self, void *auxp) { volatile struct sdmac *rp; - struct sbic_softc *sc = (struct sbic_softc *)dp; + struct sbic_softc *sc = device_private(self); struct zbus_args *zap; struct scsipi_adapter *adapt = &sc->sc_adapter; struct scsipi_channel *chan = &sc->sc_channel; zap = auxp; + sc->sc_dev = self; sc->sc_cregs = rp = zap->va; /* * disable ints and reset bank register @@ -182,7 +183,7 @@ atzscattach(struct device *pdp, struct d * Fill in the scsipi_adapter. */ memset(adapt, 0, sizeof(*adapt)); - adapt->adapt_dev = &sc->sc_dev; + adapt->adapt_dev = self; adapt->adapt_nchannels = 1; adapt->adapt_openings = 7; adapt->adapt_max_periph = 1; @@ -210,7 +211,7 @@ atzscattach(struct device *pdp, struct d /* * attach all scsi units on us */ - config_found(dp, chan, scsiprint); + config_found(self, chan, scsiprint); } void @@ -307,7 +308,7 @@ atzsc_dmaintr(void *arg) #ifdef DEBUG if (atzsc_dmadebug & DDB_FOLLOW) - printf("%s: dmaintr 0x%x\n", dev->sc_dev.dv_xname, stat); + printf("%s: dmaintr 0x%x\n", device_xname(dev->sc_dev), stat); #endif /* Index: sys/arch/amiga/dev/aucc.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/amiga/dev/aucc.c,v retrieving revision 1.41 diff -u -p -r1.41 aucc.c --- sys/arch/amiga/dev/aucc.c 23 Nov 2011 23:07:28 -0000 1.41 +++ sys/arch/amiga/dev/aucc.c 29 Sep 2012 10:52:37 -0000 @@ -103,8 +103,6 @@ extern struct audio_channel channel[4]; * Software state. */ struct aucc_softc { - struct device sc_dev; /* base device */ - int sc_open; /* single use device */ aucc_data_t sc_channel[4]; /* per channel freq, ... */ u_int sc_encoding; /* encoding AUDIO_ENCODING_.*/ @@ -130,10 +128,10 @@ static u_int freqtoper(u_int); static u_int pertofreq(u_int); /* autoconfiguration driver */ -void auccattach(struct device *, struct device *, void *); -int auccmatch(struct device *, struct cfdata *, void *); +void auccattach(device_t, device_t, void *); +int auccmatch(device_t, cfdata_t, void *); -CFATTACH_DECL(aucc, sizeof(struct aucc_softc), +CFATTACH_DECL_NEW(aucc, sizeof(struct aucc_softc), auccmatch, auccattach, NULL, NULL); struct audio_device aucc_device = { @@ -266,7 +264,7 @@ const struct audio_hw_if sa_hw_if = { /* autoconfig routines */ int -auccmatch(struct device *pdp, struct cfdata *cfp, void *aux) +auccmatch(device_t parent, cfdata_t cf, void *aux) { static int aucc_matched = 0; @@ -285,12 +283,12 @@ auccmatch(struct device *pdp, struct cfd * Audio chip found. */ void -auccattach(struct device *parent, struct device *self, void *args) +auccattach(device_t parent, device_t self, void *args) { struct aucc_softc *sc; int i; - sc = (struct aucc_softc *)self; + sc = device_private(self); printf("\n"); if ((i=init_aucc(sc))) { @@ -298,7 +296,7 @@ auccattach(struct device *parent, struct return; } - audio_attach_mi(&sa_hw_if, sc, &sc->sc_dev); + audio_attach_mi(&sa_hw_if, sc, self); } Index: sys/arch/amiga/dev/bppcsc.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/amiga/dev/bppcsc.c,v retrieving revision 1.2 diff -u -p -r1.2 bppcsc.c --- sys/arch/amiga/dev/bppcsc.c 10 Jan 2012 20:29:50 -0000 1.2 +++ sys/arch/amiga/dev/bppcsc.c 28 Sep 2012 14:53:49 -0000 @@ -84,25 +84,25 @@ __KERNEL_RCSID(0, "$NetBSD: bppcsc.c,v 1 #define BPPC_SCSI_OFF 0xf40000 #define BPPC_PUPROM_OFF 0xf00010 -void bppcscattach(struct device *, struct device *, void *); -int bppcscmatch(struct device *, struct cfdata *, void *); +void bppcscattach(device_t, device_t, void *); +int bppcscmatch(device_t, cfdata_t, void *); int bppcsc_dmaintr(void *); #ifdef DEBUG void bppcsc_dump(void); #endif -CFATTACH_DECL(bppcsc, sizeof(struct siop_softc), +CFATTACH_DECL_NEW(bppcsc, sizeof(struct siop_softc), bppcscmatch, bppcscattach, NULL, NULL); /* * if we are a Phase5 BlizzardPPC 603e+ */ int -bppcscmatch(struct device *pdp, struct cfdata *cfp, void *auxp) +bppcscmatch(device_t parent, cfdata_t cf, void *auxp) { struct p5bus_attach_args *p5baa; - p5baa = (struct p5bus_attach_args *) auxp; + p5baa = auxp; if (strcmp(p5baa->p5baa_name, "bppcsc") == 0) return 1; @@ -111,14 +111,15 @@ bppcscmatch(struct device *pdp, struct c } void -bppcscattach(struct device *pdp, struct device *dp, void *auxp) +bppcscattach(device_t parent, device_t self, void *auxp) { struct siop_softc *sc; struct scsipi_adapter *adapt; struct scsipi_channel *chan; siop_regmap_p rp; - sc = (struct siop_softc *)dp; + sc = device_private(self); + sc->sc_dev = self; adapt = &sc->sc_adapter; chan = &sc->sc_channel; @@ -140,7 +141,7 @@ bppcscattach(struct device *pdp, struct * Fill in the scsipi_adapter. */ memset(adapt, 0, sizeof(*adapt)); - adapt->adapt_dev = &sc->sc_dev; + adapt->adapt_dev = self; adapt->adapt_nchannels = 1; adapt->adapt_openings = 7; adapt->adapt_max_periph = 1; @@ -168,7 +169,7 @@ bppcscattach(struct device *pdp, struct /* * attach all scsi units on us */ - config_found(dp, chan, scsiprint); + config_found(self, chan, scsiprint); } int Index: sys/arch/amiga/dev/cbiiisc.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/amiga/dev/cbiiisc.c,v retrieving revision 1.20 diff -u -p -r1.20 cbiiisc.c --- sys/arch/amiga/dev/cbiiisc.c 10 Jan 2012 20:29:50 -0000 1.20 +++ sys/arch/amiga/dev/cbiiisc.c 28 Sep 2012 05:15:50 -0000 @@ -81,8 +81,8 @@ __KERNEL_RCSID(0, "$NetBSD: cbiiisc.c,v #include #include -void cbiiiscattach(struct device *, struct device *, void *); -int cbiiiscmatch(struct device *, struct cfdata *, void *); +void cbiiiscattach(device_t, device_t, void *); +int cbiiiscmatch(device_t, cfdata_t, void *); int cbiiisc_dmaintr(void *); #ifdef DEBUG void cbiiisc_dump(void); @@ -91,18 +91,18 @@ void cbiiisc_dump(void); #ifdef DEBUG #endif -CFATTACH_DECL(cbiiisc, sizeof(struct siop_softc), +CFATTACH_DECL_NEW(cbiiisc, sizeof(struct siop_softc), cbiiiscmatch, cbiiiscattach, NULL, NULL); /* * if we are a CyberStorm MK III SCSI */ int -cbiiiscmatch(struct device *pdp, struct cfdata *cfp, void *auxp) +cbiiiscmatch(device_t parent, cfdata_t cf, void *auxp) { struct p5bus_attach_args *p5baa; - p5baa = (struct p5bus_attach_args *) auxp; + p5baa = auxp; if (strcmp(p5baa->p5baa_name, "cbiiisc") == 0) return 1; @@ -111,15 +111,16 @@ cbiiiscmatch(struct device *pdp, struct } void -cbiiiscattach(struct device *pdp, struct device *dp, void *auxp) +cbiiiscattach(device_t parent, device_t self, void *auxp) { - struct siop_softc *sc = (struct siop_softc *)dp; + struct siop_softc *sc = device_private(self); siop_regmap_p rp; struct scsipi_adapter *adapt = &sc->sc_adapter; struct scsipi_channel *chan = &sc->sc_channel; aprint_normal(": CyberStorm PPC/Mk-III SCSI host adapter\n"); + sc->sc_dev = self; sc->sc_siopp = rp = ztwomap(0xf40000); /* siopng_dump_registers(sc); */ @@ -134,7 +135,7 @@ cbiiiscattach(struct device *pdp, struct * Fill in the scsipi_adapter. */ memset(adapt, 0, sizeof(*adapt)); - adapt->adapt_dev = &sc->sc_dev; + adapt->adapt_dev = self; adapt->adapt_nchannels = 1; adapt->adapt_openings = 7; adapt->adapt_max_periph = 1; @@ -165,7 +166,7 @@ cbiiiscattach(struct device *pdp, struct /* * attach all scsi units on us */ - config_found(dp, chan, scsiprint); + config_found(self, chan, scsiprint); } int Index: sys/arch/amiga/dev/clock.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/amiga/dev/clock.c,v retrieving revision 1.53 diff -u -p -r1.53 clock.c --- sys/arch/amiga/dev/clock.c 3 Jun 2011 00:52:22 -0000 1.53 +++ sys/arch/amiga/dev/clock.c 29 Sep 2012 11:05:52 -0000 @@ -107,9 +107,9 @@ CFATTACH_DECL_NEW(clock, 0, clockmatch, clockattach, NULL, NULL); int -clockmatch(device_t pdp, cfdata_t cfp, void *auxp) +clockmatch(device_t parent, cfdata_t cf, void *aux) { - if (matchname("clock", auxp)) + if (matchname("clock", aux)) return(1); return(0); } @@ -118,7 +118,7 @@ clockmatch(device_t pdp, cfdata_t cfp, v * Start the real-time clock. */ void -clockattach(device_t pdp, device_t dp, void *auxp) +clockattach(device_t parent, device_t self, void *aux) { const char *clockchip; unsigned short interval; @@ -149,7 +149,7 @@ clockattach(device_t pdp, device_t dp, v amiga_clk_interval = chipfreq / hz; - if (dp != NULL) { /* real autoconfig? */ + if (self != NULL) { /* real autoconfig? */ printf(": %s system hz %d hardware hz %d\n", clockchip, hz, chipfreq); @@ -168,7 +168,7 @@ clockattach(device_t pdp, device_t dp, v draco_ioct->io_timerlo = amiga_clk_interval & 0xff; draco_ioct->io_timerhi = amiga_clk_interval >> 8; - calibrate_delay(dp); + calibrate_delay(self); return; } @@ -196,7 +196,7 @@ clockattach(device_t pdp, device_t dp, v */ clockcia->cra = (clockcia->cra & 0xc0) | 1; - calibrate_delay(dp); + calibrate_delay(self); } void @@ -326,13 +326,13 @@ clk_getcounter(struct timecounter *tc) * off by 2.4% */ static void -calibrate_delay(device_t dp) +calibrate_delay(device_t self) { unsigned long t1, t2; extern u_int32_t delaydivisor; /* XXX this should be defined elsewhere */ - if (dp) + if (self) printf("Calibrating delay loop... "); do { @@ -343,7 +343,7 @@ calibrate_delay(device_t dp) t2 = ((t2 - t1) * 1000000) / (amiga_clk_interval * hz); delaydivisor = (delaydivisor * t2 + 1023) >> 10; #ifdef DEBUG - if (dp) + if (self) printf("\ndiff %ld us, new divisor %u/1024 us\n", t2, delaydivisor); do { @@ -353,7 +353,7 @@ calibrate_delay(device_t dp) } while (t2 <= t1); t2 = ((t2 - t1) * 1000000) / (amiga_clk_interval * hz); delaydivisor = (delaydivisor * t2 + 1023) >> 10; - if (dp) + if (self) printf("diff %ld us, new divisor %u/1024 us\n", t2, delaydivisor); #endif @@ -365,10 +365,10 @@ calibrate_delay(device_t dp) t2 = ((t2 - t1) * 1000000) / (amiga_clk_interval * hz); delaydivisor = (delaydivisor * t2 + 1023) >> 10; #ifdef DEBUG - if (dp) + if (self) printf("diff %ld us, new divisor ", t2); #endif - if (dp) + if (self) printf("%u/1024 us\n", delaydivisor); } Index: sys/arch/amiga/dev/drbbc.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/amiga/dev/drbbc.c,v retrieving revision 1.19 diff -u -p -r1.19 drbbc.c --- sys/arch/amiga/dev/drbbc.c 20 Dec 2010 00:25:25 -0000 1.19 +++ sys/arch/amiga/dev/drbbc.c 28 Sep 2012 05:12:57 -0000 @@ -54,25 +54,24 @@ int draco_ds_read_bit(void *); void draco_ds_write_bit(void *, int); void draco_ds_reset(void *); -void drbbc_attach(struct device *, struct device *, void *); -int drbbc_match(struct device *, struct cfdata *, void *); +void drbbc_attach(device_t, device_t, void *); +int drbbc_match(device_t, cfdata_t, void *); int dracougettod(todr_chip_handle_t, struct timeval *); int dracousettod(todr_chip_handle_t, struct timeval *); static struct todr_chip_handle dracotodr; struct drbbc_softc { - struct device sc_dev; struct ds_handle sc_dsh; }; -CFATTACH_DECL(drbbc, sizeof(struct drbbc_softc), +CFATTACH_DECL_NEW(drbbc, sizeof(struct drbbc_softc), drbbc_match, drbbc_attach, NULL, NULL); struct drbbc_softc *drbbc_sc; int -drbbc_match(struct device *pdp, struct cfdata *cfp, void *auxp) +drbbc_match(device_t parent, cfdata_t cf, void *auxp) { static int drbbc_matched = 0; @@ -85,13 +84,13 @@ drbbc_match(struct device *pdp, struct c } void -drbbc_attach(struct device *pdp, struct device *dp, void *auxp) +drbbc_attach(device_t parent, device_t self, void *auxp) { int i; struct drbbc_softc *sc; u_int8_t rombuf[8]; - sc = (struct drbbc_softc *)dp; + sc = device_private(self); sc->sc_dsh.ds_read_bit = draco_ds_read_bit; sc->sc_dsh.ds_write_bit = draco_ds_write_bit; Index: sys/arch/amiga/dev/drsc.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/amiga/dev/drsc.c,v retrieving revision 1.31 diff -u -p -r1.31 drsc.c --- sys/arch/amiga/dev/drsc.c 20 Dec 2010 00:25:25 -0000 1.31 +++ sys/arch/amiga/dev/drsc.c 9 Oct 2012 01:19:34 -0000 @@ -80,8 +80,8 @@ __KERNEL_RCSID(0, "$NetBSD: drsc.c,v 1.3 #include /* is_xxx(), */ -void drscattach(struct device *, struct device *, void *); -int drscmatch(struct device *, struct cfdata *, void *); +void drscattach(device_t, device_t, void *); +int drscmatch(device_t, cfdata_t, void *); int drsc_dmaintr(struct siop_softc *); #ifdef DEBUG void drsc_dump(void); @@ -90,7 +90,7 @@ void drsc_dump(void); #ifdef DEBUG #endif -CFATTACH_DECL(drsc, sizeof(struct siop_softc), +CFATTACH_DECL_NEW(drsc, sizeof(struct siop_softc), drscmatch, drscattach, NULL, NULL); static struct siop_softc *drsc_softc; @@ -99,7 +99,7 @@ static struct siop_softc *drsc_softc; * One of us is on every DraCo motherboard, */ int -drscmatch(struct device *pdp, struct cfdata *cfp, void *auxp) +drscmatch(device_t parent, cfdata_t cf, void *auxp) { static int drsc_matched = 0; @@ -112,9 +112,9 @@ drscmatch(struct device *pdp, struct cfd } void -drscattach(struct device *pdp, struct device *dp, void *auxp) +drscattach(device_t parent, device_t self, void *auxp) { - struct siop_softc *sc = (struct siop_softc *)dp; + struct siop_softc *sc = device_private(self); struct zbus_args *zap; siop_regmap_p rp; struct scsipi_adapter *adapt = &sc->sc_adapter; @@ -124,6 +124,7 @@ drscattach(struct device *pdp, struct de zap = auxp; + sc->sc_dev = self; sc->sc_siopp = rp = (siop_regmap_p)(DRCCADDR+PAGE_SIZE*DRSCSIPG); /* @@ -139,7 +140,7 @@ drscattach(struct device *pdp, struct de * Fill in the scsipi_adapter. */ memset(adapt, 0, sizeof(*adapt)); - adapt->adapt_dev = &sc->sc_dev; + adapt->adapt_dev = self; adapt->adapt_nchannels = 1; adapt->adapt_openings = 7; adapt->adapt_max_periph = 1; @@ -172,7 +173,7 @@ drscattach(struct device *pdp, struct de /* * attach all scsi units on us */ - config_found(dp, chan, scsiprint); + config_found(self, chan, scsiprint); } /* @@ -221,7 +222,7 @@ drsc_handler(void) single_inst_bclr_b(*draco_intpen, DRIRQ_SCSI); #ifdef DEBUG if (*draco_intpen & DRIRQ_SCSI) - printf("%s: intpen still 0x%x\n", sc->sc_dev.dv_xname, + printf("%s: intpen still 0x%x\n", device_xname(sc->sc_dev), *draco_intpen); #endif softint_schedule(sc->sc_siop_si); Index: sys/arch/amiga/dev/drsupio.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/amiga/dev/drsupio.c,v retrieving revision 1.20 diff -u -p -r1.20 drsupio.c --- sys/arch/amiga/dev/drsupio.c 19 Jul 2011 15:55:26 -0000 1.20 +++ sys/arch/amiga/dev/drsupio.c 2 Oct 2012 03:07:52 -0000 @@ -38,8 +38,8 @@ __KERNEL_RCSID(0, "$NetBSD: drsupio.c,v #include -#include #include +#include #include #include #include @@ -52,25 +52,24 @@ __KERNEL_RCSID(0, "$NetBSD: drsupio.c,v #include struct drsupio_softc { - struct device sc_dev; struct bus_space_tag sc_bst; }; -int drsupiomatch(struct device *, struct cfdata *, void *); -void drsupioattach(struct device *, struct device *, void *); +int drsupiomatch(device_t, cfdata_t, void *); +void drsupioattach(device_t, device_t, void *); int drsupprint(void *auxp, const char *); void drlptintack(void *); -CFATTACH_DECL(drsupio, sizeof(struct drsupio_softc), +CFATTACH_DECL_NEW(drsupio, sizeof(struct drsupio_softc), drsupiomatch, drsupioattach, NULL, NULL); int -drsupiomatch(struct device *parent, struct cfdata *cfp, void *auxp) +drsupiomatch(device_t parent, cfdata_t cf, void *aux) { static int drsupio_matched = 0; /* Exactly one of us lives on the DraCo */ - if (!is_draco() || !matchname(auxp, "drsupio") || drsupio_matched) + if (!is_draco() || !matchname(aux, "drsupio") || drsupio_matched) return 0; drsupio_matched = 1; @@ -91,14 +90,14 @@ struct drsupio_devs { }; void -drsupioattach(struct device *parent, struct device *self, void *auxp) +drsupioattach(device_t parent, device_t self, void *aux) { struct drsupio_softc *drsc; struct drsupio_devs *drsd; struct drioct *ioct; struct supio_attach_args supa; - drsc = (struct drsupio_softc *)self; + drsc = device_private(self); drsd = drsupiodevs; if (parent) @@ -135,10 +134,11 @@ drlptintack(void *p) } int -drsupprint(void *auxp, const char *pnp) +drsupprint(void *aux, const char *pnp) { struct supio_attach_args *supa; - supa = auxp; + + supa = aux; if (pnp == NULL) return(QUIET); Index: sys/arch/amiga/dev/empsc.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/amiga/dev/empsc.c,v retrieving revision 1.26 diff -u -p -r1.26 empsc.c --- sys/arch/amiga/dev/empsc.c 11 Dec 2005 12:16:28 -0000 1.26 +++ sys/arch/amiga/dev/empsc.c 28 Sep 2012 14:50:48 -0000 @@ -82,8 +82,8 @@ __KERNEL_RCSID(0, "$NetBSD: empsc.c,v 1. #include #include -void empscattach(struct device *, struct device *, void *); -int empscmatch(struct device *, struct cfdata *, void *); +void empscattach(device_t, device_t, void *); +int empscmatch(device_t, cfdata_t, void *); int empsc_intr(void *); #ifdef DEBUG @@ -92,14 +92,14 @@ extern int sci_debug; extern int sci_data_wait; -CFATTACH_DECL(empsc, sizeof(struct sci_softc), +CFATTACH_DECL_NEW(empsc, sizeof(struct sci_softc), empscmatch, empscattach, NULL, NULL); /* * if this is an EMPLANT board */ int -empscmatch(struct device *pdp, struct cfdata *cfp, void *auxp) +empscmatch(device_t parent, cfdata_t cf, void *auxp) { struct zbus_args *zap; @@ -115,10 +115,10 @@ empscmatch(struct device *pdp, struct cf } void -empscattach(struct device *pdp, struct device *dp, void *auxp) +empscattach(device_t parent, device_t self, void *auxp) { volatile u_char *rp; - struct sci_softc *sc = (struct sci_softc *)dp; + struct sci_softc *sc = device_private(self); struct zbus_args *zap; struct scsipi_adapter *adapt = &sc->sc_adapter; struct scsipi_channel *chan = &sc->sc_channel; @@ -129,6 +129,7 @@ empscattach(struct device *pdp, struct d rp = (u_char *)zap->va + 0x5000; + sc->sc_dev = self; sc->sci_data = rp; sc->sci_odata = rp; sc->sci_icmd = rp + 0x10; @@ -153,7 +154,7 @@ empscattach(struct device *pdp, struct d * Fill in the scsipi_adapter. */ memset(adapt, 0, sizeof(*adapt)); - adapt->adapt_dev = &sc->sc_dev; + adapt->adapt_dev = self; adapt->adapt_nchannels = 1; adapt->adapt_openings = 7; adapt->adapt_max_periph = 1; @@ -174,7 +175,7 @@ empscattach(struct device *pdp, struct d /* * attach all scsi units on us */ - config_found(dp, chan, scsiprint); + config_found(self, chan, scsiprint); } int Index: sys/arch/amiga/dev/fd.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/amiga/dev/fd.c,v retrieving revision 1.86 diff -u -p -r1.86 fd.c --- sys/arch/amiga/dev/fd.c 3 Jun 2011 00:52:22 -0000 1.86 +++ sys/arch/amiga/dev/fd.c 29 Sep 2012 12:02:19 -0000 @@ -325,12 +325,12 @@ CFATTACH_DECL_NEW(fdc, 0, int -fdcmatch(device_t pdp, cfdata_t cfp, void *auxp) +fdcmatch(device_t parent, cfdata_t cf, void *aux) { static int fdc_matched = 0; /* Allow only once instance. */ - if (matchname("fdc", auxp) == 0 || fdc_matched) + if (matchname("fdc", aux) == 0 || fdc_matched) return(0); if ((fdc_dmap = alloc_chipmem(DMABUFSZ)) == NULL) { printf("fdc: unable to allocate DMA buffer\n"); @@ -342,7 +342,7 @@ fdcmatch(device_t pdp, cfdata_t cfp, voi } void -fdcattach(device_t pdp, device_t dp, void *auxp) +fdcattach(device_t parent, device_t self, void *aux) { struct fdcargs args; @@ -352,11 +352,11 @@ fdcattach(device_t pdp, device_t dp, voi args.type = fdcgetfdtype(args.unit); fdc_side = -1; - config_found(dp, &args, fdcprint); + config_found(self, &args, fdcprint); for (args.unit++; args.unit < FDMAXUNITS; args.unit++) { if ((args.type = fdcgetfdtype(args.unit)) == NULL) continue; - config_found(dp, &args, fdcprint); + config_found(self, &args, fdcprint); } } @@ -374,28 +374,28 @@ fdcprint(void *auxp, const char *pnp) /*ARGSUSED*/ int -fdmatch(device_t pdp, cfdata_t cfp, void *auxp) +fdmatch(device_t parent, cfdata_t cf, void *aux) { struct fdcargs *fdap; - fdap = auxp; - if (cfp->cf_loc[FDCCF_UNIT] == fdap->unit || - cfp->cf_loc[FDCCF_UNIT] == FDCCF_UNIT_DEFAULT) + fdap = aux; + if (cf->cf_loc[FDCCF_UNIT] == fdap->unit || + cf->cf_loc[FDCCF_UNIT] == FDCCF_UNIT_DEFAULT) return(1); return(0); } void -fdattach(device_t pdp, device_t dp, void *auxp) +fdattach(device_t parent, device_t self, void *aux) { struct fdcargs *ap; struct fd_softc *sc; int i; - ap = auxp; - sc = device_private(dp); - sc->sc_dev = dp; + ap = aux; + sc = device_private(self); + sc->sc_dev = self; bufq_alloc(&sc->bufq, "disksort", BUFQ_SORT_CYLINDER); callout_init(&sc->calibrate_ch, 0); Index: sys/arch/amiga/dev/gayle_pcmcia.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/amiga/dev/gayle_pcmcia.c,v retrieving revision 1.25 diff -u -p -r1.25 gayle_pcmcia.c --- sys/arch/amiga/dev/gayle_pcmcia.c 26 Jul 2011 22:52:47 -0000 1.25 +++ sys/arch/amiga/dev/gayle_pcmcia.c 1 Oct 2012 16:57:27 -0000 @@ -30,14 +30,13 @@ struct pccard_slot { struct pccard_softc *sc; /* refer to `parent' */ int (*intr_func)(void *); void * intr_arg; - struct device *card; + device_t card; int flags; #define SLOT_OCCUPIED 0x01 #define SLOT_NEW_CARD_EVENT 0x02 }; struct pccard_softc { - struct device sc_dev; struct bus_space_tag io_space; struct bus_space_tag attr_space; struct bus_space_tag mem_space; @@ -46,8 +45,8 @@ struct pccard_softc { struct isr intr2; }; -static int pccard_probe(struct device *, struct cfdata *, void *); -static void pccard_attach(struct device *, struct device *, void *); +static int pccard_probe(device_t, cfdata_t, void *); +static void pccard_attach(device_t, device_t, void *); static void pccard_attach_slot(struct pccard_slot *); static int pccard_intr6(void *); static int pccard_intr2(void *); @@ -81,7 +80,7 @@ static bswm(pcmio_bswr1, u_int8_t); static bssr(pcmio_bssr1, u_int8_t); static bscr(pcmio_bscr1, u_int8_t); -CFATTACH_DECL(pccard, sizeof(struct pccard_softc), +CFATTACH_DECL_NEW(pccard, sizeof(struct pccard_softc), pccard_probe, pccard_attach, NULL, NULL); static struct pcmcia_chip_functions chip_functions = { @@ -99,16 +98,16 @@ static struct amiga_bus_space_methods pc static u_int8_t *reset_card_reg; static int -pccard_probe(struct device *dev, struct cfdata *cfd, void *aux) +pccard_probe(device_t parent, cfdata_t cf, void *aux) { return (is_a600() || is_a1200()) && matchname(aux, "pccard"); } static void -pccard_attach(struct device *parent, struct device *myself, void *aux) +pccard_attach(device_t parent, device_t self, void *aux) { - struct pccard_softc *self = (struct pccard_softc *) myself; + struct pccard_softc *sc = device_private(self); struct pcmciabus_attach_args paa; vaddr_t pcmcia_base; vaddr_t i; @@ -145,26 +144,26 @@ pccard_attach(struct device *parent, str reset_card_reg = (u_int8_t *) pcmcia_base + (GAYLE_PCMCIA_RESET - GAYLE_PCMCIA_START); - self->io_space.base = (bus_addr_t) pcmcia_base + + sc->io_space.base = (bus_addr_t) pcmcia_base + (GAYLE_PCMCIA_IO_START - GAYLE_PCMCIA_START); - self->io_space.absm = &pcmio_bs_methods; + sc->io_space.absm = &pcmio_bs_methods; - self->attr_space.base = (bus_addr_t) pcmcia_base + + sc->attr_space.base = (bus_addr_t) pcmcia_base + (GAYLE_PCMCIA_ATTR_START - GAYLE_PCMCIA_START); - self->attr_space.absm = &amiga_bus_stride_1; + sc->attr_space.absm = &amiga_bus_stride_1; /* XXX we should check if the 4M of common memory are actually * RAM or PCMCIA usable. * For now, we just do as if the 4M were RAM and make common memory * point to attribute memory, which is OK for some I/O cards. */ - self->mem_space.base = (bus_addr_t) pcmcia_base; - self->mem_space.absm = &amiga_bus_stride_1; + sc->mem_space.base = (bus_addr_t) pcmcia_base; + sc->mem_space.absm = &amiga_bus_stride_1; - self->devs[0].sc = self; - self->devs[0].intr_func = NULL; - self->devs[0].intr_arg = NULL; - self->devs[0].flags = 0; + sc->devs[0].sc = sc; + sc->devs[0].intr_func = NULL; + sc->devs[0].intr_arg = NULL; + sc->devs[0].flags = 0; gayle.pcc_status = 0; gayle.intreq = 0; @@ -173,10 +172,9 @@ pccard_attach(struct device *parent, str paa.paa_busname = "pcmcia"; paa.pct = &chip_functions; - paa.pch = &self->devs[0]; - self->devs[0].card = - config_found(myself, &paa, simple_devprint); - if (self->devs[0].card == NULL) { + paa.pch = &sc->devs[0]; + sc->devs[0].card = config_found(self, &paa, simple_devprint); + if (sc->devs[0].card == NULL) { printf("attach failed, config_found() returned NULL\n"); pmap_remove(kernel_map->pmap, pcmcia_base, pcmcia_base + (GAYLE_PCMCIA_END - GAYLE_PCMCIA_START)); @@ -186,20 +184,20 @@ pccard_attach(struct device *parent, str return; } - self->intr6.isr_intr = pccard_intr6; - self->intr6.isr_arg = self; - self->intr6.isr_ipl = 6; - add_isr(&self->intr6); - - self->intr2.isr_intr = pccard_intr2; - self->intr2.isr_arg = self; - self->intr2.isr_ipl = 2; - add_isr(&self->intr2); + sc->intr6.isr_intr = pccard_intr6; + sc->intr6.isr_arg = self; + sc->intr6.isr_ipl = 6; + add_isr(&sc->intr6); + + sc->intr2.isr_intr = pccard_intr2; + sc->intr2.isr_arg = self; + sc->intr2.isr_ipl = 2; + add_isr(&sc->intr2); - if (kthread_create(PRI_NONE, 0, NULL, pccard_kthread, self, + if (kthread_create(PRI_NONE, 0, NULL, pccard_kthread, sc, NULL, "pccard")) { printf("%s: can't create kernel thread\n", - self->sc_dev.dv_xname); + device_xname(self)); panic("pccard kthread_create() failed"); } @@ -214,18 +212,18 @@ pccard_attach(struct device *parent, str gayle.pcc_status = GAYLE_CCMEM_WP | GAYLE_CCIO_SPKR; } - pccard_attach_slot(&self->devs[0]); + pccard_attach_slot(&sc->devs[0]); } static int pccard_intr6(void *arg) { - struct pccard_softc *self = arg; + struct pccard_softc *sc = arg; if (gayle.intreq & GAYLE_INT_DETECT) { gayle.intreq = GAYLE_INT_IDE | GAYLE_INT_STSCHG | GAYLE_INT_SPKR | GAYLE_INT_WP | GAYLE_INT_IREQ; - self->devs[0].flags |= SLOT_NEW_CARD_EVENT; + sc->devs[0].flags |= SLOT_NEW_CARD_EVENT; return 1; } return 0; @@ -234,8 +232,8 @@ pccard_intr6(void *arg) static int pccard_intr2(void *arg) { - struct pccard_softc *self = arg; - struct pccard_slot *slot = &self->devs[0]; + struct pccard_softc *sc = arg; + struct pccard_slot *slot = &sc->devs[0]; if (slot->flags & SLOT_NEW_CARD_EVENT) { slot->flags &= ~SLOT_NEW_CARD_EVENT; @@ -244,7 +242,7 @@ pccard_intr2(void *arg) gayle.intreq = GAYLE_INT_IDE | GAYLE_INT_DETECT; gayle.pcc_status = GAYLE_CCMEM_WP | GAYLE_CCIO_SPKR; gayle.pcc_config = 0; - pccard_attach_slot(&self->devs[0]); + pccard_attach_slot(&sc->devs[0]); } else { int intreq = gayle.intreq & (GAYLE_INT_STSCHG | GAYLE_INT_WP | GAYLE_INT_IREQ); @@ -262,8 +260,8 @@ pccard_intr2(void *arg) static void pccard_kthread(void *arg) { - struct pccard_softc *self = arg; - struct pccard_slot *slot = &self->devs[0]; + struct pccard_softc *sc = arg; + struct pccard_slot *slot = &sc->devs[0]; for (;;) { int s = spl2(); @@ -276,7 +274,7 @@ pccard_kthread(void *arg) gayle.intreq = GAYLE_INT_IDE | GAYLE_INT_DETECT; gayle.pcc_status = GAYLE_CCMEM_WP | GAYLE_CCIO_SPKR; gayle.pcc_config = 0; - pccard_attach_slot(&self->devs[0]); + pccard_attach_slot(&sc->devs[0]); } splx(s); Index: sys/arch/amiga/dev/grf.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/amiga/dev/grf.c,v retrieving revision 1.58 diff -u -p -r1.58 grf.c --- sys/arch/amiga/dev/grf.c 13 Mar 2012 18:40:27 -0000 1.58 +++ sys/arch/amiga/dev/grf.c 6 Oct 2012 00:48:48 -0000 @@ -141,22 +141,24 @@ cons_decl(grf); * low level board driver. */ int -grfmatch(device_t pdp, cfdata_t cfp, void *auxp) +grfmatch(device_t parent, cfdata_t cf, void *aux) { + struct grf_softc *psc; - if (cfp->cf_unit != ((struct grf_softc *)pdp)->g_unit) + psc = device_private(parent); + if (cf->cf_unit != psc->g_unit) return(0); - cfdata = cfp; + cfdata = cf; return(1); } /* * Attach.. plug pointer in and print some info. * Then try and attach a wsdisplay or ite to us. - * Note: dp is NULL durring console init. + * Note: self is NULL durring console init. */ void -grfattach(device_t pdp, device_t dp, void *auxp) +grfattach(device_t parent, device_t self, void *aux) { #if NWSDISPLAY > 0 struct wsemuldisplaydev_attach_args wa; @@ -165,8 +167,9 @@ grfattach(device_t pdp, device_t dp, voi struct grf_softc *gp; int maj; - gp = (struct grf_softc *)pdp; - grfsp[gp->g_unit] = (struct grf_softc *)pdp; + gp = device_private(parent); + gp->g_device = self; + grfsp[gp->g_unit] = gp; /* * find our major device number @@ -174,7 +177,7 @@ grfattach(device_t pdp, device_t dp, voi maj = cdevsw_lookup_major(&grf_cdevsw); gp->g_grfdev = makedev(maj, gp->g_unit); - if (dp != NULL) { + if (self != NULL) { printf(": width %d height %d", gp->g_display.gd_dwidth, gp->g_display.gd_dheight); if (gp->g_display.gd_colors == 2) @@ -200,7 +203,7 @@ grfattach(device_t pdp, device_t dp, voi wa.scrdata = &gp->g_screenlist; wa.accessops = gp->g_accessops; wa.accesscookie = &gp->g_vd; - config_found(dp, &wa, wsemuldisplaydevprint); + config_found(self, &wa, wsemuldisplaydevprint); #endif /* NWSDISPLAY > 0 */ } @@ -208,12 +211,12 @@ grfattach(device_t pdp, device_t dp, voi /* * try and attach an ite */ - amiga_config_found(cfdata, dp, gp, grfprint); + amiga_config_found(cfdata, self, gp, grfprint); #endif } int -grfprint(void *auxp, const char *pnp) +grfprint(void *aux, const char *pnp) { if (pnp) aprint_normal("ite at %s", pnp); @@ -543,7 +546,7 @@ grf_wsmmap(void *v, void *vs, off_t off, if (kauth_authorize_machdep(kauth_cred_get(), KAUTH_MACHDEP_UNMANAGEDMEM, NULL, NULL, NULL, NULL) != 0) { aprint_normal("%s: permission to mmap denied.\n", - device_xname(&gp->g_device)); + device_xname(gp->g_device)); return -1; } Index: sys/arch/amiga/dev/grf_cc.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/amiga/dev/grf_cc.c,v retrieving revision 1.40 diff -u -p -r1.40 grf_cc.c --- sys/arch/amiga/dev/grf_cc.c 15 Dec 2011 14:25:13 -0000 1.40 +++ sys/arch/amiga/dev/grf_cc.c 6 Oct 2012 02:59:42 -0000 @@ -62,25 +62,25 @@ __KERNEL_RCSID(0, "$NetBSD: grf_cc.c,v 1 #include "view.h" -int grfccmatch(struct device *, struct cfdata *, void *); +int grfccmatch(device_t, cfdata_t, void *); int grfccprint(void *, const char *); -void grfccattach(struct device *, struct device *, void *); +void grfccattach(device_t, device_t, void *); void grf_cc_on(struct grf_softc *); -CFATTACH_DECL(grfcc, sizeof(struct grf_softc), +CFATTACH_DECL_NEW(grfcc, sizeof(struct grf_softc), grfccmatch, grfccattach, NULL, NULL); /* * only used in console init */ -static struct cfdata *cfdata; +static cfdata_t cfdata; /* * we make sure to only init things once. this is somewhat * tricky regarding the console. */ int -grfccmatch(struct device *pdp, struct cfdata *cfp, void *auxp) +grfccmatch(device_t parent, cfdata_t cf, void *auxp) { static int ccconunit = -1; char *mainbus_name = auxp; @@ -93,7 +93,7 @@ grfccmatch(struct device *pdp, struct cf return(0); if (matchname("grfcc", mainbus_name) == 0) return(0); - if (amiga_realconfig == 0 || ccconunit != cfp->cf_unit) { + if (amiga_realconfig == 0 || ccconunit != cf->cf_unit) { if (grfcc_probe() == 0) return(0); viewprobe(); @@ -103,8 +103,8 @@ grfccmatch(struct device *pdp, struct cf if ((*view_cdevsw.d_open)(0, 0, 0, NULL)) return(0); if (amiga_realconfig == 0) { - ccconunit = cfp->cf_unit; - cfdata = cfp; + ccconunit = cf->cf_unit; + cfdata = cf; } } return(1); @@ -114,17 +114,22 @@ grfccmatch(struct device *pdp, struct cf * attach to the grfbus (mainbus) */ void -grfccattach(struct device *pdp, struct device *dp, void *auxp) +grfccattach(device_t parent, device_t self, void *auxp) { static struct grf_softc congrf; + struct device temp; struct grf_softc *gp; - if (dp == NULL) + if (self == NULL) { gp = &congrf; - else - gp = (struct grf_softc *)dp; + gp->g_device = &temp; + temp.dv_private = gp; + } else { + gp = device_private(self); + gp->g_device = self; + } - if (dp != NULL && congrf.g_regkva != 0) { + if (self != NULL && congrf.g_regkva != 0) { /* * we inited earlier just copy the info * take care not to copy the device struct though. @@ -141,12 +146,12 @@ grfccattach(struct device *pdp, struct d #endif grf_cc_on(gp); } - if (dp != NULL) + if (self != NULL) printf("\n"); /* * attach grf */ - amiga_config_found(cfdata, &gp->g_device, gp, grfccprint); + amiga_config_found(cfdata, gp->g_device, gp, grfccprint); } int Index: sys/arch/amiga/dev/grf_cl.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/amiga/dev/grf_cl.c,v retrieving revision 1.46 diff -u -p -r1.46 grf_cl.c --- sys/arch/amiga/dev/grf_cl.c 15 Dec 2011 14:25:13 -0000 1.46 +++ sys/arch/amiga/dev/grf_cl.c 6 Oct 2012 02:59:51 -0000 @@ -115,9 +115,9 @@ static void RegWakeup(volatile void *); static void RegOnpass(volatile void *); static void RegOffpass(volatile void *); -void grfclattach(struct device *, struct device *, void *); +void grfclattach(device_t, device_t, void *); int grfclprint(void *, const char *); -int grfclmatch(struct device *, struct cfdata *, void *); +int grfclmatch(device_t, cfdata_t, void *); void cl_memset(unsigned char *, unsigned char, int); /* Graphics display definitions. @@ -189,13 +189,13 @@ static unsigned char cl_imageptr[8 * 64] static unsigned char cl_sprred[2], cl_sprgreen[2], cl_sprblue[2]; /* standard driver stuff */ -CFATTACH_DECL(grfcl, sizeof(struct grf_softc), +CFATTACH_DECL_NEW(grfcl, sizeof(struct grf_softc), grfclmatch, grfclattach, NULL, NULL); static struct cfdata *cfdata; int -grfclmatch(struct device *pdp, struct cfdata *cfp, void *auxp) +grfclmatch(device_t parent, cfdata_t cf, void *auxp) { struct zbus_args *zap; static int regprod, fbprod, fbprod2; @@ -326,7 +326,7 @@ grfclmatch(struct device *pdp, struct cf #ifdef CL5426CONSOLE if (amiga_realconfig == 0) { - cfdata = cfp; + cfdata = cf; } #endif @@ -334,11 +334,12 @@ grfclmatch(struct device *pdp, struct cf } void -grfclattach(struct device *pdp, struct device *dp, void *auxp) +grfclattach(device_t parent, device_t self, void *auxp) { static struct grf_softc congrf; struct zbus_args *zap; struct grf_softc *gp; + struct device temp; static char attachflag = 0; zap = auxp; @@ -350,12 +351,16 @@ grfclattach(struct device *pdp, struct d return; /* do all that messy console/grf stuff */ - if (dp == NULL) + if (self == NULL) { gp = &congrf; - else - gp = (struct grf_softc *) dp; + gp->g_device = &temp; + temp.dv_private = gp; + } else { + gp = device_private(self); + gp->g_device = self; + } - if (dp != NULL && congrf.g_regkva != 0) { + if (self != NULL && congrf.g_regkva != 0) { /* * inited earlier, just copy (not device struct) */ @@ -386,7 +391,7 @@ grfclattach(struct device *pdp, struct d /* * attach grf (once) */ - if (amiga_config_found(cfdata, &gp->g_device, gp, grfclprint)) { + if (amiga_config_found(cfdata, self, gp, grfclprint)) { attachflag = 1; printf("grfcl: %dMB ", cl_fbsize / 0x100000); switch (cltype) { Index: sys/arch/amiga/dev/grf_cv.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/amiga/dev/grf_cv.c,v retrieving revision 1.53 diff -u -p -r1.53 grf_cv.c --- sys/arch/amiga/dev/grf_cv.c 15 Dec 2011 14:25:13 -0000 1.53 +++ sys/arch/amiga/dev/grf_cv.c 6 Oct 2012 02:59:29 -0000 @@ -80,8 +80,8 @@ __KERNEL_RCSID(0, "$NetBSD: grf_cv.c,v 1 #include #include -int grfcvmatch(struct device *, struct cfdata *, void *); -void grfcvattach(struct device *, struct device *, void *); +int grfcvmatch(device_t, cfdata_t, void *); +void grfcvattach(device_t, device_t, void *); int grfcvprint(void *, const char *); int cvintr(void *); @@ -317,7 +317,7 @@ static struct wsscreen_descr cv_screen = #endif /* NWSDISPLAY > 0 */ /* standard driver stuff */ -CFATTACH_DECL(grfcv, sizeof(struct grf_cv_softc), +CFATTACH_DECL_NEW(grfcv, sizeof(struct grf_cv_softc), grfcvmatch, grfcvattach, NULL, NULL); static struct cfdata *cfdata; @@ -441,14 +441,14 @@ cv_has_4mb(volatile void *fb) } int -grfcvmatch(struct device *pdp, struct cfdata *cfp, void *auxp) +grfcvmatch(device_t paren, cfdata_t cf, void *aux) { #ifdef CV64CONSOLE static int cvcons_unit = -1; #endif struct zbus_args *zap; - zap = auxp; + zap = aux; if (amiga_realconfig == 0) #ifdef CV64CONSOLE @@ -464,8 +464,8 @@ grfcvmatch(struct device *pdp, struct cf #ifdef CV64CONSOLE if (amiga_realconfig == 0) { - cvcons_unit = cfp->cf_unit; - cfdata = cfp; + cvcons_unit = cf->cf_unit; + cfdata = cf; } #endif @@ -473,29 +473,35 @@ grfcvmatch(struct device *pdp, struct cf } void -grfcvattach(struct device *pdp, struct device *dp, void *auxp) +grfcvattach(device_t parent, device_t self, void *aux) { static struct grf_cv_softc congrf; + static char attachflag = 0; + struct device temp; struct zbus_args *zap; struct grf_softc *gp; struct grf_cv_softc *gcp; - static char attachflag = 0; - zap = auxp; + zap = aux; /* - * This function is called twice, once on console init (dp == NULL) + * This function is called twice, once on console init (self == NULL) * and once on "normal" grf5 init. */ - if (dp == NULL) /* console init */ + if (self == NULL) { gcp = &congrf; - else - gcp = (struct grf_cv_softc *)dp; + gp = &gcp->gcs_sc; + gp->g_device = &temp; + temp.dv_private = gp; + } else { + gcp = device_private(self); + gp = &gcp->gcs_sc; + gp->g_device = self; + } - gp = &gcp->gcs_sc; - if (dp != NULL && congrf.gcs_sc.g_regkva != 0) { + if (self != NULL && congrf.gcs_sc.g_regkva != 0) { /* * inited earlier, just copy (not device struct) */ @@ -549,8 +555,8 @@ grfcvattach(struct device *pdp, struct d /* * attach grf */ - if (amiga_config_found(cfdata, &gp->g_device, gp, grfcvprint)) { - if (dp != NULL) + if (amiga_config_found(cfdata, self, gp, grfcvprint)) { + if (self != NULL) printf("grfcv: CyberVision64 with %dMB being used\n", cv_fbsize/0x100000); attachflag = 1; Index: sys/arch/amiga/dev/grf_cv3d.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/amiga/dev/grf_cv3d.c,v retrieving revision 1.26 diff -u -p -r1.26 grf_cv3d.c --- sys/arch/amiga/dev/grf_cv3d.c 15 Dec 2011 14:25:13 -0000 1.26 +++ sys/arch/amiga/dev/grf_cv3d.c 6 Oct 2012 03:01:14 -0000 @@ -114,8 +114,8 @@ Note: IO Regbase is needed fo wakeup of #define cpu_sync() __asm volatile ("sync; isync") #endif -int grfcv3dmatch(struct device *, struct cfdata *, void *); -void grfcv3dattach(struct device *, struct device *, void *); +int grfcv3dmatch(device_t, cfdata_t, void *); +void grfcv3dattach(device_t, device_t, void *); int grfcv3dprint(void *, const char *); static int cv3d_has_4mb(volatile void *); @@ -337,7 +337,7 @@ static struct wsscreen_descr cv3d_screen #endif /* NWSDISPLAY > 0 */ /* standard driver stuff */ -CFATTACH_DECL(grfcv3d, sizeof(struct grf_softc), +CFATTACH_DECL_NEW(grfcv3d, sizeof(struct grf_softc), grfcv3dmatch, grfcv3dattach, NULL, NULL); static struct cfdata *cfdata; @@ -380,14 +380,14 @@ cv3d_has_4mb(volatile void *fb) } int -grfcv3dmatch(struct device *pdp, struct cfdata *cfp, void *auxp) +grfcv3dmatch(device_t parent, cfdata_t cf, void *aux) { #ifdef CV3DCONSOLE static int cv3dcons_unit = -1; #endif struct zbus_args *zap; - zap = auxp; + zap = aux; if (amiga_realconfig == 0) #ifdef CV3DCONSOLE @@ -416,8 +416,8 @@ grfcv3dmatch(struct device *pdp, struct #ifdef CV3DCONSOLE if (amiga_realconfig == 0) { - cv3dcons_unit = cfp->cf_unit; - cfdata = cfp; + cv3dcons_unit = cf->cf_unit; + cfdata = cf; } #endif @@ -425,28 +425,33 @@ grfcv3dmatch(struct device *pdp, struct } void -grfcv3dattach(struct device *pdp, struct device *dp, void *auxp) +grfcv3dattach(device_t parent, device_t self, void *aux) { static struct grf_softc congrf; + static char attachflag = 0; + struct device temp; struct zbus_args *zap; struct grf_softc *gp; - static char attachflag = 0; - zap = auxp; + zap = aux; printf("\n"); /* - * This function is called twice, once on console init (dp == NULL) + * This function is called twice, once on console init (self == NULL) * and once on "normal" grf7 init. */ - if (dp == NULL) /* console init */ + if (self == NULL) { gp = &congrf; - else - gp = (struct grf_softc *)dp; + gp->g_device = &temp; + temp.dv_private = gp; + } else { + gp = device_private(self); + gp->g_device = self; + } - if (dp != NULL && congrf.g_regkva != 0) { + if (self != NULL && congrf.g_regkva != 0) { /* * inited earlier, just copy (not device struct) */ @@ -507,10 +512,10 @@ grfcv3dattach(struct device *pdp, struct /* * attach grf */ - if (amiga_config_found(cfdata, &gp->g_device, gp, grfcv3dprint)) { - if (dp != NULL) + if (amiga_config_found(cfdata, self, gp, grfcv3dprint)) { + if (self != NULL) printf("%s: CyberVision64/3D with %dMB being used\n", - dp->dv_xname, cv3d_fbsize / 0x100000); + device_xname(self), cv3d_fbsize / 0x100000); attachflag = 1; } else { if (!attachflag) @@ -519,7 +524,7 @@ grfcv3dattach(struct device *pdp, struct } int -grfcv3dprint(void *auxp, const char *pnp) +grfcv3dprint(void *aux, const char *pnp) { if (pnp) aprint_normal("ite at %s: ", pnp); Index: sys/arch/amiga/dev/grf_et.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/amiga/dev/grf_et.c,v retrieving revision 1.29 diff -u -p -r1.29 grf_et.c --- sys/arch/amiga/dev/grf_et.c 15 Dec 2011 14:25:13 -0000 1.29 +++ sys/arch/amiga/dev/grf_et.c 6 Oct 2012 03:02:28 -0000 @@ -105,8 +105,8 @@ int et_blank(struct grf_softc *gp, int * static int et_getControllerType(struct grf_softc *gp); static int et_getDACType(struct grf_softc *gp); -int grfetmatch(struct device *, struct cfdata *, void *); -void grfetattach(struct device *, struct device *, void *); +int grfetmatch(device_t, cfdata_t, void *); +void grfetattach(device_t, device_t, void *); int grfetprint(void *, const char *); void et_memset(volatile unsigned char *d, unsigned char c, int l); @@ -180,18 +180,18 @@ static unsigned char et_imageptr[8 * 64] static unsigned char et_sprred[2], et_sprgreen[2], et_sprblue[2]; /* standard driver stuff */ -CFATTACH_DECL(grfet, sizeof(struct grf_softc), +CFATTACH_DECL_NEW(grfet, sizeof(struct grf_softc), grfetmatch, grfetattach, NULL, NULL); static struct cfdata *cfdata; int -grfetmatch(struct device *pdp, struct cfdata *cfp, void *auxp) +grfetmatch(device_t parent, cfdata_t cf, void *aux) { struct zbus_args *zap; static int regprod, regprod2 = 0, fbprod; - zap = auxp; + zap = aux; #ifndef TSENGCONSOLE if (amiga_realconfig == 0) @@ -259,7 +259,7 @@ grfetmatch(struct device *pdp, struct cf #ifdef TSENGCONSOLE if (amiga_realconfig == 0) { - cfdata = cfp; + cfdata = cf; } #endif @@ -268,14 +268,15 @@ grfetmatch(struct device *pdp, struct cf void -grfetattach(struct device *pdp, struct device *dp, void *auxp) +grfetattach(device_t parent, device_t self, void *aux) { static struct grf_softc congrf; + static char attachflag = 0; + struct device temp; struct zbus_args *zap; struct grf_softc *gp; - static char attachflag = 0; - zap = auxp; + zap = aux; printf("\n"); @@ -284,12 +285,16 @@ grfetattach(struct device *pdp, struct d return; /* do all that messy console/grf stuff */ - if (dp == NULL) + if (self == NULL) { gp = &congrf; - else - gp = (struct grf_softc *) dp; + gp->g_device = &temp; + temp.dv_private = gp; + } else { + gp = device_private(self); + gp->g_device = self; + } - if (dp != NULL && congrf.g_regkva != 0) { + if (self != NULL && congrf.g_regkva != 0) { /* * inited earlier, just copy (not device struct) */ @@ -320,7 +325,7 @@ grfetattach(struct device *pdp, struct d /* * attach grf (once) */ - if (amiga_config_found(cfdata, &gp->g_device, gp, grfetprint)) { + if (amiga_config_found(cfdata, self, gp, grfetprint)) { attachflag = 1; printf("grfet: %dMB ", et_fbsize / 0x100000); switch (ettype) { Index: sys/arch/amiga/dev/grf_rh.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/amiga/dev/grf_rh.c,v retrieving revision 1.54 diff -u -p -r1.54 grf_rh.c --- sys/arch/amiga/dev/grf_rh.c 15 Dec 2011 14:25:13 -0000 1.54 +++ sys/arch/amiga/dev/grf_rh.c 6 Oct 2012 03:03:46 -0000 @@ -1529,17 +1529,17 @@ int rh_default_gfx = 4; static struct MonDef *current_mon; /* EVIL */ int rh_mode(struct grf_softc *, u_long, void *, u_long, int); -void grfrhattach(struct device *, struct device *, void *); +void grfrhattach(device_t, device_t, void *); int grfrhprint(void *, const char *); -int grfrhmatch(struct device *, struct cfdata *, void *); +int grfrhmatch(device_t, cfdata_t, void *); -CFATTACH_DECL(grfrh, sizeof(struct grf_softc), +CFATTACH_DECL_NEW(grfrh, sizeof(struct grf_softc), grfrhmatch, grfrhattach, NULL, NULL); static struct cfdata *cfdata; int -grfrhmatch(struct device *pdp, struct cfdata *cfp, void *auxp) +grfrhmatch(device_t parent, cfdata_t cf, void *auxp) { #ifdef RETINACONSOLE static int rhconunit = -1; @@ -1557,7 +1557,7 @@ grfrhmatch(struct device *pdp, struct cf ((zap->prodid != 16) && (zap->prodid != 19))) return(0); #ifdef RETINACONSOLE - if (amiga_realconfig == 0 || rhconunit != cfp->cf_unit) { + if (amiga_realconfig == 0 || rhconunit != cf->cf_unit) { #endif if ((unsigned)rh_default_mon >= rh_mon_max || monitor_defs[rh_default_mon].DEP == 8) @@ -1567,8 +1567,8 @@ grfrhmatch(struct device *pdp, struct cf return(0); #ifdef RETINACONSOLE if (amiga_realconfig == 0) { - rhconunit = cfp->cf_unit; - cfdata = cfp; + rhconunit = cf->cf_unit; + cfdata = cf; } } #endif @@ -1576,19 +1576,25 @@ grfrhmatch(struct device *pdp, struct cf } void -grfrhattach(struct device *pdp, struct device *dp, void *auxp) +grfrhattach(device_t parent, device_t self, void *auxp) { static struct grf_softc congrf; + struct device temp; struct zbus_args *zap; struct grf_softc *gp; zap = auxp; - if (dp == NULL) + if (self == NULL) { gp = &congrf; - else - gp = (struct grf_softc *)dp; - if (dp != NULL && congrf.g_regkva != 0) { + gp->g_device = &temp; + temp.dv_private = gp; + } else { + gp = device_private(self); + gp->g_device = self; + } + + if (self != NULL && congrf.g_regkva != 0) { /* * inited earlier, just copy (not device struct) */ @@ -1606,12 +1612,12 @@ grfrhattach(struct device *pdp, struct d #endif (void)rh_load_mon(gp, current_mon); } - if (dp != NULL) + if (self != NULL) printf("\n"); /* * attach grf */ - amiga_config_found(cfdata, &gp->g_device, gp, grfrhprint); + amiga_config_found(cfdata, self, gp, grfrhprint); } int Index: sys/arch/amiga/dev/grf_rt.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/amiga/dev/grf_rt.c,v retrieving revision 1.55 diff -u -p -r1.55 grf_rt.c --- sys/arch/amiga/dev/grf_rt.c 15 Dec 2011 14:25:13 -0000 1.55 +++ sys/arch/amiga/dev/grf_rt.c 6 Oct 2012 03:04:18 -0000 @@ -762,9 +762,9 @@ rt_load_mon(struct grf_softc *gp, struct return(1); } -void grfrtattach(struct device *, struct device *, void *); +void grfrtattach(device_t, device_t, void *); int grfrtprint(void *, const char *); -int grfrtmatch(struct device *, struct cfdata *, void *); +int grfrtmatch(device_t, cfdata_t, void *); int rt_mode(struct grf_softc *, u_long, void *, u_long, int); static int rt_getvmode(struct grf_softc *, struct grfvideo_mode *); @@ -779,7 +779,7 @@ int rt_putcmap(struct grf_softc *, struc int rt_bitblt(struct grf_softc *, struct grf_bitblt *); int rt_blank(struct grf_softc *, int *); -CFATTACH_DECL(grfrt, sizeof(struct grf_softc), +CFATTACH_DECL_NEW(grfrt, sizeof(struct grf_softc), grfrtmatch, grfrtattach, NULL, NULL); /* @@ -792,14 +792,14 @@ static struct cfdata *cfdata; * tricky regarding the console. */ int -grfrtmatch(struct device *pdp, struct cfdata *cfp, void *auxp) +grfrtmatch(device_t parent, cfdata_t cf, void *aux) { #ifdef RETINACONSOLE static int rtconunit = -1; #endif struct zbus_args *zap; - zap = auxp; + zap = aux; /* * allow only one retina console @@ -816,7 +816,7 @@ grfrtmatch(struct device *pdp, struct cf return(0); #ifdef RETINACONSOLE - if (amiga_realconfig == 0 || rtconunit != cfp->cf_unit) { + if (amiga_realconfig == 0 || rtconunit != cf->cf_unit) { #endif if ((unsigned)retina_default_mon >= retina_mon_max || monitor_defs[retina_default_mon].DEP == 8) @@ -827,8 +827,8 @@ grfrtmatch(struct device *pdp, struct cf return(0); #ifdef RETINACONSOLE if (amiga_realconfig == 0) { - rtconunit = cfp->cf_unit; - cfdata = cfp; + rtconunit = cf->cf_unit; + cfdata = cf; } } #endif @@ -839,20 +839,25 @@ grfrtmatch(struct device *pdp, struct cf * attach to the grfbus (zbus) */ void -grfrtattach(struct device *pdp, struct device *dp, void *auxp) +grfrtattach(device_t parent, device_t self, void *aux) { static struct grf_softc congrf; + struct device temp; struct zbus_args *zap; struct grf_softc *gp; - zap = auxp; + zap = aux; - if (dp == NULL) + if (self == NULL) { gp = &congrf; - else - gp = (struct grf_softc *)dp; + gp->g_device = &temp; + temp.dv_private = gp; + } else { + gp = device_private(self); + gp->g_device = self; + } - if (dp != NULL && congrf.g_regkva != 0) { + if (self != NULL && congrf.g_regkva != 0) { /* * we inited earlier just copy the info * take care not to copy the device struct though. @@ -871,12 +876,12 @@ grfrtattach(struct device *pdp, struct d #endif (void)rt_load_mon(gp, current_mon); } - if (dp != NULL) + if (self != NULL) printf("\n"); /* * attach grf */ - amiga_config_found(cfdata, &gp->g_device, gp, grfrtprint); + amiga_config_found(cfdata, self, gp, grfrtprint); } int Index: sys/arch/amiga/dev/grf_ul.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/amiga/dev/grf_ul.c,v retrieving revision 1.47 diff -u -p -r1.47 grf_ul.c --- sys/arch/amiga/dev/grf_ul.c 15 Dec 2011 14:25:13 -0000 1.47 +++ sys/arch/amiga/dev/grf_ul.c 6 Oct 2012 03:05:03 -0000 @@ -430,11 +430,11 @@ ul_load_mon(struct grf_softc *gp, struct int ul_mode(struct grf_softc *, u_long, void *, u_long, int); -void grfulattach(struct device *, struct device *, void *); +void grfulattach(device_t, device_t, void *); int grfulprint(void *, const char *); -int grfulmatch(struct device *, struct cfdata *, void *); +int grfulmatch(device_t, cfdata_t, void *); -CFATTACH_DECL(grful, sizeof(struct grf_ul_softc), +CFATTACH_DECL_NEW(grful, sizeof(struct grf_ul_softc), grfulmatch, grfulattach, NULL, NULL); /* @@ -447,14 +447,14 @@ static struct cfdata *cfdata; * tricky regarding the console. */ int -grfulmatch(struct device *pdp, struct cfdata *cfp, void *auxp) +grfulmatch(device_t parent, cfdata_t cf, void *aux) { #ifdef ULOWELLCONSOLE static int ulconunit = -1; #endif struct zbus_args *zap; - zap = auxp; + zap = aux; /* * allow only one ulowell console @@ -469,7 +469,7 @@ grfulmatch(struct device *pdp, struct cf return(0); #ifdef ULOWELLCONSOLE - if (amiga_realconfig == 0 || ulconunit != cfp->cf_unit) { + if (amiga_realconfig == 0 || ulconunit != cf->cf_unit) { #endif if ((unsigned)ulowell_default_mon > ulowell_mon_max) ulowell_default_mon = 1; @@ -479,8 +479,8 @@ grfulmatch(struct device *pdp, struct cf return(0); #ifdef ULOWELLCONSOLE if (amiga_realconfig == 0) { - ulconunit = cfp->cf_unit; - cfdata = cfp; + ulconunit = cf->cf_unit; + cfdata = cf; } } #endif @@ -491,23 +491,28 @@ grfulmatch(struct device *pdp, struct cf * attach to the grfbus (zbus) */ void -grfulattach(struct device *pdp, struct device *dp, void *auxp) +grfulattach(device_t parent, device_t self, void *aux) { static struct grf_ul_softc congrf; + struct device temp; struct zbus_args *zap; struct grf_softc *gp; struct grf_ul_softc *gup; - zap = auxp; + zap = aux; - if (dp == NULL) + if (self == NULL) { gup = &congrf; - else - gup = (struct grf_ul_softc *)dp; - - gp = &gup->gus_sc; + gp = &gup->gus_sc; + gp->g_device = &temp; + temp.dv_private = gp; + } else { + gup = device_private(self); + gp = &gup->gus_sc; + gp->g_device = self; + } - if (dp != NULL && congrf.gus_sc.g_regkva != 0) { + if (self != NULL && congrf.gus_sc.g_regkva != 0) { /* * inited earlier, just copy (not device struct) */ @@ -546,19 +551,19 @@ grfulattach(struct device *pdp, struct d grful_iteinit(gp); #endif } - if (dp != NULL) + if (self != NULL) printf("\n"); /* * attach grf */ - amiga_config_found(cfdata, &gp->g_device, gp, grfulprint); + amiga_config_found(cfdata, self, gp, grfulprint); } int -grfulprint(void *auxp, const char *pnp) +grfulprint(void *aux, const char *pnp) { if (pnp) - aprint_normal("grf%d at %s", ((struct grf_softc *)auxp)->g_unit, + aprint_normal("grf%d at %s", ((struct grf_softc *)aux)->g_unit, pnp); return(UNCONF); } Index: sys/arch/amiga/dev/grfvar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/amiga/dev/grfvar.h,v retrieving revision 1.23 diff -u -p -r1.23 grfvar.h --- sys/arch/amiga/dev/grfvar.h 15 Dec 2011 14:25:13 -0000 1.23 +++ sys/arch/amiga/dev/grfvar.h 28 Sep 2012 05:23:24 -0000 @@ -51,7 +51,7 @@ struct ite_softc; * uses it... */ struct grf_softc { - struct device g_device; /* config sets this up. */ + device_t g_device; /* config sets this up. */ struct grfinfo g_display; /* hardware description (for ioctl) */ volatile void *g_regkva; /* KVA of registers */ volatile void *g_fbkva; /* KVA of framebuffer */ Index: sys/arch/amiga/dev/gtsc.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/amiga/dev/gtsc.c,v retrieving revision 1.40 diff -u -p -r1.40 gtsc.c --- sys/arch/amiga/dev/gtsc.c 9 Feb 2010 18:13:10 -0000 1.40 +++ sys/arch/amiga/dev/gtsc.c 28 Sep 2012 14:58:20 -0000 @@ -88,8 +88,8 @@ __KERNEL_RCSID(0, "$NetBSD: gtsc.c,v 1.4 #include #include -void gtscattach(struct device *, struct device *, void *); -int gtscmatch(struct device *, struct cfdata *, void *); +void gtscattach(device_t, device_t, void *); +int gtscmatch(device_t, cfdata_t, void *); void gtsc_enintr(struct sbic_softc *); void gtsc_dmastop(struct sbic_softc *); @@ -110,15 +110,15 @@ int gtsc_clock_override = 0; int gtsc_debug = 0; #endif -CFATTACH_DECL(gtsc, sizeof(struct sbic_softc), +CFATTACH_DECL_NEW(gtsc, sizeof(struct sbic_softc), gtscmatch, gtscattach, NULL, NULL); int -gtscmatch(struct device *pdp, struct cfdata *cfp, void *auxp) +gtscmatch(device_t parent, cfdata_t cf, void *aux) { struct gvpbus_args *gap; - gap = auxp; + gap = aux; if (gap->flags & GVP_SCSI) return(1); return(0); @@ -128,15 +128,16 @@ gtscmatch(struct device *pdp, struct cfd * attach all devices on our board. */ void -gtscattach(struct device *pdp, struct device *dp, void *auxp) +gtscattach(device_t parent, device_t self, void *aux) { volatile struct sdmac *rp; struct gvpbus_args *gap; - struct sbic_softc *sc = (struct sbic_softc *)dp; + struct sbic_softc *sc = device_private(self); struct scsipi_adapter *adapt = &sc->sc_adapter; struct scsipi_channel *chan = &sc->sc_channel; - gap = auxp; + gap = aux; + sc->sc_dev = self; sc->sc_cregs = rp = gap->zargs.va; /* @@ -210,7 +211,7 @@ gtscattach(struct device *pdp, struct de * Fill in the scsipi_adapter. */ memset(adapt, 0, sizeof(*adapt)); - adapt->adapt_dev = &sc->sc_dev; + adapt->adapt_dev = self; adapt->adapt_nchannels = 1; adapt->adapt_openings = 7; adapt->adapt_max_periph = 1; @@ -238,7 +239,7 @@ gtscattach(struct device *pdp, struct de /* * attach all scsi units on us */ - config_found(dp, chan, scsiprint); + config_found(self, chan, scsiprint); } void @@ -344,7 +345,7 @@ gtsc_dmaintr(void *arg) return (0); #ifdef DEBUG if (gtsc_debug & DDB_FOLLOW) - printf("%s: dmaintr 0x%x\n", dev->sc_dev.dv_xname, stat); + printf("%s: dmaintr 0x%x\n", device_xname(dev->sc_dev), stat); #endif if (dev->sc_flags & SBICF_INTR) if (sbicintr(dev)) Index: sys/arch/amiga/dev/gvpbus.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/amiga/dev/gvpbus.c,v retrieving revision 1.25 diff -u -p -r1.25 gvpbus.c --- sys/arch/amiga/dev/gvpbus.c 3 Jun 2011 00:52:22 -0000 1.25 +++ sys/arch/amiga/dev/gvpbus.c 29 Sep 2012 11:04:03 -0000 @@ -50,11 +50,11 @@ CFATTACH_DECL_NEW(gvpbus, 0, gvpbusmatch, gvpbusattach, NULL, NULL); int -gvpbusmatch(device_t pdp, cfdata_t cfp, void *auxp) +gvpbusmatch(device_t parent, cfdata_t cf, void *aux) { struct zbus_args *zap; - zap = auxp; + zap = aux; /* * Check manufacturer and product id. @@ -69,13 +69,13 @@ gvpbusmatch(device_t pdp, cfdata_t cfp, } void -gvpbusattach(device_t pdp, device_t dp, void *auxp) +gvpbusattach(device_t parent, device_t self, void *aux) { struct zbus_args *zap; struct gvpbus_args ga; int flags0, flags; - zap = auxp; + zap = aux; memcpy(&ga.zargs, zap, sizeof(struct zbus_args)); flags = 0; @@ -145,20 +145,20 @@ gvpbusattach(device_t pdp, device_t dp, if (flags & GVP_SCSI) { ga.flags = flags0 | GVP_SCSI; - config_found(dp, &ga, gvpbusprint); + config_found(self, &ga, gvpbusprint); } if (flags & GVP_IO) { ga.flags = flags0 | GVP_IO; - config_found(dp, &ga, gvpbusprint); + config_found(self, &ga, gvpbusprint); } } int -gvpbusprint(void *auxp, const char *pnp) +gvpbusprint(void *aux, const char *pnp) { struct gvpbus_args *gap; - gap = auxp; + gap = aux; if (pnp == NULL) return(QUIET); /* @@ -170,4 +170,3 @@ gvpbusprint(void *auxp, const char *pnp) aprint_normal("gtsc at %s", pnp); return(UNCONF); } - Index: sys/arch/amiga/dev/gvpio.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/amiga/dev/gvpio.c,v retrieving revision 1.19 diff -u -p -r1.19 gvpio.c --- sys/arch/amiga/dev/gvpio.c 19 Jul 2011 15:55:26 -0000 1.19 +++ sys/arch/amiga/dev/gvpio.c 29 Sep 2012 10:48:00 -0000 @@ -52,29 +52,28 @@ __KERNEL_RCSID(0, "$NetBSD: gvpio.c,v 1. #include struct gvpio_softc { - struct device sc_dev; struct bus_space_tag sc_bst; void *sc_cntr; LIST_HEAD(, gvpcom_int_hdl) sc_comhdls; struct isr sc_comisr; }; -int gvpiomatch(struct device *, struct cfdata *, void *); -void gvpioattach(struct device *, struct device *, void *); +int gvpiomatch(device_t, cfdata_t, void *); +void gvpioattach(device_t, device_t, void *); int gvpioprint(void *auxp, const char *); int gvp_com_intr(void *); -void gvp_com_intr_establish(struct device *, struct gvpcom_int_hdl *); +void gvp_com_intr_establish(device_t, struct gvpcom_int_hdl *); -CFATTACH_DECL(gvpio, sizeof(struct gvpio_softc), +CFATTACH_DECL_NEW(gvpio, sizeof(struct gvpio_softc), gvpiomatch, gvpioattach, NULL, NULL); int -gvpiomatch(struct device *parent, struct cfdata *cfp, void *auxp) +gvpiomatch(device_t parent, cfdata_t cf, void *aux) { struct gvpbus_args *gap; - gap = auxp; + gap = aux; if (gap->flags & GVP_IO) return (1); @@ -95,7 +94,7 @@ struct gvpio_devs { }; void -gvpioattach(struct device *parent, struct device *self, void *auxp) +gvpioattach(device_t parent, device_t self, void *aux) { struct gvpio_softc *giosc; struct gvpio_devs *giosd; @@ -106,8 +105,8 @@ gvpioattach(struct device *parent, struc u_int16_t needpsl; #endif - giosc = (struct gvpio_softc *)self; - gap = auxp; + giosc = device_private(self); + gap = aux; if (parent) printf("\n"); @@ -142,7 +141,7 @@ gvpioattach(struct device *parent, struc if (ipl2spl_table[IPL_SERIAL] < needpsl) { printf("%s: raising ipl2spl_table[IPL_SERIAL] " "from 0x%x to 0x%x\n", - giosc->sc_dev.dv_xname, ipl2spl_table[IPL_SERIAL], + device_xname(self), ipl2spl_table[IPL_SERIAL], needpsl); ipl2spl_table[IPL_SERIAL] = needpsl; } @@ -171,11 +170,11 @@ gvpioprint(void *auxp, const char *pnp) } void -gvp_com_intr_establish(struct device *self, struct gvpcom_int_hdl *p) +gvp_com_intr_establish(device_t self, struct gvpcom_int_hdl *p) { struct gvpio_softc *sc; - sc = (struct gvpio_softc *)self; + sc = device_private(self); LIST_INSERT_HEAD(&sc->sc_comhdls, p, next); } Index: sys/arch/amiga/dev/hyper.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/amiga/dev/hyper.c,v retrieving revision 1.21 diff -u -p -r1.21 hyper.c --- sys/arch/amiga/dev/hyper.c 19 Jul 2011 15:55:27 -0000 1.21 +++ sys/arch/amiga/dev/hyper.c 28 Sep 2012 14:52:23 -0000 @@ -54,15 +54,14 @@ __KERNEL_RCSID(0, "$NetBSD: hyper.c,v 1. struct hyper_softc { - struct device sc_dev; struct bus_space_tag sc_bst; }; -int hypermatch(struct device *, struct cfdata *, void *); -void hyperattach(struct device *, struct device *, void *); -int hyperprint(void *auxp, const char *); +int hypermatch(device_t, cfdata_t, void *); +void hyperattach(device_t, device_t, void *); +int hyperprint(void *, const char *); -CFATTACH_DECL(hyper, sizeof(struct hyper_softc), +CFATTACH_DECL_NEW(hyper, sizeof(struct hyper_softc), hypermatch, hyperattach, NULL, NULL); struct hyper_prods { @@ -80,12 +79,11 @@ struct hyper_prods { }; int -hypermatch(struct device *parent, struct cfdata *cfp, void *auxp) +hypermatch(device_t parent, cfdata_t cf, void *aux) { - struct zbus_args *zap; - zap = auxp; + zap = aux; if (zap->manid != 5001) return (0); @@ -123,7 +121,7 @@ struct hyper_devs { }; void -hyperattach(struct device *parent, struct device *self, void *auxp) +hyperattach(device_t parent, device_t self, void *aux) { struct hyper_softc *hprsc; struct hyper_devs *hprsd; @@ -131,8 +129,8 @@ hyperattach(struct device *parent, struc struct supio_attach_args supa; struct hyper_prods *hprpp; - hprsc = (struct hyper_softc *)self; - zap = auxp; + hprsc = device_private(self); + zap = aux; hprpp = &hyperproducts[zap->prodid]; if (parent) @@ -158,10 +156,10 @@ hyperattach(struct device *parent, struc } int -hyperprint(void *auxp, const char *pnp) +hyperprint(void *aux, const char *pnp) { struct supio_attach_args *supa; - supa = auxp; + supa = aux; if (pnp == NULL) return(QUIET); Index: sys/arch/amiga/dev/if_bah_zbus.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/amiga/dev/if_bah_zbus.c,v retrieving revision 1.14 diff -u -p -r1.14 if_bah_zbus.c --- sys/arch/amiga/dev/if_bah_zbus.c 19 Jul 2011 15:55:27 -0000 1.14 +++ sys/arch/amiga/dev/if_bah_zbus.c 29 Sep 2012 10:47:04 -0000 @@ -74,15 +74,15 @@ struct bah_zbus_softc { struct isr sc_isr; }; -int bah_zbus_match(struct device *, struct cfdata *, void *); -void bah_zbus_attach(struct device *, struct device *, void *); +int bah_zbus_match(device_t, cfdata_t, void *); +void bah_zbus_attach(device_t, device_t, void *); void bah_zbus_reset(struct bah_softc *, int); -CFATTACH_DECL(bah_zbus, sizeof(struct bah_zbus_softc), +CFATTACH_DECL_NEW(bah_zbus, sizeof(struct bah_zbus_softc), bah_zbus_match, bah_zbus_attach, NULL, NULL); int -bah_zbus_match(struct device *parent, struct cfdata *cfp, void *aux) +bah_zbus_match(device_t parent, cfdata_t cf, void *aux) { struct zbus_args *zap = aux; @@ -93,15 +93,16 @@ bah_zbus_match(struct device *parent, st } void -bah_zbus_attach(struct device *parent, struct device *self, void *aux) +bah_zbus_attach(device_t parent, device_t self, void *aux) { - struct bah_zbus_softc *bsc = (void *)self; + struct bah_zbus_softc *bsc = device_private(self); struct bah_softc *sc = &bsc->sc_bah; struct zbus_args *zap = aux; + sc->sc_dev = self; #if (defined(BAH_DEBUG) && (BAH_DEBUG > 2)) printf("\n%s: attach(0x%x, 0x%x, 0x%x)\n", - sc->sc_dev.dv_xname, parent, self, aux); + device_xname(self), parent, self, aux); #endif bsc->sc_bst.base = (bus_addr_t)zap->va; bsc->sc_bst.absm = &amiga_bus_stride_2; Index: sys/arch/amiga/dev/if_ed.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/amiga/dev/if_ed.c,v retrieving revision 1.62 diff -u -p -r1.62 if_ed.c --- sys/arch/amiga/dev/if_ed.c 5 Apr 2010 07:19:29 -0000 1.62 +++ sys/arch/amiga/dev/if_ed.c 29 Sep 2012 10:46:52 -0000 @@ -70,7 +70,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_ed.c,v 1. * ed_softc: per line info and status */ struct ed_softc { - struct device sc_dev; + device_t sc_dev; struct isr sc_isr; struct ethercom sc_ethercom; /* ethernet common */ @@ -97,8 +97,8 @@ struct ed_softc { u_char next_packet; /* pointer to next unread RX packet */ }; -int ed_zbus_match(struct device *, struct cfdata *, void *); -void ed_zbus_attach(struct device *, struct device *, void *); +int ed_zbus_match(device_t, cfdata_t, void *); +void ed_zbus_attach(device_t, device_t, void *); int edintr(void *); int ed_ioctl(struct ifnet *, u_long, void *); void ed_start(struct ifnet *); @@ -124,7 +124,7 @@ static inline void word_zero(void *, int struct mbuf *ed_ring_to_mbuf(struct ed_softc *, void *, struct mbuf *, u_short); -CFATTACH_DECL(ed_zbus, sizeof(struct ed_softc), +CFATTACH_DECL_NEW(ed_zbus, sizeof(struct ed_softc), ed_zbus_match, ed_zbus_attach, NULL, NULL); static inline void @@ -186,7 +186,7 @@ word_zero(void *a, int len) } int -ed_zbus_match(struct device *parent, struct cfdata *cfp, void *aux) +ed_zbus_match(device_t parent, cfdata_t cf, void *aux) { struct zbus_args *zap = aux; @@ -198,16 +198,17 @@ ed_zbus_match(struct device *parent, str } void -ed_zbus_attach(struct device *parent, struct device *self, void *aux) +ed_zbus_attach(device_t parent, device_t self, void *aux) { - struct ed_softc *sc = (void *)self; + struct ed_softc *sc = device_private(self); struct zbus_args *zap = aux; - struct cfdata *cf = device_cfdata(&sc->sc_dev); + struct cfdata *cf = device_cfdata(self); struct ifnet *ifp = &sc->sc_ethercom.ec_if; volatile u_char *prom; int i; u_int8_t myaddr[ETHER_ADDR_LEN]; + sc->sc_dev = self; if (zap->manid == HYDRA_MANID) { sc->mem_start = zap->va; sc->mem_size = 16384; @@ -259,7 +260,7 @@ ed_zbus_attach(struct device *parent, st ed_stop(sc); /* Initialize ifnet structure. */ - memcpy(ifp->if_xname, sc->sc_dev.dv_xname, IFNAMSIZ); + memcpy(ifp->if_xname, device_xname(sc->sc_dev), IFNAMSIZ); ifp->if_softc = sc; ifp->if_start = ed_start; ifp->if_ioctl = ed_ioctl; @@ -292,7 +293,7 @@ ed_reset(struct ed_softc *sc) ed_stop(sc); ed_init(sc); splx(s); - log(LOG_ERR, "%s: reset\n", sc->sc_dev.dv_xname); + log(LOG_ERR, "%s: reset\n", device_xname(sc->sc_dev)); } /* @@ -323,7 +324,7 @@ ed_watchdog(struct ifnet *ifp) { struct ed_softc *sc = ifp->if_softc; - log(LOG_ERR, "%s: device timeout\n", sc->sc_dev.dv_xname); + log(LOG_ERR, "%s: device timeout\n", device_xname(sc->sc_dev)); ++ifp->if_oerrors; ed_reset(sc); @@ -503,7 +504,7 @@ outloop: */ if (sc->txb_inuse && (sc->xmit_busy == 0)) { printf("%s: packets buffered, but transmitter idle\n", - sc->sc_dev.dv_xname); + device_xname(sc->sc_dev)); ed_xmit(sc); } @@ -621,9 +622,9 @@ loop: #ifdef DIAGNOSTIC if (len != packet_hdr.count) { printf("%s: length does not match next packet pointer\n", - sc->sc_dev.dv_xname); + device_xname(sc->sc_dev)); printf("%s: len %04x nlen %04x start %02x first %02x curr %02x next %02x stop %02x\n", - sc->sc_dev.dv_xname, packet_hdr.count, len, + device_xname(sc->sc_dev), packet_hdr.count, len, sc->rec_page_start, sc->next_packet, current, packet_hdr.next_packet, sc->rec_page_stop); } @@ -653,7 +654,7 @@ loop: #ifdef DEBUG_AMIGA_IF_ED log(LOG_ERR, "%s: NIC memory corrupt - invalid packet length %d\n", - sc->sc_dev.dv_xname, len); + device_xname(sc->sc_dev), len); #endif ++ifp->if_ierrors; ed_reset(sc); @@ -781,7 +782,7 @@ edintr(void *arg) #ifdef DIAGNOSTIC log(LOG_WARNING, "%s: warning - receiver ring buffer overrun\n", - sc->sc_dev.dv_xname); + device_xname(sc->sc_dev)); #endif /* Stop/reset/re-init NIC. */ ed_reset(sc); @@ -795,7 +796,7 @@ edintr(void *arg) ++ifp->if_ierrors; #ifdef ED_DEBUG printf("%s: receive error %x\n", - sc->sc_dev.dv_xname, + device_xname(sc->sc_dev), NIC_GET(sc, ED_P0_RSR)); #endif } Index: sys/arch/amiga/dev/if_es.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/amiga/dev/if_es.c,v retrieving revision 1.50 diff -u -p -r1.50 if_es.c --- sys/arch/amiga/dev/if_es.c 5 Apr 2010 07:19:29 -0000 1.50 +++ sys/arch/amiga/dev/if_es.c 29 Sep 2012 10:46:29 -0000 @@ -83,7 +83,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_es.c,v 1. * This structure contains the output queue for the interface, its address, ... */ struct es_softc { - struct device sc_dev; + device_t sc_dev; struct isr sc_isr; struct ethercom sc_ethercom; /* common Ethernet structures */ struct ifmedia sc_media; /* our supported media */ @@ -123,14 +123,14 @@ void esstop(struct es_softc *); int esmediachange(struct ifnet *); void esmediastatus(struct ifnet *, struct ifmediareq *); -int esmatch(struct device *, struct cfdata *, void *); -void esattach(struct device *, struct device *, void *); +int esmatch(device_t, cfdata_t, void *); +void esattach(device_t, device_t, void *); -CFATTACH_DECL(es, sizeof(struct es_softc), +CFATTACH_DECL_NEW(es, sizeof(struct es_softc), esmatch, esattach, NULL, NULL); int -esmatch(struct device *parent, struct cfdata *cfp, void *aux) +esmatch(device_t parent, cfdata_t cf, void *aux) { struct zbus_args *zap = aux; @@ -147,14 +147,15 @@ esmatch(struct device *parent, struct cf * to accept packets. */ void -esattach(struct device *parent, struct device *self, void *aux) +esattach(device_t parent, device_t self, void *aux) { - struct es_softc *sc = (void *)self; + struct es_softc *sc = device_private(self); struct zbus_args *zap = aux; struct ifnet *ifp = &sc->sc_ethercom.ec_if; unsigned long ser; u_int8_t myaddr[ETHER_ADDR_LEN]; + sc->sc_dev = self; sc->sc_base = zap->va; /* @@ -175,7 +176,7 @@ esattach(struct device *parent, struct d myaddr[5] = (ser ) & 0xff; /* Initialize ifnet structure. */ - memcpy(ifp->if_xname, sc->sc_dev.dv_xname, IFNAMSIZ); + memcpy(ifp->if_xname, device_xname(sc->sc_dev), IFNAMSIZ); ifp->if_softc = sc; ifp->if_ioctl = esioctl; ifp->if_start = esstart; @@ -314,7 +315,7 @@ esintr(void *arg) #ifdef ESDEBUG while ((smc->b2.bsr & BSR_MASK) != BSR_BANK2 && ifp->if_flags & IFF_RUNNING) { - printf("%s: intr BSR not 2: %04x\n", sc->sc_dev.dv_xname, + printf("%s: intr BSR not 2: %04x\n", device_xname(sc->sc_dev), smc->b2.bsr); smc->b2.bsr = BSR_BANK2; } @@ -328,13 +329,13 @@ esintr(void *arg) #ifdef ESDEBUG if (esdebug) printf ("%s: esintr ist %02x msk %02x", - sc->sc_dev.dv_xname, intsts, smc->b2.msk); + device_xname(sc->sc_dev), intsts, smc->b2.msk); if (sc->sc_intbusy++) { - printf("%s: esintr re-entered\n", sc->sc_dev.dv_xname); + printf("%s: esintr re-entered\n", device_xname(sc->sc_dev)); panic("esintr re-entered"); } if (sc->sc_smcbusy) - printf("%s: esintr interrupted busy %d\n", sc->sc_dev.dv_xname, + printf("%s: esintr interrupted busy %d\n", device_xname(sc->sc_dev), sc->sc_smcbusy); #endif smc->b2.msk = 0; @@ -348,7 +349,7 @@ esintr(void *arg) sc->sc_intctl &= ~MSK_ALLOC; #ifdef ESDEBUG if (esdebug || 1) - printf ("%s: ist %02x", sc->sc_dev.dv_xname, + printf ("%s: ist %02x", device_xname(sc->sc_dev), intsts); #endif if ((smc->b2.arr & ARR_FAILED) == 0) { @@ -373,7 +374,7 @@ esintr(void *arg) } #ifdef ESDEBUG while ((smc->b2.bsr & BSR_MASK) != BSR_BANK2) { - printf("%s: intr+ BSR not 2: %04x\n", sc->sc_dev.dv_xname, + printf("%s: intr+ BSR not 2: %04x\n", device_xname(sc->sc_dev), smc->b2.bsr); smc->b2.bsr = BSR_BANK2; } @@ -383,13 +384,13 @@ esintr(void *arg) } #ifdef ESDEBUG while ((smc->b2.bsr & BSR_MASK) != BSR_BANK2) { - printf("%s: intr++ BSR not 2: %04x\n", sc->sc_dev.dv_xname, + printf("%s: intr++ BSR not 2: %04x\n", device_xname(sc->sc_dev), smc->b2.bsr); smc->b2.bsr = BSR_BANK2; } #endif if (intact & IST_RX_OVRN) { - printf ("%s: Overrun ist %02x", sc->sc_dev.dv_xname, + printf ("%s: Overrun ist %02x", device_xname(sc->sc_dev), intsts); smc->b2.ist = ACK_RX_OVRN; printf ("->%02x\n", smc->b2.ist); @@ -400,7 +401,7 @@ esintr(void *arg) #ifdef ESDEBUG if (esdebug) printf ("%s: TX EMPTY %02x", - sc->sc_dev.dv_xname, intsts); + device_xname(sc->sc_dev), intsts); ++estxint5; /* count # IST_TX_EMPTY ints */ #endif smc->b2.ist = ACK_TX_EMPTY; @@ -436,7 +437,7 @@ esintr(void *arg) #ifdef ESDEBUG if (esdebug) { printf ("%s: TX INT ist %02x", - sc->sc_dev.dv_xname, intsts); + device_xname(sc->sc_dev), intsts); printf ("->%02x\n", smc->b2.ist); } ++estxint3; /* count # IST_TX */ @@ -456,7 +457,7 @@ zzzz: smc->b2.ptr = PTR_READ; /* point to status word */ #if 0 /* XXXX */ printf("%s: esintr TXINT IST %02x PNR %02x(%d)", - sc->sc_dev.dv_xname, smc->b2.ist, + device_xname(sc->sc_dev), smc->b2.ist, tx_pnr, n); printf(" Status %04x", smc->b2.data); printf(" EPHSR %04x\n", ephsr); @@ -503,7 +504,7 @@ zzzz: if ((smc->b2.fifo & FIFO_TEMPTY) == 0 && n++ < 32) { #if 0 /* XXXX */ printf("%s: multiple TX int(%2d) pnr %02x ist %02x fifo %04x", - sc->sc_dev.dv_xname, n, tx_pnr, smc->b2.ist, smc->b2.fifo); + device_xname(sc->sc_dev), n, tx_pnr, smc->b2.ist, smc->b2.fifo); smc->w2.istmsk = ACK_TX << 8; printf(" %04x\n", smc->b2.fifo); #endif @@ -519,7 +520,7 @@ zzzz: estint(sc); #ifdef ESDEBUG while ((smc->b2.bsr & BSR_MASK) != BSR_BANK2) { - printf("%s: intr+++ BSR not 2: %04x\n", sc->sc_dev.dv_xname, + printf("%s: intr+++ BSR not 2: %04x\n", device_xname(sc->sc_dev), smc->b2.bsr); smc->b2.bsr = BSR_BANK2; } @@ -527,7 +528,7 @@ zzzz: smc->b2.msk = sc->sc_intctl; #ifdef ESDEBUG if (--sc->sc_intbusy) { - printf("%s: esintr busy on exit\n", sc->sc_dev.dv_xname); + printf("%s: esintr busy on exit\n", device_xname(sc->sc_dev)); panic("esintr busy on exit"); } #endif @@ -559,14 +560,14 @@ esrint(struct es_softc *sc) ifp = &sc->sc_ethercom.ec_if; #ifdef ESDEBUG if (esdebug) - printf ("%s: esrint fifo %04x", sc->sc_dev.dv_xname, + printf ("%s: esrint fifo %04x", device_xname(sc->sc_dev), smc->b2.fifo); if (sc->sc_smcbusy++) { - printf("%s: esrint re-entered\n", sc->sc_dev.dv_xname); + printf("%s: esrint re-entered\n", device_xname(sc->sc_dev)); panic("esrint re-entered"); } while ((smc->b2.bsr & BSR_MASK) != BSR_BANK2) { - printf("%s: rint BSR not 2: %04x\n", sc->sc_dev.dv_xname, + printf("%s: rint BSR not 2: %04x\n", device_xname(sc->sc_dev), smc->b2.bsr); smc->b2.bsr = BSR_BANK2; } @@ -594,7 +595,7 @@ esrint(struct es_softc *sc) pktlen++; if (len > 1530) { printf("%s: Corrupted packet length-sts %04x bytcnt %04x len %04x bank %04x\n", - sc->sc_dev.dv_xname, pktctlw, pktlen, len, smc->b2.bsr); + device_xname(sc->sc_dev), pktctlw, pktlen, len, smc->b2.bsr); /* XXX ignore packet, or just truncate? */ #if defined(ESDEBUG) && defined(DDB) if ((smc->b2.bsr & BSR_MASK) != BSR_BANK2) @@ -608,7 +609,7 @@ esrint(struct es_softc *sc) #ifdef ESDEBUG if (--sc->sc_smcbusy) { printf("%s: esrintr busy on bad packet exit\n", - sc->sc_dev.dv_xname); + device_xname(sc->sc_dev)); panic("esrintr busy on exit"); } #endif @@ -636,7 +637,7 @@ esrint(struct es_softc *sc) ; #ifdef ESDEBUG if (pktctlw & (RFSW_ALGNERR | RFSW_BADCRC | RFSW_TOOLNG | RFSW_TOOSHORT)) { - printf ("%s: Packet error %04x\n", sc->sc_dev.dv_xname, pktctlw); + printf ("%s: Packet error %04x\n", device_xname(sc->sc_dev), pktctlw); /* count input error? */ } if (esdebug) { @@ -653,7 +654,7 @@ esrint(struct es_softc *sc) /* XXX copy directly from controller to mbuf */ #ifdef ESDEBUG if (pktctlw & (RFSW_ALGNERR | RFSW_BADCRC | RFSW_TOOLNG | RFSW_TOOSHORT)) { - printf ("%s: Packet error %04x\n", sc->sc_dev.dv_xname, pktctlw); + printf ("%s: Packet error %04x\n", device_xname(sc->sc_dev), pktctlw); /* count input error? */ } if (esdebug) { @@ -727,7 +728,7 @@ esrint(struct es_softc *sc) (*ifp->if_input)(ifp, top); #ifdef ESDEBUG if (--sc->sc_smcbusy) { - printf("%s: esintr busy on exit\n", sc->sc_dev.dv_xname); + printf("%s: esintr busy on exit\n", device_xname(sc->sc_dev)); panic("esintr busy on exit"); } #endif @@ -768,11 +769,11 @@ esstart(struct ifnet *ifp) #ifdef ESDEBUG if (sc->sc_smcbusy++) { - printf("%s: esstart re-entered\n", sc->sc_dev.dv_xname); + printf("%s: esstart re-entered\n", device_xname(sc->sc_dev)); panic("esstart re-entred"); } while ((smc->b2.bsr & BSR_MASK) != BSR_BANK2) { - printf("%s: esstart BSR not 2: %04x\n", sc->sc_dev.dv_xname, + printf("%s: esstart BSR not 2: %04x\n", device_xname(sc->sc_dev), smc->b2.bsr); smc->b2.bsr = BSR_BANK2; } @@ -791,7 +792,7 @@ esstart(struct ifnet *ifp) #ifdef ESDEBUG if (esdebug && (m->m_next || m->m_len & 1)) printf("%s: esstart m_next %p m_len %d\n", - sc->sc_dev.dv_xname, m->m_next, m->m_len); + device_xname(sc->sc_dev), m->m_next, m->m_len); #endif for (m0 = m, pktlen = 0; m0; m0 = m0->m_next) pktlen += m0->m_len; @@ -815,7 +816,7 @@ esstart(struct ifnet *ifp) #ifdef ESDEBUG while ((smc->b2.bsr & BSR_MASK) != BSR_BANK2) { - printf("%s: esstart+ BSR not 2: %04x\n", sc->sc_dev.dv_xname, + printf("%s: esstart+ BSR not 2: %04x\n", device_xname(sc->sc_dev), smc->b2.bsr); smc->b2.bsr = BSR_BANK2; } @@ -828,7 +829,7 @@ esstart(struct ifnet *ifp) *data = SWAP(pktlen); #ifdef ESDEBUG while ((smc->b2.bsr & BSR_MASK) != BSR_BANK2) { - printf("%s: esstart++ BSR not 2: %04x\n", sc->sc_dev.dv_xname, + printf("%s: esstart++ BSR not 2: %04x\n", device_xname(sc->sc_dev), smc->b2.bsr); smc->b2.bsr = BSR_BANK2; } @@ -848,7 +849,7 @@ esstart(struct ifnet *ifp) #ifdef ESDEBUG if (pktlen > sizeof(pktbuf) && i > (sizeof(pktbuf) * 2)) printf("%s: esstart packet longer than pktbuf\n", - sc->sc_dev.dv_xname); + device_xname(sc->sc_dev)); #endif #if 0 /* doesn't quite work? */ lbuf = (u_long *)(pktbuf); @@ -863,7 +864,7 @@ esstart(struct ifnet *ifp) #else #ifdef ESDEBUG while ((smc->b2.bsr & BSR_MASK) != BSR_BANK2) { - printf("%s: esstart++2 BSR not 2: %04x\n", sc->sc_dev.dv_xname, + printf("%s: esstart++2 BSR not 2: %04x\n", device_xname(sc->sc_dev), smc->b2.bsr); smc->b2.bsr = BSR_BANK2; } @@ -893,7 +894,7 @@ esstart(struct ifnet *ifp) pktctlw = (*buf & 0xff00) | CTLB_ODD; if (m->m_len & 1 && m->m_next) printf("%s: esstart odd byte count in mbuf\n", - sc->sc_dev.dv_xname); + device_xname(sc->sc_dev)); } *data = pktctlw; #endif /* USEPKTBUF */ @@ -909,7 +910,7 @@ esstart(struct ifnet *ifp) */ #ifdef DIAGNOSTIC printf("%s: esstart+++ BSR not 2: %04x\n", - sc->sc_dev.dv_xname, smc->b2.bsr); + device_xname(sc->sc_dev), smc->b2.bsr); #endif smc->b2.bsr = BSR_BANK2; #ifdef ESDEBUG @@ -924,7 +925,7 @@ esstart(struct ifnet *ifp) smc->b2.mmucr = MMUCR_ENQ_TX; if (smc->b2.pnr != active_pnr) printf("%s: esstart - PNR changed %x->%x\n", - sc->sc_dev.dv_xname, active_pnr, smc->b2.pnr); + device_xname(sc->sc_dev), active_pnr, smc->b2.pnr); bpf_mtap(&sc->sc_ethercom.ec_if, m0); m_freem(m0); sc->sc_ethercom.ec_if.if_opackets++; /* move to interrupt? */ @@ -934,12 +935,12 @@ esstart(struct ifnet *ifp) smc->b2.msk = sc->sc_intctl; #ifdef ESDEBUG while ((smc->b2.bsr & BSR_MASK) != BSR_BANK2) { - printf("%s: esstart++++ BSR not 2: %04x\n", sc->sc_dev.dv_xname, + printf("%s: esstart++++ BSR not 2: %04x\n", device_xname(sc->sc_dev), smc->b2.bsr); smc->b2.bsr = BSR_BANK2; } if (--sc->sc_smcbusy) { - printf("%s: esstart busy on exit\n", sc->sc_dev.dv_xname); + printf("%s: esstart busy on exit\n", device_xname(sc->sc_dev)); panic("esstart busy on exit"); } #endif @@ -1074,7 +1075,7 @@ eswatchdog(struct ifnet *ifp) { struct es_softc *sc = ifp->if_softc; - log(LOG_ERR, "%s: device timeout\n", sc->sc_dev.dv_xname); + log(LOG_ERR, "%s: device timeout\n", device_xname(sc->sc_dev)); ++ifp->if_oerrors; esreset(sc); Index: sys/arch/amiga/dev/if_qn.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/amiga/dev/if_qn.c,v retrieving revision 1.38 diff -u -p -r1.38 if_qn.c --- sys/arch/amiga/dev/if_qn.c 5 Apr 2010 07:19:29 -0000 1.38 +++ sys/arch/amiga/dev/if_qn.c 28 Sep 2012 14:18:36 -0000 @@ -131,7 +131,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_qn.c,v 1. * This structure contains the output queue for the interface, its address, ... */ struct qn_softc { - struct device sc_dev; + device_t sc_dev; struct isr sc_isr; struct ethercom sc_ethercom; /* Common ethernet structures */ u_char volatile *sc_base; @@ -152,8 +152,8 @@ struct qn_softc { #include -int qnmatch(struct device *, struct cfdata *, void *); -void qnattach(struct device *, struct device *, void *); +int qnmatch(device_t, cfdata_t, void *); +void qnattach(device_t, device_t, void *); int qnintr(void *); int qnioctl(struct ifnet *, u_long, void *); void qnstart(struct ifnet *); @@ -172,11 +172,11 @@ static void qn_get_packet(struct qn_soft static void qn_dump(struct qn_softc *); #endif -CFATTACH_DECL(qn, sizeof(struct qn_softc), +CFATTACH_DECL_NEW(qn, sizeof(struct qn_softc), qnmatch, qnattach, NULL, NULL); int -qnmatch(struct device *parent, struct cfdata *cfp, void *aux) +qnmatch(device_t parent, cfdata_t cf, void *aux) { struct zbus_args *zap; @@ -195,10 +195,10 @@ qnmatch(struct device *parent, struct cf * to accept packets. */ void -qnattach(struct device *parent, struct device *self, void *aux) +qnattach(device_t parent, device_t self, void *aux) { struct zbus_args *zap; - struct qn_softc *sc = (struct qn_softc *)self; + struct qn_softc *sc = device_private(self); struct ifnet *ifp = &sc->sc_ethercom.ec_if; u_int8_t myaddr[ETHER_ADDR_LEN]; @@ -231,7 +231,7 @@ qnattach(struct device *parent, struct d /* set interface to stopped condition (reset) */ qnstop(sc); - memcpy(ifp->if_xname, sc->sc_dev.dv_xname, IFNAMSIZ); + memcpy(ifp->if_xname, device_xname(sc->sc_dev), IFNAMSIZ); ifp->if_softc = sc; ifp->if_ioctl = qnioctl; ifp->if_watchdog = qnwatchdog; @@ -683,7 +683,7 @@ qn_rint(struct qn_softc *sc, u_short rst len < ETHER_HDR_LEN) { log(LOG_WARNING, "%s: received a %s packet? (%u bytes)\n", - sc->sc_dev.dv_xname, + device_xname(sc->sc_dev), len < ETHER_HDR_LEN ? "partial" : "big", len); ++sc->sc_ethercom.ec_if.if_ierrors; continue; @@ -693,7 +693,7 @@ qn_rint(struct qn_softc *sc, u_short rst if (len < (ETHER_MIN_LEN - ETHER_CRC_LEN)) log(LOG_WARNING, "%s: received a short packet? (%u bytes)\n", - sc->sc_dev.dv_xname, len); + device_xname(sc->sc_dev), len); #endif /* Read the packet. */ Index: sys/arch/amiga/dev/ioblix_zbus.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/amiga/dev/ioblix_zbus.c,v retrieving revision 1.18 diff -u -p -r1.18 ioblix_zbus.c --- sys/arch/amiga/dev/ioblix_zbus.c 19 Jul 2011 15:55:27 -0000 1.18 +++ sys/arch/amiga/dev/ioblix_zbus.c 28 Sep 2012 14:57:07 -0000 @@ -54,25 +54,24 @@ __KERNEL_RCSID(0, "$NetBSD: ioblix_zbus. #include "opt_iobzclock.h" struct iobz_softc { - struct device sc_dev; struct bus_space_tag sc_bst; }; -int iobzmatch(struct device *, struct cfdata *, void *); -void iobzattach(struct device *, struct device *, void *); -int iobzprint(void *auxp, const char *); +int iobzmatch(device_t, cfdata_t, void *); +void iobzattach(device_t, device_t, void *); +int iobzprint(void *, const char *); void iobz_shutdown(void *); -CFATTACH_DECL(iobl_zbus, sizeof(struct iobz_softc), +CFATTACH_DECL_NEW(iobl_zbus, sizeof(struct iobz_softc), iobzmatch, iobzattach, NULL, NULL); int -iobzmatch(struct device *parent, struct cfdata *cfp, void *auxp) +iobzmatch(device_t parent, cfdata_t cf, void *aux) { struct zbus_args *zap; - zap = auxp; + zap = aux; if (zap->manid != 4711) return (0); @@ -103,7 +102,7 @@ struct iobz_devs { int iobzclock = IOBZCLOCK; /* patchable! */ void -iobzattach(struct device *parent, struct device *self, void *auxp) +iobzattach(device_t parent, device_t self, void *aux) { struct iobz_softc *iobzsc; struct iobz_devs *iobzd; @@ -113,8 +112,8 @@ iobzattach(struct device *parent, struct volatile u_int8_t *p; - iobzsc = (struct iobz_softc *)self; - zap = auxp; + iobzsc = device_private(self); + zap = aux; if (parent) printf("\n"); @@ -141,10 +140,10 @@ iobzattach(struct device *parent, struct } int -iobzprint(void *auxp, const char *pnp) +iobzprint(void *aux, const char *pnp) { struct supio_attach_args *supa; - supa = auxp; + supa = aux; if (pnp == NULL) return(QUIET); Index: sys/arch/amiga/dev/isic_supio.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/amiga/dev/isic_supio.c,v retrieving revision 1.18 diff -u -p -r1.18 isic_supio.c --- sys/arch/amiga/dev/isic_supio.c 19 Jul 2011 15:55:27 -0000 1.18 +++ sys/arch/amiga/dev/isic_supio.c 28 Sep 2012 14:20:40 -0000 @@ -82,8 +82,8 @@ __KERNEL_RCSID(0, "$NetBSD: isic_supio.c /* XXX I think the following line should be elsewhere ... -is */ extern const struct isdn_layer1_isdnif_driver isic_std_driver; -/*static*/ int isic_supio_match(struct device *, struct cfdata *, void *); -/*static*/ void isic_supio_attach(struct device *, struct device *, void *); +/*static*/ int isic_supio_match(device_t, cfdata_t, void *); +/*static*/ void isic_supio_attach(device_t, device_t, void *); /*static*/ u_int8_t aster_read_reg(struct isic_softc *sc, int what, bus_size_t offs); @@ -102,14 +102,14 @@ struct isic_supio_softc { struct bus_space_tag sc_bst; }; -CFATTACH_DECL(isic_supio, sizeof(struct isic_supio_softc), +CFATTACH_DECL_NEW(isic_supio, sizeof(struct isic_supio_softc), isic_supio_match, isic_supio_attach, NULL, NULL); /* * Probe card */ /*static*/ int -isic_supio_match(struct device *parent, struct cfdata *cf, void *aux) +isic_supio_match(device_t parent, cfdata_t cf, void *aux) { struct supio_attach_args *sap = aux; @@ -122,9 +122,9 @@ int isic_supio_ipl = 2; * Attach the card */ /*static*/ void -isic_supio_attach(struct device *parent, struct device *self, void *aux) +isic_supio_attach(device_t parent, device_t self, void *aux) { - struct isic_supio_softc *ssc = (void *)self; + struct isic_supio_softc *ssc = device_private(self); struct isic_softc *sc = &ssc->sc_isic; struct supio_attach_args *sap = aux; @@ -133,6 +133,8 @@ isic_supio_attach(struct device *parent, int o1, o2; + sc->sc_dev = self; + /* setup parameters */ sc->sc_cardtyp = CARD_TYPEP_BLMASTER; sc->sc_num_mappings = 3; @@ -242,7 +244,7 @@ aster_write_reg(struct isic_softc *sc, i */ #define ISIC_FMT "%s: " -#define ISIC_PARM sc->sc_dev.dv_xname +#define ISIC_PARM device_xname(sc->sc_dev) #define TERMFMT "\n" int Index: sys/arch/amiga/dev/ite.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/amiga/dev/ite.c,v retrieving revision 1.93 diff -u -p -r1.93 ite.c --- sys/arch/amiga/dev/ite.c 15 Dec 2011 14:25:13 -0000 1.93 +++ sys/arch/amiga/dev/ite.c 29 Sep 2012 12:29:00 -0000 @@ -118,8 +118,8 @@ static callout_t repeat_ch; void iteputchar(int c, struct ite_softc *ip); void ite_putstr(const char * s, int len, dev_t dev); -void iteattach(struct device *, struct device *, void *); -int itematch(struct device *, struct cfdata *, void *); +void iteattach(device_t, device_t, void *); +int itematch(device_t, cfdata_t, void *); static void iteprecheckwrap(struct ite_softc *); static void itecheckwrap(struct ite_softc *); struct ite_softc *getitesp(dev_t); @@ -148,7 +148,7 @@ inline static int atoi(const char *); inline static int ite_argnum(struct ite_softc *); inline static int ite_zargnum(struct ite_softc *); -CFATTACH_DECL(ite, sizeof(struct ite_softc), +CFATTACH_DECL_NEW(ite, sizeof(struct ite_softc), itematch, iteattach, NULL, NULL); extern struct cfdriver ite_cd; @@ -167,12 +167,12 @@ const struct cdevsw ite_cdevsw = { }; int -itematch(struct device *pdp, struct cfdata *cfp, void *auxp) +itematch(device_t parent, cfdata_t cf, void *aux) { struct grf_softc *gp; int maj; - gp = auxp; + gp = aux; /* * XXX @@ -181,20 +181,20 @@ itematch(struct device *pdp, struct cfda * and thus no unit number. */ maj = cdevsw_lookup_major(&ite_cdevsw); - gp->g_itedev = makedev(maj, cfp->cf_unit); + gp->g_itedev = makedev(maj, cf->cf_unit); return(1); } void -iteattach(struct device *pdp, struct device *dp, void *auxp) +iteattach(device_t parent, device_t self, void *aux) { struct grf_softc *gp; struct ite_softc *ip; int s; - gp = (struct grf_softc *)auxp; - if (dp) { - ip = (struct ite_softc *)dp; + gp = aux; + if (self) { + ip = device_private(self); s = spltty(); if (con_itesoftc.grf != NULL && Index: sys/arch/amiga/dev/itevar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/amiga/dev/itevar.h,v retrieving revision 1.19 diff -u -p -r1.19 itevar.h --- sys/arch/amiga/dev/itevar.h 4 Mar 2007 05:59:23 -0000 1.19 +++ sys/arch/amiga/dev/itevar.h 28 Sep 2012 14:22:55 -0000 @@ -49,7 +49,6 @@ enum ite_attr { }; struct ite_softc { - struct device device; struct tty *tp; char argbuf[MAX_ARGSIZE]; struct grf_softc *grf; /* XXX */ Index: sys/arch/amiga/dev/ivsc.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/amiga/dev/ivsc.c,v retrieving revision 1.35 diff -u -p -r1.35 ivsc.c --- sys/arch/amiga/dev/ivsc.c 11 Dec 2005 12:16:28 -0000 1.35 +++ sys/arch/amiga/dev/ivsc.c 28 Sep 2012 14:48:42 -0000 @@ -74,8 +74,8 @@ __KERNEL_RCSID(0, "$NetBSD: ivsc.c,v 1.3 #include #include -void ivscattach(struct device *, struct device *, void *); -int ivscmatch(struct device *, struct cfdata *, void *); +void ivscattach(device_t, device_t, void *); +int ivscmatch(device_t, cfdata_t, void *); int ivsc_intr(void *); int ivsc_dma_xfer_in(struct sci_softc *dev, int len, @@ -95,18 +95,18 @@ extern int sci_data_wait; int ivsdma_pseudo = 1; /* 0=off, 1=on */ -CFATTACH_DECL(ivsc, sizeof(struct sci_softc), +CFATTACH_DECL_NEW(ivsc, sizeof(struct sci_softc), ivscmatch, ivscattach, NULL, NULL); /* * if this is an IVS board */ int -ivscmatch(struct device *pdp, struct cfdata *cfp, void *auxp) +ivscmatch(device_t parent, cfdata_t cf, void *aux) { struct zbus_args *zap; - zap = auxp; + zap = aux; /* * Check manufacturer and product id. @@ -120,17 +120,19 @@ ivscmatch(struct device *pdp, struct cfd } void -ivscattach(struct device *pdp, struct device *dp, void *auxp) +ivscattach(device_t parent, device_t self, void *aux) { volatile u_char *rp; - struct sci_softc *sc = (struct sci_softc *)dp; + struct sci_softc *sc = device_private(self); struct zbus_args *zap; struct scsipi_adapter *adapt = &sc->sc_adapter; struct scsipi_channel *chan = &sc->sc_channel; + sc->sc_dev = self; + printf("\n"); - zap = auxp; + zap = aux; rp = (u_char *)zap->va + 0x40; sc->sci_data = rp; @@ -163,7 +165,7 @@ ivscattach(struct device *pdp, struct de * Fill in the scsipi_adapter. */ memset(adapt, 0, sizeof(*adapt)); - adapt->adapt_dev = &sc->sc_dev; + adapt->adapt_dev = self; adapt->adapt_nchannels = 1; adapt->adapt_openings = 7; adapt->adapt_max_periph = 1; @@ -184,7 +186,7 @@ ivscattach(struct device *pdp, struct de /* * attach all scsi units on us */ - config_found(dp, chan, scsiprint); + config_found(self, chan, scsiprint); } int Index: sys/arch/amiga/dev/kbd.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/amiga/dev/kbd.c,v retrieving revision 1.54 diff -u -p -r1.54 kbd.c --- sys/arch/amiga/dev/kbd.c 3 Jun 2011 00:52:22 -0000 1.54 +++ sys/arch/amiga/dev/kbd.c 29 Sep 2012 12:02:58 -0000 @@ -177,17 +177,17 @@ const struct cdevsw kbd_cdevsw = { /*ARGSUSED*/ int -kbdmatch(device_t pdp, cfdata_t cfp, void *auxp) +kbdmatch(device_t parent, cfdata_t cf, void *aux) { - if (matchname((char *)auxp, "kbd")) + if (matchname((char *)aux, "kbd")) return(1); return(0); } /*ARGSUSED*/ void -kbdattach(device_t pdp, device_t dp, void *auxp) +kbdattach(device_t parent, device_t self, void *aux) { #ifdef DRACO kbdenable(); @@ -200,7 +200,7 @@ kbdattach(device_t pdp, device_t dp, voi #endif #if NWSKBD>0 - if (dp != NULL) { + if (self != NULL) { /* * Try to attach the wskbd. */ @@ -209,7 +209,7 @@ kbdattach(device_t pdp, device_t dp, voi waa.keymap = &kbd_mapdata; waa.accessops = &kbd_accessops; waa.accesscookie = NULL; - kbd_softc.k_wskbddev = config_found(dp, &waa, wskbddevprint); + kbd_softc.k_wskbddev = config_found(self, &waa, wskbddevprint); kbd_softc.k_pollingmode = 0; } Index: sys/arch/amiga/dev/melody.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/amiga/dev/melody.c,v retrieving revision 1.17 diff -u -p -r1.17 melody.c --- sys/arch/amiga/dev/melody.c 23 Nov 2011 23:07:28 -0000 1.17 +++ sys/arch/amiga/dev/melody.c 28 Sep 2012 15:01:15 -0000 @@ -59,15 +59,15 @@ struct melody_softc { uint8_t * sc_intack; }; -int melody_match(struct device *, struct cfdata *, void *); -void melody_attach(struct device *, struct device *, void *); +int melody_match(device_t, cfdata_t, void *); +void melody_attach(device_t, device_t, void *); void melody_intack(struct tav_softc *); -CFATTACH_DECL(melody, sizeof(struct melody_softc), +CFATTACH_DECL_NEW(melody, sizeof(struct melody_softc), melody_match, melody_attach, NULL, NULL); int -melody_match(struct device *parent, struct cfdata *cfp, void *aux) +melody_match(device_t parent, cfdata_t cf, void *aux) { struct zbus_args *zap; @@ -82,14 +82,14 @@ melody_match(struct device *parent, stru } void -melody_attach(struct device *parent, struct device *self, void *aux) +melody_attach(device_t parent, device_t self, void *aux) { struct melody_softc *sc; struct zbus_args *zap; bus_space_tag_t iot; bus_space_handle_t ioh; - sc = (struct melody_softc *)self; + sc = device_private(self); zap = aux; sc->sc_bst_leftbyte.base = (u_long)zap->va + 0; @@ -104,6 +104,7 @@ melody_attach(struct device *parent, str panic("melody: cant bus_space_map"); /* NOTREACHED */ } + sc->sc_tav.sc_dev = self; sc->sc_tav.sc_iot = iot; sc->sc_tav.sc_ioh = ioh; sc->sc_tav.sc_pcm_ord = 0; Index: sys/arch/amiga/dev/mfc.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/amiga/dev/mfc.c,v retrieving revision 1.54 diff -u -p -r1.54 mfc.c --- sys/arch/amiga/dev/mfc.c 24 Apr 2011 16:26:52 -0000 1.54 +++ sys/arch/amiga/dev/mfc.c 28 Sep 2012 14:56:47 -0000 @@ -159,7 +159,7 @@ struct duart_regs { }; struct mfc_softc { - struct device sc_dev; + device_t sc_dev; struct isr sc_isr; struct mfc_regs *sc_regs; u_long clk_frq; @@ -172,7 +172,7 @@ struct mfc_softc { #if NMFCS > 0 struct mfcs_softc { - struct device sc_dev; + device_t sc_dev; struct tty *sc_tty; struct duart_regs *sc_duart; struct mfc_regs *sc_regs; @@ -200,13 +200,13 @@ struct mfc_args { char unit; }; -int mfcprint(void *auxp, const char *); -void mfcattach(struct device *, struct device *, void *); -int mfcmatch(struct device *, struct cfdata *, void *); +int mfcprint(void *, const char *); +void mfcattach(device_t, device_t, void *); +int mfcmatch(device_t, cfdata_t, void *); #if NMFCS > 0 -int mfcsmatch(struct device *, struct cfdata *, void *); -void mfcsattach(struct device *, struct device *, void *); +int mfcsmatch(device_t, cfdata_t, void *); +void mfcsattach(device_t, device_t, void *); int mfcsparam( struct tty *, struct termios *); int mfcshwiflow(struct tty *, int); void mfcsstart(struct tty *); @@ -218,23 +218,23 @@ void mfcs_intr_soft(void *); #endif #if NMFCP > 0 -void mfcpattach(struct device *, struct device *, void *); -int mfcpmatch(struct device *, struct cfdata *, void *); +void mfcpattach(device_t, device_t, void *); +int mfcpmatch(device_t, cfdata_t, void *); #endif int mfcintr(void *); -CFATTACH_DECL(mfc, sizeof(struct mfc_softc), +CFATTACH_DECL_NEW(mfc, sizeof(struct mfc_softc), mfcmatch, mfcattach, NULL, NULL); #if NMFCS > 0 -CFATTACH_DECL(mfcs, sizeof(struct mfcs_softc), +CFATTACH_DECL_NEW(mfcs, sizeof(struct mfcs_softc), mfcsmatch, mfcsattach, NULL, NULL); extern struct cfdriver mfcs_cd; #endif #if NMFCP > 0 -CFATTACH_DECL(mfcp, sizeof(struct mfcp_softc), +CFATTACH_DECL_NEW(mfcp, sizeof(struct mfcp_softc), mfcpmatch, mfcpattach, NULL, NULL); #endif @@ -342,11 +342,11 @@ const struct speedtab mfcs2speedtab2[] = * if we are an bsc/Alf Data MultFaceCard (I, II, and III) */ int -mfcmatch(struct device *pdp, struct cfdata *cfp, void *auxp) +mfcmatch(device_t parent, cfdata_t cf, void *aux) { struct zbus_args *zap; - zap = auxp; + zap = aux; if (zap->manid == 2092 && (zap->prodid == 16 || zap->prodid == 17 || zap->prodid == 18)) @@ -355,7 +355,7 @@ mfcmatch(struct device *pdp, struct cfda } void -mfcattach(struct device *pdp, struct device *dp, void *auxp) +mfcattach(device_t parent, device_t self, void *aux) { struct mfc_softc *scc; struct zbus_args *zap; @@ -363,12 +363,13 @@ mfcattach(struct device *pdp, struct dev int unit; struct mfc_regs *rp; - zap = auxp; + zap = aux; printf ("\n"); - scc = (struct mfc_softc *)dp; - unit = device_unit(&scc->sc_dev); + scc = device_private(self); + scc->sc_dev = self; + unit = device_unit(self); scc->sc_regs = rp = zap->va; if (zap->prodid == 18) scc->mfc_iii = 3; @@ -407,30 +408,30 @@ mfcattach(struct device *pdp, struct dev memcpy(&ma.zargs, zap, sizeof(struct zbus_args)); ma.subdev = "mfcs"; ma.unit = unit * 2; - config_found(dp, &ma, mfcprint); + config_found(self, &ma, mfcprint); ma.unit = unit * 2 + 1; - config_found(dp, &ma, mfcprint); + config_found(self, &ma, mfcprint); ma.subdev = "mfcp"; ma.unit = unit; - config_found(dp, &ma, mfcprint); + config_found(self, &ma, mfcprint); } /* * */ int -mfcsmatch(struct device *pdp, struct cfdata *cfp, void *auxp) +mfcsmatch(device_t parent, cfdata_t cf, void *aux) { struct mfc_args *ma; - ma = auxp; + ma = aux; if (strcmp(ma->subdev, "mfcs") == 0) return (1); return (0); } void -mfcsattach(struct device *pdp, struct device *dp, void *auxp) +mfcsattach(device_t parent, device_t self, void *aux) { int unit; struct mfcs_softc *sc; @@ -438,9 +439,10 @@ mfcsattach(struct device *pdp, struct de struct mfc_args *ma; struct mfc_regs *rp; - sc = device_private(dp); - scc = device_private(pdp); - ma = auxp; + sc = device_private(self); + sc->sc_dev = self; + scc = device_private(parent); + ma = aux; printf (": input fifo %d output fifo %d\n", SERIBUF_SIZE, SEROBUF_SIZE); @@ -465,7 +467,7 @@ mfcsattach(struct device *pdp, struct de * print diag if pnp is NULL else just extra */ int -mfcprint(void *auxp, const char *pnp) +mfcprint(void *aux, const char *pnp) { if (pnp == NULL) return(UNCONF); @@ -950,7 +952,7 @@ mfcintr(void *arg) istat = regs->du_isr & scc->imask; if (istat == 0) return (0); - unit = device_unit(&scc->sc_dev) * 2; + unit = device_unit(scc->sc_dev) * 2; if (istat & 0x02) { /* channel A receive interrupt */ sc = device_lookup_private(&mfcs_cd, unit); while (1) { @@ -1019,7 +1021,7 @@ mfcintr(void *arg) } if (istat & 0x80) { /* input port change interrupt */ c = regs->du_ipcr; - printf ("%s: ipcr %02x", scc->sc_dev.dv_xname, c); + printf ("%s: ipcr %02x", device_xname(scc->sc_dev), c); } return(1); } @@ -1060,7 +1062,7 @@ mfcsxintr(int unit) splx(s2); if (ovfl != 0) log(LOG_WARNING, "%s: %d buffer overflow!\n", - sc->sc_dev.dv_xname, ovfl); + device_xname(sc->sc_dev), ovfl); } if (sc->incnt == 0 && (tp->t_state & TS_TBLOCK) == 0) { sc->sc_regs->du_btst = 1 << unit; /* XXXX */ Index: sys/arch/amiga/dev/mgnsc.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/amiga/dev/mgnsc.c,v retrieving revision 1.45 diff -u -p -r1.45 mgnsc.c --- sys/arch/amiga/dev/mgnsc.c 20 Dec 2010 00:25:26 -0000 1.45 +++ sys/arch/amiga/dev/mgnsc.c 28 Sep 2012 14:49:47 -0000 @@ -76,8 +76,8 @@ __KERNEL_RCSID(0, "$NetBSD: mgnsc.c,v 1. #include #include -void mgnscattach(struct device *, struct device *, void *); -int mgnscmatch(struct device *, struct cfdata *, void *); +void mgnscattach(device_t, device_t, void *); +int mgnscmatch(device_t, cfdata_t, void *); int mgnsc_dmaintr(void *); #ifdef DEBUG void mgnsc_dump(void); @@ -87,34 +87,36 @@ void mgnsc_dump(void); #ifdef DEBUG #endif -CFATTACH_DECL(mgnsc, sizeof(struct siop_softc), +CFATTACH_DECL_NEW(mgnsc, sizeof(struct siop_softc), mgnscmatch, mgnscattach, NULL, NULL); /* * if we are a CSA Magnum 40 SCSI */ int -mgnscmatch(struct device *pdp, struct cfdata *cfp, void *auxp) +mgnscmatch(device_t parent, cfdata_t cf, void *aux) { struct zbus_args *zap; - zap = auxp; + zap = aux; if (zap->manid == 1058 && zap->prodid == 17) return(1); return(0); } void -mgnscattach(struct device *pdp, struct device *dp, void *auxp) +mgnscattach(device_t parent, device_t self, void *aux) { - struct siop_softc *sc = (struct siop_softc *)dp; + struct siop_softc *sc = device_private(self); struct zbus_args *zap; siop_regmap_p rp; struct scsipi_adapter *adapt = &sc->sc_adapter; struct scsipi_channel *chan = &sc->sc_channel; + sc->sc_dev = self; + printf("\n"); - zap = auxp; + zap = aux; sc->sc_siopp = rp = (siop_regmap_p)((char *)zap->va + 0x8000); @@ -132,7 +134,7 @@ mgnscattach(struct device *pdp, struct d * Fill in the scsipi_adapter. */ memset(adapt, 0, sizeof(*adapt)); - adapt->adapt_dev = &sc->sc_dev; + adapt->adapt_dev = self; adapt->adapt_nchannels = 1; adapt->adapt_openings = 7; adapt->adapt_max_periph = 1; @@ -160,7 +162,7 @@ mgnscattach(struct device *pdp, struct d /* * attach all scsi units on us */ - config_found(dp, chan, scsiprint); + config_found(self, chan, scsiprint); } /* Index: sys/arch/amiga/dev/mlhsc.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/amiga/dev/mlhsc.c,v retrieving revision 1.30 diff -u -p -r1.30 mlhsc.c --- sys/arch/amiga/dev/mlhsc.c 11 Dec 2005 12:16:28 -0000 1.30 +++ sys/arch/amiga/dev/mlhsc.c 28 Sep 2012 14:54:19 -0000 @@ -73,8 +73,8 @@ __KERNEL_RCSID(0, "$NetBSD: mlhsc.c,v 1. #include #include -void mlhscattach(struct device *, struct device *, void *); -int mlhscmatch(struct device *, struct cfdata *, void *); +void mlhscattach(device_t, device_t, void *); +int mlhscmatch(device_t, cfdata_t, void *); int mlhsc_dma_xfer_in(struct sci_softc *dev, int len, register u_char *buf, int phase); @@ -90,18 +90,18 @@ extern int sci_debug; extern int sci_data_wait; -CFATTACH_DECL(mlhsc, sizeof(struct sci_softc), +CFATTACH_DECL_NEW(mlhsc, sizeof(struct sci_softc), mlhscmatch, mlhscattach, NULL, NULL); /* * if we are my Hacker's SCSI board we are here. */ int -mlhscmatch(struct device *pdp, struct cfdata *cfp, void *auxp) +mlhscmatch(device_t parent, cfdata_t cf, void *aux) { struct zbus_args *zap; - zap = auxp; + zap = aux; /* * Check manufacturer and product id. @@ -113,19 +113,20 @@ mlhscmatch(struct device *pdp, struct cf } void -mlhscattach(struct device *pdp, struct device *dp, void *auxp) +mlhscattach(device_t parent, device_t self, void *aux) { volatile u_char *rp; - struct sci_softc *sc = (struct sci_softc *)dp; + struct sci_softc *sc = device_private(self); struct zbus_args *zap; struct scsipi_adapter *adapt = &sc->sc_adapter; struct scsipi_channel *chan = &sc->sc_channel; + sc->sc_dev = self; + printf("\n"); - zap = auxp; + zap = aux; - sc = (struct sci_softc *)dp; rp = zap->va; sc->sci_data = rp + 1; sc->sci_odata = rp + 1; @@ -150,7 +151,7 @@ mlhscattach(struct device *pdp, struct d * Fill in the scsipi_adapter. */ memset(adapt, 0, sizeof(*adapt)); - adapt->adapt_dev = &sc->sc_dev; + adapt->adapt_dev = self; adapt->adapt_nchannels = 1; adapt->adapt_openings = 7; adapt->adapt_max_periph = 1; @@ -171,7 +172,7 @@ mlhscattach(struct device *pdp, struct d /* * attach all scsi units on us */ - config_found(dp, chan, scsiprint); + config_found(self, chan, scsiprint); } int Index: sys/arch/amiga/dev/ms.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/amiga/dev/ms.c,v retrieving revision 1.36 diff -u -p -r1.36 ms.c --- sys/arch/amiga/dev/ms.c 14 Mar 2009 15:36:01 -0000 1.36 +++ sys/arch/amiga/dev/ms.c 1 Oct 2012 16:57:40 -0000 @@ -85,8 +85,8 @@ __KERNEL_RCSID(0, "$NetBSD: ms.c,v 1.36 #include #endif -void msattach(struct device *, struct device *, void *); -int msmatch(struct device *, struct cfdata *, void *); +void msattach(device_t, device_t, void *); +int msmatch(device_t, cfdata_t, void *); /* per-port state */ struct ms_port { @@ -103,7 +103,7 @@ struct ms_port { volatile int ms_ready; /* event queue is ready */ struct evvar ms_events; /* event queue state */ #if NWSMOUSE > 0 - struct device *ms_wsmousedev; /* wsmouse device */ + device_t ms_wsmousedev; /* wsmouse device */ int ms_wsenabled; /* feeding events to wscons */ #endif }; @@ -111,11 +111,10 @@ struct ms_port { #define MS_NPORTS 2 struct ms_softc { - struct device sc_dev; /* base device */ struct ms_port sc_ports[MS_NPORTS]; }; -CFATTACH_DECL(ms, sizeof(struct ms_softc), +CFATTACH_DECL_NEW(ms, sizeof(struct ms_softc), msmatch, msattach, NULL, NULL); void msintr(void *); @@ -162,12 +161,12 @@ static struct wsmouse_accessops ms_wscon #endif int -msmatch(struct device *pdp, struct cfdata *cfp, void *auxp) +msmatch(device_t parent, cfdata_t cf, void *aux) { static int ms_matched = 0; /* Allow only one instance. */ - if (!matchname((char *)auxp, "ms") || ms_matched) + if (!matchname((char *)aux, "ms") || ms_matched) return 0; ms_matched = 1; @@ -175,12 +174,12 @@ msmatch(struct device *pdp, struct cfdat } void -msattach(struct device *pdp, struct device *dp, void *auxp) +msattach(device_t parent, device_t self, void *aux) { #if NWSMOUSE > 0 struct wsmousedev_attach_args waa; #endif - struct ms_softc *sc = (void *) dp; + struct ms_softc *sc = device_private(self); int i; printf("\n"); @@ -193,7 +192,7 @@ msattach(struct device *pdp, struct devi sc->sc_ports[i].ms_wsenabled = 0; sc->sc_ports[i].ms_wsmousedev = - config_found(dp, &waa, wsmousedevprint); + config_found(self, &waa, wsmousedevprint); #endif } } Index: sys/arch/amiga/dev/msc.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/amiga/dev/msc.c,v retrieving revision 1.44 diff -u -p -r1.44 msc.c --- sys/arch/amiga/dev/msc.c 3 Jun 2011 00:52:22 -0000 1.44 +++ sys/arch/amiga/dev/msc.c 29 Sep 2012 11:02:46 -0000 @@ -231,11 +231,11 @@ const struct cdevsw msc_cdevsw = { }; int -mscmatch(device_t pdp, cfdata_t cfp, void *auxp) +mscmatch(device_t parent, cfdata_t cf, void *aux) { struct zbus_args *zap; - zap = auxp; + zap = aux; if (zap->manid == 514 && (zap->prodid == 70 || zap->prodid == 69)) return(1); @@ -243,7 +243,7 @@ mscmatch(device_t pdp, cfdata_t cfp, voi } void -mscattach(device_t pdp, device_t dp, void *auxp) +mscattach(device_t parent, device_t self, void *aux) { volatile struct mscmemory *mscmem; struct mscdevice *msc; @@ -251,8 +251,8 @@ mscattach(device_t pdp, device_t dp, voi int unit; int Count; - zap = (struct zbus_args *)auxp; - unit = device_unit(dp); + zap = aux; + unit = device_unit(self); /* * Make config msgs look nicer. Index: sys/arch/amiga/dev/otgsc.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/amiga/dev/otgsc.c,v retrieving revision 1.31 diff -u -p -r1.31 otgsc.c --- sys/arch/amiga/dev/otgsc.c 11 Dec 2005 12:16:28 -0000 1.31 +++ sys/arch/amiga/dev/otgsc.c 28 Sep 2012 14:48:29 -0000 @@ -73,8 +73,8 @@ __KERNEL_RCSID(0, "$NetBSD: otgsc.c,v 1. #include #include -void otgscattach(struct device *, struct device *, void *); -int otgscmatch(struct device *, struct cfdata *, void *); +void otgscattach(device_t, device_t, void *); +int otgscmatch(device_t, cfdata_t, void *); int otgsc_dma_xfer_in(struct sci_softc *dev, int len, register u_char *buf, int phase); @@ -92,18 +92,18 @@ extern int sci_debug; extern int sci_data_wait; -CFATTACH_DECL(otgsc, sizeof(struct sci_softc), +CFATTACH_DECL_NEW(otgsc, sizeof(struct sci_softc), otgscmatch, otgscattach, NULL, NULL); /* * if we are my Hacker's SCSI board we are here. */ int -otgscmatch(struct device *pdp, struct cfdata *cfp, void *auxp) +otgscmatch(device_t parent, cfdata_t cf, void *aux) { struct zbus_args *zap; - zap = auxp; + zap = aux; /* * Check manufacturer and product id. @@ -115,19 +115,20 @@ otgscmatch(struct device *pdp, struct cf } void -otgscattach(struct device *pdp, struct device *dp, void *auxp) +otgscattach(device_t parent, device_t self, void *aux) { volatile u_char *rp; - struct sci_softc *sc = (struct sci_softc *)dp; + struct sci_softc *sc = device_private(self); struct zbus_args *zap; struct scsipi_adapter *adapt = &sc->sc_adapter; struct scsipi_channel *chan = &sc->sc_channel; + sc->sc_dev = self; + printf("\n"); - zap = auxp; + zap = aux; - sc = (struct sci_softc *)dp; rp = (u_char *)zap->va + 0x2000; sc->sci_data = rp; sc->sci_odata = rp; @@ -157,7 +158,7 @@ otgscattach(struct device *pdp, struct d * Fill in the scsipi_adapter. */ memset(adapt, 0, sizeof(*adapt)); - adapt->adapt_dev = &sc->sc_dev; + adapt->adapt_dev = self; adapt->adapt_nchannels = 1; adapt->adapt_openings = 7; adapt->adapt_max_periph = 1; @@ -178,7 +179,7 @@ otgscattach(struct device *pdp, struct d /* * attach all scsi units on us */ - config_found(dp, chan, scsiprint); + config_found(self, chan, scsiprint); } int Index: sys/arch/amiga/dev/p5bus.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/amiga/dev/p5bus.c,v retrieving revision 1.3 diff -u -p -r1.3 p5bus.c --- sys/arch/amiga/dev/p5bus.c 12 Feb 2012 16:34:07 -0000 1.3 +++ sys/arch/amiga/dev/p5bus.c 29 Sep 2012 10:52:15 -0000 @@ -48,8 +48,8 @@ #define P5_ROM_OFF 0xF00010 #define P5_SN_LEN 7 -static int p5bus_match(struct device *pdp, struct cfdata *cfp, void *auxp); -static void p5bus_attach(device_t parent, device_t self, void *aux); +static int p5bus_match(device_t, cfdata_t, void *); +static void p5bus_attach(device_t, device_t, void *); static char* p5bus_cardsn(void); static int p5bus_print(void *aux, const char *str); static void p5bus_callback(device_t self); @@ -70,11 +70,11 @@ CFATTACH_DECL_NEW(p5bus, sizeof(struct p p5bus_match, p5bus_attach, NULL, NULL); static int -p5bus_match(struct device *pdp, struct cfdata *cfp, void *auxp) +p5bus_match(device_t parent, cfdata_t cf, void *aux) { struct zbus_args *zap; - zap = auxp; + zap = aux; if (zap->manid != ZORRO_MANID_P5) return 0; @@ -199,4 +199,3 @@ p5bus_print(void *aux, const char *str) return 0; } - Index: sys/arch/amiga/dev/par.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/amiga/dev/par.c,v retrieving revision 1.37 diff -u -p -r1.37 par.c --- sys/arch/amiga/dev/par.c 31 May 2009 23:07:18 -0000 1.37 +++ sys/arch/amiga/dev/par.c 28 Sep 2012 14:47:45 -0000 @@ -57,7 +57,7 @@ __KERNEL_RCSID(0, "$NetBSD: par.c,v 1.37 #include struct par_softc { - struct device sc_dev; + device_t sc_dev; int sc_flags; struct parparam sc_param; @@ -101,10 +101,10 @@ void partimo(void *); void parstart(void *); void parintr(void *); -void parattach(struct device *, struct device *, void *); -int parmatch(struct device *, struct cfdata *, void *); +void parattach(device_t, device_t, void *); +int parmatch(device_t, cfdata_t, void *); -CFATTACH_DECL(par, sizeof(struct par_softc), +CFATTACH_DECL_NEW(par, sizeof(struct par_softc), parmatch, parattach, NULL, NULL); dev_type_open(paropen); @@ -120,11 +120,11 @@ const struct cdevsw par_cdevsw = { /*ARGSUSED*/ int -parmatch(struct device *pdp, struct cfdata *cfp, void *auxp) +parmatch(device_t parent, cfdata_t cf, void *aux) { static int par_found = 0; - if (!matchname((char *)auxp, "par") || par_found) + if (!matchname((char *)aux, "par") || par_found) return(0); par_found = 1; @@ -132,9 +132,11 @@ parmatch(struct device *pdp, struct cfda } void -parattach(struct device *pdp, struct device *dp, void *auxp) +parattach(device_t parent, device_t self, void *aux) { - par_softcp = (struct par_softc *)dp; + par_softcp = device_private(self); + + par_softcp->sc_dev = self; #ifdef DEBUG if ((pardebug & PDB_NOCHECK) == 0) @@ -207,7 +209,7 @@ parstart(void *arg) #ifdef DEBUG if (pardebug & PDB_FOLLOW) - printf("parstart(%x)\n", device_unit(&sc->sc_dev)); + printf("parstart(%x)\n", device_unit(sc->sc_dev)); #endif sc->sc_flags &= ~PARF_DELAY; wakeup(sc); @@ -220,7 +222,7 @@ partimo(void *arg) #ifdef DEBUG if (pardebug & PDB_FOLLOW) - printf("partimo(%x)\n", device_unit(&sc->sc_dev)); + printf("partimo(%x)\n", device_unit(sc->sc_dev)); #endif sc->sc_flags &= ~(PARF_UIO|PARF_TIMO); wakeup(sc); Index: sys/arch/amiga/dev/repulse.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/amiga/dev/repulse.c,v retrieving revision 1.18 diff -u -p -r1.18 repulse.c --- sys/arch/amiga/dev/repulse.c 23 Nov 2011 23:07:28 -0000 1.18 +++ sys/arch/amiga/dev/repulse.c 9 Oct 2012 01:02:34 -0000 @@ -198,7 +198,7 @@ void rep_write_8_mono(struct repulse_hw /* NetBSD device attachment */ struct repulse_softc { - struct device sc_dev; + device_t sc_dev; struct isr sc_isr; struct ac97_host_if sc_achost; struct ac97_codec_if *sc_codec_if; @@ -225,14 +225,14 @@ struct repulse_softc { kmutex_t sc_intr_lock; }; -int repulse_match (struct device *, struct cfdata *, void *); -void repulse_attach (struct device *, struct device *, void *); +int repulse_match (device_t, cfdata_t, void *); +void repulse_attach (device_t, device_t, void *); -CFATTACH_DECL(repulse, sizeof(struct repulse_softc), +CFATTACH_DECL_NEW(repulse, sizeof(struct repulse_softc), repulse_match, repulse_attach, NULL, NULL); int -repulse_match(struct device *parent, struct cfdata *cfp, void *aux) +repulse_match(device_t parent, cfdata_t cf, void *aux) { struct zbus_args *zap; @@ -248,7 +248,7 @@ repulse_match(struct device *parent, str } void -repulse_attach(struct device *parent, struct device *self, void *aux) +repulse_attach(device_t parent, device_t self, void *aux) { struct repulse_softc *sc; struct zbus_args *zap; @@ -257,7 +257,8 @@ repulse_attach(struct device *parent, st int needs_firmware; uint16_t a; - sc = (struct repulse_softc *)self; + sc = device_private(self); + sc->sc_dev = self; zap = aux; bp = (struct repulse_hw *)zap->va; sc->sc_boardp = bp; @@ -318,7 +319,7 @@ repulse_attach(struct device *parent, st mutex_init(&sc->sc_intr_lock, MUTEX_DEFAULT, IPL_SCHED); if (ac97_attach(&sc->sc_achost, self, &sc->sc_lock)) { - printf("%s: error attaching codec\n", self->dv_xname); + printf("%s: error attaching codec\n", device_xname(self)); return; } @@ -336,7 +337,7 @@ repulse_attach(struct device *parent, st if (!(a & AC97_EXT_AUDIO_VRA)) { printf("%s: warning: codec doesn't support " "hardware AC'97 2.0 Variable Rate Audio\n", - sc->sc_dev.dv_xname); + device_xname(self)); } #endif @@ -345,12 +346,12 @@ repulse_attach(struct device *parent, st sc->sc_isr.isr_intr = rep_intr; add_isr(&sc->sc_isr); - audio_attach_mi(&rep_hw_if, sc, &sc->sc_dev); + audio_attach_mi(&rep_hw_if, sc, self); return; Initerr: - printf("\n%s: firmware not successfully loaded\n", self->dv_xname); + printf("\n%s: firmware not successfully loaded\n", device_xname(self)); return; } @@ -371,7 +372,7 @@ repac_reset(void *arg) a = bp->rhw_status; #ifdef DIAGNOSTIC if ((a & REPSTATUS_CODECRESET) == 0) - panic("%s: cannot set reset bit", sc->sc_dev.dv_xname); + panic("%s: cannot set reset bit", device_xname(sc->sc_dev)); #endif a = bp->rhw_status; Index: sys/arch/amiga/dev/sbic.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/amiga/dev/sbic.c,v retrieving revision 1.70 diff -u -p -r1.70 sbic.c --- sys/arch/amiga/dev/sbic.c 7 Jul 2011 06:02:06 -0000 1.70 +++ sys/arch/amiga/dev/sbic.c 28 Sep 2012 05:07:58 -0000 @@ -399,7 +399,7 @@ sbic_scsipi_request(struct scsipi_channe struct scsipi_xfer *xs; struct scsipi_periph *periph; struct sbic_acb *acb; - struct sbic_softc *dev = (void *)chan->chan_adapter->adapt_dev; + struct sbic_softc *dev = device_private(chan->chan_adapter->adapt_dev); int flags, s, stat; switch (req) { @@ -571,7 +571,7 @@ sbic_scsidone(struct sbic_acb *acb, int xs = acb->xs; periph = xs->xs_periph; - dev = (void *)periph->periph_channel->chan_adapter->adapt_dev; + dev = device_private(periph->periph_channel->chan_adapter->adapt_dev); SBIC_TRACE(dev); #ifdef DIAGNOSTIC if (acb == NULL || xs == NULL) { @@ -634,7 +634,7 @@ sbic_scsidone(struct sbic_acb *acb, int TAILQ_REMOVE(&dev->ready_list, acb, chain); } else { printf("%s: can't find matching acb\n", - dev->sc_dev.dv_xname); + device_xname(dev->sc_dev)); #ifdef DDB Debugger(); #endif @@ -732,7 +732,7 @@ sbicabort(struct sbic_softc *dev, sbic_r GET_SBIC_csr(regs, csr); printf ("%s: abort %s: csr = 0x%02x, asr = 0x%02x\n", - dev->sc_dev.dv_xname, where, csr, asr); + device_xname(dev->sc_dev), where, csr, asr); #if 0 @@ -754,14 +754,14 @@ sbicabort(struct sbic_softc *dev, sbic_r /* But we don't know what direction it needs to go */ GET_SBIC_data(regs, asr); printf("%s: abort %s: clearing data buffer 0x%02x\n", - dev->sc_dev.dv_xname, where, asr); + device_xname(dev->sc_dev), where, asr); GET_SBIC_asr(regs, asr); if( asr & SBIC_ASR_DBR ) /* Not the read direction, then */ SET_SBIC_data(regs, asr); GET_SBIC_asr(regs, asr); } WAIT_CIP(regs); -printf("%s: sbicabort - sending ABORT command\n", dev->sc_dev.dv_xname); +printf("%s: sbicabort - sending ABORT command\n", device_xname(dev->sc_dev)); SET_SBIC_cmd(regs, SBIC_CMD_ABORT); WAIT_CIP(regs); @@ -769,12 +769,12 @@ printf("%s: sbicabort - sending ABORT co if (asr & (SBIC_ASR_BSY|SBIC_ASR_LCI)) { /* ok, get more drastic.. */ -printf("%s: sbicabort - asr %x, trying to reset\n", dev->sc_dev.dv_xname, asr); +printf("%s: sbicabort - asr %x, trying to reset\n", device_xname(dev->sc_dev), asr); sbicreset(dev); dev->sc_flags &= ~SBICF_SELECTED; return -1; } -printf("%s: sbicabort - sending DISC command\n", dev->sc_dev.dv_xname); +printf("%s: sbicabort - sending DISC command\n", device_xname(dev->sc_dev)); SET_SBIC_cmd(regs, SBIC_CMD_DISC); do { @@ -840,7 +840,7 @@ sbicinit(struct sbic_softc *dev) #ifdef DEBUG if (inhibit_sync) printf("%s: Inhibiting synchronous transfer %02x\n", - dev->sc_dev.dv_xname, inhibit_sync); + device_xname(dev->sc_dev), inhibit_sync); #endif for (i = 0; i < 8; ++i) if (inhibit_sync & (1 << i)) @@ -956,7 +956,7 @@ sbicerror(struct sbic_softc *dev, sbic_r if (xs->xs_control & XS_CTL_SILENT) return; - printf("%s: ", dev->sc_dev.dv_xname); + printf("%s: ", device_xname(dev->sc_dev)); printf("csr == 0x%02x\n", csr); /* XXX */ } @@ -2142,7 +2142,7 @@ sbicmsgin(struct sbic_softc *dev) dev->sc_sync[dev->target].period)); printf("%s: target %d now synchronous," " period=%dns, offset=%d.\n", - dev->sc_dev.dv_xname, dev->target, + device_xname(dev->sc_dev), dev->target, dev->sc_msg[3] * 4, dev->sc_msg[4]); } else { #ifdef DEBUG @@ -2247,7 +2247,7 @@ sbicnextstate(struct sbic_softc *dev, u_ if (acb->flags & ACB_BBUF) { if ((u_char *)kvtop(acb->sc_dmausrbuf) != acb->sc_usrbufpa) printf("%s: WARNING - buffer mapping changed %p->%x\n", - dev->sc_dev.dv_xname, acb->sc_usrbufpa, + device_xname(dev->sc_dev), acb->sc_usrbufpa, (unsigned)kvtop(acb->sc_dmausrbuf)); #ifdef DEBUG if(data_pointer_debug) @@ -2445,7 +2445,7 @@ sbicnextstate(struct sbic_softc *dev, u_ #ifdef DEBUG if (reselect_debug > 1) printf("%s: reselect %s with active command\n", - dev->sc_dev.dv_xname, + device_xname(dev->sc_dev), csr == SBIC_CSR_RSLT_NI ? "NI" : "IFY"); #ifdef DDB /* Debugger();*/ @@ -2477,7 +2477,7 @@ sbicnextstate(struct sbic_softc *dev, u_ } if (acb == NULL) { printf("%s: reselect %s targ %d not in nexus_list %p\n", - dev->sc_dev.dv_xname, + device_xname(dev->sc_dev), csr == SBIC_CSR_RSLT_NI ? "NI" : "IFY", newtarget, &dev->nexus_list.tqh_first); panic("bad reselect in sbic"); @@ -2633,7 +2633,7 @@ sbictimeout(struct sbic_softc *dev) if (dev->sc_dmatimo) { if (dev->sc_dmatimo > 1) { printf("%s: DMA timeout #%d\n", - dev->sc_dev.dv_xname, dev->sc_dmatimo - 1); + device_xname(dev->sc_dev), dev->sc_dmatimo - 1); GET_SBIC_asr(dev->sc_sbic, asr); if( asr & SBIC_ASR_INT ) { /* We need to service a missed IRQ */ @@ -2792,7 +2792,7 @@ sbic_dump(struct sbic_softc *dev) GET_SBIC_csr(regs, csr); else csr = 0; - printf("%s@%p regs %p/%p asr %x csr %x\n", dev->sc_dev.dv_xname, + printf("%s@%p regs %p/%p asr %x csr %x\n", device_xname(dev->sc_dev), dev, regs.sbic_asr_p, regs.sbic_value_p, asr, csr); if ((acb = dev->free_list.tqh_first)) { printf("Free list:\n"); Index: sys/arch/amiga/dev/sbicvar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/amiga/dev/sbicvar.h,v retrieving revision 1.23 diff -u -p -r1.23 sbicvar.h --- sys/arch/amiga/dev/sbicvar.h 11 Dec 2005 12:16:28 -0000 1.23 +++ sys/arch/amiga/dev/sbicvar.h 28 Sep 2012 14:43:37 -0000 @@ -98,7 +98,7 @@ struct sbic_tinfo { }; struct sbic_softc { - struct device sc_dev; + device_t sc_dev; struct isr sc_isr; struct callout sc_timo_ch; struct target_sync { Index: sys/arch/amiga/dev/sci.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/amiga/dev/sci.c,v retrieving revision 1.34 diff -u -p -r1.34 sci.c --- sys/arch/amiga/dev/sci.c 20 Dec 2010 00:25:26 -0000 1.34 +++ sys/arch/amiga/dev/sci.c 28 Sep 2012 17:46:42 -0000 @@ -143,7 +143,7 @@ sci_scsipi_request(struct scsipi_channel { struct scsipi_xfer *xs; struct scsipi_periph *periph; - struct sci_softc *dev = (void *)chan->chan_adapter->adapt_dev; + struct sci_softc *dev = device_private(chan->chan_adapter->adapt_dev); int flags, s; switch (req) { @@ -263,7 +263,7 @@ void sciabort(struct sci_softc *dev, const char *where) { printf ("%s: abort %s: csr = 0x%02x, bus = 0x%02x\n", - dev->sc_dev.dv_xname, where, *dev->sci_csr, *dev->sci_bus_csr); + device_xname(dev->sc_dev), where, *dev->sci_csr, *dev->sci_bus_csr); if (dev->sc_flags & SCI_SELECTED) { @@ -312,7 +312,7 @@ scireset(struct sci_softc *dev) if (dev->sc_flags & SCI_ALIVE) sciabort(dev, "reset"); - printf("%s: ", dev->sc_dev.dv_xname); + printf("%s: ", device_xname(dev->sc_dev)); s = splbio(); /* preserve our ID for now */ @@ -355,7 +355,7 @@ scierror(struct sci_softc *dev, u_char c if (xs->xs_control & XS_CTL_SILENT) return; - printf("%s: ", dev->sc_dev.dv_xname); + printf("%s: ", device_xname(dev->sc_dev)); printf("csr == 0x%02i\n", csr); /* XXX */ } Index: sys/arch/amiga/dev/scivar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/amiga/dev/scivar.h,v retrieving revision 1.17 diff -u -p -r1.17 scivar.h --- sys/arch/amiga/dev/scivar.h 11 Dec 2005 12:16:28 -0000 1.17 +++ sys/arch/amiga/dev/scivar.h 28 Sep 2012 14:45:07 -0000 @@ -39,7 +39,7 @@ struct sci_softc; struct sci_softc { - struct device sc_dev; + device_t sc_dev; struct isr sc_isr; struct scsipi_adapter sc_adapter; struct scsipi_channel sc_channel; Index: sys/arch/amiga/dev/ser.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/amiga/dev/ser.c,v retrieving revision 1.79 diff -u -p -r1.79 ser.c --- sys/arch/amiga/dev/ser.c 24 Apr 2011 16:26:52 -0000 1.79 +++ sys/arch/amiga/dev/ser.c 28 Sep 2012 14:52:59 -0000 @@ -67,15 +67,14 @@ __KERNEL_RCSID(0, "$NetBSD: ser.c,v 1.79 #include "ser.h" #if NSER > 0 -void serattach(struct device *, struct device *, void *); -int sermatch(struct device *, struct cfdata *, void *); +void serattach(device_t, device_t, void *); +int sermatch(device_t, cfdata_t, void *); struct ser_softc { - struct device dev; struct tty *ser_tty; }; -CFATTACH_DECL(ser, sizeof(struct ser_softc), +CFATTACH_DECL_NEW(ser, sizeof(struct ser_softc), sermatch, serattach, NULL, NULL); extern struct cfdriver ser_cd; @@ -189,13 +188,13 @@ long sermintcount[16]; void sermint(register int unit); int -sermatch(struct device *pdp, struct cfdata *cfp, void *auxp) +sermatch(device_t parent, cfdata_t cf, void *aux) { static int ser_matched = 0; static int ser_matched_real = 0; /* Allow only once instance. */ - if (matchname("ser", (char *)auxp) == 0) + if (matchname("ser", (char *)aux) == 0) return(0); if (amiga_realconfig) { @@ -216,13 +215,13 @@ sermatch(struct device *pdp, struct cfda void -serattach(struct device *pdp, struct device *dp, void *auxp) +serattach(device_t parent, device_t self, void *aux) { struct ser_softc *sc; struct tty *tp; u_short ir; - sc = device_private(dp); + sc = device_private(self); ir = custom.intenar; if (serconsole == 0) @@ -263,7 +262,7 @@ serattach(struct device *pdp, struct dev tty_attach(tp); sc->ser_tty = ser_tty = tp; - if (dp) + if (self) printf(": input fifo %d output fifo %d\n", SERIBUF_SIZE, SEROBUF_SIZE); } Index: sys/arch/amiga/dev/siop.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/amiga/dev/siop.c,v retrieving revision 1.66 diff -u -p -r1.66 siop.c --- sys/arch/amiga/dev/siop.c 20 Dec 2010 00:25:26 -0000 1.66 +++ sys/arch/amiga/dev/siop.c 28 Sep 2012 04:57:43 -0000 @@ -227,7 +227,7 @@ siop_scsipi_request(struct scsipi_channe struct scsipi_xfer *xs; struct scsipi_periph *periph; struct siop_acb *acb; - struct siop_softc *sc = (void *)chan->chan_adapter->adapt_dev; + struct siop_softc *sc = device_private(chan->chan_adapter->adapt_dev); int flags, s; switch (req) { @@ -308,7 +308,7 @@ siop_poll(struct siop_softc *sc, struct to = xs->timeout / 1000; if (sc->nexus_list.tqh_first) printf("%s: siop_poll called with disconnected device\n", - sc->sc_dev.dv_xname); + device_xname(sc->sc_dev)); for (;;) { /* use cmd_wait values? */ i = 50000; @@ -337,7 +337,7 @@ siop_poll(struct siop_softc *sc, struct if (siop_checkintr(sc, istat, dstat, sstat0, &status)) { if (acb != sc->sc_nexus) printf("%s: siop_poll disconnected device completed\n", - sc->sc_dev.dv_xname); + device_xname(sc->sc_dev)); else if ((sc->sc_flags & SIOP_INTDEFER) == 0) { sc->sc_flags &= ~SIOP_INTSOFF; rp->siop_sien = sc->sc_sien; @@ -365,7 +365,7 @@ siop_sched(struct siop_softc *sc) #ifdef DEBUG if (sc->sc_nexus) { printf("%s: siop_sched- nexus %p/%d ready %p/%d\n", - sc->sc_dev.dv_xname, sc->sc_nexus, + device_xname(sc->sc_dev), sc->sc_nexus, sc->sc_nexus->xs->xs_periph->periph_target, sc->ready_list.tqh_first, sc->ready_list.tqh_first->xs->xs_periph->periph_target); @@ -390,7 +390,7 @@ siop_sched(struct siop_softc *sc) if (acb == NULL) { #ifdef DEBUGXXX printf("%s: siop_sched didn't find ready command\n", - sc->sc_dev.dv_xname); + device_xname(sc->sc_dev)); #endif return; } @@ -426,7 +426,7 @@ siop_scsidone(struct siop_acb *acb, int callout_stop(&xs->xs_callout); periph = xs->xs_periph; - sc = (void *)periph->periph_channel->chan_adapter->adapt_dev; + sc = device_private(periph->periph_channel->chan_adapter->adapt_dev); xs->status = stat; xs->resid = 0; /* XXXX */ @@ -472,7 +472,7 @@ siop_scsidone(struct siop_acb *acb, int --sc->sc_active; } else { printf("%s: can't find matching acb\n", - sc->sc_dev.dv_xname); + device_xname(sc->sc_dev)); #ifdef DDB /* Debugger(); */ #endif @@ -499,7 +499,7 @@ siopabort(register struct siop_softc *sc #endif printf ("%s: abort %s: dstat %02x, sstat0 %02x sbcl %02x\n", - sc->sc_dev.dv_xname, + device_xname(sc->sc_dev), where, rp->siop_dstat, rp->siop_sstat0, rp->siop_sbcl); if (sc->sc_active > 0) { @@ -593,7 +593,7 @@ siopinitialize(struct siop_softc *sc) #ifdef DEBUG if (inhibit_sync) printf("%s: Inhibiting synchronous transfer %02x\n", - sc->sc_dev.dv_xname, inhibit_sync); + device_xname(sc->sc_dev), inhibit_sync); #endif for (i = 0; i < 8; ++i) if (inhibit_sync & (1 << i)) @@ -638,7 +638,7 @@ siopreset(struct siop_softc *sc) if (sc->sc_flags & SIOP_ALIVE) siopabort(sc, rp, "reset"); - printf("%s: ", sc->sc_dev.dv_xname); /* XXXX */ + printf("%s: ", device_xname(sc->sc_dev)); /* XXXX */ s = splbio(); @@ -874,7 +874,7 @@ siop_start(struct siop_softc *sc, int ta mstohz(acb->xs->timeout) + 1, siop_timeout, acb); if (rp->siop_istat & SIOP_ISTAT_CON) printf("%s: siop_select while connected?\n", - sc->sc_dev.dv_xname); + device_xname(sc->sc_dev)); rp->siop_temp = 0; rp->siop_sbcl = sc->sc_sync[target].sbcl; rp->siop_dsa = kvtop((void *)&acb->ds); @@ -929,7 +929,7 @@ siop_checkintr(struct siop_softc *sc, u_ if (rp->siop_dsp && (rp->siop_dsp < sc->sc_scriptspa || rp->siop_dsp >= sc->sc_scriptspa + sizeof(scripts))) { printf ("%s: dsp not within script dsp %lx scripts %lx:%lx", - sc->sc_dev.dv_xname, rp->siop_dsp, sc->sc_scriptspa, + device_xname(sc->sc_dev), rp->siop_dsp, sc->sc_scriptspa, sc->sc_scriptspa + sizeof(scripts)); printf(" istat %x dstat %x sstat0 %x\n", istat, dstat, sstat0); @@ -952,14 +952,14 @@ siop_checkintr(struct siop_softc *sc, u_ if (sc->sc_sync[target].state == NEG_WAITS) { if (acb->msg[1] == 0xff) printf ("%s: target %d ignored sync request\n", - sc->sc_dev.dv_xname, target); + device_xname(sc->sc_dev), target); else if (acb->msg[1] == MSG_REJECT) printf ("%s: target %d rejected sync request\n", - sc->sc_dev.dv_xname, target); + device_xname(sc->sc_dev), target); else /* XXX - need to set sync transfer parameters */ printf("%s: target %d (sync) %02x %02x %02x\n", - sc->sc_dev.dv_xname, target, acb->msg[1], + device_xname(sc->sc_dev), target, acb->msg[1], acb->msg[2], acb->msg[3]); sc->sc_sync[target].state = NEG_DONE; } @@ -975,7 +975,7 @@ siop_checkintr(struct siop_softc *sc, u_ } if (acb->msg[0] != 0x00) printf("%s: message was not COMMAND COMPLETE: %x\n", - sc->sc_dev.dv_xname, acb->msg[0]); + device_xname(sc->sc_dev), acb->msg[0]); #endif if (sc->nexus_list.tqh_first) rp->siop_dcntl |= SIOP_DCNTL_STD; @@ -1009,7 +1009,7 @@ siop_checkintr(struct siop_softc *sc, u_ if (acb->msg[4] && acb->msg[4] < 100 / 4) { #ifdef DEBUG printf ("%d: target %d wanted %dns period\n", - sc->sc_dev.dv_xname, target, + device_xname(sc->sc_dev), target, acb->msg[4] * 4); #endif if (acb->msg[4] == 50 / 4) @@ -1019,7 +1019,7 @@ siop_checkintr(struct siop_softc *sc, u_ } #endif /* MAXTOR_KLUDGE */ printf ("%s: target %d now synchronous, period=%dns, offset=%d\n", - sc->sc_dev.dv_xname, target, + device_xname(sc->sc_dev), target, acb->msg[4] * 4, acb->msg[5]); scsi_period_to_siop (sc, target); } @@ -1041,7 +1041,7 @@ siop_checkintr(struct siop_softc *sc, u_ ++siopphmm; if (acb == NULL) printf("%s: Phase mismatch with no active command?\n", - sc->sc_dev.dv_xname); + device_xname(sc->sc_dev)); #endif if (acb->iob_len) { int adjust; @@ -1105,7 +1105,7 @@ siop_checkintr(struct siop_softc *sc, u_ #ifdef DEBUG if (acb == NULL) printf("%s: Select timeout with no active command?\n", - sc->sc_dev.dv_xname); + device_xname(sc->sc_dev)); if (rp->siop_sbcl & SIOP_BSY) { printf ("ACK! siop was busy at timeout: rp %p script %p dsa %p\n", rp, &scripts, &acb->ds); @@ -1141,9 +1141,9 @@ siop_checkintr(struct siop_softc *sc, u_ #ifdef DEBUG if (acb == NULL) printf("%s: Unexpected disconnect with no active command?\n", - sc->sc_dev.dv_xname); + device_xname(sc->sc_dev)); printf ("%s: target %d disconnected unexpectedly\n", - sc->sc_dev.dv_xname, target); + device_xname(sc->sc_dev), target); #endif #if 0 siopabort (sc, rp, "siopchkintr"); @@ -1158,14 +1158,14 @@ siop_checkintr(struct siop_softc *sc, u_ #ifdef DEBUG if (siop_debug & 0x100) printf ("%s: ID %02x disconnected TEMP %lx (+%lx) curbuf %lx curlen %lx buf %p len %lx dfifo %x dbc %x sstat1 %x starts %d acb %p\n", - sc->sc_dev.dv_xname, 1 << target, rp->siop_temp, + device_xname(sc->sc_dev), 1 << target, rp->siop_temp, rp->siop_temp ? rp->siop_temp - sc->sc_scriptspa : 0, acb->iob_curbuf, acb->iob_curlen, acb->ds.chain[0].databuf, acb->ds.chain[0].datalen, dfifo, dbc, sstat1, siopstarts, acb); #endif if (acb == NULL) { printf("%s: Disconnect with no active command?\n", - sc->sc_dev.dv_xname); + device_xname(sc->sc_dev)); return (0); } /* @@ -1181,7 +1181,7 @@ siop_checkintr(struct siop_softc *sc, u_ if (acb->iob_curlen && acb->iob_curlen != acb->ds.chain[0].datalen) printf("%s: iob_curbuf/len already set? n %x iob %lx/%lx chain[0] %p/%lx\n", - sc->sc_dev.dv_xname, n, acb->iob_curbuf, acb->iob_curlen, + device_xname(sc->sc_dev), n, acb->iob_curbuf, acb->iob_curlen, acb->ds.chain[0].databuf, acb->ds.chain[0].datalen); if (n < Ent_datain) n = (n - Ent_dataout) / 16; @@ -1195,7 +1195,7 @@ siop_checkintr(struct siop_softc *sc, u_ } #ifdef DEBUG if (siop_debug & 0x100) { - printf("%s: TEMP offset %d", sc->sc_dev.dv_xname, n); + printf("%s: TEMP offset %d", device_xname(sc->sc_dev), n); printf(" curbuf %lx curlen %lx\n", acb->iob_curbuf, acb->iob_curlen); } @@ -1214,10 +1214,10 @@ siop_checkintr(struct siop_softc *sc, u_ #ifdef DEBUG if (siop_debug & 0x100) printf ("%s: adjusting DMA chain\n", - sc->sc_dev.dv_xname); + device_xname(sc->sc_dev)); if (rp->siop_dsps == 0xff02) printf ("%s: ID %02x disconnected without Save Data Pointers\n", - sc->sc_dev.dv_xname, 1 << target); + device_xname(sc->sc_dev), 1 << target); #endif /* XXX is: if (rp->siop_dsps != 0xff02) { */ /* not disconnected without save data ptr */ @@ -1289,17 +1289,17 @@ siop_checkintr(struct siop_softc *sc, u_ #ifdef DEBUG if (siop_debug & 0x100) printf ("%s: target ID %02x reselected dsps %lx\n", - sc->sc_dev.dv_xname, reselid, + device_xname(sc->sc_dev), reselid, rp->siop_dsps); if ((rp->siop_sfbr & 0x80) == 0) printf("%s: Reselect message in was not identify: %x\n", - sc->sc_dev.dv_xname, rp->siop_sfbr); + device_xname(sc->sc_dev), rp->siop_sfbr); #endif if (sc->sc_nexus) { #ifdef DEBUG if (siop_debug & 0x100) printf ("%s: reselect ID %02x w/active\n", - sc->sc_dev.dv_xname, reselid); + device_xname(sc->sc_dev), reselid); #endif TAILQ_INSERT_HEAD(&sc->ready_list, sc->sc_nexus, chain); sc->sc_tinfo[sc->sc_nexus->xs->xs_periph->periph_target].lubusy @@ -1329,7 +1329,7 @@ siop_checkintr(struct siop_softc *sc, u_ } if (acb == NULL) { printf("%s: target ID %02x reselect nexus_list %p\n", - sc->sc_dev.dv_xname, reselid, + device_xname(sc->sc_dev), reselid, sc->nexus_list.tqh_first); panic("unable to find reselecting device"); } @@ -1346,14 +1346,14 @@ siop_checkintr(struct siop_softc *sc, u_ if (siop_debug & 0x100 || (ctest2 & SIOP_CTEST2_SIGP) == 0) printf ("%s: reselect interrupted (Sig_P?) scntl1 %x ctest2 %x sfbr %x istat %x/%x\n", - sc->sc_dev.dv_xname, rp->siop_scntl1, + device_xname(sc->sc_dev), rp->siop_scntl1, ctest2, rp->siop_sfbr, istat, rp->siop_istat); #endif /* XXX assumes it was not select */ if (sc->sc_nexus == NULL) { #ifdef DEBUG printf("%s: reselect interrupted, sc_nexus == NULL\n", - sc->sc_dev.dv_xname); + device_xname(sc->sc_dev)); #if 0 siop_dump(sc); #ifdef DDB @@ -1375,11 +1375,11 @@ siop_checkintr(struct siop_softc *sc, u_ if (dstat & SIOP_DSTAT_SIR && rp->siop_dsps == 0xff06) { if (acb == NULL) printf("%s: Bad message-in with no active command?\n", - sc->sc_dev.dv_xname); + device_xname(sc->sc_dev)); /* Unrecognized message in byte */ dma_cachectl (&acb->msg[1],1); printf ("%s: Unrecognized message in data sfbr %x msg %x sbcl %x\n", - sc->sc_dev.dv_xname, rp->siop_sfbr, acb->msg[1], rp->siop_sbcl); + device_xname(sc->sc_dev), rp->siop_sfbr, acb->msg[1], rp->siop_sbcl); /* what should be done here? */ DCIAS(kvtop(&acb->msg[1])); rp->siop_dsp = sc->sc_scriptspa + Ent_clear_ack; @@ -1388,7 +1388,7 @@ siop_checkintr(struct siop_softc *sc, u_ if (dstat & SIOP_DSTAT_SIR && rp->siop_dsps == 0xff0a) { /* Status phase wasn't followed by message in phase? */ printf ("%s: Status phase not followed by message in phase? sbcl %x sbdl %x\n", - sc->sc_dev.dv_xname, rp->siop_sbcl, rp->siop_sbdl); + device_xname(sc->sc_dev), rp->siop_sbcl, rp->siop_sbdl); if (rp->siop_sbcl == 0xa7) { /* It is now, just continue the script? */ rp->siop_dcntl |= SIOP_DCNTL_STD; @@ -1446,7 +1446,7 @@ siop_select(struct siop_softc *sc) #ifdef DEBUG if (siop_debug & 1) - printf ("%s: select ", sc->sc_dev.dv_xname); + printf ("%s: select ", device_xname(sc->sc_dev)); #endif rp = sc->sc_siopp; @@ -1508,10 +1508,10 @@ siopintr(register struct siop_softc *sc) #ifdef DEBUG if (siop_debug & 1) printf ("%s: intr istat %x dstat %x sstat0 %x\n", - sc->sc_dev.dv_xname, istat, dstat, sstat0); + device_xname(sc->sc_dev), istat, dstat, sstat0); if (!sc->sc_active) { printf ("%s: spurious interrupt? istat %x dstat %x sstat0 %x nexus %p status %x\n", - sc->sc_dev.dv_xname, istat, dstat, sstat0, + device_xname(sc->sc_dev), istat, dstat, sstat0, sc->sc_nexus, sc->sc_nexus ? sc->sc_nexus->stat[0] : 0); } #endif @@ -1520,7 +1520,7 @@ siopintr(register struct siop_softc *sc) if (siop_debug & 5) { DCIAS(kvtop(&sc->sc_nexus->stat[0])); printf ("%s: intr istat %x dstat %x sstat0 %x dsps %lx sbcl %x sts %x msg %x\n", - sc->sc_dev.dv_xname, istat, dstat, sstat0, + device_xname(sc->sc_dev), istat, dstat, sstat0, rp->siop_dsps, rp->siop_sbcl, sc->sc_nexus->stat[0], sc->sc_nexus->msg[0]); } @@ -1539,7 +1539,7 @@ siopintr(register struct siop_softc *sc) #if 0 if (rp->siop_sbcl & SIOP_BSY) { printf ("%s: SCSI bus busy at completion", - sc->sc_dev.dv_xname); + device_xname(sc->sc_dev)); printf(" targ %d sbcl %02x sfbr %x lcrc %02x dsp +%x\n", sc->sc_nexus->xs->xs_periph->periph_target, rp->siop_sbcl, rp->siop_sfbr, rp->siop_lcrc, @@ -1664,7 +1664,7 @@ siop_dump(struct siop_softc *sc) siop_dump_trace(); #endif printf("%s@%p regs %p istat %x\n", - sc->sc_dev.dv_xname, sc, rp, rp->siop_istat); + device_xname(sc->sc_dev), sc, rp, rp->siop_istat); if ((acb = sc->free_list.tqh_first) > 0) { printf("Free list:\n"); while (acb) { Index: sys/arch/amiga/dev/siop2.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/amiga/dev/siop2.c,v retrieving revision 1.40 diff -u -p -r1.40 siop2.c --- sys/arch/amiga/dev/siop2.c 20 Dec 2010 00:25:26 -0000 1.40 +++ sys/arch/amiga/dev/siop2.c 28 Sep 2012 17:48:17 -0000 @@ -214,7 +214,7 @@ siopng_scsipi_request(struct scsipi_chan struct scsipi_xfer *xs; struct scsipi_periph *periph; struct siop_acb *acb; - struct siop_softc *sc = (void *)chan->chan_adapter->adapt_dev; + struct siop_softc *sc = device_private(chan->chan_adapter->adapt_dev); int flags, s; switch (req) { @@ -294,7 +294,7 @@ siopng_poll(struct siop_softc *sc, struc to = xs->timeout / 1000; if (sc->nexus_list.tqh_first) printf("%s: siopng_poll called with disconnected device\n", - sc->sc_dev.dv_xname); + device_xname(sc->sc_dev)); for (;;) { /* use cmd_wait values? */ i = 50000; @@ -323,7 +323,7 @@ siopng_poll(struct siop_softc *sc, struc if (siopng_checkintr(sc, istat, dstat, sist, &status)) { if (acb != sc->sc_nexus) printf("%s: siopng_poll disconnected device completed\n", - sc->sc_dev.dv_xname); + device_xname(sc->sc_dev)); else if ((sc->sc_flags & SIOP_INTDEFER) == 0) { sc->sc_flags &= ~SIOP_INTSOFF; rp->siop_sien = sc->sc_sien; @@ -350,7 +350,7 @@ siopng_sched(struct siop_softc *sc) #ifdef DEBUG if (sc->sc_nexus) { printf("%s: siopng_sched- nexus %p/%d ready %p/%d\n", - sc->sc_dev.dv_xname, sc->sc_nexus, + device_xname(sc->sc_dev), sc->sc_nexus, sc->sc_nexus->xs->xs_periph->periph_target, sc->ready_list.tqh_first, sc->ready_list.tqh_first->xs->xs_periph->periph_target); @@ -375,7 +375,7 @@ siopng_sched(struct siop_softc *sc) if (acb == NULL) { #ifdef DEBUGXXX printf("%s: siopng_sched didn't find ready command\n", - sc->sc_dev.dv_xname); + device_xname(sc->sc_dev)); #endif return; } @@ -411,7 +411,7 @@ siopng_scsidone(struct siop_acb *acb, in callout_stop(&xs->xs_callout); periph = xs->xs_periph; - sc = (void *)periph->periph_channel->chan_adapter->adapt_dev; + sc = device_private(periph->periph_channel->chan_adapter->adapt_dev); xs->status = stat; xs->resid = 0; /* XXXX */ @@ -457,7 +457,7 @@ siopng_scsidone(struct siop_acb *acb, in --sc->sc_active; } else { printf("%s: can't find matching acb\n", - sc->sc_dev.dv_xname); + device_xname(sc->sc_dev)); #ifdef DDB /* Debugger(); */ #endif @@ -484,7 +484,7 @@ siopngabort(register struct siop_softc * #endif printf ("%s: abort %s: dstat %02x, istat %02x sist %04x sien %04x sbcl %02x\n", - sc->sc_dev.dv_xname, + device_xname(sc->sc_dev), where, rp->siop_dstat, rp->siop_istat, rp->siop_sist, rp->siop_sien, rp->siop_sbcl); siopng_dump_registers(sc); @@ -581,7 +581,7 @@ siopnginitialize(struct siop_softc *sc) #ifdef DEBUG if (inhibit_sync) printf("%s: Inhibiting synchronous transfer %02x\n", - sc->sc_dev.dv_xname, inhibit_sync); + device_xname(sc->sc_dev), inhibit_sync); #endif for (i = 0; i < 16; ++i) /* XXX maxtarget */ if (inhibit_sync & (1 << i)) @@ -626,7 +626,7 @@ siopngreset(struct siop_softc *sc) if (sc->sc_flags & SIOP_ALIVE) siopngabort(sc, rp, "reset"); - printf("%s: ", sc->sc_dev.dv_xname); /* XXXX */ + printf("%s: ", device_xname(sc->sc_dev)); /* XXXX */ s = splbio(); @@ -934,7 +934,7 @@ siopng_start(struct siop_softc *sc, int mstohz(acb->xs->timeout) + 1, siopng_timeout, acb); if (rp->siop_istat & SIOP_ISTAT_CON) printf("%s: siopng_select while connected?\n", - sc->sc_dev.dv_xname); + device_xname(sc->sc_dev)); rp->siop_temp = 0; #ifndef FIXME rp->siop_scntl3 = sc->sc_sync[target].scntl3; @@ -996,7 +996,7 @@ siopng_checkintr(struct siop_softc *sc, if (rp->siop_dsp && (rp->siop_dsp < sc->sc_scriptspa || rp->siop_dsp >= sc->sc_scriptspa + sizeof(siopng_scripts))) { printf ("%s: dsp not within script dsp %lx scripts %lx:%lx", - sc->sc_dev.dv_xname, rp->siop_dsp, sc->sc_scriptspa, + device_xname(sc->sc_dev), rp->siop_dsp, sc->sc_scriptspa, sc->sc_scriptspa + sizeof(siopng_scripts)); printf(" istat %x dstat %x sist %x\n", istat, dstat, sist); @@ -1019,13 +1019,13 @@ siopng_checkintr(struct siop_softc *sc, if (sc->sc_sync[target].state == NEG_WAITW) { if (acb->msg[1] == 0xff) printf ("%s: target %d ignored wide request\n", - sc->sc_dev.dv_xname, target); + device_xname(sc->sc_dev), target); else if (acb->msg[1] == MSG_REJECT) printf ("%s: target %d rejected wide request\n", - sc->sc_dev.dv_xname, target); + device_xname(sc->sc_dev), target); else { printf("%s: target %d (wide) %02x %02x %02x %02x\n", - sc->sc_dev.dv_xname, target, acb->msg[1], + device_xname(sc->sc_dev), target, acb->msg[1], acb->msg[2], acb->msg[3], acb->msg[4]); if (acb->msg[1] == MSG_EXT_MESSAGE && acb->msg[2] == 2 && @@ -1039,14 +1039,14 @@ siopng_checkintr(struct siop_softc *sc, if (sc->sc_sync[target].state == NEG_WAITS) { if (acb->msg[1] == 0xff) printf ("%s: target %d ignored sync request\n", - sc->sc_dev.dv_xname, target); + device_xname(sc->sc_dev), target); else if (acb->msg[1] == MSG_REJECT) printf ("%s: target %d rejected sync request\n", - sc->sc_dev.dv_xname, target); + device_xname(sc->sc_dev), target); else /* XXX - need to set sync transfer parameters */ printf("%s: target %d (sync) %02x %02x %02x\n", - sc->sc_dev.dv_xname, target, acb->msg[1], + device_xname(sc->sc_dev), target, acb->msg[1], acb->msg[2], acb->msg[3]); sc->sc_sync[target].state = NEG_DONE; } @@ -1062,7 +1062,7 @@ siopng_checkintr(struct siop_softc *sc, } if (acb->msg[0] != 0x00) printf("%s: message was not COMMAND COMPLETE: %x\n", - sc->sc_dev.dv_xname, acb->msg[0]); + device_xname(sc->sc_dev), acb->msg[0]); #endif if (sc->nexus_list.tqh_first) rp->siop_dcntl |= SIOP_DCNTL_STD; @@ -1084,7 +1084,7 @@ siopng_checkintr(struct siop_softc *sc, acb->msg[4] != 0) { sc->sc_sync[target].scntl3 |= SIOP_SCNTL3_EWS; printf ("%s: target %d now wide %d\n", - sc->sc_dev.dv_xname, target, + device_xname(sc->sc_dev), target, acb->msg[4]); } rp->siop_scntl3 = sc->sc_sync[target].scntl3; @@ -1127,7 +1127,7 @@ siopng_checkintr(struct siop_softc *sc, if (acb->msg[4] && acb->msg[4] < 100 / 4) { #ifdef DEBUG printf ("%d: target %d wanted %dns period\n", - sc->sc_dev.dv_xname, target, + device_xname(sc->sc_dev), target, acb->msg[4] * 4); #endif if (acb->msg[4] == 50 / 4) @@ -1137,7 +1137,7 @@ siopng_checkintr(struct siop_softc *sc, } #endif /* MAXTOR_KLUDGE */ printf ("%s: target %d now synchronous, period=%dns, offset=%d\n", - sc->sc_dev.dv_xname, target, + device_xname(sc->sc_dev), target, (acb->msg[4] == 12) ? 50 : acb->msg[4] * 4, acb->msg[5]); scsi_period_to_siopng (sc, target); @@ -1163,7 +1163,7 @@ siopng_checkintr(struct siop_softc *sc, ++siopngphmm; if (acb == NULL) printf("%s: Phase mismatch with no active command?\n", - sc->sc_dev.dv_xname); + device_xname(sc->sc_dev)); #endif if (acb->iob_len) { int adjust; @@ -1231,7 +1231,7 @@ siopng_checkintr(struct siop_softc *sc, #ifdef DEBUG if (acb == NULL) printf("%s: Select timeout with no active command?\n", - sc->sc_dev.dv_xname); + device_xname(sc->sc_dev)); if (rp->siop_sbcl & SIOP_BSY) { printf ("ACK! siop was busy at timeout: rp %p script %p dsa %p\n", rp, &siopng_scripts, &acb->ds); @@ -1271,9 +1271,9 @@ siopng_checkintr(struct siop_softc *sc, #ifdef DEBUG if (acb == NULL) printf("%s: Unexpected disconnect with no active command?\n", - sc->sc_dev.dv_xname); + device_xname(sc->sc_dev)); printf ("%s: target %d disconnected unexpectedly\n", - sc->sc_dev.dv_xname, target); + device_xname(sc->sc_dev), target); siopng_dump_registers(sc); siopng_dump(sc); #endif @@ -1292,14 +1292,14 @@ siopng_dump(sc); #ifdef DEBUG if (siopng_debug & 0x100) printf ("%s: ID %02x disconnected TEMP %lx (+%lx) curbuf %lx curlen %lx buf %p len %lx dfifo %x dbc %x sstat1 %x starts %d acb %p\n", - sc->sc_dev.dv_xname, 1 << target, rp->siop_temp, + device_xname(sc->sc_dev), 1 << target, rp->siop_temp, rp->siop_temp ? rp->siop_temp - sc->sc_scriptspa : 0, acb->iob_curbuf, acb->iob_curlen, acb->ds.chain[0].databuf, acb->ds.chain[0].datalen, dfifo, dbc, sstat1, siopngstarts, acb); #endif if (acb == NULL) { printf("%s: Disconnect with no active command?\n", - sc->sc_dev.dv_xname); + device_xname(sc->sc_dev)); return (0); } /* @@ -1315,7 +1315,7 @@ siopng_dump(sc); if (acb->iob_curlen && acb->iob_curlen != acb->ds.chain[0].datalen) printf("%s: iob_curbuf/len already set? n %x iob %lx/%lx chain[0] %p/%lx\n", - sc->sc_dev.dv_xname, n, acb->iob_curbuf, acb->iob_curlen, + device_xname(sc->sc_dev), n, acb->iob_curbuf, acb->iob_curlen, acb->ds.chain[0].databuf, acb->ds.chain[0].datalen); if (n < Ent_datain) n = (n - Ent_dataout) / 16; @@ -1329,7 +1329,7 @@ siopng_dump(sc); } #ifdef DEBUG if (siopng_debug & 0x100) { - printf("%s: TEMP offset %d", sc->sc_dev.dv_xname, n); + printf("%s: TEMP offset %d", device_xname(sc->sc_dev), n); printf(" curbuf %lx curlen %lx\n", acb->iob_curbuf, acb->iob_curlen); } @@ -1348,10 +1348,10 @@ siopng_dump(sc); #ifdef DEBUG if (siopng_debug & 0x100) printf ("%s: adjusting DMA chain\n", - sc->sc_dev.dv_xname); + device_xname(sc->sc_dev)); if (rp->siop_dsps == 0xff02) printf ("%s: ID %02x disconnected without Save Data Pointers\n", - sc->sc_dev.dv_xname, 1 << target); + device_xname(sc->sc_dev), 1 << target); #endif for (i = 0; i < DMAMAXIO; ++i) { if (acb->ds.chain[i].datalen == 0) @@ -1426,17 +1426,17 @@ siopng_dump(sc); #ifdef DEBUG if (siopng_debug & 0x100) printf ("%s: target ID %02x reselected dsps %lx\n", - sc->sc_dev.dv_xname, reselid, + device_xname(sc->sc_dev), reselid, rp->siop_dsps); if ((rp->siop_sfbr & 0x80) == 0) printf("%s: Reselect message in was not identify: %x\n", - sc->sc_dev.dv_xname, rp->siop_sfbr); + device_xname(sc->sc_dev), rp->siop_sfbr); #endif if (sc->sc_nexus) { #ifdef DEBUG if (siopng_debug & 0x100) printf ("%s: reselect ID %02x w/active\n", - sc->sc_dev.dv_xname, reselid); + device_xname(sc->sc_dev), reselid); #endif TAILQ_INSERT_HEAD(&sc->ready_list, sc->sc_nexus, chain); sc->sc_tinfo[sc->sc_nexus->xs->xs_periph->periph_target].lubusy @@ -1470,7 +1470,7 @@ siopng_dump(sc); } if (acb == NULL) { printf("%s: target ID %02x reselect nexus_list %p\n", - sc->sc_dev.dv_xname, reselid, + device_xname(sc->sc_dev), reselid, sc->nexus_list.tqh_first); panic("unable to find reselecting device"); } @@ -1488,14 +1488,14 @@ siopng_dump(sc); if (siopng_debug & 0x100 || (ctest2 & SIOP_CTEST2_SIGP) == 0) printf ("%s: reselect interrupted (Sig_P?) scntl1 %x ctest2 %x sfbr %x istat %x/%x\n", - sc->sc_dev.dv_xname, rp->siop_scntl1, + device_xname(sc->sc_dev), rp->siop_scntl1, ctest2, rp->siop_sfbr, istat, rp->siop_istat); #endif /* XXX assumes it was not select */ if (sc->sc_nexus == NULL) { #ifdef DEBUG printf("%s: reselect interrupted, sc_nexus == NULL\n", - sc->sc_dev.dv_xname); + device_xname(sc->sc_dev)); #if 0 siopng_dump(sc); #ifdef DDB @@ -1522,11 +1522,11 @@ siopng_dump(sc); if (dstat & SIOP_DSTAT_SIR && rp->siop_dsps == 0xff06) { if (acb == NULL) printf("%s: Bad message-in with no active command?\n", - sc->sc_dev.dv_xname); + device_xname(sc->sc_dev)); /* Unrecognized message in byte */ dma_cachectl (&acb->msg[1],1); printf ("%s: Unrecognized message in data sfbr %x msg %x sbcl %x\n", - sc->sc_dev.dv_xname, rp->siop_sfbr, acb->msg[1], rp->siop_sbcl); + device_xname(sc->sc_dev), rp->siop_sfbr, acb->msg[1], rp->siop_sbcl); /* what should be done here? */ DCIAS(kvtop(&acb->msg[1])); rp->siop_dsp = sc->sc_scriptspa + Ent_clear_ack; @@ -1536,7 +1536,7 @@ siopng_dump(sc); if (dstat & SIOP_DSTAT_SIR && rp->siop_dsps == 0xff0a) { /* Status phase wasn't followed by message in phase? */ printf ("%s: Status phase not followed by message in phase? sbcl %x sbdl %x\n", - sc->sc_dev.dv_xname, rp->siop_sbcl, rp->siop_sbdl); + device_xname(sc->sc_dev), rp->siop_sbcl, rp->siop_sbdl); if (rp->siop_sbcl == 0xa7) { /* It is now, just continue the script? */ rp->siop_dcntl |= SIOP_DCNTL_STD; @@ -1594,7 +1594,7 @@ siopng_select(struct siop_softc *sc) #ifdef DEBUG if (siopng_debug & 1) - printf ("%s: select ", sc->sc_dev.dv_xname); + printf ("%s: select ", device_xname(sc->sc_dev)); #endif rp = sc->sc_siopp; @@ -1657,10 +1657,10 @@ siopngintr(register struct siop_softc *s #ifdef DEBUG if (siopng_debug & 1) printf ("%s: intr istat %x dstat %x sist %x\n", - sc->sc_dev.dv_xname, istat, dstat, sist); + device_xname(sc->sc_dev), istat, dstat, sist); if (!sc->sc_active) { printf ("%s: spurious interrupt? istat %x dstat %x sist %x nexus %p status %x\n", - sc->sc_dev.dv_xname, istat, dstat, sist, + device_xname(sc->sc_dev), istat, dstat, sist, sc->sc_nexus, sc->sc_nexus ? sc->sc_nexus->stat[0] : 0); } #endif @@ -1669,7 +1669,7 @@ siopngintr(register struct siop_softc *s if (siopng_debug & 5) { DCIAS(kvtop(&sc->sc_nexus->stat[0])); printf ("%s: intr istat %x dstat %x sist %x dsps %lx sbcl %x sts %x msg %x\n", - sc->sc_dev.dv_xname, istat, dstat, sist, + device_xname(sc->sc_dev), istat, dstat, sist, rp->siop_dsps, rp->siop_sbcl, sc->sc_nexus->stat[0], sc->sc_nexus->msg[0]); } @@ -1688,7 +1688,7 @@ siopngintr(register struct siop_softc *s #if 0 if (rp->siop_sbcl & SIOP_BSY) { printf ("%s: SCSI bus busy at completion", - sc->sc_dev.dv_xname); + device_xname(sc->sc_dev)); printf(" targ %d sbcl %02x sfbr %x respid %02x dsp +%x\n", sc->sc_nexus->xs->xs_periph->periph_target, rp->siop_sbcl, rp->siop_sfbr, rp->siop_respid, @@ -1851,7 +1851,7 @@ siopng_dump(struct siop_softc *sc) siopng_dump_trace(); #endif printf("%s@%p regs %p istat %x\n", - sc->sc_dev.dv_xname, sc, rp, rp->siop_istat); + device_xname(sc->sc_dev), sc, rp, rp->siop_istat); if ((acb = sc->free_list.tqh_first) > 0) { printf("Free list:\n"); while (acb) { Index: sys/arch/amiga/dev/siopvar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/amiga/dev/siopvar.h,v retrieving revision 1.26 diff -u -p -r1.26 siopvar.h --- sys/arch/amiga/dev/siopvar.h 19 May 2009 18:39:26 -0000 1.26 +++ sys/arch/amiga/dev/siopvar.h 28 Sep 2012 04:55:16 -0000 @@ -116,7 +116,7 @@ struct siop_tinfo { }; struct siop_softc { - struct device sc_dev; + device_t sc_dev; struct isr sc_isr; void *sc_siop_si; Index: sys/arch/amiga/dev/wesc.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/amiga/dev/wesc.c,v retrieving revision 1.39 diff -u -p -r1.39 wesc.c --- sys/arch/amiga/dev/wesc.c 20 Dec 2010 00:25:26 -0000 1.39 +++ sys/arch/amiga/dev/wesc.c 28 Sep 2012 14:48:09 -0000 @@ -76,8 +76,8 @@ __KERNEL_RCSID(0, "$NetBSD: wesc.c,v 1.3 #include #include -void wescattach(struct device *, struct device *, void *); -int wescmatch(struct device *, struct cfdata *, void *); +void wescattach(device_t, device_t, void *); +int wescmatch(device_t, cfdata_t, void *); int wesc_dmaintr(void *); #ifdef DEBUG void wesc_dump(void); @@ -87,36 +87,37 @@ void wesc_dump(void); #ifdef DEBUG #endif -CFATTACH_DECL(wesc, sizeof(struct siop_softc), +CFATTACH_DECL_NEW(wesc, sizeof(struct siop_softc), wescmatch, wescattach, NULL, NULL); /* * if we are an MacroSystemsUS Warp Engine */ int -wescmatch(struct device *pdp, struct cfdata *cfp, void *auxp) +wescmatch(device_t parent, cfdata_t cf, void *aux) { struct zbus_args *zap; - zap = auxp; + zap = aux; if (zap->manid == 2203 && zap->prodid == 19) return(1); return(0); } void -wescattach(struct device *pdp, struct device *dp, void *auxp) +wescattach(device_t parent, device_t self, void *aux) { - struct siop_softc *sc = (struct siop_softc *)dp; + struct siop_softc *sc = device_private(self); struct zbus_args *zap; siop_regmap_p rp; struct scsipi_adapter *adapt = &sc->sc_adapter; struct scsipi_channel *chan = &sc->sc_channel; + sc->sc_dev = self; printf("\n"); - zap = auxp; + zap = aux; sc->sc_siopp = rp = (siop_regmap_p)((char *)zap->va + 0x40000); @@ -131,7 +132,7 @@ wescattach(struct device *pdp, struct de * Fill in the scsipi_adapter. */ memset(adapt, 0, sizeof(*adapt)); - adapt->adapt_dev = &sc->sc_dev; + adapt->adapt_dev = self; adapt->adapt_nchannels = 1; adapt->adapt_openings = 7; adapt->adapt_max_periph = 1; @@ -159,7 +160,7 @@ wescattach(struct device *pdp, struct de /* * attach all scsi units on us */ - config_found(dp, chan, scsiprint); + config_found(self, chan, scsiprint); } int Index: sys/arch/amiga/dev/wstsc.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/amiga/dev/wstsc.c,v retrieving revision 1.32 diff -u -p -r1.32 wstsc.c --- sys/arch/amiga/dev/wstsc.c 11 Dec 2005 12:16:28 -0000 1.32 +++ sys/arch/amiga/dev/wstsc.c 28 Sep 2012 14:46:28 -0000 @@ -73,8 +73,8 @@ __KERNEL_RCSID(0, "$NetBSD: wstsc.c,v 1. #include #include -void wstscattach(struct device *, struct device *, void *); -int wstscmatch(struct device *, struct cfdata *, void *); +void wstscattach(device_t, device_t, void *); +int wstscmatch(device_t, cfdata_t, void *); int wstsc_dma_xfer_in(struct sci_softc *dev, int len, register u_char *buf, int phase); @@ -97,18 +97,18 @@ extern int sci_data_wait; int supradma_pseudo = 0; /* 0=none, 1=byte, 2=word */ -CFATTACH_DECL(wstsc, sizeof(struct sci_softc), +CFATTACH_DECL_NEW(wstsc, sizeof(struct sci_softc), wstscmatch, wstscattach, NULL, NULL); /* * if this a Supra WordSync board */ int -wstscmatch(struct device *pdp, struct cfdata *cfp, void *auxp) +wstscmatch(device_t parent, cfdata_t cf, void *aux) { struct zbus_args *zap; - zap = auxp; + zap = aux; /* * Check manufacturer and product id. @@ -122,17 +122,19 @@ wstscmatch(struct device *pdp, struct cf } void -wstscattach(struct device *pdp, struct device *dp, void *auxp) +wstscattach(device_t parent, device_t self, void *aux) { volatile u_char *rp; - struct sci_softc *sc = (struct sci_softc *)dp; + struct sci_softc *sc = device_private(self); struct zbus_args *zap; struct scsipi_adapter *adapt = &sc->sc_adapter; struct scsipi_channel *chan = &sc->sc_channel; + sc->sc_dev = self; + printf("\n"); - zap = auxp; + zap = aux; rp = zap->va; /* @@ -174,7 +176,7 @@ wstscattach(struct device *pdp, struct d * Fill in the scsipi_adapter. */ memset(adapt, 0, sizeof(*adapt)); - adapt->adapt_dev = &sc->sc_dev; + adapt->adapt_dev = self; adapt->adapt_nchannels = 1; adapt->adapt_openings = 7; adapt->adapt_max_periph = 1; @@ -195,7 +197,7 @@ wstscattach(struct device *pdp, struct d /* * attach all scsi units on us */ - config_found(dp, chan, scsiprint); + config_found(self, chan, scsiprint); } int Index: sys/arch/amiga/dev/zbus.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/amiga/dev/zbus.c,v retrieving revision 1.68 diff -u -p -r1.68 zbus.c --- sys/arch/amiga/dev/zbus.c 19 Jan 2012 00:14:08 -0000 1.68 +++ sys/arch/amiga/dev/zbus.c 29 Sep 2012 12:02:28 -0000 @@ -284,13 +284,13 @@ static cfdata_t early_cfdata; /*ARGSUSED*/ int -zbusmatch(device_t pdp, cfdata_t cfp, void *auxp) +zbusmatch(device_t parent, cfdata_t cf, void *aux) { - if (matchname(auxp, "zbus") == 0) + if (matchname(aux, "zbus") == 0) return(0); if (amiga_realconfig == 0) - early_cfdata = cfp; + early_cfdata = cf; return(1); } @@ -300,7 +300,7 @@ zbusmatch(device_t pdp, cfdata_t cfp, vo * with that driver if matched else print a diag. */ void -zbusattach(device_t pdp, device_t dp, void *auxp) +zbusattach(device_t parent, device_t self, void *aux) { struct zbus_args za; struct preconfdata *pcp, *epcp; @@ -355,7 +355,7 @@ zbusattach(device_t pdp, device_t dp, vo if (amiga_realconfig == 0) pcp->vaddr = za.va; } - amiga_config_found(early_cfdata, dp, &za, zbusprint); + amiga_config_found(early_cfdata, self, &za, zbusprint); } } Index: sys/arch/amiga/dev/zssc.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/amiga/dev/zssc.c,v retrieving revision 1.44 diff -u -p -r1.44 zssc.c --- sys/arch/amiga/dev/zssc.c 20 Dec 2010 00:25:26 -0000 1.44 +++ sys/arch/amiga/dev/zssc.c 28 Sep 2012 14:46:02 -0000 @@ -76,32 +76,32 @@ __KERNEL_RCSID(0, "$NetBSD: zssc.c,v 1.4 #include #include -void zsscattach(struct device *, struct device *, void *); -int zsscmatch(struct device *, struct cfdata *, void *); +void zsscattach(device_t, device_t, void *); +int zsscmatch(device_t, cfdata_t, void *); int zssc_dmaintr(void *); #ifdef DEBUG void zssc_dump(void); #endif -CFATTACH_DECL(zssc, sizeof(struct siop_softc), +CFATTACH_DECL_NEW(zssc, sizeof(struct siop_softc), zsscmatch, zsscattach, NULL, NULL); /* * if we are an PPI Zeus */ int -zsscmatch(struct device *pdp, struct cfdata *cfp, void *auxp) +zsscmatch(device_t parent, cfdata_t cf, void *aux) { struct zbus_args *zap; - zap = auxp; + zap = aux; if (zap->manid == 2026 && zap->prodid == 150) return(1); return(0); } void -zsscattach(struct device *pdp, struct device *dp, void *auxp) +zsscattach(device_t parent, device_t self, void *aux) { struct siop_softc *sc; struct zbus_args *zap; @@ -109,9 +109,9 @@ zsscattach(struct device *pdp, struct de printf("\n"); - zap = auxp; + zap = aux; - sc = (struct siop_softc *)dp; + sc = device_private(self); sc->sc_siopp = rp = (siop_regmap_p)((char *)zap->va + 0x4000); /* @@ -124,7 +124,7 @@ zsscattach(struct device *pdp, struct de sc->sc_siop_si = softint_establish(SOFTINT_BIO, (void (*)(void *))siopintr, sc); - sc->sc_adapter.adapt_dev = &sc->sc_dev; + sc->sc_adapter.adapt_dev = self; sc->sc_adapter.adapt_nchannels = 1; sc->sc_adapter.adapt_openings = 7; sc->sc_adapter.adapt_max_periph = 1; @@ -149,7 +149,7 @@ zsscattach(struct device *pdp, struct de /* * attach all scsi units on us */ - config_found(dp, &sc->sc_channel, scsiprint); + config_found(self, &sc->sc_channel, scsiprint); } /* Index: sys/arch/amiga/pci/cv3dpb.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/amiga/pci/cv3dpb.c,v retrieving revision 1.1 diff -u -p -r1.1 cv3dpb.c --- sys/arch/amiga/pci/cv3dpb.c 11 Jan 2012 17:04:29 -0000 1.1 +++ sys/arch/amiga/pci/cv3dpb.c 26 Sep 2012 21:34:17 -0000 @@ -56,8 +56,8 @@ #define ZORRO_MANID_P5 8512 #define ZORRO_PRODID_CV643D_Z3 67 /* CV64/3D on Z3 bus */ -static int cv3dpb_match(struct device *, struct cfdata *, void *); -static void cv3dpb_attach(struct device *, struct device *, void *); +static int cv3dpb_match(device_t, cfdata_t, void *); +static void cv3dpb_attach(device_t, device_t, void *); pcireg_t cv3dpb_pci_conf_read(pci_chipset_tag_t, pcitag_t, int); void cv3dpb_pci_conf_write(pci_chipset_tag_t, pcitag_t, int, pcireg_t); int cv3dpb_pci_bus_maxdevs(pci_chipset_tag_t pc, int busno); Index: sys/arch/amiga/pci/emmem.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/amiga/pci/emmem.c,v retrieving revision 1.2 diff -u -p -r1.2 emmem.c --- sys/arch/amiga/pci/emmem.c 31 May 2012 21:29:02 -0000 1.2 +++ sys/arch/amiga/pci/emmem.c 26 Sep 2012 21:34:17 -0000 @@ -52,8 +52,8 @@ #include #include -static int emmem_match(struct device *, struct cfdata *, void *); -static void emmem_attach(struct device *, struct device *, void *); +static int emmem_match(device_t, cfdata_t, void *); +static void emmem_attach(device_t, device_t, void *); CFATTACH_DECL_NEW(emmem, sizeof(struct emmem_softc), emmem_match, emmem_attach, NULL, NULL); Index: sys/arch/amiga/pci/empb.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/amiga/pci/empb.c,v retrieving revision 1.7 diff -u -p -r1.7 empb.c --- sys/arch/amiga/pci/empb.c 27 Jun 2012 18:53:03 -0000 1.7 +++ sys/arch/amiga/pci/empb.c 29 Sep 2012 10:43:22 -0000 @@ -63,30 +63,28 @@ #define WINDOW_LOCK(s) (s) = splhigh() #define WINDOW_UNLOCK(s) splx((s)) -static int empb_match(struct device *, struct cfdata *, void *); -static void empb_attach(struct device *, struct device *, void *); +static int empb_match(device_t, cfdata_t, void *); +static void empb_attach(device_t, device_t, void *); -static void empb_callback(device_t self); +static void empb_callback(device_t); -static void empb_find_mem(struct empb_softc *sc); -static void empb_switch_bridge(struct empb_softc *sc, uint8_t mode); -static void empb_intr_enable(struct empb_softc *sc); +static void empb_find_mem(struct empb_softc *); +static void empb_switch_bridge(struct empb_softc *, uint8_t); +static void empb_intr_enable(struct empb_softc *); pcireg_t empb_pci_conf_read(pci_chipset_tag_t, pcitag_t, int); void empb_pci_conf_write(pci_chipset_tag_t, pcitag_t, int, pcireg_t); -int empb_pci_bus_maxdevs(pci_chipset_tag_t pc, int busno); -void empb_pci_attach_hook(struct device *parent, - struct device *self, struct pcibus_attach_args *pba); -pcitag_t empb_pci_make_tag(pci_chipset_tag_t pc, int bus, int device, - int function); -void empb_pci_decompose_tag(pci_chipset_tag_t pc, pcitag_t tag, - int *bp, int *dp, int *fp); -int empb_pci_intr_map(const struct pci_attach_args *pa, - pci_intr_handle_t *ihp); -const struct evcnt * empb_pci_intr_evcnt(pci_chipset_tag_t pc, - pci_intr_handle_t ih); -int empb_pci_conf_hook(pci_chipset_tag_t pct, int bus, - int dev, int func, pcireg_t id); +int empb_pci_bus_maxdevs(pci_chipset_tag_t, int); +void empb_pci_attach_hook(device_t, device_t, + struct pcibus_attach_args *); +pcitag_t empb_pci_make_tag(pci_chipset_tag_t, int, int, int); +void empb_pci_decompose_tag(pci_chipset_tag_t, pcitag_t, + int *, int *, int *); +int empb_pci_intr_map(const struct pci_attach_args *, + pci_intr_handle_t *); +const struct evcnt * empb_pci_intr_evcnt(pci_chipset_tag_t, + pci_intr_handle_t); +int empb_pci_conf_hook(pci_chipset_tag_t, int, int, int, pcireg_t); CFATTACH_DECL_NEW(empb, sizeof(struct empb_softc), empb_match, empb_attach, NULL, NULL); @@ -420,7 +418,7 @@ empb_pci_bus_maxdevs(pci_chipset_tag_t p } void -empb_pci_attach_hook(struct device *parent, struct device *self, +empb_pci_attach_hook(device_t parent, device_t self, struct pcibus_attach_args *pba) { } Index: sys/arch/amiga/pci/mppb.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/amiga/pci/mppb.c,v retrieving revision 1.6 diff -u -p -r1.6 mppb.c --- sys/arch/amiga/pci/mppb.c 29 Jan 2012 15:32:52 -0000 1.6 +++ sys/arch/amiga/pci/mppb.c 29 Sep 2012 10:46:15 -0000 @@ -70,21 +70,20 @@ struct mppb_softc { struct amiga_pci_chipset apc; }; -static int mppb_match(struct device *, struct cfdata *, void *); -static void mppb_attach(struct device *, struct device *, void *); +static int mppb_match(device_t, cfdata_t, void *); +static void mppb_attach(device_t, device_t, void *); pcireg_t mppb_pci_conf_read(pci_chipset_tag_t, pcitag_t, int); void mppb_pci_conf_write(pci_chipset_tag_t, pcitag_t, int, pcireg_t); -int mppb_pci_bus_maxdevs(pci_chipset_tag_t pc, int busno); -void mppb_pci_attach_hook (struct device *parent, - struct device *self, struct pcibus_attach_args *pba); -pcitag_t mppb_pci_make_tag(pci_chipset_tag_t pc, int bus, int device, - int function); -void mppb_pci_decompose_tag(pci_chipset_tag_t pc, pcitag_t tag, - int *bp, int *dp, int *fp); -int mppb_pci_intr_map(const struct pci_attach_args *pa, - pci_intr_handle_t *ihp); -const struct evcnt * mppb_pci_intr_evcnt(pci_chipset_tag_t pc, - pci_intr_handle_t ih); +int mppb_pci_bus_maxdevs(pci_chipset_tag_t, int); +void mppb_pci_attach_hook (device_t, device_t, + struct pcibus_attach_args *pba); +pcitag_t mppb_pci_make_tag(pci_chipset_tag_t, int, int, int); +void mppb_pci_decompose_tag(pci_chipset_tag_t, pcitag_t, + int *, int *, int *); +int mppb_pci_intr_map(const struct pci_attach_args *, + pci_intr_handle_t *); +const struct evcnt * mppb_pci_intr_evcnt(pci_chipset_tag_t, + pci_intr_handle_t); CFATTACH_DECL_NEW(mppb, sizeof(struct mppb_softc), mppb_match, mppb_attach, NULL, NULL); @@ -235,7 +234,7 @@ mppb_pci_bus_maxdevs(pci_chipset_tag_t p } void -mppb_pci_attach_hook(struct device *parent, struct device *self, +mppb_pci_attach_hook(device_t parent, device_t self, struct pcibus_attach_args *pba) { } @@ -255,4 +254,3 @@ mppb_pci_intr_evcnt(pci_chipset_tag_t pc /* TODO: implement */ return NULL; } - Index: sys/arch/amiga/pci/p5membar.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/amiga/pci/p5membar.c,v retrieving revision 1.2 diff -u -p -r1.2 p5membar.c --- sys/arch/amiga/pci/p5membar.c 19 Jan 2012 00:14:08 -0000 1.2 +++ sys/arch/amiga/pci/p5membar.c 26 Sep 2012 21:34:17 -0000 @@ -58,8 +58,8 @@ #define ZORRO_MANID_P5 8512 #define ZORRO_PRODID_P5PB 101 /* CVPPC/BVPPC/G-REX */ -static int p5membar_match(struct device *, struct cfdata *, void *); -static void p5membar_attach(struct device *, struct device *, void *); +static int p5membar_match(device_t, cfdata_t, void *); +static void p5membar_attach(device_t, device_t, void *); CFATTACH_DECL_NEW(p5membar, sizeof(struct p5membar_softc), p5membar_match, p5membar_attach, NULL, NULL); Index: sys/arch/amiga/pci/p5pb.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/amiga/pci/p5pb.c,v retrieving revision 1.11 diff -u -p -r1.11 p5pb.c --- sys/arch/amiga/pci/p5pb.c 13 Jul 2012 08:47:07 -0000 1.11 +++ sys/arch/amiga/pci/p5pb.c 29 Sep 2012 10:45:13 -0000 @@ -86,38 +86,36 @@ struct m68k_bus_dma_tag p5pb_bus_dma_tag _bus_dmamem_mmap }; -static int p5pb_match(struct device *, struct cfdata *, void *); -static void p5pb_attach(struct device *, struct device *, void *); -void p5pb_set_props(struct p5pb_softc *sc); +static int p5pb_match(device_t, cfdata_t, void *); +static void p5pb_attach(device_t, device_t, void *); +void p5pb_set_props(struct p5pb_softc *); pcireg_t p5pb_pci_conf_read(pci_chipset_tag_t, pcitag_t, int); void p5pb_pci_conf_write(pci_chipset_tag_t, pcitag_t, int, pcireg_t); -int p5pb_pci_bus_maxdevs_cvppc(pci_chipset_tag_t pc, int busno); -int p5pb_pci_bus_maxdevs_grex1200(pci_chipset_tag_t pc, int busno); -int p5pb_pci_bus_maxdevs_grex4000(pci_chipset_tag_t pc, int busno); -int p5pb_pci_conf_hook(pci_chipset_tag_t pct, int bus, int dev, - int func, pcireg_t id); -void p5pb_pci_attach_hook (struct device *parent, - struct device *self, struct pcibus_attach_args *pba); -pcitag_t p5pb_pci_make_tag(pci_chipset_tag_t pc, int bus, int device, - int function); -void p5pb_pci_decompose_tag(pci_chipset_tag_t pc, pcitag_t tag, - int *bp, int *dp, int *fp); -int p5pb_pci_intr_map(const struct pci_attach_args *pa, - pci_intr_handle_t *ihp); -bool p5pb_bus_map_memio(struct p5pb_softc *sc); -bool p5pb_bus_map_conf(struct p5pb_softc *sc); -uint8_t p5pb_find_resources(struct p5pb_softc *sc); -static bool p5pb_identify_bridge(struct p5pb_softc *sc); -void p5pb_membar_grex(struct p5pb_softc *sc); -static bool p5pb_cvppc_probe(struct p5pb_softc *sc); +int p5pb_pci_bus_maxdevs_cvppc(pci_chipset_tag_t, int); +int p5pb_pci_bus_maxdevs_grex1200(pci_chipset_tag_t, int); +int p5pb_pci_bus_maxdevs_grex4000(pci_chipset_tag_t, int); +int p5pb_pci_conf_hook(pci_chipset_tag_t, int, int, int, pcireg_t); +void p5pb_pci_attach_hook (device_t, device_t, + struct pcibus_attach_args *); +pcitag_t p5pb_pci_make_tag(pci_chipset_tag_t, int, int, int); +void p5pb_pci_decompose_tag(pci_chipset_tag_t, pcitag_t, + int *, int *, int *); +int p5pb_pci_intr_map(const struct pci_attach_args *, + pci_intr_handle_t *); +bool p5pb_bus_map_memio(struct p5pb_softc *); +bool p5pb_bus_map_conf(struct p5pb_softc *); +uint8_t p5pb_find_resources(struct p5pb_softc *); +static bool p5pb_identify_bridge(struct p5pb_softc *); +void p5pb_membar_grex(struct p5pb_softc *); +static bool p5pb_cvppc_probe(struct p5pb_softc *); #ifdef PCI_NETBSD_CONFIGURE -bool p5pb_bus_reconfigure(struct p5pb_softc *sc); +bool p5pb_bus_reconfigure(struct p5pb_softc *); #endif /* PCI_NETBSD_CONFIGURE */ #ifdef P5PB_DEBUG -void p5pb_usable_ranges(struct p5pb_softc *sc); -void p5pb_badaddr_range(struct p5pb_softc *sc, bus_space_tag_t bust, - bus_addr_t base, size_t len); -void p5pb_conf_search(struct p5pb_softc *sc, uint16_t val); +void p5pb_usable_ranges(struct p5pb_softc *); +void p5pb_badaddr_range(struct p5pb_softc *, bus_space_tag_t, + bus_addr_t, size_t); +void p5pb_conf_search(struct p5pb_softc *, uint16_t); #endif /* P5PB_DEBUG */ CFATTACH_DECL_NEW(p5pb, sizeof(struct p5pb_softc), @@ -426,7 +424,7 @@ p5pb_pci_bus_maxdevs_grex1200(pci_chipse } void -p5pb_pci_attach_hook(struct device *parent, struct device *self, +p5pb_pci_attach_hook(device_t parent, device_t self, struct pcibus_attach_args *pba) { } @@ -706,4 +704,3 @@ p5pb_device_register(device_t dev, void } } #endif /* P5PB_CONSOLE */ - Index: sys/arch/amigappc/amigappc/autoconf.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/amigappc/amigappc/autoconf.c,v retrieving revision 1.5 diff -u -p -r1.5 autoconf.c --- sys/arch/amigappc/amigappc/autoconf.c 29 Jul 2012 18:05:39 -0000 1.5 +++ sys/arch/amigappc/amigappc/autoconf.c 9 Oct 2012 02:52:56 -0000 @@ -122,33 +122,33 @@ matchname(const char *fp, const char *sp * by checking for NULL. */ int -amiga_config_found(cfdata_t pcfp, device_t pdp, void *auxp, cfprint_t pfn) +amiga_config_found(cfdata_t pcfp, device_t parent, void *aux, cfprint_t pfn) { struct device temp; cfdata_t cf; const struct cfattach *ca; if (amiga_realconfig) - return config_found(pdp, auxp, pfn) != NULL; + return config_found(parent, aux, pfn) != NULL; - if (pdp == NULL) { + if (parent == NULL) { memset(&temp, 0, sizeof temp); - pdp = &temp; + parent = &temp; } - pdp->dv_cfdata = pcfp; - pdp->dv_cfdriver = config_cfdriver_lookup(pcfp->cf_name); - pdp->dv_unit = pcfp->cf_unit; + parent->dv_cfdata = pcfp; + parent->dv_cfdriver = config_cfdriver_lookup(pcfp->cf_name); + parent->dv_unit = pcfp->cf_unit; - if ((cf = config_search_ia(NULL, pdp, NULL, auxp)) != NULL) { + if ((cf = config_search_ia(NULL, parent, NULL, aux)) != NULL) { ca = config_cfattach_lookup(cf->cf_name, cf->cf_atname); if (ca != NULL) { - (*ca->ca_attach)(pdp, NULL, auxp); - pdp->dv_cfdata = NULL; + (*ca->ca_attach)(parent, NULL, aux); + parent->dv_cfdata = NULL; return 1; } } - pdp->dv_cfdata = NULL; + parent->dv_cfdata = NULL; return 0; } @@ -261,8 +261,8 @@ findroot(void) * Find the disk corresponding to the current * device. */ - devs = (device_t*)sd_cd.cd_devs; - if ((dkp = disk_find(devs[unit]->dv_xname)) == NULL) + devs = sd_cd.cd_devs; + if ((dkp = disk_find(device_xname(devs[unit]))) == NULL) continue; if (dkp->dk_driver == NULL || @@ -310,8 +310,8 @@ findroot(void) * Find the disk structure corresponding to the * current device. */ - devs = (device_t*)genericconf[i]->cd_devs; - if ((dkp = disk_find(devs[unit]->dv_xname)) == NULL) + devs = genericconf[i]->cd_devs; + if ((dkp = disk_find(device_xname(devs[unit]))) == NULL) continue; if (dkp->dk_driver == NULL || Index: sys/arch/arc/arc/autoconf.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/arc/arc/autoconf.c,v retrieving revision 1.34 diff -u -p -r1.34 autoconf.c --- sys/arch/arc/arc/autoconf.c 29 Jul 2012 18:05:39 -0000 1.34 +++ sys/arch/arc/arc/autoconf.c 9 Oct 2012 01:20:54 -0000 @@ -164,7 +164,7 @@ cpu_rootconf(void) { printf("boot device: %s\n", - booted_device ? booted_device->dv_xname : ""); + booted_device ? device_xname(booted_device) : ""); booted_partition = booted_device ? bootdev_data->partition : 0; rootconf(); @@ -264,13 +264,13 @@ getpno(const char **cp, int *np) * Attempt to find the device from which we were booted. */ void -device_register(struct device *dev, void *aux) +device_register(device_t dev, void *aux) { struct bootdev_data *b = bootdev_data; - struct device *parent = device_parent(dev); + device_t parent = device_parent(dev); static int found = 0, initted = 0, scsiboot = 0; - static struct device *scsibusdev = NULL; + static device_t scsibusdev = NULL; if (b == NULL) return; /* There is no hope. */ @@ -288,7 +288,7 @@ device_register(struct device *dev, void if (device_unit(dev) == b->bus) { scsibusdev = dev; #if 0 - printf("\nscsibus = %s\n", dev->dv_xname); + printf("\nscsibus = %s\n", device_xname(dev)); #endif } return; @@ -304,7 +304,7 @@ device_register(struct device *dev, void sa->sa_periph->periph_target == b->unit) { booted_device = dev; #if 0 - printf("\nbooted_device = %s\n", dev->dv_xname); + printf("\nbooted_device = %s\n", device_xname(dev)); #endif found = 1; } @@ -314,7 +314,7 @@ device_register(struct device *dev, void if (device_unit(dev) == b->unit) { booted_device = dev; #if 0 - printf("\nbooted_device = %s\n", dev->dv_xname); + printf("\nbooted_device = %s\n", device_xname(dev)); #endif found = 1; } Index: sys/arch/arc/arc/timer.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/arc/arc/timer.c,v retrieving revision 1.10 diff -u -p -r1.10 timer.c --- sys/arch/arc/arc/timer.c 8 Feb 2011 20:20:08 -0000 1.10 +++ sys/arch/arc/arc/timer.c 1 Oct 2012 16:58:27 -0000 @@ -51,7 +51,7 @@ __KERNEL_RCSID(0, "$NetBSD: timer.c,v 1. #include -struct device *timerdev; +device_t timerdev; const struct timerfns *timerfns; int timerinitted; uint32_t last_cp0_count; @@ -73,7 +73,7 @@ static u_int statcountperusec; /* number #endif void -timerattach(struct device *dev, const struct timerfns *fns) +timerattach(device_t dev, const struct timerfns *fns) { /* Index: sys/arch/arc/arc/timervar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/arc/arc/timervar.h,v retrieving revision 1.6 diff -u -p -r1.6 timervar.h --- sys/arch/arc/arc/timervar.h 6 Mar 2011 14:58:42 -0000 1.6 +++ sys/arch/arc/arc/timervar.h 1 Oct 2012 16:58:47 -0000 @@ -35,12 +35,12 @@ * chip-dependent routines. */ struct timerfns { - void (*tf_init)(struct device *); + void (*tf_init)(device_t); }; extern uint32_t last_cp0_count; -void timerattach(struct device *, const struct timerfns *); +void timerattach(device_t, const struct timerfns *); #ifdef ENABLE_INT5_STATCLOCK extern struct evcnt statclock_ev; Index: sys/arch/arc/dti/btl.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/arc/dti/btl.c,v retrieving revision 1.24 diff -u -p -r1.24 btl.c --- sys/arch/arc/dti/btl.c 27 Dec 2009 08:31:10 -0000 1.24 +++ sys/arch/arc/dti/btl.c 9 Oct 2012 01:02:34 -0000 @@ -352,7 +352,7 @@ btattach(device_t parent, device_t self, sc->sc_dev = self; if (bt_find(ia, sc) != 0) - panic("btattach: bt_find of %s failed", self->dv_xname); + panic("btattach: bt_find of %s failed", device_xname(self)); sc->sc_iobase = ia->ia_iobase; /* Index: sys/arch/arc/include/isa_machdep.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/arc/include/isa_machdep.h,v retrieving revision 1.15 diff -u -p -r1.15 isa_machdep.h --- sys/arch/arc/include/isa_machdep.h 6 Mar 2011 14:58:43 -0000 1.15 +++ sys/arch/arc/include/isa_machdep.h 1 Oct 2012 16:59:01 -0000 @@ -51,7 +51,7 @@ struct arc_isa_bus { struct isa_dma_state ic_dmastate; - void (*ic_attach_hook)(struct device *, struct device *, + void (*ic_attach_hook)(device_t, device_t, struct isabus_attach_args *); const struct evcnt *(*ic_intr_evcnt)(isa_chipset_tag_t, int); void *(*ic_intr_establish)(isa_chipset_tag_t, int, int, int, Index: sys/arch/arc/include/pci_machdep.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/arc/include/pci_machdep.h,v retrieving revision 1.9 diff -u -p -r1.9 pci_machdep.h --- sys/arch/arc/include/pci_machdep.h 4 Apr 2011 20:37:45 -0000 1.9 +++ sys/arch/arc/include/pci_machdep.h 1 Oct 2012 16:59:18 -0000 @@ -50,8 +50,8 @@ typedef u_long pci_intr_handle_t; * NOT TO BE USED DIRECTLY BY MACHINE INDEPENDENT CODE. */ struct arc_pci_chipset { - void (*pc_attach_hook)(struct device *, - struct device *, struct pcibus_attach_args *); + void (*pc_attach_hook)(device_t, device_t, + struct pcibus_attach_args *); int (*pc_bus_maxdevs)(pci_chipset_tag_t, int); pcitag_t (*pc_make_tag)(pci_chipset_tag_t, int, int, int); void (*pc_decompose_tag)(pci_chipset_tag_t, pcitag_t, Index: sys/arch/arc/isa/isabus.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/arc/isa/isabus.c,v retrieving revision 1.48 diff -u -p -r1.48 isabus.c --- sys/arch/arc/isa/isabus.c 6 Mar 2011 14:58:43 -0000 1.48 +++ sys/arch/arc/isa/isabus.c 29 Sep 2012 10:41:57 -0000 @@ -308,7 +308,7 @@ intr_calculatemasks(void) } static void -isabr_attach_hook(struct device *parent, struct device *self, +isabr_attach_hook(device_t parent, device_t self, struct isabus_attach_args *iba) { Index: sys/arch/arc/jazz/asc.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/arc/jazz/asc.c,v retrieving revision 1.24 diff -u -p -r1.24 asc.c --- sys/arch/arc/jazz/asc.c 1 Jul 2011 19:25:41 -0000 1.24 +++ sys/arch/arc/jazz/asc.c 9 Oct 2012 01:21:09 -0000 @@ -358,7 +358,7 @@ asc_dma_intr(struct ncr53c9x_softc *sc) * another target. As such, don't print the warning. */ printf("%s: xfer (%d) > req (%d)\n", - sc->sc_dev.dv_xname, trans, asc->sc_dmasize); + device_xname(sc->sc_dev), trans, asc->sc_dmasize); #endif trans = asc->sc_dmasize; } Index: sys/arch/arc/jazz/timer_jazzio.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/arc/jazz/timer_jazzio.c,v retrieving revision 1.10 diff -u -p -r1.10 timer_jazzio.c --- sys/arch/arc/jazz/timer_jazzio.c 5 Jul 2008 08:46:25 -0000 1.10 +++ sys/arch/arc/jazz/timer_jazzio.c 1 Oct 2012 16:59:32 -0000 @@ -150,7 +150,7 @@ timer_jazzio_attach(device_t parent, dev } void -timer_jazzio_init(struct device *sc) +timer_jazzio_init(device_t sc) { (*timer_jazzio_conf->tjc_init)(1000 / hz); Index: sys/arch/arc/pci/necpb.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/arc/pci/necpb.c,v retrieving revision 1.38 diff -u -p -r1.38 necpb.c --- sys/arch/arc/pci/necpb.c 27 Jan 2012 18:52:50 -0000 1.38 +++ sys/arch/arc/pci/necpb.c 29 Sep 2012 10:41:49 -0000 @@ -99,10 +99,10 @@ __KERNEL_RCSID(0, "$NetBSD: necpb.c,v 1. #include "ioconf.h" -static int necpbmatch(struct device *, struct cfdata *, void *); -static void necpbattach(struct device *, struct device *, void *); +static int necpbmatch(device_t, cfdata_t, void *); +static void necpbattach(device_t, device_t, void *); -static void necpb_attach_hook(struct device *, struct device *, +static void necpb_attach_hook(device_t, device_t, struct pcibus_attach_args *); static int necpb_bus_maxdevs(pci_chipset_tag_t, int); static pcitag_t necpb_make_tag(pci_chipset_tag_t, int, int, int); @@ -270,7 +270,7 @@ necpbattach(device_t parent, device_t se } static void -necpb_attach_hook(struct device *parent, struct device *self, +necpb_attach_hook(device_t parent, device_t self, struct pcibus_attach_args *pba) { } Index: sys/arch/arm/arm32/arm32_machdep.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/arm/arm32/arm32_machdep.c,v retrieving revision 1.84 diff -u -p -r1.84 arm32_machdep.c --- sys/arch/arm/arm32/arm32_machdep.c 16 Sep 2012 22:09:33 -0000 1.84 +++ sys/arch/arm/arm32/arm32_machdep.c 9 Oct 2012 02:24:55 -0000 @@ -284,8 +284,8 @@ sysctl_machdep_booted_device(SYSCTLFN_AR return (EOPNOTSUPP); node = *rnode; - node.sysctl_data = booted_device->dv_xname; - node.sysctl_size = strlen(booted_device->dv_xname) + 1; + node.sysctl_data = __UNCONST(device_xname(booted_device)); + node.sysctl_size = strlen(device_xname(booted_device)) + 1; return (sysctl_lookup(SYSCTLFN_CALL(&node))); } Index: sys/arch/arm/at91/at91emac.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/arm/at91/at91emac.c,v retrieving revision 1.11 diff -u -p -r1.11 at91emac.c --- sys/arch/arm/at91/at91emac.c 22 Jul 2012 14:32:49 -0000 1.11 +++ sys/arch/arm/at91/at91emac.c 29 Sep 2012 11:29:46 -0000 @@ -360,8 +360,8 @@ emac_init(struct emac_softc *sc) EMAC_WRITE(ETH_CFG, ETH_CFG_CLK_32 | ETH_CFG_SPD | ETH_CFG_FD | ETH_CFG_BIG); EMAC_WRITE(ETH_CTL, ETH_CTL_MPE); #if 0 - if (device_cfdata(&sc->sc_dev)->cf_flags) - mdcdiv = device_cfdata(&sc->sc_dev)->cf_flags; + if (device_cfdata(sc->sc_dev)->cf_flags) + mdcdiv = device_cfdata(sc->sc_dev)->cf_flags; #endif /* set ethernet address */ EMAC_WRITE(ETH_SA1L, (sc->sc_enaddr[3] << 24) Index: sys/arch/arm/at91/at91pio.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/arm/at91/at91pio.c,v retrieving revision 1.4 diff -u -p -r1.4 at91pio.c --- sys/arch/arm/at91/at91pio.c 1 Jul 2011 19:31:17 -0000 1.4 +++ sys/arch/arm/at91/at91pio.c 9 Oct 2012 01:02:34 -0000 @@ -70,7 +70,6 @@ struct intr_req { #define PIO_WRITE(_sc, _reg, _val) bus_space_write_4((_sc)->sc_iot, (_sc)->sc_ioh, (_reg), (_val)) struct at91pio_softc { - struct device sc_dev; bus_space_tag_t sc_iot; bus_space_handle_t sc_ioh; int sc_pid; @@ -98,7 +97,7 @@ static int at91pio_print(void *, const c static int at91pio_intr(void* arg); -CFATTACH_DECL(at91pio, sizeof(struct at91pio_softc), +CFATTACH_DECL_NEW(at91pio, sizeof(struct at91pio_softc), at91pio_match, at91pio_attach, NULL, NULL); static struct at91pio_softc *at91pio_softc[AT91_PIO_COUNT]; @@ -122,7 +121,7 @@ at91pio_match(device_t parent, cfdata_t static void at91pio_attach(device_t parent, device_t self, void *aux) { - struct at91pio_softc *sc = (struct at91pio_softc*)self; + struct at91pio_softc *sc = device_private(self); struct at91bus_attach_args *sa = aux; #if NGPIO > 0 struct gpiobus_attach_args gba; @@ -135,7 +134,7 @@ at91pio_attach(device_t parent, device_t if (bus_space_map(sa->sa_iot, sa->sa_addr, sa->sa_size, 0, &sc->sc_ioh)){ - printf("%s: Cannot map registers", self->dv_xname); + printf("%s: Cannot map registers", device_xname(self)); return; } @@ -209,10 +208,9 @@ at91piobus_print(void *aux, const char * static int -at91pio_search(device_t parent, cfdata_t cf, - const int *ldesc, void *aux) +at91pio_search(device_t parent, cfdata_t cf, const int *ldesc, void *aux) { - struct at91pio_softc *sc = (struct at91pio_softc*)parent; + struct at91pio_softc *sc = device_private(parent); struct at91pio_attach_args paa; paa.paa_sc = sc; @@ -229,8 +227,7 @@ at91pio_search(device_t parent, cfdata_t static int at91pio_print(void *aux, const char *name) { - struct at91pio_attach_args *paa = (struct at91pio_attach_args*)aux; -// struct at91pio_softc *sc = (struct at91pio_softc*)paa->paa_sc; + struct at91pio_attach_args *paa = aux; aprint_normal(":"); if (paa->paa_pid > -1) Index: sys/arch/arm/at91/at91st.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/arm/at91/at91st.c,v retrieving revision 1.4 diff -u -p -r1.4 at91st.c --- sys/arch/arm/at91/at91st.c 1 Jul 2011 19:31:17 -0000 1.4 +++ sys/arch/arm/at91/at91st.c 9 Oct 2012 01:02:34 -0000 @@ -79,7 +79,6 @@ void rtcinit(void); static int at91st_intr(void* arg); struct at91st_softc { - struct device sc_dev; bus_space_tag_t sc_iot; bus_space_handle_t sc_ioh; int sc_pid; @@ -147,7 +146,7 @@ static uint32_t usec_to_timer_count(uint -CFATTACH_DECL(at91st, sizeof(struct at91st_softc), at91st_match, at91st_attach, NULL, NULL); +CFATTACH_DECL_NEW(at91st, sizeof(struct at91st_softc), at91st_match, at91st_attach, NULL, NULL); @@ -162,8 +161,8 @@ at91st_match(device_t parent, cfdata_t m static void at91st_attach(device_t parent, device_t self, void *aux) { - struct at91st_softc *sc = (struct at91st_softc*) self; - struct at91bus_attach_args *sa = (struct at91bus_attach_args*) aux; + struct at91st_softc *sc = device_private(self); + struct at91bus_attach_args *sa = aux; printf("\n"); @@ -175,7 +174,7 @@ at91st_attach(device_t parent, device_t /* map bus space and get handle */ if (bus_space_map(sc->sc_iot, sa->sa_addr, sa->sa_size, 0, &sc->sc_ioh) != 0) - panic("%s: Cannot map registers", self->dv_xname); + panic("%s: Cannot map registers", device_xname(self)); #endif if (at91st_sc == NULL) Index: sys/arch/arm/at91/at91twi.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/arm/at91/at91twi.c,v retrieving revision 1.5 diff -u -p -r1.5 at91twi.c --- sys/arch/arm/at91/at91twi.c 1 Jul 2011 19:31:17 -0000 1.5 +++ sys/arch/arm/at91/at91twi.c 9 Oct 2012 01:02:34 -0000 @@ -89,7 +89,7 @@ at91twi_attach(device_t parent, device_t sc->sc_pid = sa->sa_pid; if (bus_space_map(sa->sa_iot, sa->sa_addr, sa->sa_size, 0, &sc->sc_ioh)) - panic("%s: Cannot map registers", self->dv_xname); + panic("%s: Cannot map registers", device_xname(self)); printf(": I2C controller\n"); @@ -115,7 +115,7 @@ found_ckdiv: at91twi_writereg(sc, TWI_CR, TWI_CR_MSEN); //#ifdef AT91TWI_DEBUG - printf("%s: ckdiv=%d cxdiv=%d CWGR=0x%08X SR=0x%08X\n", self->dv_xname, ckdiv, cxdiv, at91twi_readreg(sc, TWI_CWGR), at91twi_readreg(sc, TWI_SR)); + printf("%s: ckdiv=%d cxdiv=%d CWGR=0x%08X SR=0x%08X\n", device_xname(self), ckdiv, cxdiv, at91twi_readreg(sc, TWI_CWGR), at91twi_readreg(sc, TWI_SR)); //#endif /* initialize rest */ Index: sys/arch/arm/at91/at91usart.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/arm/at91/at91usart.c,v retrieving revision 1.6 diff -u -p -r1.6 at91usart.c --- sys/arch/arm/at91/at91usart.c 2 Feb 2012 19:42:57 -0000 1.6 +++ sys/arch/arm/at91/at91usart.c 28 Sep 2012 15:11:51 -0000 @@ -161,7 +161,7 @@ inline static void at91usart_rxsoft(stru #define PDC_BLOCK_SIZE 64 -//CFATTACH_DECL(at91usart, sizeof(struct at91usart_softc), +//CFATTACH_DECL_NEW(at91usart, sizeof(struct at91usart_softc), // at91usart_match, at91usart_attach, NULL, NULL); //#define USART_DEBUG 10 Index: sys/arch/arm/ep93xx/ep93xxvar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/arm/ep93xx/ep93xxvar.h,v retrieving revision 1.4 diff -u -p -r1.4 ep93xxvar.h --- sys/arch/arm/ep93xx/ep93xxvar.h 1 Jul 2011 19:31:17 -0000 1.4 +++ sys/arch/arm/ep93xx/ep93xxvar.h 1 Oct 2012 14:19:56 -0000 @@ -34,11 +34,6 @@ #include -struct ep93xx_softc { - struct device sc_dev; - bus_space_tag_t sc_iot; -}; - struct intrhand { TAILQ_ENTRY(intrhand) ih_list; /* link on intrq list */ int (*ih_func)(void *); /* interrupt handler */ @@ -71,7 +66,6 @@ struct pmap_ent { extern struct bus_space ep93xx_bs_tag; extern struct arm32_bus_dma_tag ep93xx_bus_dma; -void ep93xx_attach(struct ep93xx_softc *); void ep93xx_intr_init(void); void *ep93xx_intr_establish(int irq, int ipl, int (*)(void *), void *); void ep93xx_intr_disestablish(void *); Index: sys/arch/arm/ep93xx/epclk.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/arm/ep93xx/epclk.c,v retrieving revision 1.18 diff -u -p -r1.18 epclk.c --- sys/arch/arm/ep93xx/epclk.c 1 Jul 2011 19:31:17 -0000 1.18 +++ sys/arch/arm/ep93xx/epclk.c 9 Oct 2012 01:02:34 -0000 @@ -65,8 +65,8 @@ __KERNEL_RCSID(0, "$NetBSD: epclk.c,v 1. #define TIMER_FREQ 983040 -static int epclk_match(struct device *, struct cfdata *, void *); -static void epclk_attach(struct device *, struct device *, void *); +static int epclk_match(device_t, cfdata_t, void *); +static void epclk_attach(device_t, device_t, void *); static u_int epclk_get_timecount(struct timecounter *); void rtcinit(void); @@ -75,7 +75,6 @@ void rtcinit(void); static int epclk_intr(void* arg); struct epclk_softc { - struct device sc_dev; bus_addr_t sc_baseaddr; bus_space_tag_t sc_iot; bus_space_handle_t sc_ioh; @@ -98,7 +97,7 @@ static struct timecounter epclk_timecoun static struct epclk_softc *epclk_sc = NULL; -CFATTACH_DECL(epclk, sizeof(struct epclk_softc), +CFATTACH_DECL_NEW(epclk, sizeof(struct epclk_softc), epclk_match, epclk_attach, NULL, NULL); /* This is a quick ARM way to multiply by 983040/1000000 (w/o overflow) */ @@ -116,14 +115,14 @@ CFATTACH_DECL(epclk, sizeof(struct epclk EP93XX_APB_TIMERS + EP93XX_TIMERS_Timer4ValueLow)) static int -epclk_match(struct device *parent, struct cfdata *match, void *aux) +epclk_match(device_t parent, cfdata_t match, void *aux) { return 2; } static void -epclk_attach(struct device *parent, struct device *self, void *aux) +epclk_attach(device_t parent, device_t self, void *aux) { struct epclk_softc *sc; struct epsoc_attach_args *sa; @@ -131,7 +130,7 @@ epclk_attach(struct device *parent, stru printf("\n"); - sc = (struct epclk_softc*) self; + sc = device_private(self); sa = aux; sc->sc_iot = sa->sa_iot; sc->sc_baseaddr = sa->sa_addr; @@ -144,11 +143,11 @@ epclk_attach(struct device *parent, stru if (bus_space_map(sa->sa_iot, sa->sa_addr, sa->sa_size, 0, &sc->sc_ioh)) - panic("%s: Cannot map registers", self->dv_xname); + panic("%s: Cannot map registers", device_xname(self)); #if defined(HZ) && (HZ == 64) if (bus_space_map(sa->sa_iot, EP93XX_APB_HWBASE + EP93XX_APB_SYSCON + EP93XX_SYSCON_TEOI, 4, 0, &sc->sc_teoi_ioh)) - panic("%s: Cannot map registers", self->dv_xname); + panic("%s: Cannot map registers", device_xname(self)); #endif /* clear and start the debug timer (Timer4) */ Index: sys/arch/arm/ep93xx/epcom.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/arm/ep93xx/epcom.c,v retrieving revision 1.22 diff -u -p -r1.22 epcom.c --- sys/arch/arm/ep93xx/epcom.c 2 Feb 2012 19:42:57 -0000 1.22 +++ sys/arch/arm/ep93xx/epcom.c 28 Sep 2012 15:45:56 -0000 @@ -182,7 +182,7 @@ struct consdev epcomcons = { #define COMDIALOUT(x) (minor(x) & COMDIALOUT_MASK) #define COM_ISALIVE(sc) ((sc)->enabled != 0 && \ - device_is_active(&(sc)->sc_dev)) + device_is_active((sc)->sc_dev)) void epcom_attach_subr(struct epcom_softc *sc) @@ -212,7 +212,7 @@ epcom_attach_subr(struct epcom_softc *sc sc->sc_rbavail = EPCOM_RING_SIZE; if (sc->sc_rbuf == NULL) { printf("%s: unable to allocate ring buffer\n", - sc->sc_dev.dv_xname); + device_xname(sc->sc_dev)); return; } sc->sc_ebuf = sc->sc_rbuf + (EPCOM_RING_SIZE << 1); @@ -230,15 +230,15 @@ epcom_attach_subr(struct epcom_softc *sc /* locate the major number */ maj = cdevsw_lookup_major(&epcom_cdevsw); - cn_tab->cn_dev = makedev(maj, device_unit(&sc->sc_dev)); + cn_tab->cn_dev = makedev(maj, device_unit(sc->sc_dev)); - aprint_normal("%s: console\n", sc->sc_dev.dv_xname); + aprint_normal("%s: console\n", device_xname(sc->sc_dev)); } sc->sc_si = softint_establish(SOFTINT_SERIAL, epcomsoft, sc); #ifdef RND_COM - rnd_attach_source(&sc->rnd_source, sc->sc_dev.dv_xname, + rnd_attach_source(&sc->rnd_source, device_xname(sc->sc_dev), RND_TYPE_TTY, 0); #endif @@ -441,7 +441,7 @@ epcomopen(dev_t dev, int flag, int mode, sc->sc_rbuf == NULL) return (ENXIO); - if (!device_is_active(&sc->sc_dev)) + if (!device_is_active(sc->sc_dev)) return (ENXIO); #ifdef KGDB @@ -474,7 +474,7 @@ epcomopen(dev_t dev, int flag, int mode, splx(s2); splx(s); printf("%s: device enable failed\n", - sc->sc_dev.dv_xname); + device_xname(sc->sc_dev)); return (EIO); } sc->enabled = 1; @@ -763,7 +763,7 @@ epcom_iflush(struct epcom_softc *sc) bus_space_read_4(iot, ioh, EPCOM_Data); #ifdef DIAGNOSTIC if (!timo) - printf("%s: com_iflush timeout %02x\n", sc->sc_dev.dv_xname, + printf("%s: com_iflush timeout %02x\n", device_xname(sc->sc_dev), reg); #endif } Index: sys/arch/arm/ep93xx/epcomvar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/arm/ep93xx/epcomvar.h,v retrieving revision 1.6 diff -u -p -r1.6 epcomvar.h --- sys/arch/arm/ep93xx/epcomvar.h 2 Feb 2012 19:42:58 -0000 1.6 +++ sys/arch/arm/ep93xx/epcomvar.h 28 Sep 2012 15:44:59 -0000 @@ -43,7 +43,7 @@ #define EPCOM_RING_SIZE 2048 struct epcom_softc { - struct device sc_dev; + device_t sc_dev; bus_addr_t sc_hwbase; bus_space_tag_t sc_iot; bus_space_handle_t sc_ioh; Index: sys/arch/arm/ep93xx/epe.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/arm/ep93xx/epe.c,v retrieving revision 1.27 diff -u -p -r1.27 epe.c --- sys/arch/arm/ep93xx/epe.c 22 Jul 2012 14:32:50 -0000 1.27 +++ sys/arch/arm/ep93xx/epe.c 9 Oct 2012 01:02:34 -0000 @@ -115,7 +115,7 @@ static int epe_ifinit (struct ifnet *); static void epe_ifstop (struct ifnet *, int); static void epe_setaddr (struct ifnet *); -CFATTACH_DECL(epe, sizeof(struct epe_softc), +CFATTACH_DECL_NEW(epe, sizeof(struct epe_softc), epe_match, epe_attach, NULL, NULL); static int @@ -140,7 +140,7 @@ epe_attach(device_t parent, device_t sel if (bus_space_map(sa->sa_iot, sa->sa_addr, sa->sa_size, 0, &sc->sc_ioh)) - panic("%s: Cannot map registers", self->dv_xname); + panic("%s: Cannot map registers", device_xname(self)); /* Fetch the Ethernet address from property if set. */ enaddr = prop_dictionary_get(device_properties(self), "mac-address"); Index: sys/arch/arm/ep93xx/epgpio.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/arm/ep93xx/epgpio.c,v retrieving revision 1.4 diff -u -p -r1.4 epgpio.c --- sys/arch/arm/ep93xx/epgpio.c 1 Jul 2011 19:31:17 -0000 1.4 +++ sys/arch/arm/ep93xx/epgpio.c 9 Oct 2012 01:02:34 -0000 @@ -81,7 +81,6 @@ struct intr_req { }; struct epgpio_softc { - struct device sc_dev; bus_space_tag_t sc_iot; bus_space_handle_t sc_ioh; struct port_info sc_port[EPGPIO_NPORTS]; @@ -89,8 +88,8 @@ struct epgpio_softc { struct intr_req sc_ireq_f[EPGPIO_NPINS]; }; -static int epgpio_match(struct device *, struct cfdata *, void *); -static void epgpio_attach(struct device *, struct device *, void *); +static int epgpio_match(device_t, cfdata_t, void *); +static void epgpio_attach(device_t, device_t, void *); #if NGPIO > 0 static int epgpiobus_print(void *, const char *); @@ -99,7 +98,7 @@ static void epgpio_pin_write(void *, int static void epgpio_pin_ctl(void *, int, int); #endif -static int epgpio_search(struct device *, struct cfdata *, const int *, void *); +static int epgpio_search(device_t, cfdata_t, const int *, void *); static int epgpio_print(void *, const char *); static int epgpio_intr_combine(void* arg); @@ -116,19 +115,19 @@ static int epgpio_intr_7(void* arg); static void epgpio_bit_set(struct epgpio_softc *, bus_size_t, int); static void epgpio_bit_clear(struct epgpio_softc *, bus_size_t, int); -CFATTACH_DECL(epgpio, sizeof(struct epgpio_softc), +CFATTACH_DECL_NEW(epgpio, sizeof(struct epgpio_softc), epgpio_match, epgpio_attach, NULL, NULL); static int -epgpio_match(struct device *parent, struct cfdata *match, void *aux) +epgpio_match(device_t parent, cfdata_t match, void *aux) { return 2; } static void -epgpio_attach(struct device *parent, struct device *self, void *aux) +epgpio_attach(device_t parent, device_t self, void *aux) { - struct epgpio_softc *sc = (struct epgpio_softc*)self; + struct epgpio_softc *sc = device_private(self); struct epsoc_attach_args *sa = aux; struct port_info *pi; #if NGPIO > 0 @@ -142,7 +141,7 @@ epgpio_attach(struct device *parent, str if (bus_space_map(sa->sa_iot, sa->sa_addr, sa->sa_size, 0, &sc->sc_ioh)){ - printf("%s: Cannot map registers", self->dv_xname); + printf("%s: Cannot map registers", device_xname(self)); return; } @@ -315,7 +314,6 @@ epgpio_attach(struct device *parent, str } #endif - /* attach device */ config_search_ia(epgpio_search, self, "epgpio", epgpio_print); } @@ -335,10 +333,9 @@ epgpiobus_print(void *aux, const char *n static int -epgpio_search(struct device *parent, struct cfdata *cf, - const int *ldesc, void *aux) +epgpio_search(device_t parent, cfdata_t cf, const int *ldesc, void *aux) { - struct epgpio_softc *sc = (struct epgpio_softc*)parent; + struct epgpio_softc *sc = device_private(parent); struct epgpio_attach_args ga; ga.ga_gc = sc; @@ -356,8 +353,8 @@ epgpio_search(struct device *parent, str static int epgpio_print(void *aux, const char *name) { - struct epgpio_attach_args *ga = (struct epgpio_attach_args*)aux; - struct epgpio_softc *sc = (struct epgpio_softc*)ga->ga_gc; + struct epgpio_attach_args *ga = aux; + struct epgpio_softc *sc = ga->ga_gc; aprint_normal(":"); if (ga->ga_port > -1) Index: sys/arch/arm/ep93xx/epled.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/arm/ep93xx/epled.c,v retrieving revision 1.3 diff -u -p -r1.3 epled.c --- sys/arch/arm/ep93xx/epled.c 1 Jul 2011 19:31:17 -0000 1.3 +++ sys/arch/arm/ep93xx/epled.c 28 Sep 2012 15:14:51 -0000 @@ -37,31 +37,30 @@ __KERNEL_RCSID(0, "$NetBSD: epled.c,v 1. #include struct epled_softc { - struct device sc_dev; int sc_port; int sc_green; int sc_red; struct epgpio_softc *sc_gpio; }; -static int epled_match(struct device *, struct cfdata *, void *); -static void epled_attach(struct device *, struct device *, void *); +static int epled_match(device_t, cfdata_t, void *); +static void epled_attach(device_t, device_t, void *); -CFATTACH_DECL(epled, sizeof(struct epled_softc), +CFATTACH_DECL_NEW(epled, sizeof(struct epled_softc), epled_match, epled_attach, NULL, NULL); static struct epled_softc *the_epled_sc = 0; int -epled_match(struct device *parent, struct cfdata *cf, void *aux) +epled_match(device_t parent, cfdata_t cf, void *aux) { return 1; } void -epled_attach(struct device *parent, struct device *self, void *aux) +epled_attach(device_t parent, device_t self, void *aux) { - struct epled_softc *sc = (struct epled_softc *)self; + struct epled_softc *sc = device_private(self); struct epgpio_attach_args *ga = aux; sc->sc_port = ga->ga_port; @@ -74,7 +73,7 @@ epled_attach(struct device *parent, stru the_epled_sc = sc; #ifdef DIAGNOSTIC else - printf("%s is already configured\n", sc->sc_dev.dv_xname); + printf("%s is already configured\n", device_xname(self)); #endif epgpio_out(sc->sc_gpio, sc->sc_port, sc->sc_green); Index: sys/arch/arm/ep93xx/epohci.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/arm/ep93xx/epohci.c,v retrieving revision 1.5 diff -u -p -r1.5 epohci.c --- sys/arch/arm/ep93xx/epohci.c 1 Jul 2011 19:31:17 -0000 1.5 +++ sys/arch/arm/ep93xx/epohci.c 1 Oct 2012 17:00:22 -0000 @@ -61,9 +61,9 @@ __KERNEL_RCSID(0, "$NetBSD: epohci.c,v 1 #include #include -int epohci_match(struct device *, struct cfdata *, void *); -void epohci_attach(struct device *, struct device *, void *); -void epohci_callback(struct device *); +int epohci_match(device_t, cfdata_t, void *); +void epohci_attach(device_t, device_t, void *); +void epohci_callback(device_t); struct epohci_softc { struct ohci_softc sc; @@ -75,7 +75,7 @@ CFATTACH_DECL_NEW(epohci, sizeof(struct epohci_match, epohci_attach, NULL, NULL); int -epohci_match(struct device *parent, struct cfdata *match, void *aux) +epohci_match(device_t parent, cfdata_t match, void *aux) { /* EP93xx builtin OHCI module */ @@ -83,7 +83,7 @@ epohci_match(struct device *parent, stru } void -epohci_attach(struct device *parent, struct device *self, void *aux) +epohci_attach(device_t parent, device_t self, void *aux) { struct epohci_softc *sc = device_private(self); struct epsoc_attach_args *sa = aux; @@ -132,7 +132,7 @@ epohci_attach(struct device *parent, str } void -epohci_callback(struct device *self) +epohci_callback(device_t self) { struct epohci_softc *sc = device_private(self); usbd_status r; Index: sys/arch/arm/ep93xx/eppcic.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/arm/ep93xx/eppcic.c,v retrieving revision 1.6 diff -u -p -r1.6 eppcic.c --- sys/arch/arm/ep93xx/eppcic.c 26 Jul 2011 22:52:47 -0000 1.6 +++ sys/arch/arm/ep93xx/eppcic.c 9 Oct 2012 01:02:34 -0000 @@ -79,7 +79,7 @@ int eppcic_debug = EPPCIC_DEBUG; struct eppcic_handle { int ph_socket; /* socket number */ struct eppcic_softc *ph_sc; - struct device *ph_card; + device_t ph_card; int (*ph_ih_func)(void *); void *ph_ih_arg; lwp_t *ph_event_thread; @@ -144,19 +144,20 @@ static struct pcmcia_chip_functions eppc }; void -eppcic_attach_common(struct device *parent, struct device *self, void *aux, +eppcic_attach_common(device_t parent, device_t self, void *aux, eppcic_chipset_tag_t pcic) { - struct eppcic_softc *sc = (struct eppcic_softc *)self; + struct eppcic_softc *sc = device_private(self); struct epsoc_attach_args *sa = aux; struct eppcic_handle *ph; int reg; int i; if (!sa->sa_gpio) { - printf("%s: epgpio requires\n", self->dv_xname); + printf("%s: epgpio requires\n", device_xname(self)); return; } + sc->sc_dev = self; sc->sc_gpio = sa->sa_gpio; sc->sc_iot = sa->sa_iot; sc->sc_hclk = sa->sa_hclk; @@ -164,7 +165,7 @@ eppcic_attach_common(struct device *pare sc->sc_enable = 0; if (bus_space_map(sa->sa_iot, sa->sa_addr, sa->sa_size, 0, &sc->sc_ioh)){ - printf("%s: Cannot map registers\n", self->dv_xname); + printf("%s: Cannot map registers\n", device_xname(self)); return; } printf("\n"); @@ -175,7 +176,7 @@ eppcic_attach_common(struct device *pare #endif /* socket 0 */ if (!(ph = malloc(sizeof(struct eppcic_handle), M_DEVBUF, M_NOWAIT))) { - printf("%s: Cannot allocate memory\n", self->dv_xname); + printf("%s: Cannot allocate memory\n", device_xname(self)); return; /* ENOMEM */ } sc->sc_ph[0] = ph; @@ -264,7 +265,7 @@ eppcic_config_socket(struct eppcic_handl ph->ph_run = 1; kthread_create(PRI_NONE, 0, NULL, eppcic_event_thread, ph, - &ph->ph_event_thread, "%s,%d", sc->sc_dev.dv_xname, + &ph->ph_event_thread, "%s,%d", device_xname(sc->sc_dev), ph->ph_socket); } @@ -580,13 +581,13 @@ eppcic_get_voltage(struct eppcic_handle vcc = 5; else printf("%s: unsupported Vcc 5 Volts", - sc->sc_dev.dv_xname); + device_xname(sc->sc_dev)); } else { if (cap | VCC_3V) vcc = 3; else printf("%s: unsupported Vcc 3.3 Volts", - sc->sc_dev.dv_xname); + device_xname(sc->sc_dev)); } DPRINTFN(1, ("eppcic_get_voltage: vs1=%d, vs2=%d (%dV)\n",epgpio_read_bit(sc->sc_gpio, ph->ph_port, ph->ph_vs[0]),epgpio_read_bit(sc->sc_gpio, ph->ph_port, ph->ph_vs[1]),vcc)); return vcc; Index: sys/arch/arm/ep93xx/eppcicvar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/arm/ep93xx/eppcicvar.h,v retrieving revision 1.1 diff -u -p -r1.1 eppcicvar.h --- sys/arch/arm/ep93xx/eppcicvar.h 12 Nov 2005 05:33:23 -0000 1.1 +++ sys/arch/arm/ep93xx/eppcicvar.h 28 Sep 2012 15:50:52 -0000 @@ -51,7 +51,7 @@ typedef struct eppcic_chipset_tag *eppci struct eppcic_handle; struct eppcic_softc { - struct device sc_dev; + device_t sc_dev; bus_space_tag_t sc_iot; bus_space_handle_t sc_ioh; struct eppcic_handle *sc_ph[EP93XX_PCMCIA_NSOCKET]; @@ -61,7 +61,7 @@ struct eppcic_softc { struct epgpio_softc *sc_gpio; }; -void eppcic_attach_common(struct device *, struct device *, void *, +void eppcic_attach_common(device_t, device_t, void *, eppcic_chipset_tag_t); #endif /* _EPPCICVAR_H_ */ Index: sys/arch/arm/ep93xx/eprtc.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/arm/ep93xx/eprtc.c,v retrieving revision 1.5 diff -u -p -r1.5 eprtc.c --- sys/arch/arm/ep93xx/eprtc.c 1 Jul 2011 19:31:17 -0000 1.5 +++ sys/arch/arm/ep93xx/eprtc.c 28 Sep 2012 15:15:28 -0000 @@ -39,39 +39,38 @@ __KERNEL_RCSID(0, "$NetBSD: eprtc.c,v 1. #include struct eprtc_softc { - struct device sc_dev; bus_space_tag_t sc_iot; bus_space_handle_t sc_ioh; struct todr_chip_handle sc_todr; }; -static int eprtc_match(struct device *, struct cfdata *, void *); -static void eprtc_attach(struct device *, struct device *, void *); +static int eprtc_match(device_t, cfdata_t, void *); +static void eprtc_attach(device_t, device_t, void *); -CFATTACH_DECL(eprtc, sizeof(struct eprtc_softc), +CFATTACH_DECL_NEW(eprtc, sizeof(struct eprtc_softc), eprtc_match, eprtc_attach, NULL, NULL); static int eprtc_gettime(struct todr_chip_handle *, struct timeval *); static int eprtc_settime(struct todr_chip_handle *, struct timeval *); static int -eprtc_match(struct device *parent, struct cfdata *match, void *aux) +eprtc_match(device_t parent, cfdata_t match, void *aux) { return 1; } static void -eprtc_attach(struct device *parent, struct device *self, void *aux) +eprtc_attach(device_t parent, device_t self, void *aux) { - struct eprtc_softc *sc = (struct eprtc_softc*)self; + struct eprtc_softc *sc = device_private(self); struct epsoc_attach_args *sa = aux; printf("\n"); sc->sc_iot = sa->sa_iot; if (bus_space_map(sa->sa_iot, sa->sa_addr, - sa->sa_size, 0, &sc->sc_ioh)){ - printf("%s: Cannot map registers", self->dv_xname); + sa->sa_size, 0, &sc->sc_ioh)) { + printf("%s: Cannot map registers", device_xname(self)); return; } Index: sys/arch/arm/ep93xx/epsoc.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/arm/ep93xx/epsoc.c,v retrieving revision 1.11 diff -u -p -r1.11 epsoc.c --- sys/arch/arm/ep93xx/epsoc.c 1 Jul 2011 19:31:17 -0000 1.11 +++ sys/arch/arm/ep93xx/epsoc.c 29 Sep 2012 10:41:34 -0000 @@ -47,21 +47,19 @@ __KERNEL_RCSID(0, "$NetBSD: epsoc.c,v 1. #include "locators.h" -static int epsoc_match(struct device *, struct cfdata *, void *); -static void epsoc_attach(struct device *, struct device *, void *); -static int epsoc_search(struct device *, struct cfdata *, - const int *, void *); +static int epsoc_match(device_t, cfdata_t, void *); +static void epsoc_attach(device_t, device_t, void *); +static int epsoc_search(device_t, cfdata_t, const int *, void *); static int epsoc_print(void *, const char *); -static int epsoc_submatch(struct device *, struct cfdata *, - const int *, void *); +static int epsoc_submatch(device_t, cfdata_t, const int *, void *); -CFATTACH_DECL(epsoc, sizeof(struct epsoc_softc), +CFATTACH_DECL_NEW(epsoc, sizeof(struct epsoc_softc), epsoc_match, epsoc_attach, NULL, NULL); struct epsoc_softc *epsoc_sc = NULL; static int -epsoc_match(struct device *parent, struct cfdata *match, void *aux) +epsoc_match(device_t parent, cfdata_t match, void *aux) { bus_space_handle_t ioh; u_int32_t id, ret = 0; @@ -75,7 +73,7 @@ epsoc_match(struct device *parent, struc } static void -epsoc_attach(struct device *parent, struct device *self, void *aux) +epsoc_attach(device_t parent, device_t self, void *aux) { struct epsoc_softc *sc; u_int64_t fclk, pclk, hclk; @@ -84,7 +82,7 @@ epsoc_attach(struct device *parent, stru int locs[EPSOCCF_NLOCS]; struct epsoc_attach_args sa; - sc = (struct epsoc_softc*) self; + sc = device_private(self); if (epsoc_sc == NULL) epsoc_sc = sc; @@ -146,7 +144,7 @@ epsoc_attach(struct device *parent, stru fclk = 14745600ULL; } printf("%s: fclk %lld.%02lld MHz hclk %lld.%02lld MHz pclk %lld.%02lld MHz\n", - sc->sc_dev.dv_xname, + device_xname(self), fclk / 1000000, (fclk % 1000000 + 5000) / 10000, hclk / 1000000, (hclk % 1000000 + 5000) / 10000, pclk / 1000000, (pclk % 1000000 + 5000) / 10000); @@ -170,15 +168,15 @@ epsoc_attach(struct device *parent, stru config_found_sm_loc(self, "epsoc", locs, &sa, epsoc_print, epsoc_submatch); locs[EPSOCCF_ADDR] = EP93XX_APB_HWBASE + EP93XX_APB_GPIO; - sa.sa_gpio = (struct epgpio_softc *) + sa.sa_gpio = device_private( config_found_sm_loc(self, "epsoc", locs, &sa, - epsoc_print, epsoc_submatch); + epsoc_print, epsoc_submatch)); config_search_ia(epsoc_search, self, "epsoc", &sa); } int -epsoc_submatch(struct device *parent, struct cfdata *cf, const int *ldesc, void *aux) +epsoc_submatch(device_t parent, cfdata_t cf, const int *ldesc, void *aux) { struct epsoc_attach_args *sa = aux; @@ -192,7 +190,7 @@ epsoc_submatch(struct device *parent, st } int -epsoc_search(struct device *parent, struct cfdata *cf, const int *ldesc, void *aux) +epsoc_search(device_t parent, cfdata_t cf, const int *ldesc, void *aux) { struct epsoc_attach_args *sa = aux; @@ -209,7 +207,7 @@ epsoc_search(struct device *parent, stru static int epsoc_print(void *aux, const char *name) { - struct epsoc_attach_args *sa = (struct epsoc_attach_args*)aux; + struct epsoc_attach_args *sa = aux; if (sa->sa_size) aprint_normal(" addr 0x%lx", sa->sa_addr); Index: sys/arch/arm/ep93xx/epsocvar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/arm/ep93xx/epsocvar.h,v retrieving revision 1.4 diff -u -p -r1.4 epsocvar.h --- sys/arch/arm/ep93xx/epsocvar.h 1 Jul 2011 19:31:17 -0000 1.4 +++ sys/arch/arm/ep93xx/epsocvar.h 1 Oct 2012 14:23:08 -0000 @@ -48,7 +48,6 @@ struct epsoc_attach_args { }; struct epsoc_softc { - struct device sc_dev; u_int32_t sc_fclk; u_int32_t sc_hclk; u_int32_t sc_pclk; Index: sys/arch/arm/ep93xx/epwdog.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/arm/ep93xx/epwdog.c,v retrieving revision 1.4 diff -u -p -r1.4 epwdog.c --- sys/arch/arm/ep93xx/epwdog.c 1 Jul 2011 19:31:17 -0000 1.4 +++ sys/arch/arm/ep93xx/epwdog.c 28 Sep 2012 15:18:21 -0000 @@ -39,37 +39,36 @@ __KERNEL_RCSID(0, "$NetBSD: epwdog.c,v 1 #include struct epwdog_softc { - struct device sc_dev; bus_space_tag_t sc_iot; bus_space_handle_t sc_ioh; }; -static int epwdog_match(struct device *, struct cfdata *, void *); -static void epwdog_attach(struct device *, struct device *, void *); +static int epwdog_match(device_t, cfdata_t, void *); +static void epwdog_attach(device_t, device_t, void *); -CFATTACH_DECL(epwdog, sizeof(struct epwdog_softc), +CFATTACH_DECL_NEW(epwdog, sizeof(struct epwdog_softc), epwdog_match, epwdog_attach, NULL, NULL); static struct epwdog_softc *the_epwdog_sc = 0; static int -epwdog_match(struct device *parent, struct cfdata *match, void *aux) +epwdog_match(device_t parent, cfdata_t match, void *aux) { return 1; } static void -epwdog_attach(struct device *parent, struct device *self, void *aux) +epwdog_attach(device_t parent, device_t self, void *aux) { - struct epwdog_softc *sc = (struct epwdog_softc*)self; + struct epwdog_softc *sc = device_private(self); struct epsoc_attach_args *sa = aux; printf("\n"); sc->sc_iot = sa->sa_iot; if (bus_space_map(sa->sa_iot, sa->sa_addr, - sa->sa_size, 0, &sc->sc_ioh)){ - printf("%s: Cannot map registers", self->dv_xname); + sa->sa_size, 0, &sc->sc_ioh)) { + printf("%s: Cannot map registers", device_xname(self)); return; } @@ -77,7 +76,7 @@ epwdog_attach(struct device *parent, str the_epwdog_sc = sc; #ifdef DIAGNOSTIC else - printf("%s is already configured\n", sc->sc_dev.dv_xname); + printf("%s is already configured\n", device_xname(self)); #endif } Index: sys/arch/arm/footbridge/footbridge.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/arm/footbridge/footbridge.c,v retrieving revision 1.25 diff -u -p -r1.25 footbridge.c --- sys/arch/arm/footbridge/footbridge.c 1 Jul 2011 19:32:28 -0000 1.25 +++ sys/arch/arm/footbridge/footbridge.c 29 Sep 2012 10:16:39 -0000 @@ -123,7 +123,7 @@ footbridge_print(void *aux, const char * } /* - * int footbridge_match(struct device *parent, struct cfdata *cf, void *aux) + * int footbridge_match(device_t parent, cfdata_t cf, void *aux) * * Just return ok for this if it is device 0 */ Index: sys/arch/arm/footbridge/footbridge_com.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/arm/footbridge/footbridge_com.c,v retrieving revision 1.34 diff -u -p -r1.34 footbridge_com.c --- sys/arch/arm/footbridge/footbridge_com.c 1 Jul 2011 19:32:28 -0000 1.34 +++ sys/arch/arm/footbridge/footbridge_com.c 29 Sep 2012 10:16:39 -0000 @@ -154,7 +154,7 @@ extern int comcnspeed; extern struct bus_space fcomcons_bs_tag; /* - * int fcom_probe(struct device *parent, struct cfdata *cf, void *aux) + * int fcom_probe(device_t parent, cfdata_t cf, void *aux) * * Make sure we are trying to attach a com device and then * probe for one. Index: sys/arch/arm/footbridge/footbridge_pci.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/arm/footbridge/footbridge_pci.c,v retrieving revision 1.23 diff -u -p -r1.23 footbridge_pci.c --- sys/arch/arm/footbridge/footbridge_pci.c 18 Sep 2012 05:47:27 -0000 1.23 +++ sys/arch/arm/footbridge/footbridge_pci.c 29 Sep 2012 10:40:47 -0000 @@ -58,8 +58,8 @@ __KERNEL_RCSID(0, "$NetBSD: footbridge_p #include #endif -void footbridge_pci_attach_hook(struct device *, - struct device *, struct pcibus_attach_args *); +void footbridge_pci_attach_hook(device_t, device_t, + struct pcibus_attach_args *); int footbridge_pci_bus_maxdevs(void *, int); pcitag_t footbridge_pci_make_tag(void *, int, int, int); void footbridge_pci_decompose_tag(void *, pcitag_t, int *, @@ -125,7 +125,7 @@ pci_intr(void *arg) void -footbridge_pci_attach_hook(struct device *parent, struct device *self, struct pcibus_attach_args *pba) +footbridge_pci_attach_hook(device_t parent, device_t self, struct pcibus_attach_args *pba) { #ifdef PCI_DEBUG printf("footbridge_pci_attach_hook()\n"); Index: sys/arch/arm/footbridge/todclock.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/arm/footbridge/todclock.c,v retrieving revision 1.14 diff -u -p -r1.14 todclock.c --- sys/arch/arm/footbridge/todclock.c 21 Jul 2009 07:35:55 -0000 1.14 +++ sys/arch/arm/footbridge/todclock.c 1 Oct 2012 14:25:22 -0000 @@ -73,7 +73,6 @@ static int tod_set_ymdhms(todr_chip_hand */ struct todclock_softc { - struct device sc_dev; /* device node */ void *sc_rtc_arg; /* arg to read/write */ int (*sc_rtc_write)(void *, rtc_t *); /* rtc write function */ int (*sc_rtc_read)(void *, rtc_t *); /* rtc read function */ @@ -132,12 +131,11 @@ todclockattach(device_t parent, device_t { static struct todr_chip_handle tch; - struct todclock_softc *sc = (void *)self; + struct todclock_softc *sc = device_private(self); struct todclock_attach_args *ta = aux; /* set up our softc */ todclock_sc = sc; - todclock_sc->sc_dev = self; todclock_sc->sc_rtc_arg = ta->ta_rtc_arg; todclock_sc->sc_rtc_write = ta->ta_rtc_write; todclock_sc->sc_rtc_read = ta->ta_rtc_read; Index: sys/arch/arm/footbridge/isa/dsrtc.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/arm/footbridge/isa/dsrtc.c,v retrieving revision 1.11 diff -u -p -r1.11 dsrtc.c --- sys/arch/arm/footbridge/isa/dsrtc.c 21 Jul 2009 07:35:55 -0000 1.11 +++ sys/arch/arm/footbridge/isa/dsrtc.c 1 Oct 2012 14:22:42 -0000 @@ -53,14 +53,13 @@ __KERNEL_RCSID(0, "$NetBSD: dsrtc.c,v 1. #define NRTC_PORTS 2 struct dsrtc_softc { - struct device sc_dev; bus_space_tag_t sc_iot; bus_space_handle_t sc_ioh; struct todr_chip_handle sc_todr; }; -void dsrtcattach(struct device *parent, struct device *self, void *aux); -int dsrtcmatch(struct device *parent, struct cfdata *cf, void *aux); +void dsrtcattach(device_t parent, device_t self, void *aux); +int dsrtcmatch(device_t parent, cfdata_t cf, void *aux); int ds1687_read(struct dsrtc_softc *sc, int addr); void ds1687_write(struct dsrtc_softc *sc, int addr, int data); #if 0 Index: sys/arch/arm/footbridge/isa/isa_machdep.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/arm/footbridge/isa/isa_machdep.c,v retrieving revision 1.18 diff -u -p -r1.18 isa_machdep.c --- sys/arch/arm/footbridge/isa/isa_machdep.c 1 Jul 2011 19:32:28 -0000 1.18 +++ sys/arch/arm/footbridge/isa/isa_machdep.c 29 Sep 2012 10:40:56 -0000 @@ -481,7 +481,7 @@ isa_footbridge_init(u_int iobase, u_int } void -isa_attach_hook(struct device *parent, struct device *self, struct isabus_attach_args *iba) +isa_attach_hook(device_t parent, device_t self, struct isabus_attach_args *iba) { /* * Since we can only have one ISA bus, we just use a single Index: sys/arch/arm/fpe-arm/armfpe_init.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/arm/fpe-arm/armfpe_init.c,v retrieving revision 1.17 diff -u -p -r1.17 armfpe_init.c --- sys/arch/arm/fpe-arm/armfpe_init.c 1 Sep 2012 00:01:43 -0000 1.17 +++ sys/arch/arm/fpe-arm/armfpe_init.c 9 Oct 2012 01:21:45 -0000 @@ -92,10 +92,10 @@ initialise_arm_fpe(void) int error; printf("%s: FPE: %s\n", - curcpu()->ci_dev->dv_xname, fpe_arm_header.core_identity_addr); + device_xname(curcpu()->ci_dev), fpe_arm_header.core_identity_addr); error = arm_fpe_boot(); if (error != 0) { - printf("%s: FPE boot failed\n", curcpu()->ci_dev->dv_xname); + printf("%s: FPE boot failed\n", device_xname(curcpu()->ci_dev)); return(1); } return(0); @@ -137,10 +137,10 @@ arm_fpe_boot(void) (u_int)&fpe_nexthandler); if (id == 0x81) - printf("%s: FPA11 found\n", curcpu()->ci_dev->dv_xname); + printf("%s: FPA11 found\n", device_xname(curcpu()->ci_dev)); else printf("%s: no FP hardware found\n", - curcpu()->ci_dev->dv_xname); + device_xname(curcpu()->ci_dev)); #ifdef DEBUG printf("fpe id=%08x\n", id); Index: sys/arch/arm/gemini/gemini_ipi.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/arm/gemini/gemini_ipi.c,v retrieving revision 1.5 diff -u -p -r1.5 gemini_ipi.c --- sys/arch/arm/gemini/gemini_ipi.c 25 Nov 2009 14:28:50 -0000 1.5 +++ sys/arch/arm/gemini/gemini_ipi.c 29 Sep 2012 11:43:07 -0000 @@ -18,8 +18,8 @@ __KERNEL_RCSID(0, "$NetBSD: gemini_ipi.c #include #include -static int gemini_ipi_match(struct device *, struct cfdata *, void *); -static void gemini_ipi_attach(struct device *, struct device *, void *); +static int gemini_ipi_match(device_t, cfdata_t, void *); +static void gemini_ipi_attach(device_t, device_t, void *); static int gemini_ipiintr(void *); CFATTACH_DECL_NEW(geminiipi, sizeof(struct gemini_ipi_softc), @@ -29,7 +29,7 @@ static gemini_ipi_softc_t *gemini_ipi_sc static int -gemini_ipi_match(struct device *parent, struct cfdata *cf, void *aux) +gemini_ipi_match(device_t parent, cfdata_t cf, void *aux) { struct obio_attach_args *obio = aux; @@ -40,7 +40,7 @@ gemini_ipi_match(struct device *parent, } static void -gemini_ipi_attach(struct device *parent, struct device *self, void *aux) +gemini_ipi_attach(device_t parent, device_t self, void *aux) { gemini_ipi_softc_t *sc = device_private(self); struct obio_attach_args *obio = aux; @@ -157,7 +157,7 @@ ipi_intr_establish(int (*func)(void *), #ifdef DEBUG if (ih == NULL) panic("%s: gemini_ipi_intrq_insert failed", - device_xname(&sc->sc_dev)); + device_xname(sc->sc_dev)); #endif return ih; @@ -169,7 +169,7 @@ ipi_intr_disestablish(void *ih) gemini_ipi_softc_t *sc = gemini_ipi_sc; if (sc == NULL) - panic("%s: NULL gemini_ipi_sc", device_xname(&sc->sc_dev)); + panic("%s: NULL gemini_ipi_sc", device_xname(sc->sc_dev)); gemini_ipi_intrq_remove(sc, ih); } Index: sys/arch/arm/gemini/gemini_ipivar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/arm/gemini/gemini_ipivar.h,v retrieving revision 1.1 diff -u -p -r1.1 gemini_ipivar.h --- sys/arch/arm/gemini/gemini_ipivar.h 20 Nov 2008 08:02:48 -0000 1.1 +++ sys/arch/arm/gemini/gemini_ipivar.h 1 Oct 2012 14:29:28 -0000 @@ -14,7 +14,7 @@ typedef struct gemini_ipi_intrq { } gemini_ipi_intrq_t; typedef struct gemini_ipi_softc { - struct device sc_dev; + device_t sc_dev; bus_space_tag_t sc_iot; bus_space_handle_t sc_ioh; bus_addr_t sc_addr; Index: sys/arch/arm/gemini/gemini_ipm.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/arm/gemini/gemini_ipm.c,v retrieving revision 1.1 diff -u -p -r1.1 gemini_ipm.c --- sys/arch/arm/gemini/gemini_ipm.c 6 Dec 2008 05:22:39 -0000 1.1 +++ sys/arch/arm/gemini/gemini_ipm.c 26 Sep 2012 21:34:17 -0000 @@ -52,8 +52,8 @@ typedef struct gemini_ipm_softc { } gemini_ipm_softc_t; -static int gemini_ipm_match(struct device *, struct cfdata *, void *); -static void gemini_ipm_attach(struct device *, struct device *, void *); +static int gemini_ipm_match(device_t, cfdata_t, void *); +static void gemini_ipm_attach(device_t, device_t, void *); static int gemini_ipm_intr(void *); static void gemini_ipm_count_txdone(gemini_ipm_softc_t *); @@ -100,7 +100,7 @@ gemini_ipm_desc_write(ipm_desc_t *desc_d static int -gemini_ipm_match(struct device *parent, struct cfdata *cf, void *aux) +gemini_ipm_match(device_t parent, cfdata_t cf, void *aux) { char *name = aux; @@ -111,7 +111,7 @@ gemini_ipm_match(struct device *parent, } static void -gemini_ipm_attach(struct device *parent, struct device *self, void *aux) +gemini_ipm_attach(device_t parent, device_t self, void *aux) { gemini_ipm_softc_t *sc = device_private(self); void *ih; Index: sys/arch/arm/gemini/gemini_lpc.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/arm/gemini/gemini_lpc.c,v retrieving revision 1.3 diff -u -p -r1.3 gemini_lpc.c --- sys/arch/arm/gemini/gemini_lpc.c 15 Nov 2008 05:48:34 -0000 1.3 +++ sys/arch/arm/gemini/gemini_lpc.c 26 Sep 2012 21:34:17 -0000 @@ -27,8 +27,8 @@ __KERNEL_RCSID(0, "$NetBSD: gemini_lpc.c #define IT8712_ADDR 0x2e #define IT8712_DATA 0x2f -static int gemini_lpc_match(struct device *, struct cfdata *, void *); -static void gemini_lpc_attach(struct device *, struct device *, void *); +static int gemini_lpc_match(device_t, cfdata_t, void *); +static void gemini_lpc_attach(device_t, device_t, void *); static int gemini_lpc_search(device_t, cfdata_t, const int *, void *); static int gemini_lpc_busprint(void *, const char *); @@ -53,7 +53,7 @@ gemini_lpc_bus_ops_t gemini_lpc_bus_ops static int -gemini_lpc_match(struct device *parent, struct cfdata *cf, void *aux) +gemini_lpc_match(device_t parent, cfdata_t cf, void *aux) { struct gemini_lpc_attach_args *lpc = aux; @@ -64,7 +64,7 @@ gemini_lpc_match(struct device *parent, } static void -gemini_lpc_attach(struct device *parent, struct device *self, void *aux) +gemini_lpc_attach(device_t parent, device_t self, void *aux) { gemini_lpc_softc_t *sc = device_private(self); struct gemini_lpchc_attach_args *lpchc = aux; Index: sys/arch/arm/gemini/gemini_lpcvar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/arm/gemini/gemini_lpcvar.h,v retrieving revision 1.3 diff -u -p -r1.3 gemini_lpcvar.h --- sys/arch/arm/gemini/gemini_lpcvar.h 1 Jul 2011 19:32:28 -0000 1.3 +++ sys/arch/arm/gemini/gemini_lpcvar.h 1 Oct 2012 14:30:23 -0000 @@ -36,7 +36,6 @@ typedef struct gemini_lpc_bus_ops { } gemini_lpc_bus_ops_t; typedef struct gemini_lpc_softc { - struct device sc_dev; bus_addr_t sc_addr; bus_size_t sc_size; int sc_intr; Index: sys/arch/arm/gemini/gemini_pci.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/arm/gemini/gemini_pci.c,v retrieving revision 1.13 diff -u -p -r1.13 gemini_pci.c --- sys/arch/arm/gemini/gemini_pci.c 7 Sep 2012 03:05:11 -0000 1.13 +++ sys/arch/arm/gemini/gemini_pci.c 29 Sep 2012 10:40:17 -0000 @@ -75,7 +75,7 @@ __KERNEL_RCSID(0, "$NetBSD: gemini_pci.c #include "opt_pci.h" #include "pci.h" -void gemini_pci_attach_hook(struct device *, struct device *, +void gemini_pci_attach_hook(device_t, device_t, struct pcibus_attach_args *); int gemini_pci_bus_maxdevs(void *, int); pcitag_t gemini_pci_make_tag(void *, int, int, int); @@ -249,7 +249,7 @@ gemini_pci_conf_hook(void *v, int bus, i } void -gemini_pci_attach_hook(struct device *parent, struct device *self, +gemini_pci_attach_hook(device_t parent, device_t self, struct pcibus_attach_args *pba) { /* Nothing to do. */ @@ -448,4 +448,3 @@ gemini_pci_intr_handler(void *v) return rv; } - Index: sys/arch/arm/gemini/gemini_timervar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/arm/gemini/gemini_timervar.h,v retrieving revision 1.2 diff -u -p -r1.2 gemini_timervar.h --- sys/arch/arm/gemini/gemini_timervar.h 9 Nov 2008 08:56:47 -0000 1.2 +++ sys/arch/arm/gemini/gemini_timervar.h 1 Oct 2012 14:55:40 -0000 @@ -51,7 +51,6 @@ typedef struct timer_factors { } timer_factors_t; typedef struct geminitmr_softc { - struct device sc_dev; uint sc_timerno; bus_space_tag_t sc_iot; bus_space_handle_t sc_ioh; Index: sys/arch/arm/gemini/obio_lpchc.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/arm/gemini/obio_lpchc.c,v retrieving revision 1.3 diff -u -p -r1.3 obio_lpchc.c --- sys/arch/arm/gemini/obio_lpchc.c 1 Jul 2011 19:32:28 -0000 1.3 +++ sys/arch/arm/gemini/obio_lpchc.c 26 Sep 2012 21:34:17 -0000 @@ -24,8 +24,8 @@ __KERNEL_RCSID(0, "$NetBSD: obio_lpchc.c #include #include -static int gemini_lpchc_match(struct device *, struct cfdata *, void *); -static void gemini_lpchc_attach(struct device *, struct device *, void *); +static int gemini_lpchc_match(device_t, cfdata_t, void *); +static void gemini_lpchc_attach(device_t, device_t, void *); static int gemini_lpchc_print(void *, const char *); CFATTACH_DECL_NEW(obio_lpchc, sizeof(struct gemini_lpchc_softc), @@ -33,7 +33,7 @@ CFATTACH_DECL_NEW(obio_lpchc, sizeof(str static int -gemini_lpchc_match(struct device *parent, struct cfdata *cf, void *aux) +gemini_lpchc_match(device_t parent, cfdata_t cf, void *aux) { struct obio_attach_args *obio = aux; @@ -47,7 +47,7 @@ gemini_lpchc_match(struct device *parent } static void -gemini_lpchc_attach(struct device *parent, struct device *self, void *aux) +gemini_lpchc_attach(device_t parent, device_t self, void *aux) { gemini_lpchc_softc_t *sc = device_private(self); struct obio_attach_args *obio = aux; Index: sys/arch/arm/gemini/obio_wdt.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/arm/gemini/obio_wdt.c,v retrieving revision 1.6 diff -u -p -r1.6 obio_wdt.c --- sys/arch/arm/gemini/obio_wdt.c 1 Jul 2011 19:32:28 -0000 1.6 +++ sys/arch/arm/gemini/obio_wdt.c 26 Sep 2012 21:34:17 -0000 @@ -54,14 +54,14 @@ __KERNEL_RCSID(0, "$NetBSD: obio_wdt.c,v #include #include -static int geminiwdt_match(struct device *, struct cfdata *, void *); -static void geminiwdt_attach(struct device *, struct device *, void *); +static int geminiwdt_match(device_t, cfdata_t, void *); +static void geminiwdt_attach(device_t, device_t, void *); CFATTACH_DECL_NEW(obiowdt, sizeof(struct geminiwdt_softc), geminiwdt_match, geminiwdt_attach, NULL, NULL); static int -geminiwdt_match(struct device *parent, struct cfdata *cf, void *aux) +geminiwdt_match(device_t parent, cfdata_t cf, void *aux) { struct obio_attach_args *obio = aux; @@ -75,7 +75,7 @@ geminiwdt_match(struct device *parent, s } static void -geminiwdt_attach(struct device *parent, struct device *self, void *aux) +geminiwdt_attach(device_t parent, device_t self, void *aux) { geminiwdt_softc_t *sc = device_private(self); struct obio_attach_args *obio = aux; Index: sys/arch/arm/imx/imx31_ahb.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/arm/imx/imx31_ahb.c,v retrieving revision 1.5 diff -u -p -r1.5 imx31_ahb.c --- sys/arch/arm/imx/imx31_ahb.c 1 Jul 2011 20:27:50 -0000 1.5 +++ sys/arch/arm/imx/imx31_ahb.c 28 Sep 2012 15:19:19 -0000 @@ -123,7 +123,7 @@ __KERNEL_RCSID(0, "$Id: imx31_ahb.c,v 1. #include struct ahb_softc { - struct device sc_dev; + device_t sc_dev; bus_dma_tag_t sc_dmat; bus_space_tag_t sc_memt; bus_space_handle_t sc_memh; @@ -137,7 +137,7 @@ static void ahb_attach_critical(struct a static int ahbbus_print(void *, const char *); /* attach structures */ -CFATTACH_DECL(ahb, sizeof(struct ahb_softc), +CFATTACH_DECL_NEW(ahb, sizeof(struct ahb_softc), ahb_match, ahb_attach, NULL, NULL); static struct ahb_softc *ahb_sc; @@ -151,10 +151,11 @@ ahb_match(device_t parent, cfdata_t matc static void ahb_attach(device_t parent, device_t self, void *aux) { - struct ahb_softc *sc = (struct ahb_softc *)self; + struct ahb_softc *sc = device_private(self); struct ahb_attach_args ahba; ahb_sc = sc; + sc->sc_dev = self; sc->sc_memt = &imx_bs_tag; #if NBUS_DMA_GENERIC > 0 sc->sc_dmat = &imx_bus_dma_tag; @@ -259,7 +260,7 @@ ahb_attach_critical(struct ahb_softc *sc ahba.ahba_intr = AHBCF_INTR_DEFAULT; ahba.ahba_irqbase = AHBCF_IRQBASE_DEFAULT; - cf = config_search_ia(ahb_find, &sc->sc_dev, "ahb", &ahba); + cf = config_search_ia(ahb_find, sc->sc_dev, "ahb", &ahba); if (cf == NULL && critical_devs[i].required) panic("ahb_attach_critical: failed to find %s!", critical_devs[i].name); @@ -268,14 +269,14 @@ ahb_attach_critical(struct ahb_softc *sc ahba.ahba_size = cf->cf_loc[AHBCF_SIZE]; ahba.ahba_intr = cf->cf_loc[AHBCF_INTR]; ahba.ahba_irqbase = cf->cf_loc[AHBCF_IRQBASE]; - config_attach(&sc->sc_dev, cf, &ahba, ahbbus_print); + config_attach(sc->sc_dev, cf, &ahba, ahbbus_print); } } static int ahbbus_print(void *aux, const char *name) { - struct ahb_attach_args *ahba = (struct ahb_attach_args*)aux; + struct ahb_attach_args *ahba = aux; if (ahba->ahba_addr != AHBCF_ADDR_DEFAULT) { aprint_normal(" addr 0x%lx", ahba->ahba_addr); Index: sys/arch/arm/imx/imx31_aips.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/arm/imx/imx31_aips.c,v retrieving revision 1.4 diff -u -p -r1.4 imx31_aips.c --- sys/arch/arm/imx/imx31_aips.c 1 Jul 2011 20:27:50 -0000 1.4 +++ sys/arch/arm/imx/imx31_aips.c 28 Sep 2012 15:19:53 -0000 @@ -125,7 +125,6 @@ __KERNEL_RCSID(0, "$Id: imx31_aips.c,v 1 #include struct imxaips_softc { - struct device sc_dev; bus_space_tag_t sc_bust; }; @@ -136,7 +135,7 @@ static int imxaips_search(device_t , cf static int imxaips_print(void *, const char *); /* attach structures */ -CFATTACH_DECL(aips, sizeof(struct imxaips_softc), +CFATTACH_DECL_NEW(aips, sizeof(struct imxaips_softc), imxaips_match, imxaips_attach, NULL, NULL); static int @@ -148,7 +147,7 @@ imxaips_match(device_t parent, cfdata_t static void imxaips_attach(device_t parent, device_t self, void *aux) { - struct imxaips_softc * const sc = (struct imxaips_softc *)self; + struct imxaips_softc * const sc = device_private(self); struct ahb_attach_args * const ahba = aux; sc->sc_bust = ahba->ahba_memt; Index: sys/arch/arm/imx/imx31_clock.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/arm/imx/imx31_clock.c,v retrieving revision 1.4 diff -u -p -r1.4 imx31_clock.c --- sys/arch/arm/imx/imx31_clock.c 18 Apr 2012 05:54:07 -0000 1.4 +++ sys/arch/arm/imx/imx31_clock.c 9 Oct 2012 01:02:34 -0000 @@ -98,7 +98,7 @@ imxclock_attach(device_t parent, device_ epit2_sc = sc; break; default: - panic("%s: invalid address %p", self->dv_xname, (void *)aipsa->aipsa_addr); + panic("%s: invalid address %p", device_xname(self), (void *)aipsa->aipsa_addr); break; } Index: sys/arch/arm/imx/imx31_gpio.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/arm/imx/imx31_gpio.c,v retrieving revision 1.6 diff -u -p -r1.6 imx31_gpio.c --- sys/arch/arm/imx/imx31_gpio.c 1 Jul 2011 20:27:50 -0000 1.6 +++ sys/arch/arm/imx/imx31_gpio.c 9 Oct 2012 01:02:34 -0000 @@ -72,7 +72,6 @@ const struct pic_ops gpio_pic_ops = { }; struct gpio_softc { - struct device gpio_dev; struct pic_softc gpio_pic; bus_space_tag_t gpio_memt; bus_space_handle_t gpio_memh; @@ -220,7 +219,7 @@ gpio_pic_establish_irq(struct pic_softc static int gpio_match(device_t, cfdata_t, void *); static void gpio_attach(device_t, device_t, void *); -CFATTACH_DECL(imxgpio, +CFATTACH_DECL_NEW(imxgpio, sizeof(struct gpio_softc), gpio_match, gpio_attach, NULL, NULL); @@ -273,7 +272,7 @@ imxgpio_pin_ctl(void *arg, int pin, int static void gpio_defer(device_t self) { - struct gpio_softc * const gpio = (void *) self; + struct gpio_softc * const gpio = device_private(self); struct gpio_chipset_tag * const gp = &gpio->gpio_chipset; struct gpiobus_attach_args gba; gpio_pin_t *pins; @@ -335,7 +334,7 @@ void gpio_attach(device_t parent, device_t self, void *aux) { struct ahb_attach_args * const ahba = aux; - struct gpio_softc * const gpio = (void *) self; + struct gpio_softc * const gpio = device_private(self); int error; if (ahba->ahba_size == AHBCF_SIZE_DEFAULT) @@ -353,7 +352,7 @@ gpio_attach(device_t parent, device_t se if (ahba->ahba_irqbase != AHBCF_IRQBASE_DEFAULT) { gpio->gpio_pic.pic_ops = &gpio_pic_ops; - strlcpy(gpio->gpio_pic.pic_name, self->dv_xname, + strlcpy(gpio->gpio_pic.pic_name, device_xname(self), sizeof(gpio->gpio_pic.pic_name)); gpio->gpio_pic.pic_maxsources = 32; pic_add(&gpio->gpio_pic, ahba->ahba_irqbase); Index: sys/arch/arm/imx/imx31_icu.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/arm/imx/imx31_icu.c,v retrieving revision 1.6 diff -u -p -r1.6 imx31_icu.c --- sys/arch/arm/imx/imx31_icu.c 1 Jul 2011 20:27:50 -0000 1.6 +++ sys/arch/arm/imx/imx31_icu.c 9 Oct 2012 01:02:34 -0000 @@ -66,7 +66,6 @@ const struct pic_ops avic_pic_ops = { }; struct avic_softc { - struct device avic_dv; struct pic_softc avic_pic; bus_space_tag_t avic_memt; bus_space_handle_t avic_memh; @@ -204,10 +203,8 @@ imx31_irq_handler(void *frame) static int avic_match(device_t, cfdata_t, void *); static void avic_attach(device_t, device_t, void *); -CFATTACH_DECL(avic, - sizeof(struct avic_softc), - avic_match, avic_attach, - NULL, NULL); +CFATTACH_DECL_NEW(avic, sizeof(struct avic_softc), + avic_match, avic_attach, NULL, NULL); int avic_match(device_t parent, cfdata_t self, void *aux) @@ -223,7 +220,7 @@ avic_match(device_t parent, cfdata_t sel void avic_attach(device_t parent, device_t self, void *aux) { - struct avic_softc * const avic = (void *) self; + struct avic_softc * const avic = device_private(self); struct ahb_attach_args * const ahba = aux; int error; @@ -243,7 +240,7 @@ avic_attach(device_t parent, device_t se avic->avic_pic.pic_ops = &avic_pic_ops; avic->avic_pic.pic_maxsources = 64; - strlcpy(avic->avic_pic.pic_name, self->dv_xname, + strlcpy(avic->avic_pic.pic_name, device_xname(self), sizeof(avic->avic_pic.pic_name)); pic_add(&avic->avic_pic, ahba->ahba_irqbase); Index: sys/arch/arm/imx/imx51_clock.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/arm/imx/imx51_clock.c,v retrieving revision 1.3 diff -u -p -r1.3 imx51_clock.c --- sys/arch/arm/imx/imx51_clock.c 17 Apr 2012 09:33:31 -0000 1.3 +++ sys/arch/arm/imx/imx51_clock.c 9 Oct 2012 01:02:34 -0000 @@ -98,7 +98,7 @@ imxclock_attach(device_t parent, device_ epit2_sc = sc; break; default: - panic("%s: invalid address %p", self->dv_xname, (void *)aa->aa_addr); + panic("%s: invalid address %p", device_xname(self), (void *)aa->aa_addr); break; } Index: sys/arch/arm/imx/imx51_iomux.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/arm/imx/imx51_iomux.c,v retrieving revision 1.3 diff -u -p -r1.3 imx51_iomux.c --- sys/arch/arm/imx/imx51_iomux.c 15 Apr 2012 09:51:31 -0000 1.3 +++ sys/arch/arm/imx/imx51_iomux.c 1 Oct 2012 14:32:07 -0000 @@ -51,7 +51,6 @@ __KERNEL_RCSID(0, "$NetBSD: imx51_iomux. #include struct iomux_softc { - struct device iomux_dev; bus_space_tag_t iomux_memt; bus_space_handle_t iomux_memh; }; Index: sys/arch/arm/imx/imx_pcic.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/arm/imx/imx_pcic.c,v retrieving revision 1.5 diff -u -p -r1.5 imx_pcic.c --- sys/arch/arm/imx/imx_pcic.c 26 Jul 2011 22:52:47 -0000 1.5 +++ sys/arch/arm/imx/imx_pcic.c 28 Sep 2012 15:59:12 -0000 @@ -369,13 +369,13 @@ imx_pcic_attach_common(struct imx_pcic_s printf(": %d slot%s\n", sc->sc_nslots, sc->sc_nslots < 2 ? "" : "s"); if (sc->sc_nslots == 0) { - aprint_error("%s: can't attach\n", sc->sc_dev.dv_xname); + aprint_error("%s: can't attach\n", device_xname(sc->sc_dev)); return; } if (bus_space_map(sc->sc_iot, IMX_MEMCTL_BASE, IMX_MEMCTL_SIZE, 0, &sc->sc_memctl_ioh)) { - aprint_error("%s: failed to map MEMCTL\n", sc->sc_dev.dv_xname); + aprint_error("%s: failed to map MEMCTL\n", device_xname(sc->sc_dev)); return; } @@ -408,7 +408,7 @@ imx_pcic_attach_common(struct imx_pcic_s paa.pch = (pcmcia_chipset_handle_t)so; printf("%s: sc_pa %lx\n", __func__, sc->sc_pa); - so->pcmcia = config_found_ia(&sc->sc_dev, "pcmciabus", &paa, + so->pcmcia = config_found_ia(sc->sc_dev, "pcmciabus", &paa, imx_pcic_print); #ifdef NOTYET @@ -429,9 +429,9 @@ printf("%s: slot %d, irqpin %d\n", __fu if (kthread_create(PRI_NONE, 0, NULL, imx_pcic_event_thread, so, &so->event_thread, - "%s,%d", sc->sc_dev.dv_xname, so->socket) != 0) { + "%s,%d", device_xname(sc->sc_dev), so->socket) != 0) { printf("%s: unable to create event thread for %d\n", - sc->sc_dev.dv_xname, so->socket); + device_xname(sc->sc_dev), so->socket); } } } Index: sys/arch/arm/imx/imx_pcic.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/arm/imx/imx_pcic.h,v retrieving revision 1.2 diff -u -p -r1.2 imx_pcic.h --- sys/arch/arm/imx/imx_pcic.h 27 Apr 2008 18:58:44 -0000 1.2 +++ sys/arch/arm/imx/imx_pcic.h 1 Oct 2012 17:01:16 -0000 @@ -31,7 +31,7 @@ struct imx_pcic_socket { struct imx_pcic_softc *sc; int socket; /* socket number */ - struct device *pcmcia; + device_t pcmcia; struct lwp *event_thread; int flags; @@ -78,7 +78,7 @@ struct imx_pcic_tag { #define IMX_PCIC_NSLOT 1 /* ??? */ struct imx_pcic_softc { - struct device sc_dev; + device_t sc_dev; struct imx_pcic_socket sc_socket[IMX_PCIC_NSLOT]; bus_space_tag_t sc_iot; Index: sys/arch/arm/imx/imxgpio.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/arm/imx/imxgpio.c,v retrieving revision 1.2 diff -u -p -r1.2 imxgpio.c --- sys/arch/arm/imx/imxgpio.c 1 Jul 2011 20:27:50 -0000 1.2 +++ sys/arch/arm/imx/imxgpio.c 1 Oct 2012 15:40:30 -0000 @@ -285,7 +285,7 @@ imxgpio_pin_ctl(void *arg, int pin, int static void gpio_defer(device_t self) { - struct gpio_softc * const gpio = (void *) self; + struct gpio_softc * const gpio = device_private(self); struct gpio_chipset_tag * const gp = &gpio->gpio_chipset; struct gpiobus_attach_args gba; gpio_pin_t *pins; @@ -332,7 +332,7 @@ imxgpio_attach_common(device_t self, bus if (irqbase > 0) { gpio->gpio_pic.pic_ops = &gpio_pic_ops; - strlcpy(gpio->gpio_pic.pic_name, self->dv_xname, + strlcpy(gpio->gpio_pic.pic_name, device_xname(self), sizeof(gpio->gpio_pic.pic_name)); gpio->gpio_pic.pic_maxsources = 32; Index: sys/arch/arm/imx/imxuartvar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/arm/imx/imxuartvar.h,v retrieving revision 1.4 diff -u -p -r1.4 imxuartvar.h --- sys/arch/arm/imx/imxuartvar.h 27 Nov 2010 13:37:27 -0000 1.4 +++ sys/arch/arm/imx/imxuartvar.h 26 Sep 2012 21:34:17 -0000 @@ -52,7 +52,7 @@ void imxuart_set_frequency(u_int, u_int) /* * defined in imx51uart.c and imx31uart.c */ -int imxuart_match(struct device *, struct cfdata *, void *); -void imxuart_attach(struct device *, struct device *, void *); +int imxuart_match(device_t, cfdata_t, void *); +void imxuart_attach(device_t, device_t, void *); #endif /* _IMXUARTVAR_H */ Index: sys/arch/arm/include/isa_machdep.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/arm/include/isa_machdep.h,v retrieving revision 1.9 diff -u -p -r1.9 isa_machdep.h --- sys/arch/arm/include/isa_machdep.h 21 Sep 2012 14:21:57 -0000 1.9 +++ sys/arch/arm/include/isa_machdep.h 1 Oct 2012 17:01:36 -0000 @@ -51,7 +51,7 @@ struct isabus_attach_args; /* XXX */ /* * Functions provided to machine-independent ISA code. */ -void isa_attach_hook(struct device *, struct device *, +void isa_attach_hook(device_t, device_t, struct isabus_attach_args *); void isa_detach_hook(isa_chipset_tag_t, device_t); const struct evcnt *isa_intr_evcnt(isa_chipset_tag_t ic, int irq); Index: sys/arch/arm/include/ofisa_machdep.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/arm/include/ofisa_machdep.h,v retrieving revision 1.2 diff -u -p -r1.2 ofisa_machdep.h --- sys/arch/arm/include/ofisa_machdep.h 30 May 2001 12:28:40 -0000 1.2 +++ sys/arch/arm/include/ofisa_machdep.h 2 Oct 2012 03:09:24 -0000 @@ -43,12 +43,12 @@ int ofisa_ignore_child(int pphandle, int #ifdef COMPAT_OLD_OFW #define _OFISA_MD_MATCH -int ofisa_md_match(struct device *, struct cfdata *, void *); +int ofisa_md_match(device_t, cfdata_t, void *); #define _COM_OFISA_MD_MATCH #define _COM_OFISA_MD_INTR_FIXUP -int com_ofisa_md_match(struct device *, struct cfdata *, void *); -int com_ofisa_md_intr_fixup(struct device *, struct device*, void *, +int com_ofisa_md_match(device_t, cfdata_t, void *); +int com_ofisa_md_intr_fixup(device_t, device_t, void *, struct ofisa_intr_desc *, int, int); #define _CS_OFISA_MD_MATCH @@ -56,31 +56,30 @@ int com_ofisa_md_intr_fixup(struct devic #define _CS_OFISA_MD_INTR_FIXUP #define _CS_OFISA_MD_DMA_FIXUP #define _CS_OFISA_MD_MEDIA_FIXUP -int cs_ofisa_md_match(struct device *, struct cfdata *, void *); -int cs_ofisa_md_reg_fixup(struct device *, struct device *, void *, +int cs_ofisa_md_match(device_t, cfdata_t, void *); +int cs_ofisa_md_reg_fixup(device_t, device_t, void *, struct ofisa_reg_desc *, int, int); -int cs_ofisa_md_intr_fixup(struct device *, struct device *, void *, +int cs_ofisa_md_intr_fixup(device_t, device_t, void *, struct ofisa_intr_desc *, int, int); -int cs_ofisa_md_dma_fixup(struct device *, struct device *, void *, +int cs_ofisa_md_dma_fixup(device_t, device_t, void *, struct ofisa_dma_desc *, int, int); -int *cs_ofisa_md_media_fixup(struct device *, struct device *, void *, +int *cs_ofisa_md_media_fixup(device_t, device_t, void *, int *, int *, int *); #define _LPT_OFISA_MD_MATCH #define _LPT_OFISA_MD_INTR_FIXUP -int lpt_ofisa_md_match(struct device *, struct cfdata *, void *); -int lpt_ofisa_md_intr_fixup(struct device *, struct device*, void *, +int lpt_ofisa_md_match(device_t, cfdata_t, void *); +int lpt_ofisa_md_intr_fixup(device_t, device_t, void *, struct ofisa_intr_desc *, int, int); #define _WDC_OFISA_MD_MATCH #define _WDC_OFISA_MD_INTR_FIXUP -int wdc_ofisa_md_match(struct device *, struct cfdata *, void *); -int wdc_ofisa_md_intr_fixup(struct device *, struct device*, void *, +int wdc_ofisa_md_match(device_t, cfdata_t, void *); +int wdc_ofisa_md_intr_fixup(device_t, device_t, void *, struct ofisa_intr_desc *, int, int); #endif /* COMPAT_OLD_OFW */ /* The following aren't dependent on old OpenFirmware. */ #define _CS_OFISA_MD_CFGFLAGS_FIXUP -int cs_ofisa_md_cfgflags_fixup(struct device *, struct device *, - void *); +int cs_ofisa_md_cfgflags_fixup(device_t, device_t, void *); Index: sys/arch/arm/iomd/iomd.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/arm/iomd/iomd.c,v retrieving revision 1.20 diff -u -p -r1.20 iomd.c --- sys/arch/arm/iomd/iomd.c 14 May 2012 11:05:29 -0000 1.20 +++ sys/arch/arm/iomd/iomd.c 9 Oct 2012 01:02:34 -0000 @@ -156,7 +156,7 @@ iomdattach(device_t parent, device_t sel /* Map the IOMD */ if (bus_space_map(iot, (int) iomd_base, IOMD_SIZE, 0, &ioh)) - panic("%s: Cannot map registers", self->dv_xname); + panic("%s: Cannot map registers", device_xname(self)); sc->sc_ioh = ioh; @@ -191,7 +191,7 @@ iomdattach(device_t parent, device_t sel aprint_normal("version %d\n", bus_space_read_1(iot, ioh, IOMD_VERSION)); /* Report the DRAM refresh rate */ - aprint_normal("%s: ", self->dv_xname); + aprint_normal("%s: ", device_xname(self)); aprint_normal("DRAM refresh="); switch (refresh) { case 0x0: @@ -221,7 +221,7 @@ iomdattach(device_t parent, device_t sel * attached */ tmp = bus_space_read_1(iot, ioh, IOMD_IOTCR); - aprint_normal("%s: I/O timings: combo %c, NPCCS1/2 %c", self->dv_xname, + aprint_normal("%s: I/O timings: combo %c, NPCCS1/2 %c", device_xname(self), 'A' + ((tmp >>2) & 3), 'A' + (tmp & 3)); tmp = bus_space_read_1(iot, ioh, IOMD_ECTCR); aprint_normal(", EASI "); @@ -257,7 +257,7 @@ iomdattach(device_t parent, device_t sel /* Attach kbd device when configured */ if (bus_space_subregion(iot, ioh, IOMD_KBDDAT, 8, &ia.ia_kbd.ka_ioh)) - panic("%s: Cannot map kbd registers", self->dv_xname); + panic("%s: Cannot map kbd registers", device_xname(self)); ia.ia_kbd.ka_name = "kbd"; ia.ia_kbd.ka_iot = iot; ia.ia_kbd.ka_rxirq = IRQ_KBDRX; @@ -267,7 +267,7 @@ iomdattach(device_t parent, device_t sel /* Attach iic device */ if (bus_space_subregion(iot, ioh, IOMD_IOCR, 4, &ia.ia_iic.ia_ioh)) - panic("%s: Cannot map iic registers", self->dv_xname); + panic("%s: Cannot map iic registers", device_xname(self)); ia.ia_iic.ia_name = "iic"; ia.ia_iic.ia_iot = iot; ia.ia_iic.ia_irq = -1; @@ -280,7 +280,7 @@ iomdattach(device_t parent, device_t sel if (bus_space_subregion(iot, ioh, IOMD_MSDATA, 8, &ia.ia_opms.pa_ioh)) - panic("%s: Cannot map opms registers", self->dv_xname); + panic("%s: Cannot map opms registers", device_xname(self)); ia.ia_opms.pa_name = "opms"; ia.ia_opms.pa_iot = iot; ia.ia_opms.pa_irq = IRQ_MSDRX; @@ -291,10 +291,10 @@ iomdattach(device_t parent, device_t sel if (bus_space_subregion(iot, ioh, IOMD_MOUSEX, 8, &ia.ia_qms.qa_ioh)) - panic("%s: Cannot map qms registers", self->dv_xname); + panic("%s: Cannot map qms registers", device_xname(self)); if (bus_space_map(iot, IO_MOUSE_BUTTONS, 4, 0, &ia.ia_qms.qa_ioh_but)) - panic("%s: Cannot map registers", self->dv_xname); + panic("%s: Cannot map registers", device_xname(self)); ia.ia_qms.qa_name = "qms"; ia.ia_qms.qa_iot = iot; ia.ia_qms.qa_irq = IRQ_VSYNC; Index: sys/arch/arm/iomd/vidcaudio.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/arm/iomd/vidcaudio.c,v retrieving revision 1.50 diff -u -p -r1.50 vidcaudio.c --- sys/arch/arm/iomd/vidcaudio.c 14 May 2012 10:38:08 -0000 1.50 +++ sys/arch/arm/iomd/vidcaudio.c 9 Oct 2012 01:02:34 -0000 @@ -253,11 +253,11 @@ vidcaudio_attach(device_t parent, device sc->sc_ih.ih_func = vidcaudio_intr; sc->sc_ih.ih_arg = sc; sc->sc_ih.ih_level = IPL_AUDIO; - sc->sc_ih.ih_name = self->dv_xname; + sc->sc_ih.ih_name = device_xname(self); if (irq_claim(sc->sc_dma_intr, &sc->sc_ih) != 0) { aprint_error("%s: couldn't claim IRQ %d\n", - self->dv_xname, sc->sc_dma_intr); + device_xname(self), sc->sc_dma_intr); return; } Index: sys/arch/arm/ixp12x0/ixp12x0.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/arm/ixp12x0/ixp12x0.c,v retrieving revision 1.18 diff -u -p -r1.18 ixp12x0.c --- sys/arch/arm/ixp12x0/ixp12x0.c 1 Jul 2011 20:27:50 -0000 1.18 +++ sys/arch/arm/ixp12x0/ixp12x0.c 28 Sep 2012 17:11:29 -0000 @@ -59,15 +59,15 @@ ixp12x0_attach(struct ixp12x0_softc *sc) */ if (bus_space_map(sc->sc_iot, IXP12X0_PCI_HWBASE, IXP12X0_PCI_SIZE, 0, &sc->sc_pci_ioh)) - panic("%s: unable to map PCI registers", sc->sc_dev.dv_xname); + panic("%s: unable to map PCI registers", device_xname(sc->sc_dev)); if (bus_space_map(sc->sc_iot, IXP12X0_PCI_TYPE0_HWBASE, IXP12X0_PCI_TYPE0_SIZE, 0, &sc->sc_conf0_ioh)) panic("%s: unable to map PCI Configutation 0\n", - sc->sc_dev.dv_xname); + device_xname(sc->sc_dev)); if (bus_space_map(sc->sc_iot, IXP12X0_PCI_TYPE1_HWBASE, IXP12X0_PCI_TYPE0_SIZE, 1, &sc->sc_conf1_ioh)) panic("%s: unable to map PCI Configutation 1\n", - sc->sc_dev.dv_xname); + device_xname(sc->sc_dev)); /* * PCI bus reset @@ -176,7 +176,7 @@ ixp12x0_attach(struct ixp12x0_softc *sc) pba.pba_intrtag = 0; pba.pba_flags = PCI_FLAGS_IO_OKAY | PCI_FLAGS_MEM_OKAY | PCI_FLAGS_MRL_OKAY | PCI_FLAGS_MRM_OKAY | PCI_FLAGS_MWI_OKAY; - (void) config_found_ia(&sc->sc_dev, "pcibus", &pba, pcibusprint); + (void) config_found_ia(sc->sc_dev, "pcibus", &pba, pcibusprint); } void Index: sys/arch/arm/ixp12x0/ixp12x0_clk.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/arm/ixp12x0/ixp12x0_clk.c,v retrieving revision 1.15 diff -u -p -r1.15 ixp12x0_clk.c --- sys/arch/arm/ixp12x0/ixp12x0_clk.c 1 Jul 2011 20:27:50 -0000 1.15 +++ sys/arch/arm/ixp12x0/ixp12x0_clk.c 9 Oct 2012 01:02:34 -0000 @@ -60,8 +60,8 @@ __KERNEL_RCSID(0, "$NetBSD: ixp12x0_clk. #include #include -static int ixpclk_match(struct device *, struct cfdata *, void *); -static void ixpclk_attach(struct device *, struct device *, void *); +static int ixpclk_match(device_t, cfdata_t, void *); +static void ixpclk_attach(device_t, device_t, void *); static u_int ixpclk_get_timecount(struct timecounter *); @@ -72,7 +72,6 @@ void rtcinit(void); static int ixpclk_intr(void* arg); struct ixpclk_softc { - struct device sc_dev; bus_addr_t sc_baseaddr; bus_space_tag_t sc_iot; bus_space_handle_t sc_ioh; @@ -139,7 +138,7 @@ static volatile uint32_t ixpclk_base; #define TIMER_FREQUENCY 3686400 /* 3.6864MHz */ #define TICKS_PER_MICROSECOND (TIMER_FREQUENCY/1000000) -CFATTACH_DECL(ixpclk, sizeof(struct ixpclk_softc), +CFATTACH_DECL_NEW(ixpclk, sizeof(struct ixpclk_softc), ixpclk_match, ixpclk_attach, NULL, NULL); #define GET_TIMER_VALUE(sc) (bus_space_read_4((sc)->sc_iot, \ @@ -148,14 +147,14 @@ CFATTACH_DECL(ixpclk, sizeof(struct ixpc & IXPCL_CTV) static int -ixpclk_match(struct device *parent, struct cfdata *match, void *aux) +ixpclk_match(device_t parent, cfdata_t match, void *aux) { return 2; } static void -ixpclk_attach(struct device *parent, struct device *self, void *aux) +ixpclk_attach(device_t parent, device_t self, void *aux) { struct ixpclk_softc *sc; struct ixpsip_attach_args *sa; @@ -164,7 +163,7 @@ ixpclk_attach(struct device *parent, str printf("\n"); - sc = (struct ixpclk_softc*) self; + sc = device_private(self); sa = aux; sc->sc_iot = sa->sa_iot; sc->sc_baseaddr = sa->sa_addr; @@ -175,10 +174,10 @@ ixpclk_attach(struct device *parent, str if (bus_space_map(sa->sa_iot, sa->sa_addr, sa->sa_size, 0, &sc->sc_ioh)) - panic("%s: Cannot map registers", self->dv_xname); + panic("%s: Cannot map registers", device_xname(self)); if (bus_space_map(sa->sa_iot, sa->sa_addr + IXPCLK_PLL_CFG_OFFSET, IXPCLK_PLL_CFG_SIZE, 0, &sc->sc_pll_ioh)) - panic("%s: Cannot map registers", self->dv_xname); + panic("%s: Cannot map registers", device_xname(self)); /* disable all channel and clear interrupt status */ bus_space_write_4(sc->sc_iot, sc->sc_ioh, IXPCLK_CONTROL, @@ -205,7 +204,7 @@ ixpclk_attach(struct device *parent, str } printf("%s: IXP12x0 Interval Timer (core clock %d.%03dMHz)\n", - sc->sc_dev.dv_xname, + device_xname(self), sc->sc_coreclock_freq / 1000000, (sc->sc_coreclock_freq % 1000000) / 1000); } Index: sys/arch/arm/ixp12x0/ixp12x0_com.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/arm/ixp12x0/ixp12x0_com.c,v retrieving revision 1.40 diff -u -p -r1.40 ixp12x0_com.c --- sys/arch/arm/ixp12x0/ixp12x0_com.c 2 Feb 2012 19:42:58 -0000 1.40 +++ sys/arch/arm/ixp12x0/ixp12x0_com.c 28 Sep 2012 17:11:19 -0000 @@ -171,7 +171,7 @@ struct consdev ixpcomcons = { #define COMDIALOUT(x) (minor(x) & COMDIALOUT_MASK) #define COM_ISALIVE(sc) ((sc)->enabled != 0 && \ - device_is_active(&(sc)->sc_dev)) + device_is_active((sc)->sc_dev)) #define COM_BARRIER(t, h, f) bus_space_barrier((t), (h), 0, COM_NPORTS, (f)) @@ -211,7 +211,7 @@ ixpcom_attach_subr(struct ixpcom_softc * sc->sc_rbavail = IXPCOM_RING_SIZE; if (sc->sc_rbuf == NULL) { printf("%s: unable to allocate ring buffer\n", - sc->sc_dev.dv_xname); + device_xname(sc->sc_dev)); return; } sc->sc_ebuf = sc->sc_rbuf + (IXPCOM_RING_SIZE << 1); @@ -229,15 +229,15 @@ ixpcom_attach_subr(struct ixpcom_softc * /* locate the major number */ maj = cdevsw_lookup_major(&ixpcom_cdevsw); - cn_tab->cn_dev = makedev(maj, device_unit(&sc->sc_dev)); + cn_tab->cn_dev = makedev(maj, device_unit(sc->sc_dev)); - aprint_normal("%s: console\n", sc->sc_dev.dv_xname); + aprint_normal("%s: console\n", device_xname(sc->sc_dev)); } sc->sc_si = softint_establish(SOFTINT_SERIAL, ixpcomsoft, sc); #ifdef RND_COM - rnd_attach_source(&sc->rnd_source, sc->sc_dev.dv_xname, + rnd_attach_source(&sc->rnd_source, device_xname(sc->sc_dev), RND_TYPE_TTY, 0); #endif @@ -471,7 +471,7 @@ ixpcomopen(dev_t dev, int flag, int mode sc->sc_rbuf == NULL) return (ENXIO); - if (!device_is_active(&sc->sc_dev)) + if (!device_is_active(sc->sc_dev)) return (ENXIO); #ifdef KGDB @@ -506,7 +506,7 @@ ixpcomopen(dev_t dev, int flag, int mode splx(s2); splx(s); printf("%s: device enable failed\n", - sc->sc_dev.dv_xname); + device_xname(sc->sc_dev)); return (EIO); } sc->enabled = 1; @@ -791,7 +791,7 @@ ixpcom_iflush(struct ixpcom_softc *sc) bus_space_read_4(iot, ioh, IXPCOM_DR); #ifdef DIAGNOSTIC if (!timo) - printf("%s: com_iflush timeout %02x\n", sc->sc_dev.dv_xname, + printf("%s: com_iflush timeout %02x\n", device_xname(sc->sc_dev), reg); #endif } Index: sys/arch/arm/ixp12x0/ixp12x0_comvar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/arm/ixp12x0/ixp12x0_comvar.h,v retrieving revision 1.6 diff -u -p -r1.6 ixp12x0_comvar.h --- sys/arch/arm/ixp12x0/ixp12x0_comvar.h 2 May 2008 22:03:23 -0000 1.6 +++ sys/arch/arm/ixp12x0/ixp12x0_comvar.h 28 Sep 2012 17:00:33 -0000 @@ -45,7 +45,7 @@ #define IXPCOM_RING_SIZE 2048 struct ixpcom_softc { - struct device sc_dev; + device_t sc_dev; bus_addr_t sc_baseaddr; bus_space_tag_t sc_iot; bus_space_handle_t sc_ioh; Index: sys/arch/arm/ixp12x0/ixp12x0_pci.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/arm/ixp12x0/ixp12x0_pci.c,v retrieving revision 1.12 diff -u -p -r1.12 ixp12x0_pci.c --- sys/arch/arm/ixp12x0/ixp12x0_pci.c 7 Sep 2012 03:05:12 -0000 1.12 +++ sys/arch/arm/ixp12x0/ixp12x0_pci.c 29 Sep 2012 10:39:52 -0000 @@ -53,7 +53,7 @@ __KERNEL_RCSID(0, "$NetBSD: ixp12x0_pci. #include "opt_pci.h" #include "pci.h" -void ixp12x0_pci_attach_hook(struct device *, struct device *, +void ixp12x0_pci_attach_hook(device_t, device_t, struct pcibus_attach_args *); int ixp12x0_pci_bus_maxdevs(void *, int); pcitag_t ixp12x0_pci_make_tag(void *, int, int, int); @@ -103,7 +103,7 @@ ixp12x0_pci_init(pci_chipset_tag_t pc, v IXP12X0_PCI_MEM_HWBASE + IXP12X0_PCI_MEM_SIZE - 1, NULL, 0, EX_NOWAIT); - printf("%s: configuring PCI bus\n", sc->sc_dev.dv_xname); + aprint_normal_dev(sc->sc_dev, "configuring PCI bus\n"); pci_configure_bus(pc, ioext, memext, NULL, 0 /* XXX bus = 0 */, arm_dcache_align); @@ -119,7 +119,7 @@ ixp12x0_pci_conf_interrupt(void *v, int } void -ixp12x0_pci_attach_hook(struct device *parent, struct device *self, struct pcibus_attach_args *pba) +ixp12x0_pci_attach_hook(device_t parent, device_t self, struct pcibus_attach_args *pba) { /* Nothing to do. */ } Index: sys/arch/arm/ixp12x0/ixp12x0var.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/arm/ixp12x0/ixp12x0var.h,v retrieving revision 1.9 diff -u -p -r1.9 ixp12x0var.h --- sys/arch/arm/ixp12x0/ixp12x0var.h 1 Jul 2011 20:27:50 -0000 1.9 +++ sys/arch/arm/ixp12x0/ixp12x0var.h 28 Sep 2012 16:03:49 -0000 @@ -38,7 +38,7 @@ #include struct ixp12x0_softc { - struct device sc_dev; + device_t sc_dev; bus_space_tag_t sc_iot; /* Handles for the PCI */ Index: sys/arch/arm/ixp12x0/ixpsip.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/arm/ixp12x0/ixpsip.c,v retrieving revision 1.13 diff -u -p -r1.13 ixpsip.c --- sys/arch/arm/ixp12x0/ixpsip.c 1 Jul 2011 20:27:50 -0000 1.13 +++ sys/arch/arm/ixp12x0/ixpsip.c 29 Sep 2012 10:39:35 -0000 @@ -46,25 +46,24 @@ __KERNEL_RCSID(0, "$NetBSD: ixpsip.c,v 1 #include "locators.h" -static int ixpsip_match(struct device *, struct cfdata *, void *); -static void ixpsip_attach(struct device *, struct device *, void *); -static int ixpsip_search(struct device *, struct cfdata *, - const int *, void *); +static int ixpsip_match(device_t, cfdata_t, void *); +static void ixpsip_attach(device_t, device_t, void *); +static int ixpsip_search(device_t, cfdata_t, const int *, void *); static int ixpsip_print(void *, const char *); -CFATTACH_DECL(ixpsip, sizeof(struct ixpsip_softc), +CFATTACH_DECL_NEW(ixpsip, sizeof(struct ixpsip_softc), ixpsip_match, ixpsip_attach, NULL, NULL); int -ixpsip_match(struct device *parent, struct cfdata *cf, void *aux) +ixpsip_match(device_t parent, cfdata_t cf, void *aux) { return (1); } void -ixpsip_attach(struct device *parent, struct device *self, void *aux) +ixpsip_attach(device_t parent, device_t self, void *aux) { - struct ixpsip_softc *sc = (void *) self; + struct ixpsip_softc *sc = device_private(self); sc->sc_iot = &ixp12x0_bs_tag; printf("\n"); @@ -76,9 +75,9 @@ ixpsip_attach(struct device *parent, str } int -ixpsip_search(struct device *parent, struct cfdata *cf, const int *ldesc, void *aux) +ixpsip_search(device_t parent, cfdata_t cf, const int *ldesc, void *aux) { - struct ixpsip_softc *sc = (struct ixpsip_softc *)parent; + struct ixpsip_softc *sc = device_private(parent); struct ixpsip_attach_args sa; sa.sa_iot = sc->sc_iot; @@ -95,7 +94,7 @@ ixpsip_search(struct device *parent, str static int ixpsip_print(void *aux, const char *name) { - struct ixpsip_attach_args *sa = (struct ixpsip_attach_args*)aux; + struct ixpsip_attach_args *sa = aux; if (sa->sa_size) aprint_normal(" addr 0x%lx", sa->sa_addr); Index: sys/arch/arm/ixp12x0/ixpsipvar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/arm/ixp12x0/ixpsipvar.h,v retrieving revision 1.3 diff -u -p -r1.3 ixpsipvar.h --- sys/arch/arm/ixp12x0/ixpsipvar.h 1 Jul 2011 20:27:50 -0000 1.3 +++ sys/arch/arm/ixp12x0/ixpsipvar.h 28 Sep 2012 15:23:03 -0000 @@ -36,7 +36,6 @@ #include struct ixpsip_softc { - struct device sc_dev; bus_space_tag_t sc_iot; bus_space_handle_t sc_ioh; }; Index: sys/arch/arm/ofw/ofw_irqhandler.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/arm/ofw/ofw_irqhandler.c,v retrieving revision 1.18 diff -u -p -r1.18 ofw_irqhandler.c --- sys/arch/arm/ofw/ofw_irqhandler.c 20 Dec 2010 00:25:28 -0000 1.18 +++ sys/arch/arm/ofw/ofw_irqhandler.c 2 Oct 2012 06:38:51 -0000 @@ -49,7 +49,7 @@ __KERNEL_RCSID(0, "$NetBSD: ofw_irqhandl #include #include -#include +#include #include #include @@ -58,7 +58,7 @@ irqhandler_t *irqhandlers[NIRQS]; u_int current_mask; u_int actual_mask; u_int disabled_mask; -u_int irqmasks[IPL_LEVELS]; +u_int irqmasks[NIPL]; extern u_int intrcnt[]; extern char *_intrnames; @@ -89,7 +89,7 @@ irq_init(void) * We will start with no bits set and these will be updated as handlers * are installed at different IPL's. */ - for (loop = 0; loop < IPL_LEVELS; ++loop) + for (loop = 0; loop < NIPL; ++loop) irqmasks[loop] = 0; current_mask = 0x00000000; @@ -134,7 +134,7 @@ irq_claim(int irq, irqhandler_t *handler return(-1); /* Make sure the level is valid */ - if (handler->ih_level < 0 || handler->ih_level >= IPL_LEVELS) + if (handler->ih_level < 0 || handler->ih_level >= NIPL) return(-1); evcnt_attach_dynamic(&handler->ih_ev, EVCNT_TYPE_INTR, NULL, @@ -164,7 +164,7 @@ irq_claim(int irq, irqhandler_t *handler * If ih_level is out of range then don't bother to update * the masks. */ - if (handler->ih_level >= 0 && handler->ih_level < IPL_LEVELS) { + if (handler->ih_level >= 0 && handler->ih_level < NIPL) { irqhandler_t *ptr; /* @@ -251,11 +251,11 @@ irq_release(int irq, irqhandler_t *handl * If ih_level is out of range then don't bother to update * the masks. */ - if (handler->ih_level >= 0 && handler->ih_level < IPL_LEVELS) { + if (handler->ih_level >= 0 && handler->ih_level < NIPL) { irqhandler_t *ptr; /* Clean the bit from all the masks */ - for (level = 0; level < IPL_LEVELS; ++level) + for (level = 0; level < NIPL; ++level) irqmasks[level] &= ~(1 << irq); /* Index: sys/arch/arm/ofw/ofwgencfg_machdep.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/arm/ofw/ofwgencfg_machdep.c,v retrieving revision 1.18 diff -u -p -r1.18 ofwgencfg_machdep.c --- sys/arch/arm/ofw/ofwgencfg_machdep.c 6 Jun 2011 16:29:14 -0000 1.18 +++ sys/arch/arm/ofw/ofwgencfg_machdep.c 2 Oct 2012 06:33:53 -0000 @@ -50,6 +50,7 @@ __KERNEL_RCSID(0, "$NetBSD: ofwgencfg_ma #include #include #include +#include #include @@ -80,7 +81,6 @@ extern pv_addr_t abtstack; extern pv_addr_t kernelstack; extern u_int data_abort_handler_address; extern u_int prefetch_abort_handler_address; -extern u_int undefined_handler_address; /* * Imported routines Index: sys/arch/arm/omap/obio_ohci.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/arm/omap/obio_ohci.c,v retrieving revision 1.7 diff -u -p -r1.7 obio_ohci.c --- sys/arch/arm/omap/obio_ohci.c 5 Sep 2012 00:19:59 -0000 1.7 +++ sys/arch/arm/omap/obio_ohci.c 1 Oct 2012 17:02:42 -0000 @@ -55,9 +55,9 @@ struct obioohci_softc { bus_addr_t sc_size; }; -static int obioohci_match(struct device *, struct cfdata *, void *); -static void obioohci_attach(struct device *, struct device *, void *); -static int obioohci_detach(struct device *, int); +static int obioohci_match(device_t, cfdata_t, void *); +static void obioohci_attach(device_t, device_t, void *); +static int obioohci_detach(device_t, int); void * obioohci_fake_intr_establish(int (*)(void *), void *); void obioohci_fake_intr(void); Index: sys/arch/arm/omap/omap2_gpio.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/arm/omap/omap2_gpio.c,v retrieving revision 1.11 diff -u -p -r1.11 omap2_gpio.c --- sys/arch/arm/omap/omap2_gpio.c 29 Aug 2012 17:48:17 -0000 1.11 +++ sys/arch/arm/omap/omap2_gpio.c 9 Oct 2012 01:02:34 -0000 @@ -407,7 +407,7 @@ gpio_attach(device_t parent, device_t se if (oa->obio_intrbase != OBIOCF_INTRBASE_DEFAULT) { gpio->gpio_pic.pic_ops = &gpio_pic_ops; - strlcpy(gpio->gpio_pic.pic_name, self->dv_xname, + strlcpy(gpio->gpio_pic.pic_name, device_xname(self), sizeof(gpio->gpio_pic.pic_name)); gpio->gpio_pic.pic_maxsources = 32; pic_add(&gpio->gpio_pic, oa->obio_intrbase); Index: sys/arch/arm/omap/omap2_nand.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/arm/omap/omap2_nand.c,v retrieving revision 1.4 diff -u -p -r1.4 omap2_nand.c --- sys/arch/arm/omap/omap2_nand.c 1 Jul 2011 20:30:21 -0000 1.4 +++ sys/arch/arm/omap/omap2_nand.c 26 Sep 2012 21:34:17 -0000 @@ -81,8 +81,8 @@ __KERNEL_RCSID(0, "$NetBSD: omap2_nand.c /* NAND status register */ #define NAND_WP_BIT __BIT(4) -static int omap2_nand_match(struct device *, struct cfdata *, void *); -static void omap2_nand_attach(struct device *, struct device *, void *); +static int omap2_nand_match(device_t, cfdata_t, void *); +static void omap2_nand_attach(device_t, device_t, void *); static int omap2_nand_detach(device_t, int); void omap2_nand_command(device_t self, uint8_t command); @@ -161,7 +161,7 @@ omap2_nand_isbusy(device_t self) }; static int -omap2_nand_match(struct device *parent, struct cfdata *match, void *aux) +omap2_nand_match(device_t parent, cfdata_t match, void *aux) { struct gpmc_attach_args *gpmc = aux; bus_space_tag_t iot; Index: sys/arch/arm/omap/omap3_ehci.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/arm/omap/omap3_ehci.c,v retrieving revision 1.3 diff -u -p -r1.3 omap3_ehci.c --- sys/arch/arm/omap/omap3_ehci.c 5 Sep 2012 00:19:59 -0000 1.3 +++ sys/arch/arm/omap/omap3_ehci.c 1 Oct 2012 17:02:59 -0000 @@ -55,9 +55,9 @@ struct obioehci_softc { bus_size_t sc_size; }; -static int obioehci_match(struct device *, struct cfdata *, void *); -static void obioehci_attach(struct device *, struct device *, void *); -static int obioehci_detach(struct device *, int); +static int obioehci_match(device_t, cfdata_t, void *); +static void obioehci_attach(device_t, device_t, void *); +static int obioehci_detach(device_t, int); CFATTACH_DECL_NEW(obioehci, sizeof(struct obioehci_softc), obioehci_match, obioehci_attach, obioehci_detach, ehci_activate); Index: sys/arch/arm/s3c2xx0/s3c2410.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/arm/s3c2xx0/s3c2410.c,v retrieving revision 1.12 diff -u -p -r1.12 s3c2410.c --- sys/arch/arm/s3c2xx0/s3c2410.c 30 Jan 2012 03:28:33 -0000 1.12 +++ sys/arch/arm/s3c2xx0/s3c2410.c 9 Oct 2012 01:02:34 -0000 @@ -50,13 +50,12 @@ __KERNEL_RCSID(0, "$NetBSD: s3c2410.c,v #include "opt_cpuoptions.h" /* prototypes */ -static int s3c2410_match(struct device *, struct cfdata *, void *); -static void s3c2410_attach(struct device *, struct device *, void *); -static int s3c2410_search(struct device *, struct cfdata *, - const int *, void *); +static int s3c2410_match(device_t, cfdata_t, void *); +static void s3c2410_attach(device_t, device_t, void *); +static int s3c2410_search(device_t, cfdata_t, const int *, void *); /* attach structures */ -CFATTACH_DECL(ssio, sizeof(struct s3c24x0_softc), s3c2410_match, s3c2410_attach, +CFATTACH_DECL_NEW(ssio, sizeof(struct s3c24x0_softc), s3c2410_match, s3c2410_attach, NULL, NULL); extern struct bus_space s3c2xx0_bs_tag; @@ -70,7 +69,7 @@ volatile uint8_t *portf; /* for debug */ static int s3c2410_print(void *aux, const char *name) { - struct s3c2xx0_attach_args *sa = (struct s3c2xx0_attach_args *) aux; + struct s3c2xx0_attach_args *sa = aux; if (sa->sa_size) aprint_normal(" addr 0x%lx", sa->sa_addr); @@ -85,13 +84,13 @@ s3c2410_print(void *aux, const char *nam } int -s3c2410_match(struct device *parent, struct cfdata *match, void *aux) +s3c2410_match(device_t parent, cfdata_t match, void *aux) { return 1; } void -s3c2410_attach(struct device *parent, struct device *self, void *aux) +s3c2410_attach(device_t parent, device_t self, void *aux) { struct s3c24x0_softc *sc = device_private(self); bus_space_tag_t iot; @@ -170,14 +169,13 @@ s3c2410_attach(struct device *parent, st abort: panic("%s: unable to map %s registers", - self->dv_xname, which_registers); + device_xname(self), which_registers); #undef FAIL } int -s3c2410_search(struct device * parent, struct cfdata * cf, - const int *ldesc, void *aux) +s3c2410_search(device_t parent, cfdata_t cf, const int *ldesc, void *aux) { struct s3c24x0_softc *sc = device_private(parent); struct s3c2xx0_attach_args aa; Index: sys/arch/arm/s3c2xx0/s3c2410_extint.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/arm/s3c2xx0/s3c2410_extint.c,v retrieving revision 1.12 diff -u -p -r1.12 s3c2410_extint.c --- sys/arch/arm/s3c2xx0/s3c2410_extint.c 30 Jan 2012 03:28:33 -0000 1.12 +++ sys/arch/arm/s3c2xx0/s3c2410_extint.c 29 Sep 2012 10:39:14 -0000 @@ -68,8 +68,6 @@ __KERNEL_RCSID(0, "$NetBSD: s3c2410_exti #define N_EXTINT (S3C2410_EXTINT_MAX - EXTINT_CASCADE_MIN +1) struct ssextio_softc { - device_t sc_dev; - bus_space_tag_t sc_iot; bus_space_handle_t sc_ioh; @@ -92,10 +90,9 @@ static struct ssextio_softc *ssextio_sof #define EXTINT_8_23 2 /* prototypes */ -static int ssextio_match(struct device *, struct cfdata *, void *); -static void ssextio_attach(struct device *, struct device *, void *); -static int ssextio_search(struct device *, struct cfdata *, - const int *, void *); +static int ssextio_match(device_t, cfdata_t, void *); +static void ssextio_attach(device_t, device_t, void *); +static int ssextio_search(device_t, cfdata_t, const int *, void *); static int ssextio_print(void *, const char *); static int ssextio_cascaded_intr(void *); @@ -110,13 +107,13 @@ update_hw_mask(void) /* attach structures */ -CFATTACH_DECL(ssextio, sizeof(struct ssextio_softc), ssextio_match, ssextio_attach, +CFATTACH_DECL_NEW(ssextio, sizeof(struct ssextio_softc), ssextio_match, ssextio_attach, NULL, NULL); static int ssextio_print(void *aux, const char *name) { - struct s3c2xx0_attach_args *sa = (struct s3c2xx0_attach_args*)aux; + struct s3c2xx0_attach_args *sa = aux; if (sa->sa_addr != SSEXTIOCF_ADDR_DEFAULT) aprint_normal(" addr 0x%lx", sa->sa_addr); @@ -126,7 +123,7 @@ ssextio_print(void *aux, const char *nam } int -ssextio_match(struct device *parent, struct cfdata *match, void *aux) +ssextio_match(device_t parent, cfdata_t match, void *aux) { #if S3C2410_EXTINT_MAX < 4 /* better not configure this driver */ @@ -140,9 +137,9 @@ ssextio_match(struct device *parent, str } void -ssextio_attach(struct device *parent, struct device *self, void *aux) +ssextio_attach(device_t parent, device_t self, void *aux) { - struct ssextio_softc *sc = (struct ssextio_softc*)self; + struct ssextio_softc *sc = device_private(self); struct s3c24x0_softc *cpuc = ((struct s3c2xx0_attach_args *)aux)->sa_sc; aprint_normal("\n"); @@ -168,11 +165,10 @@ ssextio_attach(struct device *parent, st } static int -ssextio_search(struct device *parent, struct cfdata *cf, - const int *ldesc, void *aux) +ssextio_search(device_t parent, cfdata_t cf, const int *ldesc, void *aux) { struct ssextio_softc *sc = device_private(parent); - struct s3c24x0_softc *cpuc =(struct s3c24x0_softc *) device_private(device_parent(sc->sc_dev)); + struct s3c24x0_softc *cpuc = device_private(device_parent(parent)); struct s3c2xx0_attach_args sa; sa.sa_sc = sc; Index: sys/arch/arm/s3c2xx0/s3c2410_spi.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/arm/s3c2xx0/s3c2410_spi.c,v retrieving revision 1.6 diff -u -p -r1.6 s3c2410_spi.c --- sys/arch/arm/s3c2xx0/s3c2410_spi.c 1 Jul 2011 20:31:39 -0000 1.6 +++ sys/arch/arm/s3c2xx0/s3c2410_spi.c 1 Oct 2012 17:03:51 -0000 @@ -53,8 +53,6 @@ __KERNEL_RCSID(0, "$NetBSD: s3c2410_spi. #include "locators.h" struct ssspi_softc { - struct device dev; - bus_space_tag_t iot; bus_space_handle_t ioh; short index; @@ -62,14 +60,13 @@ struct ssspi_softc { /* prototypes */ -static int ssspi_match(struct device *, struct cfdata *, void *); -static void ssspi_attach(struct device *, struct device *, void *); -static int ssspi_search(struct device *, struct cfdata *, - const int *, void *); +static int ssspi_match(device_t, cfdata_t, void *); +static void ssspi_attach(device_t, device_t, void *); +static int ssspi_search(device_t, cfdata_t, const int *, void *); static int ssspi_print(void *, const char *); /* attach structures */ -CFATTACH_DECL(ssspi, sizeof(struct ssspi_softc), ssspi_match, ssspi_attach, +CFATTACH_DECL_NEW(ssspi, sizeof(struct ssspi_softc), ssspi_match, ssspi_attach, NULL, NULL); @@ -84,7 +81,7 @@ ssspi_print(void *aux, const char *name) } int -ssspi_match(struct device *parent, struct cfdata *match, void *aux) +ssspi_match(device_t parent, cfdata_t match, void *aux) { struct s3c2xx0_attach_args *sa = aux; @@ -101,10 +98,10 @@ ssspi_match(struct device *parent, struc } void -ssspi_attach(struct device *parent, struct device *self, void *aux) +ssspi_attach(device_t parent, device_t self, void *aux) { - struct ssspi_softc *sc = (struct ssspi_softc*)self; - struct s3c2xx0_attach_args *sa = (struct s3c2xx0_attach_args *)aux; + struct ssspi_softc *sc = device_private(self); + struct s3c2xx0_attach_args *sa = aux; bus_space_tag_t iot = sa->sa_iot; static bus_space_handle_t spi_ioh = 0; @@ -135,9 +132,9 @@ ssspi_attach(struct device *parent, stru } int -ssspi_search(struct device *parent, struct cfdata *cf, const int *ldesc, void *aux) +ssspi_search(device_t parent, cfdata_t cf, const int *ldesc, void *aux) { - struct ssspi_softc *sc = (struct ssspi_softc *)parent; + struct ssspi_softc *sc = device_private(parent); struct ssspi_attach_args spia; static const unsigned char intr[] = { S3C24X0_INT_SPI0, S3C2410_INT_SPI1 }; Index: sys/arch/arm/s3c2xx0/s3c2440.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/arm/s3c2xx0/s3c2440.c,v retrieving revision 1.1 diff -u -p -r1.1 s3c2440.c --- sys/arch/arm/s3c2xx0/s3c2440.c 30 Jan 2012 03:28:33 -0000 1.1 +++ sys/arch/arm/s3c2xx0/s3c2440.c 9 Oct 2012 01:02:34 -0000 @@ -79,10 +79,9 @@ __KERNEL_RCSID(0, "$NetBSD: s3c2440.c,v #include "opt_cpuoptions.h" /* prototypes */ -static int s3c2440_match(struct device *, struct cfdata *, void *); -static void s3c2440_attach(struct device *, struct device *, void *); -static int s3c2440_search(struct device *, struct cfdata *, - const int *, void *); +static int s3c2440_match(device_t, cfdata_t, void *); +static void s3c2440_attach(device_t, device_t, void *); +static int s3c2440_search(device_t, cfdata_t, const int *, void *); /* attach structures */ CFATTACH_DECL_NEW(ssio, sizeof(struct s3c24x0_softc), s3c2440_match, s3c2440_attach, @@ -114,13 +113,13 @@ s3c2440_print(void *aux, const char *nam } int -s3c2440_match(struct device *parent, struct cfdata *match, void *aux) +s3c2440_match(device_t parent, cfdata_t match, void *aux) { return 1; } void -s3c2440_attach(struct device *parent, struct device *self, void *aux) +s3c2440_attach(device_t parent, device_t self, void *aux) { struct s3c24x0_softc *sc = device_private(self); bus_space_tag_t iot; @@ -202,14 +201,13 @@ s3c2440_attach(struct device *parent, st abort: panic("%s: unable to map %s registers", - self->dv_xname, which_registers); + device_xname(self), which_registers); #undef FAIL } int -s3c2440_search(struct device * parent, struct cfdata * cf, - const int *ldesc, void *aux) +s3c2440_search(device_t parent, cfdata_t cf, const int *ldesc, void *aux) { struct s3c24x0_softc *sc = device_private(parent); struct s3c2xx0_attach_args aa; Index: sys/arch/arm/s3c2xx0/s3c2440_extint.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/arm/s3c2xx0/s3c2440_extint.c,v retrieving revision 1.1 diff -u -p -r1.1 s3c2440_extint.c --- sys/arch/arm/s3c2xx0/s3c2440_extint.c 30 Jan 2012 03:28:33 -0000 1.1 +++ sys/arch/arm/s3c2xx0/s3c2440_extint.c 1 Oct 2012 17:05:53 -0000 @@ -121,10 +121,9 @@ static struct ssextio_softc *ssextio_sof #define EXTINT_8_23 2 /* prototypes */ -static int ssextio_match(struct device *, struct cfdata *, void *); -static void ssextio_attach(struct device *, struct device *, void *); -static int ssextio_search(struct device *, struct cfdata * , - const int *, void *); +static int ssextio_match(device_t, cfdata_t, void *); +static void ssextio_attach(device_t, device_t, void *); +static int ssextio_search(device_t, cfdata_t, const int *, void *); static int ssextio_print(void *, const char *); static int ssextio_cascaded_intr(void *); @@ -155,7 +154,7 @@ ssextio_print(void *aux, const char *nam } int -ssextio_match(struct device *parent, struct cfdata *match, void *aux) +ssextio_match(device_t parent, cfdata_t match, void *aux) { #if S3C2440_EXTINT_MAX < 4 /* better not configure this driver */ @@ -169,7 +168,7 @@ ssextio_match(struct device *parent, str } void -ssextio_attach(struct device *parent, struct device *self, void *aux) +ssextio_attach(device_t parent, device_t self, void *aux) { struct ssextio_softc *sc = device_private(self); struct s3c24x0_softc *cpuc = ((struct s3c2xx0_attach_args *)aux)->sa_sc; @@ -198,11 +197,10 @@ ssextio_attach(struct device *parent, st } static int -ssextio_search(struct device *parent, struct cfdata *cf, - const int *ldesc, void *aux) +ssextio_search(device_t parent, cfdata_t cf, const int *ldesc, void *aux) { struct ssextio_softc *sc = device_private(parent); - struct s3c24x0_softc *cpuc =(struct s3c24x0_softc *) device_private(device_parent(sc->sc_dev)); + struct s3c24x0_softc *cpuc = device_private(device_parent(parent)); struct s3c2xx0_attach_args sa; sa.sa_sc = sc; Index: sys/arch/arm/s3c2xx0/s3c2440_i2s.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/arm/s3c2xx0/s3c2440_i2s.c,v retrieving revision 1.1 diff -u -p -r1.1 s3c2440_i2s.c --- sys/arch/arm/s3c2xx0/s3c2440_i2s.c 30 Jan 2012 03:28:33 -0000 1.1 +++ sys/arch/arm/s3c2xx0/s3c2440_i2s.c 29 Sep 2012 10:38:53 -0000 @@ -65,9 +65,9 @@ struct s3c2440_i2s_softc { static void s3c2440_i2s_xfer_complete(dmac_xfer_t, void *); -static int s3c2440_i2s_match(struct device *, struct cfdata *, void*); -static void s3c2440_i2s_attach(struct device *, struct device *, void*); -static int s3c2440_i2s_search(struct device *, struct cfdata *, const int *, void *); +static int s3c2440_i2s_match(device_t, cfdata_t, void *); +static void s3c2440_i2s_attach(device_t, device_t , void *); +static int s3c2440_i2s_search(device_t, cfdata_t, const int *, void *); static int s3c2440_i2s_print(void *aux, const char *name); static int s3c2440_i2s_init(struct s3c2440_i2s_softc*); @@ -75,15 +75,14 @@ CFATTACH_DECL_NEW(ssiis, sizeof(struct s s3c2440_i2s_attach, NULL, NULL); int -s3c2440_i2s_match(struct device *parent, struct cfdata *match, void*aux) +s3c2440_i2s_match(device_t parent, cfdata_t match, void *aux) { - /*struct s3c2xx0_attach_args *sa = aux;*/ return 1; } void -s3c2440_i2s_attach(struct device *parent, struct device *self, void *aux) +s3c2440_i2s_attach(device_t parent, device_t self, void *aux) { struct s3c2440_i2s_softc *sc = device_private(self); DPRINTF(("%s\n", __func__)); @@ -104,8 +103,7 @@ s3c2440_i2s_print(void *aux, const char } static int -s3c2440_i2s_search(struct device *parent, struct cfdata *cf, const int *ldesc, - void *aux) +s3c2440_i2s_search(device_tparent, cfdata_t cf, const int *ldesc, void *aux) { struct s3c2440_i2s_attach_args ia; DPRINTF(("%s\n", __func__)); Index: sys/arch/arm/s3c2xx0/s3c2440_sdi.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/arm/s3c2xx0/s3c2440_sdi.c,v retrieving revision 1.1 diff -u -p -r1.1 s3c2440_sdi.c --- sys/arch/arm/s3c2xx0/s3c2440_sdi.c 30 Jan 2012 03:28:33 -0000 1.1 +++ sys/arch/arm/s3c2xx0/s3c2440_sdi.c 1 Oct 2012 17:06:15 -0000 @@ -84,9 +84,8 @@ struct sssdi_softc { }; /* Basic driver stuff */ -static int sssdi_match(struct device *, struct cfdata *, void *); -static void sssdi_attach(struct device *, struct device *, void *); -//static int sssdi_search(struct device *, struct cfdata *, const int *, void *); +static int sssdi_match(device_t, cfdata_t, void *); +static void sssdi_attach(device_t, device_t, void *); CFATTACH_DECL_NEW(sssdi, sizeof(struct sssdi_softc), sssdi_match, sssdi_attach, NULL, NULL); @@ -163,7 +162,7 @@ struct sdmmc_chip_functions sssdi_functi }; int -sssdi_match(struct device *parent, struct cfdata *match, void *aux) +sssdi_match(device_t parent, cfdata_t match, void *aux) { /* struct s3c2xx0_attach_args *sa = aux;*/ @@ -172,7 +171,7 @@ sssdi_match(struct device *parent, struc } void -sssdi_attach(struct device *parent, struct device *self, void *aux) +sssdi_attach(device_t parent, device_t self, void *aux) { struct sssdi_softc *sc = device_private(self); struct s3c2xx0_attach_args *sa = (struct s3c2xx0_attach_args *)aux; Index: sys/arch/arm/s3c2xx0/s3c2440_spi.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/arm/s3c2xx0/s3c2440_spi.c,v retrieving revision 1.1 diff -u -p -r1.1 s3c2440_spi.c --- sys/arch/arm/s3c2xx0/s3c2440_spi.c 30 Jan 2012 03:28:33 -0000 1.1 +++ sys/arch/arm/s3c2xx0/s3c2440_spi.c 28 Sep 2012 15:41:36 -0000 @@ -85,8 +85,6 @@ __KERNEL_RCSID(0, "$NetBSD: s3c2440_spi. #include "locators.h" struct ssspi_softc { - struct device dev; - bus_space_tag_t iot; bus_space_handle_t ioh; short index; @@ -100,15 +98,14 @@ struct ssspi_softc { /* prototypes */ -static int ssspi_match(struct device *, struct cfdata *, void *); -static void ssspi_attach(struct device *, struct device *, void *); -static int ssspi_search(struct device *, struct cfdata *, - const int *, void *); +static int ssspi_match(device_t, cfdata_t, void *); +static void ssspi_attach(device_t, device_t, void *); +static int ssspi_search(device_t, cfdata_t, const int *, void *); static int ssspi_print(void *, const char *); int ssspi_intr(void *arg); /* attach structures */ -CFATTACH_DECL(ssspi, sizeof(struct ssspi_softc), ssspi_match, ssspi_attach, +CFATTACH_DECL_NEW(ssspi, sizeof(struct ssspi_softc), ssspi_match, ssspi_attach, NULL, NULL); @@ -123,7 +120,7 @@ ssspi_print(void *aux, const char *name) } int -ssspi_match(struct device *parent, struct cfdata *match, void *aux) +ssspi_match(device_t parent, cfdata_t match, void *aux) { struct s3c2xx0_attach_args *sa = aux; @@ -140,10 +137,10 @@ ssspi_match(struct device *parent, struc } void -ssspi_attach(struct device *parent, struct device *self, void *aux) +ssspi_attach(device_t parent, device_t self, void *aux) { - struct ssspi_softc *sc = (struct ssspi_softc*)self; - struct s3c2xx0_attach_args *sa = (struct s3c2xx0_attach_args *)aux; + struct ssspi_softc *sc = device_private(self); + struct s3c2xx0_attach_args *sa = aux; bus_space_tag_t iot = sa->sa_iot; static bus_space_handle_t spi_ioh = 0; @@ -177,9 +174,9 @@ ssspi_attach(struct device *parent, stru } int -ssspi_search(struct device *parent, struct cfdata *cf, const int *ldesc, void *aux) +ssspi_search(device_t parent, cfdata_t cf, const int *ldesc, void *aux) { - struct ssspi_softc *sc = (struct ssspi_softc *)parent; + struct ssspi_softc *sc = device_private(parent); struct ssspi_attach_args spia; static const unsigned char intr[] = { S3C24X0_INT_SPI0, S3C2440_INT_SPI1 }; Index: sys/arch/arm/s3c2xx0/s3c2440_touch.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/arm/s3c2xx0/s3c2440_touch.c,v retrieving revision 1.1 diff -u -p -r1.1 s3c2440_touch.c --- sys/arch/arm/s3c2xx0/s3c2440_touch.c 30 Jan 2012 03:28:33 -0000 1.1 +++ sys/arch/arm/s3c2xx0/s3c2440_touch.c 1 Oct 2012 17:06:50 -0000 @@ -70,8 +70,8 @@ struct sstouch_softc { }; /* Basic Driver Stuff */ -static int sstouch_match (struct device *, struct cfdata *, void *); -static void sstouch_attach (struct device *, struct device *, void *); +static int sstouch_match (device_t, cfdata_t, void *); +static void sstouch_attach (device_t, device_t, void *); CFATTACH_DECL_NEW(sstouch, sizeof(struct sstouch_softc), sstouch_match, sstouch_attach, NULL, NULL); @@ -108,19 +108,17 @@ static struct wsmouse_calibcoords defaul /* IMPLEMENTATION PART */ int -sstouch_match(struct device *parent, struct cfdata *match, void *aux) +sstouch_match(device_t parent, cfdata_t match, void *aux) { /* XXX: Check CPU type? */ return 1; } void -sstouch_attach(struct device *parent, - struct device *self, - void *aux) +sstouch_attach(device_t parent, device_t self, void *aux) { struct sstouch_softc *sc = device_private(self); - struct s3c2xx0_attach_args *sa = (struct s3c2xx0_attach_args*)aux; + struct s3c2xx0_attach_args *sa = aux; struct wsmousedev_attach_args mas; sc->dev = self; Index: sys/arch/arm/s3c2xx0/s3c24x0_lcd.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/arm/s3c2xx0/s3c24x0_lcd.c,v retrieving revision 1.9 diff -u -p -r1.9 s3c24x0_lcd.c --- sys/arch/arm/s3c2xx0/s3c24x0_lcd.c 30 Jan 2012 03:28:33 -0000 1.9 +++ sys/arch/arm/s3c2xx0/s3c24x0_lcd.c 9 Oct 2012 01:22:29 -0000 @@ -154,7 +154,7 @@ s3c24x0_lcd_attach_sub(struct s3c24x0_lc sc->ih = s3c24x0_intr_establish(sa->sa_intr, IPL_BIO, lcdintr, sc); if (sc->ih == NULL) printf("%s: unable to establish interrupt at irq %d", - sc->dev.dv_xname, sa->sa_intr); + device_xname(sc->dev), sa->sa_intr); #endif /* mask LCD interrupts */ @@ -322,7 +322,7 @@ s3c24x0_lcd_new_screen(struct s3c24x0_lc #if 0 /* Does this make any sense? */ #ifdef DIAGNOSTIC if (size > 1 << 22) { - aprint_error("%s: too big screen size\n", sc->dev.dv_xname); + aprint_error_dev(sc->dev, "too big screen size\n"); return NULL; } #endif Index: sys/arch/arm/s3c2xx0/s3c2800.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/arm/s3c2xx0/s3c2800.c,v retrieving revision 1.13 diff -u -p -r1.13 s3c2800.c --- sys/arch/arm/s3c2xx0/s3c2800.c 30 Jan 2012 03:28:33 -0000 1.13 +++ sys/arch/arm/s3c2xx0/s3c2800.c 9 Oct 2012 01:02:34 -0000 @@ -53,10 +53,9 @@ __KERNEL_RCSID(0, "$NetBSD: s3c2800.c,v #include "opt_cpuoptions.h" /* prototypes */ -static int s3c2800_match(struct device *, struct cfdata *, void *); -static void s3c2800_attach(struct device *, struct device *, void *); -static int s3c2800_search(struct device *, struct cfdata *, - const int *, void *); +static int s3c2800_match(device_t, cfdata_t, void *); +static void s3c2800_attach(device_t, device_t, void *); +static int s3c2800_search(device_t, cfdata_t, const int *, void *); /* attach structures */ CFATTACH_DECL_NEW(ssio, sizeof(struct s3c2800_softc), s3c2800_match, s3c2800_attach, @@ -84,13 +83,13 @@ s3c2800_print(void *aux, const char *nam } int -s3c2800_match(struct device *parent, struct cfdata *match, void *aux) +s3c2800_match(device_t parent, cfdata_t match, void *aux) { return 1; } void -s3c2800_attach(struct device *parent, struct device *self, void *aux) +s3c2800_attach(device_t parent, device_t self, void *aux) { struct s3c2800_softc *sc = device_private(self); bus_space_tag_t iot; @@ -160,14 +159,13 @@ s3c2800_attach(struct device *parent, st abort: panic("%s: unable to map %s registers", - self->dv_xname, which_registers); + device_xname(self), which_registers); #undef FAIL } int -s3c2800_search(struct device * parent, struct cfdata * cf, - const int *ldesc, void *aux) +s3c2800_search(device_t parent, cfdata_t cf, const int *ldesc, void *aux) { struct s3c2800_softc *sc = device_private(parent); struct s3c2xx0_attach_args aa; Index: sys/arch/arm/s3c2xx0/s3c2800_pci.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/arm/s3c2xx0/s3c2800_pci.c,v retrieving revision 1.18 diff -u -p -r1.18 s3c2800_pci.c --- sys/arch/arm/s3c2xx0/s3c2800_pci.c 7 Sep 2012 03:05:12 -0000 1.18 +++ sys/arch/arm/s3c2xx0/s3c2800_pci.c 9 Oct 2012 01:02:34 -0000 @@ -137,8 +137,7 @@ __KERNEL_RCSID(0, "$NetBSD: s3c2800_pci. #define BUS0_DEV_MIN 1 #define BUS0_DEV_MAX 21 -void s3c2800_pci_attach_hook(struct device *, struct device *, - struct pcibus_attach_args *); +void s3c2800_pci_attach_hook(device_t, device_t, struct pcibus_attach_args *); int s3c2800_pci_bus_maxdevs(void *, int); pcitag_t s3c2800_pci_make_tag(void *, int, int, int); void s3c2800_pci_decompose_tag(void *, pcitag_t, int *, int *, int *); @@ -164,7 +163,7 @@ struct sspci_irq_handler { }; struct sspci_softc { - struct device sc_dev; + device_t sc_dev; bus_space_tag_t sc_iot; bus_space_handle_t sc_reg_ioh; @@ -180,8 +179,8 @@ struct sspci_softc { void *sc_softinterrupt; }; -static int sspci_match(struct device *, struct cfdata *, void *aux); -static void sspci_attach(struct device *, struct device *, void *); +static int sspci_match(device_t, cfdata_t, void *aux); +static void sspci_attach(device_t, device_t, void *); static int sspci_bs_map(void *, bus_addr_t, bus_size_t, int, bus_space_handle_t *); @@ -190,7 +189,7 @@ static int sspci_intr(void *); static void sspci_softintr(void *); /* attach structures */ -CFATTACH_DECL(sspci, sizeof(struct sspci_softc), sspci_match, sspci_attach, +CFATTACH_DECL_NEW(sspci, sizeof(struct sspci_softc), sspci_match, sspci_attach, NULL, NULL); @@ -222,15 +221,15 @@ struct arm32_pci_chipset sspci_chipset = struct bus_space sspci_io_tag, sspci_mem_tag; static int -sspci_match(struct device *parent, struct cfdata *match, void *aux) +sspci_match(device_t parent, cfdata_t match, void *aux) { return 1; } static void -sspci_attach(struct device *parent, struct device *self, void *aux) +sspci_attach(device_t parent, device_t self, void *aux) { - struct sspci_softc *sc = (struct sspci_softc *) self; + struct sspci_softc *sc = device_private(self); struct s3c2xx0_attach_args *aa = aux; bus_space_tag_t iot; bus_dma_tag_t pci_dma_tag; @@ -243,6 +242,7 @@ sspci_attach(struct device *parent, stru #define FAIL(which) do { \ error_on=(which); goto abort; }while(/*CONSTCOND*/0) + sc->sc_dev = self; iot = sc->sc_iot = aa->sa_iot; if (bus_space_map(iot, S3C2800_PCICTL_BASE, S3C2800_PCICTL_SIZE, 0, &sc->sc_reg_ioh)) @@ -271,7 +271,7 @@ sspci_attach(struct device *parent, stru #if defined(PCI_NETBSD_CONFIGURE) if (sspci_init_controller(sc)) { - printf("%s: failed to initialize controller\n", self->dv_xname); + printf("%s: failed to initialize controller\n", device_xname(self)); return; } #endif @@ -293,7 +293,7 @@ sspci_attach(struct device *parent, stru sc->sc_reg_ioh, PCI_CLASS_REG); pci_devinfo(id_reg, class_reg, 1, buf, sizeof(buf)); - printf("%s: %s\n", self->dv_xname, buf); + printf("%s: %s\n", device_xname(self), buf); } #if defined(PCI_NETBSD_CONFIGURE) @@ -341,7 +341,7 @@ sspci_attach(struct device *parent, stru #undef FAIL abort: panic("%s: map failed (%s)", - self->dv_xname, error_on); + device_xname(self), error_on); } @@ -401,7 +401,7 @@ s3c2800_pci_conf_interrupt(void *v, int } void -s3c2800_pci_attach_hook(struct device * parent, struct device * self, +s3c2800_pci_attach_hook(device_t parent, device_t self, struct pcibus_attach_args * pba) { @@ -715,7 +715,7 @@ sspci_intr(void *arg) if ((errors & (1 << i)) == 0) continue; - printf("%s: %s\n", sc->sc_dev.dv_xname, + printf("%s: %s\n", device_xname(sc->sc_dev), pci_abnormal_error_name[i > 4 ? 5 : i]); errors &= ~(1 << i); Index: sys/arch/arm/s3c2xx0/sscom.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/arm/s3c2xx0/sscom.c,v retrieving revision 1.37 diff -u -p -r1.37 sscom.c --- sys/arch/arm/s3c2xx0/sscom.c 7 Feb 2012 09:06:05 -0000 1.37 +++ sys/arch/arm/s3c2xx0/sscom.c 9 Oct 2012 01:22:39 -0000 @@ -335,7 +335,7 @@ sscomstatus(struct sscom_softc *sc, cons int umcon = bus_space_read_1(sc->sc_iot, sc->sc_iot, SSCOM_UMCON); printf("%s: %s %sclocal %sdcd %sts_carr_on %sdtr %stx_stopped\n", - sc->sc_dev->dv_xname, str, + device_xname(sc->sc_dev), str, ISSET(tp->t_cflag, CLOCAL) ? "+" : "-", "+", /* DCD */ ISSET(tp->t_state, TS_CARR_ON) ? "+" : "-", @@ -343,7 +343,7 @@ sscomstatus(struct sscom_softc *sc, cons sc->sc_tx_stopped ? "+" : "-"); printf("%s: %s %scrtscts %scts %sts_ttstop %srts %xrx_flags\n", - sc->sc_dev->dv_xname, str, + device_xname(sc->sc_dev), str, ISSET(tp->t_cflag, CRTSCTS) ? "+" : "-", ISSET(umstat, UMSTAT_CTS) ? "+" : "-", ISSET(tp->t_state, TS_TTSTOP) ? "+" : "-", @@ -462,7 +462,7 @@ sscom_attach_subr(struct sscom_softc *sc #ifdef KGDB if (ISSET(sc->sc_hwflags, SSCOM_HW_KGDB)) { sscom_kgdb_attached = 1; - printf("%s: kgdb\n", sc->sc_dev->dv_xname); + printf("%s: kgdb\n", device_xname(sc->sc_dev)); sscom_enable_debugport(sc); return; } @@ -479,7 +479,7 @@ sscom_attach_subr(struct sscom_softc *sc sc->sc_rbavail = sscom_rbuf_size; if (sc->sc_rbuf == NULL) { printf("%s: unable to allocate ring buffer\n", - sc->sc_dev->dv_xname); + device_xname(sc->sc_dev)); return; } sc->sc_ebuf = sc->sc_rbuf + (sscom_rbuf_size << 1); @@ -501,7 +501,7 @@ sscom_attach_subr(struct sscom_softc *sc sc->sc_si = softint_establish(SOFTINT_SERIAL, sscomsoft, sc); #ifdef RND_COM - rnd_attach_source(&sc->rnd_source, sc->sc_dev.dv_xname, + rnd_attach_source(&sc->rnd_source, device_xname(sc->sc_dev), RND_TYPE_TTY, 0); #endif @@ -1182,7 +1182,7 @@ sscom_iflush(struct sscom_softc *sc) (void)sscom_getc(iot,ioh); #ifdef DIAGNOSTIC if (!timo) - printf("%s: sscom_iflush timeout\n", sc->sc_dev->dv_xname); + printf("%s: sscom_iflush timeout\n", device_xname(sc->sc_dev)); #endif } @@ -1354,7 +1354,7 @@ sscomdiag(void *arg) splx(s); log(LOG_WARNING, "%s: %d silo overflow%s, %d ibuf flood%s\n", - sc->sc_dev->dv_xname, + device_xname(sc->sc_dev), overflows, overflows == 1 ? "" : "s", floods, floods == 1 ? "" : "s"); } Index: sys/arch/arm/s3c2xx0/sscom_s3c2410.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/arm/s3c2xx0/sscom_s3c2410.c,v retrieving revision 1.5 diff -u -p -r1.5 sscom_s3c2410.c --- sys/arch/arm/s3c2xx0/sscom_s3c2410.c 30 Jan 2012 03:28:33 -0000 1.5 +++ sys/arch/arm/s3c2xx0/sscom_s3c2410.c 26 Sep 2012 21:34:17 -0000 @@ -64,8 +64,8 @@ __KERNEL_RCSID(0, "$NetBSD: sscom_s3c241 #include #include -static int sscom_match(struct device *, struct cfdata *, void *); -static void sscom_attach(struct device *, struct device *, void *); +static int sscom_match(device_t, cfdata_t, void *); +static void sscom_attach(device_t, device_t, void *); CFATTACH_DECL_NEW(sscom, sizeof(struct sscom_softc), sscom_match, sscom_attach, NULL, NULL); @@ -98,7 +98,7 @@ const struct sscom_uart_info s3c2410_uar }; static int -sscom_match(struct device *parent, struct cfdata *cf, void *aux) +sscom_match(device_t parent, cfdata_t cf, void *aux) { struct s3c2xx0_attach_args *sa = aux; int unit = sa->sa_index; @@ -107,7 +107,7 @@ sscom_match(struct device *parent, struc } static void -sscom_attach(struct device *parent, struct device *self, void *aux) +sscom_attach(device_t parent, device_t self, void *aux) { struct sscom_softc *sc = device_private(self); struct s3c2xx0_attach_args *sa = aux; Index: sys/arch/arm/s3c2xx0/sscom_s3c2440.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/arm/s3c2xx0/sscom_s3c2440.c,v retrieving revision 1.2 diff -u -p -r1.2 sscom_s3c2440.c --- sys/arch/arm/s3c2xx0/sscom_s3c2440.c 7 Feb 2012 09:06:05 -0000 1.2 +++ sys/arch/arm/s3c2xx0/sscom_s3c2440.c 1 Oct 2012 17:07:15 -0000 @@ -81,8 +81,8 @@ __KERNEL_RCSID(0, "$NetBSD: sscom_s3c244 #include "locators.h" -static int sscom_match(device_t, struct cfdata *, void *); -static void sscom_attach(device_t, struct device *, void *); +static int sscom_match(device_t, cfdata_t, void *); +static void sscom_attach(device_t, device_t, void *); CFATTACH_DECL_NEW(sscom, sizeof(struct sscom_softc), sscom_match, sscom_attach, NULL, NULL); @@ -127,7 +127,7 @@ sscom_match(device_t parent, struct cfda } static void -sscom_attach(device_t parent, struct device *self, void *aux) +sscom_attach(device_t parent, device_t self, void *aux) { struct sscom_softc *sc = device_private(self); struct s3c2xx0_attach_args *sa = aux; Index: sys/arch/arm/s3c2xx0/sscom_s3c2800.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/arm/s3c2xx0/sscom_s3c2800.c,v retrieving revision 1.8 diff -u -p -r1.8 sscom_s3c2800.c --- sys/arch/arm/s3c2xx0/sscom_s3c2800.c 1 Jul 2011 20:31:39 -0000 1.8 +++ sys/arch/arm/s3c2xx0/sscom_s3c2800.c 28 Sep 2012 15:34:46 -0000 @@ -64,10 +64,10 @@ __KERNEL_RCSID(0, "$NetBSD: sscom_s3c280 #include #include -static int sscom_match(struct device *, struct cfdata *, void *); -static void sscom_attach(struct device *, struct device *, void *); +static int sscom_match(device_t, cfdata_t, void *); +static void sscom_attach(device_t, device_t, void *); -CFATTACH_DECL(sscom, sizeof(struct sscom_softc), sscom_match, +CFATTACH_DECL_NEW(sscom, sizeof(struct sscom_softc), sscom_match, sscom_attach, NULL, NULL); const struct sscom_uart_info s3c2800_uart_config[] = { @@ -90,7 +90,7 @@ const struct sscom_uart_info s3c2800_uar }; static int -sscom_match(struct device *parent, struct cfdata *cf, void *aux) +sscom_match(device_t parent, cfdata_t cf, void *aux) { struct s3c2xx0_attach_args *sa = aux; int unit = sa->sa_index; @@ -99,15 +99,16 @@ sscom_match(struct device *parent, struc } static void -sscom_attach(struct device *parent, struct device *self, void *aux) +sscom_attach(device_t parent, device_t self, void *aux) { - struct sscom_softc *sc = (struct sscom_softc *)self; + struct sscom_softc *sc = device_private(self); struct s3c2xx0_attach_args *sa = aux; int unit = sa->sa_index; bus_addr_t iobase = s3c2800_uart_config[unit].iobase; printf( ": UART%d addr=%lx", sa->sa_index, iobase ); + sc->sc_dev = self; sc->sc_iot = s3c2xx0_softc->sc_iot; sc->sc_unit = unit; sc->sc_frequency = s3c2xx0_softc->sc_pclk; Index: sys/arch/arm/s3c2xx0/sscom_var.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/arm/s3c2xx0/sscom_var.h,v retrieving revision 1.11 diff -u -p -r1.11 sscom_var.h --- sys/arch/arm/s3c2xx0/sscom_var.h 2 Feb 2012 19:42:58 -0000 1.11 +++ sys/arch/arm/s3c2xx0/sscom_var.h 1 Oct 2012 17:05:09 -0000 @@ -276,10 +276,10 @@ struct sscom_uart_info { int sscomspeed(long, long); void sscom_attach_subr(struct sscom_softc *); -int sscom_detach(struct device *, int); -int sscom_activate(struct device *, enum devact); +int sscom_detach(device_t, int); +int sscom_activate(device_t, enum devact); void sscom_shutdown(struct sscom_softc *); -void sscomdiag (void *); +void sscomdiag(void *); void sscomstart(struct tty *); int sscomparam(struct tty *, struct termios *); int sscomread(dev_t, struct uio *, int); Index: sys/arch/arm/sa11x0/sa1111_kbc.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/arm/sa11x0/sa1111_kbc.c,v retrieving revision 1.15 diff -u -p -r1.15 sa1111_kbc.c --- sys/arch/arm/sa11x0/sa1111_kbc.c 4 Feb 2012 22:20:38 -0000 1.15 +++ sys/arch/arm/sa11x0/sa1111_kbc.c 26 Sep 2012 22:19:47 -0000 @@ -364,7 +364,7 @@ static void sackbc_slot_enable(void *self, pckbport_slot_t slot, int on) { #if 0 - struct sackbc_softc *sc = (struct sackbc_softc *) self; + struct sackbc_softc *sc = device_private(self); int cmd; cmd = on ? KBC_KBDENABLE : KBC_KBDDISABLE; @@ -377,7 +377,7 @@ sackbc_slot_enable(void *self, pckbport_ static void sackbc_set_poll(void *self, pckbport_slot_t slot, int on) { - struct sackbc_softc *sc = (struct sackbc_softc *)self; + struct sackbc_softc *sc = device_private(self); int s; s = spltty(); Index: sys/arch/arm/sa11x0/sa11x0.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/arm/sa11x0/sa11x0.c,v retrieving revision 1.26 diff -u -p -r1.26 sa11x0.c --- sys/arch/arm/sa11x0/sa11x0.c 1 Jul 2011 20:31:39 -0000 1.26 +++ sys/arch/arm/sa11x0/sa11x0.c 9 Oct 2012 01:02:34 -0000 @@ -139,29 +139,29 @@ sa11x0_attach(device_t parent, device_t /* Map the SAIP */ if (bus_space_map(sc->sc_iot, SAIPIC_BASE, SAIPIC_NPORTS, 0, &sc->sc_ioh)) - panic("%s: Cannot map registers", self->dv_xname); + panic("%s: Cannot map registers", device_xname(self)); saipic_base = sc->sc_ioh; /* Map the GPIO registers */ if (bus_space_map(sc->sc_iot, SAGPIO_BASE, SAGPIO_NPORTS, 0, &sc->sc_gpioh)) - panic("%s: unable to map GPIO registers", self->dv_xname); + panic("%s: unable to map GPIO registers", device_xname(self)); bus_space_write_4(sc->sc_iot, sc->sc_gpioh, SAGPIO_EDR, 0xffffffff); /* Map the PPC registers */ if (bus_space_map(sc->sc_iot, SAPPC_BASE, SAPPC_NPORTS, 0, &sc->sc_ppch)) - panic("%s: unable to map PPC registers", self->dv_xname); + panic("%s: unable to map PPC registers", device_xname(self)); /* Map the DMA controller registers */ if (bus_space_map(sc->sc_iot, SADMAC_BASE, SADMAC_NPORTS, 0, &sc->sc_dmach)) - panic("%s: unable to map DMAC registers", self->dv_xname); + panic("%s: unable to map DMAC registers", device_xname(self)); /* Map the reset controller registers */ if (bus_space_map(sc->sc_iot, SARCR_BASE, PAGE_SIZE, 0, &sc->sc_reseth)) - panic("%s: unable to map reset registers", self->dv_xname); + panic("%s: unable to map reset registers", device_xname(self)); printf("\n"); Index: sys/arch/arm/xscale/becc.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/arm/xscale/becc.c,v retrieving revision 1.15 diff -u -p -r1.15 becc.c --- sys/arch/arm/xscale/becc.c 18 Sep 2012 05:47:28 -0000 1.15 +++ sys/arch/arm/xscale/becc.c 1 Oct 2012 17:07:33 -0000 @@ -77,8 +77,7 @@ const char *becc_revisions[] = { */ struct becc_softc *becc_softc; -static int becc_search(struct device *, struct cfdata *, - const int *, void *); +static int becc_search(device_t, cfdata_t, const int *, void *); static int becc_print(void *, const char *); static void becc_pci_dma_init(struct becc_softc *); @@ -194,7 +193,7 @@ becc_attach(struct becc_softc *sc) * the BECC is a soft-core with a variety of peripherals, depending * on configuration. */ - config_search_ia(becc_search, &sc->sc_dev, "becc", NULL); + config_search_ia(becc_search, sc->sc_dev, "becc", NULL); /* * Attach the PCI bus. @@ -210,7 +209,7 @@ becc_attach(struct becc_softc *sc) pba.pba_intrtag = 0; pba.pba_flags = PCI_FLAGS_IO_OKAY | PCI_FLAGS_MEM_OKAY | PCI_FLAGS_MRL_OKAY | PCI_FLAGS_MRM_OKAY | PCI_FLAGS_MWI_OKAY; - (void) config_found_ia(&sc->sc_dev, "pcibus", &pba, pcibusprint); + (void) config_found_ia(sc->sc_dev, "pcibus", &pba, pcibusprint); } /* @@ -219,10 +218,9 @@ becc_attach(struct becc_softc *sc) * Indirect autoconfiguration glue for BECC. */ static int -becc_search(struct device *parent, struct cfdata *cf, - const int *ldesc, void *aux) +becc_search(device_t parent, cfdata_t cf, const int *ldesc, void *aux) { - struct becc_softc *sc = (void *) parent; + struct becc_softc *sc = device_private(parent); struct becc_attach_args ba; ba.ba_dmat = &sc->sc_local_dmat; Index: sys/arch/arm/xscale/becc_pci.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/arm/xscale/becc_pci.c,v retrieving revision 1.12 diff -u -p -r1.12 becc_pci.c --- sys/arch/arm/xscale/becc_pci.c 7 Sep 2012 02:11:32 -0000 1.12 +++ sys/arch/arm/xscale/becc_pci.c 29 Sep 2012 10:37:58 -0000 @@ -62,7 +62,7 @@ __KERNEL_RCSID(0, "$NetBSD: becc_pci.c,v #include "opt_pci.h" #include "pci.h" -void becc_pci_attach_hook(struct device *, struct device *, +void becc_pci_attach_hook(device_t, device_t, struct pcibus_attach_args *); int becc_pci_bus_maxdevs(void *, int); pcitag_t becc_pci_make_tag(void *, int, int, int); @@ -132,7 +132,7 @@ becc_pci_init(pci_chipset_tag_t pc, void sc->sc_owin_xlate[0] + BECC_PCI_MEM1_SIZE - 1, NULL, 0, EX_NOWAIT); - aprint_normal("%s: configuring PCI bus\n", sc->sc_dev.dv_xname); + aprint_normal("%s: configuring PCI bus\n", device_xname(sc->sc_dev)); pci_configure_bus(pc, ioext, memext, NULL, 0, arm_dcache_align); extent_destroy(ioext); @@ -146,7 +146,7 @@ becc_pci_conf_interrupt(void *v, int a, } void -becc_pci_attach_hook(struct device *parent, struct device *self, +becc_pci_attach_hook(device_t parent, device_t self, struct pcibus_attach_args *pba) { Index: sys/arch/arm/xscale/beccvar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/arm/xscale/beccvar.h,v retrieving revision 1.3 diff -u -p -r1.3 beccvar.h --- sys/arch/arm/xscale/beccvar.h 25 Mar 2003 19:47:30 -0000 1.3 +++ sys/arch/arm/xscale/beccvar.h 28 Sep 2012 15:42:57 -0000 @@ -63,7 +63,7 @@ struct intrq { }; struct becc_softc { - struct device sc_dev; /* generic device glue */ + device_t sc_dev; /* generic device glue */ /* * We expect the board-specific front-end to have already mapped Index: sys/arch/arm/xscale/i80312.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/arm/xscale/i80312.c,v retrieving revision 1.22 diff -u -p -r1.22 i80312.c --- sys/arch/arm/xscale/i80312.c 18 Sep 2012 05:47:28 -0000 1.22 +++ sys/arch/arm/xscale/i80312.c 28 Sep 2012 17:02:59 -0000 @@ -109,17 +109,17 @@ i80312_attach(struct i80312_softc *sc) if (bus_space_subregion(sc->sc_st, sc->sc_sh, I80312_PPB_BASE, I80312_PPB_SIZE, &sc->sc_ppb_sh)) panic("%s: unable to subregion PPB registers", - sc->sc_dev.dv_xname); + device_xname(sc->sc_dev)); if (bus_space_subregion(sc->sc_st, sc->sc_sh, I80312_ATU_BASE, I80312_ATU_SIZE, &sc->sc_atu_sh)) panic("%s: unable to subregion ATU registers", - sc->sc_dev.dv_xname); + device_xname(sc->sc_dev)); if (bus_space_subregion(sc->sc_st, sc->sc_sh, I80312_INTC_BASE, I80312_INTC_SIZE, &sc->sc_intc_sh)) panic("%s: unable to subregion INTC registers", - sc->sc_dev.dv_xname); + device_xname(sc->sc_dev)); /* We expect the Memory Controller to be already sliced off. */ @@ -159,10 +159,10 @@ i80312_attach(struct i80312_softc *sc) sc->sc_sder); } else if (sc->sc_privmem_size || sc->sc_privio_size) { printf("%s: WARNING: privmem_size 0x%08x privio_size 0x%08x\n", - sc->sc_dev.dv_xname, sc->sc_privmem_size, + device_xname(sc->sc_dev), sc->sc_privmem_size, sc->sc_privio_size); printf("%s: private bus spaces not enabled\n", - sc->sc_dev.dv_xname); + device_xname(sc->sc_dev)); } /* @@ -296,7 +296,7 @@ i80312_attach(struct i80312_softc *sc) ia.ia_offset = id->id_offset; ia.ia_size = id->id_size; - (void) config_found_ia(&sc->sc_dev, "iopxs", &ia, i80312_iopxs_print); + (void) config_found_ia(sc->sc_dev, "iopxs", &ia, i80312_iopxs_print); } /* @@ -319,7 +319,7 @@ i80312_attach(struct i80312_softc *sc) /* XXX MRL/MRM/MWI seem to have problems, at the moment. */ pba.pba_flags = PCI_FLAGS_IO_OKAY | PCI_FLAGS_MEM_OKAY /* | PCI_FLAGS_MRL_OKAY | PCI_FLAGS_MRM_OKAY | PCI_FLAGS_MWI_OKAY */; - (void) config_found_ia(&sc->sc_dev, "pcibus", &pba, pcibusprint); + (void) config_found_ia(sc->sc_dev, "pcibus", &pba, pcibusprint); } /* Index: sys/arch/arm/xscale/i80312_pci.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/arm/xscale/i80312_pci.c,v retrieving revision 1.12 diff -u -p -r1.12 i80312_pci.c --- sys/arch/arm/xscale/i80312_pci.c 7 Sep 2012 03:05:12 -0000 1.12 +++ sys/arch/arm/xscale/i80312_pci.c 29 Sep 2012 10:37:41 -0000 @@ -61,7 +61,7 @@ __KERNEL_RCSID(0, "$NetBSD: i80312_pci.c #include "opt_pci.h" #include "pci.h" -void i80312_pci_attach_hook(struct device *, struct device *, +void i80312_pci_attach_hook(device_t, device_t, struct pcibus_attach_args *); int i80312_pci_bus_maxdevs(void *, int); pcitag_t i80312_pci_make_tag(void *, int, int, int); @@ -115,7 +115,7 @@ i80312_pci_init(pci_chipset_tag_t pc, vo sc->sc_smemout_base + sc->sc_smemout_size - 1, NULL, 0, EX_NOWAIT); - aprint_normal("%s: configuring Secondary PCI bus\n", sc->sc_dev.dv_xname); + aprint_normal_dev(sc->sc_dev, "configuring Secondary PCI bus\n"); pci_configure_bus(pc, ioext, memext, NULL, sbus, arm_dcache_align); extent_destroy(ioext); @@ -129,7 +129,7 @@ i80312_pci_conf_interrupt(void *v, int a } void -i80312_pci_attach_hook(struct device *parent, struct device *self, +i80312_pci_attach_hook(device_t parent, device_t self, struct pcibus_attach_args *pba) { Index: sys/arch/arm/xscale/i80312var.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/arm/xscale/i80312var.h,v retrieving revision 1.10 diff -u -p -r1.10 i80312var.h --- sys/arch/arm/xscale/i80312var.h 1 Jul 2011 20:32:51 -0000 1.10 +++ sys/arch/arm/xscale/i80312var.h 28 Sep 2012 16:01:09 -0000 @@ -43,7 +43,7 @@ #include struct i80312_softc { - struct device sc_dev; /* generic device glue */ + device_t sc_dev; /* generic device glue */ int sc_is_host; /* indicates if we're a host or plugged into another host */ Index: sys/arch/arm/xscale/i80321_pci.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/arm/xscale/i80321_pci.c,v retrieving revision 1.13 diff -u -p -r1.13 i80321_pci.c --- sys/arch/arm/xscale/i80321_pci.c 7 Sep 2012 03:05:12 -0000 1.13 +++ sys/arch/arm/xscale/i80321_pci.c 29 Sep 2012 10:36:22 -0000 @@ -62,7 +62,7 @@ __KERNEL_RCSID(0, "$NetBSD: i80321_pci.c #include "opt_i80321.h" #include "pci.h" -void i80321_pci_attach_hook(struct device *, struct device *, +void i80321_pci_attach_hook(device_t, device_t, struct pcibus_attach_args *); int i80321_pci_bus_maxdevs(void *, int); pcitag_t i80321_pci_make_tag(void *, int, int, int); @@ -138,7 +138,7 @@ i80321_pci_conf_interrupt(void *v, int a } void -i80321_pci_attach_hook(struct device *parent, struct device *self, +i80321_pci_attach_hook(device_t parent, device_t self, struct pcibus_attach_args *pba) { Index: sys/arch/arm/xscale/ixp425.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/arm/xscale/ixp425.c,v retrieving revision 1.15 diff -u -p -r1.15 ixp425.c --- sys/arch/arm/xscale/ixp425.c 1 Jul 2011 20:32:51 -0000 1.15 +++ sys/arch/arm/xscale/ixp425.c 28 Sep 2012 16:16:16 -0000 @@ -45,12 +45,14 @@ __KERNEL_RCSID(0, "$NetBSD: ixp425.c,v 1 struct ixp425_softc *ixp425_softc; void -ixp425_attach(struct ixp425_softc *sc) +ixp425_attach(device_t self) { + struct ixp425_softc *sc = device_private(self); #if NPCI > 0 struct pcibus_attach_args pba; #endif + sc->sc_dev = self; sc->sc_iot = &ixp425_bs_tag; ixp425_softc = sc; @@ -62,12 +64,12 @@ ixp425_attach(struct ixp425_softc *sc) */ if (bus_space_map(sc->sc_iot, IXP425_GPIO_HWBASE, IXP425_GPIO_SIZE, 0, &sc->sc_gpio_ioh)) - panic("%s: unable to map GPIO registers", sc->sc_dev.dv_xname); + panic("%s: unable to map GPIO registers", device_xname(self)); if (bus_space_map(sc->sc_iot, IXP425_EXP_HWBASE, IXP425_EXP_SIZE, 0, &sc->sc_exp_ioh)) panic("%s: unable to map Expansion Bus registers", - sc->sc_dev.dv_xname); + device_xname(self)); #if NPCI > 0 /* @@ -75,7 +77,7 @@ ixp425_attach(struct ixp425_softc *sc) */ if (bus_space_map(sc->sc_iot, IXP425_PCI_HWBASE, IXP425_PCI_SIZE, 0, &sc->sc_pci_ioh)) - panic("%s: unable to map PCI registers", sc->sc_dev.dv_xname); + panic("%s: unable to map PCI registers", device_xname(self)); /* * Invoke the board-specific PCI initialization code @@ -106,6 +108,6 @@ ixp425_attach(struct ixp425_softc *sc) pba.pba_flags = PCI_FLAGS_IO_OKAY | PCI_FLAGS_MEM_OKAY | PCI_FLAGS_MRL_OKAY | PCI_FLAGS_MRM_OKAY | PCI_FLAGS_MWI_OKAY; - (void) config_found_ia(&sc->sc_dev, "pcibus", &pba, pcibusprint); + (void) config_found_ia(self, "pcibus", &pba, pcibusprint); #endif } Index: sys/arch/arm/xscale/ixp425_ixme.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/arm/xscale/ixp425_ixme.c,v retrieving revision 1.4 diff -u -p -r1.4 ixp425_ixme.c --- sys/arch/arm/xscale/ixp425_ixme.c 18 Sep 2012 05:47:28 -0000 1.4 +++ sys/arch/arm/xscale/ixp425_ixme.c 29 Sep 2012 10:37:07 -0000 @@ -46,33 +46,31 @@ __KERNEL_RCSID(0, "$NetBSD: ixp425_ixme. #include "locators.h" -static int ixme_match(struct device *, struct cfdata *, void *); -static void ixme_attach(struct device *, struct device *, void *); -static int ixme_search(struct device *, struct cfdata *, const int *, - void *); +static int ixme_match(device_t, cfdata_t, void *); +static void ixme_attach(device_t, device_t, void *); +static int ixme_search(device_t, cfdata_t, const int *, void *); static int ixme_print(void *, const char *); struct ixme_softc { - struct device sc_dev; struct arm32_dma_range sc_dr; struct arm32_bus_dma_tag sc_dt; void *sc_qmgr; }; -CFATTACH_DECL(ixme, sizeof(struct ixme_softc), +CFATTACH_DECL_NEW(ixme, sizeof(struct ixme_softc), ixme_match, ixme_attach, NULL, NULL); static int -ixme_match(struct device *parent, struct cfdata *self, void *arg) +ixme_match(device_t parent, cfdata_t self, void *arg) { return (1); } static void -ixme_attach(struct device *parent, struct device *self, void *arg) +ixme_attach(device_t parent, device_t self, void *arg) { - struct ixme_softc *sc = (void *)self; + struct ixme_softc *sc = device_private(self); extern paddr_t physical_start, physical_end; aprint_naive("\n"); @@ -81,7 +79,7 @@ ixme_attach(struct device *parent, struc sc->sc_qmgr = ixpqmgr_init(&ixp425_bs_tag); if (sc->sc_qmgr == NULL) { panic("%s: ixme_attach: Failed to init Queue Manager", - sc->sc_dev.dv_xname); + device_xname(self)); } sc->sc_dr.dr_sysbase = physical_start; @@ -113,10 +111,9 @@ ixme_attach(struct device *parent, struc } static int -ixme_search(struct device *parent, struct cfdata *cf, const int *ldesc, - void *arg) +ixme_search(device_t parent, cfdata_t cf, const int *ldesc, void *arg) { - struct ixme_softc *sc = (void *)parent; + struct ixme_softc *sc = device_private(parent); struct ixme_attach_args ixa; if (cf->cf_loc[IXMECF_NPE] < 0 || cf->cf_loc[IXMECF_NPE] > 2) Index: sys/arch/arm/xscale/ixp425_npe.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/arm/xscale/ixp425_npe.c,v retrieving revision 1.8 diff -u -p -r1.8 ixp425_npe.c --- sys/arch/arm/xscale/ixp425_npe.c 1 Jul 2011 20:32:51 -0000 1.8 +++ sys/arch/arm/xscale/ixp425_npe.c 29 Sep 2012 10:36:41 -0000 @@ -242,17 +242,16 @@ npe_reg_write(struct ixpnpe_softc *sc, b bus_space_write_4(sc->sc_iot, sc->sc_ioh, off, val); } -static int ixpnpe_match(struct device *, struct cfdata *, void *); -static void ixpnpe_attach(struct device *, struct device *, void *); +static int ixpnpe_match(device_t, cfdata_t, void *); +static void ixpnpe_attach(device_t, device_t, void *); static int ixpnpe_print(void *, const char *); -static int ixpnpe_search(struct device *, struct cfdata *, const int *, - void *); +static int ixpnpe_search(device_t, cfdata_t, const int *, void *); -CFATTACH_DECL(ixpnpe, sizeof(struct ixpnpe_softc), +CFATTACH_DECL_NEW(ixpnpe, sizeof(struct ixpnpe_softc), ixpnpe_match, ixpnpe_attach, NULL, NULL); static int -ixpnpe_match(struct device *parent, struct cfdata *match, void *arg) +ixpnpe_match(device_t parent, cfdata_t match, void *arg) { struct ixme_attach_args *ixa = arg; @@ -260,9 +259,9 @@ ixpnpe_match(struct device *parent, stru } static void -ixpnpe_attach(struct device *parent, struct device *self, void *arg) +ixpnpe_attach(device_t parent, device_t self, void *arg) { - struct ixpnpe_softc *sc = (void *)self; + struct ixpnpe_softc *sc = device_private(self); struct ixme_attach_args *ixa = arg; bus_addr_t base; int irq; @@ -270,6 +269,7 @@ ixpnpe_attach(struct device *parent, str aprint_naive("\n"); aprint_normal("\n"); + sc->sc_dev = self; sc->sc_iot = ixa->ixa_iot; sc->sc_dt = ixa->ixa_dt; sc->sc_unit = ixa->ixa_npe; @@ -280,7 +280,7 @@ ixpnpe_attach(struct device *parent, str switch (ixa->ixa_npe) { default: - panic("%s: Invalid NPE!", sc->sc_dev.dv_xname); + panic("%s: Invalid NPE!", device_xname(self)); case 1: base = IXP425_NPE_B_HWBASE; @@ -305,14 +305,14 @@ ixpnpe_attach(struct device *parent, str break; } if (bus_space_map(sc->sc_iot, base, sc->sc_size, 0, &sc->sc_ioh)) - panic("%s: Cannot map registers", sc->sc_dev.dv_xname); + panic("%s: Cannot map registers", device_xname(self)); /* * Setup IRQ and handler for NPE message support. */ sc->sc_ih = ixp425_intr_establish(irq, IPL_NET, ixpnpe_intr, sc); if (sc->sc_ih == NULL) - panic("%s: Unable to establish irq %u", sc->sc_dev.dv_xname, irq); + panic("%s: Unable to establish irq %u", device_xname(self), irq); /* enable output fifo interrupts (NB: must also set OFIFO Write Enable) */ npe_reg_write(sc, IX_NPECTL, npe_reg_read(sc, IX_NPECTL) | (IX_NPECTL_OFE | IX_NPECTL_OFWE)); @@ -328,10 +328,9 @@ ixpnpe_print(void *arg, const char *name } static int -ixpnpe_search(struct device *parent, struct cfdata *cf, const int *ldesc, - void *arg) +ixpnpe_search(device_t parent, cfdata_t cf, const int *ldesc, void *arg) { - struct ixpnpe_softc *sc = (void *)parent; + struct ixpnpe_softc *sc = device_private(parent); struct ixme_attach_args *ixa = arg; struct ixpnpe_attach_args na; @@ -445,7 +444,7 @@ npe_findimage(struct ixpnpe_softc *sc, /* 2 consecutive NPE_IMAGE_MARKER's indicates end of library */ if (image->id == NPE_IMAGE_MARKER) { printf("%s: imageId 0x%08x not found in image library header\n", - sc->sc_dev.dv_xname, imageId); + device_xname(sc->sc_dev), imageId); /* reached end of library, image not found */ return EIO; } @@ -540,12 +539,12 @@ npe_load_ins(struct ixpnpe_softc *sc, npeMemAddress = bp->npeMemAddress; blockSize = bp->size; /* NB: instruction/data count */ if (npeMemAddress + blockSize > sc->insMemSize) { - printf("%s: Block size too big for NPE memory\n", sc->sc_dev.dv_xname); + printf("%s: Block size too big for NPE memory\n", device_xname(sc->sc_dev)); return EINVAL; /* XXX */ } for (i = 0; i < blockSize; i++, npeMemAddress++) { if (npe_ins_write(sc, npeMemAddress, bp->data[i], verify) != 0) { - printf("%s: NPE instruction write failed", sc->sc_dev.dv_xname); + printf("%s: NPE instruction write failed", device_xname(sc->sc_dev)); return EIO; } } @@ -562,12 +561,12 @@ npe_load_data(struct ixpnpe_softc *sc, npeMemAddress = bp->npeMemAddress; blockSize = bp->size; /* NB: instruction/data count */ if (npeMemAddress + blockSize > sc->dataMemSize) { - printf("%s: Block size too big for NPE memory\n", sc->sc_dev.dv_xname); + printf("%s: Block size too big for NPE memory\n", device_xname(sc->sc_dev)); return EINVAL; } for (i = 0; i < blockSize; i++, npeMemAddress++) { if (npe_data_write(sc, npeMemAddress, bp->data[i], verify) != 0) { - printf("%s: NPE data write failed\n", sc->sc_dev.dv_xname); + printf("%s: NPE data write failed\n", device_xname(sc->sc_dev)); return EIO; } } @@ -596,27 +595,27 @@ npe_load_stateinfo(struct ixpnpe_softc * /* error-check Context Register No. and Context Number values */ if (!(0 <= reg && reg < IX_NPEDL_CTXT_REG_MAX)) { - printf("%s: invalid Context Register %u\n", sc->sc_dev.dv_xname, + printf("%s: invalid Context Register %u\n", device_xname(sc->sc_dev), reg); error = EINVAL; break; } if (!(0 <= cNum && cNum < IX_NPEDL_CTXT_NUM_MAX)) { - printf("%s: invalid Context Number %u\n", sc->sc_dev.dv_xname, + printf("%s: invalid Context Number %u\n", device_xname(sc->sc_dev), cNum); error = EINVAL; break; } /* NOTE that there is no STEVT register for Context 0 */ if (cNum == 0 && reg == IX_NPEDL_CTXT_REG_STEVT) { - printf("%s: no STEVT for Context 0\n", sc->sc_dev.dv_xname); + printf("%s: no STEVT for Context 0\n", device_xname(sc->sc_dev)); error = EINVAL; break; } if (npe_ctx_reg_write(sc, cNum, reg, regVal, verify) != 0) { printf("%s: write of state-info to NPE failed\n", - sc->sc_dev.dv_xname); + device_xname(sc->sc_dev)); error = EIO; break; } @@ -635,7 +634,7 @@ npe_load_image(struct ixpnpe_softc *sc, int i, error; if (!npe_isstopped(sc)) { /* verify NPE is stopped */ - printf("%s: cannot load image, NPE not stopped\n", sc->sc_dev.dv_xname); + printf("%s: cannot load image, NPE not stopped\n", device_xname(sc->sc_dev)); return EIO; } @@ -666,7 +665,7 @@ npe_load_image(struct ixpnpe_softc *sc, break; default: printf("%s: unknown block type 0x%x in download map\n", - sc->sc_dev.dv_xname, downloadMap->entry[i].block.type); + device_xname(sc->sc_dev), downloadMap->entry[i].block.type); error = EIO; /* XXX */ break; } @@ -1296,7 +1295,7 @@ ixpnpe_ofifo_wait(struct ixpnpe_softc *s return 1; DELAY(10); } - printf("%s: %s: timeout, last status 0x%x\n", sc->sc_dev.dv_xname, + printf("%s: %s: timeout, last status 0x%x\n", device_xname(sc->sc_dev), __func__, npe_reg_read(sc, IX_NPESTAT)); return 0; } @@ -1310,7 +1309,7 @@ ixpnpe_intr(void *arg) status = npe_reg_read(sc, IX_NPESTAT); if ((status & IX_NPESTAT_OFINT) == 0) { /* NB: should not happen */ - printf("%s: %s: status 0x%x\n", sc->sc_dev.dv_xname, __func__, status); + printf("%s: %s: status 0x%x\n", device_xname(sc->sc_dev), __func__, status); /* XXX must silence interrupt? */ return(1); } @@ -1375,7 +1374,7 @@ ixpnpe_sendmsg_locked(struct ixpnpe_soft if (error) printf("%s: input FIFO timeout, msg [0x%x,0x%x]\n", - sc->sc_dev.dv_xname, msg[0], msg[1]); + device_xname(sc->sc_dev), msg[0], msg[1]); return error; } Index: sys/arch/arm/xscale/ixp425_npevar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/arm/xscale/ixp425_npevar.h,v retrieving revision 1.3 diff -u -p -r1.3 ixp425_npevar.h --- sys/arch/arm/xscale/ixp425_npevar.h 11 Mar 2009 16:30:20 -0000 1.3 +++ sys/arch/arm/xscale/ixp425_npevar.h 28 Sep 2012 16:56:16 -0000 @@ -82,7 +82,7 @@ #define IXP425_NPE_C_IMAGEID 0x02000201 struct ixpnpe_softc { - struct device sc_dev; + device_t sc_dev; bus_dma_tag_t sc_dt; bus_space_tag_t sc_iot; bus_space_handle_t sc_ioh; Index: sys/arch/arm/xscale/ixp425_pci.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/arm/xscale/ixp425_pci.c,v retrieving revision 1.9 diff -u -p -r1.9 ixp425_pci.c --- sys/arch/arm/xscale/ixp425_pci.c 7 Sep 2012 03:05:12 -0000 1.9 +++ sys/arch/arm/xscale/ixp425_pci.c 29 Sep 2012 10:37:22 -0000 @@ -52,7 +52,7 @@ __KERNEL_RCSID(0, "$NetBSD: ixp425_pci.c #include "opt_pci.h" #include "pci.h" -void ixp425_pci_attach_hook(struct device *, struct device *, +void ixp425_pci_attach_hook(device_t, device_t, struct pcibus_attach_args *); int ixp425_pci_bus_maxdevs(void *, int); void ixp425_pci_decompose_tag(void *, pcitag_t, int *, int *, int *); @@ -97,7 +97,7 @@ ixp425_pci_init(struct ixp425_softc *sc) IXP425_PCI_MEM_HWBASE + IXP425_PCI_MEM_SIZE - 1, NULL, 0, EX_NOWAIT); - printf("%s: configuring PCI bus\n", sc->sc_dev.dv_xname); + aprint_normal_dev(sc->sc_dev, "configuring PCI bus\n"); pci_configure_bus(pc, ioext, memext, NULL, 0 /* XXX bus = 0 */, arm_dcache_align); @@ -112,7 +112,7 @@ ixp425_pci_conf_interrupt(void *v, int a } void -ixp425_pci_attach_hook(struct device *parent, struct device *self, +ixp425_pci_attach_hook(device_t parent, device_t self, struct pcibus_attach_args *pba) { /* Nothing to do. */ Index: sys/arch/arm/xscale/ixp425_sip.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/arm/xscale/ixp425_sip.c,v retrieving revision 1.12 diff -u -p -r1.12 ixp425_sip.c --- sys/arch/arm/xscale/ixp425_sip.c 1 Jul 2011 20:32:51 -0000 1.12 +++ sys/arch/arm/xscale/ixp425_sip.c 1 Oct 2012 17:07:46 -0000 @@ -46,27 +46,26 @@ __KERNEL_RCSID(0, "$NetBSD: ixp425_sip.c #include "locators.h" -static int ixpsip_match(struct device *, struct cfdata *, void *); -static void ixpsip_attach(struct device *, struct device *, void *); -static int ixpsip_search(struct device *, struct cfdata *, - const int *, void *); +static int ixpsip_match(device_t, cfdata_t, void *); +static void ixpsip_attach(device_t, device_t, void *); +static int ixpsip_search(device_t, cfdata_t, const int *, void *); static int ixpsip_print(void *, const char *); -CFATTACH_DECL(ixpsip, sizeof(struct ixpsip_softc), +CFATTACH_DECL_NEW(ixpsip, sizeof(struct ixpsip_softc), ixpsip_match, ixpsip_attach, NULL, NULL); struct ixpsip_softc *ixpsip_softc; int -ixpsip_match(struct device *parent, struct cfdata *cf, void *aux) +ixpsip_match(device_t parent, cfdata_t cf, void *aux) { return (1); } void -ixpsip_attach(struct device *parent, struct device *self, void *aux) +ixpsip_attach(device_t parent, device_t self, void *aux) { - struct ixpsip_softc *sc = (void *) self; + struct ixpsip_softc *sc = device_private(self); sc->sc_iot = &ixp425_bs_tag; ixpsip_softc = sc; @@ -76,7 +75,7 @@ ixpsip_attach(struct device *parent, str if (bus_space_map(sc->sc_iot, IXP425_EXP_HWBASE, IXP425_EXP_SIZE, 0, &sc->sc_ioh)) { printf("%s: Can't map expansion bus control registers!\n", - sc->sc_dev.dv_xname); + device_xname(self)); return; } @@ -87,10 +86,9 @@ ixpsip_attach(struct device *parent, str } int -ixpsip_search(struct device *parent, struct cfdata *cf, - const int *ldesc, void *aux) +ixpsip_search(device_t parent, cfdata_t cf, const int *ldesc, void *aux) { - struct ixpsip_softc *sc = (struct ixpsip_softc *)parent; + struct ixpsip_softc *sc = device_private(parent); struct ixpsip_attach_args sa; sa.sa_iot = sc->sc_iot; @@ -108,7 +106,7 @@ ixpsip_search(struct device *parent, str static int ixpsip_print(void *aux, const char *name) { - struct ixpsip_attach_args *sa = (struct ixpsip_attach_args*)aux; + struct ixpsip_attach_args *sa = aux; if (sa->sa_size) aprint_normal(" addr 0x%lx", sa->sa_addr); Index: sys/arch/arm/xscale/ixp425_sipvar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/arm/xscale/ixp425_sipvar.h,v retrieving revision 1.6 diff -u -p -r1.6 ixp425_sipvar.h --- sys/arch/arm/xscale/ixp425_sipvar.h 1 Jul 2011 20:32:51 -0000 1.6 +++ sys/arch/arm/xscale/ixp425_sipvar.h 28 Sep 2012 15:23:57 -0000 @@ -36,7 +36,6 @@ #include struct ixpsip_softc { - struct device sc_dev; bus_space_tag_t sc_iot; bus_space_handle_t sc_ioh; }; Index: sys/arch/arm/xscale/ixp425_timer.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/arm/xscale/ixp425_timer.c,v retrieving revision 1.16 diff -u -p -r1.16 ixp425_timer.c --- sys/arch/arm/xscale/ixp425_timer.c 1 Jul 2011 20:32:51 -0000 1.16 +++ sys/arch/arm/xscale/ixp425_timer.c 29 Sep 2012 12:29:45 -0000 @@ -53,8 +53,8 @@ __KERNEL_RCSID(0, "$NetBSD: ixp425_timer #include #include -static int ixpclk_match(struct device *, struct cfdata *, void *); -static void ixpclk_attach(struct device *, struct device *, void *); +static int ixpclk_match(device_t, cfdata_t, void *); +static void ixpclk_attach(device_t, device_t, void *); static u_int ixpclk_get_timecount(struct timecounter *); static uint32_t counts_per_hz; @@ -65,7 +65,6 @@ static void *clock_ih; int ixpclk_intr(void *); struct ixpclk_softc { - struct device sc_dev; bus_addr_t sc_baseaddr; bus_space_tag_t sc_iot; bus_space_handle_t sc_ioh; @@ -93,7 +92,7 @@ static struct timecounter ixpclk_timecou static volatile uint32_t ixpclk_base; -CFATTACH_DECL(ixpclk, sizeof(struct ixpclk_softc), +CFATTACH_DECL_NEW(ixpclk, sizeof(struct ixpclk_softc), ixpclk_match, ixpclk_attach, NULL, NULL); #define GET_TIMER_VALUE(sc) (bus_space_read_4((sc)->sc_iot, \ @@ -104,15 +103,15 @@ CFATTACH_DECL(ixpclk, sizeof(struct ixpc (IXP425_TIMER_VBASE + IXP425_OST_TS)) static int -ixpclk_match(struct device *parent, struct cfdata *match, void *aux) +ixpclk_match(device_t parent, cfdata_t match, void *aux) { return 2; } static void -ixpclk_attach(struct device *parent, struct device *self, void *aux) +ixpclk_attach(device_t parent, device_t self, void *aux) { - struct ixpclk_softc *sc = (struct ixpclk_softc*) self; + struct ixpclk_softc *sc = device_private(self); struct ixpsip_attach_args *sa = aux; printf("\n"); @@ -124,9 +123,9 @@ ixpclk_attach(struct device *parent, str if (bus_space_map(sc->sc_iot, sa->sa_addr, sa->sa_size, 0, &sc->sc_ioh)) - panic("%s: Cannot map registers", self->dv_xname); + panic("%s: Cannot map registers", device_xname(self)); - aprint_normal("%s: IXP425 Interval Timer\n", sc->sc_dev.dv_xname); + aprint_normal_dev(self, "IXP425 Interval Timer\n"); } /* @@ -137,7 +136,7 @@ ixpclk_attach(struct device *parent, str void cpu_initclocks(void) { - struct ixpclk_softc* sc = ixpclk_sc; + struct ixpclk_softc *sc = ixpclk_sc; u_int oldirqstate; #if defined(PERFCTRS) void *pmu_ih; @@ -271,7 +270,7 @@ delay(u_int n) int ixpclk_intr(void *arg) { - struct ixpclk_softc* sc = ixpclk_sc; + struct ixpclk_softc *sc = ixpclk_sc; struct clockframe *frame = arg; bus_space_write_4(sc->sc_iot, sc->sc_ioh, IXP425_OST_STATUS, Index: sys/arch/arm/xscale/ixp425_wdog.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/arm/xscale/ixp425_wdog.c,v retrieving revision 1.3 diff -u -p -r1.3 ixp425_wdog.c --- sys/arch/arm/xscale/ixp425_wdog.c 1 Jul 2011 20:32:51 -0000 1.3 +++ sys/arch/arm/xscale/ixp425_wdog.c 28 Sep 2012 15:41:03 -0000 @@ -56,7 +56,6 @@ __KERNEL_RCSID(0, "$NetBSD: ixp425_wdog. #endif struct ixpdog_softc { - struct device sc_dev; struct sysmon_wdog sc_smw; bus_space_tag_t sc_bust; bus_space_handle_t sc_bush; @@ -71,10 +70,10 @@ struct ixpdog_softc { #define IXPDOG_COUNTS_PER_SEC IXP425_CLOCK_FREQ #endif -static int ixpdog_match(struct device *, struct cfdata *, void *); -static void ixpdog_attach(struct device *, struct device *, void *); +static int ixpdog_match(device_t, cfdata_t, void *); +static void ixpdog_attach(device_t, device_t, void *); -CFATTACH_DECL(ixpdog, sizeof(struct ixpdog_softc), +CFATTACH_DECL_NEW(ixpdog, sizeof(struct ixpdog_softc), ixpdog_match, ixpdog_attach, NULL, NULL); static void ixpdog_control(struct ixpdog_softc *, int); @@ -88,18 +87,18 @@ static void ixpdog_ddb_trap(int); static int -ixpdog_match(struct device *parent, struct cfdata *match, void *arg) +ixpdog_match(device_t parent, cfdata_t cf, void *aux) { - struct ixpsip_attach_args *sa = arg; + struct ixpsip_attach_args *sa = aux; return (sa->sa_addr == IXP425_OST_WDOG_HWBASE); } static void -ixpdog_attach(struct device *parent, struct device *self, void *arg) +ixpdog_attach(device_t parent, device_t self, void *aux) { - struct ixpdog_softc *sc = (struct ixpdog_softc *)self; - struct ixpsip_attach_args *sa = arg; + struct ixpdog_softc *sc = device_private(self); + struct ixpsip_attach_args *sa = aux; aprint_naive("\n"); aprint_normal(": Watchdog Timer\n"); @@ -108,8 +107,7 @@ ixpdog_attach(struct device *parent, str if (bus_space_map(sc->sc_bust, sa->sa_addr, IXP425_OST_WDOG_SIZE, 0, &sc->sc_bush)) { - aprint_error("%s: Failed to map watchdog registers\n", - sc->sc_dev.dv_xname); + aprint_error_dev(self, "Failed to map watchdog registers\n"); return; } @@ -122,15 +120,14 @@ ixpdog_attach(struct device *parent, str db_trap_callback = ixpdog_ddb_trap; #endif - sc->sc_smw.smw_name = sc->sc_dev.dv_xname; + sc->sc_smw.smw_name = device_xname(self); sc->sc_smw.smw_cookie = sc; sc->sc_smw.smw_setmode = ixpdog_setmode; sc->sc_smw.smw_tickle = ixpdog_tickle; sc->sc_smw.smw_period = IXPDOG_DEFAULT_PERIOD; if (sysmon_wdog_register(&sc->sc_smw) != 0) - aprint_error("%s: unable to register watchdog with sysmon\n", - sc->sc_dev.dv_xname); + aprint_error_dev(self, "unable to register watchdog with sysmon\n"); } static void Index: sys/arch/arm/xscale/ixp425var.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/arm/xscale/ixp425var.h,v retrieving revision 1.14 diff -u -p -r1.14 ixp425var.h --- sys/arch/arm/xscale/ixp425var.h 28 Sep 2012 20:08:13 -0000 1.14 +++ sys/arch/arm/xscale/ixp425var.h 3 Oct 2012 10:20:37 -0000 @@ -62,7 +62,7 @@ #define PCI_CONF_UNLOCK(s) restore_interrupts((s)) struct ixp425_softc { - struct device sc_dev; + device_t sc_dev; bus_space_tag_t sc_iot; bus_space_handle_t sc_ioh; /* IRQ handle */ @@ -142,7 +142,7 @@ void ixp425_mem_bs_init(bus_space_tag_t, void ixp425_pci_conf_reg_write(struct ixp425_softc *, uint32_t, uint32_t); uint32_t ixp425_pci_conf_reg_read(struct ixp425_softc *, uint32_t); -void ixp425_attach(struct ixp425_softc *); +void ixp425_attach(device_t); void ixp425_icu_init(void); void ixp425_clk_bootstrap(bus_space_tag_t); void ixp425_intr_init(void); Index: sys/arch/arm/xscale/pxa2x0.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/arm/xscale/pxa2x0.c,v retrieving revision 1.20 diff -u -p -r1.20 pxa2x0.c --- sys/arch/arm/xscale/pxa2x0.c 1 Jul 2011 20:32:51 -0000 1.20 +++ sys/arch/arm/xscale/pxa2x0.c 9 Oct 2012 01:02:34 -0000 @@ -214,12 +214,12 @@ pxaip_attach(device_t parent, device_t s * This takes 2 secs at most. */ cpuclock = pxaip_measure_cpuclock(sc) / 1000; - printf("%s: CPU clock = %d.%03d MHz\n", self->dv_xname, + printf("%s: CPU clock = %d.%03d MHz\n", device_xname(self), cpuclock/1000, cpuclock%1000 ); aprint_normal("%s: kernel is configured for " SUPPORTED_CPU ", cpu type is %s\n", - self->dv_xname, + device_xname(self), __CPU_IS_PXA270 ? "PXA270" : "PXA250"); /* Index: sys/arch/arm/xscale/pxa2x0_ac97.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/arm/xscale/pxa2x0_ac97.c,v retrieving revision 1.11 diff -u -p -r1.11 pxa2x0_ac97.c --- sys/arch/arm/xscale/pxa2x0_ac97.c 24 Nov 2011 03:35:56 -0000 1.11 +++ sys/arch/arm/xscale/pxa2x0_ac97.c 1 Oct 2012 17:08:05 -0000 @@ -108,7 +108,7 @@ struct acu_softc { struct ac97_host_if sc_host_if; /* Child audio(4) device */ - struct device *sc_audiodev; + device_t sc_audiodev; /* auconv encodings */ struct audio_encoding_set *sc_encodings; Index: sys/arch/arm/xscale/pxa2x0_apm.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/arm/xscale/pxa2x0_apm.c,v retrieving revision 1.2 diff -u -p -r1.2 pxa2x0_apm.c --- sys/arch/arm/xscale/pxa2x0_apm.c 5 Dec 2009 22:34:43 -0000 1.2 +++ sys/arch/arm/xscale/pxa2x0_apm.c 9 Oct 2012 01:06:35 -0000 @@ -244,9 +244,9 @@ apm_power_print(struct pxa2x0_apm_softc if (powerp->battery_life != APM_BATT_LIFE_UNKNOWN) printf("%s: battery life expectancy %d%%\n", - sc->sc_dev.dv_xname, powerp->battery_life); + device_xname(sc->sc_dev), powerp->battery_life); - printf("%s: AC ", sc->sc_dev.dv_xname); + printf("%s: AC ", device_xname(sc->sc_dev)); switch (powerp->ac_state) { case APM_AC_OFF: printf("off,"); @@ -414,10 +414,10 @@ apm_thread_create(void *v) struct pxa2x0_apm_softc *sc = v; if (kthread_create(apm_thread, sc, &sc->sc_thread, - "%s", sc->sc_dev.dv_xname)) { + "%s", device_xname(sc->sc_dev))) { /* apm_disconnect(sc); */ printf("%s: failed to create kernel thread, disabled", - sc->sc_dev.dv_xname); + device_xname(sc->sc_dev)); } } @@ -654,20 +654,20 @@ pxa2x0_apm_attach_sub(struct pxa2x0_apm_ if (bus_space_map(sc->sc_iot, PXA2X0_CLKMAN_BASE, PXA2X0_CLKMAN_SIZE, 0, &pxa2x0_clkman_ioh)) { - printf("%s: failed to map CLKMAN\n", sc->sc_dev.dv_xname); + printf("%s: failed to map CLKMAN\n", device_xname(sc->sc_dev)); return; } if (bus_space_map(sc->sc_iot, PXA2X0_MEMCTL_BASE, PXA2X0_MEMCTL_SIZE, 0, &pxa2x0_memctl_ioh)) { - printf("%s: failed to map MEMCTL\n", sc->sc_dev.dv_xname); + printf("%s: failed to map MEMCTL\n", device_xname(sc->sc_dev)); return; } sc->sc_memctl_ioh = pxa2x0_memctl_ioh; if (bus_space_map(sc->sc_iot, PXA2X0_GPIO_BASE, PXA2X0_GPIO_SIZE, 0, &pxa2x0_gpio_ioh)) { - printf("%s: can't map GPIO\n", sc->sc_dev.dv_xname); + printf("%s: can't map GPIO\n", device_xname(sc->sc_dev)); return; } Index: sys/arch/arm/xscale/pxa2x0_apm.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/arm/xscale/pxa2x0_apm.h,v retrieving revision 1.2 diff -u -p -r1.2 pxa2x0_apm.h --- sys/arch/arm/xscale/pxa2x0_apm.h 1 Jul 2011 20:32:51 -0000 1.2 +++ sys/arch/arm/xscale/pxa2x0_apm.h 9 Oct 2012 01:05:43 -0000 @@ -26,7 +26,7 @@ #include struct pxa2x0_apm_softc { - struct device sc_dev; + device_t sc_dev; struct proc *sc_thread; kmutex_t sc_lock; struct klist sc_note; Index: sys/arch/arm/xscale/pxa2x0_i2s.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/arm/xscale/pxa2x0_i2s.h,v retrieving revision 1.3 diff -u -p -r1.3 pxa2x0_i2s.h --- sys/arch/arm/xscale/pxa2x0_i2s.h 23 Nov 2011 23:07:29 -0000 1.3 +++ sys/arch/arm/xscale/pxa2x0_i2s.h 1 Oct 2012 14:33:45 -0000 @@ -26,7 +26,6 @@ struct pxa2x0_i2s_dma; struct audio_params; struct pxa2x0_i2s_softc { - struct device sc_dev; kmutex_t *sc_intr_lock; bus_space_tag_t sc_iot; Index: sys/arch/arm/xscale/pxa2x0_ohci.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/arm/xscale/pxa2x0_ohci.c,v retrieving revision 1.8 diff -u -p -r1.8 pxa2x0_ohci.c --- sys/arch/arm/xscale/pxa2x0_ohci.c 1 Jul 2011 20:32:51 -0000 1.8 +++ sys/arch/arm/xscale/pxa2x0_ohci.c 9 Oct 2012 01:23:21 -0000 @@ -125,11 +125,10 @@ pxaohci_attach(device_t parent, device_t } #if 0 - sc->sc.sc_powerhook = powerhook_establish(sc->sc.sc_bus.bdev.dv_xname, + sc->sc.sc_powerhook = powerhook_establish(device_xname(sc->sc.sc_bus.bdev), pxaohci_power, sc); if (sc->sc.sc_powerhook == NULL) { - aprint_error("%s: cannot establish powerhook\n", - sc->sc.sc_dev->sc_bus.bdev.dv_xname); + aprint_error_dev(sc->sc.sc_dev->sc_bus.bdev, "cannot establish powerhook\n"); } #endif @@ -264,5 +263,3 @@ pxaohci_disable(struct pxaohci_softc *sc CFATTACH_DECL2_NEW(pxaohci, sizeof(struct pxaohci_softc), pxaohci_match, pxaohci_attach, pxaohci_detach, ohci_activate, NULL, ohci_childdet); - - Index: sys/arch/arm/xscale/pxa2x0_pcic.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/arm/xscale/pxa2x0_pcic.c,v retrieving revision 1.10 diff -u -p -r1.10 pxa2x0_pcic.c --- sys/arch/arm/xscale/pxa2x0_pcic.c 26 Jul 2011 22:52:48 -0000 1.10 +++ sys/arch/arm/xscale/pxa2x0_pcic.c 1 Oct 2012 17:08:24 -0000 @@ -44,7 +44,7 @@ __KERNEL_RCSID(0, "$NetBSD: pxa2x0_pcic. static int pxapcic_print(void *, const char *); -static void pxapcic_doattach(struct device *); +static void pxapcic_doattach(device_t); static void pxapcic_event_thread(void *); static void pxapcic_event_process(struct pxapcic_socket *); @@ -396,7 +396,7 @@ pxapcic_attach_common(struct pxapcic_sof } void -pxapcic_doattach(struct device *self) +pxapcic_doattach(device_t self) { struct pxapcic_softc *sc = device_private(self); struct pxapcic_socket *sock; Index: sys/arch/arm/xscale/pxa2x0_pcic.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/arm/xscale/pxa2x0_pcic.h,v retrieving revision 1.4 diff -u -p -r1.4 pxa2x0_pcic.h --- sys/arch/arm/xscale/pxa2x0_pcic.h 29 Jan 2009 12:28:15 -0000 1.4 +++ sys/arch/arm/xscale/pxa2x0_pcic.h 1 Oct 2012 17:08:32 -0000 @@ -23,7 +23,7 @@ struct pxapcic_socket { struct pxapcic_softc *sc; int socket; /* socket number */ - struct device *pcmcia; + device_t pcmcia; struct lwp *event_thread; int flags; Index: sys/arch/arm/xscale/pxa2x0_rtc.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/arm/xscale/pxa2x0_rtc.c,v retrieving revision 1.5 diff -u -p -r1.5 pxa2x0_rtc.c --- sys/arch/arm/xscale/pxa2x0_rtc.c 1 Jul 2011 20:32:51 -0000 1.5 +++ sys/arch/arm/xscale/pxa2x0_rtc.c 26 Sep 2012 21:34:18 -0000 @@ -54,8 +54,8 @@ struct pxartc_softc { #define FLAG_WRISTWATCH (1 << 0) }; -static int pxartc_match(struct device *, struct cfdata *, void *); -static void pxartc_attach(struct device *, struct device *, void *); +static int pxartc_match(device_t, cfdata_t, void *); +static void pxartc_attach(device_t, device_t, void *); CFATTACH_DECL_NEW(pxartc, sizeof(struct pxartc_softc), pxartc_match, pxartc_attach, NULL, NULL); @@ -68,7 +68,7 @@ static int pxartc_wristwatch_read(struct static int pxartc_wristwatch_write(struct pxartc_softc *,struct clock_ymdhms *); static int -pxartc_match(struct device *parent, struct cfdata *cf, void *aux) +pxartc_match(device_t parent, cfdata_t cf, void *aux) { struct pxaip_attach_args *pxa = aux; @@ -83,7 +83,7 @@ pxartc_match(struct device *parent, stru } static void -pxartc_attach(struct device *parent, struct device *self, void *aux) +pxartc_attach(device_t parent, device_t self, void *aux) { struct pxartc_softc *sc = device_private(self); struct pxaip_attach_args *pxa = aux; Index: sys/arch/atari/atari/autoconf.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/atari/atari/autoconf.c,v retrieving revision 1.63 diff -u -p -r1.63 autoconf.c --- sys/arch/atari/atari/autoconf.c 29 Jul 2012 18:05:40 -0000 1.63 +++ sys/arch/atari/atari/autoconf.c 9 Oct 2012 02:53:27 -0000 @@ -137,32 +137,32 @@ simple_devprint(void *auxp, const char * * by checking for NULL. */ int -atari_config_found(cfdata_t pcfp, device_t pdp, void *auxp, cfprint_t pfn) +atari_config_found(cfdata_t pcfp, device_t parent, void *aux, cfprint_t pfn) { struct device temp; cfdata_t cf; const struct cfattach *ca; if (atari_realconfig) - return config_found(pdp, auxp, pfn) != NULL; + return config_found(parent, aux, pfn) != NULL; memset(&temp, 0, sizeof(temp)); - if (pdp == NULL) - pdp = &temp; + if (parent == NULL) + parent = &temp; - pdp->dv_cfdata = pcfp; - pdp->dv_cfdriver = config_cfdriver_lookup(pcfp->cf_name); - pdp->dv_unit = pcfp->cf_unit; + parent->dv_cfdata = pcfp; + parent->dv_cfdriver = config_cfdriver_lookup(pcfp->cf_name); + parent->dv_unit = pcfp->cf_unit; - if ((cf = config_search_ia(NULL, pdp, NULL, auxp)) != NULL) { + if ((cf = config_search_ia(NULL, parent, NULL, aux)) != NULL) { ca = config_cfattach_lookup(cf->cf_name, cf->cf_atname); if (ca != NULL) { - (*ca->ca_attach)(pdp, NULL, auxp); - pdp->dv_cfdata = NULL; + (*ca->ca_attach)(parent, NULL, aux); + parent->dv_cfdata = NULL; return 1; } } - pdp->dv_cfdata = NULL; + parent->dv_cfdata = NULL; return 0; } @@ -247,8 +247,8 @@ findroot(void) * Find the disk structure corresponding to the * current device. */ - devs = (device_t *)genericconf[i]->cd_devs; - if ((dkp = disk_find(devs[unit]->dv_xname)) == NULL) + devs = genericconf[i]->cd_devs; + if ((dkp = disk_find(device_xname(devs[unit]))) == NULL) continue; if (dkp->dk_driver == NULL || Index: sys/arch/atari/atari/device.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/atari/atari/device.h,v retrieving revision 1.5 diff -u -p -r1.5 device.h --- sys/arch/atari/atari/device.h 10 Apr 2010 16:12:34 -0000 1.5 +++ sys/arch/atari/atari/device.h 1 Oct 2012 17:08:48 -0000 @@ -39,7 +39,7 @@ * *and know it* (i.e. everything is really tight certain params won't be * passed in some cases and the devices will deal with it) */ -int atari_config_found(struct cfdata *, struct device *, void *, cfprint_t); +int atari_config_found(cfdata_t, device_t, void *, cfprint_t); int simple_devprint(void *, const char *); int matchname(char *, char *); /* Index: sys/arch/atari/dev/ite_cc.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/atari/dev/ite_cc.c,v retrieving revision 1.37 diff -u -p -r1.37 ite_cc.c --- sys/arch/atari/dev/ite_cc.c 5 Jun 2011 16:25:12 -0000 1.37 +++ sys/arch/atari/dev/ite_cc.c 6 Oct 2012 03:08:47 -0000 @@ -192,7 +192,7 @@ grfccmatch(device_t parent, cfdata_t cf, /* * attach: initialize the grf-structure and try to attach an ite to us. - * note : dp is NULL during early console init. + * note : self is NULL during early console init. */ void grfccattach(device_t parent, device_t self, void *aux) Index: sys/arch/atari/dev/kbdvar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/atari/dev/kbdvar.h,v retrieving revision 1.9 diff -u -p -r1.9 kbdvar.h --- sys/arch/atari/dev/kbdvar.h 20 Oct 2009 19:10:10 -0000 1.9 +++ sys/arch/atari/dev/kbdvar.h 1 Oct 2012 17:09:11 -0000 @@ -47,7 +47,7 @@ struct kbd_softc { const uint8_t *k_sendp; /* Output pointer */ int k_send_cnt; /* Chars left for output */ #if NWSKBD>0 - struct device *k_wskbddev; /* pointer to wskbd for sending strokes */ + device_t k_wskbddev; /* pointer to wskbd for sending strokes */ int k_pollingmode; /* polling mode on? whatever it isss... */ #endif void *k_sicookie; /* softint(9) cookie */ Index: sys/arch/atari/dev/lpt.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/atari/dev/lpt.c,v retrieving revision 1.34 diff -u -p -r1.34 lpt.c --- sys/arch/atari/dev/lpt.c 13 Apr 2010 09:51:07 -0000 1.34 +++ sys/arch/atari/dev/lpt.c 29 Sep 2012 10:59:35 -0000 @@ -142,12 +142,12 @@ const struct cdevsw lp_cdevsw = { /*ARGSUSED*/ static int -lpmatch(device_t pdp, cfdata_t cfp, void *auxp) +lpmatch(device_t parent, cfdata_t cf, void *aux) { static int lpt_matched = 0; /* Match at most 1 lpt unit */ - if (strcmp((char *)auxp, "lpt") || lpt_matched) + if (strcmp((char *)aux, "lpt") || lpt_matched) return 0; lpt_matched = 1; return (1); @@ -155,17 +155,17 @@ lpmatch(device_t pdp, cfdata_t cfp, void /*ARGSUSED*/ static void -lpattach(device_t pdp, device_t dp, void *auxp) +lpattach(device_t parent, device_t self, void *aux) { - struct lpt_softc *sc = device_private(dp); + struct lpt_softc *sc = device_private(self); - sc->sc_dev = dp; + sc->sc_dev = self; sc->sc_state = 0; aprint_normal("\n"); if (intr_establish(0, USER_VEC, 0, (hw_ifun_t)lpthwintr, sc) == NULL) - aprint_error_dev(dp, "Can't establish interrupt\n"); + aprint_error_dev(self, "Can't establish interrupt\n"); ym2149_strobe(1); sc->sc_sicookie = softint_establish(SOFTINT_SERIAL, lptpseudointr, sc); Index: sys/arch/atari/dev/ncr5380.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/atari/dev/ncr5380.c,v retrieving revision 1.69 diff -u -p -r1.69 ncr5380.c --- sys/arch/atari/dev/ncr5380.c 5 Jun 2011 06:33:42 -0000 1.69 +++ sys/arch/atari/dev/ncr5380.c 26 Sep 2012 21:34:18 -0000 @@ -171,8 +171,8 @@ finish_req(SC_REQ *reqp) /* * Auto config stuff.... */ -void ncr_attach(struct device *, struct device *, void *); -int ncr_match(struct device *, struct cfdata *, void *); +void ncr_attach(device_t, device_t, void *); +int ncr_match(device_t, cfdata_t, void *); /* * Tricks to make driver-name configurable Index: sys/arch/atari/include/isa_machdep.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/atari/include/isa_machdep.h,v retrieving revision 1.16 diff -u -p -r1.16 isa_machdep.h --- sys/arch/atari/include/isa_machdep.h 1 Jul 2011 21:16:40 -0000 1.16 +++ sys/arch/atari/include/isa_machdep.h 1 Oct 2012 17:09:28 -0000 @@ -78,7 +78,7 @@ typedef struct { /* * Functions provided to machine-independent ISA code. */ -void isa_attach_hook(struct device *, struct device *, +void isa_attach_hook(device_t, device_t, struct isabus_attach_args *); void isa_detach_hook(isa_chipset_tag_t, device_t); int isa_intr_alloc(isa_chipset_tag_t, int, int, int *); Index: sys/arch/atari/include/pci_machdep.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/atari/include/pci_machdep.h,v retrieving revision 1.14 diff -u -p -r1.14 pci_machdep.h --- sys/arch/atari/include/pci_machdep.h 4 Apr 2011 20:37:46 -0000 1.14 +++ sys/arch/atari/include/pci_machdep.h 1 Oct 2012 17:09:38 -0000 @@ -65,7 +65,7 @@ typedef struct { /* * Functions provided to machine-independent PCI code. */ -void pci_attach_hook(struct device *, struct device *, +void pci_attach_hook(device_t, device_t, struct pcibus_attach_args *); int pci_bus_maxdevs(pci_chipset_tag_t, int); pcitag_t pci_make_tag(pci_chipset_tag_t, int, int, int); Index: sys/arch/atari/pci/pciide_machdep.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/atari/pci/pciide_machdep.c,v retrieving revision 1.6 diff -u -p -r1.6 pciide_machdep.c --- sys/arch/atari/pci/pciide_machdep.c 4 Apr 2011 20:37:46 -0000 1.6 +++ sys/arch/atari/pci/pciide_machdep.c 9 Oct 2012 01:17:38 -0000 @@ -55,7 +55,7 @@ __KERNEL_RCSID(0, "$NetBSD: pciide_machd #include void * -pciide_machdep_compat_intr_establish(struct device *dev, +pciide_machdep_compat_intr_establish(device_t dev, const struct pci_attach_args *pa, int chan, int (*func)(void *), void *arg) { int irq; @@ -65,7 +65,7 @@ pciide_machdep_compat_intr_establish(str cookie = isa_intr_establish(NULL, irq, IST_EDGE, IPL_BIO, func, arg); if (cookie == NULL) return (NULL); - printf("%s: %s channel interrupting at irq %d\n", dev->dv_xname, + printf("%s: %s channel interrupting at irq %d\n", device_xname(dev), PCIIDE_CHANNEL_NAME(chan), irq); return (cookie); } Index: sys/arch/cats/cats/autoconf.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/cats/cats/autoconf.c,v retrieving revision 1.17 diff -u -p -r1.17 autoconf.c --- sys/arch/cats/cats/autoconf.c 29 Jul 2012 18:05:40 -0000 1.17 +++ sys/arch/cats/cats/autoconf.c 9 Oct 2012 01:24:39 -0000 @@ -120,7 +120,7 @@ cpu_rootconf(void) { set_root_device(); printf("boot device: %s\n", - booted_device != NULL ? booted_device->dv_xname : ""); + booted_device != NULL ? device_xname(booted_device) : ""); rootconf(); } @@ -162,9 +162,10 @@ cpu_configure(void) } void -device_register(struct device *dev, void *aux) +device_register(device_t dev, void *aux) { - struct device *pdev; + device_t pdev; + if ((pdev = device_parent(dev)) != NULL && device_is_a(pdev, "pci")) { /* @@ -179,7 +180,7 @@ device_register(struct device *dev, void true) == false) { printf("WARNING: unable to set " "ali1543-ide-force-compat-mode " - "property for %s\n", dev->dv_xname); + "property for %s\n", device_xname(dev)); } } } Index: sys/arch/cats/pci/pcib.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/cats/pci/pcib.c,v retrieving revision 1.15 diff -u -p -r1.15 pcib.c --- sys/arch/cats/pci/pcib.c 1 Jul 2011 20:35:31 -0000 1.15 +++ sys/arch/cats/pci/pcib.c 9 Oct 2012 01:02:34 -0000 @@ -90,7 +90,7 @@ pcibattach(device_t parent, device_t sel * callback. */ pci_devinfo(pa->pa_id, pa->pa_class, 0, devinfo, sizeof(devinfo)); - printf("%s: %s (rev. 0x%02x)\n", self->dv_xname, devinfo, + printf("%s: %s (rev. 0x%02x)\n", device_xname(self), devinfo, PCI_REVISION(pa->pa_class)); /* Set the ISA bus callback */ Index: sys/arch/cats/pci/pciide_machdep.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/cats/pci/pciide_machdep.c,v retrieving revision 1.7 diff -u -p -r1.7 pciide_machdep.c --- sys/arch/cats/pci/pciide_machdep.c 4 Apr 2011 20:37:47 -0000 1.7 +++ sys/arch/cats/pci/pciide_machdep.c 9 Oct 2012 01:17:44 -0000 @@ -57,7 +57,7 @@ __KERNEL_RCSID(0, "$NetBSD: pciide_machd #include "isa.h" void * -pciide_machdep_compat_intr_establish(struct device *dev, +pciide_machdep_compat_intr_establish(device_t dev, const struct pci_attach_args *pa, int chan, int (*func)(void *), void *arg) { #if NISA > 0 @@ -68,7 +68,7 @@ pciide_machdep_compat_intr_establish(str cookie = isa_intr_establish(NULL, irq, IST_EDGE, IPL_BIO, func, arg); if (cookie == NULL) return (NULL); - printf("%s: %s channel interrupting at irq %d\n", dev->dv_xname, + printf("%s: %s channel interrupting at irq %d\n", device_xname(dev), PCIIDE_CHANNEL_NAME(chan), irq); return (cookie); #else Index: sys/arch/cobalt/cobalt/autoconf.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/cobalt/cobalt/autoconf.c,v retrieving revision 1.30 diff -u -p -r1.30 autoconf.c --- sys/arch/cobalt/cobalt/autoconf.c 29 Jul 2012 18:05:40 -0000 1.30 +++ sys/arch/cobalt/cobalt/autoconf.c 9 Oct 2012 01:16:43 -0000 @@ -68,13 +68,13 @@ cpu_rootconf(void) { printf("boot device: %s\n", - booted_device ? booted_device->dv_xname : ""); + booted_device ? device_xname(booted_device) : ""); rootconf(); } void -device_register(struct device *dev, void *aux) +device_register(device_t dev, void *aux) { if (booted_device != NULL) Index: sys/arch/cobalt/include/pci_machdep.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/cobalt/include/pci_machdep.h,v retrieving revision 1.11 diff -u -p -r1.11 pci_machdep.h --- sys/arch/cobalt/include/pci_machdep.h 4 Apr 2011 20:37:47 -0000 1.11 +++ sys/arch/cobalt/include/pci_machdep.h 1 Oct 2012 17:10:30 -0000 @@ -66,7 +66,7 @@ struct cobalt_pci_chipset { /* * Functions provided to machine-independent PCI code. */ -void pci_attach_hook(struct device *, struct device *, +void pci_attach_hook(device_t, device_t, struct pcibus_attach_args *); int pci_bus_maxdevs(pci_chipset_tag_t, int); pcitag_t pci_make_tag(pci_chipset_tag_t, int, int, int); Index: sys/arch/cobalt/pci/pci_machdep.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/cobalt/pci/pci_machdep.c,v retrieving revision 1.32 diff -u -p -r1.32 pci_machdep.c --- sys/arch/cobalt/pci/pci_machdep.c 9 Jul 2011 16:09:02 -0000 1.32 +++ sys/arch/cobalt/pci/pci_machdep.c 1 Oct 2012 17:10:53 -0000 @@ -68,8 +68,7 @@ struct cobalt_bus_dma_tag pci_bus_dma_ta }; void -pci_attach_hook(struct device *parent, struct device *self, - struct pcibus_attach_args *pba) +pci_attach_hook(device_t parent, device_t self, struct pcibus_attach_args *pba) { /* XXX */ Index: sys/arch/cobalt/pci/pciide_machdep.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/cobalt/pci/pciide_machdep.c,v retrieving revision 1.9 diff -u -p -r1.9 pciide_machdep.c --- sys/arch/cobalt/pci/pciide_machdep.c 9 Jul 2011 16:09:03 -0000 1.9 +++ sys/arch/cobalt/pci/pciide_machdep.c 9 Oct 2012 01:17:50 -0000 @@ -39,7 +39,7 @@ __KERNEL_RCSID(0, "$NetBSD: pciide_machd #include void * -pciide_machdep_compat_intr_establish(struct device *dev, +pciide_machdep_compat_intr_establish(device_t dev, const struct pci_attach_args *pa, int chan, int (*func)(void *), void *arg) { int irq; @@ -49,7 +49,7 @@ pciide_machdep_compat_intr_establish(str cookie = icu_intr_establish(irq, IST_EDGE, IPL_BIO, func, arg); if (cookie == NULL) return NULL; - printf("%s: %s channel interrupting at irq %d\n", dev->dv_xname, + printf("%s: %s channel interrupting at irq %d\n", device_xname(dev), PCIIDE_CHANNEL_NAME(chan), irq); return cookie; } Index: sys/arch/dreamcast/dev/g2/g2busvar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/dreamcast/dev/g2/g2busvar.h,v retrieving revision 1.6 diff -u -p -r1.6 g2busvar.h --- sys/arch/dreamcast/dev/g2/g2busvar.h 19 Jul 2011 15:52:29 -0000 1.6 +++ sys/arch/dreamcast/dev/g2/g2busvar.h 1 Oct 2012 17:11:23 -0000 @@ -48,7 +48,7 @@ struct g2bus_attach_args { * Per-device G2 variables */ struct g2busdev { - struct device *gd_dev; /* back pointer to generic */ + device_t gd_dev; /* back pointer to generic */ TAILQ_ENTRY(g2busdev) gd_bchain; /* bus chain */ }; Index: sys/arch/dreamcast/dev/maple/maple.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/dreamcast/dev/maple/maple.c,v retrieving revision 1.44 diff -u -p -r1.44 maple.c --- sys/arch/dreamcast/dev/maple/maple.c 19 Jul 2011 15:52:30 -0000 1.44 +++ sys/arch/dreamcast/dev/maple/maple.c 9 Oct 2012 02:27:57 -0000 @@ -125,8 +125,7 @@ static void maple_check_subunit_change(s static void maple_check_unit_change(struct maple_softc *, struct maple_unit *); static void maple_print_unit(void *, const char *); -static int maplesubmatch(struct device *, struct cfdata *, - const int *, void *); +static int maplesubmatch(device_t, cfdata_t, const int *, void *); static int mapleprint(void *, const char *); static void maple_attach_unit(struct maple_softc *, struct maple_unit *); static void maple_detach_unit_nofix(struct maple_softc *, @@ -624,8 +623,7 @@ maple_print_unit(void *aux, const char * } static int -maplesubmatch(struct device *parent, struct cfdata *match, - const int *ldesc, void *aux) +maplesubmatch(device_t parent, cfdata_t match, const int *ldesc, void *aux) { struct maple_attach_args *ma = aux; @@ -711,7 +709,7 @@ static void maple_detach_unit_nofix(struct maple_softc *sc, struct maple_unit *u) { struct maple_func *fn; - struct device *dev; + device_t dev; struct maple_unit *u1; int port; int error; Index: sys/arch/dreamcast/dev/maple/maplevar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/dreamcast/dev/maple/maplevar.h,v retrieving revision 1.13 diff -u -p -r1.13 maplevar.h --- sys/arch/dreamcast/dev/maple/maplevar.h 17 Oct 2010 14:13:44 -0000 1.13 +++ sys/arch/dreamcast/dev/maple/maplevar.h 1 Oct 2012 17:11:41 -0000 @@ -71,7 +71,7 @@ struct maple_func { int f_funcno; struct maple_unit *f_unit; - struct device *f_dev; + device_t f_dev; /* callback */ void (*f_callback)(void *, struct maple_response *, Index: sys/arch/dreamcast/dev/maple/mms.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/dreamcast/dev/maple/mms.c,v retrieving revision 1.16 diff -u -p -r1.16 mms.c --- sys/arch/dreamcast/dev/maple/mms.c 17 Oct 2010 14:16:21 -0000 1.16 +++ sys/arch/dreamcast/dev/maple/mms.c 1 Oct 2012 17:11:55 -0000 @@ -88,7 +88,7 @@ struct mms_softc { uint32_t sc_oldbuttons; - struct device *sc_wsmousedev; + device_t sc_wsmousedev; }; static int mms_match(device_t, cfdata_t, void *); Index: sys/arch/dreamcast/include/pci_machdep.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/dreamcast/include/pci_machdep.h,v retrieving revision 1.6 diff -u -p -r1.6 pci_machdep.h --- sys/arch/dreamcast/include/pci_machdep.h 1 Aug 2010 12:42:45 -0000 1.6 +++ sys/arch/dreamcast/include/pci_machdep.h 1 Oct 2012 17:12:16 -0000 @@ -54,8 +54,8 @@ struct pci_attach_args; */ struct dreamcast_pci_chipset { void *pc_conf_v; - void (*pc_attach_hook)(struct device *, - struct device *, struct pcibus_attach_args *); + void (*pc_attach_hook)(device_t, device_t, + struct pcibus_attach_args *); int (*pc_bus_maxdevs)(void *, int); pcitag_t (*pc_make_tag)(void *, int, int, int); void (*pc_decompose_tag)(void *, pcitag_t, int *, Index: sys/arch/emips/ebus/ace_ebus.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/emips/ebus/ace_ebus.c,v retrieving revision 1.4 diff -u -p -r1.4 ace_ebus.c --- sys/arch/emips/ebus/ace_ebus.c 2 Feb 2012 19:42:58 -0000 1.4 +++ sys/arch/emips/ebus/ace_ebus.c 9 Oct 2012 01:02:34 -0000 @@ -228,11 +228,12 @@ ace_ebus_attach(device_t parent, device_ struct ebus_attach_args *ia = aux; int error; + ace->sc_dev = self; + /* * It's on the baseboard, with a dedicated interrupt line. */ ace->sc_dr = (struct _Sac *)ia->ia_vaddr; - ace->sc_dev = self; #if DEBUG printf(" virt=%p", (void*)ace->sc_dr); #endif @@ -1578,7 +1579,7 @@ static void bad144intern(struct ace_soft void aceattach(struct ace_softc *ace) { - struct device *self = ace->sc_dev; + device_t self = ace->sc_dev; char tbuf[41], pbuf[9], c, *p, *q; int i, blank; DEBUG_PRINT(("aceattach\n"), DEBUG_FUNCS | DEBUG_PROBE); @@ -1625,7 +1626,7 @@ aceattach(struct ace_softc *ace) format_bytes(pbuf, sizeof(pbuf), ace->sc_capacity * DEV_BSIZE); aprint_normal("%s: %s, %d cyl, %d head, %d sec, " "%d bytes/sect x %llu sectors\n", - self->dv_xname, pbuf, + device_xname(self), pbuf, (int)(ace->sc_capacity / (ace->sc_params.CurrentNumberOfHeads * ace->sc_params.CurrentSectorsPerTrack)), @@ -1644,7 +1645,7 @@ aceattach(struct ace_softc *ace) } int -aceactivate(struct device *self, enum devact act) +aceactivate(device_t self, enum devact act) { int rv = 0; @@ -1661,7 +1662,7 @@ aceactivate(struct device *self, enum de } int -acedetach(struct device *self, int flags) +acedetach(device_t self, int flags) { struct ace_softc *sc = device_private(self); int s, bmaj, cmaj, i, mn; Index: sys/arch/emips/ebus/flash_ebus.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/emips/ebus/flash_ebus.c,v retrieving revision 1.4 diff -u -p -r1.4 flash_ebus.c --- sys/arch/emips/ebus/flash_ebus.c 2 Feb 2012 19:42:59 -0000 1.4 +++ sys/arch/emips/ebus/flash_ebus.c 9 Oct 2012 01:02:34 -0000 @@ -223,8 +223,8 @@ struct eflash_softc { struct flash_type sc_type; }; -static int eflash_ebus_match (struct device *, struct cfdata *, void *); -static void eflash_ebus_attach (struct device *, struct device *, void *); +static int eflash_ebus_match (device_t, cfdata_t, void *); +static void eflash_ebus_attach (device_t, device_t, void *); CFATTACH_DECL_NEW(flash_ebus, sizeof (struct eflash_softc), eflash_ebus_match, eflash_ebus_attach, NULL, NULL); @@ -243,7 +243,7 @@ static int eflash_write_at(struct eflash /* Config functions */ static int -eflash_ebus_match(struct device *parent, struct cfdata *match, void *aux) +eflash_ebus_match(device_t parent, cfdata_t match, void *aux) { struct ebus_attach_args *ia = aux; struct _Flash *f = (struct _Flash *)ia->ia_vaddr; @@ -258,7 +258,7 @@ eflash_ebus_match(struct device *parent, } static void -eflash_ebus_attach(struct device *parent, struct device *self, void *aux) +eflash_ebus_attach(device_t parent, device_t self, void *aux) { struct ebus_attach_args *ia =aux; struct eflash_softc *sc = device_private(self); @@ -1407,11 +1407,11 @@ const struct cdevsw eflash_cdevsw = { void eflashgetdefaultlabel(struct eflash_softc *, struct disklabel *); void eflashgetdisklabel(struct eflash_softc *); void eflashstart(void *); -void __eflashstart(struct eflash_softc*, struct buf *); +void __eflashstart(struct eflash_softc *, struct buf *); void eflashrestart(void *); void eflashattach(struct eflash_softc *); -int eflashdetach(struct device *, int); -int eflashactivate(struct device *, enum devact); +int eflashdetach(device_t, int); +int eflashactivate(device_t, enum devact); void eflashdone(struct eflash_softc *); static void eflash_params_to_properties(struct eflash_softc *sc); @@ -1427,7 +1427,7 @@ static void eflash_wedges(void *arg); void eflashattach(struct eflash_softc *sc) { - struct device *self = sc->sc_dev; + device_t self = sc->sc_dev; char pbuf[9]; DEBUG_PRINT(("%s: eflashattach\n", device_xname(sc->sc_dev)), DEBUG_FUNCS | DEBUG_PROBE); @@ -1444,7 +1444,7 @@ eflashattach(struct eflash_softc *sc) format_bytes(pbuf, sizeof(pbuf), sc->sc_capacity * DEV_BSIZE); aprint_normal("%s: %s, %d cyl, %d head, %d sec, %d bytes/sect x %llu sectors\n", - self->dv_xname, pbuf, 1, 1, sc->sc_capacity, + device_xname(self), pbuf, 1, 1, sc->sc_capacity, DEV_BSIZE, (unsigned long long)sc->sc_capacity); eflash_params_to_properties(sc); @@ -1460,7 +1460,7 @@ eflashattach(struct eflash_softc *sc) } int -eflashactivate(struct device *self, enum devact act) +eflashactivate(device_t self, enum devact act) { int rv = 0; @@ -1480,7 +1480,7 @@ eflashactivate(struct device *self, enum } int -eflashdetach(struct device *self, int flags) +eflashdetach(device_t self, int flags) { struct eflash_softc *sc = device_private(self); int s, bmaj, cmaj, i, mn; Index: sys/arch/emips/ebus/icap_ebus.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/emips/ebus/icap_ebus.c,v retrieving revision 1.2 diff -u -p -r1.2 icap_ebus.c --- sys/arch/emips/ebus/icap_ebus.c 12 Jun 2011 03:29:33 -0000 1.2 +++ sys/arch/emips/ebus/icap_ebus.c 26 Sep 2012 21:34:18 -0000 @@ -80,8 +80,8 @@ struct icap_softc { /* Required funcs */ -static int icap_ebus_match (struct device *, struct cfdata *, void *); -static void icap_ebus_attach (struct device *, struct device *, void *); +static int icap_ebus_match (device_t, cfdata_t, void *); +static void icap_ebus_attach (device_t, device_t, void *); static dev_type_open(icapopen); static dev_type_close(icapclose); @@ -105,7 +105,7 @@ CFATTACH_DECL_NEW(icap_ebus, sizeof (str icap_ebus_match, icap_ebus_attach, NULL, NULL); static int -icap_ebus_match(struct device *parent, struct cfdata *match, void *aux) +icap_ebus_match(device_t parent, cfdata_t match, void *aux) { struct ebus_attach_args *ia = aux; struct _Icap *f = (struct _Icap *)ia->ia_vaddr; @@ -121,7 +121,7 @@ icap_ebus_match(struct device *parent, s } static void -icap_ebus_attach(struct device *parent, struct device *self, void *aux) +icap_ebus_attach(device_t parent, device_t self, void *aux) { struct icap_softc *sc = device_private(self); struct ebus_attach_args *ia =aux; Index: sys/arch/emips/ebus/stub_ebus.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/emips/ebus/stub_ebus.c,v retrieving revision 1.1 diff -u -p -r1.1 stub_ebus.c --- sys/arch/emips/ebus/stub_ebus.c 26 Jan 2011 01:18:50 -0000 1.1 +++ sys/arch/emips/ebus/stub_ebus.c 27 Sep 2012 21:38:16 -0000 @@ -53,18 +53,17 @@ * Device softc */ struct stub_softc { - struct device sc_dev; struct STUBSTRUCT *sc_dp; }; -static int stub_ebus_match (struct device *, struct cfdata *, void *); -static void stub_ebus_attach (struct device *, struct device *, void *); +static int stub_ebus_match (device_t, cfdata_t, void *); +static void stub_ebus_attach (device_t, device_t, void *); -CFATTACH_DECL(stub_ebus, sizeof (struct stub_softc), +CFATTACH_DECL_NEW(stub_ebus, sizeof (struct stub_softc), stub_ebus_match, stub_ebus_attach, NULL, NULL); static int -stub_ebus_match(struct device *parent, struct cfdata *match, void *aux) +stub_ebus_match(device_t parent, cfdata_t match, void *aux) { struct ebus_attach_args *ia = aux; struct STUBSTRUCT *f = (struct STUBSTRUCT *)ia->ia_vaddr; @@ -78,10 +77,10 @@ stub_ebus_match(struct device *parent, s } static void -stub_ebus_attach(struct device *parent, struct device *self, void *aux) +stub_ebus_attach(device_t parent, device_t self, void *aux) { struct ebus_attach_args *ia =aux; - struct stub_softc *sc = (struct stub_softc *)self; + struct stub_softc *sc = device_private(self); sc->sc_dp = (struct STUBSTRUCT*)ia->ia_vaddr; Index: sys/arch/emips/emips/clock.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/emips/emips/clock.c,v retrieving revision 1.2 diff -u -p -r1.2 clock.c --- sys/arch/emips/emips/clock.c 8 Feb 2011 20:20:11 -0000 1.2 +++ sys/arch/emips/emips/clock.c 2 Oct 2012 01:11:13 -0000 @@ -46,7 +46,7 @@ __KERNEL_RCSID(0, "$NetBSD: clock.c,v 1. #include /* Maybe someday will need more flexibility */ -extern void eclock_init(struct device *dev); +extern void eclock_init(device_t dev); /* Start the real-time and statistics clocks. Leave stathz 0 since there Index: sys/arch/emips/emips/interrupt.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/emips/emips/interrupt.c,v retrieving revision 1.4 diff -u -p -r1.4 interrupt.c --- sys/arch/emips/emips/interrupt.c 12 Jun 2011 03:21:21 -0000 1.4 +++ sys/arch/emips/emips/interrupt.c 2 Oct 2012 01:13:55 -0000 @@ -138,7 +138,7 @@ emips_aic_intr(uint32_t status, vaddr_t void -emips_intr_establish(struct device *dev, void *cookie, int level, +emips_intr_establish(device_t dev, void *cookie, int level, int (*handler) (void *, void *), void *arg) { int index = (int) cookie; Index: sys/arch/emips/emips/machdep.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/emips/emips/machdep.c,v retrieving revision 1.7 diff -u -p -r1.7 machdep.c --- sys/arch/emips/emips/machdep.c 28 Jul 2012 23:08:56 -0000 1.7 +++ sys/arch/emips/emips/machdep.c 2 Oct 2012 01:11:25 -0000 @@ -112,7 +112,7 @@ void mach_init (int, char *[], int, intp static void unimpl_bus_reset(void); static void unimpl_cons_init(void); static void unimpl_iointr(uint32_t, vaddr_t, uint32_t); -static void unimpl_intr_establish(struct device *, void *, int, +static void unimpl_intr_establish(device_t, void *, int, int (*)(void *, void *), void *); static int unimpl_memsize(void *); @@ -716,7 +716,7 @@ unimpl_iointr(uint32_t status, vaddr_t p } static void -unimpl_intr_establish(struct device *dev, void *cookie, int level, +unimpl_intr_establish(device_t dev, void *cookie, int level, int (*handler) (void *,void *), void *arg) { Index: sys/arch/emips/include/sysconf.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/emips/include/sysconf.h,v retrieving revision 1.2 diff -u -p -r1.2 sysconf.h --- sys/arch/emips/include/sysconf.h 22 Feb 2011 08:20:20 -0000 1.2 +++ sys/arch/emips/include/sysconf.h 2 Oct 2012 01:11:42 -0000 @@ -64,7 +64,7 @@ struct platform { void (*bus_reset) (void); void (*cons_init) (void); void (*iointr) (uint32_t, vaddr_t, uint32_t); - void (*intr_establish) (struct device *, void *, int, + void (*intr_establish) (device_t, void *, int, int (*)(void *, void *), void *); int (*memsize) (void *); }; @@ -91,7 +91,7 @@ void platform_not_supported (void); /* defaults */ void noop(void); -void emips_intr_establish(struct device *, void *, int, +void emips_intr_establish(device_t, void *, int, int (*)(void *, void *), void *); void emips_aic_intr(uint32_t, vaddr_t, uint32_t); #endif /* _KERNEL */ Index: sys/arch/evbarm/adi_brh/becc_mainbus.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/evbarm/adi_brh/becc_mainbus.c,v retrieving revision 1.4 diff -u -p -r1.4 becc_mainbus.c --- sys/arch/evbarm/adi_brh/becc_mainbus.c 1 Jul 2011 20:38:16 -0000 1.4 +++ sys/arch/evbarm/adi_brh/becc_mainbus.c 28 Sep 2012 15:42:56 -0000 @@ -60,17 +60,17 @@ __KERNEL_RCSID(0, "$NetBSD: becc_mainbus #include #include -int becc_mainbus_match(struct device *, struct cfdata *, void *); -void becc_mainbus_attach(struct device *, struct device *, void *); +int becc_mainbus_match(device_t, cfdata_t, void *); +void becc_mainbus_attach(device_t, device_t, void *); -CFATTACH_DECL(becc_mainbus, sizeof(struct becc_softc), +CFATTACH_DECL_NEW(becc_mainbus, sizeof(struct becc_softc), becc_mainbus_match, becc_mainbus_attach, NULL, NULL); /* There can be only one. */ int becc_mainbus_found; int -becc_mainbus_match(struct device *parent, struct cfdata *cf, void *aux) +becc_mainbus_match(device_t parent, cfdata_t cf, void *aux) { #if 0 struct mainbus_attach_args *ma = aux; @@ -91,11 +91,13 @@ becc_mainbus_match(struct device *parent } void -becc_mainbus_attach(struct device *parent, struct device *self, void *aux) +becc_mainbus_attach(device_t parent, device_t self, void *aux) { extern paddr_t physical_start; - struct becc_softc *sc = (void *) self; + struct becc_softc *sc = device_private(self); + + sc->sc_dev = self; becc_mainbus_found = 1; Index: sys/arch/evbarm/armadillo/armadillo9_com.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/evbarm/armadillo/armadillo9_com.c,v retrieving revision 1.4 diff -u -p -r1.4 armadillo9_com.c --- sys/arch/evbarm/armadillo/armadillo9_com.c 1 Jul 2011 20:38:16 -0000 1.4 +++ sys/arch/evbarm/armadillo/armadillo9_com.c 28 Sep 2012 15:46:12 -0000 @@ -53,15 +53,15 @@ __KERNEL_RCSID(0, "$NetBSD: armadillo9_c #endif #include -static int armadillo9com_match(struct device *, struct cfdata *, void *); -static void armadillo9com_attach(struct device *, struct device *, void *); +static int armadillo9com_match(device_t, cfdata_t, void *); +static void armadillo9com_attach(device_t, device_t, void *); static int armadillo9com_intr(void *); -CFATTACH_DECL(armadillo9com, sizeof(struct epcom_softc), +CFATTACH_DECL_NEW(armadillo9com, sizeof(struct epcom_softc), armadillo9com_match, armadillo9com_attach, NULL, NULL); static int -armadillo9com_match(struct device *parent, struct cfdata *match, void *aux) +armadillo9com_match(device_t parent, cfdata_t match, void *aux) { if (strcmp(match->cf_name, "epcom") == 0) return 1; @@ -69,13 +69,14 @@ armadillo9com_match(struct device *paren } static void -armadillo9com_attach(struct device *parent, struct device *self, void *aux) +armadillo9com_attach(device_t parent, device_t self, void *aux) { - struct epcom_softc *sc = (struct epcom_softc *)self; + struct epcom_softc *sc = device_private(self); struct epsoc_attach_args *sa = aux; u_int32_t pwrcnt; bus_space_handle_t ioh; + sc->sc_dev = self; sc->sc_iot = sa->sa_iot; sc->sc_hwbase = sa->sa_addr; Index: sys/arch/evbarm/armadillo/armadillo9_iic.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/evbarm/armadillo/armadillo9_iic.c,v retrieving revision 1.6 diff -u -p -r1.6 armadillo9_iic.c --- sys/arch/evbarm/armadillo/armadillo9_iic.c 10 Jun 2008 13:53:28 -0000 1.6 +++ sys/arch/evbarm/armadillo/armadillo9_iic.c 28 Sep 2012 15:47:31 -0000 @@ -47,7 +47,6 @@ __KERNEL_RCSID(0, "$NetBSD: armadillo9_i #endif struct armadillo9iic_softc { - struct device sc_dev; struct i2c_controller sc_i2c; kmutex_t sc_buslock; int sc_port; @@ -56,8 +55,8 @@ struct armadillo9iic_softc { struct epgpio_softc *sc_gpio; }; -static int armadillo9iic_match(struct device *, struct cfdata *, void *); -static void armadillo9iic_attach(struct device *, struct device *, void *); +static int armadillo9iic_match(device_t, cfdata_t, void *); +static void armadillo9iic_attach(device_t, device_t, void *); static int armadillo9iic_acquire_bus(void *, int); static void armadillo9iic_release_bus(void *, int); @@ -71,7 +70,7 @@ static void armadillo9iic_bb_set_bits(vo static void armadillo9iic_bb_set_dir(void *, uint32_t); static uint32_t armadillo9iic_bb_read_bits(void *); -CFATTACH_DECL(armadillo9iic, sizeof(struct armadillo9iic_softc), +CFATTACH_DECL_NEW(armadillo9iic, sizeof(struct armadillo9iic_softc), armadillo9iic_match, armadillo9iic_attach, NULL, NULL); static struct i2c_bitbang_ops armadillo9iic_bbops = { @@ -82,15 +81,15 @@ static struct i2c_bitbang_ops armadillo9 }; int -armadillo9iic_match(struct device *parent, struct cfdata *cf, void *aux) +armadillo9iic_match(device_t parent, cfdata_t cf, void *aux) { return 2; } void -armadillo9iic_attach(struct device *parent, struct device *self, void *aux) +armadillo9iic_attach(device_t parent, device_t self, void *aux) { - struct armadillo9iic_softc *sc = (struct armadillo9iic_softc*)self; + struct armadillo9iic_softc *sc = device_private(self); struct i2cbus_attach_args iba; #if NSEEPROM > 0 struct epgpio_attach_args *ga = aux; @@ -124,7 +123,7 @@ armadillo9iic_attach(struct device *pare printf("\n"); - config_found_ia(&sc->sc_dev, "i2cbus", &iba, iicbus_print); + config_found_ia(self, "i2cbus", &iba, iicbus_print); #if NSEEPROM > 0 /* read mac address */ @@ -132,7 +131,7 @@ armadillo9iic_attach(struct device *pare if (seeprom_bootstrap_read(&sc->sc_i2c, 0x50, 0x00, 128, armadillo9_ethaddr, ETHER_ADDR_LEN) != 0) { printf("%s: WARNING: unable to read MAC address from SEEPROM\n", - sc->sc_dev.dv_xname); + device_xname(self)); } #endif } Index: sys/arch/evbarm/armadillo/armadillo9_machdep.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/evbarm/armadillo/armadillo9_machdep.c,v retrieving revision 1.24 diff -u -p -r1.24 armadillo9_machdep.c --- sys/arch/evbarm/armadillo/armadillo9_machdep.c 22 Sep 2012 00:33:38 -0000 1.24 +++ sys/arch/evbarm/armadillo/armadillo9_machdep.c 9 Oct 2012 01:25:01 -0000 @@ -299,7 +299,7 @@ armadillo9_device_register(device_t dev, if (prop_dictionary_set(device_properties(dev), "mac-address", pd) == false) { printf("WARNING: unable to set mac-addr property " - "for %s\n", dev->dv_xname); + "for %s\n", device_xname(dev)); } prop_object_release(pd); } Index: sys/arch/evbarm/armadillo/armadillo9_pcic.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/evbarm/armadillo/armadillo9_pcic.c,v retrieving revision 1.1 diff -u -p -r1.1 armadillo9_pcic.c --- sys/arch/evbarm/armadillo/armadillo9_pcic.c 13 Nov 2005 06:33:05 -0000 1.1 +++ sys/arch/evbarm/armadillo/armadillo9_pcic.c 28 Sep 2012 15:49:00 -0000 @@ -43,15 +43,11 @@ int armadillo9pcic_debug = A9PCIC_DEBUG; #define DPRINTFN(n,x) #endif -struct armadillo9pcic_softc { - struct eppcic_softc sc_dev; -}; - -static int armadillo9pcic_match(struct device *, struct cfdata *, void *); -static void armadillo9pcic_attach(struct device *, struct device *, void *); +static int armadillo9pcic_match(device_t, cfdata_t, void *); +static void armadillo9pcic_attach(device_t, device_t, void *); -CFATTACH_DECL(armadillo9pcic, sizeof(struct armadillo9pcic_softc), - armadillo9pcic_match, armadillo9pcic_attach, NULL, NULL); +CFATTACH_DECL_NEW(armadillo9pcic, 0, + armadillo9pcic_match, armadillo9pcic_attach, NULL, NULL); static int armadillo9pcic_card_mode(void *, int); static int armadillo9pcic_power_capability(void *, int); @@ -64,13 +60,13 @@ struct eppcic_chipset_tag armadillo9pcic }; static int -armadillo9pcic_match(struct device *parent, struct cfdata *match, void *aux) +armadillo9pcic_match(device_t parent, cfdata_t match, void *aux) { return 1; } static void -armadillo9pcic_attach(struct device *parent, struct device *self, void *aux) +armadillo9pcic_attach(device_t parent, device_t self, void *aux) { struct epsoc_attach_args *sa = aux; @@ -100,7 +96,7 @@ armadillo9pcic_power_capability(void *se static int armadillo9pcic_power_ctl(void *self, int socket, int onoff) { - struct eppcic_softc *sc = (struct eppcic_softc *)self; + struct eppcic_softc *sc = device_private(self); DPRINTFN(1, ("armadillo9pcic_power_ctl: %s\n",onoff?"on":"off")); Index: sys/arch/evbarm/dev/plcom.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/evbarm/dev/plcom.c,v retrieving revision 1.42 diff -u -p -r1.42 plcom.c --- sys/arch/evbarm/dev/plcom.c 17 Aug 2012 09:38:51 -0000 1.42 +++ sys/arch/evbarm/dev/plcom.c 29 Sep 2012 11:28:40 -0000 @@ -2382,7 +2382,7 @@ plcominit(struct plcom_instance *pi, int /* Ought to do something like this, but we have no sc to dereference. */ /* XXX device_unit() abuse */ - sc->sc_set_mcr(sc->sc_set_mcr_arg, device_unit(&sc->sc_dev), + sc->sc_set_mcr(sc->sc_set_mcr_arg, device_unit(sc->sc_dev), PL01X_MCR_DTR | PL01X_MCR_RTS); #endif Index: sys/arch/evbarm/evbarm/autoconf.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/evbarm/evbarm/autoconf.c,v retrieving revision 1.13 diff -u -p -r1.13 autoconf.c --- sys/arch/evbarm/evbarm/autoconf.c 29 Jul 2012 18:05:41 -0000 1.13 +++ sys/arch/evbarm/evbarm/autoconf.c 9 Oct 2012 01:16:43 -0000 @@ -46,7 +46,7 @@ __KERNEL_RCSID(0, "$NetBSD: autoconf.c,v #include #include -void (*evbarm_device_register)(struct device *, void *); +void (*evbarm_device_register)(device_t, void *); /* * Set up the root device from the boot args @@ -55,7 +55,7 @@ void cpu_rootconf(void) { aprint_normal("boot device: %s\n", - booted_device != NULL ? booted_device->dv_xname : ""); + booted_device != NULL ? device_xname(booted_device) : ""); rootconf(); } @@ -83,7 +83,7 @@ cpu_configure(void) } void -device_register(struct device *dev, void *aux) +device_register(device_t dev, void *aux) { if (evbarm_device_register != NULL) Index: sys/arch/evbarm/g42xxeb/g42xxeb_kmkbd.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/evbarm/g42xxeb/g42xxeb_kmkbd.c,v retrieving revision 1.13 diff -u -p -r1.13 g42xxeb_kmkbd.c --- sys/arch/evbarm/g42xxeb/g42xxeb_kmkbd.c 4 Apr 2012 01:40:57 -0000 1.13 +++ sys/arch/evbarm/g42xxeb/g42xxeb_kmkbd.c 2 Oct 2012 01:15:06 -0000 @@ -67,7 +67,7 @@ __KERNEL_RCSID(0, "$NetBSD: g42xxeb_kmkb struct kmkbd_softc { device_t dev; - struct device *wskbddev; + device_t wskbddev; void *ih; /* interrupt handler */ struct callout callout; @@ -184,7 +184,7 @@ kmkbd_is_console(void) } int -kmkbd_match(struct device *parent, struct cfdata *cf, void *aux) +kmkbd_match(device_t parent, cfdata_t cf, void *aux) { return 1; } Index: sys/arch/evbarm/g42xxeb/gb225_pcic.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/evbarm/g42xxeb/gb225_pcic.c,v retrieving revision 1.12 diff -u -p -r1.12 gb225_pcic.c --- sys/arch/evbarm/g42xxeb/gb225_pcic.c 26 Jul 2011 22:52:48 -0000 1.12 +++ sys/arch/evbarm/g42xxeb/gb225_pcic.c 29 Sep 2012 11:15:22 -0000 @@ -85,8 +85,8 @@ struct opcic_softc { bus_space_handle_t sc_memctl_ioh; }; -static int opcic_match(struct device *, struct cfdata *, void *); -static void opcic_attach(struct device *, struct device *, void *); +static int opcic_match(device_t, cfdata_t, void *); +static void opcic_attach(device_t, device_t, void *); static int opcic_print(void *, const char *); static int opcic_read(struct sapcic_socket *, int); @@ -100,7 +100,7 @@ static void opcic_intr_disestablish(stru static int opcic_card_detect(void *, int); #endif -CFATTACH_DECL(opcic, sizeof(struct opcic_softc), +CFATTACH_DECL_NEW(opcic, sizeof(struct opcic_softc), opcic_match, opcic_attach, NULL, NULL); static struct sapcic_tag opcic_tag = { @@ -128,19 +128,19 @@ opcic_read_card_status(struct opcic_sock } static int -opcic_match(struct device *parent, struct cfdata *cf, void *aux) +opcic_match(device_t parent, cfdata_t cf, void *aux) { return 1; } static void -opcic_attach(struct device *parent, struct device *self, void *aux) +opcic_attach(device_t parent, device_t self, void *aux) { int i; struct pcmciabus_attach_args paa; - struct opcic_softc *sc = (struct opcic_softc *)self; - struct opio_softc *psc = (struct opio_softc *)parent; - struct obio_softc *bsd = (struct obio_softc *)device_parent(parent); + struct opcic_softc *sc = device_private(self); + struct opio_softc *psc = device_private(parent); + struct obio_softc *bsd = device_private(device_parent(parent)); bus_space_handle_t memctl_ioh = bsd->sc_memctl_ioh; bus_space_tag_t iot = psc->sc_iot; @@ -369,7 +369,7 @@ opcic_intr_disestablish(struct sapcic_so struct opio_softc *psc = device_private(device_parent(sc->sc_pc.sc_dev)); struct obio_softc *bsc = - (struct obio_softc *) device_parent(psc->sc_dev); + device_private(device_parent(psc->sc_dev)); int (* func)(void *) = ((struct obio_handler *)ih)->func; int irq = so->socket ? PCMCIA_INT : CF_INT; Index: sys/arch/evbarm/g42xxeb/gb225_slhci.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/evbarm/g42xxeb/gb225_slhci.c,v retrieving revision 1.6 diff -u -p -r1.6 gb225_slhci.c --- sys/arch/evbarm/g42xxeb/gb225_slhci.c 1 Jul 2011 20:38:17 -0000 1.6 +++ sys/arch/evbarm/g42xxeb/gb225_slhci.c 29 Sep 2012 11:30:53 -0000 @@ -60,24 +60,24 @@ struct slhci_opio_softc { void *sc_ih; }; -static int slhci_opio_match(struct device *, struct cfdata *, void *); -static void slhci_opio_attach(struct device *, struct device *, void *); +static int slhci_opio_match(device_t, cfdata_t, void *); +static void slhci_opio_attach(device_t, device_t, void *); static void slhci_opio_enable_power(void *, int); static void slhci_opio_enable_intr(void *, int); static int slhci_opio_intr(void *); -CFATTACH_DECL(slhci_opio, sizeof(struct slhci_opio_softc), +CFATTACH_DECL_NEW(slhci_opio, sizeof(struct slhci_opio_softc), slhci_opio_match, slhci_opio_attach, NULL, NULL); #define PORTSIZE (SL11_PORTSIZE*4) static int -slhci_opio_match(struct device *parent, struct cfdata *cf, void *aux) +slhci_opio_match(device_t parent, cfdata_t cf, void *aux) { struct obio_attach_args *oba = aux; bus_space_tag_t iot = &pxa2x0_a4x_bs_tag; /* Use special BS funcs */ bus_space_handle_t ioh; - struct obio_softc *bsc = (struct obio_softc *)device_parent(parent); + struct obio_softc *bsc = device_private(device_parent(parent)); struct pxa2x0_softc *psc; int type; uint32_t reg; @@ -85,7 +85,7 @@ slhci_opio_match(struct device *parent, struct slhci_softc sc; obio_peripheral_reset(bsc, 2, 0); - psc = (struct pxa2x0_softc *)device_parent(&bsc->sc_dev); + psc = device_private(device_parent(bsc->sc_dev)); reg = bus_space_read_4(psc->saip.sc_iot, psc->sc_memctl_ioh, MEMCTL_MSC2); @@ -114,14 +114,14 @@ slhci_opio_match(struct device *parent, } static void -slhci_opio_attach(struct device *parent, struct device *self, void *aux) +slhci_opio_attach(device_t parent, device_t self, void *aux) { - struct slhci_opio_softc *sc = (struct slhci_opio_softc *)self; + struct slhci_opio_softc *sc = device_private(self); struct obio_attach_args *oba = aux; struct opio_softc *psc = - (struct opio_softc *)device_parent(self); + device_private(device_parent(self)); struct obio_softc *bsc = - (struct obio_softc *)device_parent(&psc->sc_dev); + device_private(device_parent(psc->sc_dev)); bus_space_tag_t iot = oba->oba_iot; bus_space_handle_t ioh; @@ -189,8 +189,8 @@ slhci_opio_enable_intr(void *arg, int mo struct slhci_opio_softc *sc = arg; struct obio_softc *bsc; - bsc = (struct obio_softc *)device_parent( - device_parent(&sc->sc_sc.sc_bus.bdev)); + bsc = device_private(device_parent( + device_parent(sc->sc_sc.sc_bus.bdev))); if (mode == INTR_ON) obio_intr_unmask(bsc, sc->sc_ih); Index: sys/arch/evbarm/g42xxeb/if_ne_obio.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/evbarm/g42xxeb/if_ne_obio.c,v retrieving revision 1.7 diff -u -p -r1.7 if_ne_obio.c --- sys/arch/evbarm/g42xxeb/if_ne_obio.c 1 Jul 2011 20:38:17 -0000 1.7 +++ sys/arch/evbarm/g42xxeb/if_ne_obio.c 29 Sep 2012 11:16:15 -0000 @@ -228,9 +228,9 @@ void debug_obio_ne(struct dp8390_softc *sc) { struct obio_softc *osc = - (struct obio_softc *)device_parent(&sc->sc_dev); + device_private(device_parent(sc->sc_dev)); struct pxa2x0_softc *psc = - (struct pxa2x0_softc *)device_parent(&osc->sc_dev); + device_private(device_parent(osc->sc_dev)); printf( "ISR=%02x obio: pending=(%x,%x) mask=%x pending=%x mask=%x\n", bus_space_read_1(sc->sc_regt, sc->sc_regh, Index: sys/arch/evbarm/g42xxeb/obio.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/evbarm/g42xxeb/obio.c,v retrieving revision 1.10 diff -u -p -r1.10 obio.c --- sys/arch/evbarm/g42xxeb/obio.c 1 Jul 2011 20:38:17 -0000 1.10 +++ sys/arch/evbarm/g42xxeb/obio.c 29 Sep 2012 10:35:01 -0000 @@ -195,7 +195,7 @@ obio_print(void *aux, const char *name) } int -obio_match(struct device *parent, struct cfdata *match, void *aux) +obio_match(device_t parent, cfdata_t match, void *aux) { return 1; } @@ -204,7 +204,7 @@ void obio_attach(device_t parent, device_t self, void *aux) { struct obio_softc *sc = device_private(self); - struct sa11x0_attach_args *sa = (struct sa11x0_attach_args *)aux; + struct sa11x0_attach_args *sa = aux; bus_space_tag_t iot = sa->sa_iot; int i; uint16_t reg; Index: sys/arch/evbarm/gumstix/gumstix_machdep.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/evbarm/gumstix/gumstix_machdep.c,v retrieving revision 1.43 diff -u -p -r1.43 gumstix_machdep.c --- sys/arch/evbarm/gumstix/gumstix_machdep.c 22 Sep 2012 00:33:38 -0000 1.43 +++ sys/arch/evbarm/gumstix/gumstix_machdep.c 9 Oct 2012 01:25:16 -0000 @@ -1332,17 +1332,17 @@ gumstix_device_register(device_t dev, vo if (prop_dictionary_set_bool(device_properties(dev), "Ganged-power-mask-on-port1", 1) == false) { printf("WARNING: unable to set power-mask for port1" - " property for %s\n", dev->dv_xname); + " property for %s\n", device_xname(dev)); } if (prop_dictionary_set_bool(device_properties(dev), "Ganged-power-mask-on-port2", 1) == false) { printf("WARNING: unable to set power-mask for port2" - " property for %s\n", dev->dv_xname); + " property for %s\n", device_xname(dev)); } if (prop_dictionary_set_bool(device_properties(dev), "Ganged-power-mask-on-port3", 1) == false) { printf("WARNING: unable to set power-mask for port3" - " property for %s\n", dev->dv_xname); + " property for %s\n", device_xname(dev)); } } } Index: sys/arch/evbarm/gumstix/if_sm_gxio.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/evbarm/gumstix/if_sm_gxio.c,v retrieving revision 1.10 diff -u -p -r1.10 if_sm_gxio.c --- sys/arch/evbarm/gumstix/if_sm_gxio.c 1 Jul 2011 20:39:34 -0000 1.10 +++ sys/arch/evbarm/gumstix/if_sm_gxio.c 26 Sep 2012 21:15:33 -0000 @@ -103,7 +103,7 @@ struct sm_gxio_softc { void *sc_ih; }; -CFATTACH_DECL(sm_gxio, sizeof(struct sm_gxio_softc), +CFATTACH_DECL_NEW(sm_gxio, sizeof(struct sm_gxio_softc), sm_gxio_match, sm_gxio_attach, NULL, NULL); @@ -182,6 +182,7 @@ sm_gxio_attach(device_t parent, device_t if (bus_space_map(gxa->gxa_iot, gxa->gxa_addr, SMC_IOSIZE, 0, &ioh)) panic("sm_gxio_attach: can't map i/o space"); + sc->sc_dev = self; sc->sc_bst = gxa->gxa_iot; sc->sc_bsh = ioh; Index: sys/arch/evbarm/hdl_g/btn_obio.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/evbarm/hdl_g/btn_obio.c,v retrieving revision 1.3 diff -u -p -r1.3 btn_obio.c --- sys/arch/evbarm/hdl_g/btn_obio.c 21 Jan 2012 19:44:29 -0000 1.3 +++ sys/arch/evbarm/hdl_g/btn_obio.c 28 Sep 2012 15:56:14 -0000 @@ -50,7 +50,7 @@ __KERNEL_RCSID(0, "$NetBSD: btn_obio.c,v #include struct btn_obio_softc { - struct device sc_dev; + device_t sc_dev; bus_space_tag_t sc_iot; bus_space_handle_t sc_ioh; void *sc_ih; @@ -60,17 +60,17 @@ struct btn_obio_softc { int sc_mask; }; -static int btn_obio_match(struct device *, struct cfdata *, void *); -static void btn_obio_attach(struct device *, struct device *, void *); +static int btn_obio_match(device_t, cfdata_t, void *); +static void btn_obio_attach(device_t, device_t, void *); static int btn_intr(void *aux); static void btn_sysmon_pressed_event(void *arg); -CFATTACH_DECL(btn_obio, sizeof(struct btn_obio_softc), +CFATTACH_DECL_NEW(btn_obio, sizeof(struct btn_obio_softc), btn_obio_match, btn_obio_attach, NULL, NULL); static int -btn_obio_match(struct device *parent, struct cfdata *cfp, void *aux) +btn_obio_match(device_t parent, cfdata_t cf, void *aux) { /* We take it on faith that the device is there. */ @@ -78,12 +78,13 @@ btn_obio_match(struct device *parent, st } static void -btn_obio_attach(struct device *parent, struct device *self, void *aux) +btn_obio_attach(device_t parent, device_t self, void *aux) { struct obio_attach_args *oba = aux; - struct btn_obio_softc *sc = (void *)self; + struct btn_obio_softc *sc = device_private(self); int error; + sc->sc_dev = self; sc->sc_iot = oba->oba_st; error = bus_space_map(sc->sc_iot, oba->oba_addr, 1, 0, &sc->sc_ioh); if (error) { @@ -95,7 +96,7 @@ btn_obio_attach(struct device *parent, s sysmon_task_queue_init(); /* power switch */ - sc->sc_smpsw[0].smpsw_name = device_xname(&sc->sc_dev); + sc->sc_smpsw[0].smpsw_name = device_xname(self); sc->sc_smpsw[0].smpsw_type = PSWITCH_TYPE_POWER; if (sysmon_pswitch_register(&sc->sc_smpsw[0]) != 0) { aprint_error(": unable to register power button with sysmon\n"); @@ -105,7 +106,7 @@ btn_obio_attach(struct device *parent, s hdlg_enable_pldintr(INTEN_PWRSW); /* reset button */ - sc->sc_smpsw[1].smpsw_name = device_xname(&sc->sc_dev); + sc->sc_smpsw[1].smpsw_name = device_xname(self); sc->sc_smpsw[1].smpsw_type = PSWITCH_TYPE_RESET; if (sysmon_pswitch_register(&sc->sc_smpsw[1]) != 0) { aprint_error(": unable to register reset button with sysmon\n"); @@ -146,7 +147,7 @@ btn_intr(void *arg) &sc->sc_smpsw[0]); } else { aprint_error("%s: power button pressed\n", - device_xname(&sc->sc_dev)); + device_xname(sc->sc_dev)); } rv = 1; } else if (status & BTNSTAT_RESET) { @@ -158,7 +159,7 @@ btn_intr(void *arg) &sc->sc_smpsw[1]); } else { aprint_error("%s: reset button pressed\n", - device_xname(&sc->sc_dev)); + device_xname(sc->sc_dev)); } rv = 1; } Index: sys/arch/evbarm/ifpga/plcom_ifpga.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/evbarm/ifpga/plcom_ifpga.c,v retrieving revision 1.14 diff -u -p -r1.14 plcom_ifpga.c --- sys/arch/evbarm/ifpga/plcom_ifpga.c 25 Jul 2012 07:26:18 -0000 1.14 +++ sys/arch/evbarm/ifpga/plcom_ifpga.c 29 Sep 2012 12:34:18 -0000 @@ -103,7 +103,7 @@ plcom_ifpga_attach(device_t parent, devi static void plcom_ifpga_set_mcr(void *aux, int unit, u_int mcr) { - struct plcom_ifpga_softc *isc = (struct plcom_ifpga_softc *)aux; + struct plcom_ifpga_softc *isc = aux; u_int set, clr; set = clr = 0; Index: sys/arch/evbarm/imx31/imx31lk_pcic.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/evbarm/imx31/imx31lk_pcic.c,v retrieving revision 1.4 diff -u -p -r1.4 imx31lk_pcic.c --- sys/arch/evbarm/imx31/imx31lk_pcic.c 1 Jul 2011 20:41:16 -0000 1.4 +++ sys/arch/evbarm/imx31/imx31lk_pcic.c 28 Sep 2012 15:58:33 -0000 @@ -38,10 +38,10 @@ __KERNEL_RCSID(0, "$Id: imx31lk_pcic.c,v #include -static int imx31lk_pcic_match(struct device *, struct cfdata *, void *); -static void imx31lk_pcic_attach(struct device *, struct device *, void *); +static int imx31lk_pcic_match(device_t, cfdata_t, void *); +static void imx31lk_pcic_attach(device_t, device_t, void *); -CFATTACH_DECL(imx31lk_pcic, sizeof(struct imx_pcic_softc), +CFATTACH_DECL_NEW(imx31lk_pcic, sizeof(struct imx_pcic_softc), imx31lk_pcic_match, imx31lk_pcic_attach, NULL, NULL); static void imx31lk_pcic_socket_setup(struct imx_pcic_socket *); @@ -63,18 +63,20 @@ struct imx_pcic_tag imx31lk_pcic_functio }; static int -imx31lk_pcic_match(struct device *parent, struct cfdata *cf, void *aux) +imx31lk_pcic_match(device_t parent, cfdata_t cf, void *aux) { return 1; /* XXX */ } static void -imx31lk_pcic_attach(struct device *parent, struct device *self, void *aux) +imx31lk_pcic_attach(device_t parent, device_t self, void *aux) { - struct imx_pcic_softc *sc = (struct imx_pcic_softc *)self; + struct imx_pcic_softc *sc = device_private(self); struct aips_attach_args * const aipsa = aux; + sc->sc_dev = self; + printf("\n"); printf("imx_iot %p\n", aipsa->aipsa_memt); printf("imx_addr %lx\n", aipsa->aipsa_addr); @@ -109,7 +111,7 @@ imx31lk_pcic_socket_setup(struct imx_pci iot = sc->sc_iot; if (so->socket != 0) - panic("%s: CF slot %d not supported", sc->sc_dev.dv_xname, so->socket); + panic("%s: CF slot %d not supported", device_xname(sc->sc_dev), so->socket); pa = sc->sc_pa; @@ -117,7 +119,7 @@ imx31lk_pcic_socket_setup(struct imx_pci 0, &imx31lkh); if (error) { panic("%s: failed to map memory %x for imx31lk", - sc->sc_dev.dv_xname, (uint32_t)pa); + device_xname(sc->sc_dev), (uint32_t)pa); } imx31lkh += pa - trunc_page(pa); Index: sys/arch/evbarm/include/autoconf.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/evbarm/include/autoconf.h,v retrieving revision 1.6 diff -u -p -r1.6 autoconf.h --- sys/arch/evbarm/include/autoconf.h 5 Sep 2012 00:10:11 -0000 1.6 +++ sys/arch/evbarm/include/autoconf.h 2 Oct 2012 01:15:14 -0000 @@ -39,6 +39,6 @@ struct mainbus_attach_args { #endif struct device; -extern void (*evbarm_device_register)(struct device *, void *); +extern void (*evbarm_device_register)(device_t, void *); #endif /* _EVBARM_AUTOCONF_H_ */ Index: sys/arch/evbarm/iq80310/i80312_mainbus.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/evbarm/iq80310/i80312_mainbus.c,v retrieving revision 1.15 diff -u -p -r1.15 i80312_mainbus.c --- sys/arch/evbarm/iq80310/i80312_mainbus.c 3 Oct 2012 16:51:44 -0000 1.15 +++ sys/arch/evbarm/iq80310/i80312_mainbus.c 4 Oct 2012 12:59:51 -0000 @@ -60,17 +60,17 @@ __KERNEL_RCSID(0, "$NetBSD: i80312_mainb #include #include -int i80312_mainbus_match(struct device *, struct cfdata *, void *); -void i80312_mainbus_attach(struct device *, struct device *, void *); +int i80312_mainbus_match(device_t, cfdata_t, void *); +void i80312_mainbus_attach(device_t, device_t, void *); -CFATTACH_DECL(iopxs_mainbus, sizeof(struct i80312_softc), +CFATTACH_DECL_NEW(iopxs_mainbus, sizeof(struct i80312_softc), i80312_mainbus_match, i80312_mainbus_attach, NULL, NULL); /* There can be only one. */ int i80312_mainbus_found; int -i80312_mainbus_match(struct device *parent, struct cfdata *cf, void *aux) +i80312_mainbus_match(device_t parent, cfdata_t cf, void *aux) { #if 0 struct mainbus_attach_args *ma = aux; @@ -91,13 +91,14 @@ i80312_mainbus_match(struct device *pare } void -i80312_mainbus_attach(struct device *parent, struct device *self, void *aux) +i80312_mainbus_attach(device_t parent, device_t self, void *aux) { - struct i80312_softc *sc = (void *) self; + struct i80312_softc *sc = device_private(self); paddr_t memstart; psize_t memsize; i80312_mainbus_found = 1; + sc->sc_dev = self; iq80310_intr_evcnt_attach(); /* @@ -116,7 +117,7 @@ i80312_mainbus_attach(struct device *par if (bus_space_subregion(sc->sc_st, sc->sc_sh, I80312_MEM_BASE, I80312_MEM_SIZE, &sc->sc_mem_sh)) panic("%s: unable to subregion MEM registers", - sc->sc_dev.dv_xname); + device_xname(self)); /* * We have mapped the PCI I/O windows in the early bootstrap phase. Index: sys/arch/evbarm/ixdp425/ixdp425_led.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/evbarm/ixdp425/ixdp425_led.c,v retrieving revision 1.5 diff -u -p -r1.5 ixdp425_led.c --- sys/arch/evbarm/ixdp425/ixdp425_led.c 1 Jul 2011 20:42:36 -0000 1.5 +++ sys/arch/evbarm/ixdp425/ixdp425_led.c 9 Oct 2012 01:02:34 -0000 @@ -44,14 +44,13 @@ __KERNEL_RCSID(0, "$NetBSD: ixdp425_led. #include #include -static int ixdpled_match(struct device *, struct cfdata *, void *); -static void ixdpled_attach(struct device *, struct device *, void *); +static int ixdpled_match(device_t, cfdata_t, void *); +static void ixdpled_attach(device_t, device_t, void *); static void ixdpled_callout(void *); extern void ixp425_expbus_init(void); struct ixdpled_softc { - struct device sc_dev; bus_space_tag_t sc_iot; bus_space_handle_t sc_ioh; bus_addr_t sc_baseaddr; @@ -59,19 +58,19 @@ struct ixdpled_softc { struct callout sc_co; }; -CFATTACH_DECL(ixdpled, sizeof(struct ixdpled_softc), +CFATTACH_DECL_NEW(ixdpled, sizeof(struct ixdpled_softc), ixdpled_match, ixdpled_attach, NULL, NULL); static int -ixdpled_match(struct device *parent, struct cfdata *match, void *aux) +ixdpled_match(device_t parent, cfdata_t match, void *aux) { return (1); } static void -ixdpled_attach(struct device *parent, struct device *self, void *aux) +ixdpled_attach(device_t parent, device_t self, void *aux) { - struct ixdpled_softc* sc = (struct ixdpled_softc*) self; + struct ixdpled_softc* sc = device_private(self); struct ixpsip_attach_args* sa = aux; printf("\n"); @@ -81,7 +80,7 @@ ixdpled_attach(struct device *parent, st if(bus_space_map(sc->sc_iot, sa->sa_addr, sa->sa_size, 0, &sc->sc_ioh)) { - printf("%s: unable to map registers\n", self->dv_xname); + printf("%s: unable to map registers\n", device_xname(self)); return; } Index: sys/arch/evbarm/ixdp425/ixdp425_mainbus.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/evbarm/ixdp425/ixdp425_mainbus.c,v retrieving revision 1.8 diff -u -p -r1.8 ixdp425_mainbus.c --- sys/arch/evbarm/ixdp425/ixdp425_mainbus.c 28 Sep 2012 20:08:13 -0000 1.8 +++ sys/arch/evbarm/ixdp425/ixdp425_mainbus.c 3 Oct 2012 10:21:04 -0000 @@ -48,23 +48,22 @@ __KERNEL_RCSID(0, "$NetBSD: ixdp425_main #include "locators.h" -static int ixp425_mainbus_match(struct device *, struct cfdata *, void *); -static void ixp425_mainbus_attach(struct device *, struct device *, void *); +static int ixp425_mainbus_match(device_t, cfdata_t, void *); +static void ixp425_mainbus_attach(device_t, device_t, void *); -CFATTACH_DECL(ixpio_mainbus, sizeof(struct ixp425_softc), +CFATTACH_DECL_NEW(ixpio_mainbus, sizeof(struct ixp425_softc), ixp425_mainbus_match, ixp425_mainbus_attach, NULL, NULL); int -ixp425_mainbus_match(struct device *parent, struct cfdata *cf, void *aux) +ixp425_mainbus_match(device_t parent, cfdata_t cf, void *aux) { return (1); } void -ixp425_mainbus_attach(struct device *parent, struct device *self, void *aux) +ixp425_mainbus_attach(device_t parent, device_t self, void *aux) { - struct ixp425_softc *sc = (void *) self; ixp425_intr_evcnt_attach(); - ixp425_attach(sc); + ixp425_attach(self); } Index: sys/arch/evbarm/ixm1200/ixp12x0_mainbus.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/evbarm/ixm1200/ixp12x0_mainbus.c,v retrieving revision 1.9 diff -u -p -r1.9 ixp12x0_mainbus.c --- sys/arch/evbarm/ixm1200/ixp12x0_mainbus.c 1 Jul 2011 20:42:37 -0000 1.9 +++ sys/arch/evbarm/ixm1200/ixp12x0_mainbus.c 28 Sep 2012 16:04:01 -0000 @@ -48,24 +48,26 @@ __KERNEL_RCSID(0, "$NetBSD: ixp12x0_main #include "locators.h" -static int ixp12x0_mainbus_match(struct device *, struct cfdata *, void *); -static void ixp12x0_mainbus_attach(struct device *, struct device *, void *); +static int ixp12x0_mainbus_match(device_t, cfdata_t, void *); +static void ixp12x0_mainbus_attach(device_t, device_t, void *); -CFATTACH_DECL(ixpio_mainbus, sizeof(struct ixp12x0_softc), +CFATTACH_DECL_NEW(ixpio_mainbus, sizeof(struct ixp12x0_softc), ixp12x0_mainbus_match, ixp12x0_mainbus_attach, NULL, NULL); extern struct bus_space ixp12x0_bs_tag; int -ixp12x0_mainbus_match(struct device *parent, struct cfdata *cf, void *aux) +ixp12x0_mainbus_match(device_t parent, cfdata_t cf, void *aux) { return (1); } void -ixp12x0_mainbus_attach(struct device *parent, struct device *self, void *aux) +ixp12x0_mainbus_attach(device_t parent, device_t self, void *aux) { - struct ixp12x0_softc *sc = (void *) self; + struct ixp12x0_softc *sc = device_private(self); + + sc->sc_dev = self; /* * Initialize the interrupt part of our PCI chipset tag Index: sys/arch/evbarm/ixm1200/ixpcom_ixm.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/evbarm/ixm1200/ixpcom_ixm.c,v retrieving revision 1.10 diff -u -p -r1.10 ixpcom_ixm.c --- sys/arch/evbarm/ixm1200/ixpcom_ixm.c 12 Feb 2012 16:31:01 -0000 1.10 +++ sys/arch/evbarm/ixm1200/ixpcom_ixm.c 28 Sep 2012 16:04:38 -0000 @@ -53,7 +53,7 @@ __KERNEL_RCSID(0, "$NetBSD: ixpcom_ixm.c static int ixpcom_ixm_match(device_t, cfdata_t, void *); static void ixpcom_ixm_attach(device_t, device_t, void *); -CFATTACH_DECL(ixpcom_ixm, sizeof(struct ixpcom_softc), +CFATTACH_DECL_NEW(ixpcom_ixm, sizeof(struct ixpcom_softc), ixpcom_ixm_match, ixpcom_ixm_attach, NULL, NULL); static int @@ -71,6 +71,7 @@ ixpcom_ixm_attach(device_t parent, devic struct ixpcom_softc *sc = &isc->sc_ixpcom; struct ixpsip_attach_args *sa = aux; + sc->sc_dev = self; isc->sc_iot = sa->sa_iot; sc->sc_iot = sa->sa_iot; sc->sc_baseaddr = sa->sa_addr; Index: sys/arch/evbarm/ixm1200/nappi_nppb.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/evbarm/ixm1200/nappi_nppb.c,v retrieving revision 1.9 diff -u -p -r1.9 nappi_nppb.c --- sys/arch/evbarm/ixm1200/nappi_nppb.c 1 Jul 2011 20:42:37 -0000 1.9 +++ sys/arch/evbarm/ixm1200/nappi_nppb.c 29 Sep 2012 12:33:51 -0000 @@ -72,7 +72,6 @@ CFATTACH_DECL_NEW(nppb, 0, bus_space_write_4(sc->sc_st, sc->sc_sh, reg, val) struct nppb_softc { /* XXX into i21555var.h */ - struct device sc_dev; /* generic device information */ bus_space_tag_t sc_st; /* bus space tag */ bus_space_handle_t sc_sh; /* bus space handle */ @@ -112,8 +111,8 @@ nppbmatch(device_t parent, cfdata_t cf, static void nppbattach(device_t parent, device_t self, void *aux) { - struct nppb_pci_softc *psc = (struct nppb_pci_softc *)self; - struct nppb_softc *sc = (struct nppb_softc *)self; + struct nppb_pci_softc *psc = device_private(self); + struct nppb_softc *sc = &psc->psc_nppb; struct pci_attach_args *pa = aux; pci_chipset_tag_t pc = pa->pa_pc; pci_intr_handle_t ih; @@ -160,20 +159,20 @@ nppbattach(device_t parent, device_t sel /* Map and establish our interrupt */ if (pci_intr_map(pa, &ih)) { - printf("%s: couldn't map interrupt\n", sc->sc_dev.dv_xname); + printf("%s: couldn't map interrupt\n", device_xname(self)); return; } intrstr = pci_intr_string(pc, ih); sc->sc_ih = pci_intr_establish(pc, ih, IPL_NET, nppb_intr, sc); if (sc->sc_ih == NULL) { printf("%s: couldn't establish interrupt", - sc->sc_dev.dv_xname); + device_xname(self)); if (intrstr != NULL) printf(" at %s", intrstr); printf("\n"); return; } - printf("%s: interrupting at %s\n", sc->sc_dev.dv_xname, intrstr); + printf("%s: interrupting at %s\n", device_xname(self), intrstr); } Index: sys/arch/evbarm/ixm1200/nappi_nr.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/evbarm/ixm1200/nappi_nr.c,v retrieving revision 1.10 diff -u -p -r1.10 nappi_nr.c --- sys/arch/evbarm/ixm1200/nappi_nr.c 30 Jul 2012 23:35:05 -0000 1.10 +++ sys/arch/evbarm/ixm1200/nappi_nr.c 28 Sep 2012 16:05:52 -0000 @@ -47,15 +47,14 @@ __KERNEL_RCSID(0, "$NetBSD: nappi_nr.c,v #include -static int nappinr_match(struct device *, struct cfdata *, void *); -static void nappinr_attach(struct device *, struct device *, void *); +static int nappinr_match(device_t, cfdata_t, void *); +static void nappinr_attach(device_t, device_t, void *); #if 0 -static int nappinr_activate(struct device *, enum devact); +static int nappinr_activate(device_t, enum devact); #endif static void nappinr_callout(void *); struct nappinr_softc { - struct device sc_dev; bus_space_tag_t sc_iot; bus_space_handle_t sc_ioh; bus_addr_t sc_baseaddr; @@ -63,19 +62,19 @@ struct nappinr_softc { struct callout sc_co; }; -CFATTACH_DECL(nappinr, sizeof(struct nappinr_softc), +CFATTACH_DECL_NEW(nappinr, sizeof(struct nappinr_softc), nappinr_match, nappinr_attach, NULL, NULL); static int -nappinr_match(struct device *parent, struct cfdata *match, void *aux) +nappinr_match(device_t parent, cfdata_t match, void *aux) { return (1); } static void -nappinr_attach(struct device *parent, struct device *self, void *aux) +nappinr_attach(device_t parent, device_t self, void *aux) { - struct nappinr_softc* sc = (struct nappinr_softc*) self; + struct nappinr_softc* sc = device_private(self); struct ixpsip_attach_args* sa = aux; printf("\n"); @@ -83,9 +82,9 @@ nappinr_attach(struct device *parent, st sc->sc_iot = sa->sa_iot; sc->sc_baseaddr = sa->sa_addr; - if(bus_space_map(sa->sa_iot, sa->sa_addr, sa->sa_size, 0, - &sc->sc_ioh)) { - printf("%s: unable to map registers\n", self->dv_xname); + if (bus_space_map(sa->sa_iot, sa->sa_addr, sa->sa_size, 0, + &sc->sc_ioh)) { + printf("%s: unable to map registers\n", device_xname(self)); return; } @@ -95,7 +94,7 @@ nappinr_attach(struct device *parent, st #if 0 static int -nappinr_activate(struct device *self, enum devact act) +nappinr_activate(device_t self, enum devact act) { printf("nappinr_activate act=%d\n", act); return 0; @@ -106,7 +105,7 @@ static void nappinr_callout(void *arg) { static const int ptn[] = { 1, 2, 4, 8, 4, 2 }; - struct nappinr_softc* sc = arg; + struct nappinr_softc *sc = arg; uint32_t v; v = ptn[sc->sc_pos++ % 6]; Index: sys/arch/evbarm/lubbock/if_sm_obio.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/evbarm/lubbock/if_sm_obio.c,v retrieving revision 1.4 diff -u -p -r1.4 if_sm_obio.c --- sys/arch/evbarm/lubbock/if_sm_obio.c 1 Jul 2011 20:42:37 -0000 1.4 +++ sys/arch/evbarm/lubbock/if_sm_obio.c 26 Sep 2012 21:34:18 -0000 @@ -94,8 +94,8 @@ __KERNEL_RCSID(0, "$NetBSD: if_sm_obio.c #include "opt_lubbock.h" /* LUBBOCK_SMC91C96_16BIT */ -int sm_obio_match(struct device *, struct cfdata *, void *); -void sm_obio_attach(struct device *, struct device *, void *); +int sm_obio_match(device_t, cfdata_t, void *); +void sm_obio_attach(device_t, device_t, void *); struct sm_obio_softc { struct smc91cxx_softc sc_smc; /* real "smc" softc */ @@ -104,7 +104,7 @@ struct sm_obio_softc { void *sc_ih; /* interrupt handler */ }; -CFATTACH_DECL(sm_obio, sizeof(struct sm_obio_softc), sm_obio_match, +CFATTACH_DECL_NEW(sm_obio, sizeof(struct sm_obio_softc), sm_obio_match, sm_obio_attach, NULL, NULL); extern struct bus_space smobio8_bs_tag; @@ -179,7 +179,7 @@ sm_obio_match(device_t parent, cfdata_t void sm_obio_attach(device_t parent, device_t self, void *aux) { - struct sm_obio_softc *isc = (struct sm_obio_softc *)self; + struct sm_obio_softc *isc = device_private(self); struct smc91cxx_softc *sc = &isc->sc_smc; struct obio_attach_args *oba = aux; bus_space_handle_t ioh; @@ -218,6 +218,7 @@ sm_obio_attach(device_t parent, device_t #endif /* LUBBOCK_SMC91C96_16BIT */ + sc->sc_dev = self; sc->sc_bst = iot; sc->sc_bsh = ioh; Index: sys/arch/evbarm/lubbock/lubbock_lcd.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/evbarm/lubbock/lubbock_lcd.c,v retrieving revision 1.12 diff -u -p -r1.12 lubbock_lcd.c --- sys/arch/evbarm/lubbock/lubbock_lcd.c 1 Jul 2011 20:42:37 -0000 1.12 +++ sys/arch/evbarm/lubbock/lubbock_lcd.c 29 Sep 2012 12:35:00 -0000 @@ -225,7 +225,7 @@ void lcd_attach( device_t parent, device int lcd_ioctl(void *v, void *vs, u_long cmd, void *data, int flag, struct lwp *l) { - struct pxa2x0_lcd_softc *sc = (struct pxa2x0_lcd_softc *) v; + struct pxa2x0_lcd_softc *sc = v; struct obio_softc *osc = device_private(device_parent(sc->dev)); uint16_t reg; @@ -249,7 +249,7 @@ int lcd_show_screen(void *v, void *cookie, int waitok, void (*cb)(void *, int, int), void *cbarg) { - struct pxa2x0_lcd_softc *sc = (struct pxa2x0_lcd_softc *) v; + struct pxa2x0_lcd_softc *sc = v; struct obio_softc *osc = device_private(device_parent(sc->dev)); pxa2x0_lcd_show_screen(v,cookie,waitok,cb,cbarg); Index: sys/arch/evbarm/mini2440/if_dm_mini2440.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/evbarm/mini2440/if_dm_mini2440.c,v retrieving revision 1.1 diff -u -p -r1.1 if_dm_mini2440.c --- sys/arch/evbarm/mini2440/if_dm_mini2440.c 30 Jan 2012 03:28:33 -0000 1.1 +++ sys/arch/evbarm/mini2440/if_dm_mini2440.c 26 Sep 2012 21:34:18 -0000 @@ -51,14 +51,14 @@ #include "opt_mini2440.h" -int dme_ssextio_match(struct device *, struct cfdata *, void *); -void dme_ssextio_attach(struct device *, struct device *, void *); +int dme_ssextio_match(device_t, cfdata_t, void *); +void dme_ssextio_attach(device_t, device_t, void *); CFATTACH_DECL_NEW(dme_ssextio, sizeof(struct dme_softc), dme_ssextio_match, dme_ssextio_attach, NULL, NULL); int -dme_ssextio_match(struct device *parent, struct cfdata *cf, void *aux) +dme_ssextio_match(device_t parent, cfdata_t cf, void *aux) { struct s3c2xx0_attach_args *sa = aux; bus_space_tag_t iot = sa->sa_iot; @@ -104,7 +104,7 @@ out: void -dme_ssextio_attach(struct device *parent, struct device *self, void *aux) +dme_ssextio_attach(device_t parent, device_t self, void *aux) { struct dme_softc *sc = device_private(self); struct s3c2xx0_attach_args *sa = aux; Index: sys/arch/evbarm/mini2440/mini2440_lcd.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/evbarm/mini2440/mini2440_lcd.c,v retrieving revision 1.1 diff -u -p -r1.1 mini2440_lcd.c --- sys/arch/evbarm/mini2440/mini2440_lcd.c 30 Jan 2012 03:28:34 -0000 1.1 +++ sys/arch/evbarm/mini2440/mini2440_lcd.c 26 Sep 2012 21:34:18 -0000 @@ -90,8 +90,8 @@ __KERNEL_RCSID(0, "$NetBSD: mini2440_lcd #include "wsdisplay.h" -int lcd_match(struct device *, struct cfdata *, void *); -void lcd_attach(struct device *, struct device *, void *); +int lcd_match(device_t, cfdata_t, void *); +void lcd_attach(device_t, device_t, void *); #ifdef LCD_DEBUG void draw_test_pattern(struct s3c24x0_lcd_softc *, @@ -197,7 +197,7 @@ CFATTACH_DECL_NEW(lcd_ssio, sizeof (stru lcd_attach, NULL, NULL); int -lcd_match(struct device *parent, struct cfdata *cf, void *aux) +lcd_match(device_t parent, cfdata_t cf, void *aux) { struct s3c2xx0_attach_args *sa = aux; @@ -240,7 +240,7 @@ static const struct s3c24x0_lcd_panel_in }; void -lcd_attach(struct device *parent, struct device *self, void *aux) +lcd_attach(device_t parent, device_t self, void *aux) { struct s3c24x0_lcd_softc *sc = device_private(self); bus_space_tag_t iot = s3c2xx0_softc->sc_iot; Index: sys/arch/evbarm/mpcsa/mpcsa_cf.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/evbarm/mpcsa/mpcsa_cf.c,v retrieving revision 1.2 diff -u -p -r1.2 mpcsa_cf.c --- sys/arch/evbarm/mpcsa/mpcsa_cf.c 3 Jul 2008 01:15:39 -0000 1.2 +++ sys/arch/evbarm/mpcsa/mpcsa_cf.c 26 Sep 2012 21:34:18 -0000 @@ -52,8 +52,8 @@ struct mpcsa_cf_softc { struct at91pio_softc *sc_pioc; }; -static int mpcsa_cf_match(struct device *, struct cfdata *, void *); -static void mpcsa_cf_attach(struct device *, struct device *, void *); +static int mpcsa_cf_match(device_t, cfdata_t, void *); +static void mpcsa_cf_attach(device_t, device_t, void *); CFATTACH_DECL_NEW(mpcsa_cf, sizeof(struct mpcsa_cf_softc), mpcsa_cf_match, mpcsa_cf_attach, NULL, NULL); @@ -73,7 +73,7 @@ struct at91cf_chipset_tag mpcsa_cf_tag = }; static int -mpcsa_cf_match(struct device *parent, struct cfdata *match, void *aux) +mpcsa_cf_match(device_t parent, cfdata_t match, void *aux) { if (strcmp(match->cf_name, "at91cf") == 0 && strcmp(match->cf_atname, "mpcsa_cf") == 0) return 2; @@ -81,7 +81,7 @@ mpcsa_cf_match(struct device *parent, st } static void -mpcsa_cf_attach(struct device *parent, struct device *self, void *aux) +mpcsa_cf_attach(device_t parent, device_t self, void *aux) { struct mpcsa_cf_softc *sc = device_private(self); // at91cf_chipset_tag_t cscf = sc->sc_dev.sc_cscf; Index: sys/arch/evbarm/mpcsa/mpcsa_leds.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/evbarm/mpcsa/mpcsa_leds.c,v retrieving revision 1.3 diff -u -p -r1.3 mpcsa_leds.c --- sys/arch/evbarm/mpcsa/mpcsa_leds.c 19 Jun 2010 19:47:34 -0000 1.3 +++ sys/arch/evbarm/mpcsa/mpcsa_leds.c 28 Sep 2012 16:06:16 -0000 @@ -79,7 +79,6 @@ typedef struct led_state { } led_state_t; struct mpcsa_leds_softc { - struct device sc_dev; struct spi_handle *sc_sh; #if NGPIO > 0 @@ -111,7 +110,7 @@ static int mpcsa_leds_search(device_t , static int mpcsa_leds_print(void *, const char *); #endif -CFATTACH_DECL(mpcsa_leds, sizeof(struct mpcsa_leds_softc), +CFATTACH_DECL_NEW(mpcsa_leds, sizeof(struct mpcsa_leds_softc), mpcsa_leds_match, mpcsa_leds_attach, NULL, NULL); static struct mpcsa_leds_softc *mpcsa_leds_sc; Index: sys/arch/evbarm/mpcsa/mpcsa_machdep.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/evbarm/mpcsa/mpcsa_machdep.c,v retrieving revision 1.7 diff -u -p -r1.7 mpcsa_machdep.c --- sys/arch/evbarm/mpcsa/mpcsa_machdep.c 16 Aug 2012 18:22:45 -0000 1.7 +++ sys/arch/evbarm/mpcsa/mpcsa_machdep.c 9 Oct 2012 01:25:29 -0000 @@ -365,7 +365,7 @@ static void mpcsa_device_register(device device_t twi_dev = 0; i2c_tag_t i2c = 0; if (cd && (twi_dev = device_lookup(cd, 0)) != NULL) { - struct at91twi_softc *sc = (struct at91twi_softc *)twi_dev; + struct at91twi_softc *sc = device_private(twi_dev); i2c = &sc->sc_i2c; } if (i2c && seeprom_bootstrap_read(i2c, 0x50, 0x00, 4096, @@ -376,12 +376,11 @@ static void mpcsa_device_register(device if (prop_dictionary_set(device_properties(dev), "mac-address", pd) == FALSE) { printf("WARNING: unable to set mac-addr property " - "for %s\n", dev->dv_xname); + "for %s\n", device_xname(dev)); } } else { printf("%s: WARNING: unable to read MAC address from SEEPROM\n", - dev->dv_xname); + device_xname(dev)); } } } - Index: sys/arch/evbarm/mpcsa/mpcsa_spi.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/evbarm/mpcsa/mpcsa_spi.c,v retrieving revision 1.2 diff -u -p -r1.2 mpcsa_spi.c --- sys/arch/evbarm/mpcsa/mpcsa_spi.c 3 Jul 2008 01:15:39 -0000 1.2 +++ sys/arch/evbarm/mpcsa/mpcsa_spi.c 28 Sep 2012 16:07:49 -0000 @@ -49,14 +49,14 @@ int mpcsa_spi_debug = MPCSA_SPI_DEBUG; struct at91pio_softc; struct mpcsa_spi_softc { - struct at91spi_softc sc_dev; + struct at91spi_softc sc_at91spi; struct at91pio_softc *sc_pioa, *sc_piod; }; -static int mpcsa_spi_match(struct device *, struct cfdata *, void *); -static void mpcsa_spi_attach(struct device *, struct device *, void *); +static int mpcsa_spi_match(device_t, cfdata_t, void *); +static void mpcsa_spi_attach(device_t, device_t, void *); -CFATTACH_DECL(mpcsa_spi, sizeof(struct mpcsa_spi_softc), +CFATTACH_DECL_NEW(mpcsa_spi, sizeof(struct mpcsa_spi_softc), mpcsa_spi_match, mpcsa_spi_attach, NULL, NULL); static int mpcsa_spi_select(void *self, int sel); @@ -66,7 +66,7 @@ struct at91spi_machdep mpcsa_spi_tag = { }; static int -mpcsa_spi_match(struct device *parent, struct cfdata *match, void *aux) +mpcsa_spi_match(device_t parent, cfdata_t match, void *aux) { if (strcmp(match->cf_name, "at91spi") == 0 && strcmp(match->cf_atname, "mpcsa_spi") == 0) return 2; @@ -79,9 +79,9 @@ mpcsa_spi_match(struct device *parent, s static void -mpcsa_spi_attach(struct device *parent, struct device *self, void *aux) +mpcsa_spi_attach(device_t parent, device_t self, void *aux) { - struct mpcsa_spi_softc *sc = (struct mpcsa_spi_softc *)self; + struct mpcsa_spi_softc *sc = device_private(self); // do some checks if ((sc->sc_pioa = at91pio_sc(AT91_PIOA)) == NULL) { @@ -94,7 +94,7 @@ mpcsa_spi_attach(struct device *parent, } // initialize softc - sc->sc_dev.sc_spi.sct_nslaves = 3; // number of slaves + sc->sc_at91spi.sc_spi.sct_nslaves = 3; // number of slaves // configure GPIO GPIO_SPICS0(at91pio_out); GPIO_SPICS0(at91pio_set); @@ -107,7 +107,7 @@ mpcsa_spi_attach(struct device *parent, static int mpcsa_spi_select(void *self, int sel) { - struct mpcsa_spi_softc *sc = (struct mpcsa_spi_softc *)self; + struct mpcsa_spi_softc *sc = device_private(self); /* first deselect everything */ GPIO_SPICS0(at91pio_set); Index: sys/arch/evbarm/mpcsa/mpcsa_usart.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/evbarm/mpcsa/mpcsa_usart.c,v retrieving revision 1.3 diff -u -p -r1.3 mpcsa_usart.c --- sys/arch/evbarm/mpcsa/mpcsa_usart.c 13 May 2011 22:35:50 -0000 1.3 +++ sys/arch/evbarm/mpcsa/mpcsa_usart.c 28 Sep 2012 17:00:00 -0000 @@ -60,10 +60,10 @@ struct mpcsa_usart_softc { int sc_tx_busy, sc_rx_busy; }; -static int mpcsa_usart_match(struct device *, struct cfdata *, void *); -static void mpcsa_usart_attach(struct device *, struct device *, void *); +static int mpcsa_usart_match(device_t, cfdata_t, void *); +static void mpcsa_usart_attach(device_t, device_t, void *); -CFATTACH_DECL(mpcsa_usart, sizeof(struct mpcsa_usart_softc), +CFATTACH_DECL_NEW(mpcsa_usart, sizeof(struct mpcsa_usart_softc), mpcsa_usart_match, mpcsa_usart_attach, NULL, NULL); static int mpcsa_usart_enable(struct at91usart_softc *sc); @@ -96,7 +96,7 @@ conn_led(struct mpcsa_usart_softc *mpsc, } static int -mpcsa_usart_match(struct device *parent, struct cfdata *match, void *aux) +mpcsa_usart_match(device_t parent, cfdata_t match, void *aux) { if (strcmp(match->cf_name, "at91usart") == 0 && strcmp(match->cf_atname, "mpcsa_usart") == 0) return 2; @@ -105,11 +105,13 @@ mpcsa_usart_match(struct device *parent, static void -mpcsa_usart_attach(struct device *parent, struct device *self, void *aux) +mpcsa_usart_attach(device_t parent, device_t self, void *aux) { - struct mpcsa_usart_softc *sc = (struct mpcsa_usart_softc *)self; + struct mpcsa_usart_softc *sc = device_private(self); struct at91bus_attach_args *sa = aux; + sc->sc_dev.sc_dev = self; + // initialize softc if ((sc->sc_pioa = at91pio_sc(AT91_PIOA)) == NULL) { printf("no PIOA!\n"); Index: sys/arch/evbarm/nslu2/nslu2_buttons.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/evbarm/nslu2/nslu2_buttons.c,v retrieving revision 1.3 diff -u -p -r1.3 nslu2_buttons.c --- sys/arch/evbarm/nslu2/nslu2_buttons.c 28 Apr 2008 20:23:17 -0000 1.3 +++ sys/arch/evbarm/nslu2/nslu2_buttons.c 28 Sep 2012 17:06:14 -0000 @@ -45,7 +45,7 @@ __KERNEL_RCSID(0, "$NetBSD: nslu2_button #include struct slugbutt_softc { - struct device sc_dev; + device_t sc_dev; struct sysmon_pswitch sc_smpwr; struct sysmon_pswitch sc_smrst; }; @@ -74,7 +74,7 @@ power_intr(void *arg) rv = sysmon_task_queue_sched(0, power_event, sc); if (rv) { printf("%s: WARNING: unable to queue power button " - "callback: %d\n", sc->sc_dev.dv_xname, rv); + "callback: %d\n", device_xname(sc->sc_dev), rv); } return (1); @@ -99,19 +99,21 @@ reset_intr(void *arg) rv = sysmon_task_queue_sched(0, reset_event, sc); if (rv) { printf("%s: WARNING: unable to queue reset button " - "callback: %d\n", sc->sc_dev.dv_xname, rv); + "callback: %d\n", device_xname(sc->sc_dev), rv); } return (1); } static void -slugbutt_deferred(struct device *self) +slugbutt_deferred(device_t self) { - struct slugbutt_softc *sc = (struct slugbutt_softc *) self; + struct slugbutt_softc *sc = device_private(self); struct ixp425_softc *ixsc = ixp425_softc; uint32_t reg; + sc->sc_dev = self; + /* Configure the GPIO pins as inputs */ reg = GPIO_CONF_READ_4(ixsc, IXP425_GPIO_GPOER); reg |= SLUGBUTT_PWR_BIT | SLUGBUTT_RST_BIT; @@ -134,21 +136,21 @@ slugbutt_deferred(struct device *self) sysmon_task_queue_init(); - sc->sc_smpwr.smpsw_name = sc->sc_dev.dv_xname; + sc->sc_smpwr.smpsw_name = device_xname(sc->sc_dev); sc->sc_smpwr.smpsw_type = PSWITCH_TYPE_POWER; if (sysmon_pswitch_register(&sc->sc_smpwr) != 0) { printf("%s: unable to register power button with sysmon\n", - sc->sc_dev.dv_xname); + device_xname(sc->sc_dev)); return; } - sc->sc_smrst.smpsw_name = sc->sc_dev.dv_xname; + sc->sc_smrst.smpsw_name = device_xname(sc->sc_dev); sc->sc_smrst.smpsw_type = PSWITCH_TYPE_RESET; if (sysmon_pswitch_register(&sc->sc_smrst) != 0) { printf("%s: unable to register reset button with sysmon\n", - sc->sc_dev.dv_xname); + device_xname(sc->sc_dev)); return; } @@ -159,14 +161,14 @@ slugbutt_deferred(struct device *self) static int -slugbutt_match(struct device *parent, struct cfdata *cf, void *arg) +slugbutt_match(device_t parent, cfdata_t cf, void *aux) { return (slugbutt_attached == 0); } static void -slugbutt_attach(struct device *parent, struct device *self, void *arg) +slugbutt_attach(device_t parent, device_t self, void *aux) { slugbutt_attached = 1; @@ -177,5 +179,5 @@ slugbutt_attach(struct device *parent, s config_interrupts(self, slugbutt_deferred); } -CFATTACH_DECL(slugbutt, sizeof(struct slugbutt_softc), +CFATTACH_DECL_NEW(slugbutt, sizeof(struct slugbutt_softc), slugbutt_match, slugbutt_attach, NULL, NULL); Index: sys/arch/evbarm/nslu2/nslu2_iic.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/evbarm/nslu2/nslu2_iic.c,v retrieving revision 1.7 diff -u -p -r1.7 nslu2_iic.c --- sys/arch/evbarm/nslu2/nslu2_iic.c 28 Jun 2008 15:00:13 -0000 1.7 +++ sys/arch/evbarm/nslu2/nslu2_iic.c 29 Sep 2012 12:31:02 -0000 @@ -45,7 +45,6 @@ #include struct slugiic_softc { - struct device sc_dev; struct i2c_controller sc_ic; struct i2c_bitbang_ops sc_ibo; kmutex_t sc_lock; @@ -196,9 +195,9 @@ slugiic_read_bits(void *arg) } static void -slugiic_deferred_attach(struct device *device) +slugiic_deferred_attach(device_t self) { - struct slugiic_softc *sc = (struct slugiic_softc *)device; + struct slugiic_softc *sc = device_private(self); struct i2cbus_attach_args iba; uint32_t reg; @@ -212,20 +211,20 @@ slugiic_deferred_attach(struct device *d GPIO_CONF_WRITE_4(ixp425_softc, IXP425_GPIO_GPOER, reg); iba.iba_tag = &sc->sc_ic; - (void) config_found_ia(&sc->sc_dev, "i2cbus", &iba, iicbus_print); + (void) config_found_ia(self, "i2cbus", &iba, iicbus_print); } static int -slugiic_match(struct device *parent, struct cfdata *cf, void *arg) +slugiic_match(device_t parent, cfdata_t cf, void *aux) { return (1); } static void -slugiic_attach(struct device *parent, struct device *self, void *arg) +slugiic_attach(device_t parent, device_t self, void *aux) { - struct slugiic_softc *sc = (struct slugiic_softc *)self; + struct slugiic_softc *sc = device_private(self); aprint_naive("\n"); aprint_normal(": I2C bus\n"); @@ -258,5 +257,5 @@ slugiic_attach(struct device *parent, st config_interrupts(self, slugiic_deferred_attach); } -CFATTACH_DECL(slugiic, sizeof(struct slugiic_softc), +CFATTACH_DECL_NEW(slugiic, sizeof(struct slugiic_softc), slugiic_match, slugiic_attach, NULL, NULL); Index: sys/arch/evbarm/nslu2/nslu2_leds.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/evbarm/nslu2/nslu2_leds.c,v retrieving revision 1.8 diff -u -p -r1.8 nslu2_leds.c --- sys/arch/evbarm/nslu2/nslu2_leds.c 28 Apr 2008 20:23:17 -0000 1.8 +++ sys/arch/evbarm/nslu2/nslu2_leds.c 28 Sep 2012 16:13:31 -0000 @@ -62,7 +62,6 @@ __KERNEL_RCSID(0, "$NetBSD: nslu2_leds.c #define LEDBITS_STATUS (1u << GPIO_LED_STATUS) struct slugled_softc { - struct device sc_dev; void *sc_tmr_ih; struct callout sc_usb0; void *sc_usb0_ih; @@ -190,9 +189,9 @@ slugled_shutdown(void *arg) } static void -slugled_defer(struct device *self) +slugled_defer(device_t self) { - struct slugled_softc *sc = (struct slugled_softc *) self; + struct slugled_softc *sc = device_private(self); struct ixp425_softc *ixsc = ixp425_softc; uint32_t reg; int s; @@ -214,8 +213,7 @@ slugled_defer(struct device *self) splx(s); if (shutdownhook_establish(slugled_shutdown, sc) == NULL) - aprint_error("%s: WARNING - Failed to register shutdown hook\n", - sc->sc_dev.dv_xname); + aprint_error_dev(self, "WARNING - Failed to register shutdown hook\n"); callout_init(&sc->sc_usb0, 0); callout_setfunc(&sc->sc_usb0, slugled_callout, @@ -245,14 +243,14 @@ slugled_defer(struct device *self) } static int -slugled_match(struct device *parent, struct cfdata *match, void *aux) +slugled_match(device_t parent, cfdata_t cf, void *aux) { return (slugled_attached == 0); } static void -slugled_attach(struct device *parent, struct device *self, void *aux) +slugled_attach(device_t parent, device_t self, void *aux) { aprint_normal(": LED support\n"); @@ -262,5 +260,5 @@ slugled_attach(struct device *parent, st config_interrupts(self, slugled_defer); } -CFATTACH_DECL(slugled, sizeof(struct slugled_softc), +CFATTACH_DECL_NEW(slugled, sizeof(struct slugled_softc), slugled_match, slugled_attach, NULL, NULL); Index: sys/arch/evbarm/nslu2/nslu2_mainbus.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/evbarm/nslu2/nslu2_mainbus.c,v retrieving revision 1.3 diff -u -p -r1.3 nslu2_mainbus.c --- sys/arch/evbarm/nslu2/nslu2_mainbus.c 28 Sep 2012 20:08:13 -0000 1.3 +++ sys/arch/evbarm/nslu2/nslu2_mainbus.c 3 Oct 2012 10:21:20 -0000 @@ -42,19 +42,19 @@ __KERNEL_RCSID(0, "$NetBSD: nslu2_mainbu #include static int -ixp425_mainbus_match(struct device *parent, struct cfdata *cf, void *arg) +ixp425_mainbus_match(device_t parent, cfdata_t cf, void *aux) { return (1); } static void -ixp425_mainbus_attach(struct device *parent, struct device *self, void *arg) +ixp425_mainbus_attach(device_t parent, device_t self, void *aux) { ixp425_intr_evcnt_attach(); - ixp425_attach((struct ixp425_softc *) self); + ixp425_attach(self); } -CFATTACH_DECL(ixpio_mainbus, sizeof(struct ixp425_softc), +CFATTACH_DECL_NEW(ixpio_mainbus, sizeof(struct ixp425_softc), ixp425_mainbus_match, ixp425_mainbus_attach, NULL, NULL); Index: sys/arch/evbarm/osk5912/if_sm_emifs.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/evbarm/osk5912/if_sm_emifs.c,v retrieving revision 1.4 diff -u -p -r1.4 if_sm_emifs.c --- sys/arch/evbarm/osk5912/if_sm_emifs.c 1 Jul 2011 20:44:21 -0000 1.4 +++ sys/arch/evbarm/osk5912/if_sm_emifs.c 28 Sep 2012 17:07:04 -0000 @@ -53,19 +53,19 @@ __KERNEL_RCSID(0, "$NetBSD: if_sm_emifs. #include #include -static int sm_emifs_match(struct device *, struct cfdata *, void *); -static void sm_emifs_attach(struct device *, struct device *, void *); +static int sm_emifs_match(device_t, cfdata_t, void *); +static void sm_emifs_attach(device_t, device_t, void *); struct sm_emifs_softc { struct smc91cxx_softc sc_sm; void *ih; }; -CFATTACH_DECL(sm_emifs, sizeof(struct sm_emifs_softc), sm_emifs_match, +CFATTACH_DECL_NEW(sm_emifs, sizeof(struct sm_emifs_softc), sm_emifs_match, sm_emifs_attach, NULL, NULL); static int -sm_emifs_match(struct device *parent, struct cfdata *match, void *aux) +sm_emifs_match(device_t parent, cfdata_t match, void *aux) { struct emifs_attach_args *emifs = aux; @@ -77,14 +77,15 @@ sm_emifs_match(struct device *parent, st } static void -sm_emifs_attach(struct device *parent, struct device *self, void *aux) +sm_emifs_attach(device_t parent, device_t self, void *aux) { - struct sm_emifs_softc *emifssc = (struct sm_emifs_softc *)self; + struct sm_emifs_softc *emifssc = device_private(self); struct smc91cxx_softc *sc = &emifssc->sc_sm; struct emifs_attach_args *emifs = aux; bus_space_tag_t bst; bus_space_handle_t bsh; + sc->sc_dev = self; bst = emifs->emifs_iot; /* map i/o space */ @@ -96,13 +97,14 @@ sm_emifs_attach(struct device *parent, s aprint_normal("\n"); /* fill in master sc */ + sc->sc_dev = self; sc->sc_bst = bst; sc->sc_bsh = bsh; /* register the interrupt handler */ emifssc->ih = omap_gpio_intr_establish(emifs->emifs_intr, IST_EDGE_RISING, - IPL_NET, sc->sc_dev.dv_xname, + IPL_NET, device_xname(self), smc91cxx_intr, sc); if (emifssc->ih == NULL) { Index: sys/arch/evbarm/smdk2xx0/smdk2410_kbd.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/evbarm/smdk2xx0/smdk2410_kbd.c,v retrieving revision 1.7 diff -u -p -r1.7 smdk2410_kbd.c --- sys/arch/evbarm/smdk2xx0/smdk2410_kbd.c 1 Jul 2011 20:44:21 -0000 1.7 +++ sys/arch/evbarm/smdk2xx0/smdk2410_kbd.c 29 Sep 2012 11:16:33 -0000 @@ -201,9 +201,9 @@ const struct wskbd_mapdata sskbd_keymapd * SMDK2410 keyboard driver. */ struct sskbd_softc { - struct device dev; + device_t sc_dev; - struct device *wskbddev; + device_t wskbddev; void *atn_ih; /* interrupt handler for nATN */ void *spi_ih; /* interrupt handler for SPI rx */ @@ -222,10 +222,10 @@ struct sskbd_softc { }; -int sskbd_match(struct device *, struct cfdata *, void *); -void sskbd_attach(struct device *, struct device *, void *); +int sskbd_match(device_t, cfdata_t, void *); +void sskbd_attach(device_t, device_t, void *); -CFATTACH_DECL(sskbd, sizeof(struct sskbd_softc), +CFATTACH_DECL_NEW(sskbd, sizeof(struct sskbd_softc), sskbd_match, sskbd_attach, NULL, NULL); static int sskbd_enable(void *, int); @@ -254,21 +254,23 @@ const struct wskbd_consops sskbd_consops #endif int -sskbd_match(struct device *parent, struct cfdata *cf, void *aux) +sskbd_match(device_t parent, cfdata_t cf, void *aux) { return 1; } void -sskbd_attach(struct device *parent, struct device *self, void *aux) +sskbd_attach(device_t parent, device_t self, void *aux) { - struct sskbd_softc *sc = (void *)self; + struct sskbd_softc *sc = device_private(self); struct ssspi_attach_args *spia = aux; uint32_t reg; bus_space_handle_t gpioh; bus_space_tag_t iot; struct wskbddev_attach_args a; + sc->sc_dev = self; + aprint_normal("\n"); sc->iot = iot = spia->spia_iot; @@ -326,7 +328,7 @@ sskbd_attach(struct device *parent, stru aprint_error_dev(self, "can't establish interrupt handler\n"); /* setup SPI control register, and prescaler */ - s3c24x0_spi_setup((struct ssspi_softc *)device_parent(self), + s3c24x0_spi_setup(device_private(device_parent(self)), SPCON_SMOD_INT | SPCON_ENSCK | SPCON_MSTR | SPCON_IDLELOW_RISING, 100*1000, 0); @@ -447,7 +449,7 @@ sskbd_enable(void *v, int on) struct sskbd_softc *sc = v; #ifdef KBD_DEBUG - printf("%s: enable\n", device_xname(sc->dev)); + printf("%s: enable\n", device_xname(sc->sc_dev)); #endif #if 0 Index: sys/arch/evbarm/smdk2xx0/smdk2410_lcd.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/evbarm/smdk2xx0/smdk2410_lcd.c,v retrieving revision 1.7 diff -u -p -r1.7 smdk2410_lcd.c --- sys/arch/evbarm/smdk2xx0/smdk2410_lcd.c 30 Jan 2012 03:28:34 -0000 1.7 +++ sys/arch/evbarm/smdk2xx0/smdk2410_lcd.c 26 Sep 2012 21:34:18 -0000 @@ -63,8 +63,8 @@ __KERNEL_RCSID(0, "$NetBSD: smdk2410_lcd #include "locators.h" #include "wsdisplay.h" -int lcd_match(struct device *, struct cfdata *, void *); -void lcd_attach(struct device *, struct device *, void *); +int lcd_match(device_t, cfdata_t, void *); +void lcd_attach(device_t, device_t, void *); #ifdef LCD_DEBUG void draw_test_pattern(struct s3c24x0_lcd_softc *, @@ -170,7 +170,7 @@ CFATTACH_DECL_NEW(lcd_ssio, sizeof (stru lcd_attach, NULL, NULL); int -lcd_match(struct device *parent, struct cfdata *cf, void *aux) +lcd_match(device_t parent, cfdata_t cf, void *aux) { struct s3c2xx0_attach_args *sa = aux; @@ -212,7 +212,7 @@ static const struct s3c24x0_lcd_panel_in }; void -lcd_attach(struct device *parent, struct device *self, void *aux) +lcd_attach(device_t parent, device_t self, void *aux) { struct s3c24x0_lcd_softc *sc = device_private(self); bus_space_tag_t iot = s3c2xx0_softc->sc_iot; Index: sys/arch/evbarm/stand/boot2440/s3csdi.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/evbarm/stand/boot2440/s3csdi.c,v retrieving revision 1.2 diff -u -p -r1.2 s3csdi.c --- sys/arch/evbarm/stand/boot2440/s3csdi.c 20 Jul 2012 14:53:52 -0000 1.2 +++ sys/arch/evbarm/stand/boot2440/s3csdi.c 29 Sep 2012 11:42:44 -0000 @@ -414,7 +414,7 @@ sssdi_perform_pio_write(struct sdmmc_com /* Acknowledge the timeout*/ bus_space_write_4(sc->iot, sc->ioh, SDI_DAT_STA, SDIDATSTA_DATA_TIMEOUT); - printf("%s: Data timeout\n", device_xname(&sc->dev)); + printf("%s: Data timeout\n", device_xname(sc->dev)); break; } Index: sys/arch/evbarm/tisdp24xx/if_sm_gpmc.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/evbarm/tisdp24xx/if_sm_gpmc.c,v retrieving revision 1.4 diff -u -p -r1.4 if_sm_gpmc.c --- sys/arch/evbarm/tisdp24xx/if_sm_gpmc.c 1 Jul 2011 20:45:45 -0000 1.4 +++ sys/arch/evbarm/tisdp24xx/if_sm_gpmc.c 9 Oct 2012 01:02:34 -0000 @@ -60,8 +60,8 @@ __KERNEL_RCSID(0, "$NetBSD: if_sm_gpmc.c #include #include -static int sm_gpmc_match(struct device *, struct cfdata *, void *); -static void sm_gpmc_attach(struct device *, struct device *, void *); +static int sm_gpmc_match(device_t, cfdata_t, void *); +static void sm_gpmc_attach(device_t, device_t, void *); struct sm_gpmc_softc { struct smc91cxx_softc sc_sm; @@ -70,11 +70,11 @@ struct sm_gpmc_softc { void *ih; }; -CFATTACH_DECL(sm_gpmc, sizeof(struct sm_gpmc_softc), sm_gpmc_match, +CFATTACH_DECL_NEW(sm_gpmc, sizeof(struct sm_gpmc_softc), sm_gpmc_match, sm_gpmc_attach, NULL, NULL); static int -sm_gpmc_match(struct device *parent, struct cfdata *match, void *aux) +sm_gpmc_match(device_t parent, cfdata_t match, void *aux) { struct gpmc_attach_args *gpmc = aux; @@ -106,9 +106,9 @@ sm_gpmc_intr(void *arg) } static void -sm_gpmc_attach(struct device *parent, struct device *self, void *aux) +sm_gpmc_attach(device_t parent, device_t self, void *aux) { - struct sm_gpmc_softc *gpmcsc = (struct sm_gpmc_softc *)self; + struct sm_gpmc_softc *gpmcsc = device_private(self); struct smc91cxx_softc *sc = &gpmcsc->sc_sm; struct gpmc_attach_args *gpmc = aux; bus_space_tag_t bst; @@ -127,6 +127,7 @@ sm_gpmc_attach(struct device *parent, st aprint_normal("\n"); /* fill in master sc */ + sc->sc_dev = self; sc->sc_bst = bst; sc->sc_bsh = bsh; @@ -141,9 +142,9 @@ sm_gpmc_attach(struct device *parent, st } evcnt_attach_dynamic(&gpmcsc->sc_spurious_ev, EVCNT_TYPE_INTR, NULL, - self->dv_xname, "spurious intr"); + device_xname(self), "spurious intr"); evcnt_attach_dynamic(&gpmcsc->sc_incomplete_ev, EVCNT_TYPE_INTR, NULL, - self->dv_xname, "incomplete intr"); + device_xname(self), "incomplete intr"); SMC_SELECT_BANK(sc, 1); for (count = 0; count < ETHER_ADDR_LEN; count += 2) { Index: sys/arch/evbarm/tsarm/epcom_ts.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/evbarm/tsarm/epcom_ts.c,v retrieving revision 1.6 diff -u -p -r1.6 epcom_ts.c --- sys/arch/evbarm/tsarm/epcom_ts.c 12 Feb 2012 16:34:08 -0000 1.6 +++ sys/arch/evbarm/tsarm/epcom_ts.c 28 Sep 2012 15:46:47 -0000 @@ -53,7 +53,7 @@ __KERNEL_RCSID(0, "$NetBSD: epcom_ts.c,v static int epcom_ts_match(device_t, cfdata_t, void *); static void epcom_ts_attach(device_t, device_t, void *); -CFATTACH_DECL(epcom_ts, sizeof(struct epcom_ts_softc), +CFATTACH_DECL_NEW(epcom_ts, sizeof(struct epcom_ts_softc), epcom_ts_match, epcom_ts_attach, NULL, NULL); static int @@ -73,6 +73,7 @@ epcom_ts_attach(device_t parent, device_ u_int32_t pwrcnt; bus_space_handle_t ioh; + sc->sc_dev = self; esc->sc_iot = sa->sa_iot; sc->sc_iot = sa->sa_iot; sc->sc_hwbase = sa->sa_addr; Index: sys/arch/evbarm/tsarm/toastersensors.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/evbarm/tsarm/toastersensors.c,v retrieving revision 1.9 diff -u -p -r1.9 toastersensors.c --- sys/arch/evbarm/tsarm/toastersensors.c 1 Jul 2011 19:11:34 -0000 1.9 +++ sys/arch/evbarm/tsarm/toastersensors.c 28 Sep 2012 16:22:20 -0000 @@ -59,7 +59,6 @@ __KERNEL_RCSID(0, "$NetBSD: toastersenso #include struct toastersensors_softc { - struct device sc_dev; struct matrixkp_softc sc_mxkp; bus_space_tag_t sc_iot; bus_space_handle_t sc_gpioh; @@ -103,16 +102,16 @@ struct wskbd_mapdata mxkp_keymapdata = { KB_US, }; -static int toastersensors_match(struct device *, struct cfdata *, void *); -static void toastersensors_attach(struct device *, struct device *, void *); +static int toastersensors_match(device_t, cfdata_t, void *); +static void toastersensors_attach(device_t, device_t, void *); static void toastersensors_scankeys(struct matrixkp_softc *, u_int32_t *); static void toastersensors_poll(void *); -CFATTACH_DECL(toastersensors, sizeof(struct toastersensors_softc), +CFATTACH_DECL_NEW(toastersensors, sizeof(struct toastersensors_softc), toastersensors_match, toastersensors_attach, NULL, NULL); static int -toastersensors_match(struct device *parent, struct cfdata *match, void *aux) +toastersensors_match(device_t parent, cfdata_t match, void *aux) { return 1; } @@ -149,9 +148,9 @@ toastersensors_poll(void *arg) } static void -toastersensors_attach(struct device *parent, struct device *self, void *aux) +toastersensors_attach(device_t parent, device_t self, void *aux) { - struct toastersensors_softc *sc = (void *)self; + struct toastersensors_softc *sc = device_private(self); struct tspld_attach_args *taa = aux; struct wskbddev_attach_args wa; const struct sysctlnode *node, *datnode; @@ -176,25 +175,25 @@ toastersensors_attach(struct device *par GPIO_CLEARBITS(PBDDR, 0x3f); /* tristate all lines */ aprint_normal(": internal toaster sensor inputs\n"); - aprint_normal("%s: using signal DIO_0 for toast down sensor\n", sc->sc_dev.dv_xname); - aprint_normal("%s: using signals DIO_1-DIO_5 for panel buttons\n", sc->sc_dev.dv_xname); - aprint_normal("%s: using 12-bit MAX197-ADC channel 0 for burnlevel knob\n", sc->sc_dev.dv_xname); + aprint_normal_dev(self, "using signal DIO_0 for toast down sensor\n"); + aprint_normal_dev(self, "using signals DIO_1-DIO_5 for panel buttons\n"); + aprint_normal_dev(self, "using 12-bit MAX197-ADC channel 0 for burnlevel knob\n"); if (sysctl_createv(NULL, 0, NULL, NULL, CTLFLAG_PERMANENT, CTLTYPE_NODE, "hw", NULL, NULL, 0, NULL, 0, CTL_HW, CTL_EOL) != 0) { printf("%s: could not create sysctl\n", - sc->sc_dev.dv_xname); + device_xname(self)); return; } if (sysctl_createv(NULL, 0, NULL, &node, - 0, CTLTYPE_NODE, sc->sc_dev.dv_xname, + 0, CTLTYPE_NODE, device_xname(self), NULL, NULL, 0, NULL, 0, CTL_HW, CTL_CREATE, CTL_EOL) != 0) { printf("%s: could not create sysctl\n", - sc->sc_dev.dv_xname); + device_xname(self)); return; } @@ -209,7 +208,7 @@ toastersensors_attach(struct device *par CTL_CREATE, CTL_EOL)) != 0) { printf("%s: could not create sysctl\n", - sc->sc_dev.dv_xname); + device_xname(self)); return; } @@ -223,7 +222,7 @@ toastersensors_attach(struct device *par CTL_CREATE, CTL_EOL)) \ != 0) { \ printf("%s: could not create sysctl\n", \ - sc->sc_dev.dv_xname); \ + device_xname(self)); \ return; \ } \ \ @@ -237,7 +236,7 @@ toastersensors_attach(struct device *par CTL_CREATE, CTL_EOL)) \ != 0) { \ printf("%s: could not create sysctl\n", \ - sc->sc_dev.dv_xname); \ + device_xname(self)); \ return; \ } \ @@ -270,7 +269,7 @@ toastersensors_attach(struct device *par static void toastersensors_scankeys(struct matrixkp_softc *mxkp_sc, u_int32_t *keys) { - struct toastersensors_softc *sc = (void *)mxkp_sc->sc_dev; + struct toastersensors_softc *sc = device_private(mxkp_sc->sc_dev); u_int32_t val = GPIO_GET(PBDR) & 0x3f; /* Index: sys/arch/evbarm/tsarm/tskp.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/evbarm/tsarm/tskp.c,v retrieving revision 1.8 diff -u -p -r1.8 tskp.c --- sys/arch/evbarm/tsarm/tskp.c 1 Jul 2011 19:11:34 -0000 1.8 +++ sys/arch/evbarm/tsarm/tskp.c 28 Sep 2012 16:22:50 -0000 @@ -58,7 +58,6 @@ __KERNEL_RCSID(0, "$NetBSD: tskp.c,v 1.8 #include struct tskp_softc { - struct device sc_dev; struct matrixkp_softc sc_mxkp; bus_space_tag_t sc_iot; bus_space_handle_t sc_gpioh; @@ -98,15 +97,15 @@ struct wskbd_mapdata mxkp_keymapdata = { KB_US, }; -static int tskp_match(struct device *, struct cfdata *, void *); -static void tskp_attach(struct device *, struct device *, void *); +static int tskp_match(device_t, cfdata_t, void *); +static void tskp_attach(device_t, device_t, void *); static void tskp_scankeys(struct matrixkp_softc *, u_int32_t *); -CFATTACH_DECL(tskp, sizeof(struct tskp_softc), +CFATTACH_DECL_NEW(tskp, sizeof(struct tskp_softc), tskp_match, tskp_attach, NULL, NULL); static int -tskp_match(struct device *parent, struct cfdata *match, void *aux) +tskp_match(device_t parent, cfdata_t match, void *aux) { return 1; } @@ -124,9 +123,9 @@ tskp_match(struct device *parent, struct (EP93XX_GPIO_ ## x), GPIO_GET(x) & (~(y))) static void -tskp_attach(struct device *parent, struct device *self, void *aux) +tskp_attach(device_t parent, device_t self, void *aux) { - struct tskp_softc *sc = (void *)self; + struct tskp_softc *sc = device_private(self); struct tspld_attach_args *taa = aux; struct wskbddev_attach_args wa; @@ -157,7 +156,7 @@ tskp_attach(struct device *parent, struc static void tskp_scankeys(struct matrixkp_softc *mxkp_sc, u_int32_t *keys) { - struct tskp_softc *sc = (void *)mxkp_sc->sc_dev; + struct tskp_softc *sc = device_private(mxkp_sc->sc_dev); u_int32_t pos; for(pos = 0; pos < 4; pos++) { Index: sys/arch/evbarm/tsarm/tslcd.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/evbarm/tsarm/tslcd.c,v retrieving revision 1.14 diff -u -p -r1.14 tslcd.c --- sys/arch/evbarm/tsarm/tslcd.c 1 Jul 2011 19:11:34 -0000 1.14 +++ sys/arch/evbarm/tsarm/tslcd.c 28 Sep 2012 16:23:44 -0000 @@ -58,14 +58,13 @@ __KERNEL_RCSID(0, "$NetBSD: tslcd.c,v 1. #include struct tslcd_softc { - struct device sc_dev; struct hd44780_chip sc_hlcd; bus_space_tag_t sc_iot; bus_space_handle_t sc_gpioh; }; -static int tslcd_match(struct device *, struct cfdata *, void *); -static void tslcd_attach(struct device *, struct device *, void *); +static int tslcd_match(device_t, cfdata_t, void *); +static void tslcd_attach(device_t, device_t, void *); static void tslcd_writereg(struct hd44780_chip *, u_int32_t, u_int32_t, u_int8_t); static u_int8_t tslcd_readreg(struct hd44780_chip *, u_int32_t, u_int32_t); @@ -86,7 +85,7 @@ extern const struct wsdisplay_emulops hl extern const struct wsdisplay_accessops hlcd_accessops; extern struct cfdriver tslcd_cd; -CFATTACH_DECL(tslcd, sizeof(struct tslcd_softc), +CFATTACH_DECL_NEW(tslcd, sizeof(struct tslcd_softc), tslcd_match, tslcd_attach, NULL, NULL); static const struct wsscreen_descr tslcd_stdscreen = { @@ -106,7 +105,7 @@ static const struct wsscreen_list tslcd_ }; static int -tslcd_match(struct device *parent, struct cfdata *match, void *aux) +tslcd_match(device_t parent, cfdata_t match, void *aux) { return 1; } @@ -124,9 +123,9 @@ tslcd_match(struct device *parent, struc (EP93XX_GPIO_ ## x), GPIO_GET(x) & (~(y))) static void -tslcd_attach(struct device *parent, struct device *self, void *aux) +tslcd_attach(device_t parent, device_t self, void *aux) { - struct tslcd_softc *sc = (void *)self; + struct tslcd_softc *sc = device_private(self); struct tspld_attach_args *taa = aux; struct wsemuldisplaydev_attach_args waa; @@ -162,7 +161,7 @@ tslcd_attach(struct device *parent, stru static void tslcd_writereg(struct hd44780_chip *hd, u_int32_t en, u_int32_t rs, u_int8_t cmd) { - struct tslcd_softc *sc = (struct tslcd_softc *)hd->sc_dev; + struct tslcd_softc *sc = device_private(hd->sc_dev); u_int8_t ctrl; if (hd->sc_dev_ok == 0) @@ -208,7 +207,7 @@ tslcd_writereg(struct hd44780_chip *hd, static u_int8_t tslcd_readreg(struct hd44780_chip *hd, u_int32_t en, u_int32_t rs) { - struct tslcd_softc *sc = (struct tslcd_softc *)hd->sc_dev; + struct tslcd_softc *sc = device_private(hd->sc_dev); u_int8_t ret, ctrl; if (hd->sc_dev_ok == 0) Index: sys/arch/evbarm/tsarm/tspld.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/evbarm/tsarm/tspld.c,v retrieving revision 1.21 diff -u -p -r1.21 tspld.c --- sys/arch/evbarm/tsarm/tspld.c 1 Jul 2011 19:11:34 -0000 1.21 +++ sys/arch/evbarm/tsarm/tspld.c 2 Oct 2012 01:15:35 -0000 @@ -56,16 +56,15 @@ __KERNEL_RCSID(0, "$NetBSD: tspld.c,v 1. #include #include -int tspldmatch (struct device *, struct cfdata *, void *); -void tspldattach (struct device *, struct device *, void *); +int tspldmatch (device_t, cfdata_t, void *); +void tspldattach (device_t, device_t, void *); static int tspld_wdog_setmode (struct sysmon_wdog *); static int tspld_wdog_tickle (struct sysmon_wdog *); -int tspld_search (struct device *, struct cfdata *, const int *, void *); +int tspld_search (device_t, cfdata_t, const int *, void *); int tspld_print (void *, const char *); void boardtemp_poll (void *); struct tspld_softc { - struct device sc_dev; bus_space_tag_t sc_iot; bus_space_handle_t sc_wdogfeed_ioh; bus_space_handle_t sc_wdogctrl_ioh; @@ -86,10 +85,10 @@ struct tspld_softc { struct callout boardtemp_callout; }; -CFATTACH_DECL(tspld, sizeof(struct tspld_softc), +CFATTACH_DECL_NEW(tspld, sizeof(struct tspld_softc), tspldmatch, tspldattach, NULL, NULL); -void tspld_callback(struct device *); +void tspld_callback(device_t); #define GPIO_GET(x) bus_space_read_4(sc->sc_iot, sc->sc_gpioh, \ (EP93XX_GPIO_ ## x)) @@ -116,7 +115,7 @@ void tspld_callback(struct device *); (EP93XX_SSP_ ## x), SSP_GET(x) & (~(y))) int -tspldmatch(struct device *parent, struct cfdata *match, void *aux) +tspldmatch(device_t parent, cfdata_t match, void *aux) { return 1; @@ -146,10 +145,10 @@ boardtemp_poll(void *arg) } void -tspldattach(struct device *parent, struct device *self, void *aux) +tspldattach(device_t parent, device_t self, void *aux) { int i, rev, features, jp, model; - struct tspld_softc *sc = (struct tspld_softc *)self; + struct tspld_softc *sc = device_private(self); bus_space_handle_t ioh; const struct sysctlnode *node; @@ -158,16 +157,16 @@ tspldattach(struct device *parent, struc NULL, NULL, 0, NULL, 0, CTL_HW, CTL_EOL) != 0) { printf("%s: could not create sysctl\n", - sc->sc_dev.dv_xname); + device_xname(self)); return; } if (sysctl_createv(NULL, 0, NULL, &node, - 0, CTLTYPE_NODE, sc->sc_dev.dv_xname, + 0, CTLTYPE_NODE, device_xname(self), NULL, NULL, 0, NULL, 0, CTL_HW, CTL_CREATE, CTL_EOL) != 0) { printf("%s: could not create sysctl\n", - sc->sc_dev.dv_xname); + device_xname(self)); return; } @@ -183,7 +182,7 @@ tspldattach(struct device *parent, struc CTL_HW, node->sysctl_num, CTL_CREATE, CTL_EOL)) != 0) { printf("%s: could not create sysctl\n", - sc->sc_dev.dv_xname); + device_xname(self)); return; } bus_space_unmap(sc->sc_iot, ioh, 2); @@ -201,7 +200,7 @@ tspldattach(struct device *parent, struc CTL_HW, node->sysctl_num, CTL_CREATE, CTL_EOL)) != 0) { printf("%s: could not create sysctl\n", - sc->sc_dev.dv_xname); + device_xname(self)); return; } bus_space_unmap(sc->sc_iot, ioh, 2); @@ -224,7 +223,7 @@ tspldattach(struct device *parent, struc CTL_HW, node->sysctl_num, CTL_CREATE, CTL_EOL)) != 0) { printf("%s: could not create sysctl\n", - sc->sc_dev.dv_xname); + device_xname(self)); return; } if ((i = sysctl_createv(NULL, 0, NULL, NULL, @@ -234,7 +233,7 @@ tspldattach(struct device *parent, struc CTL_HW, node->sysctl_num, CTL_CREATE, CTL_EOL)) != 0) { printf("%s: could not create sysctl\n", - sc->sc_dev.dv_xname); + device_xname(self)); return; } bus_space_map(sc->sc_iot, TS7XXX_IO16_HWBASE + TS7XXX_STATUS2, 2, 0, @@ -255,7 +254,7 @@ tspldattach(struct device *parent, struc CTL_HW, node->sysctl_num, CTL_CREATE, CTL_EOL)) != 0) { printf("%s: could not create sysctl\n", - sc->sc_dev.dv_xname); + device_xname(self)); return; } sc->sc_com2mode = "rs232"; @@ -266,7 +265,7 @@ tspldattach(struct device *parent, struc CTL_HW, node->sysctl_num, CTL_CREATE, CTL_EOL)) != 0) { printf("%s: could not create sysctl\n", - sc->sc_dev.dv_xname); + device_xname(self)); return; } if ((i = sysctl_createv(NULL, 0, NULL, NULL, @@ -276,7 +275,7 @@ tspldattach(struct device *parent, struc CTL_HW, node->sysctl_num, CTL_CREATE, CTL_EOL)) != 0) { printf("%s: could not create sysctl\n", - sc->sc_dev.dv_xname); + device_xname(self)); return; } printf(": Technologic Systems %s rev %c, features 0x%x", @@ -300,7 +299,7 @@ tspldattach(struct device *parent, struc CTL_HW, node->sysctl_num, CTL_CREATE, CTL_EOL)) != 0) { printf("%s: could not create sysctl\n", - sc->sc_dev.dv_xname); + device_xname(self)); return; } if ((i = sysctl_createv(NULL, 0, NULL, NULL, @@ -310,7 +309,7 @@ tspldattach(struct device *parent, struc CTL_HW, node->sysctl_num, CTL_CREATE, CTL_EOL)) != 0) { printf("%s: could not create sysctl\n", - sc->sc_dev.dv_xname); + device_xname(self)); return; } if ((i = sysctl_createv(NULL, 0, NULL, NULL, @@ -320,7 +319,7 @@ tspldattach(struct device *parent, struc CTL_HW, node->sysctl_num, CTL_CREATE, CTL_EOL)) != 0) { printf("%s: could not create sysctl\n", - sc->sc_dev.dv_xname); + device_xname(self)); return; } if ((i = sysctl_createv(NULL, 0, NULL, NULL, @@ -330,7 +329,7 @@ tspldattach(struct device *parent, struc CTL_HW, node->sysctl_num, CTL_CREATE, CTL_EOL)) != 0) { printf("%s: could not create sysctl\n", - sc->sc_dev.dv_xname); + device_xname(self)); return; } if ((i = sysctl_createv(NULL, 0, NULL, NULL, @@ -340,7 +339,7 @@ tspldattach(struct device *parent, struc CTL_HW, node->sysctl_num, CTL_CREATE, CTL_EOL)) != 0) { printf("%s: could not create sysctl\n", - sc->sc_dev.dv_xname); + device_xname(self)); return; } if ((i = sysctl_createv(NULL, 0, NULL, NULL, @@ -350,10 +349,10 @@ tspldattach(struct device *parent, struc CTL_HW, node->sysctl_num, CTL_CREATE, CTL_EOL)) != 0) { printf("%s: could not create sysctl\n", - sc->sc_dev.dv_xname); + device_xname(self)); return; } - printf("%s: jumpers 0x%x", sc->sc_dev.dv_xname, jp); + printf("%s: jumpers 0x%x", device_xname(self), jp); if (jp) { printf("<"); for(i = 0; i < 5; i++) { @@ -389,7 +388,7 @@ tspldattach(struct device *parent, struc sc->boardtemp_5s = sc->boardtemp_30s = sc->boardtemp; #define DEGF(c) ((c) * 9 / 5 + 32000000) printf("%s: board temperature %d.%02d degC (%d.%02d degF)\n", - sc->sc_dev.dv_xname, + device_xname(self), sc->boardtemp / 1000000, sc->boardtemp / 10000 % 100, DEGF(sc->boardtemp) / 1000000, DEGF(sc->boardtemp) / 10000 % 100); #undef DEGF @@ -400,7 +399,7 @@ tspldattach(struct device *parent, struc CTL_HW, node->sysctl_num, CTL_CREATE, CTL_EOL)) != 0) { printf("%s: could not create sysctl\n", - sc->sc_dev.dv_xname); + device_xname(self)); return; } @@ -411,7 +410,7 @@ tspldattach(struct device *parent, struc CTL_HW, node->sysctl_num, CTL_CREATE, CTL_EOL)) != 0) { printf("%s: could not create sysctl\n", - sc->sc_dev.dv_xname); + device_xname(self)); return; } @@ -422,7 +421,7 @@ tspldattach(struct device *parent, struc CTL_HW, node->sysctl_num, CTL_CREATE, CTL_EOL)) != 0) { printf("%s: could not create sysctl\n", - sc->sc_dev.dv_xname); + device_xname(self)); return; } @@ -431,7 +430,7 @@ tspldattach(struct device *parent, struc bus_space_map(sc->sc_iot, TS7XXX_IO16_HWBASE + TS7XXX_WDOGFEED, 2, 0, &sc->sc_wdogfeed_ioh); - sc->sc_wdog.smw_name = sc->sc_dev.dv_xname; + sc->sc_wdog.smw_name = device_xname(self); sc->sc_wdog.smw_cookie = sc; sc->sc_wdog.smw_setmode = tspld_wdog_setmode; sc->sc_wdog.smw_tickle = tspld_wdog_tickle; @@ -444,9 +443,9 @@ tspldattach(struct device *parent, struc } int -tspld_search(struct device *parent, struct cfdata *cf, const int *ldesc, void *aux) +tspld_search(device_t parent, cfdata_t cf, const int *ldesc, void *aux) { - struct tspld_softc *sc = (struct tspld_softc *)parent; + struct tspld_softc *sc = device_private(parent); struct tspld_attach_args sa; sa.ta_iot = sc->sc_iot; @@ -465,7 +464,7 @@ tspld_print(void *aux, const char *name) } void -tspld_callback(struct device *self) +tspld_callback(device_t self) { #if NISA > 0 extern void isa_bs_mallocok(void); Index: sys/arch/evbarm/tsarm/isa/isa_machdep.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/evbarm/tsarm/isa/isa_machdep.c,v retrieving revision 1.11 diff -u -p -r1.11 isa_machdep.c --- sys/arch/evbarm/tsarm/isa/isa_machdep.c 1 Jul 2011 19:11:35 -0000 1.11 +++ sys/arch/evbarm/tsarm/isa/isa_machdep.c 29 Sep 2012 10:34:44 -0000 @@ -184,7 +184,7 @@ isa_intr_init(void) } void -isa_attach_hook(struct device *parent, struct device *self, struct isabus_attach_args *iba) +isa_attach_hook(device_t parent, device_t self, struct isabus_attach_args *iba) { /* * Since we can only have one ISA bus, we just use a single Index: sys/arch/evbarm/viper/if_sm_pxaip.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/evbarm/viper/if_sm_pxaip.c,v retrieving revision 1.5 diff -u -p -r1.5 if_sm_pxaip.c --- sys/arch/evbarm/viper/if_sm_pxaip.c 1 Jul 2011 20:45:45 -0000 1.5 +++ sys/arch/evbarm/viper/if_sm_pxaip.c 26 Sep 2012 22:06:47 -0000 @@ -53,19 +53,19 @@ __KERNEL_RCSID(0, "$NetBSD: if_sm_pxaip. #include -static int sm_pxaip_match(struct device *, struct cfdata *, void *); -static void sm_pxaip_attach(struct device *, struct device *, void *); +static int sm_pxaip_match(device_t, cfdata_t, void *); +static void sm_pxaip_attach(device_t, device_t, void *); struct sm_pxaip_softc { struct smc91cxx_softc sc_sm; void *ih; }; -CFATTACH_DECL(sm_pxaip, sizeof(struct sm_pxaip_softc), sm_pxaip_match, +CFATTACH_DECL_NEW(sm_pxaip, sizeof(struct sm_pxaip_softc), sm_pxaip_match, sm_pxaip_attach, NULL, NULL); static int -sm_pxaip_match(struct device *parent, struct cfdata *match, void *aux) +sm_pxaip_match(device_t parent, cfdata_t match, void *aux) { struct pxaip_attach_args *paa = aux; @@ -75,9 +75,9 @@ sm_pxaip_match(struct device *parent, st } static void -sm_pxaip_attach(struct device *parent, struct device *self, void *aux) +sm_pxaip_attach(device_t parent, device_t self, void *aux) { - struct sm_pxaip_softc *pxasc = (struct sm_pxaip_softc *)self; + struct sm_pxaip_softc *pxasc = device_private(self); struct smc91cxx_softc *sc = &pxasc->sc_sm; struct pxaip_attach_args *paa = aux; bus_space_tag_t bst = &pxa2x0_bs_tag; @@ -101,6 +101,7 @@ sm_pxaip_attach(struct device *parent, s printf("\n"); /* fill in master sc */ + sc->sc_dev = self; sc->sc_bst = bst; sc->sc_bsh = bsh; Index: sys/arch/evbmips/adm5120/autoconf.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/evbmips/adm5120/autoconf.c,v retrieving revision 1.5 diff -u -p -r1.5 autoconf.c --- sys/arch/evbmips/adm5120/autoconf.c 29 Jul 2012 18:05:41 -0000 1.5 +++ sys/arch/evbmips/adm5120/autoconf.c 9 Oct 2012 01:25:44 -0000 @@ -94,7 +94,7 @@ cpu_rootconf(void) } void -device_register(struct device *dev, void *aux) +device_register(device_t dev, void *aux) { prop_object_t po; prop_dictionary_t properties = adm5120_configuration.properties; @@ -108,7 +108,7 @@ device_register(struct device *dev, void if (prop_dictionary_set(device_properties(dev), "initial-gpio", po) == FALSE) { printf("WARNING: unable to set initial-gpio " - "property for %s\n", dev->dv_xname); + "property for %s\n", device_xname(dev)); } prop_object_release(po); } @@ -118,7 +118,7 @@ device_register(struct device *dev, void if (prop_dictionary_set(device_properties(dev), "mac-address", po) == FALSE) { printf("WARNING: unable to set mac-addr " - "property for %s\n", dev->dv_xname); + "property for %s\n", device_xname(dev)); } prop_object_release(po); } Index: sys/arch/evbmips/alchemy/autoconf.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/evbmips/alchemy/autoconf.c,v retrieving revision 1.18 diff -u -p -r1.18 autoconf.c --- sys/arch/evbmips/alchemy/autoconf.c 29 Jul 2012 18:05:41 -0000 1.18 +++ sys/arch/evbmips/alchemy/autoconf.c 9 Oct 2012 01:25:54 -0000 @@ -78,7 +78,7 @@ cpu_rootconf(void) } void -device_register(struct device *dev, void *aux) +device_register(device_t dev, void *aux) { struct aubus_attach_args *aa = aux; @@ -121,7 +121,7 @@ device_register(struct device *dev, void if (prop_dictionary_set(device_properties(dev), "mac-address", pd) == false) { printf("WARNING: unable to set mac-addr " - "property for %s\n", dev->dv_xname); + "property for %s\n", device_xname(dev)); } prop_object_release(pd); } Index: sys/arch/evbmips/gdium/autoconf.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/evbmips/gdium/autoconf.c,v retrieving revision 1.5 diff -u -p -r1.5 autoconf.c --- sys/arch/evbmips/gdium/autoconf.c 29 Jul 2012 18:05:41 -0000 1.5 +++ sys/arch/evbmips/gdium/autoconf.c 9 Oct 2012 01:16:43 -0000 @@ -72,7 +72,7 @@ cpu_rootconf(void) findroot(); printf("boot device: %s\n", - booted_device ? booted_device->dv_xname : ""); + booted_device ? device_xname(booted_device) : ""); rootconf(); } @@ -108,7 +108,7 @@ findroot(void) } void -device_register(struct device *dev, void *aux) +device_register(device_t dev, void *aux) { prop_dictionary_t dict; Index: sys/arch/evbmips/loongson/autoconf.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/evbmips/loongson/autoconf.c,v retrieving revision 1.3 diff -u -p -r1.3 autoconf.c --- sys/arch/evbmips/loongson/autoconf.c 29 Jul 2012 18:05:41 -0000 1.3 +++ sys/arch/evbmips/loongson/autoconf.c 9 Oct 2012 01:16:43 -0000 @@ -75,7 +75,7 @@ cpu_rootconf(void) findroot(); printf("boot device: %s\n", - booted_device ? booted_device->dv_xname : ""); + booted_device ? device_xname(booted_device) : ""); rootconf(); } @@ -111,7 +111,7 @@ findroot(void) } void -device_register(struct device *dev, void *aux) +device_register(device_t dev, void *aux) { prop_dictionary_t dict; Index: sys/arch/evbmips/loongson/autoconf.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/evbmips/loongson/autoconf.h,v retrieving revision 1.2 diff -u -p -r1.2 autoconf.h --- sys/arch/evbmips/loongson/autoconf.h 20 Sep 2011 05:51:34 -0000 1.2 +++ sys/arch/evbmips/loongson/autoconf.h 2 Oct 2012 01:16:26 -0000 @@ -68,8 +68,7 @@ struct platform { const struct bonito_irqmap *irq_map; void (*setup)(void); - void (*device_register)(struct device *, - void *); + void (*device_register)(device_t , void *); void (*powerdown)(void); void (*reset)(void); Index: sys/arch/evbmips/loongson/gdium_machdep.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/evbmips/loongson/gdium_machdep.c,v retrieving revision 1.4 diff -u -p -r1.4 gdium_machdep.c --- sys/arch/evbmips/loongson/gdium_machdep.c 14 Feb 2012 21:34:46 -0000 1.4 +++ sys/arch/evbmips/loongson/gdium_machdep.c 2 Oct 2012 01:16:51 -0000 @@ -45,7 +45,7 @@ int gdium_revision = 0; static pcireg_t fb_addr = 0; void gdium_attach_hook(device_t, device_t, struct pcibus_attach_args *); -void gdium_device_register(struct device *, void *); +void gdium_device_register(device_t, void *); int gdium_intr_map(int, int, int, pci_intr_handle_t *); void gdium_powerdown(void); void gdium_reset(void); @@ -234,11 +234,11 @@ extern struct cfdriver sd_cd; #include void -gdium_device_register(struct device *dev, void *aux) +gdium_device_register(device_t dev, void *aux) { prop_dictionary_t dict; static int gkey_chain_pos = 0; - static struct device *lastparent = NULL; + static device_t lastparent = NULL; if (dev->dv_parent != lastparent && gkey_chain_pos != 0) return; Index: sys/arch/evbmips/loongson/generic2e_machdep.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/evbmips/loongson/generic2e_machdep.c,v retrieving revision 1.2 diff -u -p -r1.2 generic2e_machdep.c --- sys/arch/evbmips/loongson/generic2e_machdep.c 14 Feb 2012 21:41:02 -0000 1.2 +++ sys/arch/evbmips/loongson/generic2e_machdep.c 29 Sep 2012 10:48:56 -0000 @@ -82,7 +82,7 @@ __KERNEL_RCSID(0, "$NetBSD: generic2e_ma #include #endif -void generic2e_device_register(struct device *, void *); +void generic2e_device_register(device_t, void *); void generic2e_reset(void); void generic2e_setup(void); @@ -91,7 +91,7 @@ void generic2e_pci_attach_hook(device_t, struct pcibus_attach_args *); int generic2e_intr_map(int, int, int, pci_intr_handle_t *); -void generic2e_isa_attach_hook(struct device *, struct device *, +void generic2e_isa_attach_hook(device_t, device_t, struct isabus_attach_args *); void *generic2e_isa_intr_establish(void *, int, int, int, int (*)(void *), void *); @@ -234,7 +234,7 @@ generic2e_intr_map(int dev, int fn, int */ void -generic2e_isa_attach_hook(struct device *parent, struct device *self, +generic2e_isa_attach_hook(device_t parent, device_t self, struct isabus_attach_args *iba) { loongson_set_isa_imr(loongson_isaimr); @@ -383,7 +383,7 @@ generic2e_setup(void) } void -generic2e_device_register(struct device *dev, void *aux) +generic2e_device_register(device_t dev, void *aux) { const char *name = device_xname(dev); Index: sys/arch/evbmips/loongson/loongson_intr.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/evbmips/loongson/loongson_intr.c,v retrieving revision 1.1 diff -u -p -r1.1 loongson_intr.c --- sys/arch/evbmips/loongson/loongson_intr.c 27 Aug 2011 13:42:45 -0000 1.1 +++ sys/arch/evbmips/loongson/loongson_intr.c 2 Oct 2012 01:17:14 -0000 @@ -173,7 +173,7 @@ evbmips_iointr(int ppl, vaddr_t pc, uint } void * -loongson_pciide_compat_intr_establish(void *v, struct device *dev, +loongson_pciide_compat_intr_establish(void *v, device_t dev, const struct pci_attach_args *pa, int chan, int (*func)(void *), void *arg) { pci_chipset_tag_t pc = pa->pa_pc; @@ -198,7 +198,7 @@ loongson_pciide_compat_intr_establish(vo cookie = NULL; if (cookie == NULL) return (NULL); - printf("%s: %s channel interrupting at %s\n", dev->dv_xname, + printf("%s: %s channel interrupting at %s\n", device_xname(dev), PCIIDE_CHANNEL_NAME(chan), isa_intr_string(sys_platform->isa_chipset, irq)); return (cookie); Index: sys/arch/evbmips/loongson/yeeloong_machdep.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/evbmips/loongson/yeeloong_machdep.c,v retrieving revision 1.3 diff -u -p -r1.3 yeeloong_machdep.c --- sys/arch/evbmips/loongson/yeeloong_machdep.c 2 Mar 2012 13:20:57 -0000 1.3 +++ sys/arch/evbmips/loongson/yeeloong_machdep.c 29 Sep 2012 10:32:37 -0000 @@ -66,7 +66,7 @@ __KERNEL_RCSID(0, "$NetBSD: yeeloong_mac #define DPRINTF(x) #endif -void lemote_device_register(struct device *, void *); +void lemote_device_register(device_t, void *); void lemote_reset(void); void fuloong_powerdown(void); @@ -78,7 +78,7 @@ void lemote_pci_attach_hook(device_t, d struct pcibus_attach_args *); int lemote_intr_map(int, int, int, pci_intr_handle_t *); -void lemote_isa_attach_hook(struct device *, struct device *, +void lemote_isa_attach_hook(device_t, device_t, struct isabus_attach_args *); void *lemote_isa_intr_establish(void *, int, int, int, int (*)(void *), void *); @@ -356,7 +356,7 @@ lemote_intr_map(int dev, int fn, int pin */ void -lemote_isa_attach_hook(struct device *parent, struct device *self, +lemote_isa_attach_hook(device_t parent, device_t self, struct isabus_attach_args *iba) { @@ -549,7 +549,7 @@ fuloong_setup(void) } void -lemote_device_register(struct device *dev, void *aux) +lemote_device_register(device_t dev, void *aux) { const char *name = device_xname(dev); Index: sys/arch/evbmips/loongson/dev/kb3310.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/evbmips/loongson/dev/kb3310.c,v retrieving revision 1.1 diff -u -p -r1.1 kb3310.c --- sys/arch/evbmips/loongson/dev/kb3310.c 27 Aug 2011 13:42:46 -0000 1.1 +++ sys/arch/evbmips/loongson/dev/kb3310.c 1 Oct 2012 14:35:19 -0000 @@ -82,7 +82,6 @@ static const struct { }; struct ykbec_softc { - struct device sc_dev; bus_space_tag_t sc_iot; bus_space_handle_t sc_ioh; struct ksensor sc_sensor[YKBEC_NSENSORS]; @@ -97,8 +96,8 @@ static int ykbec_chip_config; extern void loongson_set_isa_imr(uint); -int ykbec_match(struct device *, void *, void *); -void ykbec_attach(struct device *, struct device *, void *); +int ykbec_match(device_t, cfdata_t, void *); +void ykbec_attach(device_t, device_t, void *); const struct cfattach ykbec_ca = { sizeof(struct ykbec_softc), ykbec_match, ykbec_attach @@ -127,7 +126,7 @@ const char *ykbec_batstate[] = { #endif int -ykbec_match(struct device *parent, void *match, void *aux) +ykbec_match(device_t parent, cfdata_t match, void *aux) { struct isa_attach_args *ia = aux; bus_space_handle_t ioh; @@ -153,10 +152,10 @@ ykbec_match(struct device *parent, void } void -ykbec_attach(struct device *parent, struct device *self, void *aux) +ykbec_attach(device_t parent, device_t self, void *aux) { struct isa_attach_args *ia = aux; - struct ykbec_softc *sc = (struct ykbec_softc *)self; + struct ykbec_softc *sc = device_private(self); int i; sc->sc_iot = ia->ia_iot; @@ -167,7 +166,7 @@ ykbec_attach(struct device *parent, stru } /* Initialize sensor data. */ - strlcpy(sc->sc_sensordev.xname, sc->sc_dev.dv_xname, + strlcpy(sc->sc_sensordev.xname, device_xname(self), sizeof(sc->sc_sensordev.xname)); if (sensor_task_register(sc, ykbec_refresh, 5) == NULL) { aprint_error(", unable to register update task\n"); Index: sys/arch/evbmips/malta/autoconf.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/evbmips/malta/autoconf.c,v retrieving revision 1.16 diff -u -p -r1.16 autoconf.c --- sys/arch/evbmips/malta/autoconf.c 29 Jul 2012 18:05:41 -0000 1.16 +++ sys/arch/evbmips/malta/autoconf.c 9 Oct 2012 01:16:43 -0000 @@ -72,7 +72,7 @@ cpu_rootconf(void) findroot(); printf("boot device: %s\n", - booted_device ? booted_device->dv_xname : ""); + booted_device ? device_xname(booted_device) : ""); rootconf(); } @@ -108,7 +108,7 @@ findroot(void) } void -device_register(struct device *dev, void *aux) +device_register(device_t dev, void *aux) { if ((booted_device == NULL) && (netboot == 1)) if (device_class(dev) == DV_IFNET) Index: sys/arch/evbmips/malta/malta_intr.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/evbmips/malta/malta_intr.c,v retrieving revision 1.21 diff -u -p -r1.21 malta_intr.c --- sys/arch/evbmips/malta/malta_intr.c 4 Apr 2011 20:37:49 -0000 1.21 +++ sys/arch/evbmips/malta/malta_intr.c 9 Oct 2012 01:17:56 -0000 @@ -103,7 +103,7 @@ static void *malta_pci_intr_establish(vo int (*)(void *), void *); static void malta_pci_intr_disestablish(void *, void *); static void malta_pci_conf_interrupt(void *, int, int, int, int, int *); -static void *malta_pciide_compat_intr_establish(void *, struct device *, +static void *malta_pciide_compat_intr_establish(void *, device_t, const struct pci_attach_args *, int, int (*)(void *), void *); @@ -381,7 +381,7 @@ malta_pci_conf_interrupt(void *v, int bu } void * -malta_pciide_compat_intr_establish(void *v, struct device *dev, +malta_pciide_compat_intr_establish(void *v, device_t dev, const struct pci_attach_args *pa, int chan, int (*func)(void *), void *arg) { pci_chipset_tag_t pc = pa->pa_pc; @@ -400,7 +400,7 @@ malta_pciide_compat_intr_establish(void cookie = isa_intr_establish(pcib_ic, irq, IST_EDGE, IPL_BIO, func, arg); if (cookie == NULL) return (NULL); - printf("%s: %s channel interrupting at %s\n", dev->dv_xname, + printf("%s: %s channel interrupting at %s\n", device_xname(dev), PCIIDE_CHANNEL_NAME(chan), malta_pci_intr_string(v, irq)); return (cookie); } Index: sys/arch/evbmips/malta/pci/pchb.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/evbmips/malta/pci/pchb.c,v retrieving revision 1.10 diff -u -p -r1.10 pchb.c --- sys/arch/evbmips/malta/pci/pchb.c 6 Jun 2011 17:13:05 -0000 1.10 +++ sys/arch/evbmips/malta/pci/pchb.c 9 Oct 2012 01:02:34 -0000 @@ -105,6 +105,6 @@ pchb_attach(device_t parent, device_t se pci_devinfo(pa->pa_id, pa->pa_class, 0, devinfo, sizeof(devinfo)); } - printf("%s: %s (rev. 0x%02x)\n", self->dv_xname, devinfo, + printf("%s: %s (rev. 0x%02x)\n", device_xname(self), devinfo, PCI_REVISION(pa->pa_class)); } Index: sys/arch/evbmips/malta/pci/pcib.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/evbmips/malta/pci/pcib.c,v retrieving revision 1.15 diff -u -p -r1.15 pcib.c --- sys/arch/evbmips/malta/pci/pcib.c 1 Jul 2011 18:46:35 -0000 1.15 +++ sys/arch/evbmips/malta/pci/pcib.c 29 Sep 2012 10:31:40 -0000 @@ -121,10 +121,10 @@ struct pcib_softc { static struct pcib_softc *my_sc; struct mips_isa_chipset *pcib_ic; -static int pcib_match(struct device *, struct cfdata *, void *); -static void pcib_attach(struct device *, struct device *, void *); +static int pcib_match(device_t, cfdata_t, void *); +static void pcib_attach(device_t, device_t, void *); static int pcib_intr(void *v); -static void pcib_bridge_callback(struct device *); +static void pcib_bridge_callback(device_t); static void pcib_set_icus(struct pcib_softc *sc); static void pcib_cleanup(void *arg); @@ -133,7 +133,7 @@ static const struct evcnt * static void *pcib_isa_intr_establish(void *, int, int, int, int (*)(void *), void *); static void pcib_isa_intr_disestablish(void *, void *); -static void pcib_isa_attach_hook(struct device *, struct device *, +static void pcib_isa_attach_hook(device_t, device_t, struct isabus_attach_args *); static void pcib_isa_detach_hook(isa_chipset_tag_t, device_t); static int pcib_isa_intr_alloc(void *, int, int, int *); @@ -154,7 +154,7 @@ malta_isa_dma_may_bounce(bus_dma_tag_t t } static int -pcib_match(struct device *parent, struct cfdata *match, void *aux) +pcib_match(device_t parent, cfdata_t match, void *aux) { struct pci_attach_args *pa = aux; @@ -166,7 +166,7 @@ pcib_match(struct device *parent, struct } static void -pcib_attach(struct device *parent, struct device *self, void *aux) +pcib_attach(device_t parent, device_t self, void *aux) { struct pci_attach_args * const pa = aux; struct pcib_softc * const sc = device_private(self); @@ -352,11 +352,11 @@ pcib_bridge_callback(device_t self) iba.iba_ic->ic_attach_hook = pcib_isa_attach_hook; iba.iba_ic->ic_detach_hook = pcib_isa_detach_hook; - config_found_ia(sc->sc_dev, "isabus", &iba, isabusprint); + config_found_ia(self, "isabus", &iba, isabusprint); } static void -pcib_isa_attach_hook(struct device *parent, struct device *self, +pcib_isa_attach_hook(device_t parent, device_t self, struct isabus_attach_args *iba) { Index: sys/arch/evbmips/rasoc/autoconf.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/evbmips/rasoc/autoconf.c,v retrieving revision 1.3 diff -u -p -r1.3 autoconf.c --- sys/arch/evbmips/rasoc/autoconf.c 29 Jul 2012 18:05:42 -0000 1.3 +++ sys/arch/evbmips/rasoc/autoconf.c 2 Oct 2012 01:17:57 -0000 @@ -62,7 +62,7 @@ cpu_rootconf(void) } void -device_register(struct device *dev, void *aux) +device_register(device_t dev, void *aux) { /* TBD */ } Index: sys/arch/evbmips/rmixl/autoconf.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/evbmips/rmixl/autoconf.c,v retrieving revision 1.6 diff -u -p -r1.6 autoconf.c --- sys/arch/evbmips/rmixl/autoconf.c 29 Jul 2012 18:05:41 -0000 1.6 +++ sys/arch/evbmips/rmixl/autoconf.c 9 Oct 2012 01:16:43 -0000 @@ -72,7 +72,7 @@ cpu_rootconf(void) findroot(); printf("boot device: %s\n", - booted_device ? booted_device->dv_xname : ""); + booted_device ? device_xname(booted_device) : ""); rootconf(); } Index: sys/arch/evbppc/virtex/dev/pstwo.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/evbppc/virtex/dev/pstwo.c,v retrieving revision 1.4 diff -u -p -r1.4 pstwo.c --- sys/arch/evbppc/virtex/dev/pstwo.c 1 Jul 2011 19:03:50 -0000 1.4 +++ sys/arch/evbppc/virtex/dev/pstwo.c 29 Sep 2012 11:42:24 -0000 @@ -137,7 +137,7 @@ static void pstwo_printreg(struct pstwo_softc *sc) { #define PRINTREG(name, reg) \ - printf("%s: [0x%08x] %s -> 0x%08x\n", device_xname(&sc->sc_dev), \ + printf("%s: [0x%08x] %s -> 0x%08x\n", device_xname(sc->sc_dev), \ reg, name, bus_space_read_4(sc->sc_iot, sc->sc_ioh, reg)) PRINTREG("status ", PSTWO_STAT); Index: sys/arch/evbsh3/ap_ms104_sh4/if_sm_mainbus.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/evbsh3/ap_ms104_sh4/if_sm_mainbus.c,v retrieving revision 1.3 diff -u -p -r1.3 if_sm_mainbus.c --- sys/arch/evbsh3/ap_ms104_sh4/if_sm_mainbus.c 21 Jan 2012 19:44:29 -0000 1.3 +++ sys/arch/evbsh3/ap_ms104_sh4/if_sm_mainbus.c 26 Sep 2012 22:07:20 -0000 @@ -58,7 +58,7 @@ struct sm_mainbus_softc { void *sc_ih; }; -CFATTACH_DECL(sm_mainbus, sizeof(struct sm_mainbus_softc), +CFATTACH_DECL_NEW(sm_mainbus, sizeof(struct sm_mainbus_softc), sm_mainbus_match, sm_mainbus_attach, NULL, NULL); static int @@ -98,6 +98,7 @@ sm_mainbus_attach(device_t parent, devic } /* fill in master sc */ + sc->sc_dev = self; sc->sc_bst = bst; sc->sc_bsh = bsh; Index: sys/arch/evbsh3/ap_ms104_sh4/shpcmcia.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/evbsh3/ap_ms104_sh4/shpcmcia.c,v retrieving revision 1.3 diff -u -p -r1.3 shpcmcia.c --- sys/arch/evbsh3/ap_ms104_sh4/shpcmcia.c 21 Jan 2012 19:44:29 -0000 1.3 +++ sys/arch/evbsh3/ap_ms104_sh4/shpcmcia.c 2 Oct 2012 01:18:12 -0000 @@ -153,7 +153,7 @@ struct shpcmcia_handle { #define SHPCMCIA_IO_WINS 2 } io[SHPCMCIA_IO_WINS]; - struct device *pcmcia; + device_t pcmcia; int shutdown; lwp_t *event_thread; Index: sys/arch/evbsh3/evbsh3/mainbus.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/evbsh3/evbsh3/mainbus.c,v retrieving revision 1.8 diff -u -p -r1.8 mainbus.c --- sys/arch/evbsh3/evbsh3/mainbus.c 6 Apr 2010 15:54:30 -0000 1.8 +++ sys/arch/evbsh3/evbsh3/mainbus.c 26 Sep 2012 21:34:18 -0000 @@ -35,8 +35,8 @@ __KERNEL_RCSID(0, "$NetBSD: mainbus.c,v #include -static int mainbus_match(struct device *, struct cfdata *, void *); -static void mainbus_attach(struct device *, struct device *, void *); +static int mainbus_match(device_t, cfdata_t, void *); +static void mainbus_attach(device_t, device_t, void *); CFATTACH_DECL_NEW(mainbus, sizeof(struct device), mainbus_match, mainbus_attach, NULL, NULL); Index: sys/arch/ews4800mips/dev/ewskbd.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/ews4800mips/dev/ewskbd.c,v retrieving revision 1.9 diff -u -p -r1.9 ewskbd.c --- sys/arch/ews4800mips/dev/ewskbd.c 14 May 2008 13:29:28 -0000 1.9 +++ sys/arch/ews4800mips/dev/ewskbd.c 2 Oct 2012 01:18:27 -0000 @@ -124,7 +124,7 @@ struct ewskbd_devconfig { #define EWSKBD_KANA 0x04 /* wscons glue */ - struct device *wskbddev; + device_t wskbddev; int enabled; }; @@ -195,7 +195,7 @@ ewskbd_zsc_match(device_t parent, cfdata } static void -ewskbd_zsc_attach(struct device *parent, struct device *self, void *aux) +ewskbd_zsc_attach(device_t parent, device_t self, void *aux) { struct ewskbd_softc *sc; struct zsc_softc *zsc; Index: sys/arch/ews4800mips/dev/ewsms.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/ews4800mips/dev/ewsms.c,v retrieving revision 1.7 diff -u -p -r1.7 ewsms.c --- sys/arch/ews4800mips/dev/ewsms.c 25 May 2008 23:37:05 -0000 1.7 +++ sys/arch/ews4800mips/dev/ewsms.c 2 Oct 2012 01:18:34 -0000 @@ -100,7 +100,7 @@ struct ewsms_softc { /* wsmouse bits */ int sc_enabled; - struct device *sc_wsmousedev; + device_t sc_wsmousedev; }; static int ewsms_zsc_match(device_t, cfdata_t, void *); Index: sys/arch/ews4800mips/sbd/if_le_sbdio.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/ews4800mips/sbd/if_le_sbdio.c,v retrieving revision 1.6 diff -u -p -r1.6 if_le_sbdio.c --- sys/arch/ews4800mips/sbd/if_le_sbdio.c 19 Jan 2010 22:06:20 -0000 1.6 +++ sys/arch/ews4800mips/sbd/if_le_sbdio.c 2 Oct 2012 01:19:01 -0000 @@ -73,8 +73,8 @@ struct le_sbdio_softc { bus_dmamap_t sc_dmamap; }; -int le_sbdio_match(device_t, struct cfdata *, void *); -void le_sbdio_attach(device_t, struct device *, void *); +int le_sbdio_match(device_t, cfdata_t, void *); +void le_sbdio_attach(device_t, device_t, void *); static void le_sbdio_wrcsr(struct lance_softc *, uint16_t, uint16_t); static uint16_t le_sbdio_rdcsr(struct lance_softc *, uint16_t); Index: sys/arch/ews4800mips/sbd/kbms_sbdio.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/ews4800mips/sbd/kbms_sbdio.c,v retrieving revision 1.9 diff -u -p -r1.9 kbms_sbdio.c --- sys/arch/ews4800mips/sbd/kbms_sbdio.c 28 Apr 2008 20:23:18 -0000 1.9 +++ sys/arch/ews4800mips/sbd/kbms_sbdio.c 2 Oct 2012 01:19:13 -0000 @@ -61,8 +61,8 @@ struct kbms_reg { enum { MOUSE_PACKET_LEN = 5 }; struct kbms_softc { device_t sc_dev; - struct device *sc_wskbd; - struct device *sc_wsmouse; + device_t sc_wskbd; + device_t sc_wsmouse; struct kbms_reg sc_reg; int sc_leds; int sc_flags; Index: sys/arch/hp300/dev/hpib.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/hp300/dev/hpib.c,v retrieving revision 1.38 diff -u -p -r1.38 hpib.c --- sys/arch/hp300/dev/hpib.c 13 Jun 2008 09:41:15 -0000 1.38 +++ sys/arch/hp300/dev/hpib.c 2 Oct 2012 01:19:35 -0000 @@ -267,7 +267,7 @@ hpibreset(int unit) } int -hpibreq(struct device *pdev, struct hpibqueue *hq) +hpibreq(device_t pdev, struct hpibqueue *hq) { struct hpibbus_softc *sc = device_private(pdev); int s; @@ -283,7 +283,7 @@ hpibreq(struct device *pdev, struct hpib } void -hpibfree(struct device *pdev, struct hpibqueue *hq) +hpibfree(device_t pdev, struct hpibqueue *hq) { struct hpibbus_softc *sc = device_private(pdev); int s; Index: sys/arch/hp300/dev/hpibvar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/hp300/dev/hpibvar.h,v retrieving revision 1.20 diff -u -p -r1.20 hpibvar.h --- sys/arch/hp300/dev/hpibvar.h 28 Apr 2008 20:23:19 -0000 1.20 +++ sys/arch/hp300/dev/hpibvar.h 2 Oct 2012 01:19:44 -0000 @@ -206,8 +206,8 @@ void hpibawait(int); int hpibswait(int, int); int hpibid(int, int); -int hpibreq(struct device *, struct hpibqueue *); -void hpibfree(struct device *, struct hpibqueue *); +int hpibreq(device_t, struct hpibqueue *); +void hpibfree(device_t, struct hpibqueue *); int hpibintr(void *); int hpibdevprint(void *, const char *); Index: sys/arch/hp300/dev/rd.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/hp300/dev/rd.c,v retrieving revision 1.92 diff -u -p -r1.92 rd.c --- sys/arch/hp300/dev/rd.c 2 Feb 2012 19:42:59 -0000 1.92 +++ sys/arch/hp300/dev/rd.c 2 Oct 2012 01:19:26 -0000 @@ -245,7 +245,7 @@ static const struct rdidentinfo rdidenti }; static const int numrdidentinfo = __arraycount(rdidentinfo); -static int rdident(struct device *, struct rd_softc *, +static int rdident(device_t, struct rd_softc *, struct hpibbus_attach_args *); static void rdreset(struct rd_softc *); static void rdustart(struct rd_softc *); Index: sys/arch/hp300/hp300/autoconf.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/hp300/hp300/autoconf.c,v retrieving revision 1.100 diff -u -p -r1.100 autoconf.c --- sys/arch/hp300/hp300/autoconf.c 29 Jul 2012 18:05:43 -0000 1.100 +++ sys/arch/hp300/hp300/autoconf.c 9 Oct 2012 01:26:21 -0000 @@ -209,7 +209,7 @@ int extio_ex_malloc_safe; struct dev_data { LIST_ENTRY(dev_data) dd_list; /* dev_data_list */ LIST_ENTRY(dev_data) dd_clist; /* ctlr list */ - struct device *dd_dev; /* device described by this entry */ + device_t dd_dev; /* device described by this entry */ int dd_scode; /* select code of device */ int dd_slave; /* ...or slave */ int dd_punit; /* and punit... */ @@ -223,7 +223,7 @@ static void findbootdev(void); static void findbootdev_slave(ddlist_t *, int, int, int); static void setbootdev(void); -static struct dev_data *dev_data_lookup(struct device *); +static struct dev_data *dev_data_lookup(device_t); static void dev_data_insert(struct dev_data *, ddlist_t *); static int mainbusmatch(device_t, cfdata_t, void *); @@ -300,7 +300,7 @@ void cpu_rootconf(void) { struct dev_data *dd; - struct device *dv; + device_t dv; struct vfsops *vops; /* @@ -320,7 +320,7 @@ cpu_rootconf(void) B_PARTITION(bootdev)); bootdev = 0; /* invalidate bootdev */ } else { - printf("boot device: %s\n", booted_device->dv_xname); + printf("boot device: %s\n", device_xname(booted_device)); } } @@ -376,7 +376,7 @@ cpu_rootconf(void) * used to attach it. This is used to find the boot device. */ void -device_register(struct device *dev, void *aux) +device_register(device_t dev, void *aux) { struct dev_data *dd; static int seen_netdevice = 0; @@ -517,7 +517,7 @@ findbootdev(void) (type == 2 && !device_is_a(booted_device, "rd"))) { printf("WARNING: boot device/type mismatch!\n"); printf("device = %s, type = %d\n", - booted_device->dv_xname, type); + device_xname(booted_device), type); booted_device = NULL; } goto out; @@ -538,7 +538,7 @@ findbootdev(void) if ((type == 4 && !device_is_a(booted_device, "sd"))) { printf("WARNING: boot device/type mismatch!\n"); printf("device = %s, type = %d\n", - booted_device->dv_xname, type); + device_xname(booted_device), type); booted_device = NULL; } goto out; @@ -683,7 +683,7 @@ setbootdev(void) * Return the dev_data corresponding to the given device. */ static struct dev_data * -dev_data_lookup(struct device *dev) +dev_data_lookup(device_t dev) { struct dev_data *dd; @@ -705,7 +705,7 @@ dev_data_insert(struct dev_data *dd, ddl #ifdef DIAGNOSTIC if (dd->dd_scode < 0 || dd->dd_scode > 255) { - printf("bogus select code for %s\n", dd->dd_dev->dv_xname); + printf("bogus select code for %s\n", device_xname(dd->dd_dev)); panic("dev_data_insert"); } #endif Index: sys/arch/hp700/dev/asp.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/hp700/dev/asp.c,v retrieving revision 1.21 diff -u -p -r1.21 asp.c --- sys/arch/hp700/dev/asp.c 23 May 2012 16:11:37 -0000 1.21 +++ sys/arch/hp700/dev/asp.c 9 Oct 2012 01:14:02 -0000 @@ -262,7 +262,7 @@ aspattach(device_t parent, device_t self /* Attach the GSC bus. */ ga.ga_ca = *ca; /* clone from us */ - if (strcmp(parent->dv_xname, "mainbus0") == 0) { + if (strcmp(device_xname(parent), "mainbus0") == 0) { ga.ga_dp.dp_bc[0] = ga.ga_dp.dp_bc[1]; ga.ga_dp.dp_bc[1] = ga.ga_dp.dp_bc[2]; ga.ga_dp.dp_bc[2] = ga.ga_dp.dp_bc[3]; Index: sys/arch/hp700/dev/cpu.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/hp700/dev/cpu.c,v retrieving revision 1.28 diff -u -p -r1.28 cpu.c --- sys/arch/hp700/dev/cpu.c 23 May 2012 21:11:34 -0000 1.28 +++ sys/arch/hp700/dev/cpu.c 9 Oct 2012 01:02:34 -0000 @@ -122,7 +122,7 @@ cpuattach(device_t parent, device_t self } /* Print the CPU type, spec, level, category, and speed. */ - aprint_normal("\n%s: %s, PA-RISC %s", self->dv_xname, + aprint_normal("\n%s: %s, PA-RISC %s", device_xname(self), hppa_cpu_info->hci_chip_type, hppa_cpu_info->hci_chip_spec); aprint_normal(", lev %s, cat %c, ", @@ -132,7 +132,7 @@ cpuattach(device_t parent, device_t self if (mhz % 100 > 9) aprint_normal(".%02d", mhz % 100); - aprint_normal(" MHz clk\n%s: %s", self->dv_xname, + aprint_normal(" MHz clk\n%s: %s", device_xname(self), pdc_model.sh? "shadows, ": ""); if (pdc_cache.dc_conf.cc_fsel) @@ -158,7 +158,7 @@ cpuattach(device_t parent, device_t self * Describe the floating-point support. */ KASSERT(fpu_present); - aprint_normal("%s: %s floating point, rev %d\n", self->dv_xname, + aprint_normal("%s: %s floating point, rev %d\n", device_xname(self), hppa_mod_info(HPPA_TYPE_FPU, (fpu_version >> 16) & 0x1f), (fpu_version >> 11) & 0x1f); Index: sys/arch/hp700/dev/elroy.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/hp700/dev/elroy.c,v retrieving revision 1.12 diff -u -p -r1.12 elroy.c --- sys/arch/hp700/dev/elroy.c 27 Jan 2012 18:52:56 -0000 1.12 +++ sys/arch/hp700/dev/elroy.c 9 Oct 2012 01:26:31 -0000 @@ -452,7 +452,7 @@ elroy_alloc_parent(device_t self, struct return (NULL); snprintf(sc->sc_memexname, sizeof(sc->sc_memexname), - "%s_mem", sc->sc_dv.dv_xname); + "%s_mem", device_xname(sc->sc_dv)); if ((sc->sc_memex = extent_create(sc->sc_memexname, mem_start, mem_start + ELROY_MEM_WINDOW, NULL, 0, EX_NOWAIT | EX_MALLOCOK)) == NULL) { Index: sys/arch/hp700/dev/ssio.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/hp700/dev/ssio.c,v retrieving revision 1.3 diff -u -p -r1.3 ssio.c --- sys/arch/hp700/dev/ssio.c 14 Apr 2012 06:04:34 -0000 1.3 +++ sys/arch/hp700/dev/ssio.c 1 Oct 2012 14:37:04 -0000 @@ -106,8 +106,6 @@ struct ssio_iv { struct ssio_iv ssio_intr_table[SSIO_NINTS]; struct ssio_softc { - struct device sc_dev; - bus_space_tag_t sc_iot; bus_space_handle_t sc_ic1h; bus_space_handle_t sc_ic2h; Index: sys/arch/hp700/dev/wax.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/hp700/dev/wax.c,v retrieving revision 1.20 diff -u -p -r1.20 wax.c --- sys/arch/hp700/dev/wax.c 23 May 2012 16:11:37 -0000 1.20 +++ sys/arch/hp700/dev/wax.c 9 Oct 2012 01:26:49 -0000 @@ -152,7 +152,7 @@ waxattach(device_t parent, device_t self /* Attach the GSC bus. */ ga.ga_ca = *ca; /* clone from us */ - if (strcmp(parent->dv_xname, "mainbus0") == 0) { + if (strcmp(device_xname(parent), "mainbus0") == 0) { ga.ga_dp.dp_bc[0] = ga.ga_dp.dp_bc[1]; ga.ga_dp.dp_bc[1] = ga.ga_dp.dp_bc[2]; ga.ga_dp.dp_bc[2] = ga.ga_dp.dp_bc[3]; Index: sys/arch/hp700/gsc/fdc_gsc.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/hp700/gsc/fdc_gsc.c,v retrieving revision 1.10 diff -u -p -r1.10 fdc_gsc.c --- sys/arch/hp700/gsc/fdc_gsc.c 1 Jul 2011 18:33:09 -0000 1.10 +++ sys/arch/hp700/gsc/fdc_gsc.c 27 Sep 2012 21:37:40 -0000 @@ -49,7 +49,7 @@ __KERNEL_RCSID(0, "$NetBSD: fdc_gsc.c,v int fdc_gsc_probe(device_t, cfdata_t, void *); void fdc_gsc_attach(device_t, device_t, void *); -CFATTACH_DECL(fdc_gsc, sizeof(struct fdc_softc), +CFATTACH_DECL_NEW(fdc_gsc, sizeof(struct fdc_softc), fdc_gsc_probe, fdc_gsc_attach, NULL, NULL); int Index: sys/arch/hp700/hp700/autoconf.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/hp700/hp700/autoconf.c,v retrieving revision 1.48 diff -u -p -r1.48 autoconf.c --- sys/arch/hp700/hp700/autoconf.c 29 Jul 2012 18:05:40 -0000 1.48 +++ sys/arch/hp700/hp700/autoconf.c 9 Oct 2012 01:26:59 -0000 @@ -474,7 +474,7 @@ cpu_rootconf(void) #endif /* DEBUG */ if (boot_device != NULL) - printf("boot device: %s\n", boot_device->dv_xname ); + printf("boot device: %s\n", device_xname(boot_device)); booted_device = boot_device; rootconf(); } Index: sys/arch/hpcarm/dev/sed_saip.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/hpcarm/dev/sed_saip.c,v retrieving revision 1.25 diff -u -p -r1.25 sed_saip.c --- sys/arch/hpcarm/dev/sed_saip.c 19 Jul 2011 15:37:38 -0000 1.25 +++ sys/arch/hpcarm/dev/sed_saip.c 9 Oct 2012 01:02:34 -0000 @@ -154,7 +154,7 @@ sed1356_attach(device_t parent, device_t /* Add a suspend hook to power saving */ sc->sc_powerstate = 0; - sc->sc_powerhook = powerhook_establish(self->dv_xname, + sc->sc_powerhook = powerhook_establish(device_xname(self), sed1356_power, sc); if (sc->sc_powerhook == NULL) aprint_normal_dev(self, "WARNING: unable to establish power hook\n"); Index: sys/arch/hpcarm/dev/wzero3_kbd.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/hpcarm/dev/wzero3_kbd.c,v retrieving revision 1.7 diff -u -p -r1.7 wzero3_kbd.c --- sys/arch/hpcarm/dev/wzero3_kbd.c 21 Jan 2012 19:44:29 -0000 1.7 +++ sys/arch/hpcarm/dev/wzero3_kbd.c 29 Sep 2012 10:18:26 -0000 @@ -246,7 +246,7 @@ wzero3kbd_lookup(void) } static int -wzero3kbd_match(struct device *parent, struct cfdata *cf, void *aux) +wzero3kbd_match(device_t parent, cfdata_t cf, void *aux) { if (strcmp(cf->cf_name, "wzero3kbd") != 0) @@ -257,7 +257,7 @@ wzero3kbd_match(struct device *parent, s } static void -wzero3kbd_attach(struct device *parent, struct device *self, void *aux) +wzero3kbd_attach(device_t parent, device_t self, void *aux) { struct wzero3kbd_softc *sc = device_private(self); struct pxaip_attach_args *pxa = (struct pxaip_attach_args *)aux; Index: sys/arch/hpcarm/dev/wzero3_keypad.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/hpcarm/dev/wzero3_keypad.c,v retrieving revision 1.3 diff -u -p -r1.3 wzero3_keypad.c --- sys/arch/hpcarm/dev/wzero3_keypad.c 21 Jan 2012 19:44:29 -0000 1.3 +++ sys/arch/hpcarm/dev/wzero3_keypad.c 29 Sep 2012 10:18:26 -0000 @@ -269,7 +269,7 @@ wzero3keypad_lookup(void) } static int -wzero3keypad_match(struct device *parent, struct cfdata *cf, void *aux) +wzero3keypad_match(device_t parent, cfdata_t cf, void *aux) { if (strcmp(cf->cf_name, "wzero3keypad") != 0) @@ -280,7 +280,7 @@ wzero3keypad_match(struct device *parent } static void -wzero3keypad_attach(struct device *parent, struct device *self, void *aux) +wzero3keypad_attach(device_t parent, device_t self, void *aux) { struct wzero3keypad_softc *sc = device_private(self); const struct wzero3keypad_model *model; Index: sys/arch/hpcarm/dev/wzero3_lcd.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/hpcarm/dev/wzero3_lcd.c,v retrieving revision 1.4 diff -u -p -r1.4 wzero3_lcd.c --- sys/arch/hpcarm/dev/wzero3_lcd.c 21 Jan 2012 19:44:29 -0000 1.4 +++ sys/arch/hpcarm/dev/wzero3_lcd.c 26 Sep 2012 21:34:18 -0000 @@ -178,8 +178,8 @@ static const struct lcd_panel_geometry s 0, /* PCDDIV */ }; -static int wzero3lcd_match(struct device *, struct cfdata *, void *); -static void wzero3lcd_attach(struct device *, struct device *, void *); +static int wzero3lcd_match(device_t, cfdata_t, void *); +static void wzero3lcd_attach(device_t, device_t, void *); CFATTACH_DECL_NEW(wzero3lcd, sizeof(struct pxa2x0_lcd_softc), wzero3lcd_match, wzero3lcd_attach, NULL, NULL); @@ -209,7 +209,7 @@ wzero3lcd_lookup(void) } static int -wzero3lcd_match(struct device *parent, struct cfdata *cf, void *aux) +wzero3lcd_match(device_t parent, cfdata_t cf, void *aux) { if (strcmp(cf->cf_name, "lcd") != 0) @@ -220,7 +220,7 @@ wzero3lcd_match(struct device *parent, s } static void -wzero3lcd_attach(struct device *parent, struct device *self, void *aux) +wzero3lcd_attach(device_t parent, device_t self, void *aux) { struct pxa2x0_lcd_softc *sc = device_private(self); struct wsemuldisplaydev_attach_args aa; Index: sys/arch/hpcarm/dev/wzero3_tp.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/hpcarm/dev/wzero3_tp.c,v retrieving revision 1.7 diff -u -p -r1.7 wzero3_tp.c --- sys/arch/hpcarm/dev/wzero3_tp.c 21 Jan 2012 19:44:29 -0000 1.7 +++ sys/arch/hpcarm/dev/wzero3_tp.c 2 Oct 2012 01:20:24 -0000 @@ -119,7 +119,7 @@ struct wzero3tp_softc { struct callout sc_tp_poll; int sc_enabled; int sc_buttons; /* button emulation ? */ - struct device *sc_wsmousedev; + device_t sc_wsmousedev; struct wzero3tp_pos sc_oldpos; struct tpcalib_softc sc_tpcalib; }; Index: sys/arch/hpcarm/hpcarm/autoconf.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/hpcarm/hpcarm/autoconf.c,v retrieving revision 1.21 diff -u -p -r1.21 autoconf.c --- sys/arch/hpcarm/hpcarm/autoconf.c 1 Sep 2012 14:48:05 -0000 1.21 +++ sys/arch/hpcarm/hpcarm/autoconf.c 9 Oct 2012 01:16:43 -0000 @@ -130,7 +130,7 @@ cpu_rootconf(void) set_root_device(); printf("boot device: %s\n", - booted_device != NULL ? booted_device->dv_xname : ""); + booted_device != NULL ? device_xname(booted_device) : ""); #endif rootconf(); } @@ -180,7 +180,7 @@ cpu_configure(void) } void -device_register(struct device *dev, void *aux) +device_register(device_t dev, void *aux) { } Index: sys/arch/hpcmips/dev/it8368.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/hpcmips/dev/it8368.c,v retrieving revision 1.23 diff -u -p -r1.23 it8368.c --- sys/arch/hpcmips/dev/it8368.c 26 Jul 2011 22:52:48 -0000 1.23 +++ sys/arch/hpcmips/dev/it8368.c 27 Sep 2012 22:27:29 -0000 @@ -60,8 +60,8 @@ int it8368debug = 1; #define DPRINTFN(n, arg) #endif -int it8368e_match(struct device *, struct cfdata *, void *); -void it8368e_attach(struct device *, struct device *, void *); +int it8368e_match(device_t, cfdata_t, void *); +void it8368e_attach(device_t, device_t, void *); int it8368_print(void *, const char *); #define IT8368_LASTSTATE_PRESENT 0x0002 @@ -69,8 +69,8 @@ int it8368_print(void *, const char *); #define IT8368_LASTSTATE_EMPTY 0x0000 struct it8368e_softc { - struct device sc_dev; - struct device *sc_pcmcia; + device_t sc_dev; + device_t sc_pcmcia; tx_chipset_tag_t sc_tc; /* Register space */ @@ -143,7 +143,7 @@ static struct pcmcia_chip_functions it83 it8368_chip_socket_disable }; -CFATTACH_DECL(it8368e, sizeof(struct it8368e_softc), +CFATTACH_DECL_NEW(it8368e, sizeof(struct it8368e_softc), it8368e_match, it8368e_attach, NULL, NULL); /* @@ -201,7 +201,7 @@ it8368e_id_check(void *aux) #endif /* IT8368E_DESTRUCTIVE_CHECK */ int -it8368e_match(struct device *parent, struct cfdata *cf, void *aux) +it8368e_match(device_t parent, cfdata_t cf, void *aux) { #ifdef IT8368E_DESTRUCTIVE_CHECK return (it8368e_id_check(aux)); @@ -211,15 +211,16 @@ it8368e_match(struct device *parent, str } void -it8368e_attach(struct device *parent, struct device *self, void *aux) +it8368e_attach(device_t parent, device_t self, void *aux) { struct cs_attach_args *ca = aux; - struct it8368e_softc *sc = (void*)self; + struct it8368e_softc *sc = device_private(self); tx_chipset_tag_t tc; bus_space_tag_t csregt; bus_space_handle_t csregh; u_int16_t reg; + sc->sc_dev = self; sc->sc_tc = tc = ca->ca_tc; sc->sc_csregt = csregt = ca->ca_csreg.cstag; @@ -275,10 +276,10 @@ it8368e_attach(struct device *parent, st if (IT8368_CTRL_FIXATTRIO & it8368_reg_read(csregt, csregh, IT8368_CTRL_REG)) { sc->sc_fixattr = 1; - printf("%s: fix attr mode\n", sc->sc_dev.dv_xname); + printf("%s: fix attr mode\n", device_xname(sc->sc_dev)); } else { sc->sc_fixattr = 0; - printf("%s: legacy attr mode\n", sc->sc_dev.dv_xname); + printf("%s: legacy attr mode\n", device_xname(sc->sc_dev)); } sc->sc_csmemt = sc->sc_csiot; @@ -406,7 +407,7 @@ it8368_init_socket(struct it8368e_softc IST_EDGE, IPL_BIO, it8368_intr, sc); if (sc->sc_ih == NULL) { printf("%s: can't establish interrupt\n", - sc->sc_dev.dv_xname); + device_xname(sc->sc_dev)); return; } Index: sys/arch/hpcmips/dev/ite8181.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/hpcmips/dev/ite8181.c,v retrieving revision 1.27 diff -u -p -r1.27 ite8181.c --- sys/arch/hpcmips/dev/ite8181.c 18 Mar 2009 16:00:11 -0000 1.27 +++ sys/arch/hpcmips/dev/ite8181.c 27 Sep 2012 23:31:07 -0000 @@ -258,10 +258,10 @@ ite8181_attach(struct ite8181_softc *sc) } printf("\n"); printf("%s: framebuffer address: 0x%08lx\n", - sc->sc_dev.dv_xname, (u_long)bootinfo->fb_addr); + device_xname(sc->sc_dev), (u_long)bootinfo->fb_addr); if (ite8181_lcd_control_disable) printf("%s: ite8181 lcd control is DISABLED.\n", - sc->sc_dev.dv_xname); + device_xname(sc->sc_dev)); /* set base offsets */ sc->sc_mba = ite8181_config_read_4(sc->sc_iot, sc->sc_ioh, ITE8181_MBA); @@ -277,11 +277,11 @@ ite8181_attach(struct ite8181_softc *sc) ite8181_erase_cursor(sc); /* Add a power hook to power saving */ - sc->sc_powerhook = powerhook_establish(sc->sc_dev.dv_xname, + sc->sc_powerhook = powerhook_establish(device_xname(sc->sc_dev), ite8181_power, sc); if (sc->sc_powerhook == NULL) printf("%s: WARNING: unable to establish power hook\n", - sc->sc_dev.dv_xname); + device_xname(sc->sc_dev)); /* Add a hard power hook to power saving */ sc->sc_hardpowerhook = config_hook(CONFIG_HOOK_PMEVENT, @@ -290,7 +290,7 @@ ite8181_attach(struct ite8181_softc *sc) ite8181_hardpower, sc); if (sc->sc_hardpowerhook == NULL) printf("%s: WARNING: unable to establish hard power hook\n", - sc->sc_dev.dv_xname); + device_xname(sc->sc_dev)); /* initialize backlight brightness and lcd contrast */ sc->sc_lcd_inited = 0; @@ -312,7 +312,7 @@ ite8181_attach(struct ite8181_softc *sc) ha.ha_ndspconf = 1; ha.ha_dspconflist = &sc->sc_dspconf; - config_found(&sc->sc_dev, &ha, hpcfbprint); + config_found(sc->sc_dev, &ha, hpcfbprint); #if NBIVIDEO > 0 /* Index: sys/arch/hpcmips/dev/ite8181var.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/hpcmips/dev/ite8181var.h,v retrieving revision 1.6 diff -u -p -r1.6 ite8181var.h --- sys/arch/hpcmips/dev/ite8181var.h 16 Sep 2001 05:32:18 -0000 1.6 +++ sys/arch/hpcmips/dev/ite8181var.h 28 Sep 2012 14:03:59 -0000 @@ -37,7 +37,7 @@ #include struct ite8181_softc { - struct device sc_dev; + device_t sc_dev; bus_addr_t sc_baseaddr; bus_space_tag_t sc_iot; bus_space_handle_t sc_ioh; Index: sys/arch/hpcmips/dev/m38813c.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/hpcmips/dev/m38813c.c,v retrieving revision 1.12 diff -u -p -r1.12 m38813c.c --- sys/arch/hpcmips/dev/m38813c.c 28 Apr 2008 20:23:21 -0000 1.12 +++ sys/arch/hpcmips/dev/m38813c.c 27 Sep 2012 22:25:43 -0000 @@ -64,14 +64,13 @@ struct m38813c_chip { }; struct m38813c_softc { - struct device sc_dev; struct m38813c_chip *sc_chip; tx_chipset_tag_t sc_tc; void *sc_ih; }; -int m38813c_match(struct device *, struct cfdata *, void *); -void m38813c_attach(struct device *, struct device *, void *); +int m38813c_match(device_t, cfdata_t, void *); +void m38813c_attach(device_t, device_t, void *); int m38813c_intr(void *); int m38813c_poll(void *); void m38813c_ifsetup(struct m38813c_chip *); @@ -79,21 +78,21 @@ int m38813c_input_establish(void *, stru struct m38813c_chip m38813c_chip; -CFATTACH_DECL(m38813c, sizeof(struct m38813c_softc), +CFATTACH_DECL_NEW(m38813c, sizeof(struct m38813c_softc), m38813c_match, m38813c_attach, NULL, NULL); int -m38813c_match(struct device *parent, struct cfdata *cf, void *aux) +m38813c_match(device_t parent, cfdata_t cf, void *aux) { return (1); } void -m38813c_attach(struct device *parent, struct device *self, void *aux) +m38813c_attach(device_t parent, device_t self, void *aux) { struct cs_attach_args *ca = aux; - struct m38813c_softc *sc = (void*)self; + struct m38813c_softc *sc = device_private(self); struct hpckbd_attach_args haa; sc->sc_tc = ca->ca_tc; Index: sys/arch/hpcmips/dev/mq200.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/hpcmips/dev/mq200.c,v retrieving revision 1.30 diff -u -p -r1.30 mq200.c --- sys/arch/hpcmips/dev/mq200.c 18 Mar 2009 16:00:11 -0000 1.30 +++ sys/arch/hpcmips/dev/mq200.c 27 Sep 2012 22:29:50 -0000 @@ -130,7 +130,7 @@ mq200_attach(struct mq200_softc *sc) } printf("\n"); printf("%s: framebuffer address: 0x%08lx\n", - sc->sc_dev.dv_xname, (u_long)bootinfo->fb_addr); + device_xname(sc->sc_dev), (u_long)bootinfo->fb_addr); /* * setup registers @@ -157,7 +157,7 @@ mq200_attach(struct mq200_softc *sc) case 16: mode = MQ200_GCC_16BPP_DIRECT; break; default: printf("%s: %dbpp isn't supported\n", - sc->sc_dev.dv_xname, sc->sc_fbconf.hf_pixel_width); + device_xname(sc->sc_dev), sc->sc_fbconf.hf_pixel_width); return; } @@ -199,11 +199,11 @@ mq200_attach(struct mq200_softc *sc) /* Add a power hook to power saving */ sc->sc_mq200pwstate = MQ200_POWERSTATE_D0; - sc->sc_powerhook = powerhook_establish(sc->sc_dev.dv_xname, + sc->sc_powerhook = powerhook_establish(device_xname(sc->sc_dev), mq200_power, sc); if (sc->sc_powerhook == NULL) printf("%s: WARNING: unable to establish power hook\n", - sc->sc_dev.dv_xname); + device_xname(sc->sc_dev)); /* Add a hard power hook to power saving */ sc->sc_hardpowerhook = config_hook(CONFIG_HOOK_PMEVENT, @@ -212,7 +212,7 @@ mq200_attach(struct mq200_softc *sc) mq200_hardpower, sc); if (sc->sc_hardpowerhook == NULL) printf("%s: WARNING: unable to establish hard power hook\n", - sc->sc_dev.dv_xname); + device_xname(sc->sc_dev)); /* initialize backlight brightness and lcd contrast */ sc->sc_lcd_inited = 0; @@ -234,7 +234,7 @@ mq200_attach(struct mq200_softc *sc) ha.ha_ndspconf = 1; ha.ha_dspconflist = &sc->sc_dspconf; - config_found(&sc->sc_dev, &ha, hpcfbprint); + config_found(sc->sc_dev, &ha, hpcfbprint); #if NBIVIDEO > 0 /* Index: sys/arch/hpcmips/dev/mq200_pci.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/hpcmips/dev/mq200_pci.c,v retrieving revision 1.4 diff -u -p -r1.4 mq200_pci.c --- sys/arch/hpcmips/dev/mq200_pci.c 2 Oct 2002 05:26:46 -0000 1.4 +++ sys/arch/hpcmips/dev/mq200_pci.c 27 Sep 2012 22:29:09 -0000 @@ -51,14 +51,14 @@ struct mq200_pci_softc { pcitag_t sc_pcitag; }; -int mq200_pci_match(struct device *, struct cfdata *, void *); -void mq200_pci_attach(struct device *, struct device *, void *); +int mq200_pci_match(device_t, cfdata_t, void *); +void mq200_pci_attach(device_t, device_t, void *); -CFATTACH_DECL(mqvideo_pci, sizeof(struct mq200_pci_softc), +CFATTACH_DECL_NEW(mqvideo_pci, sizeof(struct mq200_pci_softc), mq200_pci_match, mq200_pci_attach, NULL, NULL); int -mq200_pci_match(struct device *parent, struct cfdata *match, void *aux) +mq200_pci_match(device_t parent, cfdata_t match, void *aux) { struct pci_attach_args *pa = aux; @@ -71,20 +71,21 @@ mq200_pci_match(struct device *parent, s } void -mq200_pci_attach(struct device *parent, struct device *self, void *aux) +mq200_pci_attach(device_t parent, device_t self, void *aux) { - struct mq200_pci_softc *psc = (void *) self; + struct mq200_pci_softc *psc = device_private(self); struct mq200_softc *sc = &psc->sc_mq200; struct pci_attach_args *pa = aux; int res; + sc->sc_dev = self; psc->sc_pc = pa->pa_pc; psc->sc_pcitag = pa->pa_tag; /* check whether it is disabled by firmware */ if (!(pci_conf_read(pa->pa_pc, pa->pa_tag, PCI_COMMAND_STATUS_REG) & PCI_COMMAND_MEM_ENABLE)) { - printf("%s: disabled\n", sc->sc_dev.dv_xname); + printf("%s: disabled\n", device_xname(sc->sc_dev)); return; } @@ -92,7 +93,7 @@ mq200_pci_attach(struct device *parent, res = pci_mapreg_map(pa, PCI_MAPREG_START, PCI_MAPREG_TYPE_MEM, 0, &sc->sc_iot, &sc->sc_ioh, NULL, NULL); if (res != 0) { - printf("%s: can't map registers\n", sc->sc_dev.dv_xname); + printf("%s: can't map registers\n", device_xname(sc->sc_dev)); return; } @@ -100,7 +101,7 @@ mq200_pci_attach(struct device *parent, res = pci_mapreg_info(psc->sc_pc, psc->sc_pcitag, PCI_MAPREG_START+4, PCI_MAPREG_TYPE_MEM, &sc->sc_baseaddr, NULL, NULL); if (res != 0) { - printf("%s: can't map frame buffer\n", sc->sc_dev.dv_xname); + printf("%s: can't map frame buffer\n", device_xname(sc->sc_dev)); return; } Index: sys/arch/hpcmips/dev/mq200var.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/hpcmips/dev/mq200var.h,v retrieving revision 1.7 diff -u -p -r1.7 mq200var.h --- sys/arch/hpcmips/dev/mq200var.h 16 Sep 2001 05:32:18 -0000 1.7 +++ sys/arch/hpcmips/dev/mq200var.h 28 Sep 2012 14:01:43 -0000 @@ -39,7 +39,7 @@ #include struct mq200_softc { - struct device sc_dev; + device_t sc_dev; bus_addr_t sc_baseaddr; bus_space_tag_t sc_iot; bus_space_handle_t sc_ioh; Index: sys/arch/hpcmips/dev/optpoint.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/hpcmips/dev/optpoint.c,v retrieving revision 1.6 diff -u -p -r1.6 optpoint.c --- sys/arch/hpcmips/dev/optpoint.c 4 Mar 2007 05:59:52 -0000 1.6 +++ sys/arch/hpcmips/dev/optpoint.c 28 Sep 2012 17:58:07 -0000 @@ -54,11 +54,11 @@ __KERNEL_RCSID(0, "$NetBSD: optpoint.c,v #endif struct optpoint_softc { - struct device sc_dev; + device_t sc_dev; tx_chipset_tag_t sc_tc; struct tx39spi_softc *sc_spi; struct hpcio_chip *sc_hc; - struct device *sc_wsmousedev; + device_t sc_wsmousedev; void *sc_powerhook; /* power management hook */ char packet[4]; int index; /* number of bytes received for this packet */ @@ -66,8 +66,8 @@ struct optpoint_softc { int enabled; }; -static int optpoint_match(struct device *, struct cfdata *, void *); -static void optpoint_attach(struct device *, struct device *, void *); +static int optpoint_match(device_t, cfdata_t, void *); +static void optpoint_attach(device_t, device_t, void *); static int optpoint_intr(void *); static int optpoint_enable(void *); static void optpoint_disable(void *); @@ -88,7 +88,7 @@ static int optpoint_power(void *, int, l #define TELIOS_MFIO_OPTP_C_REQ TX39_IO_MFIO_CARDIOWR #define TELIOS_MFIO_OPTP_S_ENB_N TX39_IO_MFIO_CARDIORD -CFATTACH_DECL(optpoint, sizeof(struct optpoint_softc), +CFATTACH_DECL_NEW(optpoint, sizeof(struct optpoint_softc), optpoint_match, optpoint_attach, NULL, NULL); const struct wsmouse_accessops optpoint_accessops = { @@ -98,20 +98,21 @@ const struct wsmouse_accessops optpoint_ }; int -optpoint_match(struct device *parent, struct cfdata *cf, void *aux) +optpoint_match(device_t parent, cfdata_t cf, void *aux) { return (ATTACH_NORMAL); } void -optpoint_attach(struct device *parent, struct device *self, void *aux) +optpoint_attach(device_t parent, device_t self, void *aux) { struct txspi_attach_args *ta = aux; - struct optpoint_softc *sc = (void*)self; - struct tx39spi_softc *spi = sc->sc_spi = (void*)parent; + struct optpoint_softc *sc = device_private(self); + struct tx39spi_softc *spi = sc->sc_spi = device_private(parent); tx_chipset_tag_t tc = sc->sc_tc = ta->sa_tc; struct wsmousedev_attach_args wsmaa; + sc->sc_dev = self; sc->sc_hc = tc->tc_iochip[MFIO]; sc->enabled = 0; @@ -139,27 +140,27 @@ optpoint_attach(struct device *parent, s #ifdef DIAGNOSTIC if (sc->sc_powerhook == 0) printf("%s: unable to establish hard power hook", - sc->sc_dev.dv_xname); + device_xname(sc->sc_dev)); #endif } int -optpoint_intr(void *self) +optpoint_intr(void *arg) { - struct optpoint_softc *sc = (void*)self; + struct optpoint_softc *sc = arg; tx_chipset_tag_t tc = sc->sc_tc; char data = optpoint_recv(sc) & 0xff; #ifdef DIAGNOSTIC if (sc->index >= 3){ - printf("%s: Receive buffer overflow\n", sc->sc_dev.dv_xname); + printf("%s: Receive buffer overflow\n", device_xname(sc->sc_dev)); sc->index = 0; memset(sc->packet, 0, 3); } #endif if ((sc->index == 1) && (data & 0xcc) != 0x08){ DPRINTF(("%s: Bad second byte (0x%02x)\n", - sc->sc_dev.dv_xname, data)); + device_xname(sc->sc_dev), data)); tx_conf_write(tc, TX39_INTRCLEAR4_REG, TX39_INTRSTATUS4_OPTPOINTINT); return 0; @@ -175,7 +176,7 @@ optpoint_intr(void *self) if (dx || dy || changed){ DPRINTF(("%s: buttons=0x%x, dx=%d, dy=%d\n", - sc->sc_dev.dv_xname, newbuttons, dx, dy)); + device_xname(sc->sc_dev), newbuttons, dx, dy)); wsmouse_input(sc->sc_wsmousedev, newbuttons, dx, dy, 0, 0, @@ -191,16 +192,16 @@ optpoint_intr(void *self) } int -optpoint_enable(void *self) +optpoint_enable(void *arg) { - struct optpoint_softc *sc = (void*)self; + struct optpoint_softc *sc = arg; if (!sc->enabled){ tx_chipset_tag_t tc = sc->sc_tc; struct hpcio_chip *hc = sc->sc_hc; int s = spltty(); - DPRINTF(("%s: enable\n", sc->sc_dev.dv_xname)); + DPRINTF(("%s: enable\n", device_xname(sc->sc_dev))); sc->enabled = 1; sc->index = 0; @@ -222,16 +223,16 @@ optpoint_enable(void *self) } void -optpoint_disable(void *self) +optpoint_disable(void *arg) { - struct optpoint_softc *sc = (void*)self; + struct optpoint_softc *sc = arg; if (sc->enabled){ tx_chipset_tag_t tc = sc->sc_tc; struct hpcio_chip *hc = sc->sc_hc; int s = spltty(); - DPRINTF(("%s: disable\n", sc->sc_dev.dv_xname)); + DPRINTF(("%s: disable\n", device_xname(sc->sc_dev))); sc->enabled = 0; (*hc->hc_portwrite)(hc, TELIOS_MFIO_OPTP_C_REQ, 0); @@ -244,7 +245,7 @@ optpoint_disable(void *self) } int -optpoint_ioctl(void *self, u_long cmd, void *data, int flag, struct lwp *l) +optpoint_ioctl(void *cookie, u_long cmd, void *data, int flag, struct lwp *l) { switch (cmd) { case WSMOUSEIO_GTYPE: @@ -258,9 +259,9 @@ optpoint_ioctl(void *self, u_long cmd, v } int -optpoint_initialize(void *self) +optpoint_initialize(void *arg) { - struct optpoint_softc *sc = (void*)self; + struct optpoint_softc *sc = arg; struct hpcio_chip *hc = sc->sc_hc; tx_chipset_tag_t tc = sc->sc_tc; @@ -306,9 +307,9 @@ optpoint_recv(struct optpoint_softc *sc) } int -optpoint_power(void *self, int type, long id, void *msg) +optpoint_power(void *arg, int type, long id, void *msg) { - struct optpoint_softc *sc = (void *)self; + struct optpoint_softc *sc = arg; int why = (int)msg; switch (why) { Index: sys/arch/hpcmips/dev/plum.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/hpcmips/dev/plum.c,v retrieving revision 1.13 diff -u -p -r1.13 plum.c --- sys/arch/hpcmips/dev/plum.c 28 Apr 2008 20:23:21 -0000 1.13 +++ sys/arch/hpcmips/dev/plum.c 2 Oct 2012 01:20:56 -0000 @@ -45,13 +45,12 @@ __KERNEL_RCSID(0, "$NetBSD: plum.c,v 1.1 #include #include -int plum_match(struct device *, struct cfdata *, void *); -void plum_attach(struct device *, struct device *, void *); +int plum_match(device_t, cfdata_t, void *); +void plum_attach(device_t, device_t, void *); int plum_print(void *, const char *); -int plum_search(struct device *, struct cfdata *, const int *, void *); +int plum_search(device_t, cfdata_t, const int *, void *); struct plum_softc { - struct device sc_dev; plum_chipset_tag_t sc_pc; bus_space_tag_t sc_csregt; bus_space_tag_t sc_csiot; @@ -60,13 +59,13 @@ struct plum_softc { int sc_pri; }; -CFATTACH_DECL(plum, sizeof(struct plum_softc), +CFATTACH_DECL_NEW(plum, sizeof(struct plum_softc), plum_match, plum_attach, NULL, NULL); plumreg_t plum_idcheck(bus_space_tag_t); int -plum_match(struct device *parent, struct cfdata *cf, void *aux) +plum_match(device_t parent, cfdata_t cf, void *aux) { struct cs_attach_args *ca = aux; @@ -82,10 +81,10 @@ plum_match(struct device *parent, struct } void -plum_attach(struct device *parent, struct device *self, void *aux) +plum_attach(device_t parent, device_t self, void *aux) { struct cs_attach_args *ca = aux; - struct plum_softc *sc = (void*)self; + struct plum_softc *sc = device_private(self); plumreg_t reg; sc->sc_csregt = ca->ca_csreg.cstag; @@ -150,10 +149,9 @@ plum_print(void *aux, const char *pnp) } int -plum_search(struct device *parent, struct cfdata *cf, - const int *ldesc, void *aux) +plum_search(device_t parent, cfdata_t cf, const int *ldesc, void *aux) { - struct plum_softc *sc = (void*)parent; + struct plum_softc *sc = device_private(parent); struct plum_attach_args pa; pa.pa_pc = sc->sc_pc; Index: sys/arch/hpcmips/dev/plumicu.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/hpcmips/dev/plumicu.c,v retrieving revision 1.11 diff -u -p -r1.11 plumicu.c --- sys/arch/hpcmips/dev/plumicu.c 28 Apr 2008 20:23:21 -0000 1.11 +++ sys/arch/hpcmips/dev/plumicu.c 27 Sep 2012 22:40:10 -0000 @@ -50,8 +50,8 @@ __KERNEL_RCSID(0, "$NetBSD: plumicu.c,v #define DPRINTF(arg) #endif -int plumicu_match(struct device *, struct cfdata *, void *); -void plumicu_attach(struct device *, struct device *, void *); +int plumicu_match(device_t, cfdata_t, void *); +void plumicu_attach(device_t, device_t, void *); int plumicu_intr(void *); static inline void plum_di(plum_chipset_tag_t); @@ -142,7 +142,6 @@ struct plum_intr_entry { }; struct plumicu_softc { - struct device sc_dev; plum_chipset_tag_t sc_pc; bus_space_tag_t sc_regt; bus_space_handle_t sc_regh; @@ -151,7 +150,7 @@ struct plumicu_softc { struct plum_intr_entry sc_intr[PLUM_INTR_MAX]; }; -CFATTACH_DECL(plumicu, sizeof(struct plumicu_softc), +CFATTACH_DECL_NEW(plumicu, sizeof(struct plumicu_softc), plumicu_match, plumicu_attach, NULL, NULL); #ifdef PLUMICUDEBUG @@ -159,17 +158,17 @@ void plumicu_dump(struct plumicu_softc * #endif int -plumicu_match(struct device *parent, struct cfdata *cf, void *aux) +plumicu_match(device_t parent, cfdata_t cf, void *aux) { return (2); /* 1st attach group */ } void -plumicu_attach(struct device *parent, struct device *self, void *aux) +plumicu_attach(device_t parent, device_t self, void *aux) { struct plum_attach_args *pa = aux; - struct plumicu_softc *sc = (void*)self; + struct plumicu_softc *sc = device_private(self); const struct plum_intr_ctrl *pic; bus_space_tag_t regt; bus_space_handle_t regh; Index: sys/arch/hpcmips/dev/plumiobus.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/hpcmips/dev/plumiobus.c,v retrieving revision 1.13 diff -u -p -r1.13 plumiobus.c --- sys/arch/hpcmips/dev/plumiobus.c 28 Apr 2008 20:23:21 -0000 1.13 +++ sys/arch/hpcmips/dev/plumiobus.c 29 Sep 2012 10:30:45 -0000 @@ -60,11 +60,10 @@ int plumiobus_debug = 0; #define DPRINTFN(n, arg) #endif -int plumiobus_match(struct device *, struct cfdata *, void *); -void plumiobus_attach(struct device *, struct device *, void *); +int plumiobus_match(device_t, cfdata_t, void *); +void plumiobus_attach(device_t, device_t, void *); int plumiobus_print(void *, const char *); -int plumiobus_search(struct device *, struct cfdata *, - const int *, void *); +int plumiobus_search(device_t, cfdata_t , const int *, void *); struct plumisa_resource { int pr_irq; @@ -73,7 +72,6 @@ struct plumisa_resource { }; struct plumiobus_softc { - struct device sc_dev; plum_chipset_tag_t sc_pc; bus_space_tag_t sc_regt; bus_space_handle_t sc_regh; @@ -82,7 +80,7 @@ struct plumiobus_softc { struct plumisa_resource sc_isa[PLUM_IOBUS_IO5CSMAX]; }; -CFATTACH_DECL(plumiobus, sizeof(struct plumiobus_softc), +CFATTACH_DECL_NEW(plumiobus, sizeof(struct plumiobus_softc), plumiobus_match, plumiobus_attach, NULL, NULL); bus_space_tag_t __plumiobus_subregion(bus_space_tag_t, bus_addr_t, @@ -92,17 +90,17 @@ void plumiobus_dump(struct plumiobus_sof #endif int -plumiobus_match(struct device *parent, struct cfdata *cf, void *aux) +plumiobus_match(device_t parent, cfdata_t cf, void *aux) { return (1); } void -plumiobus_attach(struct device *parent, struct device *self, void *aux) +plumiobus_attach(device_t parent, device_t self, void *aux) { struct plum_attach_args *pa = aux; - struct plumiobus_softc *sc = (void*)self; + struct plumiobus_softc *sc = device_private(self); struct plumisa_resource *pr; sc->sc_pc = pa->pa_pc; @@ -186,10 +184,9 @@ __plumiobus_subregion(bus_space_tag_t t, } int -plumiobus_search(struct device *parent, struct cfdata *cf, - const int *ldesc, void *aux) +plumiobus_search(device_t parent, cfdata_t cf, const int *ldesc, void *aux) { - struct plumiobus_softc *sc = (void*)parent; + struct plumiobus_softc *sc = device_private(parent); struct plumiobus_attach_args pba; int slot; Index: sys/arch/hpcmips/dev/plumohci.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/hpcmips/dev/plumohci.c,v retrieving revision 1.13 diff -u -p -r1.13 plumohci.c --- sys/arch/hpcmips/dev/plumohci.c 20 Jul 2010 15:06:43 -0000 1.13 +++ sys/arch/hpcmips/dev/plumohci.c 26 Sep 2012 21:34:18 -0000 @@ -65,8 +65,8 @@ __KERNEL_RCSID(0, "$NetBSD: plumohci.c,v #include #include -int plumohci_match(struct device *, struct cfdata *, void *); -void plumohci_attach(struct device *, struct device *, void *); +int plumohci_match(device_t, cfdata_t, void *); +void plumohci_attach(device_t, device_t, void *); int plumohci_intr(void *); void __plumohci_dmamap_sync(bus_dma_tag_t, bus_dmamap_t, @@ -120,7 +120,7 @@ CFATTACH_DECL_NEW(plumohci, sizeof(struc plumohci_match, plumohci_attach, NULL, NULL); int -plumohci_match(struct device *parent, struct cfdata *match, void *aux) +plumohci_match(device_t parent, cfdata_t match, void *aux) { /* PLUM2 builtin OHCI module */ @@ -128,7 +128,7 @@ plumohci_match(struct device *parent, st } void -plumohci_attach(struct device *parent, struct device *self, void *aux) +plumohci_attach(device_t parent, device_t self, void *aux) { struct plumohci_softc *sc = device_private(self); struct plum_attach_args *pa = aux; Index: sys/arch/hpcmips/dev/plumpcmcia.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/hpcmips/dev/plumpcmcia.c,v retrieving revision 1.25 diff -u -p -r1.25 plumpcmcia.c --- sys/arch/hpcmips/dev/plumpcmcia.c 26 Jul 2011 22:52:48 -0000 1.25 +++ sys/arch/hpcmips/dev/plumpcmcia.c 1 Oct 2012 15:38:32 -0000 @@ -58,8 +58,8 @@ __KERNEL_RCSID(0, "$NetBSD: plumpcmcia.c #endif #include -int plumpcmcia_match(struct device *, struct cfdata *, void *); -void plumpcmcia_attach(struct device *, struct device *, void *); +int plumpcmcia_match(device_t, cfdata_t, void *); +void plumpcmcia_attach(device_t, device_t, void *); int plumpcmcia_print(void *, const char *); int plumpcmcia_power(void *, int, long, void *); @@ -68,9 +68,9 @@ struct plumpcmcia_softc; struct plumpcmcia_handle { /* parent */ - struct device *ph_parent; + device_t ph_parent; /* child */ - struct device *ph_pcmcia; + device_t ph_pcmcia; /* PCMCIA controller register space */ bus_space_tag_t ph_regt; @@ -121,7 +121,7 @@ struct plumpcmcia_event { }; struct plumpcmcia_softc { - struct device sc_dev; + device_t sc_dev; plum_chipset_tag_t sc_pc; /* Register space */ @@ -198,23 +198,24 @@ static void __memareadump(plumreg_t) __D static void plumpcmcia_dump(struct plumpcmcia_softc *) __DEBUG_FUNC; #endif /* PLUMPCMCIA_DEBUG */ -CFATTACH_DECL(plumpcmcia, sizeof(struct plumpcmcia_softc), +CFATTACH_DECL_NEW(plumpcmcia, sizeof(struct plumpcmcia_softc), plumpcmcia_match, plumpcmcia_attach, NULL, NULL); int -plumpcmcia_match(struct device *parent, struct cfdata *cf, void *aux) +plumpcmcia_match(device_t parent, cfdata_t cf, void *aux) { return (1); } void -plumpcmcia_attach(struct device *parent, struct device *self, void *aux) +plumpcmcia_attach(device_t parent, device_t self, void *aux) { struct plum_attach_args *pa = aux; - struct plumpcmcia_softc *sc = (void*)self; + struct plumpcmcia_softc *sc = device_private(self); struct plumpcmcia_handle *ph; int error; + sc->sc_dev = self; sc->sc_pc = pa->pa_pc; sc->sc_regt = pa->pa_regt; @@ -240,7 +241,7 @@ plumpcmcia_attach(struct device *parent, /* Slot0/1 CSC event queue */ SIMPLEQ_INIT (&sc->sc_event_head); error = kthread_create(PRI_NONE, 0, NULL, plumpcmcia_event_thread, - sc, &sc->sc_event_thread, "%s", sc->sc_dev.dv_xname); + sc, &sc->sc_event_thread, "%s", device_xname(self)); KASSERT(error == 0); /* Slot 0 */ @@ -259,7 +260,7 @@ plumpcmcia_attach(struct device *parent, &ph->ph_regh); ph->ph_iot = pa->pa_iot; ph->ph_memt = pa->pa_iot; - ph->ph_parent = (void*)sc; + ph->ph_parent = self; plum_csc_intr_setup(sc, ph, PLUM_INT_C1SC); plum_power_establish(sc->sc_pc, PLUM_PWR_PCC1); @@ -281,7 +282,7 @@ plumpcmcia_attach(struct device *parent, &ph->ph_regh); ph->ph_iot = pa->pa_iot; ph->ph_memt = pa->pa_iot; - ph->ph_parent = (void*)sc; + ph->ph_parent = self; plum_csc_intr_setup(sc, ph, PLUM_INT_C2SC); plum_power_establish(sc->sc_pc, PLUM_PWR_PCC2); @@ -302,7 +303,7 @@ static void plumpcmcia_attach_socket(struct plumpcmcia_handle *ph) { struct pcmciabus_attach_args paa; - struct plumpcmcia_softc *sc = (void*)ph->ph_parent; + struct plumpcmcia_softc *sc = device_private(ph->ph_parent); paa.paa_busname = "pcmcia"; paa.pct = (pcmcia_chipset_tag_t)&plumpcmcia_functions; @@ -328,8 +329,8 @@ plumpcmcia_chip_intr_establish(pcmcia_ch struct pcmcia_function *pf, int ipl, int (*ih_fun)(void *), void *ih_arg) { - struct plumpcmcia_handle *ph = (void*)pch; - struct plumpcmcia_softc *sc = (void*)ph->ph_parent; + struct plumpcmcia_handle *ph = (void *)pch; + struct plumpcmcia_softc *sc = device_private(ph->ph_parent); if (!(ph->ph_card_ih = plum_intr_establish(sc->sc_pc, ph->ph_plum_irq, @@ -344,8 +345,8 @@ plumpcmcia_chip_intr_establish(pcmcia_ch static void plumpcmcia_chip_intr_disestablish(pcmcia_chipset_handle_t pch, void *ih) { - struct plumpcmcia_handle *ph = (void*)pch; - struct plumpcmcia_softc *sc = (void*)ph->ph_parent; + struct plumpcmcia_handle *ph = pch; + struct plumpcmcia_softc *sc = device_private(ph->ph_parent); plum_intr_disestablish(sc->sc_pc, ih); } @@ -805,7 +806,7 @@ plumpcmcia_chip_socket_settype(pcmcia_ch reg |= PLUM_PCMCIA_GENCTRL_CARDTYPE_MEM; DPRINTF(("%s: plumpcmcia_chip_socket_enable type %s %02x\n", - ph->ph_parent->dv_xname, + device_xname(ph->ph_parent), ((cardtype == PCMCIA_IFTYPE_IO) ? "io" : "mem"), reg)); plum_conf_write(regt, regh, PLUM_PCMCIA_GENCTRL, reg); @@ -864,7 +865,7 @@ static int plum_csc_intr(void *arg) { struct plumpcmcia_handle *ph = arg; - struct plumpcmcia_softc *sc = (void *)ph->ph_parent; + struct plumpcmcia_softc *sc = device_private(ph->ph_parent); struct plumpcmcia_event *pe; bus_space_tag_t regt = ph->ph_regt; bus_space_handle_t regh = ph->ph_regh; @@ -974,7 +975,7 @@ plumpcmcia_power(void *ctx, int type, lo switch (why) { case PWR_RESUME: - DPRINTF(("%s: ON\n", sc->sc_dev.dv_xname)); + DPRINTF(("%s: ON\n", device_xname(sc->sc_dev))); /* power on */ plum_conf_write(regt, regh, PLUM_PCMCIA_CARDPWRCTRL, PLUM_PCMCIA_CARDPWRCTRL_ON); @@ -984,7 +985,7 @@ plumpcmcia_power(void *ctx, int type, lo case PWR_STANDBY: plum_conf_write(regt, regh, PLUM_PCMCIA_CARDPWRCTRL, PLUM_PCMCIA_CARDPWRCTRL_OFF); - DPRINTF(("%s: OFF\n", sc->sc_dev.dv_xname)); + DPRINTF(("%s: OFF\n", device_xname(sc->sc_dev))); break; } Index: sys/arch/hpcmips/dev/plumpower.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/hpcmips/dev/plumpower.c,v retrieving revision 1.12 diff -u -p -r1.12 plumpower.c --- sys/arch/hpcmips/dev/plumpower.c 28 Apr 2008 20:23:21 -0000 1.12 +++ sys/arch/hpcmips/dev/plumpower.c 27 Sep 2012 22:42:23 -0000 @@ -56,17 +56,16 @@ int plumpower_debug = 1; #define DPRINTFN(n, arg) #endif -int plumpower_match(struct device *, struct cfdata *, void *); -void plumpower_attach(struct device *, struct device *, void *); +int plumpower_match(device_t, cfdata_t, void *); +void plumpower_attach(device_t, device_t, void *); struct plumpower_softc { - struct device sc_dev; plum_chipset_tag_t sc_pc; bus_space_tag_t sc_regt; bus_space_handle_t sc_regh; }; -CFATTACH_DECL(plumpower, sizeof(struct plumpower_softc), +CFATTACH_DECL_NEW(plumpower, sizeof(struct plumpower_softc), plumpower_match, plumpower_attach, NULL, NULL); #ifdef PLUMPOWERDEBUG @@ -74,16 +73,16 @@ static void plumpower_dump(struct plumpo #endif int -plumpower_match(struct device *parent, struct cfdata *cf, void *aux) +plumpower_match(device_t parent, cfdata_t cf, void *aux) { return 2; /* 1st attach group */ } void -plumpower_attach(struct device *parent, struct device *self, void *aux) +plumpower_attach(device_t parent, device_t self, void *aux) { struct plum_attach_args *pa = aux; - struct plumpower_softc *sc = (void*)self; + struct plumpower_softc *sc = device_private(self); printf("\n"); sc->sc_pc = pa->pa_pc; Index: sys/arch/hpcmips/dev/plumvideo.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/hpcmips/dev/plumvideo.c,v retrieving revision 1.40 diff -u -p -r1.40 plumvideo.c --- sys/arch/hpcmips/dev/plumvideo.c 18 Mar 2009 10:22:28 -0000 1.40 +++ sys/arch/hpcmips/dev/plumvideo.c 9 Oct 2012 01:27:13 -0000 @@ -82,7 +82,7 @@ int plumvideo_debug = 1; #endif struct plumvideo_softc { - struct device sc_dev; + device_t sc_dev; tx_chipset_tag_t sc_tc; plum_chipset_tag_t sc_pc; @@ -111,13 +111,13 @@ struct plumvideo_softc { struct hpcfb_dspconf sc_dspconf; }; -int plumvideo_match(struct device*, struct cfdata*, void*); -void plumvideo_attach(struct device*, struct device*, void*); +int plumvideo_match(device_t, cfdata_t, void *); +void plumvideo_attach(device_t, device_t, void *); int plumvideo_ioctl(void *, u_long, void *, int, struct lwp *); paddr_t plumvideo_mmap(void *, off_t, int); -CFATTACH_DECL(plumvideo, sizeof(struct plumvideo_softc), +CFATTACH_DECL_NEW(plumvideo, sizeof(struct plumvideo_softc), plumvideo_match, plumvideo_attach, NULL, NULL); struct hpcfb_accessops plumvideo_ha = { @@ -147,7 +147,7 @@ void plumvideo_dump(struct plumvideo_sof #define OFF 0 int -plumvideo_match(struct device *parent, struct cfdata *cf, void *aux) +plumvideo_match(device_t parent, cfdata_t cf, void *aux) { /* * VRAM area also uses as UHOSTC shared RAM. @@ -156,13 +156,14 @@ plumvideo_match(struct device *parent, s } void -plumvideo_attach(struct device *parent, struct device *self, void *aux) +plumvideo_attach(device_t parent, device_t self, void *aux) { struct plum_attach_args *pa = aux; - struct plumvideo_softc *sc = (void*)self; + struct plumvideo_softc *sc = device_private(self); struct hpcfb_attach_args ha; int console, reverse_flag; + sc->sc_dev = self; sc->sc_console = console = cn_tab ? 0 : 1; sc->sc_pc = pa->pa_pc; sc->sc_regt = pa->pa_regt; @@ -425,7 +426,7 @@ plumvideo_init(struct plumvideo_softc *s int plumvideo_ioctl(void *v, u_long cmd, void *data, int flag, struct lwp *l) { - struct plumvideo_softc *sc = (struct plumvideo_softc *)v; + struct plumvideo_softc *sc = v; struct hpcfb_fbconf *fbconf; struct hpcfb_dspconf *dspconf; struct wsdisplay_cmap *cmap; @@ -604,7 +605,7 @@ out: paddr_t plumvideo_mmap(void *ctx, off_t offset, int prot) { - struct plumvideo_softc *sc = (struct plumvideo_softc *)ctx; + struct plumvideo_softc *sc = ctx; if (offset < 0 || (sc->sc_fbconf.hf_bytes_per_plane + sc->sc_fbconf.hf_offset) < offset) { @@ -765,14 +766,14 @@ plumvideo_power(void *ctx, int type, lon if (!sc->sc_console) return (0); /* serial console */ - DPRINTF(("%s: ON\n", sc->sc_dev.dv_xname)); + DPRINTF(("%s: ON\n", device_xname(sc->sc_dev))); /* power on */ plumvideo_backlight(sc, 1); break; case PWR_SUSPEND: /* FALLTHROUGH */ case PWR_STANDBY: - DPRINTF(("%s: OFF\n", sc->sc_dev.dv_xname)); + DPRINTF(("%s: OFF\n", device_xname(sc->sc_dev))); /* power off */ plumvideo_backlight(sc, 0); break; Index: sys/arch/hpcmips/dev/tc5165buf.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/hpcmips/dev/tc5165buf.c,v retrieving revision 1.16 diff -u -p -r1.16 tc5165buf.c --- sys/arch/hpcmips/dev/tc5165buf.c 28 Apr 2008 20:23:21 -0000 1.16 +++ sys/arch/hpcmips/dev/tc5165buf.c 27 Sep 2012 22:42:54 -0000 @@ -74,14 +74,13 @@ struct tc5165buf_chip { }; struct tc5165buf_softc { - struct device sc_dev; struct tc5165buf_chip *sc_chip; tx_chipset_tag_t sc_tc; void *sc_ih; }; -int tc5165buf_match(struct device *, struct cfdata *, void *); -void tc5165buf_attach(struct device *, struct device *, void *); +int tc5165buf_match(device_t, cfdata_t, void *); +void tc5165buf_attach(device_t, device_t, void *); int tc5165buf_intr(void *); int tc5165buf_poll(void *); void tc5165buf_soft(void *); @@ -91,21 +90,21 @@ int tc5165buf_input_establish(void *, st struct tc5165buf_chip tc5165buf_chip; -CFATTACH_DECL(tc5165buf, sizeof(struct tc5165buf_softc), +CFATTACH_DECL_NEW(tc5165buf, sizeof(struct tc5165buf_softc), tc5165buf_match, tc5165buf_attach, NULL, NULL); int -tc5165buf_match(struct device *parent, struct cfdata *cf, void *aux) +tc5165buf_match(device_t parent, cfdata_t cf, void *aux) { return (1); } void -tc5165buf_attach(struct device *parent, struct device *self, void *aux) +tc5165buf_attach(device_t parent, device_t self, void *aux) { struct cs_attach_args *ca = aux; - struct tc5165buf_softc *sc = (void*)self; + struct tc5165buf_softc *sc = device_private(self); struct hpckbd_attach_args haa; printf(": "); Index: sys/arch/hpcmips/dev/teliosio.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/hpcmips/dev/teliosio.c,v retrieving revision 1.3 diff -u -p -r1.3 teliosio.c --- sys/arch/hpcmips/dev/teliosio.c 31 May 2008 08:08:54 -0000 1.3 +++ sys/arch/hpcmips/dev/teliosio.c 27 Sep 2012 22:43:30 -0000 @@ -54,7 +54,6 @@ __KERNEL_RCSID(0, "$NetBSD: teliosio.c,v #include struct teliosio_softc { - struct device sc_dev; tx_chipset_tag_t sc_tc; bus_space_tag_t sc_regt; bus_space_handle_t sc_regh; @@ -66,8 +65,8 @@ struct teliosio_softc { ((n) <= 0 ? 0 : ((n) <= MAX_BRIGHTNESS ? (n) : MAX_BRIGHTNESS) * 9 - 1) }; -static int teliosio_match(struct device *, struct cfdata *, void *); -static void teliosio_attach(struct device *, struct device *, void *); +static int teliosio_match(device_t, cfdata_t, void *); +static void teliosio_attach(device_t, device_t, void *); static int teliosio_event(void *, int, long, void *); /* LCD backlight control */ @@ -82,21 +81,21 @@ static void teliosio_mbu_write(tx_chipse static int teliosio_mbu_read(tx_chipset_tag_t); #endif -CFATTACH_DECL(teliosio, sizeof(struct teliosio_softc), +CFATTACH_DECL_NEW(teliosio, sizeof(struct teliosio_softc), teliosio_match, teliosio_attach, NULL, NULL); static int -teliosio_match(struct device *parent, struct cfdata *cf, void *aux) +teliosio_match(device_t parent, cfdata_t cf, void *aux) { return 2; /* attach before plumvideo */ } static void -teliosio_attach(struct device *parent, struct device *self, void *aux) +teliosio_attach(device_t parent, device_t self, void *aux) { struct cs_attach_args *ca = aux; - struct teliosio_softc *sc = (void *)self; + struct teliosio_softc *sc = device_private(self); sc->sc_tc = ca->ca_tc; sc->sc_regt = ca->ca_csreg.cstag; Index: sys/arch/hpcmips/dev/ucb1200.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/hpcmips/dev/ucb1200.c,v retrieving revision 1.18 diff -u -p -r1.18 ucb1200.c --- sys/arch/hpcmips/dev/ucb1200.c 14 Mar 2009 15:36:06 -0000 1.18 +++ sys/arch/hpcmips/dev/ucb1200.c 29 Sep 2012 10:30:16 -0000 @@ -62,8 +62,7 @@ struct ucbchild_state { }; struct ucb1200_softc { - struct device sc_dev; - struct device *sc_parent; /* parent (TX39 SIB module) */ + device_t sc_parent; /* parent (TX39 SIB module) */ tx_chipset_tag_t sc_tc; int sc_snd_rate; /* passed down from SIB module */ @@ -73,18 +72,17 @@ struct ucb1200_softc { struct ucbchild_state sc_child[UCB1200_MODULE_MAX]; }; -int ucb1200_match(struct device *, struct cfdata *, void *); -void ucb1200_attach(struct device *, struct device *, void *); +int ucb1200_match(device_t, cfdata_t, void *); +void ucb1200_attach(device_t, device_t, void *); int ucb1200_print(void *, const char *); -int ucb1200_search(struct device *, struct cfdata *, - const int *, void *); +int ucb1200_search(device_t, cfdata_t, const int *, void *); int ucb1200_check_id(u_int16_t, int); #ifdef UCB1200_DEBUG void ucb1200_dump(struct ucb1200_softc *); #endif -CFATTACH_DECL(ucb, sizeof(struct ucb1200_softc), +CFATTACH_DECL_NEW(ucb, sizeof(struct ucb1200_softc), ucb1200_match, ucb1200_attach, NULL, NULL); const struct ucb_id { @@ -99,7 +97,7 @@ const struct ucb_id { }; int -ucb1200_match(struct device *parent, struct cfdata *cf, void *aux) +ucb1200_match(device_t parent, cfdata_t cf, void *aux) { struct txsib_attach_args *sa = aux; u_int16_t reg; @@ -112,10 +110,10 @@ ucb1200_match(struct device *parent, str } void -ucb1200_attach(struct device *parent, struct device *self, void *aux) +ucb1200_attach(device_t parent, device_t self, void *aux) { struct txsib_attach_args *sa = aux; - struct ucb1200_softc *sc = (void*)self; + struct ucb1200_softc *sc = device_private(self); u_int16_t reg; printf(": "); @@ -139,10 +137,9 @@ ucb1200_attach(struct device *parent, st } int -ucb1200_search(struct device *parent, struct cfdata *cf, - const int *ldesc, void *aux) +ucb1200_search(device_t parent, cfdata_t cf, const int *ldesc, void *aux) { - struct ucb1200_softc *sc = (void*)parent; + struct ucb1200_softc *sc = device_private(parent); struct ucb1200_attach_args ucba; ucba.ucba_tc = sc->sc_tc; @@ -183,19 +180,19 @@ ucb1200_check_id(u_int16_t idreg, int pr } void -ucb1200_state_install(struct device *dev, int (*sfun)(void *), void *sarg, +ucb1200_state_install(device_t dev, int (*sfun)(void *), void *sarg, int sid) { - struct ucb1200_softc *sc = (void*)dev; + struct ucb1200_softc *sc = device_private(dev); sc->sc_child[sid].cs_busy = sfun; sc->sc_child[sid].cs_arg = sarg; } int -ucb1200_state_idle(struct device *dev) +ucb1200_state_idle(device_t dev) { - struct ucb1200_softc *sc = (void*)dev; + struct ucb1200_softc *sc = device_private(dev); struct ucbchild_state *cs; int i; Index: sys/arch/hpcmips/dev/ucb1200var.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/hpcmips/dev/ucb1200var.h,v retrieving revision 1.5 diff -u -p -r1.5 ucb1200var.h --- sys/arch/hpcmips/dev/ucb1200var.h 28 Apr 2008 20:23:21 -0000 1.5 +++ sys/arch/hpcmips/dev/ucb1200var.h 2 Oct 2012 01:22:22 -0000 @@ -33,8 +33,8 @@ struct ucb1200_attach_args { tx_chipset_tag_t ucba_tc; int ucba_snd_rate; int ucba_tel_rate; - struct device *ucba_sib; - struct device *ucba_ucb; + device_t ucba_sib; + device_t ucba_ucb; }; #define UCB1200_TP_MODULE 0 @@ -42,6 +42,6 @@ struct ucb1200_attach_args { #define UCB1200_TEL_MODULE 2 #define UCB1200_MODULE_MAX 3 -void ucb1200_state_install(struct device *, int (*)(void *), void *, int); -int ucb1200_state_idle(struct device *); +void ucb1200_state_install(device_t, int (*)(void *), void *, int); +int ucb1200_state_idle(device_t); Index: sys/arch/hpcmips/dev/ucbio.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/hpcmips/dev/ucbio.c,v retrieving revision 1.11 diff -u -p -r1.11 ucbio.c --- sys/arch/hpcmips/dev/ucbio.c 28 Apr 2008 20:23:21 -0000 1.11 +++ sys/arch/hpcmips/dev/ucbio.c 2 Oct 2012 01:21:59 -0000 @@ -55,8 +55,8 @@ __KERNEL_RCSID(0, "$NetBSD: ucbio.c,v 1. #include -int ucbio_match(struct device*, struct cfdata *, void *); -void ucbio_attach(struct device*, struct device *, void *); +int ucbio_match(device_t, cfdata_t, void *); +void ucbio_attach(device_t, device_t, void *); struct betty_port_status { u_int16_t dir; @@ -64,14 +64,14 @@ struct betty_port_status { }; struct ucbio_softc { - struct device sc_dev; + device_t sc_dev; tx_chipset_tag_t sc_tc; struct betty_port_status sc_stat, sc_ostat; struct hpcio_chip sc_hc; }; -CFATTACH_DECL(ucbio, sizeof(struct ucbio_softc), +CFATTACH_DECL_NEW(ucbio, sizeof(struct ucbio_softc), ucbio_match, ucbio_attach, NULL, NULL); /* I/O */ @@ -86,18 +86,19 @@ static void betty_update(hpcio_chip_t); static void betty_dump(hpcio_chip_t); int -ucbio_match(struct device *parent, struct cfdata *cf, void *aux) +ucbio_match(device_t parent, cfdata_t cf, void *aux) { return (1); } void -ucbio_attach(struct device *parent, struct device *self, void *aux) +ucbio_attach(device_t parent, device_t self, void *aux) { struct ucb1200_attach_args *ucba = aux; - struct ucbio_softc *sc = (void *)self; + struct ucbio_softc *sc = device_private(self); struct hpcio_chip *hc = &sc->sc_hc; + sc->sc_dev = self; sc->sc_tc = ucba->ucba_tc; printf("\n"); @@ -151,7 +152,7 @@ betty_intr_establish(hpcio_chip_t hc, in { struct ucbio_softc *sc = hc->hc_sc; - printf("%s: %s not implemented.\n", sc->sc_dev.dv_xname, + printf("%s: %s not implemented.\n", device_xname(sc->sc_dev), __func__); return (0); @@ -162,7 +163,7 @@ betty_intr_disestablish(hpcio_chip_t hc, { struct ucbio_softc *sc = hc->hc_sc; - printf("%s: %s not implemented.\n", sc->sc_dev.dv_xname, + printf("%s: %s not implemented.\n", device_xname(sc->sc_dev), __func__); } Index: sys/arch/hpcmips/dev/ucbsnd.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/hpcmips/dev/ucbsnd.c,v retrieving revision 1.20 diff -u -p -r1.20 ucbsnd.c --- sys/arch/hpcmips/dev/ucbsnd.c 23 Nov 2011 23:07:29 -0000 1.20 +++ sys/arch/hpcmips/dev/ucbsnd.c 2 Oct 2012 01:23:11 -0000 @@ -114,9 +114,9 @@ struct ring_buf { }; struct ucbsnd_softc { - struct device sc_dev; - struct device *sc_sib; /* parent (TX39 SIB module) */ - struct device *sc_ucb; /* parent (UCB1200 module) */ + device_t sc_dev; + device_t sc_sib; /* parent (TX39 SIB module) */ + device_t sc_ucb; /* parent (UCB1200 module) */ tx_chipset_tag_t sc_tc; struct tx_sound_tag sc_tag; @@ -145,29 +145,29 @@ struct ucbsnd_softc { struct ring_buf sc_rb; }; -int ucbsnd_match(struct device*, struct cfdata*, void*); -void ucbsnd_attach(struct device*, struct device*, void*); +int ucbsnd_match(device_t, cfdata_t, void *); +void ucbsnd_attach(device_t, device_t, void *); -int ucbsnd_exec_output(void*); -int ucbsnd_busy(void*); +int ucbsnd_exec_output(void *); +int ucbsnd_busy(void *); -void ucbsnd_sound_init(struct ucbsnd_softc*); +void ucbsnd_sound_init(struct ucbsnd_softc *); void __ucbsnd_sound_click(tx_sound_tag_t); void __ucbsnd_sound_mute(tx_sound_tag_t, int); int ucbsndwrite_subr(struct ucbsnd_softc *, u_int32_t *, size_t, struct uio *); -int ringbuf_allocate(struct ring_buf*, size_t, int); -void ringbuf_deallocate(struct ring_buf*); -void ringbuf_reset(struct ring_buf*); -int ringbuf_full(struct ring_buf*); -void *ringbuf_producer_get(struct ring_buf*); -void ringbuf_producer_return(struct ring_buf*, size_t); -void *ringbuf_consumer_get(struct ring_buf*, size_t*); -void ringbuf_consumer_return(struct ring_buf*); +int ringbuf_allocate(struct ring_buf *, size_t, int); +void ringbuf_deallocate(struct ring_buf *); +void ringbuf_reset(struct ring_buf *); +int ringbuf_full(struct ring_buf *); +void *ringbuf_producer_get(struct ring_buf *); +void ringbuf_producer_return(struct ring_buf *, size_t); +void *ringbuf_consumer_get(struct ring_buf *, size_t *); +void ringbuf_consumer_return(struct ring_buf *); -CFATTACH_DECL(ucbsnd, sizeof(struct ucbsnd_softc), +CFATTACH_DECL_NEW(ucbsnd, sizeof(struct ucbsnd_softc), ucbsnd_match, ucbsnd_attach, NULL, NULL); dev_type_open(ucbsndopen); @@ -181,19 +181,20 @@ const struct cdevsw ucbsnd_cdevsw = { }; int -ucbsnd_match(struct device *parent, struct cfdata *cf, void *aux) +ucbsnd_match(device_t parent, cfdata_t cf, void *aux) { return (1); } void -ucbsnd_attach(struct device *parent, struct device *self, void *aux) +ucbsnd_attach(device_t parent, device_t self, void *aux) { struct ucb1200_attach_args *ucba = aux; - struct ucbsnd_softc *sc = (void*)self; + struct ucbsnd_softc *sc = device_private(self); tx_chipset_tag_t tc; + sc->sc_dev = self; tc = sc->sc_tc = ucba->ucba_tc; sc->sc_sib = ucba->ucba_sib; sc->sc_ucb = ucba->ucba_ucb; @@ -629,7 +630,7 @@ ucbsndwrite(dev_t dev, struct uio *uio, out: return (error); errout: - printf("%s: timeout. reset ring-buffer.\n", sc->sc_dev.dv_xname); + printf("%s: timeout. reset ring-buffer.\n", device_xname(sc->sc_dev)); s = splvm(); ringbuf_reset(&sc->sc_rb); splx(s); Index: sys/arch/hpcmips/dev/ucbtp.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/hpcmips/dev/ucbtp.c,v retrieving revision 1.20 diff -u -p -r1.20 ucbtp.c --- sys/arch/hpcmips/dev/ucbtp.c 16 Aug 2011 14:29:16 -0000 1.20 +++ sys/arch/hpcmips/dev/ucbtp.c 2 Oct 2012 01:23:40 -0000 @@ -108,9 +108,9 @@ enum ucbadc_state { }; struct ucbtp_softc { - struct device sc_dev; - struct device *sc_sib; /* parent (TX39 SIB module) */ - struct device *sc_ucb; /* parent (UCB1200 module) */ + device_t sc_dev; + device_t sc_sib; /* parent (TX39 SIB module) */ + device_t sc_ucb; /* parent (UCB1200 module) */ tx_chipset_tag_t sc_tc; enum ucbts_stat sc_stat; @@ -151,11 +151,11 @@ struct ucbtp_softc { int sm_rw_retry; /* retry counter for r/w */ /* wsmouse */ - struct device *sc_wsmousedev; + device_t sc_wsmousedev; }; -int ucbtp_match(struct device *, struct cfdata *, void *); -void ucbtp_attach(struct device *, struct device *, void *); +int ucbtp_match(device_t, cfdata_t, void *); +void ucbtp_attach(device_t, device_t, void *); int ucbtp_sibintr(void *); int ucbtp_poll(void *); @@ -167,7 +167,7 @@ int ucbtp_enable(void *); int ucbtp_ioctl(void *, u_long, void *, int, struct lwp *); void ucbtp_disable(void *); -CFATTACH_DECL(ucbtp, sizeof(struct ucbtp_softc), +CFATTACH_DECL_NEW(ucbtp, sizeof(struct ucbtp_softc), ucbtp_match, ucbtp_attach, NULL, NULL); const struct wsmouse_accessops ucbtp_accessops = { @@ -275,20 +275,21 @@ ucbtp_calibration(struct ucbtp_softc *sc } int -ucbtp_match(struct device *parent, struct cfdata *cf, void *aux) +ucbtp_match(device_t parent, cfdata_t cf, void *aux) { return (1); } void -ucbtp_attach(struct device *parent, struct device *self, void *aux) +ucbtp_attach(device_t parent, device_t self, void *aux) { struct ucb1200_attach_args *ucba = aux; - struct ucbtp_softc *sc = (void*)self; + struct ucbtp_softc *sc = device_private(self); struct wsmousedev_attach_args wsmaa; tx_chipset_tag_t tc; + sc->sc_dev = self; tc = sc->sc_tc = ucba->ucba_tc; sc->sc_sib = ucba->ucba_sib; sc->sc_ucb = ucba->ucba_ucb; @@ -360,7 +361,7 @@ ucbtp_sibintr(void *arg) sc->sc_pollh = tx39_poll_establish(sc->sc_tc, 1, IST_EDGE, ucbtp_poll, sc); if (!sc->sc_pollh) { - printf("%s: can't poll\n", sc->sc_dev.dv_xname); + printf("%s: can't poll\n", device_xname(sc->sc_dev)); } } Index: sys/arch/hpcmips/hpcmips/autoconf.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/hpcmips/hpcmips/autoconf.c,v retrieving revision 1.25 diff -u -p -r1.25 autoconf.c --- sys/arch/hpcmips/hpcmips/autoconf.c 29 Jul 2012 18:05:43 -0000 1.25 +++ sys/arch/hpcmips/hpcmips/autoconf.c 9 Oct 2012 01:16:43 -0000 @@ -86,7 +86,7 @@ cpu_rootconf(void) get_device(__booted_device_name); printf("boot device: %s\n", - booted_device ? booted_device->dv_xname : ""); + booted_device ? device_xname(booted_device) : ""); rootconf(); } Index: sys/arch/hpcmips/include/isa_machdep.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/hpcmips/include/isa_machdep.h,v retrieving revision 1.8 diff -u -p -r1.8 isa_machdep.h --- sys/arch/hpcmips/include/isa_machdep.h 19 Aug 2009 15:09:56 -0000 1.8 +++ sys/arch/hpcmips/include/isa_machdep.h 2 Oct 2012 01:24:31 -0000 @@ -45,12 +45,12 @@ typedef struct hpcmips_isa_chipset *isa_ /* * Functions provided to machine-independent ISA code. */ -void isa_attach_hook(struct device*, struct device*, struct isabus_attach_args*); +void isa_attach_hook(device_t, device_t, struct isabus_attach_args *); void isa_detach_hook(isa_chipset_tag_t, device_t); -int isa_intr_alloc(isa_chipset_tag_t, int, int, int*); +int isa_intr_alloc(isa_chipset_tag_t, int, int, int *); const struct evcnt *isa_intr_evcnt(isa_chipset_tag_t ic, int irq); -void *isa_intr_establish(isa_chipset_tag_t, int, int, int, int (*)(void *), void*); -void isa_intr_disestablish(isa_chipset_tag_t, void*); +void *isa_intr_establish(isa_chipset_tag_t, int, int, int, int (*)(void *), void *); +void isa_intr_disestablish(isa_chipset_tag_t, void *); #define isa_dmainit(ic, bst, dmat, d) \ _isa_dmainit(&(ic)->ic_dmastate, (bst), (dmat), (d)) Index: sys/arch/hpcmips/include/pci_machdep.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/hpcmips/include/pci_machdep.h,v retrieving revision 1.7 diff -u -p -r1.7 pci_machdep.h --- sys/arch/hpcmips/include/pci_machdep.h 24 Aug 2011 20:27:36 -0000 1.7 +++ sys/arch/hpcmips/include/pci_machdep.h 2 Oct 2012 01:24:48 -0000 @@ -47,9 +47,9 @@ struct pci_attach_args; * NOT TO BE USED DIRECTLY BY MACHINE INDEPENDENT CODE. */ struct hpcmips_pci_chipset { - struct device *pc_dev; + device_t pc_dev; - void (*pc_attach_hook)(struct device *, struct device *, + void (*pc_attach_hook)(device_t, device_t, struct pcibus_attach_args *); int (*pc_bus_maxdevs)(pci_chipset_tag_t, int); int (*pc_bus_devorder)(pci_chipset_tag_t, int, uint8_t *, int); @@ -58,7 +58,7 @@ struct hpcmips_pci_chipset { int *); pcireg_t (*pc_conf_read)(pci_chipset_tag_t, pcitag_t, int); void (*pc_conf_write)(pci_chipset_tag_t, pcitag_t, int, pcireg_t); - int (*pc_intr_map)(struct pci_attach_args *, pci_intr_handle_t *); + int (*pc_intr_map)(const struct pci_attach_args *, pci_intr_handle_t *); const char *(*pc_intr_string)(pci_chipset_tag_t, pci_intr_handle_t); const struct evcnt *(*pc_intr_evcnt)(pci_chipset_tag_t, pci_intr_handle_t); Index: sys/arch/hpcmips/isa/isa_machdep.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/hpcmips/isa/isa_machdep.c,v retrieving revision 1.38 diff -u -p -r1.38 isa_machdep.c --- sys/arch/hpcmips/isa/isa_machdep.c 19 Aug 2009 15:12:31 -0000 1.38 +++ sys/arch/hpcmips/isa/isa_machdep.c 29 Sep 2012 10:29:11 -0000 @@ -85,17 +85,16 @@ int vrisa_debug = VRISADEBUG_CONF; #define INTR_NIRQS 16 int vrisabprint(void *, const char *); -int vrisabmatch(struct device *, struct cfdata *, void *); -void vrisabattach(struct device *, struct device *, void *); +int vrisabmatch(device_t, cfdata_t, void *); +void vrisabattach(device_t, device_t, void *); struct vrisab_softc { - struct device sc_dev; hpcio_chip_t sc_hc; int sc_intr_map[INTR_NIRQS]; /* ISA <-> GIU inerrupt line mapping */ struct hpcmips_isa_chipset sc_isa_ic; }; -CFATTACH_DECL(vrisab, sizeof(struct vrisab_softc), +CFATTACH_DECL_NEW(vrisab, sizeof(struct vrisab_softc), vrisabmatch, vrisabattach, NULL, NULL); #ifdef DEBUG_FIND_PCIC @@ -113,7 +112,7 @@ static void __find_comport(void); #endif int -vrisabmatch(struct device *parent, struct cfdata *match, void *aux) +vrisabmatch(device_t parent, cfdata_t match, void *aux) { struct hpcio_attach_args *haa = aux; platid_mask_t mask; @@ -133,10 +132,10 @@ vrisabmatch(struct device *parent, struc } void -vrisabattach(struct device *parent, struct device *self, void *aux) +vrisabattach(device_t parent, device_t self, void *aux) { struct hpcio_attach_args *haa = aux; - struct vrisab_softc *sc = (void*)self; + struct vrisab_softc *sc = device_private(self); struct isabus_attach_args iba; struct bus_space_tag_hpcmips *iot, *memt; bus_addr_t offset; @@ -150,7 +149,7 @@ vrisabattach(struct device *parent, stru /* Allocate ISA memory space */ memt = hpcmips_alloc_bus_space_tag(); - offset = device_cfdata(&sc->sc_dev)->cf_loc[VRISABIFCF_ISAMEMOFFSET]; + offset = device_cfdata(self)->cf_loc[VRISABIFCF_ISAMEMOFFSET]; hpcmips_init_bus_space(memt, (struct bus_space_tag_hpcmips *)haa->haa_iot, "ISA mem", VR_ISA_MEM_BASE + offset, VR_ISA_MEM_SIZE - offset); @@ -158,7 +157,7 @@ vrisabattach(struct device *parent, stru /* Allocate ISA port space */ iot = hpcmips_alloc_bus_space_tag(); - offset = device_cfdata(&sc->sc_dev)->cf_loc[VRISABIFCF_ISAPORTOFFSET]; + offset = device_cfdata(self)->cf_loc[VRISABIFCF_ISAPORTOFFSET]; hpcmips_init_bus_space(iot, (struct bus_space_tag_hpcmips *)haa->haa_iot, "ISA port", VR_ISA_PORT_BASE + offset, VR_ISA_PORT_SIZE - offset); @@ -193,7 +192,7 @@ vrisabprint(void *aux, const char *pnp) } void -isa_attach_hook(struct device *parent, struct device *self, +isa_attach_hook(device_t parent, device_t self, struct isabus_attach_args *iba) { Index: sys/arch/hpcmips/isa/plumisa_machdep.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/hpcmips/isa/plumisa_machdep.c,v retrieving revision 1.11 diff -u -p -r1.11 plumisa_machdep.c --- sys/arch/hpcmips/isa/plumisa_machdep.c 19 Aug 2009 15:12:31 -0000 1.11 +++ sys/arch/hpcmips/isa/plumisa_machdep.c 29 Sep 2012 10:29:24 -0000 @@ -51,22 +51,21 @@ __KERNEL_RCSID(0, "$NetBSD: plumisa_mach #include "locators.h" int plumisabprint(void *, const char *); -int plumisabmatch(struct device *, struct cfdata *, void *); -void plumisabattach(struct device *, struct device *, void *); +int plumisabmatch(device_t, cfdata_t, void *); +void plumisabattach(device_t, device_t, void *); struct plumisab_softc { - struct device sc_dev; plum_chipset_tag_t sc_pc; bus_space_tag_t sc_iot; int sc_irq; void *sc_ih; }; -CFATTACH_DECL(plumisab, sizeof(struct plumisab_softc), +CFATTACH_DECL_NEW(plumisab, sizeof(struct plumisab_softc), plumisabmatch, plumisabattach, NULL, NULL); int -plumisabmatch(struct device *parent, struct cfdata *match, void *aux) +plumisabmatch(device_t parent, cfdata_t match, void *aux) { struct plumiobus_attach_args *pba = aux; platid_mask_t mask; @@ -89,10 +88,10 @@ plumisabmatch(struct device *parent, str } void -plumisabattach(struct device *parent, struct device *self, void *aux) +plumisabattach(device_t parent, device_t self, void *aux) { struct plumiobus_attach_args *pba = aux; - struct plumisab_softc *sc = (void*)self; + struct plumisab_softc *sc = device_private(self); struct isabus_attach_args iba; printf("\n"); @@ -133,7 +132,7 @@ plumisabprint(void *aux, const char *pnp } void -isa_attach_hook(struct device *parent, struct device *self, +isa_attach_hook(device_t parent, device_t self, struct isabus_attach_args *iba) { Index: sys/arch/hpcmips/tx/tx3912video.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/hpcmips/tx/tx3912video.c,v retrieving revision 1.41 diff -u -p -r1.41 tx3912video.c --- sys/arch/hpcmips/tx/tx3912video.c 27 Jan 2012 18:52:56 -0000 1.41 +++ sys/arch/hpcmips/tx/tx3912video.c 27 Sep 2012 22:50:00 -0000 @@ -79,7 +79,7 @@ int tx3912video_debug = 1; #endif struct tx3912video_softc { - struct device sc_dev; + device_t sc_dev; void *sc_powerhook; /* power management hook */ int sc_console; struct hpcfb_fbconf sc_fbconf; @@ -95,8 +95,8 @@ void tx3912video_framebuffer_init(struct int tx3912video_framebuffer_alloc(struct video_chip *, paddr_t, paddr_t *); void tx3912video_reset(struct video_chip *); void tx3912video_resolution_init(struct video_chip *); -int tx3912video_match(struct device *, struct cfdata *, void *); -void tx3912video_attach(struct device *, struct device *, void *); +int tx3912video_match(device_t, cfdata_t, void *); +void tx3912video_attach(device_t, device_t, void *); int tx3912video_print(void *, const char *); void tx3912video_hpcfbinit(struct tx3912video_softc *); @@ -111,7 +111,7 @@ void tx3912video_clut_get(struct tx3912v static int __get_color8(int); static int __get_color4(int); -CFATTACH_DECL(tx3912video, sizeof(struct tx3912video_softc), +CFATTACH_DECL_NEW(tx3912video, sizeof(struct tx3912video_softc), tx3912video_match, tx3912video_attach, NULL, NULL); struct hpcfb_accessops tx3912video_ha = { @@ -120,15 +120,15 @@ struct hpcfb_accessops tx3912video_ha = }; int -tx3912video_match(struct device *parent, struct cfdata *cf, void *aux) +tx3912video_match(device_t parent, cfdata_t cf, void *aux) { return (ATTACH_NORMAL); } void -tx3912video_attach(struct device *parent, struct device *self, void *aux) +tx3912video_attach(device_t parent, device_t self, void *aux) { - struct tx3912video_softc *sc = (void *)self; + struct tx3912video_softc *sc = device_private(self); struct video_chip *chip; static const char *const depth_print[] = { [TX3912_VIDEOCTRL1_BITSEL_MONOCHROME] = "monochrome", @@ -141,6 +141,7 @@ tx3912video_attach(struct device *parent txreg_t val; int console; + sc->sc_dev = self; sc->sc_console = console = cn_tab ? 0 : 1; sc->sc_chip = chip = &tx3912video_chip; @@ -214,7 +215,7 @@ tx3912video_power(void *ctx, int type, l if (!sc->sc_console) return (0); /* serial console */ - DPRINTF(("%s: ON\n", sc->sc_dev.dv_xname)); + DPRINTF(("%s: ON\n", device_xname(sc->sc_dev))); val = tx_conf_read(tc, TX3912_VIDEOCTRL1_REG); val |= (TX3912_VIDEOCTRL1_DISPON | TX3912_VIDEOCTRL1_ENVID); tx_conf_write(tc, TX3912_VIDEOCTRL1_REG, val); @@ -222,7 +223,7 @@ tx3912video_power(void *ctx, int type, l case PWR_SUSPEND: /* FALLTHROUGH */ case PWR_STANDBY: - DPRINTF(("%s: OFF\n", sc->sc_dev.dv_xname)); + DPRINTF(("%s: OFF\n", device_xname(sc->sc_dev))); val = tx_conf_read(tc, TX3912_VIDEOCTRL1_REG); val &= ~(TX3912_VIDEOCTRL1_DISPON | TX3912_VIDEOCTRL1_ENVID); tx_conf_write(tc, TX3912_VIDEOCTRL1_REG, val); Index: sys/arch/hpcmips/tx/tx39biu.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/hpcmips/tx/tx39biu.c,v retrieving revision 1.14 diff -u -p -r1.14 tx39biu.c --- sys/arch/hpcmips/tx/tx39biu.c 14 Mar 2009 15:36:07 -0000 1.14 +++ sys/arch/hpcmips/tx/tx39biu.c 1 Oct 2012 15:35:08 -0000 @@ -54,9 +54,9 @@ __KERNEL_RCSID(0, "$NetBSD: tx39biu.c,v #define ISSETPRINT(r, s, m) dbg_bitmask_print((u_int32_t)(r), \ TX39_MEMCONFIG ## s ## _ ##m, #m) -int tx39biu_match(struct device *, struct cfdata *, void *); -void tx39biu_attach(struct device *, struct device *, void *); -void tx39biu_callback(struct device *); +int tx39biu_match(device_t, cfdata_t, void *); +void tx39biu_attach(device_t, device_t, void *); +void tx39biu_callback(device_t); int tx39biu_print(void *, const char *); int tx39biu_intr(void *); @@ -66,24 +66,23 @@ void tx39biu_dump(tx_chipset_tag_t); #endif struct tx39biu_softc { - struct device sc_dev; tx_chipset_tag_t sc_tc; }; -CFATTACH_DECL(tx39biu, sizeof(struct tx39biu_softc), +CFATTACH_DECL_NEW(tx39biu, sizeof(struct tx39biu_softc), tx39biu_match, tx39biu_attach, NULL, NULL); int -tx39biu_match(struct device *parent, struct cfdata *cf, void *aux) +tx39biu_match(device_t parent, cfdata_t cf, void *aux) { return (ATTACH_NORMAL); } void -tx39biu_attach(struct device *parent, struct device *self, void *aux) +tx39biu_attach(device_t parent, device_t self, void *aux) { struct txsim_attach_args *ta = aux; - struct tx39biu_softc *sc = (void*)self; + struct tx39biu_softc *sc = device_private(self); tx_chipset_tag_t tc; #ifdef TX39_WATCHDOGTIMER txreg_t reg; @@ -124,9 +123,9 @@ tx39biu_attach(struct device *parent, st } void -tx39biu_callback(struct device *self) +tx39biu_callback(device_t self) { - struct tx39biu_softc *sc = (void*)self; + struct tx39biu_softc *sc = device_private(self); struct csbus_attach_args cba; cba.cba_busname = "txcsbus"; Index: sys/arch/hpcmips/tx/tx39clock.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/hpcmips/tx/tx39clock.c,v retrieving revision 1.26 diff -u -p -r1.26 tx39clock.c --- sys/arch/hpcmips/tx/tx39clock.c 8 Aug 2011 17:45:13 -0000 1.26 +++ sys/arch/hpcmips/tx/tx39clock.c 27 Sep 2012 22:52:07 -0000 @@ -72,7 +72,6 @@ struct txtime { }; struct tx39clock_softc { - struct device sc_dev; tx_chipset_tag_t sc_tc; int sc_alarm; @@ -82,8 +81,8 @@ struct tx39clock_softc { struct timecounter sc_tcounter; }; -int tx39clock_match(struct device *, struct cfdata *, void *); -void tx39clock_attach(struct device *, struct device *, void *); +int tx39clock_match(device_t, cfdata_t, void *); +void tx39clock_attach(device_t, device_t, void *); #ifdef TX39CLOCK_DEBUG void tx39clock_dump(tx_chipset_tag_t); #endif @@ -96,18 +95,18 @@ void __tx39timer_rtcget(struct txtime *) time_t __tx39timer_rtc2sec(struct txtime *); uint32_t tx39_timecount(struct timecounter *); -CFATTACH_DECL(tx39clock, sizeof(struct tx39clock_softc), +CFATTACH_DECL_NEW(tx39clock, sizeof(struct tx39clock_softc), tx39clock_match, tx39clock_attach, NULL, NULL); int -tx39clock_match(struct device *parent, struct cfdata *cf, void *aux) +tx39clock_match(device_t parent, cfdata_t cf, void *aux) { return ATTACH_FIRST; } void -tx39clock_attach(struct device *parent, struct device *self, void *aux) +tx39clock_attach(device_t parent, device_t self, void *aux) { struct txsim_attach_args *ta = aux; struct tx39clock_softc *sc = device_private(self); Index: sys/arch/hpcmips/tx/tx39icu.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/hpcmips/tx/tx39icu.c,v retrieving revision 1.31 diff -u -p -r1.31 tx39icu.c --- sys/arch/hpcmips/tx/tx39icu.c 18 Mar 2011 15:31:38 -0000 1.31 +++ sys/arch/hpcmips/tx/tx39icu.c 27 Sep 2012 22:52:34 -0000 @@ -180,7 +180,6 @@ int tx39_poll_intr(void *); #endif /* USE_POLL */ struct tx39icu_softc { - struct device sc_dev; tx_chipset_tag_t sc_tc; /* IRQLOW */ txreg_t sc_le_mask[TX39_INTRSET_MAX + 1]; @@ -198,8 +197,8 @@ struct tx39icu_softc { #endif /* USE_POLL */ }; -int tx39icu_match(struct device *, struct cfdata *, void *); -void tx39icu_attach(struct device *, struct device *, void *); +int tx39icu_match(device_t, cfdata_t, void *); +void tx39icu_attach(device_t, device_t, void *); void tx39_intr_dump(struct tx39icu_softc *); void tx39_intr_decode(int, int *, int *); @@ -209,21 +208,21 @@ void tx39_irqhigh_establish(tx_chipset_t void tx39_irqhigh_intr(uint32_t, vaddr_t, uint32_t); int tx39_irqhigh(int, int); -CFATTACH_DECL(tx39icu, sizeof(struct tx39icu_softc), +CFATTACH_DECL_NEW(tx39icu, sizeof(struct tx39icu_softc), tx39icu_match, tx39icu_attach, NULL, NULL); int -tx39icu_match(struct device *parent, struct cfdata *cf, void *aux) +tx39icu_match(device_t parent, cfdata_t cf, void *aux) { return (ATTACH_FIRST); } void -tx39icu_attach(struct device *parent, struct device *self, void *aux) +tx39icu_attach(device_t parent, device_t self, void *aux) { struct txsim_attach_args *ta = aux; - struct tx39icu_softc *sc = (void *)self; + struct tx39icu_softc *sc = device_private(self); tx_chipset_tag_t tc = ta->ta_tc; txreg_t reg, *regs; int i; Index: sys/arch/hpcmips/tx/tx39io.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/hpcmips/tx/tx39io.c,v retrieving revision 1.22 diff -u -p -r1.22 tx39io.c --- sys/arch/hpcmips/tx/tx39io.c 6 Jun 2010 06:12:49 -0000 1.22 +++ sys/arch/hpcmips/tx/tx39io.c 27 Sep 2012 22:53:47 -0000 @@ -52,10 +52,10 @@ __KERNEL_RCSID(0, "$NetBSD: tx39io.c,v 1 #define ISBITSET(x, s) ((x) & (1 << (s))) -int tx39io_match(struct device *, struct cfdata *, void *); -void tx39io_attach(struct device *, struct device *, void *); +int tx39io_match(device_t, cfdata_t, void *); +void tx39io_attach(device_t, device_t, void *); -CFATTACH_DECL(tx39io, sizeof(struct tx39io_softc), +CFATTACH_DECL_NEW(tx39io, sizeof(struct tx39io_softc), tx39io_match, tx39io_attach, NULL, NULL); /* IO/MFIO common */ @@ -98,20 +98,21 @@ static void io_dump(hpcio_chip_t); static void __print_port_status(struct tx39io_port_status *, int); int -tx39io_match(struct device *parent, struct cfdata *cf, void *aux) +tx39io_match(device_t parent, cfdata_t cf, void *aux) { return (ATTACH_FIRST); /* 1st attach group of txsim */ } void -tx39io_attach(struct device *parent, struct device *self, void *aux) +tx39io_attach(device_t parent, device_t self, void *aux) { struct txsim_attach_args *ta = aux; - struct tx39io_softc *sc = (void *)self; + struct tx39io_softc *sc = device_private(self); tx_chipset_tag_t tc; struct hpcio_chip *io_hc = &sc->sc_io_ops; struct hpcio_chip *mfio_hc = &sc->sc_mfio_ops; + sc->sc_dev = self; tc = sc->sc_tc = ta->ta_tc; printf("\n"); @@ -223,7 +224,7 @@ mfio_out(hpcio_chip_t arg, int port, int #ifdef DIAGNOSTIC if (!(sc->sc_stat_mfio.dir & pos)) { panic("%s: MFIO%d is not output port.", - sc->sc_dev.dv_xname, port); + device_xname(sc->sc_dev), port); } #endif reg = tx_conf_read(tc, TX39_IOMFIODATAOUT_REG); @@ -305,7 +306,7 @@ tx391x_io_out(hpcio_chip_t arg, int port pos = 1 << port; #ifdef DIAGNOSTIC if (!(sc->sc_stat_io.dir & pos)) - panic("%s: IO%d is not output port.", sc->sc_dev.dv_xname, + panic("%s: IO%d is not output port.", device_xname(sc->sc_dev), port); #endif reg = tx_conf_read(tc, TX39_IOCTRL_REG); @@ -376,7 +377,7 @@ tx392x_io_out(hpcio_chip_t arg, int port { struct tx39io_softc *sc = arg->hc_sc; #ifdef DIAGNOSTIC - const char *devname = sc->sc_dev.dv_xname; + const char *devname = device_xname(sc->sc_dev); #endif tx_chipset_tag_t tc = sc->sc_tc; txreg_t reg, pos, iostat; Index: sys/arch/hpcmips/tx/tx39iovar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/hpcmips/tx/tx39iovar.h,v retrieving revision 1.4 diff -u -p -r1.4 tx39iovar.h --- sys/arch/hpcmips/tx/tx39iovar.h 28 Apr 2008 20:23:21 -0000 1.4 +++ sys/arch/hpcmips/tx/tx39iovar.h 27 Sep 2012 22:53:24 -0000 @@ -40,7 +40,7 @@ struct tx39io_port_status { }; struct tx39io_softc { - struct device sc_dev; + device_t sc_dev; tx_chipset_tag_t sc_tc; u_int32_t sc_stat_io_mask, sc_stat_mfio_mask; Index: sys/arch/hpcmips/tx/tx39ir.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/hpcmips/tx/tx39ir.c,v retrieving revision 1.9 diff -u -p -r1.9 tx39ir.c --- sys/arch/hpcmips/tx/tx39ir.c 28 Apr 2008 20:23:21 -0000 1.9 +++ sys/arch/hpcmips/tx/tx39ir.c 27 Sep 2012 22:54:23 -0000 @@ -59,12 +59,11 @@ int tx39ir_debug = 1; #define DPRINTF(arg) #endif -int tx39ir_match(struct device *, struct cfdata *, void *); -void tx39ir_attach(struct device *, struct device *, void *); +int tx39ir_match(device_t, cfdata_t, void *); +void tx39ir_attach(device_t, device_t, void *); struct tx39ir_softc { - struct device sc_dev; - struct device *sc_parent; + device_t sc_parent; tx_chipset_tag_t sc_tc; }; @@ -75,20 +74,20 @@ static void tx39ir_dump(struct tx39ir_so static int tx39ir_intr(void *); #endif -CFATTACH_DECL(tx39ir, sizeof(struct tx39ir_softc), +CFATTACH_DECL_NEW(tx39ir, sizeof(struct tx39ir_softc), tx39ir_match, tx39ir_attach, NULL, NULL); int -tx39ir_match(struct device *parent, struct cfdata *cf, void *aux) +tx39ir_match(device_t parent, cfdata_t cf, void *aux) { return (ATTACH_NORMAL); } void -tx39ir_attach(struct device *parent, struct device *self, void *aux) +tx39ir_attach(device_t parent, device_t self, void *aux) { struct txcom_attach_args *tca = aux; - struct tx39ir_softc *sc = (void*)self; + struct tx39ir_softc *sc = device_private(self); tx_chipset_tag_t tc; txreg_t reg; Index: sys/arch/hpcmips/tx/tx39irvar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/hpcmips/tx/tx39irvar.h,v retrieving revision 1.3 diff -u -p -r1.3 tx39irvar.h --- sys/arch/hpcmips/tx/tx39irvar.h 28 Apr 2008 20:23:21 -0000 1.3 +++ sys/arch/hpcmips/tx/tx39irvar.h 2 Oct 2012 01:25:08 -0000 @@ -31,7 +31,7 @@ struct txcom_attach_args { tx_chipset_tag_t tca_tc; - struct device *tca_parent; + device_t tca_parent; }; -void txcom_pulse_mode(struct device *); +void txcom_pulse_mode(device_t); Index: sys/arch/hpcmips/tx/tx39power.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/hpcmips/tx/tx39power.c,v retrieving revision 1.20 diff -u -p -r1.20 tx39power.c --- sys/arch/hpcmips/tx/tx39power.c 12 Feb 2012 16:34:08 -0000 1.20 +++ sys/arch/hpcmips/tx/tx39power.c 27 Sep 2012 22:55:13 -0000 @@ -60,18 +60,18 @@ __KERNEL_RCSID(0, "$NetBSD: tx39power.c, #define ISSETPRINT(r, m) dbg_bitmask_print(r, TX39_POWERCTRL_##m, #m) -int tx39power_match(struct device *, struct cfdata *, void *); -void tx39power_attach(struct device *, struct device *, void *); +int tx39power_match(device_t, cfdata_t, void *); +void tx39power_attach(device_t, device_t, void *); struct tx39power_softc { - struct device sc_dev; + device_t sc_dev; tx_chipset_tag_t sc_tc; /* save interrupt status for resume */ txreg_t sc_icu_state[TX39_INTRSET_MAX + 1]; }; -CFATTACH_DECL(tx39power, sizeof(struct tx39power_softc), +CFATTACH_DECL_NEW(tx39power, sizeof(struct tx39power_softc), tx39power_match, tx39power_attach, NULL, NULL); void tx39power_suspend_cpu(void); /* automatic hardware resume */ @@ -87,19 +87,20 @@ static void __tx39power_dump(struct tx39 #endif int -tx39power_match(struct device *parent, struct cfdata *cf, void *aux) +tx39power_match(device_t parent, cfdata_t cf, void *aux) { return (ATTACH_FIRST); } void -tx39power_attach(struct device *parent, struct device *self, void *aux) +tx39power_attach(device_t parent, device_t self, void *aux) { struct txsim_attach_args *ta = aux; - struct tx39power_softc *sc = (void*)self; + struct tx39power_softc *sc = device_private(self); tx_chipset_tag_t tc; txreg_t reg; + sc->sc_dev = self; tc = sc->sc_tc = ta->ta_tc; tx_conf_register_power(tc, self); @@ -151,7 +152,7 @@ tx39power_suspend_cpu(void) /* I assume struct tx39power_softc *sc = tc->tc_powert; txreg_t reg, *iregs = sc->sc_icu_state; - printf ("%s: CPU sleep\n", sc->sc_dev.dv_xname); + printf ("%s: CPU sleep\n", device_xname(sc->sc_dev)); __asm volatile(".set noreorder"); reg = tx_conf_read(tc, TX39_POWERCTRL_REG); reg |= TX39_POWERCTRL_STOPCPU; @@ -208,7 +209,7 @@ tx39power_suspend_cpu(void) /* I assume #endif __asm volatile(".set reorder"); - printf ("%s: CPU wakeup\n", sc->sc_dev.dv_xname); + printf ("%s: CPU wakeup\n", device_xname(sc->sc_dev)); } static int Index: sys/arch/hpcmips/tx/tx39sib.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/hpcmips/tx/tx39sib.c,v retrieving revision 1.20 diff -u -p -r1.20 tx39sib.c --- sys/arch/hpcmips/tx/tx39sib.c 28 Apr 2008 20:23:22 -0000 1.20 +++ sys/arch/hpcmips/tx/tx39sib.c 2 Oct 2012 01:25:29 -0000 @@ -59,11 +59,10 @@ int tx39sibdebug = 0; #define DPRINTF(arg) #endif -int tx39sib_match(struct device *, struct cfdata *, void *); -void tx39sib_attach(struct device *, struct device *, void *); +int tx39sib_match(device_t, cfdata_t, void *); +void tx39sib_attach(device_t, device_t, void *); int tx39sib_print(void *, const char *); -int tx39sib_search(struct device *, struct cfdata *, - const int *, void *); +int tx39sib_search(device_t, cfdata_t, const int *, void *); #define TX39_CLK2X 18432000 const int sibsclk_divide_table[8] = { @@ -123,7 +122,6 @@ struct tx39sib_param tx39sib_param_defau }; struct tx39sib_softc { - struct device sc_dev; tx_chipset_tag_t sc_tc; struct tx39sib_param sc_param; @@ -135,20 +133,20 @@ inline int __txsibsf0_ready(tx_chipset_t void tx39sib_dump(struct tx39sib_softc *); #endif -CFATTACH_DECL(tx39sib, sizeof(struct tx39sib_softc), +CFATTACH_DECL_NEW(tx39sib, sizeof(struct tx39sib_softc), tx39sib_match, tx39sib_attach, NULL, NULL); int -tx39sib_match(struct device *parent, struct cfdata *cf, void *aux) +tx39sib_match(device_t parent, cfdata_t cf, void *aux) { return (ATTACH_FIRST); } void -tx39sib_attach(struct device *parent, struct device *self, void *aux) +tx39sib_attach(device_t parent, device_t self, void *aux) { struct txsim_attach_args *ta = aux; - struct tx39sib_softc *sc = (void*)self; + struct tx39sib_softc *sc = device_private(self); tx_chipset_tag_t tc; sc->sc_tc = tc = ta->ta_tc; @@ -183,9 +181,9 @@ tx39sib_attach(struct device *parent, st } void -tx39sib_enable1(struct device *dev) +tx39sib_enable1(device_t dev) { - struct tx39sib_softc *sc = (void*)dev; + struct tx39sib_softc *sc = device_private(dev); struct tx39sib_param *param = &sc->sc_param; tx_chipset_tag_t tc = sc->sc_tc; @@ -224,9 +222,9 @@ tx39sib_enable1(struct device *dev) } void -tx39sib_enable2(struct device *dev) +tx39sib_enable2(device_t dev) { - struct tx39sib_softc *sc = (void*)dev; + struct tx39sib_softc *sc = device_private(dev); tx_chipset_tag_t tc = sc->sc_tc; txreg_t reg; @@ -236,9 +234,9 @@ tx39sib_enable2(struct device *dev) } void -tx39sib_disable(struct device *dev) +tx39sib_disable(device_t dev) { - struct tx39sib_softc *sc = (void*)dev; + struct tx39sib_softc *sc = device_private(dev); tx_chipset_tag_t tc = sc->sc_tc; txreg_t reg; /* disable codec side */ @@ -264,18 +262,17 @@ tx39sib_disable(struct device *dev) } int -tx39sib_clock(struct device *dev) +tx39sib_clock(device_t dev) { - struct tx39sib_softc *sc = (void*)dev; + struct tx39sib_softc *sc = device_private(dev); return (TX39_CLK2X / sibsclk_divide_table[sc->sc_param.sp_clock]); } int -tx39sib_search(struct device *parent, struct cfdata *cf, - const int *ldesc, void *aux) +tx39sib_search(device_t parent, cfdata_t cf, const int *ldesc, void *aux) { - struct tx39sib_softc *sc = (void*)parent; + struct tx39sib_softc *sc = device_private(parent); struct txsib_attach_args sa; sa.sa_tc = sc->sc_tc; Index: sys/arch/hpcmips/tx/tx39sibvar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/hpcmips/tx/tx39sibvar.h,v retrieving revision 1.4 diff -u -p -r1.4 tx39sibvar.h --- sys/arch/hpcmips/tx/tx39sibvar.h 28 Apr 2008 20:23:22 -0000 1.4 +++ sys/arch/hpcmips/tx/tx39sibvar.h 2 Oct 2012 01:25:49 -0000 @@ -36,10 +36,10 @@ struct txsib_attach_args { int sa_slot; /* subframe 0 or subframe 1 */ }; -void tx39sib_enable1(struct device *); -void tx39sib_enable2(struct device *); -void tx39sib_disable(struct device *); -int tx39sib_clock(struct device *); +void tx39sib_enable1(device_t); +void tx39sib_enable2(device_t); +void tx39sib_disable(device_t); +int tx39sib_clock(device_t); /* subframe0 access sync method */ void txsibsf0_reg_write(tx_chipset_tag_t, int, u_int16_t); Index: sys/arch/hpcmips/tx/tx39spi.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/hpcmips/tx/tx39spi.c,v retrieving revision 1.4 diff -u -p -r1.4 tx39spi.c --- sys/arch/hpcmips/tx/tx39spi.c 11 Dec 2005 12:17:34 -0000 1.4 +++ sys/arch/hpcmips/tx/tx39spi.c 2 Oct 2012 01:26:06 -0000 @@ -44,34 +44,32 @@ __KERNEL_RCSID(0, "$NetBSD: tx39spi.c,v #include "locators.h" struct tx39spi_softc { - struct device sc_dev; tx_chipset_tag_t sc_tc; int sc_attached; }; -static int tx39spi_match(struct device *, struct cfdata *, void *); -static void tx39spi_attach(struct device *, struct device *, void *); -static int tx39spi_search(struct device *, struct cfdata *, - const int *, void *); +static int tx39spi_match(device_t, cfdata_t, void *); +static void tx39spi_attach(device_t, device_t, void *); +static int tx39spi_search(device_t, cfdata_t, const int *, void *); static int tx39spi_print(void *, const char *); #ifndef USE_POLL static int tx39spi_intr(void *); #endif -CFATTACH_DECL(tx39spi, sizeof(struct tx39spi_softc), +CFATTACH_DECL_NEW(tx39spi, sizeof(struct tx39spi_softc), tx39spi_match, tx39spi_attach, NULL, NULL); int -tx39spi_match(struct device *parent, struct cfdata *cf, void *aux) +tx39spi_match(device_t parent, cfdata_t cf, void *aux) { return (ATTACH_NORMAL); } void -tx39spi_attach(struct device *parent, struct device *self, void *aux) +tx39spi_attach(device_t parent, device_t self, void *aux) { struct txsim_attach_args *ta = aux; - struct tx39spi_softc *sc = (void*)self; + struct tx39spi_softc *sc = device_private(self); tx_chipset_tag_t tc = sc->sc_tc = ta->ta_tc; txreg_t reg; @@ -93,10 +91,9 @@ tx39spi_attach(struct device *parent, st } int -tx39spi_search(struct device *parent, struct cfdata *cf, - const int *ldesc, void *aux) +tx39spi_search(device_t parent, cfdata_t cf, const int *ldesc, void *aux) { - struct tx39spi_softc *sc = (void*)parent; + struct tx39spi_softc *sc = device_private(parent); struct txspi_attach_args sa; sa.sa_tc = sc->sc_tc; Index: sys/arch/hpcmips/tx/tx39uart.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/hpcmips/tx/tx39uart.c,v retrieving revision 1.14 diff -u -p -r1.14 tx39uart.c --- sys/arch/hpcmips/tx/tx39uart.c 28 Apr 2008 20:23:22 -0000 1.14 +++ sys/arch/hpcmips/tx/tx39uart.c 2 Oct 2012 01:26:23 -0000 @@ -46,32 +46,30 @@ __KERNEL_RCSID(0, "$NetBSD: tx39uart.c,v #include "locators.h" -int tx39uart_match(struct device *, struct cfdata *, void *); -void tx39uart_attach(struct device *, struct device *, void *); +int tx39uart_match(device_t, cfdata_t, void *); +void tx39uart_attach(device_t, device_t, void *); int tx39uart_print(void *, const char *); -int tx39uart_search(struct device *, struct cfdata *, - const int *, void *); +int tx39uart_search(device_t, cfdata_t, const int *, void *); struct tx39uart_softc { - struct device sc_dev; tx_chipset_tag_t sc_tc; int sc_enabled; }; -CFATTACH_DECL(tx39uart, sizeof(struct tx39uart_softc), +CFATTACH_DECL_NEW(tx39uart, sizeof(struct tx39uart_softc), tx39uart_match, tx39uart_attach, NULL, NULL); int -tx39uart_match(struct device *parent, struct cfdata *cf, void *aux) +tx39uart_match(device_t parent, cfdata_t cf, void *aux) { return ATTACH_LAST; } void -tx39uart_attach(struct device *parent, struct device *self, void *aux) +tx39uart_attach(device_t parent, device_t self, void *aux) { struct txsim_attach_args *ta = aux; - struct tx39uart_softc *sc = (void *)self; + struct tx39uart_softc *sc = device_private(self); tx_chipset_tag_t tc; printf("\n"); @@ -81,10 +79,9 @@ tx39uart_attach(struct device *parent, s } int -tx39uart_search(struct device *parent, struct cfdata *cf, - const int *ldesc, void *aux) +tx39uart_search(device_t parent, cfdata_t cf, const int *ldesc, void *aux) { - struct tx39uart_softc *sc = (void *)parent; + struct tx39uart_softc *sc = device_private(parent); struct tx39uart_attach_args ua; ua.ua_tc = sc->sc_tc; Index: sys/arch/hpcmips/tx/txcom.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/hpcmips/tx/txcom.c,v retrieving revision 1.45 diff -u -p -r1.45 txcom.c --- sys/arch/hpcmips/tx/txcom.c 24 Apr 2011 16:26:56 -0000 1.45 +++ sys/arch/hpcmips/tx/txcom.c 1 Oct 2012 15:34:31 -0000 @@ -95,7 +95,6 @@ struct txcom_chip { }; struct txcom_softc { - struct device sc_dev; struct tty *sc_tty; struct txcom_chip *sc_chip; @@ -112,9 +111,9 @@ struct txcom_softc { extern struct cfdriver txcom_cd; -int txcom_match(struct device *, struct cfdata *, void *); -void txcom_attach(struct device *, struct device *, void *); -int txcom_print(void*, const char *); +int txcom_match(device_t, cfdata_t, void *); +void txcom_attach(device_t, device_t, void *); +int txcom_print(void *, const char *); int txcom_txintr(void *); int txcom_rxintr(void *); @@ -165,7 +164,7 @@ struct consdev txcomcons = { /* Serial console */ struct txcom_chip txcom_chip; -CFATTACH_DECL(txcom, sizeof(struct txcom_softc), +CFATTACH_DECL_NEW(txcom, sizeof(struct txcom_softc), txcom_match, txcom_attach, NULL, NULL); dev_type_open(txcomopen); @@ -183,17 +182,17 @@ const struct cdevsw txcom_cdevsw = { }; int -txcom_match(struct device *parent, struct cfdata *cf, void *aux) +txcom_match(device_t parent, cfdata_t cf, void *aux) { /* if the autoconfiguration got this far, there's a slot here */ return 1; } void -txcom_attach(struct device *parent, struct device *self, void *aux) +txcom_attach(device_t parent, device_t self, void *aux) { struct tx39uart_attach_args *ua = aux; - struct txcom_softc *sc = (void*)self; + struct txcom_softc *sc = device_private(self); tx_chipset_tag_t tc; struct tty *tp; struct txcom_chip *chip; @@ -242,7 +241,7 @@ txcom_attach(struct device *parent, stru /* locate the major number */ maj = cdevsw_lookup_major(&txcom_cdevsw); - cn_tab->cn_dev = makedev(maj, device_unit(&sc->sc_dev)); + cn_tab->cn_dev = makedev(maj, device_unit(self)); printf(": console"); } @@ -415,9 +414,9 @@ __txcom_txbufready(struct txcom_chip *ch } void -txcom_pulse_mode(struct device *dev) +txcom_pulse_mode(device_t dev) { - struct txcom_softc *sc = (void*)dev; + struct txcom_softc *sc = device_private(dev); struct txcom_chip *chip = sc->sc_chip; tx_chipset_tag_t tc = chip->sc_tc; int ofs; Index: sys/arch/hpcmips/tx/txcsbus.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/hpcmips/tx/txcsbus.c,v retrieving revision 1.21 diff -u -p -r1.21 txcsbus.c --- sys/arch/hpcmips/tx/txcsbus.c 28 Apr 2008 20:23:22 -0000 1.21 +++ sys/arch/hpcmips/tx/txcsbus.c 2 Oct 2012 01:26:44 -0000 @@ -92,28 +92,26 @@ const struct csmap { TX39_SYSADDR_KUCS_SIZE}, }; -int txcsbus_match(struct device *, struct cfdata *, void *); -void txcsbus_attach(struct device *, struct device *, void *); +int txcsbus_match(device_t, cfdata_t, void *); +void txcsbus_attach(device_t, device_t, void *); int txcsbus_print(void *, const char *); -int txcsbus_search(struct device *, struct cfdata *, - const int *, void *); +int txcsbus_search(device_t, cfdata_t, const int *, void *); struct txcsbus_softc { - struct device sc_dev; tx_chipset_tag_t sc_tc; /* chip select space tag */ struct bus_space_tag_hpcmips *sc_cst[TX39_MAXCS]; int sc_pri; }; -CFATTACH_DECL(txcsbus, sizeof(struct txcsbus_softc), +CFATTACH_DECL_NEW(txcsbus, sizeof(struct txcsbus_softc), txcsbus_match, txcsbus_attach, NULL, NULL); static bus_space_tag_t __txcsbus_alloc_cstag(struct txcsbus_softc *, struct cs_handle *); int -txcsbus_match(struct device *parent, struct cfdata *cf, void *aux) +txcsbus_match(device_t parent, cfdata_t cf, void *aux) { struct csbus_attach_args *cba = aux; platid_mask_t mask; @@ -132,10 +130,10 @@ txcsbus_match(struct device *parent, str } void -txcsbus_attach(struct device *parent, struct device *self, void *aux) +txcsbus_attach(device_t parent, device_t self, void *aux) { struct csbus_attach_args *cba = aux; - struct txcsbus_softc *sc = (void*)self; + struct txcsbus_softc *sc = device_private(self); sc->sc_tc = cba->cba_tc; printf("\n"); @@ -197,10 +195,9 @@ txcsbus_print(void *aux, const char *pnp } int -txcsbus_search(struct device *parent, struct cfdata *cf, - const int *ldesc, void *aux) +txcsbus_search(device_t parent, cfdata_t cf, const int *ldesc, void *aux) { - struct txcsbus_softc *sc = (void*)parent; + struct txcsbus_softc *sc = device_private(parent); struct cs_attach_args ca; ca.ca_tc = sc->sc_tc; Index: sys/arch/hpcmips/tx/txsim.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/hpcmips/tx/txsim.c,v retrieving revision 1.16 diff -u -p -r1.16 txsim.c --- sys/arch/hpcmips/tx/txsim.c 28 Apr 2008 20:23:22 -0000 1.16 +++ sys/arch/hpcmips/tx/txsim.c 2 Oct 2012 01:26:55 -0000 @@ -50,22 +50,20 @@ __KERNEL_RCSID(0, "$NetBSD: txsim.c,v 1. #include #include -int txsim_match(struct device *, struct cfdata *, void *); -void txsim_attach(struct device *, struct device *, void *); +int txsim_match(device_t, cfdata_t, void *); +void txsim_attach(device_t, device_t, void *); int txsim_print(void *, const char*); -int txsim_search(struct device *, struct cfdata *, - const int *, void *); +int txsim_search(device_t, cfdata_t, const int *, void *); struct txsim_softc { - struct device sc_dev; int sc_pri; /* attaching device priority */ }; -CFATTACH_DECL(txsim, sizeof(struct txsim_softc), +CFATTACH_DECL_NEW(txsim, sizeof(struct txsim_softc), txsim_match, txsim_attach, NULL, NULL); int -txsim_match(struct device *parent, struct cfdata *match, void *aux) +txsim_match(device_t parent, cfdata_t match, void *aux) { struct mainbus_attach_args *ma = aux; @@ -80,9 +78,9 @@ txsim_match(struct device *parent, struc } void -txsim_attach(struct device *parent, struct device *self, void *aux) +txsim_attach(device_t parent, device_t self, void *aux) { - struct txsim_softc *sc = (void*)self; + struct txsim_softc *sc = device_private(self); printf("\n"); @@ -113,10 +111,9 @@ txsim_print(void *aux, const char *pnp) } int -txsim_search(struct device *parent, struct cfdata *cf, - const int *ldesc, void *aux) +txsim_search(device_t parent, cfdata_t cf, const int *ldesc, void *aux) { - struct txsim_softc *sc = (void*)parent; + struct txsim_softc *sc = device_private(parent); struct txsim_attach_args ta; ta.ta_tc = tx_conf_get_tag(); Index: sys/arch/hpcmips/vr/bcu_vrip.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/hpcmips/vr/bcu_vrip.c,v retrieving revision 1.29 diff -u -p -r1.29 bcu_vrip.c --- sys/arch/hpcmips/vr/bcu_vrip.c 18 Mar 2009 10:22:29 -0000 1.29 +++ sys/arch/hpcmips/vr/bcu_vrip.c 27 Sep 2012 23:03:04 -0000 @@ -58,8 +58,8 @@ __KERNEL_RCSID(0, "$NetBSD: bcu_vrip.c,v #include #include -static int vrbcu_match(struct device *, struct cfdata *, void *); -static void vrbcu_attach(struct device *, struct device *, void *); +static int vrbcu_match(device_t, cfdata_t, void *); +static void vrbcu_attach(device_t, device_t, void *); static void vrbcu_write(struct vrbcu_softc *, int, unsigned short); static unsigned short vrbcu_read(struct vrbcu_softc *, int); @@ -71,7 +71,7 @@ int vr_major=-1; int vr_minor=-1; int vr_cpuid=-1; -CFATTACH_DECL(vrbcu, sizeof(struct vrbcu_softc), +CFATTACH_DECL_NEW(vrbcu, sizeof(struct vrbcu_softc), vrbcu_match, vrbcu_attach, NULL, NULL); struct vrbcu_softc *the_bcu_sc = NULL; @@ -120,18 +120,19 @@ vrbcu_read(struct vrbcu_softc *sc, int p } static int -vrbcu_match(struct device *parent, struct cfdata *cf, void *aux) +vrbcu_match(device_t parent, cfdata_t cf, void *aux) { return (2); } static void -vrbcu_attach(struct device *parent, struct device *self, void *aux) +vrbcu_attach(device_t parent, device_t self, void *aux) { struct vrip_attach_args *va = aux; - struct vrbcu_softc *sc = (struct vrbcu_softc *)self; + struct vrbcu_softc *sc = device_private(self); + sc->sc_dev = self; sc->sc_iot = va->va_iot; bus_space_map(sc->sc_iot, va->va_addr, va->va_size, 0, /* no flags */ @@ -254,17 +255,17 @@ vrbcu_dump_regs(void) } if (tclock) printf("%s: CPU %d.%03dMHz, bus %d.%03dMHz, ram %d.%03dMHz\n", - sc->sc_dev.dv_xname, + device_xname(sc->sc_dev), cpuclock/1000000, (cpuclock%1000000)/1000, tclock/1000000, (tclock%1000000)/1000, vtclock/1000000, (vtclock%1000000)/1000); else { printf("%s: CPU %d.%03dMHz\n", - sc->sc_dev.dv_xname, + device_xname(sc->sc_dev), cpuclock/1000000, (cpuclock%1000000)/1000); printf("%s: UNKNOWN BUS CLOCK SPEED:" " CPU is UNKNOWN or NOT CONFIGURED\n", - sc->sc_dev.dv_xname); + device_xname(sc->sc_dev)); } #ifdef VRBCUDEBUG reg = vrbcu_read(sc, BCUCNT1_REG_W); Index: sys/arch/hpcmips/vr/bcuvar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/hpcmips/vr/bcuvar.h,v retrieving revision 1.6 diff -u -p -r1.6 bcuvar.h --- sys/arch/hpcmips/vr/bcuvar.h 11 Dec 2005 12:17:34 -0000 1.6 +++ sys/arch/hpcmips/vr/bcuvar.h 27 Sep 2012 23:02:37 -0000 @@ -35,7 +35,7 @@ */ struct vrbcu_softc { - struct device sc_dev; + device_t sc_dev; bus_space_tag_t sc_iot; bus_space_handle_t sc_ioh; }; Index: sys/arch/hpcmips/vr/cmu.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/hpcmips/vr/cmu.c,v retrieving revision 1.13 diff -u -p -r1.13 cmu.c --- sys/arch/hpcmips/vr/cmu.c 11 Dec 2005 12:17:34 -0000 1.13 +++ sys/arch/hpcmips/vr/cmu.c 27 Sep 2012 23:03:40 -0000 @@ -58,7 +58,6 @@ __KERNEL_RCSID(0, "$NetBSD: cmu.c,v 1.13 #include struct vrcmu_softc { - struct device sc_dev; bus_space_tag_t sc_iot; bus_space_handle_t sc_ioh; config_hook_tag sc_hardpower; @@ -66,26 +65,26 @@ struct vrcmu_softc { struct vrcmu_chipset_tag sc_chipset; }; -int vrcmu_match(struct device *, struct cfdata *, void *); -void vrcmu_attach(struct device *, struct device *, void *); +int vrcmu_match(device_t, cfdata_t, void *); +void vrcmu_attach(device_t, device_t, void *); int vrcmu_supply(vrcmu_chipset_tag_t, u_int16_t, int); int vrcmu_hardpower(void *, int, long, void *); -CFATTACH_DECL(vrcmu, sizeof(struct vrcmu_softc), +CFATTACH_DECL_NEW(vrcmu, sizeof(struct vrcmu_softc), vrcmu_match, vrcmu_attach, NULL, NULL); int -vrcmu_match(struct device *parent, struct cfdata *cf, void *aux) +vrcmu_match(device_t parent, cfdata_t cf, void *aux) { return (2); /* 1st attach group of vrip */ } void -vrcmu_attach(struct device *parent, struct device *self, void *aux) +vrcmu_attach(device_t parent, device_t self, void *aux) { struct vrip_attach_args *va = aux; - struct vrcmu_softc *sc = (void *)self; + struct vrcmu_softc *sc = device_private(self); sc->sc_iot = va->va_iot; sc->sc_chipset.cc_sc = sc; Index: sys/arch/hpcmips/vr/com_vrip.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/hpcmips/vr/com_vrip.c,v retrieving revision 1.21 diff -u -p -r1.21 com_vrip.c --- sys/arch/hpcmips/vr/com_vrip.c 29 Aug 2008 12:08:30 -0000 1.21 +++ sys/arch/hpcmips/vr/com_vrip.c 5 Oct 2012 00:09:43 -0000 @@ -172,7 +172,7 @@ com_vrip_attach(device_t parent, device_ bus_space_handle_t ioh; sc->sc_dev = self; - vsc->sc_pwctl = device_cfdata(sc->sc_dev)->cf_loc[VRIPIFCF_PWCTL]; + vsc->sc_pwctl = device_cfdata(self)->cf_loc[VRIPIFCF_PWCTL]; DPRINTF(("==com_vrip_attach")); Index: sys/arch/hpcmips/vr/flash_vrip.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/hpcmips/vr/flash_vrip.c,v retrieving revision 1.7 diff -u -p -r1.7 flash_vrip.c --- sys/arch/hpcmips/vr/flash_vrip.c 11 Jun 2008 23:53:15 -0000 1.7 +++ sys/arch/hpcmips/vr/flash_vrip.c 27 Sep 2012 23:04:29 -0000 @@ -58,8 +58,8 @@ int flash_debug = 0; #define DPRINTF(x) #endif -static int flash_probe(struct device *, struct cfdata *, void *); -static void flash_attach(struct device *, struct device *, void *); +static int flash_probe(device_t, cfdata_t, void *); +static void flash_attach(device_t, device_t, void *); const static struct flashops * find_command_set(u_int8_t cmdset0, u_int8_t cmdset1); @@ -75,7 +75,7 @@ static int amd_write(struct flash_softc extern struct cfdriver flash_cd; -CFATTACH_DECL(flash_vrip, sizeof(struct flash_softc), +CFATTACH_DECL_NEW(flash_vrip, sizeof(struct flash_softc), flash_probe, flash_attach, NULL, NULL); dev_type_open(flashopen); @@ -170,7 +170,7 @@ probe_cfi(bus_space_tag_t iot, bus_space } static int -flash_probe(struct device *parent, struct cfdata *match, void *aux) +flash_probe(device_t parent, cfdata_t match, void *aux) { struct vrip_attach_args *va = aux; bus_space_handle_t ioh; @@ -197,9 +197,9 @@ detect: } static void -flash_attach(struct device *parent, struct device *self, void *aux) +flash_attach(device_t parent, device_t self, void *aux) { - struct flash_softc *sc = (void *) self; + struct flash_softc *sc = device_private(self); struct vrip_attach_args *va = aux; int i; int fence; Index: sys/arch/hpcmips/vr/flashvar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/hpcmips/vr/flashvar.h,v retrieving revision 1.2 diff -u -p -r1.2 flashvar.h --- sys/arch/hpcmips/vr/flashvar.h 28 Apr 2008 20:23:22 -0000 1.2 +++ sys/arch/hpcmips/vr/flashvar.h 27 Sep 2012 23:04:03 -0000 @@ -39,7 +39,6 @@ #define FLASH_ST_BUSY 0x01 struct flash_softc { - struct device sc_dev; bus_space_tag_t sc_iot; bus_space_handle_t sc_ioh; size_t sc_size; Index: sys/arch/hpcmips/vr/ite8181_vrip.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/hpcmips/vr/ite8181_vrip.c,v retrieving revision 1.9 diff -u -p -r1.9 ite8181_vrip.c --- sys/arch/hpcmips/vr/ite8181_vrip.c 11 Dec 2005 12:17:34 -0000 1.9 +++ sys/arch/hpcmips/vr/ite8181_vrip.c 28 Sep 2012 14:04:12 -0000 @@ -53,14 +53,14 @@ struct ite8181_vrip_softc { struct ite8181_softc sc_ite8181; }; -static int ite8181_vrip_probe(struct device *, struct cfdata *, void *); -static void ite8181_vrip_attach(struct device *, struct device *, void *); +static int ite8181_vrip_probe(device_t, cfdata_t, void *); +static void ite8181_vrip_attach(device_t, device_t, void *); -CFATTACH_DECL(ite8181video_vrip, sizeof(struct ite8181_vrip_softc), +CFATTACH_DECL_NEW(ite8181video_vrip, sizeof(struct ite8181_vrip_softc), ite8181_vrip_probe, ite8181_vrip_attach, NULL, NULL); static int -ite8181_vrip_probe(struct device *parent, struct cfdata *cf, void *aux) +ite8181_vrip_probe(device_t parent, cfdata_t cf, void *aux) { struct vrip_attach_args *va = aux; bus_space_handle_t ioh; @@ -86,12 +86,13 @@ ite8181_vrip_probe(struct device *parent static void -ite8181_vrip_attach(struct device *parent, struct device *self, void *aux) +ite8181_vrip_attach(device_t parent, device_t self, void *aux) { - struct ite8181_vrip_softc *vsc = (void *)self; + struct ite8181_vrip_softc *vsc = device_private(self); struct ite8181_softc *sc = &vsc->sc_ite8181; struct vrip_attach_args *va = aux; + sc->sc_dev = self; sc->sc_baseaddr = va->va_addr; sc->sc_iot = va->va_iot; if (bus_space_map(va->va_iot, va->va_addr, va->va_size, 0, Index: sys/arch/hpcmips/vr/mq200_vrip.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/hpcmips/vr/mq200_vrip.c,v retrieving revision 1.12 diff -u -p -r1.12 mq200_vrip.c --- sys/arch/hpcmips/vr/mq200_vrip.c 11 Dec 2005 12:17:34 -0000 1.12 +++ sys/arch/hpcmips/vr/mq200_vrip.c 4 Oct 2012 23:52:39 -0000 @@ -55,14 +55,14 @@ struct mq200_vrip_softc { struct mq200_softc sc_mq200; }; -static int mq200_vrip_probe(struct device *, struct cfdata *, void *); -static void mq200_vrip_attach(struct device *, struct device *, void *); +static int mq200_vrip_probe(device_t, cfdata_t, void *); +static void mq200_vrip_attach(device_t, device_t, void *); -CFATTACH_DECL(mqvideo_vrip, sizeof(struct mq200_vrip_softc), +CFATTACH_DECL_NEW(mqvideo_vrip, sizeof(struct mq200_vrip_softc), mq200_vrip_probe, mq200_vrip_attach, NULL, NULL); static int -mq200_vrip_probe(struct device *parent, struct cfdata *cf, void *aux) +mq200_vrip_probe(device_t parent, cfdata_t cf, void *aux) { struct vrip_attach_args *va = aux; bus_space_handle_t ioh; @@ -89,12 +89,13 @@ mq200_vrip_probe(struct device *parent, static void -mq200_vrip_attach(struct device *parent, struct device *self, void *aux) +mq200_vrip_attach(device_t parent, device_t self, void *aux) { - struct mq200_vrip_softc *vsc = (void *)self; + struct mq200_vrip_softc *vsc = device_private(self); struct mq200_softc *sc = &vsc->sc_mq200; struct vrip_attach_args *va = aux; + sc->sc_dev = self; sc->sc_baseaddr = va->va_addr; sc->sc_iot = va->va_iot; if (bus_space_map(va->va_iot, va->va_addr + MQ200_REGADDR, Index: sys/arch/hpcmips/vr/vr4102ip.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/hpcmips/vr/vr4102ip.c,v retrieving revision 1.8 diff -u -p -r1.8 vr4102ip.c --- sys/arch/hpcmips/vr/vr4102ip.c 4 Jan 2008 22:13:57 -0000 1.8 +++ sys/arch/hpcmips/vr/vr4102ip.c 1 Oct 2012 15:42:35 -0000 @@ -46,9 +46,9 @@ __KERNEL_RCSID(0, "$NetBSD: vr4102ip.c,v #include #include -void vr4102ipattach(struct device *, struct device *, void *); +void vr4102ipattach(device_t, device_t, void *); -CFATTACH_DECL(vr4102ip, sizeof(struct vrip_softc), +CFATTACH_DECL_NEW(vr4102ip, sizeof(struct vrip_softc), vripmatch, vr4102ipattach, NULL, NULL); static const struct vrip_unit vr4102ip_units[] = { @@ -92,9 +92,9 @@ static const struct vrip_unit vr4102ip_u }; void -vr4102ipattach(struct device *parent, struct device *self, void *aux) +vr4102ipattach(device_t parent, device_t self, void *aux) { - struct vrip_softc *sc = (struct vrip_softc*)self; + struct vrip_softc *sc = device_private(self); printf("\n"); Index: sys/arch/hpcmips/vr/vr4122ip.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/hpcmips/vr/vr4122ip.c,v retrieving revision 1.7 diff -u -p -r1.7 vr4122ip.c --- sys/arch/hpcmips/vr/vr4122ip.c 4 Jan 2008 22:13:57 -0000 1.7 +++ sys/arch/hpcmips/vr/vr4122ip.c 2 Oct 2012 01:27:09 -0000 @@ -46,9 +46,9 @@ __KERNEL_RCSID(0, "$NetBSD: vr4122ip.c,v #include #include -void vr4122ipattach(struct device *, struct device *, void *); +void vr4122ipattach(device_t, device_t, void *); -CFATTACH_DECL(vr4122ip, sizeof(struct vrip_softc), +CFATTACH_DECL_NEW(vr4122ip, sizeof(struct vrip_softc), vripmatch, vr4122ipattach, NULL, NULL); static const struct vrip_unit vr4122ip_units[] = { @@ -92,9 +92,9 @@ static const struct vrip_unit vr4122ip_u }; void -vr4122ipattach(struct device *parent, struct device *self, void *aux) +vr4122ipattach(device_t parent, device_t self, void *aux) { - struct vrip_softc *sc = (struct vrip_softc*)self; + struct vrip_softc *sc = device_private(self); printf("\n"); Index: sys/arch/hpcmips/vr/vr4181aiu.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/hpcmips/vr/vr4181aiu.c,v retrieving revision 1.7 diff -u -p -r1.7 vr4181aiu.c --- sys/arch/hpcmips/vr/vr4181aiu.c 6 Jun 2010 06:10:03 -0000 1.7 +++ sys/arch/hpcmips/vr/vr4181aiu.c 27 Sep 2012 23:08:48 -0000 @@ -69,7 +69,6 @@ int vr4181aiu_debug = 0; struct vr4181aiu_softc { - struct device sc_dev; bus_space_tag_t sc_iot; bus_space_handle_t sc_dcu1_ioh; bus_space_handle_t sc_dcu2_ioh; @@ -83,13 +82,13 @@ struct vr4181aiu_softc { int sc_status; }; -static int vr4181aiu_match(struct device *, struct cfdata *, void *); -static void vr4181aiu_attach(struct device *, struct device *, void *); +static int vr4181aiu_match(device_t, cfdata_t, void *); +static void vr4181aiu_attach(device_t, device_t, void *); static int vr4181aiu_intr(void *); extern struct cfdriver vr4181aiu_cd; -CFATTACH_DECL(vr4181aiu, sizeof(struct vr4181aiu_softc), +CFATTACH_DECL_NEW(vr4181aiu, sizeof(struct vr4181aiu_softc), vr4181aiu_match, vr4181aiu_attach, NULL, NULL); dev_type_open(vr4181aiuopen); @@ -103,7 +102,7 @@ const struct cdevsw vr4181aiu_cdevsw = { }; static int -vr4181aiu_match(struct device *parent, struct cfdata *cf, void *aux) +vr4181aiu_match(device_t parent, cfdata_t cf, void *aux) { return 1; } @@ -160,10 +159,10 @@ vr4181aiu_disable(struct vr4181aiu_softc } static void -vr4181aiu_attach(struct device *parent, struct device *self, void *aux) +vr4181aiu_attach(device_t parent, device_t self, void *aux) { struct vrip_attach_args *va = aux; - struct vr4181aiu_softc *sc = (void *) self; + struct vr4181aiu_softc *sc = device_private(self); vr4181aiu_init_inbuf(sc); memset(sc->sc_inbuf1, 0x55, INBUFLEN * 2); @@ -215,7 +214,7 @@ vr4181aiu_attach(struct device *parent, if (vrip_intr_establish(va->va_vc, va->va_unit, 0, IPL_BIO, vr4181aiu_intr, sc) == NULL) { printf("%s: can't establish interrupt\n", - sc->sc_dev.dv_xname); + device_xname(self)); return; } Index: sys/arch/hpcmips/vr/vr4181giu.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/hpcmips/vr/vr4181giu.c,v retrieving revision 1.3 diff -u -p -r1.3 vr4181giu.c --- sys/arch/hpcmips/vr/vr4181giu.c 11 Dec 2005 12:17:34 -0000 1.3 +++ sys/arch/hpcmips/vr/vr4181giu.c 2 Oct 2012 01:28:07 -0000 @@ -58,7 +58,6 @@ struct vr4181giu_intr_entry { }; struct vr4181giu_softc { - struct device sc_dev; bus_space_tag_t sc_iot; bus_space_handle_t sc_ioh; vrip_chipset_tag_t sc_vc; @@ -70,24 +69,22 @@ struct vr4181giu_softc { struct hpcio_attach_args sc_haa; }; -static int vr4181giu_match(struct device *, struct cfdata *, void *); -static void vr4181giu_attach(struct device *, struct device *, void *); +static int vr4181giu_match(device_t, cfdata_t, void *); +static void vr4181giu_attach(device_t, device_t, void *); -static void vr4181giu_callback(struct device *self); -static int vr4181giu_print(void *aux, const char *pnp); -static int vr4181giu_port_read(hpcio_chip_t hc, int port); -static void vr4181giu_port_write(hpcio_chip_t hc, int port, int onoff); -static void vr4181giu_update(hpcio_chip_t hc); -static void vr4181giu_dump(hpcio_chip_t hc); -static hpcio_chip_t vr4181giu_getchip(void* scx, int chipid); +static void vr4181giu_callback(device_t); +static int vr4181giu_print(void *, const char *); +static int vr4181giu_port_read(hpcio_chip_t, int); +static void vr4181giu_port_write(hpcio_chip_t, int, int); +static void vr4181giu_update(hpcio_chip_t); +static void vr4181giu_dump(hpcio_chip_t); +static hpcio_chip_t vr4181giu_getchip(void *, int); static void *vr4181giu_intr_establish(hpcio_chip_t, int, int, int (*)(void *),void *); -static void vr4181giu_intr_disestablish(hpcio_chip_t hc, void *arg); -static void vr4181giu_intr_clear(hpcio_chip_t hc, void *arg); -static void vr4181giu_register_iochip(hpcio_chip_t hc, hpcio_chip_t iochip); -static int vr4181giu_intr(void *arg); - - +static void vr4181giu_intr_disestablish(hpcio_chip_t, void *); +static void vr4181giu_intr_clear(hpcio_chip_t, void *); +static void vr4181giu_register_iochip(hpcio_chip_t, hpcio_chip_t); +static int vr4181giu_intr(void *); static struct hpcio_chip vr4181giu_iochip = { .hc_portread = vr4181giu_port_read, @@ -100,19 +97,19 @@ static struct hpcio_chip vr4181giu_iochi .hc_dump = vr4181giu_dump, }; -CFATTACH_DECL(vr4181giu, sizeof(struct vr4181giu_softc), +CFATTACH_DECL_NEW(vr4181giu, sizeof(struct vr4181giu_softc), vr4181giu_match, vr4181giu_attach, NULL, NULL); static int -vr4181giu_match(struct device *parent, struct cfdata *match, void *aux) +vr4181giu_match(device_t parent, cfdata_t match, void *aux) { return (2); /* 1st attach group of vrip */ } static void -vr4181giu_attach(struct device *parent, struct device *self, void *aux) +vr4181giu_attach(device_t parent, device_t self, void *aux) { - struct vr4181giu_softc *sc = (struct vr4181giu_softc*) self; + struct vr4181giu_softc *sc = device_private(self); struct vrip_attach_args *va = aux; int i; @@ -131,7 +128,7 @@ vr4181giu_attach(struct device *parent, if (!(sc->sc_ih = vrip_intr_establish(va->va_vc, va->va_unit, 0, IPL_BIO, vr4181giu_intr, sc))) { - printf("%s: can't establish interrupt\n", sc->sc_dev.dv_xname); + printf("%s: can't establish interrupt\n", device_xname(self)); return; } @@ -140,7 +137,7 @@ vr4181giu_attach(struct device *parent, */ sc->sc_iochip = vr4181giu_iochip; /* structure copy */ sc->sc_iochip.hc_chipid = VRIP_IOCHIP_VR4181GIU; - sc->sc_iochip.hc_name = sc->sc_dev.dv_xname; + sc->sc_iochip.hc_name = device_xname(self); sc->sc_iochip.hc_sc = sc; /* Register functions to upper interface */ vrip_register_gpio(va->va_vc, &sc->sc_iochip); @@ -167,7 +164,7 @@ vr4181giu_attach(struct device *parent, } static void -vr4181giu_callback(struct device *self) +vr4181giu_callback(device_t self) { struct vr4181giu_softc *sc = (void *) self; Index: sys/arch/hpcmips/vr/vr4181ip.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/hpcmips/vr/vr4181ip.c,v retrieving revision 1.3 diff -u -p -r1.3 vr4181ip.c --- sys/arch/hpcmips/vr/vr4181ip.c 11 Dec 2005 12:17:34 -0000 1.3 +++ sys/arch/hpcmips/vr/vr4181ip.c 2 Oct 2012 01:28:25 -0000 @@ -49,9 +49,9 @@ __KERNEL_RCSID(0, "$NetBSD: vr4181ip.c,v #include #include -static void vr4181ipattach(struct device *, struct device *, void *); +static void vr4181ipattach(device_t, device_t, void *); -CFATTACH_DECL(vr4181ip, sizeof(struct vrip_softc), +CFATTACH_DECL_NEW(vr4181ip, sizeof(struct vrip_softc), vripmatch, vr4181ipattach, NULL, NULL); static const struct vrip_unit vr4181ip_units[] = { @@ -121,9 +121,9 @@ static int registered = 0; static void -vr4181ipattach(struct device *parent, struct device *self, void *aux) +vr4181ipattach(device_t parent, device_t self, void *aux) { - struct vrip_softc *sc = (struct vrip_softc*) self; + struct vrip_softc *sc = device_private(self); printf("\n"); Index: sys/arch/hpcmips/vr/vraiu.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/hpcmips/vr/vraiu.c,v retrieving revision 1.14 diff -u -p -r1.14 vraiu.c --- sys/arch/hpcmips/vr/vraiu.c 24 Nov 2011 03:35:56 -0000 1.14 +++ sys/arch/hpcmips/vr/vraiu.c 27 Sep 2012 23:11:16 -0000 @@ -59,7 +59,7 @@ int vraiu_debug = VRAIU_DEBUG; #define AUDIO_BUF_SIZE 2048 struct vraiu_softc { - struct device sc_dev; + device_t sc_dev; kmutex_t sc_lock; kmutex_t sc_intr_lock; bus_space_tag_t sc_iot; @@ -84,11 +84,11 @@ struct vraiu_softc { void *sc_intrdata; /* interrupt data */ }; -int vraiu_match(struct device *, struct cfdata *, void *); -void vraiu_attach(struct device *, struct device *, void *); +int vraiu_match(device_t, cfdata_t, void *); +void vraiu_attach(device_t, device_t, void *); int vraiu_intr(void *); -CFATTACH_DECL(vraiu, sizeof(struct vraiu_softc), +CFATTACH_DECL_NEW(vraiu, sizeof(struct vraiu_softc), vraiu_match, vraiu_attach, NULL, NULL); struct audio_device aiu_device = { @@ -169,13 +169,13 @@ static void vraiu_slinear16sw_2(struct v static void vraiu_volume(struct vraiu_softc *, u_short *, void *, int); int -vraiu_match(struct device *parent, struct cfdata *cf, void *aux) +vraiu_match(device_t parent, cfdata_t cf, void *aux) { return 1; } void -vraiu_attach(struct device *parent, struct device *self, void *aux) +vraiu_attach(device_t parent, device_t self, void *aux) { struct vrip_attach_args *va; struct vraiu_softc *sc; @@ -183,7 +183,8 @@ vraiu_attach(struct device *parent, stru int rsegs; va = aux; - sc = (void *)self; + sc = device_private(self); + sc->sc_dev = self; sc->sc_status = ENXIO; sc->sc_intr = NULL; sc->sc_iot = va->va_iot; @@ -277,7 +278,7 @@ vraiu_attach(struct device *parent, stru DPRINTFN(1, ("vraiu_attach: reset AIU\n")) bus_space_write_2(sc->sc_iot, sc->sc_ioh, SEQ_REG_W, AIURST); /* attach audio subsystem */ - audio_attach_mi(&vraiu_hw_if, sc, &sc->sc_dev); + audio_attach_mi(&vraiu_hw_if, sc, self); } int @@ -828,7 +829,7 @@ vraiu_slinear8_1(struct vraiu_softc *sc, #ifdef DIAGNOSTIC if (n > AUDIO_BUF_SIZE/2) { printf("%s: output data too large (%d > %d)\n", - sc->sc_dev.dv_xname, n, AUDIO_BUF_SIZE/2); + device_xname(sc->sc_dev), n, AUDIO_BUF_SIZE/2); n = AUDIO_BUF_SIZE/2; } #endif @@ -848,7 +849,7 @@ vraiu_slinear8_2(struct vraiu_softc *sc, #ifdef DIAGNOSTIC if (n > AUDIO_BUF_SIZE) { printf("%s: output data too large (%d > %d)\n", - sc->sc_dev.dv_xname, n, AUDIO_BUF_SIZE); + device_xname(sc->sc_dev), n, AUDIO_BUF_SIZE); n = AUDIO_BUF_SIZE; } #endif @@ -870,7 +871,7 @@ vraiu_ulinear8_1(struct vraiu_softc *sc, #ifdef DIAGNOSTIC if (n > AUDIO_BUF_SIZE/2) { printf("%s: output data too large (%d > %d)\n", - sc->sc_dev.dv_xname, n, AUDIO_BUF_SIZE/2); + device_xname(sc->sc_dev), n, AUDIO_BUF_SIZE/2); n = AUDIO_BUF_SIZE/2; } #endif @@ -890,7 +891,7 @@ vraiu_ulinear8_2(struct vraiu_softc *sc, #ifdef DIAGNOSTIC if (n > AUDIO_BUF_SIZE) { printf("%s: output data too large (%d > %d)\n", - sc->sc_dev.dv_xname, n, AUDIO_BUF_SIZE); + device_xname(sc->sc_dev), n, AUDIO_BUF_SIZE); n = AUDIO_BUF_SIZE; } #endif @@ -912,7 +913,7 @@ vraiu_mulaw_1(struct vraiu_softc *sc, u_ #ifdef DIAGNOSTIC if (n > AUDIO_BUF_SIZE/2) { printf("%s: output data too large (%d > %d)\n", - sc->sc_dev.dv_xname, n, AUDIO_BUF_SIZE/2); + device_xname(sc->sc_dev), n, AUDIO_BUF_SIZE/2); n = AUDIO_BUF_SIZE/2; } #endif @@ -932,7 +933,7 @@ vraiu_mulaw_2(struct vraiu_softc *sc, u_ #ifdef DIAGNOSTIC if (n > AUDIO_BUF_SIZE) { printf("%s: output data too large (%d > %d)\n", - sc->sc_dev.dv_xname, n, AUDIO_BUF_SIZE); + device_xname(sc->sc_dev), n, AUDIO_BUF_SIZE); n = AUDIO_BUF_SIZE; } #endif @@ -954,7 +955,7 @@ vraiu_slinear16_1(struct vraiu_softc *sc #ifdef DIAGNOSTIC if (n > AUDIO_BUF_SIZE) { printf("%s: output data too large (%d > %d)\n", - sc->sc_dev.dv_xname, n, AUDIO_BUF_SIZE); + device_xname(sc->sc_dev), n, AUDIO_BUF_SIZE); n = AUDIO_BUF_SIZE; } #endif @@ -975,7 +976,7 @@ vraiu_slinear16_2(struct vraiu_softc *sc #ifdef DIAGNOSTIC if (n > AUDIO_BUF_SIZE*2) { printf("%s: output data too large (%d > %d)\n", - sc->sc_dev.dv_xname, n, AUDIO_BUF_SIZE*2); + device_xname(sc->sc_dev), n, AUDIO_BUF_SIZE*2); n = AUDIO_BUF_SIZE*2; } #endif @@ -997,7 +998,7 @@ vraiu_slinear16sw_1(struct vraiu_softc * #ifdef DIAGNOSTIC if (n > AUDIO_BUF_SIZE) { printf("%s: output data too large (%d > %d)\n", - sc->sc_dev.dv_xname, n, AUDIO_BUF_SIZE); + device_xname(sc->sc_dev), n, AUDIO_BUF_SIZE); n = AUDIO_BUF_SIZE; } #endif @@ -1018,7 +1019,7 @@ vraiu_slinear16sw_2(struct vraiu_softc * #ifdef DIAGNOSTIC if (n > AUDIO_BUF_SIZE*2) { printf("%s: output data too large (%d > %d)\n", - sc->sc_dev.dv_xname, n, AUDIO_BUF_SIZE*2); + device_xname(sc->sc_dev), n, AUDIO_BUF_SIZE*2); n = AUDIO_BUF_SIZE*2; } #endif Index: sys/arch/hpcmips/vr/vrc4172gpio.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/hpcmips/vr/vrc4172gpio.c,v retrieving revision 1.12 diff -u -p -r1.12 vrc4172gpio.c --- sys/arch/hpcmips/vr/vrc4172gpio.c 15 Dec 2007 00:39:18 -0000 1.12 +++ sys/arch/hpcmips/vr/vrc4172gpio.c 1 Oct 2012 15:33:55 -0000 @@ -82,7 +82,6 @@ struct vrc4172gpio_intr_entry { }; struct vrc4172gpio_softc { - struct device sc_dev; bus_space_tag_t sc_iot; bus_space_handle_t sc_ioh; struct hpcio_attach_args sc_args; @@ -97,23 +96,23 @@ struct vrc4172gpio_softc { struct hpcio_attach_args sc_haa; }; -int vrc4172gpio_match(struct device*, struct cfdata*, void*); -void vrc4172gpio_attach(struct device*, struct device*, void*); -void vrc4172gpio_callback(struct device *self); -int vrc4172gpio_intr(void*); -int vrc4172gpio_print(void*, const char*); +int vrc4172gpio_match(device_t, cfdata_t, void *); +void vrc4172gpio_attach(device_t, device_t, void *); +void vrc4172gpio_callback(device_t); +int vrc4172gpio_intr(void *); +int vrc4172gpio_print(void *, const char *); int vrc4172gpio_port_read(hpcio_chip_t, int); void vrc4172gpio_port_write(hpcio_chip_t, int, int); -void *vrc4172gpio_intr_establish(hpcio_chip_t, int, int, int (*)(void *), void*); -void vrc4172gpio_intr_disestablish(hpcio_chip_t, void*); -void vrc4172gpio_intr_clear(hpcio_chip_t, void*); +void *vrc4172gpio_intr_establish(hpcio_chip_t, int, int, int (*)(void *), void *); +void vrc4172gpio_intr_disestablish(hpcio_chip_t, void *); +void vrc4172gpio_intr_clear(hpcio_chip_t, void *); void vrc4172gpio_register_iochip(hpcio_chip_t, hpcio_chip_t); void vrc4172gpio_update(hpcio_chip_t); void vrc4172gpio_dump(hpcio_chip_t); void vrc4172gpio_intr_dump(struct vrc4172gpio_softc *, int); -hpcio_chip_t vrc4172gpio_getchip(void*, int); -static void vrc4172gpio_diffport(struct vrc4172gpio_softc *sc); +hpcio_chip_t vrc4172gpio_getchip(void *, int); +static void vrc4172gpio_diffport(struct vrc4172gpio_softc *); static u_int16_t read_2(struct vrc4172gpio_softc *, bus_addr_t); static void write_2(struct vrc4172gpio_softc *, bus_addr_t, u_int16_t); @@ -138,7 +137,7 @@ static int intlv_regs[] = { VRC2_EXGPINTLV1L }; -CFATTACH_DECL(vrc4172gpio, sizeof(struct vrc4172gpio_softc), +CFATTACH_DECL_NEW(vrc4172gpio, sizeof(struct vrc4172gpio_softc), vrc4172gpio_match, vrc4172gpio_attach, NULL, NULL); /* @@ -175,7 +174,7 @@ write_4(struct vrc4172gpio_softc *sc, bu } int -vrc4172gpio_match(struct device *parent, struct cfdata *cf, void *aux) +vrc4172gpio_match(device_t parent, cfdata_t cf, void *aux) { struct hpcio_attach_args *haa = aux; platid_mask_t mask; @@ -190,15 +189,15 @@ vrc4172gpio_match(struct device *parent, } void -vrc4172gpio_attach(struct device *parent, struct device *self, void *aux) +vrc4172gpio_attach(device_t parent, device_t self, void *aux) { struct hpcio_attach_args *args = aux; - struct vrc4172gpio_softc *sc = (void*)self; + struct vrc4172gpio_softc *sc = device_private(self); int i, *loc, port, mode; u_int32_t regs[6], t0, t1, t2; printf("\n"); - loc = device_cfdata(&sc->sc_dev)->cf_loc; + loc = device_cfdata(self)->cf_loc; /* * map bus space @@ -209,7 +208,7 @@ vrc4172gpio_attach(struct device *parent bus_space_map(sc->sc_iot, loc[HPCIOIFCF_ADDR], loc[HPCIOIFCF_SIZE], 0 /* no cache */, &sc->sc_ioh); if (sc->sc_ioh == 0) { - printf("%s: can't map bus space\n", sc->sc_dev.dv_xname); + printf("%s: can't map bus space\n", device_xname(self)); return; } @@ -300,7 +299,7 @@ vrc4172gpio_attach(struct device *parent sc->sc_intr_handle = hpcio_intr_establish(sc->sc_hc, port, mode, vrc4172gpio_intr, sc); if (sc->sc_intr_handle == NULL) { - printf("%s: can't establish interrupt\n", sc->sc_dev.dv_xname); + printf("%s: can't establish interrupt\n", device_xname(self)); return; } @@ -309,7 +308,7 @@ vrc4172gpio_attach(struct device *parent */ sc->sc_iochip = vrc4172gpio_iochip; /* structure copy */ sc->sc_iochip.hc_chipid = VRIP_IOCHIP_VRC4172GPIO; - sc->sc_iochip.hc_name = sc->sc_dev.dv_xname; + sc->sc_iochip.hc_name = device_xname(self); sc->sc_iochip.hc_sc = sc; /* Register functions to upper interface */ hpcio_register_iochip(sc->sc_hc, &sc->sc_iochip); @@ -333,9 +332,9 @@ vrc4172gpio_attach(struct device *parent } void -vrc4172gpio_callback(struct device *self) +vrc4172gpio_callback(device_t self) { - struct vrc4172gpio_softc *sc = (void*)self; + struct vrc4172gpio_softc *sc = device_private(self); sc->sc_haa.haa_busname = "vrisab"; config_found(self, &sc->sc_haa, vrc4172gpio_print); Index: sys/arch/hpcmips/vr/vrc4172pci.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/hpcmips/vr/vrc4172pci.c,v retrieving revision 1.15 diff -u -p -r1.15 vrc4172pci.c --- sys/arch/hpcmips/vr/vrc4172pci.c 24 Aug 2011 20:27:36 -0000 1.15 +++ sys/arch/hpcmips/vr/vrc4172pci.c 29 Sep 2012 13:45:15 -0000 @@ -61,7 +61,7 @@ __KERNEL_RCSID(0, "$NetBSD: vrc4172pci.c #endif struct vrc4172pci_softc { - struct device sc_dev; + device_t sc_dev; bus_space_tag_t sc_iot; bus_space_handle_t sc_ioh; @@ -76,9 +76,9 @@ struct vrc4172pci_softc { #endif /* VRC4172PCI_MCR700_SUPPORT */ }; -static int vrc4172pci_match(struct device *, struct cfdata *, void *); -static void vrc4172pci_attach(struct device *, struct device *, void *); -static void vrc4172pci_attach_hook(struct device *, struct device *, +static int vrc4172pci_match(device_t, cfdata_t, void *); +static void vrc4172pci_attach(device_t, device_t, void *); +static void vrc4172pci_attach_hook(device_t, device_t, struct pcibus_attach_args *); static int vrc4172pci_bus_maxdevs(pci_chipset_tag_t, int); static int vrc4172pci_bus_devorder(pci_chipset_tag_t, int, uint8_t *, int); @@ -88,7 +88,7 @@ static void vrc4172pci_decompose_tag(pci static pcireg_t vrc4172pci_conf_read(pci_chipset_tag_t, pcitag_t, int); static void vrc4172pci_conf_write(pci_chipset_tag_t, pcitag_t, int, pcireg_t); -static int vrc4172pci_intr_map(struct pci_attach_args *, +static int vrc4172pci_intr_map(const struct pci_attach_args *, pci_intr_handle_t *); static const char *vrc4172pci_intr_string(pci_chipset_tag_t,pci_intr_handle_t); static const struct evcnt *vrc4172pci_intr_evcnt(pci_chipset_tag_t, @@ -102,7 +102,7 @@ static int vrc4172pci_mcr700_intr(void * #endif #endif -CFATTACH_DECL(vrc4172pci, sizeof(struct vrc4172pci_softc), +CFATTACH_DECL_NEW(vrc4172pci, sizeof(struct vrc4172pci_softc), vrc4172pci_match, vrc4172pci_attach, NULL, NULL); static inline void @@ -125,22 +125,23 @@ vrc4172pci_read(struct vrc4172pci_softc } static int -vrc4172pci_match(struct device *parent, struct cfdata *match, void *aux) +vrc4172pci_match(device_t parent, cfdata_t match, void *aux) { return (1); } static void -vrc4172pci_attach(struct device *parent, struct device *self, void *aux) +vrc4172pci_attach(device_t parent, device_t self, void *aux) { - struct vrc4172pci_softc *sc = (struct vrc4172pci_softc *)self; + struct vrc4172pci_softc *sc = device_private(self); pci_chipset_tag_t pc = &sc->sc_pc; struct vrip_attach_args *va = aux; #if NPCI > 0 struct pcibus_attach_args pba; #endif + sc->sc_dev = self; sc->sc_iot = va->va_iot; if (bus_space_map(sc->sc_iot, va->va_addr, va->va_size, 0, &sc->sc_ioh)) { @@ -166,7 +167,7 @@ vrc4172pci_attach(struct device *parent, } #endif /* VRC4172PCI_MCR700_SUPPORT */ - pc->pc_dev = &sc->sc_dev; + pc->pc_dev = sc->sc_dev; pc->pc_attach_hook = vrc4172pci_attach_hook; pc->pc_bus_maxdevs = vrc4172pci_bus_maxdevs; pc->pc_bus_devorder = vrc4172pci_bus_devorder; @@ -186,7 +187,7 @@ vrc4172pci_attach(struct device *parent, for (i = 0; i < 2; i++) printf("%s: ID_REG(0, 0, %d) = 0x%08x\n", - sc->sc_dev.dv_xname, i, + device_xname(self), i, pci_conf_read(pc, pci_make_tag(pc, 0, 0, i), PCI_ID_REG)); } @@ -209,7 +210,7 @@ vrc4172pci_attach(struct device *parent, } void -vrc4172pci_attach_hook(struct device *parent, struct device *self, +vrc4172pci_attach_hook(device_t parent, device_t self, struct pcibus_attach_args *pba) { @@ -256,7 +257,7 @@ vrc4172pci_decompose_tag(pci_chipset_tag pcireg_t vrc4172pci_conf_read(pci_chipset_tag_t pc, pcitag_t tag, int reg) { - struct vrc4172pci_softc *sc = (struct vrc4172pci_softc *)pc->pc_dev; + struct vrc4172pci_softc *sc = device_private(pc->pc_dev); u_int32_t val; #ifdef VRC4172PCI_MCR700_SUPPORT @@ -277,7 +278,7 @@ vrc4172pci_conf_read(pci_chipset_tag_t p out: #endif DPRINTF(("%s: conf_read: tag = 0x%08x, reg = 0x%x, val = 0x%08x\n", - sc->sc_dev.dv_xname, (u_int32_t)tag, reg, val)); + device_xname(sc->sc_dev), (u_int32_t)tag, reg, val)); return (val); } @@ -286,10 +287,10 @@ void vrc4172pci_conf_write(pci_chipset_tag_t pc, pcitag_t tag, int reg, pcireg_t data) { - struct vrc4172pci_softc *sc = (struct vrc4172pci_softc *)pc->pc_dev; + struct vrc4172pci_softc *sc = device_private(pc->pc_dev); DPRINTF(("%s: conf_write: tag = 0x%08x, reg = 0x%x, val = 0x%08x\n", - sc->sc_dev.dv_xname, (u_int32_t)tag, reg, (u_int32_t)data)); + device_xname(sc->sc_dev), (u_int32_t)tag, reg, (u_int32_t)data)); #ifdef VRC4172PCI_MCR700_SUPPORT if (sc->sc_fake_baseaddr != 0 && @@ -307,14 +308,14 @@ vrc4172pci_conf_write(pci_chipset_tag_t } int -vrc4172pci_intr_map(struct pci_attach_args *pa, pci_intr_handle_t *ihp) +vrc4172pci_intr_map(const struct pci_attach_args *pa, pci_intr_handle_t *ihp) { pci_chipset_tag_t pc = pa->pa_pc; pcitag_t intrtag = pa->pa_intrtag; int bus, dev, func; pci_decompose_tag(pc, intrtag, &bus, &dev, &func); - DPRINTF(("%s(%d, %d, %d): line = %d, pin = %d\n", pc->pc_dev->dv_xname, + DPRINTF(("%s(%d, %d, %d): line = %d, pin = %d\n", device_xname(pc->pc_dev), bus, dev, func, pa->pa_intrline, pa->pa_intrpin)); *ihp = CONFIG_HOOK_PCIINTR_ID(bus, dev, func); Index: sys/arch/hpcmips/vr/vrc4172pwm.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/hpcmips/vr/vrc4172pwm.c,v retrieving revision 1.21 diff -u -p -r1.21 vrc4172pwm.c --- sys/arch/hpcmips/vr/vrc4172pwm.c 12 Feb 2012 16:34:08 -0000 1.21 +++ sys/arch/hpcmips/vr/vrc4172pwm.c 27 Sep 2012 23:13:52 -0000 @@ -59,8 +59,8 @@ int vrc4172pwmdebug = VRC2PWMDEBUG_CONF; #define VDUMPREG(arg) if (bootverbose) vrc4172pwm_dumpreg(arg); #endif /* VRC2PWMDEBUG */ -static int vrc4172pwmprobe(struct device *, struct cfdata *, void *); -static void vrc4172pwmattach(struct device *, struct device *, void *); +static int vrc4172pwmprobe(device_t, cfdata_t, void *); +static void vrc4172pwmattach(device_t, device_t, void *); static void vrc4172pwm_write(struct vrc4172pwm_softc *, int, unsigned short); static unsigned short vrc4172pwm_read(struct vrc4172pwm_softc *, int); @@ -79,7 +79,7 @@ int vrc4172pwm_brightness2rawduty(struct struct vrc4172pwm_param * vrc4172pwm_getparam(void); void vrc4172pwm_dumpreg(struct vrc4172pwm_softc *); -CFATTACH_DECL(vrc4172pwm, sizeof(struct vrc4172pwm_softc), +CFATTACH_DECL_NEW(vrc4172pwm, sizeof(struct vrc4172pwm_softc), vrc4172pwmprobe, vrc4172pwmattach, NULL, NULL); /* @@ -142,7 +142,7 @@ vrc4172pwm_read(struct vrc4172pwm_softc } static int -vrc4172pwmprobe(struct device *parent, struct cfdata *cf, void *aux) +vrc4172pwmprobe(device_t parent, cfdata_t cf, void *aux) { platid_mask_t mask; struct vrip_attach_args *va = aux; @@ -198,9 +198,9 @@ vrc4172pwmprobe(struct device *parent, s } static void -vrc4172pwmattach(struct device *parent, struct device *self, void *aux) +vrc4172pwmattach(device_t parent, device_t self, void *aux) { - struct vrc4172pwm_softc *sc = (struct vrc4172pwm_softc *)self; + struct vrc4172pwm_softc *sc = device_private(self); struct vrip_attach_args *va = aux; bus_space_tag_t iot = va->va_iot; Index: sys/arch/hpcmips/vr/vrc4172pwmvar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/hpcmips/vr/vrc4172pwmvar.h,v retrieving revision 1.8 diff -u -p -r1.8 vrc4172pwmvar.h --- sys/arch/hpcmips/vr/vrc4172pwmvar.h 13 Apr 2001 08:09:08 -0000 1.8 +++ sys/arch/hpcmips/vr/vrc4172pwmvar.h 27 Sep 2012 23:14:06 -0000 @@ -40,7 +40,6 @@ struct vrc4172pwm_param { }; struct vrc4172pwm_softc { - struct device sc_dev; bus_space_tag_t sc_iot; bus_space_handle_t sc_ioh; config_hook_tag sc_lcdhook; Index: sys/arch/hpcmips/vr/vrc4173bcu.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/hpcmips/vr/vrc4173bcu.c,v retrieving revision 1.21 diff -u -p -r1.21 vrc4173bcu.c --- sys/arch/hpcmips/vr/vrc4173bcu.c 5 Apr 2009 21:19:37 -0000 1.21 +++ sys/arch/hpcmips/vr/vrc4173bcu.c 2 Oct 2012 01:28:50 -0000 @@ -60,12 +60,11 @@ __KERNEL_RCSID(0, "$NetBSD: vrc4173bcu.c #define VRC4173BCU_BADR 0x10 #define USE_WINCE_CLKMASK (~0) -static int vrc4173bcu_match(struct device *, struct cfdata *, void *); -static void vrc4173bcu_attach(struct device *, struct device *, void *); +static int vrc4173bcu_match(device_t, cfdata_t, void *); +static void vrc4173bcu_attach(device_t, device_t, void *); static int vrc4173bcu_intr(void *); static int vrc4173bcu_print(void *, const char *); -static int vrc4173bcu_search(struct device *, struct cfdata *cf, - const int *, void *); +static int vrc4173bcu_search(device_t, cfdata_t, const int *, void *); static int vrc4173bcu_pci_intr(void *); #ifdef VRC4173BCU_DEBUG static void vrc4173bcu_dump_level2mask(vrip_chipset_tag_t, @@ -132,7 +131,7 @@ struct vrc4173bcu_unit { }; struct vrc4173bcu_softc { - struct device sc_dev; + device_t sc_dev; struct vrip_chipset_tag sc_chipset; struct vrcmu_chipset_tag sc_cmuchip; @@ -214,7 +213,7 @@ static struct vrc4173bcu_unit vrc4173bcu }, }; -CFATTACH_DECL(vrc4173bcu, sizeof(struct vrc4173bcu_softc), +CFATTACH_DECL_NEW(vrc4173bcu, sizeof(struct vrc4173bcu_softc), vrc4173bcu_match, vrc4173bcu_attach, NULL, NULL); static const struct vrip_chipset_tag vrc4173bcu_chipset_methods = { @@ -231,7 +230,7 @@ static const struct vrip_chipset_tag vrc }; int -vrc4173bcu_match(struct device *parent, struct cfdata *match, void *aux) +vrc4173bcu_match(device_t parent, cfdata_t match, void *aux) { struct pci_attach_args *pa = (struct pci_attach_args *)aux; @@ -243,10 +242,10 @@ vrc4173bcu_match(struct device *parent, } void -vrc4173bcu_attach(struct device *parent, struct device *self, void *aux) +vrc4173bcu_attach(device_t parent, device_t self, void *aux) { - struct vrc4173bcu_softc *sc = (struct vrc4173bcu_softc *)self; - struct pci_attach_args *pa = (struct pci_attach_args *)aux; + struct vrc4173bcu_softc *sc = device_private(self); + struct pci_attach_args *pa = aux; pci_chipset_tag_t pc = pa->pa_pc; pcitag_t tag = pa->pa_tag; pcireg_t csr; @@ -259,11 +258,13 @@ vrc4173bcu_attach(struct device *parent, char buf[80]; #endif + sc->sc_dev = self; + pci_devinfo(pa->pa_id, pa->pa_class, 0, devinfo, sizeof(devinfo)); printf(": %s (rev. 0x%02x)\n", devinfo, PCI_REVISION(pa->pa_class)); #if 0 - printf("%s: ", sc->sc_dev.dv_xname); + printf("%s: ", device_xname(self)); pci_conf_print(pa->pa_pc, pa->pa_tag, NULL); #endif @@ -282,22 +283,22 @@ vrc4173bcu_attach(struct device *parent, /* Map I/O registers */ if (pci_mapreg_map(pa, VRC4173BCU_BADR, PCI_MAPREG_TYPE_IO, 0, &sc->sc_iot, &sc->sc_ioh, NULL, &sc->sc_size)) { - printf("%s: can't map mem space\n", sc->sc_dev.dv_xname); + printf("%s: can't map mem space\n", device_xname(self)); return; } /* Enable the device. */ csr = pci_conf_read(pc, tag, PCI_COMMAND_STATUS_REG); - DPRINTF(("%s: csr = 0x%08x", sc->sc_dev.dv_xname, csr)); + DPRINTF(("%s: csr = 0x%08x", device_xname(self), csr)); pci_conf_write(pc, tag, PCI_COMMAND_STATUS_REG, csr | PCI_COMMAND_MASTER_ENABLE | PCI_COMMAND_IO_ENABLE); csr = pci_conf_read(pc, tag, PCI_COMMAND_STATUS_REG); DPRINTF((" -> 0x%08x\n", csr)); csr = pci_conf_read(pc, tag, VRC4173BCU_BADR); - DPRINTF(("%s: base addr = %x@0x%08x\n", sc->sc_dev.dv_xname, + DPRINTF(("%s: base addr = %x@0x%08x\n", device_xname(self), (int)sc->sc_size, csr)); - DPRINTF(("%s: iot = 0x%08x, ioh = 0x%08x\n", sc->sc_dev.dv_xname, + DPRINTF(("%s: iot = 0x%08x, ioh = 0x%08x\n", device_xname(self), (int)sc->sc_iot, (int)sc->sc_ioh)); /* @@ -324,7 +325,7 @@ vrc4173bcu_attach(struct device *parent, reg = bus_space_read_2(sc->sc_iot, sc->sc_cmuh, VRC4173CMU_CLKMSK); printf("%s: default clock mask is %04x\n", - sc->sc_dev.dv_xname, reg); + device_xname(self), reg); } else { /* assert all reset bits */ bus_space_write_2(sc->sc_iot, sc->sc_cmuh, VRC4173CMU_SRST, @@ -342,19 +343,19 @@ vrc4173bcu_attach(struct device *parent, snprintb(buf, sizeof(buf), "\20\1USB\2PCMCIA2\3PCMCIA1\4PS2CH2\5PS2CH1\6PIU\7AIU\10KIU" "\11GIU\12AC97\13AC97-1\14B11\15B12\16DOZEPIU\17B14\20B15", reg); - printf("%s: SYSINT1 = 0x%s\n", sc->sc_dev.dv_xname, buf); + printf("%s: SYSINT1 = 0x%s\n", device_xname(self), buf); reg = bus_space_read_2(sc->sc_iot, sc->sc_icuh, VRC4173ICU_MKIUINT); snprintb(buf, sizeof(buf), "\20\1SCANINT\2KDATRDY\3KDATLOST\4B3\5B4\6B5\7B6\10B7" "\11B8\12B9\13B10\14B11\15B12\16B13\17B14\20B15", reg); - printf("%s: MKIUINT = 0x%s\n", sc->sc_dev.dv_xname, buf); + printf("%s: MKIUINT = 0x%s\n", device_xname(self), buf); reg = bus_space_read_2(sc->sc_iot, sc->sc_icuh, VRC4173ICU_MSYSINT1); snprintb(buf, sizeof(buf), "\20\1USB\2PCMCIA2\3PCMCIA1\4PS2CH2\5PS2CH1\6PIU\7AIU\10KIU" "\11GIU\12AC97\13AC97-1\14B11\15B12\16DOZEPIU\17B14\20B15", reg); - printf("%s: MSYSINT1 = 0x%s\n", sc->sc_dev.dv_xname, buf); + printf("%s: MSYSINT1 = 0x%s\n", device_xname(self), buf); #if 1 reg = VRC4173ICU_USBINTR | VRC4173ICU_PIUINTR | VRC4173ICU_KIUINTR | @@ -365,7 +366,7 @@ vrc4173bcu_attach(struct device *parent, snprintb(buf, sizeof(buf), "\20\1USB\2PCMCIA2\3PCMCIA1\4PS2CH2\5PS2CH1\6PIU\7AIU\10KIU" "\11GIU\12AC97\13AC97-1\14B11\15B12\16DOZEPIU\17B14\20B15", reg); - printf("%s: MSYSINT1 = 0x%s\n", sc->sc_dev.dv_xname, buf); + printf("%s: MSYSINT1 = 0x%s\n", device_xname(self), buf); #endif #endif @@ -380,20 +381,20 @@ vrc4173bcu_attach(struct device *parent, * install interrupt handler */ if (pci_intr_map(pa, &ih)) { - printf("%s: couldn't map interrupt\n", sc->sc_dev.dv_xname); + printf("%s: couldn't map interrupt\n", device_xname(self)); return; } intrstr = pci_intr_string(pc, ih); sc->sc_ih = pci_intr_establish(pc, ih, IPL_NET, vrc4173bcu_intr, sc); if (sc->sc_ih == NULL) { printf("%s: couldn't establish interrupt", - sc->sc_dev.dv_xname); + device_xname(self)); if (intrstr != NULL) printf(" at %s", intrstr); printf("\n"); return; } - printf("%s: interrupting at %s\n", sc->sc_dev.dv_xname, intrstr); + printf("%s: interrupting at %s\n", device_xname(self), intrstr); /* * install pci intr hooks @@ -447,10 +448,9 @@ vrc4173bcu_print(void *aux, const char * } int -vrc4173bcu_search(struct device *parent, struct cfdata *cf, - const int *ldesc, void *aux) +vrc4173bcu_search(device_t parent, cfdata_t cf, const int *ldesc, void *aux) { - struct vrc4173bcu_softc *sc = (struct vrc4173bcu_softc *)parent; + struct vrc4173bcu_softc *sc = device_private(parent); struct vrip_attach_args va; memset(&va, 0, sizeof(va)); @@ -491,7 +491,7 @@ vrc4173bcu_intr(void *arg) snprintb(buf, sizeof(buf), "\20\1USB\2PCMCIA2\3PCMCIA1\4PS2CH2\5PS2CH1\6PIU\7AIU\10KIU" "\11GIU\12AC97\13AC97-1\14B11\15B12\16DOZEPIU\17B14\20B15", reg); - printf("%s: %s\n", sc->sc_dev.dv_xname, buf); + printf("%s: %s\n", device_xname(sc->sc_dev), buf); } #endif for (ih = sc->sc_intrhands, i = 0; i < VRC4173BCU_NINTRS; i++, ih++) Index: sys/arch/hpcmips/vr/vrdcu.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/hpcmips/vr/vrdcu.c,v retrieving revision 1.6 diff -u -p -r1.6 vrdcu.c --- sys/arch/hpcmips/vr/vrdcu.c 20 Feb 2011 07:58:14 -0000 1.6 +++ sys/arch/hpcmips/vr/vrdcu.c 27 Sep 2012 23:17:48 -0000 @@ -47,17 +47,16 @@ int vrdcu_debug = VRDCU_DEBUG; #endif struct vrdcu_softc { - struct device sc_dev; bus_space_tag_t sc_iot; bus_space_handle_t sc_ioh; struct vrdcu_chipset_tag sc_chipset; int sc_status; /* DMA status */ }; -int vrdcu_match(struct device *, struct cfdata *, void *); -void vrdcu_attach(struct device *, struct device *, void *); +int vrdcu_match(device_t, cfdata_t, void *); +void vrdcu_attach(device_t, device_t, void *); -CFATTACH_DECL(vrdcu, sizeof(struct vrdcu_softc), +CFATTACH_DECL_NEW(vrdcu, sizeof(struct vrdcu_softc), vrdcu_match, vrdcu_attach, NULL, NULL); int vrdcu_enable_aiuin(vrdcu_chipset_tag_t); @@ -88,16 +87,16 @@ struct bus_dma_tag vrdcu_bus_dma_tag = { }; int -vrdcu_match(struct device *parent, struct cfdata *cf, void *aux) +vrdcu_match(device_t parent, cfdata_t cf, void *aux) { return 2; /* 1st attach group of vrip */ } void -vrdcu_attach(struct device *parent, struct device *self, void *aux) +vrdcu_attach(device_t parent, device_t self, void *aux) { struct vrip_attach_args *va = aux; - struct vrdcu_softc *sc = (void*)self; + struct vrdcu_softc *sc = device_private(self); sc->sc_iot = va->va_iot; sc->sc_chipset.dc_sc = sc; @@ -109,7 +108,7 @@ vrdcu_attach(struct device *parent, stru if (bus_space_map(sc->sc_iot, va->va_addr, va->va_size, 0 /* no flags */, &sc->sc_ioh)) { - printf("%s: can't map i/o space\n", sc->sc_dev.dv_xname); + printf("%s: can't map i/o space\n", device_xname(self)); return; } printf("\n"); Index: sys/arch/hpcmips/vr/vrdmaau.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/hpcmips/vr/vrdmaau.c,v retrieving revision 1.5 diff -u -p -r1.5 vrdmaau.c --- sys/arch/hpcmips/vr/vrdmaau.c 11 Dec 2005 12:17:34 -0000 1.5 +++ sys/arch/hpcmips/vr/vrdmaau.c 27 Sep 2012 23:18:44 -0000 @@ -43,16 +43,16 @@ int vrdmaau_debug = VRDMAAU_DEBUG; #endif struct vrdmaau_softc { - struct device sc_dev; + device_t sc_dev; bus_space_tag_t sc_iot; bus_space_handle_t sc_ioh; struct vrdmaau_chipset_tag sc_chipset; }; -int vrdmaau_match(struct device *, struct cfdata *, void *); -void vrdmaau_attach(struct device *, struct device *, void *); +int vrdmaau_match(device_t, cfdata_t, void *); +void vrdmaau_attach(device_t, device_t, void *); -CFATTACH_DECL(vrdmaau, sizeof(struct vrdmaau_softc), +CFATTACH_DECL_NEW(vrdmaau, sizeof(struct vrdmaau_softc), vrdmaau_match, vrdmaau_attach, NULL, NULL); int vrdmaau_set_aiuin(vrdmaau_chipset_tag_t, void *); @@ -61,17 +61,18 @@ int vrdmaau_set_fir(vrdmaau_chipset_tag_ static int vrdmaau_phy_addr(struct vrdmaau_softc *, void *, u_int32_t *); int -vrdmaau_match(struct device *parent, struct cfdata *cf, void *aux) +vrdmaau_match(device_t parent, cfdata_t cf, void *aux) { return 2; /* 1st attach group of vrip */ } void -vrdmaau_attach(struct device *parent, struct device *self, void *aux) +vrdmaau_attach(device_t parent, device_t self, void *aux) { struct vrip_attach_args *va = aux; - struct vrdmaau_softc *sc = (void*)self; + struct vrdmaau_softc *sc = device_private(self); + sc->sc_dev = self; sc->sc_iot = va->va_iot; sc->sc_chipset.ac_sc = sc; sc->sc_chipset.ac_set_aiuin = vrdmaau_set_aiuin; @@ -158,7 +159,7 @@ vrdmaau_phy_addr(struct vrdmaau_softc *s if ((*phy & (VRDMAAU_ALIGNMENT - 1)) || *phy >= VRDMAAU_BOUNCE_THRESHOLD ) { printf("%s: vrdmaau_phy_addr: invalid address %p\n", - sc->sc_dev.dv_xname, addr); + device_xname(sc->sc_dev), addr); return EINVAL; } #endif Index: sys/arch/hpcmips/vr/vrdsiu_mouse.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/hpcmips/vr/vrdsiu_mouse.c,v retrieving revision 1.11 diff -u -p -r1.11 vrdsiu_mouse.c --- sys/arch/hpcmips/vr/vrdsiu_mouse.c 14 Mar 2009 15:36:07 -0000 1.11 +++ sys/arch/hpcmips/vr/vrdsiu_mouse.c 2 Oct 2012 01:29:06 -0000 @@ -61,7 +61,6 @@ enum vrdsiu_ps2_input_state { }; struct vrdsiu_softc { - struct device sc_dev; bus_space_tag_t sc_iot; bus_space_handle_t sc_ioh; int sc_unit; @@ -70,13 +69,13 @@ struct vrdsiu_softc { enum vrdsiu_mouse_stat sc_mouse_stat; - struct device *sc_wsmousedev; + device_t sc_wsmousedev; }; static int asimOld = 0; -static int vrdsiu_match(struct device *, struct cfdata *, void *); -static void vrdsiu_attach(struct device *, struct device *, void *); +static int vrdsiu_match(device_t, cfdata_t, void *); +static void vrdsiu_attach(device_t, device_t, void *); static void vrdsiu_write(struct vrdsiu_softc *, int, unsigned short); static unsigned short vrdsiu_read(struct vrdsiu_softc *, int); @@ -97,7 +96,7 @@ const struct wsmouse_accessops vrdsiu_ac vrdsiu_mouse_disable }; -CFATTACH_DECL(vrdsiu_mouse, sizeof(struct vrdsiu_softc), +CFATTACH_DECL_NEW(vrdsiu_mouse, sizeof(struct vrdsiu_softc), vrdsiu_match, vrdsiu_attach, NULL, NULL); static inline void @@ -113,15 +112,15 @@ vrdsiu_read(struct vrdsiu_softc *sc, int } static int -vrdsiu_match(struct device *parent, struct cfdata *cf, void *aux) +vrdsiu_match(device_t parent, cfdata_t cf, void *aux) { return 1; } static void -vrdsiu_attach(struct device *parent, struct device *self, void *aux) +vrdsiu_attach(device_t parent, device_t self, void *aux) { - struct vrdsiu_softc *sc = (struct vrdsiu_softc *)self; + struct vrdsiu_softc *sc = device_private(self); struct vrip_attach_args *va = aux; struct wsmousedev_attach_args wsmaa; int res; Index: sys/arch/hpcmips/vr/vrdsu.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/hpcmips/vr/vrdsu.c,v retrieving revision 1.10 diff -u -p -r1.10 vrdsu.c --- sys/arch/hpcmips/vr/vrdsu.c 18 Mar 2009 10:22:29 -0000 1.10 +++ sys/arch/hpcmips/vr/vrdsu.c 27 Sep 2012 23:19:32 -0000 @@ -41,18 +41,17 @@ __KERNEL_RCSID(0, "$NetBSD: vrdsu.c,v 1. #include struct vrdsu_softc { - struct device sc_dev; bus_space_tag_t sc_iot; bus_space_handle_t sc_ioh; }; -static int vrdsumatch(struct device *, struct cfdata *, void *); -static void vrdsuattach(struct device *, struct device *, void *); +static int vrdsumatch(device_t, cfdata_t, void *); +static void vrdsuattach(device_t, device_t, void *); static void vrdsu_write(struct vrdsu_softc *, int, unsigned short); static unsigned short vrdsu_read(struct vrdsu_softc *, int); -CFATTACH_DECL(vrdsu, sizeof(struct vrdsu_softc), +CFATTACH_DECL_NEW(vrdsu, sizeof(struct vrdsu_softc), vrdsumatch, vrdsuattach, NULL, NULL); struct vrdsu_softc *the_dsu_sc = NULL; @@ -72,16 +71,16 @@ vrdsu_read(struct vrdsu_softc *sc, int p } static int -vrdsumatch(struct device *parent, struct cfdata *cf, void *aux) +vrdsumatch(device_t parent, cfdata_t cf, void *aux) { return (1); } static void -vrdsuattach(struct device *parent, struct device *self, void *aux) +vrdsuattach(device_t parent, device_t self, void *aux) { - struct vrdsu_softc *sc = (struct vrdsu_softc *)self; + struct vrdsu_softc *sc = device_private(self); struct vrip_attach_args *va = aux; sc->sc_iot = va->va_iot; Index: sys/arch/hpcmips/vr/vrecu.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/hpcmips/vr/vrecu.c,v retrieving revision 1.9 diff -u -p -r1.9 vrecu.c --- sys/arch/hpcmips/vr/vrecu.c 14 Sep 2009 13:41:15 -0000 1.9 +++ sys/arch/hpcmips/vr/vrecu.c 29 Sep 2012 12:04:45 -0000 @@ -55,8 +55,8 @@ __KERNEL_RCSID(0, "$NetBSD: vrecu.c,v 1. #include #include -static int pcic_vrip_match(struct device *, struct cfdata *, void *); -static void pcic_vrip_attach(struct device *, struct device *, void *); +static int pcic_vrip_match(device_t, cfdata_t, void *); +static void pcic_vrip_attach(device_t, device_t, void *); static void *pcic_vrip_chip_intr_establish(pcmcia_chipset_handle_t, struct pcmcia_function *, int, int (*)(void *), void *); @@ -73,7 +73,7 @@ struct pcic_vrip_softc { } sc_intrhand[ECU_MAX_INTR]; }; -CFATTACH_DECL(pcic_vrip, sizeof(struct pcic_vrip_softc), +CFATTACH_DECL_NEW(pcic_vrip, sizeof(struct pcic_vrip_softc), pcic_vrip_match, pcic_vrip_attach, NULL, NULL); static struct pcmcia_chip_functions pcic_vrip_functions = { @@ -97,13 +97,13 @@ static struct pcmcia_chip_functions pcic static int -pcic_vrip_match(struct device *parent, struct cfdata *match, void *aux) +pcic_vrip_match(device_t parent, cfdata_t match, void *aux) { return 1; } static void -pcic_vrip_attach(struct device *parent, struct device *self, void *aux) +pcic_vrip_attach(device_t parent, device_t self, void *aux) { struct pcic_vrip_softc *vsc = device_private(self); struct pcic_softc *sc = &vsc->sc_pcic; @@ -112,6 +112,7 @@ pcic_vrip_attach(struct device *parent, bus_space_handle_t memh; int i; + sc->dev = self; vsc->sc_intr_valid = PCIC_INTR_IRQ_VALIDMASK; vsc->sc_intr_mask = 0xffff; for (i = 0; i < ECU_MAX_INTR; i++) Index: sys/arch/hpcmips/vr/vrgiu.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/hpcmips/vr/vrgiu.c,v retrieving revision 1.41 diff -u -p -r1.41 vrgiu.c --- sys/arch/hpcmips/vr/vrgiu.c 18 Mar 2009 10:22:29 -0000 1.41 +++ sys/arch/hpcmips/vr/vrgiu.c 1 Oct 2012 15:36:08 -0000 @@ -112,7 +112,7 @@ struct vrgiu_intr_entry { }; struct vrgiu_softc { - struct device sc_dev; + device_t sc_dev; bus_space_tag_t sc_iot; bus_space_handle_t sc_ioh; /* Interrupt */ @@ -135,11 +135,11 @@ struct vrgiu_softc { /* * prototypes */ -int vrgiu_match(struct device*, struct cfdata*, void*); -void vrgiu_attach(struct device*, struct device*, void*); -int vrgiu_intr(void*); -int vrgiu_print(void*, const char*); -void vrgiu_callback(struct device*); +int vrgiu_match(device_t, cfdata_t, void *); +void vrgiu_attach(device_t, device_t, void *); +int vrgiu_intr(void *); +int vrgiu_print(void *, const char *); +void vrgiu_callback(device_t); void vrgiu_dump_regs(struct vrgiu_softc *); void vrgiu_dump_io(struct vrgiu_softc *); @@ -153,13 +153,13 @@ void vrgiu_regwrite(struct vrgiu_softc * static int vrgiu_port_read(hpcio_chip_t, int); static void vrgiu_port_write(hpcio_chip_t, int, int); -static void *vrgiu_intr_establish(hpcio_chip_t, int, int, int (*)(void *), void*); -static void vrgiu_intr_disestablish(hpcio_chip_t, void*); -static void vrgiu_intr_clear(hpcio_chip_t, void*); +static void *vrgiu_intr_establish(hpcio_chip_t, int, int, int (*)(void *), void *); +static void vrgiu_intr_disestablish(hpcio_chip_t, void *); +static void vrgiu_intr_clear(hpcio_chip_t, void *); static void vrgiu_register_iochip(hpcio_chip_t, hpcio_chip_t); static void vrgiu_update(hpcio_chip_t); static void vrgiu_dump(hpcio_chip_t); -static hpcio_chip_t vrgiu_getchip(void*, int); +static hpcio_chip_t vrgiu_getchip(void *, int); /* * variables @@ -175,7 +175,7 @@ static struct hpcio_chip vrgiu_iochip = .hc_dump = vrgiu_dump, }; -CFATTACH_DECL(vrgiu, sizeof(struct vrgiu_softc), +CFATTACH_DECL_NEW(vrgiu, sizeof(struct vrgiu_softc), vrgiu_match, vrgiu_attach, NULL, NULL); struct vrgiu_softc *this_giu; @@ -184,20 +184,22 @@ struct vrgiu_softc *this_giu; * function bodies */ int -vrgiu_match(struct device *parent, struct cfdata *cf, void *aux) +vrgiu_match(device_t parent, cfdata_t cf, void *aux) { return (2); /* 1st attach group of vrip */ } void -vrgiu_attach(struct device *parent, struct device *self, void *aux) +vrgiu_attach(device_t parent, device_t self, void *aux) { struct vrip_attach_args *va = aux; - struct vrgiu_softc *sc = (void*)self; + struct vrgiu_softc *sc = device_private(self); struct hpcio_attach_args haa; int i; + sc->sc_dev = self; + #ifndef SINGLE_VRIP_BASE if (va->va_addr == VR4102_GIU_ADDR) { sc->sc_useupdn_reg = VR4102_GIUUSEUPDN_REG_W; @@ -208,7 +210,7 @@ vrgiu_attach(struct device *parent, stru sc->sc_termupdn_reg = VR4122_GIUTERMUPDN_REG_W; } else { panic("%s: unknown base address 0x%lx", - sc->sc_dev.dv_xname, va->va_addr); + device_xname(sc->sc_dev), va->va_addr); } #endif /* SINGLE_VRIP_BASE */ @@ -239,7 +241,7 @@ vrgiu_attach(struct device *parent, stru TAILQ_INIT(&sc->sc_intr_head[i]); if (!(sc->sc_ih = vrip_intr_establish(va->va_vc, va->va_unit, 0, IPL_BIO, vrgiu_intr, sc))) { - printf("%s: can't establish interrupt\n", sc->sc_dev.dv_xname); + printf("%s: can't establish interrupt\n", device_xname(sc->sc_dev)); return; } /* @@ -247,7 +249,7 @@ vrgiu_attach(struct device *parent, stru */ sc->sc_iochip = vrgiu_iochip; /* structure copy */ sc->sc_iochip.hc_chipid = VRIP_IOCHIP_VRGIU; - sc->sc_iochip.hc_name = sc->sc_dev.dv_xname; + sc->sc_iochip.hc_name = device_xname(sc->sc_dev); sc->sc_iochip.hc_sc = sc; /* Register functions to upper interface */ vrip_register_gpio(va->va_vc, &sc->sc_iochip); @@ -278,9 +280,9 @@ vrgiu_attach(struct device *parent, stru } void -vrgiu_callback(struct device *self) +vrgiu_callback(device_t self) { - struct vrgiu_softc *sc = (void*)self; + struct vrgiu_softc *sc = device_private(self); struct hpcio_attach_args haa; haa.haa_busname = "vrisab"; @@ -535,7 +537,7 @@ vrgiu_intr_establish( if (!(ih = malloc(sizeof(struct vrgiu_intr_entry), M_DEVBUF, M_NOWAIT))) panic ("vrgiu_intr_establish: no memory."); - DPRINTF(DEBUG_INTR, ("%s: port %d ", sc->sc_dev.dv_xname, port)); + DPRINTF(DEBUG_INTR, ("%s: port %d ", device_xname(sc->sc_dev), port)); ih->ih_port = port; ih->ih_fun = ih_fun; ih->ih_arg = ih_arg; Index: sys/arch/hpcmips/vr/vrip.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/hpcmips/vr/vrip.c,v retrieving revision 1.36 diff -u -p -r1.36 vrip.c --- sys/arch/hpcmips/vr/vrip.c 18 Mar 2011 15:31:38 -0000 1.36 +++ sys/arch/hpcmips/vr/vrip.c 2 Oct 2012 01:29:19 -0000 @@ -75,12 +75,11 @@ __KERNEL_RCSID(0, "$NetBSD: vrip.c,v 1.3 #define VALID_UNIT(sc, unit) (0 <= (unit) && (unit) < (sc)->sc_nunits) #ifdef SINGLE_VRIP_BASE -int vripmatch(struct device *, struct cfdata *, void *); -void vripattach(struct device *, struct device *, void *); +int vripmatch(device_t, cfdata_t, void *); +void vripattach(device_t, device_t, void *); #endif int vrip_print(void *, const char *); -int vrip_search(struct device *, struct cfdata *, - const int *, void *); +int vrip_search(device_t, cfdata_t, const int *, void *); int vrip_intr(void *, vaddr_t, u_int32_t); int __vrip_power(vrip_chipset_tag_t, int, int); @@ -114,7 +113,7 @@ static const struct vrip_chipset_tag vri }; #ifdef SINGLE_VRIP_BASE -CFATTACH_DECL(vrip, sizeof(struct vrip_softc), +CFATTACH_DECL_NEW(vrip, sizeof(struct vrip_softc), vripmatch, vripattach, NULL, NULL); static const struct vrip_unit vrip_units[] = { @@ -170,9 +169,9 @@ static const struct vrip_unit vrip_units }; void -vripattach(struct device *parent, struct device *self, void *aux) +vripattach(device_t parent, device_t self, void *aux) { - struct vrip_softc *sc = (struct vrip_softc*)self; + struct vrip_softc *sc = device_private(self); printf("\n"); @@ -187,7 +186,7 @@ vripattach(struct device *parent, struct #endif /* SINGLE_VRIP_BASE */ int -vripmatch(struct device *parent, struct cfdata *match, void *aux) +vripmatch(device_t parent, cfdata_t match, void *aux) { struct mainbus_attach_args *ma = aux; @@ -202,10 +201,10 @@ vripmatch(struct device *parent, struct } void -vripattach_common(struct device *parent, struct device *self, void *aux) +vripattach_common(device_t parent, device_t self, void *aux) { struct mainbus_attach_args *ma = aux; - struct vrip_softc *sc = (struct vrip_softc*)self; + struct vrip_softc *sc = device_private(self); sc->sc_chipset = vrip_chipset_methods; /* structure assignment */ sc->sc_chipset.vc_sc = sc; @@ -275,10 +274,9 @@ vrip_print(void *aux, const char *hoge) } int -vrip_search(struct device *parent, struct cfdata *cf, - const int *ldesc, void *aux) +vrip_search(device_t parent, cfdata_t cf, const int *ldesc, void *aux) { - struct vrip_softc *sc = (struct vrip_softc *)parent; + struct vrip_softc *sc = device_private(parent); struct vrip_attach_args va; platid_mask_t mask; Index: sys/arch/hpcmips/vr/vripvar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/hpcmips/vr/vripvar.h,v retrieving revision 1.12 diff -u -p -r1.12 vripvar.h --- sys/arch/hpcmips/vr/vripvar.h 16 Mar 2011 13:23:41 -0000 1.12 +++ sys/arch/hpcmips/vr/vripvar.h 27 Sep 2012 23:06:43 -0000 @@ -46,7 +46,6 @@ struct vrip_unit { }; struct vrip_softc { - struct device sc_dv; bus_space_tag_t sc_iot; bus_space_handle_t sc_ioh; hpcio_chip_t sc_gpio_chips[VRIP_NIOCHIPS]; @@ -68,7 +67,7 @@ struct vrip_softc { void vrip_intr_suspend(void); void vrip_intr_resume(void); -int vripmatch(struct device *, struct cfdata *, void *); -void vripattach_common(struct device *, struct device *, void *); +int vripmatch(device_t, cfdata_t, void *); +void vripattach_common(device_t, device_t, void *); void vrip_splpiu(void); #endif /* !_VRIPVAR_H_ */ Index: sys/arch/hpcmips/vr/vrkiu.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/hpcmips/vr/vrkiu.c,v retrieving revision 1.38 diff -u -p -r1.38 vrkiu.c --- sys/arch/hpcmips/vr/vrkiu.c 18 Mar 2009 10:22:29 -0000 1.38 +++ sys/arch/hpcmips/vr/vrkiu.c 27 Sep 2012 23:22:46 -0000 @@ -78,8 +78,8 @@ int vrkiu_debug = 0; #define DPRINTF(arg) #endif -static int vrkiumatch(struct device *, struct cfdata *, void *); -static void vrkiuattach(struct device *, struct device *, void *); +static int vrkiumatch(device_t, cfdata_t, void *); +static void vrkiuattach(device_t, device_t, void *); int vrkiu_intr(void *); @@ -93,7 +93,7 @@ static void eliminate_phantom_keys(struc static int vrkiu_poll(void*); static int vrkiu_input_establish(void*, struct hpckbd_if*); -CFATTACH_DECL(vrkiu, sizeof(struct vrkiu_softc), +CFATTACH_DECL_NEW(vrkiu, sizeof(struct vrkiu_softc), vrkiumatch, vrkiuattach, NULL, NULL); struct vrkiu_chip *vrkiu_consdata = NULL; @@ -126,16 +126,16 @@ vrkiu_is_console(bus_space_tag_t iot, bu } static int -vrkiumatch(struct device *parent, struct cfdata *cf, void *aux) +vrkiumatch(device_t parent, cfdata_t cf, void *aux) { return (1); } static void -vrkiuattach(struct device *parent, struct device *self, void *aux) +vrkiuattach(device_t parent, device_t self, void *aux) { - struct vrkiu_softc *sc = (struct vrkiu_softc *)self; + struct vrkiu_softc *sc = device_private(self); struct vrip_attach_args *va = aux; struct hpckbd_attach_args haa; int isconsole, res; Index: sys/arch/hpcmips/vr/vrkiuvar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/hpcmips/vr/vrkiuvar.h,v retrieving revision 1.4 diff -u -p -r1.4 vrkiuvar.h --- sys/arch/hpcmips/vr/vrkiuvar.h 16 Sep 2001 05:32:21 -0000 1.4 +++ sys/arch/hpcmips/vr/vrkiuvar.h 27 Sep 2012 23:22:44 -0000 @@ -48,7 +48,6 @@ struct vrkiu_chip { }; struct vrkiu_softc { - struct device sc_dev; struct vrkiu_chip *sc_chip; struct vrkiu_chip sc_chip_body; void *sc_handler; Index: sys/arch/hpcmips/vr/vrled.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/hpcmips/vr/vrled.c,v retrieving revision 1.8 diff -u -p -r1.8 vrled.c --- sys/arch/hpcmips/vr/vrled.c 11 Dec 2005 12:17:35 -0000 1.8 +++ sys/arch/hpcmips/vr/vrled.c 27 Sep 2012 23:23:23 -0000 @@ -53,8 +53,8 @@ int vrleddebug = VRLEDDEBUG_CONF; #define VPRINTF(arg) if (bootverbose) printf arg; #endif /* VRLEDDEBUG */ -static int vrledmatch(struct device *, struct cfdata *, void *); -static void vrledattach(struct device *, struct device *, void *); +static int vrledmatch(device_t, cfdata_t, void *); +static void vrledattach(device_t, device_t, void *); static void vrled_write(struct vrled_softc *, int, unsigned short); static unsigned short vrled_read(struct vrled_softc *, int); @@ -68,7 +68,7 @@ static int vrled_event(void *, int, long int vrled_intr(void *); -CFATTACH_DECL(vrled, sizeof(struct vrled_softc), +CFATTACH_DECL_NEW(vrled, sizeof(struct vrled_softc), vrledmatch, vrledattach, NULL, NULL); struct vrled_softc *this_led; @@ -88,16 +88,16 @@ vrled_read(struct vrled_softc *sc, int p } static int -vrledmatch(struct device *parent, struct cfdata *cf, void *aux) +vrledmatch(device_t parent, cfdata_t cf, void *aux) { return (1); } static void -vrledattach(struct device *parent, struct device *self, void *aux) +vrledattach(device_t parent, device_t self, void *aux) { - struct vrled_softc *sc = (struct vrled_softc *)self; + struct vrled_softc *sc = device_private(self); struct vrip_attach_args *va = aux; bus_space_tag_t iot = va->va_iot; Index: sys/arch/hpcmips/vr/vrledvar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/hpcmips/vr/vrledvar.h,v retrieving revision 1.2 diff -u -p -r1.2 vrledvar.h --- sys/arch/hpcmips/vr/vrledvar.h 16 Sep 2001 05:32:21 -0000 1.2 +++ sys/arch/hpcmips/vr/vrledvar.h 27 Sep 2012 23:23:19 -0000 @@ -33,7 +33,6 @@ typedef enum { } vrled_status; struct vrled_softc { - struct device sc_dev; bus_space_tag_t sc_iot; bus_space_handle_t sc_ioh; void *sc_handler; Index: sys/arch/hpcmips/vr/vrpciu.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/hpcmips/vr/vrpciu.c,v retrieving revision 1.19 diff -u -p -r1.19 vrpciu.c --- sys/arch/hpcmips/vr/vrpciu.c 24 Aug 2011 20:27:36 -0000 1.19 +++ sys/arch/hpcmips/vr/vrpciu.c 9 Oct 2012 01:27:35 -0000 @@ -57,7 +57,7 @@ __KERNEL_RCSID(0, "$NetBSD: vrpciu.c,v 1 #endif struct vrpciu_softc { - struct device sc_dev; + device_t sc_dev; vrip_chipset_tag_t sc_vc; bus_space_tag_t sc_iot; @@ -78,10 +78,10 @@ static void vrpciu_write_2(struct vrpciu static u_int16_t vrpciu_read_2(struct vrpciu_softc *, int); #endif -static int vrpciu_match(struct device *, struct cfdata *, void *); -static void vrpciu_attach(struct device *, struct device *, void *); +static int vrpciu_match(device_t, cfdata_t, void *); +static void vrpciu_attach(device_t, device_t, void *); static int vrpciu_intr(void *); -static void vrpciu_attach_hook(struct device *, struct device *, +static void vrpciu_attach_hook(device_t, device_t, struct pcibus_attach_args *); static int vrpciu_bus_maxdevs(pci_chipset_tag_t, int); static int vrpciu_bus_devorder(pci_chipset_tag_t, int, uint8_t *, int); @@ -90,7 +90,7 @@ static void vrpciu_decompose_tag(pci_chi int *); static pcireg_t vrpciu_conf_read(pci_chipset_tag_t, pcitag_t, int); static void vrpciu_conf_write(pci_chipset_tag_t, pcitag_t, int, pcireg_t); -static int vrpciu_intr_map(struct pci_attach_args *, pci_intr_handle_t *); +static int vrpciu_intr_map(const struct pci_attach_args *, pci_intr_handle_t *); static const char *vrpciu_intr_string(pci_chipset_tag_t, pci_intr_handle_t); static const struct evcnt *vrpciu_intr_evcnt(pci_chipset_tag_t, pci_intr_handle_t); @@ -98,7 +98,7 @@ static void *vrpciu_intr_establish(pci_c int, int (*)(void *), void *); static void vrpciu_intr_disestablish(pci_chipset_tag_t, void *); -CFATTACH_DECL(vrpciu, sizeof(struct vrpciu_softc), +CFATTACH_DECL_NEW(vrpciu, sizeof(struct vrpciu_softc), vrpciu_match, vrpciu_attach, NULL, NULL); static void @@ -132,16 +132,16 @@ vrpciu_read_2(struct vrpciu_softc *sc, i #endif static int -vrpciu_match(struct device *parent, struct cfdata *match, void *aux) +vrpciu_match(device_t parent, cfdata_t match, void *aux) { return (1); } static void -vrpciu_attach(struct device *parent, struct device *self, void *aux) +vrpciu_attach(device_t parent, device_t self, void *aux) { - struct vrpciu_softc *sc = (struct vrpciu_softc *)self; + struct vrpciu_softc *sc = device_private(self); pci_chipset_tag_t pc = &sc->sc_pc; struct vrip_attach_args *va = aux; #if defined(DEBUG) || NPCI > 0 @@ -153,6 +153,7 @@ vrpciu_attach(struct device *parent, str struct pcibus_attach_args pba; #endif + sc->sc_dev = self; sc->sc_vc = va->va_vc; sc->sc_iot = va->va_iot; if (bus_space_map(sc->sc_iot, va->va_addr, va->va_size, 0, @@ -175,27 +176,27 @@ vrpciu_attach(struct device *parent, str #ifdef DEBUG #define DUMP_MAW(sc, name, reg) do { \ - printf("%s: %s =\t0x%08x\n", (sc)->sc_dev.dv_xname, \ + printf("%s: %s =\t0x%08x\n", device_xname((sc)->sc_dev), \ (name), (reg)); \ printf("%s:\tIBA/MASK =\t0x%08x/0x%08x (0x%08x - 0x%08x)\n", \ - (sc)->sc_dev.dv_xname, \ + device_xname((sc)->sc_dev), \ reg & VRPCIU_MAW_IBAMASK, VRPCIU_MAW_ADDRMASK(reg), \ VRPCIU_MAW_ADDR(reg), \ VRPCIU_MAW_ADDR(reg) + VRPCIU_MAW_SIZE(reg)); \ - printf("%s:\tWINEN =\t0x%08x\n", (sc)->sc_dev.dv_xname, \ + printf("%s:\tWINEN =\t0x%08x\n", device_xname((sc)->sc_dev), \ reg & VRPCIU_MAW_WINEN); \ - printf("%s:\tPCIADR =\t0x%08x\n", (sc)->sc_dev.dv_xname, \ + printf("%s:\tPCIADR =\t0x%08x\n", device_xname((sc)->sc_dev), \ VRPCIU_MAW_PCIADDR(reg)); \ } while (0) -#define DUMP_TAW(sc, name, reg) do { \ - printf("%s: %s =\t\t0x%08x\n", (sc)->sc_dev.dv_xname, \ - (name), (reg)); \ - printf("%s:\tMASK =\t0x%08x\n", (sc)->sc_dev.dv_xname, \ - VRPCIU_TAW_ADDRMASK(reg)); \ - printf("%s:\tWINEN =\t0x%08x\n", (sc)->sc_dev.dv_xname, \ - reg & VRPCIU_TAW_WINEN); \ - printf("%s:\tIBA =\t0x%08x\n", (sc)->sc_dev.dv_xname, \ - VRPCIU_TAW_IBA(reg)); \ +#define DUMP_TAW(sc, name, reg) do { \ + printf("%s: %s =\t\t0x%08x\n", device_xname((sc)->sc_dev), \ + (name), (reg)); \ + printf("%s:\tMASK =\t0x%08x\n", device_xname((sc)->sc_dev), \ + VRPCIU_TAW_ADDRMASK(reg)); \ + printf("%s:\tWINEN =\t0x%08x\n", device_xname((sc)->sc_dev), \ + reg & VRPCIU_TAW_WINEN); \ + printf("%s:\tIBA =\t0x%08x\n", device_xname((sc)->sc_dev), \ + VRPCIU_TAW_IBA(reg)); \ } while (0) reg = vrpciu_read(sc, VRPCIU_MMAW1REG); DUMP_MAW(sc, "MMAW1", reg); @@ -207,50 +208,50 @@ vrpciu_attach(struct device *parent, str DUMP_TAW(sc, "TAW2", reg); reg = vrpciu_read(sc, VRPCIU_MIOAWREG); DUMP_MAW(sc, "MIOAW", reg); - printf("%s: BUSERRAD =\t0x%08x\n", sc->sc_dev.dv_xname, + printf("%s: BUSERRAD =\t0x%08x\n", device_xname(sc->sc_dev), vrpciu_read(sc, VRPCIU_BUSERRADREG)); - printf("%s: INTCNTSTA =\t0x%08x\n", sc->sc_dev.dv_xname, + printf("%s: INTCNTSTA =\t0x%08x\n", device_xname(sc->sc_dev), vrpciu_read(sc, VRPCIU_INTCNTSTAREG)); - printf("%s: EXACC =\t0x%08x\n", sc->sc_dev.dv_xname, + printf("%s: EXACC =\t0x%08x\n", device_xname(sc->sc_dev), vrpciu_read(sc, VRPCIU_EXACCREG)); - printf("%s: RECONT =\t0x%08x\n", sc->sc_dev.dv_xname, + printf("%s: RECONT =\t0x%08x\n", device_xname(sc->sc_dev), vrpciu_read(sc, VRPCIU_RECONTREG)); - printf("%s: PCIEN =\t0x%08x\n", sc->sc_dev.dv_xname, + printf("%s: PCIEN =\t0x%08x\n", device_xname(sc->sc_dev), vrpciu_read(sc, VRPCIU_ENREG)); - printf("%s: CLOCKSEL =\t0x%08x\n", sc->sc_dev.dv_xname, + printf("%s: CLOCKSEL =\t0x%08x\n", device_xname(sc->sc_dev), vrpciu_read(sc, VRPCIU_CLKSELREG)); - printf("%s: TRDYV =\t0x%08x\n", sc->sc_dev.dv_xname, + printf("%s: TRDYV =\t0x%08x\n", device_xname(sc->sc_dev), vrpciu_read(sc, VRPCIU_TRDYVREG)); - printf("%s: CLKRUN =\t0x%08x\n", sc->sc_dev.dv_xname, + printf("%s: CLKRUN =\t0x%08x\n", device_xname(sc->sc_dev), vrpciu_read_2(sc, VRPCIU_CLKRUNREG)); - printf("%s: IDREG =\t0x%08x\n", sc->sc_dev.dv_xname, + printf("%s: IDREG =\t0x%08x\n", device_xname(sc->sc_dev), vrpciu_read(sc, VRPCIU_CONF_BASE + PCI_ID_REG)); reg = vrpciu_read(sc, VRPCIU_CONF_BASE + PCI_COMMAND_STATUS_REG); - printf("%s: CSR =\t\t0x%08x\n", sc->sc_dev.dv_xname, reg); + printf("%s: CSR =\t\t0x%08x\n", device_xname(sc->sc_dev), reg); vrpciu_write(sc, VRPCIU_CONF_BASE + PCI_COMMAND_STATUS_REG, reg); - printf("%s: CSR =\t\t0x%08x\n", sc->sc_dev.dv_xname, + printf("%s: CSR =\t\t0x%08x\n", device_xname(sc->sc_dev), vrpciu_read(sc, VRPCIU_CONF_BASE + PCI_COMMAND_STATUS_REG)); - printf("%s: CLASS =\t0x%08x\n", sc->sc_dev.dv_xname, + printf("%s: CLASS =\t0x%08x\n", device_xname(sc->sc_dev), vrpciu_read(sc, VRPCIU_CONF_BASE + PCI_CLASS_REG)); - printf("%s: BHLC =\t\t0x%08x\n", sc->sc_dev.dv_xname, + printf("%s: BHLC =\t\t0x%08x\n", device_xname(sc->sc_dev), vrpciu_read(sc, VRPCIU_CONF_BASE + PCI_BHLC_REG)); - printf("%s: MAIL =\t\t0x%08x\n", sc->sc_dev.dv_xname, + printf("%s: MAIL =\t\t0x%08x\n", device_xname(sc->sc_dev), vrpciu_read(sc, VRPCIU_CONF_BASE + VRPCIU_CONF_MAILREG)); - printf("%s: MBA1 =\t\t0x%08x\n", sc->sc_dev.dv_xname, + printf("%s: MBA1 =\t\t0x%08x\n", device_xname(sc->sc_dev), vrpciu_read(sc, VRPCIU_CONF_BASE + VRPCIU_CONF_MBA1REG)); - printf("%s: MBA2 =\t\t0x%08x\n", sc->sc_dev.dv_xname, + printf("%s: MBA2 =\t\t0x%08x\n", device_xname(sc->sc_dev), vrpciu_read(sc, VRPCIU_CONF_BASE + VRPCIU_CONF_MBA2REG)); - printf("%s: INTR =\t\t0x%08x\n", sc->sc_dev.dv_xname, + printf("%s: INTR =\t\t0x%08x\n", device_xname(sc->sc_dev), vrpciu_read(sc, VRPCIU_CONF_BASE + PCI_INTERRUPT_REG)); #if 0 vrpciu_write(sc, VRPCIU_CONF_BASE + PCI_INTERRUPT_REG, vrpciu_read(sc, VRPCIU_CONF_BASE + PCI_INTERRUPT_REG) | 0x01); - printf("%s: INTR =\t\t0x%08x\n", sc->sc_dev.dv_xname, + printf("%s: INTR =\t\t0x%08x\n", device_xname(sc->sc_dev), vrpciu_read(sc, VRPCIU_CONF_BASE + PCI_INTERRUPT_REG)); #endif #endif - pc->pc_dev = &sc->sc_dev; + pc->pc_dev = sc->sc_dev; pc->pc_attach_hook = vrpciu_attach_hook; pc->pc_bus_maxdevs = vrpciu_bus_maxdevs; pc->pc_bus_devorder = vrpciu_bus_devorder; @@ -270,7 +271,7 @@ vrpciu_attach(struct device *parent, str for (i = 0; i < 8; i++) printf("%s: ID_REG(0, 0, %d) = 0x%08x\n", - sc->sc_dev.dv_xname, i, + device_xname(sc->sc_dev), i, pci_conf_read(pc, pci_make_tag(pc, 0, 0, i), PCI_ID_REG)); } @@ -284,7 +285,7 @@ vrpciu_attach(struct device *parent, str iot = hpcmips_alloc_bus_space_tag(); reg = vrpciu_read(sc, VRPCIU_MIOAWREG); snprintf(tmpbuf, sizeof(tmpbuf), "%s/iot", - sc->sc_dev.dv_xname); + device_xname(sc->sc_dev)); hpcmips_init_bus_space(iot, (struct bus_space_tag_hpcmips *)sc->sc_iot, tmpbuf, VRPCIU_MAW_ADDR(reg), VRPCIU_MAW_SIZE(reg)); pba.pba_iot = &iot->bst; @@ -338,12 +339,12 @@ vrpciu_intr(void *arg) isr = vrpciu_read(sc, VRPCIU_INTCNTSTAREG); baddr = vrpciu_read(sc, VRPCIU_BUSERRADREG); printf("%s: status=0x%08x bad addr=0x%08x\n", - sc->sc_dev.dv_xname, isr, baddr); + device_xname(sc->sc_dev), isr, baddr); return ((isr & 0x0f) ? 1 : 0); } void -vrpciu_attach_hook(struct device *parent, struct device *self, +vrpciu_attach_hook(device_t parent, device_t self, struct pcibus_attach_args *pba) { @@ -418,7 +419,7 @@ vrpciu_decompose_tag(pci_chipset_tag_t p pcireg_t vrpciu_conf_read(pci_chipset_tag_t pc, pcitag_t tag, int reg) { - struct vrpciu_softc *sc = (struct vrpciu_softc *)pc->pc_dev; + struct vrpciu_softc *sc = device_private(pc->pc_dev); u_int32_t val; int bus, device, function; @@ -434,7 +435,7 @@ vrpciu_conf_read(pci_chipset_tag_t pc, p val = vrpciu_read(sc, VRPCIU_CONFDREG); #if 0 printf("%s: conf_read: tag = 0x%08x, reg = 0x%x, val = 0x%08x\n", - sc->sc_dev.dv_xname, (u_int32_t)tag, reg, val); + device_xname(sc->sc_dev), (u_int32_t)tag, reg, val); #endif return (val); } @@ -443,12 +444,12 @@ void vrpciu_conf_write(pci_chipset_tag_t pc, pcitag_t tag, int reg, pcireg_t data) { - struct vrpciu_softc *sc = (struct vrpciu_softc *)pc->pc_dev; + struct vrpciu_softc *sc = device_private(pc->pc_dev); int bus, device, function; #if 0 printf("%s: conf_write: tag = 0x%08x, reg = 0x%x, val = 0x%08x\n", - sc->sc_dev.dv_xname, (u_int32_t)tag, reg, (u_int32_t)data); + device_xname(sc->sc_dev), (u_int32_t)tag, reg, (u_int32_t)data); #endif vrpciu_decompose_tag(pc, tag, &bus, &device, &function); if (bus == 0) { @@ -463,7 +464,7 @@ vrpciu_conf_write(pci_chipset_tag_t pc, } int -vrpciu_intr_map(struct pci_attach_args *pa, pci_intr_handle_t *ihp) +vrpciu_intr_map(const struct pci_attach_args *pa, pci_intr_handle_t *ihp) { pci_chipset_tag_t pc = pa->pa_pc; pcitag_t intrtag = pa->pa_intrtag; @@ -474,7 +475,7 @@ vrpciu_intr_map(struct pci_attach_args * #endif pci_decompose_tag(pc, intrtag, &bus, &dev, &func); - DPRINTF(("%s(%d, %d, %d): line = %d, pin = %d\n", pc->pc_dev->dv_xname, + DPRINTF(("%s(%d, %d, %d): line = %d, pin = %d\n", device_xname(pc->pc_dev), bus, dev, func, line, pin)); *ihp = CONFIG_HOOK_PCIINTR_ID(bus, dev, func); Index: sys/arch/hpcmips/vr/vrpiu.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/hpcmips/vr/vrpiu.c,v retrieving revision 1.41 diff -u -p -r1.41 vrpiu.c --- sys/arch/hpcmips/vr/vrpiu.c 17 Oct 2007 19:54:29 -0000 1.41 +++ sys/arch/hpcmips/vr/vrpiu.c 27 Sep 2012 23:26:37 -0000 @@ -98,9 +98,9 @@ int vrpiu_debug = 0; /* * function prototypes */ -static int vrpiumatch(struct device *, struct cfdata *, void *); -static void vrpiuattach(struct device *, struct device *, void *); -static void vrc4173piuattach(struct device *, struct device *, void *); +static int vrpiumatch(device_t, cfdata_t, void *); +static void vrpiuattach(device_t, device_t, void *); +static void vrc4173piuattach(device_t, device_t, void *); static void vrpiu_init(struct vrpiu_softc *, void *); static void vrpiu_write(struct vrpiu_softc *, int, unsigned short); @@ -133,9 +133,9 @@ int mra_Y_AX1_BX2_C(int *y, int ys, int /* * static or global variables */ -CFATTACH_DECL(vrpiu, sizeof(struct vrpiu_softc), +CFATTACH_DECL_NEW(vrpiu, sizeof(struct vrpiu_softc), vrpiumatch, vrpiuattach, NULL, NULL); -CFATTACH_DECL(vrc4173piu, sizeof(struct vrpiu_softc), +CFATTACH_DECL_NEW(vrc4173piu, sizeof(struct vrpiu_softc), vrpiumatch, vrc4173piuattach, NULL, NULL); const struct wsmouse_accessops vrpiu_accessops = { @@ -171,17 +171,18 @@ vrpiu_buf_read(struct vrpiu_softc *sc, i } static int -vrpiumatch(struct device *parent, struct cfdata *cf, void *aux) +vrpiumatch(device_t parent, cfdata_t cf, void *aux) { return (1); } static void -vrpiuattach(struct device *parent, struct device *self, void *aux) +vrpiuattach(device_t parent, device_t self, void *aux) { - struct vrpiu_softc *sc = (struct vrpiu_softc *)self; + struct vrpiu_softc *sc = device_private(self); + sc->sc_dev = self; sc->sc_ab_paddata_mask = PIUAB_PADDATA_MASK; sc->sc_pb_paddata_mask = PIUPB_PADDATA_MASK; sc->sc_pb_paddata_max = PIUPB_PADDATA_MAX; @@ -189,10 +190,11 @@ vrpiuattach(struct device *parent, struc } static void -vrc4173piuattach(struct device *parent, struct device *self, void *aux) +vrc4173piuattach(device_t parent, device_t self, void *aux) { - struct vrpiu_softc *sc = (struct vrpiu_softc *)self; + struct vrpiu_softc *sc = device_private(self); + sc->sc_dev = self; sc->sc_ab_paddata_mask = VRC4173PIUAB_PADDATA_MASK; sc->sc_pb_paddata_mask = VRC4173PIUPB_PADDATA_MASK; sc->sc_pb_paddata_max = VRC4173PIUPB_PADDATA_MAX; @@ -325,16 +327,16 @@ vrpiu_init(struct vrpiu_softc *sc, void /* * attach the wsmouse */ - sc->sc_wsmousedev = config_found(&sc->sc_dev, &wsmaa, wsmousedevprint); + sc->sc_wsmousedev = config_found(sc->sc_dev, &wsmaa, wsmousedevprint); /* * power management events */ - sc->sc_power_hook = powerhook_establish(sc->sc_dev.dv_xname, + sc->sc_power_hook = powerhook_establish(device_xname(sc->sc_dev), vrpiu_power, sc); if (sc->sc_power_hook == NULL) aprint_error("%s: WARNING: couldn't establish powerhook\n", - sc->sc_dev.dv_xname); + device_xname(sc->sc_dev)); /* * init A/D port polling. Index: sys/arch/hpcmips/vr/vrpiuvar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/hpcmips/vr/vrpiuvar.h,v retrieving revision 1.11 diff -u -p -r1.11 vrpiuvar.h --- sys/arch/hpcmips/vr/vrpiuvar.h 15 Dec 2002 09:24:26 -0000 1.11 +++ sys/arch/hpcmips/vr/vrpiuvar.h 2 Oct 2012 01:30:08 -0000 @@ -40,7 +40,7 @@ enum vrpiu_adstat { struct vrpiu_softc { - struct device sc_dev; + device_t sc_dev; bus_space_tag_t sc_iot; bus_space_handle_t sc_ioh; bus_space_handle_t sc_buf_ioh; @@ -52,7 +52,7 @@ struct vrpiu_softc { enum vrpiu_adstat sc_adstat; u_int16_t sc_interval; - struct device *sc_wsmousedev; + device_t sc_wsmousedev; struct tpcalib_softc sc_tpcalib; Index: sys/arch/hpcmips/vr/vrpmu.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/hpcmips/vr/vrpmu.c,v retrieving revision 1.18 diff -u -p -r1.18 vrpmu.c --- sys/arch/hpcmips/vr/vrpmu.c 11 Dec 2005 12:17:35 -0000 1.18 +++ sys/arch/hpcmips/vr/vrpmu.c 27 Sep 2012 23:26:59 -0000 @@ -66,8 +66,8 @@ int vrpmudebug = VRPMUDEBUG_CONF; #define DDUMP_REGS(flag, arg) #endif /* VRPMUDEBUG */ -static int vrpmumatch(struct device *, struct cfdata *, void *); -static void vrpmuattach(struct device *, struct device *, void *); +static int vrpmumatch(device_t, cfdata_t, void *); +static void vrpmuattach(device_t, device_t, void *); static void vrpmu_write(struct vrpmu_softc *, int, unsigned short); static unsigned short vrpmu_read(struct vrpmu_softc *, int); @@ -77,7 +77,7 @@ void vrpmu_dump_intr(void *); void vrpmu_dump_intr2(unsigned int, unsigned int); void vrpmu_dump_regs(void *); -CFATTACH_DECL(vrpmu, sizeof(struct vrpmu_softc), +CFATTACH_DECL_NEW(vrpmu, sizeof(struct vrpmu_softc), vrpmumatch, vrpmuattach, NULL, NULL); struct vrpmu_softc *this_pmu; @@ -97,16 +97,16 @@ vrpmu_read(struct vrpmu_softc *sc, int p } static int -vrpmumatch(struct device *parent, struct cfdata *cf, void *aux) +vrpmumatch(device_t parent, cfdata_t cf, void *aux) { return (1); } static void -vrpmuattach(struct device *parent, struct device *self, void *aux) +vrpmuattach(device_t parent, device_t self, void *aux) { - struct vrpmu_softc *sc = (struct vrpmu_softc *)self; + struct vrpmu_softc *sc = device_private(self); struct vrip_attach_args *va = aux; #if NVRBCU > 0 int cpuid; Index: sys/arch/hpcmips/vr/vrpmuvar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/hpcmips/vr/vrpmuvar.h,v retrieving revision 1.1.1.1 diff -u -p -r1.1.1.1 vrpmuvar.h --- sys/arch/hpcmips/vr/vrpmuvar.h 16 Sep 1999 12:23:33 -0000 1.1.1.1 +++ sys/arch/hpcmips/vr/vrpmuvar.h 27 Sep 2012 23:27:06 -0000 @@ -27,7 +27,6 @@ */ struct vrpmu_softc { - struct device sc_dev; bus_space_tag_t sc_iot; bus_space_handle_t sc_ioh; void *sc_handler; Index: sys/arch/hpcsh/dev/psh3pwr.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/hpcsh/dev/psh3pwr.c,v retrieving revision 1.4 diff -u -p -r1.4 psh3pwr.c --- sys/arch/hpcsh/dev/psh3pwr.c 19 Dec 2009 07:09:28 -0000 1.4 +++ sys/arch/hpcsh/dev/psh3pwr.c 29 Sep 2012 11:42:09 -0000 @@ -180,7 +180,7 @@ psh3pwr_intr_plug_out(void *self) scpdr = _reg_read_1(SH7709_SCPDR); _reg_write_1(SH7709_SCPDR, scpdr | PSH3PWR_PLUG_OUT); - DPRINTF(("%s: plug out\n", device_xname(&sc->sc_dev))); + DPRINTF(("%s: plug out\n", device_xname(sc->sc_dev))); return 1; } @@ -201,7 +201,7 @@ psh3pwr_intr_plug_in(void *self) scpdr = _reg_read_1(SH7709_SCPDR); _reg_write_1(SH7709_SCPDR, scpdr & ~PSH3PWR_PLUG_OUT); - DPRINTF(("%s: plug in\n", device_xname(&sc->sc_dev))); + DPRINTF(("%s: plug in\n", device_xname(sc->sc_dev))); return 1; } Index: sys/arch/hpcsh/dev/hd64465/hd64465.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/hpcsh/dev/hd64465/hd64465.c,v retrieving revision 1.16 diff -u -p -r1.16 hd64465.c --- sys/arch/hpcsh/dev/hd64465/hd64465.c 12 Feb 2012 16:34:08 -0000 1.16 +++ sys/arch/hpcsh/dev/hd64465/hd64465.c 9 Oct 2012 01:02:34 -0000 @@ -103,7 +103,7 @@ hd64465_attach(device_t parent, device_t #endif r = hd64465_reg_read_2(HD64465_SRR); - printf("%s: HITACHI HD64465 rev. %d.%d\n", self->dv_xname, + printf("%s: HITACHI HD64465 rev. %d.%d\n", device_xname(self), (r >> 8) & 0xff, r & 0xff); /* Mask all interrupt */ Index: sys/arch/hpcsh/dev/hd64465/hd64465pcmcia.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/hpcsh/dev/hd64465/hd64465pcmcia.c,v retrieving revision 1.28 diff -u -p -r1.28 hd64465pcmcia.c --- sys/arch/hpcsh/dev/hd64465/hd64465pcmcia.c 26 Jul 2011 22:52:48 -0000 1.28 +++ sys/arch/hpcsh/dev/hd64465/hd64465pcmcia.c 29 Sep 2012 10:27:55 -0000 @@ -90,7 +90,7 @@ struct hd64465pcmcia_window_cookie { struct hd64465pcmcia_channel { struct hd64465pcmcia_softc *ch_parent; - struct device *ch_pcmcia; + device_t ch_pcmcia; int ch_channel; /* memory space */ @@ -119,7 +119,6 @@ struct hd64465pcmcia_event { }; struct hd64465pcmcia_softc { - struct device sc_dev; enum hd64465_module_id sc_module_id; int sc_shutdown; @@ -173,13 +172,12 @@ STATIC struct pcmcia_chip_functions hd64 hd64465pcmcia_chip_socket_settype, }; -STATIC int hd64465pcmcia_match(struct device *, struct cfdata *, void *); -STATIC void hd64465pcmcia_attach(struct device *, struct device *, void *); +STATIC int hd64465pcmcia_match(device_t, cfdata_t, void *); +STATIC void hd64465pcmcia_attach(device_t, device_t, void *); STATIC int hd64465pcmcia_print(void *, const char *); -STATIC int hd64465pcmcia_submatch(struct device *, struct cfdata *, - const int *, void *); +STATIC int hd64465pcmcia_submatch(device_t, cfdata_t, const int *, void *); -CFATTACH_DECL(hd64465pcmcia, sizeof(struct hd64465pcmcia_softc), +CFATTACH_DECL_NEW(hd64465pcmcia, sizeof(struct hd64465pcmcia_softc), hd64465pcmcia_match, hd64465pcmcia_attach, NULL, NULL); STATIC void hd64465pcmcia_attach_channel(struct hd64465pcmcia_softc *, int); @@ -201,7 +199,7 @@ STATIC vaddr_t __sh_hd64465_map_2page(pa #define DELAY_MS(x) delay((x) * 1000) int -hd64465pcmcia_match(struct device *parent, struct cfdata *cf, void *aux) +hd64465pcmcia_match(device_t parent, cfdata_t cf, void *aux) { struct hd64465_attach_args *ha = aux; @@ -209,10 +207,10 @@ hd64465pcmcia_match(struct device *paren } void -hd64465pcmcia_attach(struct device *parent, struct device *self, void *aux) +hd64465pcmcia_attach(device_t parent, device_t self, void *aux) { struct hd64465_attach_args *ha = aux; - struct hd64465pcmcia_softc *sc = (struct hd64465pcmcia_softc *)self; + struct hd64465pcmcia_softc *sc = device_private(self); int error; sc->sc_module_id = ha->ha_module_id; @@ -223,7 +221,7 @@ hd64465pcmcia_attach(struct device *pare sc->sc_area6 = __sh_hd64465_map_2page(0x18000000); /* area 6 */ if (sc->sc_area5 == 0 || sc->sc_area6 == 0) { - printf("%s: can't map memory.\n", sc->sc_dev.dv_xname); + printf("%s: can't map memory.\n", device_xname(self)); if (sc->sc_area5) uvm_km_free(kernel_map, sc->sc_area5, 0x03000000, UVM_KMF_VAONLY); @@ -238,7 +236,7 @@ hd64465pcmcia_attach(struct device *pare SIMPLEQ_INIT (&sc->sc_event_head); error = kthread_create(PRI_NONE, 0, NULL, hd64465pcmcia_event_thread, - sc, &sc->sc_event_thread, "%s", sc->sc_dev.dv_xname); + sc, &sc->sc_event_thread, "%s", device_xname(self)); KASSERT(error == 0); hd64465pcmcia_attach_channel(sc, 0); @@ -291,8 +289,7 @@ hd64465pcmcia_print(void *arg, const cha } int -hd64465pcmcia_submatch(struct device *parent, struct cfdata *cf, - const int *ldesc, void *aux) +hd64465pcmcia_submatch(device_t parent, cfdata_tcf, const int *ldesc, void *aux) { struct pcmciabus_attach_args *paa = aux; struct hd64465pcmcia_channel *ch = @@ -317,7 +314,7 @@ hd64465pcmcia_submatch(struct device *pa void hd64465pcmcia_attach_channel(struct hd64465pcmcia_softc *sc, int channel) { - struct device *parent = (struct device *)sc; + device_t parent = sc->sc_dev; struct hd64465pcmcia_channel *ch = &sc->sc_ch[channel]; struct pcmciabus_attach_args paa; bus_addr_t baseaddr; Index: sys/arch/hpcsh/hpcsh/autoconf.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/hpcsh/hpcsh/autoconf.c,v retrieving revision 1.26 diff -u -p -r1.26 autoconf.c --- sys/arch/hpcsh/hpcsh/autoconf.c 29 Jul 2012 18:05:43 -0000 1.26 +++ sys/arch/hpcsh/hpcsh/autoconf.c 9 Oct 2012 01:16:43 -0000 @@ -100,7 +100,7 @@ cpu_rootconf(void) get_device(booted_device_name); printf("boot device: %s\n", - booted_device ? booted_device->dv_xname : ""); + booted_device ? device_xname(booted_device) : ""); #endif rootconf(); } Index: sys/arch/i386/pci/pcic_pci_machdep.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/i386/pci/pcic_pci_machdep.c,v retrieving revision 1.9 diff -u -p -r1.9 pcic_pci_machdep.c --- sys/arch/i386/pci/pcic_pci_machdep.c 28 Apr 2008 20:23:25 -0000 1.9 +++ sys/arch/i386/pci/pcic_pci_machdep.c 26 Sep 2012 20:46:32 -0000 @@ -57,7 +57,7 @@ pcic_pci_machdep_pcic_intr_establish(str if (isa_intr_alloc(NULL, PCIC_CSC_INTR_IRQ_VALIDMASK & pcic_isa_intr_alloc_mask, IST_EDGE, &(sc->irq))) return (NULL); - aprint_normal_dev(&sc->dev, "interrupting at irq %d\n", sc->irq); + aprint_normal_dev(sc->dev, "interrupting at irq %d\n", sc->irq); return (isa_intr_establish(NULL, sc->irq, IST_EDGE, IPL_TTY, fct, sc)); } Index: sys/arch/ia64/ia64/ssc.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/ia64/ia64/ssc.c,v retrieving revision 1.3 diff -u -p -r1.3 ssc.c --- sys/arch/ia64/ia64/ssc.c 20 Jul 2009 04:41:37 -0000 1.3 +++ sys/arch/ia64/ia64/ssc.c 2 Oct 2012 01:30:26 -0000 @@ -37,7 +37,7 @@ #define SSC_POLL_HZ 50 -void sscconsattach(struct device *, struct device *, void *); +void sscconsattach(device_t, device_t, void *); void ssccnprobe(struct consdev *); void ssccninit(struct consdev *); @@ -60,7 +60,7 @@ ssc(uint64_t in0, uint64_t in1, uint64_t void -sscconsattach(struct device *parent, struct device *self, void *aux) +sscconsattach(device_t parent, device_t self, void *aux) { /* not yet */ } Index: sys/arch/iyonix/iyonix/autoconf.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/iyonix/iyonix/autoconf.c,v retrieving revision 1.14 diff -u -p -r1.14 autoconf.c --- sys/arch/iyonix/iyonix/autoconf.c 29 Jul 2012 18:05:44 -0000 1.14 +++ sys/arch/iyonix/iyonix/autoconf.c 9 Oct 2012 01:27:44 -0000 @@ -62,7 +62,7 @@ void cpu_rootconf(void) { aprint_normal("boot device: %s\n", - booted_device != NULL ? booted_device->dv_xname : ""); + booted_device != NULL ? device_xname(booted_device) : ""); rootconf(); } @@ -97,15 +97,15 @@ cpu_configure(void) if (prop_dictionary_set(device_properties(dev), \ x, y) == false) { \ printf("WARNING: unable to set " x " " \ - "property for %s\n", dev->dv_xname); \ + "property for %s\n", device_xname(dev)); \ } \ prop_object_release(y); \ } while (/*CONSTCOND*/0) void -device_register(struct device *dev, void *aux) +device_register(device_t dev, void *aux) { - struct device *pdev; + device_t pdev; if ((pdev = device_parent(dev)) != NULL && device_is_a(pdev, "pci")) { Index: sys/arch/landisk/include/pci_machdep.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/landisk/include/pci_machdep.h,v retrieving revision 1.2 diff -u -p -r1.2 pci_machdep.h --- sys/arch/landisk/include/pci_machdep.h 6 Apr 2011 01:32:06 -0000 1.2 +++ sys/arch/landisk/include/pci_machdep.h 2 Oct 2012 01:31:08 -0000 @@ -55,7 +55,7 @@ struct pci_attach_args; /* * Functions provided to machine-independent PCI code. */ -void landisk_pci_attach_hook(struct device *, struct device *, +void landisk_pci_attach_hook(device_t, device_t, struct pcibus_attach_args *); int landisk_pci_intr_map(const struct pci_attach_args *, pci_intr_handle_t *); const char *landisk_pci_intr_string(pci_chipset_tag_t, pci_intr_handle_t); Index: sys/arch/landisk/landisk/autoconf.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/landisk/landisk/autoconf.c,v retrieving revision 1.6 diff -u -p -r1.6 autoconf.c --- sys/arch/landisk/landisk/autoconf.c 29 Jul 2012 18:05:44 -0000 1.6 +++ sys/arch/landisk/landisk/autoconf.c 9 Oct 2012 01:28:04 -0000 @@ -97,7 +97,7 @@ match_bootdisk(device_t dv, struct btinf /* * Lookup major number for disk block device. */ - bmajor = devsw_name2blk(dv->dv_xname, NULL, 0); + bmajor = devsw_name2blk(device_xname(dv), NULL, 0); if (bmajor == -1) return (0); /* XXX panic ??? */ @@ -117,7 +117,7 @@ match_bootdisk(device_t dv, struct btinf if (error != ENXIO && error != ENODEV) #endif printf("match_bootdisk: can't open dev %s (%d)\n", - dv->dv_xname, error); + device_xname(dv), error); vput(tmpvn); return (0); } @@ -128,7 +128,7 @@ match_bootdisk(device_t dv, struct btinf * or faked one up. */ printf("match_bootdisk: can't get label for dev %s (%d)\n", - dv->dv_xname, error); + device_xname(dv), error); goto closeout; } @@ -184,7 +184,7 @@ bootdisk_found: if (booted_device) { printf("WARNING: double match for boot " "device (%s, %s)\n", - booted_device->dv_xname, dv->dv_xname); + device_xname(booted_device), device_xname(dv)); continue; } booted_device = dv; @@ -204,6 +204,6 @@ cpu_rootconf(void) findroot(); printf("boot device: %s\n", - booted_device ? booted_device->dv_xname : ""); + booted_device ? device_xname(booted_device) : ""); rootconf(); } Index: sys/arch/landisk/landisk/shpcic_machdep.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/landisk/landisk/shpcic_machdep.c,v retrieving revision 1.4 diff -u -p -r1.4 shpcic_machdep.c --- sys/arch/landisk/landisk/shpcic_machdep.c 1 Jul 2011 19:12:53 -0000 1.4 +++ sys/arch/landisk/landisk/shpcic_machdep.c 29 Sep 2012 10:26:41 -0000 @@ -81,7 +81,7 @@ shpcic_get_bus_dma_tag(void) } void -landisk_pci_attach_hook(struct device *parent, struct device *self, +landisk_pci_attach_hook(device_t parent, device_t self, struct pcibus_attach_args *pba) { Index: sys/arch/luna68k/dev/lunaws.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/luna68k/dev/lunaws.c,v retrieving revision 1.24 diff -u -p -r1.24 lunaws.c --- sys/arch/luna68k/dev/lunaws.c 16 Jul 2012 11:31:13 -0000 1.24 +++ sys/arch/luna68k/dev/lunaws.c 2 Oct 2012 01:31:33 -0000 @@ -64,9 +64,9 @@ struct ws_softc { device_t sc_dev; struct sioreg *sc_ctl; uint8_t sc_wr[6]; - struct device *sc_wskbddev; + device_t sc_wskbddev; #if NWSMOUSE > 0 - struct device *sc_wsmousedev; + device_t sc_wsmousedev; int sc_msreport; int buttons, dx, dy; #endif Index: sys/arch/luna68k/dev/siotty.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/luna68k/dev/siotty.c,v retrieving revision 1.33 diff -u -p -r1.33 siotty.c --- sys/arch/luna68k/dev/siotty.c 26 Nov 2011 04:40:50 -0000 1.33 +++ sys/arch/luna68k/dev/siotty.c 29 Sep 2012 10:18:26 -0000 @@ -118,7 +118,7 @@ siotty_match(device_t parent, cfdata_t c } static void -siotty_attach(struct device *parent, struct device *self, void *aux) +siotty_attach(device_t parent, device_t self, void *aux) { struct sio_softc *scp = device_private(parent); struct siotty_softc *sc = device_private(self); Index: sys/arch/luna68k/luna68k/autoconf.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/luna68k/luna68k/autoconf.c,v retrieving revision 1.13 diff -u -p -r1.13 autoconf.c --- sys/arch/luna68k/luna68k/autoconf.c 29 Jul 2012 18:05:44 -0000 1.13 +++ sys/arch/luna68k/luna68k/autoconf.c 9 Oct 2012 01:16:43 -0000 @@ -85,7 +85,7 @@ cpu_rootconf(void) #endif printf("boot device: %s\n", - (booted_device) ? booted_device->dv_xname : ""); + (booted_device) ? device_xname(booted_device) : ""); rootconf(); } Index: sys/arch/mac68k/dev/adb.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/mac68k/dev/adb.c,v retrieving revision 1.54 diff -u -p -r1.54 adb.c --- sys/arch/mac68k/dev/adb.c 6 Jun 2011 16:52:18 -0000 1.54 +++ sys/arch/mac68k/dev/adb.c 9 Oct 2012 01:02:34 -0000 @@ -112,7 +112,7 @@ adb_config_interrupts(device_t self) int totaladbs; int adbindex, adbaddr; - printf("%s", self->dv_xname); + printf("%s", device_xname(self)); adb_polling = 1; #ifdef MRG_ADB Index: sys/arch/mac68k/dev/aed.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/mac68k/dev/aed.c,v retrieving revision 1.29 diff -u -p -r1.29 aed.c --- sys/arch/mac68k/dev/aed.c 1 Nov 2009 01:51:35 -0000 1.29 +++ sys/arch/mac68k/dev/aed.c 27 Sep 2012 21:22:56 -0000 @@ -52,8 +52,8 @@ __KERNEL_RCSID(0, "$NetBSD: aed.c,v 1.29 /* * Function declarations. */ -static int aedmatch(struct device *, struct cfdata *, void *); -static void aedattach(struct device *, struct device *, void *); +static int aedmatch(device_t, cfdata_t, void *); +static void aedattach(device_t, device_t, void *); static void aed_emulate_mouse(adb_event_t *); static void aed_kbdrpt(void *); static void aed_dokeyupdown(adb_event_t *); @@ -67,7 +67,7 @@ static struct aed_softc *aed_sc; static int aed_options = 0 | AED_MSEMUL; /* Driver definition */ -CFATTACH_DECL(aed, sizeof(struct aed_softc), +CFATTACH_DECL_NEW(aed, sizeof(struct aed_softc), aedmatch, aedattach, NULL, NULL); extern struct cfdriver aed_cd; @@ -85,7 +85,7 @@ const struct cdevsw aed_cdevsw = { }; static int -aedmatch(struct device *parent, struct cfdata *cf, void *aux) +aedmatch(device_t parent, cfdata_t cf, void *aux) { struct adb_attach_args *aa_args = (struct adb_attach_args *)aux; static int aed_matched; @@ -99,10 +99,10 @@ aedmatch(struct device *parent, struct c } static void -aedattach(struct device *parent, struct device *self, void *aux) +aedattach(device_t parent, device_t self, void *aux) { struct adb_attach_args *aa_args = (struct adb_attach_args *)aux; - struct aed_softc *sc = (struct aed_softc *)self; + struct aed_softc *sc = device_private(self); callout_init(&sc->sc_repeat_ch, 0); selinit(&sc->sc_selinfo); @@ -119,7 +119,7 @@ aedattach(struct device *parent, struct sc->sc_repeating = -1; /* not repeating */ /* Pull in the options flags. */ - sc->sc_options = (device_cfdata(&sc->sc_dev)->cf_flags | aed_options); + sc->sc_options = (device_cfdata(self)->cf_flags | aed_options); sc->sc_ioproc = NULL; Index: sys/arch/mac68k/dev/aedvar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/mac68k/dev/aedvar.h,v retrieving revision 1.8 diff -u -p -r1.8 aedvar.h --- sys/arch/mac68k/dev/aedvar.h 1 Nov 2009 01:51:35 -0000 1.8 +++ sys/arch/mac68k/dev/aedvar.h 27 Sep 2012 21:22:39 -0000 @@ -35,8 +35,6 @@ #endif /* AED_MAX_EVENTS */ struct aed_softc { - struct device sc_dev; - struct callout sc_repeat_ch; /* ADB info */ Index: sys/arch/mac68k/dev/akbd.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/mac68k/dev/akbd.c,v retrieving revision 1.22 diff -u -p -r1.22 akbd.c --- sys/arch/mac68k/dev/akbd.c 10 Dec 2010 00:17:08 -0000 1.22 +++ sys/arch/mac68k/dev/akbd.c 27 Sep 2012 21:19:46 -0000 @@ -69,8 +69,8 @@ __KERNEL_RCSID(0, "$NetBSD: akbd.c,v 1.2 /* * Function declarations. */ -static int akbdmatch(struct device *, struct cfdata *, void *); -static void akbdattach(struct device *, struct device *, void *); +static int akbdmatch(device_t, cfdata_t, void *); +static void akbdattach(device_t, device_t, void *); static void kbd_processevent(adb_event_t *, struct akbd_softc *); #ifdef notyet static u_char getleds(int); @@ -83,7 +83,7 @@ static void blinkleds(struct akbd_softc */ /* Driver definition. */ -CFATTACH_DECL(akbd, sizeof(struct akbd_softc), +CFATTACH_DECL_NEW(akbd, sizeof(struct akbd_softc), akbdmatch, akbdattach, NULL, NULL); extern struct cfdriver akbd_cd; @@ -116,7 +116,7 @@ struct wskbd_mapdata akbd_keymapdata = { static int akbd_is_console(void); static int -akbdmatch(struct device *parent, struct cfdata *cf, void *aux) +akbdmatch(device_t parent, cfdata_t cf, void *aux) { struct adb_attach_args *aa_args = (struct adb_attach_args *)aux; @@ -127,10 +127,10 @@ akbdmatch(struct device *parent, struct } static void -akbdattach(struct device *parent, struct device *self, void *aux) +akbdattach(device_t parent, device_t self, void *aux) { ADBSetInfoBlock adbinfo; - struct akbd_softc *sc = (struct akbd_softc *)self; + struct akbd_softc *sc = device_private(self); struct adb_attach_args *aa_args = (struct adb_attach_args *)aux; int error, kbd_done; short cmd; Index: sys/arch/mac68k/dev/akbdvar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/mac68k/dev/akbdvar.h,v retrieving revision 1.9 diff -u -p -r1.9 akbdvar.h --- sys/arch/mac68k/dev/akbdvar.h 10 Mar 2007 16:35:14 -0000 1.9 +++ sys/arch/mac68k/dev/akbdvar.h 2 Oct 2012 01:31:51 -0000 @@ -39,15 +39,13 @@ * State info, per keyboard instance. */ struct akbd_softc { - struct device sc_dev; - /* ADB info */ int origaddr; /* ADB device type (ADBADDR_KBD) */ int adbaddr; /* current ADB address */ int handler_id; /* type of keyboard */ u_int8_t sc_leds; /* current LED state */ - struct device *sc_wskbddev; + device_t sc_wskbddev; }; /* LED register bits, inverse of actual register value */ Index: sys/arch/mac68k/dev/ams.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/mac68k/dev/ams.c,v retrieving revision 1.20 diff -u -p -r1.20 ams.c --- sys/arch/mac68k/dev/ams.c 10 Dec 2010 00:17:08 -0000 1.20 +++ sys/arch/mac68k/dev/ams.c 27 Sep 2012 21:19:18 -0000 @@ -59,8 +59,8 @@ __KERNEL_RCSID(0, "$NetBSD: ams.c,v 1.20 /* * Function declarations. */ -static int amsmatch(struct device *, struct cfdata *, void *); -static void amsattach(struct device *, struct device *, void *); +static int amsmatch(device_t, cfdata_t, void *); +static void amsattach(device_t, device_t, void *); static void ems_init(struct ams_softc *); static void ms_processevent(adb_event_t *, struct ams_softc *); @@ -74,7 +74,7 @@ extern int kbd_polling; /* Are we pollin */ /* Driver definition. */ -CFATTACH_DECL(ams, sizeof(struct ams_softc), +CFATTACH_DECL_NEW(ams, sizeof(struct ams_softc), amsmatch, amsattach, NULL, NULL); extern struct cfdriver ams_cd; @@ -90,7 +90,7 @@ const struct wsmouse_accessops ams_acces }; static int -amsmatch(struct device *parent, struct cfdata *cf, void *aux) +amsmatch(device_t parent, cfdata_t cf, void *aux) { struct adb_attach_args * aa_args = (struct adb_attach_args *)aux; @@ -101,10 +101,10 @@ amsmatch(struct device *parent, struct c } static void -amsattach(struct device *parent, struct device *self, void *aux) +amsattach(device_t parent, device_t self, void *aux) { ADBSetInfoBlock adbinfo; - struct ams_softc *sc = (struct ams_softc *)self; + struct ams_softc *sc = device_private(self); struct adb_attach_args * aa_args = (struct adb_attach_args *)aux; int error; #if NWSMOUSE > 0 Index: sys/arch/mac68k/dev/amsvar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/mac68k/dev/amsvar.h,v retrieving revision 1.8 diff -u -p -r1.8 amsvar.h --- sys/arch/mac68k/dev/amsvar.h 4 Mar 2007 06:00:07 -0000 1.8 +++ sys/arch/mac68k/dev/amsvar.h 27 Sep 2012 21:19:22 -0000 @@ -37,8 +37,6 @@ * State info, per mouse instance. */ struct ams_softc { - struct device sc_dev; - /* ADB info */ int origaddr; /* ADB device type (ADBADDR_MS) */ int adbaddr; /* current ADB address */ @@ -51,7 +49,7 @@ struct ams_softc { char sc_devid[5]; /* device indentifier */ int sc_mb; /* current button state */ - struct device *sc_wsmousedev; + device_t sc_wsmousedev; }; /* EMP device classes */ Index: sys/arch/mac68k/dev/grf_subr.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/mac68k/dev/grf_subr.c,v retrieving revision 1.20 diff -u -p -r1.20 grf_subr.c --- sys/arch/mac68k/dev/grf_subr.c 28 Apr 2008 20:23:27 -0000 1.20 +++ sys/arch/mac68k/dev/grf_subr.c 26 Sep 2012 22:25:20 -0000 @@ -50,7 +50,7 @@ grf_establish(struct grfbus_softc *sc, n struct grfbus_attach_args ga; /* Print hardware characteristics. */ - printf("%s: %d x %d, ", sc->sc_dev.dv_xname, gm->width, gm->height); + printf("%s: %d x %d, ", device_xname(sc->sc_dev), gm->width, gm->height); if (gm->psize == 1) printf("monochrome\n"); else @@ -64,7 +64,7 @@ grf_establish(struct grfbus_softc *sc, n ga.ga_handle = sc->sc_handle; ga.ga_phys = sc->sc_basepa; ga.ga_mode = g_mode; - (void)config_found(&sc->sc_dev, &ga, grfbusprint); + (void)config_found(sc->sc_dev, &ga, grfbusprint); } int Index: sys/arch/mac68k/dev/grfvar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/mac68k/dev/grfvar.h,v retrieving revision 1.30 diff -u -p -r1.30 grfvar.h --- sys/arch/mac68k/dev/grfvar.h 8 Feb 2011 20:20:17 -0000 1.30 +++ sys/arch/mac68k/dev/grfvar.h 26 Sep 2012 22:24:35 -0000 @@ -44,7 +44,7 @@ * State info, per hardware instance. */ struct grfbus_softc { - struct device sc_dev; + device_t sc_dev; nubus_slot sc_slot; bus_addr_t sc_basepa; /* base of video space */ Index: sys/arch/mac68k/dev/if_mc.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/mac68k/dev/if_mc.c,v retrieving revision 1.38 diff -u -p -r1.38 if_mc.c --- sys/arch/mac68k/dev/if_mc.c 5 Apr 2010 07:19:30 -0000 1.38 +++ sys/arch/mac68k/dev/if_mc.c 29 Sep 2012 12:09:44 -0000 @@ -151,7 +151,7 @@ mcsetup(struct mc_softc *sc, u_int8_t *l memcpy(sc->sc_enaddr, lladdr, ETHER_ADDR_LEN); printf(": address %s\n", ether_sprintf(lladdr)); - memcpy(ifp->if_xname, sc->sc_dev.dv_xname, IFNAMSIZ); + memcpy(ifp->if_xname, device_xname(sc->sc_dev), IFNAMSIZ); ifp->if_softc = sc; ifp->if_ioctl = mcioctl; ifp->if_start = mcstart; @@ -411,7 +411,7 @@ maceput(struct mc_softc *sc, struct mbuf } if (totlen > PAGE_SIZE) - panic("%s: maceput: packet overflow", sc->sc_dev.dv_xname); + panic("%s: maceput: packet overflow", device_xname(sc->sc_dev)); #if 0 if (totlen < ETHERMIN + sizeof(struct ether_header)) { @@ -436,21 +436,21 @@ struct mc_softc *sc = arg; ir = NIC_GET(sc, MACE_IR) & ~NIC_GET(sc, MACE_IMR); if (ir & JAB) { #ifdef MCDEBUG - printf("%s: jabber error\n", sc->sc_dev.dv_xname); + printf("%s: jabber error\n", device_xname(sc->sc_dev)); #endif sc->sc_if.if_oerrors++; } if (ir & BABL) { #ifdef MCDEBUG - printf("%s: babble\n", sc->sc_dev.dv_xname); + printf("%s: babble\n", device_xname(sc->sc_dev)); #endif sc->sc_if.if_oerrors++; } if (ir & CERR) { #ifdef MCDEBUG - printf("%s: collision error\n", sc->sc_dev.dv_xname); + printf("%s: collision error\n", device_xname(sc->sc_dev)); #endif sc->sc_if.if_collisions++; } @@ -480,13 +480,13 @@ mc_tint(struct mc_softc *sc) return; if (xmtfs & UFLO) { - printf("%s: underflow\n", sc->sc_dev.dv_xname); + printf("%s: underflow\n", device_xname(sc->sc_dev)); mcreset(sc); return; } if (xmtfs & LCOL) { - printf("%s: late collision\n", sc->sc_dev.dv_xname); + printf("%s: late collision\n", device_xname(sc->sc_dev)); sc->sc_if.if_oerrors++; sc->sc_if.if_collisions++; } @@ -497,14 +497,14 @@ mc_tint(struct mc_softc *sc) else if (xmtfs & ONE) sc->sc_if.if_collisions++; else if (xmtfs & RTRY) { - printf("%s: excessive collisions\n", sc->sc_dev.dv_xname); + printf("%s: excessive collisions\n", device_xname(sc->sc_dev)); sc->sc_if.if_collisions += 16; sc->sc_if.if_oerrors++; } if (xmtfs & LCAR) { sc->sc_havecarrier = 0; - printf("%s: lost carrier\n", sc->sc_dev.dv_xname); + printf("%s: lost carrier\n", device_xname(sc->sc_dev)); sc->sc_if.if_oerrors++; } @@ -524,12 +524,12 @@ mc_rint(struct mc_softc *sc) #ifdef MCDEBUG if (rxf.rx_rcvsts & 0xf0) printf("%s: rcvcnt %02x rcvsts %02x rntpc 0x%02x rcvcc 0x%02x\n", - sc->sc_dev.dv_xname, rxf.rx_rcvcnt, rxf.rx_rcvsts, + device_xname(sc->sc_dev), rxf.rx_rcvcnt, rxf.rx_rcvsts, rxf.rx_rntpc, rxf.rx_rcvcc); #endif if (rxf.rx_rcvsts & OFLO) { - printf("%s: receive FIFO overflow\n", sc->sc_dev.dv_xname); + printf("%s: receive FIFO overflow\n", device_xname(sc->sc_dev)); sc->sc_if.if_ierrors++; return; } @@ -539,7 +539,7 @@ mc_rint(struct mc_softc *sc) if (rxf.rx_rcvsts & FRAM) { #ifdef MCDEBUG - printf("%s: framing error\n", sc->sc_dev.dv_xname); + printf("%s: framing error\n", device_xname(sc->sc_dev)); #endif sc->sc_if.if_ierrors++; return; @@ -547,7 +547,7 @@ mc_rint(struct mc_softc *sc) if (rxf.rx_rcvsts & FCS) { #ifdef MCDEBUG - printf("%s: frame control checksum error\n", sc->sc_dev.dv_xname); + printf("%s: frame control checksum error\n", device_xname(sc->sc_dev)); #endif sc->sc_if.if_ierrors++; return; @@ -567,7 +567,7 @@ mace_read(struct mc_softc *sc, void *pkt len > ETHERMTU + sizeof(struct ether_header)) { #ifdef MCDEBUG printf("%s: invalid packet size %d; dropping\n", - sc->sc_dev.dv_xname, len); + device_xname(sc->sc_dev), len); #endif ifp->if_ierrors++; return; Index: sys/arch/mac68k/dev/if_mcvar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/mac68k/dev/if_mcvar.h,v retrieving revision 1.15 diff -u -p -r1.15 if_mcvar.h --- sys/arch/mac68k/dev/if_mcvar.h 5 Mar 2007 21:22:45 -0000 1.15 +++ sys/arch/mac68k/dev/if_mcvar.h 26 Sep 2012 22:26:06 -0000 @@ -62,7 +62,7 @@ struct mc_rxframe { }; struct mc_softc { - struct device sc_dev; /* base device glue */ + device_t sc_dev; /* base device glue */ struct ethercom sc_ethercom; /* Ethernet common part */ #define sc_if sc_ethercom.ec_if Index: sys/arch/mac68k/dev/mac68k5380.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/mac68k/dev/mac68k5380.c,v retrieving revision 1.46 diff -u -p -r1.46 mac68k5380.c --- sys/arch/mac68k/dev/mac68k5380.c 17 Jul 2011 20:54:43 -0000 1.46 +++ sys/arch/mac68k/dev/mac68k5380.c 26 Sep 2012 21:34:18 -0000 @@ -139,7 +139,7 @@ static void do_ncr5380_drq_intr(void *); static void scsi_clr_ipend(void); static void scsi_mach_init(struct ncr_softc *); -static int machine_match(struct device *, struct cfdata *, void *, +static int machine_match(device_t, cfdata_t, void *, struct cfdriver *); static int pdma_ready(void); static int transfer_pdma(u_char *, u_char *, u_long *); @@ -181,7 +181,7 @@ scsi_mach_init(struct ncr_softc *sc) } static int -machine_match(struct device *parent, struct cfdata *cf, void *aux, +machine_match(device_t parent, cfdata_t cf, void *aux, struct cfdriver *cd) { if (!mac68k_machine.scsi80) Index: sys/arch/mac68k/dev/macfb.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/mac68k/dev/macfb.c,v retrieving revision 1.19 diff -u -p -r1.19 macfb.c --- sys/arch/mac68k/dev/macfb.c 17 Oct 2007 19:55:14 -0000 1.19 +++ sys/arch/mac68k/dev/macfb.c 27 Sep 2012 21:23:26 -0000 @@ -57,10 +57,10 @@ __KERNEL_RCSID(0, "$NetBSD: macfb.c,v 1. #include #include -int macfb_match(struct device *, struct cfdata *, void *); -void macfb_attach(struct device *, struct device *, void *); +int macfb_match(device_t, cfdata_t, void *); +void macfb_attach(device_t, device_t, void *); -CFATTACH_DECL(macfb, sizeof(struct macfb_softc), +CFATTACH_DECL_NEW(macfb, sizeof(struct macfb_softc), macfb_match, macfb_attach, NULL, NULL); const struct wsdisplay_emulops macfb_emulops = { @@ -182,13 +182,13 @@ macfb_init(struct macfb_devconfig *dc) } int -macfb_match(struct device *parent, struct cfdata *match, void *aux) +macfb_match(device_t parent, cfdata_t match, void *aux) { return (1); } void -macfb_attach(struct device *parent, struct device *self, void *aux) +macfb_attach(device_t parent, device_t self, void *aux) { struct grfbus_attach_args *ga = aux; struct grfmode *gm = ga->ga_grfmode; @@ -196,7 +196,7 @@ macfb_attach(struct device *parent, stru struct wsemuldisplaydev_attach_args waa; int isconsole; - sc = (struct macfb_softc *)self; + sc = device_private(self); printf("\n"); Index: sys/arch/mac68k/dev/macfbvar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/mac68k/dev/macfbvar.h,v retrieving revision 1.4 diff -u -p -r1.4 macfbvar.h --- sys/arch/mac68k/dev/macfbvar.h 11 Dec 2005 12:18:02 -0000 1.4 +++ sys/arch/mac68k/dev/macfbvar.h 27 Sep 2012 21:23:29 -0000 @@ -60,8 +60,6 @@ struct macfb_devconfig { }; struct macfb_softc { - struct device sc_dev; - int nscreens; struct macfb_devconfig *sc_dc; }; Index: sys/arch/mac68k/dev/ncr5380.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/mac68k/dev/ncr5380.c,v retrieving revision 1.64 diff -u -p -r1.64 ncr5380.c --- sys/arch/mac68k/dev/ncr5380.c 28 Feb 2010 15:52:16 -0000 1.64 +++ sys/arch/mac68k/dev/ncr5380.c 29 Sep 2012 10:59:02 -0000 @@ -167,8 +167,8 @@ extern inline void finish_req(SC_REQ *re /* * Auto config stuff.... */ -void ncr_attach(struct device *, struct device *, void *); -int ncr_match(struct device *, struct cfdata *, void *); +void ncr_attach(device_t, device_t, void *); +int ncr_match(device_t, cfdata_t, void *); /* * Tricks to make driver-name configurable @@ -178,26 +178,28 @@ int ncr_match(struct device *, struct cf #define CFSTRING(n) __STRING(n) #define CFDRNAME(n) n -CFATTACH_DECL(CFDRNAME(DRNAME), sizeof(struct ncr_softc), +CFATTACH_DECL_NEW(CFDRNAME(DRNAME), sizeof(struct ncr_softc), ncr_match, ncr_attach, NULL, NULL); extern struct cfdriver CFNAME(DRNAME); int -ncr_match(struct device *parent, struct cfdata *cf, void *aux) +ncr_match(device_t parent, cfdata_t cf, void *aux) { + return (machine_match(parent, cf, aux, &CFNAME(DRNAME))); } void -ncr_attach(struct device *pdp, struct device *dp, void *auxp) +ncr_attach(device_t parent, device_t self, void *aux) { struct ncr_softc *sc; int i; - sc = (struct ncr_softc *)dp; + sc = device_private(self); - sc->sc_adapter.adapt_dev = &sc->sc_dev; + sc->sc_dev = self; + sc->sc_adapter.adapt_dev = self; sc->sc_adapter.adapt_openings = 7; sc->sc_adapter.adapt_max_periph = 1; sc->sc_adapter.adapt_ioctl = NULL; @@ -245,7 +247,7 @@ ncr_attach(struct device *pdp, struct de /* * attach all scsi units on us */ - config_found(dp, &sc->sc_channel, scsiprint); + config_found(self, &sc->sc_channel, scsiprint); } /* @@ -261,7 +263,7 @@ ncr5380_scsi_request(struct scsipi_chann { struct scsipi_xfer *xs; struct scsipi_periph *periph; - struct ncr_softc *sc = (void *)chan->chan_adapter->adapt_dev; + struct ncr_softc *sc = device_private(chan->chan_adapter->adapt_dev); int sps, flags; SC_REQ *reqp, *link, *tmp; @@ -696,7 +698,7 @@ scsi_select(SC_REQ *reqp, int code) u_int8_t targ_bit; struct ncr_softc *sc; - sc = (void *)reqp->xs->xs_periph->periph_channel->chan_adapter->adapt_dev; + sc = device_private(reqp->xs->xs_periph->periph_channel->chan_adapter->adapt_dev); DBG_SELPRINT ("Starting arbitration\n", 0); PID("scsi_select1"); @@ -1898,7 +1900,7 @@ ncr_aprint(struct ncr_softc *sc, const c va_list ap; va_start(ap, fmt); - printf("%s: ", sc->sc_dev.dv_xname); + printf("%s: ", device_xname(sc->sc_dev)); vprintf(fmt, ap); va_end(ap); } Index: sys/arch/mac68k/dev/ncr5380reg.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/mac68k/dev/ncr5380reg.h,v retrieving revision 1.19 diff -u -p -r1.19 ncr5380reg.h --- sys/arch/mac68k/dev/ncr5380reg.h 20 Oct 2009 19:10:12 -0000 1.19 +++ sys/arch/mac68k/dev/ncr5380reg.h 29 Sep 2012 12:09:13 -0000 @@ -152,7 +152,7 @@ #define INTR_DMA 3 struct ncr_softc { - struct device sc_dev; + device_t sc_dev; struct scsipi_channel sc_channel; struct scsipi_adapter sc_adapter; Index: sys/arch/mac68k/mac68k/autoconf.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/mac68k/mac68k/autoconf.c,v retrieving revision 1.73 diff -u -p -r1.73 autoconf.c --- sys/arch/mac68k/mac68k/autoconf.c 29 Jul 2012 18:05:44 -0000 1.73 +++ sys/arch/mac68k/mac68k/autoconf.c 9 Oct 2012 01:16:43 -0000 @@ -100,7 +100,7 @@ cpu_rootconf(void) findbootdev(); printf("boot device: %s\n", - booted_device ? booted_device->dv_xname : ""); + booted_device ? device_xname(booted_device) : ""); rootconf(); } Index: sys/arch/mac68k/nubus/cpi_nubus.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/mac68k/nubus/cpi_nubus.c,v retrieving revision 1.6 diff -u -p -r1.6 cpi_nubus.c --- sys/arch/mac68k/nubus/cpi_nubus.c 31 Jan 2012 22:13:20 -0000 1.6 +++ sys/arch/mac68k/nubus/cpi_nubus.c 27 Sep 2012 21:26:09 -0000 @@ -105,7 +105,7 @@ int cpi_nubus_match(device_t, cfdata_t, void cpi_nubus_attach(device_t, device_t, void *); void cpi_nubus_intr(void *); -CFATTACH_DECL(cpi, sizeof(struct cpi_softc), +CFATTACH_DECL_NEW(cpi, sizeof(struct cpi_softc), cpi_nubus_match, cpi_nubus_attach, NULL, NULL); dev_type_open(cpi_open); @@ -352,8 +352,8 @@ cpi_open(dev_t device, int flag, int mod } if (sc->sc_lpstate != LP_INITIAL) { if (TRACE_OPEN) - printf("%s not in initial state (%x).\n", - sc->sc_dev.dv_xname, sc->sc_lpstate); + printf("Not in initial state (%x).\n", + sc->sc_lpstate); return EBUSY; } sc->sc_lpstate = LP_OPENING; Index: sys/arch/mac68k/nubus/cpi_nubusvar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/mac68k/nubus/cpi_nubusvar.h,v retrieving revision 1.3 diff -u -p -r1.3 cpi_nubusvar.h --- sys/arch/mac68k/nubus/cpi_nubusvar.h 31 Jan 2012 22:13:20 -0000 1.3 +++ sys/arch/mac68k/nubus/cpi_nubusvar.h 27 Sep 2012 21:26:14 -0000 @@ -76,8 +76,6 @@ enum cpi_cf_flags { #define CPI_OPTIONS_MASK (CPI_CTC12_IS_TIMECOUNTER) struct cpi_softc { - struct device sc_dev; - nubus_slot sc_slot; /* Nubus slot number */ char sc_cardname[CPI_CARD_NAME_LEN]; Index: sys/arch/mac68k/nubus/grf_nubus.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/mac68k/nubus/grf_nubus.c,v retrieving revision 1.75 diff -u -p -r1.75 grf_nubus.c --- sys/arch/mac68k/nubus/grf_nubus.c 17 Oct 2007 19:55:15 -0000 1.75 +++ sys/arch/mac68k/nubus/grf_nubus.c 27 Sep 2012 21:27:10 -0000 @@ -74,10 +74,10 @@ static void grfmv_intr_mvc(void *); static void grfmv_intr_viltro_340(void *); static int grfmv_mode(struct grf_softc *, int, void *); -static int grfmv_match(struct device *, struct cfdata *, void *); -static void grfmv_attach(struct device *, struct device *, void *); +static int grfmv_match(device_t, cfdata_t, void *); +static void grfmv_attach(device_t, device_t, void *); -CFATTACH_DECL(macvid, sizeof(struct grfbus_softc), +CFATTACH_DECL_NEW(macvid, sizeof(struct grfbus_softc), grfmv_match, grfmv_attach, NULL, NULL); static void @@ -106,7 +106,7 @@ load_image_data(void * data, struct imag static int -grfmv_match(struct device *parent, struct cfdata *cf, void *aux) +grfmv_match(device_t parent, cfdata_t cf, void *aux) { struct nubus_attach_args *na = (struct nubus_attach_args *)aux; @@ -130,9 +130,9 @@ grfmv_match(struct device *parent, struc } static void -grfmv_attach(struct device *parent, struct device *self, void *aux) +grfmv_attach(device_t parent, device_t self, void *aux) { - struct grfbus_softc *sc = (struct grfbus_softc *)self; + struct grfbus_softc *sc = device_private(self); struct nubus_attach_args *na = (struct nubus_attach_args *)aux; struct image_data image_store, image; struct grfmode *gm; @@ -226,7 +226,7 @@ bad: sc->card_id = NUBUS_DRHW_SAM768; else if (strncmp(cardname, "Toby frame", 10) != 0) printf("%s: This display card pretends to be a TFB!\n", - sc->sc_dev.dv_xname); + device_xname(self)); } switch (sc->card_id) { @@ -349,7 +349,7 @@ bad: break; default: printf("%s: Unknown video card ID 0x%x --", - sc->sc_dev.dv_xname, sc->card_id); + device_xname(self), sc->card_id); printf(" Not installing interrupt routine.\n"); break; } Index: sys/arch/mac68k/nubus/if_netdock_nubus.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/mac68k/nubus/if_netdock_nubus.c,v retrieving revision 1.21 diff -u -p -r1.21 if_netdock_nubus.c --- sys/arch/mac68k/nubus/if_netdock_nubus.c 5 Apr 2010 07:19:30 -0000 1.21 +++ sys/arch/mac68k/nubus/if_netdock_nubus.c 9 Oct 2012 01:28:17 -0000 @@ -128,8 +128,8 @@ typedef struct netdock_softc { /***********************/ -static int netdock_nubus_match(struct device *, struct cfdata *, void *); -static void netdock_nubus_attach(struct device *, struct device *, void *); +static int netdock_nubus_match(device_t, cfdata_t, void *); +static void netdock_nubus_attach(device_t, device_t, void *); static int netdock_nb_get_enaddr(bus_space_tag_t, bus_space_handle_t, struct nubus_attach_args *, u_int8_t *); #ifdef NETDOCK_DEBUG_DRIVER @@ -184,13 +184,13 @@ static struct mbuf *netdock_get(struct n /***********************/ -CFATTACH_DECL(netdock_nubus, sizeof(struct netdock_softc), +CFATTACH_DECL_NEW(netdock_nubus, sizeof(struct netdock_softc), netdock_nubus_match, netdock_nubus_attach, NULL, NULL); /***********************/ static int -netdock_nubus_match(struct device *parent, struct cfdata *cf, void *aux) +netdock_nubus_match(device_t parent, cfdata_t cf, void *aux) { struct nubus_attach_args *na = (struct nubus_attach_args *)aux; bus_space_handle_t bsh; @@ -222,9 +222,9 @@ netdock_nubus_match(struct device *paren } static void -netdock_nubus_attach(struct device *parent, struct device *self, void *aux) +netdock_nubus_attach(device_t parent, device_t self, void *aux) { - struct netdock_softc *sc = (struct netdock_softc *)self; + struct netdock_softc *sc = device_private(self); struct nubus_attach_args *na = (struct nubus_attach_args *)aux; bus_space_tag_t bst; bus_space_handle_t bsh; @@ -238,6 +238,7 @@ netdock_nubus_attach(struct device *pare } sc->sc_regt = bst; + sc->sc_dev = self; cardtype = nubus_get_card_name(bst, bsh, na->fmt); #ifdef NETDOCK_DEBUG_DRIVER @@ -354,7 +355,7 @@ netdock_setup(struct netdock_softc *sc, memcpy(sc->sc_enaddr, lladdr, ETHER_ADDR_LEN); printf("%s: Ethernet address %s\n", - sc->sc_dev->dv_xname, ether_sprintf(lladdr)); + device_xname(sc->sc_dev), ether_sprintf(lladdr)); memcpy(ifp->if_xname, device_xname(sc->sc_dev), IFNAMSIZ); ifp->if_softc = sc; Index: sys/arch/mac68k/nubus/if_sm_nubus.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/mac68k/nubus/if_sm_nubus.c,v retrieving revision 1.9 diff -u -p -r1.9 if_sm_nubus.c --- sys/arch/mac68k/nubus/if_sm_nubus.c 12 Feb 2012 16:34:09 -0000 1.9 +++ sys/arch/mac68k/nubus/if_sm_nubus.c 26 Sep 2012 22:08:50 -0000 @@ -58,7 +58,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_sm_nubus. static int sm_nubus_match(device_t, cfdata_t, void *); static void sm_nubus_attach(device_t, device_t, void *); -CFATTACH_DECL(sm_nubus, sizeof(struct smc91cxx_softc), +CFATTACH_DECL_NEW(sm_nubus, sizeof(struct smc91cxx_softc), sm_nubus_match, sm_nubus_attach, NULL, NULL); static int @@ -114,6 +114,7 @@ sm_nubus_attach(device_t parent, device_ mac68k_bus_space_handle_swapped(bst, &bsh); + smc->sc_dev = self; smc->sc_bst = bst; smc->sc_bsh = bsh; Index: sys/arch/mac68k/nubus/nubus.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/mac68k/nubus/nubus.c,v retrieving revision 1.63 diff -u -p -r1.63 nubus.c --- sys/arch/mac68k/nubus/nubus.c 17 Dec 2008 20:51:32 -0000 1.63 +++ sys/arch/mac68k/nubus/nubus.c 9 Oct 2012 01:02:34 -0000 @@ -58,8 +58,8 @@ static int nubus_debug = 0 /* | NDB_PROB #endif static int nubus_print(void *, const char *); -static int nubus_match(struct device *, struct cfdata *, void *); -static void nubus_attach(struct device *, struct device *, void *); +static int nubus_match(device_t, cfdata_t, void *); +static void nubus_attach(device_t, device_t, void *); static int nubus_video_resource(int); static int nubus_probe_slot(bus_space_tag_t, bus_space_handle_t, int, @@ -77,11 +77,11 @@ static u_int16_t nubus_read_2(bus_space_ static u_int32_t nubus_read_4(bus_space_tag_t, bus_space_handle_t, u_int8_t, u_long); -CFATTACH_DECL(nubus, sizeof(struct nubus_softc), +CFATTACH_DECL_NEW(nubus, sizeof(struct nubus_softc), nubus_match, nubus_attach, NULL, NULL); static int -nubus_match(struct device *parent, struct cfdata *cf, void *aux) +nubus_match(device_t parent, cfdata_t cf, void *aux) { static int nubus_matched = 0; @@ -94,7 +94,7 @@ nubus_match(struct device *parent, struc } static void -nubus_attach(struct device *parent, struct device *self, void *aux) +nubus_attach(device_t parent, device_t self, void *aux) { struct nubus_attach_args na_args; struct mainbus_attach_args *mba; @@ -124,7 +124,7 @@ nubus_attach(struct device *parent, stru if (nubus_debug & NDB_PROBE) printf("%s: failed to map slot %x, " "address %p (in use?)\n", - self->dv_xname, i, + device_xname(self), i, (void *)NUBUS_SLOT2PA(i)); #endif continue; Index: sys/arch/mac68k/nubus/nubus.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/mac68k/nubus/nubus.h,v retrieving revision 1.65 diff -u -p -r1.65 nubus.h --- sys/arch/mac68k/nubus/nubus.h 4 Mar 2009 19:55:16 -0000 1.65 +++ sys/arch/mac68k/nubus/nubus.h 26 Sep 2012 22:11:38 -0000 @@ -369,7 +369,7 @@ struct nubus_attach_args { }; struct nubus_softc { - struct device sc_dev; + device_t sc_dev; }; Index: sys/arch/mac68k/obio/asc.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/mac68k/obio/asc.c,v retrieving revision 1.53 diff -u -p -r1.53 asc.c --- sys/arch/mac68k/obio/asc.c 15 Jun 2008 10:29:18 -0000 1.53 +++ sys/arch/mac68k/obio/asc.c 26 Sep 2012 22:20:02 -0000 @@ -105,10 +105,10 @@ static void asc_intr_enable(void); static void asc_intr(void *); #endif -static int ascmatch(struct device *, struct cfdata *, void *); -static void ascattach(struct device *, struct device *, void *); +static int ascmatch(device_t, cfdata_t, void *); +static void ascattach(device_t, device_t, void *); -CFATTACH_DECL(asc, sizeof(struct asc_softc), +CFATTACH_DECL_NEW(asc, sizeof(struct asc_softc), ascmatch, ascattach, NULL, NULL); extern struct cfdriver asc_cd; @@ -126,7 +126,7 @@ const struct cdevsw asc_cdevsw = { }; static int -ascmatch(struct device *parent, struct cfdata *cf, void *aux) +ascmatch(device_t parent, cfdata_t cf, void *aux) { struct obio_attach_args *oa = (struct obio_attach_args *)aux; bus_addr_t addr; @@ -156,13 +156,14 @@ ascmatch(struct device *parent, struct c } static void -ascattach(struct device *parent, struct device *self, void *aux) +ascattach(device_t parent, device_t self, void *aux) { - struct asc_softc *sc = (struct asc_softc *)self; + struct asc_softc *sc = device_private(self); struct obio_attach_args *oa = (struct obio_attach_args *)aux; bus_addr_t addr; int i; + sc->sc_dev = self; sc->sc_tag = oa->oa_tag; if (oa->oa_addr != (-1)) addr = (bus_addr_t)oa->oa_addr; Index: sys/arch/mac68k/obio/ascvar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/mac68k/obio/ascvar.h,v retrieving revision 1.7 diff -u -p -r1.7 ascvar.h --- sys/arch/mac68k/obio/ascvar.h 6 Sep 2002 13:20:53 -0000 1.7 +++ sys/arch/mac68k/obio/ascvar.h 26 Sep 2012 22:12:05 -0000 @@ -31,7 +31,7 @@ #define ASCUNIT(d) ((d) & 0x7) struct asc_softc { - struct device sc_dev; + device_t sc_dev; bus_space_tag_t sc_tag; bus_space_handle_t sc_handle; int sc_open; Index: sys/arch/mac68k/obio/grf_obio.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/mac68k/obio/grf_obio.c,v retrieving revision 1.57 diff -u -p -r1.57 grf_obio.c --- sys/arch/mac68k/obio/grf_obio.c 17 Oct 2007 19:55:16 -0000 1.57 +++ sys/arch/mac68k/obio/grf_obio.c 26 Sep 2012 22:24:58 -0000 @@ -83,10 +83,10 @@ __KERNEL_RCSID(0, "$NetBSD: grf_obio.c,v #include static int grfiv_mode(struct grf_softc *, int, void *); -static int grfiv_match(struct device *, struct cfdata *, void *); -static void grfiv_attach(struct device *, struct device *, void *); +static int grfiv_match(device_t, cfdata_t, void *); +static void grfiv_attach(device_t, device_t, void *); -CFATTACH_DECL(intvid, sizeof(struct grfbus_softc), +CFATTACH_DECL_NEW(intvid, sizeof(struct grfbus_softc), grfiv_match, grfiv_attach, NULL, NULL); #define DAFB_BASE 0xf9000000 @@ -97,7 +97,7 @@ CFATTACH_DECL(intvid, sizeof(struct grfb #define VALKYRIE_CONTROL_BASE 0x50f2a000 static int -grfiv_match(struct device *parent, struct cfdata *cf, void *aux) +grfiv_match(device_t parent, cfdata_t cf, void *aux) { struct obio_attach_args *oa = (struct obio_attach_args *)aux; bus_space_handle_t bsh; @@ -192,7 +192,7 @@ grfiv_match(struct device *parent, struc } static void -grfiv_attach(struct device *parent, struct device *self, void *aux) +grfiv_attach(device_t parent, device_t self, void *aux) { struct obio_attach_args *oa = (struct obio_attach_args *)aux; struct grfbus_softc *sc; @@ -200,7 +200,8 @@ grfiv_attach(struct device *parent, stru u_long base, length; u_int32_t vbase1, vbase2; - sc = (struct grfbus_softc *)self; + sc = device_private(self); + sc->sc_dev = self; sc->card_id = 0; @@ -324,7 +325,7 @@ grfiv_attach(struct device *parent, stru if (bus_space_map(sc->sc_tag, sc->sc_basepa, length, 0, &sc->sc_handle)) { - printf("%s: failed to map video RAM\n", sc->sc_dev.dv_xname); + printf("%s: failed to map video RAM\n", device_xname(sc->sc_dev)); return; } Index: sys/arch/mac68k/obio/if_mc_obio.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/mac68k/obio/if_mc_obio.c,v retrieving revision 1.17 diff -u -p -r1.17 if_mc_obio.c --- sys/arch/mac68k/obio/if_mc_obio.c 5 Mar 2007 21:23:49 -0000 1.17 +++ sys/arch/mac68k/obio/if_mc_obio.c 29 Sep 2012 12:08:24 -0000 @@ -61,8 +61,8 @@ __KERNEL_RCSID(0, "$NetBSD: if_mc_obio.c #define MACE_REG_BASE 0x50F1C000 #define MACE_PROM_BASE 0x50F08000 -hide int mc_obio_match(struct device *, struct cfdata *, void *); -hide void mc_obio_attach(struct device *, struct device *, void *); +hide int mc_obio_match(device_t, cfdata_t, void *); +hide void mc_obio_attach(device_t, device_t, void *); hide void mc_obio_init(struct mc_softc *); hide void mc_obio_put(struct mc_softc *, u_int); hide int mc_dmaintr(void *); @@ -71,11 +71,11 @@ hide void mc_reset_rxdma_set(struct mc_s hide void mc_reset_txdma(struct mc_softc *); hide int mc_obio_getaddr(struct mc_softc *, u_int8_t *); -CFATTACH_DECL(mc_obio, sizeof(struct mc_softc), +CFATTACH_DECL_NEW(mc_obio, sizeof(struct mc_softc), mc_obio_match, mc_obio_attach, NULL, NULL); hide int -mc_obio_match(struct device *parent, struct cfdata *cf, void *aux) +mc_obio_match(device_t parent, cfdata_t cf, void *aux) { struct obio_attach_args *oa = aux; bus_space_handle_t bsh; @@ -106,13 +106,14 @@ mc_obio_match(struct device *parent, str } hide void -mc_obio_attach(struct device *parent, struct device *self, void *aux) +mc_obio_attach(device_t parent, device_t self, void *aux) { struct obio_attach_args *oa = (struct obio_attach_args *)aux; - struct mc_softc *sc = (void *)self; + struct mc_softc *sc = device_private(self); u_int8_t myaddr[ETHER_ADDR_LEN]; int rsegs; + sc->sc_dev = self; sc->sc_regt = oa->oa_tag; sc->sc_biucc = XMTSP_64; sc->sc_fifocc = XMTFW_16 | RCVFW_64 | XMTFWU | RCVFWU | @@ -280,7 +281,7 @@ mc_dmaintr(void *arg) mc_reset_rxdma(sc); #ifdef MCDEBUG printf("%s: resetting receive DMA channel (status 0x%04x)\n", - sc->sc_dev.dv_xname, status); + device_xname(sc->sc_dev), status); #endif } else if (status & 0x100) { /* We've received some packets from the MACE */ @@ -297,7 +298,7 @@ mc_dmaintr(void *arg) if (head == sc->sc_tail) { #ifdef MCDEBUG printf("%s: head == tail: suspending DMA?\n", - sc->sc_dev.dv_xname); + device_xname(sc->sc_dev)); #endif psc_reg2(PSC_ENETRD_CMD + sc->sc_rxset) = 0x9000; } @@ -343,7 +344,7 @@ mc_dmaintr(void *arg) mc_reset_txdma(sc); #ifdef MCDEBUG printf("%s: resetting transmit DMA channel (status 0x%04x)\n", - sc->sc_dev.dv_xname, status); + device_xname(sc->sc_dev), status); #endif } else if (status & 0x100) { /* Clear the interrupt and switch register sets */ @@ -411,7 +412,7 @@ mc_obio_getaddr(struct mc_softc *sc, u_i if (bus_space_map(sc->sc_regt, MACE_PROM_BASE, 8*16, 0, &bsh)) { printf(": failed to map space to read MACE address.\n%s", - sc->sc_dev.dv_xname); + device_xname(sc->sc_dev)); return (-1); } @@ -423,7 +424,7 @@ mc_obio_getaddr(struct mc_softc *sc, u_i csum = mc_get_enaddr(sc->sc_regt, bsh, 1, lladdr); if (csum != 0xff) printf(": ethernet PROM checksum failed (0x%x != 0xff)\n%s", - (int)csum, sc->sc_dev.dv_xname); + (int)csum, device_xname(sc->sc_dev)); bus_space_unmap(sc->sc_regt, bsh, 8*16); Index: sys/arch/mac68k/obio/iwm_fd.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/mac68k/obio/iwm_fd.c,v retrieving revision 1.46 diff -u -p -r1.46 iwm_fd.c --- sys/arch/mac68k/obio/iwm_fd.c 13 Jan 2009 13:35:52 -0000 1.46 +++ sys/arch/mac68k/obio/iwm_fd.c 2 Oct 2012 01:43:54 -0000 @@ -34,11 +34,7 @@ #include __KERNEL_RCSID(0, "$NetBSD: iwm_fd.c,v 1.46 2009/01/13 13:35:52 yamt Exp $"); -#ifdef _MODULE -#define IWMCF_DRIVE 0 -#else #include "locators.h" -#endif #include #include @@ -75,11 +71,11 @@ __KERNEL_RCSID(0, "$NetBSD: iwm_fd.c,v 1 static int map_iwm_base(vm_offset_t); /* Autoconfig */ -int iwm_match(struct device *, struct cfdata *, void *); -void iwm_attach(struct device *, struct device *, void *); +int iwm_match(device_t, cfdata_t, void *); +void iwm_attach(device_t, device_t, void *); int iwm_print(void *, const char *); -int fd_match(struct device *, struct cfdata *, void *); -void fd_attach(struct device *, struct device *, void *); +int fd_match(device_t, cfdata_t, void *); +void fd_attach(device_t, device_t, void *); int fd_print(void *, const char *); /* Disklabel stuff */ @@ -97,12 +93,6 @@ static int checkTrack(diskPosition_t *, static int initCylinderCache(fd_softc_t *); static void invalidateCylinderCache(fd_softc_t *); -#ifdef _MODULE -static int probe_fd(void); -int fd_mod_init(void); -void fd_mod_free(void); -#endif - static int fdstart_Init(fd_softc_t *); static int fdstart_Seek(fd_softc_t *); static int fdstart_Read(fd_softc_t *); @@ -223,19 +213,16 @@ enum { * {device}_cd * references all found devices of a type. */ -#ifndef _MODULE extern struct cfdriver iwm_cd; extern struct cfdriver fd_cd; -#endif /* defined _MODULE */ - /* IWM floppy disk controller */ -CFATTACH_DECL(iwm, sizeof(iwm_softc_t), +CFATTACH_DECL_NEW(iwm, sizeof(iwm_softc_t), iwm_match, iwm_attach, NULL, NULL); /* Attached floppy disk drives */ -CFATTACH_DECL(fd, sizeof(fd_softc_t), +CFATTACH_DECL_NEW(fd, sizeof(fd_softc_t), fd_match, fd_attach, NULL, NULL); dev_type_open(fdopen); @@ -271,12 +258,9 @@ struct dkdriver fd_dkDriver = { * on machine type. */ int -iwm_match(struct device *parent, struct cfdata *match, void *auxp) +iwm_match(device_t parent, cfdata_t match, void *auxp) { int matched; -#ifdef _MODULE - int iwmErr; -#endif extern u_long IOBase; /* from mac68k/machdep.c */ extern u_long IWMBase; @@ -296,12 +280,6 @@ iwm_match(struct device *parent, struct printf("iwm: IWMBase mapped to 0x%lx in VM.\n", IWMBase); } -#ifdef _MODULE - iwmErr = iwmInit(); - if (TRACE_CONFIG) - printf("initIWM() says %d.\n", iwmErr); - matched = (iwmErr == 0) ? 1 : 0; -#endif } return matched; } @@ -314,14 +292,14 @@ iwm_match(struct device *parent, struct * and attach them. */ void -iwm_attach(struct device *parent, struct device *self, void *auxp) +iwm_attach(device_t parent, device_t self, void *auxp) { int iwmErr; iwm_softc_t *iwm; iwmAttachArgs_t ia; printf(": Apple GCR floppy disk controller\n"); - iwm = (iwm_softc_t *)self; + iwm = device_private(self); iwmErr = iwmInit(); if (TRACE_CONFIG) @@ -412,7 +390,7 @@ map_iwm_base(vm_offset_t base) * fd_match */ int -fd_match(struct device *parent, struct cfdata *match, void *auxp) +fd_match(device_t parent, cfdata_t match, void *auxp) { int matched, cfUnit; struct cfdata *cfp; @@ -437,7 +415,7 @@ fd_match(struct device *parent, struct c * so we can attach it. */ void -fd_attach(struct device *parent, struct device *self, void *auxp) +fd_attach(device_t parent, device_t self, void *auxp) { iwm_softc_t *iwm; fd_softc_t *fd; @@ -486,7 +464,7 @@ fd_attach(struct device *parent, struct } splx(spl); } - disk_init(&fd->diskInfo, fd->devInfo.dv_xname, &fd_dkDriver); + disk_init(&fd->diskInfo, device_xname(fd->sc_dev), &fd_dkDriver); disk_attach(&fd->diskInfo); } @@ -510,113 +488,6 @@ fd_print(void *auxp, const char *control return UNCONF; } - -#ifdef _MODULE - -static iwm_softc_t *iwm; - -/* - * fd_mod_init - * - * Any initializations necessary after loading the module happen here. - */ -int -fd_mod_init(void) -{ - int err; - - iwm = (iwm_softc_t *)malloc(sizeof(iwm_softc_t), M_DEVBUF, M_WAITOK); - - err = (1 == iwm_match(NULL, NULL, NULL)) ? 0 : EIO; - if (!err) { - memset(iwm, 0, sizeof(iwm_softc_t)); - iwm->maxRetries = 10; - err = (0 == probe_fd()) ? 0 : EIO; - } - return err; -} - - -/* - * fd_mod_free - * - * Necessary clean-up before unloading the module. - */ -void -fd_mod_free(void) -{ - int unit, spl; - - spl = splbio(); - /* Release any allocated memory */ - for (unit = 0; unit < IWM_MAX_DRIVE; unit++) - if (iwm->fd[unit] != NULL) { - /* - * Let's hope there is only one task per drive, - * see callout(9). - */ - callout_stop(&iwm->fd[unit]->motor_ch); - disk_detach(&iwm->fd[unit]->diskInfo); - disk_destroy(&iwm->fd[unit]->diskInfo); - free(iwm->fd[unit], M_DEVBUF); - iwm->fd[unit] = NULL; - } - free(iwm, M_DEVBUF); - splx(spl); -} - - -/* - * probe_fd - * - * See if there are any drives out there and configure them. - * If we find a drive we allocate a softc structure for it and - * insert its address into the iwm_softc. - * - * XXX Merge the remainder of probeFD() with the autoconfig framework. - */ -static int -probe_fd(void) -{ - fd_softc_t *fd; - iwmAttachArgs_t ia; - int err, unit; - - err = 0; - for (ia.unit = 0; ia.unit < IWM_MAX_DRIVE; ia.unit++) { - ia.driveType = getFDType(ia.unit); - if (NULL == ia.driveType) { - iwm->fd[ia.unit] = NULL; - continue; - } - fd = (fd_softc_t *)malloc(sizeof(fd_softc_t), - M_DEVBUF, M_WAITOK); - if (fd == NULL) { - err = ENOMEM; - break; - } else { - memset(fd, 0, sizeof(fd_softc_t)); - - /* This is usually set by the autoconfig framework */ - sprintf(fd->devInfo.dv_xname, "fd%d%c", ia.unit, 'a'); - fd_attach((struct device *)iwm, (struct device *)fd, - &ia); - } - } - if (err) { - /* Release any allocated memory */ - for (unit = 0; unit < IWM_MAX_DRIVE; unit++) - if (iwm->fd[unit] != NULL) { - free(iwm->fd[unit], M_DEVBUF); - iwm->fd[unit] = NULL; - } - } - return err; -} - -#endif /* defined _MODULE */ - - /** ** Implementation section of driver interface ** @@ -640,9 +511,7 @@ fdopen(dev_t dev, int flags, int devType int partitionMask; int fdType, fdUnit; int ierr, err; -#ifndef _MODULE iwm_softc_t *iwm = device_lookup_private(&iwm_cd, 0); /* XXX */ -#endif info = NULL; /* XXX shut up egcs */ fd = NULL; /* XXX shut up gcc3 */ @@ -774,9 +643,7 @@ fdclose(dev_t dev, int flags, int devTyp { fd_softc_t *fd; int partitionMask, fdUnit, fdType; -#ifndef _MODULE iwm_softc_t *iwm = device_lookup_private(&iwm_cd, 0); -#endif if (TRACE_CLOSE) printf("iwm: Closing driver."); @@ -818,9 +685,7 @@ fdioctl(dev_t dev, u_long cmd, void *dat { int result, fdUnit, fdType; fd_softc_t *fd; -#ifndef _MODULE iwm_softc_t *iwm = device_lookup_private(&iwm_cd, 0); -#endif if (TRACE_IOCTL) printf("iwm: Execute ioctl... "); @@ -981,9 +846,7 @@ fdstrategy(struct buf *bp) int sectSize, transferSize; diskPosition_t physDiskLoc; fd_softc_t *fd; -#ifndef _MODULE iwm_softc_t *iwm = device_lookup_private(&iwm_cd, 0); -#endif err = 0; done = 0; @@ -1274,9 +1137,7 @@ fdstart_Read(fd_softc_t *fd) int i; diskPosition_t *pos; sectorHdr_t *shdr; -#ifndef _MODULE iwm_softc_t *iwm = device_lookup_private(&iwm_cd, 0); /* XXX */ -#endif /* Initialize retry counters */ fd->seekRetries = 0; @@ -1390,9 +1251,8 @@ fdstart_Flush(fd_softc_t *fd) int i, dcnt; diskPosition_t *pos; sectorHdr_t *shdr; -#ifndef _MODULE iwm_softc_t *iwm = device_lookup_private(&iwm_cd, 0); /* XXX */ -#endif + dcnt = 0; pos = &fd->pos; shdr = &fd->sHdr; @@ -1520,9 +1380,7 @@ static int fdstart_IOErr(fd_softc_t *fd) { int state; -#ifndef _MODULE iwm_softc_t *iwm = device_lookup_private(&iwm_cd, 0); /* XXX */ -#endif #ifdef DIAGNOSTIC printf("iwm%sSector() err = %d, %d retries, on c%d_h%d_s%d.\n", @@ -1886,9 +1744,7 @@ seek(fd_softc_t *fd, int style) diskPosition_t *loc; sectorHdr_t hdr; char action[32]; -#ifndef _MODULE iwm_softc_t *iwm = device_lookup_private(&iwm_cd, 0); /* XXX */ -#endif const char *stateDesc[] = { "Init", Index: sys/arch/mac68k/obio/iwm_fdvar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/mac68k/obio/iwm_fdvar.h,v retrieving revision 1.14 diff -u -p -r1.14 iwm_fdvar.h --- sys/arch/mac68k/obio/iwm_fdvar.h 26 May 2008 17:58:37 -0000 1.14 +++ sys/arch/mac68k/obio/iwm_fdvar.h 26 Sep 2012 22:27:20 -0000 @@ -128,7 +128,7 @@ typedef struct iwmAttachArgs iwmAttachAr * */ struct fd_softc { - struct device devInfo; /* generic device info */ + device_t sc_dev; /* generic device info */ struct disk diskInfo; /* generic disk info */ struct bufq_state *bufQueue; /* queue of buf's */ int sc_active; /* number of active requests */ Index: sys/arch/macppc/dev/abtn.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/macppc/dev/abtn.c,v retrieving revision 1.18 diff -u -p -r1.18 abtn.c --- sys/arch/macppc/dev/abtn.c 18 Jun 2011 08:08:28 -0000 1.18 +++ sys/arch/macppc/dev/abtn.c 26 Sep 2012 22:30:24 -0000 @@ -51,7 +51,7 @@ __KERNEL_RCSID(0, "$NetBSD: abtn.c,v 1.1 #define BUTTON_DEPRESS 0x80 struct abtn_softc { - struct device sc_dev; + device_t sc_dev; int origaddr; /* ADB device type */ int adbaddr; /* current ADB address */ @@ -65,7 +65,7 @@ static int abtn_match(device_t, cfdata_t static void abtn_attach(device_t, device_t, void *); static void abtn_adbcomplete(uint8_t *, uint8_t *, int); -CFATTACH_DECL(abtn, sizeof(struct abtn_softc), +CFATTACH_DECL_NEW(abtn, sizeof(struct abtn_softc), abtn_match, abtn_attach, NULL, NULL); int @@ -88,6 +88,8 @@ abtn_attach(device_t parent, device_t se ADBSetInfoBlock adbinfo; int bright; + sc->sc_dev = self; + printf("buttons\n"); bright = pm_read_nvram(NVRAM_BRIGHTNESS); @@ -173,15 +175,15 @@ abtn_adbcomplete(uint8_t *buffer, uint8_ case BUTTON_SOFTER: case BUTTON_LOUDER: printf("%s: volume setting not implemented\n", - sc->sc_dev.dv_xname); + device_xname(sc->sc_dev)); break; case BUTTON_DISPLAY: printf("%s: display selection not implemented\n", - sc->sc_dev.dv_xname); + device_xname(sc->sc_dev)); break; case BUTTON_EJECT: printf("%s: eject not implemented\n", - sc->sc_dev.dv_xname); + device_xname(sc->sc_dev)); break; /* The keyboard gets wacky when in keypad mode. */ @@ -190,6 +192,6 @@ abtn_adbcomplete(uint8_t *buffer, uint8_ default: printf("%s: unknown button 0x%x\n", - sc->sc_dev.dv_xname, cmd); + device_xname(sc->sc_dev)); } } Index: sys/arch/macppc/dev/adb.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/macppc/dev/adb.c,v retrieving revision 1.33 diff -u -p -r1.33 adb.c --- sys/arch/macppc/dev/adb.c 1 Feb 2012 02:02:07 -0000 1.33 +++ sys/arch/macppc/dev/adb.c 26 Sep 2012 22:31:10 -0000 @@ -72,7 +72,7 @@ int adb_debug = 0; /* Output debugging /* * Driver definition. */ -CFATTACH_DECL(adb, sizeof(struct adb_softc), +CFATTACH_DECL_NEW(adb, sizeof(struct adb_softc), adbmatch, adbattach, NULL, NULL); static int Index: sys/arch/macppc/dev/adbvar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/macppc/dev/adbvar.h,v retrieving revision 1.14 diff -u -p -r1.14 adbvar.h --- sys/arch/macppc/dev/adbvar.h 1 Nov 2009 01:51:35 -0000 1.14 +++ sys/arch/macppc/dev/adbvar.h 26 Sep 2012 22:31:38 -0000 @@ -69,7 +69,6 @@ typedef struct { } ADBDataBlock; struct adb_softc { - struct device sc_dev; char *sc_regbase; }; Index: sys/arch/macppc/dev/aed.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/macppc/dev/aed.c,v retrieving revision 1.26 diff -u -p -r1.26 aed.c --- sys/arch/macppc/dev/aed.c 18 Jun 2011 08:08:28 -0000 1.26 +++ sys/arch/macppc/dev/aed.c 26 Sep 2012 22:32:44 -0000 @@ -71,7 +71,7 @@ static struct aed_softc *aed_sc = NULL; static int aed_options = 0; /* | AED_MSEMUL; */ /* Driver definition */ -CFATTACH_DECL(aed, sizeof(struct aed_softc), +CFATTACH_DECL_NEW(aed, sizeof(struct aed_softc), aedmatch, aedattach, NULL, NULL); extern struct cfdriver aed_cd; @@ -123,7 +123,7 @@ aedattach(device_t parent, device_t self sc->sc_repeating = -1; /* not repeating */ /* Pull in the options flags. */ - sc->sc_options = (device_cfdata(&sc->sc_dev)->cf_flags | aed_options); + sc->sc_options = (device_cfdata(self)->cf_flags | aed_options); sc->sc_ioproc = NULL; Index: sys/arch/macppc/dev/aedvar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/macppc/dev/aedvar.h,v retrieving revision 1.5 diff -u -p -r1.5 aedvar.h --- sys/arch/macppc/dev/aedvar.h 1 Nov 2009 01:51:35 -0000 1.5 +++ sys/arch/macppc/dev/aedvar.h 26 Sep 2012 22:32:39 -0000 @@ -35,8 +35,6 @@ #endif /* AED_MAX_EVENTS */ struct aed_softc { - struct device sc_dev; - struct callout sc_repeat_ch; /* ADB info */ Index: sys/arch/macppc/dev/akbd.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/macppc/dev/akbd.c,v retrieving revision 1.44 diff -u -p -r1.44 akbd.c --- sys/arch/macppc/dev/akbd.c 18 Jun 2011 08:08:28 -0000 1.44 +++ sys/arch/macppc/dev/akbd.c 26 Sep 2012 22:33:48 -0000 @@ -74,7 +74,7 @@ static void blinkleds(struct akbd_softc #endif /* Driver definition. */ -CFATTACH_DECL(akbd, sizeof(struct akbd_softc), +CFATTACH_DECL_NEW(akbd, sizeof(struct akbd_softc), akbdmatch, akbdattach, NULL, NULL); extern struct cfdriver akbd_cd; Index: sys/arch/macppc/dev/akbdvar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/macppc/dev/akbdvar.h,v retrieving revision 1.13 diff -u -p -r1.13 akbdvar.h --- sys/arch/macppc/dev/akbdvar.h 14 Mar 2009 14:46:01 -0000 1.13 +++ sys/arch/macppc/dev/akbdvar.h 26 Sep 2012 22:34:26 -0000 @@ -43,15 +43,13 @@ * State info, per keyboard instance. */ struct akbd_softc { - struct device sc_dev; - /* ADB info */ int origaddr; /* ADB device type (ADBADDR_KBD) */ int adbaddr; /* current ADB address */ int handler_id; /* type of keyboard */ u_int8_t sc_leds; /* current LED state */ - struct device *sc_wskbddev; + device_t sc_wskbddev; int sc_polling; int sc_npolledkeys; Index: sys/arch/macppc/dev/ams.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/macppc/dev/ams.c,v retrieving revision 1.28 diff -u -p -r1.28 ams.c --- sys/arch/macppc/dev/ams.c 1 Aug 2011 12:28:53 -0000 1.28 +++ sys/arch/macppc/dev/ams.c 26 Sep 2012 22:36:06 -0000 @@ -65,7 +65,7 @@ static void ms_processevent(adb_event_t static void init_trackpad(struct ams_softc *); /* Driver definition. */ -CFATTACH_DECL(ams, sizeof(struct ams_softc), +CFATTACH_DECL_NEW(ams, sizeof(struct ams_softc), amsmatch, amsattach, NULL, NULL); int ams_enable(void *); @@ -107,6 +107,7 @@ amsattach(device_t parent, device_t self int error; struct wsmousedev_attach_args a; + sc->sc_dev = self; sc->origaddr = aa_args->origaddr; sc->adbaddr = aa_args->adbaddr; sc->handler_id = aa_args->handler_id; @@ -684,7 +685,7 @@ init_trackpad(struct ams_softc *sc) ret = sysctl_createv(NULL, 0, NULL, (const struct sysctlnode **)&me, CTLFLAG_READWRITE, - CTLTYPE_NODE, sc->sc_dev.dv_xname, NULL, + CTLTYPE_NODE, device_xname(sc->sc_dev), NULL, NULL, 0, NULL, 0, CTL_MACHDEP, CTL_CREATE, CTL_EOL); Index: sys/arch/macppc/dev/amsvar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/macppc/dev/amsvar.h,v retrieving revision 1.9 diff -u -p -r1.9 amsvar.h --- sys/arch/macppc/dev/amsvar.h 14 Mar 2009 14:46:01 -0000 1.9 +++ sys/arch/macppc/dev/amsvar.h 2 Oct 2012 01:44:34 -0000 @@ -37,7 +37,7 @@ * State info, per mouse instance. */ struct ams_softc { - struct device sc_dev; + device_t sc_dev; /* ADB info */ int origaddr; /* ADB device type (ADBADDR_MS) */ @@ -51,7 +51,7 @@ struct ams_softc { char sc_devid[5]; /* device indentifier */ int sc_mb; /* current button state */ - struct device *sc_wsmousedev; + device_t sc_wsmousedev; /* helpers for trackpads */ int sc_down; int sc_tapping; /* 1 - tapping causes button event */ Index: sys/arch/macppc/dev/apm.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/macppc/dev/apm.c,v retrieving revision 1.24 diff -u -p -r1.24 apm.c --- sys/arch/macppc/dev/apm.c 18 Jun 2011 08:08:28 -0000 1.24 +++ sys/arch/macppc/dev/apm.c 26 Sep 2012 22:36:50 -0000 @@ -76,7 +76,6 @@ __KERNEL_RCSID(0, "$NetBSD: apm.c,v 1.24 #define APM_NEVENTS 16 struct apm_softc { - struct device sc_dev; struct selinfo sc_rsel; #ifdef __OpenBSD__ struct klist sc_note; @@ -111,7 +110,7 @@ static int apm_record_event(struct apm_s #endif #endif -CFATTACH_DECL(apm, sizeof(struct apm_softc), +CFATTACH_DECL_NEW(apm, sizeof(struct apm_softc), apmmatch, apmattach, NULL, NULL); #ifdef __OpenBSD__ @@ -177,7 +176,7 @@ apmmatch(device_t parent, cfdata_t match void apmattach(device_t parent, device_t self, void *aux) { - struct apm_softc *sc = (struct apm_softc *) self; + struct apm_softc *sc = device_private(self); struct pmu_battery_info info; pm_battery_info(0, &info); Index: sys/arch/macppc/dev/com_mainbus.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/macppc/dev/com_mainbus.c,v retrieving revision 1.4 diff -u -p -r1.4 com_mainbus.c --- sys/arch/macppc/dev/com_mainbus.c 1 Jul 2011 18:41:52 -0000 1.4 +++ sys/arch/macppc/dev/com_mainbus.c 29 Sep 2012 12:12:06 -0000 @@ -47,6 +47,8 @@ #include #include +#include + struct com_mainbus_softc { struct com_softc sc_com; /* real "com" softc */ Index: sys/arch/macppc/dev/gpio.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/macppc/dev/gpio.c,v retrieving revision 1.11 diff -u -p -r1.11 gpio.c --- sys/arch/macppc/dev/gpio.c 30 Jun 2011 00:52:57 -0000 1.11 +++ sys/arch/macppc/dev/gpio.c 26 Sep 2012 22:37:30 -0000 @@ -56,14 +56,13 @@ static int gpio_gpio_match (device_t, cf static int gpio_intr (void *); struct gpio_softc { - struct device sc_dev; u_int8_t *sc_port; }; -CFATTACH_DECL(gpio_obio, sizeof(struct gpio_softc), +CFATTACH_DECL_NEW(gpio_obio, sizeof(struct gpio_softc), gpio_obio_match, gpio_obio_attach, NULL, NULL); -CFATTACH_DECL(gpio_gpio, sizeof(struct gpio_softc), +CFATTACH_DECL_NEW(gpio_gpio, sizeof(struct gpio_softc), gpio_gpio_match, gpio_gpio_attach, NULL, NULL); extern struct cfdriver gpio_cd; Index: sys/arch/macppc/dev/if_wi_obio.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/macppc/dev/if_wi_obio.c,v retrieving revision 1.23 diff -u -p -r1.23 if_wi_obio.c --- sys/arch/macppc/dev/if_wi_obio.c 1 Jul 2011 18:41:52 -0000 1.23 +++ sys/arch/macppc/dev/if_wi_obio.c 9 Oct 2012 01:02:34 -0000 @@ -107,7 +107,7 @@ wi_obio_attach(device_t parent, device_t wisc->sc_enable = wi_obio_enable; if (wi_attach(wisc, 0)) { - printf("%s: failed to attach controller\n", self->dv_xname); + printf("%s: failed to attach controller\n", device_xname(self)); return; } Index: sys/arch/macppc/dev/nvram.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/macppc/dev/nvram.c,v retrieving revision 1.17 diff -u -p -r1.17 nvram.c --- sys/arch/macppc/dev/nvram.c 30 Jun 2011 00:52:57 -0000 1.17 +++ sys/arch/macppc/dev/nvram.c 26 Sep 2012 22:38:19 -0000 @@ -56,13 +56,12 @@ static void nvram_attach(device_t, devic static int nvram_match(device_t, cfdata_t, void *); struct nvram_softc { - struct device sc_dev; int nv_type; char *nv_port; char *nv_data; }; -CFATTACH_DECL(nvram, sizeof(struct nvram_softc), +CFATTACH_DECL_NEW(nvram, sizeof(struct nvram_softc), nvram_match, nvram_attach, NULL, NULL); extern struct cfdriver nvram_cd; Index: sys/arch/macppc/dev/obio.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/macppc/dev/obio.c,v retrieving revision 1.37 diff -u -p -r1.37 obio.c --- sys/arch/macppc/dev/obio.c 2 Jun 2012 21:36:42 -0000 1.37 +++ sys/arch/macppc/dev/obio.c 9 Oct 2012 01:02:34 -0000 @@ -204,7 +204,7 @@ obio_attach(device_t parent, device_t se /* Enable internal modem (KeyLargo) */ if (PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_APPLE_KEYLARGO) { aprint_normal("%s: enabling KeyLargo internal modem\n", - self->dv_xname); + device_xname(self)); bus_space_write_4(ca.ca_tag, bsh, 0x40, bus_space_read_4(ca.ca_tag, bsh, 0x40) & ~(1<<25)); } Index: sys/arch/macppc/dev/ofb.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/macppc/dev/ofb.c,v retrieving revision 1.68 diff -u -p -r1.68 ofb.c --- sys/arch/macppc/dev/ofb.c 13 Mar 2012 18:40:27 -0000 1.68 +++ sys/arch/macppc/dev/ofb.c 9 Oct 2012 01:02:34 -0000 @@ -63,7 +63,7 @@ __KERNEL_RCSID(0, "$NetBSD: ofb.c,v 1.68 #include struct ofb_softc { - struct device sc_dev; + device_t sc_dev; pci_chipset_tag_t sc_pc; pcitag_t sc_pcitag; @@ -85,7 +85,7 @@ struct ofb_softc { static int ofbmatch(device_t, cfdata_t, void *); static void ofbattach(device_t, device_t, void *); -CFATTACH_DECL(ofb, sizeof(struct ofb_softc), +CFATTACH_DECL_NEW(ofb, sizeof(struct ofb_softc), ofbmatch, ofbattach, NULL, NULL); const struct wsscreen_descr *_ofb_scrlist[] = { @@ -150,6 +150,8 @@ ofbattach(device_t parent, device_t self int console, node, sub; char devinfo[256]; + sc->sc_dev = self; + pci_devinfo(pa->pa_id, pa->pa_class, 0, devinfo, sizeof(devinfo)); printf(": %s\n", devinfo); @@ -187,7 +189,7 @@ ofbattach(device_t parent, device_t self vcons_init_screen(&sc->vd, &rascons_console_screen, 1, &defattr); rascons_console_screen.scr_flags |= VCONS_SCREEN_IS_STATIC; - printf("%s: %d x %d, %dbpp\n", self->dv_xname, + printf("%s: %d x %d, %dbpp\n", device_xname(self), ri->ri_width, ri->ri_height, ri->ri_depth); sc->sc_fbaddr = 0; @@ -195,7 +197,7 @@ ofbattach(device_t parent, device_t self OF_interpret("frame-buffer-adr", 0, 1, &sc->sc_fbaddr); if (sc->sc_fbaddr == 0) { printf("%s: Unable to find the framebuffer address.\n", - sc->sc_dev.dv_xname); + device_xname(sc->sc_dev)); return; } sc->sc_fbsize = round_page(ri->ri_stride * ri->ri_height); @@ -320,7 +322,7 @@ ofb_mmap(void *v, void *vs, off_t offset int i; if (vd->active == NULL) { - printf("%s: no active screen.\n", sc->sc_dev.dv_xname); + printf("%s: no active screen.\n", device_xname(sc->sc_dev)); return -1; } @@ -337,7 +339,7 @@ ofb_mmap(void *v, void *vs, off_t offset */ if (kauth_authorize_machdep(kauth_cred_get(), KAUTH_MACHDEP_UNMANAGEDMEM, NULL, NULL, NULL, NULL) != 0) { - printf("%s: mmap() rejected.\n", sc->sc_dev.dv_xname); + printf("%s: mmap() rejected.\n", device_xname(sc->sc_dev)); return -1; } Index: sys/arch/macppc/dev/ofcons.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/macppc/dev/ofcons.c,v retrieving revision 1.26 diff -u -p -r1.26 ofcons.c --- sys/arch/macppc/dev/ofcons.c 18 Jun 2011 08:08:28 -0000 1.26 +++ sys/arch/macppc/dev/ofcons.c 26 Sep 2012 22:39:52 -0000 @@ -55,7 +55,6 @@ __KERNEL_RCSID(0, "$NetBSD: ofcons.c,v 1 #include "adb.h" struct ofcons_softc { - struct device of_dev; struct tty *of_tty; }; @@ -66,7 +65,7 @@ static int stdin, stdout; static int ofcmatch(device_t, cfdata_t, void *); static void ofcattach(device_t, device_t, void *); -CFATTACH_DECL(macofcons, sizeof(struct ofcons_softc), +CFATTACH_DECL_NEW(macofcons, sizeof(struct ofcons_softc), ofcmatch, ofcattach, NULL, NULL); extern struct cfdriver macofcons_cd; Index: sys/arch/macppc/macppc/cpu.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/macppc/macppc/cpu.c,v retrieving revision 1.58 diff -u -p -r1.58 cpu.c --- sys/arch/macppc/macppc/cpu.c 30 Jun 2011 00:52:57 -0000 1.58 +++ sys/arch/macppc/macppc/cpu.c 9 Oct 2012 01:02:34 -0000 @@ -176,7 +176,7 @@ cpuattach(device_t parent, device_t self } if (OF_finddevice("/bandit/ohare") != -1) { - printf("%s", self->dv_xname); + printf("%s", device_xname(self)); ohare_init(); } } Index: sys/arch/macppc/pci/u3.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/macppc/pci/u3.c,v retrieving revision 1.5 diff -u -p -r1.5 u3.c --- sys/arch/macppc/pci/u3.c 30 Jun 2011 00:52:58 -0000 1.5 +++ sys/arch/macppc/pci/u3.c 29 Sep 2012 12:12:55 -0000 @@ -46,10 +46,10 @@ #include #include +#include struct ibmcpc_softc { - struct device sc_dev; struct genppc_pci_chipset sc_pc[8]; struct powerpc_bus_space sc_iot; struct powerpc_bus_space sc_memt; @@ -61,7 +61,7 @@ static int ibmcpc_match(device_t, cfdata static pcireg_t ibmcpc_conf_read(void *, pcitag_t, int); static void ibmcpc_conf_write(void *, pcitag_t, int, pcireg_t); -CFATTACH_DECL(ibmcpc, sizeof(struct ibmcpc_softc), +CFATTACH_DECL_NEW(ibmcpc, sizeof(struct ibmcpc_softc), ibmcpc_match, ibmcpc_attach, NULL, NULL); #define PCI_DEVFN(slot,func) ((((slot) & 0x1f) << 3) | ((func) & 0x07)) @@ -87,7 +87,7 @@ ibmcpc_match(device_t parent, cfdata_t c static void ibmcpc_attach(device_t parent, device_t self, void *aux) { - struct ibmcpc_softc *sc = (void *) self; + struct ibmcpc_softc *sc = device_private(self); pci_chipset_tag_t pc = sc->sc_pc; struct confargs *ca = aux; struct pcibus_attach_args pba; Index: sys/arch/mips/adm5120/adm5120_extio.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/mips/adm5120/adm5120_extio.c,v retrieving revision 1.5 diff -u -p -r1.5 adm5120_extio.c --- sys/arch/mips/adm5120/adm5120_extio.c 1 Jul 2011 18:38:48 -0000 1.5 +++ sys/arch/mips/adm5120/adm5120_extio.c 29 Sep 2012 10:26:31 -0000 @@ -94,13 +94,12 @@ do { \ #define EXTIO_DPRINTF(__fmt, ...) do { } while (/*CONSTCOND*/0) #endif /* EXTIO_DEBUG */ -static int extio_match(struct device *, struct cfdata *, void *); -static void extio_attach(struct device *, struct device *, void *); -static int extio_submatch(struct device *, struct cfdata *, - const int *, void *); +static int extio_match(device_t, cfdata_t, void *); +static void extio_attach(device_t, device_t, void *); +static int extio_submatch(device_t, cfdata_t, const int *, void *); static int extio_print(void *, const char *); -CFATTACH_DECL(extio, sizeof(struct extio_softc), +CFATTACH_DECL_NEW(extio, sizeof(struct extio_softc), extio_match, extio_attach, NULL, NULL); /* There can be only one. */ @@ -120,7 +119,7 @@ struct extiodev extiodevs[] = { }; static int -extio_match(struct device *parent, struct cfdata *match, void *aux) +extio_match(device_t parent, cfdata_t match, void *aux) { return !extio_found; } @@ -174,7 +173,7 @@ extio_mpmc_init(struct extio_softc *sc) /* Map MultiPort Memory Controller */ if (bus_space_map(sc->sc_obiot, ADM5120_BASE_MPMC, 0x280, 0, &sc->sc_mpmch) != 0) { - aprint_error_dev(&sc->sc_dev, "unable to map MPMC\n"); + aprint_error_dev(sc->sc_dev, "unable to map MPMC\n"); return; } @@ -201,12 +200,12 @@ extio_mpmc_init(struct extio_softc *sc) } if (i == 0) { - aprint_error_dev(&sc->sc_dev, + aprint_error_dev(sc->sc_dev, "timeout waiting for MPMC idle\n"); splx(s); return; } else - EXTIO_DPRINTF("%s: MPMC idle\n", device_xname(&sc->sc_dev)); + EXTIO_DPRINTF("%s: MPMC idle\n", device_xname(sc->sc_dev)); #if 0 control = bus_space_read_4(sc->sc_obiot, sc->sc_mpmch, @@ -283,9 +282,9 @@ extio_mpmc_init(struct extio_softc *sc) } static void -extio_attach(struct device *parent, struct device *self, void *aux) +extio_attach(device_t parent, device_t self, void *aux) { - struct extio_softc *sc = (struct extio_softc *)self; + struct extio_softc *sc = device_private(self); struct mainbus_attach_args *ma = (struct mainbus_attach_args *)aux; struct extio_attach_args ea; struct extiodev *ed; @@ -294,6 +293,7 @@ extio_attach(struct device *parent, stru extio_found = 1; printf("\n"); + sc->sc_dev = self; sc->sc_gpio = ma->ma_gpio; sc->sc_obiot = ma->ma_obiot; sc->sc_gpioh = ma->ma_gpioh; @@ -318,7 +318,7 @@ extio_attach(struct device *parent, stru * Use GPIO[4] for interrupts. (Not yet.) */ if (gpio_pin_map(sc->sc_gpio, 0, __BITS(0, 4), &sc->sc_pm) != 0) { - aprint_error_dev(&sc->sc_dev, "failed to map GPIO[1:2]\n"); + aprint_error_dev(sc->sc_dev, "failed to map GPIO[1:2]\n"); } EXTIO_DPRINTF("%s: %d\n", __func__, __LINE__); gpio_pin_ctl(sc->sc_gpio, &sc->sc_pm, 0, GPIO_PIN_INPUT); @@ -333,11 +333,11 @@ extio_attach(struct device *parent, stru if (gpio_pin_read(sc->sc_gpio, &sc->sc_pm, 0) == GPIO_PIN_HIGH) { EXTIO_DPRINTF("%s: WAIT# inactive\n", - device_xname(&sc->sc_dev)); + device_xname(sc->sc_dev)); bus_space_write_4(sc->sc_obiot, sc->sc_gpioh, ADM5120_GPIO2, ADM5120_GPIO2_EW | ADM5120_GPIO2_CSX0 | ADM5120_GPIO2_CSX1); } else { - aprint_error_dev(&sc->sc_dev, "WAIT# active; may be stuck\n"); + aprint_error_dev(sc->sc_dev, "WAIT# active; may be stuck\n"); bus_space_write_4(sc->sc_obiot, sc->sc_gpioh, ADM5120_GPIO2, ADM5120_GPIO2_CSX0 | ADM5120_GPIO2_CSX1); } @@ -346,7 +346,7 @@ extio_attach(struct device *parent, stru /* Map MultiPort Memory Controller */ if (bus_space_map(sc->sc_obiot, ADM5120_BASE_MPMC, 0x280, 0, &sc->sc_mpmch) != 0) { - aprint_error_dev(&sc->sc_dev, "unable to map MPMC\n"); + aprint_error_dev(sc->sc_dev, "unable to map MPMC\n"); return; } @@ -374,8 +374,7 @@ extio_attach(struct device *parent, stru } static int -extio_submatch(struct device *parent, struct cfdata *cf, - const int *ldesc, void *aux) +extio_submatch(device_t parent, cfdata_t cf, const int *ldesc, void *aux) { struct extio_attach_args *ea = aux; Index: sys/arch/mips/adm5120/dev/admwdog.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/mips/adm5120/dev/admwdog.c,v retrieving revision 1.3 diff -u -p -r1.3 admwdog.c --- sys/arch/mips/adm5120/dev/admwdog.c 1 Jul 2011 18:38:49 -0000 1.3 +++ sys/arch/mips/adm5120/dev/admwdog.c 29 Sep 2012 11:41:49 -0000 @@ -119,7 +119,7 @@ admwdog_attach(struct admsw_softc *sc) /* deactivate watchdog */ admwdog_write(sc, 0); - smw->smw_name = device_xname(&sc->sc_dev); + smw->smw_name = device_xname(sc->sc_dev); smw->smw_cookie = sc; smw->smw_setmode = admwdog_setmode; smw->smw_tickle = admwdog_tickle; Index: sys/arch/mips/adm5120/dev/ahci.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/mips/adm5120/dev/ahci.c,v retrieving revision 1.8 diff -u -p -r1.8 ahci.c --- sys/arch/mips/adm5120/dev/ahci.c 11 Mar 2012 00:34:46 -0000 1.8 +++ sys/arch/mips/adm5120/dev/ahci.c 28 Sep 2012 18:12:38 -0000 @@ -239,10 +239,10 @@ struct ahci_pipe { u_int32_t toggle; }; -static int ahci_match(device_t, struct cfdata *, void *); +static int ahci_match(device_t, cfdata_t, void *); static void ahci_attach(device_t, device_t, void *); -CFATTACH_DECL(ahci, sizeof(struct ahci_softc), +CFATTACH_DECL_NEW(ahci, sizeof(struct ahci_softc), ahci_match, ahci_attach, NULL, NULL); static int Index: sys/arch/mips/adm5120/dev/ahcivar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/mips/adm5120/dev/ahcivar.h,v retrieving revision 1.3 diff -u -p -r1.3 ahcivar.h --- sys/arch/mips/adm5120/dev/ahcivar.h 4 Apr 2011 19:58:56 -0000 1.3 +++ sys/arch/mips/adm5120/dev/ahcivar.h 2 Oct 2012 01:45:38 -0000 @@ -93,7 +93,7 @@ struct ahci_softc { device_t sc_child; - struct device *sc_parent; /* parent device */ + device_t sc_parent; /* parent device */ u_int8_t sc_addr; /* device address of root hub */ u_int8_t sc_conf; Index: sys/arch/mips/adm5120/dev/if_admsw.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/mips/adm5120/dev/if_admsw.c,v retrieving revision 1.10 diff -u -p -r1.10 if_admsw.c --- sys/arch/mips/adm5120/dev/if_admsw.c 10 Jul 2011 23:13:23 -0000 1.10 +++ sys/arch/mips/adm5120/dev/if_admsw.c 28 Sep 2012 18:16:46 -0000 @@ -152,14 +152,14 @@ static int admsw_add_rxbuf(struct admsw_ static int admsw_mediachange(struct ifnet *); static void admsw_mediastatus(struct ifnet *, struct ifmediareq *); -static int admsw_match(struct device *, struct cfdata *, void *); -static void admsw_attach(struct device *, struct device *, void *); +static int admsw_match(device_t, cfdata_t, void *); +static void admsw_attach(device_t, device_t, void *); -CFATTACH_DECL(admsw, sizeof(struct admsw_softc), +CFATTACH_DECL_NEW(admsw, sizeof(struct admsw_softc), admsw_match, admsw_attach, NULL, NULL); static int -admsw_match(struct device *parent, struct cfdata *cf, void *aux) +admsw_match(device_t parent, cfdata_t cf, void *aux) { struct obio_attach_args *aa = aux; @@ -324,10 +324,10 @@ admsw_reset(struct admsw_softc *sc) } static void -admsw_attach(struct device *parent, struct device *self, void *aux) +admsw_attach(device_t parent, device_t self, void *aux) { uint8_t enaddr[ETHER_ADDR_LEN]; - struct admsw_softc *sc = (void *) self; + struct admsw_softc *sc = device_private(self); struct obio_attach_args *aa = aux; struct ifnet *ifp; bus_dma_segment_t seg; @@ -336,10 +336,11 @@ admsw_attach(struct device *parent, stru printf(": ADM5120 Switch Engine, %d ports\n", SW_DEVS); + sc->sc_dev = self; sc->sc_dmat = aa->oba_dt; sc->sc_st = aa->oba_st; - pd = prop_dictionary_get(device_properties(&sc->sc_dev), "mac-address"); + pd = prop_dictionary_get(device_properties(self), "mac-address"); if (pd == NULL) { enaddr[0] = 0x02; @@ -353,12 +354,12 @@ admsw_attach(struct device *parent, stru memcpy(sc->sc_enaddr, enaddr, sizeof(sc->sc_enaddr)); - printf("%s: base Ethernet address %s\n", sc->sc_dev.dv_xname, + printf("%s: base Ethernet address %s\n", device_xname(sc->sc_dev), ether_sprintf(enaddr)); /* Map the device. */ if (bus_space_map(sc->sc_st, aa->oba_addr, 512, 0, &sc->sc_ioh) != 0) { - printf("%s: unable to map device\n", device_xname(&sc->sc_dev)); + printf("%s: unable to map device\n", device_xname(sc->sc_dev)); return; } @@ -367,7 +368,7 @@ admsw_attach(struct device *parent, stru if (sc->sc_ih == NULL) { printf("%s: unable to register interrupt handler\n", - sc->sc_dev.dv_xname); + device_xname(sc->sc_dev)); return; } @@ -379,28 +380,28 @@ admsw_attach(struct device *parent, stru sizeof(struct admsw_control_data), PAGE_SIZE, 0, &seg, 1, &rseg, 0)) != 0) { printf("%s: unable to allocate control data, error = %d\n", - sc->sc_dev.dv_xname, error); + device_xname(sc->sc_dev), error); return; } if ((error = bus_dmamem_map(sc->sc_dmat, &seg, rseg, sizeof(struct admsw_control_data), (void *)&sc->sc_control_data, 0)) != 0) { printf("%s: unable to map control data, error = %d\n", - sc->sc_dev.dv_xname, error); + device_xname(sc->sc_dev), error); return; } if ((error = bus_dmamap_create(sc->sc_dmat, sizeof(struct admsw_control_data), 1, sizeof(struct admsw_control_data), 0, 0, &sc->sc_cddmamap)) != 0) { printf("%s: unable to create control data DMA map, " - "error = %d\n", sc->sc_dev.dv_xname, error); + "error = %d\n", device_xname(sc->sc_dev), error); return; } if ((error = bus_dmamap_load(sc->sc_dmat, sc->sc_cddmamap, sc->sc_control_data, sizeof(struct admsw_control_data), NULL, 0)) != 0) { printf("%s: unable to load control data DMA map, error = %d\n", - sc->sc_dev.dv_xname, error); + device_xname(sc->sc_dev), error); return; } @@ -412,7 +413,7 @@ admsw_attach(struct device *parent, stru 2, MCLBYTES, 0, 0, &sc->sc_txhsoft[i].ds_dmamap)) != 0) { printf("%s: unable to create txh DMA map %d, " - "error = %d\n", sc->sc_dev.dv_xname, i, error); + "error = %d\n", device_xname(sc->sc_dev), i, error); return; } sc->sc_txhsoft[i].ds_mbuf = NULL; @@ -422,7 +423,7 @@ admsw_attach(struct device *parent, stru 2, MCLBYTES, 0, 0, &sc->sc_txlsoft[i].ds_dmamap)) != 0) { printf("%s: unable to create txl DMA map %d, " - "error = %d\n", sc->sc_dev.dv_xname, i, error); + "error = %d\n", device_xname(sc->sc_dev), i, error); return; } sc->sc_txlsoft[i].ds_mbuf = NULL; @@ -435,7 +436,7 @@ admsw_attach(struct device *parent, stru if ((error = bus_dmamap_create(sc->sc_dmat, MCLBYTES, 1, MCLBYTES, 0, 0, &sc->sc_rxhsoft[i].ds_dmamap)) != 0) { printf("%s: unable to create rxh DMA map %d, " - "error = %d\n", sc->sc_dev.dv_xname, i, error); + "error = %d\n", device_xname(sc->sc_dev), i, error); return; } sc->sc_rxhsoft[i].ds_mbuf = NULL; @@ -444,7 +445,7 @@ admsw_attach(struct device *parent, stru if ((error = bus_dmamap_create(sc->sc_dmat, MCLBYTES, 1, MCLBYTES, 0, 0, &sc->sc_rxlsoft[i].ds_dmamap)) != 0) { printf("%s: unable to create rxl DMA map %d, " - "error = %d\n", sc->sc_dev.dv_xname, i, error); + "error = %d\n", device_xname(sc->sc_dev), i, error); return; } sc->sc_rxlsoft[i].ds_mbuf = NULL; @@ -464,7 +465,7 @@ admsw_attach(struct device *parent, stru ifmedia_set(&sc->sc_ifmedia[i], IFM_ETHER|IFM_AUTO); ifp = &sc->sc_ethercom[i].ec_if; - strcpy(ifp->if_xname, sc->sc_dev.dv_xname); + strcpy(ifp->if_xname, device_xname(sc->sc_dev)); ifp->if_xname[5] += i; ifp->if_softc = sc; ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; @@ -485,16 +486,16 @@ admsw_attach(struct device *parent, stru #ifdef ADMSW_EVENT_COUNTERS evcnt_attach_dynamic(&sc->sc_ev_txstall, EVCNT_TYPE_MISC, - NULL, sc->sc_dev.dv_xname, "txstall"); + NULL, device_xname(sc->sc_dev), "txstall"); evcnt_attach_dynamic(&sc->sc_ev_rxstall, EVCNT_TYPE_MISC, - NULL, sc->sc_dev.dv_xname, "rxstall"); + NULL, device_xname(sc->sc_dev), "rxstall"); evcnt_attach_dynamic(&sc->sc_ev_txintr, EVCNT_TYPE_MISC, - NULL, sc->sc_dev.dv_xname, "txintr"); + NULL, device_xname(sc->sc_dev), "txintr"); evcnt_attach_dynamic(&sc->sc_ev_rxintr, EVCNT_TYPE_MISC, - NULL, sc->sc_dev.dv_xname, "rxintr"); + NULL, device_xname(sc->sc_dev), "rxintr"); #if 1 evcnt_attach_dynamic(&sc->sc_ev_rxsync, EVCNT_TYPE_MISC, - NULL, sc->sc_dev.dv_xname, "rxsync"); + NULL, device_xname(sc->sc_dev), "rxsync"); #endif #endif @@ -504,7 +505,7 @@ admsw_attach(struct device *parent, stru sc->sc_sdhook = shutdownhook_establish(admsw_shutdown, sc); if (sc->sc_sdhook == NULL) printf("%s: WARNING: unable to establish shutdown hook\n", - sc->sc_dev.dv_xname); + device_xname(sc->sc_dev)); /* leave interrupts and cpu port disabled */ return; @@ -595,14 +596,14 @@ admsw_start(struct ifnet *ifp) MGETHDR(m, M_DONTWAIT, MT_DATA); if (m == NULL) { printf("%s: unable to allocate Tx mbuf\n", - sc->sc_dev.dv_xname); + device_xname(sc->sc_dev)); break; } if (m0->m_pkthdr.len > MHLEN) { MCLGET(m, M_DONTWAIT); if ((m->m_flags & M_EXT) == 0) { printf("%s: unable to allocate Tx " - "cluster\n", sc->sc_dev.dv_xname); + "cluster\n", device_xname(sc->sc_dev)); m_freem(m); break; } @@ -621,7 +622,7 @@ admsw_start(struct ifnet *ifp) m, BUS_DMA_WRITE|BUS_DMA_NOWAIT); if (error) { printf("%s: unable to load Tx buffer, " - "error = %d\n", sc->sc_dev.dv_xname, error); + "error = %d\n", device_xname(sc->sc_dev), error); break; } } @@ -696,23 +697,23 @@ admsw_watchdog(struct ifnet *ifp) #if 1 /* Check if an interrupt was lost. */ if (sc->sc_txfree == ADMSW_NTXLDESC) { - printf("%s: watchdog false alarm\n", sc->sc_dev.dv_xname); + printf("%s: watchdog false alarm\n", device_xname(sc->sc_dev)); return; } if (sc->sc_ethercom[0].ec_if.if_timer != 0) - printf("%s: watchdog timer is %d!\n", sc->sc_dev.dv_xname, sc->sc_ethercom[0].ec_if.if_timer); + printf("%s: watchdog timer is %d!\n", device_xname(sc->sc_dev), sc->sc_ethercom[0].ec_if.if_timer); admsw_txintr(sc, 0); if (sc->sc_txfree == ADMSW_NTXLDESC) { - printf("%s: tx IRQ lost (queue empty)\n", sc->sc_dev.dv_xname); + printf("%s: tx IRQ lost (queue empty)\n", device_xname(sc->sc_dev)); return; } if (sc->sc_ethercom[0].ec_if.if_timer != 0) { - printf("%s: tx IRQ lost (timer recharged)\n", sc->sc_dev.dv_xname); + printf("%s: tx IRQ lost (timer recharged)\n", device_xname(sc->sc_dev)); return; } #endif - printf("%s: device timeout, txfree = %d\n", sc->sc_dev.dv_xname, sc->sc_txfree); + printf("%s: device timeout, txfree = %d\n", device_xname(sc->sc_dev), sc->sc_txfree); for (vlan = 0; vlan < SW_DEVS; vlan++) admsw_stop(&sc->sc_ethercom[vlan].ec_if, 0); for (vlan = 0; vlan < SW_DEVS; vlan++) @@ -944,7 +945,7 @@ admsw_rxintr(struct admsw_softc *sc, int ADMSW_CDRXLSYNC(sc, sc->sc_rxptr, BUS_DMASYNC_PREREAD|BUS_DMASYNC_PREWRITE); /* We've fallen behind the chip: catch it. */ printf("%s: RX ring resync, base=%x, work=%x, %d -> %d\n", - sc->sc_dev.dv_xname, REG_READ(RECV_LBADDR_REG), + device_xname(sc->sc_dev), REG_READ(RECV_LBADDR_REG), REG_READ(RECV_LWADDR_REG), sc->sc_rxptr, i); sc->sc_rxptr = i; ADMSW_EVCNT_INCR(&sc->sc_ev_rxsync); @@ -1204,7 +1205,7 @@ admsw_add_rxbuf(struct admsw_softc *sc, BUS_DMA_READ | BUS_DMA_NOWAIT); if (error) { printf("%s: can't load rx DMA map %d, error = %d\n", - sc->sc_dev.dv_xname, idx, error); + device_xname(sc->sc_dev), idx, error); panic("admsw_add_rxbuf"); /* XXX */ } Index: sys/arch/mips/adm5120/dev/if_admswvar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/mips/adm5120/dev/if_admswvar.h,v retrieving revision 1.4 diff -u -p -r1.4 if_admswvar.h --- sys/arch/mips/adm5120/dev/if_admswvar.h 10 Jul 2011 23:13:23 -0000 1.4 +++ sys/arch/mips/adm5120/dev/if_admswvar.h 28 Sep 2012 18:14:52 -0000 @@ -117,7 +117,7 @@ struct admsw_descsoft { * Software state per device. */ struct admsw_softc { - struct device sc_dev; /* generic device information */ + device_t sc_dev; /* generic device information */ uint8_t sc_enaddr[ETHER_ADDR_LEN]; bus_dma_tag_t sc_dmat; /* bus DMA tag */ bus_space_tag_t sc_st; /* bus space tag */ Index: sys/arch/mips/adm5120/include/adm5120_extiovar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/mips/adm5120/include/adm5120_extiovar.h,v retrieving revision 1.3 diff -u -p -r1.3 adm5120_extiovar.h --- sys/arch/mips/adm5120/include/adm5120_extiovar.h 19 Oct 2009 23:19:39 -0000 1.3 +++ sys/arch/mips/adm5120/include/adm5120_extiovar.h 27 Sep 2012 21:36:47 -0000 @@ -47,7 +47,7 @@ struct extio_attach_args { }; struct extio_softc { - struct device sc_dev; + device_t sc_dev; bus_space_tag_t sc_obiot; bus_space_handle_t sc_gpioh; bus_space_handle_t sc_mpmch; Index: sys/arch/mips/atheros/ar5312.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/mips/atheros/ar5312.c,v retrieving revision 1.8 diff -u -p -r1.8 ar5312.c --- sys/arch/mips/atheros/ar5312.c 7 Jul 2011 05:06:44 -0000 1.8 +++ sys/arch/mips/atheros/ar5312.c 2 Oct 2012 01:46:43 -0000 @@ -174,8 +174,7 @@ ar5312_get_freqs(struct arfreqs *freqs) static void -addprop_data(struct device *dev, const char *name, const uint8_t *data, - int len) +addprop_data(device_t dev, const char *name, const uint8_t *data, int len) { prop_data_t pd; pd = prop_data_create_data(data, len); @@ -188,7 +187,7 @@ addprop_data(struct device *dev, const c } static void -addprop_integer(struct device *dev, const char *name, uint32_t val) +addprop_integer(device_t dev, const char *name, uint32_t val) { prop_number_t pn; pn = prop_number_create_integer(val); Index: sys/arch/mips/atheros/ar5315.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/mips/atheros/ar5315.c,v retrieving revision 1.9 diff -u -p -r1.9 ar5315.c --- sys/arch/mips/atheros/ar5315.c 10 Jul 2011 06:24:18 -0000 1.9 +++ sys/arch/mips/atheros/ar5315.c 2 Oct 2012 01:47:01 -0000 @@ -228,7 +228,7 @@ addprop_integer(device_t dev, const char } static void -ar5315_device_register(struct device *dev, void *aux) +ar5315_device_register(device_t dev, void *aux) { const struct arbus_attach_args * const aa = aux; const struct ar531x_boarddata * const info = atheros_get_board_info(); Index: sys/arch/mips/atheros/ar9344.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/mips/atheros/ar9344.c,v retrieving revision 1.3 diff -u -p -r1.3 ar9344.c --- sys/arch/mips/atheros/ar9344.c 10 Jul 2011 23:13:22 -0000 1.3 +++ sys/arch/mips/atheros/ar9344.c 2 Oct 2012 01:47:14 -0000 @@ -192,7 +192,7 @@ ar9344_get_freqs(struct arfreqs *freqs) #if 0 static void -addprop_data(struct device *dev, const char *name, const uint8_t *data, +addprop_data(device_t dev, const char *name, const uint8_t *data, int len) { prop_data_t pd; @@ -207,7 +207,7 @@ addprop_data(struct device *dev, const c #endif static void -addprop_integer(struct device *dev, const char *name, uint32_t val) +addprop_integer(device_t dev, const char *name, uint32_t val) { prop_number_t pn; pn = prop_number_create_integer(val); Index: sys/arch/mips/atheros/dev/aevar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/mips/atheros/dev/aevar.h,v retrieving revision 1.5 diff -u -p -r1.5 aevar.h --- sys/arch/mips/atheros/dev/aevar.h 2 Feb 2012 19:43:00 -0000 1.5 +++ sys/arch/mips/atheros/dev/aevar.h 1 Oct 2012 14:37:22 -0000 @@ -124,7 +124,7 @@ struct ae_stats { * Software state per device. */ struct ae_softc { - struct device sc_dev; /* generic device information */ + device_t sc_dev; /* generic device information */ bus_space_tag_t sc_st; /* bus space tag */ bus_space_handle_t sc_sh; /* bus space handle */ bus_size_t sc_size; /* bus space size */ Index: sys/arch/mips/atheros/dev/arspi.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/mips/atheros/dev/arspi.c,v retrieving revision 1.9 diff -u -p -r1.9 arspi.c --- sys/arch/mips/atheros/dev/arspi.c 10 Jul 2011 06:24:19 -0000 1.9 +++ sys/arch/mips/atheros/dev/arspi.c 2 Oct 2012 01:46:14 -0000 @@ -94,7 +94,6 @@ struct arspi_job { #define JOB_WREN 0x10 /* WREN needed */ struct arspi_softc { - struct device sc_dev; struct spi_controller sc_spi; void *sc_ih; bool sc_interrupts; @@ -109,9 +108,9 @@ struct arspi_softc { #define STATIC -STATIC int arspi_match(struct device *, struct cfdata *, void *); -STATIC void arspi_attach(struct device *, struct device *, void *); -STATIC void arspi_interrupts(struct device *); +STATIC int arspi_match(device_t, cfdata_t, void *); +STATIC void arspi_attach(device_t, device_t, void *); +STATIC void arspi_interrupts(device_t); STATIC int arspi_intr(void *); /* SPI service routines */ STATIC int arspi_configure(void *, int, int, int); @@ -127,14 +126,14 @@ STATIC void arspi_update_job(struct spi_ STATIC void arspi_finish_job(struct spi_transfer *); -CFATTACH_DECL(arspi, sizeof(struct arspi_softc), +CFATTACH_DECL_NEW(arspi, sizeof(struct arspi_softc), arspi_match, arspi_attach, NULL, NULL); #define GETREG(sc, o) bus_space_read_4(sc->sc_st, sc->sc_sh, o) #define PUTREG(sc, o, v) bus_space_write_4(sc->sc_st, sc->sc_sh, o, v) int -arspi_match(struct device *parent, struct cfdata *cf, void *aux) +arspi_match(device_t parent, cfdata_t cf, void *aux) { struct arbus_attach_args *aa = aux; @@ -144,7 +143,7 @@ arspi_match(struct device *parent, struc } void -arspi_attach(struct device *parent, struct device *self, void *aux) +arspi_attach(device_t parent, device_t self, void *aux) { struct arspi_softc *sc = device_private(self); struct spibus_attach_args sba; @@ -193,11 +192,11 @@ arspi_attach(struct device *parent, stru * Initialize and attach bus attach. */ sba.sba_controller = &sc->sc_spi; - (void) config_found_ia(&sc->sc_dev, "spibus", &sba, spibus_print); + (void) config_found_ia(self, "spibus", &sba, spibus_print); } void -arspi_interrupts(struct device *self) +arspi_interrupts(device_t self) { /* * we never leave polling mode, because, apparently, we Index: sys/arch/mips/atheros/dev/athflash.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/mips/atheros/dev/athflash.c,v retrieving revision 1.5 diff -u -p -r1.5 athflash.c --- sys/arch/mips/atheros/dev/athflash.c 25 Aug 2011 02:36:03 -0000 1.5 +++ sys/arch/mips/atheros/dev/athflash.c 28 Sep 2012 18:15:18 -0000 @@ -104,7 +104,6 @@ int flash_debug = 0; #endif struct flash_softc { - struct device sc_dev; bus_space_tag_t sc_iot; bus_space_handle_t sc_ioh; size_t sc_size; @@ -115,8 +114,8 @@ struct flash_softc { #define FLASH_ST_BUSY 0x1 -static int flash_probe(struct device *, struct cfdata *, void *); -static void flash_attach(struct device *, struct device *, void *); +static int flash_probe(device_t, cfdata_t, void *); +static void flash_attach(device_t, device_t, void *); static int is_block_same(struct flash_softc *, bus_size_t, const void *); static int toggle_bit_wait(struct flash_softc *, bus_size_t, int, int, int); @@ -126,7 +125,7 @@ static int flash_sector_write(struct fla extern struct cfdriver athflash_cd; -CFATTACH_DECL(athflash, sizeof(struct flash_softc), +CFATTACH_DECL_NEW(athflash, sizeof(struct flash_softc), flash_probe, flash_attach, NULL, NULL); dev_type_open(flashopen); @@ -152,7 +151,7 @@ static struct { }; static int -flash_probe(struct device *parent, struct cfdata *cf, void *aux) +flash_probe(device_t parent, cfdata_t cf, void *aux) { struct arbus_attach_args *aa = aux; bus_space_handle_t ioh; @@ -192,10 +191,10 @@ flash_probe(struct device *parent, struc } static void -flash_attach(struct device *parent, struct device *self, void *aux) +flash_attach(device_t parent, device_t self, void *aux) { char nbuf[32]; - struct flash_softc *sc = (void *) self; + struct flash_softc *sc = device_private(self); struct arbus_attach_args *aa = aux; int i; bus_space_tag_t iot = aa->aa_bst; Index: sys/arch/mips/atheros/dev/if_ae.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/mips/atheros/dev/if_ae.c,v retrieving revision 1.23 diff -u -p -r1.23 if_ae.c --- sys/arch/mips/atheros/dev/if_ae.c 22 Jul 2012 14:32:52 -0000 1.23 +++ sys/arch/mips/atheros/dev/if_ae.c 28 Sep 2012 18:17:07 -0000 @@ -190,7 +190,7 @@ static void ae_mii_writereg(device_t, in static void ae_print_stats(struct ae_softc *); #endif -CFATTACH_DECL(ae, sizeof(struct ae_softc), +CFATTACH_DECL_NEW(ae, sizeof(struct ae_softc), ae_match, ae_attach, ae_detach, ae_activate); /* @@ -225,6 +225,8 @@ ae_attach(device_t parent, device_t self struct ifnet *ifp = &sc->sc_ethercom.ec_if; int i, error; + sc->sc_dev = self; + callout_init(&sc->sc_tick_callout, 0); printf(": Atheros AR531X 10/100 Ethernet\n"); @@ -232,10 +234,10 @@ ae_attach(device_t parent, device_t self /* * Try to get MAC address. */ - ea = prop_dictionary_get(device_properties(&sc->sc_dev), "mac-address"); + ea = prop_dictionary_get(device_properties(sc->sc_dev), "mac-address"); if (ea == NULL) { printf("%s: unable to get mac-addr property\n", - sc->sc_dev.dv_xname); + device_xname(sc->sc_dev)); return; } KASSERT(prop_object_type(ea) == PROP_TYPE_DATA); @@ -243,7 +245,7 @@ ae_attach(device_t parent, device_t self enaddr = prop_data_data_nocopy(ea); /* Announce ourselves. */ - printf("%s: Ethernet address %s\n", sc->sc_dev.dv_xname, + printf("%s: Ethernet address %s\n", device_xname(sc->sc_dev), ether_sprintf(enaddr)); sc->sc_cirq = aa->aa_cirq; @@ -261,7 +263,7 @@ ae_attach(device_t parent, device_t self if ((error = bus_space_map(sc->sc_st, aa->aa_addr, sc->sc_size, 0, &sc->sc_sh)) != 0) { printf("%s: unable to map registers, error = %d\n", - sc->sc_dev.dv_xname, error); + device_xname(sc->sc_dev), error); goto fail_0; } @@ -273,7 +275,7 @@ ae_attach(device_t parent, device_t self sizeof(struct ae_control_data), PAGE_SIZE, 0, &sc->sc_cdseg, 1, &sc->sc_cdnseg, 0)) != 0) { printf("%s: unable to allocate control data, error = %d\n", - sc->sc_dev.dv_xname, error); + device_xname(sc->sc_dev), error); goto fail_1; } @@ -281,7 +283,7 @@ ae_attach(device_t parent, device_t self sizeof(struct ae_control_data), (void **)&sc->sc_control_data, BUS_DMA_COHERENT)) != 0) { printf("%s: unable to map control data, error = %d\n", - sc->sc_dev.dv_xname, error); + device_xname(sc->sc_dev), error); goto fail_2; } @@ -289,7 +291,7 @@ ae_attach(device_t parent, device_t self sizeof(struct ae_control_data), 1, sizeof(struct ae_control_data), 0, 0, &sc->sc_cddmamap)) != 0) { printf("%s: unable to create control data DMA map, " - "error = %d\n", sc->sc_dev.dv_xname, error); + "error = %d\n", device_xname(sc->sc_dev), error); goto fail_3; } @@ -297,7 +299,7 @@ ae_attach(device_t parent, device_t self sc->sc_control_data, sizeof(struct ae_control_data), NULL, 0)) != 0) { printf("%s: unable to load control data DMA map, error = %d\n", - sc->sc_dev.dv_xname, error); + device_xname(sc->sc_dev), error); goto fail_4; } @@ -309,7 +311,7 @@ ae_attach(device_t parent, device_t self AE_NTXSEGS, MCLBYTES, 0, 0, &sc->sc_txsoft[i].txs_dmamap)) != 0) { printf("%s: unable to create tx DMA map %d, " - "error = %d\n", sc->sc_dev.dv_xname, i, error); + "error = %d\n", device_xname(sc->sc_dev), i, error); goto fail_5; } } @@ -321,7 +323,7 @@ ae_attach(device_t parent, device_t self if ((error = bus_dmamap_create(sc->sc_dmat, MCLBYTES, 1, MCLBYTES, 0, 0, &sc->sc_rxsoft[i].rxs_dmamap)) != 0) { printf("%s: unable to create rx DMA map %d, " - "error = %d\n", sc->sc_dev.dv_xname, i, error); + "error = %d\n", device_xname(sc->sc_dev), i, error); goto fail_6; } sc->sc_rxsoft[i].rxs_mbuf = NULL; @@ -350,7 +352,7 @@ ae_attach(device_t parent, device_t self sc->sc_ethercom.ec_mii = &sc->sc_mii; ifmedia_init(&sc->sc_mii.mii_media, 0, ether_mediachange, ether_mediastatus); - mii_attach(&sc->sc_dev, &sc->sc_mii, 0xffffffff, MII_PHY_ANY, + mii_attach(sc->sc_dev, &sc->sc_mii, 0xffffffff, MII_PHY_ANY, MII_OFFSET_ANY, 0); if (LIST_FIRST(&sc->sc_mii.mii_phys) == NULL) { @@ -361,7 +363,7 @@ ae_attach(device_t parent, device_t self sc->sc_tick = ae_mii_tick; - strcpy(ifp->if_xname, sc->sc_dev.dv_xname); + strcpy(ifp->if_xname, device_xname(sc->sc_dev)); ifp->if_softc = sc; ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; sc->sc_if_flags = ifp->if_flags; @@ -384,7 +386,7 @@ ae_attach(device_t parent, device_t self ether_ifattach(ifp, enaddr); ether_set_ifflags_cb(&sc->sc_ethercom, ae_ifflags_cb); - rnd_attach_source(&sc->sc_rnd_source, sc->sc_dev.dv_xname, + rnd_attach_source(&sc->sc_rnd_source, device_xname(sc->sc_dev), RND_TYPE_NET, 0); /* @@ -393,17 +395,17 @@ ae_attach(device_t parent, device_t self sc->sc_sdhook = shutdownhook_establish(ae_shutdown, sc); if (sc->sc_sdhook == NULL) printf("%s: WARNING: unable to establish shutdown hook\n", - sc->sc_dev.dv_xname); + device_xname(sc->sc_dev)); /* * Add a suspend hook to make sure we come back up after a * resume. */ - sc->sc_powerhook = powerhook_establish(sc->sc_dev.dv_xname, + sc->sc_powerhook = powerhook_establish(device_xname(sc->sc_dev), ae_power, sc); if (sc->sc_powerhook == NULL) printf("%s: WARNING: unable to establish power hook\n", - sc->sc_dev.dv_xname); + device_xname(sc->sc_dev)); return; /* @@ -550,7 +552,7 @@ ae_start(struct ifnet *ifp) int error, firsttx, nexttx, lasttx = 1, ofree, seg; DPRINTF(sc, ("%s: ae_start: sc_flags 0x%08x, if_flags 0x%08x\n", - sc->sc_dev.dv_xname, sc->sc_flags, ifp->if_flags)); + device_xname(sc->sc_dev), sc->sc_flags, ifp->if_flags)); if ((ifp->if_flags & (IFF_RUNNING|IFF_OACTIVE)) != IFF_RUNNING) @@ -564,7 +566,7 @@ ae_start(struct ifnet *ifp) firsttx = sc->sc_txnext; DPRINTF(sc, ("%s: ae_start: txfree %d, txnext %d\n", - sc->sc_dev.dv_xname, ofree, firsttx)); + device_xname(sc->sc_dev), ofree, firsttx)); /* * Loop through the send queue, setting up transmit descriptors @@ -595,7 +597,7 @@ ae_start(struct ifnet *ifp) MGETHDR(m, M_DONTWAIT, MT_DATA); if (m == NULL) { printf("%s: unable to allocate Tx mbuf\n", - sc->sc_dev.dv_xname); + device_xname(sc->sc_dev)); break; } MCLAIM(m, &sc->sc_ethercom.ec_tx_mowner); @@ -603,7 +605,7 @@ ae_start(struct ifnet *ifp) MCLGET(m, M_DONTWAIT); if ((m->m_flags & M_EXT) == 0) { printf("%s: unable to allocate Tx " - "cluster\n", sc->sc_dev.dv_xname); + "cluster\n", device_xname(sc->sc_dev)); m_freem(m); break; } @@ -614,7 +616,7 @@ ae_start(struct ifnet *ifp) m, BUS_DMA_WRITE|BUS_DMA_NOWAIT); if (error) { printf("%s: unable to load Tx buffer, " - "error = %d\n", sc->sc_dev.dv_xname, + "error = %d\n", device_xname(sc->sc_dev), error); break; } @@ -741,7 +743,7 @@ ae_start(struct ifnet *ifp) if (sc->sc_txfree != ofree) { DPRINTF(sc, ("%s: packets enqueued, IC on %d, OWN on %d\n", - sc->sc_dev.dv_xname, lasttx, firsttx)); + device_xname(sc->sc_dev), lasttx, firsttx)); /* * Cause a transmit interrupt to happen on the * last packet we enqueued. @@ -782,11 +784,11 @@ ae_watchdog(struct ifnet *ifp) doing_transmit = (! SIMPLEQ_EMPTY(&sc->sc_txdirtyq)); if (doing_transmit) { - printf("%s: transmit timeout\n", sc->sc_dev.dv_xname); + printf("%s: transmit timeout\n", device_xname(sc->sc_dev)); ifp->if_oerrors++; } else - printf("%s: spurious watchdog timeout\n", sc->sc_dev.dv_xname); + printf("%s: spurious watchdog timeout\n", device_xname(sc->sc_dev)); (void) ae_init(ifp); @@ -859,11 +861,11 @@ ae_intr(void *arg) u_int32_t status, rxstatus, txstatus; int handled = 0, txthresh; - DPRINTF(sc, ("%s: ae_intr\n", sc->sc_dev.dv_xname)); + DPRINTF(sc, ("%s: ae_intr\n", device_xname(sc->sc_dev))); #ifdef DEBUG if (AE_IS_ENABLED(sc) == 0) - panic("%s: ae_intr: not enabled", sc->sc_dev.dv_xname); + panic("%s: ae_intr: not enabled", device_xname(sc->sc_dev)); #endif /* @@ -871,7 +873,7 @@ ae_intr(void *arg) * possibly have come from us. */ if ((ifp->if_flags & IFF_RUNNING) == 0 || - !device_is_active(&sc->sc_dev)) { + !device_is_active(sc->sc_dev)) { printf("spurious?!?\n"); return (0); } @@ -897,7 +899,7 @@ ae_intr(void *arg) if (rxstatus & STATUS_RU) { printf("%s: receive ring overrun\n", - sc->sc_dev.dv_xname); + device_xname(sc->sc_dev)); /* Get the receive process going again. */ AE_WRITE(sc, CSR_RXPOLL, RXPOLL_RPD); AE_BARRIER(sc); @@ -911,7 +913,7 @@ ae_intr(void *arg) if (txstatus & STATUS_TJT) printf("%s: transmit jabber timeout\n", - sc->sc_dev.dv_xname); + device_xname(sc->sc_dev)); if (txstatus & STATUS_UNF) { /* @@ -932,7 +934,7 @@ ae_intr(void *arg) ae_txthresh[txthresh].txth_opmode; printf("%s: transmit underrun; new " "threshold: %s\n", - sc->sc_dev.dv_xname, + device_xname(sc->sc_dev), ae_txthresh[txthresh].txth_name); /* @@ -952,10 +954,10 @@ ae_intr(void *arg) if (status & (STATUS_TPS|STATUS_RPS)) { if (status & STATUS_TPS) printf("%s: transmit process stopped\n", - sc->sc_dev.dv_xname); + device_xname(sc->sc_dev)); if (status & STATUS_RPS) printf("%s: receive process stopped\n", - sc->sc_dev.dv_xname); + device_xname(sc->sc_dev)); (void) ae_init(ifp); break; } @@ -971,7 +973,7 @@ ae_intr(void *arg) str = "unknown error"; printf("%s: fatal system error: %s\n", - sc->sc_dev.dv_xname, str); + device_xname(sc->sc_dev), str); (void) ae_init(ifp); break; } @@ -1050,7 +1052,7 @@ ae_rxintr(struct ae_softc *sc) #define PRINTERR(bit, str) \ if (rxstat & (bit)) \ printf("%s: receive error: %s\n", \ - sc->sc_dev.dv_xname, str) + device_xname(sc->sc_dev), str) ifp->if_ierrors++; PRINTERR(ADSTAT_Rx_DE, "descriptor error"); PRINTERR(ADSTAT_Rx_RF, "runt frame"); @@ -1161,7 +1163,7 @@ ae_txintr(struct ae_softc *sc) u_int32_t txstat; DPRINTF(sc, ("%s: ae_txintr: sc_flags 0x%08x\n", - sc->sc_dev.dv_xname, sc->sc_flags)); + device_xname(sc->sc_dev), sc->sc_flags)); ifp->if_flags &= ~IFF_OACTIVE; @@ -1252,7 +1254,7 @@ ae_print_stats(struct ae_softc *sc) { printf("%s: tx_uf %lu, tx_to %lu, tx_ec %lu, tx_lc %lu\n", - sc->sc_dev.dv_xname, + device_xname(sc->sc_dev), sc->sc_stats.ts_tx_uf, sc->sc_stats.ts_tx_to, sc->sc_stats.ts_tx_ec, sc->sc_stats.ts_tx_lc); } @@ -1290,7 +1292,7 @@ ae_reset(struct ae_softc *sc) } if (AE_ISSET(sc, CSR_BUSMODE, BUSMODE_SWR)) - printf("%s: reset failed to complete\n", sc->sc_dev.dv_xname); + printf("%s: reset failed to complete\n", device_xname(sc->sc_dev)); delay(1000); } @@ -1367,7 +1369,7 @@ ae_init(struct ifnet *ifp) if ((error = ae_add_rxbuf(sc, i)) != 0) { printf("%s: unable to allocate or map rx " "buffer %d, error = %d\n", - sc->sc_dev.dv_xname, i, error); + device_xname(sc->sc_dev), i, error); /* * XXX Should attempt to run with fewer receive * XXX buffers instead of just failing. @@ -1460,7 +1462,7 @@ ae_init(struct ifnet *ifp) if (error) { ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE); ifp->if_timer = 0; - printf("%s: interface not running\n", sc->sc_dev.dv_xname); + printf("%s: interface not running\n", device_xname(sc->sc_dev)); } return (error); } @@ -1479,7 +1481,7 @@ ae_enable(struct ae_softc *sc) ae_intr, sc); if (sc->sc_ih == NULL) { printf("%s: unable to establish interrupt\n", - sc->sc_dev.dv_xname); + device_xname(sc->sc_dev)); return (EIO); } sc->sc_flags |= AE_ENABLED; @@ -1652,7 +1654,7 @@ ae_add_rxbuf(struct ae_softc *sc, int id BUS_DMA_READ|BUS_DMA_NOWAIT); if (error) { printf("%s: can't load rx DMA map %d, error = %d\n", - sc->sc_dev.dv_xname, idx, error); + device_xname(sc->sc_dev), idx, error); panic("ae_add_rxbuf"); /* XXX */ } @@ -1691,7 +1693,7 @@ ae_filter_setup(struct ae_softc *sc) } DPRINTF(sc, ("%s: ae_filter_setup: sc_flags 0x%08x\n", - sc->sc_dev.dv_xname, sc->sc_flags)); + device_xname(sc->sc_dev), sc->sc_flags)); macctl = AE_READ(sc, CSR_MACCTL); macctl &= ~(MACCTL_PR | MACCTL_PM); @@ -1741,7 +1743,7 @@ ae_filter_setup(struct ae_softc *sc) AE_BARRIER(sc); DPRINTF(sc, ("%s: ae_filter_setup: returning %x\n", - sc->sc_dev.dv_xname, macctl)); + device_xname(sc->sc_dev), macctl)); } /* @@ -1795,13 +1797,13 @@ ae_idle(struct ae_softc *sc, u_int32_t b if ((bits & OPMODE_ST) != 0 && (csr & STATUS_TPS) == 0 && (csr & STATUS_TS) != STATUS_TS_STOPPED) { printf("%s: transmit process failed to idle: " - "state %s\n", sc->sc_dev.dv_xname, + "state %s\n", device_xname(sc->sc_dev), txstate_names[(csr & STATUS_TS) >> 20]); } if ((bits & OPMODE_SR) != 0 && (csr & STATUS_RPS) == 0 && (csr & STATUS_RS) != STATUS_RS_STOPPED) { printf("%s: receive process failed to idle: " - "state %s\n", sc->sc_dev.dv_xname, + "state %s\n", device_xname(sc->sc_dev), rxstate_names[(csr & STATUS_RS) >> 17]); } } @@ -1822,7 +1824,7 @@ ae_mii_tick(void *arg) struct ae_softc *sc = arg; int s; - if (!device_is_active(&sc->sc_dev)) + if (!device_is_active(sc->sc_dev)) return; s = splnet(); Index: sys/arch/mips/ralink/ralink_gpio.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/mips/ralink/ralink_gpio.c,v retrieving revision 1.3 diff -u -p -r1.3 ralink_gpio.c --- sys/arch/mips/ralink/ralink_gpio.c 27 Sep 2011 01:02:34 -0000 1.3 +++ sys/arch/mips/ralink/ralink_gpio.c 9 Oct 2012 01:15:03 -0000 @@ -529,7 +529,7 @@ ra_gpio_attach(device_t parent, device_t if (sc->sc_ih == NULL) { RALINK_DEBUG(RALINK_DEBUG_ERROR, "%s: unable to establish interrupt\n", - sc->sc_dev->dv_xname); + device_xname(sc->sc_dev)); goto fail_2; } @@ -539,7 +539,7 @@ ra_gpio_attach(device_t parent, device_t ra_intr_disestablish(sc->sc_ih); RALINK_DEBUG(RALINK_DEBUG_ERROR, "%s: unable to establish soft interrupt\n", - sc->sc_dev->dv_xname); + device_xname(sc->sc_dev)); goto fail_3; } Index: sys/arch/mips/ralink/ralink_i2c.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/mips/ralink/ralink_i2c.c,v retrieving revision 1.2 diff -u -p -r1.2 ralink_i2c.c --- sys/arch/mips/ralink/ralink_i2c.c 28 Jul 2011 15:38:49 -0000 1.2 +++ sys/arch/mips/ralink/ralink_i2c.c 2 Oct 2012 01:47:29 -0000 @@ -74,8 +74,8 @@ typedef struct ra_i2c_softc { } ra_i2c_softc_t; -static int ra_i2c_match(struct device *, cfdata_t, void *); -static void ra_i2c_attach(struct device *, struct device *, void *); +static int ra_i2c_match(device_t, cfdata_t, void *); +static void ra_i2c_attach(device_t, device_t, void *); /* RT3052 I2C functions */ static int i2c_write(ra_i2c_softc_t *, u_long, const u_char *, u_long); Index: sys/arch/mips/ralink/ralink_usbhcvar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/mips/ralink/ralink_usbhcvar.h,v retrieving revision 1.2 diff -u -p -r1.2 ralink_usbhcvar.h --- sys/arch/mips/ralink/ralink_usbhcvar.h 28 Jul 2011 15:38:49 -0000 1.2 +++ sys/arch/mips/ralink/ralink_usbhcvar.h 2 Oct 2012 01:47:42 -0000 @@ -38,10 +38,10 @@ struct ralink_usb_hc { TAILQ_ENTRY(ralink_usb_hc) next; - struct device *usb; + device_t usb; }; -void ralink_usb_hc_add(struct ralink_usb_hc *, struct device *); +void ralink_usb_hc_add(struct ralink_usb_hc *, device_t); void ralink_usb_hc_rem(struct ralink_usb_hc *); #endif /* _RALINK_USBHCVAR_H_ */ Index: sys/arch/mips/rmi/rmixl_cpu.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/mips/rmi/rmixl_cpu.c,v retrieving revision 1.4 diff -u -p -r1.4 rmixl_cpu.c --- sys/arch/mips/rmi/rmixl_cpu.c 29 Apr 2011 22:00:03 -0000 1.4 +++ sys/arch/mips/rmi/rmixl_cpu.c 2 Oct 2012 01:48:07 -0000 @@ -77,9 +77,6 @@ static int cpu_fmn_intr(void *, rmixl_fm #ifdef MULTIPROCESSOR void cpu_rmixl_hatch(struct cpu_info *); void cpu_rmixl_run(struct cpu_info *); -#if 0 -static void cpu_setup_trampoline_ipi(struct device *, struct cpu_info *); -#endif static int cpu_setup_trampoline_common(struct cpu_info *, struct rmixl_cpu_trampoline_args *); static void cpu_setup_trampoline_callback(struct cpu_info *); #endif /* MULTIPROCESSOR */ Index: sys/arch/mips/rmi/rmixl_pcie.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/mips/rmi/rmixl_pcie.c,v retrieving revision 1.9 diff -u -p -r1.9 rmixl_pcie.c --- sys/arch/mips/rmi/rmixl_pcie.c 27 Jan 2012 18:52:58 -0000 1.9 +++ sys/arch/mips/rmi/rmixl_pcie.c 29 Sep 2012 10:26:13 -0000 @@ -164,7 +164,7 @@ static int rmixl_pcie_match(device_t, cf static void rmixl_pcie_attach(device_t, device_t, void *); static void rmixl_pcie_init(struct rmixl_pcie_softc *); static void rmixl_pcie_init_ecfg(struct rmixl_pcie_softc *); -static void rmixl_pcie_attach_hook(struct device *, struct device *, +static void rmixl_pcie_attach_hook(device_t, device_t, struct pcibus_attach_args *); static void rmixl_pcie_lnkcfg_4xx(rmixl_pcie_lnktab_t *, uint32_t); static void rmixl_pcie_lnkcfg_408Lite(rmixl_pcie_lnktab_t *, uint32_t); @@ -818,7 +818,7 @@ rmixl_conf_interrupt(void *v, int bus, i } void -rmixl_pcie_attach_hook(struct device *parent, struct device *self, +rmixl_pcie_attach_hook(device_t parent, device_t self, struct pcibus_attach_args *pba) { DPRINTF(("%s: pba_bus %d, pba_bridgetag %p, pc_conf_v %p\n", Index: sys/arch/mips/rmi/rmixl_pcix.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/mips/rmi/rmixl_pcix.c,v retrieving revision 1.9 diff -u -p -r1.9 rmixl_pcix.c --- sys/arch/mips/rmi/rmixl_pcix.c 10 Jul 2011 23:13:22 -0000 1.9 +++ sys/arch/mips/rmi/rmixl_pcix.c 29 Sep 2012 10:25:55 -0000 @@ -224,7 +224,7 @@ static int rmixl_pcix_match(device_t, cf static void rmixl_pcix_attach(device_t, device_t, void *); static void rmixl_pcix_init(rmixl_pcix_softc_t *); static void rmixl_pcix_init_errors(rmixl_pcix_softc_t *); -static void rmixl_pcix_attach_hook(struct device *, struct device *, +static void rmixl_pcix_attach_hook(device_t, device_t, struct pcibus_attach_args *); static void rmixl_pcix_intcfg(rmixl_pcix_softc_t *); static void rmixl_pcix_errata(rmixl_pcix_softc_t *); @@ -596,7 +596,7 @@ rmixl_conf_interrupt(void *v, int bus, i } void -rmixl_pcix_attach_hook(struct device *parent, struct device *self, +rmixl_pcix_attach_hook(device_t parent, device_t self, struct pcibus_attach_args *pba) { DPRINTF(("%s: pba_bus %d, pba_bridgetag %p, pc_conf_v %p\n", Index: sys/arch/mipsco/include/isa_machdep.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/mipsco/include/isa_machdep.h,v retrieving revision 1.8 diff -u -p -r1.8 isa_machdep.h --- sys/arch/mipsco/include/isa_machdep.h 19 Aug 2009 15:09:56 -0000 1.8 +++ sys/arch/mipsco/include/isa_machdep.h 2 Oct 2012 01:48:31 -0000 @@ -86,7 +86,6 @@ * Types provided to machine-independent ISA code. */ struct mipsco_isa_chipset { - struct device sc_dev; struct mipsco_intrhand ic_intr; /* XXX */ struct evcnt ic_intrcnt; /* Interrupt counter */ bus_space_tag_t ic_bst; /* bus_space tag */ @@ -103,7 +102,7 @@ struct isabus_attach_args; /* XXX */ /* * Functions provided to machine-independent ISA code. */ -void isa_attach_hook(struct device *, struct device *, +void isa_attach_hook(device_t, device_t, struct isabus_attach_args *); void isa_detach_hook(isa_chipset_tag_t, device_t); int isa_intr_alloc(isa_chipset_tag_t, int, int, int *); Index: sys/arch/mipsco/isa/isa_machdep.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/mipsco/isa/isa_machdep.c,v retrieving revision 1.14 diff -u -p -r1.14 isa_machdep.c --- sys/arch/mipsco/isa/isa_machdep.c 19 Aug 2009 15:11:53 -0000 1.14 +++ sys/arch/mipsco/isa/isa_machdep.c 29 Sep 2012 10:25:20 -0000 @@ -47,15 +47,14 @@ __KERNEL_RCSID(0, "$NetBSD: isa_machdep. #include static int mipscoisabusprint(void *auxp, const char *); -static int isabusmatch(struct device *, struct cfdata *, void *); -static void isabusattach(struct device *, struct device *, void *); +static int isabusmatch(device_t, cfdata_t, void *); +static void isabusattach(device_t, device_t, void *); struct isabus_softc { - struct device sc_dev; struct mipsco_isa_chipset sc_isa_ic; }; -CFATTACH_DECL(isabus, sizeof(struct isabus_softc), +CFATTACH_DECL_NEW(isabus, sizeof(struct isabus_softc), isabusmatch, isabusattach, NULL, NULL); extern struct cfdriver isabus_cd; @@ -69,7 +68,7 @@ int isa_intr(void *); int -isabusmatch(struct device *pdp, struct cfdata *cfp, void *aux) +isabusmatch(device_t parent, cfdata_t cfp, void *aux) { struct confargs *ca = aux; @@ -103,9 +102,9 @@ isa_bus_space_init(struct mipsco_bus_spa void -isabusattach(struct device *pdp, struct device *dp, void *aux) +isabusattach(device_t parent, device_t self, void *aux) { - struct isabus_softc *sc = (struct isabus_softc *)dp; + struct isabus_softc *sc = device_private(self); struct mipsco_isa_chipset *ic = &sc->sc_isa_ic; struct isabus_attach_args iba; @@ -139,13 +138,13 @@ isabusattach(struct device *pdp, struct bus_space_write_4(ic->ic_bst, ic->ic_bsh, 0, 0); evcnt_attach_dynamic(&ic->ic_intrcnt, EVCNT_TYPE_INTR, NULL, - dp->dv_xname, "intr"); + device_xname(self), "intr"); LIST_INIT(&ic->intr_q); (*platform.intr_establish)(SYS_INTR_ATBUS, isa_intr, ic); printf("\n"); - config_found_ia(dp, "isabus", &iba, mipscoisabusprint); + config_found_ia(self, "isabus", &iba, mipscoisabusprint); } int @@ -157,7 +156,7 @@ mipscoisabusprint(void *auxp, const char } void -isa_attach_hook(struct device *parent, struct device *self, struct isabus_attach_args *iba) +isa_attach_hook(device_t parent, device_t self, struct isabus_attach_args *iba) { } Index: sys/arch/mipsco/mipsco/autoconf.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/mipsco/mipsco/autoconf.c,v retrieving revision 1.25 diff -u -p -r1.25 autoconf.c --- sys/arch/mipsco/mipsco/autoconf.c 29 Jul 2012 18:05:44 -0000 1.25 +++ sys/arch/mipsco/mipsco/autoconf.c 9 Oct 2012 01:16:43 -0000 @@ -105,7 +105,7 @@ cpu_rootconf(void) findroot(&booted_device, &booted_partition); printf("boot device: %s\n", - booted_device ? booted_device->dv_xname : ""); + booted_device ? device_xname(booted_device) : ""); rootconf(); } Index: sys/arch/mipsco/mipsco/cpu.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/mipsco/mipsco/cpu.c,v retrieving revision 1.10 diff -u -p -r1.10 cpu.c --- sys/arch/mipsco/mipsco/cpu.c 20 Feb 2011 07:56:16 -0000 1.10 +++ sys/arch/mipsco/mipsco/cpu.c 27 Sep 2012 21:39:49 -0000 @@ -43,7 +43,7 @@ __KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.10 static int cpumatch(device_t, cfdata_t, void *); static void cpuattach(device_t, device_t, void *); -CFATTACH_DECL(cpu, 0, +CFATTACH_DECL_NEW(cpu, 0, cpumatch, cpuattach, NULL, NULL); extern struct cfdriver cpu_cd; Index: sys/arch/mipsco/obio/i82072.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/mipsco/obio/i82072.c,v retrieving revision 1.11 diff -u -p -r1.11 i82072.c --- sys/arch/mipsco/obio/i82072.c 14 Mar 2009 15:36:10 -0000 1.11 +++ sys/arch/mipsco/obio/i82072.c 27 Sep 2012 21:41:05 -0000 @@ -62,32 +62,32 @@ const struct cdevsw fd_cdevsw = { #define I82072_TC 0x800003 struct fd_softc { - struct device dev; + device_t dev; struct evcnt fd_intrcnt; bus_space_tag_t fd_bst; bus_space_handle_t fd_bsh; int unit; }; -static int fd_match (struct device *, struct cfdata *, void *); -static void fd_attach (struct device *, struct device *, void *); +static int fd_match (device_t, cfdata_t, void *); +static void fd_attach (device_t, device_t, void *); static void fd_reset (struct fd_softc *); -CFATTACH_DECL(fd, sizeof(struct fd_softc), +CFATTACH_DECL_NEW(fd, sizeof(struct fd_softc), fd_match, fd_attach, NULL, NULL); static int fd_intr (void *); int -fd_match(struct device *parent, struct cfdata *cf, void *aux) +fd_match(device_t parent, cfdata_t cf, void *aux) { return 1; } void -fd_attach(struct device *parent, struct device *self, void *aux) +fd_attach(device_t parent, device_t self, void *aux) { - struct fd_softc *sc = (void *)self; + struct fd_softc *sc = device_private(self); struct confargs *ca = aux; sc->fd_bst = ca->ca_bustag; @@ -95,11 +95,11 @@ fd_attach(struct device *parent, struct 0x1000000, BUS_SPACE_MAP_LINEAR, &sc->fd_bsh) != 0) { - printf("%s: cannot map registers\n", self->dv_xname); + printf("%s: cannot map registers\n", device_xname(self)); return; } evcnt_attach_dynamic(&sc->fd_intrcnt, EVCNT_TYPE_INTR, NULL, - self->dv_xname, "intr"); + device_xname(self), "intr"); bus_intr_establish(sc->fd_bst, SYS_INTR_FDC, 0, 0, fd_intr, sc); Index: sys/arch/mipsco/obio/mkclock.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/mipsco/obio/mkclock.c,v retrieving revision 1.10 diff -u -p -r1.10 mkclock.c --- sys/arch/mipsco/obio/mkclock.c 14 Mar 2009 21:04:12 -0000 1.10 +++ sys/arch/mipsco/obio/mkclock.c 27 Sep 2012 21:41:34 -0000 @@ -48,16 +48,15 @@ __KERNEL_RCSID(0, "$NetBSD: mkclock.c,v #include struct mkclock_softc { - struct device dev; bus_space_tag_t sc_bst; bus_space_handle_t sc_bsh; struct todr_chip_handle sc_todr; }; -static int mkclock_match (struct device *, struct cfdata *, void *); -static void mkclock_attach (struct device *, struct device *, void *); +static int mkclock_match (device_t, cfdata_t, void *); +static void mkclock_attach (device_t, device_t, void *); -CFATTACH_DECL(mkclock, sizeof(struct mkclock_softc), +CFATTACH_DECL_NEW(mkclock, sizeof(struct mkclock_softc), mkclock_match, mkclock_attach, NULL, NULL); int mkclock_read (todr_chip_handle_t, struct clock_ymdhms *); @@ -67,15 +66,15 @@ static int mk_read (struct mkclock_softc static void mk_write (struct mkclock_softc *, int, int); int -mkclock_match(struct device *parent, struct cfdata *cf, void *aux) +mkclock_match(device_t parent, cfdata_t cf, void *aux) { return 1; } void -mkclock_attach(struct device *parent, struct device *self, void *aux) +mkclock_attach(device_t parent, device_t self, void *aux) { - struct mkclock_softc *sc = (void *)self; + struct mkclock_softc *sc = device_private(self); struct confargs *ca = aux; sc->sc_bst = ca->ca_bustag; Index: sys/arch/mipsco/obio/rambo.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/mipsco/obio/rambo.c,v retrieving revision 1.12 diff -u -p -r1.12 rambo.c --- sys/arch/mipsco/obio/rambo.c 14 Mar 2009 21:04:12 -0000 1.12 +++ sys/arch/mipsco/obio/rambo.c 27 Sep 2012 21:42:00 -0000 @@ -50,14 +50,13 @@ __KERNEL_RCSID(0, "$NetBSD: rambo.c,v 1. * Timer & Interrupt manipulation routines for the Rambo Custom ASIC */ -static int rambo_match(struct device *, struct cfdata *, void *); -static void rambo_attach(struct device *, struct device *, void *); +static int rambo_match(device_t, cfdata_t, void *); +static void rambo_attach(device_t, device_t, void *); static unsigned rambo_get_timecount(struct timecounter *); void rambo_clkintr(struct clockframe *); static void rambo_tc_init(void); struct rambo_softc { - struct device dev; struct evcnt sc_intrcnt; bus_space_tag_t sc_bst; bus_space_handle_t sc_bsh; @@ -67,20 +66,20 @@ struct rambo_softc { static struct rambo_softc *rambo; -CFATTACH_DECL(rambo, sizeof(struct rambo_softc), +CFATTACH_DECL_NEW(rambo, sizeof(struct rambo_softc), rambo_match, rambo_attach, NULL, NULL); static int -rambo_match(struct device *parent, struct cfdata *cf, void *aux) +rambo_match(device_t parent, cfdata_t cf, void *aux) { return 1; } static void -rambo_attach(struct device *parent, struct device *self, void *aux) +rambo_attach(device_t parent, device_t self, void *aux) { struct confargs *ca = aux; - struct rambo_softc *sc = (void *)self; + struct rambo_softc *sc = device_private(self); sc->sc_bst = ca->ca_bustag; Index: sys/arch/mmeye/dev/mmeyepcmcia.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/mmeye/dev/mmeyepcmcia.c,v retrieving revision 1.21 diff -u -p -r1.21 mmeyepcmcia.c --- sys/arch/mmeye/dev/mmeyepcmcia.c 26 Jul 2011 22:52:49 -0000 1.21 +++ sys/arch/mmeye/dev/mmeyepcmcia.c 29 Sep 2012 13:01:22 -0000 @@ -101,7 +101,7 @@ struct mmeyepcmcia_handle { bus_space_handle_t ioh; } io[MMEYEPCMCIA_IO_WINS]; int ih_irq; - struct device *pcmcia; + device_t pcmcia; int shutdown; lwp_t *event_thread; @@ -128,7 +128,7 @@ struct mmeyepcmcia_handle { #define MMEYEPCMCIA_IOWINS 2 struct mmeyepcmcia_softc { - struct device dev; + device_t dev; bus_space_tag_t iot; /* mmeyepcmcia registers */ bus_space_handle_t ioh; @@ -228,10 +228,10 @@ static void mmeyepcmcia_deactivate_card( static void mmeyepcmcia_event_thread(void *); static void mmeyepcmcia_queue_event(struct mmeyepcmcia_handle *, int); -static int mmeyepcmcia_match(struct device *, struct cfdata *, void *); -static void mmeyepcmcia_attach(struct device *, struct device *, void *); +static int mmeyepcmcia_match(device_t, cfdata_t, void *); +static void mmeyepcmcia_attach(device_t, device_t, void *); -CFATTACH_DECL(mmeyepcmcia, sizeof(struct mmeyepcmcia_softc), +CFATTACH_DECL_NEW(mmeyepcmcia, sizeof(struct mmeyepcmcia_softc), mmeyepcmcia_match, mmeyepcmcia_attach, NULL, NULL); static struct pcmcia_chip_functions mmeyepcmcia_functions = { @@ -255,7 +255,7 @@ static struct pcmcia_chip_functions mmey }; static int -mmeyepcmcia_match(struct device *parent, struct cfdata *match, void *aux) +mmeyepcmcia_match(device_t parent, cfdata_t match, void *aux) { struct mainbus_attach_args *ma = aux; @@ -272,13 +272,14 @@ mmeyepcmcia_match(struct device *parent, } static void -mmeyepcmcia_attach(struct device *parent, struct device *self, void *aux) +mmeyepcmcia_attach(device_t parent, device_t self, void *aux) { struct mainbus_attach_args *ma = aux; - struct mmeyepcmcia_softc *sc = (void *)self; + struct mmeyepcmcia_softc *sc = device_private(self); aprint_naive("\n"); + sc->dev = self; sc->subregionmask = 1; /* 1999.05.17 T.Horiuchi for R1.4 */ sc->pct = (pcmcia_chipset_tag_t)&mmeyepcmcia_functions; @@ -321,7 +322,7 @@ mmeyepcmcia_chip_intr_establish(pcmcia_c ih = mmeye_intr_establish(irq, IST_LEVEL, ipl, fct, arg); h->ih_irq = irq; - printf("%s: card irq %d\n", h->pcmcia->dv_xname, irq); + printf("%s: card irq %d\n", device_xname(h->pcmcia), irq); return ih; } @@ -361,7 +362,7 @@ mmeyepcmcia_attach_socket(struct mmeyepc paa.pct = (pcmcia_chipset_tag_t) h->sc->pct; paa.pch = (pcmcia_chipset_handle_t) h; - h->pcmcia = config_found_ia(&h->sc->dev, "pcmciabus", &paa, + h->pcmcia = config_found_ia(h->sc->dev, "pcmciabus", &paa, mmeyepcmcia_print); /* if there's actually a pcmcia device attached, initialize the slot */ @@ -414,7 +415,7 @@ mmeyepcmcia_event_thread(void *arg) } splx(s); - DPRINTF(("%s: insertion event\n", h->sc->dev.dv_xname)); + DPRINTF(("%s: insertion event\n", device_xname(h->sc->dev))); mmeyepcmcia_attach_card(h); break; @@ -438,7 +439,7 @@ mmeyepcmcia_event_thread(void *arg) } splx(s); - DPRINTF(("%s: removal event\n", h->sc->dev.dv_xname)); + DPRINTF(("%s: removal event\n", device_xname(h->sc->dev))); mmeyepcmcia_detach_card(h, DETACH_FORCE); break; @@ -494,9 +495,9 @@ mmeyepcmcia_init_socket(struct mmeyepcmc } if (kthread_create(PRI_NONE, 0, NULL, mmeyepcmcia_event_thread, h, - &h->event_thread, "%s", h->sc->dev.dv_xname)) { + &h->event_thread, "%s", device_xname(h->sc->dev))) { printf("%s: unable to create event thread\n", - h->sc->dev.dv_xname); + device_xname(h->sc->dev)); panic("mmeyepcmcia_create_event_thread"); } } @@ -516,7 +517,7 @@ mmeyepcmcia_intr(void *arg) { struct mmeyepcmcia_softc *sc = arg; - DPRINTF(("%s: intr\n", sc->dev.dv_xname)); + DPRINTF(("%s: intr\n", device_xname(sc->dev))); mmeyepcmcia_intr_socket(&sc->handle[0]); @@ -537,21 +538,21 @@ mmeyepcmcia_intr_socket(struct mmeyepcmc MMEYEPCMCIA_CSC_BATTDEAD); if (cscreg & MMEYEPCMCIA_CSC_GPI) { - DPRINTF(("%s: %02x GPI\n", h->sc->dev.dv_xname, h->sock)); + DPRINTF(("%s: %02x GPI\n", device_xname(h->sc->dev), h->sock)); } if (cscreg & MMEYEPCMCIA_CSC_CD) { int statreg; statreg = mmeyepcmcia_read(h, MMEYEPCMCIA_IF_STATUS); - DPRINTF(("%s: %02x CD %x\n", h->sc->dev.dv_xname, h->sock, + DPRINTF(("%s: %02x CD %x\n", device_xname(h->sc->dev), h->sock, statreg)); if ((statreg & MMEYEPCMCIA_IF_STATUS_CARDDETECT_MASK) == MMEYEPCMCIA_IF_STATUS_CARDDETECT_PRESENT) { if (h->laststate != MMEYEPCMCIA_LASTSTATE_PRESENT) { DPRINTF(("%s: enqueing INSERTION event\n", - h->sc->dev.dv_xname)); + device_xname(h->sc->dev))); mmeyepcmcia_queue_event(h, MMEYEPCMCIA_EVENT_INSERTION); } h->laststate = MMEYEPCMCIA_LASTSTATE_PRESENT; @@ -559,11 +560,11 @@ mmeyepcmcia_intr_socket(struct mmeyepcmc if (h->laststate == MMEYEPCMCIA_LASTSTATE_PRESENT) { /* Deactivate the card now. */ DPRINTF(("%s: deactivating card\n", - h->sc->dev.dv_xname)); + device_xname(h->sc->dev))); mmeyepcmcia_deactivate_card(h); DPRINTF(("%s: enqueing REMOVAL event\n", - h->sc->dev.dv_xname)); + device_xname(h->sc->dev))); mmeyepcmcia_queue_event(h, MMEYEPCMCIA_EVENT_REMOVAL); } h->laststate = ((statreg & MMEYEPCMCIA_IF_STATUS_CARDDETECT_MASK) == 0) @@ -571,14 +572,14 @@ mmeyepcmcia_intr_socket(struct mmeyepcmc } } if (cscreg & MMEYEPCMCIA_CSC_READY) { - DPRINTF(("%s: %02x READY\n", h->sc->dev.dv_xname, h->sock)); + DPRINTF(("%s: %02x READY\n", device_xname(h->sc->dev), h->sock)); /* shouldn't happen */ } if (cscreg & MMEYEPCMCIA_CSC_BATTWARN) { - DPRINTF(("%s: %02x BATTWARN\n", h->sc->dev.dv_xname, h->sock)); + DPRINTF(("%s: %02x BATTWARN\n", device_xname(h->sc->dev), h->sock)); } if (cscreg & MMEYEPCMCIA_CSC_BATTDEAD) { - DPRINTF(("%s: %02x BATTDEAD\n", h->sc->dev.dv_xname, h->sock)); + DPRINTF(("%s: %02x BATTDEAD\n", device_xname(h->sc->dev), h->sock)); } return cscreg ? 1 : 0; } Index: sys/arch/mmeye/mmeye/autoconf.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/mmeye/mmeye/autoconf.c,v retrieving revision 1.9 diff -u -p -r1.9 autoconf.c --- sys/arch/mmeye/mmeye/autoconf.c 29 Jul 2012 18:05:44 -0000 1.9 +++ sys/arch/mmeye/mmeye/autoconf.c 9 Oct 2012 01:16:43 -0000 @@ -70,7 +70,7 @@ cpu_rootconf(void) { printf("boot device: %s\n", - booted_device ? booted_device->dv_xname : ""); + booted_device ? device_xname(booted_device) : ""); rootconf(); } Index: sys/arch/mmeye/mmeye/machdep.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/mmeye/mmeye/machdep.c,v retrieving revision 1.55 diff -u -p -r1.55 machdep.c --- sys/arch/mmeye/mmeye/machdep.c 19 Feb 2011 10:46:29 -0000 1.55 +++ sys/arch/mmeye/mmeye/machdep.c 29 Sep 2012 12:14:07 -0000 @@ -243,7 +243,6 @@ initSH3(void *pc, u_int bim, int32_t bip struct btinfo_howto *bi_howto; size_t symbolsize; vaddr_t kernend; - int i; const char *bi_msg; /* Clear bss */ @@ -272,6 +271,7 @@ initSH3(void *pc, u_int bim, int32_t bip if (memcmp(&end, ELFMAG, SELFMAG) == 0) { Elf_Ehdr *eh = (void *)end; Elf_Shdr *sh = (void *)(end + eh->e_shoff); + int i; for (i = 0; i < eh->e_shnum; i++, sh++) if (sh->sh_offset > 0 && (sh->sh_offset + sh->sh_size) > symbolsize) Index: sys/arch/mvme68k/dev/clock_pcc.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/mvme68k/dev/clock_pcc.c,v retrieving revision 1.19 diff -u -p -r1.19 clock_pcc.c --- sys/arch/mvme68k/dev/clock_pcc.c 28 Apr 2008 20:23:29 -0000 1.19 +++ sys/arch/mvme68k/dev/clock_pcc.c 27 Sep 2012 21:43:15 -0000 @@ -53,17 +53,16 @@ __KERNEL_RCSID(0, "$NetBSD: clock_pcc.c, #include "ioconf.h" -int clock_pcc_match(struct device *, struct cfdata *, void *); -void clock_pcc_attach(struct device *, struct device *, void *); +int clock_pcc_match(device_t, cfdata_t, void *); +void clock_pcc_attach(device_t, device_t, void *); struct clock_pcc_softc { - struct device sc_dev; struct clock_attach_args sc_clock_args; u_char sc_clock_lvl; struct timecounter sc_tc; }; -CFATTACH_DECL(clock_pcc, sizeof(struct clock_pcc_softc), +CFATTACH_DECL_NEW(clock_pcc, sizeof(struct clock_pcc_softc), clock_pcc_match, clock_pcc_attach, NULL, NULL); @@ -79,7 +78,7 @@ static uint16_t clock_pcc_reload; /* ARGSUSED */ int -clock_pcc_match(struct device *parent, struct cfdata *cf, void *aux) +clock_pcc_match(device_t parent, cfdata_t cf, void *aux) { struct pcc_attach_args *pa; @@ -99,12 +98,12 @@ clock_pcc_match(struct device *parent, s /* ARGSUSED */ void -clock_pcc_attach(struct device *parent, struct device *self, void *aux) +clock_pcc_attach(device_t parent, device_t self, void *aux) { struct pcc_attach_args *pa; struct clock_pcc_softc *sc; - sc = (struct clock_pcc_softc *)self; + sc = device_private(self); pa = aux; if (pa->pa_ipl != CLOCK_LEVEL) Index: sys/arch/mvme68k/dev/memc_68k.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/mvme68k/dev/memc_68k.c,v retrieving revision 1.7 diff -u -p -r1.7 memc_68k.c --- sys/arch/mvme68k/dev/memc_68k.c 28 Apr 2008 20:23:29 -0000 1.7 +++ sys/arch/mvme68k/dev/memc_68k.c 27 Sep 2012 21:43:23 -0000 @@ -54,16 +54,16 @@ __KERNEL_RCSID(0, "$NetBSD: memc_68k.c,v #include "ioconf.h" -int memc_match(struct device *, struct cfdata *, void *); -void memc_attach(struct device *, struct device *, void *); +int memc_match(device_t, cfdata_t, void *); +void memc_attach(device_t, device_t, void *); -CFATTACH_DECL(memc, sizeof(struct memc_softc), +CFATTACH_DECL_NEW(memc, sizeof(struct memc_softc), memc_match, memc_attach, NULL, NULL); /* ARGSUSED */ int -memc_match(struct device *parent, struct cfdata *cf, void *aux) +memc_match(device_t parent, cfdata_t cf, void *aux) { struct mainbus_attach_args *ma = aux; bus_space_handle_t bh; @@ -97,11 +97,12 @@ memc_match(struct device *parent, struct /* ARGSUSED */ void -memc_attach(struct device *parent, struct device *self, void *aux) +memc_attach(device_t parent, device_t self, void *aux) { struct mainbus_attach_args *ma = aux; - struct memc_softc *sc = (struct memc_softc *)self; + struct memc_softc *sc = device_private(self); + sc->sc_dev = self; sc->sc_bust = ma->ma_bust; /* Map the memory controller's registers */ Index: sys/arch/mvme68k/dev/pcc.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/mvme68k/dev/pcc.c,v retrieving revision 1.31 diff -u -p -r1.31 pcc.c --- sys/arch/mvme68k/dev/pcc.c 1 Feb 2011 20:19:31 -0000 1.31 +++ sys/arch/mvme68k/dev/pcc.c 29 Sep 2012 10:23:52 -0000 @@ -80,11 +80,11 @@ __KERNEL_RCSID(0, "$NetBSD: pcc.c,v 1.31 * Autoconfiguration stuff for the PCC chip on mvme147 */ -void pccattach(struct device *, struct device *, void *); -int pccmatch(struct device *, struct cfdata *, void *); +void pccattach(device_t, device_t, void *); +int pccmatch(device_t, cfdata_t, void *); int pccprint(void *, const char *); -CFATTACH_DECL(pcc, sizeof(struct pcc_softc), +CFATTACH_DECL_NEW(pcc, sizeof(struct pcc_softc), pccmatch, pccattach, NULL, NULL); static int pccintr(void *); @@ -139,11 +139,11 @@ bus_addr_t pcc_slave_base_addr; /* ARGSUSED */ int -pccmatch(struct device *parent, struct cfdata *cf, void *args) +pccmatch(device_t parent, cfdata_t cf, void *aux) { struct mainbus_attach_args *ma; - ma = args; + ma = aux; /* Only attach one PCC. */ if (sys_pcc) @@ -154,7 +154,7 @@ pccmatch(struct device *parent, struct c /* ARGSUSED */ void -pccattach(struct device *parent, struct device *self, void *args) +pccattach(device_t parent, device_t self, void *aux) { struct mainbus_attach_args *ma; struct pcc_attach_args npa; @@ -162,7 +162,7 @@ pccattach(struct device *parent, struct uint8_t reg; int i; - ma = args; + ma = aux; sc = sys_pcc = (struct pcc_softc *)self; /* Get a handle to the PCC's registers. */ Index: sys/arch/mvme68k/dev/pcctwo_68k.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/mvme68k/dev/pcctwo_68k.c,v retrieving revision 1.9 diff -u -p -r1.9 pcctwo_68k.c --- sys/arch/mvme68k/dev/pcctwo_68k.c 28 Apr 2008 20:23:29 -0000 1.9 +++ sys/arch/mvme68k/dev/pcctwo_68k.c 29 Sep 2012 10:24:19 -0000 @@ -55,10 +55,10 @@ __KERNEL_RCSID(0, "$NetBSD: pcctwo_68k.c /* * Autoconfiguration stuff. */ -void pcctwoattach(struct device *, struct device *, void *); -int pcctwomatch(struct device *, struct cfdata *, void *); +void pcctwoattach(device_t, device_t, void *); +int pcctwomatch(device_t, cfdata_t, void *); -CFATTACH_DECL(pcctwo, sizeof(struct pcctwo_softc), +CFATTACH_DECL_NEW(pcctwo, sizeof(struct pcctwo_softc), pcctwomatch, pcctwoattach, NULL, NULL); @@ -143,13 +143,13 @@ static struct evcnt *pcctwoisrevcnt(void /* ARGSUSED */ int -pcctwomatch(struct device *parent, struct cfdata *cf, void *args) +pcctwomatch(device_t parent, cfdata_t cf, void *aux) { struct mainbus_attach_args *ma; bus_space_handle_t bh; uint8_t cid; - ma = args; + ma = aux; /* There can be only one. */ if (sys_pcctwo || strcmp(ma->ma_name, pcctwo_cd.cd_name)) @@ -179,15 +179,15 @@ pcctwomatch(struct device *parent, struc /* ARGSUSED */ void -pcctwoattach(struct device *parent, struct device *self, void *args) +pcctwoattach(device_t parent, device_t self, void *aux) { struct mainbus_attach_args *ma; struct pcctwo_softc *sc; const struct pcctwo_device *pd = NULL; uint8_t cid; - ma = args; - sc = sys_pcctwo = (struct pcctwo_softc *)self; + sc = sys_pcctwo = device_private(self); + ma = aux; /* Get a handle to the PCCChip2's registers */ sc->sc_bust = ma->ma_bust; Index: sys/arch/mvme68k/dev/pccvar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/mvme68k/dev/pccvar.h,v retrieving revision 1.10 diff -u -p -r1.10 pccvar.h --- sys/arch/mvme68k/dev/pccvar.h 28 Apr 2008 20:23:29 -0000 1.10 +++ sys/arch/mvme68k/dev/pccvar.h 27 Sep 2012 21:45:11 -0000 @@ -54,7 +54,6 @@ struct pcc_attach_args { struct pcc_softc { - struct device sc_dev; bus_space_tag_t sc_bust; bus_space_handle_t sc_bush; struct evcnt sc_evcnt; Index: sys/arch/mvme68k/dev/sbic.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/mvme68k/dev/sbic.c,v retrieving revision 1.32 diff -u -p -r1.32 sbic.c --- sys/arch/mvme68k/dev/sbic.c 12 Jan 2008 09:54:26 -0000 1.32 +++ sys/arch/mvme68k/dev/sbic.c 29 Sep 2012 12:16:30 -0000 @@ -395,7 +395,7 @@ sbic_scsi_request(struct scsipi_channel { struct scsipi_xfer *xs; struct scsipi_periph *periph; - struct sbic_softc *dev = (void *)chan->chan_adapter->adapt_dev; + struct sbic_softc *dev = device_private(chan->chan_adapter->adapt_dev); struct sbic_acb *acb; int flags, s; @@ -594,7 +594,7 @@ sbic_scsidone(struct sbic_acb *acb, int struct scsipi_xfer *xs = acb->xs; struct scsipi_periph *periph = xs->xs_periph; struct sbic_softc *dev = - (void *)periph->periph_channel->chan_adapter->adapt_dev; + device_private(periph->periph_channel->chan_adapter->adapt_dev); int dosched = 0; #ifdef DIAGNOSTIC @@ -669,7 +669,7 @@ sbic_scsidone(struct sbic_acb *acb, int TAILQ_REMOVE(&dev->ready_list, acb, chain); } else { printf("%s: can't find matching acb\n", - dev->sc_dev.dv_xname); + device_xname(dev->sc_dev)); #ifdef DDB Debugger(); #endif @@ -754,7 +754,7 @@ sbicabort(struct sbic_softc *dev, const GET_SBIC_csr(regs, csr); printf ("%s: abort %s: csr = 0x%02x, asr = 0x%02x\n", - dev->sc_dev.dv_xname, where, csr, asr); + device_xname(dev->sc_dev), where, csr, asr); /* * Clean up chip itself @@ -768,7 +768,7 @@ sbicabort(struct sbic_softc *dev, const */ GET_SBIC_data(regs, asr); printf("%s: abort %s: clearing data buffer 0x%02x\n", - dev->sc_dev.dv_xname, where, asr); + device_xname(dev->sc_dev), where, asr); GET_SBIC_asr(regs, asr); if (asr & SBIC_ASR_DBR) /* Not the read direction, then */ @@ -779,7 +779,7 @@ sbicabort(struct sbic_softc *dev, const WAIT_CIP(regs); printf("%s: sbicabort - sending ABORT command\n", - dev->sc_dev.dv_xname); + device_xname(dev->sc_dev)); SET_SBIC_cmd(regs, SBIC_CMD_ABORT); WAIT_CIP(regs); @@ -790,14 +790,14 @@ sbicabort(struct sbic_softc *dev, const * ok, get more drastic.. */ printf("%s: sbicabort - asr %x, trying to reset\n", - dev->sc_dev.dv_xname, asr); + device_xname(dev->sc_dev), asr); sbicreset(dev); dev->sc_flags &= ~SBICF_SELECTED; return SBIC_STATE_ERROR; } printf("%s: sbicabort - sending DISC command\n", - dev->sc_dev.dv_xname); + device_xname(dev->sc_dev)); SET_SBIC_cmd(regs, SBIC_CMD_DISC); do { @@ -938,7 +938,7 @@ sbicerror(struct sbic_softc *dev, u_char if ( xs->xs_control & XS_CTL_SILENT ) return; - printf("%s: csr == 0x%02x\n", dev->sc_dev.dv_xname, csr); + printf("%s: csr == 0x%02x\n", device_xname(dev->sc_dev), csr); } /* @@ -2039,7 +2039,7 @@ sbicmsgin(struct sbic_softc *dev) printf("%s: target %d now synchronous, " "period=%dns, offset=%d.\n", - dev->sc_dev.dv_xname, dev->target, + device_xname(dev->sc_dev), dev->target, msgaddr[3] * 4, msgaddr[4]); } else { @@ -2370,7 +2370,7 @@ sbicnextstate(struct sbic_softc *dev, u_ */ if ((asr & SBIC_ASR_INT) == 0) { printf("%s: Reselect without identify?" - " asr %x\n", dev->sc_dev.dv_xname, asr); + " asr %x\n", device_xname(dev->sc_dev), asr); newlun = 0; /* XXXX */ } else { /* @@ -2424,7 +2424,7 @@ sbicnextstate(struct sbic_softc *dev, u_ #ifdef DEBUG if (reselect_debug > 1) { printf("%s: reselect %s with active command\n", - dev->sc_dev.dv_xname, + device_xname(dev->sc_dev), csr == SBIC_CSR_RSLT_NI ? "NI" : "IFY"); } #endif @@ -2474,7 +2474,7 @@ sbicnextstate(struct sbic_softc *dev, u_ if (acb == NULL) { printf("%s: reselect %s targ %d not in nexus_list %p\n", - dev->sc_dev.dv_xname, + device_xname(dev->sc_dev), csr == SBIC_CSR_RSLT_NI ? "NI" : "IFY", newtarget, &dev->nexus_list.tqh_first); panic("bad reselect in sbic"); @@ -2627,7 +2627,7 @@ sbictimeout(struct sbic_softc *dev) if (dev->sc_dmatimo > 1) { - printf("%s: DMA timeout #%d\n", dev->sc_dev.dv_xname, + printf("%s: DMA timeout #%d\n", device_xname(dev->sc_dev), dev->sc_dmatimo - 1); GET_SBIC_asr(dev->sc_sbicp, asr); Index: sys/arch/mvme68k/dev/sbicvar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/mvme68k/dev/sbicvar.h,v retrieving revision 1.14 diff -u -p -r1.14 sbicvar.h --- sys/arch/mvme68k/dev/sbicvar.h 12 Jan 2008 09:54:27 -0000 1.14 +++ sys/arch/mvme68k/dev/sbicvar.h 27 Sep 2012 21:47:31 -0000 @@ -86,7 +86,7 @@ struct sbic_tinfo { }; struct sbic_softc { - struct device sc_dev; + device_t sc_dev; struct target_sync { u_char state; u_char period; Index: sys/arch/mvme68k/dev/vme_pcc.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/mvme68k/dev/vme_pcc.c,v retrieving revision 1.25 diff -u -p -r1.25 vme_pcc.c --- sys/arch/mvme68k/dev/vme_pcc.c 16 Mar 2009 23:11:13 -0000 1.25 +++ sys/arch/mvme68k/dev/vme_pcc.c 29 Sep 2012 13:47:17 -0000 @@ -61,10 +61,10 @@ __KERNEL_RCSID(0, "$NetBSD: vme_pcc.c,v #include -int vme_pcc_match(struct device *, struct cfdata *, void *); -void vme_pcc_attach(struct device *, struct device *, void *); +int vme_pcc_match(device_t, cfdata_t, void *); +void vme_pcc_attach(device_t, device_t, void *); -CFATTACH_DECL(vmepcc, sizeof(struct vme_pcc_softc), +CFATTACH_DECL_NEW(vmepcc, sizeof(struct vme_pcc_softc), vme_pcc_match, vme_pcc_attach, NULL, NULL); extern struct cfdriver vmepcc_cd; @@ -128,7 +128,7 @@ static struct mvmebus_range vme_pcc_mast /* ARGSUSED */ int -vme_pcc_match(struct device *parent, struct cfdata *cf, void *aux) +vme_pcc_match(device_t parent, cfdata_t cf, void *aux) { struct pcc_attach_args *pa; @@ -145,14 +145,15 @@ vme_pcc_match(struct device *parent, str } void -vme_pcc_attach(struct device *parent, struct device *self, void *aux) +vme_pcc_attach(device_t parent, device_t self, void *aux) { struct pcc_attach_args *pa; struct vme_pcc_softc *sc; vme_am_t am; uint8_t reg; - sc = (struct vme_pcc_softc *) self; + sc = device_private(self); + sc->sc_mvmebus.sc_dev = self; pa = aux; /* Map the VMEchip's registers */ @@ -252,7 +253,7 @@ vme_pcc_intr_establish(void *csc, int pr if (first) { evcnt_attach_dynamic(evcnt, EVCNT_TYPE_INTR, - isrlink_evcnt(prior), sc->sc_mvmebus.sc_dev.dv_xname, + isrlink_evcnt(prior), device_xname(sc->sc_mvmebus.sc_dev), mvmebus_irq_name[level]); /* Index: sys/arch/mvme68k/dev/vme_two_68k.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/mvme68k/dev/vme_two_68k.c,v retrieving revision 1.9 diff -u -p -r1.9 vme_two_68k.c --- sys/arch/mvme68k/dev/vme_two_68k.c 28 Apr 2008 20:23:29 -0000 1.9 +++ sys/arch/mvme68k/dev/vme_two_68k.c 29 Sep 2012 13:50:53 -0000 @@ -65,16 +65,16 @@ static struct evcnt *vmetwoisrevcnt(void #if NVMETWO > 0 -int vmetwo_match(struct device *, struct cfdata *, void *); -void vmetwo_attach(struct device *, struct device *, void *); +int vmetwo_match(device_t, cfdata_t, void *); +void vmetwo_attach(device_t, device_t, void *); -CFATTACH_DECL(vmetwo, sizeof(struct vmetwo_softc), +CFATTACH_DECL_NEW(vmetwo, sizeof(struct vmetwo_softc), vmetwo_match, vmetwo_attach, NULL, NULL); /* ARGSUSED */ int -vmetwo_match(struct device *parent, struct cfdata *cf, void *aux) +vmetwo_match(device_t parent, cfdata_t cf, void *aux) { struct mainbus_attach_args *ma; static int matched = 0; @@ -96,12 +96,13 @@ vmetwo_match(struct device *parent, stru /* ARGSUSED */ void -vmetwo_attach(struct device *parent, struct device *self, void *aux) +vmetwo_attach(device_t parent, device_t self, void *aux) { struct mainbus_attach_args *ma; struct vmetwo_softc *sc; - sc = (struct vmetwo_softc *) self; + sc = device_private(self); + sc->sc_mvmebus.sc_dev = self; ma = aux; /* Index: sys/arch/mvme68k/dev/wdsc.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/mvme68k/dev/wdsc.c,v retrieving revision 1.31 diff -u -p -r1.31 wdsc.c --- sys/arch/mvme68k/dev/wdsc.c 28 Apr 2008 20:23:29 -0000 1.31 +++ sys/arch/mvme68k/dev/wdsc.c 29 Sep 2012 10:58:34 -0000 @@ -85,10 +85,10 @@ __KERNEL_RCSID(0, "$NetBSD: wdsc.c,v 1.3 #include "ioconf.h" -void wdsc_pcc_attach(struct device *, struct device *, void *); -int wdsc_pcc_match(struct device *, struct cfdata *, void *); +void wdsc_pcc_attach(device_t, device_t, void *); +int wdsc_pcc_match(device_t, cfdata_t, void *); -CFATTACH_DECL(wdsc_pcc, sizeof(struct sbic_softc), +CFATTACH_DECL_NEW(wdsc_pcc, sizeof(struct sbic_softc), wdsc_pcc_match, wdsc_pcc_attach, NULL, NULL); void wdsc_enintr(struct sbic_softc *); @@ -102,9 +102,9 @@ int wdsc_scsiintr(void *); * Match for SCSI devices on the onboard WD33C93 chip */ int -wdsc_pcc_match(struct device *pdp, struct cfdata *cf, void *auxp) +wdsc_pcc_match(device_t parent, cfdata_t cf, void *aux) { - struct pcc_attach_args *pa = auxp; + struct pcc_attach_args *pa = aux; if (strcmp(pa->pa_name, wdsc_cd.cd_name)) return 0; @@ -117,15 +117,15 @@ wdsc_pcc_match(struct device *pdp, struc * Attach the wdsc driver */ void -wdsc_pcc_attach(struct device *pdp, struct device *dp, void *auxp) +wdsc_pcc_attach(device_t parent, device_t self, void *aux) { struct sbic_softc *sc; struct pcc_attach_args *pa; bus_space_handle_t bush; static struct evcnt evcnt; /* XXXSCW: Temporary hack */ - sc = (struct sbic_softc *)dp; - pa = auxp; + sc = device_private(self); + pa = aux; bus_space_map(pa->pa_bust, pa->pa_offset, 0x20, 0, &bush); @@ -141,7 +141,7 @@ wdsc_pcc_attach(struct device *pdp, stru sc->sc_dmastop = wdsc_dmastop; sc->sc_dmacmd = 0; - sc->sc_adapter.adapt_dev = &sc->sc_dev; + sc->sc_adapter.adapt_dev = self; sc->sc_adapter.adapt_nchannels = 1; sc->sc_adapter.adapt_openings = 7; sc->sc_adapter.adapt_max_periph = 1; @@ -184,13 +184,13 @@ wdsc_pcc_attach(struct device *pdp, stru pcc_reg_write(sys_pcc, PCCREG_DMA_CONTROL, 0); evcnt_attach_dynamic(&evcnt, EVCNT_TYPE_INTR, pccintr_evcnt(sc->sc_ipl), - "disk", sc->sc_dev.dv_xname); + "disk", device_xname(self)); pccintr_establish(PCCV_DMA, wdsc_dmaintr, sc->sc_ipl, sc, &evcnt); pccintr_establish(PCCV_SCSI, wdsc_scsiintr, sc->sc_ipl, sc, &evcnt); pcc_reg_write(sys_pcc, PCCREG_SCSI_INTR_CTRL, sc->sc_ipl | PCC_IENABLE | PCC_ICLEAR); - (void)config_found(dp, &sc->sc_channel, scsiprint); + (void)config_found(self, &sc->sc_channel, scsiprint); } /* Index: sys/arch/mvme68k/mvme68k/autoconf.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/mvme68k/mvme68k/autoconf.c,v retrieving revision 1.46 diff -u -p -r1.46 autoconf.c --- sys/arch/mvme68k/mvme68k/autoconf.c 29 Jul 2012 18:05:44 -0000 1.46 +++ sys/arch/mvme68k/mvme68k/autoconf.c 9 Oct 2012 01:16:43 -0000 @@ -95,7 +95,7 @@ cpu_rootconf(void) { printf("boot device: %s", - (booted_device) ? booted_device->dv_xname : ""); + (booted_device) ? device_xname(booted_device) : ""); if (bootpart) printf(" (partition %d)\n", bootpart); @@ -107,11 +107,11 @@ cpu_rootconf(void) } void -device_register(struct device *dev, void *aux) +device_register(device_t dev, void *aux) { - static struct device *controller; + static device_t controller; static int foundboot; - struct device *parent = device_parent(dev); + device_t parent = device_parent(dev); if (foundboot) return; Index: sys/arch/mvme68k/mvme68k/clock.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/mvme68k/mvme68k/clock.c,v retrieving revision 1.26 diff -u -p -r1.26 clock.c --- sys/arch/mvme68k/mvme68k/clock.c 12 Jan 2008 09:54:29 -0000 1.26 +++ sys/arch/mvme68k/mvme68k/clock.c 9 Oct 2012 01:28:32 -0000 @@ -75,7 +75,7 @@ int clock_statmin; /* statclock interva * Common parts of clock autoconfiguration. */ void -clock_config(struct device *dev, struct clock_attach_args *ca, struct evcnt *ev) +clock_config(device_t dev, struct clock_attach_args *ca, struct evcnt *ev) { extern int delay_divisor; /* from machdep.c */ @@ -83,9 +83,9 @@ clock_config(struct device *dev, struct clock_args = ca; evcnt_attach_dynamic(&clock_profcnt, EVCNT_TYPE_INTR, ev, - dev->dv_xname, "profint"); + device_xname(dev), "profint"); evcnt_attach_dynamic(&clock_statcnt, EVCNT_TYPE_INTR, ev, - dev->dv_xname, "statint"); + device_xname(dev), "statint"); /* Print info about the clock. */ printf(": delay_divisor %d\n", delay_divisor); Index: sys/arch/netwinder/include/pci_machdep.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/netwinder/include/pci_machdep.h,v retrieving revision 1.4 diff -u -p -r1.4 pci_machdep.h --- sys/arch/netwinder/include/pci_machdep.h 14 Mar 2009 14:46:03 -0000 1.4 +++ sys/arch/netwinder/include/pci_machdep.h 2 Oct 2012 01:49:05 -0000 @@ -5,8 +5,8 @@ #include -void netwinder_pci_attach_hook(struct device *, - struct device *, struct pcibus_attach_args *); +void netwinder_pci_attach_hook(device_t, device_t, + struct pcibus_attach_args *); #define __HAVE_PCIIDE_MACHDEP_COMPAT_INTR_ESTABLISH Index: sys/arch/netwinder/netwinder/autoconf.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/netwinder/netwinder/autoconf.c,v retrieving revision 1.11 diff -u -p -r1.11 autoconf.c --- sys/arch/netwinder/netwinder/autoconf.c 29 Jul 2012 18:05:45 -0000 1.11 +++ sys/arch/netwinder/netwinder/autoconf.c 9 Oct 2012 01:16:43 -0000 @@ -71,7 +71,7 @@ void cpu_rootconf(void) { printf("boot device: %s\n", - booted_device != NULL ? booted_device->dv_xname : ""); + booted_device != NULL ? device_xname(booted_device) : ""); rootconf(); } @@ -111,7 +111,7 @@ cpu_configure(void) } void -device_register(struct device *dev, void *aux) +device_register(device_t dev, void *aux) { } /* End of autoconf.c */ Index: sys/arch/netwinder/pci/pci_machdep.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/netwinder/pci/pci_machdep.c,v retrieving revision 1.6 diff -u -p -r1.6 pci_machdep.c --- sys/arch/netwinder/pci/pci_machdep.c 11 Dec 2005 12:18:20 -0000 1.6 +++ sys/arch/netwinder/pci/pci_machdep.c 2 Oct 2012 01:49:49 -0000 @@ -11,8 +11,8 @@ __KERNEL_RCSID(0, "$NetBSD: pci_machdep. #include void -netwinder_pci_attach_hook (struct device *parent, - struct device *self, struct pcibus_attach_args *pba) +netwinder_pci_attach_hook(device_t parent, device_t self, + struct pcibus_attach_args *pba) { pcireg_t regval; pcireg_t intreg; Index: sys/arch/netwinder/pci/pcib.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/netwinder/pci/pcib.c,v retrieving revision 1.15 diff -u -p -r1.15 pcib.c --- sys/arch/netwinder/pci/pcib.c 1 Jul 2011 20:50:34 -0000 1.15 +++ sys/arch/netwinder/pci/pcib.c 9 Oct 2012 01:02:34 -0000 @@ -97,7 +97,7 @@ pcibattach(device_t parent, device_t sel * callback. */ pci_devinfo(pa->pa_id, pa->pa_class, 0, devinfo, sizeof(devinfo)); - printf("%s: %s (rev. 0x%02x)\n", self->dv_xname, devinfo, + printf("%s: %s (rev. 0x%02x)\n", device_xname(self), devinfo, PCI_REVISION(pa->pa_class)); /* Set the ISA bus callback */ Index: sys/arch/netwinder/pci/pciide_machdep.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/netwinder/pci/pciide_machdep.c,v retrieving revision 1.7 diff -u -p -r1.7 pciide_machdep.c --- sys/arch/netwinder/pci/pciide_machdep.c 4 Apr 2011 20:37:52 -0000 1.7 +++ sys/arch/netwinder/pci/pciide_machdep.c 9 Oct 2012 01:18:06 -0000 @@ -57,7 +57,7 @@ __KERNEL_RCSID(0, "$NetBSD: pciide_machd #include "isa.h" void * -pciide_machdep_compat_intr_establish(struct device *dev, +pciide_machdep_compat_intr_establish(device_t dev, const struct pci_attach_args *pa, int chan, int (*func)(void *), void *arg) { #if NISA > 0 @@ -68,7 +68,7 @@ pciide_machdep_compat_intr_establish(str cookie = isa_intr_establish(NULL, irq, IST_EDGE, IPL_BIO, func, arg); if (cookie == NULL) return (NULL); - printf("%s: %s channel interrupting at irq %d\n", dev->dv_xname, + printf("%s: %s channel interrupting at irq %d\n", device_xname(dev), PCIIDE_CHANNEL_NAME(chan), irq); return (cookie); #else Index: sys/arch/news68k/news68k/autoconf.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/news68k/news68k/autoconf.c,v retrieving revision 1.21 diff -u -p -r1.21 autoconf.c --- sys/arch/news68k/news68k/autoconf.c 29 Jul 2012 18:05:45 -0000 1.21 +++ sys/arch/news68k/news68k/autoconf.c 9 Oct 2012 01:16:43 -0000 @@ -110,7 +110,7 @@ cpu_rootconf(void) findroot(); printf("boot device: %s\n", - booted_device ? booted_device->dv_xname : ""); + booted_device ? device_xname(booted_device) : ""); rootconf(); } Index: sys/arch/newsmips/apbus/if_sn.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/newsmips/apbus/if_sn.c,v retrieving revision 1.33 diff -u -p -r1.33 if_sn.c --- sys/arch/newsmips/apbus/if_sn.c 5 Apr 2010 07:19:31 -0000 1.33 +++ sys/arch/newsmips/apbus/if_sn.c 9 Oct 2012 01:28:41 -0000 @@ -204,7 +204,7 @@ snsetup(struct sn_softc *sc, uint8_t *ll #ifdef SNDEBUG aprint_debug_dev(sc->sc_dev, "buffers: rra=%p cda=%p rda=%p tda=%p\n", - sc->sc_dev.dv_xname, sc->p_rra[0], sc->p_cda, + device_xname(sc->sc_dev), sc->p_rra[0], sc->p_cda, sc->p_rda, sc->mtda[0].mtd_txp); #endif Index: sys/arch/newsmips/apbus/kb_ap.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/newsmips/apbus/kb_ap.c,v retrieving revision 1.9 diff -u -p -r1.9 kb_ap.c --- sys/arch/newsmips/apbus/kb_ap.c 9 Apr 2008 15:40:30 -0000 1.9 +++ sys/arch/newsmips/apbus/kb_ap.c 2 Oct 2012 02:02:28 -0000 @@ -66,7 +66,7 @@ struct kbreg { struct kb_ap_softc { device_t sc_dev; struct kbreg *sc_reg; - struct device *sc_wskbddev; + device_t sc_wskbddev; }; int kb_ap_match(device_t, cfdata_t, void *); Index: sys/arch/newsmips/apbus/ms_ap.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/newsmips/apbus/ms_ap.c,v retrieving revision 1.10 diff -u -p -r1.10 ms_ap.c --- sys/arch/newsmips/apbus/ms_ap.c 9 Apr 2008 15:40:30 -0000 1.10 +++ sys/arch/newsmips/apbus/ms_ap.c 2 Oct 2012 02:02:36 -0000 @@ -50,7 +50,7 @@ struct msreg { struct ms_ap_softc { device_t sc_dev; struct msreg *sc_reg; - struct device *sc_wsmousedev; + device_t sc_wsmousedev; int sc_ndata; uint8_t sc_buf[3]; }; Index: sys/arch/newsmips/dev/kb_hb.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/newsmips/dev/kb_hb.c,v retrieving revision 1.12 diff -u -p -r1.12 kb_hb.c --- sys/arch/newsmips/dev/kb_hb.c 9 Apr 2008 15:40:30 -0000 1.12 +++ sys/arch/newsmips/dev/kb_hb.c 2 Oct 2012 02:03:30 -0000 @@ -52,7 +52,7 @@ struct kbreg { struct kb_hb_softc { device_t sc_dev; struct kbreg *sc_reg; - struct device *sc_wskbddev; + device_t sc_wskbddev; }; int kb_hb_match(device_t, cfdata_t, void *); Index: sys/arch/newsmips/dev/ms_hb.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/newsmips/dev/ms_hb.c,v retrieving revision 1.13 diff -u -p -r1.13 ms_hb.c --- sys/arch/newsmips/dev/ms_hb.c 9 Apr 2008 15:40:30 -0000 1.13 +++ sys/arch/newsmips/dev/ms_hb.c 2 Oct 2012 02:03:37 -0000 @@ -50,7 +50,7 @@ struct msreg { struct ms_hb_softc { device_t sc_dev; struct msreg *sc_reg; - struct device *sc_wsmousedev; + device_t sc_wsmousedev; int sc_ndata; uint8_t sc_buf[3]; }; Index: sys/arch/newsmips/newsmips/autoconf.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/newsmips/newsmips/autoconf.c,v retrieving revision 1.36 diff -u -p -r1.36 autoconf.c --- sys/arch/newsmips/newsmips/autoconf.c 29 Jul 2012 18:05:45 -0000 1.36 +++ sys/arch/newsmips/newsmips/autoconf.c 9 Oct 2012 01:16:43 -0000 @@ -113,7 +113,7 @@ cpu_rootconf(void) findroot(); printf("boot device: %s\n", - booted_device ? booted_device->dv_xname : ""); + booted_device ? device_xname(booted_device) : ""); rootconf(); } Index: sys/arch/next68k/dev/esp.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/next68k/dev/esp.c,v retrieving revision 1.59 diff -u -p -r1.59 esp.c --- sys/arch/next68k/dev/esp.c 23 Nov 2009 00:11:45 -0000 1.59 +++ sys/arch/next68k/dev/esp.c 9 Oct 2012 01:28:54 -0000 @@ -137,7 +137,7 @@ bus_dmamap_t esp_dmacb_continue(void *); void esp_dmacb_completed(bus_dmamap_t, void *); void esp_dmacb_shutdown(void *); -static void findchannel_defer(struct device *); +static void findchannel_defer(device_t); #ifdef ESP_DEBUG char esp_dma_dump[5*1024] = ""; @@ -222,7 +222,7 @@ espmatch_intio(device_t parent, cfdata_t } static void -findchannel_defer(struct device *self) +findchannel_defer(device_t self) { struct esp_softc *esc = device_private(self); struct ncr53c9x_softc *sc = &esc->sc_ncr53c9x; @@ -278,7 +278,7 @@ findchannel_defer(struct device *self) device_xname(sc->sc_dev), "intr"); aprint_normal_dev(sc->sc_dev, "using DMA channel %s\n", - device_xname(&esc->sc_dma->sc_dev)); + device_xname(esc->sc_dma->sc_dev)); } void @@ -1645,7 +1645,7 @@ esp_dmacb_continue(void *arg) struct esp_softc *esc = (struct esp_softc *)sc; NDTRACEIF (*ndtracep++ = 'x'); - DPRINTF(("%s: DMA continue\n",sc->sc_dev.dv_xname)); + DPRINTF(("%s: DMA continue\n", device_xname(sc->sc_dev))); #ifdef DIAGNOSTIC if ((esc->sc_datain < 0) || (esc->sc_datain > 1)) { Index: sys/arch/next68k/dev/if_xe.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/next68k/dev/if_xe.c,v retrieving revision 1.21 diff -u -p -r1.21 if_xe.c --- sys/arch/next68k/dev/if_xe.c 24 Apr 2010 19:58:13 -0000 1.21 +++ sys/arch/next68k/dev/if_xe.c 2 Oct 2012 02:04:12 -0000 @@ -82,8 +82,8 @@ extern int ndtraceshow; extern int turbo; -int xe_match(struct device *, struct cfdata *, void *); -void xe_attach(struct device *, struct device *, void *); +int xe_match(device_t, cfdata_t, void *); +void xe_attach(device_t, device_t, void *); int xe_tint(void *); int xe_rint(void *); @@ -96,9 +96,9 @@ void xe_dma_tx_completed(bus_dmamap_t, v void xe_dma_rx_shutdown(void *); void xe_dma_tx_shutdown(void *); -static void findchannel_defer(struct device *); +static void findchannel_defer(device_t); -CFATTACH_DECL(xe, sizeof(struct xe_softc), +CFATTACH_DECL_NEW(xe, sizeof(struct xe_softc), xe_match, xe_attach, NULL, NULL); static int xe_dma_medias[] = { @@ -138,7 +138,7 @@ struct mb8795_glue xe_glue = { }; int -xe_match(struct device *parent, struct cfdata *match, void *aux) +xe_match(device_t parent, cfdata_t match, void *aux) { struct intio_attach_args *ia = (struct intio_attach_args *)aux; @@ -151,26 +151,27 @@ xe_match(struct device *parent, struct c } static void -findchannel_defer(struct device *self) +findchannel_defer(device_t self) { - struct xe_softc *xsc = (struct xe_softc *)self; + struct xe_softc *xsc = device_private(self); struct mb8795_softc *sc = &xsc->sc_mb8795; int i, error; if (!xsc->sc_txdma) { xsc->sc_txdma = nextdma_findchannel ("enetx"); if (xsc->sc_txdma == NULL) - panic ("%s: can't find enetx DMA channel", - sc->sc_dev.dv_xname); + panic("%s: can't find enetx DMA channel", + device_xname(sc->sc_dev)); } if (!xsc->sc_rxdma) { xsc->sc_rxdma = nextdma_findchannel ("enetr"); if (xsc->sc_rxdma == NULL) panic ("%s: can't find enetr DMA channel", - sc->sc_dev.dv_xname); + device_xname(sc->sc_dev)); } - printf ("%s: using DMA channels %s %s\n", sc->sc_dev.dv_xname, - xsc->sc_txdma->sc_dev.dv_xname, xsc->sc_rxdma->sc_dev.dv_xname); + aprint_normal_dev(sc->sc_dev, "using DMA channels %s %s\n", + device_xname(xsc->sc_txdma->sc_dev), + device_xname(xsc->sc_rxdma->sc_dev)); nextdma_setconf (xsc->sc_rxdma, continue_cb, xe_dma_rx_continue); nextdma_setconf (xsc->sc_rxdma, completed_cb, xe_dma_rx_completed); @@ -187,8 +188,8 @@ findchannel_defer(struct device *self) (MCLBYTES/MSIZE), MCLBYTES, 0, BUS_DMA_ALLOCNOW, &xsc->sc_tx_dmamap); if (error) { - panic("%s: can't create tx DMA map, error = %d", - sc->sc_dev.dv_xname, error); + aprint_error_dev(sc->sc_dev, "can't create tx DMA map, error = %d", + error); } for(i = 0; i < MB8795_NRXBUFS; i++) { @@ -197,7 +198,7 @@ findchannel_defer(struct device *self) &xsc->sc_rx_dmamap[i]); if (error) { panic("%s: can't create rx DMA map, error = %d", - sc->sc_dev.dv_xname, error); + device_xname(sc->sc_dev), error); } xsc->sc_rx_mb_head[i] = NULL; } @@ -211,7 +212,7 @@ findchannel_defer(struct device *self) */ xsc->sc_txbuf = malloc(2000, M_DEVBUF, M_NOWAIT); if (!xsc->sc_txbuf) - panic("%s: can't malloc tx DMA buffer", sc->sc_dev.dv_xname); + panic("%s: can't malloc tx DMA buffer", device_xname(sc->sc_dev)); xsc->sc_tx_mb_head = NULL; xsc->sc_tx_loaded = 0; @@ -225,13 +226,14 @@ findchannel_defer(struct device *self) } void -xe_attach(struct device *parent, struct device *self, void *aux) +xe_attach(device_t parent, device_t self, void *aux) { struct intio_attach_args *ia = (struct intio_attach_args *)aux; - struct xe_softc *xsc = (struct xe_softc *)self; + struct xe_softc *xsc = device_private(self); struct mb8795_softc *sc = &xsc->sc_mb8795; - DPRINTF(("%s: xe_attach()\n",sc->sc_dev.dv_xname)); + sc->sc_dev = self; + DPRINTF(("%s: xe_attach()\n", device_xname(self))); { extern u_char rom_enetaddr[6]; /* kludge from machdep.c:next68k_bootargs() */ @@ -242,7 +244,7 @@ xe_attach(struct device *parent, struct } printf("\n%s: MAC address %02x:%02x:%02x:%02x:%02x:%02x\n", - sc->sc_dev.dv_xname, + device_xname(self), sc->sc_enaddr[0],sc->sc_enaddr[1],sc->sc_enaddr[2], sc->sc_enaddr[3],sc->sc_enaddr[4],sc->sc_enaddr[5]); @@ -250,14 +252,14 @@ xe_attach(struct device *parent, struct if (bus_space_map(xsc->sc_bst, NEXT_P_ENET, XE_DEVICE_SIZE, 0, &xsc->sc_bsh)) { panic("\n%s: can't map mb8795 registers", - sc->sc_dev.dv_xname); + device_xname(self)); } sc->sc_bmap_bst = ia->ia_bst; if (bus_space_map(sc->sc_bmap_bst, NEXT_P_BMAP, BMAP_SIZE, 0, &sc->sc_bmap_bsh)) { panic("\n%s: can't map bmap registers", - sc->sc_dev.dv_xname); + device_xname(self)); } /* @@ -265,12 +267,12 @@ xe_attach(struct device *parent, struct */ sc->sc_glue = &xe_glue; - xsc->sc_txdma = nextdma_findchannel ("enetx"); - xsc->sc_rxdma = nextdma_findchannel ("enetr"); + xsc->sc_txdma = nextdma_findchannel("enetx"); + xsc->sc_rxdma = nextdma_findchannel("enetr"); if (xsc->sc_rxdma && xsc->sc_txdma) { - findchannel_defer (self); + findchannel_defer(self); } else { - config_defer (self, findchannel_defer); + config_defer(self, findchannel_defer); } attached = 1; @@ -482,8 +484,8 @@ xe_dma_tx_mbuf(struct mb8795_softc *sc, } #endif if (error) { - printf("%s: can't load mbuf chain, error = %d\n", - sc->sc_dev.dv_xname, error); + aprint_error_dev(sc->sc_dev, "can't load mbuf chain, error = %d\n", + error); m_freem(xsc->sc_tx_mb_head); xsc->sc_tx_mb_head = NULL; return (error); @@ -491,7 +493,7 @@ xe_dma_tx_mbuf(struct mb8795_softc *sc, #ifdef DIAGNOSTIC if (xsc->sc_tx_loaded != 0) { - panic("%s: xsc->sc_tx_loaded is %d",sc->sc_dev.dv_xname, + panic("%s: xsc->sc_tx_loaded is %d", device_xname(sc->sc_dev), xsc->sc_tx_loaded); } #endif @@ -522,14 +524,14 @@ xe_dma_tx_completed(bus_dmamap_t map, vo struct xe_softc *xsc = (struct xe_softc *)sc; #endif - DPRINTF(("%s: xe_dma_tx_completed()\n",sc->sc_dev.dv_xname)); + DPRINTF(("%s: xe_dma_tx_completed()\n", device_xname(sc->sc_dev))); #ifdef DIAGNOSTIC if (!xsc->sc_tx_loaded) { - panic("%s: tx completed never loaded",sc->sc_dev.dv_xname); + panic("%s: tx completed never loaded", device_xname(sc->sc_dev)); } if (map != xsc->sc_tx_dmamap) { - panic("%s: unexpected tx completed map",sc->sc_dev.dv_xname); + panic("%s: unexpected tx completed map", device_xname(sc->sc_dev)); } #endif @@ -542,11 +544,11 @@ xe_dma_tx_shutdown(void *arg) struct xe_softc *xsc = (struct xe_softc *)sc; struct ifnet *ifp = &sc->sc_ethercom.ec_if; - DPRINTF(("%s: xe_dma_tx_shutdown()\n",sc->sc_dev.dv_xname)); + DPRINTF(("%s: xe_dma_tx_shutdown()\n", device_xname(sc->sc_dev))); #ifdef DIAGNOSTIC if (!xsc->sc_tx_loaded) { - panic("%s: tx shutdown never loaded",sc->sc_dev.dv_xname); + panic("%s: tx shutdown never loaded", device_xname(sc->sc_dev)); } #endif @@ -565,7 +567,7 @@ xe_dma_tx_shutdown(void *arg) #ifdef DIAGNOSTIC if (xsc->sc_tx_loaded != 0) { - panic("%s: sc->sc_tx_loaded is %d",sc->sc_dev.dv_xname, + panic("%s: sc->sc_tx_loaded is %d", device_xname(sc->sc_dev), xsc->sc_tx_loaded); } #endif @@ -600,19 +602,19 @@ xe_dma_rx_completed(bus_dmamap_t map, vo xsc->sc_rx_completed_idx %= MB8795_NRXBUFS; DPRINTF(("%s: xe_dma_rx_completed(), sc->sc_rx_completed_idx = %d\n", - sc->sc_dev.dv_xname, xsc->sc_rx_completed_idx)); + device_xname(sc->sc_dev), xsc->sc_rx_completed_idx)); #if (defined(DIAGNOSTIC)) if (map != xsc->sc_rx_dmamap[xsc->sc_rx_completed_idx]) { panic("%s: Unexpected rx dmamap completed", - sc->sc_dev.dv_xname); + device_xname(sc->sc_dev)); } #endif } #ifdef DIAGNOSTIC else DPRINTF(("%s: Unexpected rx dmamap completed while if not running\n", - sc->sc_dev.dv_xname)); + device_xname(sc->sc_dev))); #endif } @@ -625,7 +627,7 @@ xe_dma_rx_shutdown(void *arg) if (ifp->if_flags & IFF_RUNNING) { DPRINTF(("%s: xe_dma_rx_shutdown(), restarting.\n", - sc->sc_dev.dv_xname)); + device_xname(sc->sc_dev))); nextdma_start(xsc->sc_rxdma, DMACSR_SETREAD); if (turbo) @@ -634,7 +636,7 @@ xe_dma_rx_shutdown(void *arg) #ifdef DIAGNOSTIC else DPRINTF(("%s: Unexpected rx DMA shutdown while if not running\n", - sc->sc_dev.dv_xname)); + device_xname(sc->sc_dev))); #endif } @@ -695,7 +697,7 @@ xe_dma_rxmap_load(struct mb8795_softc *s MCLBYTES, map->_dm_size)); panic("%s: can't load rx mbuf chain, error = %d", - sc->sc_dev.dv_xname, error); + device_xname(sc->sc_dev), error); m_freem(m); m = NULL; } @@ -719,7 +721,7 @@ xe_dma_rx_continue(void *arg) if (m) m_freem(m); #if (defined(DIAGNOSTIC)) - DPRINTF(("%s: out of receive DMA buffers\n",sc->sc_dev.dv_xname)); + DPRINTF(("%s: out of receive DMA buffers\n", device_xname(sc->sc_dev))); #endif } xsc->sc_rx_loaded_idx++; @@ -727,12 +729,12 @@ xe_dma_rx_continue(void *arg) map = xsc->sc_rx_dmamap[xsc->sc_rx_loaded_idx]; DPRINTF(("%s: xe_dma_rx_continue() xsc->sc_rx_loaded_idx = %d\nn", - sc->sc_dev.dv_xname,xsc->sc_rx_loaded_idx)); + device_xname(sc->sc_dev), xsc->sc_rx_loaded_idx)); } #ifdef DIAGNOSTIC else panic("%s: Unexpected rx DMA continue while if not running", - sc->sc_dev.dv_xname); + device_xname(sc->sc_dev)); #endif return(map); @@ -745,7 +747,7 @@ xe_dma_tx_continue(void *arg) struct xe_softc *xsc = (struct xe_softc *)sc; bus_dmamap_t map; - DPRINTF(("%s: xe_dma_tx_continue()\n",sc->sc_dev.dv_xname)); + DPRINTF(("%s: xe_dma_tx_continue()\n", device_xname(sc->sc_dev))); if (xsc->sc_tx_loaded) { map = NULL; @@ -756,7 +758,7 @@ xe_dma_tx_continue(void *arg) #ifdef DIAGNOSTIC if (xsc->sc_tx_loaded != 1) { - panic("%s: sc->sc_tx_loaded is %d",sc->sc_dev.dv_xname, + panic("%s: sc->sc_tx_loaded is %d", device_xname(sc->sc_dev), xsc->sc_tx_loaded); } #endif Index: sys/arch/next68k/dev/mb8795.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/next68k/dev/mb8795.c,v retrieving revision 1.50 diff -u -p -r1.50 mb8795.c --- sys/arch/next68k/dev/mb8795.c 2 Feb 2012 19:43:00 -0000 1.50 +++ sys/arch/next68k/dev/mb8795.c 26 Sep 2012 20:46:47 -0000 @@ -105,10 +105,10 @@ mb8795_config(struct mb8795_softc *sc, i { struct ifnet *ifp = &sc->sc_ethercom.ec_if; - DPRINTF(("%s: mb8795_config()\n",sc->sc_dev.dv_xname)); + DPRINTF(("%s: mb8795_config()\n",device_xname(sc->sc_dev))); /* Initialize ifnet structure. */ - memcpy(ifp->if_xname, sc->sc_dev.dv_xname, IFNAMSIZ); + memcpy(ifp->if_xname, device_xname(sc->sc_dev), IFNAMSIZ); ifp->if_softc = sc; ifp->if_start = mb8795_start; ifp->if_ioctl = mb8795_ioctl; @@ -137,10 +137,10 @@ mb8795_config(struct mb8795_softc *sc, i if (sc->sc_sh == NULL) panic("mb8795_config: can't establish shutdownhook"); - rnd_attach_source(&sc->rnd_source, sc->sc_dev.dv_xname, + rnd_attach_source(&sc->rnd_source, device_xname(sc->sc_dev), RND_TYPE_NET, 0); - DPRINTF(("%s: leaving mb8795_config()\n",sc->sc_dev.dv_xname)); + DPRINTF(("%s: leaving mb8795_config()\n",device_xname(sc->sc_dev))); } /* @@ -259,31 +259,31 @@ mb8795_rint(struct mb8795_softc *sc) if (rxstat & MB8795_RXSTAT_RESET) { DPRINTF(("%s: rx reset packet\n", - sc->sc_dev.dv_xname)); + device_xname(sc->sc_dev))); error++; } if (rxstat & MB8795_RXSTAT_SHORT) { DPRINTF(("%s: rx short packet\n", - sc->sc_dev.dv_xname)); + device_xname(sc->sc_dev))); error++; } if (rxstat & MB8795_RXSTAT_ALIGNERR) { DPRINTF(("%s: rx alignment error\n", - sc->sc_dev.dv_xname)); + device_xname(sc->sc_dev))); #if 0 error++; #endif } if (rxstat & MB8795_RXSTAT_CRCERR) { DPRINTF(("%s: rx CRC error\n", - sc->sc_dev.dv_xname)); + device_xname(sc->sc_dev))); #if 0 error++; #endif } if (rxstat & MB8795_RXSTAT_OVERFLOW) { DPRINTF(("%s: rx overflow error\n", - sc->sc_dev.dv_xname)); + device_xname(sc->sc_dev))); #if 0 error++; #endif @@ -311,7 +311,7 @@ mb8795_rint(struct mb8795_softc *sc) #if defined(MB8795_DEBUG) /* Peek at the packet */ DPRINTF(("%s: received packet, at VA %p-%p,len %d\n", - sc->sc_dev.dv_xname,mtod(m,u_char *),mtod(m,u_char *)+m->m_len,m->m_len)); + device_xname(sc->sc_dev),mtod(m,u_char *),mtod(m,u_char *)+m->m_len,m->m_len)); if (mb8795_debug > 3) { mb8795_hex_dump(mtod(m,u_char *), m->m_pkthdr.len); } else if (mb8795_debug > 2) { @@ -343,7 +343,7 @@ mb8795_rint(struct mb8795_softc *sc) snprintb(sbuf, sizeof(sbuf), MB8795_RXSTAT_BITS, rxstat); printf("%s: rx interrupt, rxstat = %s\n", - sc->sc_dev.dv_xname, sbuf); + device_xname(sc->sc_dev), sbuf); snprintb(sbuf, sizeof(sbuf), MB8795_RXSTAT_BITS, MB_READ_REG(sc, MB8795_RXSTAT)); @@ -393,19 +393,19 @@ mb8795_tint(struct mb8795_softc *sc) } if (txstat & MB8795_TXSTAT_SHORTED) { - printf("%s: tx cable shorted\n", sc->sc_dev.dv_xname); + printf("%s: tx cable shorted\n", device_xname(sc->sc_dev)); ifp->if_oerrors++; } if (txstat & MB8795_TXSTAT_UNDERFLOW) { - printf("%s: tx underflow\n", sc->sc_dev.dv_xname); + printf("%s: tx underflow\n", device_xname(sc->sc_dev)); ifp->if_oerrors++; } if (txstat & MB8795_TXSTAT_COLLERR) { - DPRINTF(("%s: tx collision\n", sc->sc_dev.dv_xname)); + DPRINTF(("%s: tx collision\n", device_xname(sc->sc_dev))); ifp->if_collisions++; } if (txstat & MB8795_TXSTAT_COLLERR16) { - printf("%s: tx 16th collision\n", sc->sc_dev.dv_xname); + printf("%s: tx 16th collision\n", device_xname(sc->sc_dev)); ifp->if_oerrors++; ifp->if_collisions += 16; } @@ -416,7 +416,7 @@ mb8795_tint(struct mb8795_softc *sc) snprintb(sbuf, sizeof(sbuf), MB8795_TXSTAT_BITS, txstat); panic("%s: unexpected tx interrupt %s", - sc->sc_dev.dv_xname, sbuf); + device_xname(sc->sc_dev), sbuf); /* turn interrupt off */ MB_WRITE_REG(sc, MB8795_TXMASK, txmask & ~MB8795_TXMASK_READYIE); @@ -436,7 +436,7 @@ mb8795_reset(struct mb8795_softc *sc) s = splnet(); - DPRINTF (("%s: mb8795_reset()\n",sc->sc_dev.dv_xname)); + DPRINTF (("%s: mb8795_reset()\n",device_xname(sc->sc_dev))); sc->sc_ethercom.ec_if.if_flags &= ~(IFF_RUNNING|IFF_OACTIVE); sc->sc_ethercom.ec_if.if_timer = 0; @@ -474,7 +474,7 @@ mb8795_reset(struct mb8795_softc *sc) } DPRINTF(("%s: initializing ethernet %02x:%02x:%02x:%02x:%02x:%02x, size=%d\n", - sc->sc_dev.dv_xname, + device_xname(sc->sc_dev), sc->sc_enaddr[0],sc->sc_enaddr[1],sc->sc_enaddr[2], sc->sc_enaddr[3],sc->sc_enaddr[4],sc->sc_enaddr[5], sizeof(sc->sc_enaddr))); @@ -489,11 +489,11 @@ mb8795_watchdog(struct ifnet *ifp) { struct mb8795_softc *sc = ifp->if_softc; - log(LOG_ERR, "%s: device timeout\n", sc->sc_dev.dv_xname); + log(LOG_ERR, "%s: device timeout\n", device_xname(sc->sc_dev)); ++ifp->if_oerrors; DPRINTF(("%s: %lld input errors, %lld input packets\n", - sc->sc_dev.dv_xname, ifp->if_ierrors, ifp->if_ipackets)); + device_xname(sc->sc_dev), ifp->if_ierrors, ifp->if_ipackets)); ifp->if_flags &= ~IFF_RUNNING; mb8795_init(sc); @@ -509,7 +509,7 @@ mb8795_init(struct mb8795_softc *sc) struct ifnet *ifp = &sc->sc_ethercom.ec_if; int s; - DPRINTF (("%s: mb8795_init()\n",sc->sc_dev.dv_xname)); + DPRINTF (("%s: mb8795_init()\n",device_xname(sc->sc_dev))); if (ifp->if_flags & IFF_UP) { int rxmode; @@ -559,7 +559,7 @@ mb8795_shutdown(void *arg) { struct mb8795_softc *sc = (struct mb8795_softc *)arg; - DPRINTF(("%s: mb8795_shutdown()\n",sc->sc_dev.dv_xname)); + DPRINTF(("%s: mb8795_shutdown()\n",device_xname(sc->sc_dev))); mb8795_reset(sc); } @@ -575,12 +575,12 @@ mb8795_ioctl(struct ifnet *ifp, u_long c s = splnet(); - DPRINTF(("%s: mb8795_ioctl()\n",sc->sc_dev.dv_xname)); + DPRINTF(("%s: mb8795_ioctl()\n",device_xname(sc->sc_dev))); switch (cmd) { case SIOCINITIFADDR: - DPRINTF(("%s: mb8795_ioctl() SIOCINITIFADDR\n",sc->sc_dev.dv_xname)); + DPRINTF(("%s: mb8795_ioctl() SIOCINITIFADDR\n",device_xname(sc->sc_dev))); ifp->if_flags |= IFF_UP; mb8795_init(sc); @@ -597,7 +597,7 @@ mb8795_ioctl(struct ifnet *ifp, u_long c case SIOCSIFFLAGS: - DPRINTF(("%s: mb8795_ioctl() SIOCSIFFLAGS\n",sc->sc_dev.dv_xname)); + DPRINTF(("%s: mb8795_ioctl() SIOCSIFFLAGS\n",device_xname(sc->sc_dev))); if ((error = ifioctl_common(ifp, cmd, data)) != 0) break; switch (ifp->if_flags & (IFF_UP|IFF_RUNNING)) { @@ -635,7 +635,7 @@ mb8795_ioctl(struct ifnet *ifp, u_long c case SIOCADDMULTI: case SIOCDELMULTI: DPRINTF(("%s: mb8795_ioctl() SIOCADDMULTI\n", - sc->sc_dev.dv_xname)); + device_xname(sc->sc_dev))); if ((error = ether_ioctl(ifp, cmd, data)) == ENETRESET) { /* * Multicast list has changed; set the hardware filter @@ -649,7 +649,7 @@ mb8795_ioctl(struct ifnet *ifp, u_long c case SIOCGIFMEDIA: case SIOCSIFMEDIA: - DPRINTF(("%s: mb8795_ioctl() SIOCSIFMEDIA\n",sc->sc_dev.dv_xname)); + DPRINTF(("%s: mb8795_ioctl() SIOCSIFMEDIA\n",device_xname(sc->sc_dev))); error = ifmedia_ioctl(ifp, ifr, &sc->sc_media, cmd); break; @@ -681,13 +681,13 @@ mb8795_start(struct ifnet *ifp) struct mbuf *m; int s; - DPRINTF(("%s: mb8795_start()\n",sc->sc_dev.dv_xname)); + DPRINTF(("%s: mb8795_start()\n",device_xname(sc->sc_dev))); #ifdef DIAGNOSTIC IFQ_POLL(&ifp->if_snd, m); if (m == 0) { panic("%s: No packet to start", - sc->sc_dev.dv_xname); + device_xname(sc->sc_dev)); } #endif @@ -730,7 +730,7 @@ mb8795_start_dma(struct mb8795_softc *sc struct mbuf *m; u_char txmask; - DPRINTF(("%s: mb8795_start_dma()\n",sc->sc_dev.dv_xname)); + DPRINTF(("%s: mb8795_start_dma()\n",device_xname(sc->sc_dev))); #if (defined(DIAGNOSTIC)) { @@ -741,7 +741,7 @@ mb8795_start_dma(struct mb8795_softc *sc * Let's see if I can just reset instead. [ dbj 980706.1900 ] */ printf("%s: transmitter not ready\n", - sc->sc_dev.dv_xname); + device_xname(sc->sc_dev)); ifp->if_flags &= ~IFF_RUNNING; mb8795_init(sc); return; @@ -757,7 +757,7 @@ mb8795_start_dma(struct mb8795_softc *sc if (m == 0) { #ifdef DIAGNOSTIC panic("%s: No packet to start_dma", - sc->sc_dev.dv_xname); + device_xname(sc->sc_dev)); #endif return; } Index: sys/arch/next68k/dev/mb8795var.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/next68k/dev/mb8795var.h,v retrieving revision 1.13 diff -u -p -r1.13 mb8795var.h --- sys/arch/next68k/dev/mb8795var.h 2 Feb 2012 19:43:00 -0000 1.13 +++ sys/arch/next68k/dev/mb8795var.h 26 Sep 2012 20:46:47 -0000 @@ -49,7 +49,7 @@ struct mb8795_glue { }; struct mb8795_softc { - struct device sc_dev; /* base device glue */ + device_t sc_dev; /* base device glue */ struct ethercom sc_ethercom; /* Ethernet common part */ struct mb8795_glue *sc_glue; /* glue to MD code */ Index: sys/arch/next68k/dev/nextdisplay.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/next68k/dev/nextdisplay.c,v retrieving revision 1.20 diff -u -p -r1.20 nextdisplay.c --- sys/arch/next68k/dev/nextdisplay.c 4 Mar 2007 06:00:27 -0000 1.20 +++ sys/arch/next68k/dev/nextdisplay.c 26 Sep 2012 22:19:47 -0000 @@ -57,10 +57,10 @@ __KERNEL_RCSID(0, "$NetBSD: nextdisplay. extern int turbo; -int nextdisplay_match(struct device *, struct cfdata *, void *); -void nextdisplay_attach(struct device *, struct device *, void *); +int nextdisplay_match(device_t, cfdata_t, void *); +void nextdisplay_attach(device_t, device_t, void *); -CFATTACH_DECL(nextdisplay, sizeof(struct nextdisplay_softc), +CFATTACH_DECL_NEW(nextdisplay, sizeof(struct nextdisplay_softc), nextdisplay_match, nextdisplay_attach, NULL, NULL); const struct wsdisplay_emulops nextdisplay_mono_emulops = { @@ -141,7 +141,7 @@ nextdisplay_is_console(vaddr_t addr) } int -nextdisplay_match(struct device *parent, struct cfdata *match, void *aux) +nextdisplay_match(device_t parent, cfdata_t match, void *aux) { if (rom_machine_type == NeXT_WARP9 || rom_machine_type == NeXT_X15 || @@ -226,9 +226,9 @@ nextdisplay_init(struct nextdisplay_conf } void -nextdisplay_attach(struct device *parent, struct device *self, void *aux) +nextdisplay_attach(device_t parent, device_t self, void *aux) { - struct nextdisplay_softc *sc = (void *)self; + struct nextdisplay_softc *sc = device_private(self); struct wsemuldisplaydev_attach_args waa; int isconsole; int iscolor; @@ -262,7 +262,7 @@ nextdisplay_attach(struct device *parent uint8_t x; x = *(volatile uint8_t *)IIOV(NEXT_P_C16_CMD_REG); - printf("%s: cmd=%02x\n", sc->sc_dev.dv_xname, x); + aprint_debug_dev(sc->sc_dev, "cmd=%02x\n", x); #endif *(volatile uint8_t *)IIOV(NEXT_P_C16_CMD_REG) = 0x05; isrlink_autovec(nextdisplay_intr, sc, NEXT_I_IPL(NEXT_I_C16_VIDEO), 1, NULL); Index: sys/arch/next68k/dev/nextdisplayvar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/next68k/dev/nextdisplayvar.h,v retrieving revision 1.4 diff -u -p -r1.4 nextdisplayvar.h --- sys/arch/next68k/dev/nextdisplayvar.h 11 Dec 2005 12:18:25 -0000 1.4 +++ sys/arch/next68k/dev/nextdisplayvar.h 26 Sep 2012 20:46:47 -0000 @@ -64,7 +64,7 @@ struct nextdisplay_config { }; struct nextdisplay_softc { - struct device sc_dev; + device_t sc_dev; struct nextdisplay_config *sc_dc; Index: sys/arch/next68k/dev/nextdma.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/next68k/dev/nextdma.c,v retrieving revision 1.47 diff -u -p -r1.47 nextdma.c --- sys/arch/next68k/dev/nextdma.c 6 Jun 2010 02:51:46 -0000 1.47 +++ sys/arch/next68k/dev/nextdma.c 26 Sep 2012 20:46:47 -0000 @@ -91,8 +91,8 @@ void nextdma_debug_enetr_dumpstate(void) #endif -int nextdma_match(struct device *, struct cfdata *, void *); -void nextdma_attach(struct device *, struct device *, void *); +int nextdma_match(device_t, cfdata_t, void *); +void nextdma_attach(device_t, device_t, void *); void nextdmamap_sync(bus_dma_tag_t, bus_dmamap_t, bus_addr_t, bus_size_t, int); int nextdma_continue(struct nextdma_softc *); @@ -113,7 +113,7 @@ static int nextdma_enet_intr(void *); #define nd_bsw4(reg,val) \ bus_space_write_4(nsc->sc_bst, nsc->sc_bsh, (reg), (val)) -CFATTACH_DECL(nextdma, sizeof(struct nextdma_softc), +CFATTACH_DECL_NEW(nextdma, sizeof(struct nextdma_softc), nextdma_match, nextdma_attach, NULL, NULL); static struct nextdma_channel nextdma_channel[] = { @@ -138,7 +138,7 @@ nextdma_findchannel(const char *name) for (dev = deviter_first(&di, DEVITER_F_ROOT_FIRST); dev != NULL; dev = deviter_next(&di)) { - if (strncmp(dev->dv_xname, "nextdma", 7) == 0) { + if (strncmp(device_xname(dev), "nextdma", 7) == 0) { struct nextdma_softc *nsc = device_private(dev); if (strcmp(nsc->sc_chan->nd_name, name) == 0) break; @@ -151,7 +151,7 @@ nextdma_findchannel(const char *name) } int -nextdma_match(struct device *parent, struct cfdata *match, void *aux) +nextdma_match(device_t parent, cfdata_t match, void *aux) { struct intio_attach_args *ia = (struct intio_attach_args *)aux; @@ -164,14 +164,15 @@ nextdma_match(struct device *parent, str } void -nextdma_attach(struct device *parent, struct device *self, void *aux) +nextdma_attach(device_t parent, device_t self, void *aux) { - struct nextdma_softc *nsc = (struct nextdma_softc *)self; + struct nextdma_softc *nsc = device_private(self); struct intio_attach_args *ia = (struct intio_attach_args *)aux; if (attached >= nnextdma_channels) return; + nsc->sc_dev = self; nsc->sc_chan = &nextdma_channel[attached]; nsc->sc_dmat = ia->ia_dmat; @@ -180,7 +181,7 @@ nextdma_attach(struct device *parent, st if (bus_space_map(nsc->sc_bst, nsc->sc_chan->nd_base, nsc->sc_chan->nd_size, 0, &nsc->sc_bsh)) { panic("%s: can't map DMA registers for channel %s", - nsc->sc_dev.dv_xname, nsc->sc_chan->nd_name); + device_xname(self), nsc->sc_chan->nd_name); } nextdma_init (nsc); Index: sys/arch/next68k/dev/nextdmavar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/next68k/dev/nextdmavar.h,v retrieving revision 1.15 diff -u -p -r1.15 nextdmavar.h --- sys/arch/next68k/dev/nextdmavar.h 24 Apr 2010 19:58:13 -0000 1.15 +++ sys/arch/next68k/dev/nextdmavar.h 26 Sep 2012 20:46:47 -0000 @@ -53,7 +53,7 @@ struct nextdma_status { }; struct nextdma_softc { - struct device sc_dev; + device_t sc_dev; struct nextdma_channel *sc_chan; bus_space_handle_t sc_bsh; /* bus space handle */ bus_space_tag_t sc_bst; /* bus space tag */ Index: sys/arch/next68k/dev/nextkbd.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/next68k/dev/nextkbd.c,v retrieving revision 1.13 diff -u -p -r1.13 nextkbd.c --- sys/arch/next68k/dev/nextkbd.c 5 Jan 2008 00:31:56 -0000 1.13 +++ sys/arch/next68k/dev/nextkbd.c 26 Sep 2012 21:34:18 -0000 @@ -79,12 +79,12 @@ struct mon_regs { static int attached = 0; -int nextkbd_match(struct device *, struct cfdata *, void *); -void nextkbd_attach(struct device *, struct device *, void *); +int nextkbd_match(device_t, cfdata_t, void *); +void nextkbd_attach(device_t, device_t, void *); int nextkbc_cnattach(bus_space_tag_t); -CFATTACH_DECL(nextkbd, sizeof(struct nextkbd_softc), +CFATTACH_DECL_NEW(nextkbd, sizeof(struct nextkbd_softc), nextkbd_match, nextkbd_attach, NULL, NULL); int nextkbd_enable(void *, int); @@ -125,7 +125,7 @@ nextkbd_is_console(bus_space_tag_t bst) } int -nextkbd_match(struct device *parent, struct cfdata *match, void *aux) +nextkbd_match(device_t parent, cfdata_t match, void *aux) { struct intio_attach_args *ia = (struct intio_attach_args *)aux; @@ -138,9 +138,9 @@ nextkbd_match(struct device *parent, str } void -nextkbd_attach(struct device *parent, struct device *self, void *aux) +nextkbd_attach(device_t parent, device_t self, void *aux) { - struct nextkbd_softc *sc = (struct nextkbd_softc *)self; + struct nextkbd_softc *sc = device_private(self); struct intio_attach_args *ia = (struct intio_attach_args *)aux; int isconsole; struct wskbddev_attach_args a; @@ -161,7 +161,7 @@ nextkbd_attach(struct device *parent, st sizeof(struct mon_regs), 0, &sc->id->ioh)) { printf("%s: can't map mon status control register\n", - sc->sc_dev.dv_xname); + device_xname(self)); return; } } Index: sys/arch/next68k/dev/nextkbdvar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/next68k/dev/nextkbdvar.h,v retrieving revision 1.4 diff -u -p -r1.4 nextkbdvar.h --- sys/arch/next68k/dev/nextkbdvar.h 11 Dec 2005 12:18:25 -0000 1.4 +++ sys/arch/next68k/dev/nextkbdvar.h 2 Oct 2012 02:04:25 -0000 @@ -32,10 +32,9 @@ int nextkbd_cnattach(bus_space_tag_t); struct nextkbd_softc { - struct device sc_dev; struct nextkbd_internal *id; - struct device *sc_wskbddev; + device_t sc_wskbddev; int enabled; /* XXX ? */ int sc_leds; Index: sys/arch/next68k/next68k/autoconf.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/next68k/next68k/autoconf.c,v retrieving revision 1.26 diff -u -p -r1.26 autoconf.c --- sys/arch/next68k/next68k/autoconf.c 29 Jul 2012 18:05:45 -0000 1.26 +++ sys/arch/next68k/next68k/autoconf.c 9 Oct 2012 01:16:43 -0000 @@ -70,7 +70,7 @@ __KERNEL_RCSID(0, "$NetBSD: autoconf.c,v volatile u_long *intrstat; volatile u_long *intrmask; -static struct device *getdevunit(const char *, int); +static device_t getdevunit(const char *, int); static int devidentparse(const char *, int *, int *, int *); static int atoi(const char *); @@ -142,7 +142,7 @@ cpu_rootconf(void) booted_device = getdevunit (rom_boot_dev, count); printf("boot device: %s\n", - (booted_device) ? booted_device->dv_xname : ""); + (booted_device) ? device_xname(booted_device) : ""); rootconf(); } @@ -150,7 +150,7 @@ cpu_rootconf(void) /* * find a device matching "name" and unit number */ -static struct device * +static device_t getdevunit(const char *name, int unit) { int i; Index: sys/arch/pmax/pmax/autoconf.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/pmax/pmax/autoconf.c,v retrieving revision 1.79 diff -u -p -r1.79 autoconf.c --- sys/arch/pmax/pmax/autoconf.c 29 Jul 2012 18:05:45 -0000 1.79 +++ sys/arch/pmax/pmax/autoconf.c 9 Oct 2012 01:16:43 -0000 @@ -62,9 +62,9 @@ __KERNEL_RCSID(0, "$NetBSD: autoconf.c,v #include "opt_dec_3100.h" #include "opt_dec_5100.h" -struct intrhand intrtab[MAX_DEV_NCOOKIES]; -static struct device *booted_controller; -static int booted_slot, booted_unit; +struct intrhand intrtab[MAX_DEV_NCOOKIES]; +static device_t booted_controller; +static int booted_slot, booted_unit; static const char *booted_protocol; /* @@ -149,7 +149,7 @@ cpu_rootconf(void) { printf("boot device: %s\n", - booted_device ? booted_device->dv_xname : ""); + booted_device ? device_xname(booted_device) : ""); rootconf(); } @@ -158,11 +158,11 @@ cpu_rootconf(void) * Try to determine the boot device. */ void -device_register(struct device *dev, void *aux) +device_register(device_t dev, void *aux) { static int found, initted, scsiboot, netboot; - static struct device *ioasicdev; - struct device *parent = device_parent(dev); + static device_t ioasicdev; + device_t parent = device_parent(dev); if (found) return; Index: sys/arch/pmax/pmax/dec_3100.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/pmax/pmax/dec_3100.c,v retrieving revision 1.52 diff -u -p -r1.52 dec_3100.c --- sys/arch/pmax/pmax/dec_3100.c 9 Jul 2011 17:32:30 -0000 1.52 +++ sys/arch/pmax/pmax/dec_3100.c 2 Oct 2012 02:05:59 -0000 @@ -102,7 +102,7 @@ static void dec_3100_bus_reset(void); static void dec_3100_cons_init(void); static void dec_3100_errintr(void); static void dec_3100_intr(uint32_t, vaddr_t, uint32_t); -static void dec_3100_intr_establish(struct device *, void *, +static void dec_3100_intr_establish(device_t, void *, int, int (*)(void *), void *); #define kn01_wbflush() wbflush() /* XXX to be corrected XXX */ @@ -221,7 +221,7 @@ dec_3100_intr(uint32_t status, vaddr_t p } static void -dec_3100_intr_establish(struct device *dev, void *cookie, int level, +dec_3100_intr_establish(device_t dev, void *cookie, int level, int (*handler)(void *), void *arg) { Index: sys/arch/pmax/pmax/dec_3max.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/pmax/pmax/dec_3max.c,v retrieving revision 1.54 diff -u -p -r1.54 dec_3max.c --- sys/arch/pmax/pmax/dec_3max.c 9 Jul 2011 17:32:30 -0000 1.54 +++ sys/arch/pmax/pmax/dec_3max.c 2 Oct 2012 02:06:17 -0000 @@ -220,7 +220,7 @@ static const struct { }; static void -dec_3max_intr_establish(struct device *dev, void *cookie, int level, +dec_3max_intr_establish(device_t dev, void *cookie, int level, int (*handler)(void *), void *arg) { int i; Index: sys/arch/pmax/pmax/dec_3maxplus.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/pmax/pmax/dec_3maxplus.c,v retrieving revision 1.68 diff -u -p -r1.68 dec_3maxplus.c --- sys/arch/pmax/pmax/dec_3maxplus.c 9 Jul 2011 17:32:30 -0000 1.68 +++ sys/arch/pmax/pmax/dec_3maxplus.c 2 Oct 2012 02:05:09 -0000 @@ -104,7 +104,7 @@ static void dec_3maxplus_bus_reset(void) static void dec_3maxplus_cons_init(void); static void dec_3maxplus_errintr(void); static void dec_3maxplus_intr(uint32_t, vaddr_t, uint32_t); -static void dec_3maxplus_intr_establish(struct device *, void *, +static void dec_3maxplus_intr_establish(device_t, void *, int, int (*)(void *), void *); static void kn03_wbflush(void); @@ -234,7 +234,7 @@ dec_3maxplus_cons_init(void) } static void -dec_3maxplus_intr_establish(struct device *dev, void *cookie, int level, +dec_3maxplus_intr_establish(device_t dev, void *cookie, int level, int (*handler)(void *), void *arg) { uint32_t mask; Index: sys/arch/pmax/pmax/dec_3min.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/pmax/pmax/dec_3min.c,v retrieving revision 1.71 diff -u -p -r1.71 dec_3min.c --- sys/arch/pmax/pmax/dec_3min.c 9 Jul 2011 17:32:30 -0000 1.71 +++ sys/arch/pmax/pmax/dec_3min.c 2 Oct 2012 02:06:39 -0000 @@ -102,7 +102,7 @@ void dec_3min_init(void); /* XXX */ static void dec_3min_bus_reset(void); static void dec_3min_cons_init(void); static void dec_3min_intr(uint32_t, vaddr_t, uint32_t); -static void dec_3min_intr_establish(struct device *, void *, +static void dec_3min_intr_establish(device_t, void *, int, int (*)(void *), void *); static void kn02ba_wbflush(void); @@ -233,7 +233,7 @@ dec_3min_cons_init(void) } static void -dec_3min_intr_establish(struct device *dev, void *cookie, int level, +dec_3min_intr_establish(device_t dev, void *cookie, int level, int (*handler)(void *), void *arg) { uint32_t mask; Index: sys/arch/pmax/pmax/dec_5100.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/pmax/pmax/dec_5100.c,v retrieving revision 1.46 diff -u -p -r1.46 dec_5100.c --- sys/arch/pmax/pmax/dec_5100.c 9 Jul 2011 17:32:30 -0000 1.46 +++ sys/arch/pmax/pmax/dec_5100.c 2 Oct 2012 02:06:51 -0000 @@ -63,7 +63,7 @@ void dec_5100_init(void); /* XXX */ static void dec_5100_bus_reset(void); static void dec_5100_cons_init(void); static void dec_5100_intr(uint32_t, vaddr_t, uint32_t); -static void dec_5100_intr_establish(struct device *, void *, +static void dec_5100_intr_establish(device_t, void *, int, int (*)(void *), void *); static void dec_5100_memintr(void); @@ -135,7 +135,7 @@ dec_5100_cons_init(void) } static void -dec_5100_intr_establish(struct device *dev, void *cookie, int level, +dec_5100_intr_establish(device_t dev, void *cookie, int level, int (*handler)(void *), void *arg) { Index: sys/arch/pmax/pmax/dec_maxine.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/pmax/pmax/dec_maxine.c,v retrieving revision 1.63 diff -u -p -r1.63 dec_maxine.c --- sys/arch/pmax/pmax/dec_maxine.c 9 Jul 2011 17:32:30 -0000 1.63 +++ sys/arch/pmax/pmax/dec_maxine.c 2 Oct 2012 02:06:27 -0000 @@ -101,7 +101,7 @@ void dec_maxine_init(void); /* XXX */ static void dec_maxine_bus_reset(void); static void dec_maxine_cons_init(void); static void dec_maxine_intr(uint32_t, vaddr_t, uint32_t); -static void dec_maxine_intr_establish(struct device *, void *, +static void dec_maxine_intr_establish(device_t, void *, int, int (*)(void *), void *); static void dec_maxine_tc_init(void); @@ -227,7 +227,7 @@ dec_maxine_cons_init(void) } static void -dec_maxine_intr_establish(struct device *dev, void *cookie, int level, +dec_maxine_intr_establish(device_t dev, void *cookie, int level, int (*handler)(void *), void *arg) { uint32_t mask; Index: sys/arch/pmax/tc/asc_ioasic.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/pmax/tc/asc_ioasic.c,v retrieving revision 1.24 diff -u -p -r1.24 asc_ioasic.c --- sys/arch/pmax/tc/asc_ioasic.c 9 Jul 2011 17:32:31 -0000 1.24 +++ sys/arch/pmax/tc/asc_ioasic.c 9 Oct 2012 01:29:02 -0000 @@ -218,7 +218,7 @@ asc_ioasic_setup(struct ncr53c9x_softc * size_t size; vaddr_t cp; - NCR_DMA(("%s: start %d@%p,%s\n", sc->sc_dev.dv_xname, + NCR_DMA(("%s: start %d@%p,%s\n", device_xname(sc->sc_dev), *asc->sc_dmalen, *asc->sc_dmaaddr, ispullup ? "IN" : "OUT")); /* upto two 4KB pages */ Index: sys/arch/pmax/tc/tcbus.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/pmax/tc/tcbus.c,v retrieving revision 1.28 diff -u -p -r1.28 tcbus.c --- sys/arch/pmax/tc/tcbus.c 9 Jul 2011 17:32:31 -0000 1.28 +++ sys/arch/pmax/tc/tcbus.c 2 Oct 2012 02:07:06 -0000 @@ -52,10 +52,10 @@ __KERNEL_RCSID(0, "$NetBSD: tcbus.c,v 1. #include #include -static const struct evcnt *tc_ds_intr_evcnt(struct device *, void *); -static void tc_ds_intr_establish(struct device *, void *, +static const struct evcnt *tc_ds_intr_evcnt(device_t, void *); +static void tc_ds_intr_establish(device_t, void *, int, int (*)(void *), void *); -static void tc_ds_intr_disestablish(struct device *, void *); +static void tc_ds_intr_disestablish(device_t, void *); static bus_dma_tag_t tc_ds_get_dma_tag(int); extern struct tcbus_attach_args kn02_tc_desc[]; /* XXX */ Index: sys/arch/prep/include/nvram.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/prep/include/nvram.h,v retrieving revision 1.7 diff -u -p -r1.7 nvram.h --- sys/arch/prep/include/nvram.h 30 Jun 2011 20:09:35 -0000 1.7 +++ sys/arch/prep/include/nvram.h 29 Sep 2012 12:18:43 -0000 @@ -220,8 +220,6 @@ struct prep_mk48txx_softc { }; struct nvram_pnpbus_softc { - struct device sc_dev; /* base device */ - bus_space_tag_t sc_iot; /* io space tag */ bus_space_tag_t sc_as; /* addr line */ bus_space_handle_t sc_ash; Index: sys/arch/prep/pnpbus/if_we_pnpbus.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/prep/pnpbus/if_we_pnpbus.c,v retrieving revision 1.8 diff -u -p -r1.8 if_we_pnpbus.c --- sys/arch/prep/pnpbus/if_we_pnpbus.c 1 Jul 2011 16:55:42 -0000 1.8 +++ sys/arch/prep/pnpbus/if_we_pnpbus.c 27 Sep 2012 21:29:55 -0000 @@ -82,7 +82,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_we_pnpbus int we_pnpbus_probe(device_t, cfdata_t, void *); void we_pnpbus_attach(device_t, device_t, void *); -CFATTACH_DECL(we_pnpbus, sizeof(struct we_softc), +CFATTACH_DECL_NEW(we_pnpbus, sizeof(struct we_softc), we_pnpbus_probe, we_pnpbus_attach, NULL, NULL); extern struct cfdriver we_cd; @@ -154,6 +154,8 @@ we_pnpbus_attach(device_t parent, device const char *typestr; int memfound = 0, i, irqnum; + sc->sc_dev = self; + nict = asict = pna->pna_iot; memt = pna->pna_memt; Index: sys/arch/prep/pnpbus/nvram_pnpbus.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/prep/pnpbus/nvram_pnpbus.c,v retrieving revision 1.16 diff -u -p -r1.16 nvram_pnpbus.c --- sys/arch/prep/pnpbus/nvram_pnpbus.c 18 Feb 2012 23:51:27 -0000 1.16 +++ sys/arch/prep/pnpbus/nvram_pnpbus.c 29 Sep 2012 12:18:34 -0000 @@ -83,7 +83,7 @@ void prep_nvram_write_val(int, uint8_t) uint8_t mkclock_pnpbus_nvrd(struct mk48txx_softc *, int); void mkclock_pnpbus_nvwr(struct mk48txx_softc *, int, uint8_t); -CFATTACH_DECL(nvram_pnpbus, sizeof(struct nvram_pnpbus_softc), +CFATTACH_DECL_NEW(nvram_pnpbus, sizeof(struct nvram_pnpbus_softc), nvram_pnpbus_probe, nvram_pnpbus_attach, NULL, NULL); dev_type_open(prep_nvramopen); Index: sys/arch/sbmips/sbmips/autoconf.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/sbmips/sbmips/autoconf.c,v retrieving revision 1.8 diff -u -p -r1.8 autoconf.c --- sys/arch/sbmips/sbmips/autoconf.c 29 Jul 2012 18:05:46 -0000 1.8 +++ sys/arch/sbmips/sbmips/autoconf.c 2 Oct 2012 02:07:20 -0000 @@ -67,7 +67,7 @@ cpu_rootconf(void) } void -device_register(struct device *dev, void *aux) +device_register(device_t dev, void *aux) { /* XXXCGD */ Index: sys/arch/sgimips/dev/dpclock.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/sgimips/dev/dpclock.c,v retrieving revision 1.3 diff -u -p -r1.3 dpclock.c --- sys/arch/sgimips/dev/dpclock.c 1 Jul 2011 18:53:46 -0000 1.3 +++ sys/arch/sgimips/dev/dpclock.c 27 Sep 2012 21:49:27 -0000 @@ -50,8 +50,6 @@ #include struct dpclock_softc { - struct device sc_dev; - struct todr_chip_handle sc_todrch; /* RTC registers */ @@ -59,16 +57,16 @@ struct dpclock_softc { bus_space_handle_t sc_rtch; }; -static int dpclock_match(struct device *, struct cfdata *, void *); -static void dpclock_attach(struct device *, struct device *, void *); +static int dpclock_match(device_t, cfdata_t, void *); +static void dpclock_attach(device_t, device_t, void *); static int dpclock_gettime(struct todr_chip_handle *, struct timeval *); static int dpclock_settime(struct todr_chip_handle *, struct timeval *); -CFATTACH_DECL(dpclock, sizeof(struct dpclock_softc), +CFATTACH_DECL_NEW(dpclock, sizeof(struct dpclock_softc), dpclock_match, dpclock_attach, NULL, NULL); static int -dpclock_match(struct device *parent, struct cfdata *cf, void *aux) +dpclock_match(device_t parent, cfdata_t cf, void *aux) { struct mainbus_attach_args *ma = aux; @@ -89,9 +87,9 @@ dpclock_match(struct device *parent, str } static void -dpclock_attach(struct device *parent, struct device *self, void *aux) +dpclock_attach(device_t parent, device_t self, void *aux) { - struct dpclock_softc *sc = (void *)self; + struct dpclock_softc *sc = device_private(self); struct mainbus_attach_args *ma = aux; int err; Index: sys/arch/sgimips/dev/imc.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/sgimips/dev/imc.c,v retrieving revision 1.32 diff -u -p -r1.32 imc.c --- sys/arch/sgimips/dev/imc.c 1 Jul 2011 18:53:46 -0000 1.32 +++ sys/arch/sgimips/dev/imc.c 27 Sep 2012 21:50:01 -0000 @@ -49,16 +49,14 @@ __KERNEL_RCSID(0, "$NetBSD: imc.c,v 1.32 #include "locators.h" struct imc_softc { - struct device sc_dev; - bus_space_tag_t iot; bus_space_handle_t ioh; int eisa_present; }; -static int imc_match(struct device *, struct cfdata *, void *); -static void imc_attach(struct device *, struct device *, void *); +static int imc_match(device_t, cfdata_t, void *); +static void imc_attach(device_t, device_t, void *); static int imc_print(void *, const char *); static void imc_bus_reset(void); static void imc_bus_error(vaddr_t, uint32_t, uint32_t); @@ -66,7 +64,7 @@ static void imc_watchdog_reset(void); static void imc_watchdog_disable(void); static void imc_watchdog_enable(void); -CFATTACH_DECL(imc, sizeof(struct imc_softc), +CFATTACH_DECL_NEW(imc, sizeof(struct imc_softc), imc_match, imc_attach, NULL, NULL); struct imc_attach_args { @@ -88,7 +86,7 @@ int imc_gio64_arb_config(int, uint32_t); struct imc_softc isc; static int -imc_match(struct device *parent, struct cfdata *match, void *aux) +imc_match(device_t parent, cfdata_t match, void *aux) { if ((mach_type == MACH_SGI_IP22) || (mach_type == MACH_SGI_IP20)) @@ -98,7 +96,7 @@ imc_match(struct device *parent, struct } static void -imc_attach(struct device *parent, struct device *self, void *aux) +imc_attach(device_t parent, device_t self, void *aux) { uint32_t reg; struct imc_attach_args iaa; Index: sys/arch/sgimips/dev/int.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/sgimips/dev/int.c,v retrieving revision 1.24 diff -u -p -r1.24 int.c --- sys/arch/sgimips/dev/int.c 1 Jul 2011 18:53:46 -0000 1.24 +++ sys/arch/sgimips/dev/int.c 9 Oct 2012 01:02:34 -0000 @@ -61,13 +61,8 @@ __KERNEL_RCSID(0, "$NetBSD: int.c,v 1.24 static bus_space_handle_t ioh; static bus_space_tag_t iot; -struct int_softc { - struct device sc_dev; -}; - - -static int int_match(struct device *, struct cfdata *, void *); -static void int_attach(struct device *, struct device *, void *); +static int int_match(device_t, cfdata_t, void *); +static void int_attach(device_t, device_t, void *); static void *int1_intr_establish(int, int, int (*)(void *), void *); static void *int2_intr_establish(int, int, int (*)(void *), void *); static void int1_local_intr(vaddr_t, uint32_t, uint32_t); @@ -80,7 +75,7 @@ static void int_8254_intr0(vaddr_t, uint static void int_8254_intr1(vaddr_t, uint32_t, uint32_t); #ifdef MIPS3 -static u_long int2_cpu_freq(struct device *); +static u_long int2_cpu_freq(device_t); static u_long int2_cal_timer(void); #endif @@ -97,11 +92,11 @@ static struct timecounter int_8254_timec static u_long int_8254_tc_count; -CFATTACH_DECL(int, sizeof(struct int_softc), +CFATTACH_DECL_NEW(int, 0, int_match, int_attach, NULL, NULL); static int -int_match(struct device *parent, struct cfdata *match, void *aux) +int_match(device_t parent, cfdata_t match, void *aux) { switch (mach_type) { @@ -116,7 +111,7 @@ int_match(struct device *parent, struct } static void -int_attach(struct device *parent, struct device *self, void *aux) +int_attach(device_t parent, device_t self, void *aux) { uint32_t address; @@ -450,7 +445,7 @@ int2_intr_establish(int level, int ipl, #ifdef MIPS3 static u_long -int2_cpu_freq(struct device *self) +int2_cpu_freq(device_t self) { int i; unsigned long cps; @@ -472,7 +467,7 @@ int2_cpu_freq(struct device *self) cps = cps / (sizeof(ctrdiff) / sizeof(ctrdiff[0])); printf("%s: bus %luMHz, CPU %luMHz\n", - self->dv_xname, cps / 10000, cps / 5000); + device_xname(self), cps / 10000, cps / 5000); /* R4k/R4400/R4600/R5k count at half CPU frequency */ return (2 * cps * hz); Index: sys/arch/sgimips/dev/pic.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/sgimips/dev/pic.c,v retrieving revision 1.15 diff -u -p -r1.15 pic.c --- sys/arch/sgimips/dev/pic.c 1 Jul 2011 18:53:46 -0000 1.15 +++ sys/arch/sgimips/dev/pic.c 27 Sep 2012 21:52:33 -0000 @@ -48,15 +48,12 @@ __KERNEL_RCSID(0, "$NetBSD: pic.c,v 1.15 #include "locators.h" struct pic_softc { - struct device sc_dev; - bus_space_tag_t iot; bus_space_handle_t ioh; - }; -static int pic_match(struct device *, struct cfdata *, void *); -static void pic_attach(struct device *, struct device *, void *); +static int pic_match(device_t, cfdata_t, void *); +static void pic_attach(device_t, device_t, void *); static int pic_print(void *, const char *); static void pic_bus_reset(void); static void pic_bus_error(vaddr_t, uint32_t, uint32_t); @@ -64,7 +61,7 @@ static void pic_watchdog_enable(void); static void pic_watchdog_disable(void); static void pic_watchdog_tickle(void); -CFATTACH_DECL(pic, sizeof(struct pic_softc), +CFATTACH_DECL_NEW(pic, 0, pic_match, pic_attach, NULL, NULL); struct pic_attach_args { @@ -79,7 +76,7 @@ int pic_gio32_arb_config(int, uint32_t); static struct pic_softc psc; static int -pic_match(struct device * parent, struct cfdata * match, void *aux) +pic_match(device_t parent, cfdata_t match, void *aux) { /* * PIC exists on IP12 systems. It appears to be the immediate @@ -92,7 +89,7 @@ pic_match(struct device * parent, struct } static void -pic_attach(struct device * parent, struct device * self, void *aux) +pic_attach(device_t parent, device_t self, void *aux) { uint32_t reg; struct pic_attach_args iaa; Index: sys/arch/sgimips/dev/scn.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/sgimips/dev/scn.c,v retrieving revision 1.3 diff -u -p -r1.3 scn.c --- sys/arch/sgimips/dev/scn.c 24 Apr 2011 16:26:57 -0000 1.3 +++ sys/arch/sgimips/dev/scn.c 27 Sep 2012 21:53:49 -0000 @@ -140,7 +140,7 @@ void scncnpollc(dev_t, int); int scninit(dev_t, int); void scncnreinit(void *); -CFATTACH_DECL(scn, sizeof(struct scn_softc), +CFATTACH_DECL_NEW(scn, sizeof(struct scn_softc), scn_match, scn_attach, NULL, NULL); extern struct cfdriver scn_cd; @@ -194,7 +194,7 @@ SOFTC(int unit) { if (unit < 0 || unit >= scn_cd.cd_ndevs) return (NULL); - return ((struct scn_softc *)scn_cd.cd_devs[unit]); + return device_private(scn_cd.cd_devs[unit]); } static int scnintr(void *); Index: sys/arch/sgimips/dev/scnvar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/sgimips/dev/scnvar.h,v retrieving revision 1.1 diff -u -p -r1.1 scnvar.h --- sys/arch/sgimips/dev/scnvar.h 10 Feb 2009 06:04:56 -0000 1.1 +++ sys/arch/sgimips/dev/scnvar.h 27 Sep 2012 21:53:16 -0000 @@ -113,7 +113,6 @@ struct duart { /* scn channel state */ struct scn_softc { - struct device sc_dev; struct tty *sc_tty; int sc_unit; /* unit number of this line (base 0) */ int sc_channel; Index: sys/arch/sgimips/dev/zs_kbd.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/sgimips/dev/zs_kbd.c,v retrieving revision 1.8 diff -u -p -r1.8 zs_kbd.c --- sys/arch/sgimips/dev/zs_kbd.c 29 Mar 2008 19:15:35 -0000 1.8 +++ sys/arch/sgimips/dev/zs_kbd.c 2 Oct 2012 02:07:52 -0000 @@ -110,7 +110,7 @@ struct zskbd_devconfig { uint8_t dip; /* wscons glue */ - struct device *wskbddev; + device_t *wskbddev; int enabled; }; Index: sys/arch/sgimips/dev/zs_ms.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/sgimips/dev/zs_ms.c,v retrieving revision 1.7 diff -u -p -r1.7 zs_ms.c --- sys/arch/sgimips/dev/zs_ms.c 29 Mar 2008 19:15:35 -0000 1.7 +++ sys/arch/sgimips/dev/zs_ms.c 2 Oct 2012 02:08:06 -0000 @@ -86,7 +86,7 @@ struct zsms_softc { /* wsmouse bits */ int enabled; - struct device *wsmousedev; + device_t wsmousedev; }; static int zsms_match(device_t, cfdata_t, void *); Index: sys/arch/sgimips/eisa/eisa_machdep.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/sgimips/eisa/eisa_machdep.c,v retrieving revision 1.7 diff -u -p -r1.7 eisa_machdep.c --- sys/arch/sgimips/eisa/eisa_machdep.c 1 Jul 2011 18:53:46 -0000 1.7 +++ sys/arch/sgimips/eisa/eisa_machdep.c 29 Sep 2012 10:23:19 -0000 @@ -79,7 +79,7 @@ __KERNEL_RCSID(0, "$NetBSD: eisa_machdep #include void -eisa_attach_hook(struct device *parent, struct device *self, struct eisabus_attach_args *eba) +eisa_attach_hook(device_t parent, device_t self, struct eisabus_attach_args *eba) { } Index: sys/arch/sgimips/gio/gio.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/sgimips/gio/gio.c,v retrieving revision 1.32 diff -u -p -r1.32 gio.c --- sys/arch/sgimips/gio/gio.c 1 Jul 2011 18:53:46 -0000 1.32 +++ sys/arch/sgimips/gio/gio.c 29 Sep 2012 10:23:04 -0000 @@ -78,19 +78,13 @@ extern int pic_gio32_arb_config(int, uin #endif -struct gio_softc { - struct device sc_dev; -}; - -static int gio_match(struct device *, struct cfdata *, void *); -static void gio_attach(struct device *, struct device *, void *); +static int gio_match(device_t, cfdata_t, void *); +static void gio_attach(device_t, device_t, void *); static int gio_print(void *, const char *); -static int gio_search(struct device *, struct cfdata *, - const int *, void *); -static int gio_submatch(struct device *, struct cfdata *, - const int *, void *); +static int gio_search(device_t, cfdata_t, const int *, void *); +static int gio_submatch(device_t, cfdata_t, const int *, void *); -CFATTACH_DECL(gio, sizeof(struct gio_softc), +CFATTACH_DECL_NEW(gio, 0, gio_match, gio_attach, NULL, NULL); struct gio_probe { @@ -174,7 +168,7 @@ static const struct gio_probe gfx_bases[ #define MAXGFX 8 static int -gio_match(struct device *parent, struct cfdata *match, void *aux) +gio_match(device_t parent, cfdata_t match, void *aux) { if (mach_type == MACH_SGI_IP12 || mach_type == MACH_SGI_IP20 || mach_type == MACH_SGI_IP22) @@ -184,7 +178,7 @@ gio_match(struct device *parent, struct } static void -gio_attach(struct device *parent, struct device *self, void *aux) +gio_attach(device_t parent, device_t self, void *aux) { struct gio_attach_args ga; uint32_t gfx[MAXGFX]; @@ -318,8 +312,7 @@ gio_print(void *aux, const char *pnp) } static int -gio_search(struct device *parent, struct cfdata *cf, - const int *ldesc, void *aux) +gio_search(device_t parent, cfdata_t cf, const int *ldesc, void *aux) { struct gio_attach_args *ga = aux; @@ -341,8 +334,7 @@ gio_search(struct device *parent, struct } static int -gio_submatch(struct device *parent, struct cfdata *cf, - const int *ldesc, void *aux) +gio_submatch(device_t parent, cfdata_t cf, const int *ldesc, void *aux) { struct gio_attach_args *ga = aux; Index: sys/arch/sgimips/gio/grtwo.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/sgimips/gio/grtwo.c,v retrieving revision 1.12 diff -u -p -r1.12 grtwo.c --- sys/arch/sgimips/gio/grtwo.c 11 Jan 2012 21:23:38 -0000 1.12 +++ sys/arch/sgimips/gio/grtwo.c 2 Oct 2012 02:08:37 -0000 @@ -55,8 +55,6 @@ __KERNEL_RCSID(0, "$NetBSD: grtwo.c,v 1. #include struct grtwo_softc { - struct device sc_dev; - struct grtwo_devconfig *sc_dc; }; @@ -84,10 +82,10 @@ struct grtwo_devconfig { struct wsdisplay_font *dc_fontdata; }; -static int grtwo_match(struct device *, struct cfdata *, void *); -static void grtwo_attach(struct device *, struct device *, void *); +static int grtwo_match(device_t, cfdata_t, void *); +static void grtwo_attach(device_t, device_t, void *); -CFATTACH_DECL(grtwo, sizeof(struct grtwo_softc), +CFATTACH_DECL_NEW(grtwo, sizeof(struct grtwo_softc), grtwo_match, grtwo_attach, NULL, NULL); /* textops */ @@ -441,7 +439,7 @@ grtwo_setup_hw(struct grtwo_devconfig * /* Attach routines */ static int -grtwo_match(struct device * parent, struct cfdata * self, void *aux) +grtwo_match(device_t parent, cfdata_t cf, void *aux) { struct gio_attach_args *ga = aux; @@ -496,10 +494,10 @@ grtwo_attach_common(struct grtwo_devconf } static void -grtwo_attach(struct device * parent, struct device * self, void *aux) +grtwo_attach(device_t parent, device_t self, void *aux) { struct gio_attach_args *ga = aux; - struct grtwo_softc *sc = (void *) self; + struct grtwo_softc *sc = device_private(self); struct wsemuldisplaydev_attach_args wa; if (grtwo_is_console && ga->ga_addr == grtwo_console_dc.dc_addr) { @@ -530,7 +528,7 @@ grtwo_attach(struct device * parent, str if ((cpu_intr_establish(6, IPL_TTY, grtwo_intr6, sc)) == NULL) printf(": unable to establish interrupt!\n"); - config_found(&sc->sc_dev, &wa, wsemuldisplaydevprint); + config_found(self, &wa, wsemuldisplaydevprint); } int Index: sys/arch/sgimips/gio/light.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/sgimips/gio/light.c,v retrieving revision 1.6 diff -u -p -r1.6 light.c --- sys/arch/sgimips/gio/light.c 11 Jan 2012 21:23:38 -0000 1.6 +++ sys/arch/sgimips/gio/light.c 29 Sep 2012 10:22:19 -0000 @@ -61,8 +61,6 @@ __KERNEL_RCSID(0, "$NetBSD: light.c,v 1. #include struct light_softc { - struct device sc_dev; - struct light_devconfig *sc_dc; }; @@ -82,10 +80,10 @@ struct light_devconfig { #define LIGHT_YRES 768 #define LIGHT_DEPTH 8 -static int light_match(struct device *, struct cfdata *, void *); -static void light_attach(struct device *, struct device *, void *); +static int light_match(device_t, cfdata_t, void *); +static void light_attach(device_t, device_t, void *); -CFATTACH_DECL(light, sizeof(struct light_softc), light_match, light_attach, +CFATTACH_DECL_NEW(light, sizeof(struct light_softc), light_match, light_attach, NULL, NULL); /* wsdisplay_emulops */ @@ -265,7 +263,7 @@ rex_fill_rect(struct light_devconfig *dc ******************************************************************************/ static int -light_match(struct device *parent, struct cfdata *self, void *aux) +light_match(device_t parent, cfdata_t cf, void *aux) { struct gio_attach_args *ga = aux; @@ -311,10 +309,10 @@ light_attach_common(struct light_devconf } static void -light_attach(struct device *parent, struct device *self, void *aux) +light_attach(device_t parent, device_t self, void *aux) { struct gio_attach_args *ga = aux; - struct light_softc *sc = (void *)self; + struct light_softc *sc = device_private(self); struct wsemuldisplaydev_attach_args wa; if (light_is_console && ga->ga_addr == light_console_dc.dc_addr) { @@ -340,7 +338,7 @@ light_attach(struct device *parent, stru wa.accessops = &light_accessops; wa.accesscookie = sc->sc_dc; - config_found(&sc->sc_dev, &wa, wsemuldisplaydevprint); + config_found(self, &wa, wsemuldisplaydevprint); } int Index: sys/arch/sgimips/gio/pci_gio.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/sgimips/gio/pci_gio.c,v retrieving revision 1.10 diff -u -p -r1.10 pci_gio.c --- sys/arch/sgimips/gio/pci_gio.c 27 Jan 2012 18:53:01 -0000 1.10 +++ sys/arch/sgimips/gio/pci_gio.c 27 Sep 2012 21:56:13 -0000 @@ -65,7 +65,6 @@ int giopci_debug = 0; #define DPRINTF(_x) if (giopci_debug) printf _x struct giopci_softc { - struct device sc_dev; struct sgimips_pci_chipset sc_pc; int sc_slot; int sc_gprid; @@ -74,8 +73,8 @@ struct giopci_softc { bus_space_handle_t sc_ioh; }; -static int giopci_match(struct device *, struct cfdata *, void *); -static void giopci_attach(struct device *, struct device *, void *); +static int giopci_match(device_t, cfdata_t, void *); +static void giopci_attach(device_t, device_t, void *); static int giopci_bus_maxdevs(pci_chipset_tag_t, int); static pcireg_t giopci_conf_read(pci_chipset_tag_t, pcitag_t, int); static void giopci_conf_write(pci_chipset_tag_t, pcitag_t, int, pcireg_t); @@ -99,11 +98,11 @@ static void giopci_intr_disestablish(voi #define SETENG_TLAN_START 0x00100000 #define SETENG_TLAN_END 0x001fffff -CFATTACH_DECL(giopci, sizeof(struct giopci_softc), +CFATTACH_DECL_NEW(giopci, sizeof(struct giopci_softc), giopci_match, giopci_attach, NULL, NULL); static int -giopci_match(struct device *parent, struct cfdata *match, void *aux) +giopci_match(device_t parent, cfdata_t match, void *aux) { struct gio_attach_args *ga = aux; int gprid; @@ -127,9 +126,9 @@ giopci_match(struct device *parent, stru } static void -giopci_attach(struct device *parent, struct device *self, void *aux) +giopci_attach(device_t parent, device_t self, void *aux) { - struct giopci_softc *sc = (void *)self; + struct giopci_softc *sc = device_private(self); pci_chipset_tag_t pc = &sc->sc_pc; struct gio_attach_args *ga = aux; uint32_t pci_off, pci_len, arb; @@ -193,7 +192,7 @@ giopci_attach(struct device *parent, str if (bus_space_subregion(ga->ga_iot, ga->ga_ioh, pci_off, pci_len, &sc->sc_ioh)) { - printf("%s: unable to map PCI registers\n",sc->sc_dev.dv_xname); + printf("%s: unable to map PCI registers\n", device_xname(self)); return; } sc->sc_pci_len = pci_len; Index: sys/arch/sgimips/hpc/hpc.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/sgimips/hpc/hpc.c,v retrieving revision 1.66 diff -u -p -r1.66 hpc.c --- sys/arch/sgimips/hpc/hpc.c 1 Jul 2011 18:53:46 -0000 1.66 +++ sys/arch/sgimips/hpc/hpc.c 29 Sep 2012 10:22:02 -0000 @@ -638,8 +638,7 @@ hpc_revision(struct hpc_softc *sc, struc } static int -hpc_submatch(struct device *parent, struct cfdata *cf, - const int *ldesc, void *aux) +hpc_submatch(device_t parent, cfdata_t cf, const int *ldesc, void *aux) { struct hpc_attach_args *ha = aux; Index: sys/arch/sgimips/include/eisa_machdep.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/sgimips/include/eisa_machdep.h,v retrieving revision 1.1 diff -u -p -r1.1 eisa_machdep.h --- sys/arch/sgimips/include/eisa_machdep.h 11 May 2001 04:36:15 -0000 1.1 +++ sys/arch/sgimips/include/eisa_machdep.h 2 Oct 2012 02:08:58 -0000 @@ -51,7 +51,7 @@ typedef int eisa_intr_handle_t; /* * Functions provided to machine-independent EISA code. */ -void eisa_attach_hook(struct device *, struct device *, +void eisa_attach_hook(device_t, device_t, struct eisabus_attach_args *); int eisa_maxslots(eisa_chipset_tag_t); int eisa_intr_map(eisa_chipset_tag_t, u_int, Index: sys/arch/sgimips/include/pci_machdep.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/sgimips/include/pci_machdep.h,v retrieving revision 1.10 diff -u -p -r1.10 pci_machdep.h --- sys/arch/sgimips/include/pci_machdep.h 11 May 2011 17:49:31 -0000 1.10 +++ sys/arch/sgimips/include/pci_machdep.h 2 Oct 2012 02:09:06 -0000 @@ -81,7 +81,7 @@ extern struct sgimips_bus_dma_tag pci_bu /* * Functions provided to machine-independent PCI code. */ -void pci_attach_hook(struct device *, struct device *, +void pci_attach_hook(device_t, device_t, struct pcibus_attach_args *); int pci_bus_maxdevs(pci_chipset_tag_t, int); pcitag_t pci_make_tag(pci_chipset_tag_t, int, int, int); Index: sys/arch/sgimips/ioc/ioc.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/sgimips/ioc/ioc.c,v retrieving revision 1.9 diff -u -p -r1.9 ioc.c --- sys/arch/sgimips/ioc/ioc.c 1 Jul 2011 18:53:47 -0000 1.9 +++ sys/arch/sgimips/ioc/ioc.c 2 Oct 2012 02:09:36 -0000 @@ -64,21 +64,18 @@ __KERNEL_RCSID(0, "$NetBSD: ioc.c,v 1.9 #include "locators.h" struct ioc_softc { - struct device sc_dev; - bus_space_tag_t sc_iot; bus_space_handle_t sc_ioh; }; -static int ioc_match(struct device *, struct cfdata *, void *); -static void ioc_attach(struct device *, struct device *, void *); +static int ioc_match(device_t, cfdata_t, void *); +static void ioc_attach(device_t, device_t, void *); #if defined(notyet) static int ioc_print(void *, const char *); -static int ioc_search(struct device *, struct cfdata *, - const int *, void *); +static int ioc_search(device_t, cfdata_t, const int *, void *); #endif -CFATTACH_DECL(ioc, sizeof(struct ioc_softc), +CFATTACH_DECL_NEW(ioc, sizeof(struct ioc_softc), ioc_match, ioc_attach, NULL, NULL); #if defined(BLINK) @@ -87,7 +84,7 @@ static void ioc_blink(void *); #endif static int -ioc_match(struct device * parent, struct cfdata * match, void *aux) +ioc_match(device_t parent, cfdata_t match, void *aux) { if (mach_type == MACH_SGI_IP22) return 1; @@ -96,9 +93,9 @@ ioc_match(struct device * parent, struct } static void -ioc_attach(struct device * parent, struct device * self, void *aux) +ioc_attach(device_t parent, device_t self, void *aux) { - struct ioc_softc *sc = (struct ioc_softc *) self; + struct ioc_softc *sc = device_private(self); struct mainbus_attach_args *maa = aux; u_int32_t sysid; @@ -182,10 +179,9 @@ ioc_print(void *aux, const char *pnp) } static int -ioc_search(struct device * parent, struct cfdata * cf, - const int *ldesc, void *aux) +ioc_search(device_t parent, cfdata_t cf, const int *ldesc, void *aux) { - struct ioc_softc *sc = (struct ioc_softc *) parent; + struct ioc_softc *sc = device_private(parent); struct ioc_attach_args iaa; int tryagain; @@ -210,7 +206,7 @@ ioc_search(struct device * parent, struc static void ioc_blink(void *self) { - struct ioc_softc *sc = (struct ioc_softc *) self; + struct ioc_softc *sc = device_private(self); register int s; int value; Index: sys/arch/sgimips/ioc/oioc.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/sgimips/ioc/oioc.c,v retrieving revision 1.2 diff -u -p -r1.2 oioc.c --- sys/arch/sgimips/ioc/oioc.c 1 Jul 2011 18:53:47 -0000 1.2 +++ sys/arch/sgimips/ioc/oioc.c 2 Oct 2012 02:35:53 -0000 @@ -56,19 +56,17 @@ __KERNEL_RCSID(0, "$NetBSD: oioc.c,v 1.2 #include "locators.h" struct oioc_softc { - struct device sc_dev; - int sc_burst_dma; bus_space_tag_t sc_iot; bus_space_handle_t sc_ioh; }; -static int oioc_match(struct device *, struct cfdata *, void *); -static void oioc_attach(struct device *, struct device *, void *); +static int oioc_match(device_t, cfdata_t, void *); +static void oioc_attach(device_t, device_t, void *); static int oioc_print(void *, const char *); -CFATTACH_DECL(oioc, sizeof(struct oioc_softc), +CFATTACH_DECL_NEW(oioc, sizeof(struct oioc_softc), oioc_match, oioc_attach, NULL, NULL); struct oioc_device { @@ -81,7 +79,7 @@ struct oioc_device { }; static int -oioc_match(struct device * parent, struct cfdata * match, void *aux) +oioc_match(device_t parent, cfdata_t match, void *aux) { switch(mach_type) { @@ -94,9 +92,9 @@ oioc_match(struct device * parent, struc } static void -oioc_attach(struct device * parent, struct device * self, void *aux) +oioc_attach(device_t parent, device_t self, void *aux) { - struct oioc_softc *sc = (struct oioc_softc *)self; + struct oioc_softc *sc = device_private(self); struct mainbus_attach_args *ma = aux; uint32_t reg1, reg2; int oiocrev, i; Index: sys/arch/sgimips/mace/mace.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/sgimips/mace/mace.c,v retrieving revision 1.18 diff -u -p -r1.18 mace.c --- sys/arch/sgimips/mace/mace.c 18 Aug 2011 03:25:34 -0000 1.18 +++ sys/arch/sgimips/mace/mace.c 9 Oct 2012 01:02:34 -0000 @@ -99,11 +99,10 @@ struct mace_softc { void *isa_ringbuffer; }; -static int mace_match(struct device *, struct cfdata *, void *); -static void mace_attach(struct device *, struct device *, void *); +static int mace_match(device_t, cfdata_t, void *); +static void mace_attach(device_t, device_t, void *); static int mace_print(void *, const char *); -static int mace_search(struct device *, struct cfdata *, - const int *, void *); +static int mace_search(device_t, cfdata_t, const int *, void *); CFATTACH_DECL_NEW(mace, sizeof(struct mace_softc), mace_match, mace_attach, NULL, NULL); @@ -147,9 +146,9 @@ mace_attach(device_t parent, device_t se aprint_normal("\n"); - aprint_debug("%s: isa sts %#"PRIx64"\n", self->dv_xname, + aprint_debug("%s: isa sts %#"PRIx64"\n", device_xname(self), bus_space_read_8(sc->iot, sc->ioh, MACE_ISA_INT_STATUS)); - aprint_debug("%s: isa msk %#"PRIx64"\n", self->dv_xname, + aprint_debug("%s: isa msk %#"PRIx64"\n", device_xname(self), bus_space_read_8(sc->iot, sc->ioh, MACE_ISA_INT_MASK)); /* @@ -203,8 +202,7 @@ mace_print(void *aux, const char *pnp) } static int -mace_search(device_t parent, struct cfdata *cf, - const int *ldesc, void *aux) +mace_search(device_t parent, struct cfdata *cf, const int *ldesc, void *aux) { struct mace_softc *sc = device_private(parent); struct mace_attach_args maa; @@ -327,7 +325,7 @@ mace_intr(int irqs) static void mace_blink(void *self) { - struct mace_softc *sc = (struct mace_softc *) self; + struct mace_softc *sc = device_private(self); register int s; int value; Index: sys/arch/sgimips/mace/macekbc.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/sgimips/mace/macekbc.c,v retrieving revision 1.6 diff -u -p -r1.6 macekbc.c --- sys/arch/sgimips/mace/macekbc.c 1 Jul 2011 18:53:47 -0000 1.6 +++ sys/arch/sgimips/mace/macekbc.c 27 Sep 2012 21:57:19 -0000 @@ -61,7 +61,6 @@ __KERNEL_RCSID(0, "$NetBSD: macekbc.c,v #define MACEKBC_STAT_RXFULL (1 << 4) struct macekbc_softc { - struct device sc_dev; struct macekbc_internal *sc_id; bus_space_tag_t sc_iot; @@ -89,10 +88,10 @@ static void macekbc_slot_enable(void *, static void macekbc_intr_establish(void *, pckbport_slot_t); static void macekbc_set_poll(void *, pckbport_slot_t, int); -static int macekbc_match(struct device *, struct cfdata *, void *); -static void macekbc_attach(struct device *, struct device *, void *); +static int macekbc_match(device_t, cfdata_t, void *); +static void macekbc_attach(device_t, device_t, void *); -CFATTACH_DECL(macekbc, sizeof(struct macekbc_softc), +CFATTACH_DECL_NEW(macekbc, sizeof(struct macekbc_softc), macekbc_match, macekbc_attach, NULL, NULL); static struct pckbport_accessops macekbc_ops = { @@ -105,14 +104,14 @@ static struct pckbport_accessops macekbc }; static int -macekbc_match(struct device *parent, struct cfdata *match, void *aux) +macekbc_match(device_t parent, cfdata_t match, void *aux) { return 1; } static void -macekbc_attach(struct device *parent, struct device *self, void *aux) +macekbc_attach(device_t parent, device_t self, void *aux) { struct mace_attach_args *maa; struct macekbc_softc *sc; @@ -164,9 +163,9 @@ macekbc_attach(struct device *parent, st pckbport_cnattach(t, &macekbc_ops, PCKBPORT_KBD_SLOT); t->t_pt = pckbport_attach(t, &macekbc_ops); - if (pckbport_attach_slot(&sc->sc_dev, t->t_pt, PCKBPORT_KBD_SLOT)) + if (pckbport_attach_slot(self, t->t_pt, PCKBPORT_KBD_SLOT)) t->t_present[PCKBPORT_KBD_SLOT] = 1; - if (pckbport_attach_slot(&sc->sc_dev, t->t_pt, PCKBPORT_AUX_SLOT)) + if (pckbport_attach_slot(self, t->t_pt, PCKBPORT_AUX_SLOT)) t->t_present[PCKBPORT_AUX_SLOT] = 1; return; Index: sys/arch/sgimips/mace/mavb.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/sgimips/mace/mavb.c,v retrieving revision 1.8 diff -u -p -r1.8 mavb.c --- sys/arch/sgimips/mace/mavb.c 23 Nov 2011 23:07:30 -0000 1.8 +++ sys/arch/sgimips/mace/mavb.c 27 Sep 2012 21:59:10 -0000 @@ -117,7 +117,7 @@ static const struct audio_format mavb_fo }; struct mavb_softc { - struct device sc_dev; + device_t sc_dev; kmutex_t sc_lock; kmutex_t sc_intr_lock; bus_space_tag_t sc_st; @@ -244,10 +244,10 @@ uint16_t ad1843_reg_read(struct mavb_sof uint16_t ad1843_reg_write(struct mavb_softc *, ad1843_addr_t, uint16_t); void ad1843_dump_regs(struct mavb_softc *); -int mavb_match(struct device *, struct cfdata *, void *); -void mavb_attach(struct device *, struct device *, void *); +int mavb_match(device_t, cfdata_t, void *); +void mavb_attach(device_t, device_t, void *); -CFATTACH_DECL(mavb, sizeof(struct mavb_softc), +CFATTACH_DECL_NEW(mavb, sizeof(struct mavb_softc), mavb_match, mavb_attach, NULL, NULL); int mavb_open(void *, int); @@ -386,7 +386,7 @@ mavb_set_params(void *hdl, int setmode, int error; DPRINTF(1, ("%s: mavb_set_params: sample=%u precision=%d " - "channels=%d\n", sc->sc_dev.dv_xname, play->sample_rate, + "channels=%d\n", device_xname(sc->sc_dev), play->sample_rate, play->precision, play->channels)); if (setmode & AUMODE_PLAY) { @@ -437,7 +437,7 @@ mavb_halt_output(void *hdl) { struct mavb_softc *sc = (struct mavb_softc *)hdl; - DPRINTF(1, ("%s: mavb_halt_output called\n", sc->sc_dev.dv_xname)); + DPRINTF(1, ("%s: mavb_halt_output called\n", device_xname(sc->sc_dev))); bus_space_write_8(sc->sc_st, sc->sc_sh, MAVB_CHANNEL2_CONTROL, 0); return 0; @@ -466,7 +466,7 @@ mavb_set_port(void *hdl, struct mixer_ct ad1843_addr_t reg; uint16_t value; - DPRINTF(1, ("%s: mavb_set_port: dev=%d\n", sc->sc_dev.dv_xname, + DPRINTF(1, ("%s: mavb_set_port: dev=%d\n", device_xname(sc->sc_dev), mc->dev)); switch (mc->dev) { @@ -589,7 +589,7 @@ mavb_get_port(void *hdl, struct mixer_ct ad1843_addr_t reg; uint16_t value; - DPRINTF(1, ("%s: mavb_get_port: dev=%d\n", sc->sc_dev.dv_xname, + DPRINTF(1, ("%s: mavb_get_port: dev=%d\n", device_xname(sc->sc_dev), mc->dev)); switch (mc->dev) { @@ -896,7 +896,7 @@ mavb_trigger_output(void *hdl, void *sta struct mavb_softc *sc = (struct mavb_softc *)hdl; DPRINTF(1, ("%s: mavb_trigger_output: start=%p end=%p " - "blksize=%d intr=%p(%p)\n", sc->sc_dev.dv_xname, + "blksize=%d intr=%p(%p)\n", device_xname(sc->sc_dev), start, end, blksize, intr, intrarg)); sc->sc_blksize = blksize; @@ -946,7 +946,7 @@ mavb_button_repeat(void *hdl) uint64_t intmask, control; uint16_t value, left, right; - DPRINTF(1, ("%s: mavb_repeat called\n", sc->sc_dev.dv_xname)); + DPRINTF(1, ("%s: mavb_repeat called\n", device_xname(sc->sc_dev))); #define MAVB_CONTROL_VOLUME_BUTTONS \ (MAVB_CONTROL_VOLUME_BUTTON_UP | MAVB_CONTROL_VOLUME_BUTTON_DOWN) @@ -999,7 +999,7 @@ mavb_intr(void *arg) stat = bus_space_read_8(sc->sc_st, sc->sc_isash, MACE_ISA_INT_STATUS); DPRINTF(MAVB_DEBUG_INTR, ("%s: mavb_intr: stat = 0x%llx\n", - sc->sc_dev.dv_xname, stat)); + device_xname(sc->sc_dev), stat)); if (stat & MACE_ISA_INT_AUDIO_SC) { /* Disable volume button interrupts. */ @@ -1022,22 +1022,24 @@ mavb_intr(void *arg) } int -mavb_match(struct device *parent, struct cfdata *match, void *aux) +mavb_match(device_t parent, cfdata_t match, void *aux) { return 1; } void -mavb_attach(struct device *parent, struct device *self, void *aux) +mavb_attach(device_t parent, device_t self, void *aux) { - struct mavb_softc *sc = (void *)self; + struct mavb_softc *sc = device_private(self); struct mace_attach_args *maa = aux; bus_dma_segment_t seg; uint64_t control; uint16_t value; int rseg, err; + sc->sc_dev = self; + mutex_init(&sc->sc_lock, MUTEX_DEFAULT, IPL_NONE); mutex_init(&sc->sc_intr_lock, MUTEX_DEFAULT, IPL_SCHED); @@ -1163,7 +1165,7 @@ mavb_attach(struct device *parent, struc callout_init(&sc->sc_volume_button_ch, 0); - audio_attach_mi(&mavb_sa_hw_if, sc, &sc->sc_dev); + audio_attach_mi(&mavb_sa_hw_if, sc, self); return; } Index: sys/arch/sgimips/mace/pci_mace.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/sgimips/mace/pci_mace.c,v retrieving revision 1.14 diff -u -p -r1.14 pci_mace.c --- sys/arch/sgimips/mace/pci_mace.c 27 Jan 2012 18:53:01 -0000 1.14 +++ sys/arch/sgimips/mace/pci_mace.c 27 Sep 2012 21:59:28 -0000 @@ -66,13 +66,11 @@ __KERNEL_RCSID(0, "$NetBSD: pci_mace.c,v #include struct macepci_softc { - struct device sc_dev; - struct sgimips_pci_chipset sc_pc; }; -static int macepci_match(struct device *, struct cfdata *, void *); -static void macepci_attach(struct device *, struct device *, void *); +static int macepci_match(device_t, cfdata_t, void *); +static void macepci_attach(device_t, device_t, void *); static int macepci_bus_maxdevs(pci_chipset_tag_t, int); static pcireg_t macepci_conf_read(pci_chipset_tag_t, pcitag_t, int); static void macepci_conf_write(pci_chipset_tag_t, pcitag_t, int, pcireg_t); @@ -82,20 +80,20 @@ static const char * macepci_intr_string(pci_chipset_tag_t, pci_intr_handle_t); static int macepci_intr(void *); -CFATTACH_DECL(macepci, sizeof(struct macepci_softc), +CFATTACH_DECL_NEW(macepci, sizeof(struct macepci_softc), macepci_match, macepci_attach, NULL, NULL); static int -macepci_match(struct device *parent, struct cfdata *match, void *aux) +macepci_match(device_t parent, cfdata_t match, void *aux) { return (1); } static void -macepci_attach(struct device *parent, struct device *self, void *aux) +macepci_attach(device_t parent, device_t self, void *aux) { - struct macepci_softc *sc = (struct macepci_softc *)self; + struct macepci_softc *sc = device_private(self); pci_chipset_tag_t pc = &sc->sc_pc; struct mace_attach_args *maa = aux; struct pcibus_attach_args pba; Index: sys/arch/sgimips/pci/pci_machdep.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/sgimips/pci/pci_machdep.c,v retrieving revision 1.22 diff -u -p -r1.22 pci_machdep.c --- sys/arch/sgimips/pci/pci_machdep.c 1 Jul 2011 18:53:47 -0000 1.22 +++ sys/arch/sgimips/pci/pci_machdep.c 29 Sep 2012 10:21:50 -0000 @@ -60,7 +60,7 @@ __KERNEL_RCSID(0, "$NetBSD: pci_machdep. struct sgimips_bus_dma_tag pci_bus_dma_tag; void -pci_attach_hook(struct device *parent, struct device *self, struct pcibus_attach_args *pba) +pci_attach_hook(device_t parent, device_t self, struct pcibus_attach_args *pba) { /* * PCI doesn't have any special needs; just use Index: sys/arch/sgimips/sgimips/autoconf.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/sgimips/sgimips/autoconf.c,v retrieving revision 1.43 diff -u -p -r1.43 autoconf.c --- sys/arch/sgimips/sgimips/autoconf.c 29 Jul 2012 18:05:46 -0000 1.43 +++ sys/arch/sgimips/sgimips/autoconf.c 9 Oct 2012 01:29:09 -0000 @@ -55,7 +55,7 @@ __KERNEL_RCSID(0, "$NetBSD: autoconf.c,v #include #include -static struct device *booted_controller = NULL; +static device_t booted_controller = NULL; static int booted_slot, booted_unit; static const char *booted_protocol = NULL; @@ -161,7 +161,7 @@ void cpu_rootconf(void) { printf("boot device: %s\n", - booted_device ? booted_device->dv_xname : ""); + booted_device ? device_xname(booted_device) : ""); rootconf(); } @@ -176,10 +176,10 @@ cpu_rootconf(void) ((pa)->pa_bus == 0 && (pa)->pa_device == 2 && (pa)->pa_function == 0)) void -device_register(struct device *dev, void *aux) +device_register(device_t dev, void *aux) { static int found, initted, scsiboot, netboot; - struct device *parent = device_parent(dev); + device_t parent = device_parent(dev); if (mach_type == MACH_SGI_IP32 && parent != NULL && device_is_a(parent, "pci")) { @@ -190,14 +190,14 @@ device_register(struct device *dev, void "aic7xxx-use-target-defaults", true) == false) { printf("WARNING: unable to set " "aic7xxx-use-target-defaults property " - "for %s\n", dev->dv_xname); + "for %s\n", device_xname(dev)); } if (prop_dictionary_set_bool(device_properties(dev), "aic7xxx-override-ultra", true) == false) { printf("WARNING: unable to set " "aic7xxx-override-ultra property for %s\n", - dev->dv_xname); + device_xname(dev)); } } } @@ -207,7 +207,7 @@ device_register(struct device *dev, void * on DMA boundaries. */ if (device_is_a(dev, "tl")) { - struct device *grandparent; + device_t grandparent; prop_number_t gfe_boundary; grandparent = device_parent(parent); @@ -219,7 +219,7 @@ device_register(struct device *dev, void "tl-dma-page-boundary", gfe_boundary) == false) { printf("WARNING: unable to set " "tl-dma-page-boundary property " - "for %s\n", dev->dv_xname); + "for %s\n", device_xname(dev)); } prop_object_release(gfe_boundary); return; Index: sys/arch/sgimips/sgimips/machdep.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/sgimips/sgimips/machdep.c,v retrieving revision 1.137 diff -u -p -r1.137 machdep.c --- sys/arch/sgimips/sgimips/machdep.c 28 Jul 2012 23:09:50 -0000 1.137 +++ sys/arch/sgimips/sgimips/machdep.c 9 Oct 2012 01:02:34 -0000 @@ -954,7 +954,7 @@ mips_machdep_find_l2cache(struct arcbios switch (comp->Type) { case COMPONENT_TYPE_SecondaryICache: - panic("%s: split L2 cache", self->dv_xname); + panic("%s: split L2 cache", device_xname(self)); case COMPONENT_TYPE_SecondaryDCache: case COMPONENT_TYPE_SecondaryCache: mci->mci_sdcache_size = COMPONENT_KEY_Cache_CacheSize(comp->Key); Index: sys/arch/sh3/dev/sci.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/sh3/dev/sci.c,v retrieving revision 1.54 diff -u -p -r1.54 sci.c --- sys/arch/sh3/dev/sci.c 2 Feb 2012 19:43:00 -0000 1.54 +++ sys/arch/sh3/dev/sci.c 29 Sep 2012 10:26:58 -0000 @@ -130,7 +130,7 @@ void scicnpoolc(dev_t, int); int sciintr(void *); struct sci_softc { - struct device sc_dev; /* boilerplate */ + device_t sc_dev; /* boilerplate */ struct tty *sc_tty; void *sc_si; callout_t sc_diag_ch; @@ -181,8 +181,8 @@ struct sci_softc { }; /* controller driver configuration */ -static int sci_match(struct device *, struct cfdata *, void *); -static void sci_attach(struct device *, struct device *, void *); +static int sci_match(device_t, cfdata_t, void *); +static void sci_attach(device_t, device_t, void *); void sci_break(struct sci_softc *, int); void sci_iflush(struct sci_softc *); @@ -231,7 +231,7 @@ int scicn_speed = 9600; u_int sci_rbuf_size = SCI_RING_SIZE; -CFATTACH_DECL(sci, sizeof(struct sci_softc), +CFATTACH_DECL_NEW(sci, sizeof(struct sci_softc), sci_match, sci_attach, NULL, NULL); extern struct cfdriver sci_cd; @@ -358,19 +358,19 @@ sci_getc(void) } static int -sci_match(struct device *parent, struct cfdata *cfp, void *aux) +sci_match(device_t parent, cfdata_t *cf, void *aux) { - if (strcmp(cfp->cf_name, "sci") || sci_attached) + if (strcmp(cf->cf_name, "sci") || sci_attached) return 0; return 1; } static void -sci_attach(struct device *parent, struct device *self, void *aux) +sci_attach(device_t parent, device_t self, void *aux) { - struct sci_softc *sc = (struct sci_softc *)self; + struct sci_softc *sc = device_private(self); struct tty *tp; sci_attached = 1; @@ -382,7 +382,7 @@ sci_attach(struct device *parent, struct if (sciisconsole) { SET(sc->sc_hwflags, SCI_HW_CONSOLE); SET(sc->sc_swflags, TIOCFLAG_SOFTCAR); - printf("\n%s: console\n", sc->sc_dev.dv_xname); + printf("\n%s: console\n", device_xname(self)); } else { InitializeSci(9600); printf("\n"); @@ -411,7 +411,7 @@ sci_attach(struct device *parent, struct sc->sc_rbuf = malloc(sci_rbuf_size << 1, M_DEVBUF, M_NOWAIT); if (sc->sc_rbuf == NULL) { printf("%s: unable to allocate ring buffer\n", - sc->sc_dev.dv_xname); + device_xname(self)); return; } sc->sc_ebuf = sc->sc_rbuf + (sci_rbuf_size << 1); @@ -481,7 +481,7 @@ sciparam(struct tty *tp, struct termios int ospeed = t->c_ospeed; int s; - if (!device_is_active(&sc->sc_dev)) + if (!device_is_active(sc->sc_dev)) return (EIO); /* Check requested parameters. */ @@ -618,7 +618,7 @@ sciopen(dev_t dev, int flag, int mode, s sc->sc_rbuf == NULL) return (ENXIO); - if (!device_is_active(&sc->sc_dev)) + if (!device_is_active(sc->sc_dev)) return (ENXIO); #ifdef KGDB @@ -728,7 +728,7 @@ sciclose(dev_t dev, int flag, int mode, (*tp->t_linesw->l_close)(tp, flag); ttyclose(tp); - if (!device_is_active(&sc->sc_dev)) + if (!device_is_active(sc->sc_dev)) return (0); return (0); @@ -778,7 +778,7 @@ sciioctl(dev_t dev, u_long cmd, void *da int error; int s; - if (!device_is_active(&sc->sc_dev)) + if (!device_is_active(sc->sc_dev)) return (EIO); error = (*tp->t_linesw->l_ioctl)(tp, cmd, data, flag, l); @@ -891,7 +891,7 @@ scidiag(void *arg) splx(s); log(LOG_WARNING, "%s: %d silo overflow%s, %d ibuf flood%s\n", - sc->sc_dev.dv_xname, + device_xname(sc->sc_dev), overflows, overflows == 1 ? "" : "s", floods, floods == 1 ? "" : "s"); } @@ -1036,7 +1036,7 @@ scisoft(void *arg) struct sci_softc *sc = arg; struct tty *tp; - if (!device_is_active(&sc->sc_dev)) + if (!device_is_active(sc->sc_dev)) return; tp = sc->sc_tty; @@ -1067,7 +1067,7 @@ sciintr(void *arg) u_int cc; u_short ssr; - if (!device_is_active(&sc->sc_dev)) + if (!device_is_active(sc->sc_dev)) return (0); end = sc->sc_ebuf; Index: sys/arch/shark/isa/isa_shark_machdep.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/shark/isa/isa_shark_machdep.c,v retrieving revision 1.14 diff -u -p -r1.14 isa_shark_machdep.c --- sys/arch/shark/isa/isa_shark_machdep.c 19 Aug 2009 15:11:22 -0000 1.14 +++ sys/arch/shark/isa/isa_shark_machdep.c 29 Sep 2012 10:21:36 -0000 @@ -216,7 +216,7 @@ isa_init(vaddr_t isa_io_addr, vaddr_t is } void -isa_attach_hook(struct device *parent, struct device *self, struct isabus_attach_args *iba) +isa_attach_hook(device_t parent, device_t self, struct isabus_attach_args *iba) { /* Index: sys/arch/shark/ofw/com_ofisa_machdep.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/shark/ofw/com_ofisa_machdep.c,v retrieving revision 1.7 diff -u -p -r1.7 com_ofisa_machdep.c --- sys/arch/shark/ofw/com_ofisa_machdep.c 19 Jul 2011 15:07:43 -0000 1.7 +++ sys/arch/shark/ofw/com_ofisa_machdep.c 29 Sep 2012 10:18:26 -0000 @@ -51,7 +51,7 @@ __KERNEL_RCSID(0, "$NetBSD: com_ofisa_ma #ifdef COMPAT_OLD_OFW int -com_ofisa_md_match(struct device *parent, struct cfdata *cf, void *aux) +com_ofisa_md_match(device_t parent, cfdata_t cf, void *aux) { struct ofisa_attach_args *aa = aux; char type[8]; @@ -74,7 +74,7 @@ com_ofisa_md_match(struct device *parent } int -com_ofisa_md_intr_fixup(struct device *parent, struct device *self, void *aux, struct ofisa_intr_desc *descp, int ndescs, int ndescsfilled) +com_ofisa_md_intr_fixup(device_t parent, device_t self, void *aux, struct ofisa_intr_desc *descp, int ndescs, int ndescsfilled) { if (1) /* XXX old firmware compat enabled */ Index: sys/arch/shark/ofw/igsfb_ofbus.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/shark/ofw/igsfb_ofbus.c,v retrieving revision 1.13 diff -u -p -r1.13 igsfb_ofbus.c --- sys/arch/shark/ofw/igsfb_ofbus.c 26 Jul 2011 08:56:26 -0000 1.13 +++ sys/arch/shark/ofw/igsfb_ofbus.c 26 Sep 2012 22:19:47 -0000 @@ -209,7 +209,7 @@ igsfb_ofbus_match(device_t parent, cfdat static void igsfb_ofbus_attach(device_t parent, device_t self, void *aux) { - struct igsfb_softc *sc = (struct igsfb_softc *)self; + struct igsfb_softc *sc = device_private(self); struct ofbus_attach_args *oba = aux; uint32_t regs[16]; int isconsole, ret; Index: sys/arch/shark/ofw/lpt_ofisa_machdep.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/shark/ofw/lpt_ofisa_machdep.c,v retrieving revision 1.8 diff -u -p -r1.8 lpt_ofisa_machdep.c --- sys/arch/shark/ofw/lpt_ofisa_machdep.c 19 Jul 2011 15:07:43 -0000 1.8 +++ sys/arch/shark/ofw/lpt_ofisa_machdep.c 29 Sep 2012 10:18:26 -0000 @@ -53,7 +53,7 @@ __KERNEL_RCSID(0, "$NetBSD: lpt_ofisa_ma extern int i87307PrinterConfig(bus_space_tag_t, u_int); /* XXX */ int -lpt_ofisa_md_match(struct device *parent, struct cfdata *cf, void *aux) +lpt_ofisa_md_match(device_t parent, cfdata_t cf, void *aux) { struct ofisa_attach_args *aa = aux; char type[9]; @@ -75,7 +75,7 @@ lpt_ofisa_md_match(struct device *parent } int -lpt_ofisa_md_intr_fixup(struct device *parent, struct device *self, void *aux, struct ofisa_intr_desc *descp, int ndescs, int ndescsfilled) +lpt_ofisa_md_intr_fixup(device_t parent, device_t self, void *aux, struct ofisa_intr_desc *descp, int ndescs, int ndescsfilled) { if (1) /* XXX old firmware compat enabled */ Index: sys/arch/shark/ofw/ofisa_machdep.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/shark/ofw/ofisa_machdep.c,v retrieving revision 1.9 diff -u -p -r1.9 ofisa_machdep.c --- sys/arch/shark/ofw/ofisa_machdep.c 19 Jul 2011 15:07:43 -0000 1.9 +++ sys/arch/shark/ofw/ofisa_machdep.c 29 Sep 2012 10:16:39 -0000 @@ -74,7 +74,7 @@ ofisa_ignore_child(int pphandle, int cph #ifdef COMPAT_OLD_OFW int -ofisa_md_match(struct device *parent, struct cfdata *cf, void *aux) +ofisa_md_match(device_t parent, cfdata_t cf, void *aux) { struct ofbus_attach_args *oba = aux; char type[8]; Index: sys/arch/shark/ofw/wdc_ofisa_machdep.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/shark/ofw/wdc_ofisa_machdep.c,v retrieving revision 1.7 diff -u -p -r1.7 wdc_ofisa_machdep.c --- sys/arch/shark/ofw/wdc_ofisa_machdep.c 19 Jul 2011 15:07:43 -0000 1.7 +++ sys/arch/shark/ofw/wdc_ofisa_machdep.c 29 Sep 2012 10:18:26 -0000 @@ -51,7 +51,7 @@ __KERNEL_RCSID(0, "$NetBSD: wdc_ofisa_ma #ifdef COMPAT_OLD_OFW int -wdc_ofisa_md_match(struct device *parent, struct cfdata *cf, void *aux) +wdc_ofisa_md_match(device_t parent, cfdata_t cf, void *aux) { struct ofisa_attach_args *aa = aux; char type[8]; @@ -73,7 +73,7 @@ wdc_ofisa_md_match(struct device *parent } int -wdc_ofisa_md_intr_fixup(struct device *parent, struct device *self, void *aux, struct ofisa_intr_desc *descp, int ndescs, int ndescsfilled) +wdc_ofisa_md_intr_fixup(device_t parent, device_t self, void *aux, struct ofisa_intr_desc *descp, int ndescs, int ndescsfilled) { if (1) /* XXX old firmware compat enabled */ Index: sys/arch/shark/shark/autoconf.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/shark/shark/autoconf.c,v retrieving revision 1.19 diff -u -p -r1.19 autoconf.c --- sys/arch/shark/shark/autoconf.c 1 Sep 2012 12:15:39 -0000 1.19 +++ sys/arch/shark/shark/autoconf.c 9 Oct 2012 01:16:43 -0000 @@ -69,13 +69,13 @@ __KERNEL_RCSID(0, "$NetBSD: autoconf.c,v #ifdef SHARK #include extern void ofrootfound(void); -extern void ofw_device_register(struct device *, void *aux); +extern void ofw_device_register(device_t, void *); extern void startrtclock(void); #endif #if defined(OFWGENCFG) || defined(SHARK) /* Temporary for SHARK! */ -extern void ofw_device_register(struct device *dev, void *aux); +extern void ofw_device_register(device_t, void *); #include #endif @@ -150,7 +150,7 @@ cpu_rootconf(void) set_root_device(); printf("boot device: %s\n", - booted_device != NULL ? booted_device->dv_xname : ""); + booted_device != NULL ? device_xname(booted_device) : ""); #endif rootconf(); } @@ -203,7 +203,7 @@ cpu_configure(void) } void -device_register(struct device *dev, void *aux) +device_register(device_t dev, void *aux) { #if defined(OFWGENCFG) || defined(SHARK) /* Temporary for SHARK! */ Index: sys/arch/sparc/dev/cgfour.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/sparc/dev/cgfour.c,v retrieving revision 1.46 diff -u -p -r1.46 cgfour.c --- sys/arch/sparc/dev/cgfour.c 18 Jul 2011 00:05:35 -0000 1.46 +++ sys/arch/sparc/dev/cgfour.c 2 Oct 2012 02:10:58 -0000 @@ -138,7 +138,7 @@ static int cgfourmatch(device_t, cfdata_ static void cgfourattach(device_t, device_t, void *); #if defined(SUN4) -static void cgfourunblank(struct device *); +static void cgfourunblank(device_t); #endif static int cg4_pfour_probe(void *, void *); @@ -451,7 +451,7 @@ cgfourmmap(dev_t dev, off_t off, int pro * Undo the effect of an FBIOSVIDEO that turns the video off. */ static void -cgfourunblank(struct device *dev) +cgfourunblank(device_t dev) { cgfour_set_video(device_private(dev), 1); Index: sys/arch/sparc/dev/cgfourteen.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/sparc/dev/cgfourteen.c,v retrieving revision 1.67 diff -u -p -r1.67 cgfourteen.c --- sys/arch/sparc/dev/cgfourteen.c 11 Jan 2012 15:54:44 -0000 1.67 +++ sys/arch/sparc/dev/cgfourteen.c 9 Oct 2012 01:02:34 -0000 @@ -254,7 +254,7 @@ cgfourteenattach(device_t parent, device if (sa->sa_nreg < 2) { printf("%s: only %d register sets\n", - self->dv_xname, sa->sa_nreg); + device_xname(self), sa->sa_nreg); return; } memcpy(sc->sc_physadr, sa->sa_reg, @@ -277,7 +277,7 @@ cgfourteenattach(device_t parent, device sa->sa_size, 0 /*BUS_SPACE_MAP_LINEAR*/, &bh) != 0) { - printf("%s: cannot map control registers\n", self->dv_xname); + printf("%s: cannot map control registers\n", device_xname(self)); return; } sc->sc_regh = bh; Index: sys/arch/sparc/dev/cgsix_obio.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/sparc/dev/cgsix_obio.c,v retrieving revision 1.25 diff -u -p -r1.25 cgsix_obio.c --- sys/arch/sparc/dev/cgsix_obio.c 18 Jul 2011 00:31:13 -0000 1.25 +++ sys/arch/sparc/dev/cgsix_obio.c 9 Oct 2012 01:02:34 -0000 @@ -141,7 +141,7 @@ cgsixattach(device_t parent, device_t se sizeof(*sc->sc_bt), BUS_SPACE_MAP_LINEAR, &bh) != 0) { - printf("%s: cannot map brooktree registers\n", self->dv_xname); + printf("%s: cannot map brooktree registers\n", device_xname(self)); return; } sc->sc_bt = (struct bt_regs *)bh; @@ -151,7 +151,7 @@ cgsixattach(device_t parent, device_t se sizeof(*sc->sc_fhc), BUS_SPACE_MAP_LINEAR, &bh) != 0) { - printf("%s: cannot map FHC registers\n", self->dv_xname); + printf("%s: cannot map FHC registers\n", device_xname(self)); return; } sc->sc_fhc = (int *)bh; @@ -161,7 +161,7 @@ cgsixattach(device_t parent, device_t se sizeof(*sc->sc_thc), BUS_SPACE_MAP_LINEAR, &bh) != 0) { - printf("%s: cannot map THC registers\n", self->dv_xname); + printf("%s: cannot map THC registers\n", device_xname(self)); return; } sc->sc_thc = (struct cg6_thc *)bh; @@ -171,7 +171,7 @@ cgsixattach(device_t parent, device_t se sizeof(*sc->sc_tec), BUS_SPACE_MAP_LINEAR, &bh) != 0) { - printf("%s: cannot map TEC registers\n", self->dv_xname); + printf("%s: cannot map TEC registers\n", device_xname(self)); return; } sc->sc_tec = (struct cg6_tec_xxx *)bh; @@ -181,7 +181,7 @@ cgsixattach(device_t parent, device_t se sizeof(*sc->sc_fbc), BUS_SPACE_MAP_LINEAR, &bh) != 0) { - printf("%s: cannot map FBC registers\n", self->dv_xname); + printf("%s: cannot map FBC registers\n", device_xname(self)); return; } sc->sc_fbc = (struct cg6_fbc *)bh; @@ -210,7 +210,7 @@ cgsixattach(device_t parent, device_t se sc->sc_ramsize, BUS_SPACE_MAP_LINEAR, &bh) != 0) { - printf("%s: cannot map pixels\n", self->dv_xname); + printf("%s: cannot map pixels\n", device_xname(self)); return; } sc->sc_fb.fb_pixels = (void *)bh; Index: sys/arch/sparc/dev/fd.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/sparc/dev/fd.c,v retrieving revision 1.150 diff -u -p -r1.150 fd.c --- sys/arch/sparc/dev/fd.c 17 Jul 2011 23:18:23 -0000 1.150 +++ sys/arch/sparc/dev/fd.c 9 Oct 2012 01:02:34 -0000 @@ -174,7 +174,7 @@ enum fdc_state { /* software state, per controller */ struct fdc_softc { - struct device *sc_dev; + device_t sc_dev; bus_space_tag_t sc_bustag; struct callout sc_timo_ch; /* timeout callout */ @@ -259,7 +259,7 @@ struct fd_type fd_types[] = { /* software state, per disk (with up to 4 disks per ctlr) */ struct fd_softc { - struct device *sc_dv; /* generic device info */ + device_t sc_dv; /* generic device info */ struct disk sc_dk; /* generic disk info */ struct fd_type *sc_deftype; /* default type descriptor */ @@ -342,7 +342,7 @@ void fdcretry(struct fdc_softc *); void fdfinish(struct fd_softc *, struct buf *); int fdformat(dev_t, struct ne7_fd_formb *, struct proc *); void fd_do_eject(struct fd_softc *); -void fd_mountroot_hook(struct device *); +void fd_mountroot_hook(device_t); static int fdconf(struct fdc_softc *); static void establish_chip_type( struct fdc_softc *, @@ -547,7 +547,7 @@ fdcattach_mainbus(device_t parent, devic ma->ma_size, BUS_SPACE_MAP_LINEAR, &fdc->sc_handle) != 0) { - printf("%s: cannot map registers\n", self->dv_xname); + printf("%s: cannot map registers\n", device_xname(self)); return; } @@ -580,7 +580,7 @@ fdcattach_obio(device_t parent, device_t sa->sa_slot, sa->sa_offset, sa->sa_size, BUS_SPACE_MAP_LINEAR, &fdc->sc_handle) != 0) { printf("%s: cannot map control registers\n", - self->dv_xname); + device_xname(self)); return; } @@ -890,7 +890,7 @@ fdstrategy(struct buf *bp) fdstart(fd); #ifdef DIAGNOSTIC else { - struct fdc_softc *fdc = (void *)device_parent(fd->sc_dv); + struct fdc_softc *fdc = device_private(device_parent(fd->sc_dv)); if (fdc->sc_state == DEVIDLE) { printf("fdstrategy: controller inactive\n"); fdcstart(fdc); @@ -1012,7 +1012,7 @@ fd_motor_off(void *arg) s = splbio(); fd->sc_flags &= ~(FD_MOTOR | FD_MOTOR_WAIT); - fd_set_motor((struct fdc_softc *)device_parent(fd->sc_dv)); + fd_set_motor(device_private(device_parent(fd->sc_dv))); splx(s); } @@ -2305,7 +2305,7 @@ fd_do_eject(struct fd_softc *fd) /* ARGSUSED */ void -fd_mountroot_hook(struct device *dev) +fd_mountroot_hook(device_t dev) { int c; Index: sys/arch/sparc/dev/ms_pckbport.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/sparc/dev/ms_pckbport.c,v retrieving revision 1.8 diff -u -p -r1.8 ms_pckbport.c --- sys/arch/sparc/dev/ms_pckbport.c 8 Sep 2011 15:36:42 -0000 1.8 +++ sys/arch/sparc/dev/ms_pckbport.c 2 Oct 2012 02:12:12 -0000 @@ -74,8 +74,8 @@ CFATTACH_DECL_NEW(ms_pckbport, sizeof(st ms_pckbport_match, ms_pckbport_attach, NULL, NULL); -static int ms_pckbport_iopen(struct device *, int); -static int ms_pckbport_iclose(struct device *, int); +static int ms_pckbport_iopen(device_t, int); +static int ms_pckbport_iclose(device_t, int); static void ms_pckbport_input(void *, int); @@ -135,7 +135,7 @@ ms_pckbport_attach(device_t parent, devi static int -ms_pckbport_iopen(struct device *self, int flags) +ms_pckbport_iopen(device_t self, int flags) { struct ms_pckbport_softc *sc = device_private(self); struct ms_softc *ms = &sc->sc_ms; @@ -162,7 +162,7 @@ ms_pckbport_iopen(struct device *self, i static int -ms_pckbport_iclose(struct device *self, int flags) +ms_pckbport_iclose(device_t self, int flags) { struct ms_pckbport_softc *sc = device_private(self); u_char cmd[1]; Index: sys/arch/sparc/dev/obio.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/sparc/dev/obio.c,v retrieving revision 1.72 diff -u -p -r1.72 obio.c --- sys/arch/sparc/dev/obio.c 1 Jul 2011 18:50:41 -0000 1.72 +++ sys/arch/sparc/dev/obio.c 2 Oct 2012 02:12:27 -0000 @@ -70,8 +70,8 @@ union obio_softc { /* autoconfiguration driver */ -static int obiomatch(device_t, struct cfdata *, void *); -static void obioattach(device_t, struct device *, void *); +static int obiomatch(device_t, cfdata_t, void *); +static void obioattach(device_t, device_t, void *); CFATTACH_DECL_NEW(obio, sizeof(union obio_softc), obiomatch, obioattach, NULL, NULL); Index: sys/arch/sparc/dev/tctrl.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/sparc/dev/tctrl.c,v retrieving revision 1.55 diff -u -p -r1.55 tctrl.c --- sys/arch/sparc/dev/tctrl.c 25 Mar 2012 08:48:40 -0000 1.55 +++ sys/arch/sparc/dev/tctrl.c 2 Oct 2012 02:12:50 -0000 @@ -1437,7 +1437,7 @@ static void tctrl_event_thread(void *v) { struct tctrl_softc *sc = v; - struct device *dv; + device_t dv; struct sd_softc *sd = NULL; struct lance_softc *le = NULL; int ticks = hz/2; Index: sys/arch/sparc/dev/ts102.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/sparc/dev/ts102.c,v retrieving revision 1.16 diff -u -p -r1.16 ts102.c --- sys/arch/sparc/dev/ts102.c 26 Jul 2011 22:52:49 -0000 1.16 +++ sys/arch/sparc/dev/ts102.c 9 Oct 2012 01:29:32 -0000 @@ -319,14 +319,14 @@ tslot_attach(device_t parent, device_t s sa->sa_offset, sa->sa_size, 0, &sc->sc_regh) != 0) { - printf("%s: cannot map registers\n", self->dv_xname); + printf("%s: cannot map registers\n", device_xname(self)); return; } regs = (uint8_t *)bus_space_vaddr(sa->sa_bustag, sc->sc_regh); tag = bus_space_tag_alloc(sa->sa_bustag, sc); if (tag == NULL) { - printf("%s: attach: out of memory\n", self->dv_xname); + printf("%s: attach: out of memory\n", device_xname(self)); return; } tag->sparc_read_2 = ts102_read_2; @@ -379,7 +379,7 @@ tslot_attach(device_t parent, device_t s TS102_ARBITRARY_MAP_SIZE, 0, &hrang) != 0) { printf("%s: cannot map registers\n", - self->dv_xname); + device_xname(self)); return; } TSPRINTF("%08x: %08x ",(uint32_t)ranges[base + 3], @@ -621,7 +621,7 @@ tslot_slot_disable(pcmcia_chipset_handle struct tslot_data *td = (struct tslot_data *)pch; #ifdef TSLOT_DEBUG printf("%s: disable slot %d\n", - td->td_parent->sc_dev.dv_xname, td->td_slot); + device_xname(td->td_parent->sc_dev), td->td_slot); #endif /* @@ -645,7 +645,7 @@ tslot_slot_enable(pcmcia_chipset_handle_ #ifdef TSLOT_DEBUG printf("%s: enable slot %d\n", - td->td_parent->sc_dev.dv_xname, td->td_slot); + device_xname(td->td_parent->sc_dev), td->td_slot); #endif /* Power down the socket to reset it */ Index: sys/arch/sparc/dev/vme_machdep.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/sparc/dev/vme_machdep.c,v retrieving revision 1.67 diff -u -p -r1.67 vme_machdep.c --- sys/arch/sparc/dev/vme_machdep.c 29 Jul 2012 00:04:05 -0000 1.67 +++ sys/arch/sparc/dev/vme_machdep.c 29 Sep 2012 10:18:26 -0000 @@ -328,7 +328,7 @@ vmeattach_mainbus(device_t parent, devic /* sun4m vmebus */ static void -vmeattach_iommu(struct device *parent, struct device *self, void *aux) +vmeattach_iommu(device_t parent, device_t self, void *aux) { #if defined(SUN4M) struct sparcvme_softc *sc = device_private(self); Index: sys/arch/sparc/dev/zs.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/sparc/dev/zs.c,v retrieving revision 1.120 diff -u -p -r1.120 zs.c --- sys/arch/sparc/dev/zs.c 26 Jun 2010 03:39:53 -0000 1.120 +++ sys/arch/sparc/dev/zs.c 2 Oct 2012 02:13:28 -0000 @@ -185,7 +185,7 @@ void zs_disable(struct zs_chanstate *); /* XXX from dev/ic/z8530tty.c */ -extern struct tty *zstty_get_tty_from_dev(struct device *); +extern struct tty *zstty_get_tty_from_dev(device_t); /* * Is the zs chip present? @@ -415,7 +415,7 @@ zs_attach(struct zsc_softc *zsc, struct */ for (channel = 0; channel < 2; channel++) { struct zschan *zc; - struct device *child; + device_t child; int hwflags; zsc_args.channel = channel; Index: sys/arch/sparc/include/autoconf.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/sparc/include/autoconf.h,v retrieving revision 1.47 diff -u -p -r1.47 autoconf.h --- sys/arch/sparc/include/autoconf.h 1 Jul 2011 21:00:57 -0000 1.47 +++ sys/arch/sparc/include/autoconf.h 2 Oct 2012 02:14:00 -0000 @@ -152,7 +152,7 @@ int obio_find_rom_map(bus_addr_t, int, b */ struct device; struct cfdata; -int matchbyname(struct device *, struct cfdata *cf, void *aux); +int matchbyname(device_t, cfdata_t, void *); /* * `clockfreq' produces a printable representation of a clock frequency @@ -164,15 +164,14 @@ char *clockfreq(int freq); struct bootpath { char name[16]; /* name of this node */ int val[3]; /* up to three optional values */ - struct device *dev; /* device that recognised this component */ + device_t dev; /* device that recognised this component */ }; /* Parse a disk string into a dev_t, return device struct pointer */ -struct device *parsedisk(char *, int, int, dev_t *); +device_t parsedisk(char *, int, int, dev_t *); /* Establish a mountroot_hook, for benefit of floppy drive, mostly. */ -void mountroot_hook_establish(void (*)(struct device *), - struct device *); +void mountroot_hook_establish(void (*)(device_t), device_t); void bootstrap(void); int romgetcursoraddr(int **, int **); Index: sys/arch/sparc/include/pci_machdep.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/sparc/include/pci_machdep.h,v retrieving revision 1.8 diff -u -p -r1.8 pci_machdep.h --- sys/arch/sparc/include/pci_machdep.h 4 Apr 2011 20:37:54 -0000 1.8 +++ sys/arch/sparc/include/pci_machdep.h 2 Oct 2012 02:14:15 -0000 @@ -75,7 +75,7 @@ struct sparc_pci_chipset { /* * Functions provided to machine-independent PCI code. */ -void pci_attach_hook(struct device *, struct device *, +void pci_attach_hook(device_t, device_t, struct pcibus_attach_args *); int pci_bus_maxdevs(pci_chipset_tag_t, int); pcitag_t pci_make_tag(pci_chipset_tag_t, int, int, int); Index: sys/arch/sparc/sparc/autoconf.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/sparc/sparc/autoconf.c,v retrieving revision 1.245 diff -u -p -r1.245 autoconf.c --- sys/arch/sparc/sparc/autoconf.c 31 Jul 2012 14:23:33 -0000 1.245 +++ sys/arch/sparc/sparc/autoconf.c 9 Oct 2012 01:30:45 -0000 @@ -158,7 +158,7 @@ int autoconf_debug = 0; * device names with our internal names. */ int -matchbyname(struct device *parent, struct cfdata *cf, void *aux) +matchbyname(device_t parent, cfdata_t cf, void *aux) { printf("%s: WARNING: matchbyname\n", cf->cf_name); @@ -1501,11 +1501,11 @@ romgetcursoraddr(int **rowp, int **colp) #define BUSCLASS_PCIC 9 #define BUSCLASS_PCI 10 -static int bus_class(struct device *); +static int bus_class(device_t); static const char *bus_compatible(const char *); -static int instance_match(struct device *, void *, struct bootpath *); -static void nail_bootdev(struct device *, struct bootpath *); -static void set_network_props(struct device *, void *); +static int instance_match(device_t, void *, struct bootpath *); +static void nail_bootdev(device_t, struct bootpath *); +static void set_network_props(device_t, void *); static struct { const char *name; @@ -1564,7 +1564,7 @@ bus_compatible(const char *bpname) } static int -bus_class(struct device *dev) +bus_class(device_t dev) { int i, class; @@ -1587,7 +1587,7 @@ bus_class(struct device *dev) } static void -set_network_props(struct device *dev, void *aux) +set_network_props(device_t dev, void *aux) { struct mainbus_attach_args *ma; struct sbus_attach_args *sa; @@ -1626,7 +1626,7 @@ set_network_props(struct device *dev, vo } int -instance_match(struct device *dev, void *aux, struct bootpath *bp) +instance_match(device_t dev, void *aux, struct bootpath *bp) { struct mainbus_attach_args *ma; struct sbus_attach_args *sa; @@ -1724,12 +1724,12 @@ instance_match(struct device *dev, void } void -nail_bootdev(struct device *dev, struct bootpath *bp) +nail_bootdev(device_t dev, struct bootpath *bp) { if (bp->dev != NULL) panic("device_register: already got a boot device: %s", - bp->dev->dv_xname); + device_xname(bp->dev)); /* * Mark this bootpath component by linking it to the matched @@ -1746,7 +1746,7 @@ nail_bootdev(struct device *dev, struct } void -device_register(struct device *dev, void *aux) +device_register(device_t dev, void *aux) { struct bootpath *bp = bootpath_store(0, NULL); const char *bpname; @@ -1765,8 +1765,8 @@ device_register(struct device *dev, void DPRINTF(ACDB_BOOTDEV, ("\n%s: device_register: dvname %s(%s) bpname %s(%s)\n", - dev->dv_xname, device_cfdata(dev)->cf_name, dev->dv_xname, - bpname, bp->name)); + device_xname(dev), device_cfdata(dev)->cf_name, + device_xname(dev), bpname, bp->name)); /* First, match by name */ if (!device_is_a(dev, bpname)) @@ -1794,7 +1794,7 @@ device_register(struct device *dev, void booted_device = bp->dev = dev; bootpath_store(1, bp + 1); DPRINTF(ACDB_BOOTDEV, ("\t-- found bus controller %s\n", - dev->dv_xname)); + device_xname(dev))); return; } } else if (device_is_a(dev, "le") || @@ -1810,7 +1810,7 @@ device_register(struct device *dev, void if (instance_match(dev, aux, bp) != 0) { nail_bootdev(dev, bp); DPRINTF(ACDB_BOOTDEV, ("\t-- found ethernet controller %s\n", - dev->dv_xname)); + device_xname(dev))); return; } } else if (device_is_a(dev, "sd") || @@ -1864,7 +1864,7 @@ device_register(struct device *dev, void periph->periph_lun == lun) { nail_bootdev(dev, bp); DPRINTF(ACDB_BOOTDEV, ("\t-- found [cs]d disk %s\n", - dev->dv_xname)); + device_xname(dev))); return; } #endif /* NSCSIBUS */ @@ -1875,7 +1875,7 @@ device_register(struct device *dev, void if (instance_match(dev, aux, bp) != 0) { nail_bootdev(dev, bp); DPRINTF(ACDB_BOOTDEV, ("\t-- found x[dy] disk %s\n", - dev->dv_xname)); + device_xname(dev))); return; } @@ -1889,7 +1889,7 @@ device_register(struct device *dev, void */ nail_bootdev(dev, bp); DPRINTF(ACDB_BOOTDEV, ("\t-- found floppy drive %s\n", - dev->dv_xname)); + device_xname(dev))); return; } else { /* Index: sys/arch/sparc/sparc/cpu.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/sparc/sparc/cpu.c,v retrieving revision 1.238 diff -u -p -r1.238 cpu.c --- sys/arch/sparc/sparc/cpu.c 31 Jul 2012 20:12:27 -0000 1.238 +++ sys/arch/sparc/sparc/cpu.c 9 Oct 2012 01:02:34 -0000 @@ -245,14 +245,14 @@ cpu_mainbus_attach(device_t parent, devi * cache congruency! */ if (rrp[0].oa_space == 0) - printf("%s: mailbox in mem space\n", self->dv_xname); + printf("%s: mailbox in mem space\n", device_xname(self)); if (bus_space_map(ma->ma_bustag, BUS_ADDR(rrp[0].oa_space, rrp[0].oa_base), rrp[0].oa_size, BUS_SPACE_MAP_LINEAR, &cpi->mailbox) != 0) - panic("%s: can't map CPU mailbox", self->dv_xname); + panic("%s: can't map CPU mailbox", device_xname(self)); free(rrp, M_DEVBUF); } @@ -275,7 +275,7 @@ cpu_mainbus_attach(device_t parent, devi rrp[0].oa_size, BUS_SPACE_MAP_LINEAR, &cpi->ci_mbusport) != 0) { - panic("%s: can't map CPU regs", self->dv_xname); + panic("%s: can't map CPU regs", device_xname(self)); } /* register set #1: MCXX control */ if (bus_space_map(ma->ma_bustag, @@ -283,7 +283,7 @@ cpu_mainbus_attach(device_t parent, devi rrp[1].oa_size, BUS_SPACE_MAP_LINEAR, &cpi->ci_mxccregs) != 0) { - panic("%s: can't map CPU regs", self->dv_xname); + panic("%s: can't map CPU regs", device_xname(self)); } /* register sets #3 and #4 are E$ cache data and tags */ Index: sys/arch/sparc/sparc/memecc.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/sparc/sparc/memecc.c,v retrieving revision 1.14 diff -u -p -r1.14 memecc.c --- sys/arch/sparc/sparc/memecc.c 29 Jul 2012 00:04:05 -0000 1.14 +++ sys/arch/sparc/sparc/memecc.c 26 Sep 2012 22:19:47 -0000 @@ -75,7 +75,7 @@ memecc_match(device_t parent, cfdata_t c void memecc_attach(device_t parent, device_t self, void *aux) { - struct memecc_softc *sc = (struct memecc_softc *)self; + struct memecc_softc *sc = device_private(self); struct mainbus_attach_args *ma = aux; int node; uint32_t reg; Index: sys/arch/sparc/sparc/pci_machdep.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/sparc/sparc/pci_machdep.c,v retrieving revision 1.16 diff -u -p -r1.16 pci_machdep.c --- sys/arch/sparc/sparc/pci_machdep.c 1 Jul 2011 18:51:51 -0000 1.16 +++ sys/arch/sparc/sparc/pci_machdep.c 29 Sep 2012 10:21:26 -0000 @@ -146,7 +146,7 @@ static int wiring_map_size; void -pci_attach_hook(struct device *parent, struct device *self, +pci_attach_hook(device_t parent, device_t self, struct pcibus_attach_args *pba) { struct mspcic_known_model *p; Index: sys/arch/sparc64/dev/ebus_mainbus.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/sparc64/dev/ebus_mainbus.c,v retrieving revision 1.9 diff -u -p -r1.9 ebus_mainbus.c --- sys/arch/sparc64/dev/ebus_mainbus.c 18 Mar 2012 05:26:58 -0000 1.9 +++ sys/arch/sparc64/dev/ebus_mainbus.c 29 Sep 2012 10:21:17 -0000 @@ -73,7 +73,7 @@ static void ebus_mainbus_intr_ack(struct #endif int -ebus_mainbus_match(struct device *parent, cfdata_t cf, void *aux) +ebus_mainbus_match(device_t parent, cfdata_t cf, void *aux) { struct mainbus_attach_args *ma = aux; @@ -83,7 +83,7 @@ ebus_mainbus_match(struct device *parent } void -ebus_mainbus_attach(struct device *parent, struct device *self, void *aux) +ebus_mainbus_attach(device_t parent, device_t self, void *aux) { struct ebus_softc *sc = device_private(self); struct mainbus_attach_args *ma = aux; Index: sys/arch/sparc64/dev/mkclock.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/sparc64/dev/mkclock.c,v retrieving revision 1.11 diff -u -p -r1.11 mkclock.c --- sys/arch/sparc64/dev/mkclock.c 19 Sep 2012 20:34:57 -0000 1.11 +++ sys/arch/sparc64/dev/mkclock.c 29 Sep 2012 10:18:26 -0000 @@ -192,7 +192,7 @@ mkclock_sbus_attach(device_t parent, dev /* ARGSUSED */ static void -mkclock_ebus_attach(struct device *parent, struct device *self, void *aux) +mkclock_ebus_attach(device_t parent, device_t self, void *aux) { struct mk48txx_softc *sc = device_private(self); struct ebus_attach_args *ea = aux; @@ -221,7 +221,7 @@ mkclock_ebus_attach(struct device *paren /* ARGSUSED */ static void -mkclock_fhc_attach(struct device *parent, struct device *self, void *aux) +mkclock_fhc_attach(device_t parent, device_t self, void *aux) { struct mk48txx_softc *sc = device_private(self); struct fhc_attach_args *fa = aux; Index: sys/arch/sparc64/dev/pci_machdep.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/sparc64/dev/pci_machdep.c,v retrieving revision 1.74 diff -u -p -r1.74 pci_machdep.c --- sys/arch/sparc64/dev/pci_machdep.c 12 Aug 2011 06:04:41 -0000 1.74 +++ sys/arch/sparc64/dev/pci_machdep.c 29 Sep 2012 10:21:08 -0000 @@ -98,8 +98,8 @@ ofpci_make_tag(pci_chipset_tag_t pc, int */ void -pci_attach_hook(struct device *parent, struct device *self, - struct pcibus_attach_args *pba) +pci_attach_hook(device_t parent, device_t self, + struct pcibus_attach_args *pba) { } Index: sys/arch/sparc64/dev/pld_wdog.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/sparc64/dev/pld_wdog.c,v retrieving revision 1.10 diff -u -p -r1.10 pld_wdog.c --- sys/arch/sparc64/dev/pld_wdog.c 18 Mar 2012 05:26:58 -0000 1.10 +++ sys/arch/sparc64/dev/pld_wdog.c 29 Sep 2012 11:41:23 -0000 @@ -85,7 +85,7 @@ pldwdog_tickle(struct sysmon_wdog *smw) #ifdef PLD_WDOG_DEBUG printf("%s: pldwdog_tickle: mode %x, period %d\n", - device_xname(&sc->sc_dev), smw->smw_mode, smw->smw_period); + device_xname(sc->sc_dev), smw->smw_mode, smw->smw_period); /* pldwdog_regs(sc); */ #endif Index: sys/arch/sparc64/dev/psm.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/sparc64/dev/psm.c,v retrieving revision 1.9 diff -u -p -r1.9 psm.c --- sys/arch/sparc64/dev/psm.c 1 Jul 2011 18:48:36 -0000 1.9 +++ sys/arch/sparc64/dev/psm.c 29 Sep 2012 10:20:48 -0000 @@ -128,7 +128,7 @@ CFATTACH_DECL_NEW(psm, sizeof(struct psm int -psm_match(struct device *parent, cfdata_t cf, void *aux) +psm_match(device_t parent, cfdata_t cf, void *aux) { struct ebus_attach_args *ea = aux; @@ -138,7 +138,7 @@ psm_match(struct device *parent, cfdata_ } void -psm_attach(struct device *parent, struct device *self, void *aux) +psm_attach(device_t parent, device_t self, void *aux) { struct psm_softc *sc = device_private(self); struct ebus_attach_args *ea = aux; Index: sys/arch/sparc64/dev/pyro.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/sparc64/dev/pyro.c,v retrieving revision 1.11 diff -u -p -r1.11 pyro.c --- sys/arch/sparc64/dev/pyro.c 18 Mar 2012 05:26:58 -0000 1.11 +++ sys/arch/sparc64/dev/pyro.c 29 Sep 2012 10:20:41 -0000 @@ -122,7 +122,7 @@ int pyro_dmamap_create(bus_dma_tag_t, bu bus_size_t, bus_size_t, int, bus_dmamap_t *); int -pyro_match(struct device *parent, cfdata_t match, void *aux) +pyro_match(device_t parent, cfdata_t match, void *aux) { struct mainbus_attach_args *ma = aux; char *str; @@ -139,7 +139,7 @@ pyro_match(struct device *parent, cfdata } void -pyro_attach(struct device *parent, struct device *self, void *aux) +pyro_attach(device_t parent, device_t self, void *aux) { struct pyro_softc *sc = device_private(self); struct mainbus_attach_args *ma = aux; Index: sys/arch/sparc64/dev/schizo.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/sparc64/dev/schizo.c,v retrieving revision 1.29 diff -u -p -r1.29 schizo.c --- sys/arch/sparc64/dev/schizo.c 25 Mar 2012 03:13:08 -0000 1.29 +++ sys/arch/sparc64/dev/schizo.c 29 Sep 2012 10:20:31 -0000 @@ -112,7 +112,7 @@ static int schizo_dmamap_create(bus_dma_ bus_size_t, int, bus_dmamap_t *); int -schizo_match(struct device *parent, cfdata_t match, void *aux) +schizo_match(device_t parent, cfdata_t match, void *aux) { struct mainbus_attach_args *ma = aux; char *str; @@ -136,7 +136,7 @@ schizo_match(struct device *parent, cfda } void -schizo_attach(struct device *parent, struct device *self, void *aux) +schizo_attach(device_t parent, device_t self, void *aux) { struct schizo_softc *sc = device_private(self); struct mainbus_attach_args *ma = aux; Index: sys/arch/sparc64/dev/tda.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/sparc64/dev/tda.c,v retrieving revision 1.5 diff -u -p -r1.5 tda.c --- sys/arch/sparc64/dev/tda.c 18 Mar 2012 05:26:58 -0000 1.5 +++ sys/arch/sparc64/dev/tda.c 26 Sep 2012 21:34:18 -0000 @@ -64,8 +64,8 @@ struct tda_softc { callout_t sc_timer; }; -int tda_match(struct device *, struct cfdata *, void *); -void tda_attach(struct device *, struct device *, void *); +int tda_match(device_t, cfdata_t, void *); +void tda_attach(device_t, device_t, void *); void tda_setspeed(struct tda_softc *); static void tda_adjust(void *); @@ -76,7 +76,7 @@ CFATTACH_DECL_NEW(tda, sizeof(struct tda tda_match, tda_attach, NULL, NULL); int -tda_match(struct device *parent, struct cfdata *match, void *aux) +tda_match(device_t parent, cfdata_t match, void *aux) { struct i2c_attach_args *ia = aux; char name[32]; @@ -97,7 +97,7 @@ tda_match(struct device *parent, struct } void -tda_attach(struct device *parent, struct device *self, void *aux) +tda_attach(device_t parent, device_t self, void *aux) { struct tda_softc *sc = device_private(self); struct i2c_attach_args *ia = aux; Index: sys/arch/sparc64/dev/zs.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/sparc64/dev/zs.c,v retrieving revision 1.73 diff -u -p -r1.73 zs.c --- sys/arch/sparc64/dev/zs.c 12 Aug 2011 08:47:05 -0000 1.73 +++ sys/arch/sparc64/dev/zs.c 2 Oct 2012 02:15:15 -0000 @@ -182,7 +182,7 @@ int zs_enable(struct zs_chanstate *); void zs_disable(struct zs_chanstate *); /* from dev/ic/z8530tty.c */ -struct tty *zstty_get_tty_from_dev(struct device *); +struct tty *zstty_get_tty_from_dev(device_t); /* * Is the zs chip present? @@ -345,7 +345,7 @@ zs_attach(struct zsc_softc *zsc, struct */ for (channel = 0; channel < 2; channel++) { struct zschan *zc; - struct device *child; + device_t child; zsc_args.channel = channel; cs = &zsc->zsc_cs_store[channel]; Index: sys/arch/sparc64/include/autoconf.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/sparc64/include/autoconf.h,v retrieving revision 1.30 diff -u -p -r1.30 autoconf.h --- sys/arch/sparc64/include/autoconf.h 1 Jul 2011 20:59:38 -0000 1.30 +++ sys/arch/sparc64/include/autoconf.h 2 Oct 2012 02:15:35 -0000 @@ -125,13 +125,13 @@ struct mainbus_attach_args { */ struct device; struct cfdata; -int matchbyname(struct device *, struct cfdata *cf, void *aux); +int matchbyname(device_t, cfdata_t, void *); /* * `clockfreq' produces a printable representation of a clock frequency * (this is just a frill). */ -char *clockfreq(long freq); +char *clockfreq(long); /* Kernel initialization routine. */ void bootstrap(void *, void *, void *, void *, void *); Index: sys/arch/sparc64/include/pci_machdep.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/sparc64/include/pci_machdep.h,v retrieving revision 1.25 diff -u -p -r1.25 pci_machdep.h --- sys/arch/sparc64/include/pci_machdep.h 4 Apr 2011 20:37:54 -0000 1.25 +++ sys/arch/sparc64/include/pci_machdep.h 2 Oct 2012 02:15:55 -0000 @@ -82,8 +82,8 @@ struct sparc_pci_chipset { }; -void pci_attach_hook(struct device *, struct device *, - struct pcibus_attach_args *); +void pci_attach_hook(device_t, device_t, + struct pcibus_attach_args *); int pci_bus_maxdevs(pci_chipset_tag_t, int); pcitag_t pci_make_tag(pci_chipset_tag_t, int, int, int); void pci_decompose_tag(pci_chipset_tag_t, pcitag_t, int *, int *, Index: sys/arch/sparc64/sparc64/cpu.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/sparc64/sparc64/cpu.c,v retrieving revision 1.101 diff -u -p -r1.101 cpu.c --- sys/arch/sparc64/sparc64/cpu.c 8 Oct 2011 08:49:07 -0000 1.101 +++ sys/arch/sparc64/sparc64/cpu.c 29 Sep 2012 10:20:22 -0000 @@ -109,8 +109,8 @@ static void cpu_reset_fpustate(void); volatile int sync_tick = 0; /* The CPU configuration driver. */ -void cpu_attach(struct device *, struct device *, void *); -int cpu_match(struct device *, struct cfdata *, void *); +void cpu_attach(device_t, device_t, void *); +int cpu_match(device_t, cfdata_t, void *); CFATTACH_DECL_NEW(cpu, 0, cpu_match, cpu_attach, NULL, NULL); @@ -193,7 +193,7 @@ alloc_cpuinfo(u_int cpu_node) } int -cpu_match(struct device *parent, struct cfdata *cf, void *aux) +cpu_match(device_t parent, cfdata_t cf, void *aux) { struct mainbus_attach_args *ma = aux; @@ -239,7 +239,7 @@ cpu_reset_fpustate(void) * (slightly funny place to do it, but this is where it is to be found). */ void -cpu_attach(struct device *parent, struct device *dev, void *aux) +cpu_attach(device_t parent, device_t dev, void *aux) { int node; long clk; Index: sys/arch/sun2/dev/cons.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/sun2/dev/cons.h,v retrieving revision 1.3 diff -u -p -r1.3 cons.h --- sys/arch/sun2/dev/cons.h 11 Dec 2005 12:19:16 -0000 1.3 +++ sys/arch/sun2/dev/cons.h 1 Oct 2012 14:41:24 -0000 @@ -35,7 +35,6 @@ */ struct pconssoftc { - struct device of_dev; struct tty *of_tty; struct callout sc_poll_ch; int of_flags; Index: sys/arch/sun2/dev/zs.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/sun2/dev/zs.c,v retrieving revision 1.20 diff -u -p -r1.20 zs.c --- sys/arch/sun2/dev/zs.c 26 Oct 2011 00:56:59 -0000 1.20 +++ sys/arch/sun2/dev/zs.c 2 Oct 2012 02:16:05 -0000 @@ -170,7 +170,7 @@ zs_attach(struct zsc_softc *zsc, struct */ for (channel = 0; channel < 2; channel++) { struct zschan *zc; - struct device *child; + device_t child; zsc_args.channel = channel; zsc_args.hwflags = 0; Index: sys/arch/sun2/sun2/obmem.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/sun2/sun2/obmem.c,v retrieving revision 1.17 diff -u -p -r1.17 obmem.c --- sys/arch/sun2/sun2/obmem.c 6 Jul 2008 13:29:50 -0000 1.17 +++ sys/arch/sun2/sun2/obmem.c 29 Sep 2012 10:16:39 -0000 @@ -77,7 +77,7 @@ static struct sun68k_bus_space_tag obmem }; static int -obmem_match(struct device *parent, struct cfdata *cf, void *aux) +obmem_match(device_t parent, cfdata_t cf, void *aux) { struct mainbus_attach_args *ma = aux; Index: sys/arch/sun3/dev/dma.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/sun3/dev/dma.c,v retrieving revision 1.21 diff -u -p -r1.21 dma.c --- sys/arch/sun3/dev/dma.c 16 Dec 2008 22:35:27 -0000 1.21 +++ sys/arch/sun3/dev/dma.c 9 Oct 2012 01:30:53 -0000 @@ -389,7 +389,7 @@ espdmaintr(struct dma_softc *sc) * another target. As such, don't print the warning. */ printf("%s: xfer (%d) > req (%d)\n", - sc->sc_dev.dv_xname, trans, sc->sc_dmasize); + device_xname(sc->sc_dev), trans, sc->sc_dmasize); #endif trans = sc->sc_dmasize; } Index: sys/arch/sun3/dev/fd.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/sun3/dev/fd.c,v retrieving revision 1.72 diff -u -p -r1.72 fd.c --- sys/arch/sun3/dev/fd.c 16 Jul 2011 20:25:28 -0000 1.72 +++ sys/arch/sun3/dev/fd.c 29 Sep 2012 10:18:26 -0000 @@ -396,7 +396,7 @@ fdconf(struct fdc_softc *fdc) } void -fdcattach(struct device *parent, struct device *self, void *aux) +fdcattach(device_t parent, device_t self, void *aux) { struct confargs *ca = aux; struct fdc_softc *fdc = device_private(self); Index: sys/arch/sun3/dev/zs_kgdb.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/sun3/dev/zs_kgdb.c,v retrieving revision 1.25 diff -u -p -r1.25 zs_kgdb.c --- sys/arch/sun3/dev/zs_kgdb.c 28 Apr 2008 20:23:38 -0000 1.25 +++ sys/arch/sun3/dev/zs_kgdb.c 29 Sep 2012 12:23:25 -0000 @@ -143,7 +143,7 @@ zs_kgdb_init(void) zsc_unit = (kgdb_dev & 2) ? 0 : 1; channel = kgdb_dev & 1; printf("zs_kgdb_init: attaching tty%c at %d baud\n", - 'a' + (kgdb_dev & 3), kgdb_rate); + 'a' + ((int)kgdb_dev & 3), kgdb_rate); /* Setup temporary chanstate. */ memset((void *)&cs, 0, sizeof(cs)); Index: sys/arch/sun3/include/autoconf.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/sun3/include/autoconf.h,v retrieving revision 1.26 diff -u -p -r1.26 autoconf.h --- sys/arch/sun3/include/autoconf.h 28 Apr 2008 20:23:38 -0000 1.26 +++ sys/arch/sun3/include/autoconf.h 2 Oct 2012 02:16:20 -0000 @@ -72,7 +72,7 @@ extern struct sun68k_bus_space_tag mainb #define cf_intpri cf_loc[1] #define cf_intvec cf_loc[2] -int bus_scan(struct device *, struct cfdata *, const int *, void *); +int bus_scan(device_t, cfdata_t, const int *, void *); int bus_print(void *, const char *); int bus_peek(int, int, int); void *bus_mapin(int, int, int); Index: sys/arch/sun3/sun3/autoconf.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/sun3/sun3/autoconf.c,v retrieving revision 1.77 diff -u -p -r1.77 autoconf.c --- sys/arch/sun3/sun3/autoconf.c 30 Jul 2012 17:21:31 -0000 1.77 +++ sys/arch/sun3/sun3/autoconf.c 9 Oct 2012 01:16:43 -0000 @@ -98,7 +98,7 @@ cpu_configure(void) * setup the confargs for each child match and attach call. */ int -bus_scan(struct device *parent, struct cfdata *cf, const int *ldesc, void *aux) +bus_scan(device_t parent, cfdata_t cf, const int *ldesc, void *aux) { struct confargs *ca = aux; @@ -154,13 +154,13 @@ bus_print(void *args, const char *name) /****************************************************************/ /* This takes the args: name, ctlr, unit */ -typedef struct device * (*findfunc_t)(char *, int, int); +typedef device_t (*findfunc_t)(char *, int, int); -static struct device * net_find (char *, int, int); +static device_t net_find(char *, int, int); #if NSCSIBUS > 0 -static struct device * scsi_find(char *, int, int); +static device_t scsi_find(char *, int, int); #endif -static struct device * xx_find (char *, int, int); +static device_t xx_find(char *, int, int); struct prom_n2f { const char name[4]; @@ -218,7 +218,7 @@ cpu_rootconf(void) if (find) booted_device = (*find)(promname, bp->ctlrNum, bp->unitNum); if (booted_device) { - devname = booted_device->dv_xname; + devname = device_xname(booted_device); if (device_class(booted_device) == DV_DISK) { booted_partition = bp->partNum & 7; partname[0] = 'a' + booted_partition; @@ -237,7 +237,7 @@ cpu_rootconf(void) /* * Network device: Just use controller number. */ -static struct device * +static device_t net_find(char *name, int ctlr, int unit) { return device_find_by_driver_unit(name, ctlr); @@ -248,10 +248,10 @@ net_find(char *name, int ctlr, int unit) * SCSI device: The controller number corresponds to the * scsibus number, and the unit number is (targ*8 + LUN). */ -static struct device * +static device_t scsi_find(char *name, int ctlr, int unit) { - struct device *scsibus; + device_t scsibus; struct scsibus_softc *sbsc; struct scsipi_periph *periph; int target, lun; @@ -278,7 +278,7 @@ scsi_find(char *name, int ctlr, int unit * Xylogics SMD disk: (xy, xd) * Assume wired-in unit numbers for now... */ -static struct device * +static device_t xx_find(char *name, int ctlr, int unit) { return device_find_by_driver_unit(name, ctlr * 2 + unit); Index: sys/arch/sun3/sun3x/obio.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/sun3/sun3x/obio.c,v retrieving revision 1.32 diff -u -p -r1.32 obio.c --- sys/arch/sun3/sun3x/obio.c 28 Jun 2008 12:13:38 -0000 1.32 +++ sys/arch/sun3/sun3x/obio.c 29 Sep 2012 10:18:26 -0000 @@ -157,7 +157,7 @@ static paddr_t obio_alist[] = { #define OBIO_ALIST_LEN __arraycount(obio_alist) static void -obio_attach(struct device *parent, struct device *self, void *aux) +obio_attach(device_t parent, device_t self, void *aux) { struct confargs *ca = aux; struct obio_softc *sc = device_private(self); Index: sys/arch/sun3/sun3x/vme.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/sun3/sun3x/vme.c,v retrieving revision 1.15 diff -u -p -r1.15 vme.c --- sys/arch/sun3/sun3x/vme.c 28 Jun 2008 12:13:38 -0000 1.15 +++ sys/arch/sun3/sun3x/vme.c 26 Sep 2012 21:34:18 -0000 @@ -70,8 +70,8 @@ static const struct { { BUS_VME32D32, "A32/D32", PMAP_VME32, VME32_BASE, VME32_MASK }, }; -static int vme_match(struct device *, struct cfdata *, void *); -static void vme_attach(struct device *, struct device *, void *); +static int vme_match(device_t, cfdata_t, void *); +static void vme_attach(device_t, device_t, void *); struct vme_softc { device_t sc_dev; Index: sys/arch/sun68k/sun68k/autoconf.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/sun68k/sun68k/autoconf.c,v retrieving revision 1.29 diff -u -p -r1.29 autoconf.c --- sys/arch/sun68k/sun68k/autoconf.c 29 Jul 2012 18:05:46 -0000 1.29 +++ sys/arch/sun68k/sun68k/autoconf.c 9 Oct 2012 01:16:43 -0000 @@ -349,7 +349,7 @@ cpu_rootconf(void) if (find) booted_device = (*find)(promname, prom_ctlr, prom_unit); if (booted_device) { - devname = booted_device->dv_xname; + devname = device_xname(booted_device); if (device_class(booted_device) == DV_DISK) { booted_partition = prom_part & 7; partname[0] = 'a' + booted_partition; Index: sys/arch/vax/vax/autoconf.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/vax/vax/autoconf.c,v retrieving revision 1.94 diff -u -p -r1.94 autoconf.c --- sys/arch/vax/vax/autoconf.c 29 Jul 2012 18:05:47 -0000 1.94 +++ sys/arch/vax/vax/autoconf.c 28 Sep 2012 18:03:40 -0000 @@ -419,7 +419,7 @@ int booted_ra(device_t dev, void *aux) { struct drive_attach_args *da = aux; - struct mscp_softc *pdev = (void *)device_parent(dev); + struct mscp_softc *pdev = device_private(device_parent(dev)); paddr_t ioaddr; if (jmfr("ra", dev, BDEV_UDA)) Index: sys/arch/vax/vsa/asc_vsbus.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/vax/vsa/asc_vsbus.c,v retrieving revision 1.42 diff -u -p -r1.42 asc_vsbus.c --- sys/arch/vax/vsa/asc_vsbus.c 14 Dec 2010 23:31:16 -0000 1.42 +++ sys/arch/vax/vsa/asc_vsbus.c 29 Sep 2012 11:41:05 -0000 @@ -410,7 +410,7 @@ asc_vsbus_dma_setup(struct ncr53c9x_soft panic("%s: DMA address (%p) outside of kernel", __func__, *asc->sc_dmaaddr); - NCR_DMA(("%s: start %d@%p,%d\n", device_xname(&sc->sc_dev), + NCR_DMA(("%s: start %d@%p,%d\n", device_xname(sc->sc_dev), (int)*asc->sc_dmalen, *asc->sc_dmaaddr, (asc->sc_flags & ASC_FROMMEMORY))); *dmasize = asc->sc_dmasize = min(*dmasize, ASC_MAXXFERSIZE); Index: sys/arch/x68k/dev/grf_machdep.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/x68k/dev/grf_machdep.c,v retrieving revision 1.30 diff -u -p -r1.30 grf_machdep.c --- sys/arch/x68k/dev/grf_machdep.c 8 Feb 2011 20:20:25 -0000 1.30 +++ sys/arch/x68k/dev/grf_machdep.c 29 Sep 2012 10:57:24 -0000 @@ -79,32 +79,32 @@ CFATTACH_DECL_NEW(grf, sizeof(struct grf extern struct cfdriver grfbus_cd; int -grfbusmatch(device_t pdp, cfdata_t cfp, void *auxp) +grfbusmatch(device_t parent, cfdata_t cf, void *aux) { - if (strcmp(auxp, grfbus_cd.cd_name)) + if (strcmp(aux, grfbus_cd.cd_name)) return (0); return (1); } void -grfbusattach(device_t pdp, device_t dp, void *auxp) +grfbusattach(device_t parent, device_t self, void *aux) { aprint_normal("\n"); - config_search_ia(grfbussearch, dp, "grfb", NULL); + config_search_ia(grfbussearch, self, "grfb", NULL); } int -grfbussearch(device_t dp, cfdata_t match, const int *ldesc, void *aux) +grfbussearch(device_t self, cfdata_t match, const int *ldesc, void *aux) { - config_found(dp, &match->cf_loc[GRFBCF_ADDR], grfbusprint); + config_found(self, &match->cf_loc[GRFBCF_ADDR], grfbusprint); return (0); } int -grfbusprint(void *auxp, const char *name) +grfbusprint(void *aux, const char *name) { if (name == NULL) @@ -130,17 +130,17 @@ grfmatch(device_t parent, cfdata_t cfp, struct grf_softc congrf; void -grfattach(device_t parent, device_t dp, void *aux) +grfattach(device_t parent, device_t self, void *aux) { struct grf_softc *gp; struct cfdata *cf; int addr; - cf = device_cfdata(dp); + cf = device_cfdata(self); addr = cf->cf_loc[GRFBCF_ADDR]; - gp = device_private(dp); - gp->g_device = dp; + gp = device_private(self); + gp->g_device = self; gp->g_cfaddr = addr; grfinit(gp, addr); @@ -155,11 +155,11 @@ grfattach(device_t parent, device_t dp, /* * try and attach an ite */ - config_found(dp, gp, grfprint); + config_found(self, gp, grfprint); } int -grfprint(void *auxp, const char *pnp) +grfprint(void *aux, const char *pnp) { if (pnp) Index: sys/arch/x68k/dev/ite.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/x68k/dev/ite.c,v retrieving revision 1.59 diff -u -p -r1.59 ite.c --- sys/arch/x68k/dev/ite.c 24 Apr 2011 16:26:58 -0000 1.59 +++ sys/arch/x68k/dev/ite.c 29 Sep 2012 12:23:54 -0000 @@ -170,12 +170,12 @@ const struct cdevsw ite_cdevsw = { }; int -itematch(device_t pdp, cfdata_t cdp, void *auxp) +itematch(device_t parent, cfdata_t cf, void *aux) { struct grf_softc *gp; - gp = auxp; - if (cdp->cf_loc[GRFCF_GRFADDR] != gp->g_cfaddr) + gp = aux; + if (cf->cf_loc[GRFCF_GRFADDR] != gp->g_cfaddr) return 0; return 1; @@ -186,13 +186,14 @@ itematch(device_t pdp, cfdata_t cdp, voi * an ite device, it is also called from ite_cninit(). */ void -iteattach(device_t pdp, device_t dp, void *auxp) +iteattach(device_t parent, device_t self, void *aux) { struct ite_softc *ip; struct grf_softc *gp; - gp = (struct grf_softc *)auxp; - ip = device_private(dp); + gp = aux; + ip = device_private(self); + ip->device = self; if(con_itesoftc.grf != NULL /*&& con_itesoftc.grf->g_unit == gp->g_unit*/) { /* @@ -205,7 +206,7 @@ iteattach(device_t pdp, device_t dp, voi kbd_ite = ip; } ip->grf = gp; - iteinit(device_unit(&ip->device)); /* XXX */ + iteinit(device_unit(self)); /* XXX */ aprint_normal(": rows %d cols %d", ip->rows, ip->cols); if (kbd_ite == NULL) kbd_ite = ip; @@ -240,7 +241,7 @@ iteinit(dev_t dev) ip->cursorx = 0; ip->cursory = 0; - ip->isw = &itesw[device_unit(&ip->device)]; /* XXX */ + ip->isw = &itesw[device_unit(ip->device)]; /* XXX */ SUBR_INIT(ip); SUBR_CURSOR(ip, DRAW_CURSOR); if (!ip->tabs) @@ -714,7 +715,7 @@ ite_filter(u_char c) struct key key; int s, i; - if (!kbd_ite || !(kbd_tty = ite_tty[device_unit(&kbd_ite->device)])) + if (!kbd_ite || !(kbd_tty = ite_tty[device_unit(kbd_ite->device)])) return; /* have to make sure we're at spltty in here */ @@ -2086,7 +2087,7 @@ iteputchar(int c, struct ite_softc *ip) case BEL: #if NBELL > 0 - if (kbd_ite && ite_tty[device_unit(&kbd_ite->device)]) + if (kbd_ite && ite_tty[device_unit(kbd_ite->device)]) opm_bell(); #endif break; Index: sys/arch/x68k/dev/itevar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/x68k/dev/itevar.h,v retrieving revision 1.14 diff -u -p -r1.14 itevar.h --- sys/arch/x68k/dev/itevar.h 8 Feb 2011 20:20:25 -0000 1.14 +++ sys/arch/x68k/dev/itevar.h 29 Sep 2012 10:55:53 -0000 @@ -61,7 +61,7 @@ enum ite_arraymaxs { #define ARGBUF_SIZE 256 struct ite_softc { - struct device device; + device_t device; struct grf_softc *grf; struct itesw *isw; int flags; Index: sys/arch/x68k/dev/mha.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/x68k/dev/mha.c,v retrieving revision 1.52 diff -u -p -r1.52 mha.c --- sys/arch/x68k/dev/mha.c 23 Nov 2009 00:11:45 -0000 1.52 +++ sys/arch/x68k/dev/mha.c 28 Sep 2012 17:42:09 -0000 @@ -337,7 +337,7 @@ mhaattach(device_t parent, device_t self /* * Fill in the adapter. */ - sc->sc_adapter.adapt_dev = sc->sc_dev; + sc->sc_adapter.adapt_dev = self; sc->sc_adapter.adapt_nchannels = 1; sc->sc_adapter.adapt_openings = 7; sc->sc_adapter.adapt_max_periph = 1; @@ -674,7 +674,7 @@ mha_scsi_request(struct scsipi_channel * { struct scsipi_xfer *xs; struct scsipi_periph *periph; - struct mha_softc *sc = (void *)chan->chan_adapter->adapt_dev; + struct mha_softc *sc = device_private(chan->chan_adapter->adapt_dev); struct acb *acb; int s, flags; @@ -1949,7 +1949,7 @@ mha_timeout(void *arg) struct scsipi_xfer *xs = acb->xs; struct scsipi_periph *periph = xs->xs_periph; struct mha_softc *sc = - (void *)periph->periph_channel->chan_adapter->adapt_dev; + device_private(periph->periph_channel->chan_adapter->adapt_dev); int s; s = splbio(); Index: sys/arch/x68k/dev/par.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/x68k/dev/par.c,v retrieving revision 1.38 diff -u -p -r1.38 par.c --- sys/arch/x68k/dev/par.c 9 Jan 2010 09:16:32 -0000 1.38 +++ sys/arch/x68k/dev/par.c 29 Sep 2012 10:53:41 -0000 @@ -130,7 +130,7 @@ const struct cdevsw par_cdevsw = { }; int -parmatch(device_t pdp, cfdata_t cfp, void *aux) +parmatch(device_t parent, cfdata_t cf, void *aux) { struct intio_attach_args *ia = aux; @@ -141,7 +141,7 @@ parmatch(device_t pdp, cfdata_t cfp, voi if (ia->ia_addr == INTIOCF_ADDR_DEFAULT) ia->ia_addr = 0xe8c000; ia->ia_size = 0x2000; - if (intio_map_allocate_region(pdp, ia, INTIO_MAP_TESTONLY)) + if (intio_map_allocate_region(parent, ia, INTIO_MAP_TESTONLY)) return 0; if (ia->ia_intr == INTIOCF_INTR_DEFAULT) ia->ia_intr = 99; @@ -154,19 +154,19 @@ parmatch(device_t pdp, cfdata_t cfp, voi } void -parattach(device_t pdp, device_t dp, void *aux) +parattach(device_t parent, device_t self, void *aux) { - struct par_softc *sc = device_private(dp); + struct par_softc *sc = device_private(self); struct intio_attach_args *ia = aux; int r; par_attached = 1; - sc->sc_dev = dp; + sc->sc_dev = self; sc->sc_flags = PARF_ALIVE; aprint_normal(": parallel port (write only, interrupt)\n"); ia->ia_size = 0x2000; - r = intio_map_allocate_region(pdp, ia, INTIO_MAP_ALLOCATE); + r = intio_map_allocate_region(parent, ia, INTIO_MAP_ALLOCATE); #ifdef DIAGNOSTIC if (r) panic("IO map for PAR corruption??"); Index: sys/arch/x68k/include/bus.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/x68k/include/bus.h,v retrieving revision 1.24 diff -u -p -r1.24 bus.h --- sys/arch/x68k/include/bus.h 24 Mar 2011 15:05:55 -0000 1.24 +++ sys/arch/x68k/include/bus.h 2 Oct 2012 02:17:18 -0000 @@ -99,7 +99,7 @@ struct x68k_bus_space { int); /* flags */ #endif - struct device *x68k_bus_device; + device_t x68k_bus_device; }; int x68k_bus_space_alloc(bus_space_tag_t, bus_addr_t, bus_addr_t, bus_size_t, Index: sys/arch/x86/pci/pci_ranges.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/x86/pci/pci_ranges.c,v retrieving revision 1.3 diff -u -p -r1.3 pci_ranges.c --- sys/arch/x86/pci/pci_ranges.c 18 Oct 2011 23:30:54 -0000 1.3 +++ sys/arch/x86/pci/pci_ranges.c 29 Sep 2012 11:19:39 -0000 @@ -999,7 +999,7 @@ device_pci_props_register(device_t dev, #if 0 aprint_normal_dev(dev, "is%s a pci, parent %p, cf %p, ifattr %s\n", device_is_a(dev, "pci") ? "" : " not", - (const void *)device_parent(dev), + device_parent(dev), cf, cf != NULL ? cfdata_ifattr(cf) : ""); #endif Index: sys/arch/zaurus/dev/zaudio.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/zaurus/dev/zaudio.c,v retrieving revision 1.19 diff -u -p -r1.19 zaudio.c --- sys/arch/zaurus/dev/zaudio.c 29 Jan 2012 10:12:41 -0000 1.19 +++ sys/arch/zaurus/dev/zaudio.c 1 Oct 2012 14:33:26 -0000 @@ -102,7 +102,6 @@ struct zaudio_volume { }; struct zaudio_softc { - device_t sc_dev; kmutex_t sc_lock; kmutex_t sc_intr_lock; @@ -342,7 +341,6 @@ zaudio_attach(device_t parent, device_t struct i2c_attach_args *ia = aux; int error; - sc->sc_dev = self; sc->sc_i2c = ia->ia_tag; mutex_init(&sc->sc_lock, MUTEX_DEFAULT, IPL_NONE); mutex_init(&sc->sc_intr_lock, MUTEX_DEFAULT, IPL_SCHED); Index: sys/arch/zaurus/dev/zkbd.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/zaurus/dev/zkbd.c,v retrieving revision 1.16 diff -u -p -r1.16 zkbd.c --- sys/arch/zaurus/dev/zkbd.c 29 Jan 2012 10:12:42 -0000 1.16 +++ sys/arch/zaurus/dev/zkbd.c 2 Oct 2012 02:17:29 -0000 @@ -138,7 +138,7 @@ struct zkbd_softc { int sc_pollkey; /* wskbd bits */ - struct device *sc_wskbddev; + device_t sc_wskbddev; struct wskbd_mapdata *sc_keymapdata; int sc_rawkbd; #ifdef WSDISPLAY_COMPAT_RAWKBD Index: sys/arch/zaurus/dev/zrc.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/zaurus/dev/zrc.c,v retrieving revision 1.8 diff -u -p -r1.8 zrc.c --- sys/arch/zaurus/dev/zrc.c 25 Jan 2012 15:58:10 -0000 1.8 +++ sys/arch/zaurus/dev/zrc.c 2 Oct 2012 02:17:45 -0000 @@ -89,14 +89,14 @@ struct zrc_softc { int sc_scans; /* rescan counter */ int sc_noise; /* discard if too noisy? */ int sc_keydown; /* currently pressed key */ - struct device *sc_wskbddev; + device_t sc_wskbddev; #ifdef WSDISPLAY_COMPAT_RAWKBD int sc_rawkbd; #endif }; -static int zrc_match(struct device *, struct cfdata *, void *); -static void zrc_attach(struct device *, struct device *, void *); +static int zrc_match(device_t, cfdata_t, void *); +static void zrc_attach(device_t, device_t, void *); CFATTACH_DECL_NEW(zrc, sizeof(struct zrc_softc), zrc_match, zrc_attach, NULL, NULL); Index: sys/arch/zaurus/dev/ztp.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/arch/zaurus/dev/ztp.c,v retrieving revision 1.13 diff -u -p -r1.13 ztp.c --- sys/arch/zaurus/dev/ztp.c 29 Jan 2012 10:12:42 -0000 1.13 +++ sys/arch/zaurus/dev/ztp.c 2 Oct 2012 02:17:57 -0000 @@ -114,7 +114,7 @@ struct ztp_softc { void *sc_gh; int sc_enabled; int sc_buttons; /* button emulation ? */ - struct device *sc_wsmousedev; + device_t sc_wsmousedev; struct ztp_pos sc_oldpos; int sc_resx; int sc_resy; Index: sys/dev/audiobell.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/audiobell.c,v retrieving revision 1.8 diff -u -p -r1.8 audiobell.c --- sys/dev/audiobell.c 12 May 2009 10:22:31 -0000 1.8 +++ sys/dev/audiobell.c 2 Oct 2012 03:05:18 -0000 @@ -34,8 +34,8 @@ __KERNEL_RCSID(0, "$NetBSD: audiobell.c,v 1.8 2009/05/12 10:22:31 cegger Exp $"); #include -#include #include +#include #include #include #include Index: sys/dev/clockctl.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/clockctl.c,v retrieving revision 1.29 diff -u -p -r1.29 clockctl.c --- sys/dev/clockctl.c 4 Jan 2012 13:40:53 -0000 1.29 +++ sys/dev/clockctl.c 1 Oct 2012 14:19:12 -0000 @@ -54,10 +54,6 @@ __KERNEL_RCSID(0, "$NetBSD: clockctl.c,v #include #endif -struct clockctl_softc { - struct device clockctl_dev; -}; - dev_type_ioctl(clockctlioctl); const struct cdevsw clockctl_cdevsw = { Index: sys/dev/ld.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/ld.c,v retrieving revision 1.69 diff -u -p -r1.69 ld.c --- sys/dev/ld.c 2 Feb 2012 19:43:01 -0000 1.69 +++ sys/dev/ld.c 29 Sep 2012 11:45:22 -0000 @@ -252,7 +252,7 @@ ldenddetach(struct ld_softc *sc) /* Flush the device's cache. */ if (sc->sc_flush != NULL) if ((*sc->sc_flush)(sc, 0) != 0) - aprint_error_dev(&sc->sc_dv, "unable to flush cache\n"); + aprint_error_dev(sc->sc_dv, "unable to flush cache\n"); #endif mutex_destroy(&sc->sc_mutex); } Index: sys/dev/sequencervar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/sequencervar.h,v retrieving revision 1.14 diff -u -p -r1.14 sequencervar.h --- sys/dev/sequencervar.h 23 Nov 2011 23:07:31 -0000 1.14 +++ sys/dev/sequencervar.h 1 Oct 2012 16:42:28 -0000 @@ -74,8 +74,6 @@ struct midi_dev { }; struct sequencer_softc { - struct device dev; - struct device *sc_dev; /* Hardware device struct */ callout_t sc_callout; kmutex_t lock; kcondvar_t wchan; Index: sys/dev/adb/adb_ms.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/adb/adb_ms.c,v retrieving revision 1.13 diff -u -p -r1.13 adb_ms.c --- sys/dev/adb/adb_ms.c 2 Jun 2012 21:36:43 -0000 1.13 +++ sys/dev/adb/adb_ms.c 2 Oct 2012 02:18:12 -0000 @@ -76,7 +76,7 @@ struct adbms_softc { char sc_devid[5]; /* device indentifier */ uint8_t sc_us; /* cmd to watch for */ int sc_mb; /* current button state */ - struct device *sc_wsmousedev; + device_t sc_wsmousedev; /* helpers for trackpads */ int sc_down; /* Index: sys/dev/ata/ata_raid.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/ata/ata_raid.c,v retrieving revision 1.34 diff -u -p -r1.34 ata_raid.c --- sys/dev/ata/ata_raid.c 6 Jul 2010 18:03:21 -0000 1.34 +++ sys/dev/ata/ata_raid.c 1 Oct 2012 16:09:26 -0000 @@ -177,8 +177,7 @@ ata_raid_finalize(device_t self) * Autoconfiguration glue: match routine. */ static int -ataraid_match(device_t parent, cfdata_t cf, - void *aux) +ataraid_match(device_t parent, cfdata_t cf, void *aux) { /* pseudo-device; always present */ @@ -191,8 +190,7 @@ ataraid_match(device_t parent, cfdata_t * Autoconfiguration glue: attach routine. We attach the children. */ static void -ataraid_attach(device_t parent, device_t self, - void *aux) +ataraid_attach(device_t parent, device_t self, void *aux) { struct ataraid_array_info *aai; int locs[ATARAIDCF_NLOCS]; Index: sys/dev/bluetooth/btkbd.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/bluetooth/btkbd.c,v retrieving revision 1.14 diff -u -p -r1.14 btkbd.c --- sys/dev/bluetooth/btkbd.c 3 Apr 2012 09:32:53 -0000 1.14 +++ sys/dev/bluetooth/btkbd.c 1 Oct 2012 15:47:13 -0000 @@ -332,18 +332,18 @@ btkbd_parse_desc(struct btkbd_softc *sc, */ static int -btkbd_enable(void *self, int on) +btkbd_enable(void *cookie, int on) { - struct btkbd_softc *sc = self; + struct btkbd_softc *sc = cookie; sc->sc_enabled = on; return 0; } static void -btkbd_set_leds(void *self, int leds) +btkbd_set_leds(void *cookie, int leds) { - struct btkbd_softc *sc = self; + struct btkbd_softc *sc = cookie; uint8_t report; if (sc->sc_leds == leds) @@ -371,10 +371,10 @@ btkbd_set_leds(void *self, int leds) } static int -btkbd_ioctl(void *self, unsigned long cmd, void *data, int flag, +btkbd_ioctl(void *cookie, unsigned long cmd, void *data, int flag, struct lwp *l) { - struct btkbd_softc *sc = self; + struct btkbd_softc *sc = cookie; switch (cmd) { case WSKBDIO_GTYPE: @@ -463,9 +463,9 @@ static const u_int8_t btkbd_trtab[256] = #define REP_DELAYN 100 static void -btkbd_input(struct bthidev *self, uint8_t *data, int len) +btkbd_input(struct bthidev *hidev, uint8_t *data, int len) { - struct btkbd_softc *sc = (struct btkbd_softc *)self; + struct btkbd_softc *sc = (struct btkbd_softc *)hidev; struct btkbd_data *ud = &sc->sc_ndata; uint16_t ibuf[MAXKEYS]; uint32_t mod, omod; Index: sys/dev/bluetooth/btms.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/bluetooth/btms.c,v retrieving revision 1.10 diff -u -p -r1.10 btms.c --- sys/dev/bluetooth/btms.c 3 Apr 2012 09:32:53 -0000 1.10 +++ sys/dev/bluetooth/btms.c 1 Oct 2012 15:47:55 -0000 @@ -302,9 +302,9 @@ btms_detach(device_t self, int flags) */ static int -btms_wsmouse_enable(void *self) +btms_wsmouse_enable(void *cookie) { - struct btms_softc *sc = self; + struct btms_softc *sc = cookie; if (sc->sc_enabled) return EBUSY; @@ -314,10 +314,9 @@ btms_wsmouse_enable(void *self) } static int -btms_wsmouse_ioctl(void *self, unsigned long cmd, void *data, +btms_wsmouse_ioctl(void *cookie, unsigned long cmd, void *data, int flag, struct lwp *l) { - /* struct btms_softc *sc = self; */ switch (cmd) { case WSMOUSEIO_GTYPE: @@ -332,9 +331,9 @@ btms_wsmouse_ioctl(void *self, unsigned } static void -btms_wsmouse_disable(void *self) +btms_wsmouse_disable(void *cookie) { - struct btms_softc *sc = self; + struct btms_softc *sc = cookie; sc->sc_enabled = 0; } @@ -345,9 +344,9 @@ btms_wsmouse_disable(void *self) */ static void -btms_input(struct bthidev *self, uint8_t *data, int len) +btms_input(struct bthidev *hidev, uint8_t *data, int len) { - struct btms_softc *sc = (struct btms_softc *)self; + struct btms_softc *sc = (struct btms_softc *)hidev; int dx, dy, dz, dw; uint32_t buttons; int i, s; Index: sys/dev/cardbus/adv_cardbus.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/cardbus/adv_cardbus.c,v retrieving revision 1.28 diff -u -p -r1.28 adv_cardbus.c --- sys/dev/cardbus/adv_cardbus.c 1 Aug 2011 11:20:27 -0000 1.28 +++ sys/dev/cardbus/adv_cardbus.c 26 Sep 2012 20:46:12 -0000 @@ -67,7 +67,7 @@ __KERNEL_RCSID(0, "$NetBSD: adv_cardbus. #define ADV_CARDBUS_DEBUG #define ADV_CARDBUS_ALLOW_MEMIO -#define DEVNAME(sc) device_xname(&(sc)->sc_dev) +#define DEVNAME(sc) device_xname((sc)->sc_dev) struct adv_cardbus_softc { struct asc_softc sc_adv; /* real ADV */ @@ -85,12 +85,11 @@ int adv_cardbus_match(device_t, cfdata_t void adv_cardbus_attach(device_t, device_t, void *); int adv_cardbus_detach(device_t, int); -CFATTACH_DECL(adv_cardbus, sizeof(struct adv_cardbus_softc), +CFATTACH_DECL_NEW(adv_cardbus, sizeof(struct adv_cardbus_softc), adv_cardbus_match, adv_cardbus_attach, adv_cardbus_detach, NULL); int -adv_cardbus_match(device_t parent, cfdata_t match, - void *aux) +adv_cardbus_match(device_t parent, cfdata_t match, void *aux) { struct cardbus_attach_args *ca = aux; @@ -102,8 +101,7 @@ adv_cardbus_match(device_t parent, cfdat } void -adv_cardbus_attach(device_t parent, device_t self, - void *aux) +adv_cardbus_attach(device_t parent, device_t self, void *aux) { struct cardbus_attach_args *ca = aux; struct adv_cardbus_softc *csc = device_private(self); @@ -114,6 +112,7 @@ adv_cardbus_attach(device_t parent, devi pcireg_t reg; u_int8_t latency = 0x20; + sc->sc_dev = self; sc->sc_flags = 0; if (PCI_VENDOR(ca->ca_id) == PCI_VENDOR_ADVSYS) { @@ -174,7 +173,7 @@ adv_cardbus_attach(device_t parent, devi csc->sc_csr |= PCI_COMMAND_IO_ENABLE; } else { csc->sc_bar = 0; - aprint_error_dev(&sc->sc_dev, "unable to map device registers\n"); + aprint_error_dev(sc->sc_dev, "unable to map device registers\n"); return; } @@ -218,7 +217,7 @@ adv_cardbus_attach(device_t parent, devi */ sc->sc_ih = Cardbus_intr_establish(ct, IPL_BIO, adv_intr, sc); if (sc->sc_ih == NULL) { - aprint_error_dev(&sc->sc_dev, + aprint_error_dev(sc->sc_dev, "unable to establish interrupt\n"); return; } Index: sys/dev/cardbus/cardslot.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/cardbus/cardslot.c,v retrieving revision 1.53 diff -u -p -r1.53 cardslot.c --- sys/dev/cardbus/cardslot.c 24 May 2011 16:37:04 -0000 1.53 +++ sys/dev/cardbus/cardslot.c 29 Sep 2012 11:48:39 -0000 @@ -67,8 +67,7 @@ static void cardslot_event_thread(void * STATIC int cardslot_cb_print(void *aux, const char *pcic); static int cardslot_16_print(void *, const char *); -static int cardslot_16_submatch(device_t, cfdata_t, - const int *, void *); +static int cardslot_16_submatch(device_t, cfdata_t, const int *, void *); CFATTACH_DECL3_NEW(cardslot, sizeof(struct cardslot_softc), cardslotmatch, cardslotattach, cardslotdetach, NULL, NULL, cardslotchilddet, @@ -103,8 +102,7 @@ cardslotchilddet(device_t self, device_t } STATIC void -cardslotattach(device_t parent, device_t self, - void *aux) +cardslotattach(device_t parent, device_t self, void *aux) { struct cardslot_softc *sc = device_private(self); struct cardslot_attach_args *caa = aux; Index: sys/dev/dec/dzkbd.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/dec/dzkbd.c,v retrieving revision 1.25 diff -u -p -r1.25 dzkbd.c --- sys/dev/dec/dzkbd.c 16 Jul 2012 12:55:36 -0000 1.25 +++ sys/dev/dec/dzkbd.c 28 Sep 2012 18:17:42 -0000 @@ -79,8 +79,6 @@ struct dzkbd_internal { struct dzkbd_internal dzkbd_console_internal; struct dzkbd_softc { - struct device dzkbd_dev; /* required first: base device */ - struct dzkbd_internal *sc_itl; int sc_enabled; @@ -94,7 +92,7 @@ static int dzkbd_input(void *, int); static int dzkbd_match(device_t, cfdata_t, void *); static void dzkbd_attach(device_t, device_t, void *); -CFATTACH_DECL(dzkbd, sizeof(struct dzkbd_softc), +CFATTACH_DECL_NEW(dzkbd, sizeof(struct dzkbd_softc), dzkbd_match, dzkbd_attach, NULL, NULL); static int dzkbd_enable(void *, int); Index: sys/dev/dec/dzms.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/dec/dzms.c,v retrieving revision 1.21 diff -u -p -r1.21 dzms.c --- sys/dev/dec/dzms.c 12 May 2009 14:18:16 -0000 1.21 +++ sys/dev/dec/dzms.c 28 Sep 2012 18:17:59 -0000 @@ -69,7 +69,6 @@ __KERNEL_RCSID(0, "$NetBSD: dzms.c,v 1.2 #include "locators.h" struct dzms_softc { /* driver status information */ - struct device dzms_dev; /* required first: base device */ struct dz_linestate *dzms_ls; int sc_enabled; /* input enabled? */ @@ -86,7 +85,7 @@ static int dzms_match(device_t, cfdata_ static void dzms_attach(device_t, device_t, void *); static int dzms_input(void *, int); -CFATTACH_DECL(dzms, sizeof(struct dzms_softc), +CFATTACH_DECL_NEW(dzms, sizeof(struct dzms_softc), dzms_match, dzms_attach, NULL, NULL); static int dzms_enable(void *); Index: sys/dev/dec/vsxxxvar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/dec/vsxxxvar.h,v retrieving revision 1.5 diff -u -p -r1.5 vsxxxvar.h --- sys/dev/dec/vsxxxvar.h 12 May 2009 14:18:16 -0000 1.5 +++ sys/dev/dec/vsxxxvar.h 1 Oct 2012 14:42:24 -0000 @@ -30,7 +30,6 @@ */ struct vsxxx_softc { - struct device sc_dev; device_t sc_wsmousedev; unsigned sc_nbyte; union { Index: sys/dev/dkwedge/dk.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/dkwedge/dk.c,v retrieving revision 1.64 diff -u -p -r1.64 dk.c --- sys/dev/dkwedge/dk.c 10 Jun 2012 17:05:19 -0000 1.64 +++ sys/dev/dkwedge/dk.c 2 Oct 2012 02:18:27 -0000 @@ -68,7 +68,7 @@ typedef enum { } dkwedge_state_t; struct dkwedge_softc { - struct device *sc_dev; /* pointer to our pseudo-device */ + device_t sc_dev; /* pointer to our pseudo-device */ struct cfdata sc_cfdata; /* our cfdata structure */ uint8_t sc_wname[128]; /* wedge name (Unicode, UTF-8) */ Index: sys/dev/dtv/dtv_device.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/dtv/dtv_device.c,v retrieving revision 1.8 diff -u -p -r1.8 dtv_device.c --- sys/dev/dtv/dtv_device.c 9 Aug 2011 01:42:24 -0000 1.8 +++ sys/dev/dtv/dtv_device.c 2 Oct 2012 03:05:47 -0000 @@ -36,8 +36,8 @@ __KERNEL_RCSID(0, "$NetBSD: dtv_device.c,v 1.8 2011/08/09 01:42:24 jmcneill Exp $"); #include -#include #include +#include #include #include #include Index: sys/dev/eisa/ahb.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/eisa/ahb.c,v retrieving revision 1.59 diff -u -p -r1.59 ahb.c --- sys/dev/eisa/ahb.c 13 Nov 2010 13:51:58 -0000 1.59 +++ sys/dev/eisa/ahb.c 26 Sep 2012 18:37:43 -0000 @@ -86,7 +86,7 @@ __KERNEL_RCSID(0, "$NetBSD: ahb.c,v 1.59 #define AHB_MAXXFER ((AHB_NSEG - 1) << PGSHIFT) struct ahb_softc { - struct device sc_dev; + device_t sc_dev; bus_space_tag_t sc_iot; bus_space_handle_t sc_ioh; @@ -137,7 +137,7 @@ static int ahb_init_ecb(struct ahb_softc static int ahbmatch(device_t, cfdata_t, void *); static void ahbattach(device_t, device_t, void *); -CFATTACH_DECL(ahb, sizeof(struct ahb_softc), +CFATTACH_DECL_NEW(ahb, sizeof(struct ahb_softc), ahbmatch, ahbattach, NULL, NULL); #define AHB_ABORT_TIMEOUT 2000 /* time to wait for abort (mSec) */ @@ -192,6 +192,8 @@ ahbattach(device_t parent, device_t self struct scsipi_adapter *adapt = &sc->sc_adapter; struct scsipi_channel *chan = &sc->sc_channel; + sc->sc_dev = self; + if (!strcmp(ea->ea_idstring, "ADP0000")) model = EISA_PRODUCT_ADP0000; else if (!strcmp(ea->ea_idstring, "ADP0001")) @@ -221,7 +223,7 @@ ahbattach(device_t parent, device_t self * Fill in the scsipi_adapter. */ memset(adapt, 0, sizeof(*adapt)); - adapt->adapt_dev = &sc->sc_dev; + adapt->adapt_dev = sc->sc_dev; adapt->adapt_nchannels = 1; /* adapt_openings initialized below */ adapt->adapt_max_periph = 4; /* XXX arbitrary? */ @@ -245,7 +247,7 @@ ahbattach(device_t parent, device_t self } if (eisa_intr_map(ec, apd.sc_irq, &ih)) { - aprint_error_dev(&sc->sc_dev, "couldn't map interrupt (%d)\n", + aprint_error_dev(sc->sc_dev, "couldn't map interrupt (%d)\n", apd.sc_irq); return; } @@ -253,14 +255,14 @@ ahbattach(device_t parent, device_t self sc->sc_ih = eisa_intr_establish(ec, ih, IST_LEVEL, IPL_BIO, ahbintr, sc); if (sc->sc_ih == NULL) { - aprint_error_dev(&sc->sc_dev, "couldn't establish interrupt"); + aprint_error_dev(sc->sc_dev, "couldn't establish interrupt"); if (intrstr != NULL) aprint_error(" at %s", intrstr); aprint_error("\n"); return; } if (intrstr != NULL) - aprint_normal_dev(&sc->sc_dev, "interrupting at %s\n", + aprint_normal_dev(sc->sc_dev, "interrupting at %s\n", intrstr); /* @@ -286,7 +288,7 @@ ahb_send_mbox(struct ahb_softc *sc, int delay(10); } if (!wait) { - printf("%s: board not responding\n", device_xname(&sc->sc_dev)); + printf("%s: board not responding\n", device_xname(sc->sc_dev)); Debugger(); } @@ -321,7 +323,7 @@ ahb_send_immed(struct ahb_softc *sc, u_i delay(10); } if (!wait) { - printf("%s: board not responding\n", device_xname(&sc->sc_dev)); + printf("%s: board not responding\n", device_xname(sc->sc_dev)); Debugger(); } @@ -349,7 +351,7 @@ ahbintr(void *arg) u_int32_t mboxval; #ifdef AHBDEBUG - printf("%s: ahbintr ", device_xname(&sc->sc_dev)); + printf("%s: ahbintr ", device_xname(sc->sc_dev)); #endif /* AHBDEBUG */ if ((bus_space_read_1(iot, ioh, G2STAT) & G2STAT_INT_PEND) == 0) @@ -377,7 +379,7 @@ ahbintr(void *arg) case AHB_ECB_ERR: ecb = ahb_ecb_phys_kv(sc, mboxval); if (!ecb) { - aprint_error_dev(&sc->sc_dev, "BAD ECB RETURNED!\n"); + aprint_error_dev(sc->sc_dev, "BAD ECB RETURNED!\n"); goto next; /* whatever it was, it'll timeout */ } break; @@ -394,7 +396,7 @@ ahbintr(void *arg) break; default: - aprint_error_dev(&sc->sc_dev, "unexpected interrupt %x\n", + aprint_error_dev(sc->sc_dev, "unexpected interrupt %x\n", ahbstat); goto next; } @@ -445,7 +447,7 @@ ahb_init_ecb(struct ahb_softc *sc, struc error = bus_dmamap_create(dmat, AHB_MAXXFER, AHB_NSEG, AHB_MAXXFER, 0, BUS_DMA_NOWAIT|BUS_DMA_ALLOCNOW, &ecb->dmamap_xfer); if (error) { - aprint_error_dev(&sc->sc_dev, "can't create ecb dmamap_xfer\n"); + aprint_error_dev(sc->sc_dev, "can't create ecb dmamap_xfer\n"); return (error); } @@ -472,7 +474,7 @@ ahb_create_ecbs(struct ahb_softc *sc, st for (i = 0; i < count; i++) { ecb = &ecbstore[i]; if ((error = ahb_init_ecb(sc, ecb)) != 0) { - aprint_error_dev(&sc->sc_dev, "unable to initialize ecb, error = %d\n", + aprint_error_dev(sc->sc_dev, "unable to initialize ecb, error = %d\n", error); goto out; } @@ -555,7 +557,7 @@ ahb_done(struct ahb_softc *sc, struct ah * into the xfer and call whoever started it */ if ((ecb->flags & ECB_ALLOC) == 0) { - aprint_error_dev(&sc->sc_dev, "exiting ecb not allocated!\n"); + aprint_error_dev(sc->sc_dev, "exiting ecb not allocated!\n"); Debugger(); } if (ecb->flags & ECB_IMMED) { @@ -571,7 +573,7 @@ ahb_done(struct ahb_softc *sc, struct ah break; default: /* Other scsi protocol messes */ printf("%s: host_stat %x\n", - device_xname(&sc->sc_dev), ecb->ecb_status.host_stat); + device_xname(sc->sc_dev), ecb->ecb_status.host_stat); xs->error = XS_DRIVER_STUFFUP; } } else if (ecb->ecb_status.target_stat != SCSI_OK) { @@ -587,7 +589,7 @@ ahb_done(struct ahb_softc *sc, struct ah break; default: printf("%s: target_stat %x\n", - device_xname(&sc->sc_dev), ecb->ecb_status.target_stat); + device_xname(sc->sc_dev), ecb->ecb_status.target_stat); xs->error = XS_DRIVER_STUFFUP; } } else @@ -702,14 +704,14 @@ ahb_init(struct ahb_softc *sc) */ if ((error = bus_dmamem_alloc(sc->sc_dmat, ECBSIZE, PAGE_SIZE, 0, &seg, 1, &rseg, BUS_DMA_NOWAIT)) != 0) { - aprint_error_dev(&sc->sc_dev, "unable to allocate ecbs, error = %d\n", + aprint_error_dev(sc->sc_dev, "unable to allocate ecbs, error = %d\n", error); return (error); } if ((error = bus_dmamem_map(sc->sc_dmat, &seg, rseg, ECBSIZE, (void **)&sc->sc_ecbs, BUS_DMA_NOWAIT|BUS_DMA_COHERENT)) != 0) { - aprint_error_dev(&sc->sc_dev, "unable to map ecbs, error = %d\n", + aprint_error_dev(sc->sc_dev, "unable to map ecbs, error = %d\n", error); return (error); } @@ -719,13 +721,13 @@ ahb_init(struct ahb_softc *sc) */ if ((error = bus_dmamap_create(sc->sc_dmat, ECBSIZE, 1, ECBSIZE, 0, BUS_DMA_NOWAIT, &sc->sc_dmamap_ecb)) != 0) { - aprint_error_dev(&sc->sc_dev, "unable to create ecb DMA map, error = %d\n", + aprint_error_dev(sc->sc_dev, "unable to create ecb DMA map, error = %d\n", error); return (error); } if ((error = bus_dmamap_load(sc->sc_dmat, sc->sc_dmamap_ecb, sc->sc_ecbs, ECBSIZE, NULL, BUS_DMA_NOWAIT)) != 0) { - aprint_error_dev(&sc->sc_dev, "unable to load ecb DMA map, error = %d\n", + aprint_error_dev(sc->sc_dev, "unable to load ecb DMA map, error = %d\n", error); return (error); } @@ -737,11 +739,11 @@ ahb_init(struct ahb_softc *sc) */ i = ahb_create_ecbs(sc, sc->sc_ecbs, AHB_ECB_MAX); if (i == 0) { - aprint_error_dev(&sc->sc_dev, "unable to create ecbs\n"); + aprint_error_dev(sc->sc_dev, "unable to create ecbs\n"); return (ENOMEM); } else if (i != AHB_ECB_MAX) { printf("%s: WARNING: only %d of %d ecbs created\n", - device_xname(&sc->sc_dev), i, AHB_ECB_MAX); + device_xname(sc->sc_dev), i, AHB_ECB_MAX); } sc->sc_adapter.adapt_openings = i; @@ -768,7 +770,7 @@ ahb_scsipi_request(struct scsipi_channel { struct scsipi_xfer *xs; struct scsipi_periph *periph; - struct ahb_softc *sc = (void *)chan->chan_adapter->adapt_dev; + struct ahb_softc *sc = device_private(chan->chan_adapter->adapt_dev); bus_dma_tag_t dmat = sc->sc_dmat; struct ahb_ecb *ecb; int error, seg, flags, s; @@ -833,7 +835,7 @@ ahb_scsipi_request(struct scsipi_channel * Put all the arguments for the xfer in the ecb */ if (xs->cmdlen > sizeof(ecb->scsi_cmd)) { - aprint_error_dev(&sc->sc_dev, "cmdlen %d too large for ECB\n", + aprint_error_dev(sc->sc_dev, "cmdlen %d too large for ECB\n", xs->cmdlen); xs->error = XS_DRIVER_STUFFUP; goto out_bad; @@ -879,7 +881,7 @@ ahb_scsipi_request(struct scsipi_channel default: xs->error = XS_DRIVER_STUFFUP; - aprint_error_dev(&sc->sc_dev, "error %d loading DMA map\n", + aprint_error_dev(sc->sc_dev, "error %d loading DMA map\n", error); out_bad: ahb_free_ecb(sc, ecb); @@ -977,7 +979,7 @@ ahb_timeout(void *arg) struct scsipi_xfer *xs = ecb->xs; struct scsipi_periph *periph = xs->xs_periph; struct ahb_softc *sc = - (void *)periph->periph_channel->chan_adapter->adapt_dev; + device_private(periph->periph_channel->chan_adapter->adapt_dev); int s; scsipi_printaddr(periph); Index: sys/dev/eisa/bha_eisa.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/eisa/bha_eisa.c,v retrieving revision 1.34 diff -u -p -r1.34 bha_eisa.c --- sys/dev/eisa/bha_eisa.c 4 Dec 2009 11:13:04 -0000 1.34 +++ sys/dev/eisa/bha_eisa.c 26 Sep 2012 18:37:43 -0000 @@ -58,7 +58,7 @@ static int bha_eisa_address(bus_space_ta static int bha_eisa_match(device_t, cfdata_t, void *); static void bha_eisa_attach(device_t, device_t, void *); -CFATTACH_DECL(bha_eisa, sizeof(struct bha_softc), +CFATTACH_DECL_NEW(bha_eisa, sizeof(struct bha_softc), bha_eisa_match, bha_eisa_attach, NULL, NULL); static int @@ -99,8 +99,7 @@ bha_eisa_address(bus_space_tag_t iot, bu * the actual probe routine to check it out. */ static int -bha_eisa_match(device_t parent, cfdata_t match, - void *aux) +bha_eisa_match(device_t parent, cfdata_t match, void *aux) { struct eisa_attach_args *ea = aux; bus_space_tag_t iot = ea->ea_iot; @@ -148,6 +147,8 @@ bha_eisa_attach(device_t parent, device_ eisa_intr_handle_t ih; const char *model, *intrstr; + sc->sc_dev = self; + if (!strcmp(ea->ea_idstring, "BUS4201")) model = EISA_PRODUCT_BUS4201; else if (!strcmp(ea->ea_idstring, "BUS4202")) @@ -174,7 +175,7 @@ bha_eisa_attach(device_t parent, device_ sc->sc_dmaflags = 0; if (eisa_intr_map(ec, bpd.sc_irq, &ih)) { - aprint_error_dev(&sc->sc_dev, "couldn't map interrupt (%d)\n", + aprint_error_dev(sc->sc_dev, "couldn't map interrupt (%d)\n", bpd.sc_irq); return; } @@ -182,13 +183,13 @@ bha_eisa_attach(device_t parent, device_ sc->sc_ih = eisa_intr_establish(ec, ih, IST_LEVEL, IPL_BIO, bha_intr, sc); if (sc->sc_ih == NULL) { - aprint_error_dev(&sc->sc_dev, "couldn't establish interrupt"); + aprint_error_dev(sc->sc_dev, "couldn't establish interrupt"); 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); bha_attach(sc); } Index: sys/dev/eisa/cac_eisa.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/eisa/cac_eisa.c,v retrieving revision 1.21 diff -u -p -r1.21 cac_eisa.c --- sys/dev/eisa/cac_eisa.c 12 May 2009 14:21:32 -0000 1.21 +++ sys/dev/eisa/cac_eisa.c 26 Sep 2012 18:37:43 -0000 @@ -89,7 +89,7 @@ static void cac_eisa_l0_intr_enable(stru static int cac_eisa_l0_intr_pending(struct cac_softc *); static void cac_eisa_l0_submit(struct cac_softc *, struct cac_ccb *); -CFATTACH_DECL(cac_eisa, sizeof(struct cac_softc), +CFATTACH_DECL_NEW(cac_eisa, sizeof(struct cac_softc), cac_eisa_match, cac_eisa_attach, NULL, NULL); static const struct cac_linkage cac_eisa_l0 = { @@ -151,6 +151,7 @@ cac_eisa_attach(device_t parent, device_ return; } + sc->sc_dev = self; sc->sc_iot = iot; sc->sc_ioh = ioh; sc->sc_dmat = ea->ea_dmat; Index: sys/dev/eisa/depca_eisa.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/eisa/depca_eisa.c,v retrieving revision 1.13 diff -u -p -r1.13 depca_eisa.c --- sys/dev/eisa/depca_eisa.c 19 Jan 2010 22:06:23 -0000 1.13 +++ sys/dev/eisa/depca_eisa.c 29 Sep 2012 12:39:35 -0000 @@ -150,15 +150,15 @@ depca_eisa_attach(device_t parent, devic } static void * -depca_eisa_intr_establish(struct depca_softc *parent, struct lance_softc *child) +depca_eisa_intr_establish(struct depca_softc *sc, struct lance_softc *child) { - struct depca_eisa_softc *esc = (struct depca_eisa_softc *)parent; + struct depca_eisa_softc *esc = (struct depca_eisa_softc *)sc; eisa_intr_handle_t ih; const char *intrstr; void *rv; if (eisa_intr_map(esc->sc_ec, esc->sc_irq, &ih)) { - aprint_error_dev(parent->sc_dev, + aprint_error_dev(sc->sc_dev, "unable to map interrupt (%d)\n", esc->sc_irq); return (NULL); } @@ -166,7 +166,7 @@ depca_eisa_intr_establish(struct depca_s rv = eisa_intr_establish(esc->sc_ec, ih, esc->sc_ist, IPL_NET, (esc->sc_ist == IST_LEVEL) ? am7990_intr : depca_intredge, child); if (rv == NULL) { - aprint_error_dev(parent->sc_dev, + aprint_error_dev(sc->sc_dev, "unable to establish interrupt"); if (intrstr != NULL) aprint_error(" at %s", intrstr); @@ -174,7 +174,7 @@ depca_eisa_intr_establish(struct depca_s return (NULL); } if (intrstr != NULL) - aprint_normal_dev(parent->sc_dev, "interrupting at %s\n", + aprint_normal_dev(sc->sc_dev, "interrupting at %s\n", intrstr); return (rv); Index: sys/dev/eisa/dpt_eisa.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/eisa/dpt_eisa.c,v retrieving revision 1.20 diff -u -p -r1.20 dpt_eisa.c --- sys/dev/eisa/dpt_eisa.c 12 May 2009 14:21:32 -0000 1.20 +++ sys/dev/eisa/dpt_eisa.c 26 Sep 2012 18:37:43 -0000 @@ -61,7 +61,7 @@ static void dpt_eisa_attach(device_t, de static int dpt_eisa_irq(bus_space_tag_t, bus_space_handle_t, int *); static int dpt_eisa_match(device_t, cfdata_t, void *); -CFATTACH_DECL(dpt_eisa, sizeof(struct dpt_softc), +CFATTACH_DECL_NEW(dpt_eisa, sizeof(struct dpt_softc), dpt_eisa_match, dpt_eisa_attach, NULL, NULL); static const char * const dpt_eisa_boards[] = { @@ -103,8 +103,7 @@ dpt_eisa_irq(bus_space_tag_t iot, bus_sp } static int -dpt_eisa_match(device_t parent, cfdata_t match, - void *aux) +dpt_eisa_match(device_t parent, cfdata_t match, void *aux) { struct eisa_attach_args *ea; int i; @@ -132,6 +131,7 @@ dpt_eisa_attach(device_t parent, device_ ea = aux; sc = device_private(self); + sc->sc_dev = self; iot = ea->ea_iot; ec = ea->ea_ec; @@ -171,7 +171,7 @@ dpt_eisa_attach(device_t parent, device_ /* Read the EATA configuration. */ if (dpt_readcfg(sc)) { - aprint_error_dev(&sc->sc_dv, "readcfg failed - see dpt(4)\n"); + aprint_error_dev(sc->sc_dev, "readcfg failed - see dpt(4)\n"); return; } Index: sys/dev/eisa/if_fea.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/eisa/if_fea.c,v retrieving revision 1.44 diff -u -p -r1.44 if_fea.c --- sys/dev/eisa/if_fea.c 22 Mar 2010 23:01:10 -0000 1.44 +++ sys/dev/eisa/if_fea.c 26 Sep 2012 23:51:23 -0000 @@ -387,10 +387,11 @@ pdq_eisa_attach( device_t self, void *aux) { - pdq_softc_t *sc = (pdq_softc_t *) self; + pdq_softc_t *sc = device_private(self); struct isa_attach_args *ia = (struct isa_attach_args *) aux; struct ifnet *ifp = &sc->sc_if; + sc->sc_dev = self; sc->sc_if.if_unit = sc->sc_dev.dv_unit; sc->sc_if.if_name = "fea"; sc->sc_if.if_flags = 0; @@ -464,13 +465,13 @@ pdq_eisa_attach( sc->sc_iotag = ea->ea_iot; sc->sc_dmatag = ea->ea_dmat; - memcpy(sc->sc_if.if_xname, device_xname(&sc->sc_dev), IFNAMSIZ); + memcpy(sc->sc_if.if_xname, device_xname(sc->sc_dev), IFNAMSIZ); sc->sc_if.if_flags = 0; sc->sc_if.if_softc = sc; if (bus_space_map(sc->sc_iotag, EISA_SLOT_ADDR(ea->ea_slot), EISA_SLOT_SIZE, 0, &sc->sc_iobase)) { aprint_normal("\n"); - aprint_error_dev(&sc->sc_dev, "failed to map I/O!\n"); + aprint_error_dev(sc->sc_dev, "failed to map I/O!\n"); return; } @@ -482,7 +483,7 @@ pdq_eisa_attach( if (bus_space_map(sc->sc_csrtag, maddr, msiz, 0, &sc->sc_membase)) { bus_space_unmap(sc->sc_iotag, sc->sc_iobase, EISA_SLOT_SIZE); aprint_normal("\n"); - aprint_error_dev(&sc->sc_dev, "failed to map memory (0x%x-0x%x)!\n", + aprint_error_dev(sc->sc_dev, "failed to map memory (0x%x-0x%x)!\n", maddr, maddr + msiz - 1); return; } @@ -497,21 +498,21 @@ pdq_eisa_attach( sc->sc_if.if_xname, 0, (void *) sc, PDQ_DEFEA); if (sc->sc_pdq == NULL) { - aprint_error_dev(&sc->sc_dev, "initialization failed\n"); + aprint_error_dev(sc->sc_dev, "initialization failed\n"); return; } pdq_ifattach(sc, pdq_eisa_ifwatchdog); if (eisa_intr_map(ea->ea_ec, irq, &ih)) { - aprint_error_dev(&sc->sc_dev, "couldn't map interrupt (%d)\n", irq); + aprint_error_dev(sc->sc_dev, "couldn't map interrupt (%d)\n", irq); return; } intrstr = eisa_intr_string(ea->ea_ec, ih); sc->sc_ih = eisa_intr_establish(ea->ea_ec, ih, IST_LEVEL, IPL_NET, (int (*)(void *)) pdq_interrupt, sc->sc_pdq); if (sc->sc_ih == NULL) { - aprint_error_dev(&sc->sc_dev, "couldn't establish interrupt"); + aprint_error_dev(sc->sc_dev, "couldn't establish interrupt"); if (intrstr != NULL) aprint_error(" at %s", intrstr); aprint_error("\n"); @@ -521,11 +522,11 @@ pdq_eisa_attach( if (sc->sc_ats == NULL) aprint_error_dev(self, "warning: couldn't establish shutdown hook\n"); if (sc->sc_csr_memmapped) - printf("%s: using iomem 0x%x-0x%x\n", device_xname(&sc->sc_dev), maddr, maddr + msiz - 1); + printf("%s: using iomem 0x%x-0x%x\n", device_xname(sc->sc_dev), maddr, maddr + msiz - 1); if (intrstr != NULL) - printf("%s: interrupting at %s\n", device_xname(&sc->sc_dev), intrstr); + printf("%s: interrupting at %s\n", device_xname(sc->sc_dev), intrstr); } -CFATTACH_DECL(fea, sizeof(pdq_softc_t), +CFATTACH_DECL_NEW(fea, sizeof(pdq_softc_t), pdq_eisa_match, pdq_eisa_attach, NULL, NULL); #endif Index: sys/dev/eisa/mlx_eisa.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/eisa/mlx_eisa.c,v retrieving revision 1.22 diff -u -p -r1.22 mlx_eisa.c --- sys/dev/eisa/mlx_eisa.c 12 May 2009 14:21:32 -0000 1.22 +++ sys/dev/eisa/mlx_eisa.c 26 Sep 2012 22:45:19 -0000 @@ -74,7 +74,7 @@ static int mlx_v1_fw_handshake(struct ml static int mlx_v1_reset(struct mlx_softc *); #endif -CFATTACH_DECL(mlx_eisa, sizeof(struct mlx_softc), +CFATTACH_DECL_NEW(mlx_eisa, sizeof(struct mlx_softc), mlx_eisa_match, mlx_eisa_attach, NULL, NULL); static struct mlx_eisa_prod { @@ -130,6 +130,7 @@ mlx_eisa_attach(device_t parent, device_ return; } + mlx->mlx_dv = self; mlx->mlx_iot = iot; mlx->mlx_ioh = ioh; mlx->mlx_dmat = ea->ea_dmat; Index: sys/dev/eisa/uha_eisa.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/eisa/uha_eisa.c,v retrieving revision 1.33 diff -u -p -r1.33 uha_eisa.c --- sys/dev/eisa/uha_eisa.c 4 Dec 2009 11:13:04 -0000 1.33 +++ sys/dev/eisa/uha_eisa.c 26 Sep 2012 22:49:56 -0000 @@ -59,7 +59,7 @@ __KERNEL_RCSID(0, "$NetBSD: uha_eisa.c,v static int uha_eisa_match(device_t, cfdata_t, void *); static void uha_eisa_attach(device_t, device_t, void *); -CFATTACH_DECL(uha_eisa, sizeof(struct uha_softc), +CFATTACH_DECL_NEW(uha_eisa, sizeof(struct uha_softc), uha_eisa_match, uha_eisa_attach, NULL, NULL); #ifndef DDB @@ -128,6 +128,7 @@ uha_eisa_attach(device_t parent, device_ UHA_EISA_SLOT_OFFSET, UHA_EISA_IOSIZE, 0, &ioh)) panic("uha_eisa_attach: could not map I/O addresses"); + sc->sc_dev = self; sc->sc_iot = iot; sc->sc_ioh = ioh; sc->sc_dmat = dmat; @@ -137,7 +138,7 @@ uha_eisa_attach(device_t parent, device_ sc->sc_dmaflags = 0; if (eisa_intr_map(ec, upd.sc_irq, &ih)) { - aprint_error_dev(&sc->sc_dev, "couldn't map interrupt (%d)\n", + aprint_error_dev(sc->sc_dev, "couldn't map interrupt (%d)\n", upd.sc_irq); return; } @@ -145,13 +146,13 @@ uha_eisa_attach(device_t parent, device_ sc->sc_ih = eisa_intr_establish(ec, ih, IST_LEVEL, IPL_BIO, u24_intr, sc); if (sc->sc_ih == NULL) { - aprint_error_dev(&sc->sc_dev, "couldn't establish interrupt"); + aprint_error_dev(sc->sc_dev, "couldn't establish interrupt"); 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); /* Save function pointers for later use. */ sc->start_mbox = u24_start_mbox; @@ -231,7 +232,7 @@ u24_start_mbox(struct uha_softc *sc, str delay(100); } if (!spincount) { - aprint_error_dev(&sc->sc_dev, "uha_start_mbox, board not responding\n"); + aprint_error_dev(sc->sc_dev, "uha_start_mbox, board not responding\n"); Debugger(); } @@ -280,7 +281,7 @@ u24_intr(void *arg) u_long mboxval; #ifdef UHADEBUG - printf("%s: uhaintr ", device_xname(&sc->sc_dev)); + printf("%s: uhaintr ", device_xname(sc->sc_dev)); #endif /*UHADEBUG */ if ((bus_space_read_1(iot, ioh, U24_SINT) & U24_SDIP) == 0) @@ -306,7 +307,7 @@ u24_intr(void *arg) mscp = uha_mscp_phys_kv(sc, mboxval); if (!mscp) { printf("%s: BAD MSCP RETURNED!\n", - device_xname(&sc->sc_dev)); + device_xname(sc->sc_dev)); continue; /* whatever it was, it'll timeout */ } callout_stop(&mscp->xs->xs_callout); Index: sys/dev/gpib/cs80bus.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/gpib/cs80bus.c,v retrieving revision 1.15 diff -u -p -r1.15 cs80bus.c --- sys/dev/gpib/cs80bus.c 12 Sep 2009 18:41:05 -0000 1.15 +++ sys/dev/gpib/cs80bus.c 28 Sep 2012 18:05:41 -0000 @@ -62,7 +62,7 @@ int cs80busdebug = 0xff; int cs80busmatch(device_t, cfdata_t, void *); void cs80busattach(device_t, device_t, void *); -CFATTACH_DECL(cs80bus, sizeof(struct cs80bus_softc), +CFATTACH_DECL_NEW(cs80bus, sizeof(struct cs80bus_softc), cs80busmatch, cs80busattach, NULL, NULL); static int cs80bus_alloc(struct cs80bus_softc *, int, int); @@ -110,11 +110,12 @@ cs80busattach(device_t parent, device_t printf("\n"); + sc->sc_dev = self; sc->sc_ic = ga->ga_ic; for (slave = 0; slave < 8; slave++) { - if (gpib_isalloc((void *)device_parent(&sc->sc_dev), slave)) + if (gpib_isalloc(device_private(device_parent(sc->sc_dev)), slave)) continue; if (gpibrecv(sc->sc_ic, GPIB_BROADCAST_ADDR, @@ -132,14 +133,14 @@ cs80busattach(device_t parent, device_t ca.ca_slave = slave; ca.ca_id = id; - (void)config_search_ia(cs80bussearch, &sc->sc_dev, "cs80bus", &ca); + (void)config_search_ia(cs80bussearch, sc->sc_dev, "cs80bus", &ca); } } int cs80bussearch(device_t parent, cfdata_t cf, const int *ldesc, void *aux) { - struct cs80bus_softc *sc = (struct cs80bus_softc *)parent; + struct cs80bus_softc *sc = device_private(parent); struct cs80bus_attach_args *ca = aux; /* @@ -208,7 +209,7 @@ cs80bus_alloc(struct cs80bus_softc *sc, if (slave >= CS80BUS_NSLAVES || punit >= CS80BUS_NPUNITS) panic("cs80bus_alloc: device address out of range"); - gpib_alloc((void *)device_parent(&sc->sc_dev), slave); + gpib_alloc(device_private(device_parent(sc->sc_dev)), slave); if (sc->sc_rmap[slave][punit] == 0) { sc->sc_rmap[slave][punit] = 1; Index: sys/dev/gpib/cs80busvar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/gpib/cs80busvar.h,v retrieving revision 1.5 diff -u -p -r1.5 cs80busvar.h --- sys/dev/gpib/cs80busvar.h 28 Apr 2008 20:23:48 -0000 1.5 +++ sys/dev/gpib/cs80busvar.h 26 Sep 2012 22:50:29 -0000 @@ -40,7 +40,7 @@ struct cs80bus_attach_args { }; struct cs80bus_softc { - struct device sc_dev; /* generic device glue */ + device_t sc_dev; /* generic device glue */ gpib_chipset_tag_t sc_ic; u_int8_t sc_rmap[CS80BUS_NSLAVES][CS80BUS_NPUNITS]; }; Index: sys/dev/gpib/ct.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/gpib/ct.c,v retrieving revision 1.23 diff -u -p -r1.23 ct.c --- sys/dev/gpib/ct.c 8 Feb 2011 20:20:27 -0000 1.23 +++ sys/dev/gpib/ct.c 26 Sep 2012 22:52:50 -0000 @@ -116,7 +116,7 @@ int ctdebug = 0xff; #endif struct ct_softc { - struct device sc_dev; + device_t sc_dev; gpib_chipset_tag_t sc_ic; gpib_handle_t sc_hdl; @@ -155,7 +155,7 @@ struct ct_softc { int ctmatch(device_t, cfdata_t, void *); void ctattach(device_t, device_t, void *); -CFATTACH_DECL(ct, sizeof(struct ct_softc), +CFATTACH_DECL_NEW(ct, sizeof(struct ct_softc), ctmatch, ctattach, NULL, NULL); int ctident(device_t, struct ct_softc *, @@ -252,13 +252,13 @@ ctattach(device_t parent, device_t self, if (cs80reset(parent, sc->sc_slave, sc->sc_punit)) { aprint_normal("\n"); - aprint_error_dev(&sc->sc_dev, "can't reset device\n"); + aprint_error_dev(sc->sc_dev, "can't reset device\n"); return; } if (cs80describe(parent, sc->sc_slave, sc->sc_punit, &csd)) { aprint_normal("\n"); - aprint_error_dev(&sc->sc_dev, "didn't respond to describe command\n"); + aprint_error_dev(sc->sc_dev, "didn't respond to describe command\n"); return; } memset(name, 0, sizeof(name)); @@ -270,7 +270,7 @@ ctattach(device_t parent, device_t self, #ifdef DEBUG if (ctdebug & CDB_IDENT) { printf("\n%s: name: ('%s')\n", - device_xname(&sc->sc_dev),name); + device_xname(sc->sc_dev),name); printf(" iuw %x, maxxfr %d, ctype %d\n", csd.d_iuw, csd.d_cmaxxfr, csd.d_ctype); printf(" utype %d, bps %d, blkbuf %d, burst %d, blktime %d\n", @@ -282,7 +282,7 @@ ctattach(device_t parent, device_t self, printf(" maxcyl/head/sect %d/%d/%d, maxvsect %d, inter %d\n", csd.d_maxcylhead >> 8 , csd.d_maxcylhead & 0xff, csd.d_maxsect, csd.d_maxvsectl, csd.d_interleave); - printf("%s", device_xname(&sc->sc_dev)); + printf("%s", device_xname(sc->sc_dev)); } #endif @@ -316,7 +316,7 @@ ctattach(device_t parent, device_t self, if (gpibregister(sc->sc_ic, sc->sc_slave, ctcallback, sc, &sc->sc_hdl)) { - aprint_error_dev(&sc->sc_dev, "can't register callback\n"); + aprint_error_dev(sc->sc_dev, "can't register callback\n"); return; } @@ -342,7 +342,7 @@ ctopen(dev_t dev, int flag, int type, st else opt = C_SPAR; - if (cs80setoptions(device_parent(&sc->sc_dev), sc->sc_slave, + if (cs80setoptions(device_parent(sc->sc_dev), sc->sc_slave, sc->sc_punit, opt)) return (EBUSY); @@ -371,7 +371,7 @@ ctclose(dev_t dev, int flag, int fmt, st else sc->sc_eofp--; DPRINTF(CDB_BSF, ("%s: ctclose backup eofs prt %d blk %d\n", - device_xname(&sc->sc_dev), sc->sc_eofp, + device_xname(sc->sc_dev), sc->sc_eofp, sc->sc_eofs[sc->sc_eofp])); } @@ -428,7 +428,7 @@ ctcommand(dev_t dev, int cmd, int cnt) sc->sc_blkno = sc->sc_eofs[sc->sc_eofp]; sc->sc_eofp--; DPRINTF(CDB_BSF, ("%s: backup eof pos %d blk %d\n", - device_xname(&sc->sc_dev), sc->sc_eofp, + device_xname(sc->sc_dev), sc->sc_eofp, sc->sc_eofs[sc->sc_eofp])); } ctstrategy(bp); @@ -499,7 +499,7 @@ ctstart(struct ct_softc *sc) sc->sc_blkno = 0; ul.unit = CS80CMD_SUNIT(punit); ul.cmd = CS80CMD_UNLOAD; - (void) cs80send(device_parent(&sc->sc_dev), slave, + (void) cs80send(device_parent(sc->sc_dev), slave, punit, CS80CMD_SCMD, &ul, sizeof(ul)); break; @@ -508,7 +508,7 @@ ctstart(struct ct_softc *sc) sc->sc_flags |= CTF_WRT; wfm.unit = CS80CMD_SUNIT(sc->sc_punit); wfm.cmd = CS80CMD_WFM; - (void) cs80send(device_parent(&sc->sc_dev), slave, + (void) cs80send(device_parent(sc->sc_dev), slave, punit, CS80CMD_SCMD, &wfm, sizeof(wfm)); ctaddeof(sc); break; @@ -524,7 +524,7 @@ ctstart(struct ct_softc *sc) case MTREW: sc->sc_blkno = 0; DPRINTF(CDB_BSF, ("%s: clearing eofs\n", - device_xname(&sc->sc_dev))); + device_xname(sc->sc_dev))); for (i=0; isc_eofs[i] = 0; sc->sc_eofp = 0; @@ -539,7 +539,7 @@ gotaddr: sc->sc_ioc.len = htobe32(0); sc->sc_ioc.nop3 = CS80CMD_NOP; sc->sc_ioc.cmd = CS80CMD_READ; - (void) cs80send(device_parent(&sc->sc_dev), slave, + (void) cs80send(device_parent(sc->sc_dev), slave, punit, CS80CMD_SCMD, &sc->sc_ioc, sizeof(sc->sc_ioc)); break; @@ -575,7 +575,7 @@ mustio: sc->sc_ioc.cmd = CS80CMD_WRITE; sc->sc_flags |= (CTF_WRT | CTF_WRTTN); } - (void) cs80send(device_parent(&sc->sc_dev), slave, punit, + (void) cs80send(device_parent(sc->sc_dev), slave, punit, CS80CMD_SCMD, &sc->sc_ioc, sizeof(sc->sc_ioc)); } gpibawait(sc->sc_ic); @@ -684,7 +684,7 @@ ctintr(struct ct_softc *sc) bp = bufq_peek(sc->sc_tab); if (bp == NULL) { - aprint_error_dev(&sc->sc_dev, "bp == NULL\n"); + aprint_error_dev(sc->sc_dev, "bp == NULL\n"); return; } if (sc->sc_flags & CTF_IO) { @@ -734,18 +734,18 @@ ctintr(struct ct_softc *sc) if (sc->sc_stat.c_aef & 0x4000) tprintf(sc->sc_tpr, "%s: uninitialized media\n", - device_xname(&sc->sc_dev)); + device_xname(sc->sc_dev)); if (sc->sc_stat.c_aef & 0x1000) tprintf(sc->sc_tpr, "%s: not ready\n", - device_xname(&sc->sc_dev)); + device_xname(sc->sc_dev)); if (sc->sc_stat.c_aef & 0x0800) tprintf(sc->sc_tpr, "%s: write protect\n", - device_xname(&sc->sc_dev)); + device_xname(sc->sc_dev)); } else { printf("%s err: v%d u%d ru%d bn%d, ", - device_xname(&sc->sc_dev), + device_xname(sc->sc_dev), (sc->sc_stat.c_vu>>4)&0xF, sc->sc_stat.c_vu&0xF, sc->sc_stat.c_pend, @@ -757,7 +757,7 @@ ctintr(struct ct_softc *sc) sc->sc_stat.c_ief); } } else - aprint_error_dev(&sc->sc_dev, "request status failed\n"); + aprint_error_dev(sc->sc_dev, "request status failed\n"); bp->b_error = EIO; goto done; } else @@ -887,6 +887,6 @@ ctaddeof(struct ct_softc *sc) sc->sc_eofs[sc->sc_eofp] = sc->sc_blkno - 1; } DPRINTF(CDB_BSF, ("%s: add eof pos %d blk %d\n", - device_xname(&sc->sc_dev), sc->sc_eofp, + device_xname(sc->sc_dev), sc->sc_eofp, sc->sc_eofs[sc->sc_eofp])); } Index: sys/dev/gpib/gpib.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/gpib/gpib.c,v retrieving revision 1.19 diff -u -p -r1.19 gpib.c --- sys/dev/gpib/gpib.c 12 Sep 2009 18:41:05 -0000 1.19 +++ sys/dev/gpib/gpib.c 28 Sep 2012 18:18:45 -0000 @@ -63,13 +63,11 @@ int gpibdebug = 0xff; int gpibmatch(device_t, cfdata_t, void *); void gpibattach(device_t, device_t, void *); -CFATTACH_DECL(gpib, sizeof(struct gpib_softc), +CFATTACH_DECL_NEW(gpib, sizeof(struct gpib_softc), gpibmatch, gpibattach, NULL, NULL); -static int gpibsubmatch1(device_t, cfdata_t, - const int *, void *); -static int gpibsubmatch2(device_t, cfdata_t, - const int *, void *); +static int gpibsubmatch1(device_t, cfdata_t, const int *, void *); +static int gpibsubmatch2(device_t, cfdata_t, const int *, void *); static int gpibprint(void *, const char *); dev_type_open(gpibopen); @@ -101,11 +99,12 @@ void gpibattach(device_t parent, device_t self, void *aux) { struct gpib_softc *sc = device_private(self); - cfdata_t cf = device_cfdata(&sc->sc_dev); + cfdata_t cf = device_cfdata(self); struct gpibdev_attach_args *gda = aux; struct gpib_attach_args ga; int address; + sc->sc_dev = self; sc->sc_ic = gda->ga_ic; /* @@ -131,18 +130,18 @@ gpibattach(device_t parent, device_t sel for (address=0; addresssc_ic; ga.ga_address = address; - (void) config_search_ia(gpibsubmatch1, &sc->sc_dev, "gpib", &ga); + (void) config_search_ia(gpibsubmatch1, sc->sc_dev, "gpib", &ga); } /* attach the wild-carded devices - probably protocol busses */ ga.ga_ic = sc->sc_ic; - (void) config_search_ia(gpibsubmatch2, &sc->sc_dev, "gpib", &ga); + (void) config_search_ia(gpibsubmatch2, sc->sc_dev, "gpib", &ga); } int gpibsubmatch1(device_t parent, cfdata_t cf, const int *ldesc, void *aux) { - struct gpib_softc *sc = (struct gpib_softc *)parent; + struct gpib_softc *sc = device_private(parent); struct gpib_attach_args *ga = aux; if (cf->cf_loc[GPIBCF_ADDRESS] != ga->ga_address) @@ -290,7 +289,7 @@ _gpibswait(struct gpib_softc *sc, int sl pptest = sc->sc_ic->pptest; while ((*pptest)(sc->sc_ic->cookie, slave) == 0) { if (--timo == 0) { - aprint_error_dev(&sc->sc_dev, "swait timeout\n"); + aprint_error_dev(sc->sc_dev, "swait timeout\n"); return(-1); } } @@ -405,7 +404,7 @@ senderror: (*sc->sc_ic->ifc)(sc->sc_ic->cookie); DPRINTF(DBG_FAIL, ("%s: _gpibsend failed: slave %d, sec %x, sent %d of %d bytes\n", - device_xname(&sc->sc_dev), slave, sec, cnt, origcnt)); + device_xname(sc->sc_dev), slave, sec, cnt, origcnt)); return (cnt); } Index: sys/dev/gpib/gpibvar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/gpib/gpibvar.h,v retrieving revision 1.4 diff -u -p -r1.4 gpibvar.h --- sys/dev/gpib/gpibvar.h 28 Apr 2008 20:23:48 -0000 1.4 +++ sys/dev/gpib/gpibvar.h 27 Sep 2012 01:40:46 -0000 @@ -169,7 +169,7 @@ struct gpibdev_attach_args { * Software state per GPIB bus. */ struct gpib_softc { - struct device sc_dev; /* generic device glue */ + device_t sc_dev; /* generic device glue */ gpib_chipset_tag_t sc_ic; /* GPIB chipset tag */ u_int8_t sc_myaddr; /* my (host) GPIB address */ int sc_flags; Index: sys/dev/gpib/hil_gpib.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/gpib/hil_gpib.c,v retrieving revision 1.11 diff -u -p -r1.11 hil_gpib.c --- sys/dev/gpib/hil_gpib.c 12 May 2009 14:21:58 -0000 1.11 +++ sys/dev/gpib/hil_gpib.c 1 Oct 2012 14:44:07 -0000 @@ -26,7 +26,6 @@ int hildebug = 0; #endif struct hil_softc { - struct device sc_dev; gpib_chipset_tag_t sc_ic; gpib_handle_t sc_hdl; @@ -77,7 +76,7 @@ hilattach(device_t parent, device_t self if (gpibregister(sc->sc_ic, sc->sc_address, hilcallback, sc, &sc->sc_hdl)) { - aprint_error_dev(&sc->sc_dev, "can't register callback\n"); + aprint_error_dev(self, "can't register callback\n"); return; } @@ -111,7 +110,7 @@ hilstart(void *v) { struct hil_softc *sc = v; - DPRINTF(HDB_FOLLOW, ("hilstart(%x)\n", device_unit(&sc->sc_dev))); + DPRINTF(HDB_FOLLOW, ("hilstart\n")); sc->sc_flags &= ~HILF_DELAY; } Index: sys/dev/gpib/mt.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/gpib/mt.c,v retrieving revision 1.24 diff -u -p -r1.24 mt.c --- sys/dev/gpib/mt.c 8 Feb 2011 20:20:27 -0000 1.24 +++ sys/dev/gpib/mt.c 26 Sep 2012 22:54:54 -0000 @@ -107,7 +107,7 @@ int mtdebug = 0; #endif struct mt_softc { - struct device sc_dev; + device_t sc_dev; gpib_chipset_tag_t sc_ic; gpib_handle_t sc_hdl; @@ -138,7 +138,7 @@ struct mt_softc { int mtmatch(device_t, cfdata_t, void *); void mtattach(device_t, device_t, void *); -CFATTACH_DECL(mt, sizeof(struct mt_softc), +CFATTACH_DECL_NEW(mt, sizeof(struct mt_softc), mtmatch, mtattach, NULL, NULL); int mtlookup(int, int, int); @@ -230,7 +230,7 @@ mtattach(device_t parent, device_t self, if (gpibregister(sc->sc_ic, sc->sc_slave, mtcallback, sc, &sc->sc_hdl)) { - aprint_error_dev(&sc->sc_dev, "can't register callback\n"); + aprint_error_dev(sc->sc_dev, "can't register callback\n"); return; } } @@ -254,7 +254,7 @@ mtreaddsj(struct mt_softc *sc, int ecmd) sc->sc_flags &= ~MTF_DSJTIMEO; if (retval != 1) { DPRINTF(MDB_ANY, ("%s can't gpibrecv DSJ", - device_xname(&sc->sc_dev))); + device_xname(sc->sc_dev))); if (sc->sc_recvtimeo == 0) sc->sc_recvtimeo = hz; if (--sc->sc_recvtimeo == 0) @@ -265,7 +265,7 @@ mtreaddsj(struct mt_softc *sc, int ecmd) } sc->sc_recvtimeo = 0; sc->sc_statindex = 0; - DPRINTF(MDB_ANY, ("%s readdsj: 0x%x", device_xname(&sc->sc_dev), + DPRINTF(MDB_ANY, ("%s readdsj: 0x%x", device_xname(sc->sc_dev), sc->sc_lastdsj)); sc->sc_lastecmd = ecmd; switch (sc->sc_lastdsj) { @@ -280,7 +280,7 @@ mtreaddsj(struct mt_softc *sc, int ecmd) break; default: - printf("%s readdsj: DSJ 0x%x\n", device_xname(&sc->sc_dev), + printf("%s readdsj: DSJ 0x%x\n", device_xname(sc->sc_dev), sc->sc_lastdsj); return (-1); } @@ -302,13 +302,13 @@ getstats: sc->sc_flags |= MTF_STATTIMEO; return (-2); } - printf("%s readdsj: can't read status", device_xname(&sc->sc_dev)); + printf("%s readdsj: can't read status", device_xname(sc->sc_dev)); return (-1); } sc->sc_recvtimeo = 0; sc->sc_statindex = 0; DPRINTF(MDB_ANY, ("%s readdsj: status is %x %x %x %x %x %x", - device_xname(&sc->sc_dev), + device_xname(sc->sc_dev), sc->sc_stat1, sc->sc_stat2, sc->sc_stat3, sc->sc_stat4, sc->sc_stat5, sc->sc_stat6)); if (sc->sc_lastecmd) @@ -331,7 +331,7 @@ mtopen(dev_t dev, int flag, int mode, st if (sc->sc_flags & MTF_OPEN) return (EBUSY); - DPRINTF(MDB_ANY, ("%s open: flags 0x%x", device_xname(&sc->sc_dev), + DPRINTF(MDB_ANY, ("%s open: flags 0x%x", device_xname(sc->sc_dev), sc->sc_flags)); sc->sc_flags |= MTF_OPEN; @@ -359,7 +359,7 @@ mtopen(dev_t dev, int flag, int mode, st goto errout; } if (!(sc->sc_stat1 & SR1_ONLINE)) { - uprintf("%s: not online\n", device_xname(&sc->sc_dev)); + uprintf("%s: not online\n", device_xname(sc->sc_dev)); error = EIO; goto errout; } @@ -397,7 +397,7 @@ mtopen(dev_t dev, int flag, int mode, st if (!(sc->sc_stat1 & SR1_BOT)) { if (sc->sc_density != req_den) { uprintf("%s: can't change density mid-tape\n", - device_xname(&sc->sc_dev)); + device_xname(sc->sc_dev)); error = EIO; goto errout; } @@ -486,7 +486,7 @@ mtstrategy(struct buf *bp) sc = device_lookup_private(&mt_cd, MTUNIT(bp->b_dev)); - DPRINTF(MDB_ANY, ("%s strategy", device_xname(&sc->sc_dev))); + DPRINTF(MDB_ANY, ("%s strategy", device_xname(sc->sc_dev))); if ((bp->b_flags & (B_CMD | B_READ)) == 0) { #define WRITE_BITS_IGNORED 8 @@ -494,7 +494,7 @@ mtstrategy(struct buf *bp) if (bp->b_bcount & ((1 << WRITE_BITS_IGNORED) - 1)) { tprintf(sc->sc_ttyp, "%s: write record must be multiple of %d\n", - device_xname(&sc->sc_dev), 1 << WRITE_BITS_IGNORED); + device_xname(sc->sc_dev), 1 << WRITE_BITS_IGNORED); goto error; } #endif @@ -514,7 +514,7 @@ mtstrategy(struct buf *bp) if (bp->b_bcount > s) { tprintf(sc->sc_ttyp, "%s: write record (%d) too big: limit (%d)\n", - device_xname(&sc->sc_dev), bp->b_bcount, s); + device_xname(sc->sc_dev), bp->b_bcount, s); #if 0 /* XXX see above */ error: #endif @@ -536,7 +536,7 @@ void mtustart(struct mt_softc *sc) { - DPRINTF(MDB_ANY, ("%s ustart", device_xname(&sc->sc_dev))); + DPRINTF(MDB_ANY, ("%s ustart", device_xname(sc->sc_dev))); if (gpibrequest(sc->sc_ic, sc->sc_hdl)) mtstart(sc); } @@ -590,7 +590,7 @@ mtstart(struct mt_softc *sc) short cmdcount = 1; u_char cmdbuf[2]; - DPRINTF(MDB_ANY, ("%s start", device_xname(&sc->sc_dev))); + DPRINTF(MDB_ANY, ("%s start", device_xname(sc->sc_dev))); sc->sc_flags &= ~MTF_WRT; bp = bufq_peek(sc->sc_tab); if ((sc->sc_flags & MTF_ALIVE) == 0 && @@ -715,7 +715,7 @@ mtstart(struct mt_softc *sc) * 3) interrupt will read DSJ (and END COMPLETE-IDLE) */ if (gpibsend(sc->sc_ic, sc->sc_slave, -2, NULL, 0)){ - aprint_error_dev(&sc->sc_dev, "can't reset"); + aprint_error_dev(sc->sc_dev, "can't reset"); goto fatalerror; } callout_reset(&sc->sc_intr_ch, 4*hz, mtintr_callout, @@ -791,11 +791,11 @@ mtintr(struct mt_softc *sc) bp = bufq_peek(sc->sc_tab); if (bp == NULL) { - printf("%s intr: bp == NULL", device_xname(&sc->sc_dev)); + printf("%s intr: bp == NULL", device_xname(sc->sc_dev)); return; } - DPRINTF(MDB_ANY, ("%s intr", device_xname(&sc->sc_dev))); + DPRINTF(MDB_ANY, ("%s intr", device_xname(sc->sc_dev))); /* * Some operation completed. Read status bytes and report errors. @@ -836,13 +836,13 @@ mtintr(struct mt_softc *sc) return; default: - printf("%s intr: can't get drive stat", device_xname(&sc->sc_dev)); + printf("%s intr: can't get drive stat", device_xname(sc->sc_dev)); goto error; } if (sc->sc_stat1 & (SR1_ERR | SR1_REJECT)) { i = sc->sc_stat4 & SR4_ERCLMASK; printf("%s: %s error, retry %d, SR2/3 %x/%x, code %d", - device_xname(&sc->sc_dev), i == SR4_DEVICE ? "device" : + device_xname(sc->sc_dev), i == SR4_DEVICE ? "device" : (i == SR4_PROTOCOL ? "protocol" : (i == SR4_SELFTEST ? "selftest" : "unknown")), sc->sc_stat4 & SR4_RETRYMASK, sc->sc_stat2, @@ -858,7 +858,7 @@ mtintr(struct mt_softc *sc) * Report and clear any soft errors. */ if (sc->sc_stat1 & SR1_SOFTERR) { - printf("%s: soft error, retry %d\n", device_xname(&sc->sc_dev), + printf("%s: soft error, retry %d\n", device_xname(sc->sc_dev), sc->sc_stat4 & SR4_RETRYMASK); sc->sc_stat1 &= ~SR1_SOFTERR; } @@ -908,7 +908,7 @@ mtintr(struct mt_softc *sc) } else { i = gpibrecv(sc->sc_ic, slave, MTT_BCNT, cmdbuf, 2); if (i != 2) { - aprint_error_dev(&sc->sc_dev, "intr: can't get xfer length\n"); + aprint_error_dev(sc->sc_dev, "intr: can't get xfer length\n"); goto error; } i = (int) *((u_short *) cmdbuf); @@ -917,12 +917,12 @@ mtintr(struct mt_softc *sc) sc->sc_flags |= MTF_HITEOF; bp->b_resid = bp->b_bcount - i; DPRINTF(MDB_ANY, ("%s intr: bcount %d, resid %d", - device_xname(&sc->sc_dev), + device_xname(sc->sc_dev), bp->b_bcount, bp->b_resid)); } else { tprintf(sc->sc_ttyp, "%s: record (%d) larger than wanted (%d)\n", - device_xname(&sc->sc_dev), i, bp->b_bcount); + device_xname(sc->sc_dev), i, bp->b_bcount); error: sc->sc_flags &= ~MTF_IO; bp->b_error = EIO; Index: sys/dev/gpib/ppi.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/gpib/ppi.c,v retrieving revision 1.19 diff -u -p -r1.19 ppi.c --- sys/dev/gpib/ppi.c 12 Sep 2009 18:44:36 -0000 1.19 +++ sys/dev/gpib/ppi.c 26 Sep 2012 22:55:29 -0000 @@ -81,7 +81,7 @@ __KERNEL_RCSID(0, "$NetBSD: ppi.c,v 1.19 #include struct ppi_softc { - struct device sc_dev; + device_t sc_dev; gpib_chipset_tag_t sc_ic; gpib_handle_t sc_hdl; @@ -106,7 +106,7 @@ struct ppi_softc { int ppimatch(device_t, cfdata_t, void *); void ppiattach(device_t, device_t, void *); -CFATTACH_DECL(ppi, sizeof(struct ppi_softc), +CFATTACH_DECL_NEW(ppi, sizeof(struct ppi_softc), ppimatch, ppiattach, NULL, NULL); extern struct cfdriver ppi_cd; @@ -165,7 +165,7 @@ ppiattach(device_t parent, device_t self if (gpibregister(sc->sc_ic, sc->sc_address, ppicallback, sc, &sc->sc_hdl)) { - aprint_error_dev(&sc->sc_dev, "can't register callback\n"); + aprint_error_dev(sc->sc_dev, "can't register callback\n"); return; } @@ -238,7 +238,7 @@ ppistart(void *v) { struct ppi_softc *sc = v; - DPRINTF(PDB_FOLLOW, ("ppistart(%x)\n", device_unit(&sc->sc_dev))); + DPRINTF(PDB_FOLLOW, ("ppistart(%x)\n", device_unit(sc->sc_dev))); sc->sc_flags &= ~PPIF_DELAY; wakeup(sc); @@ -249,7 +249,7 @@ ppitimo(void *arg) { struct ppi_softc *sc = arg; - DPRINTF(PDB_FOLLOW, ("ppitimo(%x)\n", device_unit(&sc->sc_dev))); + DPRINTF(PDB_FOLLOW, ("ppitimo(%x)\n", device_unit(sc->sc_dev))); sc->sc_flags &= ~(PPIF_UIO|PPIF_TIMO); wakeup(sc); Index: sys/dev/gpib/rd.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/gpib/rd.c,v retrieving revision 1.30 diff -u -p -r1.30 rd.c --- sys/dev/gpib/rd.c 2 Feb 2012 19:43:02 -0000 1.30 +++ sys/dev/gpib/rd.c 26 Sep 2012 22:56:16 -0000 @@ -110,7 +110,7 @@ int rddebug = 0xff; #endif struct rd_softc { - struct device sc_dev; + device_t sc_dev; gpib_chipset_tag_t sc_ic; gpib_handle_t sc_hdl; @@ -241,7 +241,7 @@ int rderror(struct rd_softc *); int rdmatch(device_t, cfdata_t, void *); void rdattach(device_t, device_t, void *); -CFATTACH_DECL(rd, sizeof(struct rd_softc), +CFATTACH_DECL_NEW(rd, sizeof(struct rd_softc), rdmatch, rdattach, NULL, NULL); @@ -298,6 +298,7 @@ rdattach(device_t parent, device_t self, char name[7]; int type, i, n; + sc->sc_dev = self; sc->sc_ic = ca->ca_ic; sc->sc_slave = ca->ca_slave; sc->sc_punit = ca->ca_punit; @@ -307,13 +308,13 @@ rdattach(device_t parent, device_t self, if (cs80reset(parent, sc->sc_slave, sc->sc_punit)) { aprint_normal("\n"); - aprint_error_dev(&sc->sc_dev, "can't reset device\n"); + aprint_error_dev(sc->sc_dev, "can't reset device\n"); return; } if (cs80describe(parent, sc->sc_slave, sc->sc_punit, &csd)) { aprint_normal("\n"); - aprint_error_dev(&sc->sc_dev, "didn't respond to describe command\n"); + aprint_error_dev(sc->sc_dev, "didn't respond to describe command\n"); return; } memset(name, 0, sizeof(name)); @@ -325,7 +326,7 @@ rdattach(device_t parent, device_t self, #ifdef DEBUG if (rddebug & RDB_IDENT) { printf("\n%s: name: ('%s')\n", - device_xname(&sc->sc_dev), name); + device_xname(sc->sc_dev), name); printf(" iuw %x, maxxfr %d, ctype %d\n", csd.d_iuw, csd.d_cmaxxfr, csd.d_ctype); printf(" utype %d, bps %d, blkbuf %d, burst %d, blktime %d\n", @@ -337,7 +338,7 @@ rdattach(device_t parent, device_t self, printf(" maxcyl/head/sect %d/%d/%d, maxvsect %d, inter %d\n", csd.d_maxcylhead >> 8, csd.d_maxcylhead & 0xff, csd.d_maxsect, csd.d_maxvsectl, csd.d_interleave); - printf("%s", device_xname(&sc->sc_dev)); + printf("%s", device_xname(sc->sc_dev)); } #endif @@ -379,7 +380,7 @@ rdattach(device_t parent, device_t self, */ printf(": %s\n", rdidentinfo[type].ri_desc); printf("%s: %d cylinders, %d heads, %d blocks, %d bytes/block\n", - device_xname(&sc->sc_dev), rdidentinfo[type].ri_ncyl, + device_xname(sc->sc_dev), rdidentinfo[type].ri_ncyl, rdidentinfo[type].ri_ntpc, rdidentinfo[type].ri_nblocks, DEV_BSIZE); @@ -389,14 +390,14 @@ rdattach(device_t parent, device_t self, * Initialize and attach the disk structure. */ memset(&sc->sc_dk, 0, sizeof(sc->sc_dk)); - disk_init(&sc->sc_dk, device_xname(&sc->sc_dev), NULL); + disk_init(&sc->sc_dk, device_xname(sc->sc_dev), NULL); disk_attach(&sc->sc_dk); callout_init(&sc->sc_restart_ch, 0); if (gpibregister(sc->sc_ic, sc->sc_slave, rdcallback, sc, &sc->sc_hdl)) { - aprint_error_dev(&sc->sc_dev, "can't register callback\n"); + aprint_error_dev(sc->sc_dev, "can't register callback\n"); return; } @@ -409,7 +410,7 @@ rdattach(device_t parent, device_t self, /* * attach the device into the random source list */ - rnd_attach_source(&sc->rnd_source, device_xname(&sc->sc_dev), + rnd_attach_source(&sc->rnd_source, device_xname(sc->sc_dev), RND_TYPE_DISK, 0); } @@ -430,13 +431,13 @@ rdgetinfo(struct rd_softc *sc) /* * Call the generic disklabel extraction routine */ - msg = readdisklabel(RDMAKEDEV(0, device_unit(&sc->sc_dev), RAW_PART), + msg = readdisklabel(RDMAKEDEV(0, device_unit(sc->sc_dev), RAW_PART), rdstrategy, lp, NULL); if (msg == NULL) return (0); pi = lp->d_partitions; - printf("%s: WARNING: %s\n", device_xname(&sc->sc_dev), msg); + printf("%s: WARNING: %s\n", device_xname(sc->sc_dev), msg); pi[RAW_PART].p_size = rdidentinfo[sc->sc_type].ri_nblocks; lp->d_npartitions = RAW_PART+1; @@ -687,7 +688,7 @@ rdstart(struct rd_softc *sc) punit = sc->sc_punit; DPRINTF(RDB_FOLLOW, ("rdstart(%s): bp %p, %c\n", - device_xname(&sc->sc_dev), bp, (bp->b_flags & B_READ) ? 'R' : 'W')); + device_xname(sc->sc_dev), bp, (bp->b_flags & B_READ) ? 'R' : 'W')); again: @@ -724,11 +725,11 @@ again: sc->sc_errcnt)); sc->sc_flags &= ~RDF_SEEK; - cs80reset(device_parent(&sc->sc_dev), slave, punit); + cs80reset(device_parent(sc->sc_dev), slave, punit); if (sc->sc_errcnt++ < RDRETRY) goto again; printf("%s: rdstart err: cmd 0x%x sect %uld blk %" PRId64 " len %d\n", - device_xname(&sc->sc_dev), sc->sc_ioc.c_cmd, sc->sc_ioc.c_addr, + device_xname(sc->sc_dev), sc->sc_ioc.c_cmd, sc->sc_ioc.c_addr, bp->b_blkno, sc->sc_resid); bp->b_error = EIO; bp = rdfinish(sc, bp); @@ -751,7 +752,7 @@ rdintr(struct rd_softc *sc) bp = bufq_peek(sc->sc_tab); DPRINTF(RDB_FOLLOW, ("rdintr(%s): bp %p, %c, flags %x\n", - device_xname(&sc->sc_dev), bp, (bp->b_flags & B_READ) ? 'R' : 'W', + device_xname(sc->sc_dev), bp, (bp->b_flags & B_READ) ? 'R' : 'W', sc->sc_flags)); disk_unbusy(&sc->sc_dk, (bp->b_bcount - bp->b_resid), @@ -807,9 +808,9 @@ rderror(struct rd_softc *sc) DPRINTF(RDB_FOLLOW, ("rderror: sc=%p\n", sc)); - if (cs80status(device_parent(&sc->sc_dev), sc->sc_slave, + if (cs80status(device_parent(sc->sc_dev), sc->sc_slave, sc->sc_punit, &css)) { - cs80reset(device_parent(&sc->sc_dev), sc->sc_slave, + cs80reset(device_parent(sc->sc_dev), sc->sc_slave, sc->sc_punit); return (1); } @@ -830,7 +831,7 @@ rderror(struct rd_softc *sc) if (css.c_fef & FEF_REXMT) return (1); if (css.c_fef & FEF_PF) { - cs80reset(device_parent(&sc->sc_dev), sc->sc_slave, + cs80reset(device_parent(sc->sc_dev), sc->sc_slave, sc->sc_punit); return (1); } @@ -846,7 +847,7 @@ rderror(struct rd_softc *sc) int rdtimo = RDWAITC << sc->sc_errcnt; DPRINTF(RDB_STATUS, ("%s: internal maintenance, %d-second timeout\n", - device_xname(&sc->sc_dev), rdtimo)); + device_xname(sc->sc_dev), rdtimo)); gpibrelease(sc->sc_ic, sc->sc_hdl); callout_reset(&sc->sc_restart_ch, rdtimo * hz, rdrestart, sc); return (0); @@ -909,12 +910,12 @@ rderror(struct rd_softc *sc) * of the transfer, not necessary where the error occurred. */ printf("%s%c: hard error, sector number %" PRId64 "\n", - device_xname(&sc->sc_dev), 'a'+RDPART(bp->b_dev), pbn); + device_xname(sc->sc_dev), 'a'+RDPART(bp->b_dev), pbn); /* * Now report the status as returned by the hardware with * attempt at interpretation. */ - printf("%s %s error:", device_xname(&sc->sc_dev), + printf("%s %s error:", device_xname(sc->sc_dev), (bp->b_flags & B_READ) ? "read" : "write"); printf(" unit %d, volume %d R0x%x F0x%x A0x%x I0x%x\n", css.c_vu&0xF, (css.c_vu>>4)&0xF, @@ -1145,7 +1146,7 @@ rddump(dev_t dev, daddr_t blkno, void *v return (EIO); #else /* RD_DUMP_NOT_TRUSTED */ /* Let's just talk about this first... */ - printf("%s: dump addr %p, blk %d\n", device_xname(&sc->sc_dev), + printf("%s: dump addr %p, blk %d\n", device_xname(sc->sc_dev), va, blkno); delay(500 * 1000); /* half a second */ #endif /* RD_DUMP_NOT_TRUSTED */ Index: sys/dev/gpio/gpioiic.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/gpio/gpioiic.c,v retrieving revision 1.5 diff -u -p -r1.5 gpioiic.c --- sys/dev/gpio/gpioiic.c 2 Oct 2011 09:33:19 -0000 1.5 +++ sys/dev/gpio/gpioiic.c 2 Oct 2012 02:19:07 -0000 @@ -110,7 +110,7 @@ gpioiic_match(device_t parent, cfdata_t } void -gpioiic_attach(struct device *parent, struct device *self, void *aux) +gpioiic_attach(device_t parent, device_t self, void *aux) { struct gpioiic_softc *sc = device_private(self); struct gpio_attach_args *ga = aux; @@ -211,7 +211,7 @@ fail: } int -gpioiic_detach(struct device *self, int flags) +gpioiic_detach(device_t self, int flags) { struct gpioiic_softc *sc = device_private(self); int rv = 0; Index: sys/dev/hpc/bivideo.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/hpc/bivideo.c,v retrieving revision 1.32 diff -u -p -r1.32 bivideo.c --- sys/dev/hpc/bivideo.c 13 Nov 2010 13:51:58 -0000 1.32 +++ sys/dev/hpc/bivideo.c 28 Sep 2012 18:20:21 -0000 @@ -83,7 +83,6 @@ int bivideo_ioctl(void *, u_long, void * paddr_t bivideo_mmap(void *, off_t, int); struct bivideo_softc { - struct device sc_dev; struct hpcfb_fbconf sc_fbconf; struct hpcfb_dspconf sc_dspconf; int sc_powerstate; @@ -125,7 +124,7 @@ void bivideo_set_contrast(struct bivideo /* * static variables */ -CFATTACH_DECL(bivideo, sizeof(struct bivideo_softc), +CFATTACH_DECL_NEW(bivideo, sizeof(struct bivideo_softc), bivideomatch, bivideoattach, NULL, NULL); struct hpcfb_accessops bivideo_ha = { @@ -173,7 +172,7 @@ bivideoattach(device_t parent, device_t } printf("\n"); printf("%s: framebuffer address: 0x%08lx\n", - device_xname(&sc->sc_dev), (u_long)bootinfo->fb_addr); + device_xname(self), (u_long)bootinfo->fb_addr); /* Add a suspend hook to power saving */ sc->sc_powerstate = 0; Index: sys/dev/hpc/btnmgr.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/hpc/btnmgr.c,v retrieving revision 1.25 diff -u -p -r1.25 btnmgr.c --- sys/dev/hpc/btnmgr.c 12 May 2009 14:22:39 -0000 1.25 +++ sys/dev/hpc/btnmgr.c 28 Sep 2012 18:20:43 -0000 @@ -74,7 +74,6 @@ int btnmgr_debug = BTNMGRDEBUG_CONF; #endif struct btnmgr_softc { - struct device sc_dev; config_hook_tag sc_hook_tag; int sc_enabled; device_t sc_wskbddev; @@ -91,7 +90,7 @@ static int btnmgr_hook(void *, int, long /* * global/static data */ -CFATTACH_DECL(btnmgr, sizeof(struct btnmgr_softc), +CFATTACH_DECL_NEW(btnmgr, sizeof(struct btnmgr_softc), btnmgrmatch, btnmgrattach, NULL, NULL); #ifdef notyet Index: sys/dev/hpc/button.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/hpc/button.c,v retrieving revision 1.15 diff -u -p -r1.15 button.c --- sys/dev/hpc/button.c 12 May 2009 14:22:39 -0000 1.15 +++ sys/dev/hpc/button.c 28 Sep 2012 18:07:01 -0000 @@ -52,7 +52,6 @@ __KERNEL_RCSID(0, "$NetBSD: button.c,v 1 #include "locators.h" struct button_softc { - struct device sc_dev; hpcio_chip_t sc_hc; hpcio_intr_handle_t sc_intr_handle; int sc_port; @@ -67,7 +66,7 @@ static void button_attach(device_t, devi static int button_intr(void *); static int button_state(void *, int, long, void *); -CFATTACH_DECL(button, sizeof(struct button_softc), +CFATTACH_DECL_NEW(button, sizeof(struct button_softc), button_match, button_attach, NULL, NULL); int @@ -89,10 +88,10 @@ button_attach(device_t parent, device_t { struct hpcio_attach_args *haa = aux; int *loc; - struct button_softc *sc = (void*)self; + struct button_softc *sc = device_private(self); int mode; - loc = device_cfdata(&sc->sc_dev)->cf_loc; + loc = device_cfdata(self)->cf_loc; sc->sc_hc = (*haa->haa_getchip)(haa->haa_sc, loc[HPCIOIFCF_IOCHIP]); sc->sc_port = loc[HPCIOIFCF_PORT]; sc->sc_id = loc[HPCIOIFCF_ID]; Index: sys/dev/hpc/hpcapm.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/hpc/hpcapm.c,v retrieving revision 1.18 diff -u -p -r1.18 hpcapm.c --- sys/dev/hpc/hpcapm.c 12 May 2009 14:22:39 -0000 1.18 +++ sys/dev/hpc/hpcapm.c 28 Sep 2012 18:21:33 -0000 @@ -75,7 +75,6 @@ static void hpcapm_cpu_idle(void *); static void hpcapm_get_capabilities(void *, u_int *, u_int *); struct apmhpc_softc { - struct device sc_dev; void *sc_apmdev; volatile unsigned int events; volatile int power_state; @@ -89,7 +88,7 @@ struct apmhpc_softc { int minutes_left; }; -CFATTACH_DECL(hpcapm, sizeof (struct apmhpc_softc), +CFATTACH_DECL_NEW(hpcapm, sizeof (struct apmhpc_softc), hpcapm_match, hpcapm_attach, NULL, NULL); struct apm_accessops hpcapm_accessops = { @@ -106,16 +105,14 @@ struct apm_accessops hpcapm_accessops = extern struct cfdriver hpcapm_cd; static int -hpcapm_match(device_t parent, - cfdata_t cf, void *aux) +hpcapm_match(device_t parent, cfdata_t cf, void *aux) { return 1; } static void -hpcapm_attach(device_t parent, - device_t self, void *aux) +hpcapm_attach(device_t parent, device_t self, void *aux) { struct apmhpc_softc *sc; struct apmdev_attach_args aaa; Index: sys/dev/hpc/hpcbatteryvar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/hpc/hpcbatteryvar.h,v retrieving revision 1.3 diff -u -p -r1.3 hpcbatteryvar.h --- sys/dev/hpc/hpcbatteryvar.h 11 Dec 2005 12:21:22 -0000 1.3 +++ sys/dev/hpc/hpcbatteryvar.h 1 Oct 2012 14:44:55 -0000 @@ -64,7 +64,6 @@ typedef enum { } hpcbattery_batt_state; struct hpcbattery_softc { - struct device sc_device; /* current status */ hpcbattery_ac_state sc_ac_status; hpcbattery_batt_state sc_batt_status; Index: sys/dev/hpc/hpcin.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/hpc/hpcin.c,v retrieving revision 1.14 diff -u -p -r1.14 hpcin.c --- sys/dev/hpc/hpcin.c 12 May 2009 14:22:39 -0000 1.14 +++ sys/dev/hpc/hpcin.c 28 Sep 2012 18:21:46 -0000 @@ -49,7 +49,6 @@ void hpcin_attach(device_t, device_t, vo int hpcin_intr(void *); struct hpcin_softc { - struct device sc_dev; struct hpcioman_attach_args sc_hma; hpcio_intr_handle_t sc_ih; config_call_tag sc_ct; @@ -65,7 +64,7 @@ struct hpcin_softc { #define sc_off sc_hma.hma_off #define sc_connect sc_hma.hma_connect -CFATTACH_DECL(hpcin, sizeof(struct hpcin_softc), +CFATTACH_DECL_NEW(hpcin, sizeof(struct hpcin_softc), hpcin_match, hpcin_attach, NULL, NULL); int Index: sys/dev/hpc/hpcioman.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/hpc/hpcioman.c,v retrieving revision 1.18 diff -u -p -r1.18 hpcioman.c --- sys/dev/hpc/hpcioman.c 12 May 2009 14:22:39 -0000 1.18 +++ sys/dev/hpc/hpcioman.c 28 Sep 2012 18:23:04 -0000 @@ -49,14 +49,9 @@ __KERNEL_RCSID(0, "$NetBSD: hpcioman.c,v int hpcioman_match(device_t, cfdata_t, void *); void hpcioman_attach(device_t, device_t, void *); int hpcioman_print(void *, const char *); -int hpcioman_search(device_t, cfdata_t, - const int *, void *); +int hpcioman_search(device_t, cfdata_t, const int *, void *); -struct hpcioman_softc { - struct device sc_dev; -}; - -CFATTACH_DECL(hpcioman, sizeof(struct hpcioman_softc), +CFATTACH_DECL_NEW(hpcioman, 0, hpcioman_match, hpcioman_attach, NULL, NULL); int @@ -82,10 +77,8 @@ hpcioman_attach(device_t parent, device_ } int -hpcioman_search(device_t parent, cfdata_t cf, - const int *ldesc, void *aux) +hpcioman_search(device_t parent, cfdata_t cf, const int *ldesc, void *aux) { - //struct hpcioman_softc *sc = (struct hpcioman_softc *)parent; struct hpcio_attach_args *haa = aux; struct hpcioman_attach_args hma; Index: sys/dev/hpc/hpckbd.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/hpc/hpckbd.c,v retrieving revision 1.29 diff -u -p -r1.29 hpckbd.c --- sys/dev/hpc/hpckbd.c 11 Jun 2011 16:34:36 -0000 1.29 +++ sys/dev/hpc/hpckbd.c 2 Oct 2012 02:19:24 -0000 @@ -79,8 +79,8 @@ struct hpckbd_core { struct hpckbd_eventq *hc_head, *hc_tail; int hc_nevents; int hc_enabled; - struct device *hc_wskbddev; - struct hpckbd_softc* hc_sc; /* back link */ + device_t hc_wskbddev; + struct hpckbd_softc *hc_sc; /* back link */ #ifdef WSDISPLAY_COMPAT_RAWKBD int hc_rawkbd; #endif Index: sys/dev/hpc/hpcout.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/hpc/hpcout.c,v retrieving revision 1.15 diff -u -p -r1.15 hpcout.c --- sys/dev/hpc/hpcout.c 12 May 2009 14:22:39 -0000 1.15 +++ sys/dev/hpc/hpcout.c 28 Sep 2012 18:23:42 -0000 @@ -49,7 +49,6 @@ void hpcout_attach(device_t, device_t, v int hpcout_hook(void *, int, long, void *); struct hpcout_softc { - struct device sc_dev; struct hpcioman_attach_args sc_hma; }; @@ -62,7 +61,7 @@ struct hpcout_softc { #define sc_on sc_hma.hma_on #define sc_off sc_hma.hma_off -CFATTACH_DECL(hpcout, sizeof(struct hpcout_softc), +CFATTACH_DECL_NEW(hpcout, sizeof(struct hpcout_softc), hpcout_match, hpcout_attach, NULL, NULL); int Index: sys/dev/hpc/hpf1275a_tty.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/hpc/hpf1275a_tty.c,v retrieving revision 1.25 diff -u -p -r1.25 hpf1275a_tty.c --- sys/dev/hpc/hpf1275a_tty.c 12 May 2009 14:22:39 -0000 1.25 +++ sys/dev/hpc/hpf1275a_tty.c 29 Sep 2012 11:44:21 -0000 @@ -56,7 +56,7 @@ __KERNEL_RCSID(0, "$NetBSD: hpf1275a_tty extern struct cfdriver hpf1275a_cd; struct hpf1275a_softc { - struct device sc_dev; + device_t sc_dev; struct tty *sc_tp; /* back reference to the tty */ device_t sc_wskbd; /* wskbd child */ @@ -91,7 +91,7 @@ static int hpf1275a_wskbd_ioctl(void *, * It doesn't need to be exported, as only hpf1275aattach() uses it, * but there's no "official" way to make it static. */ -CFATTACH_DECL(hpf1275a, sizeof(struct hpf1275a_softc), +CFATTACH_DECL_NEW(hpf1275a, sizeof(struct hpf1275a_softc), hpf1275a_match, hpf1275a_attach, hpf1275a_detach, NULL); @@ -244,8 +244,7 @@ hpf1275aattach(int n) * XXX: unused: config_attach_pseudo(9) does not call ca_match. */ static int -hpf1275a_match(device_t self, - cfdata_t cfdata, void *arg) +hpf1275a_match(device_t self, cfdata_t cfdata, void *arg) { /* pseudo-device; always present */ @@ -258,8 +257,7 @@ hpf1275a_match(device_t self, * open the line discipline. */ static void -hpf1275a_attach(device_t parent, - device_t self, void *aux) +hpf1275a_attach(device_t parent, device_t self, void *aux) { struct hpf1275a_softc *sc = device_private(self); struct wskbddev_attach_args wska; @@ -269,6 +267,7 @@ hpf1275a_attach(device_t parent, wska.accessops = &hpf1275a_wskbd_accessops; wska.accesscookie = sc; + sc->sc_dev = self; sc->sc_enabled = 0; #ifdef WSDISPLAY_COMPAT_RAWKBD sc->sc_rawkbd = 0; @@ -309,6 +308,7 @@ hpf1275a_open(dev_t dev, struct tty *tp) }; struct lwp *l = curlwp; /* XXX */ struct hpf1275a_softc *sc; + device_t self; int error, s; if ((error = kauth_authorize_device_tty(l->l_cred, @@ -322,13 +322,13 @@ hpf1275a_open(dev_t dev, struct tty *tp) return 0; } - sc = (struct hpf1275a_softc *)config_attach_pseudo(&hpf1275a_cfdata); - if (sc == NULL) { + self = config_attach_pseudo(&hpf1275a_cfdata); + if (self == NULL) { splx(s); return (EIO); } - tp->t_sc = sc; + tp->t_sc = device_private(self); sc->sc_tp = tp; splx(s); @@ -354,7 +354,7 @@ hpf1275a_close(struct tty *tp, int flag) if (sc != NULL) { tp->t_sc = NULL; if (sc->sc_tp == tp) - config_detach(&sc->sc_dev, 0); + config_detach(sc->sc_dev, 0); } splx(s); return (0); @@ -387,7 +387,7 @@ hpf1275a_input(int c, struct tty *tp) xtscan = hpf1275a_to_xtscan[code]; if (xtscan == 0) { - aprint_error_dev(&sc->sc_dev, "unknown code 0x%x\n", code); + aprint_error_dev(sc->sc_dev, "unknown code 0x%x\n", code); return (0); } Index: sys/dev/hpc/pwctl.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/hpc/pwctl.c,v retrieving revision 1.19 diff -u -p -r1.19 pwctl.c --- sys/dev/hpc/pwctl.c 12 May 2009 14:22:39 -0000 1.19 +++ sys/dev/hpc/pwctl.c 28 Sep 2012 18:26:09 -0000 @@ -70,7 +70,6 @@ int pwctl_debug = PWCTLDEBUG_CONF; #endif struct pwctl_softc { - struct device sc_dev; hpcio_chip_t sc_hc; int sc_port; long sc_id; @@ -88,7 +87,7 @@ static int pwctl_hook(void *, int, long, static int pwctl_ghook(void *, int, long, void *); int pwctl_hardpower(void *, int, long, void *); -CFATTACH_DECL(pwctl, sizeof(struct pwctl_softc), +CFATTACH_DECL_NEW(pwctl, sizeof(struct pwctl_softc), pwctl_match, pwctl_attach, NULL, NULL); int @@ -114,7 +113,7 @@ pwctl_attach(device_t parent, device_t s int *loc; struct pwctl_softc *sc = device_private(self); - loc = device_cfdata(&sc->sc_dev)->cf_loc; + loc = device_cfdata(self)->cf_loc; sc->sc_hc = (*haa->haa_getchip)(haa->haa_sc, loc[HPCIOIFCF_IOCHIP]); sc->sc_port = loc[HPCIOIFCF_PORT]; sc->sc_id = loc[HPCIOIFCF_ID]; Index: sys/dev/i2c/adm1021.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/i2c/adm1021.c,v retrieving revision 1.7 diff -u -p -r1.7 adm1021.c --- sys/dev/i2c/adm1021.c 20 Jun 2011 20:16:19 -0000 1.7 +++ sys/dev/i2c/adm1021.c 29 Sep 2012 12:22:37 -0000 @@ -46,7 +46,6 @@ __KERNEL_RCSID(0, "$NetBSD: adm1021.c,v #define ADMTEMP_NUM_SENSORS 2 struct admtemp_softc { - struct device sc_dev; i2c_tag_t sc_tag; i2c_addr_t sc_addr; @@ -112,7 +111,7 @@ admtemp_attach(device_t parent, device_t if (iic_exec(sc->sc_tag, I2C_OP_READ_WITH_STOP, sc->sc_addr, &cmd, sizeof cmd, &data, sizeof data, 0)) { iic_release_bus(sc->sc_tag, 0); - aprint_error_dev(&sc->sc_dev, "cannot get control register\n"); + aprint_error_dev(self, "cannot get control register\n"); return; } if (data & ADM1021_CONFIG_RUN) { @@ -120,7 +119,7 @@ admtemp_attach(device_t parent, device_t if (iic_exec(sc->sc_tag, I2C_OP_READ_WITH_STOP, sc->sc_addr, &cmd, sizeof cmd, &stat, sizeof stat, 0)) { iic_release_bus(sc->sc_tag, 0); - aprint_error_dev(&sc->sc_dev, + aprint_error_dev(self, "cannot read status register\n"); return; } @@ -129,7 +128,7 @@ admtemp_attach(device_t parent, device_t sc->sc_addr, &cmd, sizeof cmd, &stat, sizeof stat, 0)) { iic_release_bus(sc->sc_tag, 0); - aprint_error_dev(&sc->sc_dev, + aprint_error_dev(self, "cannot read status register\n"); return; } @@ -145,7 +144,7 @@ admtemp_attach(device_t parent, device_t if (iic_exec(sc->sc_tag, I2C_OP_WRITE_WITH_STOP, sc->sc_addr, &cmd, sizeof cmd, &data, sizeof data, 0)) { iic_release_bus(sc->sc_tag, 0); - aprint_error_dev(&sc->sc_dev, + aprint_error_dev(self, "cannot set control register\n"); return; } @@ -165,7 +164,7 @@ admtemp_attach(device_t parent, device_t if (sysmon_envsys_sensor_attach( sc->sc_sme, &sc->sc_sensor[ADMTEMP_INT])) { sysmon_envsys_destroy(sc->sc_sme); - aprint_error_dev(&sc->sc_dev, + aprint_error_dev(self, "unable to attach internal at sysmon\n"); return; } @@ -173,7 +172,7 @@ admtemp_attach(device_t parent, device_t sysmon_envsys_sensor_attach( sc->sc_sme, &sc->sc_sensor[ADMTEMP_EXT])) { sysmon_envsys_destroy(sc->sc_sme); - aprint_error_dev(&sc->sc_dev, + aprint_error_dev(self, "unable to attach external at sysmon\n"); return; } @@ -181,7 +180,7 @@ admtemp_attach(device_t parent, device_t sc->sc_sme->sme_cookie = sc; sc->sc_sme->sme_refresh = admtemp_refresh; if (sysmon_envsys_register(sc->sc_sme)) { - aprint_error_dev(&sc->sc_dev, + aprint_error_dev(self, "unable to register with sysmon\n"); sysmon_envsys_destroy(sc->sc_sme); return; Index: sys/dev/i2c/lm75.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/i2c/lm75.c,v retrieving revision 1.24 diff -u -p -r1.24 lm75.c --- sys/dev/i2c/lm75.c 2 Jun 2012 21:36:44 -0000 1.24 +++ sys/dev/i2c/lm75.c 29 Sep 2012 11:44:48 -0000 @@ -266,7 +266,7 @@ lmtemp_refresh_sensor_data(struct lmtemp error = lmtemp_temp_read(sc, LM75_REG_TEMP, &val); if (error) { #if 0 - aprint_error_dev(&sc->sc_dev, "unable to read temperature, error = %d\n", + aprint_error_dev(sc->sc_dev, "unable to read temperature, error = %d\n", error); #endif sc->sc_sensor.state = ENVSYS_SINVALID; Index: sys/dev/i2o/dpti.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/i2o/dpti.c,v retrieving revision 1.44 diff -u -p -r1.44 dpti.c --- sys/dev/i2o/dpti.c 7 Aug 2011 13:39:23 -0000 1.44 +++ sys/dev/i2o/dpti.c 28 Sep 2012 20:54:57 -0000 @@ -143,7 +143,7 @@ const struct cdevsw dpti_cdevsw = { extern struct cfdriver dpti_cd; -CFATTACH_DECL(dpti, sizeof(struct dpti_softc), +CFATTACH_DECL_NEW(dpti, sizeof(struct dpti_softc), dpti_match, dpti_attach, NULL, NULL); int @@ -153,7 +153,7 @@ dpti_match(device_t parent, cfdata_t mat struct iop_softc *iop; ia = aux; - iop = (struct iop_softc *)parent; + iop = device_private(parent); if (ia->ia_class != I2O_CLASS_ANY || ia->ia_tid != I2O_TID_IOP) return (0); @@ -177,6 +177,7 @@ dpti_attach(device_t parent, device_t se int rv; sc = device_private(self); + sc->sc_dev = self; iop = device_private(parent); /* @@ -216,7 +217,7 @@ dptiioctl(dev_t dev, u_long cmd, void *d int i, size, rv, linux; sc = device_lookup_private(&dpti_cd, minor(dev)); - iop = (struct iop_softc *)device_parent(&sc->sc_dv); + iop = device_private(device_parent(sc->sc_dev)); rv = 0; if (cmd == PTIOCLINUX) { @@ -283,7 +284,7 @@ dptiioctl(dev_t dev, u_long cmd, void *d case DPT_I2ORESETCMD: printf("%s: I2ORESETCMD not implemented\n", - device_xname(&sc->sc_dv)); + device_xname(sc->sc_dev)); rv = EOPNOTSUPP; break; @@ -307,7 +308,7 @@ dpti_blinkled(struct dpti_softc *sc) struct iop_softc *iop; u_int v; - iop = (struct iop_softc *)device_parent(&sc->sc_dv); + iop = device_private(device_parent(sc->sc_dev)); v = bus_space_read_1(iop->sc_iot, iop->sc_ioh, sc->sc_blinkled + 0); if (v == 0xbc) { @@ -326,12 +327,12 @@ dpti_ctlrinfo(struct dpti_softc *sc, int struct iop_softc *iop; int rv, i; - iop = (struct iop_softc *)device_parent(&sc->sc_dv); + iop = device_private(device_parent(sc->sc_dev)); memset(&info, 0, sizeof(info)); info.length = sizeof(info) - sizeof(u_int16_t); - info.drvrHBAnum = device_unit(&sc->sc_dv); + info.drvrHBAnum = device_unit(sc->sc_dev); info.baseAddr = iop->sc_memaddr; if ((i = dpti_blinkled(sc)) == -1) i = 0; @@ -448,12 +449,12 @@ dpti_passthrough(struct dpti_softc *sc, int rv, msgsize, repsize, sgoff, i, mapped, nbuf, nfrag, j, sz; u_int32_t *p, *pmax; - iop = (struct iop_softc *)device_parent(&sc->sc_dv); + iop = device_private(device_parent(sc->sc_dev)); im = NULL; if ((rv = dpti_blinkled(sc)) != -1) { if (rv != 0) { - aprint_error_dev(&sc->sc_dv, "adapter blinkled = 0x%02x\n", rv); + aprint_error_dev(sc->sc_dev, "adapter blinkled = 0x%02x\n", rv); return (EIO); } } @@ -464,14 +465,14 @@ dpti_passthrough(struct dpti_softc *sc, */ if ((rv = copyin(data, &mh, sizeof(mh))) != 0) { DPRINTF(("%s: message copyin failed\n", - device_xname(&sc->sc_dv))); + device_xname(sc->sc_dev))); return (rv); } msgsize = (mh.msgflags >> 14) & ~3; if (msgsize < sizeof(mh) || msgsize >= IOP_MAX_MSG_SIZE) { DPRINTF(("%s: bad message frame size\n", - device_xname(&sc->sc_dv))); + device_xname(sc->sc_dev))); return (EINVAL); } @@ -481,17 +482,17 @@ dpti_passthrough(struct dpti_softc *sc, switch (mh.msgfunc >> 24) { case I2O_EXEC_IOP_RESET: printf("%s: I2O_EXEC_IOP_RESET not implemented\n", - device_xname(&sc->sc_dv)); + device_xname(sc->sc_dev)); return (EOPNOTSUPP); case I2O_EXEC_OUTBOUND_INIT: printf("%s: I2O_EXEC_OUTBOUND_INIT not implemented\n", - device_xname(&sc->sc_dv)); + device_xname(sc->sc_dev)); return (EOPNOTSUPP); case I2O_EXEC_SYS_TAB_SET: printf("%s: I2O_EXEC_SYS_TAB_SET not implemented\n", - device_xname(&sc->sc_dv)); + device_xname(sc->sc_dev)); return (EOPNOTSUPP); case I2O_EXEC_STATUS_GET: @@ -506,7 +507,7 @@ dpti_passthrough(struct dpti_softc *sc, */ if ((rv = copyin(data, mbtmp, msgsize)) != 0) { DPRINTF(("%s: full message copyin failed\n", - device_xname(&sc->sc_dv))); + device_xname(sc->sc_dev))); return (rv); } @@ -515,19 +516,19 @@ dpti_passthrough(struct dpti_softc *sc, */ if ((rv = copyin((char *)data + msgsize, &rh, sizeof(rh))) != 0) { DPRINTF(("%s: reply copyin failed\n", - device_xname(&sc->sc_dv))); + device_xname(sc->sc_dev))); return (rv); } repsize = (rh.msgflags >> 14) & ~3; if (repsize < sizeof(rh) || repsize >= IOP_MAX_MSG_SIZE) { DPRINTF(("%s: bad reply header size\n", - device_xname(&sc->sc_dv))); + device_xname(sc->sc_dev))); return (EINVAL); } if ((rv = copyin((char *)data + msgsize, rbtmp, repsize)) != 0) { - DPRINTF(("%s: reply too large\n", device_xname(&sc->sc_dv))); + DPRINTF(("%s: reply too large\n", device_xname(sc->sc_dev))); return (rv); } @@ -541,7 +542,7 @@ dpti_passthrough(struct dpti_softc *sc, if ((sgoff = ((mh.msgflags >> 4) & 15)) != 0) { if ((sgoff + 2) > (msgsize >> 2)) { DPRINTF(("%s: invalid message size fields\n", - device_xname(&sc->sc_dv))); + device_xname(sc->sc_dev))); return (EINVAL); } @@ -553,13 +554,13 @@ dpti_passthrough(struct dpti_softc *sc, for (nbuf = 0; nbuf < IOP_MAX_MSG_XFERS; nbuf++, p += 2) { if (p > pmax) { DPRINTF(("%s: invalid SGL (1)\n", - device_xname(&sc->sc_dv))); + device_xname(sc->sc_dev))); goto bad; } if ((p[0] & 0x30000000) != I2O_SGL_SIMPLE) { DPRINTF(("%s: invalid SGL (2)\n", - device_xname(&sc->sc_dv))); + device_xname(sc->sc_dev))); goto bad; } @@ -569,7 +570,7 @@ dpti_passthrough(struct dpti_softc *sc, if ((p[0] & I2O_SGL_END_BUFFER) != 0) { if ((p[0] & 0x00ffffff) > IOP_MAX_XFER) { DPRINTF(("%s: buffer too large\n", - device_xname(&sc->sc_dv))); + device_xname(sc->sc_dev))); goto bad; } @@ -592,7 +593,7 @@ dpti_passthrough(struct dpti_softc *sc, for (; p <= pmax; p += 2) { if (nfrag == DPTI_MAX_SEGS) { DPRINTF(("%s: too many segments\n", - device_xname(&sc->sc_dv))); + device_xname(sc->sc_dev))); goto bad; } @@ -608,7 +609,7 @@ dpti_passthrough(struct dpti_softc *sc, if ((p[0] & I2O_SGL_END_BUFFER) == 0) { DPRINTF(( "%s: invalid SGL (3)\n", - device_xname(&sc->sc_dv))); + device_xname(sc->sc_dev))); goto bad; } break; @@ -620,13 +621,13 @@ dpti_passthrough(struct dpti_softc *sc, if (p > pmax) { DPRINTF(("%s: invalid SGL (4)\n", - device_xname(&sc->sc_dv))); + device_xname(sc->sc_dev))); goto bad; } if (sz > IOP_MAX_XFER) { DPRINTF(("%s: buffer too large\n", - device_xname(&sc->sc_dv))); + device_xname(sc->sc_dev))); goto bad; } @@ -634,7 +635,7 @@ dpti_passthrough(struct dpti_softc *sc, bufs[nbuf].db_ptr = malloc(sz, M_DEVBUF, M_WAITOK); if (bufs[nbuf].db_ptr == NULL) { DPRINTF(("%s: allocation failure\n", - device_xname(&sc->sc_dv))); + device_xname(sc->sc_dev))); rv = ENOMEM; goto bad; } @@ -645,7 +646,7 @@ dpti_passthrough(struct dpti_softc *sc, bufs[nbuf].db_frags[i].iov_len); if (rv != 0) { DPRINTF(("%s: frag copyin\n", - device_xname(&sc->sc_dv))); + device_xname(sc->sc_dev))); goto bad; } sz += bufs[nbuf].db_frags[i].iov_len; @@ -657,7 +658,7 @@ dpti_passthrough(struct dpti_softc *sc, if (nbuf == IOP_MAX_MSG_XFERS) { DPRINTF(("%s: too many transfers\n", - device_xname(&sc->sc_dv))); + device_xname(sc->sc_dev))); goto bad; } } else @@ -685,7 +686,7 @@ dpti_passthrough(struct dpti_softc *sc, bufs[i].db_size, bufs[i].db_out, bufs[i].db_proc); if (rv != 0) { DPRINTF(("%s: msg_map failed, rv = %d\n", - device_xname(&sc->sc_dv), rv)); + device_xname(sc->sc_dev), rv)); goto bad; } mapped = 1; @@ -702,7 +703,7 @@ dpti_passthrough(struct dpti_softc *sc, */ if ((rv = copyout(rbtmp, (char *)data + msgsize, repsize)) != 0) { DPRINTF(("%s: reply copyout() failed\n", - device_xname(&sc->sc_dv))); + device_xname(sc->sc_dev))); } bad: Index: sys/dev/i2o/dptivar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/i2o/dptivar.h,v retrieving revision 1.8 diff -u -p -r1.8 dptivar.h --- sys/dev/i2o/dptivar.h 7 Aug 2011 13:39:23 -0000 1.8 +++ sys/dev/i2o/dptivar.h 28 Sep 2012 21:15:59 -0000 @@ -61,7 +61,7 @@ * Runtime state. */ struct dpti_softc { - struct device sc_dv; + device_t sc_dev; int sc_blinkled; }; Index: sys/dev/i2o/iop.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/i2o/iop.c,v retrieving revision 1.81 diff -u -p -r1.81 iop.c --- sys/dev/i2o/iop.c 13 Nov 2010 13:51:59 -0000 1.81 +++ sys/dev/i2o/iop.c 29 Sep 2012 13:08:52 -0000 @@ -297,27 +297,27 @@ iop_init(struct iop_softc *sc, const cha /* Allocate a scratch DMA map for small miscellaneous shared data. */ if (bus_dmamap_create(sc->sc_dmat, PAGE_SIZE, 1, PAGE_SIZE, 0, BUS_DMA_NOWAIT | BUS_DMA_ALLOCNOW, &sc->sc_scr_dmamap) != 0) { - aprint_error_dev(&sc->sc_dv, "cannot create scratch dmamap\n"); + aprint_error_dev(sc->sc_dev, "cannot create scratch dmamap\n"); return; } if (bus_dmamem_alloc(sc->sc_dmat, PAGE_SIZE, PAGE_SIZE, 0, sc->sc_scr_seg, 1, &nsegs, BUS_DMA_NOWAIT) != 0) { - aprint_error_dev(&sc->sc_dv, "cannot alloc scratch dmamem\n"); + aprint_error_dev(sc->sc_dev, "cannot alloc scratch dmamem\n"); goto bail_out; } state++; if (bus_dmamem_map(sc->sc_dmat, sc->sc_scr_seg, nsegs, PAGE_SIZE, &sc->sc_scr, 0)) { - aprint_error_dev(&sc->sc_dv, "cannot map scratch dmamem\n"); + aprint_error_dev(sc->sc_dev, "cannot map scratch dmamem\n"); goto bail_out; } state++; if (bus_dmamap_load(sc->sc_dmat, sc->sc_scr_dmamap, sc->sc_scr, PAGE_SIZE, NULL, BUS_DMA_NOWAIT)) { - aprint_error_dev(&sc->sc_dv, "cannot load scratch dmamap\n"); + aprint_error_dev(sc->sc_dev, "cannot load scratch dmamap\n"); goto bail_out; } state++; @@ -332,12 +332,12 @@ iop_init(struct iop_softc *sc, const cha /* Reset the adapter and request status. */ if ((rv = iop_reset(sc)) != 0) { - aprint_error_dev(&sc->sc_dv, "not responding (reset)\n"); + aprint_error_dev(sc->sc_dev, "not responding (reset)\n"); goto bail_out; } if ((rv = iop_status_get(sc, 1)) != 0) { - aprint_error_dev(&sc->sc_dv, "not responding (get status)\n"); + aprint_error_dev(sc->sc_dev, "not responding (get status)\n"); goto bail_out; } @@ -348,15 +348,15 @@ iop_init(struct iop_softc *sc, const cha #ifdef I2ODEBUG printf("%s: orgid=0x%04x version=%d\n", - device_xname(&sc->sc_dv), + device_xname(sc->sc_dev), le16toh(sc->sc_status.orgid), (le32toh(sc->sc_status.segnumber) >> 12) & 15); - printf("%s: type want have cbase\n", device_xname(&sc->sc_dv)); - printf("%s: mem %04x %04x %08x\n", device_xname(&sc->sc_dv), + printf("%s: type want have cbase\n", device_xname(sc->sc_dev)); + printf("%s: mem %04x %04x %08x\n", device_xname(sc->sc_dev), le32toh(sc->sc_status.desiredprivmemsize), le32toh(sc->sc_status.currentprivmemsize), le32toh(sc->sc_status.currentprivmembase)); - printf("%s: i/o %04x %04x %08x\n", device_xname(&sc->sc_dv), + printf("%s: i/o %04x %04x %08x\n", device_xname(sc->sc_dev), le32toh(sc->sc_status.desiredpriviosize), le32toh(sc->sc_status.currentpriviosize), le32toh(sc->sc_status.currentpriviobase)); @@ -374,7 +374,7 @@ iop_init(struct iop_softc *sc, const cha #if defined(I2ODEBUG) || defined(DIAGNOSTIC) if (sc->sc_framesize < IOP_MIN_MSG_SIZE) { - aprint_error_dev(&sc->sc_dv, "frame size too small (%d)\n", + aprint_error_dev(sc->sc_dev, "frame size too small (%d)\n", sc->sc_framesize); goto bail_out; } @@ -383,7 +383,7 @@ iop_init(struct iop_softc *sc, const cha /* Allocate message wrappers. */ im = malloc(sizeof(*im) * sc->sc_maxib, M_DEVBUF, M_NOWAIT|M_ZERO); if (im == NULL) { - aprint_error_dev(&sc->sc_dv, "memory allocation failure\n"); + aprint_error_dev(sc->sc_dev, "memory allocation failure\n"); goto bail_out; } state++; @@ -396,7 +396,7 @@ iop_init(struct iop_softc *sc, const cha BUS_DMA_NOWAIT | BUS_DMA_ALLOCNOW, &im->im_xfer[0].ix_map); if (rv != 0) { - aprint_error_dev(&sc->sc_dv, "couldn't create dmamap (%d)", rv); + aprint_error_dev(sc->sc_dev, "couldn't create dmamap (%d)", rv); goto bail_out3; } @@ -407,7 +407,7 @@ iop_init(struct iop_softc *sc, const cha /* Initialise the IOP's outbound FIFO. */ if (iop_ofifo_init(sc) != 0) { - aprint_error_dev(&sc->sc_dv, "unable to init oubound FIFO\n"); + aprint_error_dev(sc->sc_dev, "unable to init oubound FIFO\n"); goto bail_out3; } @@ -415,7 +415,7 @@ iop_init(struct iop_softc *sc, const cha * Defer further configuration until (a) interrupts are working and * (b) we have enough information to build the system table. */ - config_interrupts((device_t)sc, iop_config_interrupts); + config_interrupts(sc->sc_dev, iop_config_interrupts); /* Configure shutdown hook before we start any device activity. */ if (iop_sdh == NULL) @@ -426,12 +426,12 @@ iop_init(struct iop_softc *sc, const cha iop_outl(sc, IOP_REG_INTR_MASK, mask & ~IOP_INTR_OFIFO); if (intrstr != NULL) - printf("%s: interrupting at %s\n", device_xname(&sc->sc_dv), + printf("%s: interrupting at %s\n", device_xname(sc->sc_dev), intrstr); #ifdef I2ODEBUG printf("%s: queue depths: inbound %d/%d, outbound %d/%d\n", - device_xname(&sc->sc_dv), sc->sc_maxib, + device_xname(sc->sc_dev), sc->sc_maxib, le32toh(sc->sc_status.maxinboundmframes), sc->sc_maxob, le32toh(sc->sc_status.maxoutboundmframes)); #endif @@ -472,10 +472,10 @@ iop_config_interrupts(device_t self) LIST_INIT(&sc->sc_iilist); - printf("%s: configuring...\n", device_xname(&sc->sc_dv)); + printf("%s: configuring...\n", device_xname(sc->sc_dev)); if (iop_hrt_get(sc) != 0) { - printf("%s: unable to retrieve HRT\n", device_xname(&sc->sc_dv)); + printf("%s: unable to retrieve HRT\n", device_xname(sc->sc_dev)); mutex_exit(&sc->sc_conflock); return; } @@ -490,7 +490,7 @@ iop_config_interrupts(device_t self) if ((iop->sc_flags & IOP_HAVESTATUS) == 0) continue; if (iop_status_get(iop, 1) != 0) { - aprint_error_dev(&sc->sc_dv, "unable to retrieve status\n"); + aprint_error_dev(sc->sc_dev, "unable to retrieve status\n"); iop->sc_flags &= ~IOP_HAVESTATUS; continue; } @@ -516,7 +516,7 @@ iop_config_interrupts(device_t self) continue; ste->orgid = iop->sc_status.orgid; - ste->iopid = device_unit(&iop->sc_dv) + 2; + ste->iopid = device_unit(iop->sc_dev) + 2; ste->segnumber = htole32(le32toh(iop->sc_status.segnumber) & ~4095); ste->iopcaps = iop->sc_status.iopcaps; @@ -533,12 +533,12 @@ iop_config_interrupts(device_t self) * state. */ if (iop_systab_set(sc) != 0) { - aprint_error_dev(&sc->sc_dv, "unable to set system table\n"); + aprint_error_dev(sc->sc_dev, "unable to set system table\n"); mutex_exit(&sc->sc_conflock); return; } if (iop_sys_enable(sc) != 0) { - aprint_error_dev(&sc->sc_dv, "unable to enable system\n"); + aprint_error_dev(sc->sc_dev, "unable to enable system\n"); mutex_exit(&sc->sc_conflock); return; } @@ -566,7 +566,7 @@ iop_config_interrupts(device_t self) I2O_EVENT_GEN_STATE_CHANGE | I2O_EVENT_GEN_GENERAL_WARNING); if (rv != 0) { - aprint_error_dev(&sc->sc_dv, "unable to register for events"); + aprint_error_dev(sc->sc_dev, "unable to register for events"); mutex_exit(&sc->sc_conflock); return; } @@ -584,15 +584,15 @@ iop_config_interrupts(device_t self) * Start device configuration. */ if ((rv = iop_reconfigure(sc, 0)) == -1) - aprint_error_dev(&sc->sc_dv, "configure failed (%d)\n", rv); + aprint_error_dev(sc->sc_dev, "configure failed (%d)\n", rv); sc->sc_flags |= IOP_ONLINE; rv = kthread_create(PRI_NONE, 0, NULL, iop_reconf_thread, sc, - &sc->sc_reconf_thread, "%s", device_xname(&sc->sc_dv)); + &sc->sc_reconf_thread, "%s", device_xname(sc->sc_dev)); mutex_exit(&sc->sc_conflock); if (rv != 0) { - aprint_error_dev(&sc->sc_dv, "unable to create reconfiguration thread (%d)", rv); + aprint_error_dev(sc->sc_dev, "unable to create reconfiguration thread (%d)", rv); return; } } @@ -616,12 +616,12 @@ iop_reconf_thread(void *cookie) for (;;) { DPRINTF(("%s: async reconfig: requested 0x%08x\n", - device_xname(&sc->sc_dv), chgind)); + device_xname(sc->sc_dev), chgind)); rv = iop_lct_get0(sc, &lct, sizeof(lct), chgind); DPRINTF(("%s: async reconfig: notified (0x%08x, %d)\n", - device_xname(&sc->sc_dv), le32toh(lct.changeindicator), rv)); + device_xname(sc->sc_dev), le32toh(lct.changeindicator), rv)); mutex_enter(&sc->sc_conflock); if (rv == 0) { @@ -673,18 +673,18 @@ iop_reconfigure(struct iop_softc *sc, u_ mf.msgictx = IOP_ICTX; mf.msgtctx = im->im_tctx; - DPRINTF(("%s: scanning bus %d\n", device_xname(&sc->sc_dv), + DPRINTF(("%s: scanning bus %d\n", device_xname(sc->sc_dev), tid)); rv = iop_msg_post(sc, im, &mf, 5*60*1000); iop_msg_free(sc, im); #ifdef I2ODEBUG if (rv != 0) - aprint_error_dev(&sc->sc_dv, "bus scan failed\n"); + aprint_error_dev(sc->sc_dev, "bus scan failed\n"); #endif } } else if (chgind <= sc->sc_chgind) { - DPRINTF(("%s: LCT unchanged (async)\n", device_xname(&sc->sc_dv))); + DPRINTF(("%s: LCT unchanged (async)\n", device_xname(sc->sc_dev))); return (0); } @@ -693,14 +693,14 @@ iop_reconfigure(struct iop_softc *sc, u_ DPRINTF(("iop_reconfigure: unable to re-read LCT\n")); return (rv); } - DPRINTF(("%s: %d LCT entries\n", device_xname(&sc->sc_dv), sc->sc_nlctent)); + DPRINTF(("%s: %d LCT entries\n", device_xname(sc->sc_dev), sc->sc_nlctent)); chgind = le32toh(sc->sc_lct->changeindicator); if (chgind == sc->sc_chgind) { - DPRINTF(("%s: LCT unchanged\n", device_xname(&sc->sc_dv))); + DPRINTF(("%s: LCT unchanged\n", device_xname(sc->sc_dev))); return (0); } - DPRINTF(("%s: LCT changed\n", device_xname(&sc->sc_dv))); + DPRINTF(("%s: LCT changed\n", device_xname(sc->sc_dev))); sc->sc_chgind = chgind; if (sc->sc_tidmap != NULL) @@ -747,7 +747,7 @@ iop_reconfigure(struct iop_softc *sc, u_ if (ii->ii_reconfig == NULL) continue; if ((rv = (*ii->ii_reconfig)(ii->ii_dv)) != 0) - aprint_error_dev(&sc->sc_dv, "%s failed reconfigure (%d)\n", + aprint_error_dev(sc->sc_dev, "%s failed reconfigure (%d)\n", device_xname(ii->ii_dv), rv); } @@ -810,7 +810,7 @@ iop_configure_devices(struct iop_softc * locs[IOPCF_TID] = ia.ia_tid; - dv = config_found_sm_loc(&sc->sc_dv, "iop", locs, &ia, + dv = config_found_sm_loc(sc->sc_dev, "iop", locs, &ia, iop_print, config_stdsubmatch); if (dv != NULL) { sc->sc_tidmap[i].it_flags |= IT_CONFIGURED; @@ -943,7 +943,7 @@ iop_status_get(struct iop_softc *sc, int } if (st->syncbyte != 0xff) { - aprint_error_dev(&sc->sc_dv, "STATUS_GET timed out\n"); + aprint_error_dev(sc->sc_dev, "STATUS_GET timed out\n"); rv = EIO; } else { memcpy(&sc->sc_status, st, sizeof(sc->sc_status)); @@ -1002,7 +1002,7 @@ iop_ofifo_init(struct iop_softc *sc) *sw == htole32(I2O_EXEC_OUTBOUND_INIT_COMPLETE))); if (*sw != htole32(I2O_EXEC_OUTBOUND_INIT_COMPLETE)) { - aprint_error_dev(&sc->sc_dv, "outbound FIFO init failed (%d)\n", + aprint_error_dev(sc->sc_dev, "outbound FIFO init failed (%d)\n", le32toh(*sw)); return (EIO); } @@ -1014,7 +1014,7 @@ iop_ofifo_init(struct iop_softc *sc) rv = bus_dmamem_alloc(sc->sc_dmat, sc->sc_rep_size, PAGE_SIZE, 0, &seg, 1, &rseg, BUS_DMA_NOWAIT); if (rv != 0) { - aprint_error_dev(&sc->sc_dv, "DMA alloc = %d\n", + aprint_error_dev(sc->sc_dev, "DMA alloc = %d\n", rv); return (rv); } @@ -1022,21 +1022,21 @@ iop_ofifo_init(struct iop_softc *sc) rv = bus_dmamem_map(sc->sc_dmat, &seg, rseg, sc->sc_rep_size, &sc->sc_rep, BUS_DMA_NOWAIT | BUS_DMA_COHERENT); if (rv != 0) { - aprint_error_dev(&sc->sc_dv, "DMA map = %d\n", rv); + aprint_error_dev(sc->sc_dev, "DMA map = %d\n", rv); return (rv); } rv = bus_dmamap_create(sc->sc_dmat, sc->sc_rep_size, 1, sc->sc_rep_size, 0, BUS_DMA_NOWAIT, &sc->sc_rep_dmamap); if (rv != 0) { - aprint_error_dev(&sc->sc_dv, "DMA create = %d\n", rv); + aprint_error_dev(sc->sc_dev, "DMA create = %d\n", rv); return (rv); } rv = bus_dmamap_load(sc->sc_dmat, sc->sc_rep_dmamap, sc->sc_rep, sc->sc_rep_size, NULL, BUS_DMA_NOWAIT); if (rv != 0) { - aprint_error_dev(&sc->sc_dv, "DMA load = %d\n", rv); + aprint_error_dev(sc->sc_dev, "DMA load = %d\n", rv); return (rv); } @@ -1093,7 +1093,7 @@ iop_hrt_get(struct iop_softc *sc) if (rv != 0) return (rv); - DPRINTF(("%s: %d hrt entries\n", device_xname(&sc->sc_dv), + DPRINTF(("%s: %d hrt entries\n", device_xname(sc->sc_dev), le16toh(hrthdr.numentries))); size = sizeof(struct i2o_hrt) + @@ -1277,7 +1277,7 @@ iop_field_get_all(struct iop_softc *sc, if (rv != 0) printf("%s: FIELD_GET failed for tid %d group %d\n", - device_xname(&sc->sc_dv), tid, group); + device_xname(sc->sc_dev), tid, group); } if (ii == NULL || rv != 0) { @@ -1328,7 +1328,7 @@ iop_field_set(struct iop_softc *sc, int iop_msg_map(sc, im, mb, pgop, totsize, 1, NULL); rv = iop_msg_post(sc, im, mb, 30000); if (rv != 0) - aprint_error_dev(&sc->sc_dv, "FIELD_SET failed for tid %d group %d\n", + aprint_error_dev(sc->sc_dev, "FIELD_SET failed for tid %d group %d\n", tid, group); iop_msg_unmap(sc, im); @@ -1368,7 +1368,7 @@ iop_table_clear(struct iop_softc *sc, in iop_msg_map(sc, im, mb, &pgop, sizeof(pgop), 1, NULL); rv = iop_msg_post(sc, im, mb, 30000); if (rv != 0) - aprint_error_dev(&sc->sc_dv, "TABLE_CLEAR failed for tid %d group %d\n", + aprint_error_dev(sc->sc_dev, "TABLE_CLEAR failed for tid %d group %d\n", tid, group); iop_msg_unmap(sc, im); @@ -1418,7 +1418,7 @@ iop_table_add_row(struct iop_softc *sc, iop_msg_map(sc, im, mb, pgop, totsize, 1, NULL); rv = iop_msg_post(sc, im, mb, 30000); if (rv != 0) - aprint_error_dev(&sc->sc_dv, "ADD_ROW failed for tid %d group %d row %d\n", + aprint_error_dev(sc->sc_dev, "ADD_ROW failed for tid %d group %d row %d\n", tid, group, row); iop_msg_unmap(sc, im); @@ -1472,7 +1472,7 @@ iop_systab_set(struct iop_softc *sc) mf->msgfunc = I2O_MSGFUNC(I2O_TID_IOP, I2O_EXEC_SYS_TAB_SET); mf->msgictx = IOP_ICTX; mf->msgtctx = im->im_tctx; - mf->iopid = (device_unit(&sc->sc_dv) + 2) << 12; + mf->iopid = (device_unit(sc->sc_dev) + 2) << 12; mf->segnumber = 0; mema[1] = sc->sc_status.desiredprivmemsize; @@ -1483,7 +1483,7 @@ iop_systab_set(struct iop_softc *sc) le32toh(mema[1]), PAGE_SIZE, 0, 0, &boo, &bsh); mema[0] = htole32(boo); if (rv != 0) { - aprint_error_dev(&sc->sc_dv, "can't alloc priv mem space, err = %d\n", rv); + aprint_error_dev(sc->sc_dev, "can't alloc priv mem space, err = %d\n", rv); mema[0] = 0; mema[1] = 0; } @@ -1494,7 +1494,7 @@ iop_systab_set(struct iop_softc *sc) le32toh(ioa[1]), 0, 0, 0, &boo, &bsh); ioa[0] = htole32(boo); if (rv != 0) { - aprint_error_dev(&sc->sc_dv, "can't alloc priv i/o space, err = %d\n", rv); + aprint_error_dev(sc->sc_dev, "can't alloc priv i/o space, err = %d\n", rv); ioa[0] = 0; ioa[1] = 0; } @@ -1545,7 +1545,7 @@ iop_reset(struct iop_softc *sc) (bus_dmamap_sync(sc->sc_dmat, sc->sc_scr_dmamap, 0, sizeof(*sw), BUS_DMASYNC_POSTWRITE | BUS_DMASYNC_POSTREAD), *sw != 0)); if (*sw != htole32(I2O_RESET_IN_PROGRESS)) { - aprint_error_dev(&sc->sc_dv, "reset rejected, status 0x%x\n", + aprint_error_dev(sc->sc_dev, "reset rejected, status 0x%x\n", le32toh(*sw)); return (EIO); } @@ -1556,7 +1556,7 @@ iop_reset(struct iop_softc *sc) */ POLL(10000, (mfa = iop_inl(sc, IOP_REG_IFIFO)) != IOP_MFA_EMPTY); if (mfa == IOP_MFA_EMPTY) { - aprint_error_dev(&sc->sc_dv, "reset failed\n"); + aprint_error_dev(sc->sc_dev, "reset failed\n"); return (EIO); } @@ -1655,7 +1655,7 @@ iop_handle_reply(struct iop_softc *sc, u #ifdef I2ODEBUG iop_reply_print(sc, rb); #endif - aprint_error_dev(&sc->sc_dv, "WARNING: bad ictx returned (%x)\n", + aprint_error_dev(sc->sc_dev, "WARNING: bad ictx returned (%x)\n", ictx); return (-1); } @@ -1689,9 +1689,9 @@ iop_handle_reply(struct iop_softc *sc, u if ((tctx & IOP_TCTX_MASK) > sc->sc_maxib || (im->im_flags & IM_ALLOCED) == 0 || tctx != im->im_tctx) { - aprint_error_dev(&sc->sc_dv, "WARNING: bad tctx returned (0x%08x, %p)\n", tctx, im); + aprint_error_dev(sc->sc_dev, "WARNING: bad tctx returned (0x%08x, %p)\n", tctx, im); if (im != NULL) - aprint_error_dev(&sc->sc_dv, "flags=0x%08x tctx=0x%08x\n", + aprint_error_dev(sc->sc_dev, "flags=0x%08x tctx=0x%08x\n", im->im_flags, im->im_tctx); #ifdef I2ODEBUG if ((rb->msgflags & I2O_MSGFLAGS_FAIL) == 0) @@ -1705,7 +1705,7 @@ iop_handle_reply(struct iop_softc *sc, u #ifdef I2ODEBUG if ((im->im_flags & IM_REPLIED) != 0) - panic("%s: dup reply", device_xname(&sc->sc_dv)); + panic("%s: dup reply", device_xname(sc->sc_dev)); #endif im->im_flags |= IM_REPLIED; @@ -2104,7 +2104,7 @@ iop_post(struct iop_softc *sc, u_int32_t if ((mfa = iop_inl(sc, IOP_REG_IFIFO)) == IOP_MFA_EMPTY) if ((mfa = iop_inl(sc, IOP_REG_IFIFO)) == IOP_MFA_EMPTY) { mutex_spin_exit(&sc->sc_intrlock); - aprint_error_dev(&sc->sc_dv, "mfa not forthcoming\n"); + aprint_error_dev(sc->sc_dev, "mfa not forthcoming\n"); return (EAGAIN); } @@ -2205,7 +2205,7 @@ iop_msg_poll(struct iop_softc *sc, struc if (timo == 0) { #ifdef I2ODEBUG - printf("%s: poll - no reply\n", device_xname(&sc->sc_dv)); + printf("%s: poll - no reply\n", device_xname(sc->sc_dev)); if (iop_status_get(sc, 1) != 0) printf("iop_msg_poll: unable to retrieve status\n"); else @@ -2274,7 +2274,7 @@ iop_reply_print(struct iop_softc *sc, st function = (le32toh(rb->msgfunc) >> 24) & 0xff; detail = le16toh(rb->detail); - printf("%s: reply:\n", device_xname(&sc->sc_dv)); + printf("%s: reply:\n", device_xname(sc->sc_dev)); if (rb->reqstatus < sizeof(iop_status) / sizeof(iop_status[0])) statusstr = iop_status[rb->reqstatus]; @@ -2282,11 +2282,11 @@ iop_reply_print(struct iop_softc *sc, st statusstr = "undefined error code"; printf("%s: function=0x%02x status=0x%02x (%s)\n", - device_xname(&sc->sc_dv), function, rb->reqstatus, statusstr); + device_xname(sc->sc_dev), function, rb->reqstatus, statusstr); printf("%s: detail=0x%04x ictx=0x%08x tctx=0x%08x\n", - device_xname(&sc->sc_dv), detail, le32toh(rb->msgictx), + device_xname(sc->sc_dev), detail, le32toh(rb->msgictx), le32toh(rb->msgtctx)); - printf("%s: tidi=%d tidt=%d flags=0x%02x\n", device_xname(&sc->sc_dv), + printf("%s: tidi=%d tidt=%d flags=0x%02x\n", device_xname(sc->sc_dev), (le32toh(rb->msgfunc) >> 12) & 4095, le32toh(rb->msgfunc) & 4095, (le32toh(rb->msgflags) >> 8) & 0xff); } @@ -2299,14 +2299,14 @@ static void iop_tfn_print(struct iop_softc *sc, struct i2o_fault_notify *fn) { - printf("%s: WARNING: transport failure:\n", device_xname(&sc->sc_dv)); + printf("%s: WARNING: transport failure:\n", device_xname(sc->sc_dev)); - printf("%s: ictx=0x%08x tctx=0x%08x\n", device_xname(&sc->sc_dv), + printf("%s: ictx=0x%08x tctx=0x%08x\n", device_xname(sc->sc_dev), le32toh(fn->msgictx), le32toh(fn->msgtctx)); printf("%s: failurecode=0x%02x severity=0x%02x\n", - device_xname(&sc->sc_dv), fn->failurecode, fn->severity); + device_xname(sc->sc_dev), fn->failurecode, fn->severity); printf("%s: highestver=0x%02x lowestver=0x%02x\n", - device_xname(&sc->sc_dv), fn->highestver, fn->lowestver); + device_xname(sc->sc_dev), fn->highestver, fn->lowestver); } /* @@ -2509,7 +2509,7 @@ iopioctl(dev_t dev, u_long cmd, void *da default: #if defined(DIAGNOSTIC) || defined(I2ODEBUG) - printf("%s: unknown ioctl %lx\n", device_xname(&sc->sc_dv), cmd); + printf("%s: unknown ioctl %lx\n", device_xname(sc->sc_dev), cmd); #endif return (ENOTTY); } Index: sys/dev/i2o/iopsp.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/i2o/iopsp.c,v retrieving revision 1.35 diff -u -p -r1.35 iopsp.c --- sys/dev/i2o/iopsp.c 12 May 2009 14:23:47 -0000 1.35 +++ sys/dev/i2o/iopsp.c 29 Sep 2012 12:40:17 -0000 @@ -73,7 +73,7 @@ static int iopsp_reconfig(device_t); static void iopsp_scsipi_request(struct scsipi_channel *, scsipi_adapter_req_t, void *); -CFATTACH_DECL(iopsp, sizeof(struct iopsp_softc), +CFATTACH_DECL_NEW(iopsp, sizeof(struct iopsp_softc), iopsp_match, iopsp_attach, NULL, NULL); /* @@ -156,7 +156,7 @@ iopsp_attach(device_t parent, device_t s if (rv != 0) goto bad; - aprint_normal_dev(&sc->sc_dv, ""); + aprint_normal_dev(sc->sc_dev, ""); if (fc) aprint_normal("FC"); else @@ -167,7 +167,7 @@ iopsp_attach(device_t parent, device_t s sc->sc_openings = 1; - sc->sc_adapter.adapt_dev = &sc->sc_dv; + sc->sc_adapter.adapt_dev = sc->sc_dev; sc->sc_adapter.adapt_nchannels = 1; sc->sc_adapter.adapt_openings = 1; sc->sc_adapter.adapt_max_periph = 1; @@ -194,7 +194,7 @@ iopsp_attach(device_t parent, device_t s /* Build the two maps, and attach to scsipi. */ if (iopsp_reconfig(self) != 0) { - aprint_error_dev(&sc->sc_dv, "configure failed\n"); + aprint_error_dev(sc->sc_dev, "configure failed\n"); goto bad; } config_found(self, &sc->sc_channel, scsiprint); @@ -226,8 +226,8 @@ iopsp_reconfig(device_t dv) struct iopsp_target *it; int syncrate; - sc = (struct iopsp_softc *)dv; - iop = (struct iop_softc *)device_parent(&sc->sc_dv); + sc = device_private(dv); + iop = device_private(device_parent(sc->sc_dev)); sc_chan = &sc->sc_channel; KASSERT(mutex_owned(&iop->sc_conflock)); @@ -278,7 +278,7 @@ iopsp_reconfig(device_t dv) #if defined(DIAGNOSTIC) || defined(I2ODEBUG) if (targ >= sc_chan->chan_ntargets || lun >= sc_chan->chan_nluns) { - aprint_error_dev(&sc->sc_dv, "target %d,%d (tid %d): " + aprint_error_dev(sc->sc_dev, "target %d,%d (tid %d): " "bad target/LUN\n", targ, lun, tid); continue; } @@ -298,7 +298,7 @@ iopsp_reconfig(device_t dv) it->it_offset = param.sdi.negoffset; it->it_syncrate = syncrate; - aprint_verbose_dev(&sc->sc_dv, "target %d (tid %d): %d-bit, ", + aprint_verbose_dev(sc->sc_dev, "target %d (tid %d): %d-bit, ", targ, tid, it->it_width); if (it->it_syncrate == 0) aprint_verbose("asynchronous\n"); @@ -313,7 +313,7 @@ iopsp_reconfig(device_t dv) if (sc->sc_tidmap == NULL || IOPSP_TIDMAP(sc->sc_tidmap, targ, lun) != IOPSP_TID_INUSE) { - aprint_verbose_dev(&sc->sc_dv, "target %d,%d (tid %d): " + aprint_verbose_dev(sc->sc_dev, "target %d,%d (tid %d): " "in use by tid %d\n", targ, lun, tid, le32toh(le->usertid) & 4095); @@ -350,7 +350,7 @@ iopsp_rescan(struct iopsp_softc *sc) struct i2o_hba_bus_scan mf; int rv; - iop = (struct iop_softc *)device_parent(&sc->sc_dv); + iop = device_private(device_parent(sc->sc_dev)); mutex_enter(&iop->sc_conflock); im = iop_msg_alloc(iop, IM_WAIT); @@ -363,11 +363,11 @@ iopsp_rescan(struct iopsp_softc *sc) rv = iop_msg_post(iop, im, &mf, 5*60*1000); iop_msg_free(iop, im); if (rv != 0) - aprint_error_dev(&sc->sc_dv, "bus rescan failed (error %d)\n", + aprint_error_dev(sc->sc_dev, "bus rescan failed (error %d)\n", rv); if ((rv = iop_lct_get(iop)) == 0) - rv = iopsp_reconfig(&sc->sc_dv); + rv = iopsp_reconfig(sc->sc_dev); mutex_exit(&iop->sc_conflock); return (rv); @@ -389,8 +389,8 @@ iopsp_scsipi_request(struct scsipi_chann int error, flags, tid; u_int32_t mb[IOP_MAX_MSG_SIZE / sizeof(u_int32_t)]; - sc = (void *)chan->chan_adapter->adapt_dev; - iop = (struct iop_softc *)device_parent(&sc->sc_dv); + sc = device_private(chan->chan_adapter->adapt_dev); + iop = device_private(device_parent(sc->sc_dev)); switch (req) { case ADAPTER_REQ_RUN_XFER: @@ -412,7 +412,7 @@ iopsp_scsipi_request(struct scsipi_chann if ((flags & XS_CTL_RESET) != 0) { if (iop_simple_cmd(iop, tid, I2O_SCSI_DEVICE_RESET, sc->sc_ii.ii_ictx, 1, 30*1000) != 0) { - aprint_error_dev(&sc->sc_dv, "reset failed\n"); + aprint_error_dev(sc->sc_dev, "reset failed\n"); xs->error = XS_DRIVER_STUFFUP; } else xs->error = XS_NOERROR; @@ -423,7 +423,7 @@ iopsp_scsipi_request(struct scsipi_chann #if defined(I2ODEBUG) || defined(SCSIDEBUG) if (xs->cmdlen > sizeof(mf->cdb)) - panic("%s: CDB too large", device_xname(&sc->sc_dv)); + panic("%s: CDB too large", device_xname(sc->sc_dev)); #endif im = iop_msg_alloc(iop, IM_POLL_INTR | @@ -505,7 +505,7 @@ iopsp_scsi_abort(struct iopsp_softc *sc, struct iop_softc *iop; int rv, s; - iop = (struct iop_softc *)device_parent(&sc->sc_dv); + iop = device_private(device_parent(sc->sc_dev)); im = iop_msg_alloc(iop, IM_POLL); mf.msgflags = I2O_MSGFLAGS(i2o_scsi_scb_abort); @@ -534,9 +534,9 @@ iopsp_intr(device_t dv, struct iop_msg * struct iop_softc *iop; u_int sl; - sc = (struct iopsp_softc *)dv; - xs = (struct scsipi_xfer *)im->im_dvcontext; - iop = (struct iop_softc *)device_parent(dv); + sc = device_private(dv); + xs = im->im_dvcontext; + iop = device_private(device_parent(dv)); rb = reply; SC_DEBUG(xs->xs_periph, SCSIPI_DB2, ("iopsp_intr\n")); @@ -565,7 +565,7 @@ iopsp_intr(device_t dv, struct iop_msg * xs->error = XS_DRIVER_STUFFUP; break; } - aprint_error_dev(&sc->sc_dv, "HBA status 0x%02x\n", + aprint_error_dev(sc->sc_dev, "HBA status 0x%02x\n", rb->hbastatus); } else if (rb->scsistatus != SCSI_OK) { switch (rb->scsistatus) { @@ -617,7 +617,7 @@ iopsp_ioctl(struct scsipi_channel *chan, */ if (curlwp != &lwp0) rv = iopsp_rescan( - (struct iopsp_softc *)chan->chan_adapter->adapt_dev); + device_private(chan->chan_adapter->adapt_dev)); else rv = 0; break; Index: sys/dev/i2o/iopspvar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/i2o/iopspvar.h,v retrieving revision 1.8 diff -u -p -r1.8 iopspvar.h --- sys/dev/i2o/iopspvar.h 28 Apr 2008 20:23:48 -0000 1.8 +++ sys/dev/i2o/iopspvar.h 28 Sep 2012 20:55:31 -0000 @@ -49,7 +49,7 @@ struct iopsp_target { #define IT_PRESENT 0x01 /* Target is present */ struct iopsp_softc { - struct device sc_dv; /* Generic device data */ + device_t sc_dev; /* Generic device data */ struct scsipi_adapter sc_adapter; /* scsipi adapter */ struct scsipi_channel sc_channel; /* Prototype link */ struct iop_initiator sc_ii; /* I2O initiator state */ Index: sys/dev/i2o/iopvar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/i2o/iopvar.h,v retrieving revision 1.23 diff -u -p -r1.23 iopvar.h --- sys/dev/i2o/iopvar.h 12 May 2009 14:23:47 -0000 1.23 +++ sys/dev/i2o/iopvar.h 2 Oct 2012 02:19:45 -0000 @@ -80,7 +80,7 @@ struct iop_initiator { int (*ii_reconfig)(device_t); void (*ii_adjqparam)(device_t, int); - struct device *ii_dv; + device_t ii_dv; kcondvar_t ii_cv; int ii_flags; int ii_ictx; /* Initiator context */ @@ -105,7 +105,7 @@ struct iop_pgop { * Per-IOP context. */ struct iop_softc { - struct device sc_dv; /* Generic device data */ + device_t sc_dev; /* Generic device data */ bus_space_handle_t sc_ioh; /* Bus space handle */ bus_space_tag_t sc_iot; /* Bus space tag */ bus_dma_tag_t sc_dmat; /* Bus DMA tag */ Index: sys/dev/ic/aac.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/ic/aac.c,v retrieving revision 1.43 diff -u -p -r1.43 aac.c --- sys/dev/ic/aac.c 13 Nov 2010 13:51:59 -0000 1.43 +++ sys/dev/ic/aac.c 26 Sep 2012 23:15:10 -0000 @@ -192,7 +192,7 @@ aac_attach(struct aac_softc *sc) locs[AACCF_UNIT] = i; - config_found_sm_loc(&sc->sc_dv, "aac", locs, &aaca, + config_found_sm_loc(sc->sc_dv, "aac", locs, &aaca, aac_print, config_stdsubmatch); } @@ -229,7 +229,7 @@ aac_alloc_commands(struct aac_softc *sc) error = bus_dmamap_create(sc->sc_dmat, size, 1, size, 0, BUS_DMA_NOWAIT | BUS_DMA_ALLOCNOW, &fm->fm_fibmap); if (error != 0) { - aprint_error_dev(&sc->sc_dv, "cannot create fibs dmamap (%d)\n", + aprint_error_dev(sc->sc_dv, "cannot create fibs dmamap (%d)\n", error); goto bail_out; } @@ -237,7 +237,7 @@ aac_alloc_commands(struct aac_softc *sc) error = bus_dmamem_alloc(sc->sc_dmat, size, PAGE_SIZE, 0, &fm->fm_fibseg, 1, &nsegs, BUS_DMA_NOWAIT); if (error != 0) { - aprint_error_dev(&sc->sc_dv, "can't allocate fibs structure (%d)\n", + aprint_error_dev(sc->sc_dv, "can't allocate fibs structure (%d)\n", error); goto bail_out; } @@ -245,7 +245,7 @@ aac_alloc_commands(struct aac_softc *sc) error = bus_dmamem_map(sc->sc_dmat, &fm->fm_fibseg, nsegs, size, (void **)&fm->fm_fibs, 0); if (error != 0) { - aprint_error_dev(&sc->sc_dv, "can't map fibs structure (%d)\n", + aprint_error_dev(sc->sc_dv, "can't map fibs structure (%d)\n", error); goto bail_out; } @@ -253,7 +253,7 @@ aac_alloc_commands(struct aac_softc *sc) error = bus_dmamap_load(sc->sc_dmat, fm->fm_fibmap, fm->fm_fibs, size, NULL, BUS_DMA_NOWAIT); if (error != 0) { - aprint_error_dev(&sc->sc_dv, "cannot load fibs dmamap (%d)\n", + aprint_error_dev(sc->sc_dv, "cannot load fibs dmamap (%d)\n", error); goto bail_out; } @@ -275,7 +275,7 @@ aac_alloc_commands(struct aac_softc *sc) ac->ac_dmamap_xfer); sc->sc_total_fibs--; } - aprint_error_dev(&sc->sc_dv, "cannot create ccb dmamap (%d)", + aprint_error_dev(sc->sc_dv, "cannot create ccb dmamap (%d)", error); goto bail_out; } @@ -365,18 +365,18 @@ aac_describe_controller(struct aac_softc arg = 0; if (aac_sync_fib(sc, RequestAdapterInfo, 0, &arg, sizeof(arg), &tbuf, &bufsize)) { - aprint_error_dev(&sc->sc_dv, "RequestAdapterInfo failed\n"); + aprint_error_dev(sc->sc_dv, "RequestAdapterInfo failed\n"); return; } if (bufsize != sizeof(*info)) { - aprint_error_dev(&sc->sc_dv, + aprint_error_dev(sc->sc_dv, "RequestAdapterInfo returned wrong data size (%d != %zu)\n", bufsize, sizeof(*info)); return; } info = (struct aac_adapter_info *)&tbuf[0]; - aprint_normal_dev(&sc->sc_dv, "%s at %dMHz, %dMB mem (%dMB cache), %s\n", + aprint_normal_dev(sc->sc_dv, "%s at %dMHz, %dMB mem (%dMB cache), %s\n", aac_describe_code(aac_cpu_variant, le32toh(info->CpuVariant)), le32toh(info->ClockSpeed), le32toh(info->TotalMem) / (1024 * 1024), @@ -384,7 +384,7 @@ aac_describe_controller(struct aac_softc aac_describe_code(aac_battery_platform, le32toh(info->batteryPlatform))); - aprint_verbose_dev(&sc->sc_dv, "Kernel %d.%d-%d [Build %d], ", + aprint_verbose_dev(sc->sc_dv, "Kernel %d.%d-%d [Build %d], ", info->KernelRevision.external.comp.major, info->KernelRevision.external.comp.minor, info->KernelRevision.external.comp.dash, @@ -398,7 +398,7 @@ aac_describe_controller(struct aac_softc ((u_int32_t)info->SerialNumber & 0xffffff)); snprintb(fmtbuf, sizeof(fmtbuf), optfmt, sc->sc_supported_options); - aprint_verbose_dev(&sc->sc_dv, "Controller supports: %s\n", fmtbuf); + aprint_verbose_dev(sc->sc_dv, "Controller supports: %s\n", fmtbuf); /* Save the kernel revision structure for later use. */ sc->sc_revision = info->KernelRevision; @@ -417,7 +417,7 @@ aac_check_firmware(struct aac_softc *sc) if ((sc->sc_quirks & AAC_QUIRK_PERC2QC) != 0) { if (aac_sync_command(sc, AAC_MONKER_GETKERNVER, 0, 0, 0, 0, NULL)) { - aprint_error_dev(&sc->sc_dv, "error reading firmware version\n"); + aprint_error_dev(sc->sc_dv, "error reading firmware version\n"); return (1); } @@ -425,7 +425,7 @@ aac_check_firmware(struct aac_softc *sc) major = (AAC_GET_MAILBOX(sc, 1) & 0xff) - 0x30; minor = (AAC_GET_MAILBOX(sc, 2) & 0xff) - 0x30; if (major == 1) { - aprint_error_dev(&sc->sc_dv, + aprint_error_dev(sc->sc_dv, "firmware version %d.%d not supported.\n", major, minor); return (1); @@ -434,7 +434,7 @@ aac_check_firmware(struct aac_softc *sc) if (aac_sync_command(sc, AAC_MONKER_GETINFO, 0, 0, 0, 0, &status)) { if (status != AAC_SRB_STS_INVALID_REQUEST) { - aprint_error_dev(&sc->sc_dv, "GETINFO failed, status 0x%08x\n", status); + aprint_error_dev(sc->sc_dv, "GETINFO failed, status 0x%08x\n", status); return (1); } } else { @@ -448,7 +448,7 @@ aac_check_firmware(struct aac_softc *sc) if (((opts & AAC_SUPPORTED_SGMAP_HOST64) != 0) && (sizeof(bus_addr_t) > 4)) { - aprint_normal_dev(&sc->sc_dv, "Enabling 64-bit address support\n"); + aprint_normal_dev(sc->sc_dv, "Enabling 64-bit address support\n"); sc->sc_quirks |= AAC_QUIRK_SG_64BIT; } if ((opts & AAC_SUPPORTED_NEW_COMM) && @@ -463,7 +463,7 @@ aac_check_firmware(struct aac_softc *sc) if ( (sc->sc_quirks & AAC_QUIRK_NEW_COMM) && (sc->sc_regsize < atusize)) { - aprint_error_dev(&sc->sc_dv, "Not enabling new comm i/f -- " + aprint_error_dev(sc->sc_dv, "Not enabling new comm i/f -- " "atusize 0x%08x, regsize 0x%08x\n", atusize, (uint32_t) sc->sc_regsize); @@ -471,7 +471,7 @@ aac_check_firmware(struct aac_softc *sc) } #if 0 if (sc->sc_quirks & AAC_QUIRK_NEW_COMM) { - aprint_error_dev(&sc->sc_dv, "Not enabling new comm i/f -- " + aprint_error_dev(sc->sc_dv, "Not enabling new comm i/f -- " "driver not ready yet\n"); sc->sc_quirks &= ~AAC_QUIRK_NEW_COMM; } @@ -498,7 +498,7 @@ aac_check_firmware(struct aac_softc *sc) opt2 = AAC_GET_MAILBOX(sc, 2); opt3 = AAC_GET_MAILBOX(sc, 3); if (!opt1 || !opt2 || !opt3) { - aprint_verbose_dev(&sc->sc_dv, "GETCOMMPREF appears untrustworthy." + aprint_verbose_dev(sc->sc_dv, "GETCOMMPREF appears untrustworthy." " Ignoring.\n"); } else { sc->sc_max_fib_size = le32toh(opt1) & 0xffff; @@ -535,12 +535,12 @@ aac_check_firmware(struct aac_softc *sc) if (sc->sc_max_fib_size > sizeof(struct aac_fib)) { sc->sc_quirks |= AAC_QUIRK_RAW_IO; - aprint_debug_dev(&sc->sc_dv, "Enable raw I/O\n"); + aprint_debug_dev(sc->sc_dv, "Enable raw I/O\n"); } if ((sc->sc_quirks & AAC_QUIRK_RAW_IO) && (sc->sc_quirks & AAC_QUIRK_ARRAY_64BIT)) { sc->sc_quirks |= AAC_QUIRK_LBA_64BIT; - aprint_normal_dev(&sc->sc_dv, "Enable 64-bit array support\n"); + aprint_normal_dev(sc->sc_dv, "Enable 64-bit array support\n"); } return (0); @@ -561,11 +561,11 @@ aac_init(struct aac_softc *sc) for (i = 0; i < AAC_BOOT_TIMEOUT * 1000; i++) { code = AAC_GET_FWSTATUS(sc); if ((code & AAC_SELF_TEST_FAILED) != 0) { - aprint_error_dev(&sc->sc_dv, "FATAL: selftest failed\n"); + aprint_error_dev(sc->sc_dv, "FATAL: selftest failed\n"); return (ENXIO); } if ((code & AAC_KERNEL_PANIC) != 0) { - aprint_error_dev(&sc->sc_dv, "FATAL: controller kernel panic\n"); + aprint_error_dev(sc->sc_dv, "FATAL: controller kernel panic\n"); return (ENXIO); } if ((code & AAC_UP_AND_RUNNING) != 0) @@ -573,7 +573,7 @@ aac_init(struct aac_softc *sc) DELAY(1000); } if (i == AAC_BOOT_TIMEOUT * 1000) { - aprint_error_dev(&sc->sc_dv, + aprint_error_dev(sc->sc_dv, "FATAL: controller not coming ready, status %x\n", code); return (ENXIO); @@ -582,33 +582,33 @@ aac_init(struct aac_softc *sc) sc->sc_aif_fib = malloc(sizeof(struct aac_fib), M_AACBUF, M_NOWAIT | M_ZERO); if (sc->sc_aif_fib == NULL) { - aprint_error_dev(&sc->sc_dv, "cannot alloc fib structure\n"); + aprint_error_dev(sc->sc_dv, "cannot alloc fib structure\n"); return (ENOMEM); } if ((rv = bus_dmamap_create(sc->sc_dmat, sizeof(*sc->sc_common), 1, sizeof(*sc->sc_common), 0, BUS_DMA_NOWAIT | BUS_DMA_ALLOCNOW, &sc->sc_common_dmamap)) != 0) { - aprint_error_dev(&sc->sc_dv, "cannot create common dmamap\n"); + aprint_error_dev(sc->sc_dv, "cannot create common dmamap\n"); goto bail_out; } state++; if ((rv = bus_dmamem_alloc(sc->sc_dmat, sizeof(*sc->sc_common), PAGE_SIZE, 0, &sc->sc_common_seg, 1, &nsegs, BUS_DMA_NOWAIT)) != 0) { - aprint_error_dev(&sc->sc_dv, "can't allocate common structure\n"); + aprint_error_dev(sc->sc_dv, "can't allocate common structure\n"); goto bail_out; } state++; if ((rv = bus_dmamem_map(sc->sc_dmat, &sc->sc_common_seg, nsegs, sizeof(*sc->sc_common), (void **)&sc->sc_common, 0)) != 0) { - aprint_error_dev(&sc->sc_dv, "can't map common structure\n"); + aprint_error_dev(sc->sc_dv, "can't map common structure\n"); goto bail_out; } state++; if ((rv = bus_dmamap_load(sc->sc_dmat, sc->sc_common_dmamap, sc->sc_common, sizeof(*sc->sc_common), NULL, BUS_DMA_NOWAIT)) != 0) { - aprint_error_dev(&sc->sc_dv, "cannot load common dmamap\n"); + aprint_error_dev(sc->sc_dv, "cannot load common dmamap\n"); goto bail_out; } state++; @@ -619,7 +619,7 @@ aac_init(struct aac_softc *sc) sc->sc_ccbs = malloc(sizeof(struct aac_ccb) * sc->sc_max_fibs, M_AACBUF, M_NOWAIT | M_ZERO); if (sc->sc_ccbs == NULL) { - aprint_error_dev(&sc->sc_dv, "memory allocation failure getting ccbs\n"); + aprint_error_dev(sc->sc_dv, "memory allocation failure getting ccbs\n"); rv = ENOMEM; goto bail_out; } @@ -668,7 +668,7 @@ aac_init(struct aac_softc *sc) ip->InitFlags = 0; if (sc->sc_quirks & AAC_QUIRK_NEW_COMM) { ip->InitFlags = htole32(AAC_INITFLAGS_NEW_COMM_SUPPORTED); - aprint_normal_dev(&sc->sc_dv, "New comm. interface enabled\n"); + aprint_normal_dev(sc->sc_dv, "New comm. interface enabled\n"); } ip->MaxIoCommands = htole32(sc->sc_max_fibs); @@ -780,7 +780,7 @@ aac_init(struct aac_softc *sc) if (aac_sync_command(sc, AAC_MONKER_INITSTRUCT, sc->sc_common_seg.ds_addr + offsetof(struct aac_common, ac_init), 0, 0, 0, NULL)) { - aprint_error_dev(&sc->sc_dv, "error establishing init structure\n"); + aprint_error_dev(sc->sc_dv, "error establishing init structure\n"); rv = EIO; goto bail_out; } @@ -840,11 +840,11 @@ aac_startup(struct aac_softc *sc) mi.MntCount = htole32(i); if (aac_sync_fib(sc, ContainerCommand, 0, &mi, sizeof(mi), &mir, &rsize)) { - aprint_error_dev(&sc->sc_dv, "error probing container %d\n", i); + aprint_error_dev(sc->sc_dv, "error probing container %d\n", i); continue; } if (rsize != ersize) { - aprint_error_dev(&sc->sc_dv, "container info response wrong size " + aprint_error_dev(sc->sc_dv, "container info response wrong size " "(%d should be %zu)\n", rsize, ersize); continue; } @@ -894,7 +894,7 @@ aac_shutdown(void *cookie) cc.ContainerId = 0xffffffff; if (aac_sync_fib(sc, ContainerCommand, 0, &cc, sizeof(cc), NULL, NULL)) { - aprint_error_dev(&sc->sc_dv, "unable to halt controller\n"); + aprint_error_dev(sc->sc_dv, "unable to halt controller\n"); continue; } @@ -905,7 +905,7 @@ aac_shutdown(void *cookie) */ if (aac_sync_fib(sc, FsaHostShutdown, AAC_FIBSTATE_SHUTDOWN, &i, sizeof(i), NULL, NULL)) - aprint_error_dev(&sc->sc_dv, "unable to halt controller\n"); + aprint_error_dev(sc->sc_dv, "unable to halt controller\n"); sc->sc_flags &= ~AAC_ONLINE; } @@ -1010,8 +1010,8 @@ aac_intr(void *cookie) if (sc->sc_common->ac_printf[0] == '\0') sc->sc_common->ac_printf[0] = ' '; printf("%s: WARNING: adapter logged message:\n", - device_xname(&sc->sc_dv)); - printf("%s: %.*s", device_xname(&sc->sc_dv), + device_xname(sc->sc_dv)); + printf("%s: %.*s", device_xname(sc->sc_dv), AAC_PRINTF_BUFSIZE, sc->sc_common->ac_printf); sc->sc_common->ac_printf[0] = '\0'; AAC_QNOTIFY(sc, AAC_DB_PRINTF); @@ -1076,7 +1076,7 @@ aac_host_command(struct aac_softc *sc) AAC_PRINT_FIB(sc, fib); break; default: - aprint_error_dev(&sc->sc_dv, "unknown command from controller\n"); + aprint_error_dev(sc->sc_dv, "unknown command from controller\n"); AAC_PRINT_FIB(sc, fib); break; } @@ -1262,7 +1262,7 @@ aac_sync_fib(struct aac_softc *sc, u_int return (EIO); if (status != 1) { printf("%s: syncfib command %04x status %08x\n", - device_xname(&sc->sc_dv), command, status); + device_xname(sc->sc_dv), command, status); } bus_dmamap_sync(sc->sc_dmat, sc->sc_common_dmamap, @@ -1354,7 +1354,7 @@ aac_ccb_map(struct aac_softc *sc, struct ac->ac_datalen, NULL, BUS_DMA_NOWAIT | BUS_DMA_STREAMING | ((ac->ac_flags & AAC_CCB_DATA_IN) ? BUS_DMA_READ : BUS_DMA_WRITE)); if (error) { - printf("%s: aac_ccb_map: ", device_xname(&sc->sc_dv)); + printf("%s: aac_ccb_map: ", device_xname(sc->sc_dv)); if (error == EFBIG) printf("more than %d DMA segs\n", sc->sc_max_sgs); else Index: sys/dev/ic/aacvar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/ic/aacvar.h,v retrieving revision 1.13 diff -u -p -r1.13 aacvar.h --- sys/dev/ic/aacvar.h 2 Oct 2008 08:21:57 -0000 1.13 +++ sys/dev/ic/aacvar.h 26 Sep 2012 23:14:06 -0000 @@ -274,7 +274,7 @@ struct aac_ccb { u_int ac_flags; void (*ac_intr)(struct aac_ccb *); - struct device *ac_device; + device_t ac_device; void *ac_context; }; #define AAC_CCB_MAPPED 0x01 @@ -292,7 +292,7 @@ struct aac_drive { * Per-controller structure. */ struct aac_softc { - struct device sc_dv; + device_t sc_dv; void *sc_ih; bus_space_tag_t sc_memt; bus_space_handle_t sc_memh; Index: sys/dev/ic/ac97.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/ic/ac97.c,v retrieving revision 1.94 diff -u -p -r1.94 ac97.c --- sys/dev/ic/ac97.c 2 Jun 2012 21:36:44 -0000 1.94 +++ sys/dev/ic/ac97.c 29 Sep 2012 12:41:28 -0000 @@ -994,14 +994,14 @@ ac97_setup_defaults(struct ac97_softc *a } static void -ac97_restore_shadow(struct ac97_codec_if *self) +ac97_restore_shadow(struct ac97_codec_if *codec_if) { struct ac97_softc *as; const struct ac97_source_info *si; int idx; uint16_t val; - as = (struct ac97_softc *) self; + as = (struct ac97_softc *)codec_if; KASSERT(mutex_owned(as->lock)); Index: sys/dev/ic/adv.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/ic/adv.c,v retrieving revision 1.45 diff -u -p -r1.45 adv.c --- sys/dev/ic/adv.c 13 Nov 2010 13:52:00 -0000 1.45 +++ sys/dev/ic/adv.c 26 Sep 2012 18:37:43 -0000 @@ -113,7 +113,7 @@ adv_alloc_control_data(ASC_SOFTC *sc) if ((error = bus_dmamem_alloc(sc->sc_dmat, sizeof(struct adv_control), PAGE_SIZE, 0, &sc->sc_control_seg, 1, &sc->sc_control_nsegs, BUS_DMA_NOWAIT)) != 0) { - aprint_error_dev(&sc->sc_dev, "unable to allocate control structures," + aprint_error_dev(sc->sc_dev, "unable to allocate control structures," " error = %d\n", error); return (error); } @@ -121,7 +121,7 @@ adv_alloc_control_data(ASC_SOFTC *sc) sc->sc_control_nsegs, sizeof(struct adv_control), (void **) & sc->sc_control, BUS_DMA_NOWAIT | BUS_DMA_COHERENT)) != 0) { - aprint_error_dev(&sc->sc_dev, "unable to map control structures, error = %d\n", + aprint_error_dev(sc->sc_dev, "unable to map control structures, error = %d\n", error); return (error); } @@ -131,14 +131,14 @@ adv_alloc_control_data(ASC_SOFTC *sc) if ((error = bus_dmamap_create(sc->sc_dmat, sizeof(struct adv_control), 1, sizeof(struct adv_control), 0, BUS_DMA_NOWAIT, &sc->sc_dmamap_control)) != 0) { - aprint_error_dev(&sc->sc_dev, "unable to create control DMA map, error = %d\n", + aprint_error_dev(sc->sc_dev, "unable to create control DMA map, error = %d\n", error); return (error); } if ((error = bus_dmamap_load(sc->sc_dmat, sc->sc_dmamap_control, sc->sc_control, sizeof(struct adv_control), NULL, BUS_DMA_NOWAIT)) != 0) { - aprint_error_dev(&sc->sc_dev, "unable to load control DMA map, error = %d\n", + aprint_error_dev(sc->sc_dev, "unable to load control DMA map, error = %d\n", error); return (error); } @@ -180,7 +180,7 @@ adv_create_ccbs(ASC_SOFTC *sc, ADV_CCB * for (i = 0; i < count; i++) { ccb = &ccbstore[i]; if ((error = adv_init_ccb(sc, ccb)) != 0) { - aprint_error_dev(&sc->sc_dev, "unable to initialize ccb, error = %d\n", + aprint_error_dev(sc->sc_dev, "unable to initialize ccb, error = %d\n", error); return (i); } @@ -229,7 +229,7 @@ adv_init_ccb(ASC_SOFTC *sc, ADV_CCB *ccb ASC_MAX_SG_LIST, (ASC_MAX_SG_LIST - 1) * PAGE_SIZE, 0, BUS_DMA_NOWAIT | BUS_DMA_ALLOCNOW, &ccb->dmamap_xfer); if (error) { - aprint_error_dev(&sc->sc_dev, "unable to create DMA map, error = %d\n", + aprint_error_dev(sc->sc_dev, "unable to create DMA map, error = %d\n", error); return (error); } @@ -348,7 +348,7 @@ adv_init(ASC_SOFTC *sc) AscInitASC_SOFTC(sc); warn = AscInitFromEEP(sc); if (warn) { - aprint_error_dev(&sc->sc_dev, "-get: "); + aprint_error_dev(sc->sc_dev, "-get: "); switch (warn) { case -1: aprint_normal("Chip is not halted\n"); @@ -391,7 +391,7 @@ adv_init(ASC_SOFTC *sc) */ warn = AscInitFromASC_SOFTC(sc); if (warn) { - aprint_error_dev(&sc->sc_dev, "-set: "); + aprint_error_dev(sc->sc_dev, "-set: "); switch (warn) { case ASC_WARN_CMD_QNG_CONFLICT: aprint_normal("tag queuing enabled w/o disconnects\n"); @@ -427,29 +427,29 @@ adv_attach(ASC_SOFTC *sc) break; case 1: - panic("%s: bad signature", device_xname(&sc->sc_dev)); + panic("%s: bad signature", device_xname(sc->sc_dev)); break; case 2: panic("%s: unable to load MicroCode", - device_xname(&sc->sc_dev)); + device_xname(sc->sc_dev)); break; case 3: panic("%s: unable to initialize MicroCode", - device_xname(&sc->sc_dev)); + device_xname(sc->sc_dev)); break; default: panic("%s: unable to initialize board RISC chip", - device_xname(&sc->sc_dev)); + device_xname(sc->sc_dev)); } /* * Fill in the scsipi_adapter. */ memset(adapt, 0, sizeof(*adapt)); - adapt->adapt_dev = &sc->sc_dev; + adapt->adapt_dev = sc->sc_dev; adapt->adapt_nchannels = 1; /* adapt_openings initialized below */ /* adapt_max_periph initialized below */ @@ -482,10 +482,10 @@ adv_attach(ASC_SOFTC *sc) */ i = adv_create_ccbs(sc, sc->sc_control->ccbs, ADV_MAX_CCB); if (i == 0) { - aprint_error_dev(&sc->sc_dev, "unable to create control blocks\n"); + aprint_error_dev(sc->sc_dev, "unable to create control blocks\n"); return; /* (ENOMEM) */ ; } else if (i != ADV_MAX_CCB) { - aprint_error_dev(&sc->sc_dev, + aprint_error_dev(sc->sc_dev, "WARNING: only %d of %d control blocks created\n", i, ADV_MAX_CCB); } @@ -493,7 +493,7 @@ adv_attach(ASC_SOFTC *sc) adapt->adapt_openings = i; adapt->adapt_max_periph = adapt->adapt_openings; - sc->sc_child = config_found(&sc->sc_dev, chan, scsiprint); + sc->sc_child = config_found(sc->sc_dev, chan, scsiprint); } int @@ -529,7 +529,7 @@ adv_scsipi_request(struct scsipi_channel { struct scsipi_xfer *xs; struct scsipi_periph *periph; - ASC_SOFTC *sc = (void *)chan->chan_adapter->adapt_dev; + ASC_SOFTC *sc = device_private(chan->chan_adapter->adapt_dev); bus_dma_tag_t dmat = sc->sc_dmat; ADV_CCB *ccb; int s, flags, error, nsegs; @@ -634,11 +634,11 @@ adv_scsipi_request(struct scsipi_channel default: xs->error = XS_DRIVER_STUFFUP; if (error == EFBIG) { - aprint_error_dev(&sc->sc_dev, "adv_scsi_cmd, more than %d" + aprint_error_dev(sc->sc_dev, "adv_scsi_cmd, more than %d" " DMA segments\n", ASC_MAX_SG_LIST); } else { - aprint_error_dev(&sc->sc_dev, "adv_scsi_cmd, error %d" + aprint_error_dev(sc->sc_dev, "adv_scsi_cmd, error %d" " loading DMA map\n", error); } @@ -787,7 +787,7 @@ adv_timeout(void *arg) struct scsipi_xfer *xs = ccb->xs; struct scsipi_periph *periph = xs->xs_periph; ASC_SOFTC *sc = - (void *)periph->periph_channel->chan_adapter->adapt_dev; + device_private(periph->periph_channel->chan_adapter->adapt_dev); int s; scsipi_printaddr(periph); @@ -828,7 +828,7 @@ adv_watchdog(void *arg) struct scsipi_xfer *xs = ccb->xs; struct scsipi_periph *periph = xs->xs_periph; ASC_SOFTC *sc = - (void *)periph->periph_channel->chan_adapter->adapt_dev; + device_private(periph->periph_channel->chan_adapter->adapt_dev); int s; s = splbio(); @@ -882,7 +882,7 @@ adv_narrow_isr_callback(ASC_SOFTC *sc, A bus_dmamap_unload(dmat, ccb->dmamap_xfer); } if ((ccb->flags & CCB_ALLOC) == 0) { - aprint_error_dev(&sc->sc_dev, "exiting ccb not allocated!\n"); + aprint_error_dev(sc->sc_dev, "exiting ccb not allocated!\n"); Debugger(); return; } Index: sys/dev/ic/advlib.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/ic/advlib.h,v retrieving revision 1.18 diff -u -p -r1.18 advlib.h --- sys/dev/ic/advlib.h 24 Aug 2012 09:01:22 -0000 1.18 +++ sys/dev/ic/advlib.h 26 Sep 2012 18:37:43 -0000 @@ -837,9 +837,9 @@ typedef int (* ASC_CALLBACK) (int); typedef struct asc_softc { - struct device sc_dev; + device_t sc_dev; - struct device *sc_child; + device_t sc_child; bus_space_tag_t sc_iot; bus_space_handle_t sc_ioh; Index: sys/dev/ic/adw.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/ic/adw.c,v retrieving revision 1.51 diff -u -p -r1.51 adw.c --- sys/dev/ic/adw.c 13 Nov 2010 13:52:00 -0000 1.51 +++ sys/dev/ic/adw.c 26 Sep 2012 23:18:39 -0000 @@ -110,14 +110,14 @@ adw_alloc_controls(ADW_SOFTC *sc) if ((error = bus_dmamem_alloc(sc->sc_dmat, sizeof(struct adw_control), PAGE_SIZE, 0, &seg, 1, &rseg, BUS_DMA_NOWAIT)) != 0) { - aprint_error_dev(&sc->sc_dev, "unable to allocate control structures," + aprint_error_dev(sc->sc_dev, "unable to allocate control structures," " error = %d\n", error); return (error); } if ((error = bus_dmamem_map(sc->sc_dmat, &seg, rseg, sizeof(struct adw_control), (void **) & sc->sc_control, BUS_DMA_NOWAIT | BUS_DMA_COHERENT)) != 0) { - aprint_error_dev(&sc->sc_dev, "unable to map control structures, error = %d\n", + aprint_error_dev(sc->sc_dev, "unable to map control structures, error = %d\n", error); return (error); } @@ -128,14 +128,14 @@ adw_alloc_controls(ADW_SOFTC *sc) if ((error = bus_dmamap_create(sc->sc_dmat, sizeof(struct adw_control), 1, sizeof(struct adw_control), 0, BUS_DMA_NOWAIT, &sc->sc_dmamap_control)) != 0) { - aprint_error_dev(&sc->sc_dev, "unable to create control DMA map, error = %d\n", + aprint_error_dev(sc->sc_dev, "unable to create control DMA map, error = %d\n", error); return (error); } if ((error = bus_dmamap_load(sc->sc_dmat, sc->sc_dmamap_control, sc->sc_control, sizeof(struct adw_control), NULL, BUS_DMA_NOWAIT)) != 0) { - aprint_error_dev(&sc->sc_dev, "unable to load control DMA map, error = %d\n", + aprint_error_dev(sc->sc_dev, "unable to load control DMA map, error = %d\n", error); return (error); } @@ -156,7 +156,7 @@ adw_alloc_carriers(ADW_SOFTC *sc) sc->sc_control->carriers = malloc(sizeof(ADW_CARRIER) * ADW_MAX_CARRIER, M_DEVBUF, M_WAITOK); if(!sc->sc_control->carriers) { - aprint_error_dev(&sc->sc_dev, + aprint_error_dev(sc->sc_dev, "malloc() failed in allocating carrier structures\n"); return (ENOMEM); } @@ -164,7 +164,7 @@ adw_alloc_carriers(ADW_SOFTC *sc) if ((error = bus_dmamem_alloc(sc->sc_dmat, sizeof(ADW_CARRIER) * ADW_MAX_CARRIER, 0x10, 0, &seg, 1, &rseg, BUS_DMA_NOWAIT)) != 0) { - aprint_error_dev(&sc->sc_dev, "unable to allocate carrier structures," + aprint_error_dev(sc->sc_dev, "unable to allocate carrier structures," " error = %d\n", error); return (error); } @@ -172,7 +172,7 @@ adw_alloc_carriers(ADW_SOFTC *sc) sizeof(ADW_CARRIER) * ADW_MAX_CARRIER, (void **) &sc->sc_control->carriers, BUS_DMA_NOWAIT | BUS_DMA_COHERENT)) != 0) { - aprint_error_dev(&sc->sc_dev, "unable to map carrier structures," + aprint_error_dev(sc->sc_dev, "unable to map carrier structures," " error = %d\n", error); return (error); } @@ -184,7 +184,7 @@ adw_alloc_carriers(ADW_SOFTC *sc) sizeof(ADW_CARRIER) * ADW_MAX_CARRIER, 1, sizeof(ADW_CARRIER) * ADW_MAX_CARRIER, 0,BUS_DMA_NOWAIT, &sc->sc_dmamap_carrier)) != 0) { - aprint_error_dev(&sc->sc_dev, "unable to create carriers DMA map," + aprint_error_dev(sc->sc_dev, "unable to create carriers DMA map," " error = %d\n", error); return (error); } @@ -192,7 +192,7 @@ adw_alloc_carriers(ADW_SOFTC *sc) sc->sc_dmamap_carrier, sc->sc_control->carriers, sizeof(ADW_CARRIER) * ADW_MAX_CARRIER, NULL, BUS_DMA_NOWAIT)) != 0) { - aprint_error_dev(&sc->sc_dev, "unable to load carriers DMA map," + aprint_error_dev(sc->sc_dev, "unable to load carriers DMA map," " error = %d\n", error); return (error); } @@ -219,7 +219,7 @@ adw_create_ccbs(ADW_SOFTC *sc, ADW_CCB * for (i = 0; i < count; i++) { ccb = &ccbstore[i]; if ((error = adw_init_ccb(sc, ccb)) != 0) { - aprint_error_dev(&sc->sc_dev, "unable to initialize ccb, error = %d\n", + aprint_error_dev(sc->sc_dev, "unable to initialize ccb, error = %d\n", error); return (i); } @@ -268,7 +268,7 @@ adw_init_ccb(ADW_SOFTC *sc, ADW_CCB *ccb ADW_MAX_SG_LIST, (ADW_MAX_SG_LIST - 1) * PAGE_SIZE, 0, BUS_DMA_NOWAIT | BUS_DMA_ALLOCNOW, &ccb->dmamap_xfer); if (error) { - aprint_error_dev(&sc->sc_dev, "unable to create CCB DMA map, error = %d\n", + aprint_error_dev(sc->sc_dev, "unable to create CCB DMA map, error = %d\n", error); return (error); } @@ -393,10 +393,10 @@ adw_init(ADW_SOFTC *sc) warn_code = AdwInitFromEEPROM(sc); if (warn_code & ADW_WARN_EEPROM_CHKSUM) - aprint_error_dev(&sc->sc_dev, "Bad checksum found. " + aprint_error_dev(sc->sc_dev, "Bad checksum found. " "Setting default values\n"); if (warn_code & ADW_WARN_EEPROM_TERMINATION) - aprint_error_dev(&sc->sc_dev, "Bad bus termination setting." + aprint_error_dev(sc->sc_dev, "Bad bus termination setting." "Using automatic termination.\n"); } @@ -432,10 +432,10 @@ adw_attach(ADW_SOFTC *sc) */ ncontrols = adw_create_ccbs(sc, sc->sc_control->ccbs, ADW_MAX_CCB); if (ncontrols == 0) { - aprint_error_dev(&sc->sc_dev, "unable to create Control Blocks\n"); + aprint_error_dev(sc->sc_dev, "unable to create Control Blocks\n"); return; /* (ENOMEM) */ ; } else if (ncontrols != ADW_MAX_CCB) { - aprint_error_dev(&sc->sc_dev, "WARNING: only %d of %d Control Blocks" + aprint_error_dev(sc->sc_dev, "WARNING: only %d of %d Control Blocks" " created\n", ncontrols, ADW_MAX_CCB); } @@ -458,47 +458,47 @@ adw_attach(ADW_SOFTC *sc) switch (AdwInitDriver(sc)) { case ADW_IERR_BIST_PRE_TEST: panic("%s: BIST pre-test error", - device_xname(&sc->sc_dev)); + device_xname(sc->sc_dev)); break; case ADW_IERR_BIST_RAM_TEST: panic("%s: BIST RAM test error", - device_xname(&sc->sc_dev)); + device_xname(sc->sc_dev)); break; case ADW_IERR_MCODE_CHKSUM: panic("%s: Microcode checksum error", - device_xname(&sc->sc_dev)); + device_xname(sc->sc_dev)); break; case ADW_IERR_ILLEGAL_CONNECTION: panic("%s: All three connectors are in use", - device_xname(&sc->sc_dev)); + device_xname(sc->sc_dev)); break; case ADW_IERR_REVERSED_CABLE: panic("%s: Cable is reversed", - device_xname(&sc->sc_dev)); + device_xname(sc->sc_dev)); break; case ADW_IERR_HVD_DEVICE: panic("%s: HVD attached to LVD connector", - device_xname(&sc->sc_dev)); + device_xname(sc->sc_dev)); break; case ADW_IERR_SINGLE_END_DEVICE: panic("%s: single-ended device is attached to" " one of the connectors", - device_xname(&sc->sc_dev)); + device_xname(sc->sc_dev)); break; case ADW_IERR_NO_CARRIER: panic("%s: unable to create Carriers", - device_xname(&sc->sc_dev)); + device_xname(sc->sc_dev)); break; case ADW_WARN_BUSRESET_ERROR: - aprint_error_dev(&sc->sc_dev, "WARNING: Bus Reset Error\n"); + aprint_error_dev(sc->sc_dev, "WARNING: Bus Reset Error\n"); break; } @@ -506,7 +506,7 @@ adw_attach(ADW_SOFTC *sc) * Fill in the scsipi_adapter. */ memset(adapt, 0, sizeof(*adapt)); - adapt->adapt_dev = &sc->sc_dev; + adapt->adapt_dev = sc->sc_dev; adapt->adapt_nchannels = 1; adapt->adapt_openings = ncontrols; adapt->adapt_max_periph = adapt->adapt_openings; @@ -524,7 +524,7 @@ adw_attach(ADW_SOFTC *sc) chan->chan_nluns = 8; chan->chan_id = sc->chip_scsi_id; - config_found(&sc->sc_dev, &sc->sc_channel, scsiprint); + config_found(sc->sc_dev, &sc->sc_channel, scsiprint); } @@ -547,7 +547,7 @@ adw_scsipi_request(struct scsipi_channel void *arg) { struct scsipi_xfer *xs; - ADW_SOFTC *sc = (void *)chan->chan_adapter->adapt_dev; + ADW_SOFTC *sc = device_private(chan->chan_adapter->adapt_dev); ADW_CCB *ccb; int s, retry; @@ -699,7 +699,7 @@ adw_build_req(ADW_SOFTC *sc, ADW_CCB *cc default: xs->error = XS_DRIVER_STUFFUP; - aprint_error_dev(&sc->sc_dev, "error %d loading DMA map\n", + aprint_error_dev(sc->sc_dev, "error %d loading DMA map\n", error); out_bad: adw_free_ccb(sc, ccb); @@ -825,7 +825,7 @@ adw_timeout(void *arg) struct scsipi_xfer *xs = ccb->xs; struct scsipi_periph *periph = xs->xs_periph; ADW_SOFTC *sc = - (void *)periph->periph_channel->chan_adapter->adapt_dev; + device_private(periph->periph_channel->chan_adapter->adapt_dev); int s; scsipi_printaddr(periph); @@ -957,7 +957,7 @@ adw_print_info(ADW_SOFTC *sc, int tid) wdtr_reneg = sdtr_reneg = 0; } - printf("%s: target %d ", device_xname(&sc->sc_dev), tid); + printf("%s: target %d ", device_xname(sc->sc_dev), tid); ADW_READ_WORD_LRAM(iot, ioh, ADW_MC_SDTR_ABLE, wdtr_able); if(wdtr_able & ADW_TID_TO_TIDMASK(tid)) { @@ -1004,7 +1004,7 @@ adw_print_info(ADW_SOFTC *sc, int tid) } if(wdtr_reneg || sdtr_reneg) { - printf("%s: target %d %s", device_xname(&sc->sc_dev), tid, + printf("%s: target %d %s", device_xname(sc->sc_dev), tid, (wdtr_reneg)? ((sdtr_reneg)? "wide/sync" : "wide") : ((sdtr_reneg)? "sync" : "") ); printf(" renegotiation pending before next command.\n"); @@ -1054,7 +1054,7 @@ adw_isr_callback(ADW_SOFTC *sc, ADW_SCSI } if ((ccb->flags & CCB_ALLOC) == 0) { - aprint_error_dev(&sc->sc_dev, "exiting ccb not allocated!\n"); + aprint_error_dev(sc->sc_dev, "exiting ccb not allocated!\n"); Debugger(); return; } @@ -1103,29 +1103,29 @@ adw_isr_callback(ADW_SOFTC *sc, ADW_SCSI case QHSTA_M_SXFR_OFF_UFLW: case QHSTA_M_SXFR_OFF_OFLW: case QHSTA_M_DATA_OVER_RUN: - aprint_error_dev(&sc->sc_dev, "Overrun/Overflow/Underflow condition\n"); + aprint_error_dev(sc->sc_dev, "Overrun/Overflow/Underflow condition\n"); xs->error = XS_DRIVER_STUFFUP; break; case QHSTA_M_SXFR_DESELECTED: case QHSTA_M_UNEXPECTED_BUS_FREE: - aprint_error_dev(&sc->sc_dev, "Unexpected BUS free\n"); + aprint_error_dev(sc->sc_dev, "Unexpected BUS free\n"); xs->error = XS_DRIVER_STUFFUP; break; case QHSTA_M_SCSI_BUS_RESET: case QHSTA_M_SCSI_BUS_RESET_UNSOL: - aprint_error_dev(&sc->sc_dev, "BUS Reset\n"); + aprint_error_dev(sc->sc_dev, "BUS Reset\n"); xs->error = XS_DRIVER_STUFFUP; break; case QHSTA_M_BUS_DEVICE_RESET: - aprint_error_dev(&sc->sc_dev, "Device Reset\n"); + aprint_error_dev(sc->sc_dev, "Device Reset\n"); xs->error = XS_DRIVER_STUFFUP; break; case QHSTA_M_QUEUE_ABORTED: - aprint_error_dev(&sc->sc_dev, "Queue Aborted\n"); + aprint_error_dev(sc->sc_dev, "Queue Aborted\n"); xs->error = XS_DRIVER_STUFFUP; break; @@ -1138,7 +1138,7 @@ adw_isr_callback(ADW_SOFTC *sc, ADW_SCSI * Lets try resetting the bus and reinitialize * the host adapter. */ - aprint_error_dev(&sc->sc_dev, "DMA Error. Reseting bus\n"); + aprint_error_dev(sc->sc_dev, "DMA Error. Reseting bus\n"); TAILQ_REMOVE(&sc->sc_pending_ccb, ccb, chain); adw_reset_bus(sc); xs->error = XS_BUSY; @@ -1148,31 +1148,31 @@ adw_isr_callback(ADW_SOFTC *sc, ADW_SCSI case QHSTA_M_SXFR_WD_TMO: /* The SCSI bus hung in a phase */ printf("%s: Watch Dog timer expired. Reseting bus\n", - device_xname(&sc->sc_dev)); + device_xname(sc->sc_dev)); TAILQ_REMOVE(&sc->sc_pending_ccb, ccb, chain); adw_reset_bus(sc); xs->error = XS_BUSY; goto done; case QHSTA_M_SXFR_XFR_PH_ERR: - aprint_error_dev(&sc->sc_dev, "Transfer Error\n"); + aprint_error_dev(sc->sc_dev, "Transfer Error\n"); xs->error = XS_DRIVER_STUFFUP; break; case QHSTA_M_BAD_CMPL_STATUS_IN: /* No command complete after a status message */ printf("%s: Bad Completion Status\n", - device_xname(&sc->sc_dev)); + device_xname(sc->sc_dev)); xs->error = XS_DRIVER_STUFFUP; break; case QHSTA_M_AUTO_REQ_SENSE_FAIL: - aprint_error_dev(&sc->sc_dev, "Auto Sense Failed\n"); + aprint_error_dev(sc->sc_dev, "Auto Sense Failed\n"); xs->error = XS_DRIVER_STUFFUP; break; case QHSTA_M_INVALID_DEVICE: - aprint_error_dev(&sc->sc_dev, "Invalid Device\n"); + aprint_error_dev(sc->sc_dev, "Invalid Device\n"); xs->error = XS_DRIVER_STUFFUP; break; @@ -1181,18 +1181,18 @@ adw_isr_callback(ADW_SOFTC *sc, ADW_SCSI * User didn't request sense, but we got a * check condition. */ - aprint_error_dev(&sc->sc_dev, "Unexpected Check Condition\n"); + aprint_error_dev(sc->sc_dev, "Unexpected Check Condition\n"); xs->error = XS_DRIVER_STUFFUP; break; case QHSTA_M_SXFR_UNKNOWN_ERROR: - aprint_error_dev(&sc->sc_dev, "Unknown Error\n"); + aprint_error_dev(sc->sc_dev, "Unknown Error\n"); xs->error = XS_DRIVER_STUFFUP; break; default: panic("%s: Unhandled Host Status Error %x", - device_xname(&sc->sc_dev), scsiq->host_status); + device_xname(sc->sc_dev), scsiq->host_status); } } @@ -1211,7 +1211,7 @@ adw_async_callback(ADW_SOFTC *sc, u_int8 switch (code) { case ADV_ASYNC_SCSI_BUS_RESET_DET: /* The firmware detected a SCSI Bus reset. */ - printf("%s: SCSI Bus reset detected\n", device_xname(&sc->sc_dev)); + printf("%s: SCSI Bus reset detected\n", device_xname(sc->sc_dev)); break; case ADV_ASYNC_RDMA_FAILURE: @@ -1220,19 +1220,19 @@ adw_async_callback(ADW_SOFTC *sc, u_int8 * possibly the chip if it is unresponsive. */ printf("%s: RDMA failure. Resetting the SCSI Bus and" - " the adapter\n", device_xname(&sc->sc_dev)); + " the adapter\n", device_xname(sc->sc_dev)); AdwResetSCSIBus(sc); break; case ADV_HOST_SCSI_BUS_RESET: /* Host generated SCSI bus reset occurred. */ printf("%s: Host generated SCSI bus reset occurred\n", - device_xname(&sc->sc_dev)); + device_xname(sc->sc_dev)); break; case ADV_ASYNC_CARRIER_READY_FAILURE: /* Carrier Ready failure. */ - printf("%s: Carrier Ready failure!\n", device_xname(&sc->sc_dev)); + printf("%s: Carrier Ready failure!\n", device_xname(sc->sc_dev)); break; default: Index: sys/dev/ic/adwlib.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/ic/adwlib.h,v retrieving revision 1.20 diff -u -p -r1.20 adwlib.h --- sys/dev/ic/adwlib.h 24 Aug 2012 09:01:22 -0000 1.20 +++ sys/dev/ic/adwlib.h 26 Sep 2012 23:17:59 -0000 @@ -736,7 +736,7 @@ typedef int (* ADW_CALLBACK) (int); typedef struct adw_softc { - struct device sc_dev; + device_t sc_dev; bus_space_tag_t sc_iot; bus_space_handle_t sc_ioh; Index: sys/dev/ic/aic6915.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/ic/aic6915.c,v retrieving revision 1.29 diff -u -p -r1.29 aic6915.c --- sys/dev/ic/aic6915.c 22 Jul 2012 14:32:55 -0000 1.29 +++ sys/dev/ic/aic6915.c 27 Sep 2012 00:01:19 -0000 @@ -154,7 +154,7 @@ sf_attach(struct sf_softc *sc) else { if ((error = bus_space_subregion(sc->sc_st, sc->sc_sh, SF_GENREG_OFFSET, SF_FUNCREG_SIZE, &sc->sc_sh_func)) != 0) { - aprint_error_dev(&sc->sc_dev, "unable to sub-region functional " + aprint_error_dev(sc->sc_dev, "unable to sub-region functional " "registers, error = %d\n", error); return; @@ -176,7 +176,7 @@ sf_attach(struct sf_softc *sc) if ((error = bus_dmamem_alloc(sc->sc_dmat, sizeof(struct sf_control_data), PAGE_SIZE, 0, &seg, 1, &rseg, BUS_DMA_NOWAIT)) != 0) { - aprint_error_dev(&sc->sc_dev, "unable to allocate control data, error = %d\n", + aprint_error_dev(sc->sc_dev, "unable to allocate control data, error = %d\n", error); goto fail_0; } @@ -184,7 +184,7 @@ sf_attach(struct sf_softc *sc) if ((error = bus_dmamem_map(sc->sc_dmat, &seg, rseg, sizeof(struct sf_control_data), (void **)&sc->sc_control_data, BUS_DMA_NOWAIT|BUS_DMA_COHERENT)) != 0) { - aprint_error_dev(&sc->sc_dev, "unable to map control data, error = %d\n", + aprint_error_dev(sc->sc_dev, "unable to map control data, error = %d\n", error); goto fail_1; } @@ -193,7 +193,7 @@ sf_attach(struct sf_softc *sc) sizeof(struct sf_control_data), 1, sizeof(struct sf_control_data), 0, BUS_DMA_NOWAIT, &sc->sc_cddmamap)) != 0) { - aprint_error_dev(&sc->sc_dev, "unable to create control data DMA map, " + aprint_error_dev(sc->sc_dev, "unable to create control data DMA map, " "error = %d\n", error); goto fail_2; } @@ -201,7 +201,7 @@ sf_attach(struct sf_softc *sc) if ((error = bus_dmamap_load(sc->sc_dmat, sc->sc_cddmamap, sc->sc_control_data, sizeof(struct sf_control_data), NULL, BUS_DMA_NOWAIT)) != 0) { - aprint_error_dev(&sc->sc_dev, "unable to load control data DMA map, error = %d\n", + aprint_error_dev(sc->sc_dev, "unable to load control data DMA map, error = %d\n", error); goto fail_3; } @@ -213,7 +213,7 @@ sf_attach(struct sf_softc *sc) if ((error = bus_dmamap_create(sc->sc_dmat, MCLBYTES, SF_NTXFRAGS, MCLBYTES, 0, BUS_DMA_NOWAIT, &sc->sc_txsoft[i].ds_dmamap)) != 0) { - aprint_error_dev(&sc->sc_dev, "unable to create tx DMA map %d, " + aprint_error_dev(sc->sc_dev, "unable to create tx DMA map %d, " "error = %d\n", i, error); goto fail_4; } @@ -226,7 +226,7 @@ sf_attach(struct sf_softc *sc) if ((error = bus_dmamap_create(sc->sc_dmat, MCLBYTES, 1, MCLBYTES, 0, BUS_DMA_NOWAIT, &sc->sc_rxsoft[i].ds_dmamap)) != 0) { - aprint_error_dev(&sc->sc_dev, "unable to create rx DMA map %d, " + aprint_error_dev(sc->sc_dev, "unable to create rx DMA map %d, " "error = %d\n", i, error); goto fail_5; } @@ -243,11 +243,11 @@ sf_attach(struct sf_softc *sc) for (i = 0; i < ETHER_ADDR_LEN; i++) enaddr[i] = sf_read_eeprom(sc, (15 + (ETHER_ADDR_LEN - 1)) - i); - printf("%s: Ethernet address %s\n", device_xname(&sc->sc_dev), + printf("%s: Ethernet address %s\n", device_xname(sc->sc_dev), ether_sprintf(enaddr)); if (sf_funcreg_read(sc, SF_PciDeviceConfig) & PDC_System64) - printf("%s: 64-bit PCI slot detected\n", device_xname(&sc->sc_dev)); + printf("%s: 64-bit PCI slot detected\n", device_xname(sc->sc_dev)); /* * Initialize our media structures and probe the MII. @@ -259,7 +259,7 @@ sf_attach(struct sf_softc *sc) sc->sc_ethercom.ec_mii = &sc->sc_mii; ifmedia_init(&sc->sc_mii.mii_media, IFM_IMASK, ether_mediachange, ether_mediastatus); - mii_attach(&sc->sc_dev, &sc->sc_mii, 0xffffffff, MII_PHY_ANY, + mii_attach(sc->sc_dev, &sc->sc_mii, 0xffffffff, MII_PHY_ANY, MII_OFFSET_ANY, 0); if (LIST_FIRST(&sc->sc_mii.mii_phys) == NULL) { ifmedia_add(&sc->sc_mii.mii_media, IFM_ETHER|IFM_NONE, 0, NULL); @@ -267,7 +267,7 @@ sf_attach(struct sf_softc *sc) } else ifmedia_set(&sc->sc_mii.mii_media, IFM_ETHER|IFM_AUTO); - 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_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; ifp->if_ioctl = sf_ioctl; @@ -286,10 +286,10 @@ sf_attach(struct sf_softc *sc) /* * Make sure the interface is shutdown during reboot. */ - if (pmf_device_register1(&sc->sc_dev, NULL, NULL, sf_shutdown)) - pmf_class_network_register(&sc->sc_dev, ifp); + if (pmf_device_register1(sc->sc_dev, NULL, NULL, sf_shutdown)) + pmf_class_network_register(sc->sc_dev, ifp); else - aprint_error_dev(&sc->sc_dev, + aprint_error_dev(sc->sc_dev, "couldn't establish power handler\n"); return; @@ -395,13 +395,13 @@ sf_start(struct ifnet *ifp) BUS_DMA_WRITE|BUS_DMA_NOWAIT) != 0) { MGETHDR(m, M_DONTWAIT, MT_DATA); if (m == NULL) { - aprint_error_dev(&sc->sc_dev, "unable to allocate Tx mbuf\n"); + aprint_error_dev(sc->sc_dev, "unable to allocate Tx mbuf\n"); break; } if (m0->m_pkthdr.len > MHLEN) { MCLGET(m, M_DONTWAIT); if ((m->m_flags & M_EXT) == 0) { - aprint_error_dev(&sc->sc_dev, "unable to allocate Tx " + aprint_error_dev(sc->sc_dev, "unable to allocate Tx " "cluster\n"); m_freem(m); break; @@ -412,7 +412,7 @@ sf_start(struct ifnet *ifp) error = bus_dmamap_load_mbuf(sc->sc_dmat, dmamap, m, BUS_DMA_WRITE|BUS_DMA_NOWAIT); if (error) { - aprint_error_dev(&sc->sc_dev, "unable to load Tx buffer, " + aprint_error_dev(sc->sc_dev, "unable to load Tx buffer, " "error = %d\n", error); break; } @@ -495,7 +495,7 @@ sf_watchdog(struct ifnet *ifp) { struct sf_softc *sc = ifp->if_softc; - printf("%s: device timeout\n", device_xname(&sc->sc_dev)); + printf("%s: device timeout\n", device_xname(sc->sc_dev)); ifp->if_oerrors++; (void) sf_init(ifp); @@ -572,7 +572,7 @@ sf_intr(void *arg) /* DMA errors. */ if (isr & IS_DmaErrInt) { wantinit = 1; - aprint_error_dev(&sc->sc_dev, "WARNING: DMA error\n"); + aprint_error_dev(sc->sc_dev, "WARNING: DMA error\n"); } /* Transmit FIFO underruns. */ @@ -581,7 +581,7 @@ sf_intr(void *arg) sc->sc_txthresh++; printf("%s: transmit FIFO underrun, new " "threshold: %d bytes\n", - device_xname(&sc->sc_dev), + device_xname(sc->sc_dev), sc->sc_txthresh * 16); sf_funcreg_write(sc, SF_TransmitFrameCSR, sc->sc_TransmitFrameCSR | @@ -638,7 +638,7 @@ sf_txintr(struct sf_softc *sc) txidx = SF_TCD_INDEX_TO_HOST(TCD_INDEX(tcd)); #ifdef DIAGNOSTIC if ((tcd & TCD_PR) == 0) - aprint_error_dev(&sc->sc_dev, "Tx queue mismatch, index %d\n", + aprint_error_dev(sc->sc_dev, "Tx queue mismatch, index %d\n", txidx); #endif /* @@ -884,7 +884,7 @@ sf_reset(struct sf_softc *sc) } if (i == 1000) { - aprint_error_dev(&sc->sc_dev, "reset failed to complete\n"); + aprint_error_dev(sc->sc_dev, "reset failed to complete\n"); sf_funcreg_write(sc, SF_PciDeviceConfig, 0); } @@ -957,7 +957,7 @@ sf_init(struct ifnet *ifp) ds = &sc->sc_rxsoft[i]; if (ds->ds_mbuf == NULL) { if ((error = sf_add_rxbuf(sc, i)) != 0) { - aprint_error_dev(&sc->sc_dev, "unable to allocate or map rx " + aprint_error_dev(sc->sc_dev, "unable to allocate or map rx " "buffer %d, error = %d\n", i, error); /* @@ -1093,7 +1093,7 @@ sf_init(struct ifnet *ifp) if (error) { ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE); ifp->if_timer = 0; - printf("%s: interface not running\n", device_xname(&sc->sc_dev)); + printf("%s: interface not running\n", device_xname(sc->sc_dev)); } return (error); } @@ -1211,7 +1211,7 @@ sf_add_rxbuf(struct sf_softc *sc, int id m->m_ext.ext_buf, m->m_ext.ext_size, NULL, BUS_DMA_READ|BUS_DMA_NOWAIT); if (error) { - aprint_error_dev(&sc->sc_dev, "can't load rx DMA map %d, error = %d\n", + aprint_error_dev(sc->sc_dev, "can't load rx DMA map %d, error = %d\n", idx, error); panic("sf_add_rxbuf"); /* XXX */ } @@ -1389,7 +1389,7 @@ sf_mii_write(device_t self, int phy, int delay(1); } - printf("%s: MII write timed out\n", device_xname(&sc->sc_dev)); + printf("%s: MII write timed out\n", device_xname(sc->sc_dev)); } /* Index: sys/dev/ic/aic6915var.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/ic/aic6915var.h,v retrieving revision 1.3 diff -u -p -r1.3 aic6915var.h --- sys/dev/ic/aic6915var.h 27 Sep 2009 10:00:11 -0000 1.3 +++ sys/dev/ic/aic6915var.h 27 Sep 2012 00:00:36 -0000 @@ -112,7 +112,7 @@ struct sf_descsoft { * Software state per device. */ struct sf_softc { - struct device sc_dev; /* generic device information */ + device_t sc_dev; /* generic device information */ bus_space_tag_t sc_st; /* bus space tag */ bus_space_handle_t sc_sh; /* bus space handle */ bus_space_handle_t sc_sh_func; /* sub-handle for func regs */ Index: sys/dev/ic/awi.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/ic/awi.c,v retrieving revision 1.87 diff -u -p -r1.87 awi.c --- sys/dev/ic/awi.c 5 Apr 2010 07:19:33 -0000 1.87 +++ sys/dev/ic/awi.c 28 Sep 2012 20:04:06 -0000 @@ -199,13 +199,13 @@ awi_attach(struct awi_softc *sc) sc->sc_attached = 0; sc->sc_substate = AWI_ST_NONE; if ((error = awi_hw_init(sc)) != 0) { - config_deactivate(&sc->sc_dev); + config_deactivate(sc->sc_dev); splx(s); return error; } error = awi_init_mibs(sc); if (error != 0) { - config_deactivate(&sc->sc_dev); + config_deactivate(sc->sc_dev); splx(s); return error; } @@ -221,7 +221,7 @@ awi_attach(struct awi_softc *sc) ifp->if_init = awi_init; ifp->if_stop = awi_stop; IFQ_SET_READY(&ifp->if_snd); - memcpy(ifp->if_xname, device_xname(&sc->sc_dev), IFNAMSIZ); + memcpy(ifp->if_xname, device_xname(sc->sc_dev), IFNAMSIZ); ic->ic_ifp = ifp; ic->ic_caps = IEEE80211_C_WEP | IEEE80211_C_IBSS | IEEE80211_C_HOSTAP; @@ -387,11 +387,11 @@ awi_intr(void *arg) #endif if (!sc->sc_enabled || !sc->sc_enab_intr || - !device_is_active(&sc->sc_dev)) { + !device_is_active(sc->sc_dev)) { DPRINTF(("awi_intr: stray interrupt: " "enabled %d enab_intr %d invalid %d\n", sc->sc_enabled, sc->sc_enab_intr, - !device_is_active(&sc->sc_dev))); + !device_is_active(sc->sc_dev))); return 0; } @@ -610,7 +610,7 @@ awi_stop(struct ifnet *ifp, int disable) ieee80211_new_state(&sc->sc_ic, IEEE80211_S_INIT, -1); - if (device_is_active(&sc->sc_dev)) { + if (device_is_active(sc->sc_dev)) { if (sc->sc_cmd_inprog) (void)awi_cmd_wait(sc); (void)awi_cmd(sc, AWI_CMD_KILL_RX, AWI_WAIT); @@ -632,7 +632,7 @@ awi_stop(struct ifnet *ifp, int disable) IFQ_PURGE(&ifp->if_snd); if (disable) { - if (device_is_active(&sc->sc_dev)) + if (device_is_active(sc->sc_dev)) am79c930_gcr_setbits(&sc->sc_chip, AM79C930_GCR_CORESET); if (sc->sc_disable) @@ -654,7 +654,7 @@ awi_start(struct ifnet *ifp) u_int32_t txd, frame, ntxd; u_int8_t rate; - if (!sc->sc_enabled || !device_is_active(&sc->sc_dev)) + if (!sc->sc_enabled || !device_is_active(sc->sc_dev)) return; for (;;) { @@ -782,7 +782,7 @@ awi_watchdog(struct ifnet *ifp) int ocansleep; ifp->if_timer = 0; - if (!sc->sc_enabled || !device_is_active(&sc->sc_dev)) + if (!sc->sc_enabled || !device_is_active(sc->sc_dev)) return; ocansleep = sc->sc_cansleep; @@ -1256,7 +1256,7 @@ awi_hw_init(struct awi_softc *sc) /* wait for selftest completion */ for (i = 0; ; i++) { - if (!device_is_active(&sc->sc_dev)) + if (!device_is_active(sc->sc_dev)) return ENXIO; if (i >= AWI_SELFTEST_TIMEOUT*hz/1000) { printf("%s: failed to complete selftest (timeout)\n", @@ -1549,12 +1549,12 @@ awi_cmd_wait(struct awi_softc *sc) i = 0; while (sc->sc_cmd_inprog) { - if (!device_is_active(&sc->sc_dev)) + if (!device_is_active(sc->sc_dev)) return ENXIO; if (awi_read_1(sc, AWI_CMD) != sc->sc_cmd_inprog) { printf("%s: failed to access hardware\n", sc->sc_if.if_xname); - config_deactivate(&sc->sc_dev); + config_deactivate(sc->sc_dev); return ENXIO; } if (sc->sc_cansleep) { @@ -1656,7 +1656,7 @@ awi_lock(struct awi_softc *sc) * ioctl requests in progress. */ if (sc->sc_busy) { - if (!device_is_active(&sc->sc_dev)) + if (!device_is_active(sc->sc_dev)) return ENXIO; return EWOULDBLOCK; } @@ -1665,7 +1665,7 @@ awi_lock(struct awi_softc *sc) return 0; } while (sc->sc_busy) { - if (!device_is_active(&sc->sc_dev)) + if (!device_is_active(sc->sc_dev)) return ENXIO; sc->sc_sleep_cnt++; error = tsleep(sc, PWAIT | PCATCH, "awilck", 0); Index: sys/dev/ic/awivar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/ic/awivar.h,v retrieving revision 1.26 diff -u -p -r1.26 awivar.h --- sys/dev/ic/awivar.h 12 Nov 2009 19:32:14 -0000 1.26 +++ sys/dev/ic/awivar.h 28 Sep 2012 20:03:25 -0000 @@ -66,7 +66,7 @@ struct awi_chanset { }; struct awi_softc { - struct device sc_dev; + device_t sc_dev; struct am79c930_softc sc_chip; struct ethercom sc_ec; struct ieee80211com sc_ic; Index: sys/dev/ic/bha.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/ic/bha.c,v retrieving revision 1.74 diff -u -p -r1.74 bha.c --- sys/dev/ic/bha.c 13 Nov 2010 13:52:00 -0000 1.74 +++ sys/dev/ic/bha.c 28 Sep 2012 17:49:00 -0000 @@ -155,7 +155,7 @@ bha_attach(struct bha_softc *sc) initial_ccbs = bha_info(sc); if (initial_ccbs == 0) { - aprint_error_dev(&sc->sc_dev, "unable to get adapter info\n"); + aprint_error_dev(sc->sc_dev, "unable to get adapter info\n"); return; } @@ -163,7 +163,7 @@ bha_attach(struct bha_softc *sc) * Fill in the scsipi_adapter. */ memset(adapt, 0, sizeof(*adapt)); - adapt->adapt_dev = &sc->sc_dev; + adapt->adapt_dev = sc->sc_dev; adapt->adapt_nchannels = 1; /* adapt_openings initialized below */ adapt->adapt_max_periph = sc->sc_mbox_count; @@ -191,7 +191,7 @@ bha_attach(struct bha_softc *sc) bha_create_ccbs(sc, initial_ccbs); if (sc->sc_cur_ccbs < 2) { - aprint_error_dev(&sc->sc_dev, "not enough CCBs to run\n"); + aprint_error_dev(sc->sc_dev, "not enough CCBs to run\n"); return; } @@ -200,7 +200,7 @@ bha_attach(struct bha_softc *sc) if (bha_init(sc) != 0) return; - (void) config_found(&sc->sc_dev, &sc->sc_channel, scsiprint); + (void) config_found(sc->sc_dev, &sc->sc_channel, scsiprint); } /* @@ -217,7 +217,7 @@ bha_intr(void *arg) u_char sts; #ifdef BHADEBUG - printf("%s: bha_intr ", device_xname(&sc->sc_dev)); + printf("%s: bha_intr ", device_xname(sc->sc_dev)); #endif /* BHADEBUG */ /* @@ -240,7 +240,7 @@ bha_intr(void *arg) toggle.cmd.opcode = BHA_MBO_INTR_EN; toggle.cmd.enable = 0; - bha_cmd(iot, ioh, device_xname(&sc->sc_dev), + bha_cmd(iot, ioh, device_xname(sc->sc_dev), sizeof(toggle.cmd), (u_char *)&toggle.cmd, 0, (u_char *)0); bha_start_ccbs(sc); @@ -267,7 +267,7 @@ bha_scsipi_request(struct scsipi_channel void *arg) { struct scsipi_adapter *adapt = chan->chan_adapter; - struct bha_softc *sc = (void *)adapt->adapt_dev; + struct bha_softc *sc = device_private(adapt->adapt_dev); struct scsipi_xfer *xs; struct scsipi_periph *periph; bus_dma_tag_t dmat = sc->sc_dmat; @@ -309,7 +309,7 @@ bha_scsipi_request(struct scsipi_channel /* can't use S/G if zero length */ if (xs->cmdlen > sizeof(ccb->scsi_cmd)) { printf("%s: cmdlen %d too large for CCB\n", - device_xname(&sc->sc_dev), xs->cmdlen); + device_xname(sc->sc_dev), xs->cmdlen); xs->error = XS_DRIVER_STUFFUP; goto out_bad; } @@ -354,7 +354,7 @@ bha_scsipi_request(struct scsipi_channel default: xs->error = XS_DRIVER_STUFFUP; - aprint_error_dev(&sc->sc_dev, "error %d loading DMA map\n", error); + aprint_error_dev(sc->sc_dev, "error %d loading DMA map\n", error); out_bad: bha_free_ccb(sc, ccb); scsipi_done(xs); @@ -493,7 +493,7 @@ bha_get_xfer_mode(struct bha_softc *sc, ((sc->sc_flags & BHAF_WIDE) ? sizeof(hwsetup.reply_w) : 0); hwsetup.cmd.opcode = BHA_INQUIRE_SETUP; hwsetup.cmd.len = rlen; - bha_cmd(sc->sc_iot, sc->sc_ioh, device_xname(&sc->sc_dev), + bha_cmd(sc->sc_iot, sc->sc_ioh, device_xname(sc->sc_dev), sizeof(hwsetup.cmd), (u_char *)&hwsetup.cmd, rlen, (u_char *)&hwsetup.reply); @@ -546,7 +546,7 @@ bha_get_xfer_mode(struct bha_softc *sc, sizeof(hwperiod.reply_w) : 0); hwperiod.cmd.opcode = BHA_INQUIRE_PERIOD; hwperiod.cmd.len = rlen; - bha_cmd(sc->sc_iot, sc->sc_ioh, device_xname(&sc->sc_dev), + bha_cmd(sc->sc_iot, sc->sc_ioh, device_xname(sc->sc_dev), sizeof(hwperiod.cmd), (u_char *)&hwperiod.cmd, rlen, (u_char *)&hwperiod.reply); @@ -591,13 +591,13 @@ bha_done(struct bha_softc *sc, struct bh #ifdef BHADIAG if (ccb->flags & CCB_SENDING) { printf("%s: exiting ccb still in transit!\n", - device_xname(&sc->sc_dev)); + device_xname(sc->sc_dev)); Debugger(); return; } #endif if ((ccb->flags & CCB_ALLOC) == 0) { - aprint_error_dev(&sc->sc_dev, "exiting ccb not allocated!\n"); + aprint_error_dev(sc->sc_dev, "exiting ccb not allocated!\n"); Debugger(); return; } @@ -622,7 +622,7 @@ bha_done(struct bha_softc *sc, struct bh break; default: /* Other scsi protocol messes */ printf("%s: host_stat %x\n", - device_xname(&sc->sc_dev), ccb->host_stat); + device_xname(sc->sc_dev), ccb->host_stat); xs->error = XS_DRIVER_STUFFUP; break; } @@ -639,7 +639,7 @@ bha_done(struct bha_softc *sc, struct bh break; default: printf("%s: target_stat %x\n", - device_xname(&sc->sc_dev), ccb->target_stat); + device_xname(sc->sc_dev), ccb->target_stat); xs->error = XS_DRIVER_STUFFUP; break; } @@ -691,7 +691,7 @@ bha_timeout(void *arg) struct scsipi_xfer *xs = ccb->xs; struct scsipi_periph *periph = xs->xs_periph; struct bha_softc *sc = - (void *)periph->periph_channel->chan_adapter->adapt_dev; + device_private(periph->periph_channel->chan_adapter->adapt_dev); int s; scsipi_printaddr(periph); @@ -705,7 +705,7 @@ bha_timeout(void *arg) */ bha_collect_mbo(sc); if (ccb->flags & CCB_SENDING) { - aprint_error_dev(&sc->sc_dev, "not taking commands!\n"); + aprint_error_dev(sc->sc_dev, "not taking commands!\n"); Debugger(); } #endif @@ -1057,7 +1057,7 @@ bha_disable_isacompat(struct bha_softc * isa_disable.cmd.opcode = BHA_MODIFY_IOPORT; isa_disable.cmd.modifier = BHA_IOMODIFY_DISABLE1; - bha_cmd(sc->sc_iot, sc->sc_ioh, device_xname(&sc->sc_dev), + bha_cmd(sc->sc_iot, sc->sc_ioh, device_xname(sc->sc_dev), sizeof(isa_disable.cmd), (u_char*)&isa_disable.cmd, 0, (u_char *)0); return (0); @@ -1082,7 +1082,7 @@ bha_info(struct bha_softc *sc) struct bha_revision revision; struct bha_digit digit; int i, j, initial_ccbs, rlen; - const char *name = device_xname(&sc->sc_dev); + const char *name = device_xname(sc->sc_dev); char *p; /* @@ -1273,10 +1273,10 @@ bha_info(struct bha_softc *sc) sizeof(setup.cmd), (u_char *)&setup.cmd, rlen, (u_char *)&setup.reply); - aprint_normal_dev(&sc->sc_dev, "model BT-%s, firmware %s\n", + aprint_normal_dev(sc->sc_dev, "model BT-%s, firmware %s\n", sc->sc_model, sc->sc_firmware); - aprint_normal_dev(&sc->sc_dev, "%d H/W CCBs", sc->sc_max_ccbs); + aprint_normal_dev(sc->sc_dev, "%d H/W CCBs", sc->sc_max_ccbs); if (setup.reply.sync_neg) aprint_normal(", sync"); if (setup.reply.parity) @@ -1347,7 +1347,7 @@ bha_info(struct bha_softc *sc) static int bha_init(struct bha_softc *sc) { - const char *name = device_xname(&sc->sc_dev); + const char *name = device_xname(sc->sc_dev); struct bha_toggle toggle; struct bha_mailbox mailbox; struct bha_mbx_out *mbo; @@ -1451,7 +1451,7 @@ bha_start_ccbs(struct bha_softc *sc) toggle.cmd.opcode = BHA_MBO_INTR_EN; toggle.cmd.enable = 1; - bha_cmd(iot, ioh, device_xname(&sc->sc_dev), + bha_cmd(iot, ioh, device_xname(sc->sc_dev), sizeof(toggle.cmd), (u_char *)&toggle.cmd, 0, (u_char *)0); break; @@ -1516,7 +1516,7 @@ bha_finish_ccbs(struct bha_softc *sc) * we use all mailbox slots. */ printf("%s: mbi not in round-robin order\n", - device_xname(&sc->sc_dev)); + device_xname(sc->sc_dev)); #endif goto again; } @@ -1526,7 +1526,7 @@ bha_finish_ccbs(struct bha_softc *sc) } #ifdef BHADIAGnot printf("%s: mbi interrupt with no full mailboxes\n", - device_xname(&sc->sc_dev)); + device_xname(sc->sc_dev)); #endif return; } @@ -1535,7 +1535,7 @@ bha_finish_ccbs(struct bha_softc *sc) do { ccb = bha_ccb_phys_kv(sc, phystol(mbi->ccb_addr)); if (ccb == NULL) { - aprint_error_dev(&sc->sc_dev, "bad mbi ccb pointer 0x%08x; skipping\n", + aprint_error_dev(sc->sc_dev, "bad mbi ccb pointer 0x%08x; skipping\n", phystol(mbi->ccb_addr)); goto next; } @@ -1579,7 +1579,7 @@ bha_finish_ccbs(struct bha_softc *sc) break; default: - aprint_error_dev(&sc->sc_dev, "bad mbi comp_stat %02x; skipping\n", + aprint_error_dev(sc->sc_dev, "bad mbi comp_stat %02x; skipping\n", mbi->comp_stat); goto next; } @@ -1628,7 +1628,7 @@ bha_create_mailbox(struct bha_softc *sc) error = bus_dmamem_alloc(sc->sc_dmat, size, PAGE_SIZE, 0, &seg, 1, &rseg, sc->sc_dmaflags); if (error) { - aprint_error_dev(&sc->sc_dev, "unable to allocate mailboxes, error = %d\n", + aprint_error_dev(sc->sc_dev, "unable to allocate mailboxes, error = %d\n", error); goto bad_0; } @@ -1636,7 +1636,7 @@ bha_create_mailbox(struct bha_softc *sc) error = bus_dmamem_map(sc->sc_dmat, &seg, rseg, size, (void **)&sc->sc_mbo, sc->sc_dmaflags | BUS_DMA_COHERENT); if (error) { - aprint_error_dev(&sc->sc_dev, "unable to map mailboxes, error = %d\n", + aprint_error_dev(sc->sc_dev, "unable to map mailboxes, error = %d\n", error); goto bad_1; } @@ -1646,7 +1646,7 @@ bha_create_mailbox(struct bha_softc *sc) error = bus_dmamap_create(sc->sc_dmat, size, 1, size, 0, sc->sc_dmaflags, &sc->sc_dmamap_mbox); if (error) { - aprint_error_dev(&sc->sc_dev, + aprint_error_dev(sc->sc_dev, "unable to create mailbox DMA map, error = %d\n", error); goto bad_2; @@ -1655,7 +1655,7 @@ bha_create_mailbox(struct bha_softc *sc) error = bus_dmamap_load(sc->sc_dmat, sc->sc_dmamap_mbox, sc->sc_mbo, size, NULL, 0); if (error) { - aprint_error_dev(&sc->sc_dev, "unable to load mailbox DMA map, error = %d\n", + aprint_error_dev(sc->sc_dev, "unable to load mailbox DMA map, error = %d\n", error); goto bad_3; } @@ -1765,7 +1765,7 @@ bha_create_ccbs(struct bha_softc *sc, in error = bus_dmamem_alloc(sc->sc_dmat, PAGE_SIZE, PAGE_SIZE, 0, &seg, 1, &rseg, sc->sc_dmaflags | BUS_DMA_NOWAIT); if (error) { - aprint_error_dev(&sc->sc_dev, "unable to allocate CCB group, error = %d\n", + aprint_error_dev(sc->sc_dev, "unable to allocate CCB group, error = %d\n", error); goto bad_0; } @@ -1774,7 +1774,7 @@ bha_create_ccbs(struct bha_softc *sc, in (void *)&bcg, sc->sc_dmaflags | BUS_DMA_NOWAIT | BUS_DMA_COHERENT); if (error) { - aprint_error_dev(&sc->sc_dev, "unable to map CCB group, error = %d\n", + aprint_error_dev(sc->sc_dev, "unable to map CCB group, error = %d\n", error); goto bad_1; } @@ -1784,7 +1784,7 @@ bha_create_ccbs(struct bha_softc *sc, in error = bus_dmamap_create(sc->sc_dmat, PAGE_SIZE, 1, PAGE_SIZE, 0, sc->sc_dmaflags | BUS_DMA_NOWAIT, &ccbmap); if (error) { - aprint_error_dev(&sc->sc_dev, "unable to create CCB group DMA map, error = %d\n", + aprint_error_dev(sc->sc_dev, "unable to create CCB group DMA map, error = %d\n", error); goto bad_2; } @@ -1792,7 +1792,7 @@ bha_create_ccbs(struct bha_softc *sc, in error = bus_dmamap_load(sc->sc_dmat, ccbmap, bcg, PAGE_SIZE, NULL, sc->sc_dmaflags | BUS_DMA_NOWAIT); if (error) { - aprint_error_dev(&sc->sc_dev, "unable to load CCB group DMA map, error = %d\n", + aprint_error_dev(sc->sc_dev, "unable to load CCB group DMA map, error = %d\n", error); goto bad_3; } @@ -1869,7 +1869,7 @@ bha_init_ccb(struct bha_softc *sc, struc BHA_MAXXFER, 0, BUS_DMA_NOWAIT | BUS_DMA_ALLOCNOW | sc->sc_dmaflags, &ccb->dmamap_xfer); if (error) { - aprint_error_dev(&sc->sc_dev, "unable to create CCB DMA map, error = %d\n", + aprint_error_dev(sc->sc_dev, "unable to create CCB DMA map, error = %d\n", error); return (error); } Index: sys/dev/ic/bhavar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/ic/bhavar.h,v retrieving revision 1.24 diff -u -p -r1.24 bhavar.h --- sys/dev/ic/bhavar.h 28 Apr 2008 20:23:49 -0000 1.24 +++ sys/dev/ic/bhavar.h 26 Sep 2012 18:37:43 -0000 @@ -86,7 +86,7 @@ do { \ } while (0) struct bha_softc { - struct device sc_dev; + device_t sc_dev; bus_space_tag_t sc_iot; bus_space_handle_t sc_ioh; Index: sys/dev/ic/cac.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/ic/cac.c,v retrieving revision 1.53 diff -u -p -r1.53 cac.c --- sys/dev/ic/cac.c 20 Jun 2011 22:02:55 -0000 1.53 +++ sys/dev/ic/cac.c 29 Sep 2012 12:42:26 -0000 @@ -107,7 +107,7 @@ cac_init(struct cac_softc *sc, const cha char firm[8]; if (intrstr != NULL) - aprint_normal_dev(&sc->sc_dv, "interrupting at %s\n", + aprint_normal_dev(sc->sc_dev, "interrupting at %s\n", intrstr); SIMPLEQ_INIT(&sc->sc_ccb_free); @@ -119,7 +119,7 @@ cac_init(struct cac_softc *sc, const cha if ((error = bus_dmamem_alloc(sc->sc_dmat, size, PAGE_SIZE, 0, &seg, 1, &rseg, BUS_DMA_NOWAIT)) != 0) { - aprint_error_dev(&sc->sc_dv, "unable to allocate CCBs, error = %d\n", + aprint_error_dev(sc->sc_dev, "unable to allocate CCBs, error = %d\n", error); return (-1); } @@ -127,21 +127,21 @@ cac_init(struct cac_softc *sc, const cha if ((error = bus_dmamem_map(sc->sc_dmat, &seg, rseg, size, (void **)&sc->sc_ccbs, BUS_DMA_NOWAIT | BUS_DMA_COHERENT)) != 0) { - aprint_error_dev(&sc->sc_dv, "unable to map CCBs, error = %d\n", + aprint_error_dev(sc->sc_dev, "unable to map CCBs, error = %d\n", error); return (-1); } if ((error = bus_dmamap_create(sc->sc_dmat, size, 1, size, 0, BUS_DMA_NOWAIT, &sc->sc_dmamap)) != 0) { - aprint_error_dev(&sc->sc_dv, "unable to create CCB DMA map, error = %d\n", + aprint_error_dev(sc->sc_dev, "unable to create CCB DMA map, error = %d\n", error); return (-1); } if ((error = bus_dmamap_load(sc->sc_dmat, sc->sc_dmamap, sc->sc_ccbs, size, NULL, BUS_DMA_NOWAIT)) != 0) { - aprint_error_dev(&sc->sc_dv, "unable to load CCB DMA map, error = %d\n", + aprint_error_dev(sc->sc_dev, "unable to load CCB DMA map, error = %d\n", error); return (-1); } @@ -158,7 +158,7 @@ cac_init(struct cac_softc *sc, const cha &ccb->ccb_dmamap_xfer); if (error) { - aprint_error_dev(&sc->sc_dv, "can't create ccb dmamap (%d)\n", + aprint_error_dev(sc->sc_dev, "can't create ccb dmamap (%d)\n", error); break; } @@ -172,19 +172,19 @@ cac_init(struct cac_softc *sc, const cha if (startfw) { if (cac_cmd(sc, CAC_CMD_START_FIRMWARE, &cinfo, sizeof(cinfo), 0, 0, CAC_CCB_DATA_IN, NULL)) { - aprint_error_dev(&sc->sc_dv, "CAC_CMD_START_FIRMWARE failed\n"); + aprint_error_dev(sc->sc_dev, "CAC_CMD_START_FIRMWARE failed\n"); return (-1); } } if (cac_cmd(sc, CAC_CMD_GET_CTRL_INFO, &cinfo, sizeof(cinfo), 0, 0, CAC_CCB_DATA_IN, NULL)) { - aprint_error_dev(&sc->sc_dv, "CAC_CMD_GET_CTRL_INFO failed\n"); + aprint_error_dev(sc->sc_dev, "CAC_CMD_GET_CTRL_INFO failed\n"); return (-1); } strlcpy(firm, cinfo.firm_rev, 4+1); - printf("%s: %d channels, firmware <%s>\n", device_xname(&sc->sc_dv), + printf("%s: %d channels, firmware <%s>\n", device_xname(sc->sc_dev), cinfo.scsi_chips, firm); sc->sc_nunits = cinfo.num_drvs; @@ -193,7 +193,7 @@ cac_init(struct cac_softc *sc, const cha locs[CACCF_UNIT] = i; - config_found_sm_loc(&sc->sc_dv, "cac", locs, &caca, + config_found_sm_loc(sc->sc_dev, "cac", locs, &caca, cac_print, config_stdsubmatch); } @@ -206,12 +206,12 @@ cac_init(struct cac_softc *sc, const cha mutex_exit(&sc->sc_mutex); #if NBIO > 0 - if (bio_register(&sc->sc_dv, cac_ioctl) != 0) - aprint_error_dev(&sc->sc_dv, "controller registration failed"); + if (bio_register(sc->sc_dev, cac_ioctl) != 0) + aprint_error_dev(sc->sc_dev, "controller registration failed"); else sc->sc_ioctl = cac_ioctl; if (cac_create_sensors(sc) != 0) - aprint_error_dev(&sc->sc_dv, "unable to create sensors\n"); + aprint_error_dev(sc->sc_dev, "unable to create sensors\n"); #endif return (0); @@ -265,7 +265,7 @@ cac_intr(void *cookie) struct cac_ccb *ccb; int rv; - sc = (struct cac_softc *)cookie; + sc = cookie; mutex_enter(&sc->sc_mutex); @@ -297,7 +297,7 @@ cac_cmd(struct cac_softc *sc, int comman size = 0; if ((ccb = cac_ccb_alloc(sc, 1)) == NULL) { - aprint_error_dev(&sc->sc_dv, "unable to alloc CCB"); + aprint_error_dev(sc->sc_dev, "unable to alloc CCB"); return (EAGAIN); } @@ -390,7 +390,7 @@ cac_ccb_poll(struct cac_softc *sc, struc } if (timo == 0) { - printf("%s: timeout\n", device_xname(&sc->sc_dv)); + printf("%s: timeout\n", device_xname(sc->sc_dev)); return (EBUSY); } cac_ccb_done(sc, ccb); @@ -460,12 +460,12 @@ cac_ccb_done(struct cac_softc *sc, struc (*ccb->ccb_context.cc_handler)(dv, context, error); } else { if ((error & CAC_RET_SOFT_ERROR) != 0) - aprint_error_dev(&sc->sc_dv, "soft error; array may be degraded\n"); + aprint_error_dev(sc->sc_dev, "soft error; array may be degraded\n"); if ((error & CAC_RET_HARD_ERROR) != 0) - aprint_error_dev(&sc->sc_dv, "hard error\n"); + aprint_error_dev(sc->sc_dev, "hard error\n"); if ((error & CAC_RET_CMD_REJECTED) != 0) { error = 1; - aprint_error_dev(&sc->sc_dv, "invalid request\n"); + aprint_error_dev(sc->sc_dev, "invalid request\n"); } } } @@ -548,7 +548,7 @@ cac_l0_completed(struct cac_softc *sc) return (NULL); if ((off & 3) != 0) - aprint_error_dev(&sc->sc_dv, "failed command list returned: %lx\n", + aprint_error_dev(sc->sc_dev, "failed command list returned: %lx\n", (long)off); off = (off & ~3) - sc->sc_ccbs_paddr; @@ -592,7 +592,7 @@ const int cac_stat[] = { BIOC_SVONLINE, int cac_ioctl(device_t dev, u_long cmd, void *addr) { - struct cac_softc *sc = (struct cac_softc *)dev; + struct cac_softc *sc = device_private(dev); struct bioc_inq *bi; struct bioc_disk *bd; cac_lock_t lock; @@ -602,7 +602,7 @@ cac_ioctl(device_t dev, u_long cmd, void switch (cmd) { case BIOCINQ: bi = (struct bioc_inq *)addr; - strlcpy(bi->bi_dev, device_xname(&sc->sc_dv), sizeof(bi->bi_dev)); + strlcpy(bi->bi_dev, device_xname(sc->sc_dev), sizeof(bi->bi_dev)); bi->bi_novol = sc->sc_nunits; bi->bi_nodisk = 0; break; @@ -677,7 +677,7 @@ cac_create_sensors(struct cac_softc *sc) sc->sc_sensor = malloc(sizeof(envsys_data_t) * nsensors, M_DEVBUF, M_NOWAIT | M_ZERO); if (sc->sc_sensor == NULL) { - aprint_error_dev(&sc->sc_dv, "can't allocate envsys_data_t\n"); + aprint_error_dev(sc->sc_dev, "can't allocate envsys_data_t\n"); return(ENOMEM); } @@ -690,16 +690,16 @@ cac_create_sensors(struct cac_softc *sc) /* logical drives */ snprintf(sc->sc_sensor[i].desc, sizeof(sc->sc_sensor[i].desc), "%s:%d", - device_xname(&sc->sc_dv), i); + device_xname(sc->sc_dev), i); if (sysmon_envsys_sensor_attach(sc->sc_sme, &sc->sc_sensor[i])) goto out; } - sc->sc_sme->sme_name = device_xname(&sc->sc_dv); + sc->sc_sme->sme_name = device_xname(sc->sc_dev); sc->sc_sme->sme_cookie = sc; sc->sc_sme->sme_refresh = cac_sensor_refresh; if (sysmon_envsys_register(sc->sc_sme)) { - aprint_error_dev(&sc->sc_dv, "unable to register with sysmon\n"); + aprint_error_dev(sc->sc_dev, "unable to register with sysmon\n"); return(1); } return (0); Index: sys/dev/ic/cacvar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/ic/cacvar.h,v retrieving revision 1.19 diff -u -p -r1.19 cacvar.h --- sys/dev/ic/cacvar.h 12 May 2009 14:25:17 -0000 1.19 +++ sys/dev/ic/cacvar.h 2 Oct 2012 02:20:13 -0000 @@ -72,7 +72,7 @@ struct cac_ccb; struct cac_context { void (*cc_handler)(device_t, void *, int); - struct device *cc_dv; + device_t cc_dv; void *cc_context; }; @@ -104,7 +104,7 @@ struct cac_linkage { }; struct cac_softc { - struct device sc_dv; + device_t sc_dev; kmutex_t sc_mutex; bus_space_tag_t sc_iot; bus_space_handle_t sc_ioh; Index: sys/dev/ic/cd18xx.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/ic/cd18xx.c,v retrieving revision 1.28 diff -u -p -r1.28 cd18xx.c --- sys/dev/ic/cd18xx.c 24 Apr 2011 16:26:59 -0000 1.28 +++ sys/dev/ic/cd18xx.c 26 Sep 2012 18:37:43 -0000 @@ -1,7 +1,5 @@ /* $NetBSD: cd18xx.c,v 1.28 2011/04/24 16:26:59 rmind Exp $ */ -/* XXXad does this even compile? */ - /* * Copyright (c) 1998, 2001 Matthew R. Green * All rights reserved. @@ -119,11 +117,6 @@ __KERNEL_RCSID(0, "$NetBSD: cd18xx.c,v 1 * some helpers */ -/* macros to clear/set/test flags. */ -#define SET(t, f) (t) |= (f) -#define CLR(t, f) (t) &= ~(f) -#define ISSET(t, f) ((t) & (f)) - static void cdtty_attach(struct cd18xx_softc *, int); static inline void cd18xx_rint(struct cd18xx_softc *, int *); @@ -179,9 +172,9 @@ int cd18xx_debug = CDD_INTR|CDD_INFO; /* Known supported revisions. */ struct cd18xx_revs { - u_char revision; - u_char onehundred_pin; - char *name; + u_char revision; + u_char onehundred_pin; + const char *name; } cd18xx_revs[] = { { CD180_GFRCR_REV_B, 0, "CL-CD180 rev. B" }, { CD180_GFRCR_REV_C, 0, "CL-CD180 rev. C" }, @@ -225,7 +218,7 @@ cd18xx_attach(struct cd18xx_softc *sc) } if (cd18xx_revs[i].name == NULL) { - aprint_error_dev(&sc->sc_dev, "unknown revision, bailing.\n"); + aprint_error_dev(sc->sc_dev, "unknown revision, bailing.\n"); return; } @@ -249,7 +242,7 @@ cd18xx_attach(struct cd18xx_softc *sc) ; if (i == 0) { aprint_normal("\n"); - aprint_error_dev(&sc->sc_dev, "did not reset!\n"); + aprint_error_dev(sc->sc_dev, "did not reset!\n"); return; } @@ -299,7 +292,6 @@ void cdtty_attach(struct cd18xx_softc *sc, int port) { struct cdtty_port *p = &sc->sc_ports[port]; - int i; /* load CAR with channel number */ cd18xx_set_car(sc, port); @@ -307,7 +299,7 @@ cdtty_attach(struct cd18xx_softc *sc, in /* wait for CCR to go to zero */ if (cd18xx_wait_ccr(sc)) { printf("cd18xx_attach: change command timed out setting " - "CAR for port %d\n", i); + "CAR for port %d\n", port); return; } @@ -337,7 +329,7 @@ cdtty_attach(struct cd18xx_softc *sc, in p->p_rbput = p->p_rbget = p->p_rbuf; p->p_rbavail = cdtty_rbuf_size; if (p->p_rbuf == NULL) { - aprint_error_dev(&sc->sc_dev, "unable to allocate ring buffer for tty %d\n", port); + aprint_error_dev(sc->sc_dev, "unable to allocate ring buffer for tty %d\n", port); return; } p->p_ebuf = p->p_rbuf + (cdtty_rbuf_size << 1); @@ -387,7 +379,7 @@ cdtty_shutdown(struct cd18xx_softc *sc, * cdttyopen: open syscall for cdtty terminals.. */ int -cdttyopen(dev_t dev, int flag, int mode, struct proc *p) +cdttyopen(dev_t dev, int flag, int mode, struct lwp *l) { struct tty *tp; struct cd18xx_softc *sc; @@ -487,7 +479,7 @@ cdttyopen(dev_t dev, int flag, int mode, * cdttyclose: close syscall for cdtty terminals.. */ int -cdttyclose(dev_t dev, int flag, int mode, struct proc *p) +cdttyclose(dev_t dev, int flag, int mode, struct lwp *l) { struct cd18xx_softc *sc; struct cdtty_port *port; @@ -551,13 +543,13 @@ cdttywrite(dev_t dev, struct uio *uio, i } int -cdttypoll(dev_t dev, int events, struct proc *p) +cdttypoll(dev_t dev, int events, struct lwp *l) { struct cd18xx_softc *sc = device_lookup_private(&clcd_cd, CD18XX_INSTANCE(dev)); struct cdtty_port *port = &sc->sc_ports[CD18XX_CHANNEL(dev)]; struct tty *tp = port->p_tty; - return ((*tp->t_linesw->l_poll)(tp, events, p)); + return ((*tp->t_linesw->l_poll)(tp, events, l)); } /* @@ -576,18 +568,18 @@ cdttytty(dev_t dev) * cdttyioctl: ioctl syscall for cdtty terminals.. */ int -cdttyioctl(dev_t dev, u_long cmd, void *data, int flag, struct proc *p) +cdttyioctl(dev_t dev, u_long cmd, void *data, int flag, struct lwp *l) { struct cd18xx_softc *sc = device_lookup_private(&clcd_cd, CD18XX_INSTANCE(dev)); struct cdtty_port *port = &sc->sc_ports[CD18XX_CHANNEL(dev)]; struct tty *tp = port->p_tty; int error, s; - error = (*tp->t_linesw->l_ioctl)(tp, cmd, data, flag, p); + error = (*tp->t_linesw->l_ioctl)(tp, cmd, data, flag, l); if (error != EPASSTHROUGH) return (error); - error = ttioctl(tp, cmd, data, flag, p); + error = ttioctl(tp, cmd, data, flag, l); if (error != EPASSTHROUGH) return (error); @@ -735,7 +727,7 @@ cdtty_loadchannelregs(struct cd18xx_soft if (cd18xx_wait_ccr(sc)) { DPRINTF(CDD_INFO, ("%s: cdtty_loadchannelregs ccr wait timed out\n", - device_xname(&sc->sc_dev))); + device_xname(sc->sc_dev))); } cd18xx_write(sc, CD18xx_CCR, p->p_chanctl); } @@ -1073,7 +1065,7 @@ cd18xx_rint(struct cd18xx_softc *sc, int /* work out the channel and softc */ channel = cd18xx_get_gscr1_channel(sc); p = &sc->sc_ports[channel]; - DPRINTF(CDD_INTR, ("%s: rint: channel %d", device_xname(&sc->sc_dev), channel)); + DPRINTF(CDD_INTR, ("%s: rint: channel %d", device_xname(sc->sc_dev), channel)); GOTINTR(sc, p); end = p->p_ebuf; @@ -1147,7 +1139,7 @@ cd18xx_tint(struct cd18xx_softc *sc, int /* work out the channel and softc */ channel = cd18xx_get_gscr1_channel(sc); p = &sc->sc_ports[channel]; - DPRINTF(CDD_INTR, ("%s: tint: channel %d", device_xname(&sc->sc_dev), + DPRINTF(CDD_INTR, ("%s: tint: channel %d", device_xname(sc->sc_dev), channel)); GOTINTR(sc, p); @@ -1226,7 +1218,7 @@ cd18xx_mint(struct cd18xx_softc *sc, int /* work out the channel and softc */ channel = cd18xx_get_gscr1_channel(sc); p = &sc->sc_ports[channel]; - DPRINTF(CDD_INTR, ("%s: mint: channel %d", device_xname(&sc->sc_dev), channel)); + DPRINTF(CDD_INTR, ("%s: mint: channel %d", device_xname(sc->sc_dev), channel)); GOTINTR(sc, p); /* @@ -1291,7 +1283,7 @@ cd18xx_hardintr(void *v) if (sc == NULL) continue; - DPRINTF(CDD_INTR, ("%s:", device_xname(&sc->sc_dev))); + DPRINTF(CDD_INTR, ("%s:", device_xname(sc->sc_dev))); while (count-- && (status = (cd18xx_read(sc, CD18xx_SRSR) & CD18xx_SRSR_PENDING))) { Index: sys/dev/ic/cd18xxvar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/ic/cd18xxvar.h,v retrieving revision 1.3 diff -u -p -r1.3 cd18xxvar.h --- sys/dev/ic/cd18xxvar.h 18 Jul 2011 00:58:51 -0000 1.3 +++ sys/dev/ic/cd18xxvar.h 26 Sep 2012 18:37:43 -0000 @@ -97,6 +97,8 @@ struct cdtty_port { /* softc allocated per-cd18xx */ struct cd18xx_softc { + device_t sc_dev; + /* tag and handle for our registers (128 bytes) */ bus_space_tag_t sc_tag; bus_space_handle_t sc_handle; Index: sys/dev/ic/ciss.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/ic/ciss.c,v retrieving revision 1.28 diff -u -p -r1.28 ciss.c --- sys/dev/ic/ciss.c 23 Sep 2012 01:13:52 -0000 1.28 +++ sys/dev/ic/ciss.c 29 Sep 2012 11:54:07 -0000 @@ -335,7 +335,7 @@ ciss_attach(struct ciss_softc *sc) /* map LDs */ if (ciss_ldmap(sc)) { - aprint_error_dev(&sc->sc_dev, "adapter LD map failed\n"); + aprint_error_dev(sc->sc_dev, "adapter LD map failed\n"); bus_dmamem_free(sc->sc_dmat, sc->cmdseg, 1); bus_dmamap_destroy(sc->sc_dmat, sc->cmdmap); return -1; @@ -371,14 +371,14 @@ ciss_attach(struct ciss_softc *sc) sc->sc_channel.chan_flags = 0; sc->sc_channel.chan_id = sc->maxunits; - sc->sc_adapter.adapt_dev = (device_t) sc; + sc->sc_adapter.adapt_dev = sc->sc_dev; sc->sc_adapter.adapt_openings = sc->sc_channel.chan_openings; sc->sc_adapter.adapt_max_periph = min(sc->sc_adapter.adapt_openings, 256); sc->sc_adapter.adapt_request = ciss_scsi_cmd; sc->sc_adapter.adapt_minphys = cissminphys; sc->sc_adapter.adapt_ioctl = ciss_scsi_ioctl; sc->sc_adapter.adapt_nchannels = 1; - config_found(&sc->sc_dev, &sc->sc_channel, scsiprint); + config_found(sc->sc_dev, &sc->sc_channel, scsiprint); #if 0 sc->sc_link_raw.adapter_softc = sc; @@ -386,7 +386,7 @@ ciss_attach(struct ciss_softc *sc) sc->sc_link_raw.adapter = &ciss_raw_switch; sc->sc_link_raw.adapter_target = sc->ndrives; sc->sc_link_raw.adapter_buswidth = sc->ndrives; - config_found(&sc->sc_dev, &sc->sc_channel, scsiprint); + config_found(sc->sc_dev, &sc->sc_channel, scsiprint); #endif #if NBIO > 0 @@ -398,12 +398,12 @@ ciss_attach(struct ciss_softc *sc) return 0; } - if (bio_register(&sc->sc_dev, ciss_ioctl) != 0) - aprint_error_dev(&sc->sc_dev, "controller registration failed"); + if (bio_register(sc->sc_dev, ciss_ioctl) != 0) + aprint_error_dev(sc->sc_dev, "controller registration failed"); else sc->sc_ioctl = ciss_ioctl; if (ciss_create_sensors(sc) != 0) - aprint_error_dev(&sc->sc_dev, "unable to create sensors"); + aprint_error_dev(sc->sc_dev, "unable to create sensors"); #endif sc->sc_waitflag = 0; /* we can sleep now */ @@ -448,7 +448,7 @@ ciss_cmd(struct ciss_ccb *ccb, int flags int i, tohz, error = 0; if (ccb->ccb_state != CISS_CCB_READY) { - printf("%s: ccb %d not ready state=0x%x\n", device_xname(&sc->sc_dev), + printf("%s: ccb %d not ready state=0x%x\n", device_xname(sc->sc_dev), cmd->id, ccb->ccb_state); return (EINVAL); } @@ -589,7 +589,7 @@ ciss_done(struct ciss_ccb *ccb) if (ccb->ccb_state != CISS_CCB_ONQ) { printf("%s: unqueued ccb %p ready, state=0x%x\n", - device_xname(&sc->sc_dev), ccb, ccb->ccb_state); + device_xname(sc->sc_dev), ccb, ccb->ccb_state); return 1; } @@ -646,7 +646,7 @@ ciss_error(struct ciss_ccb *ccb) if (xs == NULL || xs->cmd->opcode != SCSI_SYNCHRONIZE_CACHE_10) printf("%s: invalid cmd 0x%x: 0x%x is not valid @ 0x%x[%d]\n", - device_xname(&sc->sc_dev), ccb->ccb_cmd.id, + device_xname(sc->sc_dev), ccb->ccb_cmd.id, err->err_info, err->err_type[3], err->err_type[2]); if (xs) { memset(&xs->sense, 0, sizeof(xs->sense)); @@ -688,7 +688,7 @@ ciss_error(struct ciss_ccb *ccb) default: CISS_DPRINTF(CISS_D_ERR, ("%s: " "cmd_stat=%x scsi_stat=0x%x resid=0x%x\n", - device_xname(&sc->sc_dev), rv, err->scsi_stat, + device_xname(sc->sc_dev), rv, err->scsi_stat, le32toh(err->resid))); printf("ciss driver stuffup in %s:%d: %s()\n", __FILE__, __LINE__, __func__); @@ -1174,7 +1174,7 @@ ciss_ioctl(device_t dev, u_long cmd, voi switch (cmd) { case BIOCINQ: bi = (struct bioc_inq *)addr; - strlcpy(bi->bi_dev, device_xname(&sc->sc_dev), sizeof(bi->bi_dev)); + strlcpy(bi->bi_dev, device_xname(sc->sc_dev), sizeof(bi->bi_dev)); bi->bi_novol = sc->maxunits; bi->bi_nodisk = sc->sc_lds[0]->ndrives; break; @@ -1419,7 +1419,7 @@ ciss_create_sensors(struct ciss_softc *s sc->sc_sensor = malloc(sizeof(envsys_data_t) * nsensors, M_DEVBUF, M_NOWAIT | M_ZERO); if (sc->sc_sensor == NULL) { - aprint_error_dev(&sc->sc_dev, "can't allocate envsys_data"); + aprint_error_dev(sc->sc_dev, "can't allocate envsys_data"); return(ENOMEM); } @@ -1432,18 +1432,18 @@ ciss_create_sensors(struct ciss_softc *s /* logical drives */ snprintf(sc->sc_sensor[i].desc, sizeof(sc->sc_sensor[i].desc), "%s:%d", - device_xname(&sc->sc_dev), i); + device_xname(sc->sc_dev), i); if (sysmon_envsys_sensor_attach(sc->sc_sme, &sc->sc_sensor[i])) goto out; } - sc->sc_sme->sme_name = device_xname(&sc->sc_dev); + sc->sc_sme->sme_name = device_xname(sc->sc_dev); sc->sc_sme->sme_cookie = sc; sc->sc_sme->sme_refresh = ciss_sensor_refresh; if (sysmon_envsys_register(sc->sc_sme)) { printf("%s: unable to register with sysmon\n", - device_xname(&sc->sc_dev)); + device_xname(sc->sc_dev)); return(1); } return (0); Index: sys/dev/ic/cissvar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/ic/cissvar.h,v retrieving revision 1.4 diff -u -p -r1.4 cissvar.h --- sys/dev/ic/cissvar.h 12 May 2009 14:25:17 -0000 1.4 +++ sys/dev/ic/cissvar.h 26 Sep 2012 23:28:35 -0000 @@ -33,7 +33,7 @@ struct ciss_ld { struct ciss_softc { /* Generic device info. */ - struct device sc_dev; + device_t sc_dev; kmutex_t sc_mutex; kmutex_t sc_mutex_scratch; bus_space_handle_t sc_ioh; Index: sys/dev/ic/clmpcc.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/ic/clmpcc.c,v retrieving revision 1.45 diff -u -p -r1.45 clmpcc.c --- sys/dev/ic/clmpcc.c 1 Oct 2011 15:59:01 -0000 1.45 +++ sys/dev/ic/clmpcc.c 28 Sep 2012 20:01:59 -0000 @@ -220,7 +220,7 @@ clmpcc_channel_cmd(struct clmpcc_softc * if ( i == 0 ) printf("%s: channel %d command timeout (idle)\n", - device_xname(&sc->sc_dev), chan); + device_xname(sc->sc_dev), chan); clmpcc_wrreg(sc, CLMPCC_REG_CCR, cmd); } @@ -296,7 +296,7 @@ clmpcc_attach(struct clmpcc_softc *sc) ch->ch_ibuf = malloc(clmpcc_ibuf_size * 2, M_DEVBUF, M_NOWAIT); if ( ch->ch_ibuf == NULL ) { - aprint_error_dev(&sc->sc_dev, "(%d): unable to allocate ring buffer\n", + aprint_error_dev(sc->sc_dev, "(%d): unable to allocate ring buffer\n", chan); return; } @@ -307,7 +307,7 @@ clmpcc_attach(struct clmpcc_softc *sc) tty_attach(tp); } - aprint_error_dev(&sc->sc_dev, "%d channels available", + aprint_error_dev(sc->sc_dev, "%d channels available", CLMPCC_NUM_CHANS); if ( cons_sc == sc ) { printf(", console on channel %d.\n", cons_chan); @@ -368,7 +368,7 @@ clmpcc_init(struct clmpcc_softc *sc) * Watch out... If this chip is console, the message * probably won't be sent since we just reset it! */ - aprint_error_dev(&sc->sc_dev, "Failed to reset chip\n"); + aprint_error_dev(sc->sc_dev, "Failed to reset chip\n"); return -1; } Index: sys/dev/ic/clmpccvar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/ic/clmpccvar.h,v retrieving revision 1.12 diff -u -p -r1.12 clmpccvar.h --- sys/dev/ic/clmpccvar.h 28 Apr 2008 20:23:49 -0000 1.12 +++ sys/dev/ic/clmpccvar.h 28 Sep 2012 20:01:31 -0000 @@ -89,7 +89,7 @@ struct clmpcc_chan { struct clmpcc_softc { - struct device sc_dev; + device_t sc_dev; /* * The bus/MD-specific attachment code must initialise the Index: sys/dev/ic/daic.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/ic/daic.c,v retrieving revision 1.30 diff -u -p -r1.30 daic.c --- sys/dev/ic/daic.c 27 Jul 2010 08:07:36 -0000 1.30 +++ sys/dev/ic/daic.c 26 Sep 2012 18:37:43 -0000 @@ -173,9 +173,9 @@ daic_attach(device_t self, struct daic_s } printf("\n"); - printf("%s: EICON.Diehl %s\n", device_xname(&sc->sc_dev), + printf("%s: EICON.Diehl %s\n", device_xname(sc->sc_dev), cardtypename(sc->sc_cardtype)); - printf("%s: %d kByte on board RAM\n", device_xname(&sc->sc_dev), memsize); + printf("%s: %d kByte on board RAM\n", device_xname(sc->sc_dev), memsize); num_ports = sc->sc_cardtype == DAIC_TYPE_QUAD ? 4 : 1; for (i = 0; i < num_ports; i++) sc->sc_port[i].du_state = DAIC_STATE_DOWNLOAD; @@ -235,7 +235,7 @@ daic_handle_intr(struct daic_softc *sc, } goto check_ind; } else if ((rc & DAIC_RC_ASSIGN_MASK) == DAIC_RC_ASSIGN_RC) { - aprint_error_dev(&sc->sc_dev, "assign request failed, error 0x%02x: %s\n", + aprint_error_dev(sc->sc_dev, "assign request failed, error 0x%02x: %s\n", rc & DAIC_RC_ERRMASK, err_codes[rc & DAIC_RC_ERRMASK]); du->du_assign_res = 0; @@ -272,7 +272,7 @@ daic_handle_intr(struct daic_softc *sc, /* not found? */ printf("%s: unknown id 0x%02x got rc 0x%02x: %s\n", - device_xname(&sc->sc_dev), rcid, rc, + device_xname(sc->sc_dev), rcid, rc, err_codes[rc & DAIC_RC_ERRMASK]); req_done: @@ -292,7 +292,7 @@ check_ind: int i; printf("%s: got info indication\n", - device_xname(&sc->sc_dev)); + device_xname(sc->sc_dev)); for (i = 0; i < 48; i++) { if (!(i % 16)) @@ -302,10 +302,10 @@ check_ind: printf("\n"); } else if (ind == DAIC_IND_HANGUP) { printf("%s: got global HANGUP indication\n", - device_xname(&sc->sc_dev)); + device_xname(sc->sc_dev)); } else { printf("%s: unknown global indication: 0x%02x\n", - device_xname(&sc->sc_dev), ind); + device_xname(sc->sc_dev), ind); } goto ind_done; } @@ -313,11 +313,11 @@ check_ind: for (chan = 0; chan < 2; chan++) { if (indid == sc->sc_con[port*2+chan].dchan_inst) { printf("%s: D-Channel indication 0x%02x for channel %d\n", - device_xname(&sc->sc_dev), ind, chan); + device_xname(sc->sc_dev), ind, chan); goto ind_done; } else if (indid == sc->sc_con[port*2+chan].bchan_inst) { printf("%s: B-Channel indication 0x%02x for channel %d\n", - device_xname(&sc->sc_dev), ind, chan); + device_xname(sc->sc_dev), ind, chan); goto ind_done; } } @@ -325,13 +325,13 @@ check_ind: TAILQ_FOREACH(assoc, &sc->sc_outcalls[port], queue) { if (indid == assoc->dchan_id) { printf("%s: D-Channel indication 0x%02x for outgoing call with cdid %d\n", - device_xname(&sc->sc_dev), ind, assoc->cdid); + device_xname(sc->sc_dev), ind, assoc->cdid); goto ind_done; } } /* not found - something's wrong! */ - printf("%s: got ind 0x%02x for id 0x%02x\n", device_xname(&sc->sc_dev), ind, indid); + printf("%s: got ind 0x%02x for id 0x%02x\n", device_xname(sc->sc_dev), ind, indid); ind_done: bus_space_write_1(sc->sc_iot, sc->sc_ioh, DAIC_COM_IND+off, 0); @@ -383,10 +383,10 @@ daic_download(void *token, int count, st sw_id = p[1] | (p[2] << 8) | (p[3] << 16) | (p[4] << 24); if (sc->sc_cardtype == DAIC_TYPE_QUAD) printf("%s port %d: downloading %s\n", - device_xname(&sc->sc_dev), i, data[i].microcode+4); + device_xname(sc->sc_dev), i, data[i].microcode+4); else printf("%s: downloading %s\n", - device_xname(&sc->sc_dev), data[i].microcode+4); + device_xname(sc->sc_dev), data[i].microcode+4); x = splnet(); p = data[i].microcode; while (s > 0) { @@ -405,7 +405,7 @@ daic_download(void *token, int count, st } if (bus_space_read_1(sc->sc_iot, sc->sc_ioh, DAIC_BOOT_CTRL+off) != 0) { splx(x); - aprint_error_dev(&sc->sc_dev, "download of microcode failed\n"); + aprint_error_dev(sc->sc_dev, "download of microcode failed\n"); return EIO; } } @@ -430,7 +430,7 @@ daic_download(void *token, int count, st if (signature) { if (signature != DAIC_SIGNATURE_VALUE) { splx(x); - aprint_error_dev(&sc->sc_dev, "microcode signature bad: should be %04x, is %04x\n", + aprint_error_dev(sc->sc_dev, "microcode signature bad: should be %04x, is %04x\n", DAIC_SIGNATURE_VALUE,signature); return EIO; } @@ -452,7 +452,7 @@ daic_download(void *token, int count, st if (sc->sc_port[i].du_state != DAIC_STATE_RUNNING) { splx(x); printf("%s: download interrupt test timeout\n", - device_xname(&sc->sc_dev)); + device_xname(sc->sc_dev)); return EIO; } @@ -473,7 +473,7 @@ daic_download(void *token, int count, st tsleep(&sc->sc_port[i].du_request_res, 0, "daic request", 0); x = splnet(); if (sc->sc_port[i].du_request_res != DAIC_RC_OK) { - aprint_error_dev(&sc->sc_dev, "INDICATE request error (0x%02x): %s\n", + aprint_error_dev(sc->sc_dev, "INDICATE request error (0x%02x): %s\n", sc->sc_port[i].du_request_res, err_codes[sc->sc_port[i].du_request_res & DAIC_RC_ERRMASK]); splx(x); @@ -551,12 +551,12 @@ daic_diagnostic(void *token, struct isdn /* validate parameters */ if (req->cmd > DAIC_DIAG_MAXCMD) { - aprint_error_dev(&sc->sc_dev, "daic_diagnostic: illegal cmd %d\n", + aprint_error_dev(sc->sc_dev, "daic_diagnostic: illegal cmd %d\n", req->cmd); return EIO; } if (req->out_param_len > (DAIC_DIAG_DATA_SIZE+1)) { - aprint_error_dev(&sc->sc_dev, "daic_diagnostic: illegal out_param_len %d\n", + aprint_error_dev(sc->sc_dev, "daic_diagnostic: illegal out_param_len %d\n", req->out_param_len); return EIO; } @@ -574,9 +574,9 @@ daic_diagnostic(void *token, struct isdn }; /* create the d-channel task for this call */ - printf("%s: assigning id for pass-through call\n", device_xname(&sc->sc_dev)); + printf("%s: assigning id for pass-through call\n", device_xname(sc->sc_dev)); id = daic_assign(sc, port, DAIC_GLOBALID_DCHAN, sizeof(parms), parms); - printf("%s: got id 0x%02x\n", device_xname(&sc->sc_dev), id); + printf("%s: got id 0x%02x\n", device_xname(sc->sc_dev), id); #ifdef DAIC_DEBUG daic_dump_request(sc, port, DAIC_REQ_CALL, id, req->in_param_len, req->in_param); @@ -672,9 +672,9 @@ daic_register_port(struct daic_softc *sc /* make sure this hardware driver type is known to layer 4 */ if (sc->sc_cardtype == DAIC_TYPE_QUAD) snprintf(devname, sizeof(devname), "%s port %d", - device_xname(&sc->sc_dev), port); + device_xname(sc->sc_dev), port); else - strlcpy(devname, device_xname(&sc->sc_dev), sizeof(devname)); + strlcpy(devname, device_xname(sc->sc_dev), sizeof(devname)); snprintf(cardname, sizeof(cardname), "EICON.Diehl %s", cardtypename(sc->sc_cardtype)); l3drv = isdn_attach_isdnif( @@ -822,7 +822,7 @@ daic_dump_request(struct daic_softc *sc, { int i; printf("%s: request 0x%02x to task id 0x%02x:", - device_xname(&sc->sc_dev), req, id); + device_xname(sc->sc_dev), req, id); for (i = 0; i < parmsize; i++) { if (i % 16 == 0) printf("\n%02x:", i); @@ -968,7 +968,7 @@ daic_connect_request(struct call_desc *c *p++ = 0x85; } else { printf("%s: daic_connect_request for unknown bchan protocol 0x%x\n", - device_xname(&sc->sc_dev), cd->bprot); + device_xname(sc->sc_dev), cd->bprot); return; } if (cd->src_telno[0]) { @@ -1015,7 +1015,7 @@ daic_connect_request(struct call_desc *c splx(x); tsleep(assoc, 0, "daic call", 0); if (assoc->rc != DAIC_RC_OK) { - aprint_error_dev(&sc->sc_dev, "call request failed, error 0x%02x: %s\n", + aprint_error_dev(sc->sc_dev, "call request failed, error 0x%02x: %s\n", assoc->rc & DAIC_RC_ERRMASK, err_codes[assoc->rc & DAIC_RC_ERRMASK]); } Index: sys/dev/ic/daicvar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/ic/daicvar.h,v retrieving revision 1.11 diff -u -p -r1.11 daicvar.h --- sys/dev/ic/daicvar.h 12 May 2009 14:25:17 -0000 1.11 +++ sys/dev/ic/daicvar.h 26 Sep 2012 18:37:43 -0000 @@ -91,7 +91,7 @@ struct daic_unit { /* superclass of all softc structs for attachments, you should * always be able to cast an attachments device_t self to this. */ struct daic_softc { - struct device sc_dev; + device_t sc_dev; bus_space_tag_t sc_iot; /* bus identifier */ bus_space_handle_t sc_ioh; /* mem handle */ int sc_cardtype; /* variant of card */ Index: sys/dev/ic/dpt.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/ic/dpt.c,v retrieving revision 1.67 diff -u -p -r1.67 dpt.c --- sys/dev/ic/dpt.c 15 Mar 2012 18:35:20 -0000 1.67 +++ sys/dev/ic/dpt.c 26 Sep 2012 18:37:43 -0000 @@ -264,7 +264,7 @@ dpt_intr(void *cookie) if ((dpt_inb(sc, HA_AUX_STATUS) & HA_AUX_INTR) == 0) return (0); - printf("%s: no status\n", device_xname(&sc->sc_dv)); + printf("%s: no status\n", device_xname(sc->sc_dev)); /* Re-sync DMA map */ bus_dmamap_sync(sc->sc_dmat, sc->sc_dmamap, @@ -275,7 +275,7 @@ dpt_intr(void *cookie) /* Make sure CCB ID from status packet is realistic. */ if ((u_int)sp->sp_ccbid >= sc->sc_nccbs) { printf("%s: bogus status (returned CCB id %d)\n", - device_xname(&sc->sc_dv), sp->sp_ccbid); + device_xname(sc->sc_dev), sp->sp_ccbid); /* Ack the interrupt */ sp->sp_ccbid = -1; @@ -345,26 +345,26 @@ dpt_init(struct dpt_softc *sc, const cha if ((rv = bus_dmamem_alloc(sc->sc_dmat, mapsize, PAGE_SIZE, 0, &seg, 1, &rseg, BUS_DMA_NOWAIT)) != 0) { - aprint_error_dev(&sc->sc_dv, "unable to allocate CCBs, rv = %d\n", rv); + aprint_error_dev(sc->sc_dev, "unable to allocate CCBs, rv = %d\n", rv); return; } if ((rv = bus_dmamem_map(sc->sc_dmat, &seg, rseg, mapsize, (void **)&sc->sc_ccbs, BUS_DMA_NOWAIT|BUS_DMA_COHERENT)) != 0) { - aprint_error_dev(&sc->sc_dv, "unable to map CCBs, rv = %d\n", + aprint_error_dev(sc->sc_dev, "unable to map CCBs, rv = %d\n", rv); return; } if ((rv = bus_dmamap_create(sc->sc_dmat, mapsize, mapsize, 1, 0, BUS_DMA_NOWAIT, &sc->sc_dmamap)) != 0) { - aprint_error_dev(&sc->sc_dv, "unable to create CCB DMA map, rv = %d\n", rv); + aprint_error_dev(sc->sc_dev, "unable to create CCB DMA map, rv = %d\n", rv); return; } if ((rv = bus_dmamap_load(sc->sc_dmat, sc->sc_dmamap, sc->sc_ccbs, mapsize, NULL, BUS_DMA_NOWAIT)) != 0) { - aprint_error_dev(&sc->sc_dv, "unable to load CCB DMA map, rv = %d\n", rv); + aprint_error_dev(sc->sc_dev, "unable to load CCB DMA map, rv = %d\n", rv); return; } @@ -386,7 +386,7 @@ dpt_init(struct dpt_softc *sc, const cha BUS_DMA_NOWAIT | BUS_DMA_ALLOCNOW, &ccb->ccb_dmamap_xfer); if (rv) { - aprint_error_dev(&sc->sc_dv, "can't create ccb dmamap (%d)\n", rv); + aprint_error_dev(sc->sc_dev, "can't create ccb dmamap (%d)\n", rv); break; } @@ -397,10 +397,10 @@ dpt_init(struct dpt_softc *sc, const cha } if (i == 0) { - aprint_error_dev(&sc->sc_dv, "unable to create CCBs\n"); + aprint_error_dev(sc->sc_dev, "unable to create CCBs\n"); return; } else if (i != sc->sc_nccbs) { - aprint_error_dev(&sc->sc_dv, "%d/%d CCBs created!\n", + aprint_error_dev(sc->sc_dev, "%d/%d CCBs created!\n", i, sc->sc_nccbs); sc->sc_nccbs = i; } @@ -438,7 +438,7 @@ dpt_init(struct dpt_softc *sc, const cha aprint_normal("%s %s (%s)\n", vendor, dpt_cname[i + 1], model); if (intrstr != NULL) - aprint_normal_dev(&sc->sc_dv, "interrupting at %s\n", + aprint_normal_dev(sc->sc_dev, "interrupting at %s\n", intrstr); maxchannel = (ec->ec_feat3 & EC_F3_MAX_CHANNEL_MASK) >> @@ -446,7 +446,7 @@ dpt_init(struct dpt_softc *sc, const cha maxtarget = (ec->ec_feat3 & EC_F3_MAX_TARGET_MASK) >> EC_F3_MAX_TARGET_SHIFT; - aprint_normal_dev(&sc->sc_dv, "%d queued commands, %d channel(s), adapter on ID(s)", + aprint_normal_dev(sc->sc_dev, "%d queued commands, %d channel(s), adapter on ID(s)", sc->sc_nccbs, maxchannel + 1); for (i = 0; i <= maxchannel; i++) { @@ -460,12 +460,12 @@ dpt_init(struct dpt_softc *sc, const cha * this for each bus? */ if (dpt_cmd(sc, NULL, CP_IMMEDIATE, CPI_BUS_RESET)) - panic("%s: dpt_cmd failed", device_xname(&sc->sc_dv)); + panic("%s: dpt_cmd failed", device_xname(sc->sc_dev)); /* Fill in the scsipi_adapter. */ adapt = &sc->sc_adapt; memset(adapt, 0, sizeof(*adapt)); - adapt->adapt_dev = &sc->sc_dv; + adapt->adapt_dev = sc->sc_dev; adapt->adapt_nchannels = maxchannel + 1; adapt->adapt_openings = sc->sc_nccbs - 1; adapt->adapt_max_periph = sc->sc_nccbs - 1; @@ -482,7 +482,7 @@ dpt_init(struct dpt_softc *sc, const cha chan->chan_ntargets = maxtarget + 1; chan->chan_nluns = ec->ec_maxlun + 1; chan->chan_id = sc->sc_hbaid[i]; - config_found(&sc->sc_dv, chan, scsiprint); + config_found(sc->sc_dev, chan, scsiprint); } } @@ -510,7 +510,7 @@ dpt_readcfg(struct dpt_softc *sc) if (i == 0) { printf("%s: HBA not ready after reset (hba status:%02x)\n", - device_xname(&sc->sc_dv), dpt_inb(sc, HA_STATUS)); + device_xname(sc->sc_dev), dpt_inb(sc, HA_STATUS)); return (-1); } @@ -523,7 +523,7 @@ dpt_readcfg(struct dpt_softc *sc) if(dpt_inb(sc, HA_ERROR) != 'D' || dpt_inb(sc, HA_ERROR + 1) != 'P' || dpt_inb(sc, HA_ERROR + 2) != 'T') { - printf("%s: HBA not ready\n", device_xname(&sc->sc_dv)); + printf("%s: HBA not ready\n", device_xname(sc->sc_dev)); return (-1); } } @@ -543,7 +543,7 @@ dpt_readcfg(struct dpt_softc *sc) if (dpt_wait(sc, 0xFF, HA_ST_DATA_RDY, 2000)) { printf("%s: cfg data didn't appear (hba status:%02x)\n", - device_xname(&sc->sc_dv), dpt_inb(sc, HA_STATUS)); + device_xname(sc->sc_dev), dpt_inb(sc, HA_STATUS)); return (-1); } @@ -575,22 +575,22 @@ dpt_readcfg(struct dpt_softc *sc) ec->ec_hba[DPT_MAX_CHANNELS - 1] = 7; if ((dpt_inb(sc, HA_STATUS) & HA_ST_ERROR) != 0) { - aprint_error_dev(&sc->sc_dv, "HBA error\n"); + aprint_error_dev(sc->sc_dev, "HBA error\n"); return (-1); } if (memcmp(ec->ec_eatasig, "EATA", 4) != 0) { - aprint_error_dev(&sc->sc_dv, "EATA signature mismatch\n"); + aprint_error_dev(sc->sc_dev, "EATA signature mismatch\n"); return (-1); } if ((ec->ec_feat0 & EC_F0_HBA_VALID) == 0) { - aprint_error_dev(&sc->sc_dv, "ec_hba field invalid\n"); + aprint_error_dev(sc->sc_dev, "ec_hba field invalid\n"); return (-1); } if ((ec->ec_feat0 & EC_F0_DMA_SUPPORTED) == 0) { - aprint_error_dev(&sc->sc_dv, "DMA not supported\n"); + aprint_error_dev(sc->sc_dev, "DMA not supported\n"); return (-1); } @@ -741,7 +741,7 @@ dpt_ccb_done(struct dpt_softc *sc, struc break; default: printf("%s: HBA status %x\n", - device_xname(&sc->sc_dv), ccb->ccb_hba_status); + device_xname(sc->sc_dev), ccb->ccb_hba_status); xs->error = XS_DRIVER_STUFFUP; break; } @@ -806,7 +806,7 @@ dpt_ccb_abort(struct dpt_softc *sc, stru ccb->ccb_flg |= CCB_ABORT; /* Start the abort */ if (dpt_cmd(sc, ccb, CP_IMMEDIATE, CPI_SPEC_ABORT)) - aprint_error_dev(&sc->sc_dv, "dpt_cmd failed\n"); + aprint_error_dev(sc->sc_dev, "dpt_cmd failed\n"); } splx(s); @@ -843,7 +843,7 @@ dpt_ccb_map(struct dpt_softc *sc, struct break; default: xs->error = XS_DRIVER_STUFFUP; - printf("%s: error %d loading map\n", device_xname(&sc->sc_dv), rv); + printf("%s: error %d loading map\n", device_xname(sc->sc_dev), rv); break; } @@ -922,7 +922,7 @@ dpt_scsipi_request(struct scsipi_channel struct dpt_ccb *ccb; struct eata_cp *cp; - sc = (struct dpt_softc *)chan->chan_adapter->adapt_dev; + sc = device_private(chan->chan_adapter->adapt_dev); switch (req) { case ADAPTER_REQ_RUN_XFER: @@ -1006,7 +1006,7 @@ dpt_scsipi_request(struct scsipi_channel ccb->ccb_flg |= CCB_PRIVATE; if (dpt_cmd(sc, ccb, CP_DMA_CMD, 0)) { - aprint_error_dev(&sc->sc_dv, "dpt_cmd failed\n"); + aprint_error_dev(sc->sc_dev, "dpt_cmd failed\n"); xs->error = XS_DRIVER_STUFFUP; if (xs->datalen != 0) dpt_ccb_unmap(sc, ccb); @@ -1088,15 +1088,15 @@ dpt_hba_inquire(struct dpt_softc *sc, st /* Start the command and poll on completion. */ if (dpt_cmd(sc, ccb, CP_DMA_CMD, 0)) - panic("%s: dpt_cmd failed", device_xname(&sc->sc_dv)); + panic("%s: dpt_cmd failed", device_xname(sc->sc_dev)); if (dpt_ccb_poll(sc, ccb)) - panic("%s: inquiry timed out", device_xname(&sc->sc_dv)); + panic("%s: inquiry timed out", device_xname(sc->sc_dev)); if (ccb->ccb_hba_status != SP_HBA_NO_ERROR || ccb->ccb_scsi_status != SCSI_OK) panic("%s: inquiry failed (hba:%02x scsi:%02x)", - device_xname(&sc->sc_dv), ccb->ccb_hba_status, + device_xname(sc->sc_dev), ccb->ccb_hba_status, ccb->ccb_scsi_status); /* Sync up the DMA map and free CCB, returning. */ @@ -1153,7 +1153,7 @@ dptioctl(dev_t dev, u_long cmd, void *da if (IOCPARM_LEN(cmd) < sizeof(struct eata_ucp)) { DPRINTF(("%s: ucp %lu vs %lu bytes\n", - device_xname(&sc->sc_dv), IOCPARM_LEN(cmd), + device_xname(sc->sc_dev), IOCPARM_LEN(cmd), (unsigned long int)sizeof(struct eata_ucp))); return (EINVAL); } @@ -1165,7 +1165,7 @@ dptioctl(dev_t dev, u_long cmd, void *da return (rv); default: - DPRINTF(("%s: unknown ioctl %lx\n", device_xname(&sc->sc_dv), cmd)); + DPRINTF(("%s: unknown ioctl %lx\n", device_xname(sc->sc_dev), cmd)); return (ENOTTY); } @@ -1299,7 +1299,7 @@ dpt_passthrough(struct dpt_softc *sc, st datain = ((cp->cp_ctl0 & CP_C0_DATA_IN) != 0); if (ucp->ucp_datalen > DPT_MAX_XFER) { - DPRINTF(("%s: xfer too big\n", device_xname(&sc->sc_dv))); + DPRINTF(("%s: xfer too big\n", device_xname(sc->sc_dev))); dpt_ccb_free(sc, ccb); return (EFBIG); } @@ -1308,7 +1308,7 @@ dpt_passthrough(struct dpt_softc *sc, st BUS_DMA_WAITOK | BUS_DMA_STREAMING | (datain ? BUS_DMA_READ : BUS_DMA_WRITE)); if (rv != 0) { - DPRINTF(("%s: map failed; %d\n", device_xname(&sc->sc_dv), + DPRINTF(("%s: map failed; %d\n", device_xname(sc->sc_dev), rv)); dpt_ccb_free(sc, ccb); return (rv); @@ -1342,7 +1342,7 @@ dpt_passthrough(struct dpt_softc *sc, st bus_dmamap_sync(sc->sc_dmat, sc->sc_dmamap, sc->sc_stpoff, sizeof(struct eata_sp), BUS_DMASYNC_PREREAD); if (dpt_cmd(sc, ccb, CP_DMA_CMD, 0)) - panic("%s: dpt_cmd failed", device_xname(&sc->sc_dv)); + panic("%s: dpt_cmd failed", device_xname(sc->sc_dev)); tsleep(ccb, PWAIT, "dptucmd", 0); splx(s); @@ -1362,7 +1362,7 @@ dpt_passthrough(struct dpt_softc *sc, st rv = copyout(&sp, ucp->ucp_stataddr, sizeof(sp)); if (rv != 0) { DPRINTF(("%s: sp copyout() failed\n", - device_xname(&sc->sc_dv))); + device_xname(sc->sc_dev))); } } if (rv == 0 && ucp->ucp_senseaddr != NULL) { @@ -1370,7 +1370,7 @@ dpt_passthrough(struct dpt_softc *sc, st rv = copyout(&ccb->ccb_sense, ucp->ucp_senseaddr, i); if (rv != 0) { DPRINTF(("%s: sense copyout() failed\n", - device_xname(&sc->sc_dv))); + device_xname(sc->sc_dev))); } } Index: sys/dev/ic/dptvar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/ic/dptvar.h,v retrieving revision 1.15 diff -u -p -r1.15 dptvar.h --- sys/dev/ic/dptvar.h 7 Aug 2011 13:39:24 -0000 1.15 +++ sys/dev/ic/dptvar.h 26 Sep 2012 18:37:43 -0000 @@ -64,7 +64,7 @@ struct dpt_ccb { }; struct dpt_softc { - struct device sc_dv; /* generic device data */ + device_t sc_dev; /* generic device data */ kmutex_t sc_lock; struct scsipi_adapter sc_adapt; /* scsipi adapter */ struct scsipi_channel sc_chans[3]; /* each channel */ Index: sys/dev/ic/elink3.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/ic/elink3.c,v retrieving revision 1.133 diff -u -p -r1.133 elink3.c --- sys/dev/ic/elink3.c 22 Jul 2012 14:32:56 -0000 1.133 +++ sys/dev/ic/elink3.c 29 Sep 2012 11:40:50 -0000 @@ -1379,7 +1379,7 @@ epintr(void *arg) if ((status & INTR_LATCH) == 0) { #if 0 printf("%s: intr latch cleared\n", - device_xname(&sc->sc_dev)); + device_xname(sc->sc_dev)); #endif break; } @@ -1399,7 +1399,7 @@ epintr(void *arg) #if 0 status = bus_space_read_2(iot, ioh, ELINK_STATUS); - printf("%s: intr%s%s%s%s\n", device_xname(&sc->sc_dev), + printf("%s: intr%s%s%s%s\n", device_xname(sc->sc_dev), (status & RX_COMPLETE)?" RX_COMPLETE":"", (status & TX_COMPLETE)?" TX_COMPLETE":"", (status & TX_AVAIL)?" TX_AVAIL":"", Index: sys/dev/ic/hd64570var.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/ic/hd64570var.h,v retrieving revision 1.10 diff -u -p -r1.10 hd64570var.h --- sys/dev/ic/hd64570var.h 27 Jul 2010 19:40:16 -0000 1.10 +++ sys/dev/ic/hd64570var.h 26 Sep 2012 23:58:33 -0000 @@ -137,7 +137,7 @@ struct sca_port { * softc structure for the chip itself */ struct sca_softc { - struct device *sc_parent; /* our parent device, or NULL */ + device_t sc_parent; /* our parent device, or NULL */ int sc_numports; /* number of ports present */ u_int32_t sc_baseclock; /* the base operating clock */ Index: sys/dev/ic/hscx.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/ic/hscx.c,v retrieving revision 1.15 diff -u -p -r1.15 hscx.c --- sys/dev/ic/hscx.c 17 Jul 2011 20:54:51 -0000 1.15 +++ sys/dev/ic/hscx.c 28 Sep 2012 21:18:12 -0000 @@ -346,7 +346,7 @@ isic_hscx_irq(register struct isic_softc int len; int nextlen; - NDBGL1(L1_H_IRQ, "%s, chan %d - XPR, Tx Fifo Empty!", device_xname(&sc->sc_dev), h_chan); + NDBGL1(L1_H_IRQ, "%s, chan %d - XPR, Tx Fifo Empty!", device_xname(sc->sc_dev), h_chan); if(chan->out_mbuf_cur == NULL) /* last frame is transmitted */ { Index: sys/dev/ic/i82365.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/ic/i82365.c,v retrieving revision 1.114 diff -u -p -r1.114 i82365.c --- sys/dev/ic/i82365.c 26 Jul 2011 22:21:02 -0000 1.114 +++ sys/dev/ic/i82365.c 26 Sep 2012 18:37:43 -0000 @@ -236,7 +236,7 @@ pcic_attach(struct pcic_softc *sc) DPRINTF(("pcic ident regs:")); - self = &sc->dev; + self = sc->dev; mutex_init(&sc->sc_pcic_lock, MUTEX_DEFAULT, IPL_NONE); /* find and configure for the available sockets */ @@ -371,7 +371,7 @@ pcic_power(int why, void *arg) pcic_read(h, PCIC_CSC_INTR)); #endif DPRINTF(("%s: CSC_INTR was zero; reset to %s\n", - device_xname(&sc->dev), bitbuf)); + device_xname(sc->dev), bitbuf)); } /* @@ -411,7 +411,7 @@ pcic_attach_socket(struct pcic_handle *h locs[PCMCIABUSCF_CONTROLLER] = h->chip; locs[PCMCIABUSCF_SOCKET] = h->socket; - h->pcmcia = config_found_sm_loc(&sc->dev, "pcmciabus", locs, &paa, + h->pcmcia = config_found_sm_loc(sc->dev, "pcmciabus", locs, &paa, pcic_print, config_stdsubmatch); if (h->pcmcia == NULL) { h->flags &= ~PCIC_FLAG_SOCKETP; @@ -659,7 +659,7 @@ pcic_intr(void *arg) struct pcic_softc *sc = arg; int i, ret = 0; - DPRINTF(("%s: intr\n", device_xname(&sc->dev))); + DPRINTF(("%s: intr\n", device_xname(sc->dev))); for (i = 0; i < __arraycount(sc->handle); i++) if (sc->handle[i].flags & PCIC_FLAG_SOCKETP) @@ -1211,7 +1211,7 @@ pcic_chip_io_map(pcmcia_chipset_handle_t /* XXX wtf is this doing here? */ - printf("%s: port 0x%lx", device_xname(&sc->dev), (u_long) ioaddr); + printf("%s: port 0x%lx", device_xname(sc->dev), (u_long) ioaddr); if (size > 1) printf("-0x%lx", (u_long) ioaddr + (u_long) size - 1); printf("\n"); Index: sys/dev/ic/i82365var.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/ic/i82365var.h,v retrieving revision 1.31 diff -u -p -r1.31 i82365var.h --- sys/dev/ic/i82365var.h 17 Sep 2009 18:14:41 -0000 1.31 +++ sys/dev/ic/i82365var.h 26 Sep 2012 18:37:43 -0000 @@ -117,7 +117,7 @@ struct pcic_handle { #define PCIC_NSLOTS 4 struct pcic_softc { - struct device dev; + device_t dev; bus_space_tag_t memt; bus_space_handle_t memh; Index: sys/dev/ic/iavc.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/ic/iavc.c,v retrieving revision 1.8 diff -u -p -r1.8 iavc.c --- sys/dev/ic/iavc.c 23 Jan 2009 19:49:16 -0000 1.8 +++ sys/dev/ic/iavc.c 26 Sep 2012 23:41:09 -0000 @@ -321,7 +321,7 @@ int iavc_load(capi_softc_t *capi_sc, int iavc_softc_t *sc = (iavc_softc_t*) capi_sc->ctx; u_int8_t val; - aprint_debug_dev(&sc->sc_dev, "reset card ....\n"); + aprint_debug_dev(sc->sc_dev, "reset card ....\n"); if (sc->sc_dma) iavc_b1dma_reset(sc); /* PCI cards */ @@ -332,17 +332,17 @@ int iavc_load(capi_softc_t *capi_sc, int DELAY(1000); - aprint_debug_dev(&sc->sc_dev, "start loading %d bytes firmware\n", len); + aprint_debug_dev(sc->sc_dev, "start loading %d bytes firmware\n", len); while (len && b1io_save_put_byte(sc, *cp++) == 0) len--; if (len) { - aprint_error_dev(&sc->sc_dev, "loading failed, can't write to card, len = %d\n", len); + aprint_error_dev(sc->sc_dev, "loading failed, can't write to card, len = %d\n", len); return (EIO); } - aprint_debug_dev(&sc->sc_dev, "firmware loaded, wait for ACK\n"); + aprint_debug_dev(sc->sc_dev, "firmware loaded, wait for ACK\n"); if(sc->sc_capi.card_type == CARD_TYPEC_AVM_B1_ISA) iavc_put_byte(sc, SEND_POLL); @@ -353,7 +353,7 @@ int iavc_load(capi_softc_t *capi_sc, int DELAY(100); if (!iavc_rx_full(sc)) { - aprint_error_dev(&sc->sc_dev, "loading failed, no ack\n"); + aprint_error_dev(sc->sc_dev, "loading failed, no ack\n"); return (EIO); } @@ -361,11 +361,11 @@ int iavc_load(capi_softc_t *capi_sc, int if ((sc->sc_dma && val != RECEIVE_POLLDWORD) || (!sc->sc_dma && val != RECEIVE_POLL)) { - aprint_error_dev(&sc->sc_dev, "loading failed, bad ack = %02x\n", val); + aprint_error_dev(sc->sc_dev, "loading failed, bad ack = %02x\n", val); return (EIO); } - aprint_debug_dev(&sc->sc_dev, "got ACK = 0x%02x\n", val); + aprint_debug_dev(sc->sc_dev, "got ACK = 0x%02x\n", val); /* Start the DMA engine */ if (sc->sc_dma) { @@ -452,7 +452,7 @@ int iavc_release(capi_softc_t *capi_sc, u_int8_t *p; if (!m) { - aprint_error_dev(&sc->sc_dev, "can't get memory\n"); + aprint_error_dev(sc->sc_dev, "can't get memory\n"); return (ENOMEM); } @@ -477,7 +477,7 @@ int iavc_send(capi_softc_t *capi_sc, str iavc_softc_t *sc = (iavc_softc_t*) capi_sc->ctx; if (sc->sc_state != IAVC_UP) { - aprint_error_dev(&sc->sc_dev, "attempt to send before device up\n"); + aprint_error_dev(sc->sc_dev, "attempt to send before device up\n"); if (m->m_next) i4b_Bfreembuf(m->m_next); i4b_Dfreembuf(m); @@ -488,7 +488,7 @@ int iavc_send(capi_softc_t *capi_sc, str if (IF_QFULL(&sc->sc_txq)) { IF_DROP(&sc->sc_txq); - aprint_error_dev(&sc->sc_dev, "tx overflow, message dropped\n"); + aprint_error_dev(sc->sc_dev, "tx overflow, message dropped\n"); if (m->m_next) i4b_Bfreembuf(m->m_next); i4b_Dfreembuf(m); @@ -518,7 +518,7 @@ static int iavc_send_init(iavc_softc_t * int s; if (!m) { - aprint_error_dev(&sc->sc_dev, "can't get memory\n"); + aprint_error_dev(sc->sc_dev, "can't get memory\n"); return (ENOMEM); } @@ -591,7 +591,7 @@ static int iavc_receive_init(iavc_softc_ #if 0 { int len = 0; - printf("%s: rx_init: ", device_xname(&sc->sc_dev)); + printf("%s: rx_init: ", device_xname(sc->sc_dev)); while (len < Length) { printf(" %02x", p[len]); if (len && (len % 16) == 0) printf("\n"); @@ -617,14 +617,14 @@ static int iavc_receive_init(iavc_softc_ if (cardtype && serial && profile) { int nbch = ((profile[3]<<8) | profile[2]); - aprint_normal_dev(&sc->sc_dev, "AVM %s, s/n %s, %d chans, f/w rev %s, prot %s\n", + aprint_normal_dev(sc->sc_dev, "AVM %s, s/n %s, %d chans, f/w rev %s, prot %s\n", cardtype, serial, nbch, vers, prot); - aprint_verbose_dev(&sc->sc_dev, "%s\n", caps); + aprint_verbose_dev(sc->sc_dev, "%s\n", caps); capi_ll_control(&sc->sc_capi, CAPI_CTRL_PROFILE, (int) profile); } else { - printf("%s: no profile data in info response?\n", device_xname(&sc->sc_dev)); + printf("%s: no profile data in info response?\n", device_xname(sc->sc_dev)); } sc->sc_blocked = 1; /* controller will send START when ready */ @@ -637,10 +637,10 @@ static int iavc_receive_start(iavc_softc u_int8_t *p; if (sc->sc_blocked && sc->sc_state == IAVC_UP) - printf("%s: receive_start\n", device_xname(&sc->sc_dev)); + printf("%s: receive_start\n", device_xname(sc->sc_dev)); if (!m) { - aprint_error_dev(&sc->sc_dev, "can't get memory\n"); + aprint_error_dev(sc->sc_dev, "can't get memory\n"); return (ENOMEM); } @@ -655,7 +655,7 @@ static int iavc_receive_start(iavc_softc IF_PREPEND(&sc->sc_txq, m); NDBGL4(L4_IAVCDBG, "%s: blocked = %d, state = %d", - device_xname(&sc->sc_dev), sc->sc_blocked, sc->sc_state); + device_xname(sc->sc_dev), sc->sc_blocked, sc->sc_state); sc->sc_blocked = 0; iavc_start_tx(sc); @@ -671,7 +671,7 @@ static int iavc_receive_start(iavc_softc static int iavc_receive_stop(iavc_softc_t *sc) { - printf("%s: receive_stop\n", device_xname(&sc->sc_dev)); + printf("%s: receive_stop\n", device_xname(sc->sc_dev)); sc->sc_blocked = 1; return 0; } @@ -714,7 +714,7 @@ static int iavc_receive_task_ready(iavc_ { u_int32_t TaskId, Length; u_int8_t *p; - printf("%s: receive_task_ready\n", device_xname(&sc->sc_dev)); + printf("%s: receive_task_ready\n", device_xname(sc->sc_dev)); if (sc->sc_dma) { p = amcc_get_word(dmabuf, &TaskId); @@ -733,7 +733,7 @@ static int iavc_receive_debugmsg(iavc_so { u_int32_t Length; u_int8_t *p; - printf("%s: receive_debugmsg\n", device_xname(&sc->sc_dev)); + printf("%s: receive_debugmsg\n", device_xname(sc->sc_dev)); if (sc->sc_dma) { p = amcc_get_word(dmabuf, &Length); @@ -778,7 +778,7 @@ static int iavc_receive(iavc_softc_t *sc m = i4b_Dgetmbuf(Length); if (!m) { - aprint_error_dev(&sc->sc_dev, "can't get memory for receive\n"); + aprint_error_dev(sc->sc_dev, "can't get memory for receive\n"); return (ENOMEM); } @@ -788,7 +788,7 @@ static int iavc_receive(iavc_softc_t *sc { u_int8_t *p = mtod(m, u_int8_t*); int len = 0; - printf("%s: applid=%d, len=%d\n", device_xname(&sc->sc_dev), + printf("%s: applid=%d, len=%d\n", device_xname(sc->sc_dev), ApplId, Length); while (len < m->m_len) { printf(" %02x", p[len]); @@ -809,7 +809,7 @@ static int iavc_receive(iavc_softc_t *sc m->m_next = i4b_Bgetmbuf(Length); if (!m->m_next) { - aprint_error_dev(&sc->sc_dev, "can't get memory for receive\n"); + aprint_error_dev(sc->sc_dev, "can't get memory for receive\n"); i4b_Dfreembuf(m); return (ENOMEM); } @@ -937,7 +937,7 @@ static void iavc_handle_rx(iavc_softc_t break; default: - aprint_error_dev(&sc->sc_dev, "unknown msg %02x\n", cmd); + aprint_error_dev(sc->sc_dev, "unknown msg %02x\n", cmd); } } @@ -1070,7 +1070,7 @@ iavc_tx_ctrlmsg(iavc_softc_t *sc, struct u_int8_t *p = mtod(m, u_int8_t*) + 2; int len; - printf("%s: tx BDC msg, len = %d, msg =", device_xname(&sc->sc_dev), + printf("%s: tx BDC msg, len = %d, msg =", device_xname(sc->sc_dev), m->m_len-2); for (len = 0; len < m->m_len-2; len++) { printf(" %02x", *p++); Index: sys/dev/ic/iavcvar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/ic/iavcvar.h,v retrieving revision 1.4 diff -u -p -r1.4 iavcvar.h --- sys/dev/ic/iavcvar.h 4 Mar 2007 06:01:56 -0000 1.4 +++ sys/dev/ic/iavcvar.h 26 Sep 2012 23:40:03 -0000 @@ -40,7 +40,7 @@ #define IAVC_DMA_SIZE (128 + 2048) typedef struct iavc_softc { - struct device sc_dev; + device_t sc_dev; capi_softc_t sc_capi; bus_space_handle_t sc_mem_bh; Index: sys/dev/ic/icp.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/ic/icp.c,v retrieving revision 1.30 diff -u -p -r1.30 icp.c --- sys/dev/ic/icp.c 13 Nov 2010 13:52:01 -0000 1.30 +++ sys/dev/ic/icp.c 26 Sep 2012 23:43:27 -0000 @@ -135,7 +135,7 @@ icp_init(struct icp_softc *icp, const ch state = 0; if (intrstr != NULL) - aprint_normal_dev(&icp->icp_dv, "interrupting at %s\n", + aprint_normal_dev(icp->icp_dv, "interrupting at %s\n", intrstr); SIMPLEQ_INIT(&icp->icp_ccb_queue); @@ -149,28 +149,28 @@ icp_init(struct icp_softc *icp, const ch if (bus_dmamap_create(icp->icp_dmat, ICP_SCRATCH_SIZE, 1, ICP_SCRATCH_SIZE, 0, BUS_DMA_NOWAIT | BUS_DMA_ALLOCNOW, &icp->icp_scr_dmamap) != 0) { - aprint_error_dev(&icp->icp_dv, "cannot create scratch dmamap\n"); + aprint_error_dev(icp->icp_dv, "cannot create scratch dmamap\n"); return (1); } state++; if (bus_dmamem_alloc(icp->icp_dmat, ICP_SCRATCH_SIZE, PAGE_SIZE, 0, icp->icp_scr_seg, 1, &nsegs, BUS_DMA_NOWAIT) != 0) { - aprint_error_dev(&icp->icp_dv, "cannot alloc scratch dmamem\n"); + aprint_error_dev(icp->icp_dv, "cannot alloc scratch dmamem\n"); goto bail_out; } state++; if (bus_dmamem_map(icp->icp_dmat, icp->icp_scr_seg, nsegs, ICP_SCRATCH_SIZE, &icp->icp_scr, 0)) { - aprint_error_dev(&icp->icp_dv, "cannot map scratch dmamem\n"); + aprint_error_dev(icp->icp_dv, "cannot map scratch dmamem\n"); goto bail_out; } state++; if (bus_dmamap_load(icp->icp_dmat, icp->icp_scr_dmamap, icp->icp_scr, ICP_SCRATCH_SIZE, NULL, BUS_DMA_NOWAIT)) { - aprint_error_dev(&icp->icp_dv, "cannot load scratch dmamap\n"); + aprint_error_dev(icp->icp_dv, "cannot load scratch dmamap\n"); goto bail_out; } state++; @@ -180,7 +180,7 @@ icp_init(struct icp_softc *icp, const ch */ ic = malloc(sizeof(*ic) * ICP_NCCBS, M_DEVBUF, M_NOWAIT | M_ZERO); if ((icp->icp_ccbs = ic) == NULL) { - aprint_error_dev(&icp->icp_dv, "malloc() failed\n"); + aprint_error_dev(icp->icp_dv, "malloc() failed\n"); goto bail_out; } state++; @@ -202,7 +202,7 @@ icp_init(struct icp_softc *icp, const ch } #ifdef DIAGNOSTIC if (icp->icp_nccbs != ICP_NCCBS) - aprint_error_dev(&icp->icp_dv, "%d/%d CCBs usable\n", + aprint_error_dev(icp->icp_dv, "%d/%d CCBs usable\n", icp->icp_nccbs, ICP_NCCBS); #endif @@ -210,13 +210,13 @@ icp_init(struct icp_softc *icp, const ch * Initalize the controller. */ if (!icp_cmd(icp, ICP_SCREENSERVICE, ICP_INIT, 0, 0, 0)) { - aprint_error_dev(&icp->icp_dv, "screen service init error %d\n", + aprint_error_dev(icp->icp_dv, "screen service init error %d\n", icp->icp_status); goto bail_out; } if (!icp_cmd(icp, ICP_CACHESERVICE, ICP_INIT, ICP_LINUX_OS, 0, 0)) { - aprint_error_dev(&icp->icp_dv, "cache service init error %d\n", + aprint_error_dev(icp->icp_dv, "cache service init error %d\n", icp->icp_status); goto bail_out; } @@ -224,13 +224,13 @@ icp_init(struct icp_softc *icp, const ch icp_cmd(icp, ICP_CACHESERVICE, ICP_UNFREEZE_IO, 0, 0, 0); if (!icp_cmd(icp, ICP_CACHESERVICE, ICP_MOUNT, 0xffff, 1, 0)) { - aprint_error_dev(&icp->icp_dv, "cache service mount error %d\n", + aprint_error_dev(icp->icp_dv, "cache service mount error %d\n", icp->icp_status); goto bail_out; } if (!icp_cmd(icp, ICP_CACHESERVICE, ICP_INIT, ICP_LINUX_OS, 0, 0)) { - aprint_error_dev(&icp->icp_dv, "cache service post-mount init error %d\n", + aprint_error_dev(icp->icp_dv, "cache service post-mount init error %d\n", icp->icp_status); goto bail_out; } @@ -238,7 +238,7 @@ icp_init(struct icp_softc *icp, const ch icp->icp_fw_vers = icp->icp_service; if (!icp_cmd(icp, ICP_SCSIRAWSERVICE, ICP_INIT, 0, 0, 0)) { - aprint_error_dev(&icp->icp_dv, "raw service init error %d\n", + aprint_error_dev(icp->icp_dv, "raw service init error %d\n", icp->icp_status); goto bail_out; } @@ -254,7 +254,7 @@ icp_init(struct icp_softc *icp, const ch if ((feat & ICP_SCATTER_GATHER) == 0) { #ifdef DIAGNOSTIC - aprint_normal_dev(&icp->icp_dv, + aprint_normal_dev(icp->icp_dv, "scatter/gather not supported (raw service)\n"); #endif } else @@ -271,7 +271,7 @@ icp_init(struct icp_softc *icp, const ch if ((feat & ICP_SCATTER_GATHER) == 0) { #ifdef DIAGNOSTIC - aprint_normal_dev(&icp->icp_dv, + aprint_normal_dev(icp->icp_dv, "scatter/gather not supported (cache service)\n"); #endif } else @@ -282,12 +282,12 @@ icp_init(struct icp_softc *icp, const ch */ if (!icp_cmd(icp, ICP_CACHESERVICE, ICP_IOCTL, ICP_BOARD_INFO, ICP_INVALID_CHANNEL, sizeof(struct icp_binfo))) { - aprint_error_dev(&icp->icp_dv, "unable to retrive board info\n"); + aprint_error_dev(icp->icp_dv, "unable to retrive board info\n"); goto bail_out; } memcpy(&binfo, icp->icp_scr, sizeof(binfo)); - aprint_normal_dev(&icp->icp_dv, + aprint_normal_dev(icp->icp_dv, "model <%s>, firmware <%s>, %d channel(s), %dMB memory\n", binfo.bi_type_string, binfo.bi_raid_string, binfo.bi_chan_count, le32toh(binfo.bi_memsize) >> 20); @@ -351,7 +351,7 @@ icp_init(struct icp_softc *icp, const ch ICP_SCSI_CHAN_CNT | ICP_L_CTRL_PATTERN, ICP_IO_CHANNEL | ICP_INVALID_CHANNEL, sizeof(*gc))) { - aprint_error_dev(&icp->icp_dv, + aprint_error_dev(icp->icp_dv, "unable to get chan info"); goto bail_out; } @@ -368,7 +368,7 @@ icp_init(struct icp_softc *icp, const ch locs[ICPCF_UNIT] = j + ICPA_UNIT_SCSI; icp->icp_children[icpa.icpa_unit] = - config_found_sm_loc(&icp->icp_dv, "icp", locs, + config_found_sm_loc(icp->icp_dv, "icp", locs, &icpa, icp_print, config_stdsubmatch); } } @@ -386,7 +386,7 @@ icp_init(struct icp_softc *icp, const ch locs[ICPCF_UNIT] = j; icp->icp_children[icpa.icpa_unit] = - config_found_sm_loc(&icp->icp_dv, "icp", locs, + config_found_sm_loc(icp->icp_dv, "icp", locs, &icpa, icp_print, config_stdsubmatch); } } @@ -451,14 +451,14 @@ icp_rescan(struct icp_softc *icp, int un if (!icp_cmd(icp, ICP_CACHESERVICE, ICP_INFO, unit, 0, 0)) { #ifdef ICP_DEBUG printf("%s: rescan: unit %d ICP_INFO failed -> 0x%04x\n", - device_xname(&icp->icp_dv), unit, icp->icp_status); + device_xname(icp->icp_dv), unit, icp->icp_status); #endif goto gone; } if ((newsize = icp->icp_info) == 0) { #ifdef ICP_DEBUG printf("%s: rescan: unit %d has zero size\n", - device_xname(&icp->icp_dv), unit); + device_xname(icp->icp_dv), unit); #endif gone: /* @@ -481,14 +481,14 @@ icp_rescan(struct icp_softc *icp, int un else { #ifdef ICP_DEBUG printf("%s: rescan: unit %d ICP_DEVTYPE failed\n", - device_xname(&icp->icp_dv), unit); + device_xname(icp->icp_dv), unit); #endif newtype = 0; /* XXX? */ } #ifdef ICP_DEBUG printf("%s: rescan: unit %d old %u/%u, new %u/%u\n", - device_xname(&icp->icp_dv), unit, icp->icp_cdr[unit].cd_size, + device_xname(icp->icp_dv), unit, icp->icp_cdr[unit].cd_size, icp->icp_cdr[unit].cd_type, newsize, newtype); #endif @@ -511,7 +511,7 @@ icp_rescan(struct icp_softc *icp, int un locs[ICPCF_UNIT] = unit; - icp->icp_children[unit] = config_found_sm_loc(&icp->icp_dv, + icp->icp_children[unit] = config_found_sm_loc(icp->icp_dv, "icp", locs, &icpa, icp_print, config_stdsubmatch); } @@ -530,7 +530,7 @@ icp_rescan_all(struct icp_softc *icp) */ if (!icp_cmd(icp, ICP_CACHESERVICE, ICP_INIT, ICP_LINUX_OS, 0, 0)) { printf("%s: unable to re-initialize cache service for rescan\n", - device_xname(&icp->icp_dv)); + device_xname(icp->icp_dv)); return; } cdev_cnt = (u_int16_t) icp->icp_info; @@ -544,7 +544,7 @@ icp_rescan_all(struct icp_softc *icp) if (icp->icp_cdr[unit].cd_size != 0) { #ifdef ICP_DEBUG printf("%s: rescan all: unit %d < new cdev_cnt (%d)\n", - device_xname(&icp->icp_dv), unit, cdev_cnt); + device_xname(icp->icp_dv), unit, cdev_cnt); #endif icp->icp_ndevs--; icp->icp_cdr[unit].cd_size = 0; @@ -575,7 +575,7 @@ icp_recompute_openings(struct icp_softc #ifdef ICP_DEBUG printf("%s: %d device%s, %d openings per device\n", - device_xname(&icp->icp_dv), icp->icp_ndevs, + device_xname(icp->icp_dv), icp->icp_ndevs, icp->icp_ndevs == 1 ? "" : "s", icp->icp_openings); #endif @@ -636,18 +636,18 @@ icp_async_event(struct icp_softc *icp, i if ((icp->icp_fw_vers & 0xff) >= 0x1a) { icp->icp_evt.size = 0; icp->icp_evt.eu.async.ionode = - device_unit(&icp->icp_dv); + device_unit(icp->icp_dv); icp->icp_evt.eu.async.status = icp->icp_status; /* * Severity and event string are filled in by the * hardware interface interrupt handler. */ - printf("%s: %s\n", device_xname(&icp->icp_dv), + printf("%s: %s\n", device_xname(icp->icp_dv), icp->icp_evt.event_string); } else { icp->icp_evt.size = sizeof(icp->icp_evt.eu.async); icp->icp_evt.eu.async.ionode = - device_unit(&icp->icp_dv); + device_unit(icp->icp_dv); icp->icp_evt.eu.async.service = service; icp->icp_evt.eu.async.status = icp->icp_status; icp->icp_evt.eu.async.info = icp->icp_info; @@ -689,10 +689,10 @@ icp_intr(void *cookie) return (1); case ICP_SPEZINDEX: - aprint_error_dev(&icp->icp_dv, "uninitialized or unknown service (%d/%d)\n", + aprint_error_dev(icp->icp_dv, "uninitialized or unknown service (%d/%d)\n", ctx.info, ctx.info2); icp->icp_evt.size = sizeof(icp->icp_evt.eu.driver); - icp->icp_evt.eu.driver.ionode = device_unit(&icp->icp_dv); + icp->icp_evt.eu.driver.ionode = device_unit(icp->icp_dv); icp_store_event(icp, GDT_ES_DRIVER, 4, &icp->icp_evt); return (1); } @@ -722,7 +722,7 @@ icp_intr(void *cookie) switch (icp->icp_status) { case ICP_S_BSY: #ifdef ICP_DEBUG - printf("%s: ICP_S_BSY received\n", device_xname(&icp->icp_dv)); + printf("%s: ICP_S_BSY received\n", device_xname(icp->icp_dv)); #endif if (__predict_false((ic->ic_flags & IC_UCMD) != 0)) SIMPLEQ_INSERT_HEAD(&icp->icp_ucmd_queue, ic, ic_chain); @@ -755,7 +755,7 @@ struct icp_ucmd_ctx { void icp_ucmd_intr(struct icp_ccb *ic) { - struct icp_softc *icp = (void *) ic->ic_dv; + struct icp_softc *icp = device_private(ic->ic_dv); struct icp_ucmd_ctx *iu = ic->ic_context; gdt_ucmd_t *ucmd = iu->iu_ucmd; @@ -860,7 +860,7 @@ icp_ucmd(struct icp_softc *icp, gdt_ucmd if (ucmd->command.cmd_opcode == ICP_IOCTL) { cnt = ucmd->command.cmd_packet.ic.ic_bufsize; if (cnt > GDT_SCRATCH_SZ) { - aprint_error_dev(&icp->icp_dv, "scratch buffer too small (%d/%d)\n", + aprint_error_dev(icp->icp_dv, "scratch buffer too small (%d/%d)\n", GDT_SCRATCH_SZ, cnt); return (EINVAL); } @@ -868,7 +868,7 @@ icp_ucmd(struct icp_softc *icp, gdt_ucmd cnt = ucmd->command.cmd_packet.cc.cc_blockcnt * ICP_SECTOR_SIZE; if (cnt > GDT_SCRATCH_SZ) { - aprint_error_dev(&icp->icp_dv, "scratch buffer too small (%d/%d)\n", + aprint_error_dev(icp->icp_dv, "scratch buffer too small (%d/%d)\n", GDT_SCRATCH_SZ, cnt); return (EINVAL); } @@ -877,7 +877,7 @@ icp_ucmd(struct icp_softc *icp, gdt_ucmd cnt = ucmd->command.cmd_packet.rc.rc_sdlen + ucmd->command.cmd_packet.rc.rc_sense_len; if (cnt > GDT_SCRATCH_SZ) { - aprint_error_dev(&icp->icp_dv, "scratch buffer too small (%d/%d)\n", + aprint_error_dev(icp->icp_dv, "scratch buffer too small (%d/%d)\n", GDT_SCRATCH_SZ, cnt); return (EINVAL); } @@ -952,7 +952,7 @@ icp_ucmd(struct icp_softc *icp, gdt_ucmd * XXX just pull a number out of thin air. */ if (__predict_false((error = icp_ccb_wait_user(icp, ic, 30000)) != 0)) - aprint_error_dev(&icp->icp_dv, "error %d waiting for ucmd to complete\n", + aprint_error_dev(icp->icp_dv, "error %d waiting for ucmd to complete\n", error); /* icp_ucmd_intr() has updated ucmd. */ @@ -1138,7 +1138,7 @@ icp_ccb_poll(struct icp_softc *icp, stru DELAY(10); } if (timo == 0) { - printf("%s: submit: busy\n", device_xname(&icp->icp_dv)); + printf("%s: submit: busy\n", device_xname(icp->icp_dv)); return (EAGAIN); } @@ -1166,13 +1166,13 @@ icp_ccb_poll(struct icp_softc *icp, stru if (ic->ic_status != ICP_S_OK) { #ifdef ICP_DEBUG printf("%s: request failed; status=0x%04x\n", - device_xname(&icp->icp_dv), ic->ic_status); + device_xname(icp->icp_dv), ic->ic_status); #endif rv = EIO; } else rv = 0; } else { - aprint_error_dev(&icp->icp_dv, "command timed out\n"); + aprint_error_dev(icp->icp_dv, "command timed out\n"); rv = EIO; } @@ -1202,7 +1202,7 @@ icp_ccb_wait(struct icp_softc *icp, stru splx(s); if (ic->ic_status != ICP_S_OK) { - aprint_error_dev(&icp->icp_dv, "command failed; status=%x\n", + aprint_error_dev(icp->icp_dv, "command failed; status=%x\n", ic->ic_status); return (EIO); } @@ -1215,7 +1215,7 @@ icp_ccb_wait_user(struct icp_softc *icp, { int s, rv; - ic->ic_dv = &icp->icp_dv; + ic->ic_dv = icp->icp_dv; ic->ic_intr = icp_ucmd_intr; ic->ic_flags |= IC_UCMD; Index: sys/dev/ic/icpsp.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/ic/icpsp.c,v retrieving revision 1.24 diff -u -p -r1.24 icpsp.c --- sys/dev/ic/icpsp.c 13 Nov 2010 13:52:01 -0000 1.24 +++ sys/dev/ic/icpsp.c 29 Sep 2012 12:42:59 -0000 @@ -56,7 +56,7 @@ __KERNEL_RCSID(0, "$NetBSD: icpsp.c,v 1. #include struct icpsp_softc { - struct device sc_dv; + device_t sc_dv; struct scsipi_adapter sc_adapter; struct scsipi_channel sc_channel; int sc_busno; @@ -71,7 +71,7 @@ void icpsp_scsipi_request(struct scsipi_ void icpsp_adjqparam(device_t, int); -CFATTACH_DECL(icpsp, sizeof(struct icpsp_softc), +CFATTACH_DECL_NEW(icpsp, sizeof(struct icpsp_softc), icpsp_match, icpsp_attach, NULL, NULL); static const struct icp_servicecb icpsp_servicecb = { @@ -97,16 +97,17 @@ icpsp_attach(device_t parent, device_t s struct icp_softc *icp; icpa = (struct icp_attach_args *)aux; - sc = (struct icpsp_softc *)self; - icp = (struct icp_softc *)parent; + sc = device_private(self); + icp = device_private(parent); + sc->sc_dv = self; sc->sc_busno = icpa->icpa_unit - ICPA_UNIT_SCSI; sc->sc_openings = icp->icp_openings; printf(": physical SCSI channel %d\n", sc->sc_busno); icp_register_servicecb(icp, icpa->icpa_unit, &icpsp_servicecb); - sc->sc_adapter.adapt_dev = &sc->sc_dv; + sc->sc_adapter.adapt_dev = sc->sc_dv; sc->sc_adapter.adapt_nchannels = 1; sc->sc_adapter.adapt_openings = icp->icp_openings; sc->sc_adapter.adapt_max_periph = icp->icp_openings; @@ -137,8 +138,8 @@ icpsp_scsipi_request(struct scsipi_chann struct icp_ccb *ic; int rv, flags, s, soff; - sc = (void *)chan->chan_adapter->adapt_dev; - icp = (struct icp_softc *)device_parent(&sc->sc_dv); + sc = device_private(chan->chan_adapter->adapt_dev); + icp = device_private(device_parent(sc->sc_dv)); switch (req) { case ADAPTER_REQ_RUN_XFER: @@ -157,7 +158,7 @@ icpsp_scsipi_request(struct scsipi_chann #if defined(ICP_DEBUG) || defined(SCSIDEBUG) if (xs->cmdlen > sizeof(rc->rc_cdb)) - panic("%s: CDB too large", device_xname(&sc->sc_dv)); + panic("%s: CDB too large", device_xname(sc->sc_dv)); #endif /* @@ -228,7 +229,7 @@ icpsp_scsipi_request(struct scsipi_chann */ ic->ic_intr = icpsp_intr; ic->ic_context = xs; - ic->ic_dv = &sc->sc_dv; + ic->ic_dv = sc->sc_dv; if ((flags & XS_CTL_POLL) != 0) { s = splbio(); @@ -274,9 +275,9 @@ icpsp_intr(struct icp_ccb *ic) struct icp_softc *icp; int soff; - sc = (struct icpsp_softc *)ic->ic_dv; - xs = (struct scsipi_xfer *)ic->ic_context; - icp = (struct icp_softc *)device_parent(ic->ic_dv); + sc = device_private(ic->ic_dv); + xs = ic->ic_context; + icp = device_private(device_parent(ic->ic_dv)); soff = ICP_SCRATCH_SENSE + ic->ic_ident * sizeof(struct scsi_sense_data); @@ -298,7 +299,7 @@ icpsp_intr(struct icp_ccb *ic) case SCSI_OK: #ifdef DIAGNOSTIC printf("%s: error return (%d), but SCSI_OK?\n", - device_xname(&sc->sc_dv), icp->icp_info); + device_xname(sc->sc_dv), icp->icp_info); #endif xs->resid = 0; break; @@ -324,9 +325,9 @@ icpsp_intr(struct icp_ccb *ic) } void -icpsp_adjqparam(device_t dv, int openings) +icpsp_adjqparam(device_t self, int openings) { - struct icpsp_softc *sc = (struct icpsp_softc *) dv; + struct icpsp_softc *sc = device_private(self); int s; s = splbio(); Index: sys/dev/ic/icpvar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/ic/icpvar.h,v retrieving revision 1.12 diff -u -p -r1.12 icpvar.h --- sys/dev/ic/icpvar.h 12 May 2009 14:25:17 -0000 1.12 +++ sys/dev/ic/icpvar.h 2 Oct 2012 02:20:28 -0000 @@ -77,7 +77,7 @@ struct icp_ccb { u_int ic_xfer_size; bus_dmamap_t ic_xfer_map; struct icp_sg *ic_sg; - struct device *ic_dv; + device_t ic_dv; void *ic_context; void (*ic_intr)(struct icp_ccb *); struct icp_cmd ic_cmd; @@ -109,7 +109,7 @@ struct icp_servicecb { * Per-controller context. */ struct icp_softc { - struct device icp_dv; + device_t icp_dv; void *icp_ih; bus_dma_tag_t icp_dmat; bus_space_tag_t icp_dpmemt; @@ -126,7 +126,7 @@ struct icp_softc { u_int8_t icp_bus_id[ICP_MAXBUS]; struct icp_cachedrv icp_cdr[ICP_MAX_HDRIVES]; const struct icp_servicecb *icp_servicecb[ICP_MAX_HDRIVES + ICP_MAXBUS]; - struct device *icp_children[ICP_MAX_HDRIVES + ICP_MAXBUS]; + device_t icp_children[ICP_MAX_HDRIVES + ICP_MAXBUS]; int icp_ndevs; int icp_openings; int icp_features; Index: sys/dev/ic/iic_cpcbus.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/ic/iic_cpcbus.c,v retrieving revision 1.12 diff -u -p -r1.12 iic_cpcbus.c --- sys/dev/ic/iic_cpcbus.c 12 May 2009 14:25:17 -0000 1.12 +++ sys/dev/ic/iic_cpcbus.c 28 Sep 2012 19:35:06 -0000 @@ -41,7 +41,6 @@ __KERNEL_RCSID(0, "$NetBSD: iic_cpcbus.c #include struct iic_cpcbus_softc { - struct device sc_dev; bus_space_tag_t sc_iot; bus_space_handle_t sc_ioh; void *sc_ih; @@ -50,7 +49,7 @@ struct iic_cpcbus_softc { static int iic_cpcbus_match(device_t, cfdata_t, void *); static void iic_cpcbus_attach(device_t, device_t, void *); -CFATTACH_DECL(iic_cpcbus, sizeof(struct iic_cpcbus_softc), +CFATTACH_DECL_NEW(iic_cpcbus, sizeof(struct iic_cpcbus_softc), iic_cpcbus_match, iic_cpcbus_attach, NULL, NULL); int @@ -65,7 +64,7 @@ void iic_cpcbus_attach(device_t parent, device_t self, void *aux) { struct cpcbus_attach_args *caa = aux; - struct iic_cpcbus_softc *sc = (struct iic_cpcbus_softc *)self; + struct iic_cpcbus_softc *sc = device_private(self); sc->sc_iot = caa->cpca_tag; if (bus_space_map(sc->sc_iot, caa->cpca_addr, CPC_IIC_SIZE, 0, Index: sys/dev/ic/interwave.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/ic/interwave.c,v retrieving revision 1.36 diff -u -p -r1.36 interwave.c --- sys/dev/ic/interwave.c 24 Nov 2011 03:35:57 -0000 1.36 +++ sys/dev/ic/interwave.c 28 Sep 2012 19:46:08 -0000 @@ -215,8 +215,8 @@ iwattach(struct iw_softc *sc) iw_set_format(sc, AUDIO_ENCODING_ULAW, 0); iw_set_format(sc, AUDIO_ENCODING_ULAW, 1); printf("%s: interwave version %s\n", - device_xname(&sc->sc_dev), iw_device.version); - audio_attach_mi(sc->iw_hw_if, sc, &sc->sc_dev); + device_xname(sc->sc_dev), iw_device.version); + audio_attach_mi(sc->iw_hw_if, sc, sc->sc_dev); } int @@ -310,7 +310,7 @@ iw_meminit(struct iw_softc *sc) addr += RAM_STEP; } - printf("%s:", device_xname(&sc->sc_dev)); + printf("%s:", device_xname(sc->sc_dev)); for (i = 0; i < 4; i++) { iw_mempoke(sc, base, 0xAA); /* mark start of bank */ Index: sys/dev/ic/interwavevar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/ic/interwavevar.h,v retrieving revision 1.17 diff -u -p -r1.17 interwavevar.h --- sys/dev/ic/interwavevar.h 23 Nov 2011 23:07:32 -0000 1.17 +++ sys/dev/ic/interwavevar.h 28 Sep 2012 19:46:16 -0000 @@ -75,7 +75,7 @@ typedef struct iw_port_info { } iw_port_info_t; struct iw_softc { - struct device sc_dev; + device_t sc_dev; bus_space_tag_t sc_iot; /* bus cookie */ isa_chipset_tag_t sc_ic; kmutex_t sc_lock; Index: sys/dev/ic/isac.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/ic/isac.c,v retrieving revision 1.23 diff -u -p -r1.23 isac.c --- sys/dev/ic/isac.c 17 Jul 2011 20:54:51 -0000 1.23 +++ sys/dev/ic/isac.c 28 Sep 2012 21:20:10 -0000 @@ -96,7 +96,7 @@ void isic_isac_irq(struct isic_softc *sc, int ista) { register u_char c = 0; - NDBGL1(L1_F_MSG, "%s: ista = 0x%02x", device_xname(&sc->sc_dev), ista); + NDBGL1(L1_F_MSG, "%s: ista = 0x%02x", device_xname(sc->sc_dev), ista); if(ista & ISAC_ISTA_EXI) /* extended interrupt */ { @@ -121,24 +121,24 @@ isic_isac_irq(struct isic_softc *sc, int if(!(rsta & ISAC_RSTA_CRC)) /* CRC error */ { error++; - NDBGL1(L1_I_ERR, "%s: CRC error", device_xname(&sc->sc_dev)); + NDBGL1(L1_I_ERR, "%s: CRC error", device_xname(sc->sc_dev)); } if(rsta & ISAC_RSTA_RDO) /* ReceiveDataOverflow */ { error++; - NDBGL1(L1_I_ERR, "%s: Data Overrun error", device_xname(&sc->sc_dev)); + NDBGL1(L1_I_ERR, "%s: Data Overrun error", device_xname(sc->sc_dev)); } if(rsta & ISAC_RSTA_RAB) /* ReceiveABorted */ { error++; - NDBGL1(L1_I_ERR, "%s: Receive Aborted error", device_xname(&sc->sc_dev)); + NDBGL1(L1_I_ERR, "%s: Receive Aborted error", device_xname(sc->sc_dev)); } if(error == 0) { - NDBGL1(L1_I_ERR, "%s: RME unknown error, RSTA = 0x%02x!", device_xname(&sc->sc_dev), rsta); + NDBGL1(L1_I_ERR, "%s: RME unknown error, RSTA = 0x%02x!", device_xname(sc->sc_dev), rsta); } i4b_Dfreembuf(sc->sc_ibuf); Index: sys/dev/ic/isacsx.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/ic/isacsx.c,v retrieving revision 1.6 diff -u -p -r1.6 isacsx.c --- sys/dev/ic/isacsx.c 8 Apr 2008 12:07:26 -0000 1.6 +++ sys/dev/ic/isacsx.c 28 Sep 2012 21:19:26 -0000 @@ -100,13 +100,13 @@ isic_isacsx_irq(struct isic_softc *sc, i register u_char c = 0; register u_char istad = 0; - NDBGL1(L1_F_MSG, "%s: ista = 0x%02x", device_xname(&sc->sc_dev), ista); + NDBGL1(L1_F_MSG, "%s: ista = 0x%02x", device_xname(sc->sc_dev), ista); /* was it an HDLC interrupt ? */ if (ista & ISACSX_ISTA_ICD) { istad = ISAC_READ(I_ISTAD); - NDBGL1(L1_F_MSG, "%s: istad = 0x%02x", device_xname(&sc->sc_dev), istad); + NDBGL1(L1_F_MSG, "%s: istad = 0x%02x", device_xname(sc->sc_dev), istad); if(istad & (ISACSX_ISTAD_RFO|ISACSX_ISTAD_XMR|ISACSX_ISTAD_XDU)) { @@ -132,29 +132,29 @@ isic_isacsx_irq(struct isic_softc *sc, i if(!(rsta & ISACSX_RSTAD_VFR)) /* VFR error */ { error++; - NDBGL1(L1_I_ERR, "%s: Frame not valid error", device_xname(&sc->sc_dev)); + NDBGL1(L1_I_ERR, "%s: Frame not valid error", device_xname(sc->sc_dev)); } if(!(rsta & ISACSX_RSTAD_CRC)) /* CRC error */ { error++; - NDBGL1(L1_I_ERR, "%s: CRC error", device_xname(&sc->sc_dev)); + NDBGL1(L1_I_ERR, "%s: CRC error", device_xname(sc->sc_dev)); } if(rsta & ISACSX_RSTAD_RDO) /* ReceiveDataOverflow */ { error++; - NDBGL1(L1_I_ERR, "%s: Data Overrun error", device_xname(&sc->sc_dev)); + NDBGL1(L1_I_ERR, "%s: Data Overrun error", device_xname(sc->sc_dev)); } if(rsta & ISACSX_RSTAD_RAB) /* ReceiveABorted */ { error++; - NDBGL1(L1_I_ERR, "%s: Receive Aborted error", device_xname(&sc->sc_dev)); + NDBGL1(L1_I_ERR, "%s: Receive Aborted error", device_xname(sc->sc_dev)); } if(error == 0) - NDBGL1(L1_I_ERR, "%s: RME unknown error, RSTAD = 0x%02x!", device_xname(&sc->sc_dev), rsta); + NDBGL1(L1_I_ERR, "%s: RME unknown error, RSTAD = 0x%02x!", device_xname(sc->sc_dev), rsta); i4b_Dfreembuf(sc->sc_ibuf); @@ -645,7 +645,7 @@ isic_isacsx_recover(struct isic_softc *s * prints some stuff that might be helpful. */ - printf("%s: isic_isacsx_recover\n", device_xname(&sc->sc_dev)); + printf("%s: isic_isacsx_recover\n", device_xname(sc->sc_dev)); /* get isac irq status */ byte = ISAC_READ(I_ISTAD); Index: sys/dev/ic/isic.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/ic/isic.c,v retrieving revision 1.24 diff -u -p -r1.24 isic.c --- sys/dev/ic/isic.c 8 Apr 2008 12:07:26 -0000 1.24 +++ sys/dev/ic/isic.c 28 Sep 2012 19:38:36 -0000 @@ -195,7 +195,7 @@ isicintr(void *arg) if (isac_ista & 0xfe) isic_isac_irq(sc, isac_ista & 0xfe); if (isac_ista & 0x01) /* unexpected */ - aprint_error_dev(&sc->sc_dev, "unexpected ipac timer2 irq\n"); + aprint_error_dev(sc->sc_dev, "unexpected ipac timer2 irq\n"); was_ipac_irq = 1; } if(ipac_irq_stat & IPAC_ISTA_EXD) @@ -230,7 +230,7 @@ isic_attach_bri(struct isic_softc *sc, c { struct isdn_l3_driver * drv; - drv = isdn_attach_isdnif(device_xname(&sc->sc_dev), cardname, + drv = isdn_attach_isdnif(device_xname(sc->sc_dev), cardname, &sc->sc_l2, &isic_l3_driver, NBCH_BRI); sc->sc_l3token = drv; sc->sc_l2.driver = dchan_driver; Index: sys/dev/ic/isic_bchan.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/ic/isic_bchan.c,v retrieving revision 1.14 diff -u -p -r1.14 isic_bchan.c --- sys/dev/ic/isic_bchan.c 17 Jul 2011 20:54:51 -0000 1.14 +++ sys/dev/ic/isic_bchan.c 28 Sep 2012 19:38:55 -0000 @@ -100,7 +100,7 @@ isic_bchannel_setup(isdn_layer1token t, } NDBGL1(L1_BCHAN, "%s, channel=%d, %s", - device_xname(&sc->sc_dev), h_chan, activate ? "activate" : "deactivate"); + device_xname(sc->sc_dev), h_chan, activate ? "activate" : "deactivate"); /* general part */ Index: sys/dev/ic/isic_l1.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/ic/isic_l1.c,v retrieving revision 1.18 diff -u -p -r1.18 isic_l1.c --- sys/dev/ic/isic_l1.c 8 Apr 2008 12:07:26 -0000 1.18 +++ sys/dev/ic/isic_l1.c 28 Sep 2012 19:38:08 -0000 @@ -210,7 +210,7 @@ isic_std_ph_activate_req(isdn_layer1toke { struct isic_softc *sc = (struct isic_softc*)token; - NDBGL1(L1_PRIM, " %s ", device_xname(&sc->sc_dev)); + NDBGL1(L1_PRIM, " %s ", device_xname(sc->sc_dev)); isic_next_state(sc, EV_PHAR); return(0); } @@ -228,13 +228,13 @@ isic_std_mph_command_req(isdn_layer1toke switch(command) { case CMR_DOPEN: /* daemon running */ - NDBGL1(L1_PRIM, "%s, command = CMR_DOPEN", device_xname(&sc->sc_dev)); + NDBGL1(L1_PRIM, "%s, command = CMR_DOPEN", device_xname(sc->sc_dev)); sc->sc_intr_valid = ISIC_INTR_VALID; pass_down = 1; break; case CMR_DCLOSE: /* daemon not running */ - NDBGL1(L1_PRIM, "%s, command = CMR_DCLOSE", device_xname(&sc->sc_dev)); + NDBGL1(L1_PRIM, "%s, command = CMR_DCLOSE", device_xname(sc->sc_dev)); sc->sc_intr_valid = ISIC_INTR_DISABLED; isic_enable_intr(sc, 0); pass_down = 1; @@ -245,12 +245,12 @@ isic_std_mph_command_req(isdn_layer1toke break; case CMR_SETTRACE: - NDBGL1(L1_PRIM, "%s, command = CMR_SETTRACE, parm = %p", device_xname(&sc->sc_dev), parm); + NDBGL1(L1_PRIM, "%s, command = CMR_SETTRACE, parm = %p", device_xname(sc->sc_dev), parm); sc->sc_trace = (int)(unsigned long)parm; break; default: - NDBGL1(L1_ERROR, "ERROR, unknown command = %d, %s, parm = %p", command, device_xname(&sc->sc_dev), parm); + NDBGL1(L1_ERROR, "ERROR, unknown command = %d, %s, parm = %p", command, device_xname(sc->sc_dev), parm); break; } Index: sys/dev/ic/isic_l1.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/ic/isic_l1.h,v retrieving revision 1.20 diff -u -p -r1.20 isic_l1.h --- sys/dev/ic/isic_l1.h 11 Dec 2005 12:21:27 -0000 1.20 +++ sys/dev/ic/isic_l1.h 28 Sep 2012 19:37:36 -0000 @@ -154,7 +154,7 @@ typedef struct *---------------------------------------------------------------------------*/ struct isic_softc { - struct device sc_dev; + device_t sc_dev; void *sc_l3token; /* pointer to registered L3 instance */ struct l2_softc sc_l2; /* D-channel variables */ Index: sys/dev/ic/ld_aac.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/ic/ld_aac.c,v retrieving revision 1.26 diff -u -p -r1.26 ld_aac.c --- sys/dev/ic/ld_aac.c 2 Feb 2012 19:43:03 -0000 1.26 +++ sys/dev/ic/ld_aac.c 29 Sep 2012 12:44:41 -0000 @@ -299,7 +299,7 @@ ld_aac_dobio(struct ld_aac_softc *sc, vo } } } else { - ac->ac_device = (device_t)sc; + ac->ac_device = sc->sc_ld.sc_dv; ac->ac_context = bp; ac->ac_intr = ld_aac_intr; aac_ccb_enqueue(aac, ac); @@ -328,8 +328,8 @@ ld_aac_intr(struct aac_ccb *ac) u_int32_t status; bp = ac->ac_context; - sc = (struct ld_aac_softc *)ac->ac_device; - aac = device_private(device_parent(sc->sc_ld.sc_dv)); + sc = device_private(ac->ac_device); + aac = device_private(device_parent(ac->ac_device)); if ((bp->b_flags & B_READ) != 0) { brr = (struct aac_blockread_response *)&ac->ac_fib->data[0]; Index: sys/dev/ic/ld_icp.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/ic/ld_icp.c,v retrieving revision 1.25 diff -u -p -r1.25 ld_icp.c --- sys/dev/ic/ld_icp.c 2 Feb 2012 19:43:03 -0000 1.25 +++ sys/dev/ic/ld_icp.c 29 Sep 2012 11:26:59 -0000 @@ -292,7 +292,7 @@ ld_icp_intr(struct icp_ccb *ic) struct icp_softc *icp; bp = ic->ic_context; - sc = (struct ld_icp_softc *)device_private(ic->ic_dv); + sc = device_private(ic->ic_dv); icp = device_private(device_parent(sc->sc_ld.sc_dv)); if (ic->ic_status != ICP_S_OK) { @@ -302,7 +302,7 @@ ld_icp_intr(struct icp_ccb *ic) bp->b_resid = bp->b_bcount; icp->icp_evt.size = sizeof(icp->icp_evt.eu.sync); - icp->icp_evt.eu.sync.ionode = device_unit(&icp->icp_dv); + icp->icp_evt.eu.sync.ionode = device_unit(icp->icp_dv); icp->icp_evt.eu.sync.service = icp->icp_service; icp->icp_evt.eu.sync.status = icp->icp_status; icp->icp_evt.eu.sync.info = icp->icp_info; Index: sys/dev/ic/lemac.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/ic/lemac.c,v retrieving revision 1.40 diff -u -p -r1.40 lemac.c --- sys/dev/ic/lemac.c 2 Feb 2012 19:43:03 -0000 1.40 +++ sys/dev/ic/lemac.c 26 Sep 2012 21:06:03 -0000 @@ -978,7 +978,7 @@ lemac_ifattach( { struct ifnet * const ifp = &sc->sc_if; - strlcpy(ifp->if_xname, device_xname(&sc->sc_dv), IFNAMSIZ); + strlcpy(ifp->if_xname, device_xname(sc->sc_dev), IFNAMSIZ); lemac_reset(sc); @@ -1011,7 +1011,7 @@ lemac_ifattach( if_attach(ifp); ether_ifattach(ifp, sc->sc_enaddr); - rnd_attach_source(&sc->rnd_source, device_xname(&sc->sc_dv), + rnd_attach_source(&sc->rnd_source, device_xname(sc->sc_dev), RND_TYPE_NET, 0); ifmedia_init(&sc->sc_ifmedia, 0, Index: sys/dev/ic/lemacvar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/ic/lemacvar.h,v retrieving revision 1.11 diff -u -p -r1.11 lemacvar.h --- sys/dev/ic/lemacvar.h 2 Feb 2012 19:43:03 -0000 1.11 +++ sys/dev/ic/lemacvar.h 26 Sep 2012 21:03:21 -0000 @@ -34,7 +34,7 @@ * Ethernet status, per interface. */ typedef struct { - struct device sc_dv; + device_t sc_dev; void *sc_ih; void *sc_ats; struct ethercom sc_ec; Index: sys/dev/ic/lsi64854.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/ic/lsi64854.c,v retrieving revision 1.37 diff -u -p -r1.37 lsi64854.c --- sys/dev/ic/lsi64854.c 14 Nov 2010 06:30:59 -0000 1.37 +++ sys/dev/ic/lsi64854.c 29 Sep 2012 11:40:39 -0000 @@ -460,7 +460,7 @@ lsi64854_scsi_intr(void *arg) * another target. As such, don't print the warning. */ printf("%s: xfer (%d) > req (%d)\n", - device_xname(&sc->sc_dev), trans, sc->sc_dmasize); + device_xname(sc->sc_dev), trans, sc->sc_dmasize); #endif trans = sc->sc_dmasize; } Index: sys/dev/ic/mb86950.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/ic/mb86950.c,v retrieving revision 1.19 diff -u -p -r1.19 mb86950.c --- sys/dev/ic/mb86950.c 2 Feb 2012 19:43:03 -0000 1.19 +++ sys/dev/ic/mb86950.c 26 Sep 2012 23:11:00 -0000 @@ -192,7 +192,7 @@ mb86950_attach(struct mb86950_softc *sc, #ifdef DIAGNOSTIC if (myea == NULL) { printf("%s: ethernet address shouldn't be NULL\n", - device_xname(&sc->sc_dev)); + device_xname(sc->sc_dev)); panic("NULL ethernet address"); } #endif @@ -268,7 +268,7 @@ mb86950_config(struct mb86950_softc *sc, bus_space_handle_t bsh = sc->sc_bsh; /* Initialize ifnet structure. */ - 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 = mb86950_start; ifp->if_ioctl = mb86950_ioctl; @@ -293,7 +293,7 @@ mb86950_config(struct mb86950_softc *sc, ether_ifattach(ifp, sc->sc_enaddr); - rnd_attach_source(&sc->rnd_source, device_xname(&sc->sc_dev), + rnd_attach_source(&sc->rnd_source, device_xname(sc->sc_dev), RND_TYPE_NET, 0); /* XXX No! This doesn't work - DLCR6 of the mb86950 is different @@ -323,7 +323,7 @@ mb86950_config(struct mb86950_softc *sc, if (sc->rxb_num_pkt == 0) sc->rxb_num_pkt = 100; /* Print additional info when attached. */ - printf("%s: Ethernet address %s\n", device_xname(&sc->sc_dev), + printf("%s: Ethernet address %s\n", device_xname(sc->sc_dev), ether_sprintf(sc->sc_enaddr)); /* The attach is successful. */ @@ -373,7 +373,7 @@ mb86950_reset(struct mb86950_softc *sc) int s; s = splnet(); - log(LOG_ERR, "%s: device reset\n", device_xname(&sc->sc_dev)); + log(LOG_ERR, "%s: device reset\n", device_xname(sc->sc_dev)); mb86950_stop(sc); mb86950_init(sc); splx(s); @@ -396,21 +396,21 @@ mb86950_watchdog(struct ifnet *ifp) if (tstat & TX_CR_LOST) { if ((tstat & (TX_COL | TX_16COL)) == 0) { log(LOG_ERR, "%s: carrier lost\n", - device_xname(&sc->sc_dev)); + device_xname(sc->sc_dev)); } else { log(LOG_ERR, "%s: excessive collisions\n", - device_xname(&sc->sc_dev)); + device_xname(sc->sc_dev)); } } else if ((tstat & (TX_UNDERFLO | TX_BUS_WR_ERR)) != 0) { log(LOG_ERR, "%s: tx fifo underflow/overflow\n", - device_xname(&sc->sc_dev)); + device_xname(sc->sc_dev)); } else { log(LOG_ERR, "%s: transmit error\n", - device_xname(&sc->sc_dev)); + device_xname(sc->sc_dev)); } } else { - log(LOG_ERR, "%s: device timeout\n", device_xname(&sc->sc_dev)); + log(LOG_ERR, "%s: device timeout\n", device_xname(sc->sc_dev)); } /* Don't know how many packets are lost by this accident. @@ -501,7 +501,7 @@ mb86950_ioctl(struct ifnet *ifp, unsigne /* "ifconfig fe0 debug" to print register dump. */ if (ifp->if_flags & IFF_DEBUG) { log(LOG_INFO, "%s: SIOCSIFFLAGS(DEBUG)\n", - device_xname(&sc->sc_dev)); + device_xname(sc->sc_dev)); mb86950_dump(LOG_DEBUG, sc); } #endif @@ -580,7 +580,7 @@ mb86950_start(struct ifnet *ifp) /* XXX bus_space_barrier here ? */ if (bus_space_read_1(bst, bsh, DLCR_TX_STAT) & (TX_UNDERFLO | TX_BUS_WR_ERR)) { - log(LOG_ERR, "%s: tx fifo underflow/overflow\n", device_xname(&sc->sc_dev)); + log(LOG_ERR, "%s: tx fifo underflow/overflow\n", device_xname(sc->sc_dev)); } bus_space_write_2(bst, bsh, BMPR_TX_LENGTH, len | TRANSMIT_START); @@ -921,7 +921,7 @@ mb86950_enable(struct mb86950_softc *sc) if ((sc->sc_stat & ESTAR_STAT_ENABLED) == 0 && sc->sc_enable != NULL) { if ((*sc->sc_enable)(sc) != 0) { - aprint_error_dev(&sc->sc_dev, "device enable failed\n"); + aprint_error_dev(sc->sc_dev, "device enable failed\n"); return (EIO); } } Index: sys/dev/ic/mb86950var.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/ic/mb86950var.h,v retrieving revision 1.7 diff -u -p -r1.7 mb86950var.h --- sys/dev/ic/mb86950var.h 2 Feb 2012 19:43:03 -0000 1.7 +++ sys/dev/ic/mb86950var.h 26 Sep 2012 23:10:42 -0000 @@ -38,7 +38,7 @@ * EStar_softc: per line info and status */ struct mb86950_softc { - struct device sc_dev; + device_t sc_dev; struct ethercom sc_ec; /* ethernet common */ struct ifmedia sc_media; /* supported media information */ Index: sys/dev/ic/mlx.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/ic/mlx.c,v retrieving revision 1.59 diff -u -p -r1.59 mlx.c --- sys/dev/ic/mlx.c 13 Nov 2010 13:52:01 -0000 1.59 +++ sys/dev/ic/mlx.c 29 Sep 2012 12:45:46 -0000 @@ -262,7 +262,7 @@ mlx_init(struct mlx_softc *mlx, const ch TAILQ_INIT(&mlx->mlx_ccb_worklist); if (intrstr != NULL) - printf("%s: interrupting at %s\n", device_xname(&mlx->mlx_dv), + printf("%s: interrupting at %s\n", device_xname(mlx->mlx_dv), intrstr); /* @@ -272,26 +272,26 @@ mlx_init(struct mlx_softc *mlx, const ch if ((rv = bus_dmamem_alloc(mlx->mlx_dmat, size, PAGE_SIZE, 0, &seg, 1, &rseg, BUS_DMA_NOWAIT)) != 0) { - aprint_error_dev(&mlx->mlx_dv, "unable to allocate sglists, rv = %d\n", rv); + aprint_error_dev(mlx->mlx_dv, "unable to allocate sglists, rv = %d\n", rv); return; } if ((rv = bus_dmamem_map(mlx->mlx_dmat, &seg, rseg, size, (void **)&mlx->mlx_sgls, BUS_DMA_NOWAIT | BUS_DMA_COHERENT)) != 0) { - aprint_error_dev(&mlx->mlx_dv, "unable to map sglists, rv = %d\n", rv); + aprint_error_dev(mlx->mlx_dv, "unable to map sglists, rv = %d\n", rv); return; } if ((rv = bus_dmamap_create(mlx->mlx_dmat, size, 1, size, 0, BUS_DMA_NOWAIT, &mlx->mlx_dmamap)) != 0) { - aprint_error_dev(&mlx->mlx_dv, "unable to create sglist DMA map, rv = %d\n", rv); + aprint_error_dev(mlx->mlx_dv, "unable to create sglist DMA map, rv = %d\n", rv); return; } if ((rv = bus_dmamap_load(mlx->mlx_dmat, mlx->mlx_dmamap, mlx->mlx_sgls, size, NULL, BUS_DMA_NOWAIT)) != 0) { - aprint_error_dev(&mlx->mlx_dv, "unable to load sglist DMA map, rv = %d\n", rv); + aprint_error_dev(mlx->mlx_dv, "unable to load sglist DMA map, rv = %d\n", rv); return; } @@ -316,7 +316,7 @@ mlx_init(struct mlx_softc *mlx, const ch mlx_ccb_free(mlx, mc); } if (mlx->mlx_nccbs != MLX_MAX_QUEUECNT) - printf("%s: %d/%d CCBs usable\n", device_xname(&mlx->mlx_dv), + printf("%s: %d/%d CCBs usable\n", device_xname(mlx->mlx_dv), mlx->mlx_nccbs, MLX_MAX_QUEUECNT); /* Disable interrupts before we start talking to the controller */ @@ -324,9 +324,9 @@ mlx_init(struct mlx_softc *mlx, const ch /* If we've got a reset routine, then reset the controller now. */ if (mlx->mlx_reset != NULL) { - printf("%s: resetting controller...\n", device_xname(&mlx->mlx_dv)); + printf("%s: resetting controller...\n", device_xname(mlx->mlx_dv)); if ((*mlx->mlx_reset)(mlx) != 0) { - aprint_error_dev(&mlx->mlx_dv, "reset failed\n"); + aprint_error_dev(mlx->mlx_dv, "reset failed\n"); return; } } @@ -344,14 +344,14 @@ mlx_init(struct mlx_softc *mlx, const ch if (hscode == 0) { if (hsmsg != 0) printf("%s: initialization complete\n", - device_xname(&mlx->mlx_dv)); + device_xname(mlx->mlx_dv)); break; } /* Report first time around... */ if (hsmsg == 0) { printf("%s: initializing (may take some time)...\n", - device_xname(&mlx->mlx_dv)); + device_xname(mlx->mlx_dv)); hsmsg = 1; } @@ -374,7 +374,7 @@ mlx_init(struct mlx_softc *mlx, const ch me2 = mlx_enquire(mlx, MLX_CMD_ENQUIRY2, sizeof(struct mlx_enquiry2), NULL, 0); if (me2 == NULL) { - aprint_error_dev(&mlx->mlx_dv, "ENQUIRY2 failed\n"); + aprint_error_dev(mlx->mlx_dv, "ENQUIRY2 failed\n"); return; } @@ -399,7 +399,7 @@ mlx_init(struct mlx_softc *mlx, const ch meo = mlx_enquire(mlx, MLX_CMD_ENQUIRY_OLD, sizeof(struct mlx_enquiry_old), NULL, 0); if (meo == NULL) { - aprint_error_dev(&mlx->mlx_dv, "ENQUIRY_OLD failed\n"); + aprint_error_dev(mlx->mlx_dv, "ENQUIRY_OLD failed\n"); return; } ci->ci_firmware_id[0] = meo->me_fwmajor; @@ -450,9 +450,9 @@ mlx_init(struct mlx_softc *mlx, const ch if (wantfwstr != NULL) { printf("%s: WARNING: this f/w revision is not recommended\n", - device_xname(&mlx->mlx_dv)); + device_xname(mlx->mlx_dv)); printf("%s: WARNING: use revision %s or later\n", - device_xname(&mlx->mlx_dv), wantfwstr); + device_xname(mlx->mlx_dv), wantfwstr); } /* We don't (yet) know where the event log is up to. */ @@ -469,9 +469,9 @@ mlx_init(struct mlx_softc *mlx, const ch #ifdef DIAGNOSTIC if (mlx->mlx_max_queuecnt < MLX_NCCBS_CONTROL + MLX_MAX_DRIVES) printf("%s: WARNING: few CCBs available\n", - device_xname(&mlx->mlx_dv)); + device_xname(mlx->mlx_dv)); if (ci->ci_max_sg < MLX_MAX_SEGS) { - aprint_error_dev(&mlx->mlx_dv, "oops, not enough S/G segments\n"); + aprint_error_dev(mlx->mlx_dv, "oops, not enough S/G segments\n"); return; } #endif @@ -522,7 +522,7 @@ mlx_describe(struct mlx_softc *mlx) } printf("%s: DAC%s, %d channel%s, firmware %d.%02d-%c-%02d", - device_xname(&mlx->mlx_dv), model, ci->ci_nchan, + device_xname(mlx->mlx_dv), model, ci->ci_nchan, ci->ci_nchan > 1 ? "s" : "", ci->ci_firmware_id[0], ci->ci_firmware_id[1], ci->ci_firmware_id[3], ci->ci_firmware_id[2]); @@ -552,7 +552,7 @@ mlx_configure(struct mlx_softc *mlx, int meo = mlx_enquire(mlx, MLX_CMD_ENQUIRY_OLD, sizeof(struct mlx_enquiry_old), NULL, waitok); if (meo == NULL) { - aprint_error_dev(&mlx->mlx_dv, "ENQUIRY_OLD failed\n"); + aprint_error_dev(mlx->mlx_dv, "ENQUIRY_OLD failed\n"); goto out; } mlx->mlx_numsysdrives = meo->me_num_sys_drvs; @@ -561,7 +561,7 @@ mlx_configure(struct mlx_softc *mlx, int me = mlx_enquire(mlx, MLX_CMD_ENQUIRY, sizeof(struct mlx_enquiry), NULL, waitok); if (me == NULL) { - aprint_error_dev(&mlx->mlx_dv, "ENQUIRY failed\n"); + aprint_error_dev(mlx->mlx_dv, "ENQUIRY failed\n"); goto out; } mlx->mlx_numsysdrives = me->me_num_sys_drvs; @@ -571,7 +571,7 @@ mlx_configure(struct mlx_softc *mlx, int mes = mlx_enquire(mlx, MLX_CMD_ENQSYSDRIVE, sizeof(*mes) * MLX_MAX_DRIVES, NULL, waitok); if (mes == NULL) { - aprint_error_dev(&mlx->mlx_dv, "error fetching drive status\n"); + aprint_error_dev(mlx->mlx_dv, "error fetching drive status\n"); goto out; } @@ -609,7 +609,7 @@ mlx_configure(struct mlx_softc *mlx, int locs[MLXCF_UNIT] = i; - ms->ms_dv = config_found_sm_loc(&mlx->mlx_dv, "mlx", locs, + ms->ms_dv = config_found_sm_loc(mlx->mlx_dv, "mlx", locs, &mlxa, mlx_print, config_stdsubmatch); nunits += (ms->ms_dv != NULL); } @@ -667,7 +667,7 @@ mlx_adjqparam(struct mlx_softc *mlx, int for (i = 0; i < ld_cd.cd_ndevs; i++) { if ((ld = device_lookup_private(&ld_cd, i)) == NULL) continue; - if (device_parent(ld->sc_dv) != &mlx->mlx_dv) + if (device_parent(ld->sc_dv) != mlx->mlx_dv) continue; ldadjqparam(ld, mpu + (slop-- > 0)); } @@ -1052,14 +1052,14 @@ mlx_periodic_enquiry(struct mlx_ccb *mc) int i, j; u_int lsn; - mlx = (struct mlx_softc *)mc->mc_mx.mx_dv; + mlx = device_private(mc->mc_mx.mx_dv); mlx_ccb_unmap(mlx, mc); /* * Command completed OK? */ if (mc->mc_status != 0) { - aprint_error_dev(&mlx->mlx_dv, "periodic enquiry failed - %s\n", + aprint_error_dev(mlx->mlx_dv, "periodic enquiry failed - %s\n", mlx_ccb_diagnose(mc)); goto out; } @@ -1169,7 +1169,7 @@ mlx_periodic_enquiry(struct mlx_ccb *mc) break; } - printf("%s: unit %d %s\n", device_xname(&mlx->mlx_dv), + printf("%s: unit %d %s\n", device_xname(mlx->mlx_dv), i, statestr); /* Save new state. */ @@ -1181,7 +1181,7 @@ mlx_periodic_enquiry(struct mlx_ccb *mc) #ifdef DIAGNOSTIC default: printf("%s: mlx_periodic_enquiry: eh?\n", - device_xname(&mlx->mlx_dv)); + device_xname(mlx->mlx_dv)); break; #endif } @@ -1229,7 +1229,7 @@ mlx_periodic_eventlog_poll(struct mlx_so mlx->mlx_lastevent, 0, 0, mc->mc_xfer_phys, 0); mc->mc_mx.mx_handler = mlx_periodic_eventlog_respond; - mc->mc_mx.mx_dv = &mlx->mlx_dv; + mc->mc_mx.mx_dv = mlx->mlx_dv; mc->mc_mx.mx_context = result; /* Start the command. */ @@ -1257,7 +1257,7 @@ mlx_periodic_eventlog_respond(struct mlx const char *reason; u_int8_t sensekey, chan, targ; - mlx = (struct mlx_softc *)mc->mc_mx.mx_dv; + mlx = device_private(mc->mc_mx.mx_dv); el = mc->mc_mx.mx_context; mlx_ccb_unmap(mlx, mc); @@ -1288,7 +1288,7 @@ mlx_periodic_eventlog_respond(struct mlx reason = "for unknown reason"; printf("%s: physical drive %d:%d killed %s\n", - device_xname(&mlx->mlx_dv), chan, targ, reason); + device_xname(mlx->mlx_dv), chan, targ, reason); } /* @@ -1296,7 +1296,7 @@ mlx_periodic_eventlog_respond(struct mlx */ if (sensekey == 6 && el->el_asc == 0x29) printf("%s: physical drive %d:%d reset\n", - device_xname(&mlx->mlx_dv), chan, targ); + device_xname(mlx->mlx_dv), chan, targ); /* * SCSI drive error? @@ -1307,11 +1307,11 @@ mlx_periodic_eventlog_respond(struct mlx (el->el_asq == 0x01 || el->el_asq == 0x02)))) { printf("%s: physical drive %d:%d error log: " "sense = %d asc = %x asq = %x\n", - device_xname(&mlx->mlx_dv), chan, targ, sensekey, + device_xname(mlx->mlx_dv), chan, targ, sensekey, el->el_asc, el->el_asq); printf("%s: info = %d:%d:%d:%d " " csi = %d:%d:%d:%d\n", - device_xname(&mlx->mlx_dv), + device_xname(mlx->mlx_dv), el->el_information[0], el->el_information[1], el->el_information[2], @@ -1323,12 +1323,12 @@ mlx_periodic_eventlog_respond(struct mlx break; default: - aprint_error_dev(&mlx->mlx_dv, "unknown log message type 0x%x\n", + aprint_error_dev(mlx->mlx_dv, "unknown log message type 0x%x\n", el->el_type); break; } } else { - aprint_error_dev(&mlx->mlx_dv, "error reading message log - %s\n", + aprint_error_dev(mlx->mlx_dv, "error reading message log - %s\n", mlx_ccb_diagnose(mc)); /* @@ -1360,7 +1360,7 @@ mlx_periodic_rebuild(struct mlx_ccb *mc) const char *opstr; struct mlx_rebuild_status *mr; - mlx = (struct mlx_softc *)mc->mc_mx.mx_dv; + mlx = device_private(mc->mc_mx.mx_dv); mr = mc->mc_mx.mx_context; mlx_ccb_unmap(mlx, mc); @@ -1375,7 +1375,7 @@ mlx_periodic_rebuild(struct mlx_ccb *mc) if (mlx->mlx_bg == 0) { mlx->mlx_bg = MLX_BG_SPONTANEOUS; printf("%s: background check/rebuild started\n", - device_xname(&mlx->mlx_dv)); + device_xname(mlx->mlx_dv)); } break; @@ -1408,7 +1408,7 @@ mlx_periodic_rebuild(struct mlx_ccb *mc) } if (opstr != NULL) - printf("%s: %s completed\n", device_xname(&mlx->mlx_dv), + printf("%s: %s completed\n", device_xname(mlx->mlx_dv), opstr); mlx->mlx_bg = 0; @@ -1456,7 +1456,7 @@ mlx_pause_action(struct mlx_softc *mlx) for (i = 0; i < mlx->mlx_ci.ci_nchan; i++) { if ((1 << i) & mlx->mlx_pause.mp_which) { if (mlx_ccb_alloc(mlx, &mc, 1) != 0) { - aprint_error_dev(&mlx->mlx_dv, "%s failed for channel %d\n", + aprint_error_dev(mlx->mlx_dv, "%s failed for channel %d\n", cmd == MLX_CMD_STOPCHANNEL ? "pause" : "resume", i); continue; @@ -1466,7 +1466,7 @@ mlx_pause_action(struct mlx_softc *mlx) mlx_make_type2(mc, cmd, (failsafe << 4) | i, 0, 0, 0, 0, 0, 0, 0); mc->mc_mx.mx_handler = mlx_pause_done; - mc->mc_mx.mx_dv = &mlx->mlx_dv; + mc->mc_mx.mx_dv = mlx->mlx_dv; mlx_ccb_enqueue(mlx, mc); } @@ -1479,20 +1479,20 @@ mlx_pause_done(struct mlx_ccb *mc) struct mlx_softc *mlx; int command, channel; - mlx = (struct mlx_softc *)mc->mc_mx.mx_dv; + mlx = device_private(mc->mc_mx.mx_dv); command = mc->mc_mbox[0]; channel = mc->mc_mbox[2] & 0xf; if (mc->mc_status != 0) - aprint_error_dev(&mlx->mlx_dv, "%s command failed - %s\n", + aprint_error_dev(mlx->mlx_dv, "%s command failed - %s\n", command == MLX_CMD_STOPCHANNEL ? "pause" : "resume", mlx_ccb_diagnose(mc)); else if (command == MLX_CMD_STOPCHANNEL) printf("%s: channel %d pausing for %ld seconds\n", - device_xname(&mlx->mlx_dv), channel, + device_xname(mlx->mlx_dv), channel, (long)(mlx->mlx_pause.mp_howlong - time_second)); else - printf("%s: channel %d resuming\n", device_xname(&mlx->mlx_dv), + printf("%s: channel %d resuming\n", device_xname(mlx->mlx_dv), channel); mlx_ccb_free(mlx, mc); @@ -1538,7 +1538,7 @@ mlx_enquire(struct mlx_softc *mlx, int c /* Do we want a completion callback? */ if (handler != NULL) { mc->mc_mx.mx_context = result; - mc->mc_mx.mx_dv = &mlx->mlx_dv; + mc->mc_mx.mx_dv = mlx->mlx_dv; mc->mc_mx.mx_handler = handler; mlx_ccb_enqueue(mlx, mc); } else { @@ -1595,7 +1595,7 @@ mlx_flush(struct mlx_softc *mlx, int asy /* Command completed OK? */ if (mc->mc_status != 0) { - aprint_error_dev(&mlx->mlx_dv, "FLUSH failed - %s\n", + aprint_error_dev(mlx->mlx_dv, "FLUSH failed - %s\n", mlx_ccb_diagnose(mc)); rv = EIO; } @@ -1631,7 +1631,7 @@ mlx_check(struct mlx_softc *mlx, int dri /* Command completed OK? */ if (mc->mc_status != 0) - aprint_error_dev(&mlx->mlx_dv, "CHECK ASYNC failed - %s\n", + aprint_error_dev(mlx->mlx_dv, "CHECK ASYNC failed - %s\n", mlx_ccb_diagnose(mc)); else printf("%s: consistency check started", @@ -1670,7 +1670,7 @@ mlx_rebuild(struct mlx_softc *mlx, int c goto out; /* Command completed OK? */ - aprint_normal_dev(&mlx->mlx_dv, ""); + aprint_normal_dev(mlx->mlx_dv, ""); if (mc->mc_status != 0) printf("REBUILD ASYNC failed - %s\n", mlx_ccb_diagnose(mc)); else @@ -1978,13 +1978,13 @@ mlx_ccb_poll(struct mlx_softc *mlx, stru if (timo != 0) { if (mc->mc_status != 0) { - aprint_error_dev(&mlx->mlx_dv, "command failed - %s\n", + aprint_error_dev(mlx->mlx_dv, "command failed - %s\n", mlx_ccb_diagnose(mc)); rv = EIO; } else rv = 0; } else { - printf("%s: command timed out\n", device_xname(&mlx->mlx_dv)); + printf("%s: command timed out\n", device_xname(mlx->mlx_dv)); rv = EIO; } @@ -2009,7 +2009,7 @@ mlx_ccb_wait(struct mlx_softc *mlx, stru splx(s); if (mc->mc_status != 0) { - aprint_error_dev(&mlx->mlx_dv, "command failed - %s\n", + aprint_error_dev(mlx->mlx_dv, "command failed - %s\n", mlx_ccb_diagnose(mc)); return (EIO); } @@ -2094,14 +2094,14 @@ mlx_intr(void *cookie) ident--; if (ident >= MLX_MAX_QUEUECNT) { - aprint_error_dev(&mlx->mlx_dv, "bad completion returned\n"); + aprint_error_dev(mlx->mlx_dv, "bad completion returned\n"); continue; } mc = mlx->mlx_ccbs + ident; if (mc->mc_status != MLX_STATUS_BUSY) { - aprint_error_dev(&mlx->mlx_dv, "bad completion returned\n"); + aprint_error_dev(mlx->mlx_dv, "bad completion returned\n"); continue; } @@ -2147,7 +2147,7 @@ mlx_fw_message(struct mlx_softc *mlx, in */ if ((mlx->mlx_flags & MLXF_SPINUP_REPORTED) == 0) { printf("%s: spinning up drives...\n", - device_xname(&mlx->mlx_dv)); + device_xname(mlx->mlx_dv)); mlx->mlx_flags |= MLXF_SPINUP_REPORTED; } return (0); @@ -2181,16 +2181,16 @@ mlx_fw_message(struct mlx_softc *mlx, in break; case 0xf0: - aprint_error_dev(&mlx->mlx_dv, "FATAL MEMORY PARITY ERROR\n"); + aprint_error_dev(mlx->mlx_dv, "FATAL MEMORY PARITY ERROR\n"); return (1); default: - aprint_error_dev(&mlx->mlx_dv, "unknown firmware init error %02x:%02x:%02x\n", + aprint_error_dev(mlx->mlx_dv, "unknown firmware init error %02x:%02x:%02x\n", error, param1, param2); return (0); } - aprint_normal_dev(&mlx->mlx_dv, ""); + aprint_normal_dev(mlx->mlx_dv, ""); aprint_normal(fmt, param2, param1); aprint_normal("\n"); Index: sys/dev/ic/mlxvar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/ic/mlxvar.h,v retrieving revision 1.14 diff -u -p -r1.14 mlxvar.h --- sys/dev/ic/mlxvar.h 28 Apr 2008 20:23:50 -0000 1.14 +++ sys/dev/ic/mlxvar.h 26 Sep 2012 22:44:52 -0000 @@ -79,7 +79,7 @@ struct mlx_sysdrive { u_int32_t ms_size; u_short ms_state; u_short ms_raidlevel; - struct device *ms_dv; + device_t ms_dv; }; /* Optional per-CCB context. */ @@ -87,7 +87,7 @@ struct mlx_ccb; struct mlx_context { void (*mx_handler)(struct mlx_ccb *); void *mx_context; - struct device *mx_dv; + device_t mx_dv; }; /* Command control block. */ @@ -117,7 +117,7 @@ struct mlx_ccb { * Per-controller state. */ struct mlx_softc { - struct device mlx_dv; + device_t mlx_dv; bus_space_tag_t mlx_iot; bus_space_handle_t mlx_ioh; bus_dma_tag_t mlx_dmat; Index: sys/dev/ic/mtd803.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/ic/mtd803.c,v retrieving revision 1.26 diff -u -p -r1.26 mtd803.c --- sys/dev/ic/mtd803.c 22 Jul 2012 14:32:57 -0000 1.26 +++ sys/dev/ic/mtd803.c 26 Sep 2012 23:56:29 -0000 @@ -139,7 +139,7 @@ mtd_config(struct mtd_softc *sc) sc->eaddr[i] = MTD_READ_1(sc, MTD_PAR0 + i); /* Initialize ifnet structure */ - memcpy(ifp->if_xname, device_xname(&sc->dev), IFNAMSIZ); + memcpy(ifp->if_xname, device_xname(sc->dev), IFNAMSIZ); ifp->if_softc = sc; ifp->if_init = mtd_init; ifp->if_start = mtd_start; @@ -159,10 +159,10 @@ mtd_config(struct mtd_softc *sc) ifmedia_init(&sc->mii.mii_media, 0, ether_mediachange, ether_mediastatus); - mii_attach(&sc->dev, &sc->mii, 0xffffffff, MII_PHY_ANY, 0, 0); + mii_attach(sc->dev, &sc->mii, 0xffffffff, MII_PHY_ANY, 0, 0); if (LIST_FIRST(&sc->mii.mii_phys) == NULL) { - aprint_error_dev(&sc->dev, "Unable to configure MII\n"); + aprint_error_dev(sc->dev, "Unable to configure MII\n"); return 1; } else { ifmedia_set(&sc->mii.mii_media, IFM_ETHER | IFM_AUTO); @@ -176,7 +176,7 @@ mtd_config(struct mtd_softc *sc) ether_ifattach(ifp, sc->eaddr); /* Initialise random source */ - rnd_attach_source(&sc->rnd_src, device_xname(&sc->dev), + rnd_attach_source(&sc->rnd_src, device_xname(sc->dev), RND_TYPE_NET, 0); /* Add shutdown hook to reset card when we reboot */ @@ -254,14 +254,14 @@ mtd_init_desc(struct mtd_softc *sc) /* Allocate DMA-safe memory */ if ((err = bus_dmamem_alloc(sc->dma_tag, size, MTD_DMA_ALIGN, 0, &seg, 1, &rseg, BUS_DMA_NOWAIT)) != 0) { - aprint_error_dev(&sc->dev, "unable to allocate DMA buffer, error = %d\n", err); + aprint_error_dev(sc->dev, "unable to allocate DMA buffer, error = %d\n", err); return 1; } /* Map memory to kernel addressable space */ if ((err = bus_dmamem_map(sc->dma_tag, &seg, 1, size, (void **)&sc->desc, BUS_DMA_NOWAIT | BUS_DMA_COHERENT)) != 0) { - aprint_error_dev(&sc->dev, "unable to map DMA buffer, error = %d\n", err); + aprint_error_dev(sc->dev, "unable to map DMA buffer, error = %d\n", err); bus_dmamem_free(sc->dma_tag, &seg, rseg); return 1; } @@ -269,7 +269,7 @@ mtd_init_desc(struct mtd_softc *sc) /* Create a DMA map */ if ((err = bus_dmamap_create(sc->dma_tag, size, 1, size, 0, BUS_DMA_NOWAIT, &sc->desc_dma_map)) != 0) { - aprint_error_dev(&sc->dev, "unable to create DMA map, error = %d\n", err); + aprint_error_dev(sc->dev, "unable to create DMA map, error = %d\n", err); bus_dmamem_unmap(sc->dma_tag, (void *)sc->desc, size); bus_dmamem_free(sc->dma_tag, &seg, rseg); return 1; @@ -278,7 +278,7 @@ mtd_init_desc(struct mtd_softc *sc) /* Load the DMA map */ if ((err = bus_dmamap_load(sc->dma_tag, sc->desc_dma_map, sc->desc, size, NULL, BUS_DMA_NOWAIT)) != 0) { - aprint_error_dev(&sc->dev, "unable to load DMA map, error = %d\n", + aprint_error_dev(sc->dev, "unable to load DMA map, error = %d\n", err); bus_dmamap_destroy(sc->dma_tag, sc->desc_dma_map); bus_dmamem_unmap(sc->dma_tag, (void *)sc->desc, size); @@ -292,7 +292,7 @@ mtd_init_desc(struct mtd_softc *sc) /* Allocate DMA-safe memory */ if ((err = bus_dmamem_alloc(sc->dma_tag, size, MTD_DMA_ALIGN, 0, &seg, 1, &rseg, BUS_DMA_NOWAIT)) != 0) { - aprint_error_dev(&sc->dev, "unable to allocate DMA buffer, error = %d\n", + aprint_error_dev(sc->dev, "unable to allocate DMA buffer, error = %d\n", err); /* Undo DMA map for descriptors */ @@ -306,7 +306,7 @@ mtd_init_desc(struct mtd_softc *sc) /* Map memory to kernel addressable space */ if ((err = bus_dmamem_map(sc->dma_tag, &seg, 1, size, &sc->buf, BUS_DMA_NOWAIT | BUS_DMA_COHERENT)) != 0) { - aprint_error_dev(&sc->dev, "unable to map DMA buffer, error = %d\n", + aprint_error_dev(sc->dev, "unable to map DMA buffer, error = %d\n", err); bus_dmamem_free(sc->dma_tag, &seg, rseg); @@ -321,7 +321,7 @@ mtd_init_desc(struct mtd_softc *sc) /* Create a DMA map */ if ((err = bus_dmamap_create(sc->dma_tag, size, 1, size, 0, BUS_DMA_NOWAIT, &sc->buf_dma_map)) != 0) { - aprint_error_dev(&sc->dev, "unable to create DMA map, error = %d\n", + aprint_error_dev(sc->dev, "unable to create DMA map, error = %d\n", err); bus_dmamem_unmap(sc->dma_tag, sc->buf, size); bus_dmamem_free(sc->dma_tag, &seg, rseg); @@ -337,7 +337,7 @@ mtd_init_desc(struct mtd_softc *sc) /* Load the DMA map */ if ((err = bus_dmamap_load(sc->dma_tag, sc->buf_dma_map, sc->buf, size, NULL, BUS_DMA_NOWAIT)) != 0) { - aprint_error_dev(&sc->dev, "unable to load DMA map, error = %d\n", + aprint_error_dev(sc->dev, "unable to load DMA map, error = %d\n", err); bus_dmamap_destroy(sc->dma_tag, sc->buf_dma_map); bus_dmamem_unmap(sc->dma_tag, sc->buf, size); @@ -436,7 +436,7 @@ mtd_put(struct mtd_softc *sc, int index, continue; } else if (tlen > MTD_TXBUF_SIZE) { /* XXX FIXME: No idea what to do here. */ - aprint_error_dev(&sc->dev, "packet too large! Size = %i\n", + aprint_error_dev(sc->dev, "packet too large! Size = %i\n", tlen); MFREE(m, n); continue; @@ -534,7 +534,7 @@ mtd_watchdog(struct ifnet *ifp) struct mtd_softc *sc = ifp->if_softc; int s; - log(LOG_ERR, "%s: device timeout\n", device_xname(&sc->dev)); + log(LOG_ERR, "%s: device timeout\n", device_xname(sc->dev)); ++sc->ethercom.ec_if.if_oerrors; mtd_stop(ifp, 0); @@ -635,7 +635,7 @@ mtd_rxirq(struct mtd_softc *sc) for (; !(sc->desc[sc->cur_rx].stat & MTD_RXD_OWNER);) { /* Error summary set? */ if (sc->desc[sc->cur_rx].stat & MTD_RXD_ERRSUM) { - aprint_error_dev(&sc->dev, "received packet with errors\n"); + aprint_error_dev(sc->dev, "received packet with errors\n"); /* Give up packet, since an error occurred */ sc->desc[sc->cur_rx].stat = MTD_RXD_OWNER; sc->desc[sc->cur_rx].conf = MTD_RXBUF_SIZE & @@ -652,7 +652,7 @@ mtd_rxirq(struct mtd_softc *sc) /* Check packet size */ if (len <= sizeof(struct ether_header)) { - aprint_error_dev(&sc->dev, "invalid packet size %d; dropping\n", + aprint_error_dev(sc->dev, "invalid packet size %d; dropping\n", len); sc->desc[sc->cur_rx].stat = MTD_RXD_OWNER; sc->desc[sc->cur_rx].conf = MTD_RXBUF_SIZE & @@ -673,7 +673,7 @@ mtd_rxirq(struct mtd_softc *sc) sc->cur_rx = 0; if (m == NULL) { - aprint_error_dev(&sc->dev, "error pulling packet off interface\n"); + aprint_error_dev(sc->dev, "error pulling packet off interface\n"); ++ifp->if_ierrors; continue; } @@ -728,7 +728,7 @@ mtd_irq_h(void *args) u_int32_t status; int r = 0; - if (!(ifp->if_flags & IFF_RUNNING) || !device_is_active(&sc->dev)) + if (!(ifp->if_flags & IFF_RUNNING) || !device_is_active(sc->dev)) return 0; /* Disable interrupts */ @@ -750,42 +750,42 @@ mtd_irq_h(void *args) /* NOTE: Perhaps we should reset with some of these errors? */ if (status & MTD_ISR_RXBUN) { - aprint_error_dev(&sc->dev, "receive buffer unavailable\n"); + aprint_error_dev(sc->dev, "receive buffer unavailable\n"); ++ifp->if_ierrors; } if (status & MTD_ISR_RXERR) { - aprint_error_dev(&sc->dev, "receive error\n"); + aprint_error_dev(sc->dev, "receive error\n"); ++ifp->if_ierrors; } if (status & MTD_ISR_TXBUN) { - aprint_error_dev(&sc->dev, "transmit buffer unavailable\n"); + aprint_error_dev(sc->dev, "transmit buffer unavailable\n"); ++ifp->if_ierrors; } if ((status & MTD_ISR_PDF)) { - aprint_error_dev(&sc->dev, "parallel detection fault\n"); + aprint_error_dev(sc->dev, "parallel detection fault\n"); ++ifp->if_ierrors; } if (status & MTD_ISR_FBUSERR) { - aprint_error_dev(&sc->dev, "fatal bus error\n"); + aprint_error_dev(sc->dev, "fatal bus error\n"); ++ifp->if_ierrors; } if (status & MTD_ISR_TARERR) { - aprint_error_dev(&sc->dev, "target error\n"); + aprint_error_dev(sc->dev, "target error\n"); ++ifp->if_ierrors; } if (status & MTD_ISR_MASTERR) { - aprint_error_dev(&sc->dev, "master error\n"); + aprint_error_dev(sc->dev, "master error\n"); ++ifp->if_ierrors; } if (status & MTD_ISR_PARERR) { - aprint_error_dev(&sc->dev, "parity error\n"); + aprint_error_dev(sc->dev, "parity error\n"); ++ifp->if_ierrors; } @@ -875,7 +875,7 @@ mtd_reset(struct mtd_softc *sc) } if (i == MTD_TIMEOUT) { - aprint_error_dev(&sc->dev, "reset timed out\n"); + aprint_error_dev(sc->dev, "reset timed out\n"); } /* Wait a little so chip can stabilize */ Index: sys/dev/ic/mtd803var.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/ic/mtd803var.h,v retrieving revision 1.8 diff -u -p -r1.8 mtd803var.h --- sys/dev/ic/mtd803var.h 2 Feb 2012 19:43:03 -0000 1.8 +++ sys/dev/ic/mtd803var.h 26 Sep 2012 23:55:33 -0000 @@ -59,7 +59,7 @@ struct mtd_desc { /* Softc struct */ struct mtd_softc { - struct device dev; + device_t dev; struct mii_data mii; struct ethercom ethercom; bus_space_tag_t bus_tag; Index: sys/dev/ic/ne2000.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/ic/ne2000.c,v retrieving revision 1.72 diff -u -p -r1.72 ne2000.c --- sys/dev/ic/ne2000.c 29 Mar 2010 15:51:03 -0000 1.72 +++ sys/dev/ic/ne2000.c 29 Sep 2012 11:45:05 -0000 @@ -248,7 +248,7 @@ ne2000_attach(struct ne2000_softc *nsc, } if (memstart == 0) { - aprint_error_dev(&dsc->sc_dev, + aprint_error_dev(dsc->sc_dev, "cannot find start of RAM\n"); return 1; } @@ -277,7 +277,7 @@ ne2000_attach(struct ne2000_softc *nsc, } printf("%s: RAM start 0x%x, size %d\n", - device_xname(&dsc->sc_dev), memstart, memsize); + device_xname(dsc->sc_dev), memstart, memsize); } #endif /* GWETHER */ dsc->mem_start = memstart; Index: sys/dev/ic/ninjascsi32var.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/ic/ninjascsi32var.h,v retrieving revision 1.6 diff -u -p -r1.6 ninjascsi32var.h --- sys/dev/ic/ninjascsi32var.h 9 Jul 2008 19:08:44 -0000 1.6 +++ sys/dev/ic/ninjascsi32var.h 2 Oct 2012 02:20:42 -0000 @@ -209,7 +209,7 @@ struct njsc32_softc { int sc_sync_max; /* for scsipi layer */ - struct device *sc_scsi; + device_t sc_scsi; struct scsipi_adapter sc_adapter; struct scsipi_channel sc_channel; Index: sys/dev/ic/pdq_ifsubr.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/ic/pdq_ifsubr.c,v retrieving revision 1.54 diff -u -p -r1.54 pdq_ifsubr.c --- sys/dev/ic/pdq_ifsubr.c 19 Jan 2010 22:06:24 -0000 1.54 +++ sys/dev/ic/pdq_ifsubr.c 26 Sep 2012 22:43:55 -0000 @@ -730,12 +730,12 @@ pdq_os_databuf_alloc( MGETHDR(m, M_DONTWAIT, MT_DATA); if (m == NULL) { - aprint_error_dev(&sc->sc_dev, "can't alloc small buf\n"); + aprint_error_dev(sc->sc_dev, "can't alloc small buf\n"); return NULL; } MCLGET(m, M_DONTWAIT); if ((m->m_flags & M_EXT) == 0) { - aprint_error_dev(&sc->sc_dev, "can't alloc cluster\n"); + aprint_error_dev(sc->sc_dev, "can't alloc cluster\n"); m_free(m); return NULL; } @@ -744,13 +744,13 @@ pdq_os_databuf_alloc( if (bus_dmamap_create(sc->sc_dmatag, PDQ_OS_DATABUF_SIZE, 1, PDQ_OS_DATABUF_SIZE, 0, BUS_DMA_NOWAIT, &map)) { - aprint_error_dev(&sc->sc_dev, "can't create dmamap\n"); + aprint_error_dev(sc->sc_dev, "can't create dmamap\n"); m_free(m); return NULL; } if (bus_dmamap_load_mbuf(sc->sc_dmatag, map, m, BUS_DMA_READ|BUS_DMA_NOWAIT)) { - aprint_error_dev(&sc->sc_dev, "can't load dmamap\n"); + aprint_error_dev(sc->sc_dev, "can't load dmamap\n"); bus_dmamap_destroy(sc->sc_dmatag, map); m_free(m); return NULL; Index: sys/dev/ic/pdqvar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/ic/pdqvar.h,v retrieving revision 1.46 diff -u -p -r1.46 pdqvar.h --- sys/dev/ic/pdqvar.h 13 Nov 2010 13:52:02 -0000 1.46 +++ sys/dev/ic/pdqvar.h 26 Sep 2012 23:50:51 -0000 @@ -316,7 +316,7 @@ typedef struct _pdq_os_ctx_t { struct arpcom sc_ac; #define sc_if sc_ac.ac_if #elif defined(__NetBSD__) - struct device sc_dev; /* base device */ + device_t sc_dev; /* base device */ void *sc_ih; /* interrupt vectoring */ void *sc_ats; /* shutdown hook */ struct ethercom sc_ec; Index: sys/dev/ic/rrunner.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/ic/rrunner.c,v retrieving revision 1.74 diff -u -p -r1.74 rrunner.c --- sys/dev/ic/rrunner.c 5 Apr 2010 07:19:35 -0000 1.74 +++ sys/dev/ic/rrunner.c 26 Sep 2012 23:48:57 -0000 @@ -188,7 +188,7 @@ eshconfig(struct esh_softc *sc) int error; int i; - esh_softc_debug[device_unit(&sc->sc_dev)] = sc; + esh_softc_debug[device_unit(sc->sc_dev)] = sc; sc->sc_flags = 0; TAILQ_INIT(&sc->sc_dmainfo_freelist); @@ -209,12 +209,12 @@ eshconfig(struct esh_softc *sc) 0, RR_DMA_BOUNDARY, &sc->sc_dmaseg, 1, &rseg, BUS_DMA_NOWAIT); if (error) { - aprint_error_dev(&sc->sc_dev, "couldn't allocate space for host-side" + aprint_error_dev(sc->sc_dev, "couldn't allocate space for host-side" "data structures\n"); return; } if (rseg > 1) { - aprint_error_dev(&sc->sc_dev, "contiguous memory not available\n"); + aprint_error_dev(sc->sc_dev, "contiguous memory not available\n"); goto bad_dmamem_map; } @@ -222,7 +222,7 @@ eshconfig(struct esh_softc *sc) sc->sc_dma_size, (void **)&sc->sc_dma_addr, BUS_DMA_NOWAIT | BUS_DMA_COHERENT); if (error) { - aprint_error_dev(&sc->sc_dev, + aprint_error_dev(sc->sc_dev, "couldn't map memory for host-side structures\n"); goto bad_dmamem_map; } @@ -231,13 +231,13 @@ eshconfig(struct esh_softc *sc) 1, sc->sc_dma_size, RR_DMA_BOUNDARY, BUS_DMA_ALLOCNOW | BUS_DMA_NOWAIT, &sc->sc_dma)) { - aprint_error_dev(&sc->sc_dev, "couldn't create DMA map\n"); + aprint_error_dev(sc->sc_dev, "couldn't create DMA map\n"); goto bad_dmamap_create; } if (bus_dmamap_load(sc->sc_dmat, sc->sc_dma, sc->sc_dma_addr, sc->sc_dma_size, NULL, BUS_DMA_NOWAIT)) { - aprint_error_dev(&sc->sc_dev, "couldn't load DMA map\n"); + aprint_error_dev(sc->sc_dev, "couldn't load DMA map\n"); goto bad_dmamap_load; } @@ -268,7 +268,7 @@ eshconfig(struct esh_softc *sc) #ifdef DIAGNOSTIC if (size > sc->sc_dmaseg.ds_len) { - aprint_error_dev(&sc->sc_dev, "bogus size calculation\n"); + aprint_error_dev(sc->sc_dev, "bogus size calculation\n"); goto bad_other; } #endif @@ -283,7 +283,7 @@ eshconfig(struct esh_softc *sc) ESH_MAX_NSEGS, RR_DMA_MAX, RR_DMA_BOUNDARY, BUS_DMA_ALLOCNOW | BUS_DMA_NOWAIT, &sc->sc_send.ec_dma)) { - aprint_error_dev(&sc->sc_dev, "failed bus_dmamap_create\n"); + aprint_error_dev(sc->sc_dev, "failed bus_dmamap_create\n"); goto bad_other; } sc->sc_send.ec_offset = 0; @@ -296,7 +296,7 @@ eshconfig(struct esh_softc *sc) RR_DMA_BOUNDARY, BUS_DMA_ALLOCNOW | BUS_DMA_NOWAIT, &sc->sc_snap_recv.ec_dma[i])) { - aprint_error_dev(&sc->sc_dev, "failed bus_dmamap_create\n"); + aprint_error_dev(sc->sc_dev, "failed bus_dmamap_create\n"); for (i--; i >= 0; i--) bus_dmamap_destroy(sc->sc_dmat, sc->sc_snap_recv.ec_dma[i]); @@ -326,7 +326,7 @@ eshconfig(struct esh_softc *sc) header_format = esh_read_eeprom(sc, RR_EE_HEADER_FORMAT); if (header_format != RR_EE_HEADER_FORMAT_MAGIC) { - aprint_error_dev(&sc->sc_dev, "bogus EEPROM header format value %x\n", + aprint_error_dev(sc->sc_dev, "bogus EEPROM header format value %x\n", header_format); goto bad_other; } @@ -397,7 +397,7 @@ eshconfig(struct esh_softc *sc) bus_space_write_4(iot, ioh, RR_MISC_LOCAL_CTL, misc_local_ctl); - 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 = eshstart; ifp->if_ioctl = eshioctl; @@ -518,13 +518,13 @@ eshinit(struct esh_softc *sc) value = sc->sc_bist_read(sc); if (value != 0) { - aprint_error_dev(&sc->sc_dev, "BIST is %d, not 0!\n", + aprint_error_dev(sc->sc_dev, "BIST is %d, not 0!\n", value); goto bad_init; } #ifdef ESH_PRINTF - printf("%s: BIST is %x\n", device_xname(&sc->sc_dev), value); + printf("%s: BIST is %x\n", device_xname(sc->sc_dev), value); eshstatus(sc); #endif @@ -594,7 +594,7 @@ eshinit(struct esh_softc *sc) bus_space_read_4(iot, ioh, RR_RUNCODE_VERSION); sc->sc_version = sc->sc_runcode_version >> 16; if (sc->sc_version != 1 && sc->sc_version != 2) { - aprint_error_dev(&sc->sc_dev, "bad version number %d in runcode\n", + aprint_error_dev(sc->sc_dev, "bad version number %d in runcode\n", sc->sc_version); goto bad_init; } @@ -607,12 +607,12 @@ eshinit(struct esh_softc *sc) } if (sc->sc_options & (RR_OP_LONG_TX | RR_OP_LONG_RX)) { - aprint_error_dev(&sc->sc_dev, "unsupported firmware -- long descriptors\n"); + aprint_error_dev(sc->sc_dev, "unsupported firmware -- long descriptors\n"); goto bad_init; } printf("%s: startup runcode version %d.%d.%d, options %x\n", - device_xname(&sc->sc_dev), + device_xname(sc->sc_dev), sc->sc_version, (sc->sc_runcode_version >> 8) & 0xff, sc->sc_runcode_version & 0xff, @@ -703,7 +703,7 @@ esh_fpopen(dev_t dev, int oflags, int de #ifdef ESH_PRINTF printf("esh_fpopen: opening board %d, ulp %d\n", - device_unit(&sc->sc_dev), ulp); + device_unit(sc->sc_dev), ulp); #endif /* If the card is not up, initialize it. */ @@ -787,13 +787,13 @@ esh_fpopen(dev_t dev, int oflags, int de &rseg, BUS_DMA_WAITOK); if (error) { - aprint_error_dev(&sc->sc_dev, "couldn't allocate space for FP receive ring" + aprint_error_dev(sc->sc_dev, "couldn't allocate space for FP receive ring" "data structures\n"); goto bad_fp_dmamem_alloc; } if (rseg > 1) { - aprint_error_dev(&sc->sc_dev, "contiguous memory not available for " + aprint_error_dev(sc->sc_dev, "contiguous memory not available for " "FP receive ring\n"); goto bad_fp_dmamem_map; } @@ -802,20 +802,20 @@ esh_fpopen(dev_t dev, int oflags, int de size, (void **) &recv->ec_descr, BUS_DMA_WAITOK | BUS_DMA_COHERENT); if (error) { - aprint_error_dev(&sc->sc_dev, "couldn't map memory for FP receive ring\n"); + aprint_error_dev(sc->sc_dev, "couldn't map memory for FP receive ring\n"); goto bad_fp_dmamem_map; } if (bus_dmamap_create(sc->sc_dmat, size, 1, size, RR_DMA_BOUNDARY, BUS_DMA_ALLOCNOW | BUS_DMA_WAITOK, &recv->ec_dma)) { - aprint_error_dev(&sc->sc_dev, "couldn't create DMA map for FP receive ring\n"); + aprint_error_dev(sc->sc_dev, "couldn't create DMA map for FP receive ring\n"); goto bad_fp_dmamap_create; } if (bus_dmamap_load(sc->sc_dmat, recv->ec_dma, recv->ec_descr, size, NULL, BUS_DMA_WAITOK)) { - aprint_error_dev(&sc->sc_dev, "couldn't load DMA map for FP receive ring\n"); + aprint_error_dev(sc->sc_dev, "couldn't load DMA map for FP receive ring\n"); goto bad_fp_dmamap_load; } @@ -923,7 +923,7 @@ esh_fpclose(dev_t dev, int fflag, int de #ifdef ESH_PRINTF printf("esh_fpclose: closing unit %d, ulp %d\n", - device_unit(&sc->sc_dev), ulp); + device_unit(sc->sc_dev), ulp); #endif assert(ring); assert(ring_ctl); @@ -941,7 +941,7 @@ esh_fpclose(dev_t dev, int fflag, int de error = tsleep((void *) &ring->ec_index, PCATCH | PRIBIO, "esh_fpclose", 0); if (error != 0 && error != EAGAIN) { - aprint_error_dev(&sc->sc_dev, "esh_fpclose: wait on ring disable bad\n"); + aprint_error_dev(sc->sc_dev, "esh_fpclose: wait on ring disable bad\n"); ring->ec_index = -1; break; } @@ -1050,7 +1050,7 @@ esh_fpread(dev_t dev, struct uio *uio, i error = bus_dmamap_load_uio(sc->sc_dmat, di->ed_dma, uio, BUS_DMA_READ|BUS_DMA_WAITOK); if (error) { - aprint_error_dev(&sc->sc_dev, "esh_fpread: bus_dmamap_load_uio " + aprint_error_dev(sc->sc_dev, "esh_fpread: bus_dmamap_load_uio " "failed\terror code %d\n", error); error = ENOBUFS; @@ -1203,7 +1203,7 @@ esh_fpwrite(dev_t dev, struct uio *uio, error = bus_dmamap_load_uio(sc->sc_dmat, di->ed_dma, uio, BUS_DMA_WRITE|BUS_DMA_WAITOK); if (error) { - aprint_error_dev(&sc->sc_dev, "esh_fpwrite: bus_dmamap_load_uio " + aprint_error_dev(sc->sc_dev, "esh_fpwrite: bus_dmamap_load_uio " "failed\terror code %d\n", error); error = ENOBUFS; @@ -1326,7 +1326,7 @@ esh_fpstrategy(struct buf *bp) bp->b_proc, BUS_DMA_READ|BUS_DMA_WAITOK); if (error) { - aprint_error_dev(&sc->sc_dev, "esh_fpstrategy: " + aprint_error_dev(sc->sc_dev, "esh_fpstrategy: " "bus_dmamap_load " "failed\terror code %d\n", error); @@ -1446,7 +1446,7 @@ eshintr(void *arg) event->re_code != RR_EC_STATS_UPDATE && event->re_code != RR_EC_SET_CMD_CONSUMER) { printf("%s: event code %x, ring %d, index %d\n", - device_xname(&sc->sc_dev), event->re_code, + device_xname(sc->sc_dev), event->re_code, event->re_ring, event->re_index); if (okay == 0) printf("%s\n", sbuf); @@ -1457,7 +1457,7 @@ eshintr(void *arg) switch(event->re_code) { case RR_EC_RUNCODE_UP: - printf("%s: firmware up\n", device_xname(&sc->sc_dev)); + printf("%s: firmware up\n", device_xname(sc->sc_dev)); sc->sc_flags |= ESH_FL_RUNCODE_UP; esh_send_cmd(sc, RR_CC_WATCHDOG, 0, 0); esh_send_cmd(sc, RR_CC_UPDATE_STATS, 0, 0); @@ -1490,7 +1490,7 @@ eshintr(void *arg) break; case RR_EC_LINK_ON: - printf("%s: link up\n", device_xname(&sc->sc_dev)); + printf("%s: link up\n", device_xname(sc->sc_dev)); sc->sc_flags |= ESH_FL_LINK_UP; esh_send_cmd(sc, RR_CC_WATCHDOG, 0, 0); @@ -1510,7 +1510,7 @@ eshintr(void *arg) case RR_EC_LINK_OFF: sc->sc_flags &= ~ESH_FL_LINK_UP; - printf("%s: link down\n", device_xname(&sc->sc_dev)); + printf("%s: link down\n", device_xname(sc->sc_dev)); break; /* @@ -1530,7 +1530,7 @@ eshintr(void *arg) case RR_EC_BAD_RECV_DESC: case RR_EC_BAD_RECV_RING: case RR_EC_UNIMPLEMENTED: - aprint_error_dev(&sc->sc_dev, "unexpected event %x;" + aprint_error_dev(sc->sc_dev, "unexpected event %x;" "shutting down interface\n", event->re_code); ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE); @@ -1543,7 +1543,7 @@ eshintr(void *arg) #define CALLOUT(a) case a: \ printf("%s: Event " #a " received -- " \ "ring %d index %d timestamp %x\n", \ - device_xname(&sc->sc_dev), event->re_ring, event->re_index, \ + device_xname(sc->sc_dev), event->re_ring, event->re_index, \ event->re_timestamp); \ break; @@ -1658,7 +1658,7 @@ eshintr(void *arg) case RR_EC_RING_ENABLE_ERR: if (event->re_ring == HIPPI_ULP_802) { - aprint_error_dev(&sc->sc_dev, "unable to enable SNAP ring!?\n\t" + aprint_error_dev(sc->sc_dev, "unable to enable SNAP ring!?\n\t" "shutting down interface\n"); ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE); #ifdef ESH_PRINTF @@ -1684,7 +1684,7 @@ eshintr(void *arg) */ if (event->re_ring == HIPPI_ULP_802) { - aprint_error_dev(&sc->sc_dev, "discard on SNAP ring!?\n\t" + aprint_error_dev(sc->sc_dev, "discard on SNAP ring!?\n\t" "shutting down interface\n"); ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE); sc->sc_flags = ESH_FL_CRASHED; @@ -1765,7 +1765,7 @@ eshintr(void *arg) break; default: - aprint_error_dev(&sc->sc_dev, "Bogus event code %x, " + aprint_error_dev(sc->sc_dev, "Bogus event code %x, " "ring %d, index %d, timestamp %x\n", event->re_code, event->re_ring, event->re_index, @@ -1942,7 +1942,7 @@ eshstart(struct ifnet *ifp) if (error) panic("%s: eshstart: " "bus_dmamap_load_mbuf failed err %d\n", - device_xname(&sc->sc_dev), error); + device_xname(sc->sc_dev), error); send->ec_offset = 0; } @@ -1985,7 +1985,7 @@ eshstart(struct ifnet *ifp) if (error) panic("%s: eshstart: " "bus_dmamap_load failed err %d\n", - device_xname(&sc->sc_dev), error); + device_xname(sc->sc_dev), error); } /* @@ -2163,7 +2163,7 @@ eshstart_cleanup(struct esh_softc *sc, u } else { panic("%s: eshstart_cleanup: " "no current mbuf, buf, or dmainfo!\n", - device_xname(&sc->sc_dev)); + device_xname(sc->sc_dev)); } /* @@ -2273,7 +2273,7 @@ esh_adjust_mbufs(struct esh_softc *sc, s return m; bogosity: - aprint_error_dev(&sc->sc_dev, "esh_adjust_mbuf: unable to allocate cluster for " + aprint_error_dev(sc->sc_dev, "esh_adjust_mbuf: unable to allocate cluster for " "mbuf %p, len %x\n", mtod(m, void *), m->m_len); m_freem(m); @@ -2329,7 +2329,7 @@ esh_read_snap_ring(struct esh_softc *sc, m_freem(recv->ec_cur_pkt); recv->ec_cur_pkt = NULL; printf("%s: possible skipped packet!\n", - device_xname(&sc->sc_dev)); + device_xname(sc->sc_dev)); } recv->ec_cur_pkt = recv->ec_cur_mbuf = m; /* allocated buffers all have pkthdrs... */ @@ -2407,7 +2407,7 @@ esh_init_snap_ring(struct esh_softc *sc) struct rr_ring_ctl *ring = sc->sc_recv_ring_table + HIPPI_ULP_802; if ((sc->sc_flags & ESH_FL_CLOSING_SNAP) != 0) { - aprint_error_dev(&sc->sc_dev, "can't reopen SNAP ring until ring disable is completed\n"); + aprint_error_dev(sc->sc_dev, "can't reopen SNAP ring until ring disable is completed\n"); return; } @@ -2434,7 +2434,7 @@ esh_init_snap_ring(struct esh_softc *sc) sc->sc_snap_recv.ec_producer); } else { printf("%s: snap receive ring already initialized!\n", - device_xname(&sc->sc_dev)); + device_xname(sc->sc_dev)); } } @@ -2491,7 +2491,7 @@ esh_fill_snap_ring(struct esh_softc *sc) if (error) { printf("%s: esh_fill_recv_ring: bus_dmamap_load " "failed\toffset %x, error code %d\n", - device_xname(&sc->sc_dev), offset, error); + device_xname(sc->sc_dev), offset, error); MFREE(m, m0); break; } @@ -2597,7 +2597,7 @@ esh_read_fp_ring(struct esh_softc *sc, u if (recv->ec_read_len) { recv->ec_error = 0; printf("%s: ulp %d: possible skipped FP packet!\n", - device_xname(&sc->sc_dev), recv->ec_ulp); + device_xname(sc->sc_dev), recv->ec_ulp); } recv->ec_seen_end = 0; recv->ec_read_len = 0; @@ -3103,7 +3103,7 @@ esh_generic_ioctl(struct esh_softc *sc, bus_space_write_4(iot, ioh, RR_MISC_LOCAL_CTL, value); if (cmd == EIOCSEEPROM) { - printf("%s: writing EEPROM\n", device_xname(&sc->sc_dev)); + printf("%s: writing EEPROM\n", device_xname(sc->sc_dev)); sc->sc_flags |= ESH_FL_EEPROM_BUSY; } @@ -3155,7 +3155,7 @@ esh_generic_ioctl(struct esh_softc *sc, sc->sc_flags &= ~ESH_FL_EEPROM_BUSY; wakeup(&sc->sc_flags); printf("%s: done writing EEPROM\n", - device_xname(&sc->sc_dev)); + device_xname(sc->sc_dev)); } break; @@ -3198,7 +3198,7 @@ eshwatchdog(struct ifnet *ifp) if (!sc->sc_watchdog) { printf("%s: watchdog timer expired. " "Should reset interface!\n", - device_xname(&sc->sc_dev)); + device_xname(sc->sc_dev)); ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE); eshstatus(sc); #if 0 @@ -3563,7 +3563,7 @@ esh_new_dmainfo(struct esh_softc *sc) BUS_DMA_ALLOCNOW | BUS_DMA_WAITOK, &di->ed_dma)) { printf("%s: failed dmainfo bus_dmamap_create\n", - device_xname(&sc->sc_dev)); + device_xname(sc->sc_dev)); free(di, M_DEVBUF); di = NULL; } @@ -3605,7 +3605,7 @@ eshstatus(struct esh_softc *sc) /* XXX: This looks pathetic, and should be improved! */ printf("%s: status -- fail1 %x fail2 %x\n", - device_xname(&sc->sc_dev), + device_xname(sc->sc_dev), bus_space_read_4(iot, ioh, RR_RUNCODE_FAIL1), bus_space_read_4(iot, ioh, RR_RUNCODE_FAIL2)); printf("\tmisc host ctl %x misc local ctl %x\n", Index: sys/dev/ic/rrunnervar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/ic/rrunnervar.h,v retrieving revision 1.13 diff -u -p -r1.13 rrunnervar.h --- sys/dev/ic/rrunnervar.h 28 Apr 2008 20:23:51 -0000 1.13 +++ sys/dev/ic/rrunnervar.h 26 Sep 2012 23:48:49 -0000 @@ -135,7 +135,7 @@ struct esh_fp_ring_ctl { struct esh_softc { - struct device sc_dev; + device_t sc_dev; struct ifnet sc_if; struct ifmedia sc_media; Index: sys/dev/ic/seeq8005.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/ic/seeq8005.c,v retrieving revision 1.48 diff -u -p -r1.48 seeq8005.c --- sys/dev/ic/seeq8005.c 10 Jun 2012 15:00:49 -0000 1.48 +++ sys/dev/ic/seeq8005.c 28 Sep 2012 20:12:32 -0000 @@ -184,7 +184,7 @@ seeq8005_attach(struct seeq8005_softc *s SEEQ_WRITE16(sc, iot, ioh, SEEQ_RX_PTR, 0x1234); if (SEEQ_READ16(sc, iot, ioh, SEEQ_RX_PTR) != 0x1234) { aprint_normal("\n"); - aprint_error_dev(&sc->sc_dev, "Cannot determine data bus width\n"); + aprint_error_dev(sc->sc_dev, "Cannot determine data bus width\n"); return; } } @@ -238,21 +238,21 @@ seeq8005_attach(struct seeq8005_softc *s ea_ramtest(sc); printf("%s: %dKB packet memory, txbuf=%dKB (%d buffers), rxbuf=%dKB", - device_xname(&sc->sc_dev), sc->sc_buffersize >> 10, + device_xname(sc->sc_dev), sc->sc_buffersize >> 10, sc->sc_tx_bufsize >> 10, sc->sc_tx_bufs, sc->sc_rx_bufsize >> 10); if (padbuf == NULL) { 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; } } /* Initialise ifnet structure. */ - 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 = ea_start; ifp->if_ioctl = ea_ioctl; @@ -288,7 +288,7 @@ seeq8005_attach(struct seeq8005_softc *s printf("\n"); /* After \n because it can print a line of its own. */ - rnd_attach_source(&sc->rnd_source, device_xname(&sc->sc_dev), + rnd_attach_source(&sc->rnd_source, device_xname(sc->sc_dev), RND_TYPE_NET, 0); } @@ -369,7 +369,7 @@ do { \ /* Report */ if (sum > 0) - aprint_error_dev(&sc->sc_dev, "buffer RAM failed self test, %d faults\n", sum); + aprint_error_dev(sc->sc_dev, "buffer RAM failed self test, %d faults\n", sum); } @@ -406,7 +406,7 @@ ea_stoptx(struct seeq8005_softc *sc) } while ((status & SEEQ_STATUS_TX_ON) && --timeout > 0); if (timeout == 0) log(LOG_ERR, "%s: timeout waiting for tx termination\n", - device_xname(&sc->sc_dev)); + device_xname(sc->sc_dev)); /* Clear any pending tx interrupt */ SEEQ_WRITE16(sc, iot, ioh, SEEQ_COMMAND, @@ -446,7 +446,7 @@ ea_stoprx(struct seeq8005_softc *sc) } while ((status & SEEQ_STATUS_RX_ON) && --timeout > 0); if (timeout == 0) log(LOG_ERR, "%s: timeout waiting for rx termination\n", - device_xname(&sc->sc_dev)); + device_xname(sc->sc_dev)); /* Clear any pending rx interrupt */ @@ -551,7 +551,7 @@ ea_await_fifo_empty(struct seeq8005_soft if (SEEQ_READ16(sc, iot, ioh, SEEQ_STATUS) & SEEQ_STATUS_FIFO_EMPTY) return; - log(LOG_ERR, "%s: DMA FIFO failed to empty\n", device_xname(&sc->sc_dev)); + log(LOG_ERR, "%s: DMA FIFO failed to empty\n", device_xname(sc->sc_dev)); } /* @@ -569,7 +569,7 @@ ea_await_fifo_full(struct seeq8005_softc if (SEEQ_READ16(sc, iot, ioh, SEEQ_STATUS) & SEEQ_STATUS_FIFO_FULL) return; - log(LOG_ERR, "%s: DMA FIFO failed to fill\n", device_xname(&sc->sc_dev)); + log(LOG_ERR, "%s: DMA FIFO failed to fill\n", device_xname(sc->sc_dev)); } /* @@ -593,9 +593,9 @@ ea_writebuf(struct seeq8005_softc *sc, u #ifdef DIAGNOSTIC if (__predict_false(!ALIGNED_POINTER(buf, u_int16_t))) - panic("%s: unaligned writebuf", device_xname(&sc->sc_dev)); + panic("%s: unaligned writebuf", device_xname(sc->sc_dev)); if (__predict_false(addr >= SEEQ_MAX_BUFFER_SIZE)) - panic("%s: writebuf out of range", device_xname(&sc->sc_dev)); + panic("%s: writebuf out of range", device_xname(sc->sc_dev)); #endif if (addr != -1) { @@ -646,9 +646,9 @@ ea_readbuf(struct seeq8005_softc *sc, u_ #ifdef DIAGNOSTIC if (__predict_false(!ALIGNED_POINTER(buf, u_int16_t))) - panic("%s: unaligned readbuf", device_xname(&sc->sc_dev)); + panic("%s: unaligned readbuf", device_xname(sc->sc_dev)); if (__predict_false(addr >= SEEQ_MAX_BUFFER_SIZE)) - panic("%s: readbuf out of range", device_xname(&sc->sc_dev)); + panic("%s: readbuf out of range", device_xname(sc->sc_dev)); #endif if (addr != -1) { @@ -1154,7 +1154,7 @@ ea_rxint(struct seeq8005_softc *sc) ++ifp->if_ierrors; log(LOG_ERR, "%s: Rx chain corrupt at %04x (ptr = %04x)\n", - device_xname(&sc->sc_dev), addr, ptr); + device_xname(sc->sc_dev), addr, ptr); ea_init(ifp); return; } @@ -1180,7 +1180,7 @@ ea_rxint(struct seeq8005_softc *sc) ++ifp->if_ierrors; log(LOG_WARNING, "%s: rx packet error at %04x (err=%02x)\n", - device_xname(&sc->sc_dev), addr, status & 0x0f); + device_xname(sc->sc_dev), addr, status & 0x0f); /* XXX shouldn't need to reset if it's genuine. */ ea_init(ifp); return; @@ -1194,7 +1194,7 @@ ea_rxint(struct seeq8005_softc *sc) ++ifp->if_ierrors; log(LOG_ERR, "%s: rx packet size error at %04x (len=%d)\n", - device_xname(&sc->sc_dev), addr, len); + device_xname(sc->sc_dev), addr, len); sc->sc_config2 |= SEEQ_CFG2_OUTPUT; SEEQ_WRITE16(sc, iot, ioh, SEEQ_CONFIG2, sc->sc_config2); @@ -1474,7 +1474,7 @@ ea_watchdog(struct ifnet *ifp) struct seeq8005_softc *sc = ifp->if_softc; log(LOG_ERR, "%s: lost Tx interrupt (status = 0x%04x)\n", - device_xname(&sc->sc_dev), + device_xname(sc->sc_dev), SEEQ_READ16(sc, sc->sc_iot, sc->sc_ioh, SEEQ_STATUS)); ifp->if_oerrors++; Index: sys/dev/ic/seeq8005var.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/ic/seeq8005var.h,v retrieving revision 1.7 diff -u -p -r1.7 seeq8005var.h --- sys/dev/ic/seeq8005var.h 2 Feb 2012 19:43:03 -0000 1.7 +++ sys/dev/ic/seeq8005var.h 28 Sep 2012 20:12:10 -0000 @@ -50,7 +50,7 @@ enum seeq_variant { */ struct seeq8005_softc { - struct device sc_dev; + device_t sc_dev; /* These fields should be initialised by the board driver. */ bus_space_tag_t sc_iot; /* I/O base addr */ Index: sys/dev/ic/sl811hsvar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/ic/sl811hsvar.h,v retrieving revision 1.8 diff -u -p -r1.8 sl811hsvar.h --- sys/dev/ic/sl811hsvar.h 21 Jun 2011 15:13:34 -0000 1.8 +++ sys/dev/ic/sl811hsvar.h 2 Oct 2012 02:20:55 -0000 @@ -69,7 +69,7 @@ struct slhci_softc { PowerFunc sc_enable_power; - struct device *sc_child; + device_t sc_child; struct timeval sc_reserved_warn_rate; struct timeval sc_overflow_warn_rate; Index: sys/dev/ic/smc90cx6.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/ic/smc90cx6.c,v retrieving revision 1.63 diff -u -p -r1.63 smc90cx6.c --- sys/dev/ic/smc90cx6.c 5 Apr 2010 07:19:37 -0000 1.63 +++ sys/dev/ic/smc90cx6.c 28 Sep 2012 14:14:13 -0000 @@ -154,7 +154,7 @@ bah_attach_subr(struct bah_softc *sc) #if (defined(BAH_DEBUG) && (BAH_DEBUG > 2)) printf("\n%s: attach(0x%x, 0x%x, 0x%x)\n", - device_xname(&sc->sc_dev), parent, self, aux); + device_xname(sc->sc_dev), parent, self, aux); #endif s = splhigh(); @@ -189,7 +189,7 @@ bah_attach_subr(struct bah_softc *sc) */ bah_stop(sc); - 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 = bah_start; ifp->if_ioctl = bah_ioctl; @@ -253,7 +253,7 @@ bah_reset(struct bah_softc *sc) ifp = &sc->sc_arccom.ac_if; #ifdef BAH_DEBUG - printf("%s: reset\n", device_xname(&sc->sc_dev)); + printf("%s: reset\n", device_xname(sc->sc_dev)); #endif /* stop and restart hardware */ @@ -266,7 +266,7 @@ bah_reset(struct bah_softc *sc) #if defined(BAH_DEBUG) && (BAH_DEBUG > 2) printf("%s: reset: card reset, link addr = 0x%02x (%ld)\n", - device_xname(&sc->sc_dev), linkaddress, linkaddress); + device_xname(sc->sc_dev), linkaddress, linkaddress); #endif /* tell the routing level about the (possibly changed) link address */ @@ -279,13 +279,13 @@ bah_reset(struct bah_softc *sc) #ifdef BAH_DEBUG printf("%s: reset: chip configured, status=0x%02x\n", - device_xname(&sc->sc_dev), GETREG(BAHSTAT)); + device_xname(sc->sc_dev), GETREG(BAHSTAT)); #endif PUTREG(BAHCMD, BAH_CLR(CLR_POR|CLR_RECONFIG)); #ifdef BAH_DEBUG printf("%s: reset: bits cleared, status=0x%02x\n", - device_xname(&sc->sc_dev), GETREG(BAHSTAT)); + device_xname(sc->sc_dev), GETREG(BAHSTAT)); #endif sc->sc_reconcount_excessive = ARC_EXCESSIVE_RECONS; @@ -301,7 +301,7 @@ bah_reset(struct bah_softc *sc) #ifdef BAH_DEBUG printf("%s: reset: started receiver, status=0x%02x\n", - device_xname(&sc->sc_dev), GETREG(BAHSTAT)); + device_xname(sc->sc_dev), GETREG(BAHSTAT)); #endif /* and init transmitter status */ @@ -360,7 +360,7 @@ bah_start(struct ifnet *ifp) #endif #if defined(BAH_DEBUG) && (BAH_DEBUG > 3) - printf("%s: start(0x%x)\n", device_xname(&sc->sc_dev), ifp); + printf("%s: start(0x%x)\n", device_xname(sc->sc_dev), ifp); #endif if ((ifp->if_flags & IFF_RUNNING) == 0) @@ -394,7 +394,7 @@ bah_start(struct ifnet *ifp) if (m->m_len < ARC_HDRLEN) m = m_pullup(m, ARC_HDRLEN);/* gcc does structure padding */ printf("%s: start: filling %ld from %ld to %ld type %ld\n", - device_xname(&sc->sc_dev), buffer, mtod(m, u_char *)[0], + device_xname(sc->sc_dev), buffer, mtod(m, u_char *)[0], mtod(m, u_char *)[1], mtod(m, u_char *)[2]); #else if (m->m_len < 2) @@ -461,7 +461,7 @@ bah_start(struct ifnet *ifp) } else { #ifdef BAH_DEBUG printf("%s: start: starting transmitter on buffer %d\n", - device_xname(&sc->sc_dev), buffer); + device_xname(sc->sc_dev), buffer); #endif /* Transmitter was off, start it */ sc->sc_tx_act = buffer; @@ -628,7 +628,7 @@ cleanup: #ifdef BAH_DEBUG printf("%s: srint: restarted rx on buf %ld\n", - device_xname(&sc->sc_dev), buffer); + device_xname(sc->sc_dev), buffer); #endif } splx(s); @@ -695,7 +695,7 @@ bah_tint(struct bah_softc *sc, int isr) #if defined(BAH_DEBUG) && (BAH_DEBUG > 1) printf("%s: tint: starting tx on buffer %d, status 0x%02x\n", - device_xname(&sc->sc_dev), buffer, GETREG(BAHSTAT)); + device_xname(sc->sc_dev), buffer, GETREG(BAHSTAT)); #endif } else { /* have to disable TX interrupt */ @@ -706,7 +706,7 @@ bah_tint(struct bah_softc *sc, int isr) #ifdef BAH_DEBUG printf("%s: tint: no more buffers to send, status 0x%02x\n", - device_xname(&sc->sc_dev), GETREG(BAHSTAT)); + device_xname(sc->sc_dev), GETREG(BAHSTAT)); #endif } @@ -745,7 +745,7 @@ bahintr(void *arg) #if defined(BAH_DEBUG) && (BAH_DEBUG>1) printf("%s: intr: status 0x%02x, intmask 0x%02x\n", - device_xname(&sc->sc_dev), isr, sc->sc_intmask); + device_xname(sc->sc_dev), isr, sc->sc_intmask); #endif if (maskedisr & BAH_POR) { @@ -757,7 +757,7 @@ bahintr(void *arg) PUTREG(BAHCMD, BAH_CLR(CLR_POR)); log(LOG_WARNING, "%s: intr: got spurious power on reset int\n", - device_xname(&sc->sc_dev)); + device_xname(sc->sc_dev)); } if (maskedisr & BAH_RECON) { @@ -788,7 +788,7 @@ bahintr(void *arg) (++sc->sc_reconcount == ARC_EXCESSIVE_RECONS)) { log(LOG_WARNING, "%s: excessive token losses, " - "cable problem?\n", device_xname(&sc->sc_dev)); + "cable problem?\n", device_xname(sc->sc_dev)); } sc->sc_recontime = newsec; callout_reset(&sc->sc_recon_ch, 15 * hz, @@ -798,7 +798,7 @@ bahintr(void *arg) if (maskedisr & BAH_RI) { #if defined(BAH_DEBUG) && (BAH_DEBUG > 1) printf("%s: intr: hard rint, act %ld\n", - device_xname(&sc->sc_dev), sc->sc_rx_act); + device_xname(sc->sc_dev), sc->sc_rx_act); #endif buffer = sc->sc_rx_act; @@ -810,7 +810,7 @@ bahintr(void *arg) */ log(LOG_WARNING, "%s: spurious RX interrupt or sender 0 " - " (ignored)\n", device_xname(&sc->sc_dev)); + " (ignored)\n", device_xname(sc->sc_dev)); /* * restart receiver on same buffer. * XXX maybe better reset interface? @@ -835,7 +835,7 @@ bahintr(void *arg) #ifdef BAH_DEBUG printf("%s: strt rx for buf %ld, " "stat 0x%02x\n", - device_xname(&sc->sc_dev), sc->sc_rx_act, + device_xname(sc->sc_dev), sc->sc_rx_act, GETREG(BAHSTAT)); #endif } @@ -870,7 +870,7 @@ bah_reconwatch(void *arg) if (sc->sc_reconcount >= ARC_EXCESSIVE_RECONS) { sc->sc_reconcount = 0; log(LOG_WARNING, "%s: token valid again.\n", - device_xname(&sc->sc_dev)); + device_xname(sc->sc_dev)); } sc->sc_reconcount = 0; } @@ -896,7 +896,7 @@ bah_ioctl(struct ifnet *ifp, u_long cmd, #if defined(BAH_DEBUG) && (BAH_DEBUG > 2) printf("%s: ioctl() called, cmd = 0x%x\n", - device_xname(&sc->sc_dev), cmd); + device_xname(sc->sc_dev), cmd); #endif switch (cmd) { Index: sys/dev/ic/smc90cx6var.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/ic/smc90cx6var.h,v retrieving revision 1.10 diff -u -p -r1.10 smc90cx6var.h --- sys/dev/ic/smc90cx6var.h 1 Aug 2011 12:28:53 -0000 1.10 +++ sys/dev/ic/smc90cx6var.h 28 Sep 2012 14:12:46 -0000 @@ -48,7 +48,7 @@ #include struct bah_softc { - struct device sc_dev; + device_t sc_dev; struct arccom sc_arccom; /* Common arcnet structures */ bus_space_tag_t sc_bst_r, sc_bst_m; bus_space_handle_t sc_regs, sc_mem; Index: sys/dev/ic/smc91cxx.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/ic/smc91cxx.c,v retrieving revision 1.82 diff -u -p -r1.82 smc91cxx.c --- sys/dev/ic/smc91cxx.c 22 Jul 2012 14:32:58 -0000 1.82 +++ sys/dev/ic/smc91cxx.c 26 Sep 2012 21:12:43 -0000 @@ -254,7 +254,7 @@ smc91cxx_attach(struct smc91cxx_softc *s tmp = bus_space_read_2(bst, bsh, BANK_SELECT_REG_W); /* check magic number */ if ((tmp & BSR_DETECT_MASK) != BSR_DETECT_VALUE) { - aprint_error_dev(&sc->sc_dev, "failed to detect chip, bsr=%04x\n", tmp); + aprint_error_dev(sc->sc_dev, "failed to detect chip, bsr=%04x\n", tmp); return; } @@ -266,7 +266,7 @@ smc91cxx_attach(struct smc91cxx_softc *s sc->sc_chipid = RR_ID(tmp); idstr = smc91cxx_idstrs[sc->sc_chipid]; - aprint_normal_dev(&sc->sc_dev, ""); + aprint_normal_dev(sc->sc_dev, ""); if (idstr != NULL) aprint_normal("%s, ", idstr); else @@ -301,11 +301,11 @@ smc91cxx_attach(struct smc91cxx_softc *s myea[i] = tmp & 0xff; } } - aprint_normal_dev(&sc->sc_dev, "MAC address %s, ", + aprint_normal_dev(sc->sc_dev, "MAC address %s, ", ether_sprintf(myea)); /* Initialize the ifnet structure. */ - 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 = smc91cxx_start; ifp->if_ioctl = smc91cxx_ioctl; @@ -349,7 +349,7 @@ smc91cxx_attach(struct smc91cxx_softc *s sc->sc_internal_phy = !(tmp & CR_AUI_SELECT); } else aprint_normal("\n"); - mii_attach(&sc->sc_dev, &sc->sc_mii, miicapabilities, + mii_attach(sc->sc_dev, &sc->sc_mii, miicapabilities, MII_PHY_ANY, MII_OFFSET_ANY, 0); if (LIST_FIRST(&sc->sc_mii.mii_phys) == NULL) { ifmedia_add(&sc->sc_mii.mii_media, @@ -381,7 +381,7 @@ smc91cxx_attach(struct smc91cxx_softc *s break; } - rnd_attach_source(&sc->rnd_source, device_xname(&sc->sc_dev), + rnd_attach_source(&sc->rnd_source, device_xname(sc->sc_dev), RND_TYPE_NET, 0); callout_init(&sc->sc_mii_callout, 0); @@ -661,7 +661,7 @@ smc91cxx_start(struct ifnet *ifp) * truncate them instead? */ if ((len + pad) > (ETHER_MAX_LEN - ETHER_CRC_LEN)) { - printf("%s: large packet discarded\n", device_xname(&sc->sc_dev)); + printf("%s: large packet discarded\n", device_xname(sc->sc_dev)); ifp->if_oerrors++; IFQ_DEQUEUE(&ifp->if_snd, m); m_freem(m); @@ -918,7 +918,7 @@ smc91cxx_intr(void *arg) #endif if ((sc->sc_flags & SMC_FLAGS_ENABLED) == 0 || - !device_is_active(&sc->sc_dev)) + !device_is_active(sc->sc_dev)) return (0); SMC_SELECT_BANK(sc, 2); @@ -976,7 +976,7 @@ smc91cxx_intr(void *arg) #if 1 /* DIAGNOSTIC */ packetno = bus_space_read_2(bst, bsh, FIFO_PORTS_REG_W); if (packetno & FIFO_REMPTY) { - aprint_error_dev(&sc->sc_dev, "receive interrupt on empty fifo\n"); + aprint_error_dev(sc->sc_dev, "receive interrupt on empty fifo\n"); goto out; } else #endif @@ -1039,7 +1039,7 @@ smc91cxx_intr(void *arg) static int txsuc_count; if (ppsratecheck(&txsuc_last, &txsuc_count, 1)) printf("%s: successful packet caused TX" - " interrupt?!\n", device_xname(&sc->sc_dev)); + " interrupt?!\n", device_xname(sc->sc_dev)); } else ifp->if_oerrors++; @@ -1221,7 +1221,7 @@ smc91cxx_read(struct smc91cxx_softc *sc) if ((m->m_flags & M_EXT) == 0) { m_freem(m); ifp->if_ierrors++; - aprint_error_dev(&sc->sc_dev, "can't allocate cluster for incoming packet\n"); + aprint_error_dev(sc->sc_dev, "can't allocate cluster for incoming packet\n"); goto out; } @@ -1424,7 +1424,7 @@ smc91cxx_watchdog(struct ifnet *ifp) { struct smc91cxx_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++; smc91cxx_reset(sc); } @@ -1466,7 +1466,7 @@ smc91cxx_enable(struct smc91cxx_softc *s if ((sc->sc_flags & SMC_FLAGS_ENABLED) == 0 && sc->sc_enable != NULL) { if ((*sc->sc_enable)(sc) != 0) { - aprint_error_dev(&sc->sc_dev, "device enable failed\n"); + aprint_error_dev(sc->sc_dev, "device enable failed\n"); return (EIO); } } @@ -1606,7 +1606,7 @@ smc91cxx_tick(void *arg) panic("smc91cxx_tick"); #endif - if (!device_is_active(&sc->sc_dev)) + if (!device_is_active(sc->sc_dev)) return; s = splnet(); Index: sys/dev/ic/smc91cxxvar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/ic/smc91cxxvar.h,v retrieving revision 1.18 diff -u -p -r1.18 smc91cxxvar.h --- sys/dev/ic/smc91cxxvar.h 2 Feb 2012 19:43:03 -0000 1.18 +++ sys/dev/ic/smc91cxxvar.h 26 Sep 2012 21:11:53 -0000 @@ -33,7 +33,7 @@ #include struct smc91cxx_softc { - struct device sc_dev; /* generic device glue */ + device_t sc_dev; /* generic device glue */ struct ethercom sc_ec; /* ethernet common glue */ struct mii_data sc_mii; /* MII/media control */ Index: sys/dev/ic/spdmem.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/ic/spdmem.c,v retrieving revision 1.6 diff -u -p -r1.6 spdmem.c --- sys/dev/ic/spdmem.c 31 May 2012 16:09:34 -0000 1.6 +++ sys/dev/ic/spdmem.c 29 Sep 2012 12:46:27 -0000 @@ -417,7 +417,7 @@ decode_size_speed(device_t self, const s bool round, const char *ddr_type_string, int speed) { int p_clk; - struct spdmem_softc *sc = (struct spdmem_softc *)device_private(self); + struct spdmem_softc *sc = device_private(self); if (dimm_size < 1024) aprint_normal("%dMB", dimm_size); Index: sys/dev/ic/tcic2.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/ic/tcic2.c,v retrieving revision 1.37 diff -u -p -r1.37 tcic2.c --- sys/dev/ic/tcic2.c 24 Aug 2012 09:01:23 -0000 1.37 +++ sys/dev/ic/tcic2.c 28 Sep 2012 21:18:37 -0000 @@ -370,7 +370,7 @@ tcic_attach(struct tcic_softc *sc) if ((sc->handle[0].flags & TCIC_FLAG_SOCKETP) || (sc->handle[1].flags & TCIC_FLAG_SOCKETP)) { - printf("%s: %s has ", device_xname(&sc->dev), + printf("%s: %s has ", device_xname(sc->sc_dev), tcic_chipid_to_string(sc->chipid)); if ((sc->handle[0].flags & TCIC_FLAG_SOCKETP) && @@ -416,7 +416,7 @@ tcic_attach_socket(struct tcic_handle *h locs[PCMCIABUSCF_CONTROLLER] = 0; locs[PCMCIABUSCF_SOCKET] = h->sock; - h->pcmcia = config_found_sm_loc(&h->sc->dev, "pcmciabus", locs, &paa, + h->pcmcia = config_found_sm_loc(h->sc->sc_dev, "pcmciabus", locs, &paa, tcic_print, config_stdsubmatch); /* if there's actually a pcmcia device attached, initialize the slot */ @@ -443,8 +443,8 @@ tcic_create_event_thread(void *arg) } if (kthread_create(PRI_NONE, 0, NULL, tcic_event_thread, h, - &h->event_thread, "%s,%s", device_xname(&h->sc->dev), cs)) { - aprint_error_dev(&h->sc->dev, "unable to create event thread for sock 0x%02x\n", h->sock); + &h->event_thread, "%s,%s", device_xname(h->sc->sc_dev), cs)) { + aprint_error_dev(h->sc->sc_dev, "unable to create event thread for sock 0x%02x\n", h->sock); panic("tcic_create_event_thread"); } } @@ -468,12 +468,12 @@ tcic_event_thread(void *arg) switch (pe->pe_type) { case TCIC_EVENT_INSERTION: - DPRINTF(("%s: insertion event\n", device_xname(&h->sc->dev))); + DPRINTF(("%s: insertion event\n", device_xname(h->sc->sc_dev))); tcic_attach_card(h); break; case TCIC_EVENT_REMOVAL: - DPRINTF(("%s: removal event\n", device_xname(&h->sc->dev))); + DPRINTF(("%s: removal event\n", device_xname(h->sc->sc_dev))); tcic_detach_card(h, DETACH_FORCE); break; @@ -536,7 +536,7 @@ tcic_intr(void *arg) struct tcic_softc *sc = arg; int i, ret = 0; - DPRINTF(("%s: intr\n", device_xname(&sc->dev))); + DPRINTF(("%s: intr\n", device_xname(sc->sc_dev))); for (i = 0; i < TCIC_NSLOTS; i++) if (sc->handle[i].flags & TCIC_FLAG_SOCKETP) @@ -554,19 +554,19 @@ tcic_intr_socket(struct tcic_handle *h) tcic_sel_sock(h); icsr = tcic_read_1(h, TCIC_R_ICSR); - DPRINTF(("%s: %d icsr: 0x%02x \n", device_xname(&h->sc->dev), h->sock, icsr)); + DPRINTF(("%s: %d icsr: 0x%02x \n", device_xname(h->sc->sc_dev), h->sock, icsr)); /* XXX or should the next three be handled in tcic_intr? -chb */ if (icsr & TCIC_ICSR_PROGTIME) { - DPRINTF(("%s: %02x PROGTIME\n", device_xname(&h->sc->dev), h->sock)); + DPRINTF(("%s: %02x PROGTIME\n", device_xname(h->sc->sc_dev), h->sock)); rv = 1; } if (icsr & TCIC_ICSR_ILOCK) { - DPRINTF(("%s: %02x ILOCK\n", device_xname(&h->sc->dev), h->sock)); + DPRINTF(("%s: %02x ILOCK\n", device_xname(h->sc->sc_dev), h->sock)); rv = 1; } if (icsr & TCIC_ICSR_ERR) { - DPRINTF(("%s: %02x ERR\n", device_xname(&h->sc->dev), h->sock)); + DPRINTF(("%s: %02x ERR\n", device_xname(h->sc->sc_dev), h->sock)); rv = 1; } if (icsr & TCIC_ICSR_CDCHG) { @@ -581,7 +581,7 @@ tcic_intr_socket(struct tcic_handle *h) if (delta) rv = 1; - DPRINTF(("%s: %02x CDCHG %x\n", device_xname(&h->sc->dev), h->sock, + DPRINTF(("%s: %02x CDCHG %x\n", device_xname(h->sc->sc_dev), h->sock, delta)); /* @@ -593,34 +593,34 @@ tcic_intr_socket(struct tcic_handle *h) if (sstat & TCIC_SSTAT_CD) { if (!(h->flags & TCIC_FLAG_CARDP)) { DPRINTF(("%s: enqueing INSERTION event\n", - device_xname(&h->sc->dev))); + device_xname(h->sc->sc_dev))); tcic_queue_event(h, TCIC_EVENT_INSERTION); } } else { if (h->flags & TCIC_FLAG_CARDP) { /* Deactivate the card now. */ DPRINTF(("%s: deactivating card\n", - device_xname(&h->sc->dev))); + device_xname(h->sc->sc_dev))); tcic_deactivate_card(h); DPRINTF(("%s: enqueing REMOVAL event\n", - device_xname(&h->sc->dev))); + device_xname(h->sc->sc_dev))); tcic_queue_event(h, TCIC_EVENT_REMOVAL); } } } if (delta & TCIC_SSTAT_RDY) { - DPRINTF(("%s: %02x READY\n", device_xname(&h->sc->dev), h->sock)); + DPRINTF(("%s: %02x READY\n", device_xname(h->sc->sc_dev), h->sock)); /* shouldn't happen */ } if (delta & TCIC_SSTAT_LBAT1) { - DPRINTF(("%s: %02x LBAT1\n", device_xname(&h->sc->dev), h->sock)); + DPRINTF(("%s: %02x LBAT1\n", device_xname(h->sc->sc_dev), h->sock)); } if (delta & TCIC_SSTAT_LBAT2) { - DPRINTF(("%s: %02x LBAT2\n", device_xname(&h->sc->dev), h->sock)); + DPRINTF(("%s: %02x LBAT2\n", device_xname(h->sc->sc_dev), h->sock)); } if (delta & TCIC_SSTAT_WP) { - DPRINTF(("%s: %02x WP\n", device_xname(&h->sc->dev), h->sock)); + DPRINTF(("%s: %02x WP\n", device_xname(h->sc->sc_dev), h->sock)); } } return rv; @@ -1108,7 +1108,7 @@ tcic_chip_io_map(pcmcia_chipset_handle_t /* XXX wtf is this doing here? */ - printf("%s: port 0x%lx", device_xname(&h->sc->dev), (u_long) ioaddr); + printf("%s: port 0x%lx", device_xname(h->sc->sc_dev), (u_long) ioaddr); if (size > 1) printf("-0x%lx", (u_long) ioaddr + (u_long) size - 1); printf("\n"); @@ -1231,7 +1231,7 @@ tcic_chip_socket_settype(pcmcia_chipset_ tcic_write_ind_2(h, TCIC_IR_SCF1_N(h->sock), reg); DPRINTF(("%s: tcic_chip_socket_enable %d cardtype %s 0x%02x\n", - device_xname(&h->sc->dev), h->sock, + device_xname(h->sc->sc_dev), h->sock, ((type == PCMCIA_IFTYPE_IO) ? "io" : "mem"), reg)); } Index: sys/dev/ic/tcic2var.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/ic/tcic2var.h,v retrieving revision 1.12 diff -u -p -r1.12 tcic2var.h --- sys/dev/ic/tcic2var.h 12 May 2009 14:25:18 -0000 1.12 +++ sys/dev/ic/tcic2var.h 28 Sep 2012 21:12:39 -0000 @@ -96,8 +96,7 @@ struct tcic_handle { #define TCIC_NSLOTS 2 struct tcic_softc { - struct device dev; - + device_t sc_dev; bus_space_tag_t memt; bus_space_handle_t memh; bus_space_tag_t iot; Index: sys/dev/ic/timer_cpcbus.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/ic/timer_cpcbus.c,v retrieving revision 1.11 diff -u -p -r1.11 timer_cpcbus.c --- sys/dev/ic/timer_cpcbus.c 12 May 2009 14:25:18 -0000 1.11 +++ sys/dev/ic/timer_cpcbus.c 28 Sep 2012 19:35:20 -0000 @@ -40,14 +40,13 @@ __KERNEL_RCSID(0, "$NetBSD: timer_cpcbus #include struct cpctim_softc { - struct device sc_dev; void *sc_ih; }; static int cpctim_match(device_t, cfdata_t, void *); static void cpctim_attach(device_t, device_t, void *); -CFATTACH_DECL(cpctim, sizeof(struct cpctim_softc), +CFATTACH_DECL_NEW(cpctim, sizeof(struct cpctim_softc), cpctim_match, cpctim_attach, NULL, NULL); int @@ -63,7 +62,7 @@ cpctim_attach(device_t parent, device_t { #if 0 struct cpcbus_attach_args *caa = aux; - struct cpctim_softc *sc = (struct cpctim_softc *)self; + struct cpctim_softc *sc = device_private(self); int addr = caa->cpca_addr; int irq = caa->cpca_irq; Index: sys/dev/ic/tms320av110.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/ic/tms320av110.c,v retrieving revision 1.22 diff -u -p -r1.22 tms320av110.c --- sys/dev/ic/tms320av110.c 23 Nov 2011 23:07:32 -0000 1.22 +++ sys/dev/ic/tms320av110.c 28 Sep 2012 14:26:33 -0000 @@ -140,7 +140,7 @@ tms320av110_attach_mi(struct tav_softc * tav_write_byte(iot, ioh, TAV_SYNC_ECM, TAV_ECM_REPEAT); tav_write_byte(iot, ioh, TAV_CRC_ECM, TAV_ECM_REPEAT); - audio_attach_mi(&tav_audio_if, sc, &sc->sc_dev); + audio_attach_mi(&tav_audio_if, sc, sc->sc_dev); } int @@ -350,7 +350,7 @@ tav_getdev(void *hdl, struct audio_devic /* guaranteed to be <= 4 in length */ snprintf(ret->version, sizeof(ret->version), "%u", tav_read_byte(iot, ioh, TAV_VERSION)); - strlcpy(ret->config, device_xname(&sc->sc_dev), sizeof(ret->config)); + strlcpy(ret->config, device_xname(sc->sc_dev), sizeof(ret->config)); return 0; } Index: sys/dev/ic/tms320av110var.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/ic/tms320av110var.h,v retrieving revision 1.11 diff -u -p -r1.11 tms320av110var.h --- sys/dev/ic/tms320av110var.h 23 Nov 2011 23:07:32 -0000 1.11 +++ sys/dev/ic/tms320av110var.h 28 Sep 2012 14:26:44 -0000 @@ -45,7 +45,7 @@ /* softc */ struct tav_softc { - struct device sc_dev; + device_t sc_dev; kmutex_t sc_lock; kmutex_t sc_intr_lock; kcondvar_t sc_cv; Index: sys/dev/ic/tpmvar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/ic/tpmvar.h,v retrieving revision 1.2 diff -u -p -r1.2 tpmvar.h --- sys/dev/ic/tpmvar.h 22 Jan 2012 20:41:25 -0000 1.2 +++ sys/dev/ic/tpmvar.h 2 Oct 2012 02:21:09 -0000 @@ -18,7 +18,7 @@ */ struct tpm_softc { - struct device *sc_dev; + device_t sc_dev; void *sc_ih; int (*sc_init)(struct tpm_softc *, int, const char *); Index: sys/dev/ic/tropic.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/ic/tropic.c,v retrieving revision 1.43 diff -u -p -r1.43 tropic.c --- sys/dev/ic/tropic.c 1 Aug 2011 12:28:53 -0000 1.43 +++ sys/dev/ic/tropic.c 26 Sep 2012 23:05:05 -0000 @@ -187,7 +187,7 @@ tr_config(struct tr_softc *sc) } if (i == 30000 && sc->sc_srb == ACA_RDW(sc, ACA_WRBR)) { - aprint_error_dev(&sc->sc_dev, "no response for fast path cfg\n"); + aprint_error_dev(sc->sc_dev, "no response for fast path cfg\n"); return 1; } @@ -195,7 +195,7 @@ tr_config(struct tr_softc *sc) if ((SRB_INB(sc, sc->sc_srb, SRB_RETCODE) != 0)) { printf("%s: cfg fast path returned: 0x%02x\n", - device_xname(&sc->sc_dev), + device_xname(sc->sc_dev), SRB_INB(sc, sc->sc_srb, SRB_RETCODE)); return 1; } @@ -326,7 +326,7 @@ tr_attach(struct tr_softc *sc) /* * init network-visible interface */ - 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_ioctl = tr_ioctl; if (sc->sc_init_status & FAST_PATH_TRANSMIT) @@ -423,7 +423,7 @@ tr_attach(struct tr_softc *sc) token_ifattach(ifp, myaddr); - printf("%s: address %s ring speed %d Mbps\n", device_xname(&sc->sc_dev), + printf("%s: address %s ring speed %d Mbps\n", device_xname(sc->sc_dev), token_sprintf(myaddr), (sc->sc_init_status & RSP_16) ? 16 : 4); callout_init(&sc->sc_init_callout, 0); @@ -447,7 +447,7 @@ tr_setspeed(struct tr_softc *sc, u_int8_ if ((SRB_INB(sc, sc->sc_srb, SRB_RETCODE) != 0)) { printf("%s: set default ringspeed returned: 0x%02x\n", - device_xname(&sc->sc_dev), SRB_INB(sc, sc->sc_srb, SRB_RETCODE)); + device_xname(sc->sc_dev), SRB_INB(sc, sc->sc_srb, SRB_RETCODE)); return 1; } return 0; @@ -505,7 +505,7 @@ tr_reset(struct tr_softc *sc) } if (i == 35000 && sc->sc_srb == 0) { - aprint_error_dev(&sc->sc_dev, "no response from adapter after reset\n"); + aprint_error_dev(sc->sc_dev, "no response from adapter after reset\n"); return 1; } @@ -514,12 +514,12 @@ tr_reset(struct tr_softc *sc) ACA_OUTB(sc, ACA_RRR_e, (sc->sc_maddr >> 12)); sc->sc_srb = ACA_RDW(sc, ACA_WRBR); if (SRB_INB(sc, sc->sc_srb, SRB_CMD) != 0x80) { - aprint_error_dev(&sc->sc_dev, "initialization incomplete, status: 0x%02x\n", + aprint_error_dev(sc->sc_dev, "initialization incomplete, status: 0x%02x\n", SRB_INB(sc, sc->sc_srb, SRB_CMD)); return 1; } if (SRB_INB(sc, sc->sc_srb, SRB_INIT_BUC) != 0) { - aprint_error_dev(&sc->sc_dev, "Bring Up Code %02x\n", + aprint_error_dev(sc->sc_dev, "Bring Up Code %02x\n", SRB_INB(sc, sc->sc_srb, SRB_INIT_BUC)); return 1; } @@ -800,7 +800,7 @@ tr_intr(void *arg) /* Is this interrupt caused by an adapter check? */ if (status & ADAP_CHK_INT) { printf("%s: adapter check 0x%04x\n", - device_xname(&sc->sc_dev), + device_xname(sc->sc_dev), (unsigned int)ntohs(ACA_RDW(sc, ACA_WWCR))); /* Clear this interrupt bit */ @@ -838,7 +838,7 @@ tr_intr(void *arg) case XMIT_UI_FRM: /* Response to xmit request */ /* Response not valid? */ if (retcode != 0xff) - aprint_error_dev(&sc->sc_dev, "error on xmit request = " + aprint_error_dev(sc->sc_dev, "error on xmit request = " "0x%x\n", retcode); break; @@ -869,7 +869,7 @@ tr_intr(void *arg) sc->sc_xmit_buffers; #ifdef TROPICDEBUG printf("%s: %d buffers\n", - device_xname(&sc->sc_dev), + device_xname(sc->sc_dev), sc->sc_xmit_buffers); #endif sc->sc_xmit_correlator = 0; @@ -879,7 +879,7 @@ tr_intr(void *arg) tr_opensap(sc, LLC_SNAP_LSAP); } else { - aprint_error_dev(&sc->sc_dev, "open error = 0x%x\n", + aprint_error_dev(sc->sc_dev, "open error = 0x%x\n", SRB_INB(sc, srb, SRB_RETCODE)); ifp->if_flags &= ~IFF_RUNNING; ifp->if_flags &= ~IFF_UP; @@ -895,7 +895,7 @@ tr_intr(void *arg) case DIR_CLOSE: /* Response to close adapter command */ /* Close not successful? */ if (retcode != 0) - aprint_error_dev(&sc->sc_dev, "close error = 0x%x\n", retcode); + aprint_error_dev(sc->sc_dev, "close error = 0x%x\n", retcode); else { ifp->if_flags &= ~IFF_RUNNING; ifp->if_flags &= ~IFF_UP; @@ -915,7 +915,7 @@ tr_intr(void *arg) SRB_INW(sc, sap_srb, SRB_OPNSAP_STATIONID); printf("%s: Token Ring opened\n", - device_xname(&sc->sc_dev)); + device_xname(sc->sc_dev)); wakeup(&sc->tr_sleepevent); break; /* XXX DLC_CLOSE_SAP not needed ? */ @@ -924,34 +924,34 @@ tr_intr(void *arg) case DIR_READ_LOG: /* Response to read log */ /* Cmd not successful? */ if (retcode != 0) - aprint_error_dev(&sc->sc_dev, "read error log cmd err = " + aprint_error_dev(sc->sc_dev, "read error log cmd err = " "0x%x\n", retcode); #ifdef TROPICDEBUG log_srb = sc->sc_srb; - printf("%s: ERROR LOG:\n", device_xname(&sc->sc_dev)); + printf("%s: ERROR LOG:\n", device_xname(sc->sc_dev)); printf("%s: Line=%d, Internal=%d, Burst=%d\n", - device_xname(&sc->sc_dev), + device_xname(sc->sc_dev), (SRB_INB(sc, log_srb, SRB_LOG_LINEERRS)), (SRB_INB(sc, log_srb, SRB_LOG_INTERRS)), (SRB_INB(sc, log_srb, SRB_LOG_BRSTERRS))); printf("%s: A/C=%d, Abort=%d, Lost frames=%d\n", - device_xname(&sc->sc_dev), + device_xname(sc->sc_dev), (SRB_INB(sc, log_srb, SRB_LOG_ACERRS)), (SRB_INB(sc, log_srb, SRB_LOG_ABRTERRS)), (SRB_INB(sc, log_srb, SRB_LOG_LOSTFRMS))); printf("%s: Receive congestion=%d, Frame copied=%d, Frequency=%d\n", - device_xname(&sc->sc_dev), + device_xname(sc->sc_dev), (SRB_INB(sc, log_srb, SRB_LOG_RCVCONG)), (SRB_INB(sc, log_srb, SRB_LOG_FCPYERRS)), (SRB_INB(sc, log_srb, SRB_LOG_FREQERRS))); - printf("%s: Token=%d\n", device_xname(&sc->sc_dev), + printf("%s: Token=%d\n", device_xname(sc->sc_dev), (SRB_INB(sc, log_srb, SRB_LOG_TOKENERRS))); #endif /* TROPICDEBUG */ ifp->if_flags &= ~IFF_OACTIVE; break; default: printf("%s: bad SRB command encountered 0x%x\n", - device_xname(&sc->sc_dev), command); + device_xname(sc->sc_dev), command); break; } /* clear the SRB-response interrupt bit */ @@ -974,16 +974,16 @@ tr_intr(void *arg) case REC_DATA: /* Receive */ /* Response not valid? */ if (retcode != 0xff) - aprint_error_dev(&sc->sc_dev, "ASB bad receive response = 0x%x\n", retcode); + aprint_error_dev(sc->sc_dev, "ASB bad receive response = 0x%x\n", retcode); break; case XMIT_DIR_FRAME: /* Transmit */ case XMIT_UI_FRM: /* Transmit */ /* Response not valid? */ if (retcode != 0xff) - aprint_error_dev(&sc->sc_dev, "ASB response err on xmit = 0x%x\n", retcode); + aprint_error_dev(sc->sc_dev, "ASB response err on xmit = 0x%x\n", retcode); break; default: - aprint_error_dev(&sc->sc_dev, "invalid command in ASB = 0x%x\n", command); + aprint_error_dev(sc->sc_dev, "invalid command in ASB = 0x%x\n", command); break; } /* Clear this interrupt bit */ @@ -996,7 +996,7 @@ tr_intr(void *arg) switch (command) { case DLC_STATUS: /* DLC status change */ printf("%s: ARB new DLC status = 0x%x\n", - device_xname(&sc->sc_dev), + device_xname(sc->sc_dev), ARB_INW(sc, arb, ARB_DLCSTAT_STATUS)); break; case REC_DATA: /* Adapter has data for PC */ @@ -1007,7 +1007,7 @@ tr_intr(void *arg) case RING_STAT_CHANGE: /* Ring status change */ if (ARB_INW(sc, arb, ARB_RINGSTATUS) & (SIGNAL_LOSS + LOBE_FAULT)){ - aprint_error_dev(&sc->sc_dev, "signal loss / lobe fault\n"); + aprint_error_dev(sc->sc_dev, "signal loss / lobe fault\n"); ifp->if_flags &= ~IFF_RUNNING; ifp->if_flags &= ~IFF_UP; IFQ_PURGE(&ifp->if_snd); @@ -1020,7 +1020,7 @@ tr_intr(void *arg) ~(SOFT_ERR)) printf("%s: ARB new ring status" " = 0x%x\n", - device_xname(&sc->sc_dev), + device_xname(sc->sc_dev), ARB_INW(sc, arb, ARB_RINGSTATUS)); #endif /* TROPICDEBUG */ @@ -1044,7 +1044,7 @@ tr_intr(void *arg) break; default: - aprint_error_dev(&sc->sc_dev, "invalid command in ARB = 0x%x\n", command); + aprint_error_dev(sc->sc_dev, "invalid command in ARB = 0x%x\n", command); break; } @@ -1067,11 +1067,11 @@ tr_intr(void *arg) /* collect status on last packet */ if (retcode != 0) { printf("%s: xmit return code = 0x%x\n", - device_xname(&sc->sc_dev), retcode); + device_xname(sc->sc_dev), retcode); /* XXXchb */ if (retcode == 0x22) { printf("%s: FS = 0x%2x\n", - device_xname(&sc->sc_dev), + device_xname(sc->sc_dev), SSB_INB(sc, ssb, SSB_XMITERR)); } @@ -1094,7 +1094,7 @@ tr_intr(void *arg) retcode); break; default: - aprint_error_dev(&sc->sc_dev, "SSB error, invalid command =%x\n", command); + aprint_error_dev(sc->sc_dev, "SSB error, invalid command =%x\n", command); } /* clear this interrupt bit */ ACA_RSTB(sc, ACA_ISRP_o, ~(SSB_RESP_INT)); @@ -1108,7 +1108,7 @@ tr_intr(void *arg) /* Is this interrupt caused by an adapter error or access violation? */ if (ACA_RDB(sc, ACA_ISRP_e) & (TCR_INT | ERR_INT | ACCESS_INT)) { printf("%s: adapter error, ISRP_e = 0x%x\n", - device_xname(&sc->sc_dev), ACA_RDB(sc, ACA_ISRP_e)); + device_xname(sc->sc_dev), ACA_RDB(sc, ACA_ISRP_e)); /* Clear these interrupt bits */ ACA_RSTB(sc, ACA_ISRP_e, ~(TCR_INT | ERR_INT | ACCESS_INT)); @@ -1338,7 +1338,7 @@ tr_oldxint(struct tr_softc *sc) ASB_OUTW(sc, asb, XMIT_FRAMELEN, size); } else { - aprint_error_dev(&sc->sc_dev, "unexpected empty mbuf send queue\n"); + aprint_error_dev(sc->sc_dev, "unexpected empty mbuf send queue\n"); /* Set size of transmission frame in ASB to zero. */ ASB_OUTW(sc, asb, XMIT_FRAMELEN, 0); @@ -1374,7 +1374,7 @@ tr_xint(struct tr_softc *sc) txbuf = TXB_INW(sc, txbuf, XMIT_NEXTBUF) - XMIT_NEXTBUF; if (TXB_INB(sc, txbuf, XMIT_RETCODE) != 0) { ifp->if_oerrors++; - aprint_error_dev(&sc->sc_dev, "xmit error = 0x%x\n", + aprint_error_dev(sc->sc_dev, "xmit error = 0x%x\n", TXB_INB(sc, txbuf, XMIT_RETCODE)); } sc->sc_xmit_buffers += @@ -1669,7 +1669,7 @@ tr_sleep(struct tr_softc *sc) error = tsleep(&sc->tr_sleepevent, 1, "trsleep", hz * 30); if (error == EWOULDBLOCK) - printf("%s: sleep event timeout\n", device_xname(&sc->sc_dev)); + printf("%s: sleep event timeout\n", device_xname(sc->sc_dev)); } void @@ -1677,7 +1677,7 @@ tr_watchdog(struct ifnet *ifp) { struct tr_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; tr_reset(sc); @@ -1688,7 +1688,7 @@ tr_enable(struct tr_softc *sc) { if (sc->sc_enabled == 0 && sc->sc_enable != NULL) { if ((*sc->sc_enable)(sc) != 0) { - aprint_error_dev(&sc->sc_dev, "device enable failed\n"); + aprint_error_dev(sc->sc_dev, "device enable failed\n"); return (EIO); } } @@ -1723,7 +1723,7 @@ tr_activate(device_t self, enum devact a int tr_detach(device_t self, int flags) { - struct tr_softc *sc = (struct tr_softc *)self; + struct tr_softc *sc = device_private(self); struct ifnet *ifp = &sc->sc_ethercom.ec_if; tr_disable(sc); Index: sys/dev/ic/tropicvar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/ic/tropicvar.h,v retrieving revision 1.13 diff -u -p -r1.13 tropicvar.h --- sys/dev/ic/tropicvar.h 12 May 2009 14:25:18 -0000 1.13 +++ sys/dev/ic/tropicvar.h 26 Sep 2012 23:03:49 -0000 @@ -51,7 +51,7 @@ struct rbcb { * Token-Ring software status per adapter */ struct tr_softc { - struct device sc_dev; + device_t sc_dev; void *sc_ih; struct ethercom sc_ethercom; struct ifmedia sc_media; Index: sys/dev/ic/uha.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/ic/uha.c,v retrieving revision 1.45 diff -u -p -r1.45 uha.c --- sys/dev/ic/uha.c 13 Nov 2010 13:52:02 -0000 1.45 +++ sys/dev/ic/uha.c 26 Sep 2012 22:48:49 -0000 @@ -117,7 +117,7 @@ uha_attach(struct uha_softc *sc, struct * Fill in the scsipi_adapter. */ memset(adapt, 0, sizeof(*adapt)); - adapt->adapt_dev = &sc->sc_dev; + adapt->adapt_dev = sc->sc_dev; adapt->adapt_nchannels = 1; /* adapt_openings initialized below */ /* adapt_max_periph initialized below */ @@ -142,14 +142,14 @@ uha_attach(struct uha_softc *sc, struct */ if ((error = bus_dmamem_alloc(sc->sc_dmat, MSCPSIZE, PAGE_SIZE, 0, &seg, 1, &rseg, BUS_DMA_NOWAIT)) != 0) { - aprint_error_dev(&sc->sc_dev, "unable to allocate mscps, error = %d\n", + aprint_error_dev(sc->sc_dev, "unable to allocate mscps, error = %d\n", error); return; } if ((error = bus_dmamem_map(sc->sc_dmat, &seg, rseg, MSCPSIZE, (void **)&sc->sc_mscps, BUS_DMA_NOWAIT|BUS_DMA_COHERENT)) != 0) { - aprint_error_dev(&sc->sc_dev, "unable to map mscps, error = %d\n", + aprint_error_dev(sc->sc_dev, "unable to map mscps, error = %d\n", error); return; } @@ -160,13 +160,13 @@ uha_attach(struct uha_softc *sc, struct if ((error = bus_dmamap_create(sc->sc_dmat, MSCPSIZE, 1, MSCPSIZE, 0, BUS_DMA_NOWAIT | sc->sc_dmaflags, &sc->sc_dmamap_mscp)) != 0) { - aprint_error_dev(&sc->sc_dev, "unable to create mscp DMA map, error = %d\n", + aprint_error_dev(sc->sc_dev, "unable to create mscp DMA map, error = %d\n", error); return; } if ((error = bus_dmamap_load(sc->sc_dmat, sc->sc_dmamap_mscp, sc->sc_mscps, MSCPSIZE, NULL, BUS_DMA_NOWAIT)) != 0) { - aprint_error_dev(&sc->sc_dev, "unable to load mscp DMA map, error = %d\n", + aprint_error_dev(sc->sc_dev, "unable to load mscp DMA map, error = %d\n", error); return; } @@ -178,10 +178,10 @@ uha_attach(struct uha_softc *sc, struct */ i = uha_create_mscps(sc, sc->sc_mscps, UHA_MSCP_MAX); if (i == 0) { - aprint_error_dev(&sc->sc_dev, "unable to create mscps\n"); + aprint_error_dev(sc->sc_dev, "unable to create mscps\n"); return; } else if (i != UHA_MSCP_MAX) { - aprint_error_dev(&sc->sc_dev, "WARNING: only %d of %d mscps created\n", + aprint_error_dev(sc->sc_dev, "WARNING: only %d of %d mscps created\n", i, UHA_MSCP_MAX); } @@ -191,7 +191,7 @@ uha_attach(struct uha_softc *sc, struct /* * ask the adapter what subunits are present */ - config_found(&sc->sc_dev, &sc->sc_channel, scsiprint); + config_found(sc->sc_dev, &sc->sc_channel, scsiprint); } integrate void @@ -228,7 +228,7 @@ uha_init_mscp(struct uha_softc *sc, stru 0, BUS_DMA_NOWAIT|BUS_DMA_ALLOCNOW | sc->sc_dmaflags, &mscp->dmamap_xfer); if (error) { - aprint_error_dev(&sc->sc_dev, "can't create mscp DMA map, error = %d\n", + aprint_error_dev(sc->sc_dev, "can't create mscp DMA map, error = %d\n", error); return (error); } @@ -259,7 +259,7 @@ uha_create_mscps(struct uha_softc *sc, s for (i = 0; i < count; i++) { mscp = &mscpstore[i]; if ((error = uha_init_mscp(sc, mscp)) != 0) { - aprint_error_dev(&sc->sc_dev, "unable to initialize mscp, error = %d\n", + aprint_error_dev(sc->sc_dev, "unable to initialize mscp, error = %d\n", error); goto out; } @@ -342,7 +342,7 @@ uha_done(struct uha_softc *sc, struct uh * into the xfer and call whoever started it */ if ((mscp->flags & MSCP_ALLOC) == 0) { - aprint_error_dev(&sc->sc_dev, "exiting ccb not allocated!\n"); + aprint_error_dev(sc->sc_dev, "exiting ccb not allocated!\n"); Debugger(); return; } @@ -353,7 +353,7 @@ uha_done(struct uha_softc *sc, struct uh xs->error = XS_SELTIMEOUT; break; default: /* Other scsi protocol messes */ - aprint_error_dev(&sc->sc_dev, "host_stat %x\n", + aprint_error_dev(sc->sc_dev, "host_stat %x\n", mscp->host_stat); xs->error = XS_DRIVER_STUFFUP; } @@ -369,7 +369,7 @@ uha_done(struct uha_softc *sc, struct uh xs->error = XS_BUSY; break; default: - aprint_error_dev(&sc->sc_dev, "target_stat %x\n", + aprint_error_dev(sc->sc_dev, "target_stat %x\n", mscp->target_stat); xs->error = XS_DRIVER_STUFFUP; } @@ -399,7 +399,7 @@ uha_scsipi_request(struct scsipi_channel { struct scsipi_xfer *xs; struct scsipi_periph *periph; - struct uha_softc *sc = (void *)chan->chan_adapter->adapt_dev; + struct uha_softc *sc = device_private(chan->chan_adapter->adapt_dev); bus_dma_tag_t dmat = sc->sc_dmat; struct uha_mscp *mscp; int error, seg, flags, s; @@ -438,7 +438,7 @@ uha_scsipi_request(struct scsipi_channel mscp->ca = 0x01; } else { if (xs->cmdlen > sizeof(mscp->scsi_cmd)) { - aprint_error_dev(&sc->sc_dev, "cmdlen %d too large for MSCP\n", + aprint_error_dev(sc->sc_dev, "cmdlen %d too large for MSCP\n", xs->cmdlen); xs->error = XS_DRIVER_STUFFUP; goto out_bad; @@ -493,7 +493,7 @@ uha_scsipi_request(struct scsipi_channel default: xs->error = XS_DRIVER_STUFFUP; - aprint_error_dev(&sc->sc_dev, "error %d loading DMA map\n", + aprint_error_dev(sc->sc_dev, "error %d loading DMA map\n", error); out_bad: uha_free_mscp(sc, mscp); @@ -576,7 +576,7 @@ uha_timeout(void *arg) struct scsipi_xfer *xs = mscp->xs; struct scsipi_periph *periph = xs->xs_periph; struct uha_softc *sc = - (void *)periph->periph_channel->chan_adapter->adapt_dev; + device_private(periph->periph_channel->chan_adapter->adapt_dev); int s; scsipi_printaddr(periph); Index: sys/dev/ic/uhavar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/ic/uhavar.h,v retrieving revision 1.15 diff -u -p -r1.15 uhavar.h --- sys/dev/ic/uhavar.h 28 Apr 2008 20:23:51 -0000 1.15 +++ sys/dev/ic/uhavar.h 26 Sep 2012 22:47:56 -0000 @@ -38,7 +38,7 @@ #define MSCP_HASH(x) ((((long)(x))>>MSCP_HASH_SHIFT) & (MSCP_HASH_SIZE - 1)) struct uha_softc { - struct device sc_dev; + device_t sc_dev; bus_space_tag_t sc_iot; bus_space_handle_t sc_ioh; Index: sys/dev/ic/upc.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/ic/upc.c,v retrieving revision 1.14 diff -u -p -r1.14 upc.c --- sys/dev/ic/upc.c 8 Apr 2008 12:07:27 -0000 1.14 +++ sys/dev/ic/upc.c 26 Sep 2012 21:43:14 -0000 @@ -102,7 +102,7 @@ upc1_attach(struct upc_softc *sc) for (i = 0; i < 16; i++) cr[i] = upc1_read_config(sc, i); - aprint_verbose_dev(&sc->sc_dev, "config state"); + aprint_verbose_dev(sc->sc_dev, "config state"); for (i = 0; i < 16; i++) aprint_verbose(" %02x", cr[i]); aprint_verbose("\n"); @@ -219,7 +219,7 @@ upc_found(struct upc_softc *sc, char con locs[UPCCF_OFFSET] = offset; - config_found_sm_loc(&sc->sc_dev, "upc", locs, &ua, + config_found_sm_loc(sc->sc_dev, "upc", locs, &ua, upc_print, config_stdsubmatch); } @@ -240,7 +240,7 @@ upc_found2(struct upc_softc *sc, char co locs[UPCCF_OFFSET] = offset; - config_found_sm_loc(&sc->sc_dev, "upc", locs, &ua, + config_found_sm_loc(sc->sc_dev, "upc", locs, &ua, upc_print, config_stdsubmatch); } Index: sys/dev/ic/upcvar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/ic/upcvar.h,v retrieving revision 1.5 diff -u -p -r1.5 upcvar.h --- sys/dev/ic/upcvar.h 19 Oct 2007 12:00:04 -0000 1.5 +++ sys/dev/ic/upcvar.h 26 Sep 2012 21:45:52 -0000 @@ -38,7 +38,7 @@ struct upc_irqhandle { }; struct upc_softc { - struct device sc_dev; + device_t sc_dev; /* These fields are filled in by the bus attachment. */ bus_space_tag_t sc_iot; bus_space_handle_t sc_ioh; Index: sys/dev/if_ndis/if_ndis_pci.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/if_ndis/if_ndis_pci.c,v retrieving revision 1.18 diff -u -p -r1.18 if_ndis_pci.c --- sys/dev/if_ndis/if_ndis_pci.c 28 Apr 2010 19:17:04 -0000 1.18 +++ sys/dev/if_ndis/if_ndis_pci.c 28 Sep 2012 19:41:10 -0000 @@ -109,7 +109,7 @@ extern unsigned char drv_data[]; #endif -CFATTACH_DECL( +CFATTACH_DECL_NEW( #ifdef NDIS_DEVNAME NDIS_DEVNAME, #else @@ -187,7 +187,7 @@ ndis_probe_pci(device_t parent, cfdata_t /*static*/ void ndis_attach_pci(device_t parent, device_t self, void *aux) { - struct ndis_softc *sc = (struct ndis_softc*)self; + struct ndis_softc *sc = device_private(self); struct pci_attach_args *pa = aux; #ifdef NDIS_DBG char devinfo[256]; Index: sys/dev/if_ndis/if_ndisvar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/if_ndis/if_ndisvar.h,v retrieving revision 1.8 diff -u -p -r1.8 if_ndisvar.h --- sys/dev/if_ndis/if_ndisvar.h 28 Jul 2012 00:43:23 -0000 1.8 +++ sys/dev/if_ndis/if_ndisvar.h 28 Sep 2012 19:40:21 -0000 @@ -112,14 +112,6 @@ extern int ndis_in_isr; struct ndis_softc { #ifdef __NetBSD__ -/* - * TODO: It seems like in the attach function the ndis "struct device" object - * and the softc are the same thing, so I added a "struct device" to the - * front of the softc, to make sure the arpcom field wasn't getting - * messed up. However, I'm not sure if the arpcom field is supposed - * to be first for some other reason. - */ - struct device dev; struct ethercom arpcom; #endif struct ieee80211com ic; /* interface info */ Index: sys/dev/isa/addcom_isa.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/isa/addcom_isa.c,v retrieving revision 1.19 diff -u -p -r1.19 addcom_isa.c --- sys/dev/isa/addcom_isa.c 12 May 2009 09:10:15 -0000 1.19 +++ sys/dev/isa/addcom_isa.c 26 Sep 2012 22:19:47 -0000 @@ -81,7 +81,6 @@ __KERNEL_RCSID(0, "$NetBSD: addcom_isa.c #define STATUS_SIZE 8 /* May be bogus... */ struct addcom_softc { - struct device sc_dev; void *sc_ih; bus_space_tag_t sc_iot; @@ -109,7 +108,7 @@ int addcomprobe(device_t, cfdata_t, void void addcomattach(device_t, device_t, void *); int addcomintr(void *); -CFATTACH_DECL(addcom_isa, sizeof(struct addcom_softc), +CFATTACH_DECL_NEW(addcom_isa, sizeof(struct addcom_softc), addcomprobe, addcomattach, NULL, NULL); int @@ -186,7 +185,7 @@ out: void addcomattach(device_t parent, device_t self, void *aux) { - struct addcom_softc *sc = (void *)self; + struct addcom_softc *sc = device_private(self); struct isa_attach_args *ia = aux; struct commulti_attach_args ca; bus_space_tag_t iot = ia->ia_iot; @@ -199,7 +198,7 @@ addcomattach(device_t parent, device_t s if (bus_space_map(iot, STATUS_IOADDR, STATUS_SIZE, 0, &sc->sc_statusioh)) { - aprint_error_dev(&sc->sc_dev, "can't map status space\n"); + aprint_error_dev(self, "can't map status space\n"); return; } @@ -210,7 +209,7 @@ addcomattach(device_t parent, device_t s if (!com_is_console(iot, iobase, &sc->sc_slaveioh[i]) && bus_space_map(iot, iobase, COM_NPORTS, 0, &sc->sc_slaveioh[i])) { - aprint_error_dev(&sc->sc_dev, "can't map i/o space for slave %d\n", i); + aprint_error_dev(self, "can't map i/o space for slave %d\n", i); return; } } Index: sys/dev/isa/adv_isa.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/isa/adv_isa.c,v retrieving revision 1.19 diff -u -p -r1.19 adv_isa.c --- sys/dev/isa/adv_isa.c 23 Nov 2009 02:13:46 -0000 1.19 +++ sys/dev/isa/adv_isa.c 26 Sep 2012 18:37:43 -0000 @@ -96,7 +96,7 @@ static int asc_ioport[ASC_IOADR_TABLE_MA int adv_isa_probe(device_t, cfdata_t, void *); void adv_isa_attach(device_t, device_t, void *); -CFATTACH_DECL(adv_isa, sizeof(ASC_SOFTC), +CFATTACH_DECL_NEW(adv_isa, sizeof(ASC_SOFTC), adv_isa_probe, adv_isa_attach, NULL, NULL); /******************************************************************************/ @@ -201,7 +201,7 @@ void adv_isa_attach(device_t parent, device_t self, void *aux) { struct isa_attach_args *ia = aux; - ASC_SOFTC *sc = (void *) self; + ASC_SOFTC *sc = device_private(self); bus_space_tag_t iot = ia->ia_iot; bus_space_handle_t ioh; isa_chipset_tag_t ic = ia->ia_ic; @@ -209,10 +209,11 @@ adv_isa_attach(device_t parent, device_t printf("\n"); + sc->sc_dev = self; sc->sc_flags = 0x0; if (bus_space_map(iot, ia->ia_io[0].ir_addr, ASC_IOADR_GAP, 0, &ioh)) { - aprint_error_dev(&sc->sc_dev, "can't map i/o space\n"); + aprint_error_dev(sc->sc_dev, "can't map i/o space\n"); return; } @@ -231,19 +232,19 @@ adv_isa_attach(device_t parent, device_t * Initialize the board */ if (adv_init(sc)) { - aprint_error_dev(&sc->sc_dev, "adv_init failed\n"); + aprint_error_dev(sc->sc_dev, "adv_init failed\n"); return; } if ((error = isa_dmacascade(ic, ia->ia_drq[0].ir_drq)) != 0) { - aprint_error_dev(&sc->sc_dev, "unable to cascade DRQ, error = %d\n", error); + aprint_error_dev(sc->sc_dev, "unable to cascade DRQ, error = %d\n", error); return; } sc->sc_ih = isa_intr_establish(ic, ia->ia_irq[0].ir_irq, IST_EDGE, IPL_BIO, adv_intr, sc); if (sc->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"); return; } Index: sys/dev/isa/aria.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/isa/aria.c,v retrieving revision 1.36 diff -u -p -r1.36 aria.c --- sys/dev/isa/aria.c 24 Nov 2011 16:07:28 -0000 1.36 +++ sys/dev/isa/aria.c 26 Sep 2012 18:37:43 -0000 @@ -93,7 +93,7 @@ struct aria_mixmaster { }; struct aria_softc { - struct device sc_dev; /* base device */ + device_t sc_dev; /* base device */ kmutex_t sc_lock; kmutex_t sc_intr_lock; void *sc_ih; /* interrupt vectoring */ @@ -179,7 +179,7 @@ int aria_mixer_set_port(void *, mixer_ct int aria_mixer_get_port(void *, mixer_ctrl_t *); int aria_mixer_query_devinfo(void *, mixer_devinfo_t *); -CFATTACH_DECL(aria, sizeof(struct aria_softc), +CFATTACH_DECL_NEW(aria, sizeof(struct aria_softc), ariaprobe, ariaattach, NULL, NULL); /* XXX temporary test for 1.3 */ @@ -403,7 +403,8 @@ ariaattach(device_t parent, device_t sel struct isa_attach_args *ia; u_short i; - sc = (void *)self; + sc = device_private(self); + sc->sc_dev = self; ia = aux; if (bus_space_map(ia->ia_iot, ia->ia_io[0].ir_addr, ARIADSP_NPORT, 0, &ioh)) @@ -472,7 +473,7 @@ ariaattach(device_t parent, device_t sel snprintf(aria_device.version, sizeof(aria_device.version), "%s", ARIA_MODEL & sc->sc_hardware ? "SC18026" : "SC18025"); - audio_attach_mi(&aria_hw_if, (void *)sc, &sc->sc_dev); + audio_attach_mi(&aria_hw_if, (void *)sc, sc->sc_dev); } /* Index: sys/dev/isa/ast.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/isa/ast.c,v retrieving revision 1.64 diff -u -p -r1.64 ast.c --- sys/dev/isa/ast.c 12 May 2009 09:10:15 -0000 1.64 +++ sys/dev/isa/ast.c 26 Sep 2012 18:37:43 -0000 @@ -53,7 +53,6 @@ __KERNEL_RCSID(0, "$NetBSD: ast.c,v 1.64 #define NSLAVES 4 struct ast_softc { - struct device sc_dev; void *sc_ih; bus_space_tag_t sc_iot; @@ -68,7 +67,7 @@ int astprobe(device_t, cfdata_t, void *) void astattach(device_t, device_t, void *); int astintr(void *); -CFATTACH_DECL(ast, sizeof(struct ast_softc), +CFATTACH_DECL_NEW(ast, sizeof(struct ast_softc), astprobe, astattach, NULL, NULL); int @@ -161,7 +160,7 @@ astattach(device_t parent, device_t self if (!com_is_console(iot, iobase, &sc->sc_slaveioh[i]) && bus_space_map(iot, iobase, COM_NPORTS, 0, &sc->sc_slaveioh[i])) { - aprint_error_dev(&sc->sc_dev, "can't map i/o space for slave %d\n", i); + aprint_error_dev(self, "can't map i/o space for slave %d\n", i); return; } } Index: sys/dev/isa/aztech.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/isa/aztech.c,v retrieving revision 1.16 diff -u -p -r1.16 aztech.c --- sys/dev/isa/aztech.c 12 May 2009 09:10:15 -0000 1.16 +++ sys/dev/isa/aztech.c 26 Sep 2012 18:37:43 -0000 @@ -78,7 +78,7 @@ __KERNEL_RCSID(0, "$NetBSD: aztech.c,v 1 #define AZ_DATA_OFF (0 << 7) int az_probe(device_t, cfdata_t, void *); -void az_attach(device_t, device_t self, void *); +void az_attach(device_t, device_t, void *); int az_get_info(void *, struct radio_info *); int az_set_info(void *, struct radio_info *); @@ -92,8 +92,6 @@ const struct radio_hw_if az_hw_if = { }; struct az_softc { - struct device sc_dev; - int mute; u_int8_t vol; u_int32_t freq; @@ -103,7 +101,7 @@ struct az_softc { struct lm700x_t lm; }; -CFATTACH_DECL(az, sizeof(struct az_softc), +CFATTACH_DECL_NEW(az, sizeof(struct az_softc), az_probe, az_attach, NULL, NULL); u_int az_find(bus_space_tag_t, bus_space_handle_t); @@ -163,7 +161,7 @@ az_probe(device_t parent, cfdata_t cf, v void az_attach(device_t parent, device_t self, void *aux) { - struct az_softc *sc = (void *)self; + struct az_softc *sc = device_private(self); struct isa_attach_args *ia = aux; sc->lm.iot = ia->ia_iot; @@ -176,7 +174,7 @@ az_attach(device_t parent, device_t self /* remap I/O */ if (bus_space_map(sc->lm.iot, ia->ia_io[0].ir_addr, ia->ia_io[0].ir_size, 0, &sc->lm.ioh)) - panic(": bus_space_map() of %s failed", device_xname(&sc->sc_dev)); + panic(": bus_space_map() of %s failed", device_xname(self)); printf(": Aztech/PackardBell\n"); @@ -193,7 +191,7 @@ az_attach(device_t parent, device_t self az_set_freq(sc, sc->freq); - radio_attach_mi(&az_hw_if, sc, &sc->sc_dev); + radio_attach_mi(&az_hw_if, sc, self); } /* Index: sys/dev/isa/bha_isa.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/isa/bha_isa.c,v retrieving revision 1.34 diff -u -p -r1.34 bha_isa.c --- sys/dev/isa/bha_isa.c 12 May 2009 09:10:15 -0000 1.34 +++ sys/dev/isa/bha_isa.c 26 Sep 2012 18:37:43 -0000 @@ -53,7 +53,7 @@ __KERNEL_RCSID(0, "$NetBSD: bha_isa.c,v int bha_isa_probe(device_t, cfdata_t, void *); void bha_isa_attach(device_t, device_t, void *); -CFATTACH_DECL(bha_isa, sizeof(struct bha_softc), +CFATTACH_DECL_NEW(bha_isa, sizeof(struct bha_softc), bha_isa_probe, bha_isa_attach, NULL, NULL); /* @@ -120,7 +120,7 @@ void bha_isa_attach(device_t parent, device_t self, void *aux) { struct isa_attach_args *ia = aux; - struct bha_softc *sc = (void *)self; + struct bha_softc *sc = device_private(self); bus_space_tag_t iot = ia->ia_iot; bus_space_handle_t ioh; struct bha_probe_data bpd; @@ -129,8 +129,9 @@ bha_isa_attach(device_t parent, device_t printf("\n"); + sc->sc_dev = self; if (bus_space_map(iot, ia->ia_io[0].ir_addr, BHA_ISA_IOSIZE, 0, &ioh)) { - aprint_error_dev(&sc->sc_dev, "can't map i/o space\n"); + aprint_error_dev(sc->sc_dev, "can't map i/o space\n"); return; } @@ -138,14 +139,14 @@ bha_isa_attach(device_t parent, device_t sc->sc_ioh = ioh; sc->sc_dmat = ia->ia_dmat; if (!bha_probe_inquiry(iot, ioh, &bpd)) { - aprint_error_dev(&sc->sc_dev, "bha_isa_attach failed\n"); + aprint_error_dev(sc->sc_dev, "bha_isa_attach failed\n"); return; } sc->sc_dmaflags = 0; if (bpd.sc_drq != -1) { if ((error = isa_dmacascade(ic, bpd.sc_drq)) != 0) { - aprint_error_dev(&sc->sc_dev, " unable to cascade DRQ, error = %d\n", error); + aprint_error_dev(sc->sc_dev, " unable to cascade DRQ, error = %d\n", error); return; } } else { @@ -158,7 +159,7 @@ bha_isa_attach(device_t parent, device_t (void) bha_info(sc); if (strcmp(sc->sc_firmware, "3.37") < 0) printf("%s: buggy VLB controller, disabling 32-bit DMA\n", - device_xname(&sc->sc_dev)); + device_xname(sc->sc_dev)); else sc->sc_dmaflags = ISABUS_DMA_32BIT; } @@ -166,7 +167,7 @@ bha_isa_attach(device_t parent, device_t sc->sc_ih = isa_intr_establish(ic, bpd.sc_irq, IST_EDGE, IPL_BIO, bha_intr, sc); if (sc->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"); return; } Index: sys/dev/isa/boca.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/isa/boca.c,v retrieving revision 1.53 diff -u -p -r1.53 boca.c --- sys/dev/isa/boca.c 12 May 2009 09:10:15 -0000 1.53 +++ sys/dev/isa/boca.c 26 Sep 2012 21:00:53 -0000 @@ -55,7 +55,7 @@ __KERNEL_RCSID(0, "$NetBSD: boca.c,v 1.5 #define NSLAVES 8 struct boca_softc { - struct device sc_dev; + device_t sc_dev; void *sc_ih; bus_space_tag_t sc_iot; @@ -72,7 +72,7 @@ void bocaattach(device_t, device_t, void int bocaintr(void *); void boca_fixup(void *); -CFATTACH_DECL(boca, sizeof(struct boca_softc), +CFATTACH_DECL_NEW(boca, sizeof(struct boca_softc), bocaprobe, bocaattach, NULL, NULL); int @@ -149,7 +149,7 @@ out: void bocaattach(device_t parent, device_t self, void *aux) { - struct boca_softc *sc = (void *)self; + struct boca_softc *sc = device_private(self); struct isa_attach_args *ia = aux; struct commulti_attach_args ca; bus_space_tag_t iot = ia->ia_iot; @@ -157,6 +157,7 @@ bocaattach(device_t parent, device_t sel printf("\n"); + sc->sc_dev = self; sc->sc_iot = ia->ia_iot; sc->sc_iobase = ia->ia_io[0].ir_addr; @@ -165,7 +166,7 @@ bocaattach(device_t parent, device_t sel if (!com_is_console(iot, iobase, &sc->sc_slaveioh[i]) && bus_space_map(iot, iobase, COM_NPORTS, 0, &sc->sc_slaveioh[i])) { - aprint_error_dev(&sc->sc_dev, "can't map i/o space for slave %d\n", i); + aprint_error_dev(sc->sc_dev, "can't map i/o space for slave %d\n", i); return; } } @@ -206,7 +207,7 @@ bocaintr(void *arg) if (bits & (1 << (n))) { \ if (comintr(sc->sc_slaves[n]) == 0) { \ printf("%s: bogus intr for port %d\n", \ - device_xname(&sc->sc_dev), n); \ + device_xname(sc->sc_dev), n); \ } \ } TRY(0); Index: sys/dev/isa/cec.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/isa/cec.c,v retrieving revision 1.12 diff -u -p -r1.12 cec.c --- sys/dev/isa/cec.c 12 Sep 2009 18:52:25 -0000 1.12 +++ sys/dev/isa/cec.c 26 Sep 2012 22:19:47 -0000 @@ -68,7 +68,7 @@ int cecdebug = 0x1f; #define CEC_IOSIZE 8 struct cec_softc { - struct device sc_dev; /* generic device glue */ + device_t sc_dev; /* generic device glue */ bus_space_tag_t sc_iot; bus_space_handle_t sc_ioh; @@ -92,7 +92,7 @@ struct cec_softc { int cecprobe(device_t, cfdata_t, void *); void cecattach(device_t, device_t, void *); -CFATTACH_DECL(cec, sizeof(struct cec_softc), +CFATTACH_DECL_NEW(cec, sizeof(struct cec_softc), cecprobe, cecattach, NULL, NULL); void cecreset(void *); @@ -180,7 +180,7 @@ cecprobe(device_t parent, cfdata_t match void cecattach(device_t parent, device_t self, void *aux) { - struct cec_softc *sc = (struct cec_softc *)self; + struct cec_softc *sc = device_private(self); struct isa_attach_args *ia = aux; struct gpibdev_attach_args ga; bus_size_t maxsize; @@ -189,12 +189,13 @@ cecattach(device_t parent, device_t self DPRINTF(DBG_CONFIG, ("cecattach: called\n")); + sc->sc_dev = self; sc->sc_iot = ia->ia_iot; sc->sc_ic = ia->ia_ic; if (bus_space_map(sc->sc_iot, ia->ia_io[0].ir_addr, CEC_IOSIZE, 0, &sc->sc_ioh) != 0) { - aprint_error_dev(&sc->sc_dev, "unable to map I/O space\n"); + aprint_error_dev(sc->sc_dev, "unable to map I/O space\n"); return; } @@ -206,7 +207,7 @@ cecattach(device_t parent, device_t self maxsize = isa_dmamaxsize(sc->sc_ic, sc->sc_drq); if (isa_dmamap_create(sc->sc_ic, sc->sc_drq, maxsize, BUS_DMA_NOWAIT | BUS_DMA_ALLOCNOW)) { - aprint_error_dev(&sc->sc_dev, "unable to create map for drq %d\n", + aprint_error_dev(sc->sc_dev, "unable to create map for drq %d\n", sc->sc_drq); sc->sc_flags &= ~CECF_USEDMA; } @@ -220,7 +221,7 @@ cecattach(device_t parent, device_t self sc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq[0].ir_irq, IST_EDGE, IPL_BIO, cecintr, sc); if (sc->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"); return; } @@ -700,7 +701,7 @@ cectimeout(void *v) bus_space_write_1(iot, ioh, NEC7210_AUXMR, AUXCMD_TCA); sc->sc_flags &= ~(CECF_IO | CECF_READ | CECF_TIMO); isa_dmaabort(sc->sc_ic, sc->sc_drq); - aprint_error_dev(&sc->sc_dev, "%s timeout\n", + aprint_error_dev(sc->sc_dev, "%s timeout\n", sc->sc_flags & CECF_READ ? "read" : "write"); gpibintr(sc->sc_gpib); } Index: sys/dev/isa/daic_isa.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/isa/daic_isa.c,v retrieving revision 1.19 diff -u -p -r1.19 daic_isa.c --- sys/dev/isa/daic_isa.c 12 May 2009 09:10:15 -0000 1.19 +++ sys/dev/isa/daic_isa.c 26 Sep 2012 18:37:43 -0000 @@ -65,22 +65,11 @@ static int daic_isa_probe(device_t, cfda static void daic_isa_attach(device_t, device_t, void *); static int daic_isa_intr(void *); -CFATTACH_DECL(daic_isa, sizeof(struct daic_isa_softc), +CFATTACH_DECL_NEW(daic_isa, sizeof(struct daic_isa_softc), daic_isa_probe, daic_isa_attach, NULL, NULL); static int -#ifdef __BROKEN_INDIRECT_CONFIG -daic_isa_probe(parent, match, aux) -#else -daic_isa_probe(parent, cf, aux) -#endif - device_t parent; -#ifdef __BROKEN_INDIRECT_CONFIG - void *match; -#else - cfdata_t cf; -#endif - void *aux; +daic_isa_probe(device_t parent, cfdata_t cf, void *aux) { struct isa_attach_args *ia = aux; bus_space_tag_t memt = ia->ia_memt; @@ -122,7 +111,7 @@ bad: static void daic_isa_attach(device_t parent, device_t self, void *aux) { - struct daic_isa_softc *sc = (void *)self; + struct daic_isa_softc *sc = device_private(self); struct isa_attach_args *ia = aux; bus_space_tag_t memt = ia->ia_memt; bus_space_handle_t memh; Index: sys/dev/isa/depca_isa.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/isa/depca_isa.c,v retrieving revision 1.15 diff -u -p -r1.15 depca_isa.c --- sys/dev/isa/depca_isa.c 19 Jan 2010 22:06:59 -0000 1.15 +++ sys/dev/isa/depca_isa.c 29 Sep 2012 12:47:48 -0000 @@ -223,16 +223,16 @@ depca_isa_attach(device_t parent, device } void * -depca_isa_intr_establish(struct depca_softc *parent, struct lance_softc *child) +depca_isa_intr_establish(struct depca_softc *sc, struct lance_softc *child) { - struct depca_isa_softc *isc = (struct depca_isa_softc *)parent; + struct depca_isa_softc *isc = (struct depca_isa_softc *)sc; void *rv; rv = isa_intr_establish(isc->sc_ic, isc->sc_irq, IST_EDGE, IPL_NET, depca_intredge, child); if (rv == NULL) printf("%s: unable to establish interrupt\n", - device_xname(parent->sc_dev)); + device_xname(sc->sc_dev)); return (rv); } Index: sys/dev/isa/dpt_isa.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/isa/dpt_isa.c,v retrieving revision 1.21 diff -u -p -r1.21 dpt_isa.c --- sys/dev/isa/dpt_isa.c 7 Aug 2011 19:46:22 -0000 1.21 +++ sys/dev/isa/dpt_isa.c 26 Sep 2012 18:37:43 -0000 @@ -65,7 +65,7 @@ static int dpt_isa_probe(struct isa_atta static int dpt_isa_wait(bus_space_handle_t, bus_space_tag_t, u_int8_t, u_int8_t); -CFATTACH_DECL(dpt_isa, sizeof(struct dpt_softc), +CFATTACH_DECL_NEW(dpt_isa, sizeof(struct dpt_softc), dpt_isa_match, dpt_isa_attach, NULL, NULL); /* Try 'less intrusive' addresses first */ @@ -263,7 +263,8 @@ dpt_isa_attach(device_t parent, device_t int error; ia = aux; - sc = (struct dpt_softc *)self; + sc = device_private(self); + sc->sc_dev = self; iot = ia->ia_iot; ic = ia->ia_ic; Index: sys/dev/isa/ega.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/isa/ega.c,v retrieving revision 1.29 diff -u -p -r1.29 ega.c --- sys/dev/isa/ega.c 12 May 2009 09:10:15 -0000 1.29 +++ sys/dev/isa/ega.c 26 Sep 2012 18:37:43 -0000 @@ -90,7 +90,6 @@ struct ega_config { }; struct ega_softc { - struct device sc_dev; struct ega_config *sc_dc; int nscreens; }; @@ -114,7 +113,7 @@ static void ega_setfont(struct ega_confi static int ega_allocattr(void *, int, int, int, long *); void ega_copyrows(void *, int, int, int); -CFATTACH_DECL(ega, sizeof(struct ega_softc), +CFATTACH_DECL_NEW(ega, sizeof(struct ega_softc), ega_match, ega_attach, NULL, NULL); const struct wsdisplay_emulops ega_emulops = { @@ -487,7 +486,7 @@ void ega_attach(device_t parent, device_t self, void *aux) { struct isa_attach_args *ia = aux; - struct ega_softc *sc = (struct ega_softc *)self; + struct ega_softc *sc = device_private(self); int console; struct ega_config *dc; struct wsemuldisplaydev_attach_args aa; Index: sys/dev/isa/gus.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/isa/gus.c,v retrieving revision 1.108 diff -u -p -r1.108 gus.c --- sys/dev/isa/gus.c 24 Nov 2011 03:35:57 -0000 1.108 +++ sys/dev/isa/gus.c 26 Sep 2012 18:37:43 -0000 @@ -170,7 +170,7 @@ struct gus_voice { */ struct gus_softc { - struct device sc_dev; /* base device */ + device_t sc_dev; /* base device */ kmutex_t sc_lock; kmutex_t sc_intr_lock; void *sc_ih; /* interrupt vector */ @@ -437,7 +437,7 @@ void stereo_dmaintr(void *); int gusprobe(device_t, cfdata_t, void *); void gusattach(device_t, device_t, void *); -CFATTACH_DECL(gus, sizeof(struct gus_softc), +CFATTACH_DECL_NEW(gus, sizeof(struct gus_softc), gusprobe, gusattach, NULL, NULL); /* @@ -817,7 +817,7 @@ gusattach(device_t parent, device_t self int d = -1; const struct audio_hw_if *hwif; - sc = (void *) self; + sc = device_private(self); ia = aux; callout_init(&sc->sc_dmaout_ch, CALLOUT_MPSAFE); ad1848_init_locks(&sc->sc_codec.sc_ad1848, IPL_AUDIO); @@ -894,7 +894,7 @@ gusattach(device_t parent, device_t self } if (d == -1) printf("%s: WARNING: Cannot initialize drq\n", - device_xname(&sc->sc_dev)); + device_xname(sc->sc_dev)); /* * Program the IRQ and DMA channels on the GUS. Note that we hardwire @@ -937,14 +937,14 @@ gusattach(device_t parent, device_t self sc->sc_play_maxsize = isa_dmamaxsize(sc->sc_ic, sc->sc_playdrq); if (isa_drq_alloc(sc->sc_ic, sc->sc_playdrq) != 0) { - aprint_error_dev(&sc->sc_dev, "can't reserve drq %d\n", + aprint_error_dev(sc->sc_dev, "can't reserve drq %d\n", sc->sc_playdrq); ad1848_destroy_locks(&sc->sc_codec.sc_ad1848); return; } if (isa_dmamap_create(sc->sc_ic, sc->sc_playdrq, sc->sc_play_maxsize, BUS_DMA_WAITOK|BUS_DMA_ALLOCNOW)) { - aprint_error_dev(&sc->sc_dev, "can't create map for drq %d\n", + aprint_error_dev(sc->sc_dev, "can't create map for drq %d\n", sc->sc_playdrq); ad1848_destroy_locks(&sc->sc_codec.sc_ad1848); return; @@ -954,14 +954,14 @@ gusattach(device_t parent, device_t self sc->sc_req_maxsize = isa_dmamaxsize(sc->sc_ic, sc->sc_recdrq); if (isa_drq_alloc(sc->sc_ic, sc->sc_recdrq) != 0) { - aprint_error_dev(&sc->sc_dev, "can't reserve drq %d\n", + aprint_error_dev(sc->sc_dev, "can't reserve drq %d\n", sc->sc_recdrq); ad1848_destroy_locks(&sc->sc_codec.sc_ad1848); return; } if (isa_dmamap_create(sc->sc_ic, sc->sc_recdrq, sc->sc_req_maxsize, BUS_DMA_WAITOK|BUS_DMA_ALLOCNOW)) { - aprint_error_dev(&sc->sc_dev, "can't create map for drq %d\n", + aprint_error_dev(sc->sc_dev, "can't create map for drq %d\n", sc->sc_recdrq); ad1848_destroy_locks(&sc->sc_codec.sc_ad1848); return; @@ -1015,7 +1015,7 @@ gusattach(device_t parent, device_t self snprintf(gus_device.version, sizeof(gus_device.version), "%d", sc->sc_revision); - printf("\n%s: Gravis UltraSound", device_xname(&sc->sc_dev)); + printf("\n%s: Gravis UltraSound", device_xname(sc->sc_dev)); if (sc->sc_revision >= 10) printf(" MAX"); else { @@ -1029,7 +1029,7 @@ gusattach(device_t parent, device_t self /* A GUS MAX should always have a CODEC installed */ if ((sc->sc_revision >= 10) & !(HAS_CODEC(sc))) printf("%s: WARNING: did not attach CODEC on MAX\n", - device_xname(&sc->sc_dev)); + device_xname(sc->sc_dev)); /* * Setup a default interrupt handler @@ -1074,7 +1074,7 @@ gusattach(device_t parent, device_t self */ audio_attach_mi(hwif, - HAS_CODEC(sc) ? (void *)&sc->sc_codec : (void *)sc, &sc->sc_dev); + HAS_CODEC(sc) ? (void *)&sc->sc_codec : (void *)sc, sc->sc_dev); } int @@ -1460,7 +1460,7 @@ gus_dmaout_timeout(void *arg) sc = arg; iot = sc->sc_iot; ioh2 = sc->sc_ioh2; - printf("%s: dmaout timeout\n", device_xname(&sc->sc_dev)); + printf("%s: dmaout timeout\n", device_xname(sc->sc_dev)); /* * Stop any DMA. @@ -1470,7 +1470,7 @@ gus_dmaout_timeout(void *arg) bus_space_write_1(iot, ioh2, GUS_DATA_HIGH, 0); #if 0 /* XXX we will dmadone below? */ - isa_dmaabort(device_parent(&sc->sc_dev), sc->sc_playdrq); + isa_dmaabort(device_parent(sc->sc_dev), sc->sc_playdrq); #endif gus_dmaout_dointr(sc); @@ -1579,7 +1579,7 @@ gus_dmaout_dointr(struct gus_softc *sc) if (sc->sc_voc[GUS_VOICE_LEFT].voccntl & GUSMASK_VOICE_STOPPED) { if (sc->sc_flags & GUS_PLAYING) { - printf("%s: playing yet stopped?\n", device_xname(&sc->sc_dev)); + printf("%s: playing yet stopped?\n", device_xname(sc->sc_dev)); } sc->sc_bufcnt++; /* another yet to be played */ gus_start_playing(sc, sc->sc_dmabuf); @@ -1728,7 +1728,7 @@ gus_voice_intr(struct gus_softc *sc) if (status & GUSMASK_VOICE_STOPPED) { if (voice != GUS_VOICE_LEFT) { DMAPRINTF(("%s: spurious voice %d stop?\n", - device_xname(&sc->sc_dev), voice)); + device_xname(sc->sc_dev), voice)); gus_stop_voice(sc, voice, 0); continue; } @@ -1744,14 +1744,14 @@ gus_voice_intr(struct gus_softc *sc) * in place. Start the voice again. */ printf("%s: stopped voice not drained? (%x)\n", - device_xname(&sc->sc_dev), sc->sc_bufcnt); + device_xname(sc->sc_dev), sc->sc_bufcnt); gus_falsestops++; sc->sc_playbuf = (sc->sc_playbuf + 1) % sc->sc_nbufs; gus_start_playing(sc, sc->sc_playbuf); } else if (sc->sc_bufcnt < 0) { panic("%s: negative bufcnt in stopped voice", - device_xname(&sc->sc_dev)); + device_xname(sc->sc_dev)); } else { sc->sc_playbuf = -1; /* none are active */ gus_stops++; @@ -1933,7 +1933,7 @@ gus_continue_playing(struct gus_softc *s DPRINTF(("gus: bufcnt 0 on continuing voice?\n")); } if (sc->sc_playbuf == sc->sc_dmabuf && (sc->sc_flags & GUS_LOCKED)) { - aprint_error_dev(&sc->sc_dev, "continue into active dmabuf?\n"); + aprint_error_dev(sc->sc_dev, "continue into active dmabuf?\n"); return 1; } Index: sys/dev/isa/i82365_isa.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/isa/i82365_isa.c,v retrieving revision 1.33 diff -u -p -r1.33 i82365_isa.c --- sys/dev/isa/i82365_isa.c 17 Sep 2009 18:14:41 -0000 1.33 +++ sys/dev/isa/i82365_isa.c 26 Sep 2012 18:37:43 -0000 @@ -64,7 +64,7 @@ int pcicisa_debug = 0; int pcic_isa_probe(device_t, cfdata_t, void *); void pcic_isa_attach(device_t, device_t, void *); -CFATTACH_DECL(pcic_isa, sizeof(struct pcic_isa_softc), +CFATTACH_DECL_NEW(pcic_isa, sizeof(struct pcic_isa_softc), pcic_isa_probe, pcic_isa_attach, NULL, NULL); static const struct pcmcia_chip_functions pcic_isa_functions = { @@ -193,6 +193,8 @@ pcic_isa_attach(device_t parent, device_ bus_space_handle_t ioh; bus_space_handle_t memh; + sc->dev = self; + /* Map i/o space. */ if (bus_space_map(iot, ia->ia_io[0].ir_addr, PCIC_IOSIZE, 0, &ioh)) { printf(": can't map i/o space\n"); Index: sys/dev/isa/i82365_isasubr.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/isa/i82365_isasubr.c,v retrieving revision 1.47 diff -u -p -r1.47 i82365_isasubr.c --- sys/dev/isa/i82365_isasubr.c 23 May 2010 23:50:37 -0000 1.47 +++ sys/dev/isa/i82365_isasubr.c 26 Sep 2012 18:37:43 -0000 @@ -183,7 +183,7 @@ pcic_isa_probe_interrupts(struct pcic_is ic = isc->sc_ic; printf("%s: controller %d detecting irqs with mask 0x%04x:", - device_xname(&sc->dev), h->chip, sc->intr_mask[h->chip]); + device_xname(sc->dev), h->chip, sc->intr_mask[h->chip]); DPRINTF(("\n")); /* clear any current interrupt */ @@ -384,7 +384,7 @@ void pcic_isa_bus_width_probe(struct pci /* Map i/o space. */ if (bus_space_map(iot, base + 0x400, length, 0, &ioh_high)) { - aprint_error_dev(&sc->dev, "can't map high i/o space\n"); + aprint_error_dev(sc->dev, "can't map high i/o space\n"); return; } @@ -429,7 +429,7 @@ void pcic_isa_bus_width_probe(struct pci } DPRINTF(("%s: bus_space_alloc range 0x%04lx-0x%04lx (probed)\n", - device_xname(&sc->dev), (long) sc->iobase, + device_xname(sc->dev), (long) sc->iobase, (long)(sc->iobase + sc->iosize))); if (pcic_isa_alloc_iobase && pcic_isa_alloc_iosize) { @@ -437,7 +437,7 @@ void pcic_isa_bus_width_probe(struct pci sc->iosize = pcic_isa_alloc_iosize; DPRINTF(("%s: bus_space_alloc range 0x%04lx-0x%04lx " - "(config override)\n", device_xname(&sc->dev), + "(config override)\n", device_xname(sc->dev), (long) sc->iobase, (long)(sc->iobase + sc->iosize))); } } Index: sys/dev/isa/if_eg.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/isa/if_eg.c,v retrieving revision 1.84 diff -u -p -r1.84 if_eg.c --- sys/dev/isa/if_eg.c 2 Feb 2012 19:43:04 -0000 1.84 +++ sys/dev/isa/if_eg.c 26 Sep 2012 18:37:43 -0000 @@ -97,7 +97,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_eg.c,v 1. * Ethernet software status per interface. */ struct eg_softc { - struct device sc_dev; + device_t sc_dev; void *sc_ih; struct ethercom sc_ethercom; /* Ethernet common part */ bus_space_tag_t sc_iot; /* bus space identifier */ @@ -116,7 +116,7 @@ struct eg_softc { int egprobe(device_t, cfdata_t, void *); void egattach(device_t, device_t, void *); -CFATTACH_DECL(eg, sizeof(struct eg_softc), +CFATTACH_DECL_NEW(eg, sizeof(struct eg_softc), egprobe, egattach, NULL, NULL); int egintr(void *); @@ -377,13 +377,15 @@ egprobe(device_t parent, cfdata_t match, void egattach(device_t parent, device_t self, void *aux) { - struct eg_softc *sc = (void *)self; + struct eg_softc *sc = device_private(self); struct isa_attach_args *ia = aux; bus_space_tag_t iot = ia->ia_iot; bus_space_handle_t ioh; struct ifnet *ifp = &sc->sc_ethercom.ec_if; u_int8_t myaddr[ETHER_ADDR_LEN]; + sc->sc_dev = self; + printf("\n"); /* Map i/o space. */ @@ -462,7 +464,7 @@ egattach(device_t parent, device_t self, } /* Initialize ifnet structure. */ - 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 = egstart; ifp->if_ioctl = egioctl; @@ -477,7 +479,7 @@ egattach(device_t parent, device_t self, sc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq[0].ir_irq, IST_EDGE, IPL_NET, egintr, sc); - rnd_attach_source(&sc->rnd_source, device_xname(&sc->sc_dev), + rnd_attach_source(&sc->rnd_source, device_xname(sc->sc_dev), RND_TYPE_NET, 0); } @@ -501,18 +503,18 @@ eginit(struct eg_softc *sc) sc->eg_pcb[2] = 3; /* receive broadcast & multicast */ sc->eg_pcb[3] = 0; if (egwritePCB(iot, ioh, sc->eg_pcb) != 0) - aprint_error_dev(&sc->sc_dev, "can't send Configure 82586\n"); + aprint_error_dev(sc->sc_dev, "can't send Configure 82586\n"); if (egreadPCB(iot, ioh, sc->eg_pcb) != 0) { - aprint_error_dev(&sc->sc_dev, "can't read Configure 82586 status\n"); + aprint_error_dev(sc->sc_dev, "can't read Configure 82586 status\n"); egprintpcb(sc->eg_pcb); } else if (sc->eg_pcb[2] != 0 || sc->eg_pcb[3] != 0) - aprint_error_dev(&sc->sc_dev, "configure card command failed\n"); + aprint_error_dev(sc->sc_dev, "configure card command failed\n"); if (sc->eg_inbuf == NULL) { sc->eg_inbuf = malloc(EG_BUFLEN, M_TEMP, M_NOWAIT); if (sc->eg_inbuf == NULL) { - aprint_error_dev(&sc->sc_dev, "can't allocate inbuf\n"); + aprint_error_dev(sc->sc_dev, "can't allocate inbuf\n"); panic("eginit"); } } @@ -521,7 +523,7 @@ eginit(struct eg_softc *sc) if (sc->eg_outbuf == NULL) { sc->eg_outbuf = malloc(EG_BUFLEN, M_TEMP, M_NOWAIT); if (sc->eg_outbuf == NULL) { - aprint_error_dev(&sc->sc_dev, "can't allocate outbuf\n"); + aprint_error_dev(sc->sc_dev, "can't allocate outbuf\n"); panic("eginit"); } } @@ -585,7 +587,7 @@ loop: /* We need to use m->m_pkthdr.len, so require the header */ if ((m0->m_flags & M_PKTHDR) == 0) { - aprint_error_dev(&sc->sc_dev, "no header mbuf\n"); + aprint_error_dev(sc->sc_dev, "no header mbuf\n"); panic("egstart"); } len = max(m0->m_pkthdr.len, ETHER_MIN_LEN - ETHER_CRC_LEN); @@ -601,7 +603,7 @@ loop: sc->eg_pcb[6] = len; /* length of packet */ sc->eg_pcb[7] = len >> 8; if (egwritePCB(iot, ioh, sc->eg_pcb) != 0) { - aprint_error_dev(&sc->sc_dev, "can't send Send Packet command\n"); + aprint_error_dev(sc->sc_dev, "can't send Send Packet command\n"); ifp->if_oerrors++; ifp->if_flags &= ~IFF_OACTIVE; m_freem(m0); @@ -669,7 +671,7 @@ egintr(void *arg) case EG_RSP_SENDPACKET: if (sc->eg_pcb[6] || sc->eg_pcb[7]) { DPRINTF(("%s: packet dropped\n", - device_xname(&sc->sc_dev))); + device_xname(sc->sc_dev))); sc->sc_ethercom.ec_if.if_oerrors++; } else sc->sc_ethercom.ec_if.if_opackets++; @@ -683,7 +685,7 @@ egintr(void *arg) /* XXX byte-order and type-size bugs here... */ case EG_RSP_GETSTATS: DPRINTF(("%s: Card Statistics\n", - device_xname(&sc->sc_dev))); + device_xname(sc->sc_dev))); memcpy(&i, &sc->eg_pcb[2], sizeof(i)); DPRINTF(("Receive Packets %d\n", i)); memcpy(&i, &sc->eg_pcb[6], sizeof(i)); @@ -701,7 +703,7 @@ egintr(void *arg) default: printf("%s: egintr: Unknown response %x??\n", - device_xname(&sc->sc_dev), sc->eg_pcb[0]); + device_xname(sc->sc_dev), sc->eg_pcb[0]); egprintpcb(sc->eg_pcb); break; } @@ -723,7 +725,7 @@ egread(struct eg_softc *sc, void *buf, i if (len <= sizeof(struct ether_header) || len > ETHER_MAX_LEN) { - aprint_error_dev(&sc->sc_dev, "invalid packet size %d; dropping\n", len); + aprint_error_dev(sc->sc_dev, "invalid packet size %d; dropping\n", len); ifp->if_ierrors++; return; } @@ -868,7 +870,7 @@ egreset(struct eg_softc *sc) { int s; - DPRINTF(("%s: egreset()\n", device_xname(&sc->sc_dev))); + DPRINTF(("%s: egreset()\n", device_xname(sc->sc_dev))); s = splnet(); egstop(sc); eginit(sc); @@ -880,7 +882,7 @@ egwatchdog(struct ifnet *ifp) { struct eg_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)); sc->sc_ethercom.ec_if.if_oerrors++; egreset(sc); Index: sys/dev/isa/if_el.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/isa/if_el.c,v retrieving revision 1.88 diff -u -p -r1.88 if_el.c --- sys/dev/isa/if_el.c 2 Feb 2012 19:43:04 -0000 1.88 +++ sys/dev/isa/if_el.c 26 Sep 2012 18:37:43 -0000 @@ -69,7 +69,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_el.c,v 1. * per-line info and status */ struct el_softc { - struct device sc_dev; + device_t sc_dev; void *sc_ih; struct ethercom sc_ethercom; /* ethernet common */ @@ -97,7 +97,7 @@ static inline void el_hardreset(struct e int elprobe(device_t, cfdata_t, void *); void elattach(device_t, device_t, void *); -CFATTACH_DECL(el, sizeof(struct el_softc), +CFATTACH_DECL_NEW(el, sizeof(struct el_softc), elprobe, elattach, NULL, NULL); /* @@ -196,7 +196,7 @@ elprobe(device_t parent, cfdata_t match, void elattach(device_t parent, device_t self, void *aux) { - struct el_softc *sc = (void *)self; + struct el_softc *sc = device_private(self); struct isa_attach_args *ia = aux; bus_space_tag_t iot = ia->ia_iot; bus_space_handle_t ioh; @@ -204,9 +204,11 @@ elattach(device_t parent, device_t self, u_int8_t myaddr[ETHER_ADDR_LEN]; u_int8_t i; + sc->sc_dev = self; + printf("\n"); - DPRINTF(("Attaching %s...\n", device_xname(&sc->sc_dev))); + DPRINTF(("Attaching %s...\n", device_xname(sc->sc_dev))); /* Map i/o space. */ if (bus_space_map(iot, ia->ia_io[0].ir_addr, 16, 0, &ioh)) { @@ -232,7 +234,7 @@ elattach(device_t parent, device_t self, elstop(sc); /* Initialize ifnet structure. */ - 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 = elstart; ifp->if_ioctl = elioctl; @@ -252,7 +254,7 @@ elattach(device_t parent, device_t self, IST_EDGE, IPL_NET, elintr, sc); DPRINTF(("Attaching to random...\n")); - rnd_attach_source(&sc->rnd_source, device_xname(&sc->sc_dev), + rnd_attach_source(&sc->rnd_source, device_xname(sc->sc_dev), RND_TYPE_NET, 0); DPRINTF(("elattach() finished.\n")); @@ -395,7 +397,7 @@ elstart(struct ifnet *ifp) #ifdef DIAGNOSTIC if ((off & 0xffff) != off) printf("%s: bogus off 0x%x\n", - device_xname(&sc->sc_dev), off); + device_xname(sc->sc_dev), off); #endif bus_space_write_1(iot, ioh, EL_GPBL, off & 0xff); bus_space_write_1(iot, ioh, EL_GPBH, (off >> 8) & 0xff); @@ -569,7 +571,7 @@ elread(struct el_softc *sc, int len) if (len <= sizeof(struct ether_header) || len > ETHER_MAX_LEN) { printf("%s: invalid packet size %d; dropping\n", - device_xname(&sc->sc_dev), len); + device_xname(sc->sc_dev), len); ifp->if_ierrors++; return; } @@ -724,7 +726,7 @@ elwatchdog(struct ifnet *ifp) { struct el_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)); sc->sc_ethercom.ec_if.if_oerrors++; elreset(sc); Index: sys/dev/isa/if_iy.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/isa/if_iy.c,v retrieving revision 1.90 diff -u -p -r1.90 if_iy.c --- sys/dev/isa/if_iy.c 2 Feb 2012 19:43:04 -0000 1.90 +++ sys/dev/isa/if_iy.c 26 Sep 2012 18:37:43 -0000 @@ -98,7 +98,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_iy.c,v 1. * Ethernet status, per interface. */ struct iy_softc { - struct device sc_dev; + device_t sc_dev; void *sc_ih; bus_space_tag_t sc_iot; @@ -170,7 +170,7 @@ static u_int16_t eepromread(bus_space_ta static int eepromreadall(bus_space_tag_t, bus_space_handle_t, u_int16_t *, int); -CFATTACH_DECL(iy, sizeof(struct iy_softc), +CFATTACH_DECL_NEW(iy, sizeof(struct iy_softc), iyprobe, iyattach, NULL, NULL); static u_int8_t eepro_irqmap[] = EEPP_INTMAP; @@ -278,7 +278,7 @@ out: void iyattach(device_t parent, device_t self, void *aux) { - struct iy_softc *sc = (void *)self; + struct iy_softc *sc = device_private(self); struct isa_attach_args *ia = aux; struct ifnet *ifp = &sc->sc_ethercom.ec_if; bus_space_tag_t iot; @@ -307,7 +307,7 @@ iyattach(device_t parent, device_t self, iyprobemem(sc); - 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 = iystart; ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_NOTRAILERS @@ -357,12 +357,12 @@ iyattach(device_t parent, device_t self, eirq = eepro_irqmap[eaddr[EEPPW1] & EEPP_Int]; if (eirq != ia->ia_irq[0].ir_irq) printf("%s: EEPROM irq setting %d ignored\n", - device_xname(&sc->sc_dev), eirq); + device_xname(sc->sc_dev), eirq); sc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq[0].ir_irq, IST_EDGE, IPL_NET, iyintr, sc); - rnd_attach_source(&sc->rnd_source, device_xname(&sc->sc_dev), + rnd_attach_source(&sc->rnd_source, device_xname(sc->sc_dev), RND_TYPE_NET, 0); temp = bus_space_read_1(iot, ioh, INT_NO_REG); @@ -390,7 +390,7 @@ iystop(struct iy_softc *sc) delay(200); #ifdef IYDEBUG printf("%s: dumping tx chain (st 0x%x end 0x%x last 0x%x)\n", - device_xname(&sc->sc_dev), sc->tx_start, sc->tx_end, sc->tx_last); + device_xname(sc->sc_dev), sc->tx_start, sc->tx_end, sc->tx_last); p = sc->tx_last; if (!p) p = sc->tx_start; @@ -479,7 +479,7 @@ iyinit(struct iy_softc *sc) "\020\1PRMSC\2NOBRDST\3SEECRC\4LENGTH\5NOSaIns\6MultiIA", temp); - printf("%s: RECV_MODES set to %s\n", device_xname(&sc->sc_dev), sbuf); + printf("%s: RECV_MODES set to %s\n", device_xname(sc->sc_dev), sbuf); } #endif /* XXX VOODOO */ @@ -498,7 +498,7 @@ iyinit(struct iy_softc *sc) snprintb(sbuf, sizeof(sbuf), "\020\1LnkInDis\2PolCor\3TPE\4JabberDis\5NoAport\6BNC", temp); - printf("%s: media select was 0x%s ", device_xname(&sc->sc_dev), sbuf); + printf("%s: media select was 0x%s ", device_xname(sc->sc_dev), sbuf); } #endif temp = (temp & TEST_MODE_MASK); @@ -556,12 +556,12 @@ iyinit(struct iy_softc *sc) snprintb(sbuf, sizeof(sbuf), "\020\4bad_irq\010flash/boot present", temp); - printf("%s: int no was %s\n", device_xname(&sc->sc_dev), sbuf); + printf("%s: int no was %s\n", device_xname(sc->sc_dev), sbuf); temp = bus_space_read_1(iot, ioh, INT_NO_REG); snprintb(sbuf, sizeof(sbuf), "\020\4bad_irq\010flash/boot present", temp); - printf("%s: int no now %s\n", device_xname(&sc->sc_dev), sbuf); + printf("%s: int no now %s\n", device_xname(sc->sc_dev), sbuf); } #endif @@ -578,7 +578,7 @@ iyinit(struct iy_softc *sc) snprintb(sbuf, sizeof(sbuf), "\020\2WORD_WIDTH\010INT_ENABLE", temp); - printf("%s: HW access is %s\n", device_xname(&sc->sc_dev), sbuf); + printf("%s: HW access is %s\n", device_xname(sc->sc_dev), sbuf); } #endif bus_space_write_1(iot, ioh, REG1, temp | INT_ENABLE); /* XXX what about WORD_WIDTH? */ @@ -590,7 +590,7 @@ iyinit(struct iy_softc *sc) temp = bus_space_read_1(iot, ioh, REG1); snprintb(sbuf, sizeof(sbuf), "\020\2WORD_WIDTH\010INT_ENABLE", temp); - printf("%s: HW access is %s\n", device_xname(&sc->sc_dev), sbuf); + printf("%s: HW access is %s\n", device_xname(sc->sc_dev), sbuf); } #endif @@ -654,7 +654,7 @@ iystart(struct ifnet *ifp) break; #ifdef IYDEBUG printf("%s: trying to write another packet to the hardware\n", - device_xname(&sc->sc_dev)); + device_xname(sc->sc_dev)); #endif /* We need to use m->m_pkthdr.len, so require the header */ @@ -665,7 +665,7 @@ iystart(struct ifnet *ifp) pad = len & 1; #ifdef IYDEBUG - printf("%s: length is %d.\n", device_xname(&sc->sc_dev), len); + printf("%s: length is %d.\n", device_xname(sc->sc_dev), len); #endif if (len < (ETHER_MIN_LEN - ETHER_CRC_LEN)) { pad = ETHER_MIN_LEN - ETHER_CRC_LEN - len; @@ -686,7 +686,7 @@ iystart(struct ifnet *ifp) avail += sc->tx_size; #ifdef IYDEBUG - printf("%s: avail is %d.\n", device_xname(&sc->sc_dev), avail); + printf("%s: avail is %d.\n", device_xname(sc->sc_dev), avail); #endif /* * we MUST RUN at splnet here --- @@ -698,7 +698,7 @@ iystart(struct ifnet *ifp) if ((len+pad+2*I595_XMT_HDRLEN) > avail) { #ifdef IYDEBUG printf("%s: len = %d, avail = %d, setting OACTIVE\n", - device_xname(&sc->sc_dev), len, avail); + device_xname(sc->sc_dev), len, avail); #endif /* mark interface as full ... */ ifp->if_flags |= IFF_OACTIVE; @@ -748,7 +748,7 @@ iystart(struct ifnet *ifp) if (residual) { #ifdef IYDEBUG printf("%s: merging residual with next mbuf.\n", - device_xname(&sc->sc_dev)); + device_xname(sc->sc_dev)); #endif resval |= *data << 8; bus_space_write_stream_2(iot, ioh, @@ -768,7 +768,7 @@ iystart(struct ifnet *ifp) resval = *(data + llen - 1); #ifdef IYDEBUG printf("%s: got odd mbuf to send.\n", - device_xname(&sc->sc_dev)); + device_xname(sc->sc_dev)); #endif } @@ -785,9 +785,9 @@ iystart(struct ifnet *ifp) #ifdef IYDEBUG printf("%s: new last = 0x%x, end = 0x%x.\n", - device_xname(&sc->sc_dev), last, end); + device_xname(sc->sc_dev), last, end); printf("%s: old start = 0x%x, end = 0x%x, last = 0x%x\n", - device_xname(&sc->sc_dev), sc->tx_start, sc->tx_end, sc->tx_last); + device_xname(sc->sc_dev), sc->tx_start, sc->tx_end, sc->tx_last); #endif if (sc->tx_start != sc->tx_end) { @@ -810,7 +810,7 @@ iystart(struct ifnet *ifp) stat | htole16(CHAIN)); #ifdef IYDEBUG printf("%s: setting 0x%x to 0x%x\n", - device_xname(&sc->sc_dev), sc->tx_last + XMT_COUNT, + device_xname(sc->sc_dev), sc->tx_last + XMT_COUNT, le16toh(stat) | CHAIN); #endif } @@ -826,13 +826,13 @@ iystart(struct ifnet *ifp) sc->tx_start = last; #ifdef IYDEBUG printf("%s: writing 0x%x to XAR and giving XCMD\n", - device_xname(&sc->sc_dev), last); + device_xname(sc->sc_dev), last); #endif } else { bus_space_write_1(iot, ioh, 0, RESUME_XMT_CMD); #ifdef IYDEBUG printf("%s: giving RESUME_XCMD\n", - device_xname(&sc->sc_dev)); + device_xname(sc->sc_dev)); #endif } sc->tx_last = last; @@ -919,7 +919,7 @@ iywatchdog(struct ifnet *ifp) { struct iy_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)); ++sc->sc_ethercom.ec_if.if_oerrors; iyreset(sc); } @@ -950,7 +950,7 @@ iyintr(void *arg) snprintb(sbuf, sizeof(sbuf), "\020\1RX_STP\2RX\3TX\4EXEC", status); - printf("%s: got interrupt %s", device_xname(&sc->sc_dev), sbuf); + printf("%s: got interrupt %s", device_xname(sc->sc_dev), sbuf); if (status & EXEC_INT) { snprintb(sbuf, sizeof(sbuf), @@ -1027,7 +1027,7 @@ iyget(struct iy_softc *sc, bus_space_tag mtod(m, u_int16_t *), len/2); } else { #ifdef IYDEBUG - printf("%s: received odd mbuf\n", device_xname(&sc->sc_dev)); + printf("%s: received odd mbuf\n", device_xname(sc->sc_dev)); #endif *(mtod(m, char *)) = bus_space_read_stream_2(iot, ioh, MEM_PORT_REG); @@ -1086,7 +1086,7 @@ iy_intr_rx(struct iy_softc *sc) "\014CRCERR\015LENERR\016RCVOK\020TYP", rxstatus); printf("%s: pck at 0x%04x stat %s next 0x%x len 0x%x\n", - device_xname(&sc->sc_dev), rxadrs, sbuf, rxnext, rxlen); + device_xname(sc->sc_dev), rxadrs, sbuf, rxnext, rxlen); } #endif iyget(sc, iot, ioh, rxlen); @@ -1362,12 +1362,12 @@ iy_mc_setup(struct iy_softc *sc) bus_space_write_1(iot, ioh, STATUS_REG, EXEC_INT); #ifdef DIAGNOSTIC if (temp & 0x20) { - aprint_error_dev(&sc->sc_dev, "mc setup failed, %d usec\n", + aprint_error_dev(sc->sc_dev, "mc setup failed, %d usec\n", timeout * 2); } else if (((temp & 0x0f) == 0x03) && (ifp->if_flags & IFF_DEBUG)) { printf("%s: mc setup done, %d usec\n", - device_xname(&sc->sc_dev), timeout * 2); + device_xname(sc->sc_dev), timeout * 2); } #endif break; @@ -1474,7 +1474,7 @@ iyprobemem(struct iy_softc *sc) if (bus_space_read_2(iot, ioh, MEM_PORT_REG) != 0xdead) { #ifdef IYMEMDEBUG printf("%s: Didn't keep 0xdead at 0x%x\n", - device_xname(&sc->sc_dev), testing-2); + device_xname(sc->sc_dev), testing-2); #endif continue; } @@ -1485,7 +1485,7 @@ iyprobemem(struct iy_softc *sc) if (bus_space_read_2(iot, ioh, MEM_PORT_REG) != 0xbeef) { #ifdef IYMEMDEBUG printf("%s: Didn't keep 0xbeef at 0x%x\n", - device_xname(&sc->sc_dev), testing-2); + device_xname(sc->sc_dev), testing-2); #endif continue; } @@ -1498,7 +1498,7 @@ iyprobemem(struct iy_softc *sc) if (bus_space_read_2(iot, ioh, MEM_PORT_REG) == (testing >> 1)) { #ifdef IYMEMDEBUG printf("%s: 0x%x alias of 0x0\n", - device_xname(&sc->sc_dev), testing >> 1); + device_xname(sc->sc_dev), testing >> 1); #endif continue; } Index: sys/dev/isa/if_lc_isa.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/isa/if_lc_isa.c,v retrieving revision 1.33 diff -u -p -r1.33 if_lc_isa.c --- sys/dev/isa/if_lc_isa.c 12 May 2009 09:10:15 -0000 1.33 +++ sys/dev/isa/if_lc_isa.c 27 Sep 2012 00:19:03 -0000 @@ -62,15 +62,15 @@ __KERNEL_RCSID(0, "$NetBSD: if_lc_isa.c, extern struct cfdriver lc_cd; -static int lemac_isa_find(lemac_softc_t *, struct isa_attach_args *, int); +static int lemac_isa_find(lemac_softc_t *, const char *, struct isa_attach_args *, int); static int lemac_isa_probe(device_t, cfdata_t, void *); static void lemac_isa_attach(device_t, device_t, void *); -CFATTACH_DECL(lc_isa, sizeof(lemac_softc_t), +CFATTACH_DECL_NEW(lc_isa, sizeof(lemac_softc_t), lemac_isa_probe, lemac_isa_attach, NULL, NULL); static int -lemac_isa_find(lemac_softc_t *sc, struct isa_attach_args *ia, int attach) +lemac_isa_find(lemac_softc_t *sc, const char *xname, struct isa_attach_args *ia, int attach) { bus_addr_t maddr; bus_size_t msiz; @@ -142,14 +142,14 @@ lemac_isa_find(lemac_softc_t *sc, struct */ if (ia->ia_irq[0].ir_irq != ISA_UNKNOWN_IRQ && ia->ia_irq[0].ir_irq != irq) - printf("%s: overriding IRQ %d to %d\n", device_xname(&sc->sc_dv), + printf("%s: overriding IRQ %d to %d\n", xname, ia->ia_irq[0].ir_irq, irq); if (attach) { sc->sc_ats = shutdownhook_establish(lemac_shutdown, sc); if (sc->sc_ats == NULL) { aprint_normal("\n"); - aprint_error_dev(&sc->sc_dv, "warning: can't establish shutdown hook\n"); + aprint_error("%s: warning: can't establish shutdown hook\n", xname); } lemac_ifattach(sc); @@ -187,17 +187,19 @@ lemac_isa_probe(device_t parent, cfdata_ struct isa_attach_args *ia = aux; cfdata_t cf = match; lemac_softc_t sc; - snprintf(sc.sc_dv.dv_xname, sizeof(sc.sc_dv.dv_xname), "%s%d", - lc_cd.cd_name, cf->cf_unit); + char xname[16]; - return lemac_isa_find(&sc, ia, 0); + snprintf(xname, sizeof(xname), "%s%d", lc_cd.cd_name, cf->cf_unit); + + return lemac_isa_find(&sc, xname, ia, 0); } static void lemac_isa_attach(device_t parent, device_t self, void *aux) { - lemac_softc_t *sc = (void *)self; + lemac_softc_t *sc = device_private(self); struct isa_attach_args *ia = aux; - (void) lemac_isa_find(sc, ia, 1); + sc->sc_dev = self; + (void) lemac_isa_find(sc, device_xname(self), ia, 1); } Index: sys/dev/isa/if_ntwoc_isa.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/isa/if_ntwoc_isa.c,v retrieving revision 1.23 diff -u -p -r1.23 if_ntwoc_isa.c --- sys/dev/isa/if_ntwoc_isa.c 3 Aug 2010 14:06:10 -0000 1.23 +++ sys/dev/isa/if_ntwoc_isa.c 26 Sep 2012 21:10:39 -0000 @@ -75,7 +75,7 @@ static void ntwoc_isa_config_interrupts( struct ntwoc_isa_softc { /* Generic device stuff */ - struct device sc_dev; /* Common to all devices */ + device_t sc_dev; /* Common to all devices */ /* PCI chipset glue */ void *sc_ih; /* Interrupt handler */ @@ -95,7 +95,7 @@ static void ntwoc_isa_get_clock(struct s static void ntwoc_isa_setup_memory(struct sca_softc *sc); static void ntwoc_isa_shutdown(void *sc); -CFATTACH_DECL(ntwoc_isa, sizeof(struct ntwoc_isa_softc), +CFATTACH_DECL_NEW(ntwoc_isa, sizeof(struct ntwoc_isa_softc), ntwoc_isa_probe, ntwoc_isa_attach, NULL, NULL); /* @@ -393,15 +393,16 @@ ntwoc_isa_attach(device_t parent, device int i, dbg, pgs, rv; ia = (struct isa_attach_args *)aux; - sc = (struct ntwoc_isa_softc *)self; + sc = device_private(self); + sc->sc_dev = self; sca = &sc->sc_sca; dbg = 0; printf(": N2 Serial Interface\n"); - flags = device_cfdata(&sc->sc_dev)->cf_flags; + flags = device_cfdata(sc->sc_dev)->cf_flags; sc->sc_ic = ia->ia_ic; - sca->sc_parent = &sc->sc_dev; + sca->sc_parent = sc->sc_dev; sca->sc_numports = (flags & NTWOC_FLAGS_NPORT_MASK) + 1; sca->sc_usedma = 0; sca->sc_aux = sc; @@ -419,7 +420,7 @@ ntwoc_isa_attach(device_t parent, device sca->sc_iot = ia->ia_iot; if ((rv = bus_space_map(ia->ia_iot, ia->ia_io[0].ir_addr, NTWOC_SRC_IOPORT_SIZE, 0, &sca->sc_ioh))) { - aprint_error_dev(&sc->sc_dev, "can't map io 0x%x sz %d, %d\n", + aprint_error_dev(sc->sc_dev, "can't map io 0x%x sz %d, %d\n", ia->ia_io[0].ir_addr, NTWOC_SRC_IOPORT_SIZE, rv); return; @@ -431,7 +432,7 @@ ntwoc_isa_attach(device_t parent, device /* map the isa io addresses */ if ((tmp = bus_space_map(ia->ia_iot, ioport, 16, 0, &sca->scu_sca_ioh[i]))) { - aprint_error_dev(&sc->sc_dev, "mapping sca 0x%x sz %d failed: %d\n", + aprint_error_dev(sc->sc_dev, "mapping sca 0x%x sz %d failed: %d\n", ioport, 16, tmp); return; } @@ -463,7 +464,7 @@ ntwoc_isa_attach(device_t parent, device sca->scu_pagemask = sca->scu_pagesize - 1; if ((rv = bus_space_map(ia->ia_memt, ia->ia_iomem[0].ir_addr, sca->scu_pagesize, 0, &sca->scu_memh))) { - aprint_error_dev(&sc->sc_dev, "can't map mem 0x%x sz %ld, %d\n", + aprint_error_dev(sc->sc_dev, "can't map mem 0x%x sz %ld, %d\n", ia->ia_iomem[0].ir_addr, (u_long)sca->scu_pagesize, rv); return; @@ -542,13 +543,13 @@ ntwoc_isa_attach(device_t parent, device #if 0 printf("%s: sca port 0x%x-0x%x dpram %ldk %d serial port%s\n", - device_xname(&sc->sc_dev), ia->ia_io[0].ir_addr | 0x8000, + device_xname(sc->sc_dev), ia->ia_io[0].ir_addr | 0x8000, (ia->ia_io[0].ir_addr | 0x8000) + NTWOC_SRC_ASIC_SIZE - 1, pgs * (sca->scu_pagesize / 1024), sca->sc_numports, (sca->sc_numports > 1 ? "s" : "")); #else printf("%s: dpram %ldk %d serial port%s\n", - device_xname(&sc->sc_dev), (u_long)pgs * (sca->scu_pagesize / 1024), + device_xname(sc->sc_dev), (u_long)pgs * (sca->scu_pagesize / 1024), sca->sc_numports, (sca->sc_numports > 1 ? "s" : "")); #endif @@ -564,14 +565,14 @@ ntwoc_isa_attach(device_t parent, device sc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq[0].ir_irq, IST_EDGE, IPL_NET, ntwoc_isa_intr, sc); if (sc->sc_ih == NULL) { - aprint_error_dev(&sc->sc_dev, "can't establish interrupt\n"); + aprint_error_dev(sc->sc_dev, "can't establish interrupt\n"); return; } /* make sure we have 2 pages for each port */ if (pgs < 2 * sca->sc_numports) { printf("%s: %d less than required pages of memory of %d\n", - device_xname(&sc->sc_dev), pgs, 2 * sca->sc_numports); + device_xname(sc->sc_dev), pgs, 2 * sca->sc_numports); return; } @@ -809,7 +810,7 @@ ntwoc_isa_config_interrupts(device_t sel { struct ntwoc_isa_softc *sc; - sc = (void *)self; + sc = device_private(self); sca_get_base_clock(&sc->sc_sca); sca_print_clock_info(&sc->sc_sca); } Index: sys/dev/isa/if_sm_isa.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/isa/if_sm_isa.c,v retrieving revision 1.22 diff -u -p -r1.22 if_sm_isa.c --- sys/dev/isa/if_sm_isa.c 12 May 2009 09:10:15 -0000 1.22 +++ sys/dev/isa/if_sm_isa.c 27 Sep 2012 00:12:53 -0000 @@ -69,7 +69,7 @@ struct sm_isa_softc { void *sc_ih; /* interrupt cookie */ }; -CFATTACH_DECL(sm_isa, sizeof(struct sm_isa_softc), +CFATTACH_DECL_NEW(sm_isa, sizeof(struct sm_isa_softc), sm_isa_match, sm_isa_attach, NULL, NULL); int @@ -153,7 +153,7 @@ sm_isa_match(device_t parent, cfdata_t m void sm_isa_attach(device_t parent, device_t self, void *aux) { - struct sm_isa_softc *isc = (struct sm_isa_softc *)self; + struct sm_isa_softc *isc = device_private(self); struct smc91cxx_softc *sc = &isc->sc_smc; struct isa_attach_args *ia = aux; bus_space_tag_t iot = ia->ia_iot; @@ -165,6 +165,7 @@ sm_isa_attach(device_t parent, device_t if (bus_space_map(iot, ia->ia_io[0].ir_addr, SMC_IOSIZE, 0, &ioh)) panic("sm_isa_attach: can't map i/o space"); + sc->sc_dev = self; sc->sc_bst = iot; sc->sc_bsh = ioh; @@ -180,5 +181,5 @@ sm_isa_attach(device_t parent, device_t isc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq[0].ir_irq, IST_EDGE, IPL_NET, smc91cxx_intr, sc); if (isc->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"); } Index: sys/dev/isa/if_tr_isa.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/isa/if_tr_isa.c,v retrieving revision 1.23 diff -u -p -r1.23 if_tr_isa.c --- sys/dev/isa/if_tr_isa.c 12 May 2009 09:10:15 -0000 1.23 +++ sys/dev/isa/if_tr_isa.c 26 Sep 2012 23:04:23 -0000 @@ -78,7 +78,7 @@ int (*tr_isa_probe_list[])(device_t, cfd 0 }; -CFATTACH_DECL(tr_isa, sizeof(struct tr_softc), +CFATTACH_DECL_NEW(tr_isa, sizeof(struct tr_softc), tr_isa_probe, tr_isa_attach, NULL, NULL); int @@ -192,13 +192,14 @@ tr_isa_probe(device_t parent, cfdata_t m int trtcm_setspeed(struct tr_softc *, int); void -tr_isa_attach(device_t parent, device_t self, void *aux) +tr_isa_attach(device_t parent, device_t self, void *aux) { - struct tr_softc *sc = (void *) self; + struct tr_softc *sc = device_private(self); struct isa_attach_args *ia = aux; printf("\n"); + sc->sc_dev = self; sc->sc_piot = ia->ia_iot; sc->sc_memt = ia->ia_memt; if (tr_isa_map_io(ia, &sc->sc_pioh, &sc->sc_mmioh)) { Index: sys/dev/isa/ioat66.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/isa/ioat66.c,v retrieving revision 1.20 diff -u -p -r1.20 ioat66.c --- sys/dev/isa/ioat66.c 12 May 2009 09:10:15 -0000 1.20 +++ sys/dev/isa/ioat66.c 26 Sep 2012 18:37:43 -0000 @@ -53,7 +53,6 @@ __KERNEL_RCSID(0, "$NetBSD: ioat66.c,v 1 #define NSLAVES 6 struct ioat66_softc { - struct device sc_dev; void *sc_ih; bus_space_tag_t sc_iot; @@ -72,7 +71,7 @@ int ioat66probe(device_t, cfdata_t, void void ioat66attach(device_t, device_t, void *); int ioat66intr(void *); -CFATTACH_DECL(ioat, sizeof(struct ioat66_softc), +CFATTACH_DECL_NEW(ioat, sizeof(struct ioat66_softc), ioat66probe, ioat66attach, NULL, NULL); int @@ -144,7 +143,7 @@ out: void ioat66attach(device_t parent, device_t self, void *aux) { - struct ioat66_softc *sc = (void *)self; + struct ioat66_softc *sc = device_private(self); struct isa_attach_args *ia = aux; struct commulti_attach_args ca; bus_space_tag_t iot = ia->ia_iot; @@ -161,14 +160,14 @@ ioat66attach(device_t parent, device_t s if (!com_is_console(iot, iobase, &sc->sc_slaveioh[i]) && bus_space_map(iot, iobase, COM_NPORTS, 0, &sc->sc_slaveioh[i])) { - aprint_error_dev(&sc->sc_dev, "can't map i/o space for slave %d\n", i); + aprint_error_dev(self, "can't map i/o space for slave %d\n", i); return; } } if(bus_space_map(iot, IOAT66SHARED, 1, 0, &sc->sc_intmasq)) { - aprint_error_dev(&sc->sc_dev, "can't map shared interrupt mask\n"); - return; + aprint_error_dev(self, "can't map shared interrupt mask\n"); + return; } for (i = 0; i < NSLAVES; i++) { Index: sys/dev/isa/isic_isa.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/isa/isic_isa.c,v retrieving revision 1.35 diff -u -p -r1.35 isic_isa.c --- sys/dev/isa/isic_isa.c 12 May 2009 09:10:15 -0000 1.35 +++ sys/dev/isa/isic_isa.c 28 Sep 2012 19:37:28 -0000 @@ -83,11 +83,11 @@ static int setup_io_map(int flags, bus_s int *msize); static void args_unmap(int *num_mappings, struct isic_io_map *maps); -CFATTACH_DECL(isic_isa, sizeof(struct isic_softc), +CFATTACH_DECL_NEW(isic_isa, sizeof(struct isic_softc), isic_isa_probe, isic_isa_attach, NULL, NULL); #define ISIC_FMT "%s: " -#define ISIC_PARM device_xname(&sc->sc_dev) +#define ISIC_PARM device_xname(sc->sc_dev) #define TERMFMT "\n" /* @@ -363,7 +363,7 @@ isicattach(int flags, struct isic_softc #elif defined(__bsdi__) - struct isic_softc *sc = (struct isic_softc *)self; + struct isic_softc *sc = device_private(self); #define PARM parent, self, ia #define PARM2 parent, self, ia #define FLAGS sc->sc_flags @@ -536,7 +536,7 @@ isicattach(int flags, struct isic_softc break; default: - aprint_error_dev(&sc->sc_dev, "Error, IPAC version %d unknown!\n", ret); + aprint_error_dev(sc->sc_dev, "Error, IPAC version %d unknown!\n", ret); return(0); break; } @@ -777,9 +777,9 @@ isicattach(int flags, struct isic_softc static void isic_isa_attach(device_t parent, device_t self, void *aux) { - struct isic_softc *sc = (void *)self; + struct isic_softc *sc = device_private(self); struct isa_attach_args *ia = aux; - int flags = device_cfdata(&sc->sc_dev)->cf_flags; + int flags = device_cfdata(self)->cf_flags; int ret = 0, iobase, iosize, maddr, msize; struct isic_attach_args args; @@ -799,6 +799,7 @@ isic_isa_attach(device_t parent, device_ } /* Setup parameters */ + sc->sc_dev = self; sc->sc_irq = ia->ia_irq[0].ir_irq; sc->sc_maddr = maddr; sc->sc_num_mappings = 0; Index: sys/dev/isa/isic_isa_itk_ix1.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/isa/isic_isa_itk_ix1.c,v retrieving revision 1.17 diff -u -p -r1.17 isic_isa_itk_ix1.c --- sys/dev/isa/isic_isa_itk_ix1.c 28 Apr 2008 20:23:52 -0000 1.17 +++ sys/dev/isa/isic_isa_itk_ix1.c 28 Sep 2012 21:15:00 -0000 @@ -310,11 +310,11 @@ int isic_attach_itkix1(struct isic_softc if((hv1 != 0x05 && hv1 != 0x04) || (hv2 != 0x05 && hv2 != 0x04)) { printf("%s: HSCX VSTR test failed for ITK ix1 micro\n", - device_xname(&sc->sc_dev)); + device_xname(sc->sc_dev)); printf("%s: HSC0: VSTR: %#x\n", - device_xname(&sc->sc_dev), HSCX_READ(0, H_VSTR)); + device_xname(sc->sc_dev), HSCX_READ(0, H_VSTR)); printf("%s: HSC1: VSTR: %#x\n", - device_xname(&sc->sc_dev), HSCX_READ(1, H_VSTR)); + device_xname(sc->sc_dev), HSCX_READ(1, H_VSTR)); return 0; } Index: sys/dev/isa/isic_isa_tel_s0163.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/isa/isic_isa_tel_s0163.c,v retrieving revision 1.12 diff -u -p -r1.12 isic_isa_tel_s0163.c --- sys/dev/isa/isic_isa_tel_s0163.c 12 May 2009 09:10:15 -0000 1.12 +++ sys/dev/isa/isic_isa_tel_s0163.c 26 Sep 2012 22:19:47 -0000 @@ -540,7 +540,7 @@ extern int isic_attach_s0163(device_t parent, device_t self, struct isa_attach_args *ia) { u_char irq; - struct isic_softc *sc = (struct isic_softc *)self; + struct isic_softc *sc = device_private(self); int unit = sc->sc_dev.dv_unit; /* Commit the probed attachement values */ Index: sys/dev/isa/mcd.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/isa/mcd.c,v retrieving revision 1.109 diff -u -p -r1.109 mcd.c --- sys/dev/isa/mcd.c 12 May 2009 09:10:15 -0000 1.109 +++ sys/dev/isa/mcd.c 26 Sep 2012 18:37:43 -0000 @@ -86,7 +86,7 @@ __KERNEL_RCSID(0, "$NetBSD: mcd.c,v 1.10 #ifndef MCDDEBUG #define MCD_TRACE(fmt,...) #else -#define MCD_TRACE(fmt,...) {if (sc->debug) {printf("%s: st=%02x: ", device_xname(&sc->sc_dev), sc->status); printf(fmt,__VA_ARGS__);}} +#define MCD_TRACE(fmt,...) {if (sc->debug) {printf("%s: st=%02x: ", device_xname(sc->sc_dev), sc->status); printf(fmt,__VA_ARGS__);}} #endif #define MCDPART(dev) DISKPART(dev) @@ -120,7 +120,7 @@ struct mcd_mbx { }; struct mcd_softc { - struct device sc_dev; + device_t sc_dev; struct disk sc_dk; kmutex_t sc_lock; void *sc_ih; @@ -193,7 +193,7 @@ int mcd_find(bus_space_tag_t, bus_space_ int mcdprobe(device_t, cfdata_t, void *); void mcdattach(device_t, device_t, void *); -CFATTACH_DECL(mcd, sizeof(struct mcd_softc), +CFATTACH_DECL_NEW(mcd, sizeof(struct mcd_softc), mcdprobe, mcdattach, NULL, NULL); extern struct cfdriver mcd_cd; @@ -237,7 +237,7 @@ struct dkdriver mcddkdriver = { mcdstrat void mcdattach(device_t parent, device_t self, void *aux) { - struct mcd_softc *sc = (void *)self; + struct mcd_softc *sc = device_private(self); struct isa_attach_args *ia = aux; bus_space_tag_t iot = ia->ia_iot; bus_space_handle_t ioh; @@ -268,7 +268,7 @@ mcdattach(device_t parent, device_t self /* * Initialize and attach the disk structure. */ - disk_init(&sc->sc_dk, device_xname(&sc->sc_dev), &mcddkdriver); + disk_init(&sc->sc_dk, device_xname(sc->sc_dev), &mcddkdriver); disk_attach(&sc->sc_dk); printf(": model %s\n", sc->type != 0 ? sc->type : "unknown"); @@ -436,7 +436,7 @@ mcdstrategy(struct buf *bp) if (bp->b_blkno < 0 || (bp->b_bcount % sc->blksize) != 0) { printf("%s: strategy: blkno = %" PRId64 " bcount = %d\n", - device_xname(&sc->sc_dev), bp->b_blkno, bp->b_bcount); + device_xname(sc->sc_dev), bp->b_blkno, bp->b_bcount); bp->b_error = EINVAL; goto done; } @@ -897,7 +897,7 @@ mcd_find(bus_space_tag_t iot, bus_space_ #ifdef MCDDEBUG printf("%s: unrecognized drive version %c%02x; will try to use it anyway\n", - device_xname(&sc->sc_dev), + device_xname(sc->sc_dev), mbx.res.data.continfo.code, mbx.res.data.continfo.version); #endif sc->type = 0; @@ -993,14 +993,14 @@ mcd_getresult(struct mcd_softc *sc, stru int i, x; if (sc->debug) - printf("%s: mcd_getresult: %d", device_xname(&sc->sc_dev), + printf("%s: mcd_getresult: %d", device_xname(sc->sc_dev), res->length); if ((x = mcd_getreply(sc)) < 0) { if (sc->debug) printf(" timeout\n"); else if (!sc->probe) - printf("%s: timeout in getresult\n", device_xname(&sc->sc_dev)); + printf("%s: timeout in getresult\n", device_xname(sc->sc_dev)); return EIO; } if (sc->debug) @@ -1016,7 +1016,7 @@ mcd_getresult(struct mcd_softc *sc, stru if (sc->debug) printf(" timeout\n"); else - printf("%s: timeout in getresult\n", device_xname(&sc->sc_dev)); + printf("%s: timeout in getresult\n", device_xname(sc->sc_dev)); return EIO; } if (sc->debug) @@ -1033,7 +1033,7 @@ mcd_getresult(struct mcd_softc *sc, stru MCD_XF_STATUSUNAVAIL) == 0) { x = bus_space_read_1(sc->sc_iot, sc->sc_ioh, MCD_STATUS); printf("%s: got extra byte %02x during getstatus\n", - device_xname(&sc->sc_dev), (u_int)x); + device_xname(sc->sc_dev), (u_int)x); delay(10); } #endif @@ -1050,11 +1050,11 @@ mcd_setflags(struct mcd_softc *sc) (sc->status & (MCD_ST_DSKCHNG | MCD_ST_DSKIN | MCD_ST_DOOROPEN)) != MCD_ST_DSKIN) { if ((sc->status & MCD_ST_DOOROPEN) != 0) - printf("%s: door open\n", device_xname(&sc->sc_dev)); + printf("%s: door open\n", device_xname(sc->sc_dev)); else if ((sc->status & MCD_ST_DSKIN) == 0) - printf("%s: no disk present\n", device_xname(&sc->sc_dev)); + printf("%s: no disk present\n", device_xname(sc->sc_dev)); else if ((sc->status & MCD_ST_DSKCHNG) != 0) - printf("%s: media change\n", device_xname(&sc->sc_dev)); + printf("%s: media change\n", device_xname(sc->sc_dev)); sc->flags &= ~MCDF_LOADED; } @@ -1073,7 +1073,7 @@ mcd_send(struct mcd_softc *sc, struct mc bus_space_handle_t ioh = sc->sc_ioh; if (sc->debug) { - printf("%s: mcd_send: %d %02x", device_xname(&sc->sc_dev), + printf("%s: mcd_send: %d %02x", device_xname(sc->sc_dev), mbx->cmd.length, (u_int)mbx->cmd.opcode); for (i = 0; i < mbx->cmd.length; i++) printf(" %02x", (u_int)mbx->cmd.data.raw.data[i]); @@ -1240,7 +1240,7 @@ mcdintr(void *arg) goto changed; #if 0 printf("%s: got status byte %02x during read\n", - device_xname(&sc->sc_dev), (u_int)sc->status); + device_xname(sc->sc_dev), (u_int)sc->status); #endif goto loop; @@ -1271,12 +1271,12 @@ mcdintr(void *arg) hold: if (mbx->count-- < 0) { printf("%s: timeout in state %d", - device_xname(&sc->sc_dev), mbx->state); + device_xname(sc->sc_dev), mbx->state); goto readerr; } #if 0 - printf("%s: sleep in state %d\n", device_xname(&sc->sc_dev), + printf("%s: sleep in state %d\n", device_xname(sc->sc_dev), mbx->state); #endif callout_reset(&sc->sc_pintr_ch, hz / 100, @@ -1303,7 +1303,7 @@ changed: return -1; #ifdef notyet - printf("%s: unit timeout; resetting\n", device_xname(&sc->sc_dev)); + printf("%s: unit timeout; resetting\n", device_xname(sc->sc_dev)); bus_space_write_1(iot, ioh, MCD_RESET, MCD_CMDRESET); delay(300000); (void) mcd_getstat(sc, 1); @@ -1347,7 +1347,7 @@ mcd_setmode(struct mcd_softc *sc, int mo if (sc->lastmode == mode) return 0; if (sc->debug) - printf("%s: setting mode to %d\n", device_xname(&sc->sc_dev), mode); + printf("%s: setting mode to %d\n", device_xname(sc->sc_dev), mode); sc->lastmode = MCD_MD_UNKNOWN; mbx.cmd.opcode = MCD_CMDSETMODE; @@ -1370,7 +1370,7 @@ mcd_setupc(struct mcd_softc *sc, int upc if (sc->lastupc == upc) return 0; if (sc->debug) - printf("%s: setting upc to %d\n", device_xname(&sc->sc_dev), upc); + printf("%s: setting upc to %d\n", device_xname(sc->sc_dev), upc); sc->lastupc = MCD_UPC_UNKNOWN; mbx.cmd.opcode = MCD_CMDCONFIGDRIVE; @@ -1391,7 +1391,7 @@ mcd_toc_header(struct mcd_softc *sc, str if (sc->debug) printf("%s: mcd_toc_header: reading toc header\n", - device_xname(&sc->sc_dev)); + device_xname(sc->sc_dev)); th->len = msf2hsg(sc->volinfo.vol_msf, 0); th->starting_track = bcd2bin(sc->volinfo.trk_low); @@ -1415,7 +1415,7 @@ mcd_read_toc(struct mcd_softc *sc) if (sc->debug) printf("%s: read_toc: reading qchannel info\n", - device_xname(&sc->sc_dev)); + device_xname(sc->sc_dev)); for (trk = th.starting_track; trk <= th.ending_track; trk++) sc->toc[trk].toc.idx_no = 0x00; @@ -1519,7 +1519,7 @@ mcd_stop(struct mcd_softc *sc) int error; if (sc->debug) - printf("%s: mcd_stop: stopping play\n", device_xname(&sc->sc_dev)); + printf("%s: mcd_stop: stopping play\n", device_xname(sc->sc_dev)); mbx.cmd.opcode = MCD_CMDSTOPAUDIO; mbx.cmd.length = 0; @@ -1571,7 +1571,7 @@ mcd_read_subchannel(struct mcd_softc *sc int error; if (sc->debug) - printf("%s: subchan: af=%d df=%d\n", device_xname(&sc->sc_dev), + printf("%s: subchan: af=%d df=%d\n", device_xname(sc->sc_dev), ch->address_format, ch->data_format); if (len > sizeof(*info) || len < sizeof(info->header)) @@ -1647,7 +1647,7 @@ mcd_playtracks(struct mcd_softc *sc, str if (sc->debug) printf("%s: playtracks: from %d:%d to %d:%d\n", - device_xname(&sc->sc_dev), + device_xname(sc->sc_dev), a, p->start_index, z, p->end_index); if (a < bcd2bin(sc->volinfo.trk_low) || @@ -1681,7 +1681,7 @@ mcd_playmsf(struct mcd_softc *sc, struct if (sc->debug) printf("%s: playmsf: from %d:%d.%d to %d:%d.%d\n", - device_xname(&sc->sc_dev), + device_xname(sc->sc_dev), p->start_m, p->start_s, p->start_f, p->end_m, p->end_s, p->end_f); @@ -1713,7 +1713,7 @@ mcd_playblocks(struct mcd_softc *sc, str if (sc->debug) printf("%s: playblocks: blkno %d length %d\n", - device_xname(&sc->sc_dev), p->blk, p->len); + device_xname(sc->sc_dev), p->blk, p->len); if (p->blk > sc->disksize || p->len > sc->disksize || (p->blk + p->len) > sc->disksize) @@ -1740,7 +1740,7 @@ mcd_pause(struct mcd_softc *sc) /* Verify current status. */ if (sc->audio_status != CD_AS_PLAY_IN_PROGRESS) { printf("%s: pause: attempted when not playing\n", - device_xname(&sc->sc_dev)); + device_xname(sc->sc_dev)); return EINVAL; } Index: sys/dev/isa/moxa_isa.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/isa/moxa_isa.c,v retrieving revision 1.19 diff -u -p -r1.19 moxa_isa.c --- sys/dev/isa/moxa_isa.c 12 May 2009 09:10:15 -0000 1.19 +++ sys/dev/isa/moxa_isa.c 28 Sep 2012 19:42:12 -0000 @@ -53,7 +53,6 @@ __KERNEL_RCSID(0, "$NetBSD: moxa_isa.c,v #define NSLAVES 8 struct moxa_isa_softc { - struct device sc_dev; void *sc_ih; bus_space_tag_t sc_iot; @@ -68,7 +67,7 @@ int moxa_isaprobe(device_t, cfdata_t, vo void moxa_isaattach(device_t, device_t, void *); int moxa_isaintr(void *); -CFATTACH_DECL(moxa_isa, sizeof(struct moxa_isa_softc), +CFATTACH_DECL_NEW(moxa_isa, sizeof(struct moxa_isa_softc), moxa_isaprobe, moxa_isaattach, NULL, NULL); int @@ -143,7 +142,7 @@ out: void moxa_isaattach(device_t parent, device_t self, void *aux) { - struct moxa_isa_softc *sc = (void *)self; + struct moxa_isa_softc *sc = device_private(self); struct isa_attach_args *ia = aux; struct commulti_attach_args ca; bus_space_tag_t iot = ia->ia_iot; @@ -159,7 +158,7 @@ moxa_isaattach(device_t parent, device_t if (!com_is_console(iot, iobase, &sc->sc_slaveioh[i]) && bus_space_map(iot, iobase, COM_NPORTS, 0, &sc->sc_slaveioh[i])) { - aprint_error_dev(&sc->sc_dev, "can't map i/o space for slave %d\n", i); + aprint_error_dev(self, "can't map i/o space for slave %d\n", i); return; } } Index: sys/dev/isa/nca_isa.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/isa/nca_isa.c,v retrieving revision 1.21 diff -u -p -r1.21 nca_isa.c --- sys/dev/isa/nca_isa.c 28 Apr 2008 20:23:52 -0000 1.21 +++ sys/dev/isa/nca_isa.c 1 Oct 2012 14:48:13 -0000 @@ -87,7 +87,6 @@ struct nca_isa_softc { }; struct nca_isa_probe_data { - struct device sc_dev; int sc_reg_offset; int sc_host_type; }; Index: sys/dev/isa/pcdisplay.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/isa/pcdisplay.c,v retrieving revision 1.40 diff -u -p -r1.40 pcdisplay.c --- sys/dev/isa/pcdisplay.c 19 Apr 2010 18:24:26 -0000 1.40 +++ sys/dev/isa/pcdisplay.c 26 Sep 2012 18:37:43 -0000 @@ -60,7 +60,6 @@ struct pcdisplay_config { }; struct pcdisplay_softc { - struct device sc_dev; struct pcdisplay_config *sc_dc; int nscreens; #if NPCWEASEL > 0 @@ -82,7 +81,7 @@ static void pcdisplay_init(struct pcdisp int); static int pcdisplay_allocattr(void *, int, int, int, long *); -CFATTACH_DECL(pcdisplay, sizeof(struct pcdisplay_softc), +CFATTACH_DECL_NEW(pcdisplay, sizeof(struct pcdisplay_softc), pcdisplay_match, pcdisplay_attach, NULL, NULL); const struct wsdisplay_emulops pcdisplay_emulops = { @@ -282,7 +281,7 @@ void pcdisplay_attach(device_t parent, device_t self, void *aux) { struct isa_attach_args *ia = aux; - struct pcdisplay_softc *sc = (struct pcdisplay_softc *)self; + struct pcdisplay_softc *sc = device_private(self); int console; struct pcdisplay_config *dc; struct wsemuldisplaydev_attach_args aa; @@ -319,7 +318,7 @@ pcdisplay_attach(device_t parent, device if (dc->mono) { sc->sc_weasel.wh_st = dc->dc_ph.ph_memt; sc->sc_weasel.wh_sh = dc->dc_ph.ph_memh; - sc->sc_weasel.wh_parent = &sc->sc_dev; + sc->sc_weasel.wh_parent = self; weasel_isa_init(&sc->sc_weasel); } #endif /* NPCWEASEL > 0 */ Index: sys/dev/isa/radiotrack.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/isa/radiotrack.c,v retrieving revision 1.18 diff -u -p -r1.18 radiotrack.c --- sys/dev/isa/radiotrack.c 12 May 2009 09:10:15 -0000 1.18 +++ sys/dev/isa/radiotrack.c 26 Sep 2012 18:37:43 -0000 @@ -104,8 +104,6 @@ const struct radio_hw_if rt_hw_if = { }; struct rt_softc { - struct device sc_dev; - int mute; u_int8_t vol; u_int8_t cardtype; @@ -116,7 +114,7 @@ struct rt_softc { struct lm700x_t lm; }; -CFATTACH_DECL(rt, sizeof(struct rt_softc), +CFATTACH_DECL_NEW(rt, sizeof(struct rt_softc), rt_probe, rt_attach, NULL, NULL); int rt_find(bus_space_tag_t, bus_space_handle_t); @@ -176,7 +174,7 @@ rt_probe(device_t parent, cfdata_t cf, v void rt_attach(device_t parent, device_t self, void *aux) { - struct rt_softc *sc = (void *) self; + struct rt_softc *sc = device_private(self); struct isa_attach_args *ia = aux; sc->lm.iot = ia->ia_iot; @@ -189,7 +187,7 @@ rt_attach(device_t parent, device_t self /* remap I/O */ if (bus_space_map(sc->lm.iot, ia->ia_io[0].ir_addr, ia->ia_io[0].ir_size, 0, &sc->lm.ioh)) - panic(": bus_space_map() of %s failed", device_xname(&sc->sc_dev)); + panic(": bus_space_map() of %s failed", device_xname(self)); switch (ia->ia_io[0].ir_addr) { case 0x20C: @@ -223,7 +221,7 @@ rt_attach(device_t parent, device_t self rt_set_freq(sc, sc->freq); - radio_attach_mi(&rt_hw_if, sc, &sc->sc_dev); + radio_attach_mi(&rt_hw_if, sc, self); } /* Index: sys/dev/isa/radiotrack2.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/isa/radiotrack2.c,v retrieving revision 1.15 diff -u -p -r1.15 radiotrack2.c --- sys/dev/isa/radiotrack2.c 12 May 2009 09:10:15 -0000 1.15 +++ sys/dev/isa/radiotrack2.c 26 Sep 2012 22:19:47 -0000 @@ -97,8 +97,6 @@ const struct radio_hw_if rtii_hw_if = { }; struct rtii_softc { - struct device dev; - u_int32_t freq; u_int32_t stereo; u_int32_t lock; @@ -108,7 +106,7 @@ struct rtii_softc { struct tea5757_t tea; }; -CFATTACH_DECL(rtii, sizeof(struct rtii_softc), +CFATTACH_DECL_NEW(rtii, sizeof(struct rtii_softc), rtii_probe, rtii_attach, NULL, NULL); void rtii_set_mute(struct rtii_softc *); @@ -166,7 +164,7 @@ rtii_probe(device_t parent, cfdata_t cf, void rtii_attach(device_t parent, device_t self, void *aux) { - struct rtii_softc *sc = (void *) self; + struct rtii_softc *sc = device_private(self); struct isa_attach_args *ia = aux; sc->tea.iot = ia->ia_iot; @@ -193,7 +191,7 @@ rtii_attach(device_t parent, device_t se tea5757_set_freq(&sc->tea, sc->stereo, sc->lock, sc->freq); rtii_set_mute(sc); - radio_attach_mi(&rtii_hw_if, sc, &sc->dev); + radio_attach_mi(&rtii_hw_if, sc, self); } /* Index: sys/dev/isa/rtfps.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/isa/rtfps.c,v retrieving revision 1.57 diff -u -p -r1.57 rtfps.c --- sys/dev/isa/rtfps.c 12 May 2009 09:10:15 -0000 1.57 +++ sys/dev/isa/rtfps.c 26 Sep 2012 18:37:43 -0000 @@ -53,7 +53,6 @@ __KERNEL_RCSID(0, "$NetBSD: rtfps.c,v 1. #define NSLAVES 4 struct rtfps_softc { - struct device sc_dev; void *sc_ih; bus_space_tag_t sc_iot; @@ -70,7 +69,7 @@ int rtfpsprobe(device_t, cfdata_t, void void rtfpsattach(device_t, device_t, void *); int rtfpsintr(void *); -CFATTACH_DECL(rtfps, sizeof(struct rtfps_softc), +CFATTACH_DECL_NEW(rtfps, sizeof(struct rtfps_softc), rtfpsprobe, rtfpsattach, NULL, NULL); int @@ -142,7 +141,7 @@ out: void rtfpsattach(device_t parent, device_t self, void *aux) { - struct rtfps_softc *sc = (void *)self; + struct rtfps_softc *sc = device_private(self); struct isa_attach_args *ia = aux; struct commulti_attach_args ca; static int irqport[] = { @@ -159,7 +158,7 @@ rtfpsattach(device_t parent, device_t se irq = ia->ia_irq[0].ir_irq; if (irq >= 16 || irqport[irq] == -1) { - printf("%s: invalid irq\n", device_xname(&sc->sc_dev)); + printf("%s: invalid irq\n", device_xname(self)); return; } sc->sc_irqport = irqport[irq]; @@ -169,12 +168,12 @@ rtfpsattach(device_t parent, device_t se if (!com_is_console(iot, iobase, &sc->sc_slaveioh[i]) && bus_space_map(iot, iobase, COM_NPORTS, 0, &sc->sc_slaveioh[i])) { - aprint_error_dev(&sc->sc_dev, "can't map i/o space for slave %d\n", i); + aprint_error_dev(self, "can't map i/o space for slave %d\n", i); return; } } if (bus_space_map(iot, sc->sc_irqport, 1, 0, &sc->sc_irqioh)) { - aprint_error_dev(&sc->sc_dev, "can't map irq port at 0x%x\n", + aprint_error_dev(self, "can't map irq port at 0x%x\n", sc->sc_irqport); return; } Index: sys/dev/isa/satlink.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/isa/satlink.c,v retrieving revision 1.42 diff -u -p -r1.42 satlink.c --- sys/dev/isa/satlink.c 12 May 2009 09:10:15 -0000 1.42 +++ sys/dev/isa/satlink.c 26 Sep 2012 18:37:43 -0000 @@ -67,7 +67,6 @@ __KERNEL_RCSID(0, "$NetBSD: satlink.c,v #include struct satlink_softc { - struct device sc_dev; /* device glue */ bus_space_tag_t sc_iot; /* space tag */ bus_space_handle_t sc_ioh; /* space handle */ isa_chipset_tag_t sc_ic; /* ISA chipset info */ @@ -97,7 +96,7 @@ int satlinkprobe(device_t, cfdata_t, voi void satlinkattach(device_t, device_t, void *); void satlinktimeout(void *); -CFATTACH_DECL(satlink, sizeof(struct satlink_softc), +CFATTACH_DECL_NEW(satlink, sizeof(struct satlink_softc), satlinkprobe, satlinkattach, NULL, NULL); extern struct cfdriver satlink_cd; @@ -160,7 +159,7 @@ satlinkprobe(device_t parent, cfdata_t m void satlinkattach(device_t parent, device_t self, void *aux) { - struct satlink_softc *sc = (struct satlink_softc *)self; + struct satlink_softc *sc = device_private(self); struct isa_attach_args *ia = aux; bus_space_tag_t iot = ia->ia_iot; bus_space_handle_t ioh; @@ -170,7 +169,7 @@ satlinkattach(device_t parent, device_t /* Map the card. */ if (bus_space_map(iot, ia->ia_io[0].ir_addr, SATLINK_IOSIZE, 0, &ioh)) { - aprint_error_dev(&sc->sc_dev, "can't map i/o space\n"); + aprint_error_dev(self, "can't map i/o space\n"); return; } @@ -197,7 +196,7 @@ satlinkattach(device_t parent, device_t (bus_space_read_1(iot, ioh, SATLINK_SER_H) << 24); printf("%s: mfrid 0x%x, grpid 0x%x, userid 0x%x, serial %d\n", - device_xname(&sc->sc_dev), sc->sc_id.sid_mfrid, + device_xname(self), sc->sc_id.sid_mfrid, sc->sc_id.sid_grpid, sc->sc_id.sid_userid, sc->sc_id.sid_serial); @@ -209,19 +208,19 @@ satlinkattach(device_t parent, device_t /* Allocate and map the ring buffer. */ if (isa_dmamem_alloc(sc->sc_ic, sc->sc_drq, sc->sc_bufsize, &ringaddr, BUS_DMA_NOWAIT)) { - aprint_error_dev(&sc->sc_dev, "can't allocate ring buffer\n"); + aprint_error_dev(self, "can't allocate ring buffer\n"); return; } if (isa_dmamem_map(sc->sc_ic, sc->sc_drq, ringaddr, sc->sc_bufsize, &sc->sc_buf, BUS_DMA_NOWAIT|BUS_DMA_COHERENT)) { - aprint_error_dev(&sc->sc_dev, "can't map ring buffer\n"); + aprint_error_dev(self, "can't map ring buffer\n"); isa_dmamem_free(sc->sc_ic, sc->sc_drq, ringaddr, sc->sc_bufsize); return; } if (isa_drq_alloc(sc->sc_ic, sc->sc_drq) != 0) { - aprint_error_dev(&sc->sc_dev, "can't reserve drq %d\n", + aprint_error_dev(self, "can't reserve drq %d\n", sc->sc_drq); isa_dmamem_unmap(sc->sc_ic, sc->sc_drq, sc->sc_buf, sc->sc_bufsize); @@ -233,7 +232,7 @@ satlinkattach(device_t parent, device_t /* Create the DMA map. */ if (isa_dmamap_create(sc->sc_ic, sc->sc_drq, sc->sc_bufsize, BUS_DMA_NOWAIT|BUS_DMA_ALLOCNOW)) { - aprint_error_dev(&sc->sc_dev, "can't create DMA map\n"); + aprint_error_dev(self, "can't create DMA map\n"); isa_dmamem_unmap(sc->sc_ic, sc->sc_drq, sc->sc_buf, sc->sc_bufsize); isa_dmamem_free(sc->sc_ic, sc->sc_drq, ringaddr, Index: sys/dev/isa/seagate.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/isa/seagate.c,v retrieving revision 1.70 diff -u -p -r1.70 seagate.c --- sys/dev/isa/seagate.c 23 Nov 2009 02:13:47 -0000 1.70 +++ sys/dev/isa/seagate.c 26 Sep 2012 18:37:43 -0000 @@ -189,7 +189,7 @@ struct sea_scb { * controller card. */ struct sea_softc { - struct device sc_dev; + device_t sc_dev; void *sc_ih; int type; /* board type */ @@ -296,7 +296,7 @@ void sea_grow_scb(struct sea_softc *); int seaprobe(device_t, cfdata_t, void *); void seaattach(device_t, device_t, void *); -CFATTACH_DECL(sea, sizeof(struct sea_softc), +CFATTACH_DECL_NEW(sea, sizeof(struct sea_softc), seaprobe, seaattach, NULL, NULL); extern struct cfdriver sea_cd; @@ -313,7 +313,7 @@ sea_queue_length(struct sea_softc *sea) scb = scb->chain.tqe_next, issued++); for (scb = sea->nexus_list.tqh_first, disconnected = 0; scb; scb = scb->chain.tqe_next, disconnected++); - printf("%s: length: %d/%d/%d\n", device_xname(&sea->sc_dev), connected, + printf("%s: length: %d/%d/%d\n", device_xname(sea->sc_dev), connected, issued, disconnected); } #endif @@ -386,11 +386,13 @@ void seaattach(device_t parent, device_t self, void *aux) { struct isa_attach_args *ia = aux; - struct sea_softc *sea = (void *)self; + struct sea_softc *sea = device_private(self); struct scsipi_adapter *adapt = &sea->sc_adapter; struct scsipi_channel *chan = &sea->sc_channel; int i; + sea->sc_dev = self; + /* XXX XXX XXX */ sea->maddr = ISA_HOLE_VADDR(ia->ia_iomem[0].ir_addr); @@ -420,7 +422,7 @@ seaattach(device_t parent, device_t self default: #ifdef DEBUG printf("%s: board type unknown at address %p\n", - device_xname(&sea->sc_dev), sea->maddr); + device_xname(sea->sc_dev), sea->maddr); #endif return; } @@ -431,7 +433,7 @@ seaattach(device_t parent, device_t self if ((*((u_char *)sea->maddr + SEA_RAMOFFSET) != 0xa5) || (*((u_char *)sea->maddr + SEA_RAMOFFSET + 1) != 0x5a)) { - aprint_error_dev(&sea->sc_dev, "board RAM failure\n"); + aprint_error_dev(sea->sc_dev, "board RAM failure\n"); return; } @@ -441,7 +443,7 @@ seaattach(device_t parent, device_t self * Fill in the scsipi_adapter. */ memset(adapt, 0, sizeof(*adapt)); - adapt->adapt_dev = &sea->sc_dev; + adapt->adapt_dev = sea->sc_dev; adapt->adapt_nchannels = 1; adapt->adapt_openings = sea->numscbs; adapt->adapt_max_periph = 1; @@ -491,7 +493,7 @@ loop: if (STATUS & STAT_PARITY) { /* Parity error interrupt */ - aprint_error_dev(&sea->sc_dev, "parity error\n"); + aprint_error_dev(sea->sc_dev, "parity error\n"); return 1; } @@ -556,7 +558,7 @@ sea_scsipi_request(struct scsipi_channel { struct scsipi_xfer *xs; struct scsipi_periph *periph; - struct sea_softc *sea = (void *)chan->chan_adapter->adapt_dev; + struct sea_softc *sea = device_private(chan->chan_adapter->adapt_dev); struct sea_scb *scb; int flags; int s; @@ -571,7 +573,7 @@ sea_scsipi_request(struct scsipi_channel /* XXX Reset not implemented. */ if (flags & XS_CTL_RESET) { - printf("%s: resetting\n", device_xname(&sea->sc_dev)); + printf("%s: resetting\n", device_xname(sea->sc_dev)); xs->error = XS_DRIVER_STUFFUP; scsipi_done(xs); return; @@ -827,7 +829,7 @@ sea_timeout(void *arg) struct scsipi_xfer *xs = scb->xs; struct scsipi_periph *periph = xs->xs_periph; struct sea_softc *sea = - (void *)periph->periph_channel->chan_adapter->adapt_dev; + device_private(periph->periph_channel->chan_adapter->adapt_dev); int s; scsipi_printaddr(periph); @@ -873,7 +875,7 @@ sea_reselect(struct sea_softc *sea) int abort = 0; if (!((target_mask = STATUS) & STAT_SEL)) { - printf("%s: wrong state 0x%x\n", device_xname(&sea->sc_dev), + printf("%s: wrong state 0x%x\n", device_xname(sea->sc_dev), target_mask); return; } @@ -888,7 +890,7 @@ sea_reselect(struct sea_softc *sea) /* see that we really are the initiator */ if (!(target_mask & sea->our_id_mask)) { printf("%s: polled reselection was not for me: 0x%x\n", - device_xname(&sea->sc_dev), target_mask); + device_xname(sea->sc_dev), target_mask); return; } /* find target who won */ @@ -910,7 +912,7 @@ sea_reselect(struct sea_softc *sea) if (!MSG_ISIDENTIFY(msg[0])) { printf("%s: expecting IDENTIFY message, got 0x%x\n", - device_xname(&sea->sc_dev), msg[0]); + device_xname(sea->sc_dev), msg[0]); abort = 1; scb = NULL; } else { @@ -931,7 +933,7 @@ sea_reselect(struct sea_softc *sea) } if (!scb) { printf("%s: target %02x lun %d not disconnected\n", - device_xname(&sea->sc_dev), target_mask, lun); + device_xname(sea->sc_dev), target_mask, lun); /* * Since we have an established nexus that we can't do * anything with, we must abort it. @@ -974,7 +976,7 @@ sea_transfer_pio(struct sea_softc *sea, break; if (!(tmp & STAT_REQ)) { printf("%s: timeout waiting for STAT_REQ\n", - device_xname(&sea->sc_dev)); + device_xname(sea->sc_dev)); break; } @@ -1015,7 +1017,7 @@ sea_transfer_pio(struct sea_softc *sea, break; if (STATUS & STAT_REQ) printf("%s: timeout on wait for !STAT_REQ", - device_xname(&sea->sc_dev)); + device_xname(sea->sc_dev)); #endif } while (--c); @@ -1056,11 +1058,11 @@ sea_select(struct sea_softc *sea, struct break; if (!(STATUS & STAT_ARB_CMPL)) { if (STATUS & STAT_SEL) { - printf("%s: arbitration lost\n", device_xname(&sea->sc_dev)); + printf("%s: arbitration lost\n", device_xname(sea->sc_dev)); scb->flags |= SCB_ERROR; } else { printf("%s: arbitration timeout\n", - device_xname(&sea->sc_dev)); + device_xname(sea->sc_dev)); scb->flags |= SCB_TIMEOUT; } CONTROL = BASE_CMD; @@ -1120,7 +1122,7 @@ sea_select(struct sea_softc *sea, struct } if (!(STATUS & STAT_BSY)) printf("%s: after successful arbitrate: no STAT_BSY!\n", - device_xname(&sea->sc_dev)); + device_xname(sea->sc_dev)); sea->nexus = scb; sea->busy[scb->xs->xs_periph->periph_target] |= @@ -1257,14 +1259,14 @@ sea_information_transfer(struct sea_soft tmp = STATUS; if (tmp & STAT_PARITY) printf("%s: parity error detected\n", - device_xname(&sea->sc_dev)); + device_xname(sea->sc_dev)); if (!(tmp & STAT_BSY)) { for (loop = 0; loop < 20; loop++) if ((tmp = STATUS) & STAT_BSY) break; if (!(tmp & STAT_BSY)) { printf("%s: !STAT_BSY unit in data transfer!\n", - device_xname(&sea->sc_dev)); + device_xname(sea->sc_dev)); s = splbio(); sea->nexus = NULL; scb->flags = SCB_ERROR; @@ -1290,7 +1292,7 @@ sea_information_transfer(struct sea_soft case PH_DATAOUT: #ifdef SEA_NODATAOUT printf("%s: SEA_NODATAOUT set, attempted DATAOUT aborted\n", - device_xname(&sea->sc_dev)); + device_xname(sea->sc_dev)); msgout = MSG_ABORT; CONTROL = BASE_CMD | CMD_ATTN; break; @@ -1306,7 +1308,7 @@ sea_information_transfer(struct sea_soft break; if (!(tmp & STAT_REQ)) { printf("%s: timeout waiting for STAT_REQ\n", - device_xname(&sea->sc_dev)); + device_xname(sea->sc_dev)); /* XXX Do something? */ } if (sea->type == FDOMAIN840) @@ -1383,7 +1385,7 @@ sea_information_transfer(struct sea_soft return; case MSG_MESSAGE_REJECT: printf("%s: message_reject received\n", - device_xname(&sea->sc_dev)); + device_xname(sea->sc_dev)); break; case MSG_DISCONNECT: s = splbio(); @@ -1405,7 +1407,7 @@ sea_information_transfer(struct sea_soft * message. */ printf("%s: unknown message in: %x\n", - device_xname(&sea->sc_dev), tmp); + device_xname(sea->sc_dev), tmp); break; } /* switch (tmp) */ break; @@ -1416,7 +1418,7 @@ sea_information_transfer(struct sea_soft sea_transfer_pio(sea, &phase, &len, &data); if (msgout == MSG_ABORT) { printf("%s: sent message abort to target\n", - device_xname(&sea->sc_dev)); + device_xname(sea->sc_dev)); s = splbio(); sea->busy[scb->xs->xs_periph->periph_target] &= ~(1 << scb->xs->xs_periph->periph_lun); @@ -1446,7 +1448,7 @@ sea_information_transfer(struct sea_soft } /* for (...) */ /* If we get here we have got a timeout! */ - printf("%s: timeout in data transfer\n", device_xname(&sea->sc_dev)); + printf("%s: timeout in data transfer\n", device_xname(sea->sc_dev)); scb->flags = SCB_TIMEOUT; /* XXX Should I clear scsi-bus state? */ sea_done(sea, scb); Index: sys/dev/isa/sf16fmr2.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/isa/sf16fmr2.c,v retrieving revision 1.15 diff -u -p -r1.15 sf16fmr2.c --- sys/dev/isa/sf16fmr2.c 12 May 2009 09:10:16 -0000 1.15 +++ sys/dev/isa/sf16fmr2.c 26 Sep 2012 18:37:43 -0000 @@ -97,8 +97,6 @@ const struct radio_hw_if sf2r_hw_if = { }; struct sf2r_softc { - struct device sc_dev; - u_int32_t freq; u_int32_t stereo; u_int32_t lock; @@ -108,7 +106,7 @@ struct sf2r_softc { struct tea5757_t tea; }; -CFATTACH_DECL(sf2r, sizeof(struct sf2r_softc), +CFATTACH_DECL_NEW(sf2r, sizeof(struct sf2r_softc), sf2r_probe, sf2r_attach, NULL, NULL); void sf2r_set_mute(struct sf2r_softc *); @@ -166,7 +164,7 @@ sf2r_probe(device_t parent, cfdata_t cf, void sf2r_attach(device_t parent, device_t self, void *aux) { - struct sf2r_softc *sc = (void *) self; + struct sf2r_softc *sc = device_private(self); struct isa_attach_args *ia = aux; sc->tea.iot = ia->ia_iot; @@ -193,7 +191,7 @@ sf2r_attach(device_t parent, device_t se tea5757_set_freq(&sc->tea, sc->stereo, sc->lock, sc->freq); sf2r_set_mute(sc); - radio_attach_mi(&sf2r_hw_if, sc, &sc->sc_dev); + radio_attach_mi(&sf2r_hw_if, sc, self); } /* Index: sys/dev/isa/smscvar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/isa/smscvar.h,v retrieving revision 1.4 diff -u -p -r1.4 smscvar.h --- sys/dev/isa/smscvar.h 28 Apr 2008 20:23:52 -0000 1.4 +++ sys/dev/isa/smscvar.h 1 Oct 2012 14:49:08 -0000 @@ -76,8 +76,6 @@ #define SMSC_MAX_SENSORS 8 /* 4 temp sensors, 4 fan sensors */ struct smsc_softc { - struct device sc_dev; - bus_space_tag_t sc_iot; bus_space_handle_t sc_ioh; Index: sys/dev/isa/tcic2_isa.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/isa/tcic2_isa.c,v retrieving revision 1.25 diff -u -p -r1.25 tcic2_isa.c --- sys/dev/isa/tcic2_isa.c 12 May 2009 09:10:16 -0000 1.25 +++ sys/dev/isa/tcic2_isa.c 28 Sep 2012 19:43:55 -0000 @@ -115,7 +115,7 @@ void *tcic_isa_chip_intr_establish(pcmci struct pcmcia_function *, int, int (*) (void *), void *); void tcic_isa_chip_intr_disestablish(pcmcia_chipset_handle_t, void *); -CFATTACH_DECL(tcic_isa, sizeof(struct tcic_softc), +CFATTACH_DECL_NEW(tcic_isa, sizeof(struct tcic_softc), tcic_isa_probe, tcic_isa_attach, NULL, NULL); static const struct pcmcia_chip_functions tcic_isa_functions = { @@ -216,7 +216,7 @@ tcic_isa_probe(device_t parent, cfdata_t void tcic_isa_attach(device_t parent, device_t self, void *aux) { - struct tcic_softc *sc = (void *) self; + struct tcic_softc *sc = device_private(self); struct isa_attach_args *ia = aux; isa_chipset_tag_t ic = ia->ia_ic; bus_space_tag_t iot = ia->ia_iot; @@ -271,7 +271,7 @@ tcic_isa_attach(device_t parent, device_ sc->validirqs & (tcic_isa_intr_alloc_mask & 0xff00), IST_EDGE, &sc->irq)) { aprint_normal("\n"); - aprint_error_dev(&sc->dev, "can't allocate interrupt\n"); + aprint_error_dev(self, "can't allocate interrupt\n"); return; } printf(": using irq %d", sc->irq); @@ -313,7 +313,7 @@ tcic_isa_attach(device_t parent, device_ #endif DPRINTF(("%s: bus_space_alloc range 0x%04lx-0x%04lx)\n", - device_xname(&sc->dev), (long) sc->iobase, + device_xname(self), (long) sc->iobase, (long) sc->iobase + sc->iosize)); if (tcic_isa_alloc_iobase && tcic_isa_alloc_iosize) { @@ -321,13 +321,13 @@ tcic_isa_attach(device_t parent, device_ sc->iosize = tcic_isa_alloc_iosize; DPRINTF(("%s: bus_space_alloc range 0x%04lx-0x%04lx " - "(config override)\n", device_xname(&sc->dev), (long) sc->iobase, + "(config override)\n", device_xname(self), (long) sc->iobase, (long) sc->iobase + sc->iosize)); } sc->ih = isa_intr_establish(ic, sc->irq, IST_EDGE, IPL_TTY, tcic_intr, sc); if (sc->ih == NULL) { - printf("%s: can't establish interrupt\n", device_xname(&sc->dev)); + printf("%s: can't establish interrupt\n", device_xname(self)); return; } @@ -342,7 +342,7 @@ tcic_isa_chip_intr_establish(pcmcia_chip int irq, ist; void *ih; - DPRINTF(("%s: tcic_isa_chip_intr_establish\n", device_xname(&h->sc->dev))); + DPRINTF(("%s: tcic_isa_chip_intr_establish\n", device_xname(h->sc->sc_dev))); /* XXX should we convert level to pulse? -chb */ if (pf->cfe->flags & PCMCIA_CFE_IRQLEVEL) @@ -359,7 +359,7 @@ tcic_isa_chip_intr_establish(pcmcia_chip fct, arg)) == NULL) return (NULL); - DPRINTF(("%s: intr estrablished\n", device_xname(&h->sc->dev))); + DPRINTF(("%s: intr estrablished\n", device_xname(h->sc->sc_dev))); h->ih_irq = irq; @@ -374,7 +374,7 @@ tcic_isa_chip_intr_disestablish(pcmcia_c struct tcic_handle *h = (struct tcic_handle *) pch; int val, reg; - DPRINTF(("%s: tcic_isa_chip_intr_disestablish\n", device_xname(&h->sc->dev))); + DPRINTF(("%s: tcic_isa_chip_intr_disestablish\n", device_xname(h->sc->sc_dev))); h->ih_irq = 0; Index: sys/dev/isa/toasterlcd.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/isa/toasterlcd.c,v retrieving revision 1.10 diff -u -p -r1.10 toasterlcd.c --- sys/dev/isa/toasterlcd.c 12 May 2009 09:10:16 -0000 1.10 +++ sys/dev/isa/toasterlcd.c 26 Sep 2012 18:37:43 -0000 @@ -56,7 +56,7 @@ __KERNEL_RCSID(0, "$NetBSD: toasterlcd.c #include struct toasterlcd_softc { - struct device sc_dev; + device_t sc_dev; struct hd44780_chip sc_hlcd; bus_space_tag_t sc_iot; bus_space_handle_t sc_gpioh; @@ -72,7 +72,7 @@ extern const struct wsdisplay_emulops hl extern const struct wsdisplay_accessops hlcd_accessops; extern struct cfdriver toasterlcd_cd; -CFATTACH_DECL(toasterlcd, sizeof(struct toasterlcd_softc), +CFATTACH_DECL_NEW(toasterlcd, sizeof(struct toasterlcd_softc), toasterlcd_match, toasterlcd_attach, NULL, NULL); static const struct wsscreen_descr toasterlcd_stdscreen = { @@ -112,7 +112,7 @@ toasterlcd_match(device_t parent, cfdata static void toasterlcd_attach(device_t parent, device_t self, void *aux) { - struct toasterlcd_softc *sc = (void *)self; + struct toasterlcd_softc *sc = device_private(self); struct tsdio_attach_args *taa = aux; struct wsemuldisplaydev_attach_args waa; @@ -133,8 +133,8 @@ toasterlcd_attach(device_t parent, devic TSDIO_CLEARBITS(PBDR, 0xd); /* De-assert EN, De-assert RS */ aprint_normal(": 4x40 text-mode hd44780 LCD\n"); - aprint_normal_dev(&sc->sc_dev, "using port C, bits 0-7 as DB0-DB7\n"); - aprint_normal_dev(&sc->sc_dev, "using port B, bits 0-3 as RS, WR, EN1, EN2\n"); + aprint_normal_dev(sc->sc_dev, "using port C, bits 0-7 as DB0-DB7\n"); + aprint_normal_dev(sc->sc_dev, "using port B, bits 0-3 as RS, WR, EN1, EN2\n"); hd44780_attach_subr(&sc->sc_hlcd); @@ -148,7 +148,7 @@ toasterlcd_attach(device_t parent, devic static void toasterlcd_writereg(struct hd44780_chip *hd, u_int32_t en, u_int32_t rs, u_int8_t cmd) { - struct toasterlcd_softc *sc = (struct toasterlcd_softc *)hd->sc_dev; + struct toasterlcd_softc *sc = device_private(hd->sc_dev); u_int8_t ctrl; if (hd->sc_dev_ok == 0) @@ -196,7 +196,7 @@ toasterlcd_writereg(struct hd44780_chip static u_int8_t toasterlcd_readreg(struct hd44780_chip *hd, u_int32_t en, u_int32_t rs) { - struct toasterlcd_softc *sc = (struct toasterlcd_softc *)hd->sc_dev; + struct toasterlcd_softc *sc = device_private(hd->sc_dev); u_int8_t ret, ctrl; if (hd->sc_dev_ok == 0) Index: sys/dev/isa/tsdio.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/isa/tsdio.c,v retrieving revision 1.10 diff -u -p -r1.10 tsdio.c --- sys/dev/isa/tsdio.c 12 May 2009 09:10:16 -0000 1.10 +++ sys/dev/isa/tsdio.c 29 Sep 2012 12:48:29 -0000 @@ -49,7 +49,7 @@ void tsdio_attach(device_t, device_t, vo int tsdio_search(device_t, cfdata_t, const int *, void *); int tsdio_print(void *, const char *); -CFATTACH_DECL(tsdio, sizeof(struct tsdio_softc), +CFATTACH_DECL_NEW(tsdio, sizeof(struct tsdio_softc), tsdio_probe, tsdio_attach, NULL, NULL); int @@ -103,7 +103,7 @@ tsdio_probe(device_t parent, cfdata_t cf void tsdio_attach(device_t parent, device_t self, void *aux) { - struct tsdio_softc *sc = (struct tsdio_softc *) self; + struct tsdio_softc *sc = device_private(self); struct isa_attach_args *ia = aux; sc->sc_iot = ia->ia_iot; @@ -115,7 +115,7 @@ tsdio_attach(device_t parent, device_t s */ if (bus_space_map(sc->sc_iot, ia->ia_io[0].ir_addr, 8, 0, &sc->sc_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; } @@ -128,7 +128,7 @@ tsdio_attach(device_t parent, device_t s int tsdio_search(device_t parent, cfdata_t cf, const int *l, void *aux) { - struct tsdio_softc *sc = (struct tsdio_softc *)parent; + struct tsdio_softc *sc = device_private(parent); struct tsdio_attach_args sa; sa.ta_iot = sc->sc_iot; Index: sys/dev/isa/tsdiovar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/isa/tsdiovar.h,v retrieving revision 1.3 diff -u -p -r1.3 tsdiovar.h --- sys/dev/isa/tsdiovar.h 23 Oct 2009 00:39:31 -0000 1.3 +++ sys/dev/isa/tsdiovar.h 26 Sep 2012 18:37:43 -0000 @@ -30,7 +30,6 @@ #define _TSDIOVAR_H_ struct tsdio_softc { - struct device sc_dev; bus_space_tag_t sc_iot; bus_space_handle_t sc_ioh; }; Index: sys/dev/isa/uha_isa.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/isa/uha_isa.c,v retrieving revision 1.38 diff -u -p -r1.38 uha_isa.c --- sys/dev/isa/uha_isa.c 23 Nov 2009 02:13:47 -0000 1.38 +++ sys/dev/isa/uha_isa.c 26 Sep 2012 22:49:24 -0000 @@ -58,7 +58,7 @@ __KERNEL_RCSID(0, "$NetBSD: uha_isa.c,v int uha_isa_probe(device_t, cfdata_t, void *); void uha_isa_attach(device_t, device_t, void *); -CFATTACH_DECL(uha_isa, sizeof(struct uha_softc), +CFATTACH_DECL_NEW(uha_isa, sizeof(struct uha_softc), uha_isa_probe, uha_isa_attach, NULL, NULL); #ifndef DDB @@ -135,7 +135,7 @@ void uha_isa_attach(device_t parent, device_t self, void *aux) { struct isa_attach_args *ia = aux; - struct uha_softc *sc = (void *)self; + struct uha_softc *sc = device_private(self); bus_space_tag_t iot = ia->ia_iot; bus_dma_tag_t dmat = ia->ia_dmat; bus_space_handle_t ioh; @@ -146,22 +146,23 @@ uha_isa_attach(device_t parent, device_t printf("\n"); if (bus_space_map(iot, ia->ia_io[0].ir_addr, UHA_ISA_IOSIZE, 0, &ioh)) { - aprint_error_dev(&sc->sc_dev, "can't map i/o space\n"); + aprint_error_dev(sc->sc_dev, "can't map i/o space\n"); return; } + sc->sc_dev = self; sc->sc_iot = iot; sc->sc_ioh = ioh; sc->sc_dmat = dmat; if (!u14_find(iot, ioh, &upd)) { - aprint_error_dev(&sc->sc_dev, "u14_find failed\n"); + aprint_error_dev(sc->sc_dev, "u14_find failed\n"); return; } if (upd.sc_drq != -1) { sc->sc_dmaflags = 0; if ((error = isa_dmacascade(ic, upd.sc_drq)) != 0) { - aprint_error_dev(&sc->sc_dev, "unable to cascade DRQ, error = %d\n", error); + aprint_error_dev(sc->sc_dev, "unable to cascade DRQ, error = %d\n", error); return; } } else { @@ -174,7 +175,7 @@ uha_isa_attach(device_t parent, device_t sc->sc_ih = isa_intr_establish(ic, upd.sc_irq, IST_EDGE, IPL_BIO, u14_intr, sc); if (sc->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"); return; } @@ -288,7 +289,7 @@ u14_start_mbox(struct uha_softc *sc, str delay(100); } if (!spincount) { - aprint_error_dev(&sc->sc_dev, "uha_start_mbox, board not responding\n"); + aprint_error_dev(sc->sc_dev, "uha_start_mbox, board not responding\n"); Debugger(); } @@ -344,7 +345,7 @@ u14_intr(void *arg) u_long mboxval; #ifdef UHADEBUG - printf("%s: uhaintr ", device_xname(&sc->sc_dev)); + printf("%s: uhaintr ", device_xname(sc->sc_dev)); #endif /*UHADEBUG */ if ((bus_space_read_1(iot, ioh, U14_SINT) & U14_SDIP) == 0) @@ -370,7 +371,7 @@ u14_intr(void *arg) mscp = uha_mscp_phys_kv(sc, mboxval); if (!mscp) { printf("%s: BAD MSCP RETURNED!\n", - device_xname(&sc->sc_dev)); + device_xname(sc->sc_dev)); continue; /* whatever it was, it'll timeout */ } Index: sys/dev/isa/wds.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/isa/wds.c,v retrieving revision 1.75 diff -u -p -r1.75 wds.c --- sys/dev/isa/wds.c 13 Nov 2010 13:52:03 -0000 1.75 +++ sys/dev/isa/wds.c 26 Sep 2012 18:37:43 -0000 @@ -142,7 +142,7 @@ struct wds_mbx { }; struct wds_softc { - struct device sc_dev; + device_t sc_dev; bus_space_tag_t sc_iot; bus_space_handle_t sc_ioh; @@ -199,7 +199,7 @@ int wds_create_scbs(struct wds_softc *, int wdsprobe(device_t, cfdata_t, void *); void wdsattach(device_t, device_t, void *); -CFATTACH_DECL(wds, sizeof(struct wds_softc), +CFATTACH_DECL_NEW(wds, sizeof(struct wds_softc), wdsprobe, wdsattach, NULL, NULL); #ifdef WDSDEBUG @@ -308,17 +308,19 @@ void wdsattach(device_t parent, device_t self, void *aux) { struct isa_attach_args *ia = aux; - struct wds_softc *sc = (void *)self; + struct wds_softc *sc = device_private(self); bus_space_tag_t iot = ia->ia_iot; bus_space_handle_t ioh; struct wds_probe_data wpd; isa_chipset_tag_t ic = ia->ia_ic; int error; + sc->sc_dev = self; + printf("\n"); if (bus_space_map(iot, ia->ia_io[0].ir_addr, WDS_ISA_IOSIZE, 0, &ioh)) { - aprint_error_dev(&sc->sc_dev, "can't map i/o space\n"); + aprint_error_dev(sc->sc_dev, "can't map i/o space\n"); return; } @@ -326,7 +328,7 @@ wdsattach(device_t parent, device_t self sc->sc_ioh = ioh; sc->sc_dmat = ia->ia_dmat; if (!wds_find(iot, ioh, &wpd)) { - aprint_error_dev(&sc->sc_dev, "wds_find failed\n"); + aprint_error_dev(sc->sc_dev, "wds_find failed\n"); return; } @@ -334,7 +336,7 @@ wdsattach(device_t parent, device_t self #ifdef notyet if (wpd.sc_drq != -1) { if ((error = isa_dmacascade(ic, wpd.sc_drq)) != 0) { - aprint_error_dev(&sc->sc_dev, "unable to cascade DRQ, error = %d\n", error); + aprint_error_dev(sc->sc_dev, "unable to cascade DRQ, error = %d\n", error); return; } } @@ -343,7 +345,7 @@ wdsattach(device_t parent, device_t self wdsintr, sc); #else if ((error = isa_dmacascade(ic, ia->ia_drq[0].ir_drq)) != 0) { - aprint_error_dev(&sc->sc_dev, "unable to cascade DRQ, error = %d\n", error); + aprint_error_dev(sc->sc_dev, "unable to cascade DRQ, error = %d\n", error); return; } @@ -351,7 +353,7 @@ wdsattach(device_t parent, device_t self IPL_BIO, wdsintr, sc); #endif if (sc->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"); return; } @@ -371,7 +373,7 @@ wds_attach(struct wds_softc *sc, struct * Fill in the scsipi_adapter. */ memset(adapt, 0, sizeof(*adapt)); - adapt->adapt_dev = &sc->sc_dev; + adapt->adapt_dev = sc->sc_dev; adapt->adapt_nchannels = 1; /* adapt_openings initialized below */ adapt->adapt_max_periph = 1; @@ -398,7 +400,7 @@ wds_attach(struct wds_softc *sc, struct /* * ask the adapter what subunits are present */ - config_found(&sc->sc_dev, &sc->sc_channel, scsiprint); + config_found(sc->sc_dev, &sc->sc_channel, scsiprint); } integrate void @@ -414,14 +416,14 @@ wds_finish_scbs(struct wds_softc *sc) for (i = 0; i < WDS_MBX_SIZE; i++) { if (wmbi->stat != WDS_MBI_FREE) { printf("%s: mbi not in round-robin order\n", - device_xname(&sc->sc_dev)); + device_xname(sc->sc_dev)); goto AGAIN; } wds_nextmbx(wmbi, wmbx, mbi); } #ifdef WDSDIAGnot printf("%s: mbi interrupt with no full mailboxes\n", - device_xname(&sc->sc_dev)); + device_xname(sc->sc_dev)); #endif return; } @@ -431,7 +433,7 @@ AGAIN: scb = wds_scb_phys_kv(sc, phystol(wmbi->scb_addr)); if (!scb) { printf("%s: bad mbi scb pointer; skipping\n", - device_xname(&sc->sc_dev)); + device_xname(sc->sc_dev)); goto next; } @@ -488,7 +490,7 @@ wdsintr(void *arg) break; default: - aprint_error_dev(&sc->sc_dev, "unrecognized interrupt type %02x", c); + aprint_error_dev(sc->sc_dev, "unrecognized interrupt type %02x", c); break; } @@ -535,14 +537,14 @@ wds_init_scb(struct wds_softc *sc, struc error = bus_dmamap_create(dmat, sizeof(struct wds_scb), 1, sizeof(struct wds_scb), 0, BUS_DMA_NOWAIT, &scb->dmamap_self); if (error) { - aprint_error_dev(&sc->sc_dev, "can't create scb dmamap_self\n"); + aprint_error_dev(sc->sc_dev, "can't create scb dmamap_self\n"); return (error); } error = bus_dmamap_create(dmat, WDS_MAXXFER, WDS_NSEG, WDS_MAXXFER, 0, BUS_DMA_NOWAIT|BUS_DMA_ALLOCNOW, &scb->dmamap_xfer); if (error) { - aprint_error_dev(&sc->sc_dev, "can't create scb dmamap_xfer\n"); + aprint_error_dev(sc->sc_dev, "can't create scb dmamap_xfer\n"); bus_dmamap_destroy(dmat, scb->dmamap_self); return (error); } @@ -553,7 +555,7 @@ wds_init_scb(struct wds_softc *sc, struc error = bus_dmamap_load(dmat, scb->dmamap_self, scb, sizeof(struct wds_scb), NULL, BUS_DMA_NOWAIT); if (error) { - aprint_error_dev(&sc->sc_dev, "can't load scb dmamap_self\n"); + aprint_error_dev(sc->sc_dev, "can't load scb dmamap_self\n"); bus_dmamap_destroy(dmat, scb->dmamap_self); bus_dmamap_destroy(dmat, scb->dmamap_xfer); return (error); @@ -591,14 +593,14 @@ wds_create_scbs(struct wds_softc *sc, vo error = bus_dmamem_alloc(sc->sc_dmat, size, PAGE_SIZE, 0, &seg, 1, &rseg, BUS_DMA_NOWAIT); if (error) { - aprint_error_dev(&sc->sc_dev, "can't allocate memory for scbs\n"); + aprint_error_dev(sc->sc_dev, "can't allocate memory for scbs\n"); return (error); } error = bus_dmamem_map(sc->sc_dmat, &seg, rseg, size, (void *)&scb, BUS_DMA_NOWAIT|BUS_DMA_COHERENT); if (error) { - aprint_error_dev(&sc->sc_dev, "can't map memory for scbs\n"); + aprint_error_dev(sc->sc_dev, "can't map memory for scbs\n"); bus_dmamem_free(sc->sc_dmat, &seg, rseg); return (error); } @@ -608,7 +610,7 @@ wds_create_scbs(struct wds_softc *sc, vo while (size > sizeof(struct wds_scb) && sc->sc_numscbs < WDS_SCB_MAX) { error = wds_init_scb(sc, scb); if (error) { - aprint_error_dev(&sc->sc_dev, "can't initialize scb\n"); + aprint_error_dev(sc->sc_dev, "can't initialize scb\n"); return (error); } TAILQ_INSERT_TAIL(&sc->sc_free_scb, scb, chain); @@ -793,14 +795,14 @@ wds_done(struct wds_softc *sc, struct wd */ switch (scb->cmd.venderr) { case 0x00: - aprint_error_dev(&sc->sc_dev, "Is this " + aprint_error_dev(sc->sc_dev, "Is this " "an error?\n"); /* Experiment. */ xs->error = XS_DRIVER_STUFFUP; break; case 0x01: #if 0 - aprint_error_dev(&sc->sc_dev, "OK, see SCSI " + aprint_error_dev(sc->sc_dev, "OK, see SCSI " "error field.\n"); #endif if (scb->cmd.stat == SCSI_CHECK || @@ -812,7 +814,7 @@ wds_done(struct wds_softc *sc, struct wd case 0x40: #if 0 printf("%s: DMA underrun!\n", - device_xname(&sc->sc_dev)); + device_xname(sc->sc_dev)); #endif /* * Hits this if the target @@ -827,7 +829,7 @@ wds_done(struct wds_softc *sc, struct wd default: printf("%s: VENDOR ERROR " "%02x, scsi %02x\n", - device_xname(&sc->sc_dev), + device_xname(sc->sc_dev), scb->cmd.venderr, scb->cmd.stat); /* Experiment. */ @@ -1019,7 +1021,7 @@ wds_inquire_setup_information(struct wds goto out; /* Print the version number. */ - printf("%s: version %x.%02x ", device_xname(&sc->sc_dev), + printf("%s: version %x.%02x ", device_xname(sc->sc_dev), scb->cmd.targ, scb->cmd.scb[0]); sc->sc_revision = (scb->cmd.targ << 8) | scb->cmd.scb[0]; /* Print out the version string. */ @@ -1061,7 +1063,7 @@ wds_scsipi_request(struct scsipi_channel { struct scsipi_xfer *xs; struct scsipi_periph *periph; - struct wds_softc *sc = (void *)chan->chan_adapter->adapt_dev; + struct wds_softc *sc = device_private(chan->chan_adapter->adapt_dev); bus_dma_tag_t dmat = sc->sc_dmat; struct wds_scb *scb; int error, seg, flags, s; @@ -1073,7 +1075,7 @@ wds_scsipi_request(struct scsipi_channel if (xs->xs_control & XS_CTL_RESET) { /* XXX Fix me! */ - printf("%s: reset!\n", device_xname(&sc->sc_dev)); + printf("%s: reset!\n", device_xname(sc->sc_dev)); wds_init(sc, 1); scsipi_done(xs); return; @@ -1085,7 +1087,7 @@ wds_scsipi_request(struct scsipi_channel * Let's not worry about UIO. There isn't any code * for the non-SG boards anyway! */ - aprint_error_dev(&sc->sc_dev, "UIO is untested and disabled!\n"); + aprint_error_dev(sc->sc_dev, "UIO is untested and disabled!\n"); xs->error = XS_DRIVER_STUFFUP; scsipi_done(xs); return; @@ -1112,7 +1114,7 @@ wds_scsipi_request(struct scsipi_channel /* Zero out the command structure. */ if (xs->cmdlen > sizeof(scb->cmd.scb)) { - aprint_error_dev(&sc->sc_dev, "cmdlen %d too large for SCB\n", + aprint_error_dev(sc->sc_dev, "cmdlen %d too large for SCB\n", xs->cmdlen); xs->error = XS_DRIVER_STUFFUP; goto out_bad; @@ -1162,7 +1164,7 @@ wds_scsipi_request(struct scsipi_channel default: xs->error = XS_DRIVER_STUFFUP; - aprint_error_dev(&sc->sc_dev, "error %d loading DMA map\n", error); + aprint_error_dev(sc->sc_dev, "error %d loading DMA map\n", error); out_bad: wds_free_scb(sc, scb); scsipi_done(xs); @@ -1313,7 +1315,7 @@ wds_timeout(void *arg) struct scsipi_xfer *xs = scb->xs; struct scsipi_periph *periph = xs->xs_periph; struct wds_softc *sc = - (void *)periph->periph_channel->chan_adapter->adapt_dev; + device_private(periph->periph_channel->chan_adapter->adapt_dev); int s; scsipi_printaddr(periph); @@ -1327,7 +1329,7 @@ wds_timeout(void *arg) */ wds_collect_mbo(sc); if (scb->flags & SCB_SENDING) { - aprint_error_dev(&sc->sc_dev, "not taking commands!\n"); + aprint_error_dev(sc->sc_dev, "not taking commands!\n"); Debugger(); } #endif Index: sys/dev/isa/wt.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/isa/wt.c,v retrieving revision 1.82 diff -u -p -r1.82 wt.c --- sys/dev/isa/wt.c 12 May 2009 09:10:16 -0000 1.82 +++ sys/dev/isa/wt.c 26 Sep 2012 18:37:43 -0000 @@ -120,7 +120,7 @@ static struct wtregs { }; struct wt_softc { - struct device sc_dev; + device_t sc_dev; void *sc_ih; bus_space_tag_t sc_iot; @@ -184,7 +184,7 @@ static int wtintr(void *sc); int wtprobe(device_t, cfdata_t, void *); void wtattach(device_t, device_t, void *); -CFATTACH_DECL(wt, sizeof(struct wt_softc), +CFATTACH_DECL_NEW(wt, sizeof(struct wt_softc), wtprobe, wtattach, NULL, NULL); extern struct cfdriver wt_cd; @@ -259,12 +259,14 @@ done: void wtattach(device_t parent, device_t self, void *aux) { - struct wt_softc *sc = (void *)self; + struct wt_softc *sc = device_private(self); struct isa_attach_args *ia = aux; bus_space_tag_t iot = ia->ia_iot; bus_space_handle_t ioh; bus_size_t maxsize; + sc->sc_dev = self; + /* Map i/o space */ if (bus_space_map(iot, ia->ia_io[0].ir_addr, AV_NPORT, 0, &ioh)) { printf(": can't map i/o space\n"); @@ -306,20 +308,20 @@ ok: sc->chan = ia->ia_drq[0].ir_drq; if ((maxsize = isa_dmamaxsize(sc->sc_ic, sc->chan)) < MAXPHYS) { - aprint_error_dev(&sc->sc_dev, "max DMA size %lu is less than required %d\n", + aprint_error_dev(sc->sc_dev, "max DMA size %lu is less than required %d\n", (u_long)maxsize, MAXPHYS); return; } if (isa_drq_alloc(sc->sc_ic, sc->chan) != 0) { - aprint_error_dev(&sc->sc_dev, "can't reserve drq %d\n", + aprint_error_dev(sc->sc_dev, "can't reserve drq %d\n", sc->chan); return; } if (isa_dmamap_create(sc->sc_ic, sc->chan, MAXPHYS, BUS_DMA_NOWAIT|BUS_DMA_ALLOCNOW)) { - aprint_error_dev(&sc->sc_dev, "can't set up ISA DMA map\n"); + aprint_error_dev(sc->sc_dev, "can't set up ISA DMA map\n"); return; } @@ -407,7 +409,7 @@ wtopen(dev_t dev, int flag, int mode, st /* Check the status of the controller. */ if (sc->error & TP_ILL) { - aprint_error_dev(&sc->sc_dev, "invalid tape density\n"); + aprint_error_dev(sc->sc_dev, "invalid tape density\n"); return ENODEV; } } @@ -1085,7 +1087,7 @@ wtsense(struct wt_softc *sc, int verbose else if (error & TP_ILL) msg = "Illegal command"; if (msg) - printf("%s: %s\n", device_xname(&sc->sc_dev), msg); + printf("%s: %s\n", device_xname(sc->sc_dev), msg); return 0; } Index: sys/dev/isapnp/gus_isapnp.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/isapnp/gus_isapnp.c,v retrieving revision 1.36 diff -u -p -r1.36 gus_isapnp.c --- sys/dev/isapnp/gus_isapnp.c 23 Nov 2011 23:07:33 -0000 1.36 +++ sys/dev/isapnp/gus_isapnp.c 28 Sep 2012 19:45:58 -0000 @@ -94,7 +94,7 @@ static const struct audio_hw_if guspnp_h iw_get_locks, }; -CFATTACH_DECL(guspnp, sizeof(struct iw_softc), +CFATTACH_DECL_NEW(guspnp, sizeof(struct iw_softc), gus_isapnp_match, gus_isapnp_attach, NULL, NULL); extern struct cfdriver guspnp_cd; @@ -141,10 +141,11 @@ gus_isapnp_attach(device_t parent, devic gus_0 = 0; if (isapnp_config(ipa->ipa_iot, ipa->ipa_memt, ipa)) { - aprint_error_dev(&sc->sc_dev, "error in region allocation\n"); + aprint_error_dev(self, "error in region allocation\n"); return; } + sc->sc_dev = self; sc->sc_iot = ipa->ipa_iot; /* handle is the region base */ @@ -171,13 +172,13 @@ gus_isapnp_attach(device_t parent, devic sc->sc_play_maxsize = isa_dmamaxsize(sc->sc_ic, sc->sc_playdrq); if (isa_drq_alloc(sc->sc_ic, sc->sc_playdrq) != 0) { - aprint_error_dev(&sc->sc_dev, "can't reserve drq %d\n", + aprint_error_dev(self, "can't reserve drq %d\n", sc->sc_playdrq); return; } if (isa_dmamap_create(sc->sc_ic, sc->sc_playdrq, sc->sc_play_maxsize, BUS_DMA_NOWAIT|BUS_DMA_ALLOCNOW)) { - aprint_error_dev(&sc->sc_dev, "can't create map for drq %d\n", + aprint_error_dev(self, "can't create map for drq %d\n", sc->sc_playdrq); return; } @@ -186,13 +187,13 @@ gus_isapnp_attach(device_t parent, devic sc->sc_rec_maxsize = isa_dmamaxsize(sc->sc_ic, sc->sc_recdrq); if (isa_drq_alloc(sc->sc_ic, sc->sc_recdrq) != 0) { - aprint_error_dev(&sc->sc_dev, "can't reserve drq %d\n", + aprint_error_dev(self, "can't reserve drq %d\n", sc->sc_recdrq); return; } if (isa_dmamap_create(sc->sc_ic, sc->sc_recdrq, sc->sc_rec_maxsize, BUS_DMA_NOWAIT|BUS_DMA_ALLOCNOW)) { - aprint_error_dev(&sc->sc_dev, "can't create map for drq %d\n", + aprint_error_dev(self, "can't create map for drq %d\n", sc->sc_recdrq); return; } @@ -205,7 +206,7 @@ gus_isapnp_attach(device_t parent, devic sc->iw_cd = &guspnp_cd; sc->iw_hw_if = &guspnp_hw_if; - printf("%s: %s %s", device_xname(&sc->sc_dev), ipa->ipa_devident, + printf("%s: %s %s", device_xname(self), ipa->ipa_devident, ipa->ipa_devclass); iwattach(sc); Index: sys/dev/isapnp/i82365_isapnp.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/isapnp/i82365_isapnp.c,v retrieving revision 1.31 diff -u -p -r1.31 i82365_isapnp.c --- sys/dev/isapnp/i82365_isapnp.c 23 May 2010 23:53:36 -0000 1.31 +++ sys/dev/isapnp/i82365_isapnp.c 28 Sep 2012 21:13:25 -0000 @@ -68,7 +68,7 @@ int pcicisapnp_debug = 0 /* XXX */ ; int pcic_isapnp_match(device_t, cfdata_t, void *); void pcic_isapnp_attach(device_t, device_t, void *); -CFATTACH_DECL(pcic_isapnp, sizeof(struct pcic_isa_softc), +CFATTACH_DECL_NEW(pcic_isapnp, sizeof(struct pcic_isa_softc), pcic_isapnp_match, pcic_isapnp_attach, NULL, NULL); static const struct pcmcia_chip_functions pcic_isa_functions = { @@ -117,6 +117,8 @@ pcic_isapnp_attach(device_t parent, devi int msize; int tmp1; + sc->dev = self; + printf("\n"); if (isapnp_config(iot, memt, ipa)) { Index: sys/dev/isapnp/if_tr_isapnp.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/isapnp/if_tr_isapnp.c,v retrieving revision 1.20 diff -u -p -r1.20 if_tr_isapnp.c --- sys/dev/isapnp/if_tr_isapnp.c 12 May 2009 10:16:35 -0000 1.20 +++ sys/dev/isapnp/if_tr_isapnp.c 26 Sep 2012 23:06:50 -0000 @@ -64,7 +64,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_tr_isapnp int tr_isapnp_match(device_t, cfdata_t, void *); void tr_isapnp_attach(device_t, device_t, void *); -CFATTACH_DECL(tr_isapnp, sizeof(struct tr_softc), +CFATTACH_DECL_NEW(tr_isapnp, sizeof(struct tr_softc), tr_isapnp_match, tr_isapnp_attach, NULL, NULL); int @@ -89,13 +89,14 @@ tr_isapnp_attach(device_t parent, device printf("\n"); if (isapnp_config(ipa->ipa_iot, ipa->ipa_memt, ipa)) { - aprint_error_dev(&sc->sc_dev, "error in region allocation\n"); + aprint_error_dev(self, "error in region allocation\n"); return; } - printf("%s: %s %s\n", device_xname(&sc->sc_dev), ipa->ipa_devident, + printf("%s: %s %s\n", device_xname(self), ipa->ipa_devident, ipa->ipa_devclass); + sc->sc_dev = self; sc->sc_piot = ipa->ipa_iot; sc->sc_pioh = ipa->ipa_io[0].h; Index: sys/dev/isapnp/isic_isapnp.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/isapnp/isic_isapnp.c,v retrieving revision 1.31 diff -u -p -r1.31 isic_isapnp.c --- sys/dev/isapnp/isic_isapnp.c 12 May 2009 10:16:35 -0000 1.31 +++ sys/dev/isapnp/isic_isapnp.c 28 Sep 2012 21:16:25 -0000 @@ -76,7 +76,7 @@ extern const struct isdn_layer1_isdnif_d static int isic_isapnp_probe(device_t, cfdata_t, void *); static void isic_isapnp_attach(device_t, device_t, void *); -CFATTACH_DECL(isic_isapnp, sizeof(struct isic_softc), +CFATTACH_DECL_NEW(isic_isapnp, sizeof(struct isic_softc), isic_isapnp_probe, isic_isapnp_attach, NULL, NULL); typedef void (*allocmaps_func)(struct isapnp_attach_args *ipa, struct isic_softc *sc); @@ -180,13 +180,12 @@ isic_isapnp_probe(device_t parent, #define TERMFMT " " #else #define ISIC_FMT "%s: " -#define ISIC_PARM device_xname(&sc->sc_dev) +#define ISIC_PARM device_xname(sc->sc_dev) #define TERMFMT "\n" #endif static void -isic_isapnp_attach(device_t parent, - device_t self, void *aux) +isic_isapnp_attach(device_t parent, device_t self, void *aux) { static const char *ISACversion[] = { "2085 Version A1/A2 or 2086/2186 Version 1.1", @@ -211,8 +210,9 @@ isic_isapnp_attach(device_t parent, const struct isic_isapnp_card_desc *desc = isic_isapnp_descriptions; int i; + sc->sc_dev = self; if (isapnp_config(ipa->ipa_iot, ipa->ipa_memt, ipa)) { - aprint_error_dev(&sc->sc_dev, "error in region allocation\n"); + aprint_error_dev(sc->sc_dev, "error in region allocation\n"); return; } @@ -233,7 +233,7 @@ isic_isapnp_attach(device_t parent, /* establish interrupt handler */ if (isa_intr_establish(ipa->ipa_ic, ipa->ipa_irq[0].num, ipa->ipa_irq[0].type, IPL_NET, isicintr, sc) == NULL) - aprint_error_dev(&sc->sc_dev, "couldn't establish interrupt handler\n"); + aprint_error_dev(sc->sc_dev, "couldn't establish interrupt handler\n"); /* init card */ desc->attach(sc); Index: sys/dev/isapnp/isic_isapnp_dynalink.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/isapnp/isic_isapnp_dynalink.c,v retrieving revision 1.13 diff -u -p -r1.13 isic_isapnp_dynalink.c --- sys/dev/isapnp/isic_isapnp_dynalink.c 12 May 2009 10:16:35 -0000 1.13 +++ sys/dev/isapnp/isic_isapnp_dynalink.c 28 Sep 2012 21:17:48 -0000 @@ -393,7 +393,7 @@ int isic_attach_Dyn(device_t parent, device_t self, struct isa_attach_args *ia) { - struct isic_softc *sc = (struct isic_softc *)self; + struct isic_softc *sc = device_private(self); int unit = sc->sc_dev.dv_unit; /* Commit the probed attachment values */ @@ -431,11 +431,11 @@ void isic_attach_Dyn(struct isic_softc * if( ((HSCX_READ(0, H_VSTR) & 0xf) != 0x5) || ((HSCX_READ(1, H_VSTR) & 0xf) != 0x5) ) { printf("%s: HSCX VSTR test failed for Dynalink PnP\n", - device_xname(&sc->sc_dev)); + device_xname(sc->sc_dev)); printf("%s: HSC0: VSTR: %#x\n", - device_xname(&sc->sc_dev), HSCX_READ(0, H_VSTR)); + device_xname(sc->sc_dev), HSCX_READ(0, H_VSTR)); printf("%s: HSC1: VSTR: %#x\n", - device_xname(&sc->sc_dev), HSCX_READ(1, H_VSTR)); + device_xname(sc->sc_dev), HSCX_READ(1, H_VSTR)); return; } Index: sys/dev/isapnp/isic_isapnp_sws.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/isapnp/isic_isapnp_sws.c,v retrieving revision 1.13 diff -u -p -r1.13 isic_isapnp_sws.c --- sys/dev/isapnp/isic_isapnp_sws.c 8 Apr 2008 20:09:27 -0000 1.13 +++ sys/dev/isapnp/isic_isapnp_sws.c 28 Sep 2012 21:21:03 -0000 @@ -366,11 +366,11 @@ isic_attach_sws(struct isic_softc *sc) ((HSCX_READ(1, H_VSTR) & 0xf) != 0x5) ) { printf("%s: HSCX VSTR test failed for SWS PnP\n", - device_xname(&sc->sc_dev)); + device_xname(sc->sc_dev)); printf("%s: HSC0: VSTR: %#x\n", - device_xname(&sc->sc_dev), HSCX_READ(0, H_VSTR)); + device_xname(sc->sc_dev), HSCX_READ(0, H_VSTR)); printf("%s: HSC1: VSTR: %#x\n", - device_xname(&sc->sc_dev), HSCX_READ(1, H_VSTR)); + device_xname(sc->sc_dev), HSCX_READ(1, H_VSTR)); return; } Index: sys/dev/mca/ed_mca.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/mca/ed_mca.c,v retrieving revision 1.52 diff -u -p -r1.52 ed_mca.c --- sys/dev/mca/ed_mca.c 31 Jul 2012 15:50:35 -0000 1.52 +++ sys/dev/mca/ed_mca.c 6 Oct 2012 00:47:17 -0000 @@ -77,7 +77,7 @@ __KERNEL_RCSID(0, "$NetBSD: ed_mca.c,v 1 static int ed_mca_probe (device_t, cfdata_t, void *); static void ed_mca_attach (device_t, device_t, void *); -CFATTACH_DECL(ed_mca, sizeof(struct ed_softc), +CFATTACH_DECL_NEW(ed_mca, sizeof(struct ed_softc), ed_mca_probe, ed_mca_attach, NULL, NULL); extern struct cfdriver ed_cd; @@ -111,12 +111,11 @@ static struct dkdriver eddkdriver = { ed * Just check if it's possible to identify the disk. */ static int -ed_mca_probe(device_t parent, cfdata_t cf, - void *aux) +ed_mca_probe(device_t parent, cfdata_t cf, void *aux) { + struct edc_mca_softc *sc = device_private(parent); + struct ed_attach_args *eda = aux; u_int16_t cmd_args[2]; - struct edc_mca_softc *sc = (void *) parent; - struct ed_attach_args *eda = (struct ed_attach_args *) aux; int found = 1; /* @@ -135,10 +134,11 @@ ed_mca_attach(device_t parent, device_t { struct ed_softc *ed = device_private(self); struct edc_mca_softc *sc = device_private(parent); - struct ed_attach_args *eda = (struct ed_attach_args *) aux; + struct ed_attach_args *eda = aux; char pbuf[8]; int drv_flags; + ed->sc_dev = self; ed->edc_softc = sc; ed->sc_devno = eda->edc_drive; edc_add_disk(sc, ed); @@ -159,7 +159,7 @@ ed_mca_attach(device_t parent, device_t ed->sc_capacity); printf("%s: %u spares/cyl, %s, %s, %s, %s, %s\n", - device_xname(&ed->sc_dev), ed->spares, + device_xname(ed->sc_dev), ed->spares, (drv_flags & (1 << 0)) ? "NoRetries" : "Retries", (drv_flags & (1 << 1)) ? "Removable" : "Fixed", (drv_flags & (1 << 2)) ? "SkewedFormat" : "NoSkew", @@ -170,9 +170,9 @@ ed_mca_attach(device_t parent, device_t /* * Initialize and attach the disk structure. */ - disk_init(&ed->sc_dk, device_xname(&ed->sc_dev), &eddkdriver); + disk_init(&ed->sc_dk, device_xname(ed->sc_dev), &eddkdriver); disk_attach(&ed->sc_dk); - rnd_attach_source(&ed->rnd_source, device_xname(&ed->sc_dev), + rnd_attach_source(&ed->rnd_source, device_xname(ed->sc_dev), RND_TYPE_DISK, 0); ed->sc_flags |= EDF_INIT; @@ -198,7 +198,7 @@ edmcastrategy(struct buf *bp) ed = device_lookup_private(&ed_cd, DISKUNIT(bp->b_dev)); lp = ed->sc_dk.dk_label; - ATADEBUG_PRINT(("edmcastrategy (%s)\n", device_xname(&ed->sc_dev)), + ATADEBUG_PRINT(("edmcastrategy (%s)\n", device_xname(ed->sc_dev)), DEBUG_XFERS); /* Valid request? */ @@ -446,7 +446,7 @@ edgetdisklabel(dev_t dev, struct ed_soft edmcastrategy, lp, ed->sc_dk.dk_cpulabel); } if (errstring) { - printf("%s: %s\n", device_xname(&ed->sc_dev), errstring); + printf("%s: %s\n", device_xname(ed->sc_dev), errstring); return; } } @@ -561,7 +561,7 @@ edmcaioctl(dev_t dev, u_long xfer, void return (EBADF); /* If the ioctl happens here, the parent is us. */ - strlcpy(dkw->dkw_parent, device_xname(&ed->sc_dev), + strlcpy(dkw->dkw_parent, device_xname(ed->sc_dev), sizeof(dkw->dkw_parent)); return (dkwedge_add(dkw)); } @@ -574,7 +574,7 @@ edmcaioctl(dev_t dev, u_long xfer, void return (EBADF); /* If the ioctl happens here, the parent is us. */ - strlcpy(dkw->dkw_parent, device_xname(&ed->sc_dev), + strlcpy(dkw->dkw_parent, device_xname(ed->sc_dev), sizeof(dkw->dkw_parent)); return (dkwedge_del(dkw)); } Index: sys/dev/mca/edc_mca.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/mca/edc_mca.c,v retrieving revision 1.46 diff -u -p -r1.46 edc_mca.c --- sys/dev/mca/edc_mca.c 2 Feb 2012 19:43:04 -0000 1.46 +++ sys/dev/mca/edc_mca.c 2 Oct 2012 05:57:38 -0000 @@ -82,7 +82,7 @@ __KERNEL_RCSID(0, "$NetBSD: edc_mca.c,v #define EDC_MAX_CMD_RES_LEN 8 struct edc_mca_softc { - struct device sc_dev; + device_t sc_dev; bus_space_tag_t sc_iot; bus_space_handle_t sc_ioh; @@ -115,7 +115,7 @@ struct edc_mca_softc { int edc_mca_probe(device_t, cfdata_t, void *); void edc_mca_attach(device_t, device_t, void *); -CFATTACH_DECL(edc_mca, sizeof(struct edc_mca_softc), +CFATTACH_DECL_NEW(edc_mca, sizeof(struct edc_mca_softc), edc_mca_probe, edc_mca_attach, NULL, NULL); static int edc_intr(void *); @@ -126,8 +126,7 @@ static void edc_cmd_wait(struct edc_mca_ static void edcworker(void *); int -edc_mca_probe(device_t parent, cfdata_t match, - void *aux) +edc_mca_probe(device_t parent, cfdata_t match, void *aux) { struct mca_attach_args *ma = aux; @@ -152,6 +151,8 @@ edc_mca_attach(device_t parent, device_t int devno, error; int locs[EDCCF_NLOCS]; + sc->sc_dev = self; + pos2 = mca_conf_read(ma->ma_mc, ma->ma_slot, 2); pos3 = mca_conf_read(ma->ma_mc, ma->ma_slot, 3); pos4 = mca_conf_read(ma->ma_mc, ma->ma_slot, 4); @@ -208,13 +209,13 @@ edc_mca_attach(device_t parent, device_t * utility uses only valid addresses. */ if (drq == 2 || drq >= 8) { - aprint_error_dev(&sc->sc_dev, "invalid DMA Arbitration Level %d\n", drq); + aprint_error_dev(sc->sc_dev, "invalid DMA Arbitration Level %d\n", drq); return; } #endif printf("%s: Fairness %s, Release %s, ", - device_xname(&sc->sc_dev), + device_xname(sc->sc_dev), (pos2 & FAIRNESS_ENABLE) ? "On" : "Off", (pos4 & RELEASE_1) ? "6ms" : ((pos4 & RELEASE_2) ? "3ms" : "Immediate") @@ -231,13 +232,13 @@ edc_mca_attach(device_t parent, device_t if (bus_space_map(sc->sc_iot, iobase, ESDIC_REG_NPORTS, 0, &sc->sc_ioh)) { - aprint_error_dev(&sc->sc_dev, "couldn't map registers\n"); + aprint_error_dev(sc->sc_dev, "couldn't map registers\n"); return; } sc->sc_ih = mca_intr_establish(ma->ma_mc, irq, IPL_BIO, edc_intr, sc); if (sc->sc_ih == NULL) { - aprint_error_dev(&sc->sc_dev, "couldn't establish interrupt handler\n"); + aprint_error_dev(sc->sc_dev, "couldn't establish interrupt handler\n"); return; } @@ -246,7 +247,7 @@ edc_mca_attach(device_t parent, device_t if ((error = mca_dmamap_create(sc->sc_dmat, MAXPHYS, BUS_DMA_NOWAIT | BUS_DMA_ALLOCNOW | MCABUS_DMA_16BIT, &sc->sc_dmamap_xfer, drq)) != 0){ - aprint_error_dev(&sc->sc_dev, "couldn't create DMA map - error %d\n", error); + aprint_error_dev(sc->sc_dev, "couldn't create DMA map - error %d\n", error); return; } @@ -268,7 +269,7 @@ edc_mca_attach(device_t parent, device_t if (bus_space_read_1(sc->sc_iot, sc->sc_ioh, BSR) & BSR_BUSY) { /* hard reset */ printf("%s: controller busy, performing hardware reset ...\n", - device_xname(&sc->sc_dev)); + device_xname(sc->sc_dev)); bus_space_write_1(sc->sc_iot, sc->sc_ioh, BCR, BCR_INT_ENABLE|BCR_RESET); } else { @@ -295,9 +296,10 @@ edc_mca_attach(device_t parent, device_t for (devno = 0; devno < sc->sc_maxdevs; devno++) { eda.edc_drive = devno; locs[EDCCF_DRIVE] = devno; - sc->sc_ed[devno] = - (void *) config_found_sm_loc(self, "edc", locs, &eda, - NULL, config_stdsubmatch); + + sc->sc_ed[devno] = device_private( + config_found_sm_loc(self, "edc", locs, &eda, NULL, + config_stdsubmatch)); /* If initialization did not succeed, NULL the pointer. */ if (sc->sc_ed[devno] @@ -319,7 +321,7 @@ edc_mca_attach(device_t parent, device_t if (devno == sc->sc_maxdevs) { printf("%s: disabling controller (no drives attached)\n", - device_xname(&sc->sc_dev)); + device_xname(sc->sc_dev)); mca_intr_disestablish(ma->ma_mc, sc->sc_ih); return; } @@ -329,8 +331,8 @@ edc_mca_attach(device_t parent, device_t */ config_pending_incr(); if ((error = kthread_create(PRI_NONE, 0, NULL, edcworker, sc, NULL, - "%s", device_xname(&sc->sc_dev)))) { - aprint_error_dev(&sc->sc_dev, "cannot spawn worker thread: errno=%d\n", error); + "%s", device_xname(sc->sc_dev)))) { + aprint_error_dev(sc->sc_dev, "cannot spawn worker thread: errno=%d\n", error); panic("edc_mca_attach"); } } @@ -365,7 +367,7 @@ edc_intr(void *arg) #ifdef EDC_DEBUG if (intr_id == 0 || intr_id == 2 || intr_id == 4) { - aprint_error_dev(&sc->sc_dev, "bogus interrupt id %d\n", + aprint_error_dev(sc->sc_dev, "bogus interrupt id %d\n", (int) intr_id); return (0); } @@ -389,7 +391,7 @@ edc_intr(void *arg) #ifdef DEBUG if (len > EDC_MAX_CMD_RES_LEN) panic("%s: maximum Status Length exceeded: %d > %d", - device_xname(&sc->sc_dev), + device_xname(sc->sc_dev), len, EDC_MAX_CMD_RES_LEN); #endif @@ -451,7 +453,7 @@ edc_intr(void *arg) * No status block available, so no further info. */ panic("%s: dev %d: attention error", - device_xname(&sc->sc_dev), + device_xname(sc->sc_dev), devno); /* NOTREACHED */ break; @@ -504,7 +506,7 @@ edc_do_attn(struct edc_mca_softc *sc, in if (attn_type == ATN_CMD_REQ && (bus_space_read_1(sc->sc_iot, sc->sc_ioh, BSR) & BSR_INT_PENDING)) - panic("%s: edc int pending", device_xname(&sc->sc_dev)); + panic("%s: edc int pending", device_xname(sc->sc_dev)); #endif for(tries=1; tries < EDC_ATTN_MAXTRIES; tries++) { @@ -515,7 +517,7 @@ edc_do_attn(struct edc_mca_softc *sc, in if (tries == EDC_ATTN_MAXTRIES) { printf("%s: edc_do_attn: timeout waiting for attachment to become available\n", - device_xname(&sc->sc_ed[devno]->sc_dev)); + device_xname(sc->sc_ed[devno]->sc_dev)); return (EIO); } } @@ -617,7 +619,7 @@ edc_run_cmd(struct edc_mca_softc *sc, in if (tries == 10000 && bus_space_read_1(sc->sc_iot, sc->sc_ioh, BSR) & BSR_CIFR_FULL) { - aprint_error_dev(&sc->sc_dev, "device too slow to accept command %d\n", cmd); + aprint_error_dev(sc->sc_dev, "device too slow to accept command %d\n", cmd); return (EIO); } } @@ -733,30 +735,30 @@ edc_dump_status_block(struct edc_mca_sof { #ifdef EDC_DEBUG printf("%s: Command: %s, Status: %s (intr %d)\n", - device_xname(&sc->sc_dev), + device_xname(sc->sc_dev), edc_commands[status_block[0] & 0x1f], edc_cmd_status[SB_GET_CMD_STATUS(status_block)], intr_id ); #else printf("%s: Command: %d, Status: %d (intr %d)\n", - device_xname(&sc->sc_dev), + device_xname(sc->sc_dev), status_block[0] & 0x1f, SB_GET_CMD_STATUS(status_block), intr_id ); #endif printf("%s: # left blocks: %u, last processed RBA: %u\n", - device_xname(&sc->sc_dev), + device_xname(sc->sc_dev), status_block[SB_RESBLKCNT_IDX], (status_block[5] << 16) | status_block[4]); if (intr_id == ISR_COMPLETED_WARNING) { #ifdef EDC_DEBUG - aprint_error_dev(&sc->sc_dev, "Command Error Code: %s\n", + aprint_error_dev(sc->sc_dev, "Command Error Code: %s\n", edc_cmd_error[status_block[1] & 0xff]); #else - aprint_error_dev(&sc->sc_dev, "Command Error Code: %d\n", + aprint_error_dev(sc->sc_dev, "Command Error Code: %d\n", status_block[1] & 0xff); #endif } @@ -766,7 +768,7 @@ edc_dump_status_block(struct edc_mca_sof char buf[100]; printf("%s: Device Error Code: %s\n", - device_xname(&sc->sc_dev), + device_xname(sc->sc_dev), edc_dev_errors[status_block[2] & 0xff]); snprintb(buf, sizeof(buf), "\20" @@ -780,10 +782,10 @@ edc_dump_status_block(struct edc_mca_sof "\010Reserved0", (status_block[2] & 0xff00) >> 8); printf("%s: Device Status: %s\n", - device_xname(&sc->sc_dev), buf); + device_xname(sc->sc_dev), buf); #else printf("%s: Device Error Code: %d, Device Status: %d\n", - device_xname(&sc->sc_dev), + device_xname(sc->sc_dev), status_block[2] & 0xff, (status_block[2] & 0xff00) >> 8); #endif @@ -863,7 +865,7 @@ edc_bio(struct edc_mca_softc *sc, struct if ((error = bus_dmamap_load(sc->sc_dmat, sc->sc_dmamap_xfer, data, bcount, NULL, BUS_DMA_STREAMING|fl))) { printf("%s: ed_bio: unable to load DMA buffer - error %d\n", - device_xname(&ed->sc_dev), error); + device_xname(ed->sc_dev), error); goto out; } Index: sys/dev/mca/edvar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/mca/edvar.h,v retrieving revision 1.15 diff -u -p -r1.15 edvar.h --- sys/dev/mca/edvar.h 2 Feb 2012 19:43:04 -0000 1.15 +++ sys/dev/mca/edvar.h 28 Sep 2012 19:50:27 -0000 @@ -34,7 +34,7 @@ struct edc_mca_softc; struct ed_softc { - struct device sc_dev; + device_t sc_dev; /* General disk infos */ struct disk sc_dk; Index: sys/dev/mca/if_tr_mca.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/mca/if_tr_mca.c,v retrieving revision 1.21 diff -u -p -r1.21 if_tr_mca.c --- sys/dev/mca/if_tr_mca.c 12 May 2009 14:31:00 -0000 1.21 +++ sys/dev/mca/if_tr_mca.c 26 Sep 2012 23:07:50 -0000 @@ -64,7 +64,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_tr_mca.c, int tr_mca_probe(device_t, cfdata_t, void *); void tr_mca_attach(device_t, device_t, void *); -CFATTACH_DECL(tr_mca, sizeof(struct tr_softc), +CFATTACH_DECL_NEW(tr_mca, sizeof(struct tr_softc), tr_mca_probe, tr_mca_attach, NULL, NULL); /* supported products */ @@ -169,22 +169,23 @@ tr_mca_attach(device_t parent, device_t /* map the pio registers */ if (bus_space_map(ma->ma_iot, iobase, TR_PIOSIZE, 0, &pioh)) { - aprint_error_dev(&sc->sc_dev, "unable to map PIO space\n"); + aprint_error_dev(self, "unable to map PIO space\n"); return; } /* map the mmio registers */ if (bus_space_map(ma->ma_memt, rom_addr, TR_MMIOSIZE, 0, &mmioh)) { - aprint_error_dev(&sc->sc_dev, "unable to map MMIO space\n"); + aprint_error_dev(self, "unable to map MMIO space\n"); return; } /* map the sram space */ if (bus_space_map(ma->ma_memt, sram_addr, sram_size, 0, &sramh)) { - aprint_error_dev(&sc->sc_dev, "unable to map SRAM space\n"); + aprint_error_dev(self, "unable to map SRAM space\n"); return; } + sc->sc_dev = self; sc->sc_piot = ma->ma_iot; sc->sc_pioh = pioh; sc->sc_memt = ma->ma_memt; @@ -217,7 +218,7 @@ tr_mca_attach(device_t parent, device_t /* establish interrupt handler */ sc->sc_ih = mca_intr_establish(ma->ma_mc, irq, IPL_NET, tr_intr, sc); if (sc->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; } Index: sys/dev/mca/if_tra_mca.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/mca/if_tra_mca.c,v retrieving revision 1.15 diff -u -p -r1.15 if_tra_mca.c --- sys/dev/mca/if_tra_mca.c 3 Feb 2012 01:20:45 -0000 1.15 +++ sys/dev/mca/if_tra_mca.c 27 Sep 2012 00:13:59 -0000 @@ -70,7 +70,7 @@ struct tiara_softc { void *sc_ih; /* interrupt cookie */ }; -CFATTACH_DECL(tra_mca, sizeof(struct tiara_softc), +CFATTACH_DECL_NEW(tra_mca, sizeof(struct tiara_softc), tiara_mca_match, tiara_mca_attach, NULL, NULL); static const struct tiara_mca_product { @@ -98,8 +98,7 @@ tiara_mca_lookup(u_int32_t id) } int -tiara_mca_match(device_t parent, cfdata_t match, - void *aux) +tiara_mca_match(device_t parent, cfdata_t match, void *aux) { struct mca_attach_args *ma = (struct mca_attach_args *) aux; @@ -187,7 +186,7 @@ tiara_mca_attach(device_t parent, device if ((pos2 & 0x80) != 0) irq = smc_irq[((pos2 & 0x70) >> 4)]; else { - aprint_error_dev(&sc->sc_dev, "unsupported irq selected\n"); + aprint_error_dev(self, "unsupported irq selected\n"); return; } @@ -205,7 +204,7 @@ tiara_mca_attach(device_t parent, device tra_p = tiara_mca_lookup(ma->ma_id); if (tra_p == NULL) { aprint_normal("\n"); - aprint_error_dev(&sc->sc_dev, "where did the card go?\n"); + aprint_error_dev(self, "where did the card go?\n"); return; } #endif @@ -214,10 +213,11 @@ tiara_mca_attach(device_t parent, device /* Map i/o space. */ if (bus_space_map(iot, iobase, TIARA_NPORTS, 0, &ioh)) { - aprint_error_dev(&sc->sc_dev, "can't map i/o space\n"); + aprint_error_dev(self, "can't map i/o space\n"); return; } + sc->sc_dev = self; sc->sc_bst = iot; sc->sc_bsh = ioh; @@ -241,7 +241,7 @@ tiara_mca_attach(device_t parent, device isc->sc_ih = mca_intr_establish(ma->ma_mc, irq, IPL_NET, mb86950_intr, sc); if (isc->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; } } Index: sys/dev/mca/mcavar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/mca/mcavar.h,v retrieving revision 1.11 diff -u -p -r1.11 mcavar.h --- sys/dev/mca/mcavar.h 28 Apr 2008 20:23:53 -0000 1.11 +++ sys/dev/mca/mcavar.h 2 Oct 2012 02:21:59 -0000 @@ -55,7 +55,6 @@ struct mcabus_attach_args { struct mca_attach_args { - struct device *ma_self; /* pointer to it's device struct */ bus_space_tag_t ma_iot; /* MCA I/O space tag */ bus_space_tag_t ma_memt; /* MCA mem space tag */ bus_dma_tag_t ma_dmat; /* MCA DMA tag */ Index: sys/dev/mscp/mscp.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/mscp/mscp.c,v retrieving revision 1.35 diff -u -p -r1.35 mscp.c --- sys/dev/mscp/mscp.c 10 Jul 2012 22:30:23 -0000 1.35 +++ sys/dev/mscp/mscp.c 29 Sep 2012 11:24:57 -0000 @@ -203,7 +203,7 @@ loop: mi->mi_flags |= MSC_READY; } else { printf("%s: SETCTLRC failed: %d ", - device_xname(&mi->mi_dev), mp->mscp_status); + device_xname(mi->mi_dev), mp->mscp_status); mscp_printevent(mp); } goto done; @@ -243,7 +243,7 @@ loop: case MSCPT_MAINTENANCE: default: printf("%s: unit %d: unknown message type 0x%x ignored\n", - device_xname(&mi->mi_dev), mp->mscp_unit, + device_xname(mi->mi_dev), mp->mscp_unit, MSCP_MSGTYPE(mp->mscp_msgtc)); goto done; } @@ -305,7 +305,7 @@ loop: mw = SLIST_FIRST(&mi->mi_freelist); if (mw == NULL) { - aprint_error_dev(&mi->mi_dev, + aprint_error_dev(mi->mi_dev, "couldn't attach drive (no free items)\n"); mutex_spin_exit(&mi->mi_mtx); } else { @@ -419,7 +419,7 @@ rwend: bp->b_resid = bp->b_bcount - mp->mscp_seq.seq_bytecount; bus_dmamap_unload(mi->mi_dmat, mxi->mxi_dmam); - (*mc->mc_ctlrdone)(device_parent(&mi->mi_dev)); + (*mc->mc_ctlrdone)(device_parent(mi->mi_dev)); (*me->me_iodone)(drive, bp); out: mxi->mxi_inuse = 0; @@ -496,7 +496,7 @@ mscp_worker(struct work *wk, void *dummy da.da_mp = &mw->mw_mp; da.da_typ = mi->mi_type; - config_found(&mi->mi_dev, (void *)&da, mscp_print); + config_found(mi->mi_dev, (void *)&da, mscp_print); mutex_spin_enter(&mi->mi_mtx); SLIST_INSERT_HEAD(&mw->mw_mi->mi_freelist, mw, mw_list); Index: sys/dev/mscp/mscp_disk.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/mscp/mscp_disk.c,v retrieving revision 1.75 diff -u -p -r1.75 mscp_disk.c --- sys/dev/mscp/mscp_disk.c 11 Jul 2012 16:41:16 -0000 1.75 +++ sys/dev/mscp/mscp_disk.c 28 Sep 2012 21:06:25 -0000 @@ -116,7 +116,7 @@ __KERNEL_RCSID(0, "$NetBSD: mscp_disk.c, * Drive status, per drive */ struct ra_softc { - struct device ra_dev; /* Autoconf struct */ + device_t ra_dev; /* Autoconf struct */ struct disk ra_disk; int ra_state; /* open/closed state */ u_long ra_mediaid; /* media id */ @@ -138,7 +138,7 @@ static inline struct ra_softc *mscp_devi int ramatch(device_t, cfdata_t, void *); -CFATTACH_DECL(ra, sizeof(struct ra_softc), +CFATTACH_DECL_NEW(ra, sizeof(struct ra_softc), ramatch, raattach, NULL, NULL); #endif /* NRA */ @@ -339,7 +339,7 @@ rastrategy(struct buf *bp) b = splbio(); disk_busy(&ra->ra_disk); splx(b); - mscp_strategy(bp, device_parent(&ra->ra_dev)); + mscp_strategy(bp, device_parent(ra->ra_dev)); return; } @@ -361,7 +361,7 @@ rastrategy(struct buf *bp) b = splbio(); disk_busy(&ra->ra_disk); splx(b); - mscp_strategy(bp, device_parent(&ra->ra_dev)); + mscp_strategy(bp, device_parent(ra->ra_dev)); return; done: @@ -490,7 +490,7 @@ raioctl(dev_t dev, u_long cmd, void *dat return (EBADF); /* If the ioctl happens here, the parent is us. */ - strlcpy(dkw->dkw_parent, device_xname(&ra->ra_dev), + strlcpy(dkw->dkw_parent, device_xname(ra->ra_dev), sizeof(dkw->dkw_parent)); return (dkwedge_add(dkw)); } @@ -503,7 +503,7 @@ raioctl(dev_t dev, u_long cmd, void *dat return (EBADF); /* If the ioctl happens here, the parent is us. */ - strlcpy(dkw->dkw_parent, device_xname(&ra->ra_dev), + strlcpy(dkw->dkw_parent, device_xname(ra->ra_dev), sizeof(dkw->dkw_parent)); return (dkwedge_del(dkw)); } @@ -553,7 +553,7 @@ rasize(dev_t dev) int rxmatch(device_t, cfdata_t, void *); -CFATTACH_DECL(rx, sizeof(struct rx_softc), +CFATTACH_DECL_NEW(rx, sizeof(struct rx_softc), rxmatch, raattach, NULL, NULL); dev_type_open(rxopen); @@ -609,7 +609,7 @@ rxmatch(device_t parent, cfdata_t cf, vo int racdmatch(device_t, cfdata_t, void *); -CFATTACH_DECL(racd, sizeof(struct racd_softc), +CFATTACH_DECL_NEW(racd, sizeof(struct racd_softc), racdmatch, raattach, NULL, NULL); dev_type_open(raopen); @@ -669,9 +669,10 @@ raattach(device_t parent, device_t self, struct rx_softc *rx = device_private(self); struct drive_attach_args *da = aux; struct mscp *mp = da->da_mp; - struct mscp_softc *mi = (void *)parent; + struct mscp_softc *mi = device_private(parent); struct disklabel *dl; + rx->ra_dev = self; rx->ra_mediaid = mp->mscp_guse.guse_mediaid; rx->ra_state = DK_CLOSED; rx->ra_hwunit = mp->mscp_unit; @@ -679,21 +680,21 @@ raattach(device_t parent, device_t self, #if NRX if (MSCP_MID_ECH(1, mp->mscp_guse.guse_mediaid) == 'X' - '@') - disk_init((struct disk *)&rx->ra_disk, device_xname(&rx->ra_dev), + disk_init((struct disk *)&rx->ra_disk, device_xname(rx->ra_dev), &rxdkdriver); #endif #if NRACD if (MSCP_MID_ECH(1, mp->mscp_guse.guse_mediaid) == 'R' - '@') - disk_init((struct disk *)&rx->ra_disk, device_xname(&rx->ra_dev), + disk_init((struct disk *)&rx->ra_disk, device_xname(rx->ra_dev), &racddkdriver); #endif #if NRA if (MSCP_MID_ECH(1, mp->mscp_guse.guse_mediaid) != 'X' - '@' && MSCP_MID_ECH(1, mp->mscp_guse.guse_mediaid) != 'R' - '@') - disk_init((struct disk *)&rx->ra_disk, device_xname(&rx->ra_dev), + disk_init((struct disk *)&rx->ra_disk, device_xname(rx->ra_dev), &radkdriver); #endif - disk_attach((struct disk *)&rx->ra_disk); + disk_attach(&rx->ra_disk); /* Fill in what we know. The actual size is gotten later */ dl = rx->ra_disk.dk_label; @@ -726,8 +727,7 @@ int rx_putonline(struct rx_softc *rx) { struct mscp *mp; - struct mscp_softc *mi = - (struct mscp_softc *)device_parent(&rx->ra_dev); + struct mscp_softc *mi = device_private(device_parent(rx->ra_dev)); volatile int i; rx->ra_state = DK_CLOSED; @@ -822,7 +822,7 @@ rxstrategy(struct buf *bp) b = splbio(); disk_busy(&rx->ra_disk); splx(b); - mscp_strategy(bp, device_parent(&rx->ra_dev)); + mscp_strategy(bp, device_parent(rx->ra_dev)); return; done: @@ -1118,9 +1118,9 @@ ra_putonline(dev_t dev, struct ra_softc dl = ra->ra_disk.dk_label; ra->ra_state = DK_RDLABEL; - printf("%s", device_xname(&ra->ra_dev)); + printf("%s", device_xname(ra->ra_dev)); if ((msg = readdisklabel( - MAKEDISKDEV(major(dev), device_unit(&ra->ra_dev), RAW_PART), + MAKEDISKDEV(major(dev), device_unit(ra->ra_dev), RAW_PART), rastrategy, dl, NULL)) == NULL) { ra->ra_havelabel = 1; ra->ra_state = DK_OPEN; Index: sys/dev/mscp/mscp_subr.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/mscp/mscp_subr.c,v retrieving revision 1.43 diff -u -p -r1.43 mscp_subr.c --- sys/dev/mscp/mscp_subr.c 10 Jul 2012 22:30:23 -0000 1.43 +++ sys/dev/mscp/mscp_subr.c 28 Sep 2012 19:57:08 -0000 @@ -99,12 +99,12 @@ __KERNEL_RCSID(0, "$NetBSD: mscp_subr.c, int mscp_match(device_t, cfdata_t, void *); void mscp_attach(device_t, device_t, void *); -void mscp_start(struct mscp_softc *); -int mscp_init(struct mscp_softc *); +void mscp_start(struct mscp_softc *); +int mscp_init(struct mscp_softc *); void mscp_initds(struct mscp_softc *); int mscp_waitstep(struct mscp_softc *, int, int); -CFATTACH_DECL(mscpbus, sizeof(struct mscp_softc), +CFATTACH_DECL_NEW(mscpbus, sizeof(struct mscp_softc), mscp_match, mscp_attach, NULL, NULL); #define READ_SA (bus_space_read_2(mi->mi_iot, mi->mi_sah, 0)) @@ -181,6 +181,7 @@ mscp_attach(device_t parent, device_t se volatile int i; int timeout, error, unit; + mi->mi_dev = self; mi->mi_mc = ma->ma_mc; mi->mi_me = NULL; mi->mi_type = ma->ma_type; @@ -202,7 +203,7 @@ mscp_attach(device_t parent, device_t se error = workqueue_create(&mi->mi_wq, "mscp_wq", mscp_worker, NULL, PRI_NONE, IPL_VM, 0); if (error != 0) { - aprint_error_dev(&mi->mi_dev, "could not create workqueue"); + aprint_error_dev(mi->mi_dev, "could not create workqueue"); return; } @@ -212,7 +213,7 @@ mscp_attach(device_t parent, device_t se if ((mw = kmem_zalloc(sizeof(*mw), KM_SLEEP)) == NULL) { mscp_free_workitems(mi); - aprint_error_dev(&mi->mi_dev, + aprint_error_dev(mi->mi_dev, "failed to allocate memory for work items"); return; } @@ -233,7 +234,7 @@ mscp_attach(device_t parent, device_t se bufq_alloc(&mi->mi_resq, "fcfs", 0); if (mscp_init(mi)) { - aprint_error_dev(&mi->mi_dev, "can't init, controller hung\n"); + aprint_error_dev(mi->mi_dev, "can't init, controller hung\n"); return; } for (i = 0; i < NCMD; i++) { @@ -282,7 +283,7 @@ mscp_attach(device_t parent, device_t se while (!mp->mscp_opcode) { if ( --timeout == 0) { printf("%s: no Get Unit Status response\n", - device_xname(&mi->mi_dev)); + device_xname(mi->mi_dev)); return; } DELAY(10000); @@ -345,7 +346,7 @@ mscp_attach(device_t parent, device_t se * In service, or something else unusable. */ printf("%s: unit %d off line: ", - device_xname(&mi->mi_dev), mp->mscp_unit); + device_xname(mi->mi_dev), mp->mscp_unit); mp2 = __UNVOLATILE(mp); mscp_printevent(mp2); break; @@ -353,7 +354,7 @@ mscp_attach(device_t parent, device_t se break; default: - aprint_error_dev(&mi->mi_dev, + aprint_error_dev(mi->mi_dev, "unable to get unit status: "); mscp_printevent(__UNVOLATILE(mp)); return; @@ -391,7 +392,7 @@ mscp_init(struct mscp_softc *mi) if (status == 0) return 1; /* Init failed */ if (READ_SA & MP_ERR) { - (*mi->mi_mc->mc_saerror)(device_parent(&mi->mi_dev), 0); + (*mi->mi_mc->mc_saerror)(device_parent(mi->mi_dev), 0); return 1; } @@ -400,7 +401,7 @@ mscp_init(struct mscp_softc *mi) MP_IE | (mi->mi_ivec >> 2)); status = mscp_waitstep(mi, STEP1MASK, STEP1GOOD); if (status == 0) { - (*mi->mi_mc->mc_saerror)(device_parent(&mi->mi_dev), 0); + (*mi->mi_mc->mc_saerror)(device_parent(mi->mi_dev), 0); return 1; } @@ -410,7 +411,7 @@ mscp_init(struct mscp_softc *mi) (vax_cputype == VAX_780 || vax_cputype == VAX_8600 ? MP_PI : 0)); status = mscp_waitstep(mi, STEP2MASK, STEP2GOOD(mi->mi_ivec >> 2)); if (status == 0) { - (*mi->mi_mc->mc_saerror)(device_parent(&mi->mi_dev), 0); + (*mi->mi_mc->mc_saerror)(device_parent(mi->mi_dev), 0); return 1; } @@ -418,7 +419,7 @@ mscp_init(struct mscp_softc *mi) WRITE_SW((mi->mi_dmam->dm_segs[0].ds_addr >> 16)); status = mscp_waitstep(mi, STEP3MASK, STEP3GOOD); if (status == 0) { - (*mi->mi_mc->mc_saerror)(device_parent(&mi->mi_dev), 0); + (*mi->mi_mc->mc_saerror)(device_parent(mi->mi_dev), 0); return 1; } i = READ_SA & 0377; @@ -428,7 +429,7 @@ mscp_init(struct mscp_softc *mi) if (mi->mi_type & MSCPBUS_UDA) { WRITE_SW(MP_GO | (BURST - 1) << 2); printf("%s: DMA burst size set to %d\n", - device_xname(&mi->mi_dev), BURST); + device_xname(mi->mi_dev), BURST); } WRITE_SW(MP_GO); @@ -463,7 +464,7 @@ mscp_init(struct mscp_softc *mi) } if (count == DELAYTEN) { out: - aprint_error_dev(&mi->mi_dev, "couldn't set ctlr characteristics, sa=%x\n", j); + aprint_error_dev(mi->mi_dev, "couldn't set ctlr characteristics, sa=%x\n", j); return 1; } return 0; @@ -573,7 +574,7 @@ mscp_kickaway(struct mscp_softc *mi) if ((mp = mscp_getcp(mi, MSCP_DONTWAIT)) == NULL) { if (mi->mi_credits > MSCP_MINCREDITS) printf("%s: command ring too small\n", - device_xname(device_parent(&mi->mi_dev))); + device_xname(device_parent(mi->mi_dev))); /* * By some (strange) reason we didn't get a MSCP packet. * Just return and wait for free packets. @@ -597,7 +598,7 @@ mscp_kickaway(struct mscp_softc *mi) mi->mi_xi[next].mxi_inuse = 1; bp->b_resid = next; (*mi->mi_me->me_fillin)(bp, mp); - (*mi->mi_mc->mc_go)(device_parent(&mi->mi_dev), + (*mi->mi_mc->mc_go)(device_parent(mi->mi_dev), &mi->mi_xi[next]); (void)bufq_get(mi->mi_resq); } Index: sys/dev/mscp/mscp_tape.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/mscp/mscp_tape.c,v retrieving revision 1.38 diff -u -p -r1.38 mscp_tape.c --- sys/dev/mscp/mscp_tape.c 12 May 2009 14:37:59 -0000 1.38 +++ sys/dev/mscp/mscp_tape.c 28 Sep 2012 20:00:12 -0000 @@ -69,7 +69,7 @@ __KERNEL_RCSID(0, "$NetBSD: mscp_tape.c, * Drive status, per drive */ struct mt_softc { - struct device mt_dev; /* Autoconf struct */ + device_t mt_dev; /* Autoconf struct */ int mt_state; /* open/closed state */ int mt_hwunit; /* Hardware unit number */ int mt_inuse; /* Locks the tape drive for others */ @@ -110,7 +110,7 @@ struct mscp_device mt_device = { #define mtnorewind(dev) (dev & T_NOREWIND) #define mthdensity(dev) (dev & T_1600BPI) -CFATTACH_DECL(mt, sizeof(struct mt_softc), +CFATTACH_DECL_NEW(mt, sizeof(struct mt_softc), mtmatch, mtattach, NULL, NULL); extern struct cfdriver mt_cd; @@ -159,8 +159,9 @@ mtattach(device_t parent, device_t self, struct mt_softc *mt = device_private(self); struct drive_attach_args *da = aux; struct mscp *mp = da->da_mp; - struct mscp_softc *mi = (void *)parent; + struct mscp_softc *mi = device_private(parent); + mt->mt_dev = self; mt->mt_hwunit = mp->mscp_unit; mi->mi_dp[mp->mscp_unit] = self; @@ -176,7 +177,7 @@ mt_putonline(struct mt_softc *mt) { struct mscp *mp; struct mscp_softc *mi = - (struct mscp_softc *)device_parent(&mt->mt_dev); + device_private(device_parent(mt->mt_dev)); volatile int i; ((volatile struct mt_softc *) mt)->mt_state = MT_OFFLINE; @@ -267,7 +268,7 @@ mtstrategy(struct buf *bp) } mt->mt_waswrite = bp->b_flags & B_READ ? 0 : 1; - mscp_strategy(bp, device_parent(&mt->mt_dev)); + mscp_strategy(bp, device_parent(mt->mt_dev)); return; } @@ -382,10 +383,10 @@ mtioerror(device_t usc, struct mscp *mp, mt->mt_serex = 2; else { if (st && st < 17) - printf("%s: error %d (%s)\n", device_xname(&mt->mt_dev), st, + printf("%s: error %d (%s)\n", device_xname(mt->mt_dev), st, mt_ioerrs[st-1]); else - printf("%s: error %d\n", device_xname(&mt->mt_dev), st); + printf("%s: error %d\n", device_xname(mt->mt_dev), st); bp->b_error = EROFS; } @@ -447,7 +448,7 @@ int mtcmd(struct mt_softc *mt, int cmd, int count, int complete) { struct mscp *mp; - struct mscp_softc *mi = (void *)device_parent(&mt->mt_dev); + struct mscp_softc *mi = device_private(device_parent(mt->mt_dev)); volatile int i; mp = mscp_getcp(mi, MSCP_WAIT); @@ -522,7 +523,7 @@ mtcmddone(device_t usc, struct mscp *mp) if (mp->mscp_status) { mt->mt_ioctlerr = EIO; - printf("%s: bad status %x\n", device_xname(&mt->mt_dev), + printf("%s: bad status %x\n", device_xname(mt->mt_dev), mp->mscp_status); } wakeup(&mt->mt_inuse); Index: sys/dev/mscp/mscpvar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/mscp/mscpvar.h,v retrieving revision 1.17 diff -u -p -r1.17 mscpvar.h --- sys/dev/mscp/mscpvar.h 12 May 2009 14:37:59 -0000 1.17 +++ sys/dev/mscp/mscpvar.h 2 Oct 2012 02:22:24 -0000 @@ -206,7 +206,7 @@ struct mscp_work { * been handed out; b_actf is that place. */ struct mscp_softc { - struct device mi_dev; /* Autoconf stuff */ + device_t mi_dev; /* Autoconf stuff */ struct mscp_ri mi_cmd; /* MSCP command ring info */ struct mscp_ri mi_rsp; /* MSCP response ring info */ bus_dma_tag_t mi_dmat; @@ -218,7 +218,7 @@ struct mscp_softc { char mi_wantcredits; /* waiting for transfer credits */ struct mscp_ctlr *mi_mc; /* Pointer to parent's mscp_ctlr */ struct mscp_device *mi_me; /* Pointer to child's mscp_device */ - struct device **mi_dp; /* array of backpointers */ + device_t *mi_dp; /* array of backpointers */ int mi_driveno; /* Max physical drive number found */ char mi_ctlrnr; /* Phys ctlr nr */ char mi_adapnr; /* Phys adapter nr */ Index: sys/dev/mvme/clmpcc_pcctwo.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/mvme/clmpcc_pcctwo.c,v retrieving revision 1.18 diff -u -p -r1.18 clmpcc_pcctwo.c --- sys/dev/mvme/clmpcc_pcctwo.c 12 May 2009 14:38:26 -0000 1.18 +++ sys/dev/mvme/clmpcc_pcctwo.c 28 Sep 2012 20:01:52 -0000 @@ -73,7 +73,7 @@ void clmpcc_pcctwo_attach(device_t, devi void clmpcc_pcctwo_iackhook(struct clmpcc_softc *, int); void clmpcc_pcctwo_consiackhook(struct clmpcc_softc *, int); -CFATTACH_DECL(clmpcc_pcctwo, sizeof(struct clmpcc_softc), +CFATTACH_DECL_NEW(clmpcc_pcctwo, sizeof(struct clmpcc_softc), clmpcc_pcctwo_match, clmpcc_pcctwo_attach, NULL, NULL); extern struct cfdriver clmpcc_cd; @@ -115,6 +115,7 @@ clmpcc_pcctwo_attach(device_t parent, de int level = pa->pa_ipl; sc = device_private(self); + sc->sc_dev = self; level = pa->pa_ipl; sc->sc_iot = pa->pa_bust; bus_space_map(pa->pa_bust, pa->pa_offset, 0x100, 0, &sc->sc_ioh); @@ -161,7 +162,7 @@ clmpcc_pcctwo_iackhook(struct clmpcc_sof default: #ifdef DEBUG printf("%s: Invalid IACK number '%d'\n", - device_xname(&sc->sc_dev), which); + device_xname(sc->sc_dev), which); #endif panic("clmpcc_pcctwo_iackhook %d", which); } @@ -194,7 +195,7 @@ clmpcc_pcctwo_consiackhook(struct clmpcc default: #ifdef DEBUG printf("%s: Invalid IACK number '%d'\n", - device_xname(&sc->sc_dev), which); + device_xname(sc->sc_dev), which); panic("clmpcc_pcctwo_consiackhook"); #endif panic("clmpcc_pcctwo_iackhook %d", which); Index: sys/dev/mvme/clock_pcctwo.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/mvme/clock_pcctwo.c,v retrieving revision 1.16 diff -u -p -r1.16 clock_pcctwo.c --- sys/dev/mvme/clock_pcctwo.c 12 May 2009 14:38:26 -0000 1.16 +++ sys/dev/mvme/clock_pcctwo.c 28 Sep 2012 20:02:36 -0000 @@ -56,13 +56,12 @@ int clock_pcctwo_match(device_t, cfdata_ void clock_pcctwo_attach(device_t, device_t, void *); struct clock_pcctwo_softc { - struct device sc_dev; struct clock_attach_args sc_clock_args; u_char sc_clock_lvl; struct timecounter sc_tc; }; -CFATTACH_DECL(clock_pcctwo, sizeof(struct clock_pcctwo_softc), +CFATTACH_DECL_NEW(clock_pcctwo, sizeof(struct clock_pcctwo_softc), clock_pcctwo_match, clock_pcctwo_attach, NULL, NULL); extern struct cfdriver clock_cd; Index: sys/dev/mvme/memc.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/mvme/memc.c,v retrieving revision 1.10 diff -u -p -r1.10 memc.c --- sys/dev/mvme/memc.c 14 Mar 2009 15:36:19 -0000 1.10 +++ sys/dev/mvme/memc.c 27 Sep 2012 21:43:35 -0000 @@ -364,7 +364,7 @@ memc_init(struct memc_softc *sc) (chipid == MEMC_CHIP_ID_MEMC040) ? "Parity" : "ECC", memc_reg_read(sc, MEMC_REG_CHIP_REVISION)); - printf("%s: Base Address: 0x%x, ", device_xname(&sc->sc_dev), + printf("%s: Base Address: 0x%x, ", device_xname(sc->sc_dev), MEMC_BASE_ADDRESS(memc_reg_read(sc, MEMC_REG_BASE_ADDRESS_HI), memc_reg_read(sc, MEMC_REG_BASE_ADDRESS_LO))); @@ -467,7 +467,7 @@ memecc_attach(struct memc_softc *sc) memc_reg_read(sc, MEMECC_REG_SCRUB_CONTROL) | MEMECC_SCRUB_CONTROL_SCRBEN | MEMECC_SCRUB_CONTROL_SBEIEN); - printf("%s: Logging ECC errors at ipl %d\n", device_xname(&sc->sc_dev), + printf("%s: Logging ECC errors at ipl %d\n", device_xname(sc->sc_dev), MEMC_IRQ_LEVEL); } @@ -593,10 +593,10 @@ memecc_log_error(struct memc_softc *sc, etype = "Spurious"; printf("%s: %s error on %s%s access to 0x%08x.\n", - device_xname(&sc->sc_dev), etype, bm, rdwr, addr); + device_xname(sc->sc_dev), etype, bm, rdwr, addr); if ((errlog & MEMECC_ERROR_LOGGER_SBE) != 0) - printf("%s: ECC Syndrome 0x%02x (%s)\n", device_xname(&sc->sc_dev), + printf("%s: ECC Syndrome 0x%02x (%s)\n", device_xname(sc->sc_dev), syndrome, syntext); /* @@ -631,6 +631,6 @@ memecc_log_error(struct memc_softc *sc, memc_reg_write(sc, MEMECC_REG_SCRUB_CONTROL + off, rv); panic("%s: Halting system to preserve data integrity.", - device_xname(&sc->sc_dev)); + device_xname(sc->sc_dev)); } } Index: sys/dev/mvme/memcvar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/mvme/memcvar.h,v retrieving revision 1.2 diff -u -p -r1.2 memcvar.h --- sys/dev/mvme/memcvar.h 28 Apr 2008 20:23:54 -0000 1.2 +++ sys/dev/mvme/memcvar.h 27 Sep 2012 21:42:59 -0000 @@ -33,7 +33,7 @@ #define _MVME_MEMCVAR_H struct memc_softc { - struct device sc_dev; + device_t sc_dev; bus_space_tag_t sc_bust; bus_space_handle_t sc_bush; struct evcnt sc_evcnt; Index: sys/dev/mvme/mvmebus.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/mvme/mvmebus.c,v retrieving revision 1.18 diff -u -p -r1.18 mvmebus.c --- sys/dev/mvme/mvmebus.c 12 Feb 2012 16:34:12 -0000 1.18 +++ sys/dev/mvme/mvmebus.c 29 Sep 2012 11:34:40 -0000 @@ -137,7 +137,7 @@ mvmebus_offboard_ram(struct mvmebus_soft svr->vr_am = MVMEBUS_AM_DISABLED; #ifdef DEBUG printf("%s: No VMEbus master mapping for offboard RAM!\n", - device_xname(&sc->sc_dev)); + device_xname(sc->sc_dev)); #endif return; } @@ -170,11 +170,11 @@ mvmebus_attach(struct mvmebus_softc *sc) struct mvmebus_range *vr = &sc->sc_masters[i]; if (vr->vr_am == MVMEBUS_AM_DISABLED) { printf("%s: Master#%d: disabled\n", - device_xname(&sc->sc_dev), i); + device_xname(sc->sc_dev), i); continue; } printf("%s: Master#%d: 0x%08lx -> %s\n", - device_xname(&sc->sc_dev), i, + device_xname(sc->sc_dev), i, vr->vr_locstart + (vr->vr_vmestart & vr->vr_mask), mvmebus_mod_string(vr->vr_vmestart, (vr->vr_vmeend - vr->vr_vmestart) + 1, @@ -185,11 +185,11 @@ mvmebus_attach(struct mvmebus_softc *sc) struct mvmebus_range *vr = &sc->sc_slaves[i]; if (vr->vr_am == MVMEBUS_AM_DISABLED) { printf("%s: Slave#%d: disabled\n", - device_xname(&sc->sc_dev), i); + device_xname(sc->sc_dev), i); continue; } printf("%s: Slave#%d: 0x%08lx -> %s\n", - device_xname(&sc->sc_dev), i, vr->vr_locstart, + device_xname(sc->sc_dev), i, vr->vr_locstart, mvmebus_mod_string(vr->vr_vmestart, (vr->vr_vmeend - vr->vr_vmestart) + 1, vr->vr_am, vr->vr_datasize)); @@ -236,7 +236,7 @@ mvmebus_attach(struct mvmebus_softc *sc) vaa.va_bdt = &sc->sc_mvmedmat; vaa.va_slaveconfig = NULL; - config_found(&sc->sc_dev, &vaa, 0); + config_found(sc->sc_dev, &vaa, 0); } int @@ -385,12 +385,12 @@ mvmebus_intr_establish(void *vsc, vme_in #ifdef DIAGNOSTIC if (vector < 0 || vector > 0xff) { printf("%s: Illegal vector offset: 0x%x\n", - device_xname(&sc->sc_dev), vector); + device_xname(sc->sc_dev), vector); panic("mvmebus_intr_establish"); } if (level < 1 || level > 7) { printf("%s: Illegal interrupt level: %d\n", - device_xname(&sc->sc_dev), level); + device_xname(sc->sc_dev), level); panic("mvmebus_intr_establish"); } #endif @@ -418,17 +418,17 @@ mvmebus_intr_disestablish(void *vsc, vme #ifdef DIAGNOSTIC if (vector < 0 || vector > 0xff) { printf("%s: Illegal vector offset: 0x%x\n", - device_xname(&sc->sc_dev), vector); + device_xname(sc->sc_dev), vector); panic("mvmebus_intr_disestablish"); } if (level < 1 || level > 7) { printf("%s: Illegal interrupt level: %d\n", - device_xname(&sc->sc_dev), level); + device_xname(sc->sc_dev), level); panic("mvmebus_intr_disestablish"); } if (sc->sc_irqref[level] == 0) { printf("%s: VMEirq#%d: Reference count already zero!\n", - device_xname(&sc->sc_dev), level); + device_xname(sc->sc_dev), level); panic("mvmebus_intr_disestablish"); } #endif Index: sys/dev/mvme/mvmebus.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/mvme/mvmebus.h,v retrieving revision 1.3 diff -u -p -r1.3 mvmebus.h --- sys/dev/mvme/mvmebus.h 28 Apr 2008 20:23:54 -0000 1.3 +++ sys/dev/mvme/mvmebus.h 29 Sep 2012 13:47:48 -0000 @@ -91,7 +91,7 @@ struct mvmebus_dmamap { struct mvmebus_softc { - struct device sc_dev; + device_t sc_dev; bus_space_tag_t sc_bust; bus_dma_tag_t sc_dmat; short sc_irqref[8]; Index: sys/dev/mvme/pcctwo.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/mvme/pcctwo.c,v retrieving revision 1.10 diff -u -p -r1.10 pcctwo.c --- sys/dev/mvme/pcctwo.c 12 Feb 2012 16:34:12 -0000 1.10 +++ sys/dev/mvme/pcctwo.c 27 Sep 2012 21:44:15 -0000 @@ -103,7 +103,7 @@ pcctwo_init(struct pcctwo_softc *sc, con pd++; /* Attach the device if configured. */ - (void) config_found(&sc->sc_dev, &npa, pcctwoprint); + (void) config_found(sc->sc_dev, &npa, pcctwoprint); } } Index: sys/dev/mvme/pcctwovar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/mvme/pcctwovar.h,v retrieving revision 1.4 diff -u -p -r1.4 pcctwovar.h --- sys/dev/mvme/pcctwovar.h 28 Apr 2008 20:23:54 -0000 1.4 +++ sys/dev/mvme/pcctwovar.h 27 Sep 2012 21:44:00 -0000 @@ -69,7 +69,7 @@ struct pcctwo_device { * PCCChip2 driver's soft state structure */ struct pcctwo_softc { - struct device sc_dev; + device_t sc_dev; bus_space_tag_t sc_bust; /* PCCChip2's register tag */ bus_space_handle_t sc_bush; /* PCCChip2's register handle */ bus_dma_tag_t sc_dmat; /* PCCChip2's dma tag (unused)*/ Index: sys/dev/mvme/vme_two_isr.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/mvme/vme_two_isr.c,v retrieving revision 1.15 diff -u -p -r1.15 vme_two_isr.c --- sys/dev/mvme/vme_two_isr.c 16 Mar 2009 23:11:16 -0000 1.15 +++ sys/dev/mvme/vme_two_isr.c 29 Sep 2012 13:55:19 -0000 @@ -300,7 +300,7 @@ vmetwo_intr_establish(void *csc, int pri if (evcnt) evcnt_attach_dynamic(evcnt, EVCNT_TYPE_INTR, (*sc->sc_isrevcnt)(sc->sc_isrcookie, prior), - device_xname(&sc->sc_mvmebus.sc_dev), + device_xname(sc->sc_mvmebus.sc_dev), mvmebus_irq_name[lvl]); #endif iloffset = VME2_ILOFFSET_FROM_VECTOR(bitoff) + Index: sys/dev/ofisa/com_ofisa.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/ofisa/com_ofisa.c,v retrieving revision 1.14 diff -u -p -r1.14 com_ofisa.c --- sys/dev/ofisa/com_ofisa.c 8 Apr 2008 20:11:36 -0000 1.14 +++ sys/dev/ofisa/com_ofisa.c 29 Sep 2012 11:39:52 -0000 @@ -155,10 +155,10 @@ com_ofisa_attach(device_t parent, device com_attach_subr(sc); #if 0 - printf("%s: registers: ", device_xname(&sc->sc_dev)); + printf("%s: registers: ", device_xname(sc->sc_dev)); ofisa_reg_print(®, 1); printf("\n"); - printf("%s: interrupts: ", device_xname(&sc->sc_dev)); + printf("%s: interrupts: ", device_xname(sc->sc_dev)); ofisa_intr_print(&intr, 1); printf("\n"); #endif Index: sys/dev/ofisa/lpt_ofisa.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/ofisa/lpt_ofisa.c,v retrieving revision 1.14 diff -u -p -r1.14 lpt_ofisa.c --- sys/dev/ofisa/lpt_ofisa.c 8 Apr 2008 20:11:36 -0000 1.14 +++ sys/dev/ofisa/lpt_ofisa.c 29 Sep 2012 11:39:43 -0000 @@ -140,10 +140,10 @@ lpt_ofisa_attach(device_t parent, device lpt_attach_subr(sc); #if 0 - printf("%s: registers: ", device_xname(&sc->sc_dev)); + printf("%s: registers: ", device_xname(sc->sc_dev)); ofisa_reg_print(®, 1); printf("\n"); - printf("%s: interrupts: ", device_xname(&sc->sc_dev)); + printf("%s: interrupts: ", device_xname(sc->sc_dev)); ofisa_intr_print(&intr, 1); printf("\n"); #endif Index: sys/dev/ofw/ofnet.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/ofw/ofnet.c,v retrieving revision 1.52 diff -u -p -r1.52 ofnet.c --- sys/dev/ofw/ofnet.c 26 Jul 2011 08:59:38 -0000 1.52 +++ sys/dev/ofw/ofnet.c 26 Sep 2012 23:12:39 -0000 @@ -64,7 +64,7 @@ __KERNEL_RCSID(0, "$NetBSD: ofnet.c,v 1. #include #include -CFATTACH_DECL(ipkdb_ofn, 0, +CFATTACH_DECL_NEW(ipkdb_ofn, 0, ipkdb_probe, ipkdb_attach, NULL, NULL); static struct ipkdb_if *kifp; Index: sys/dev/pci/aac_pci.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/pci/aac_pci.c,v retrieving revision 1.34 diff -u -p -r1.34 aac_pci.c --- sys/dev/pci/aac_pci.c 23 Sep 2012 01:10:59 -0000 1.34 +++ sys/dev/pci/aac_pci.c 27 Sep 2012 00:13:25 -0000 @@ -505,6 +505,7 @@ aac_pci_attach(device_t parent, device_t pcisc = device_private(self); pcisc->sc_pc = pc; sc = &pcisc->sc_aac; + sc->sc_dv = self; state = 0; aprint_naive(": RAID controller\n"); @@ -560,7 +561,7 @@ aac_pci_attach(device_t parent, device_t m = aac_find_ident(pa); aprint_normal("%s\n", m->prodstr); if (intrstr != NULL) - aprint_normal_dev(&sc->sc_dv, "interrupting at %s\n", + aprint_normal_dev(self, "interrupting at %s\n", intrstr); sc->sc_hwif = m->hwif; @@ -597,7 +598,7 @@ aac_pci_attach(device_t parent, device_t bus_space_unmap(sc->sc_memt, sc->sc_memh, memsize); } -CFATTACH_DECL(aac_pci, sizeof(struct aac_pci_softc), +CFATTACH_DECL_NEW(aac_pci, sizeof(struct aac_pci_softc), aac_pci_match, aac_pci_attach, NULL, NULL); /* Index: sys/dev/pci/adv_pci.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/pci/adv_pci.c,v retrieving revision 1.26 diff -u -p -r1.26 adv_pci.c --- sys/dev/pci/adv_pci.c 26 Nov 2009 15:17:08 -0000 1.26 +++ sys/dev/pci/adv_pci.c 26 Sep 2012 18:37:43 -0000 @@ -109,7 +109,7 @@ static void adv_pci_attach(device_t parent, device_t self, void *aux) { struct pci_attach_args *pa = aux; - ASC_SOFTC *sc = (void *) self; + ASC_SOFTC *sc = device_private(self); bus_space_tag_t iot; bus_space_handle_t ioh; pci_intr_handle_t ih; @@ -119,6 +119,7 @@ adv_pci_attach(device_t parent, device_t aprint_naive(": SCSI controller\n"); + sc->sc_dev = self; sc->sc_flags = 0x0; if (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_ADVSYS) switch (PCI_PRODUCT(pa->pa_id)) { @@ -190,7 +191,7 @@ adv_pci_attach(device_t parent, device_t */ if (pci_mapreg_map(pa, PCI_BASEADR_IO, PCI_MAPREG_TYPE_IO, 0, &iot, &ioh, NULL, NULL)) { - aprint_error_dev(&sc->sc_dev, "unable to map device registers\n"); + aprint_error_dev(sc->sc_dev, "unable to map device registers\n"); return; } @@ -214,7 +215,7 @@ adv_pci_attach(device_t parent, device_t * Map Interrupt line */ 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(pc, ih); @@ -224,13 +225,13 @@ adv_pci_attach(device_t parent, device_t */ sc->sc_ih = pci_intr_establish(pc, ih, IPL_BIO, adv_intr, sc); if (sc->sc_ih == NULL) { - aprint_error_dev(&sc->sc_dev, "couldn't establish interrupt"); + aprint_error_dev(sc->sc_dev, "couldn't establish interrupt"); 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); /* * Attach all the sub-devices we can find @@ -238,5 +239,5 @@ adv_pci_attach(device_t parent, device_t adv_attach(sc); } -CFATTACH_DECL(adv_pci, sizeof(ASC_SOFTC), +CFATTACH_DECL_NEW(adv_pci, sizeof(ASC_SOFTC), adv_pci_match, adv_pci_attach, NULL, NULL); Index: sys/dev/pci/adw_pci.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/pci/adw_pci.c,v retrieving revision 1.25 diff -u -p -r1.25 adw_pci.c --- sys/dev/pci/adw_pci.c 26 Nov 2009 15:17:08 -0000 1.25 +++ sys/dev/pci/adw_pci.c 28 Sep 2012 20:48:02 -0000 @@ -96,7 +96,7 @@ static void adw_pci_attach(device_t parent, device_t self, void *aux) { struct pci_attach_args *pa = aux; - ADW_SOFTC *sc = (void *) self; + ADW_SOFTC *sc = device_private(self); bus_space_tag_t iot; bus_space_handle_t ioh; pci_intr_handle_t ih; @@ -104,6 +104,8 @@ adw_pci_attach(device_t parent, device_t u_int32_t command; const char *intrstr; + sc->sc_dev = self; + aprint_naive(": SCSI controller\n"); if (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_ADVSYS) @@ -148,7 +150,7 @@ adw_pci_attach(device_t parent, device_t */ if (pci_mapreg_map(pa, PCI_BASEADR_IO, PCI_MAPREG_TYPE_IO, 0, &iot, &ioh, NULL, NULL)) { - aprint_error_dev(&sc->sc_dev, "unable to map device registers\n"); + aprint_error_dev(self, "unable to map device registers\n"); return; } sc->sc_iot = iot; @@ -159,7 +161,7 @@ adw_pci_attach(device_t parent, device_t * Initialize the board */ if (adw_init(sc)) { - aprint_error_dev(&sc->sc_dev, "adw_init failed"); + aprint_error_dev(self, "adw_init failed"); return; } @@ -167,7 +169,7 @@ adw_pci_attach(device_t parent, device_t * Map Interrupt line */ if (pci_intr_map(pa, &ih)) { - aprint_error_dev(&sc->sc_dev, "couldn't map interrupt\n"); + aprint_error_dev(self, "couldn't map interrupt\n"); return; } intrstr = pci_intr_string(pc, ih); @@ -177,13 +179,13 @@ adw_pci_attach(device_t parent, device_t */ sc->sc_ih = pci_intr_establish(pc, ih, IPL_BIO, adw_intr, sc); if (sc->sc_ih == NULL) { - aprint_error_dev(&sc->sc_dev, "couldn't establish interrupt"); + aprint_error_dev(self, "couldn't establish interrupt"); 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(self, "interrupting at %s\n", intrstr); /* * Attach all the sub-devices we can find @@ -191,5 +193,5 @@ adw_pci_attach(device_t parent, device_t adw_attach(sc); } -CFATTACH_DECL(adw_pci, sizeof(ADW_SOFTC), +CFATTACH_DECL_NEW(adw_pci, sizeof(ADW_SOFTC), adw_pci_match, adw_pci_attach, NULL, NULL); Index: sys/dev/pci/amdpm.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/pci/amdpm.c,v retrieving revision 1.35 diff -u -p -r1.35 amdpm.c --- sys/dev/pci/amdpm.c 30 Jan 2012 19:41:18 -0000 1.35 +++ sys/dev/pci/amdpm.c 26 Sep 2012 23:21:12 -0000 @@ -93,6 +93,8 @@ amdpm_attach(device_t parent, device_t s pci_aprint_devinfo(pa, NULL); + sc->sc_dev = self; + if (PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_NVIDIA_XBOX_SMBUS) sc->sc_nforce = 1; else @@ -104,7 +106,7 @@ amdpm_attach(device_t parent, device_t s sc->sc_pa = pa; #if 0 - aprint_normal_dev(&sc->sc_dev, ""); + aprint_normal_dev(self, ""); pci_conf_print(pa->pa_pc, pa->pa_tag, NULL); #endif @@ -120,24 +122,24 @@ amdpm_attach(device_t parent, device_t s confreg = pci_conf_read(pa->pa_pc, pa->pa_tag, AMDPM_CONFREG); if ((confreg & AMDPM_PMIOEN) == 0) { - aprint_error_dev(&sc->sc_dev, "PMxx space isn't enabled\n"); + aprint_error_dev(self, "PMxx space isn't enabled\n"); return; } if (sc->sc_nforce) { pmptrreg = pci_conf_read(pa->pa_pc, pa->pa_tag, NFORCE_PMPTR); - aprint_normal_dev(&sc->sc_dev, "power management at 0x%04x\n", + aprint_normal_dev(self, "power management at 0x%04x\n", NFORCE_PMBASE(pmptrreg)); if (bus_space_map(sc->sc_iot, NFORCE_PMBASE(pmptrreg), AMDPM_PMSIZE, 0, &sc->sc_ioh)) { - aprint_error_dev(&sc->sc_dev, "failed to map PMxx space\n"); + aprint_error_dev(self, "failed to map PMxx space\n"); return; } } else { pmptrreg = pci_conf_read(pa->pa_pc, pa->pa_tag, AMDPM_PMPTR); if (bus_space_map(sc->sc_iot, AMDPM_PMBASE(pmptrreg), AMDPM_PMSIZE, 0, &sc->sc_ioh)) { - aprint_error_dev(&sc->sc_dev, "failed to map PMxx space\n"); + aprint_error_dev(self, "failed to map PMxx space\n"); return; } } @@ -145,7 +147,7 @@ amdpm_attach(device_t parent, device_t s /* don't attach a timecounter on nforce boards */ if ((confreg & AMDPM_TMRRST) == 0 && (confreg & AMDPM_STOPTMR) == 0 && !sc->sc_nforce) { - acpipmtimer_attach(&sc->sc_dev, sc->sc_iot, sc->sc_ioh, + acpipmtimer_attach(self, sc->sc_iot, sc->sc_ioh, AMDPM_TMR, ((confreg & AMDPM_TMR32) ? ACPIPMT_32BIT : 0)); } @@ -168,12 +170,12 @@ amdpm_attach(device_t parent, device_t s delay(1); } if ((pmreg & AMDPM_RNGDONE) != 0) { - aprint_normal_dev(&sc->sc_dev, "" + aprint_normal_dev(self, "" "random number generator enabled (apprx. %dms)\n", i); callout_init(&sc->sc_rnd_ch, 0); rnd_attach_source(&sc->sc_rnd_source, - device_xname(&sc->sc_dev), RND_TYPE_RNG, + device_xname(self), RND_TYPE_RNG, /* * XXX Careful! The use of RND_FLAG_NO_ESTIMATE * XXX here is unobvious: we later feed raw bits @@ -188,12 +190,12 @@ amdpm_attach(device_t parent, device_t s RND_FLAG_NO_ESTIMATE); #ifdef AMDPM_RND_COUNTERS evcnt_attach_dynamic(&sc->sc_rnd_hits, EVCNT_TYPE_MISC, - NULL, device_xname(&sc->sc_dev), "rnd hits"); + NULL, device_xname(self), "rnd hits"); evcnt_attach_dynamic(&sc->sc_rnd_miss, EVCNT_TYPE_MISC, - NULL, device_xname(&sc->sc_dev), "rnd miss"); + NULL, device_xname(self), "rnd miss"); for (i = 0; i < 256; i++) { evcnt_attach_dynamic(&sc->sc_rnd_data[i], - EVCNT_TYPE_MISC, NULL, device_xname(&sc->sc_dev), + EVCNT_TYPE_MISC, NULL, device_xname(self), "rnd data"); } #endif @@ -202,7 +204,7 @@ amdpm_attach(device_t parent, device_t s } } -CFATTACH_DECL(amdpm, sizeof(struct amdpm_softc), +CFATTACH_DECL_NEW(amdpm, sizeof(struct amdpm_softc), amdpm_match, amdpm_attach, NULL, NULL); static void Index: sys/dev/pci/amdpm_smbus.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/pci/amdpm_smbus.c,v retrieving revision 1.18 diff -u -p -r1.18 amdpm_smbus.c --- sys/dev/pci/amdpm_smbus.c 14 Feb 2012 15:08:07 -0000 1.18 +++ sys/dev/pci/amdpm_smbus.c 26 Sep 2012 23:20:59 -0000 @@ -86,7 +86,7 @@ amdpm_smbus_attach(struct amdpm_softc *s mutex_init(&sc->sc_mutex, MUTEX_DEFAULT, IPL_NONE); iba.iba_tag = &sc->sc_i2c; - (void)config_found_ia(&sc->sc_dev, "i2cbus", &iba, iicbus_print); + (void)config_found_ia(sc->sc_dev, "i2cbus", &iba, iicbus_print); } static int Index: sys/dev/pci/amdpmvar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/pci/amdpmvar.h,v retrieving revision 1.8 diff -u -p -r1.8 amdpmvar.h --- sys/dev/pci/amdpmvar.h 14 Feb 2012 15:08:07 -0000 1.8 +++ sys/dev/pci/amdpmvar.h 26 Sep 2012 23:21:05 -0000 @@ -35,7 +35,7 @@ #include struct amdpm_softc { - struct device sc_dev; + device_t sc_dev; pci_chipset_tag_t sc_pc; pcitag_t sc_tag; Index: sys/dev/pci/atppc_puc.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/pci/atppc_puc.c,v retrieving revision 1.12 diff -u -p -r1.12 atppc_puc.c --- sys/dev/pci/atppc_puc.c 13 Nov 2010 13:52:05 -0000 1.12 +++ sys/dev/pci/atppc_puc.c 29 Sep 2012 12:50:03 -0000 @@ -159,11 +159,10 @@ atppc_puc_dma_setup(struct atppc_puc_sof /* Start DMA operation over PCI bus */ static int -atppc_puc_dma_start(struct atppc_softc *dev, void *buf, u_int nbytes, +atppc_puc_dma_start(struct atppc_softc *sc, void *buf, u_int nbytes, u_int8_t mode) { - struct atppc_puc_softc *psc = (struct atppc_puc_softc *) dev; - struct atppc_softc *sc = &psc->sc_atppc; + struct atppc_puc_softc *psc = (struct atppc_puc_softc *)sc; bus_dmamap_sync(sc->sc_dmat, psc->sc_dmamap, 0, nbytes, (mode == ATPPC_DMA_MODE_WRITE) ? BUS_DMASYNC_PREWRITE @@ -174,11 +173,10 @@ atppc_puc_dma_start(struct atppc_softc * /* Stop DMA operation over PCI bus */ static int -atppc_puc_dma_finish(struct atppc_softc *dev) +atppc_puc_dma_finish(struct atppc_softc *sc) { - struct atppc_puc_softc *psc = (struct atppc_puc_softc *) dev; - struct atppc_softc *sc = &psc->sc_atppc; + struct atppc_puc_softc *psc = (struct atppc_puc_softc *)sc; /* * We don't know direction of DMA, so sync both. We can safely Index: sys/dev/pci/auacer.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/pci/auacer.c,v retrieving revision 1.30 diff -u -p -r1.30 auacer.c --- sys/dev/pci/auacer.c 24 Nov 2011 03:35:58 -0000 1.30 +++ sys/dev/pci/auacer.c 26 Sep 2012 23:22:23 -0000 @@ -96,7 +96,7 @@ struct auacer_chan { }; struct auacer_softc { - struct device sc_dev; + device_t sc_dev; void *sc_ih; kmutex_t sc_lock; kmutex_t sc_intr_lock; @@ -260,6 +260,7 @@ auacer_attach(device_t parent, device_t int i; sc = device_private(self); + sc->sc_dev = self; pa = aux; aprint_normal(": Acer Labs M5455 Audio controller\n"); @@ -285,7 +286,7 @@ auacer_attach(device_t parent, device_t /* Map and establish the interrupt. */ if (pci_intr_map(pa, &ih)) { - aprint_error_dev(&sc->sc_dev, "can't map interrupt\n"); + aprint_error_dev(sc->sc_dev, "can't map interrupt\n"); mutex_destroy(&sc->sc_lock); mutex_destroy(&sc->sc_intr_lock); return; @@ -294,7 +295,7 @@ auacer_attach(device_t parent, device_t sc->sc_ih = pci_intr_establish(pa->pa_pc, ih, IPL_AUDIO, auacer_intr, sc); if (sc->sc_ih == NULL) { - aprint_error_dev(&sc->sc_dev, "can't establish interrupt"); + aprint_error_dev(sc->sc_dev, "can't establish interrupt"); if (intrstr != NULL) aprint_error(" at %s", intrstr); aprint_error("\n"); @@ -302,12 +303,12 @@ auacer_attach(device_t parent, device_t mutex_destroy(&sc->sc_intr_lock); return; } - aprint_normal_dev(&sc->sc_dev, "interrupting at %s\n", intrstr); + aprint_normal_dev(sc->sc_dev, "interrupting at %s\n", intrstr); strlcpy(sc->sc_audev.name, "M5455 AC97", MAX_AUDIO_DEV_LEN); snprintf(sc->sc_audev.version, MAX_AUDIO_DEV_LEN, "0x%02x", PCI_REVISION(pa->pa_class)); - strlcpy(sc->sc_audev.config, device_xname(&sc->sc_dev), MAX_AUDIO_DEV_LEN); + strlcpy(sc->sc_audev.config, device_xname(sc->sc_dev), MAX_AUDIO_DEV_LEN); /* Set up DMA lists. */ auacer_alloc_cdata(sc); @@ -358,13 +359,13 @@ auacer_attach(device_t parent, device_t mutex_spin_exit(&sc->sc_intr_lock); mutex_exit(&sc->sc_lock); - audio_attach_mi(&auacer_hw_if, sc, &sc->sc_dev); + audio_attach_mi(&auacer_hw_if, sc, sc->sc_dev); if (!pmf_device_register(self, NULL, auacer_resume)) aprint_error_dev(self, "couldn't establish power handler\n"); } -CFATTACH_DECL(auacer, sizeof(struct auacer_softc), +CFATTACH_DECL_NEW(auacer, sizeof(struct auacer_softc), auacer_match, auacer_attach, NULL, NULL); static int @@ -825,7 +826,7 @@ auacer_upd_chan(struct auacer_softc *sc, if (sts & ALI_SR_DMA_INT_FIFO) { printf("%s: fifo underrun # %u\n", - device_xname(&sc->sc_dev), ++chan->fifoe); + device_xname(sc->sc_dev), ++chan->fifoe); } civ = READ1(sc, chan->port + ALI_OFF_CIV); @@ -1004,7 +1005,7 @@ auacer_alloc_cdata(struct auacer_softc * if ((error = bus_dmamem_alloc(sc->dmat, sizeof(struct auacer_cdata), PAGE_SIZE, 0, &seg, 1, &rseg, 0)) != 0) { - aprint_error_dev(&sc->sc_dev, "unable to allocate control data, error = %d\n", + aprint_error_dev(sc->sc_dev, "unable to allocate control data, error = %d\n", error); goto fail_0; } @@ -1013,7 +1014,7 @@ auacer_alloc_cdata(struct auacer_softc * sizeof(struct auacer_cdata), (void **) &sc->sc_cdata, sc->sc_dmamap_flags)) != 0) { - aprint_error_dev(&sc->sc_dev, "unable to map control data, error = %d\n", + aprint_error_dev(sc->sc_dev, "unable to map control data, error = %d\n", error); goto fail_1; } @@ -1021,7 +1022,7 @@ auacer_alloc_cdata(struct auacer_softc * if ((error = bus_dmamap_create(sc->dmat, sizeof(struct auacer_cdata), 1, sizeof(struct auacer_cdata), 0, 0, &sc->sc_cddmamap)) != 0) { - aprint_error_dev(&sc->sc_dev, "unable to create control data DMA map, " + aprint_error_dev(sc->sc_dev, "unable to create control data DMA map, " "error = %d\n", error); goto fail_2; } @@ -1029,7 +1030,7 @@ auacer_alloc_cdata(struct auacer_softc * if ((error = bus_dmamap_load(sc->dmat, sc->sc_cddmamap, sc->sc_cdata, sizeof(struct auacer_cdata), NULL, 0)) != 0) { - aprint_error_dev(&sc->sc_dev, "unable to load control data DMA map, " + aprint_error_dev(sc->sc_dev, "unable to load control data DMA map, " "error = %d\n", error); goto fail_3; } Index: sys/dev/pci/auixp.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/pci/auixp.c,v retrieving revision 1.38 diff -u -p -r1.38 auixp.c --- sys/dev/pci/auixp.c 30 Jan 2012 19:41:18 -0000 1.38 +++ sys/dev/pci/auixp.c 26 Sep 2012 23:23:37 -0000 @@ -238,7 +238,7 @@ static const struct audio_hw_if auixp_hw }; -CFATTACH_DECL(auixp, sizeof(struct auixp_softc), auixp_match, auixp_attach, +CFATTACH_DECL_NEW(auixp, sizeof(struct auixp_softc), auixp_match, auixp_attach, auixp_detach, NULL); @@ -477,7 +477,7 @@ auixp_malloc(void *hdl, int direction, s error = auixp_allocmem(sc, size, 16, dma); if (error) { kmem_free(dma, sizeof(*dma)); - aprint_error_dev(&sc->sc_dev, "auixp_malloc: not enough memory\n"); + aprint_error_dev(sc->sc_dev, "auixp_malloc: not enough memory\n"); return NULL; } @@ -651,7 +651,7 @@ auixp_allocate_dma_chain(struct auixp_so error = auixp_allocmem(sc, DMA_DESC_CHAIN * sizeof(atiixp_dma_desc_t), 16, dma); if (error) { - aprint_error_dev(&sc->sc_dev, "can't malloc dma descriptor chain\n"); + aprint_error_dev(sc->sc_dev, "can't malloc dma descriptor chain\n"); kmem_free(dma, sizeof(*dma)); return ENOMEM; } @@ -699,9 +699,9 @@ auixp_dma_update(struct auixp_softc *sc, /* be very paranoid */ if (!dma) - panic("%s: update: dma = NULL", device_xname(&sc->sc_dev)); + panic("%s: update: dma = NULL", device_xname(sc->sc_dev)); if (!dma->intr) - panic("%s: update: dma->intr = NULL", device_xname(&sc->sc_dev)); + panic("%s: update: dma->intr = NULL", device_xname(sc->sc_dev)); /* request more input from upper layer */ (*dma->intr)(dma->intrarg); @@ -776,7 +776,7 @@ auixp_trigger_output(void *hdl, void *st /* not ours ? then bail out */ if (!sound_dma) { printf("%s: auixp_trigger_output: bad sound addr %p\n", - device_xname(&sc->sc_dev), start); + device_xname(sc->sc_dev), start); return EINVAL; } @@ -851,7 +851,7 @@ auixp_trigger_input(void *hdl, void *sta /* not ours ? then bail out */ if (!sound_dma) { printf("%s: auixp_trigger_input: bad sound addr %p\n", - device_xname(&sc->sc_dev), start); + device_xname(sc->sc_dev), start); return EINVAL; } @@ -921,7 +921,7 @@ auixp_intr(void *softc) return 0; } - DPRINTF(("%s: (status = %x)\n", device_xname(&sc->sc_dev), status)); + DPRINTF(("%s: (status = %x)\n", device_xname(sc->sc_dev), status)); /* check DMA UPDATE flags for input & output */ if (status & ATI_REG_ISR_IN_STATUS) { @@ -1103,6 +1103,7 @@ auixp_attach(device_t parent, device_t s int error; sc = device_private(self); + sc->sc_dev = self; pa = (struct pci_attach_args *)aux; tag = pa->pa_tag; pc = pa->pa_pc; @@ -1130,7 +1131,7 @@ auixp_attach(device_t parent, device_t s /* map memory; its not sized -> what is the size? max PCI slot size? */ if (pci_mapreg_map(pa, PCI_CBIO, PCI_MAPREG_TYPE_MEM, 0, &sc->sc_iot, &sc->sc_ioh, &sc->sc_iob, &sc->sc_ios)) { - aprint_error_dev(&sc->sc_dev, "can't map memory space\n"); + aprint_error_dev(sc->sc_dev, "can't map memory space\n"); return; } @@ -1156,7 +1157,7 @@ auixp_attach(device_t parent, device_t s /* map interrupt on the pci bus */ if (pci_intr_map(pa, &ih)) { - aprint_error_dev(&sc->sc_dev, "can't map interrupt\n"); + aprint_error_dev(sc->sc_dev, "can't map interrupt\n"); return; } @@ -1169,25 +1170,25 @@ auixp_attach(device_t parent, device_t s /* establish interrupt routine hookup at IPL_AUDIO level */ sc->sc_ih = pci_intr_establish(pc, ih, IPL_AUDIO, auixp_intr, self); if (sc->sc_ih == NULL) { - aprint_error_dev(&sc->sc_dev, "can't establish interrupt"); + aprint_error_dev(sc->sc_dev, "can't establish interrupt"); 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); /* power up chip */ if ((error = pci_activate(pa->pa_pc, pa->pa_tag, self, pci_activate_null)) && error != EOPNOTSUPP) { - aprint_error_dev(&sc->sc_dev, "cannot activate %d\n", + aprint_error_dev(sc->sc_dev, "cannot activate %d\n", error); return; } /* init chip */ if (auixp_init(sc) == -1) { - aprint_error_dev(&sc->sc_dev, "auixp_attach: unable to initialize the card\n"); + aprint_error_dev(sc->sc_dev, "auixp_attach: unable to initialize the card\n"); return; } @@ -1262,12 +1263,12 @@ auixp_post_config(device_t self) &sc->sc_encodings); if (res) { printf("%s: auconv_create_encodings failed; " - "no attachments\n", device_xname(&sc->sc_dev)); + "no attachments\n", device_xname(sc->sc_dev)); return; } if (sc->has_spdif) { - aprint_normal_dev(&sc->sc_dev, "codec spdif support detected but disabled " + aprint_normal_dev(sc->sc_dev, "codec spdif support detected but disabled " "for now\n"); sc->has_spdif = 0; } @@ -1291,7 +1292,7 @@ auixp_post_config(device_t self) for (codec_nr = 0; codec_nr < ATI_IXP_CODECS; codec_nr++) { codec = &sc->sc_codec[codec_nr]; if (codec->present) - audio_attach_mi(&auixp_hw_if, codec, &sc->sc_dev); + audio_attach_mi(&auixp_hw_if, codec, sc->sc_dev); } /* done! now enable all interrupts we can service */ @@ -1367,7 +1368,7 @@ auixp_detach(device_t self, int flags) auixp_disable_interrupts(sc); /* tear down .... */ - config_detach(&sc->sc_dev, flags); /* XXX OK? XXX */ + config_detach(sc->sc_dev, flags); /* XXX OK? XXX */ pmf_device_deregister(self); if (sc->sc_ih != NULL) @@ -1449,7 +1450,7 @@ auixp_read_codec(void *aux, uint8_t reg, if (reg < 0x7c) printf("%s: codec read timeout! (reg %x)\n", - device_xname(&sc->sc_dev), reg); + device_xname(sc->sc_dev), reg); return 0xffff; } @@ -1524,7 +1525,7 @@ auixp_wait_for_codecs(struct auixp_softc timeout--; } while (timeout > 0); - printf("%s: %s: timed out\n", func, device_xname(&sc->sc_dev)); + printf("%s: %s: timed out\n", func, device_xname(sc->sc_dev)); return -1; } @@ -1560,7 +1561,7 @@ auixp_autodetect_codecs(struct auixp_sof if (timeout == 0) printf("%s: WARNING: timeout during codec detection; " "codecs might be present but haven't interrupted\n", - device_xname(&sc->sc_dev)); + device_xname(sc->sc_dev)); /* disable all interrupts for now */ auixp_disable_interrupts(sc); @@ -1585,7 +1586,7 @@ auixp_autodetect_codecs(struct auixp_sof if (!(sc->sc_codec_not_ready_bits & ATI_REG_ISR_CODEC0_NOT_READY)) { /* codec 0 present */ DPRINTF(("auixp : YAY! codec 0 present!\n")); - if (ac97_attach(&sc->sc_codec[0].host_if, &sc->sc_dev, + if (ac97_attach(&sc->sc_codec[0].host_if, sc->sc_dev, &sc->sc_lock) == 0) sc->sc_num_codecs++; } @@ -1593,7 +1594,7 @@ auixp_autodetect_codecs(struct auixp_sof if (!(sc->sc_codec_not_ready_bits & ATI_REG_ISR_CODEC1_NOT_READY)) { /* codec 1 present */ DPRINTF(("auixp : YAY! codec 1 present!\n")); - if (ac97_attach(&sc->sc_codec[1].host_if, &sc->sc_dev, + if (ac97_attach(&sc->sc_codec[1].host_if, sc->sc_dev, &sc->sc_lock) == 0) sc->sc_num_codecs++; } @@ -1601,7 +1602,7 @@ auixp_autodetect_codecs(struct auixp_sof if (!(sc->sc_codec_not_ready_bits & ATI_REG_ISR_CODEC2_NOT_READY)) { /* codec 2 present */ DPRINTF(("auixp : YAY! codec 2 present!\n")); - if (ac97_attach(&sc->sc_codec[2].host_if, &sc->sc_dev, + if (ac97_attach(&sc->sc_codec[2].host_if, sc->sc_dev, &sc->sc_lock) == 0) sc->sc_num_codecs++; } @@ -1609,7 +1610,7 @@ auixp_autodetect_codecs(struct auixp_sof if (sc->sc_num_codecs == 0) { printf("%s: no codecs detected or " "no codecs managed to initialise\n", - device_xname(&sc->sc_dev)); + device_xname(sc->sc_dev)); return; } @@ -1668,7 +1669,7 @@ auixp_reset_aclink(struct auixp_softc *s /* if power is down, power it up */ value = bus_space_read_4(iot, ioh, ATI_REG_CMD); if (value & ATI_REG_CMD_POWERDOWN) { - printf("%s: powering up\n", device_xname(&sc->sc_dev)); + printf("%s: powering up\n", device_xname(sc->sc_dev)); /* explicitly enable power */ value &= ~ATI_REG_CMD_POWERDOWN; @@ -1678,7 +1679,7 @@ auixp_reset_aclink(struct auixp_softc *s DELAY(20); }; - printf("%s: soft resetting aclink\n", device_xname(&sc->sc_dev)); + printf("%s: soft resetting aclink\n", device_xname(sc->sc_dev)); /* perform a soft reset */ value = bus_space_read_4(iot, ioh, ATI_REG_CMD); @@ -1699,7 +1700,7 @@ auixp_reset_aclink(struct auixp_softc *s value = bus_space_read_4(iot, ioh, ATI_REG_CMD); while (!(value & ATI_REG_CMD_ACLINK_ACTIVE)) { printf("%s: not up; resetting aclink hardware\n", - device_xname(&sc->sc_dev)); + device_xname(sc->sc_dev)); /* dip aclink reset but keep the acsync */ value &= ~ATI_REG_CMD_AC_RESET; @@ -1723,11 +1724,11 @@ auixp_reset_aclink(struct auixp_softc *s }; if (timeout == 0) { - printf("%s: giving up aclink reset\n", device_xname(&sc->sc_dev)); + printf("%s: giving up aclink reset\n", device_xname(sc->sc_dev)); }; if (timeout != 10) { printf("%s: aclink hardware reset successful\n", - device_xname(&sc->sc_dev)); + device_xname(sc->sc_dev)); }; /* assert reset and sync for safety */ @@ -1797,7 +1798,7 @@ auixp_dumpreg(void) sc = static_sc; iot = sc->sc_iot; ioh = sc->sc_ioh; - printf("%s register dump:\n", device_xname(&sc->sc_dev)); + printf("%s register dump:\n", device_xname(sc->sc_dev)); for (i = 0; i < 256; i+=4) { printf("\t0x%02x: 0x%08x\n", i, bus_space_read_4(iot, ioh, i)); } Index: sys/dev/pci/auixpvar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/pci/auixpvar.h,v retrieving revision 1.7 diff -u -p -r1.7 auixpvar.h --- sys/dev/pci/auixpvar.h 23 Nov 2011 23:07:34 -0000 1.7 +++ sys/dev/pci/auixpvar.h 26 Sep 2012 23:22:42 -0000 @@ -96,7 +96,7 @@ struct auixp_codec { struct auixp_softc { - struct device sc_dev; + device_t sc_dev; kmutex_t sc_lock; kmutex_t sc_intr_lock; Index: sys/dev/pci/bha_pci.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/pci/bha_pci.c,v retrieving revision 1.37 diff -u -p -r1.37 bha_pci.c --- sys/dev/pci/bha_pci.c 26 Nov 2009 15:17:08 -0000 1.37 +++ sys/dev/pci/bha_pci.c 26 Sep 2012 18:37:43 -0000 @@ -97,6 +97,8 @@ bha_pci_attach(device_t parent, device_t pcireg_t csr; const char *model, *intrstr; + sc->sc_dev = self; + aprint_naive(": SCSI controller\n"); if (PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_BUSLOGIC_MULTIMASTER_NC) @@ -109,7 +111,7 @@ bha_pci_attach(device_t parent, device_t if (pci_mapreg_map(pa, PCI_CBIO, PCI_MAPREG_TYPE_IO, 0, &iot, &ioh, NULL, NULL)) { - aprint_error_dev(&sc->sc_dev, "unable to map device registers\n"); + aprint_error_dev(sc->sc_dev, "unable to map device registers\n"); return; } @@ -126,24 +128,24 @@ bha_pci_attach(device_t parent, device_t csr | PCI_COMMAND_MASTER_ENABLE | PCI_COMMAND_IO_ENABLE); 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(pc, ih); sc->sc_ih = pci_intr_establish(pc, ih, IPL_BIO, bha_intr, sc); if (sc->sc_ih == NULL) { - aprint_error_dev(&sc->sc_dev, "couldn't establish interrupt"); + aprint_error_dev(sc->sc_dev, "couldn't establish interrupt"); 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); bha_attach(sc); bha_disable_isacompat(sc); } -CFATTACH_DECL(bha_pci, sizeof(struct bha_softc), +CFATTACH_DECL_NEW(bha_pci, sizeof(struct bha_softc), bha_pci_match, bha_pci_attach, NULL, NULL); Index: sys/dev/pci/btvmei.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/pci/btvmei.c,v retrieving revision 1.28 diff -u -p -r1.28 btvmei.c --- sys/dev/pci/btvmei.c 30 Jan 2012 19:41:18 -0000 1.28 +++ sys/dev/pci/btvmei.c 26 Sep 2012 23:27:14 -0000 @@ -69,7 +69,7 @@ struct b3_617_vmeresc { int firstpage, maplen; }; -CFATTACH_DECL(btvmei, sizeof(struct b3_617_softc), +CFATTACH_DECL_NEW(btvmei, sizeof(struct b3_617_softc), b3_617_match, b3_617_attach, NULL, NULL); static int @@ -94,6 +94,7 @@ b3_617_attach(device_t parent, device_t const char *intrstr; struct vmebus_attach_args vaa; + sc->sc_dev = self; sc->sc_pc = pc; sc->sc_dmat = pa->pa_dmat; @@ -131,7 +132,7 @@ b3_617_attach(device_t parent, device_t /* Map and establish the interrupt. */ 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(pc, ih); @@ -141,13 +142,13 @@ b3_617_attach(device_t parent, device_t */ sc->sc_ih = pci_intr_establish(pc, ih, IPL_BIO, b3_617_intr, sc); if (sc->sc_ih == NULL) { - aprint_error_dev(&sc->sc_dev, "couldn't establish interrupt"); + aprint_error_dev(sc->sc_dev, "couldn't establish interrupt"); 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); if (b3_617_init(sc)) return; @@ -261,7 +262,7 @@ b3_617_reset(struct b3_617_softc *sc) /* reset sequence, ch 5.2 */ status = read_csr_byte(sc, LOC_STATUS); if (status & LSR_NO_CONNECT) { - printf("%s: not connected\n", device_xname(&sc->sc_dev)); + printf("%s: not connected\n", device_xname(sc->sc_dev)); return (-1); } status = read_csr_byte(sc, REM_STATUS); /* discard */ @@ -271,7 +272,7 @@ b3_617_reset(struct b3_617_softc *sc) char sbuf[sizeof(BIT3_LSR_BITS) + 64]; snprintb(sbuf, sizeof(sbuf), BIT3_LSR_BITS, status); - printf("%s: interface error, lsr=%s\n", device_xname(&sc->sc_dev), + printf("%s: interface error, lsr=%s\n", device_xname(sc->sc_dev), sbuf); return (-1); } @@ -531,7 +532,7 @@ b3_617_map_vmeint(void *vsc, int level, { if (!sc->sc_ih) { printf("%s: b3_617_map_vmeint: no IRQ\n", - device_xname(&sc->sc_dev)); + device_xname(sc->sc_dev)); return (ENXIO); } /* Index: sys/dev/pci/btvmeii.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/pci/btvmeii.c,v retrieving revision 1.21 diff -u -p -r1.21 btvmeii.c --- sys/dev/pci/btvmeii.c 30 Jun 2011 20:09:40 -0000 1.21 +++ sys/dev/pci/btvmeii.c 26 Sep 2012 23:27:44 -0000 @@ -103,7 +103,6 @@ struct b3_2706_vmeintrhand { }; struct b3_2706_softc { - struct device sc_dev; struct univ_pci_data univdata; bus_space_tag_t swapt, vmet; bus_space_handle_t swaph; @@ -121,7 +120,7 @@ struct b3_2706_softc { int strayintrs; }; -CFATTACH_DECL(btvmeii, sizeof(struct b3_2706_softc), +CFATTACH_DECL_NEW(btvmeii, sizeof(struct b3_2706_softc), b3_2706_match, b3_2706_attach, NULL, NULL); /* Index: sys/dev/pci/btvmeivar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/pci/btvmeivar.h,v retrieving revision 1.4 diff -u -p -r1.4 btvmeivar.h --- sys/dev/pci/btvmeivar.h 11 Dec 2005 12:22:48 -0000 1.4 +++ sys/dev/pci/btvmeivar.h 26 Sep 2012 23:26:23 -0000 @@ -37,7 +37,7 @@ struct b3_617_vmeintrhand { }; struct b3_617_softc { - struct device sc_dev; + device_t sc_dev; /* tags passed in from PCI */ pci_chipset_tag_t sc_pc; Index: sys/dev/pci/cac_pci.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/pci/cac_pci.c,v retrieving revision 1.32 diff -u -p -r1.32 cac_pci.c --- sys/dev/pci/cac_pci.c 26 Nov 2009 15:17:08 -0000 1.32 +++ sys/dev/pci/cac_pci.c 26 Sep 2012 18:37:43 -0000 @@ -151,6 +151,7 @@ cac_pci_attach(device_t parent, device_t aprint_naive(": RAID controller\n"); sc = device_private(self); + sc->sc_dev = self; pa = (struct pci_attach_args *)aux; pc = pa->pa_pc; ct = cac_pci_findtype(pa); @@ -218,7 +219,7 @@ cac_pci_attach(device_t parent, device_t cac_init(sc, intrstr, (ct->ct_flags & CT_STARTFW) != 0); } -CFATTACH_DECL(cac_pci, sizeof(struct cac_softc), +CFATTACH_DECL_NEW(cac_pci, sizeof(struct cac_softc), cac_pci_match, cac_pci_attach, NULL, NULL); static void @@ -244,7 +245,7 @@ cac_pci_l0_completed(struct cac_softc *s if ((off & 3) != 0) printf("%s: failed command list returned: %lx\n", - device_xname(&sc->sc_dv), (long)off); + device_xname(sc->sc_dev), (long)off); off = (off & ~3) - sc->sc_ccbs_paddr; ccb = (struct cac_ccb *)((char *)sc->sc_ccbs + off); Index: sys/dev/pci/ciss_pci.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/pci/ciss_pci.c,v retrieving revision 1.9 diff -u -p -r1.9 ciss_pci.c --- sys/dev/pci/ciss_pci.c 26 Nov 2009 15:17:08 -0000 1.9 +++ sys/dev/pci/ciss_pci.c 26 Sep 2012 23:28:26 -0000 @@ -44,7 +44,7 @@ __KERNEL_RCSID(0, "$NetBSD: ciss_pci.c,v int ciss_pci_match(device_t, cfdata_t, void *); void ciss_pci_attach(device_t, device_t, void *); -CFATTACH_DECL(ciss_pci, sizeof(struct ciss_softc), +CFATTACH_DECL_NEW(ciss_pci, sizeof(struct ciss_softc), ciss_pci_match, ciss_pci_attach, NULL, NULL); const struct { @@ -255,6 +255,8 @@ ciss_pci_attach(device_t parent, device_ pcireg_t reg = pci_conf_read(pa->pa_pc, pa->pa_tag, PCI_SUBSYS_ID_REG); int i; + sc->sc_dev = self; + for (i = 0; ciss_pci_devices[i].vendor; i++) { if ((PCI_VENDOR(pa->pa_id) == ciss_pci_devices[i].vendor && @@ -324,7 +326,7 @@ ciss_pci_attach(device_t parent, device_ intrstr = pci_intr_string(pa->pa_pc, ih); sc->sc_ih = pci_intr_establish(pa->pa_pc, ih, IPL_BIO, ciss_intr, sc); if (!sc->sc_ih) { - aprint_error_dev(&sc->sc_dev, "can't establish interrupt"); + aprint_error_dev(sc->sc_dev, "can't establish interrupt"); if (intrstr) aprint_error(" at %s", intrstr); aprint_error("\n"); @@ -333,8 +335,8 @@ ciss_pci_attach(device_t parent, device_ bus_space_unmap(sc->sc_iot, sc->cfg_ioh, cfgsz); } - printf("%s: interrupting at %s\n%s", device_xname(&sc->sc_dev), intrstr, - device_xname(&sc->sc_dev)); + printf("%s: interrupting at %s\n%s", device_xname(sc->sc_dev), intrstr, + device_xname(sc->sc_dev)); if (ciss_attach(sc)) { pci_intr_disestablish(pa->pa_pc, sc->sc_ih); Index: sys/dev/pci/cmpci.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/pci/cmpci.c,v retrieving revision 1.45 diff -u -p -r1.45 cmpci.c --- sys/dev/pci/cmpci.c 30 Jan 2012 19:41:18 -0000 1.45 +++ sys/dev/pci/cmpci.c 26 Sep 2012 23:30:13 -0000 @@ -109,7 +109,7 @@ static int cmpci_set_in_ports(struct cmp static int cmpci_match(device_t, cfdata_t, void *); static void cmpci_attach(device_t, device_t, void *); -CFATTACH_DECL(cmpci, sizeof (struct cmpci_softc), +CFATTACH_DECL_NEW(cmpci, sizeof (struct cmpci_softc), cmpci_match, cmpci_attach, NULL, NULL); /* interrupt */ @@ -384,6 +384,7 @@ cmpci_attach(device_t parent, device_t s int i, v; sc = device_private(self); + sc->sc_dev = self; pa = (struct pci_attach_args *)aux; sc->sc_id = pa->pa_id; @@ -405,7 +406,7 @@ cmpci_attach(device_t parent, device_t s /* map I/O space */ if (pci_mapreg_map(pa, CMPCI_PCI_IOBASEREG, PCI_MAPREG_TYPE_IO, 0, &sc->sc_iot, &sc->sc_ioh, NULL, NULL)) { - aprint_error_dev(&sc->sc_dev, "failed to map I/O space\n"); + aprint_error_dev(sc->sc_dev, "failed to map I/O space\n"); return; } @@ -414,14 +415,14 @@ cmpci_attach(device_t parent, device_t s /* interrupt */ if (pci_intr_map(pa, &ih)) { - aprint_error_dev(&sc->sc_dev, "failed to map interrupt\n"); + aprint_error_dev(sc->sc_dev, "failed to map interrupt\n"); return; } strintr = pci_intr_string(pa->pa_pc, ih); sc->sc_ih = pci_intr_establish(pa->pa_pc, ih, IPL_AUDIO, cmpci_intr, sc); if (sc->sc_ih == NULL) { - aprint_error_dev(&sc->sc_dev, "failed to establish interrupt"); + aprint_error_dev(sc->sc_dev, "failed to establish interrupt"); if (strintr != NULL) aprint_error(" at %s", strintr); aprint_error("\n"); @@ -429,17 +430,17 @@ cmpci_attach(device_t parent, device_t s mutex_destroy(&sc->sc_intr_lock); return; } - aprint_normal_dev(&sc->sc_dev, "interrupting at %s\n", strintr); + aprint_normal_dev(sc->sc_dev, "interrupting at %s\n", strintr); sc->sc_dmat = pa->pa_dmat; - audio_attach_mi(&cmpci_hw_if, sc, &sc->sc_dev); + audio_attach_mi(&cmpci_hw_if, sc, sc->sc_dev); /* attach OPL device */ aa.type = AUDIODEV_TYPE_OPL; aa.hwif = NULL; aa.hdl = NULL; - (void)config_found(&sc->sc_dev, &aa, audioprint); + (void)config_found(sc->sc_dev, &aa, audioprint); /* attach MPU-401 device */ aa.type = AUDIODEV_TYPE_MPU; @@ -447,7 +448,7 @@ cmpci_attach(device_t parent, device_t s aa.hdl = NULL; if (bus_space_subregion(sc->sc_iot, sc->sc_ioh, CMPCI_REG_MPU_BASE, CMPCI_REG_MPU_SIZE, &sc->sc_mpu_ioh) == 0) - sc->sc_mpudev = config_found(&sc->sc_dev, &aa, audioprint); + sc->sc_mpudev = config_found(sc->sc_dev, &aa, audioprint); /* get initial value (this is 0 and may be omitted but just in case) */ sc->sc_reg_misc = bus_space_read_4(sc->sc_iot, sc->sc_ioh, @@ -673,7 +674,7 @@ cmpci_set_params(void *handle, int setmo md_divide = cmpci_index_to_divider(md_index); p->sample_rate = cmpci_index_to_rate(md_index); DPRINTF(("%s: sample:%u, divider=%d\n", - device_xname(&sc->sc_dev), p->sample_rate, md_divide)); + device_xname(sc->sc_dev), p->sample_rate, md_divide)); ind = auconv_set_converter(cmpci_formats, CMPCI_NFORMATS, mode, p, FALSE, fil); Index: sys/dev/pci/cmpcivar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/pci/cmpcivar.h,v retrieving revision 1.11 diff -u -p -r1.11 cmpcivar.h --- sys/dev/pci/cmpcivar.h 23 Nov 2011 23:07:35 -0000 1.11 +++ sys/dev/pci/cmpcivar.h 26 Sep 2012 23:29:43 -0000 @@ -173,7 +173,7 @@ typedef struct cmpci_dmanode *cmpci_dmap * softc */ struct cmpci_softc { - struct device sc_dev; + device_t sc_dev; kmutex_t sc_lock; kmutex_t sc_intr_lock; @@ -216,7 +216,7 @@ struct cmpci_softc { bus_space_handle_t sc_ioh; bus_space_handle_t sc_mpu_ioh; - struct device *sc_mpudev; + device_t sc_mpudev; /* intr handle */ pci_intr_handle_t *sc_ih; Index: sys/dev/pci/cs4280.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/pci/cs4280.c,v retrieving revision 1.64 diff -u -p -r1.64 cs4280.c --- sys/dev/pci/cs4280.c 30 Jan 2012 19:41:18 -0000 1.64 +++ sys/dev/pci/cs4280.c 26 Sep 2012 23:32:20 -0000 @@ -206,7 +206,7 @@ static const struct midi_hw_if cs4280_mi }; #endif -CFATTACH_DECL(clcs, sizeof(struct cs428x_softc), +CFATTACH_DECL_NEW(clcs, sizeof(struct cs428x_softc), cs4280_match, cs4280_attach, NULL, NULL); static struct audio_device cs4280_device = { @@ -247,6 +247,7 @@ cs4280_attach(device_t parent, device_t int error; sc = device_private(self); + sc->sc_dev = self; pa = (struct pci_attach_args *)aux; pc = pa->pa_pc; @@ -257,15 +258,15 @@ cs4280_attach(device_t parent, device_t vendor = pci_findvendor(cs_card->id); product = pci_findproduct(cs_card->id); if (vendor == NULL) - aprint_normal_dev(&sc->sc_dev, + aprint_normal_dev(sc->sc_dev, "vendor 0x%04x product 0x%04x\n", PCI_VENDOR(cs_card->id), PCI_PRODUCT(cs_card->id)); else if (product == NULL) - aprint_normal_dev(&sc->sc_dev, "%s product 0x%04x\n", + aprint_normal_dev(sc->sc_dev, "%s product 0x%04x\n", vendor, PCI_PRODUCT(cs_card->id)); else - aprint_normal_dev(&sc->sc_dev, "%s %s\n", + aprint_normal_dev(sc->sc_dev, "%s %s\n", vendor, product); sc->sc_flags = cs_card->flags; } else { @@ -279,13 +280,13 @@ cs4280_attach(device_t parent, device_t if (pci_mapreg_map(pa, PCI_BA0, PCI_MAPREG_TYPE_MEM|PCI_MAPREG_MEM_TYPE_32BIT, 0, &sc->ba0t, &sc->ba0h, NULL, NULL)) { - aprint_error_dev(&sc->sc_dev, "can't map BA0 space\n"); + aprint_error_dev(sc->sc_dev, "can't map BA0 space\n"); return; } if (pci_mapreg_map(pa, PCI_BA1, PCI_MAPREG_TYPE_MEM|PCI_MAPREG_MEM_TYPE_32BIT, 0, &sc->ba1t, &sc->ba1h, NULL, NULL)) { - aprint_error_dev(&sc->sc_dev, "can't map BA1 space\n"); + aprint_error_dev(sc->sc_dev, "can't map BA1 space\n"); return; } @@ -294,7 +295,7 @@ cs4280_attach(device_t parent, device_t /* power up chip */ if ((error = pci_activate(pa->pa_pc, pa->pa_tag, self, pci_activate_null)) && error != EOPNOTSUPP) { - aprint_error_dev(&sc->sc_dev, "cannot activate %d\n", error); + aprint_error_dev(sc->sc_dev, "cannot activate %d\n", error); return; } @@ -316,7 +317,7 @@ cs4280_attach(device_t parent, device_t /* Map and establish the interrupt. */ if (pci_intr_map(pa, &sc->intrh)) { - 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(pc, sc->intrh); @@ -327,7 +328,7 @@ cs4280_attach(device_t parent, device_t sc->sc_ih = pci_intr_establish(sc->sc_pc, sc->intrh, IPL_AUDIO, cs4280_intr, sc); if (sc->sc_ih == NULL) { - aprint_error_dev(&sc->sc_dev, "couldn't establish interrupt"); + aprint_error_dev(sc->sc_dev, "couldn't establish interrupt"); if (intrstr != NULL) aprint_error(" at %s", intrstr); aprint_error("\n"); @@ -335,7 +336,7 @@ cs4280_attach(device_t parent, device_t mutex_destroy(&sc->sc_intr_lock); return; } - aprint_normal_dev(&sc->sc_dev, "interrupting at %s\n", intrstr); + aprint_normal_dev(sc->sc_dev, "interrupting at %s\n", intrstr); /* Initialization */ if(cs4280_init(sc, 1) != 0) { @@ -365,14 +366,14 @@ cs4280_attach(device_t parent, device_t #endif sc->host_if.flags = cs4280_flags_codec; if (ac97_attach(&sc->host_if, self, &sc->sc_lock) != 0) { - aprint_error_dev(&sc->sc_dev, "ac97_attach failed\n"); + aprint_error_dev(sc->sc_dev, "ac97_attach failed\n"); return; } - audio_attach_mi(&cs4280_hw_if, sc, &sc->sc_dev); + audio_attach_mi(&cs4280_hw_if, sc, sc->sc_dev); #if NMIDI > 0 - midi_attach_mi(&cs4280_midi_hw_if, sc, &sc->sc_dev); + midi_attach_mi(&cs4280_midi_hw_if, sc, sc->sc_dev); #endif if (!pmf_device_register(self, cs4280_suspend, cs4280_resume)) @@ -443,7 +444,7 @@ cs4280_intr(void *p) if (sc->sc_pn >= sc->sc_pe) sc->sc_pn = sc->sc_ps; } else { - aprint_error_dev(&sc->sc_dev, "unexpected play intr\n"); + aprint_error_dev(sc->sc_dev, "unexpected play intr\n"); } BA1WRITE4(sc, CS4280_PFIE, mem); } @@ -505,7 +506,7 @@ cs4280_intr(void *p) break; default: /* Should not reach here */ - aprint_error_dev(&sc->sc_dev, + aprint_error_dev(sc->sc_dev, "unknown sc->sc_rparam: %d\n", sc->sc_rparam); } @@ -518,7 +519,7 @@ cs4280_intr(void *p) if ((sc->sc_ri%(sc->sc_rcount)) == 0) sc->sc_rintr(sc->sc_rarg); } else { - aprint_error_dev(&sc->sc_dev, + aprint_error_dev(sc->sc_dev, "unexpected record intr\n"); } } @@ -1152,11 +1153,11 @@ cs4280_clkrun_hack_init(struct cs428x_so if (pci_find_device(&smbuspa, cs4280_piix4_match)) { sc->sc_active = 0; - aprint_normal_dev(&sc->sc_dev, "enabling CLKRUN hack\n"); + aprint_normal_dev(sc->sc_dev, "enabling CLKRUN hack\n"); reg = pci_conf_read(smbuspa.pa_pc, smbuspa.pa_tag, 0x40); port = reg & 0xffc0; - aprint_normal_dev(&sc->sc_dev, "power management port 0x%x\n", + aprint_normal_dev(sc->sc_dev, "power management port 0x%x\n", port); sc->sc_pm_iot = smbuspa.pa_iot; @@ -1167,7 +1168,7 @@ cs4280_clkrun_hack_init(struct cs428x_so /* handle error */ sc->sc_flags &= ~CS428X_FLAG_CLKRUNHACK; - aprint_normal_dev(&sc->sc_dev, "disabling CLKRUN hack\n"); + aprint_normal_dev(sc->sc_dev, "disabling CLKRUN hack\n"); } static void @@ -1382,7 +1383,7 @@ cs4280_download_image(struct cs428x_soft BA1Struct.memory[idx].offset, BA1Struct.memory[idx].size); if (err != 0) { - aprint_error_dev(&sc->sc_dev, + aprint_error_dev(sc->sc_dev, "load_image failed at %d\n", idx); return -1; } @@ -1475,7 +1476,7 @@ cs4280_init(struct cs428x_softc *sc, int while ((BA0READ4(sc, CS428X_ACSTS) & ACSTS_CRDY) == 0) { delay(125); if (++n > 1000) { - aprint_error_dev(&sc->sc_dev, "codec ready timeout\n"); + aprint_error_dev(sc->sc_dev, "codec ready timeout\n"); goto exit; } } @@ -1502,7 +1503,7 @@ cs4280_init(struct cs428x_softc *sc, int /* Download the image to the processor */ if (cs4280_download_image(sc) != 0) { - aprint_error_dev(&sc->sc_dev, "image download error\n"); + aprint_error_dev(sc->sc_dev, "image download error\n"); goto exit; } @@ -1744,7 +1745,7 @@ cs4280_check_images(struct cs428x_softc BA1Struct.memory[idx].offset, BA1Struct.memory[idx].size); if (err != 0) { - aprint_error_dev(&sc->sc_dev, + aprint_error_dev(sc->sc_dev, "check_image failed at %d\n", idx); } offset += BA1Struct.memory[idx].size / sizeof(uint32_t); Index: sys/dev/pci/cs4281.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/pci/cs4281.c,v retrieving revision 1.47 diff -u -p -r1.47 cs4281.c --- sys/dev/pci/cs4281.c 30 Jan 2012 19:41:19 -0000 1.47 +++ sys/dev/pci/cs4281.c 26 Sep 2012 23:32:40 -0000 @@ -158,7 +158,7 @@ static const struct midi_hw_if cs4281_mi }; #endif -CFATTACH_DECL(clct, sizeof(struct cs428x_softc), +CFATTACH_DECL_NEW(clct, sizeof(struct cs428x_softc), cs4281_match, cs4281_attach, NULL, NULL); static struct audio_device cs4281_device = { @@ -192,6 +192,7 @@ cs4281_attach(device_t parent, device_t int error; sc = device_private(self); + sc->sc_dev = self; pa = (struct pci_attach_args *)aux; pc = pa->pa_pc; @@ -204,13 +205,13 @@ cs4281_attach(device_t parent, device_t if (pci_mapreg_map(pa, PCI_BA0, PCI_MAPREG_TYPE_MEM|PCI_MAPREG_MEM_TYPE_32BIT, 0, &sc->ba0t, &sc->ba0h, NULL, NULL)) { - aprint_error_dev(&sc->sc_dev, "can't map BA0 space\n"); + aprint_error_dev(sc->sc_dev, "can't map BA0 space\n"); return; } if (pci_mapreg_map(pa, PCI_BA1, PCI_MAPREG_TYPE_MEM|PCI_MAPREG_MEM_TYPE_32BIT, 0, &sc->ba1t, &sc->ba1h, NULL, NULL)) { - aprint_error_dev(&sc->sc_dev, "can't map BA1 space\n"); + aprint_error_dev(sc->sc_dev, "can't map BA1 space\n"); return; } @@ -219,7 +220,7 @@ cs4281_attach(device_t parent, device_t /* power up chip */ if ((error = pci_activate(pa->pa_pc, pa->pa_tag, self, pci_activate_null)) && error != EOPNOTSUPP) { - aprint_error_dev(&sc->sc_dev, "cannot activate %d\n", error); + aprint_error_dev(sc->sc_dev, "cannot activate %d\n", error); return; } @@ -240,7 +241,7 @@ cs4281_attach(device_t parent, device_t /* Map and establish the interrupt. */ if (pci_intr_map(pa, &sc->intrh)) { - 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(pc, sc->intrh); @@ -251,7 +252,7 @@ cs4281_attach(device_t parent, device_t sc->sc_ih = pci_intr_establish(sc->sc_pc, sc->intrh, IPL_AUDIO, cs4281_intr, sc); if (sc->sc_ih == NULL) { - aprint_error_dev(&sc->sc_dev, "couldn't establish interrupt"); + aprint_error_dev(sc->sc_dev, "couldn't establish interrupt"); if (intrstr != NULL) aprint_error(" at %s", intrstr); aprint_error("\n"); @@ -259,7 +260,7 @@ cs4281_attach(device_t parent, device_t mutex_destroy(&sc->sc_intr_lock); return; } - aprint_normal_dev(&sc->sc_dev, "interrupting at %s\n", intrstr); + aprint_normal_dev(sc->sc_dev, "interrupting at %s\n", intrstr); /* * Sound System start-up @@ -285,15 +286,15 @@ cs4281_attach(device_t parent, device_t sc->host_if.write = cs428x_write_codec; sc->host_if.reset = cs4281_reset_codec; if (ac97_attach(&sc->host_if, self, &sc->sc_lock) != 0) { - aprint_error_dev(&sc->sc_dev, "ac97_attach failed\n"); + aprint_error_dev(sc->sc_dev, "ac97_attach failed\n"); mutex_destroy(&sc->sc_lock); mutex_destroy(&sc->sc_intr_lock); return; } - audio_attach_mi(&cs4281_hw_if, sc, &sc->sc_dev); + audio_attach_mi(&cs4281_hw_if, sc, sc->sc_dev); #if NMIDI > 0 && 0 - midi_attach_mi(&cs4281_midi_hw_if, sc, &sc->sc_dev); + midi_attach_mi(&cs4281_midi_hw_if, sc, sc->sc_dev); #endif if (!pmf_device_register(self, cs4281_suspend, cs4281_resume)) @@ -356,7 +357,7 @@ cs4281_intr(void *p) if (sc->sc_pn >= sc->sc_pe) sc->sc_pn = sc->sc_ps; } else { - aprint_error_dev(&sc->sc_dev, "unexpected play intr\n"); + aprint_error_dev(sc->sc_dev, "unexpected play intr\n"); } } if (intr & HISR_DMA1) { @@ -376,7 +377,7 @@ cs4281_intr(void *p) if ((sc->sc_ri % sc->sc_rcount) == 0) sc->sc_rintr(sc->sc_rarg); } else { - aprint_error_dev(&sc->sc_dev, + aprint_error_dev(sc->sc_dev, "unexpected record intr\n"); } } @@ -858,7 +859,7 @@ cs4281_reset_codec(void *addr) do { delay(1000); if (++n > 1000) { - aprint_error_dev(&sc->sc_dev, + aprint_error_dev(sc->sc_dev, "timeout waiting for codec ready\n"); return ETIMEDOUT; } @@ -873,7 +874,7 @@ cs4281_reset_codec(void *addr) do { delay(1); if (++n > 1000) { - aprint_error_dev(&sc->sc_dev, + aprint_error_dev(sc->sc_dev, "timeout waiting for codec calibration\n"); return ETIMEDOUT; } @@ -889,7 +890,7 @@ cs4281_reset_codec(void *addr) do { delay(1000); if (++n > 1000) { - aprint_error_dev(&sc->sc_dev, "timeout waiting for " + aprint_error_dev(sc->sc_dev, "timeout waiting for " "sampled input slots as valid\n"); return ETIMEDOUT; } @@ -1016,7 +1017,7 @@ cs4281_init(struct cs428x_softc *sc, int != (CLKCR1_DLLRDY | CLKCR1_CLKON)) { delay(100); if (++n > 1000) { - aprint_error_dev(&sc->sc_dev, + aprint_error_dev(sc->sc_dev, "timeout waiting for clock stabilization\n"); return -1; } @@ -1026,7 +1027,7 @@ cs4281_init(struct cs428x_softc *sc, int while (!(BA0READ4(sc, CS4281_CLKCR1) & CLKCR1_DLLRDY)) { delay(1000); if (++n > 1000) { - aprint_error_dev(&sc->sc_dev, + aprint_error_dev(sc->sc_dev, "timeout waiting for clock stabilization\n"); return -1; } @@ -1041,7 +1042,7 @@ cs4281_init(struct cs428x_softc *sc, int while ((BA0READ4(sc, CS428X_ACSTS) & ACSTS_CRDY) == 0) { delay(100); if (++n > 1000) { - aprint_error_dev(&sc->sc_dev, + aprint_error_dev(sc->sc_dev, "timeout waiting for codec ready\n"); return -1; } @@ -1053,7 +1054,7 @@ cs4281_init(struct cs428x_softc *sc, int while ((BA0READ4(sc, CS4281_ACSTS2) & ACSTS2_CRDY2) == 0) { delay(100); if (++n > 1000) { - aprint_error_dev(&sc->sc_dev, + aprint_error_dev(sc->sc_dev, "timeout waiting for secondary codec ready\n"); return -1; } @@ -1069,7 +1070,7 @@ cs4281_init(struct cs428x_softc *sc, int do { delay(1000); if (++n > 1000) { - aprint_error_dev(&sc->sc_dev, + aprint_error_dev(sc->sc_dev, "timeout waiting for codec ready\n"); return -1; } @@ -1084,7 +1085,7 @@ cs4281_init(struct cs428x_softc *sc, int do { delay(1); if (++n > 1000) { - aprint_error_dev(&sc->sc_dev, + aprint_error_dev(sc->sc_dev, "timeout waiting for codec calibration\n"); return -1; } @@ -1100,7 +1101,7 @@ cs4281_init(struct cs428x_softc *sc, int do { delay(1000); if (++n > 1000) { - aprint_error_dev(&sc->sc_dev, "timeout waiting for " + aprint_error_dev(sc->sc_dev, "timeout waiting for " "sampled input slots as valid\n"); return -1; } Index: sys/dev/pci/cs428x.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/pci/cs428x.c,v retrieving revision 1.16 diff -u -p -r1.16 cs428x.c --- sys/dev/pci/cs428x.c 23 Nov 2011 23:07:35 -0000 1.16 +++ sys/dev/pci/cs428x.c 27 Sep 2012 00:12:29 -0000 @@ -244,7 +244,7 @@ cs428x_read_codec(void *addr, uint8_t ac if (cs428x_src_wait(sc) < 0) { printf("%s: AC97 read prob. (DCV!=0) for add=0x%0x\n", - device_xname(&sc->sc_dev), ac97_addr); + device_xname(sc->sc_dev), ac97_addr); return 1; } @@ -254,7 +254,7 @@ cs428x_read_codec(void *addr, uint8_t ac delay(1); while (++n > 1000) { printf("%s: AC97 read fail (VSTS==0) for add=0x%0x\n", - device_xname(&sc->sc_dev), ac97_addr); + device_xname(sc->sc_dev), ac97_addr); return 1; } } @@ -282,7 +282,7 @@ cs428x_write_codec(void *addr, uint8_t a if (cs428x_src_wait(sc) < 0) { printf("%s: AC97 write fail (DCV!=0) for add=0x%02x data=" - "0x%04x\n", device_xname(&sc->sc_dev), ac97_addr, ac97_data); + "0x%04x\n", device_xname(sc->sc_dev), ac97_addr, ac97_data); return 1; } return 0; @@ -306,7 +306,7 @@ cs428x_allocmem(struct cs428x_softc *sc, p->segs, sizeof(p->segs)/sizeof(p->segs[0]), &p->nsegs, BUS_DMA_WAITOK); if (error) { - aprint_error_dev(&sc->sc_dev, "unable to allocate DMA. error=%d\n", + aprint_error_dev(sc->sc_dev, "unable to allocate DMA. error=%d\n", error); goto allfree; } @@ -314,7 +314,7 @@ cs428x_allocmem(struct cs428x_softc *sc, error = bus_dmamem_map(sc->sc_dmatag, p->segs, p->nsegs, p->size, &p->addr, BUS_DMA_WAITOK|BUS_DMA_COHERENT); if (error) { - aprint_error_dev(&sc->sc_dev, "unable to map DMA, error=%d\n", + aprint_error_dev(sc->sc_dev, "unable to map DMA, error=%d\n", error); goto free; } @@ -322,7 +322,7 @@ cs428x_allocmem(struct cs428x_softc *sc, error = bus_dmamap_create(sc->sc_dmatag, p->size, 1, p->size, 0, BUS_DMA_WAITOK, &p->map); if (error) { - aprint_error_dev(&sc->sc_dev, "unable to create DMA map, error=%d\n", + aprint_error_dev(sc->sc_dev, "unable to create DMA map, error=%d\n", error); goto unmap; } @@ -330,7 +330,7 @@ cs428x_allocmem(struct cs428x_softc *sc, error = bus_dmamap_load(sc->sc_dmatag, p->map, p->addr, p->size, NULL, BUS_DMA_WAITOK); if (error) { - aprint_error_dev(&sc->sc_dev, "unable to load DMA map, error=%d\n", + aprint_error_dev(sc->sc_dev, "unable to load DMA map, error=%d\n", error); goto destroy; } Index: sys/dev/pci/cs428x.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/pci/cs428x.h,v retrieving revision 1.15 diff -u -p -r1.15 cs428x.h --- sys/dev/pci/cs428x.h 23 Nov 2011 23:07:35 -0000 1.15 +++ sys/dev/pci/cs428x.h 26 Sep 2012 23:31:48 -0000 @@ -72,7 +72,7 @@ enum cs428x_flags { * Software state */ struct cs428x_softc { - struct device sc_dev; + device_t sc_dev; kmutex_t sc_lock; kmutex_t sc_intr_lock; Index: sys/dev/pci/cxdtv.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/pci/cxdtv.c,v retrieving revision 1.11 diff -u -p -r1.11 cxdtv.c --- sys/dev/pci/cxdtv.c 30 Jan 2012 19:41:19 -0000 1.11 +++ sys/dev/pci/cxdtv.c 2 Oct 2012 02:34:27 -0000 @@ -61,11 +61,11 @@ __KERNEL_RCSID(0, "$NetBSD: cxdtv.c,v 1. #define CXDTV_SRAM_CH_MPEG 0 #define CXDTV_TS_PKTSIZE (188 * 8) -static int cxdtv_match(struct device *, struct cfdata *, void *); -static void cxdtv_attach(struct device *, struct device *, void *); -static int cxdtv_detach(struct device *, int); -static int cxdtv_rescan(struct device *, const char *, const int *); -static void cxdtv_childdet(struct device *, struct device *); +static int cxdtv_match(device_t, cfdata_t, void *); +static void cxdtv_attach(device_t, device_t, void *); +static int cxdtv_detach(device_t, int); +static int cxdtv_rescan(device_t, const char *, const int *); +static void cxdtv_childdet(device_t, device_t); static int cxdtv_intr(void *); static bool cxdtv_resume(device_t, const pmf_qual_t *); Index: sys/dev/pci/cz.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/pci/cz.c,v retrieving revision 1.55 diff -u -p -r1.55 cz.c --- sys/dev/pci/cz.c 24 Apr 2011 16:27:00 -0000 1.55 +++ sys/dev/pci/cz.c 26 Sep 2012 23:35:28 -0000 @@ -150,7 +150,7 @@ struct cztty_softc { * Per-board state. */ struct cz_softc { - struct device cz_dev; /* generic device info */ + device_t cz_dev; /* generic device info */ struct plx9060_config cz_plx; /* PLX 9060 config info */ bus_space_tag_t cz_win_st; /* window space tag */ bus_space_handle_t cz_win_sh; /* window space handle */ @@ -295,19 +295,20 @@ cz_attach(device_t parent, device_t self aprint_naive(": Multi-port serial controller\n"); aprint_normal(": Cyclades-Z multiport serial\n"); + cz->cz_dev = self; cz->cz_plx.plx_pc = pa->pa_pc; cz->cz_plx.plx_tag = pa->pa_tag; if (pci_mapreg_map(pa, PLX_PCI_RUNTIME_MEMADDR, PCI_MAPREG_TYPE_MEM|PCI_MAPREG_MEM_TYPE_32BIT, 0, &cz->cz_plx.plx_st, &cz->cz_plx.plx_sh, NULL, NULL) != 0) { - aprint_error_dev(&cz->cz_dev, "unable to map PLX registers\n"); + aprint_error_dev(cz->cz_dev, "unable to map PLX registers\n"); return; } if (pci_mapreg_map(pa, PLX_PCI_LOCAL_ADDR0, PCI_MAPREG_TYPE_MEM|PCI_MAPREG_MEM_TYPE_32BIT, 0, &cz->cz_win_st, &cz->cz_win_sh, NULL, NULL) != 0) { - aprint_error_dev(&cz->cz_dev, "unable to map device window\n"); + aprint_error_dev(cz->cz_dev, "unable to map device window\n"); return; } @@ -346,13 +347,13 @@ cz_attach(device_t parent, device_t self cz_intr, cz); } if (cz->cz_ih == NULL) { - aprint_error_dev(&cz->cz_dev, "unable to establish interrupt"); + aprint_error_dev(cz->cz_dev, "unable to establish interrupt"); if (intrstr != NULL) aprint_error(" at %s", intrstr); aprint_error("\n"); /* We will fall-back on polling mode. */ } else - aprint_normal_dev(&cz->cz_dev, "interrupting at %s\n", + aprint_normal_dev(cz->cz_dev, "interrupting at %s\n", intrstr); polling_mode: @@ -360,7 +361,7 @@ cz_attach(device_t parent, device_t self callout_init(&cz->cz_callout, 0); if (cz_timeout_ticks == 0) cz_timeout_ticks = max(1, hz * CZ_POLL_MS / 1000); - aprint_normal_dev(&cz->cz_dev, "polling mode, %d ms interval (%d tick%s)\n", + aprint_normal_dev(cz->cz_dev, "polling mode, %d ms interval (%d tick%s)\n", CZ_POLL_MS, cz_timeout_ticks, cz_timeout_ticks == 1 ? "" : "s"); } @@ -396,7 +397,7 @@ cz_attach(device_t parent, device_t self if (bus_space_subregion(cz->cz_win_st, cz->cz_win_sh, cz->cz_fwctl + ZFIRM_CHNCTL_OFF(i, 0), ZFIRM_CHNCTL_SIZE, &sc->sc_chan_sh)) { - aprint_error_dev(&cz->cz_dev, + aprint_error_dev(cz->cz_dev, "unable to subregion channel %d control\n", i); sc->sc_channel = CZTTY_CHANNEL_DEAD; continue; @@ -404,7 +405,7 @@ cz_attach(device_t parent, device_t self if (bus_space_subregion(cz->cz_win_st, cz->cz_win_sh, cz->cz_fwctl + ZFIRM_BUFCTL_OFF(i, 0), ZFIRM_BUFCTL_SIZE, &sc->sc_buf_sh)) { - aprint_error_dev(&cz->cz_dev, + aprint_error_dev(cz->cz_dev, "unable to subregion channel %d buffer\n", i); sc->sc_channel = CZTTY_CHANNEL_DEAD; continue; @@ -414,7 +415,7 @@ cz_attach(device_t parent, device_t self tp = tty_alloc(); tp->t_dev = makedev(cdevsw_lookup_major(&cz_cdevsw), - (device_unit(&cz->cz_dev) * ZFIRM_MAX_CHANNELS) + i); + (device_unit(cz->cz_dev) * ZFIRM_MAX_CHANNELS) + i); tp->t_oproc = czttystart; tp->t_param = czttyparam; tty_attach(tp); @@ -435,7 +436,7 @@ cz_attach(device_t parent, device_t self } } -CFATTACH_DECL(cz, sizeof(struct cz_softc), +CFATTACH_DECL_NEW(cz, sizeof(struct cz_softc), cz_match, cz_attach, NULL, NULL); #if 0 @@ -485,7 +486,7 @@ cz_load_firmware(struct cz_softc *cz) /* Find the config header. */ if (le32toh(zfh->zfh_configoff) & (sizeof(u_int32_t) - 1)) { - aprint_error_dev(&cz->cz_dev, "bad ZFIRM config offset: 0x%x\n", + aprint_error_dev(cz->cz_dev, "bad ZFIRM config offset: 0x%x\n", le32toh(zfh->zfh_configoff)); return (EIO); } @@ -500,7 +501,7 @@ cz_load_firmware(struct cz_softc *cz) break; } if (i == nconfigs) { - aprint_error_dev(&cz->cz_dev, "unable to locate config header\n"); + aprint_error_dev(cz->cz_dev, "unable to locate config header\n"); return (EIO); } @@ -518,7 +519,7 @@ cz_load_firmware(struct cz_softc *cz) #endif ) { #ifdef CZ_DEBUG - aprint_debug_dev(&cz->cz_dev, "Loading FPGA..."); + aprint_debug_dev(cz->cz_dev, "Loading FPGA..."); #endif CZ_WIN_FPGA(cz); for (i = 0; i < nblocks; i++) { @@ -569,7 +570,7 @@ cz_load_firmware(struct cz_softc *cz) CZ_WIN_RAM(cz); #ifdef CZ_DEBUG - aprint_debug_dev(&cz->cz_dev, "waiting for MIPS to start"); + aprint_debug_dev(cz->cz_dev, "waiting for MIPS to start"); #endif for (i = 0; i < 100; i++) { fid = bus_space_read_4(cz->cz_win_st, cz->cz_win_sh, @@ -582,7 +583,7 @@ cz_load_firmware(struct cz_softc *cz) * The MIPS has halted, usually due to a power * shortage on the expansion module. */ - aprint_error_dev(&cz->cz_dev, "MIPS halted; possible power supply " + aprint_error_dev(cz->cz_dev, "MIPS halted; possible power supply " "problem\n"); return (EIO); } else { @@ -598,10 +599,10 @@ cz_load_firmware(struct cz_softc *cz) #endif if (i == 100) { CZ_WIN_FPGA(cz); - aprint_error_dev(&cz->cz_dev, + aprint_error_dev(cz->cz_dev, "MIPS failed to start; wanted 0x%08x got 0x%08x\n", ZFIRM_SIG, fid); - aprint_error_dev(&cz->cz_dev, "FPGA ID 0x%08x, FPGA version 0x%08x\n", + aprint_error_dev(cz->cz_dev, "FPGA ID 0x%08x, FPGA version 0x%08x\n", CZ_FPGA_READ(cz, FPGA_ID), CZ_FPGA_READ(cz, FPGA_VERSION)); return (EIO); @@ -613,7 +614,7 @@ cz_load_firmware(struct cz_softc *cz) cz->cz_fwctl = bus_space_read_4(cz->cz_win_st, cz->cz_win_sh, ZFIRM_CTRLADDR_OFF); #ifdef CZ_DEBUG - aprint_debug_dev(&cz->cz_dev, "FWCTL structure at offset " + aprint_debug_dev(cz->cz_dev, "FWCTL structure at offset " "%#08" PRIxPADDR "\n", cz->cz_fwctl); #endif @@ -641,7 +642,7 @@ cz_load_firmware(struct cz_softc *cz) } fid = CZ_FWCTL_READ(cz, BRDCTL_FWVERSION); - aprint_normal_dev(&cz->cz_dev, "%s, ", board); + aprint_normal_dev(cz->cz_dev, "%s, ", board); if (cz->cz_nchannels == 0) aprint_normal("no channels attached, "); else @@ -700,7 +701,7 @@ cz_intr(void *arg) if (cz->cz_ports == NULL) { #ifdef CZ_DEBUG printf("%s: interrupt on channel %d, but no channels\n", - device_xname(&cz->cz_dev), channel); + device_xname(cz->cz_dev), channel); #endif continue; } @@ -720,7 +721,7 @@ cz_intr(void *arg) if (!ISSET(tp->t_state, TS_ISOPEN)) { #ifdef CZ_DEBUG printf("%s: tx intr on closed channel %d\n", - device_xname(&cz->cz_dev), channel); + device_xname(cz->cz_dev), channel); #endif break; } @@ -811,7 +812,7 @@ cz_intr(void *arg) default: #ifdef CZ_DEBUG printf("%s: channel %d: Unknown interrupt 0x%x\n", - device_xname(&cz->cz_dev), sc->sc_channel, command); + device_xname(cz->cz_dev), sc->sc_channel, command); #endif break; } @@ -926,7 +927,7 @@ cztty_shutdown(struct cztty_softc *sc) if ((--cz->cz_nopenchan == 0) && (cz->cz_ih == NULL)) { #ifdef CZ_DEBUG - printf("%s: Disabling polling\n", device_xname(&cz->cz_dev)); + printf("%s: Disabling polling\n", device_xname(cz->cz_dev)); #endif callout_stop(&cz->cz_callout); } @@ -973,7 +974,7 @@ czttyopen(dev_t dev, int flags, int mode if ((cz->cz_nopenchan++ == 0) && (cz->cz_ih == NULL)) { #ifdef CZ_DEBUG printf("%s: Enabling polling.\n", - device_xname(&cz->cz_dev)); + device_xname(cz->cz_dev)); #endif callout_reset(&cz->cz_callout, cz_timeout_ticks, cz_poll, cz); @@ -1526,7 +1527,7 @@ cztty_diag(void *arg) log(LOG_WARNING, "%s: channel %d: %u overflow%s, %u parity, %u framing error%s\n", - device_xname(&cz->cz_dev), sc->sc_channel, + device_xname(cz->cz_dev), sc->sc_channel, overflows, overflows == 1 ? "" : "s", parity_errors, framing_errors, framing_errors == 1 ? "" : "s"); @@ -1581,7 +1582,7 @@ cztty_transmit(struct cztty_softc *sc, s error = q_to_b(&tp->t_outq, 0, move); if (error != move) { printf("%s: channel %d: error moving to " - "transmit buf\n", device_xname(&cz->cz_dev), + "transmit buf\n", device_xname(cz->cz_dev), sc->sc_channel); move = error; } Index: sys/dev/pci/dpt_pci.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/pci/dpt_pci.c,v retrieving revision 1.25 diff -u -p -r1.25 dpt_pci.c --- sys/dev/pci/dpt_pci.c 26 Nov 2009 15:17:09 -0000 1.25 +++ sys/dev/pci/dpt_pci.c 26 Sep 2012 18:37:43 -0000 @@ -59,7 +59,7 @@ __KERNEL_RCSID(0, "$NetBSD: dpt_pci.c,v static int dpt_pci_match(device_t, cfdata_t, void *); static void dpt_pci_attach(device_t, device_t, void *); -CFATTACH_DECL(dpt_pci, sizeof(struct dpt_softc), +CFATTACH_DECL_NEW(dpt_pci, sizeof(struct dpt_softc), dpt_pci_match, dpt_pci_attach, NULL, NULL); static int @@ -90,6 +90,7 @@ dpt_pci_attach(device_t parent, device_t aprint_naive(": Storage controller\n"); sc = device_private(self); + sc->sc_dev = self; pa = (struct pci_attach_args *)aux; pc = pa->pa_pc; aprint_normal(": "); @@ -130,7 +131,7 @@ dpt_pci_attach(device_t parent, device_t /* Read the EATA configuration. */ if (dpt_readcfg(sc)) { - aprint_error_dev(&sc->sc_dv, "readcfg failed - see dpt(4)\n"); + aprint_error_dev(sc->sc_dev, "readcfg failed - see dpt(4)\n"); return; } Index: sys/dev/pci/esavar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/pci/esavar.h,v retrieving revision 1.11 diff -u -p -r1.11 esavar.h --- sys/dev/pci/esavar.h 23 Nov 2011 23:07:35 -0000 1.11 +++ sys/dev/pci/esavar.h 2 Oct 2012 02:24:11 -0000 @@ -116,7 +116,7 @@ struct esa_softc struct ac97_host_if host_if; enum ac97_host_flags codec_flags; - struct device *sc_audiodev[ESA_NUM_VOICES]; + device_t sc_audiodev[ESA_NUM_VOICES]; struct esa_voice voice[ESA_NUM_VOICES]; struct esa_dma *sc_dmas; Index: sys/dev/pci/eso.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/pci/eso.c,v retrieving revision 1.61 diff -u -p -r1.61 eso.c --- sys/dev/pci/eso.c 12 Aug 2012 18:39:32 -0000 1.61 +++ sys/dev/pci/eso.c 28 Sep 2012 20:48:13 -0000 @@ -127,7 +127,7 @@ static void eso_attach(device_t, device_ static void eso_defer(device_t); static int eso_print(void *, const char *); -CFATTACH_DECL(eso, sizeof (struct eso_softc), +CFATTACH_DECL_NEW(eso, sizeof (struct eso_softc), eso_match, eso_attach, NULL, NULL); /* PCI interface */ @@ -264,6 +264,7 @@ eso_attach(device_t parent, device_t sel uint8_t a2mode, mvctl; sc = device_private(self); + sc->sc_dev = self; pa = aux; aprint_naive(": Audio controller\n"); @@ -281,29 +282,29 @@ eso_attach(device_t parent, device_t sel /* Map I/O registers. */ if (pci_mapreg_map(pa, ESO_PCI_BAR_IO, PCI_MAPREG_TYPE_IO, 0, &sc->sc_iot, &sc->sc_ioh, NULL, NULL)) { - aprint_error_dev(&sc->sc_dev, "can't map I/O space\n"); + aprint_error_dev(sc->sc_dev, "can't map I/O space\n"); return; } if (pci_mapreg_map(pa, ESO_PCI_BAR_SB, PCI_MAPREG_TYPE_IO, 0, &sc->sc_sb_iot, &sc->sc_sb_ioh, NULL, NULL)) { - aprint_error_dev(&sc->sc_dev, "can't map SB I/O space\n"); + aprint_error_dev(sc->sc_dev, "can't map SB I/O space\n"); return; } if (pci_mapreg_map(pa, ESO_PCI_BAR_VC, PCI_MAPREG_TYPE_IO, 0, &sc->sc_dmac_iot, &sc->sc_dmac_ioh, &vcbase, &sc->sc_vcsize)) { - aprint_error_dev(&sc->sc_dev, "can't map VC I/O space\n"); + aprint_error_dev(sc->sc_dev, "can't map VC I/O space\n"); /* Don't bail out yet: we can map it later, see below. */ vcbase = 0; sc->sc_vcsize = 0x10; /* From the data sheet. */ } if (pci_mapreg_map(pa, ESO_PCI_BAR_MPU, PCI_MAPREG_TYPE_IO, 0, &sc->sc_mpu_iot, &sc->sc_mpu_ioh, NULL, NULL)) { - aprint_error_dev(&sc->sc_dev, "can't map MPU I/O space\n"); + aprint_error_dev(sc->sc_dev, "can't map MPU I/O space\n"); return; } if (pci_mapreg_map(pa, ESO_PCI_BAR_GAME, PCI_MAPREG_TYPE_IO, 0, &sc->sc_game_iot, &sc->sc_game_ioh, NULL, NULL)) { - aprint_error_dev(&sc->sc_dev, "can't map Game I/O space\n"); + aprint_error_dev(sc->sc_dev, "can't map Game I/O space\n"); return; } @@ -321,7 +322,7 @@ eso_attach(device_t parent, device_t sel error = eso_reset(sc); mutex_spin_exit(&sc->sc_intr_lock); if (error != 0) { - aprint_error_dev(&sc->sc_dev, "can't reset\n"); + aprint_error_dev(sc->sc_dev, "can't reset\n"); return; } @@ -388,14 +389,14 @@ eso_attach(device_t parent, device_t sel /* Map and establish the interrupt. */ 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; } intrstring = pci_intr_string(pa->pa_pc, ih); sc->sc_ih = pci_intr_establish(pa->pa_pc, ih, IPL_AUDIO, eso_intr, sc); if (sc->sc_ih == NULL) { - aprint_error_dev(&sc->sc_dev, "couldn't establish interrupt"); + aprint_error_dev(sc->sc_dev, "couldn't establish interrupt"); if (intrstring != NULL) aprint_error(" at %s", intrstring); aprint_error("\n"); @@ -403,7 +404,7 @@ eso_attach(device_t parent, device_t sel mutex_destroy(&sc->sc_intr_lock); return; } - aprint_normal_dev(&sc->sc_dev, "interrupting at %s\n", + aprint_normal_dev(sc->sc_dev, "interrupting at %s\n", intrstring); cv_init(&sc->sc_pcv, "esoho"); @@ -430,27 +431,27 @@ eso_attach(device_t parent, device_t sel vcbase | ESO_PCI_DDMAC_DE); sc->sc_dmac_configured = 1; - aprint_normal_dev(&sc->sc_dev, + aprint_normal_dev(sc->sc_dev, "mapping Audio 1 DMA using VC I/O space at 0x%lx\n", (unsigned long)vcbase); } else { DPRINTF(("%s: VC I/O space at 0x%lx not suitable, deferring\n", - device_xname(&sc->sc_dev), (unsigned long)vcbase)); + device_xname(sc->sc_dev), (unsigned long)vcbase)); sc->sc_pa = *pa; config_defer(self, eso_defer); } - audio_attach_mi(&eso_hw_if, sc, &sc->sc_dev); + audio_attach_mi(&eso_hw_if, sc, sc->sc_dev); aa.type = AUDIODEV_TYPE_OPL; aa.hwif = NULL; aa.hdl = NULL; - (void)config_found(&sc->sc_dev, &aa, audioprint); + (void)config_found(sc->sc_dev, &aa, audioprint); aa.type = AUDIODEV_TYPE_MPU; aa.hwif = NULL; aa.hdl = NULL; - sc->sc_mpudev = config_found(&sc->sc_dev, &aa, audioprint); + sc->sc_mpudev = config_found(sc->sc_dev, &aa, audioprint); if (sc->sc_mpudev != NULL) { /* Unmask the MPU irq. */ mutex_spin_enter(&sc->sc_intr_lock); @@ -463,7 +464,7 @@ eso_attach(device_t parent, device_t sel aa.type = AUDIODEV_TYPE_AUX; aa.hwif = NULL; aa.hdl = NULL; - (void)config_found(&sc->sc_dev, &aa, eso_print); + (void)config_found(sc->sc_dev, &aa, eso_print); } static void @@ -475,7 +476,7 @@ eso_defer(device_t self) sc = device_private(self); pa = &sc->sc_pa; - aprint_normal_dev(&sc->sc_dev, ""); + aprint_normal_dev(sc->sc_dev, ""); /* * This is outright ugly, but since we must not make assumptions @@ -537,7 +538,7 @@ eso_write_cmd(struct eso_softc *sc, uint } } - printf("%s: WDR timeout\n", device_xname(&sc->sc_dev)); + printf("%s: WDR timeout\n", device_xname(sc->sc_dev)); return; } @@ -568,7 +569,7 @@ eso_read_rdr(struct eso_softc *sc) } } - printf("%s: RDR timeout\n", device_xname(&sc->sc_dev)); + printf("%s: RDR timeout\n", device_xname(sc->sc_dev)); return (-1); } @@ -704,7 +705,7 @@ eso_reset(struct eso_softc *sc) } } - printf("%s: reset timeout\n", device_xname(&sc->sc_dev)); + printf("%s: reset timeout\n", device_xname(sc->sc_dev)); return -1; } @@ -856,7 +857,7 @@ eso_halt_output(void *hdl) int error; sc = hdl; - DPRINTF(("%s: halt_output\n", device_xname(&sc->sc_dev))); + DPRINTF(("%s: halt_output\n", device_xname(sc->sc_dev))); /* * Disable auto-initialize DMA, allowing the FIFO to drain and then @@ -897,7 +898,7 @@ eso_halt_input(void *hdl) int error; sc = hdl; - DPRINTF(("%s: halt_input\n", device_xname(&sc->sc_dev))); + DPRINTF(("%s: halt_input\n", device_xname(sc->sc_dev))); /* Just like eso_halt_output(), but for Audio 1. */ eso_write_ctlreg(sc, ESO_CTLREG_A1C2, @@ -1633,7 +1634,7 @@ eso_kva2dma(const struct eso_softc *sc, return p; } - panic("%s: kva2dma: bad kva: %p", sc->sc_dev.dv_xname, kva); + panic("%s: kva2dma: bad kva: %p", device_xname(sc->sc_dev), kva); /* NOTREACHED */ } @@ -1764,15 +1765,15 @@ eso_trigger_output(void *hdl, void *star sc = hdl; DPRINTF(( "%s: trigger_output: start %p, end %p, blksize %d, intr %p(%p)\n", - device_xname(&sc->sc_dev), start, end, blksize, intr, arg)); + device_xname(sc->sc_dev), start, end, blksize, intr, arg)); DPRINTF(("%s: param: rate %u, encoding %u, precision %u, channels %u\n", - device_xname(&sc->sc_dev), param->sample_rate, param->encoding, + device_xname(sc->sc_dev), param->sample_rate, param->encoding, param->precision, param->channels)); /* Find DMA buffer. */ ed = eso_kva2dma(sc, start); DPRINTF(("%s: dmaaddr %lx\n", - device_xname(&sc->sc_dev), (unsigned long)DMAADDR(ed))); + device_xname(sc->sc_dev), (unsigned long)DMAADDR(ed))); sc->sc_pintr = intr; sc->sc_parg = arg; @@ -1835,9 +1836,9 @@ eso_trigger_input(void *hdl, void *start sc = hdl; DPRINTF(( "%s: trigger_input: start %p, end %p, blksize %d, intr %p(%p)\n", - device_xname(&sc->sc_dev), start, end, blksize, intr, arg)); + device_xname(sc->sc_dev), start, end, blksize, intr, arg)); DPRINTF(("%s: param: rate %u, encoding %u, precision %u, channels %u\n", - device_xname(&sc->sc_dev), param->sample_rate, param->encoding, + device_xname(sc->sc_dev), param->sample_rate, param->encoding, param->precision, param->channels)); /* @@ -1850,7 +1851,7 @@ eso_trigger_input(void *hdl, void *start /* Find DMA buffer. */ ed = eso_kva2dma(sc, start); DPRINTF(("%s: dmaaddr %lx\n", - device_xname(&sc->sc_dev), (unsigned long)DMAADDR(ed))); + device_xname(sc->sc_dev), (unsigned long)DMAADDR(ed))); sc->sc_rintr = intr; sc->sc_rarg = arg; Index: sys/dev/pci/esovar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/pci/esovar.h,v retrieving revision 1.10 diff -u -p -r1.10 esovar.h --- sys/dev/pci/esovar.h 23 Nov 2011 23:07:35 -0000 1.10 +++ sys/dev/pci/esovar.h 26 Sep 2012 23:36:13 -0000 @@ -85,7 +85,7 @@ * Software state */ struct eso_softc { - struct device sc_dev; + device_t sc_dev; kmutex_t sc_lock; kmutex_t sc_intr_lock; Index: sys/dev/pci/fms.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/pci/fms.c,v retrieving revision 1.40 diff -u -p -r1.40 fms.c --- sys/dev/pci/fms.c 24 Nov 2011 03:35:59 -0000 1.40 +++ sys/dev/pci/fms.c 26 Sep 2012 23:37:38 -0000 @@ -99,7 +99,7 @@ static int fms_trigger_input(void *, voi const audio_params_t *); static void fms_get_locks(void *, kmutex_t **, kmutex_t **); -CFATTACH_DECL(fms, sizeof (struct fms_softc), +CFATTACH_DECL_NEW(fms, sizeof (struct fms_softc), fms_match, fms_attach, NULL, NULL); static struct audio_device fms_device = { @@ -235,6 +235,7 @@ fms_attach(device_t parent, device_t sel pa = aux; sc = device_private(self); + sc->sc_dev = self; intrstr = NULL; pc = pa->pa_pc; pt = pa->pa_tag; @@ -243,7 +244,7 @@ fms_attach(device_t parent, device_t sel if (pci_mapreg_map(pa, 0x10, PCI_MAPREG_TYPE_IO, 0, &sc->sc_iot, &sc->sc_ioh, &sc->sc_ioaddr, &sc->sc_iosize)) { - aprint_error_dev(&sc->sc_dev, "can't map i/o space\n"); + aprint_error_dev(sc->sc_dev, "can't map i/o space\n"); return; } if (bus_space_subregion(sc->sc_iot, sc->sc_ioh, 0x30, 2, @@ -254,7 +255,7 @@ fms_attach(device_t parent, device_t sel panic("fms_attach: can't get opl subregion handle"); 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(pc, ih); @@ -264,7 +265,7 @@ fms_attach(device_t parent, device_t sel sc->sc_ih = pci_intr_establish(pc, ih, IPL_AUDIO, fms_intr, sc); if (sc->sc_ih == NULL) { - aprint_error_dev(&sc->sc_dev, "couldn't establish interrupt"); + aprint_error_dev(sc->sc_dev, "couldn't establish interrupt"); if (intrstr != NULL) aprint_error(" at %s", intrstr); aprint_error("\n"); @@ -275,7 +276,7 @@ fms_attach(device_t parent, device_t sel sc->sc_dmat = pa->pa_dmat; - aprint_normal_dev(&sc->sc_dev, "interrupting at %s\n", intrstr); + aprint_normal_dev(sc->sc_dev, "interrupting at %s\n", intrstr); /* Disable legacy audio (SBPro compatibility) */ pci_conf_write(pc, pt, 0x40, 0); @@ -314,17 +315,17 @@ fms_attach(device_t parent, device_t sel return; } - audio_attach_mi(&fms_hw_if, sc, &sc->sc_dev); + audio_attach_mi(&fms_hw_if, sc, sc->sc_dev); aa.type = AUDIODEV_TYPE_OPL; aa.hwif = NULL; aa.hdl = NULL; - config_found(&sc->sc_dev, &aa, audioprint); + config_found(sc->sc_dev, &aa, audioprint); aa.type = AUDIODEV_TYPE_MPU; aa.hwif = NULL; aa.hdl = NULL; - sc->sc_mpu_dev = config_found(&sc->sc_dev, &aa, audioprint); + sc->sc_mpu_dev = config_found(sc->sc_dev, &aa, audioprint); } /* @@ -690,27 +691,27 @@ fms_malloc(void *addr, int direction, si p->size = size; if ((error = bus_dmamem_alloc(sc->sc_dmat, size, PAGE_SIZE, 0, &p->seg, 1, &rseg, BUS_DMA_WAITOK)) != 0) { - aprint_error_dev(&sc->sc_dev, "unable to allocate DMA, error = %d\n", error); + aprint_error_dev(sc->sc_dev, "unable to allocate DMA, error = %d\n", error); goto fail_alloc; } if ((error = bus_dmamem_map(sc->sc_dmat, &p->seg, rseg, size, &p->addr, BUS_DMA_WAITOK | BUS_DMA_COHERENT)) != 0) { - aprint_error_dev(&sc->sc_dev, "unable to map DMA, error = %d\n", + aprint_error_dev(sc->sc_dev, "unable to map DMA, error = %d\n", error); goto fail_map; } if ((error = bus_dmamap_create(sc->sc_dmat, size, 1, size, 0, BUS_DMA_WAITOK, &p->map)) != 0) { - aprint_error_dev(&sc->sc_dev, "unable to create DMA map, error = %d\n", + aprint_error_dev(sc->sc_dev, "unable to create DMA map, error = %d\n", error); goto fail_create; } if ((error = bus_dmamap_load(sc->sc_dmat, p->map, p->addr, size, NULL, BUS_DMA_WAITOK)) != 0) { - aprint_error_dev(&sc->sc_dev, "unable to load DMA map, error = %d\n", + aprint_error_dev(sc->sc_dev, "unable to load DMA map, error = %d\n", error); goto fail_load; } Index: sys/dev/pci/fmsvar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/pci/fmsvar.h,v retrieving revision 1.6 diff -u -p -r1.6 fmsvar.h --- sys/dev/pci/fmsvar.h 23 Nov 2011 23:07:35 -0000 1.6 +++ sys/dev/pci/fmsvar.h 26 Sep 2012 23:37:15 -0000 @@ -34,7 +34,7 @@ #define _DEV_PCI_FMSVAR_H_ struct fms_softc { - struct device sc_dev; + device_t sc_dev; void *sc_ih; kmutex_t sc_lock; kmutex_t sc_intr_lock; Index: sys/dev/pci/gtp.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/pci/gtp.c,v retrieving revision 1.18 diff -u -p -r1.18 gtp.c --- sys/dev/pci/gtp.c 30 Jan 2012 19:41:19 -0000 1.18 +++ sys/dev/pci/gtp.c 26 Sep 2012 23:38:15 -0000 @@ -93,8 +93,6 @@ static const struct radio_hw_if gtp_hw_i }; struct gtp_softc { - struct device sc_dev; - int mute; u_int8_t vol; u_int32_t freq; @@ -104,7 +102,7 @@ struct gtp_softc { struct tea5757_t tea; }; -CFATTACH_DECL(gtp, sizeof(struct gtp_softc), +CFATTACH_DECL_NEW(gtp, sizeof(struct gtp_softc), gtp_match, gtp_attach, NULL, NULL); static void gtp_set_mute(struct gtp_softc *); @@ -143,7 +141,7 @@ gtp_attach(device_t parent, device_t sel { struct gtp_softc *sc = device_private(self); struct pci_attach_args *pa = aux; - cfdata_t cf = device_cfdata(&sc->sc_dev); + cfdata_t cf = device_cfdata(self); pci_chipset_tag_t pc = pa->pa_pc; bus_size_t iosize; pcireg_t csr; @@ -176,7 +174,7 @@ gtp_attach(device_t parent, device_t sel aprint_normal(": Gemtek PR103\n"); - radio_attach_mi(>p_hw_if, sc, &sc->sc_dev); + radio_attach_mi(>p_hw_if, sc, self); } static int Index: sys/dev/pci/hifn7751.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/pci/hifn7751.c,v retrieving revision 1.50 diff -u -p -r1.50 hifn7751.c --- sys/dev/pci/hifn7751.c 2 Feb 2012 19:43:04 -0000 1.50 +++ sys/dev/pci/hifn7751.c 9 Oct 2012 01:02:34 -0000 @@ -101,7 +101,7 @@ static int hifn_probe(device_t, cfdata_t #endif static void hifn_attach(device_t, device_t, void *); -CFATTACH_DECL(hifn, sizeof(struct hifn_softc), +CFATTACH_DECL_NEW(hifn, sizeof(struct hifn_softc), hifn_probe, hifn_attach, NULL, NULL); #ifdef __OpenBSD__ @@ -256,6 +256,7 @@ hifn_attach(device_t parent, device_t se pci_aprint_devinfo_fancy(pa, "Crypto processor", hp->hifn_name, 1); + sc->sc_dv = self; sc->sc_pci_pc = pa->pa_pc; sc->sc_pci_tag = pa->pa_tag; @@ -267,13 +268,13 @@ hifn_attach(device_t parent, device_t se if (pci_mapreg_map(pa, HIFN_BAR0, PCI_MAPREG_TYPE_MEM, 0, &sc->sc_st0, &sc->sc_sh0, NULL, &iosize0)) { - aprint_error_dev(&sc->sc_dv, "can't map mem space %d\n", 0); + aprint_error_dev(sc->sc_dv, "can't map mem space %d\n", 0); return; } if (pci_mapreg_map(pa, HIFN_BAR1, PCI_MAPREG_TYPE_MEM, 0, &sc->sc_st1, &sc->sc_sh1, NULL, &iosize1)) { - aprint_error_dev(&sc->sc_dv, "can't find mem space %d\n", 1); + aprint_error_dev(sc->sc_dv, "can't find mem space %d\n", 1); goto fail_io0; } @@ -287,26 +288,26 @@ hifn_attach(device_t parent, device_t se sc->sc_dmat = pa->pa_dmat; if (bus_dmamem_alloc(sc->sc_dmat, sizeof(*sc->sc_dma), PAGE_SIZE, 0, &seg, 1, &rseg, BUS_DMA_NOWAIT)) { - aprint_error_dev(&sc->sc_dv, "can't alloc DMA buffer\n"); + aprint_error_dev(sc->sc_dv, "can't alloc DMA buffer\n"); goto fail_io1; } if (bus_dmamem_map(sc->sc_dmat, &seg, rseg, sizeof(*sc->sc_dma), &kva, BUS_DMA_NOWAIT)) { - aprint_error_dev(&sc->sc_dv, "can't map DMA buffers (%lu bytes)\n", + aprint_error_dev(sc->sc_dv, "can't map DMA buffers (%lu bytes)\n", (u_long)sizeof(*sc->sc_dma)); bus_dmamem_free(sc->sc_dmat, &seg, rseg); goto fail_io1; } if (bus_dmamap_create(sc->sc_dmat, sizeof(*sc->sc_dma), 1, sizeof(*sc->sc_dma), 0, BUS_DMA_NOWAIT, &dmamap)) { - aprint_error_dev(&sc->sc_dv, "can't create DMA map\n"); + aprint_error_dev(sc->sc_dv, "can't create DMA map\n"); bus_dmamem_unmap(sc->sc_dmat, kva, sizeof(*sc->sc_dma)); bus_dmamem_free(sc->sc_dmat, &seg, rseg); goto fail_io1; } if (bus_dmamap_load(sc->sc_dmat, dmamap, kva, sizeof(*sc->sc_dma), NULL, BUS_DMA_NOWAIT)) { - aprint_error_dev(&sc->sc_dv, "can't load DMA map\n"); + aprint_error_dev(sc->sc_dv, "can't load DMA map\n"); bus_dmamap_destroy(sc->sc_dmat, dmamap); bus_dmamem_unmap(sc->sc_dmat, kva, sizeof(*sc->sc_dma)); bus_dmamem_free(sc->sc_dmat, &seg, rseg); @@ -319,7 +320,7 @@ hifn_attach(device_t parent, device_t se hifn_reset_board(sc, 0); if ((hifncap = hifn_enable_crypto(sc, pa->pa_id)) == NULL) { - aprint_error_dev(&sc->sc_dv, "crypto enabling failed\n"); + aprint_error_dev(sc->sc_dv, "crypto enabling failed\n"); goto fail_mem; } hifn_reset_puc(sc); @@ -348,18 +349,18 @@ hifn_attach(device_t parent, device_t se sc->sc_ramsize >>= 1; if (pci_intr_map(pa, &ih)) { - aprint_error_dev(&sc->sc_dv, "couldn't map interrupt\n"); + aprint_error_dev(sc->sc_dv, "couldn't map interrupt\n"); goto fail_mem; } intrstr = pci_intr_string(pc, ih); #ifdef __OpenBSD__ sc->sc_ih = pci_intr_establish(pc, ih, IPL_NET, hifn_intr, sc, - self->dv_xname); + device_xname(self)); #else sc->sc_ih = pci_intr_establish(pc, ih, IPL_NET, hifn_intr, sc); #endif if (sc->sc_ih == NULL) { - aprint_error_dev(&sc->sc_dv, "couldn't establish interrupt\n"); + aprint_error_dev(sc->sc_dv, "couldn't establish interrupt\n"); if (intrstr != NULL) aprint_error(" at %s", intrstr); aprint_error("\n"); @@ -374,13 +375,13 @@ hifn_attach(device_t parent, device_t se rbase = 'M'; rseg /= 1024; } - aprint_normal_dev(&sc->sc_dv, "%s, %d%cB %cRAM, interrupting at %s\n", + aprint_normal_dev(sc->sc_dv, "%s, %d%cB %cRAM, interrupting at %s\n", hifncap, rseg, rbase, sc->sc_drammodel ? 'D' : 'S', intrstr); sc->sc_cid = crypto_get_driverid(0); if (sc->sc_cid < 0) { - aprint_error_dev(&sc->sc_dv, "couldn't get crypto driver id\n"); + aprint_error_dev(sc->sc_dv, "couldn't get crypto driver id\n"); goto fail_intr; } @@ -467,7 +468,7 @@ hifn_init_pubrng(struct hifn_softc *sc) if (i == 100) { printf("%s: public key init failed\n", - device_xname(&sc->sc_dv)); + device_xname(sc->sc_dv)); return (1); } } @@ -510,7 +511,7 @@ hifn_init_pubrng(struct hifn_softc *sc) * XXX as entropy, which is not a good idea since * XXX we add data periodically from a callout. */ - rnd_attach_source(&sc->sc_rnd_source, device_xname(&sc->sc_dv), + rnd_attach_source(&sc->sc_rnd_source, device_xname(sc->sc_dv), RND_TYPE_RNG, RND_FLAG_NO_ESTIMATE); #endif @@ -556,7 +557,7 @@ hifn_rng(void *vsc) sts = READ_REG_1(sc, HIFN_1_7811_RNGSTS); if (sts & HIFN_7811_RNGSTS_UFL) { printf("%s: RNG underflow: disabling\n", - device_xname(&sc->sc_dv)); + device_xname(sc->sc_dv)); return; } if ((sts & HIFN_7811_RNGSTS_RDY) == 0) @@ -665,7 +666,7 @@ hifn_puc_wait(struct hifn_softc *sc) break; } if (!i) - printf("%s: proc unit did not reset\n", device_xname(&sc->sc_dv)); + printf("%s: proc unit did not reset\n", device_xname(sc->sc_dv)); } /* @@ -834,7 +835,7 @@ hifn_enable_crypto(struct hifn_softc *sc if (offtbl == NULL) { #ifdef HIFN_DEBUG - aprint_debug_dev(&sc->sc_dv, "Unknown card!\n"); + aprint_debug_dev(sc->sc_dv, "Unknown card!\n"); #endif return (NULL); } @@ -856,14 +857,14 @@ hifn_enable_crypto(struct hifn_softc *sc */ if (encl == HIFN_PUSTAT_ENA_1 || encl == HIFN_PUSTAT_ENA_2) { #ifdef HIFN_DEBUG - aprint_debug_dev(&sc->sc_dv, "Strong Crypto already enabled!\n"); + aprint_debug_dev(sc->sc_dv, "Strong Crypto already enabled!\n"); #endif goto report; } if (encl != 0 && encl != HIFN_PUSTAT_ENA_0) { #ifdef HIFN_DEBUG - aprint_debug_dev(&sc->sc_dv, "Unknown encryption level\n"); + aprint_debug_dev(sc->sc_dv, "Unknown encryption level\n"); #endif return (NULL); } @@ -1215,7 +1216,7 @@ hifn_writeramaddr(struct hifn_softc *sc, if (r == 0) { printf("%s: writeramaddr -- " "result[%d](addr %d) still valid\n", - device_xname(&sc->sc_dv), resi, addr); + device_xname(sc->sc_dv), resi, addr); r = -1; return (-1); } else @@ -1279,7 +1280,7 @@ hifn_readramaddr(struct hifn_softc *sc, if (r == 0) { printf("%s: readramaddr -- " "result[%d](addr %d) still valid\n", - device_xname(&sc->sc_dv), resi, addr); + device_xname(sc->sc_dv), resi, addr); r = -1; } else { r = 0; @@ -1701,7 +1702,7 @@ hifn_crypto(struct hifn_softc *sc, struc #ifdef HIFN_DEBUG if (hifn_debug) printf("%s: Entering cmd: stat %8x ien %8x u %d/%d/%d/%d n %d/%d\n", - device_xname(&sc->sc_dv), + device_xname(sc->sc_dv), READ_REG_1(sc, HIFN_1_DMA_CSR), READ_REG_1(sc, HIFN_1_DMA_IER), dma->cmdu, dma->srcu, dma->dstu, dma->resu, @@ -1831,7 +1832,7 @@ hifn_crypto(struct hifn_softc *sc, struc #ifdef HIFN_DEBUG if (hifn_debug) printf("%s: command: stat %8x ier %8x\n", - device_xname(&sc->sc_dv), + device_xname(sc->sc_dv), READ_REG_1(sc, HIFN_1_DMA_CSR), READ_REG_1(sc, HIFN_1_DMA_IER)); #endif @@ -1911,7 +1912,7 @@ hifn_intr(void *arg) #ifdef HIFN_DEBUG if (hifn_debug) printf("%s: irq: stat %08x ien %08x u %d/%d/%d/%d\n", - device_xname(&sc->sc_dv), + device_xname(sc->sc_dv), dmacsr, READ_REG_1(sc, HIFN_1_DMA_IER), dma->cmdu, dma->srcu, dma->dstu, dma->resu); #endif @@ -1932,19 +1933,19 @@ hifn_intr(void *arg) restart = dmacsr & (HIFN_DMACSR_R_OVER | HIFN_DMACSR_D_OVER); if (restart) - printf("%s: overrun %x\n", device_xname(&sc->sc_dv), dmacsr); + printf("%s: overrun %x\n", device_xname(sc->sc_dv), dmacsr); if (sc->sc_flags & HIFN_IS_7811) { if (dmacsr & HIFN_DMACSR_ILLR) - printf("%s: illegal read\n", device_xname(&sc->sc_dv)); + printf("%s: illegal read\n", device_xname(sc->sc_dv)); if (dmacsr & HIFN_DMACSR_ILLW) - printf("%s: illegal write\n", device_xname(&sc->sc_dv)); + printf("%s: illegal write\n", device_xname(sc->sc_dv)); } restart = dmacsr & (HIFN_DMACSR_C_ABORT | HIFN_DMACSR_S_ABORT | HIFN_DMACSR_D_ABORT | HIFN_DMACSR_R_ABORT); if (restart) { - printf("%s: abort, resetting.\n", device_xname(&sc->sc_dv)); + printf("%s: abort, resetting.\n", device_xname(sc->sc_dv)); hifnstats.hst_abort++; hifn_abort(sc); return (1); @@ -2106,7 +2107,7 @@ hifn_newsession(void *arg, u_int32_t *si if ((comp && mac) || (comp && cry)) return (EINVAL); - *sidp = HIFN_SID(device_unit(&sc->sc_dv), i); + *sidp = HIFN_SID(device_unit(sc->sc_dv), i); sc->sc_sessions[i].hs_state = HS_STATE_USED; return (0); @@ -2385,7 +2386,7 @@ hifn_process(void *arg, struct cryptop * */ #ifdef HIFN_DEBUG if (hifn_debug) - printf("%s: requeue request\n", device_xname(&sc->sc_dv)); + printf("%s: requeue request\n", device_xname(sc->sc_dv)); #endif free(cmd, M_DEVBUF); sc->sc_needwakeup |= CRYPTO_SYMQ; Index: sys/dev/pci/hifn7751var.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/pci/hifn7751var.h,v retrieving revision 1.8 diff -u -p -r1.8 hifn7751var.h --- sys/dev/pci/hifn7751var.h 19 Nov 2011 22:51:23 -0000 1.8 +++ sys/dev/pci/hifn7751var.h 26 Sep 2012 23:38:26 -0000 @@ -137,7 +137,7 @@ struct hifn_session { * Holds data specific to a single HIFN board. */ struct hifn_softc { - struct device sc_dv; /* generic device */ + device_t sc_dv; /* generic device */ void * sc_ih; /* interrupt handler cookie */ u_int32_t sc_dmaier; u_int32_t sc_drammodel; /* 1=dram, 0=sram */ Index: sys/dev/pci/i82365_pci.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/pci/i82365_pci.c,v retrieving revision 1.32 diff -u -p -r1.32 i82365_pci.c --- sys/dev/pci/i82365_pci.c 17 Sep 2009 18:14:41 -0000 1.32 +++ sys/dev/pci/i82365_pci.c 26 Sep 2012 18:37:43 -0000 @@ -60,7 +60,7 @@ __KERNEL_RCSID(0, "$NetBSD: i82365_pci.c int pcic_pci_match(device_t, cfdata_t, void *); void pcic_pci_attach(device_t, device_t, void *); -CFATTACH_DECL(pcic_pci, sizeof(struct pcic_pci_softc), +CFATTACH_DECL_NEW(pcic_pci, sizeof(struct pcic_pci_softc), pcic_pci_match, pcic_pci_attach, NULL, NULL); static const struct pcmcia_chip_functions pcic_pci_functions = { @@ -118,6 +118,8 @@ pcic_pci_attach(device_t parent, device_ bus_space_handle_t memh; const char *model; + sc->dev = self; + aprint_naive(": PCMCIA controller\n"); if (pci_mapreg_map(pa, PCI_CBIO, PCI_MAPREG_TYPE_IO, 0, Index: sys/dev/pci/iavc_pci.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/pci/iavc_pci.c,v retrieving revision 1.13 diff -u -p -r1.13 iavc_pci.c --- sys/dev/pci/iavc_pci.c 6 Dec 2009 22:44:55 -0000 1.13 +++ sys/dev/pci/iavc_pci.c 28 Sep 2012 20:48:37 -0000 @@ -80,7 +80,7 @@ static void iavc_pci_attach(device_t, de int iavc_pci_intr(void *); -CFATTACH_DECL(iavc_pci, sizeof(struct iavc_pci_softc), +CFATTACH_DECL_NEW(iavc_pci, sizeof(struct iavc_pci_softc), iavc_pci_probe, iavc_pci_attach, NULL, NULL); static const struct iavc_pci_product { @@ -134,6 +134,7 @@ iavc_pci_attach(device_t parent, device_ if (pp == NULL) return; + sc->sc_dev = self; sc->sc_t1 = 0; sc->sc_dma = 0; sc->dmat = pa->pa_dmat; @@ -154,7 +155,7 @@ iavc_pci_attach(device_t parent, device_ aprint_normal(": %s\n", pp->name); if (pp->npp_product == PCI_PRODUCT_AVM_T1) { - aprint_error_dev(&sc->sc_dev, "sorry, PRI not yet supported\n"); + aprint_error_dev(sc->sc_dev, "sorry, PRI not yet supported\n"); return; #if 0 @@ -163,9 +164,9 @@ iavc_pci_attach(device_t parent, device_ ret = iavc_t1_detect(sc); if (ret) { if (ret < 6) { - aprint_error_dev(&sc->sc_dev, "no card detected?\n"); + aprint_error_dev(sc->sc_dev, "no card detected?\n"); } else { - aprint_error_dev(&sc->sc_dev, "black box not on\n"); + aprint_error_dev(sc->sc_dev, "black box not on\n"); } return; } else { @@ -181,7 +182,7 @@ iavc_pci_attach(device_t parent, device_ if (ret) { ret = iavc_b1_detect(sc); if (ret) { - aprint_error_dev(&sc->sc_dev, "no card detected?\n"); + aprint_error_dev(sc->sc_dev, "no card detected?\n"); return; } } else { @@ -202,21 +203,21 @@ iavc_pci_attach(device_t parent, device_ #endif 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(pc, ih); psc->sc_ih = pci_intr_establish(pc, ih, IPL_NET, iavc_pci_intr, psc); if (psc->sc_ih == NULL) { - aprint_error_dev(&sc->sc_dev, "couldn't establish interrupt"); + aprint_error_dev(sc->sc_dev, "couldn't establish interrupt"); if (intrstr != NULL) aprint_error(" at %s", intrstr); aprint_error("\n"); return; } psc->sc_pc = pc; - aprint_normal("%s: interrupting at %s\n", device_xname(&sc->sc_dev), intrstr); + aprint_normal("%s: interrupting at %s\n", device_xname(sc->sc_dev), intrstr); memset(&sc->sc_txq, 0, sizeof(struct ifqueue)); sc->sc_txq.ifq_maxlen = sc->sc_capi.sc_nbch * 4; @@ -235,14 +236,14 @@ iavc_pci_attach(device_t parent, device_ /* lock & load DMA for TX */ if ((ret = bus_dmamem_alloc(sc->dmat, IAVC_DMA_SIZE, PAGE_SIZE, 0, &sc->txseg, 1, &sc->ntxsegs, BUS_DMA_ALLOCNOW)) != 0) { - aprint_error_dev(&sc->sc_dev, "can't allocate tx DMA memory, error = %d\n", + aprint_error_dev(sc->sc_dev, "can't allocate tx DMA memory, error = %d\n", ret); goto fail1; } if ((ret = bus_dmamem_map(sc->dmat, &sc->txseg, sc->ntxsegs, IAVC_DMA_SIZE, &sc->sc_sendbuf, BUS_DMA_NOWAIT)) != 0) { - aprint_error_dev(&sc->sc_dev, "can't map tx DMA memory, error = %d\n", + aprint_error_dev(sc->sc_dev, "can't map tx DMA memory, error = %d\n", ret); goto fail2; } @@ -250,14 +251,14 @@ iavc_pci_attach(device_t parent, device_ if ((ret = bus_dmamap_create(sc->dmat, IAVC_DMA_SIZE, 1, IAVC_DMA_SIZE, 0, BUS_DMA_ALLOCNOW | BUS_DMA_NOWAIT, &sc->tx_map)) != 0) { - aprint_error_dev(&sc->sc_dev, "can't create tx DMA map, error = %d\n", + aprint_error_dev(sc->sc_dev, "can't create tx DMA map, error = %d\n", ret); goto fail3; } if ((ret = bus_dmamap_load(sc->dmat, sc->tx_map, sc->sc_sendbuf, IAVC_DMA_SIZE, NULL, BUS_DMA_WRITE | BUS_DMA_NOWAIT)) != 0) { - aprint_error_dev(&sc->sc_dev, "can't load tx DMA map, error = %d\n", + aprint_error_dev(sc->sc_dev, "can't load tx DMA map, error = %d\n", ret); goto fail4; } @@ -265,34 +266,34 @@ iavc_pci_attach(device_t parent, device_ /* do the same for RX */ if ((ret = bus_dmamem_alloc(sc->dmat, IAVC_DMA_SIZE, PAGE_SIZE, 0, &sc->rxseg, 1, &sc->nrxsegs, BUS_DMA_ALLOCNOW)) != 0) { - aprint_error_dev(&sc->sc_dev, "can't allocate rx DMA memory, error = %d\n", + aprint_error_dev(sc->sc_dev, "can't allocate rx DMA memory, error = %d\n", ret); goto fail5; } if ((ret = bus_dmamem_map(sc->dmat, &sc->rxseg, sc->nrxsegs, IAVC_DMA_SIZE, &sc->sc_recvbuf, BUS_DMA_NOWAIT)) != 0) { - aprint_error_dev(&sc->sc_dev, "can't map rx DMA memory, error = %d\n", + aprint_error_dev(sc->sc_dev, "can't map rx DMA memory, error = %d\n", ret); goto fail6; } if ((ret = bus_dmamap_create(sc->dmat, IAVC_DMA_SIZE, 1, IAVC_DMA_SIZE, 0, BUS_DMA_ALLOCNOW | BUS_DMA_NOWAIT, &sc->rx_map)) != 0) { - aprint_error_dev(&sc->sc_dev, "can't create rx DMA map, error = %d\n", + aprint_error_dev(sc->sc_dev, "can't create rx DMA map, error = %d\n", ret); goto fail7; } if ((ret = bus_dmamap_load(sc->dmat, sc->rx_map, sc->sc_recvbuf, IAVC_DMA_SIZE, NULL, BUS_DMA_READ | BUS_DMA_NOWAIT)) != 0) { - aprint_error_dev(&sc->sc_dev, "can't load rx DMA map, error = %d\n", + aprint_error_dev(sc->sc_dev, "can't load rx DMA map, error = %d\n", ret); goto fail8; } - if (capi_ll_attach(&sc->sc_capi, device_xname(&sc->sc_dev), pp->name)) { - aprint_error_dev(&sc->sc_dev, "capi attach failed\n"); + if (capi_ll_attach(&sc->sc_capi, device_xname(sc->sc_dev), pp->name)) { + aprint_error_dev(sc->sc_dev, "capi attach failed\n"); goto fail9; } return; Index: sys/dev/pci/icp_pci.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/pci/icp_pci.c,v retrieving revision 1.20 diff -u -p -r1.20 icp_pci.c --- sys/dev/pci/icp_pci.c 13 Nov 2010 13:52:05 -0000 1.20 +++ sys/dev/pci/icp_pci.c 26 Sep 2012 23:42:38 -0000 @@ -181,7 +181,7 @@ void icp_mpr_release_event(struct icp_so void icp_mpr_set_sema0(struct icp_softc *); int icp_mpr_test_busy(struct icp_softc *); -CFATTACH_DECL(icp_pci, sizeof(struct icp_softc), +CFATTACH_DECL_NEW(icp_pci, sizeof(struct icp_softc), icp_pci_match, icp_pci_attach, NULL, NULL); struct icp_pci_ident { @@ -254,6 +254,7 @@ icp_pci_attach(device_t parent, device_t pa = aux; status = 0; icp = device_private(self); + icp->icp_dv = self; icp->icp_class = icp_pci_find_class(pa); aprint_naive(": RAID controller\n"); Index: sys/dev/pci/if_de.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/pci/if_de.c,v retrieving revision 1.139 diff -u -p -r1.139 if_de.c --- sys/dev/pci/if_de.c 2 Feb 2012 19:43:05 -0000 1.139 +++ sys/dev/pci/if_de.c 2 Oct 2012 02:25:13 -0000 @@ -5142,7 +5142,7 @@ tulip_attach( #endif /* __bsdi__ */ #if defined(__NetBSD__) - rnd_attach_source(&sc->tulip_rndsource, device_xname(&sc->tulip_dev), + rnd_attach_source(&sc->tulip_rndsource, device_xname(sc->tulip_dev), RND_TYPE_NET, 0); #endif } @@ -5550,15 +5550,15 @@ struct cfdriver decd = { #endif /* __bsdi__ */ #if defined(__NetBSD__) -#define TULIP_PCI_ATTACH_ARGS struct device * const parent, struct device * const self, void *const aux +#define TULIP_PCI_ATTACH_ARGS device_t parent, device_t self, void *const aux #define TULIP_SHUTDOWN_ARGS void *arg static int tulip_pci_probe( - struct device *parent, + device_t parent, cfdata_t match, void *aux) { - struct pci_attach_args *pa = (struct pci_attach_args *) aux; + struct pci_attach_args *pa = aux; /* Don't match lmc cards */ if (PCI_VENDOR(pci_conf_read(pa->pa_pc, pa->pa_tag, @@ -5577,7 +5577,7 @@ tulip_pci_probe( static void tulip_pci_attach(TULIP_PCI_ATTACH_ARGS); -CFATTACH_DECL(de, sizeof(tulip_softc_t), +CFATTACH_DECL_NEW(de, sizeof(tulip_softc_t), tulip_pci_probe, tulip_pci_attach, NULL, NULL); #endif /* __NetBSD__ */ @@ -5616,8 +5616,9 @@ tulip_pci_attach( #endif #if defined(__NetBSD__) tulip_softc_t * const sc = device_private(self); + sc->tulip_dev = self; struct pci_attach_args * const pa = (struct pci_attach_args *) aux; - const int unit = sc->tulip_dev.dv_unit; + const int unit = device_unit(sc->tulip_dev); #define PCI_CONF_WRITE(r, v) pci_conf_write(pa->pa_pc, pa->pa_tag, (r), (v)) #define PCI_CONF_READ(r) pci_conf_read(pa->pa_pc, pa->pa_tag, (r)) #define PCI_GETBUSDEVINFO(sc) do { \ @@ -5871,20 +5872,20 @@ tulip_pci_attach( const char *intrstr; if (pci_intr_map(pa, &intrhandle)) { - aprint_error_dev(&sc->tulip_dev, "couldn't map interrupt\n"); + aprint_error_dev(sc->tulip_dev, "couldn't map interrupt\n"); return; } intrstr = pci_intr_string(pa->pa_pc, intrhandle); sc->tulip_ih = pci_intr_establish(pa->pa_pc, intrhandle, IPL_NET, intr_rtn, sc); if (sc->tulip_ih == NULL) { - aprint_error_dev(&sc->tulip_dev, "couldn't establish interrupt"); + aprint_error_dev(sc->tulip_dev, "couldn't establish interrupt"); if (intrstr != NULL) aprint_error(" at %s", intrstr); aprint_error("\n"); return; } - printf("%s: interrupting at %s\n", device_xname(&sc->tulip_dev), intrstr); + printf("%s: interrupting at %s\n", device_xname(sc->tulip_dev), intrstr); } sc->tulip_ats = shutdownhook_establish(tulip_shutdown, sc); if (sc->tulip_ats == NULL) Index: sys/dev/pci/if_devar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/pci/if_devar.h,v retrieving revision 1.57 diff -u -p -r1.57 if_devar.h --- sys/dev/pci/if_devar.h 2 Feb 2012 19:43:05 -0000 1.57 +++ sys/dev/pci/if_devar.h 26 Sep 2012 23:44:22 -0000 @@ -487,7 +487,7 @@ struct _tulip_softc_t { #endif /* _BSDI_VERSION < 199401 */ #endif /* __bsdi__ */ #if defined(__NetBSD__) - struct device tulip_dev; /* base device */ + device_t tulip_dev; /* base device */ void *tulip_ih; /* intrrupt vectoring */ void *tulip_ats; /* shutdown hook */ struct callout tulip_to_ch; /* tulip_timeout_callback() */ Index: sys/dev/pci/if_dge.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/pci/if_dge.c,v retrieving revision 1.34 diff -u -p -r1.34 if_dge.c --- sys/dev/pci/if_dge.c 2 Feb 2012 19:43:05 -0000 1.34 +++ sys/dev/pci/if_dge.c 26 Sep 2012 23:48:10 -0000 @@ -246,7 +246,7 @@ struct dge_rxsoft { * Software state per device. */ struct dge_softc { - struct device sc_dev; /* generic device information */ + device_t sc_dev; /* generic device information */ bus_space_tag_t sc_st; /* bus space tag */ bus_space_handle_t sc_sh; /* bus space handle */ bus_dma_tag_t sc_dmat; /* bus DMA tag */ @@ -482,14 +482,14 @@ dge_alloc_rcvmem(struct dge_softc *sc) if (bus_dmamem_alloc(sc->sc_dmat, DGE_RXMEM, PAGE_SIZE, 0, &seg, 1, &rseg, BUS_DMA_NOWAIT)) { - aprint_error_dev(&sc->sc_dev, "can't alloc rx buffers\n"); + aprint_error_dev(sc->sc_dev, "can't alloc rx buffers\n"); return ENOBUFS; } state = 1; if (bus_dmamem_map(sc->sc_dmat, &seg, rseg, DGE_RXMEM, (void **)&kva, BUS_DMA_NOWAIT)) { - aprint_error_dev(&sc->sc_dev, "can't map DMA buffers (%d bytes)\n", + aprint_error_dev(sc->sc_dev, "can't map DMA buffers (%d bytes)\n", (int)DGE_RXMEM); error = ENOBUFS; goto out; @@ -498,7 +498,7 @@ dge_alloc_rcvmem(struct dge_softc *sc) state = 2; if (bus_dmamap_create(sc->sc_dmat, DGE_RXMEM, 1, DGE_RXMEM, 0, BUS_DMA_NOWAIT, &sc->sc_bugmap)) { - aprint_error_dev(&sc->sc_dev, "can't create DMA map\n"); + aprint_error_dev(sc->sc_dev, "can't create DMA map\n"); error = ENOBUFS; goto out; } @@ -506,7 +506,7 @@ dge_alloc_rcvmem(struct dge_softc *sc) state = 3; if (bus_dmamap_load(sc->sc_dmat, sc->sc_bugmap, kva, DGE_RXMEM, NULL, BUS_DMA_NOWAIT)) { - aprint_error_dev(&sc->sc_dev, "can't load DMA map\n"); + aprint_error_dev(sc->sc_dev, "can't load DMA map\n"); error = ENOBUFS; goto out; } @@ -561,7 +561,7 @@ dge_getbuf(struct dge_softc *sc) entry = SLIST_FIRST(&sc->sc_buglist); if (entry == NULL) { - printf("%s: no free RX buffers\n", device_xname(&sc->sc_dev)); + printf("%s: no free RX buffers\n", device_xname(sc->sc_dev)); return(NULL); } @@ -634,7 +634,7 @@ static void dge_xgmii_reset(struct dge_s static void dge_xgmii_writereg(device_t, int, int, int); -CFATTACH_DECL(dge, sizeof(struct dge_softc), +CFATTACH_DECL_NEW(dge, sizeof(struct dge_softc), dge_match, dge_attach, NULL, NULL); #ifdef DGE_EVENT_COUNTERS @@ -671,6 +671,7 @@ dge_attach(device_t parent, device_t sel pcireg_t preg, memtype; uint32_t reg; + sc->sc_dev = self; sc->sc_dmat = pa->pa_dmat; sc->sc_pc = pa->pa_pc; sc->sc_pt = pa->pa_tag; @@ -681,7 +682,7 @@ dge_attach(device_t parent, device_t sel memtype = pci_mapreg_type(pa->pa_pc, pa->pa_tag, DGE_PCI_BAR); if (pci_mapreg_map(pa, DGE_PCI_BAR, memtype, 0, &sc->sc_st, &sc->sc_sh, NULL, NULL)) { - aprint_error_dev(&sc->sc_dev, "unable to map device registers\n"); + aprint_error_dev(sc->sc_dev, "unable to map device registers\n"); return; } @@ -694,19 +695,19 @@ dge_attach(device_t parent, device_t sel * Map and establish our interrupt. */ if (pci_intr_map(pa, &ih)) { - aprint_error_dev(&sc->sc_dev, "unable to map interrupt\n"); + aprint_error_dev(sc->sc_dev, "unable to map interrupt\n"); return; } intrstr = pci_intr_string(pc, ih); sc->sc_ih = pci_intr_establish(pc, ih, IPL_NET, dge_intr, sc); if (sc->sc_ih == NULL) { - aprint_error_dev(&sc->sc_dev, "unable to establish interrupt"); + aprint_error_dev(sc->sc_dev, "unable to establish interrupt"); 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); /* * Determine a few things about the bus we're connected to. @@ -719,7 +720,7 @@ dge_attach(device_t parent, device_t sel if (pci_get_capability(pa->pa_pc, pa->pa_tag, PCI_CAP_PCIX, &sc->sc_pcix_offset, NULL) == 0) - aprint_error_dev(&sc->sc_dev, "unable to find PCIX " + aprint_error_dev(sc->sc_dev, "unable to find PCIX " "capability\n"); if (sc->sc_flags & DGE_F_PCIX) { @@ -734,14 +735,14 @@ dge_attach(device_t parent, device_t sel sc->sc_bus_speed = 133; break; default: - aprint_error_dev(&sc->sc_dev, + aprint_error_dev(sc->sc_dev, "unknown PCIXSPD %d; assuming 66MHz\n", reg & STATUS_PCIX_MSK); sc->sc_bus_speed = 66; } } else sc->sc_bus_speed = (reg & STATUS_BUS64) ? 66 : 33; - aprint_verbose_dev(&sc->sc_dev, "%d-bit %dMHz %s bus\n", + aprint_verbose_dev(sc->sc_dev, "%d-bit %dMHz %s bus\n", (sc->sc_flags & DGE_F_BUS64) ? 64 : 32, sc->sc_bus_speed, (sc->sc_flags & DGE_F_PCIX) ? "PCIX" : "PCI"); @@ -752,7 +753,7 @@ dge_attach(device_t parent, device_t sel if ((error = bus_dmamem_alloc(sc->sc_dmat, sizeof(struct dge_control_data), PAGE_SIZE, 0, &seg, 1, &rseg, 0)) != 0) { - aprint_error_dev(&sc->sc_dev, + aprint_error_dev(sc->sc_dev, "unable to allocate control data, error = %d\n", error); goto fail_0; @@ -761,7 +762,7 @@ dge_attach(device_t parent, device_t sel if ((error = bus_dmamem_map(sc->sc_dmat, &seg, rseg, sizeof(struct dge_control_data), (void **)&sc->sc_control_data, 0)) != 0) { - aprint_error_dev(&sc->sc_dev, "unable to map control data, error = %d\n", + aprint_error_dev(sc->sc_dev, "unable to map control data, error = %d\n", error); goto fail_1; } @@ -769,7 +770,7 @@ dge_attach(device_t parent, device_t sel if ((error = bus_dmamap_create(sc->sc_dmat, sizeof(struct dge_control_data), 1, sizeof(struct dge_control_data), 0, 0, &sc->sc_cddmamap)) != 0) { - aprint_error_dev(&sc->sc_dev, "unable to create control data DMA map, " + aprint_error_dev(sc->sc_dev, "unable to create control data DMA map, " "error = %d\n", error); goto fail_2; } @@ -777,7 +778,7 @@ dge_attach(device_t parent, device_t sel if ((error = bus_dmamap_load(sc->sc_dmat, sc->sc_cddmamap, sc->sc_control_data, sizeof(struct dge_control_data), NULL, 0)) != 0) { - aprint_error_dev(&sc->sc_dev, + aprint_error_dev(sc->sc_dev, "unable to load control data DMA map, error = %d\n", error); goto fail_3; @@ -794,7 +795,7 @@ dge_attach(device_t parent, device_t sel if ((error = bus_dmamap_create(sc->sc_dmat, DGE_MAX_MTU, DGE_NTXSEGS, MCLBYTES, 0, 0, &sc->sc_txsoft[i].txs_dmamap)) != 0) { - aprint_error_dev(&sc->sc_dev, "unable to create Tx DMA map %d, " + aprint_error_dev(sc->sc_dev, "unable to create Tx DMA map %d, " "error = %d\n", i, error); goto fail_4; } @@ -811,7 +812,7 @@ dge_attach(device_t parent, device_t sel if ((error = bus_dmamap_create(sc->sc_dmat, MCLBYTES, 1, MCLBYTES, 0, 0, &sc->sc_rxsoft[i].rxs_dmamap)) != 0) { #endif - aprint_error_dev(&sc->sc_dev, "unable to create Rx DMA map %d, " + aprint_error_dev(sc->sc_dev, "unable to create Rx DMA map %d, " "error = %d\n", i, error); goto fail_5; } @@ -840,7 +841,7 @@ dge_attach(device_t parent, device_t sel * Read in EEPROM data. */ if (dge_read_eeprom(sc)) { - aprint_error_dev(&sc->sc_dev, "couldn't read EEPROM\n"); + aprint_error_dev(sc->sc_dev, "couldn't read EEPROM\n"); return; } @@ -854,7 +855,7 @@ dge_attach(device_t parent, device_t sel enaddr[4] = sc->sc_eeprom[EE_ADDR45] & 0377; enaddr[5] = sc->sc_eeprom[EE_ADDR45] >> 8; - aprint_normal_dev(&sc->sc_dev, "Ethernet address %s\n", + aprint_normal_dev(sc->sc_dev, "Ethernet address %s\n", ether_sprintf(enaddr)); /* @@ -866,7 +867,7 @@ dge_attach(device_t parent, device_t sel ifmedia_set(&sc->sc_media, IFM_ETHER|IFM_10G_LR); 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_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; ifp->if_ioctl = dge_ioctl; @@ -893,7 +894,7 @@ dge_attach(device_t parent, device_t sel */ if_attach(ifp); ether_ifattach(ifp, enaddr); - rnd_attach_source(&sc->rnd_source, device_xname(&sc->sc_dev), + rnd_attach_source(&sc->rnd_source, device_xname(sc->sc_dev), RND_TYPE_NET, 0); #ifdef DGE_EVENT_COUNTERS @@ -908,42 +909,42 @@ dge_attach(device_t parent, device_t sel /* Attach event counters. */ evcnt_attach_dynamic(&sc->sc_ev_txsstall, EVCNT_TYPE_MISC, - NULL, device_xname(&sc->sc_dev), "txsstall"); + NULL, device_xname(sc->sc_dev), "txsstall"); evcnt_attach_dynamic(&sc->sc_ev_txdstall, EVCNT_TYPE_MISC, - NULL, device_xname(&sc->sc_dev), "txdstall"); + NULL, device_xname(sc->sc_dev), "txdstall"); evcnt_attach_dynamic(&sc->sc_ev_txforceintr, EVCNT_TYPE_MISC, - NULL, device_xname(&sc->sc_dev), "txforceintr"); + NULL, device_xname(sc->sc_dev), "txforceintr"); evcnt_attach_dynamic(&sc->sc_ev_txdw, EVCNT_TYPE_INTR, - NULL, device_xname(&sc->sc_dev), "txdw"); + NULL, device_xname(sc->sc_dev), "txdw"); evcnt_attach_dynamic(&sc->sc_ev_txqe, EVCNT_TYPE_INTR, - NULL, device_xname(&sc->sc_dev), "txqe"); + NULL, device_xname(sc->sc_dev), "txqe"); evcnt_attach_dynamic(&sc->sc_ev_rxintr, EVCNT_TYPE_INTR, - NULL, device_xname(&sc->sc_dev), "rxintr"); + NULL, device_xname(sc->sc_dev), "rxintr"); evcnt_attach_dynamic(&sc->sc_ev_linkintr, EVCNT_TYPE_INTR, - NULL, device_xname(&sc->sc_dev), "linkintr"); + NULL, device_xname(sc->sc_dev), "linkintr"); evcnt_attach_dynamic(&sc->sc_ev_rxipsum, EVCNT_TYPE_MISC, - NULL, device_xname(&sc->sc_dev), "rxipsum"); + NULL, device_xname(sc->sc_dev), "rxipsum"); evcnt_attach_dynamic(&sc->sc_ev_rxtusum, EVCNT_TYPE_MISC, - NULL, device_xname(&sc->sc_dev), "rxtusum"); + NULL, device_xname(sc->sc_dev), "rxtusum"); evcnt_attach_dynamic(&sc->sc_ev_txipsum, EVCNT_TYPE_MISC, - NULL, device_xname(&sc->sc_dev), "txipsum"); + NULL, device_xname(sc->sc_dev), "txipsum"); evcnt_attach_dynamic(&sc->sc_ev_txtusum, EVCNT_TYPE_MISC, - NULL, device_xname(&sc->sc_dev), "txtusum"); + NULL, device_xname(sc->sc_dev), "txtusum"); evcnt_attach_dynamic(&sc->sc_ev_txctx_init, EVCNT_TYPE_MISC, - NULL, device_xname(&sc->sc_dev), "txctx init"); + NULL, device_xname(sc->sc_dev), "txctx init"); evcnt_attach_dynamic(&sc->sc_ev_txctx_hit, EVCNT_TYPE_MISC, - NULL, device_xname(&sc->sc_dev), "txctx hit"); + NULL, device_xname(sc->sc_dev), "txctx hit"); evcnt_attach_dynamic(&sc->sc_ev_txctx_miss, EVCNT_TYPE_MISC, - NULL, device_xname(&sc->sc_dev), "txctx miss"); + NULL, device_xname(sc->sc_dev), "txctx miss"); for (i = 0; i < DGE_NTXSEGS; i++) evcnt_attach_dynamic(&sc->sc_ev_txseg[i], EVCNT_TYPE_MISC, - NULL, device_xname(&sc->sc_dev), (*dge_txseg_evcnt_names)[i]); + NULL, device_xname(sc->sc_dev), (*dge_txseg_evcnt_names)[i]); evcnt_attach_dynamic(&sc->sc_ev_txdrop, EVCNT_TYPE_MISC, - NULL, device_xname(&sc->sc_dev), "txdrop"); + NULL, device_xname(sc->sc_dev), "txdrop"); #endif /* DGE_EVENT_COUNTERS */ @@ -1065,7 +1066,7 @@ dge_tx_cksum(struct dge_softc *sc, struc } DPRINTF(DGE_DEBUG_CKSUM, ("%s: CKSUM: offset %d ipcs 0x%x\n", - device_xname(&sc->sc_dev), offset, ipcs)); + device_xname(sc->sc_dev), offset, ipcs)); offset += iphl; @@ -1087,7 +1088,7 @@ dge_tx_cksum(struct dge_softc *sc, struc DPRINTF(DGE_DEBUG_CKSUM, ("%s: CKSUM: offset %d tucs 0x%x\n", - device_xname(&sc->sc_dev), offset, tucs)); + device_xname(sc->sc_dev), offset, tucs)); if (sc->sc_txctx_ipcs == ipcs && sc->sc_txctx_tucs == tucs) { @@ -1158,7 +1159,7 @@ dge_start(struct ifnet *ifp) DPRINTF(DGE_DEBUG_TX, ("%s: TX: have packet to transmit: %p\n", - device_xname(&sc->sc_dev), m0)); + device_xname(sc->sc_dev), m0)); /* Get a work queue entry. */ if (sc->sc_txsfree < DGE_TXQUEUE_GC) { @@ -1166,7 +1167,7 @@ dge_start(struct ifnet *ifp) if (sc->sc_txsfree == 0) { DPRINTF(DGE_DEBUG_TX, ("%s: TX: no free job descriptors\n", - device_xname(&sc->sc_dev))); + device_xname(sc->sc_dev))); DGE_EVCNT_INCR(&sc->sc_ev_txsstall); break; } @@ -1190,7 +1191,7 @@ dge_start(struct ifnet *ifp) DGE_EVCNT_INCR(&sc->sc_ev_txdrop); printf("%s: Tx packet consumes too many " "DMA segments, dropping...\n", - device_xname(&sc->sc_dev)); + device_xname(sc->sc_dev)); IFQ_DEQUEUE(&ifp->if_snd, m0); m_freem(m0); continue; @@ -1200,7 +1201,7 @@ dge_start(struct ifnet *ifp) */ DPRINTF(DGE_DEBUG_TX, ("%s: TX: dmamap load failed: %d\n", - device_xname(&sc->sc_dev), error)); + device_xname(sc->sc_dev), error)); break; } @@ -1221,7 +1222,7 @@ dge_start(struct ifnet *ifp) */ DPRINTF(DGE_DEBUG_TX, ("%s: TX: need %d descriptors, have %d\n", - device_xname(&sc->sc_dev), dmamap->dm_nsegs, + device_xname(sc->sc_dev), dmamap->dm_nsegs, sc->sc_txfree - 1)); ifp->if_flags |= IFF_OACTIVE; bus_dmamap_unload(sc->sc_dmat, dmamap); @@ -1241,7 +1242,7 @@ dge_start(struct ifnet *ifp) DPRINTF(DGE_DEBUG_TX, ("%s: TX: packet has %d DMA segments\n", - device_xname(&sc->sc_dev), dmamap->dm_nsegs)); + device_xname(sc->sc_dev), dmamap->dm_nsegs)); DGE_EVCNT_INCR(&sc->sc_ev_txseg[dmamap->dm_nsegs - 1]); @@ -1297,7 +1298,7 @@ dge_start(struct ifnet *ifp) DPRINTF(DGE_DEBUG_TX, ("%s: TX: desc %d: low 0x%08lx, len 0x%04lx\n", - device_xname(&sc->sc_dev), nexttx, + device_xname(sc->sc_dev), nexttx, (unsigned long)le32toh(dmamap->dm_segs[seg].ds_addr), (unsigned long)le32toh(dmamap->dm_segs[seg].ds_len))); } @@ -1315,7 +1316,7 @@ dge_start(struct ifnet *ifp) txs->txs_lastdesc = lasttx; DPRINTF(DGE_DEBUG_TX, - ("%s: TX: desc %d: cmdlen 0x%08x\n", device_xname(&sc->sc_dev), + ("%s: TX: desc %d: cmdlen 0x%08x\n", device_xname(sc->sc_dev), lasttx, le32toh(sc->sc_txdescs[lasttx].dt_ctl))); /* Sync the descriptors we're using. */ @@ -1326,11 +1327,11 @@ dge_start(struct ifnet *ifp) CSR_WRITE(sc, DGE_TDT, nexttx); DPRINTF(DGE_DEBUG_TX, - ("%s: TX: TDT -> %d\n", device_xname(&sc->sc_dev), nexttx)); + ("%s: TX: TDT -> %d\n", device_xname(sc->sc_dev), nexttx)); DPRINTF(DGE_DEBUG_TX, ("%s: TX: finished transmitting packet, job %d\n", - device_xname(&sc->sc_dev), sc->sc_txsnext)); + device_xname(sc->sc_dev), sc->sc_txsnext)); /* Advance the tx pointer. */ sc->sc_txfree -= txs->txs_ndesc; @@ -1372,7 +1373,7 @@ dge_watchdog(struct ifnet *ifp) if (sc->sc_txfree != DGE_NTXDESC) { printf("%s: device timeout (txfree %d txsfree %d txnext %d)\n", - device_xname(&sc->sc_dev), sc->sc_txfree, sc->sc_txsfree, + device_xname(sc->sc_dev), sc->sc_txfree, sc->sc_txsfree, sc->sc_txnext); ifp->if_oerrors++; @@ -1492,7 +1493,7 @@ dge_intr(void *arg) if (icr & (ICR_RXDMT0|ICR_RXT0)) { DPRINTF(DGE_DEBUG_RX, ("%s: RX: got Rx intr 0x%08x\n", - device_xname(&sc->sc_dev), + device_xname(sc->sc_dev), icr & (ICR_RXDMT0|ICR_RXT0))); DGE_EVCNT_INCR(&sc->sc_ev_rxintr); } @@ -1503,7 +1504,7 @@ dge_intr(void *arg) if (icr & ICR_TXDW) { DPRINTF(DGE_DEBUG_TX, ("%s: TX: got TXDW interrupt\n", - device_xname(&sc->sc_dev))); + device_xname(sc->sc_dev))); DGE_EVCNT_INCR(&sc->sc_ev_txdw); } if (icr & ICR_TXQE) @@ -1517,7 +1518,7 @@ dge_intr(void *arg) } if (icr & ICR_RXO) { - printf("%s: Receive overrun\n", device_xname(&sc->sc_dev)); + printf("%s: Receive overrun\n", device_xname(sc->sc_dev)); wantinit = 1; } } @@ -1557,7 +1558,7 @@ dge_txintr(struct dge_softc *sc) txs = &sc->sc_txsoft[i]; DPRINTF(DGE_DEBUG_TX, - ("%s: TX: checking job %d\n", device_xname(&sc->sc_dev), i)); + ("%s: TX: checking job %d\n", device_xname(sc->sc_dev), i)); DGE_CDTXSYNC(sc, txs->txs_firstdesc, txs->txs_dmamap->dm_nsegs, BUS_DMASYNC_POSTREAD|BUS_DMASYNC_POSTWRITE); @@ -1572,7 +1573,7 @@ dge_txintr(struct dge_softc *sc) DPRINTF(DGE_DEBUG_TX, ("%s: TX: job %d done: descs %d..%d\n", - device_xname(&sc->sc_dev), i, txs->txs_firstdesc, + device_xname(sc->sc_dev), i, txs->txs_firstdesc, txs->txs_lastdesc)); ifp->if_opackets++; @@ -1587,7 +1588,7 @@ dge_txintr(struct dge_softc *sc) /* Update the dirty transmit buffer pointer. */ sc->sc_txsdirty = i; DPRINTF(DGE_DEBUG_TX, - ("%s: TX: txsdirty -> %d\n", device_xname(&sc->sc_dev), i)); + ("%s: TX: txsdirty -> %d\n", device_xname(sc->sc_dev), i)); /* * If there are no more pending transmissions, cancel the watchdog @@ -1616,7 +1617,7 @@ dge_rxintr(struct dge_softc *sc) DPRINTF(DGE_DEBUG_RX, ("%s: RX: checking descriptor %d\n", - device_xname(&sc->sc_dev), i)); + device_xname(sc->sc_dev), i)); DGE_CDRXSYNC(sc, i, BUS_DMASYNC_POSTREAD|BUS_DMASYNC_POSTWRITE); @@ -1635,13 +1636,13 @@ dge_rxintr(struct dge_softc *sc) if (__predict_false(sc->sc_rxdiscard)) { DPRINTF(DGE_DEBUG_RX, ("%s: RX: discarding contents of descriptor %d\n", - device_xname(&sc->sc_dev), i)); + device_xname(sc->sc_dev), i)); DGE_INIT_RXDESC(sc, i); if (status & RDESC_STS_EOP) { /* Reset our state. */ DPRINTF(DGE_DEBUG_RX, ("%s: RX: resetting rxdiscard -> 0\n", - device_xname(&sc->sc_dev))); + device_xname(sc->sc_dev))); sc->sc_rxdiscard = 0; } continue; @@ -1671,7 +1672,7 @@ dge_rxintr(struct dge_softc *sc) DGE_RXCHAIN_RESET(sc); DPRINTF(DGE_DEBUG_RX, ("%s: RX: Rx buffer allocation failed, " - "dropping packet%s\n", device_xname(&sc->sc_dev), + "dropping packet%s\n", device_xname(sc->sc_dev), sc->sc_rxdiscard ? " (discard)" : "")); continue; } @@ -1683,7 +1684,7 @@ dge_rxintr(struct dge_softc *sc) DPRINTF(DGE_DEBUG_RX, ("%s: RX: buffer at %p len %d\n", - device_xname(&sc->sc_dev), m->m_data, len)); + device_xname(sc->sc_dev), m->m_data, len)); /* * If this is not the end of the packet, keep @@ -1693,7 +1694,7 @@ dge_rxintr(struct dge_softc *sc) sc->sc_rxlen += len; DPRINTF(DGE_DEBUG_RX, ("%s: RX: not yet EOP, rxlen -> %d\n", - device_xname(&sc->sc_dev), sc->sc_rxlen)); + device_xname(sc->sc_dev), sc->sc_rxlen)); continue; } @@ -1708,7 +1709,7 @@ dge_rxintr(struct dge_softc *sc) DPRINTF(DGE_DEBUG_RX, ("%s: RX: have entire packet, len -> %d\n", - device_xname(&sc->sc_dev), len)); + device_xname(sc->sc_dev), len)); /* * If an error occurred, update stats and drop the packet. @@ -1718,13 +1719,13 @@ dge_rxintr(struct dge_softc *sc) ifp->if_ierrors++; if (errors & RDESC_ERR_SE) printf("%s: symbol error\n", - device_xname(&sc->sc_dev)); + device_xname(sc->sc_dev)); else if (errors & RDESC_ERR_P) printf("%s: parity error\n", - device_xname(&sc->sc_dev)); + device_xname(sc->sc_dev)); else if (errors & RDESC_ERR_CE) printf("%s: CRC error\n", - device_xname(&sc->sc_dev)); + device_xname(sc->sc_dev)); m_freem(m); continue; } @@ -1769,7 +1770,7 @@ dge_rxintr(struct dge_softc *sc) sc->sc_rxptr = i; DPRINTF(DGE_DEBUG_RX, - ("%s: RX: rxptr -> %d\n", device_xname(&sc->sc_dev), i)); + ("%s: RX: rxptr -> %d\n", device_xname(sc->sc_dev), i)); } /* @@ -1786,15 +1787,15 @@ dge_linkintr(struct dge_softc *sc, uint3 status = CSR_READ(sc, DGE_STATUS); if (status & STATUS_LINKUP) { DPRINTF(DGE_DEBUG_LINK, ("%s: LINK: LSC -> up\n", - device_xname(&sc->sc_dev))); + device_xname(sc->sc_dev))); } else { DPRINTF(DGE_DEBUG_LINK, ("%s: LINK: LSC -> down\n", - device_xname(&sc->sc_dev))); + device_xname(sc->sc_dev))); } } else if (icr & ICR_RXSEQ) { DPRINTF(DGE_DEBUG_LINK, ("%s: LINK: Receive sequence error\n", - device_xname(&sc->sc_dev))); + device_xname(sc->sc_dev))); } /* XXX - fix errata */ } @@ -1824,7 +1825,7 @@ dge_reset(struct dge_softc *sc) if (CSR_READ(sc, DGE_CTRL0) & CTRL0_RST) printf("%s: WARNING: reset failed to complete\n", - device_xname(&sc->sc_dev)); + device_xname(sc->sc_dev)); /* * Reset the EEPROM logic. * This will cause the chip to reread its default values, @@ -1925,7 +1926,7 @@ dge_init(struct ifnet *ifp) if ((error = dge_add_rxbuf(sc, i)) != 0) { printf("%s: unable to allocate or map rx " "buffer %d, error = %d\n", - device_xname(&sc->sc_dev), i, error); + device_xname(sc->sc_dev), i, error); /* * XXX Should attempt to run with fewer receive * XXX buffers instead of just failing. @@ -2021,7 +2022,7 @@ dge_init(struct ifnet *ifp) out: if (error) - printf("%s: interface not running\n", device_xname(&sc->sc_dev)); + printf("%s: interface not running\n", device_xname(sc->sc_dev)); return (error); } @@ -2131,7 +2132,7 @@ dge_add_rxbuf(struct dge_softc *sc, int #endif if (error) { printf("%s: unable to load rx DMA map %d, error = %d\n", - device_xname(&sc->sc_dev), idx, error); + device_xname(sc->sc_dev), idx, error); panic("dge_add_rxbuf"); /* XXX XXX XXX */ } bus_dmamap_sync(sc->sc_dmat, rxs->rxs_dmamap, 0, @@ -2388,12 +2389,12 @@ dge_xgmii_writereg(device_t self, int ph CSR_WRITE(sc, DGE_MDIRW, val); if (((mdic = phwait(sc, phy, reg, 1, MDIO_ADDR)) & MDIO_CMD)) { printf("%s: address cycle timeout; phy %d reg %d\n", - device_xname(&sc->sc_dev), phy, reg); + device_xname(sc->sc_dev), phy, reg); return; } if (((mdic = phwait(sc, phy, reg, 1, MDIO_WRITE)) & MDIO_CMD)) { printf("%s: read cycle timeout; phy %d reg %d\n", - device_xname(&sc->sc_dev), phy, reg); + device_xname(sc->sc_dev), phy, reg); return; } } Index: sys/dev/pci/if_esh_pci.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/pci/if_esh_pci.c,v retrieving revision 1.29 diff -u -p -r1.29 if_esh_pci.c --- sys/dev/pci/if_esh_pci.c 26 Jul 2011 20:51:24 -0000 1.29 +++ sys/dev/pci/if_esh_pci.c 26 Sep 2012 23:48:39 -0000 @@ -79,7 +79,7 @@ static u_int8_t esh_pci_bist_read(struct static void esh_pci_bist_write(struct esh_softc *, u_int8_t); -CFATTACH_DECL(esh_pci, sizeof(struct esh_softc), +CFATTACH_DECL_NEW(esh_pci, sizeof(struct esh_softc), esh_pci_match, esh_pci_attach, NULL, NULL); static int @@ -119,6 +119,7 @@ esh_pci_attach(device_t parent, device_t return; } + sc->sc_dev = self; sc->sc_dmat = pa->pa_dmat; switch (PCI_PRODUCT(pa->pa_id)) { @@ -147,19 +148,19 @@ esh_pci_attach(device_t parent, device_t /* Map and establish the interrupt. */ 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(pc, ih); sc->sc_ih = pci_intr_establish(pc, ih, IPL_NET, eshintr, sc); if (sc->sc_ih == NULL) { - aprint_error_dev(&sc->sc_dev, "couldn't establish interrupt"); + aprint_error_dev(sc->sc_dev, "couldn't establish interrupt"); 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); } static u_int8_t Index: sys/dev/pci/if_fpa.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/pci/if_fpa.c,v retrieving revision 1.57 diff -u -p -r1.57 if_fpa.c --- sys/dev/pci/if_fpa.c 19 Jan 2010 22:07:00 -0000 1.57 +++ sys/dev/pci/if_fpa.c 26 Sep 2012 23:51:47 -0000 @@ -343,6 +343,7 @@ pdq_pci_attach(device_t parent, device_t struct ifnet *ifp = &sc->sc_if; int i; + sc->sc_dev = self; sc->sc_if.if_unit = sc->sc_dev.dv_unit; sc->sc_if.if_name = "fpa"; sc->sc_if.if_flags = 0; @@ -415,7 +416,7 @@ pdq_pci_attach(device_t const parent, de pci_conf_write(pa->pa_pc, pa->pa_tag, PCI_CFLT, data); } - strlcpy(sc->sc_if.if_xname, device_xname(&sc->sc_dev), IFNAMSIZ); + strlcpy(sc->sc_if.if_xname, device_xname(sc->sc_dev), IFNAMSIZ); sc->sc_if.if_flags = 0; sc->sc_if.if_softc = sc; @@ -459,7 +460,7 @@ pdq_pci_attach(device_t const parent, de sc->sc_if.if_xname, 0, (void *) sc, PDQ_DEFPA); if (sc->sc_pdq == NULL) { - aprint_error_dev(&sc->sc_dev, "initialization failed\n"); + aprint_error_dev(sc->sc_dev, "initialization failed\n"); return; } @@ -486,7 +487,7 @@ pdq_pci_attach(device_t const parent, de aprint_normal_dev(self, "interrupting at %s\n", intrstr); } -CFATTACH_DECL(fpa, sizeof(pdq_softc_t), +CFATTACH_DECL_NEW(fpa, sizeof(pdq_softc_t), pdq_pci_match, pdq_pci_attach, NULL, NULL); #endif /* __NetBSD__ */ Index: sys/dev/pci/if_ipw.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/pci/if_ipw.c,v retrieving revision 1.53 diff -u -p -r1.53 if_ipw.c --- sys/dev/pci/if_ipw.c 30 Jan 2012 19:41:20 -0000 1.53 +++ sys/dev/pci/if_ipw.c 2 Oct 2012 02:25:48 -0000 @@ -152,7 +152,7 @@ MEM_READ_4(struct ipw_softc *sc, uint32_ return CSR_READ_4(sc, IPW_CSR_INDIRECT_DATA); } -CFATTACH_DECL(ipw, sizeof (struct ipw_softc), ipw_match, ipw_attach, +CFATTACH_DECL_NEW(ipw, sizeof (struct ipw_softc), ipw_match, ipw_attach, ipw_detach, NULL); static int @@ -186,6 +186,7 @@ ipw_attach(device_t parent, device_t sel uint16_t val; int i, error; + sc->sc_dev = self; sc->sc_pct = pa->pa_pc; sc->sc_pcitag = pa->pa_tag; @@ -200,7 +201,7 @@ ipw_attach(device_t parent, device_t sel error = pci_mapreg_map(pa, IPW_PCI_BAR0, PCI_MAPREG_TYPE_MEM | PCI_MAPREG_MEM_TYPE_32BIT, 0, &memt, &memh, &base, &sc->sc_sz); if (error != 0) { - aprint_error_dev(&sc->sc_dev, "could not map memory space\n"); + aprint_error_dev(sc->sc_dev, "could not map memory space\n"); return; } @@ -213,28 +214,28 @@ ipw_attach(device_t parent, device_t sel CSR_WRITE_4(sc, IPW_CSR_INTR_MASK, 0); if (pci_intr_map(pa, &ih) != 0) { - aprint_error_dev(&sc->sc_dev, "could not map interrupt\n"); + aprint_error_dev(sc->sc_dev, "could not map interrupt\n"); return; } intrstr = pci_intr_string(sc->sc_pct, ih); sc->sc_ih = pci_intr_establish(sc->sc_pct, ih, IPL_NET, ipw_intr, sc); if (sc->sc_ih == NULL) { - aprint_error_dev(&sc->sc_dev, "could not establish interrupt"); + aprint_error_dev(sc->sc_dev, "could not establish interrupt"); 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); if (ipw_reset(sc) != 0) { - aprint_error_dev(&sc->sc_dev, "could not reset adapter\n"); + aprint_error_dev(sc->sc_dev, "could not reset adapter\n"); goto fail; } if (ipw_dma_alloc(sc) != 0) { - aprint_error_dev(&sc->sc_dev, "could not allocate DMA resources\n"); + aprint_error_dev(sc->sc_dev, "could not allocate DMA resources\n"); goto fail; } @@ -246,7 +247,7 @@ ipw_attach(device_t parent, device_t sel ifp->if_start = ipw_start; ifp->if_watchdog = ipw_watchdog; IFQ_SET_READY(&ifp->if_snd); - strlcpy(ifp->if_xname, device_xname(&sc->sc_dev), IFNAMSIZ); + strlcpy(ifp->if_xname, device_xname(sc->sc_dev), IFNAMSIZ); ic->ic_ifp = ifp; ic->ic_phytype = IEEE80211_T_DS; @@ -291,7 +292,7 @@ ipw_attach(device_t parent, device_t sel if (!(ipw_read_prom_word(sc, IPW_EEPROM_RADIO) & 8)) sc->flags |= IPW_FLAG_HAS_RADIO_SWITCH; - aprint_normal_dev(&sc->sc_dev, "802.11 address %s\n", + aprint_normal_dev(sc->sc_dev, "802.11 address %s\n", ether_sprintf(ic->ic_myaddr)); if_attach(ifp); @@ -333,7 +334,7 @@ fail: ipw_detach(self, 0); } static int -ipw_detach(struct device* self, int flags) +ipw_detach(device_t self, int flags) { struct ipw_softc *sc = device_private(self); struct ifnet *ifp = &sc->sc_if; @@ -373,28 +374,28 @@ ipw_dma_alloc(struct ipw_softc *sc) error = bus_dmamap_create(sc->sc_dmat, IPW_TBD_SZ, 1, IPW_TBD_SZ, 0, BUS_DMA_NOWAIT, &sc->tbd_map); if (error != 0) { - aprint_error_dev(&sc->sc_dev, "could not create tbd dma map\n"); + aprint_error_dev(sc->sc_dev, "could not create tbd dma map\n"); goto fail; } error = bus_dmamem_alloc(sc->sc_dmat, IPW_TBD_SZ, PAGE_SIZE, 0, &sc->tbd_seg, 1, &nsegs, BUS_DMA_NOWAIT); if (error != 0) { - aprint_error_dev(&sc->sc_dev, "could not allocate tbd dma memory\n"); + aprint_error_dev(sc->sc_dev, "could not allocate tbd dma memory\n"); goto fail; } error = bus_dmamem_map(sc->sc_dmat, &sc->tbd_seg, nsegs, IPW_TBD_SZ, (void **)&sc->tbd_list, BUS_DMA_NOWAIT); if (error != 0) { - aprint_error_dev(&sc->sc_dev, "could not map tbd dma memory\n"); + aprint_error_dev(sc->sc_dev, "could not map tbd dma memory\n"); goto fail; } error = bus_dmamap_load(sc->sc_dmat, sc->tbd_map, sc->tbd_list, IPW_TBD_SZ, NULL, BUS_DMA_NOWAIT); if (error != 0) { - aprint_error_dev(&sc->sc_dev, "could not load tbd dma memory\n"); + aprint_error_dev(sc->sc_dev, "could not load tbd dma memory\n"); goto fail; } @@ -406,28 +407,28 @@ ipw_dma_alloc(struct ipw_softc *sc) error = bus_dmamap_create(sc->sc_dmat, IPW_RBD_SZ, 1, IPW_RBD_SZ, 0, BUS_DMA_NOWAIT, &sc->rbd_map); if (error != 0) { - aprint_error_dev(&sc->sc_dev, "could not create rbd dma map\n"); + aprint_error_dev(sc->sc_dev, "could not create rbd dma map\n"); goto fail; } error = bus_dmamem_alloc(sc->sc_dmat, IPW_RBD_SZ, PAGE_SIZE, 0, &sc->rbd_seg, 1, &nsegs, BUS_DMA_NOWAIT); if (error != 0) { - aprint_error_dev(&sc->sc_dev, "could not allocate rbd dma memory\n"); + aprint_error_dev(sc->sc_dev, "could not allocate rbd dma memory\n"); goto fail; } error = bus_dmamem_map(sc->sc_dmat, &sc->rbd_seg, nsegs, IPW_RBD_SZ, (void **)&sc->rbd_list, BUS_DMA_NOWAIT); if (error != 0) { - aprint_error_dev(&sc->sc_dev, "could not map rbd dma memory\n"); + aprint_error_dev(sc->sc_dev, "could not map rbd dma memory\n"); goto fail; } error = bus_dmamap_load(sc->sc_dmat, sc->rbd_map, sc->rbd_list, IPW_RBD_SZ, NULL, BUS_DMA_NOWAIT); if (error != 0) { - aprint_error_dev(&sc->sc_dev, "could not load rbd dma memory\n"); + aprint_error_dev(sc->sc_dev, "could not load rbd dma memory\n"); goto fail; } @@ -439,28 +440,28 @@ ipw_dma_alloc(struct ipw_softc *sc) error = bus_dmamap_create(sc->sc_dmat, IPW_STATUS_SZ, 1, IPW_STATUS_SZ, 0, BUS_DMA_NOWAIT, &sc->status_map); if (error != 0) { - aprint_error_dev(&sc->sc_dev, "could not create status dma map\n"); + aprint_error_dev(sc->sc_dev, "could not create status dma map\n"); goto fail; } error = bus_dmamem_alloc(sc->sc_dmat, IPW_STATUS_SZ, PAGE_SIZE, 0, &sc->status_seg, 1, &nsegs, BUS_DMA_NOWAIT); if (error != 0) { - aprint_error_dev(&sc->sc_dev, "could not allocate status dma memory\n"); + aprint_error_dev(sc->sc_dev, "could not allocate status dma memory\n"); goto fail; } error = bus_dmamem_map(sc->sc_dmat, &sc->status_seg, nsegs, IPW_STATUS_SZ, (void **)&sc->status_list, BUS_DMA_NOWAIT); if (error != 0) { - aprint_error_dev(&sc->sc_dev, "could not map status dma memory\n"); + aprint_error_dev(sc->sc_dev, "could not map status dma memory\n"); goto fail; } error = bus_dmamap_load(sc->sc_dmat, sc->status_map, sc->status_list, IPW_STATUS_SZ, NULL, BUS_DMA_NOWAIT); if (error != 0) { - aprint_error_dev(&sc->sc_dev, "could not load status dma memory\n"); + aprint_error_dev(sc->sc_dev, "could not load status dma memory\n"); goto fail; } @@ -472,28 +473,28 @@ ipw_dma_alloc(struct ipw_softc *sc) error = bus_dmamap_create(sc->sc_dmat, sizeof (struct ipw_cmd), 1, sizeof (struct ipw_cmd), 0, BUS_DMA_NOWAIT, &sc->cmd_map); if (error != 0) { - aprint_error_dev(&sc->sc_dev, "could not create cmd dma map\n"); + aprint_error_dev(sc->sc_dev, "could not create cmd dma map\n"); goto fail; } error = bus_dmamem_alloc(sc->sc_dmat, sizeof (struct ipw_cmd), PAGE_SIZE, 0, &sc->cmd_seg, 1, &nsegs, BUS_DMA_NOWAIT); if (error != 0) { - aprint_error_dev(&sc->sc_dev, "could not allocate cmd dma memory\n"); + aprint_error_dev(sc->sc_dev, "could not allocate cmd dma memory\n"); goto fail; } error = bus_dmamem_map(sc->sc_dmat, &sc->cmd_seg, nsegs, sizeof (struct ipw_cmd), (void **)&sc->cmd, BUS_DMA_NOWAIT); if (error != 0) { - aprint_error_dev(&sc->sc_dev, "could not map cmd dma memory\n"); + aprint_error_dev(sc->sc_dev, "could not map cmd dma memory\n"); goto fail; } error = bus_dmamap_load(sc->sc_dmat, sc->cmd_map, &sc->cmd, sizeof (struct ipw_cmd), NULL, BUS_DMA_NOWAIT); if (error != 0) { - aprint_error_dev(&sc->sc_dev, "could not map cmd dma memory\n"); + aprint_error_dev(sc->sc_dev, "could not map cmd dma memory\n"); return error; } @@ -506,7 +507,7 @@ ipw_dma_alloc(struct ipw_softc *sc) sizeof(struct ipw_hdr), 0, BUS_DMA_NOWAIT, &sc->hdr_map); if (error != 0) { - aprint_error_dev(&sc->sc_dev, "could not create hdr dma map\n"); + aprint_error_dev(sc->sc_dev, "could not create hdr dma map\n"); goto fail; } @@ -514,7 +515,7 @@ ipw_dma_alloc(struct ipw_softc *sc) IPW_NDATA * sizeof(struct ipw_hdr), PAGE_SIZE, 0, &sc->hdr_seg, 1, &nsegs, BUS_DMA_NOWAIT); if (error != 0) { - aprint_error_dev(&sc->sc_dev, "could not allocate hdr memory\n"); + aprint_error_dev(sc->sc_dev, "could not allocate hdr memory\n"); goto fail; } @@ -522,14 +523,14 @@ ipw_dma_alloc(struct ipw_softc *sc) IPW_NDATA * sizeof(struct ipw_hdr), (void **)&sc->hdr_list, BUS_DMA_NOWAIT); if (error != 0) { - aprint_error_dev(&sc->sc_dev, "could not map hdr memory\n"); + aprint_error_dev(sc->sc_dev, "could not map hdr memory\n"); goto fail; } error = bus_dmamap_load(sc->sc_dmat, sc->hdr_map, sc->hdr_list, IPW_NDATA * sizeof(struct ipw_hdr), NULL, BUS_DMA_NOWAIT); if (error != 0) { - aprint_error_dev(&sc->sc_dev, "could not load hdr memory\n"); + aprint_error_dev(sc->sc_dev, "could not load hdr memory\n"); goto fail; } @@ -557,7 +558,7 @@ ipw_dma_alloc(struct ipw_softc *sc) error = bus_dmamap_create(sc->sc_dmat, MCLBYTES, IPW_MAX_NSEG, MCLBYTES, 0, BUS_DMA_NOWAIT, &sbuf->map); if (error != 0) { - aprint_error_dev(&sc->sc_dev, "could not create txbuf dma map\n"); + aprint_error_dev(sc->sc_dev, "could not create txbuf dma map\n"); goto fail; } TAILQ_INSERT_TAIL(&sc->sc_free_sbuf, sbuf, next); @@ -582,7 +583,7 @@ ipw_dma_alloc(struct ipw_softc *sc) MGETHDR(sbuf->m, M_DONTWAIT, MT_DATA); if (sbuf->m == NULL) { - aprint_error_dev(&sc->sc_dev, "could not allocate rx mbuf\n"); + aprint_error_dev(sc->sc_dev, "could not allocate rx mbuf\n"); error = ENOMEM; goto fail; } @@ -590,7 +591,7 @@ ipw_dma_alloc(struct ipw_softc *sc) MCLGET(sbuf->m, M_DONTWAIT); if (!(sbuf->m->m_flags & M_EXT)) { m_freem(sbuf->m); - aprint_error_dev(&sc->sc_dev, "could not allocate rx mbuf cluster\n"); + aprint_error_dev(sc->sc_dev, "could not allocate rx mbuf cluster\n"); error = ENOMEM; goto fail; } @@ -600,7 +601,7 @@ ipw_dma_alloc(struct ipw_softc *sc) error = bus_dmamap_create(sc->sc_dmat, MCLBYTES, 1, MCLBYTES, 0, BUS_DMA_NOWAIT | BUS_DMA_ALLOCNOW, &sbuf->map); if (error != 0) { - aprint_error_dev(&sc->sc_dev, "could not create rxbuf dma map\n"); + aprint_error_dev(sc->sc_dev, "could not create rxbuf dma map\n"); m_freem(sbuf->m); goto fail; } @@ -610,7 +611,7 @@ ipw_dma_alloc(struct ipw_softc *sc) if (error != 0) { bus_dmamap_destroy(sc->sc_dmat, sbuf->map); m_freem(sbuf->m); - aprint_error_dev(&sc->sc_dev, "could not map rxbuf dma memory\n"); + aprint_error_dev(sc->sc_dev, "could not map rxbuf dma memory\n"); goto fail; } @@ -1005,14 +1006,14 @@ ipw_data_intr(struct ipw_softc *sc, stru */ MGETHDR(mnew, M_DONTWAIT, MT_DATA); if (mnew == NULL) { - aprint_error_dev(&sc->sc_dev, "could not allocate rx mbuf\n"); + aprint_error_dev(sc->sc_dev, "could not allocate rx mbuf\n"); ifp->if_ierrors++; return; } MCLGET(mnew, M_DONTWAIT); if (!(mnew->m_flags & M_EXT)) { - aprint_error_dev(&sc->sc_dev, "could not allocate rx mbuf cluster\n"); + aprint_error_dev(sc->sc_dev, "could not allocate rx mbuf cluster\n"); m_freem(mnew); ifp->if_ierrors++; return; @@ -1027,7 +1028,7 @@ ipw_data_intr(struct ipw_softc *sc, stru error = bus_dmamap_load_mbuf(sc->sc_dmat, sbuf->map, mnew, BUS_DMA_READ | BUS_DMA_NOWAIT); if (error != 0) { - aprint_error_dev(&sc->sc_dev, "could not load rx buf DMA map\n"); + aprint_error_dev(sc->sc_dev, "could not load rx buf DMA map\n"); m_freem(mnew); /* try to reload the old mbuf */ @@ -1036,7 +1037,7 @@ ipw_data_intr(struct ipw_softc *sc, stru if (error != 0) { /* very unlikely that it will fail... */ panic("%s: unable to remap rx buf", - device_xname(&sc->sc_dev)); + device_xname(sc->sc_dev)); } ifp->if_ierrors++; return; @@ -1128,7 +1129,7 @@ ipw_rx_intr(struct ipw_softc *sc) break; default: - aprint_error_dev(&sc->sc_dev, "unknown status code %u\n", + aprint_error_dev(sc->sc_dev, "unknown status code %u\n", le16toh(status->code)); } @@ -1231,7 +1232,7 @@ ipw_intr(void *arg) CSR_WRITE_4(sc, IPW_CSR_INTR_MASK, 0); if (r & (IPW_INTR_FATAL_ERROR | IPW_INTR_PARITY_ERROR)) { - aprint_error_dev(&sc->sc_dev, "fatal error\n"); + aprint_error_dev(sc->sc_dev, "fatal error\n"); sc->sc_ic.ic_ifp->if_flags &= ~IFF_UP; ipw_stop(&sc->sc_if, 1); } @@ -1352,7 +1353,7 @@ ipw_tx_start(struct ifnet *ifp, struct m error = bus_dmamap_load_mbuf(sc->sc_dmat, sbuf->map, m0, BUS_DMA_NOWAIT); if (error != 0 && error != EFBIG) { - aprint_error_dev(&sc->sc_dev, "could not map mbuf (error %d)\n", + aprint_error_dev(sc->sc_dev, "could not map mbuf (error %d)\n", error); m_freem(m0); return error; @@ -1386,7 +1387,7 @@ ipw_tx_start(struct ifnet *ifp, struct m error = bus_dmamap_load_mbuf(sc->sc_dmat, sbuf->map, m0, BUS_DMA_WRITE | BUS_DMA_NOWAIT); if (error != 0) { - aprint_error_dev(&sc->sc_dev, "could not map mbuf (error %d)\n", error); + aprint_error_dev(sc->sc_dev, "could not map mbuf (error %d)\n", error); m_freem(m0); return error; } @@ -1525,7 +1526,7 @@ ipw_watchdog(struct ifnet *ifp) if (sc->sc_tx_timer > 0) { if (--sc->sc_tx_timer == 0) { - aprint_error_dev(&sc->sc_dev, "device timeout\n"); + aprint_error_dev(sc->sc_dev, "device timeout\n"); ifp->if_oerrors++; ifp->if_flags &= ~IFF_UP; ipw_stop(ifp, 1); @@ -1706,7 +1707,7 @@ ipw_stop_master(struct ipw_softc *sc) DELAY(10); } if (ntries == 50) - aprint_error_dev(&sc->sc_dev, "timeout waiting for master\n"); + aprint_error_dev(sc->sc_dev, "timeout waiting for master\n"); CSR_WRITE_4(sc, IPW_CSR_RST, CSR_READ_4(sc, IPW_CSR_RST) | IPW_RST_PRINCETON_RESET); @@ -1787,7 +1788,7 @@ ipw_load_ucode(struct ipw_softc *sc, u_c DELAY(10); } if (ntries == 10) { - aprint_error_dev(&sc->sc_dev, "timeout waiting for ucode to initialize\n"); + aprint_error_dev(sc->sc_dev, "timeout waiting for ucode to initialize\n"); return EIO; } @@ -1831,7 +1832,7 @@ ipw_load_firmware(struct ipw_softc *sc, /* wait at most one second for firmware initialization to complete */ if ((error = tsleep(sc, 0, "ipwinit", hz)) != 0) { - aprint_error_dev(&sc->sc_dev, "timeout waiting for firmware initialization " + aprint_error_dev(sc->sc_dev, "timeout waiting for firmware initialization " "to complete\n"); return error; } @@ -1858,7 +1859,7 @@ ipw_cache_firmware(struct ipw_softc *sc) ipw_free_firmware(sc); if (ipw_accept_eula == 0) { - aprint_error_dev(&sc->sc_dev, + aprint_error_dev(sc->sc_dev, "EULA not accepted; please see the ipw(4) man page.\n"); return EPERM; } @@ -2140,7 +2141,7 @@ ipw_init(struct ifnet *ifp) if (!(sc->flags & IPW_FLAG_FW_CACHED)) { if (ipw_cache_firmware(sc) != 0) { - aprint_error_dev(&sc->sc_dev, "could not cache the firmware (%s)\n", + aprint_error_dev(sc->sc_dev, "could not cache the firmware (%s)\n", sc->sc_fwname); goto fail; } @@ -2149,12 +2150,12 @@ ipw_init(struct ifnet *ifp) ipw_stop(ifp, 0); if (ipw_reset(sc) != 0) { - aprint_error_dev(&sc->sc_dev, "could not reset adapter\n"); + aprint_error_dev(sc->sc_dev, "could not reset adapter\n"); goto fail; } if (ipw_load_ucode(sc, fw->ucode, fw->ucode_size) != 0) { - aprint_error_dev(&sc->sc_dev, "could not load microcode\n"); + aprint_error_dev(sc->sc_dev, "could not load microcode\n"); goto fail; } @@ -2181,7 +2182,7 @@ ipw_init(struct ifnet *ifp) CSR_WRITE_4(sc, IPW_CSR_STATUS_BASE, sc->status_map->dm_segs[0].ds_addr); if (ipw_load_firmware(sc, fw->main, fw->main_size) != 0) { - aprint_error_dev(&sc->sc_dev, "could not load firmware\n"); + aprint_error_dev(sc->sc_dev, "could not load firmware\n"); goto fail; } @@ -2194,7 +2195,7 @@ ipw_init(struct ifnet *ifp) ipw_write_table1(sc, IPW_INFO_LOCK, 0); if (ipw_config(sc) != 0) { - aprint_error_dev(&sc->sc_dev, "device configuration failed\n"); + aprint_error_dev(sc->sc_dev, "device configuration failed\n"); goto fail; } Index: sys/dev/pci/if_ipwvar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/pci/if_ipwvar.h,v retrieving revision 1.15 diff -u -p -r1.15 if_ipwvar.h --- sys/dev/pci/if_ipwvar.h 19 Jan 2010 22:07:00 -0000 1.15 +++ sys/dev/pci/if_ipwvar.h 26 Sep 2012 23:52:03 -0000 @@ -81,7 +81,7 @@ struct ipw_tx_radiotap_header { ((1 << IEEE80211_RADIOTAP_CHANNEL)) struct ipw_softc { - struct device sc_dev; + device_t sc_dev; struct ethercom sc_ec; struct ieee80211com sc_ic; Index: sys/dev/pci/if_kse.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/pci/if_kse.c,v retrieving revision 1.22 diff -u -p -r1.22 if_kse.c --- sys/dev/pci/if_kse.c 5 Apr 2010 07:20:26 -0000 1.22 +++ sys/dev/pci/if_kse.c 26 Sep 2012 23:53:13 -0000 @@ -200,7 +200,7 @@ struct kse_rxsoft { }; struct kse_softc { - struct device sc_dev; /* generic device information */ + device_t sc_dev; /* generic device information */ bus_space_tag_t sc_st; /* bus space tag */ bus_space_handle_t sc_sh; /* bus space handle */ bus_dma_tag_t sc_dmat; /* bus DMA tag */ @@ -298,7 +298,7 @@ u_int kse_monitor_rxintr; /* fragmented static int kse_match(device_t, cfdata_t, void *); static void kse_attach(device_t, device_t, void *); -CFATTACH_DECL(kse, sizeof(struct kse_softc), +CFATTACH_DECL_NEW(kse, sizeof(struct kse_softc), kse_match, kse_attach, NULL, NULL); static int kse_ioctl(struct ifnet *, u_long, void *); @@ -361,6 +361,7 @@ kse_attach(device_t parent, device_t sel return; } + sc->sc_dev = self; sc->sc_dmat = pa->pa_dmat; /* Make sure bus mastering is enabled. */ @@ -378,12 +379,12 @@ kse_attach(device_t parent, device_t sel * this state, so punt. */ printf("%s: unable to wake from power state D3\n", - device_xname(&sc->sc_dev)); + device_xname(sc->sc_dev)); return; } if (pmode != PCI_PMCSR_STATE_D0) { printf("%s: waking up from power date D%d\n", - device_xname(&sc->sc_dev), pmode); + device_xname(sc->sc_dev), pmode); pci_conf_write(pc, pa->pa_tag, pmreg + PCI_PMCSR, PCI_PMCSR_STATE_D0); } @@ -403,7 +404,7 @@ kse_attach(device_t parent, device_t sel i = CSR_READ_2(sc, MARH); enaddr[1] = i; enaddr[0] = i >> 8; printf("%s: Ethernet address: %s\n", - device_xname(&sc->sc_dev), ether_sprintf(enaddr)); + device_xname(sc->sc_dev), ether_sprintf(enaddr)); /* * Enable chip function. @@ -414,19 +415,19 @@ kse_attach(device_t parent, device_t sel * Map and establish our interrupt. */ if (pci_intr_map(pa, &ih)) { - aprint_error_dev(&sc->sc_dev, "unable to map interrupt\n"); + aprint_error_dev(sc->sc_dev, "unable to map interrupt\n"); return; } intrstr = pci_intr_string(pc, ih); sc->sc_ih = pci_intr_establish(pc, ih, IPL_NET, kse_intr, sc); if (sc->sc_ih == NULL) { - aprint_error_dev(&sc->sc_dev, "unable to establish interrupt"); + aprint_error_dev(sc->sc_dev, "unable to establish interrupt"); 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); /* * Allocate the control data structures, and create and load the @@ -435,28 +436,28 @@ kse_attach(device_t parent, device_t sel error = bus_dmamem_alloc(sc->sc_dmat, sizeof(struct kse_control_data), PAGE_SIZE, 0, &seg, 1, &nseg, 0); if (error != 0) { - aprint_error_dev(&sc->sc_dev, "unable to allocate control data, error = %d\n", error); + aprint_error_dev(sc->sc_dev, "unable to allocate control data, error = %d\n", error); goto fail_0; } error = bus_dmamem_map(sc->sc_dmat, &seg, nseg, sizeof(struct kse_control_data), (void **)&sc->sc_control_data, BUS_DMA_COHERENT); if (error != 0) { - aprint_error_dev(&sc->sc_dev, "unable to map control data, error = %d\n", error); + aprint_error_dev(sc->sc_dev, "unable to map control data, error = %d\n", error); goto fail_1; } error = bus_dmamap_create(sc->sc_dmat, sizeof(struct kse_control_data), 1, sizeof(struct kse_control_data), 0, 0, &sc->sc_cddmamap); if (error != 0) { - aprint_error_dev(&sc->sc_dev, "unable to create control data DMA map, " + aprint_error_dev(sc->sc_dev, "unable to create control data DMA map, " "error = %d\n", error); goto fail_2; } error = bus_dmamap_load(sc->sc_dmat, sc->sc_cddmamap, sc->sc_control_data, sizeof(struct kse_control_data), NULL, 0); if (error != 0) { - aprint_error_dev(&sc->sc_dev, "unable to load control data DMA map, error = %d\n", + aprint_error_dev(sc->sc_dev, "unable to load control data DMA map, error = %d\n", error); goto fail_3; } @@ -464,7 +465,7 @@ kse_attach(device_t parent, device_t sel if ((error = bus_dmamap_create(sc->sc_dmat, MCLBYTES, KSE_NTXSEGS, MCLBYTES, 0, 0, &sc->sc_txsoft[i].txs_dmamap)) != 0) { - aprint_error_dev(&sc->sc_dev, "unable to create tx DMA map %d, " + aprint_error_dev(sc->sc_dev, "unable to create tx DMA map %d, " "error = %d\n", i, error); goto fail_4; } @@ -472,7 +473,7 @@ kse_attach(device_t parent, device_t sel for (i = 0; i < KSE_NRXDESC; i++) { if ((error = bus_dmamap_create(sc->sc_dmat, MCLBYTES, 1, MCLBYTES, 0, 0, &sc->sc_rxsoft[i].rxs_dmamap)) != 0) { - aprint_error_dev(&sc->sc_dev, "unable to create rx DMA map %d, " + aprint_error_dev(sc->sc_dev, "unable to create rx DMA map %d, " "error = %d\n", i, error); goto fail_5; } @@ -499,10 +500,10 @@ kse_attach(device_t parent, device_t sel } printf("%s: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto\n", - device_xname(&sc->sc_dev)); + device_xname(sc->sc_dev)); 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_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; ifp->if_ioctl = kse_ioctl; @@ -529,7 +530,7 @@ kse_attach(device_t parent, device_t sel #ifdef KSE_EVENT_COUNTERS for (i = 0; i < p; i++) { struct ksext *ee = &sc->sc_ext; - sprintf(ee->evcntname[i], "%s.%d", device_xname(&sc->sc_dev), i+1); + sprintf(ee->evcntname[i], "%s.%d", device_xname(sc->sc_dev), i+1); evcnt_attach_dynamic(&ee->pev[i][0], EVCNT_TYPE_MISC, NULL, ee->evcntname[i], "RxLoPriotyByte"); evcnt_attach_dynamic(&ee->pev[i][1], EVCNT_TYPE_MISC, @@ -710,7 +711,7 @@ kse_init(struct ifnet *ifp) if ((error = add_rxbuf(sc, i)) != 0) { printf("%s: unable to allocate or map rx " "buffer %d, error = %d\n", - device_xname(&sc->sc_dev), i, error); + device_xname(sc->sc_dev), i, error); rxdrain(sc); goto out; } @@ -793,7 +794,7 @@ kse_init(struct ifnet *ifp) if (error) { ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE); ifp->if_timer = 0; - printf("%s: interface not running\n", device_xname(&sc->sc_dev)); + printf("%s: interface not running\n", device_xname(sc->sc_dev)); } return error; } @@ -854,7 +855,7 @@ kse_watchdog(struct ifnet *ifp) if (sc->sc_txfree != KSE_NTXDESC) { printf("%s: device timeout (txfree %d txsfree %d txnext %d)\n", - device_xname(&sc->sc_dev), sc->sc_txfree, sc->sc_txsfree, + device_xname(sc->sc_dev), sc->sc_txfree, sc->sc_txsfree, sc->sc_txnext); ifp->if_oerrors++; @@ -863,7 +864,7 @@ kse_watchdog(struct ifnet *ifp) } else if (ifp->if_flags & IFF_DEBUG) printf("%s: recovered from device timeout\n", - device_xname(&sc->sc_dev)); + device_xname(sc->sc_dev)); /* Try to get more packets going. */ kse_start(ifp); @@ -911,7 +912,7 @@ kse_start(struct ifnet *ifp) if (error == EFBIG) { printf("%s: Tx packet consumes too many " "DMA segments, dropping...\n", - device_xname(&sc->sc_dev)); + device_xname(sc->sc_dev)); IFQ_DEQUEUE(&ifp->if_snd, m0); m_freem(m0); continue; @@ -1080,7 +1081,7 @@ add_rxbuf(struct kse_softc *sc, int idx) m->m_ext.ext_buf, m->m_ext.ext_size, NULL, BUS_DMA_NOWAIT); if (error) { printf("%s: can't load rx DMA map %d, error = %d\n", - device_xname(&sc->sc_dev), idx, error); + device_xname(sc->sc_dev), idx, error); panic("kse_add_rxbuf"); } @@ -1124,7 +1125,7 @@ kse_intr(void *arg) if (isr & INT_DMLCS) lnkchg(sc); if (isr & INT_DMRBUS) - printf("%s: Rx descriptor full\n", device_xname(&sc->sc_dev)); + printf("%s: Rx descriptor full\n", device_xname(sc->sc_dev)); CSR_WRITE_4(sc, INTST, isr); return 1; @@ -1157,7 +1158,7 @@ rxintr(struct kse_softc *sc) #define PRINTERR(bit, str) \ if (rxstat & (bit)) \ printf("%s: receive error: %s\n", \ - device_xname(&sc->sc_dev), str) + device_xname(sc->sc_dev), str) PRINTERR(R0_TL, "frame too long"); PRINTERR(R0_RF, "runt frame"); PRINTERR(R0_CE, "bad FCS"); @@ -1252,7 +1253,7 @@ lnkchg(struct kse_softc *sc) struct ifmediareq ifmr; #if 0 /* rambling link status */ - printf("%s: link %s\n", device_xname(&sc->sc_dev), + printf("%s: link %s\n", device_xname(sc->sc_dev), (CSR_READ_2(sc, P1SR) & (1U << 5)) ? "up" : "down"); #endif ifmedia_sts(&sc->sc_ethercom.ec_if, &ifmr); Index: sys/dev/pci/if_lmc.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/pci/if_lmc.c,v retrieving revision 1.50 diff -u -p -r1.50 if_lmc.c --- sys/dev/pci/if_lmc.c 13 Nov 2010 13:52:06 -0000 1.50 +++ sys/dev/pci/if_lmc.c 2 Oct 2012 03:40:40 -0000 @@ -3562,7 +3562,7 @@ ifnet_attach(softc_t *sc) # endif /* Every OS does it differently! */ - strlcpy(sc->ifp->if_xname, device_xname(&sc->dev), IFNAMSIZ); + strlcpy(sc->ifp->if_xname, device_xname(sc->sc_dev), IFNAMSIZ); IFQ_SET_MAXLEN(&sc->ifp->if_snd, SNDQ_MAXLEN); IFQ_SET_READY(&sc->ifp->if_snd); @@ -5380,8 +5380,7 @@ print_driver_info(void) /* Looking for a DEC 21140A chip on any Lan Media Corp card. */ /* context: kernel (boot) or process (syscall) */ static int -nbsd_match(struct device *parent, cfdata_t match, - void *aux) +nbsd_match(device_t parent, cfdata_t match, void *aux) { struct pci_attach_args *pa = aux; u_int32_t cfid = pci_conf_read(pa->pa_pc, pa->pa_tag, TLP_CFID); @@ -5405,7 +5404,7 @@ nbsd_match(struct device *parent, cfdata /* NetBSD bottom-half initialization. */ /* context: kernel (boot) or process (syscall) */ static void -nbsd_attach(struct device *parent, struct device *self, void *aux) +nbsd_attach(device_t parent, device_t self, void *aux) { softc_t *sc = (softc_t *)self; /* device is first in softc */ struct pci_attach_args *pa = aux; @@ -5414,6 +5413,7 @@ nbsd_attach(struct device *parent, struc int error; /* for READ/WRITE_PCI_CFG() */ + sc->sc_dev = self; sc->pa_pc = pa->pa_pc; sc->pa_tag = pa->pa_tag; sc->pa_dmat = pa->pa_dmat; @@ -5493,9 +5493,9 @@ nbsd_attach(struct device *parent, struc /* context: kernel (boot) or process (syscall) */ static int -nbsd_detach(struct device *self, int flags) +nbsd_detach(device_t self, int flags) { - softc_t *sc = (softc_t *)self; /* device is first in softc */ + softc_t *sc = device_private(self); /* Detach from the bus and the kernel. */ lmc_detach(sc); @@ -5514,9 +5514,5 @@ nbsd_detach(struct device *self, int fla return 0; } -CFATTACH_DECL(lmc, sizeof(softc_t), /* lmc_ca */ +CFATTACH_DECL_NEW(lmc, sizeof(softc_t), /* lmc_ca */ nbsd_match, nbsd_attach, nbsd_detach, NULL); - - - - Index: sys/dev/pci/if_lmc.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/pci/if_lmc.h,v retrieving revision 1.20 diff -u -p -r1.20 if_lmc.h --- sys/dev/pci/if_lmc.h 13 Mar 2012 18:40:32 -0000 1.20 +++ sys/dev/pci/if_lmc.h 2 Oct 2012 03:37:17 -0000 @@ -964,7 +964,7 @@ typedef int intr_return_t; # define WRITE_PCI_CFG(sc, addr, data) pci_conf_write((sc)->pa_pc, (sc)->pa_tag, addr, data) # define READ_CSR(sc, csr) bus_space_read_4 ((sc)->csr_tag, (sc)->csr_handle, csr) # define WRITE_CSR(sc, csr, val) bus_space_write_4((sc)->csr_tag, (sc)->csr_handle, csr, val) -# define NAME_UNIT device_xname(&sc->dev) +# define NAME_UNIT device_xname(sc->sc_dev) # define BOOT_VERBOSE (boothowto & AB_VERBOSE) # define TOP_LOCK(sc) (mutex_spin_enter(&(sc)->top_lock), 0) # define TOP_TRYLOCK(sc) mutex_tryenter(&(sc)->top_lock) @@ -1103,7 +1103,7 @@ struct stack /* an object */ struct softc { - struct device dev; /* must be first in softc */ + device_t sc_dev; pcitag_t pa_tag; pci_chipset_tag_t pa_pc; bus_dma_tag_t pa_dmat; @@ -1382,9 +1382,9 @@ static void tulip_detach(void *); static void print_driver_info(void); -static int nbsd_match(struct device *, cfdata_t, void *); -static void nbsd_attach(struct device *, struct device *, void *); -static int nbsd_detach(struct device *, int); +static int nbsd_match(device_t, cfdata_t, void *); +static void nbsd_attach(device_t, device_t, void *); +static int nbsd_detach(device_t, int); #endif /* KERNEL */ Index: sys/dev/pci/if_mskvar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/pci/if_mskvar.h,v retrieving revision 1.10 diff -u -p -r1.10 if_mskvar.h --- sys/dev/pci/if_mskvar.h 2 Feb 2012 19:43:05 -0000 1.10 +++ sys/dev/pci/if_mskvar.h 2 Oct 2012 02:26:48 -0000 @@ -184,7 +184,7 @@ struct sk_if_softc; /* Softc for the Yukon-II controller. */ struct sk_softc { - struct device *sk_dev; /* generic device */ + device_t sk_dev; bus_space_handle_t sk_bhandle; /* bus space handle */ bus_space_tag_t sk_btag; /* bus space tag */ void *sk_intrhand; /* irq handler handle */ @@ -210,7 +210,7 @@ struct sk_softc { /* Softc for each logical interface */ struct sk_if_softc { - struct device *sk_dev; /* generic device */ + device_t sk_dev; struct ethercom sk_ethercom; /* interface info */ struct mii_data sk_mii; u_int8_t sk_enaddr[ETHER_ADDR_LEN]; /* station addr */ Index: sys/dev/pci/if_mtd_pci.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/pci/if_mtd_pci.c,v retrieving revision 1.17 diff -u -p -r1.17 if_mtd_pci.c --- sys/dev/pci/if_mtd_pci.c 30 Jan 2012 19:41:20 -0000 1.17 +++ sys/dev/pci/if_mtd_pci.c 26 Sep 2012 23:56:08 -0000 @@ -70,7 +70,7 @@ static struct mtd_pci_device_id mtd_ids[ static int mtd_pci_match(device_t, cfdata_t, void *); static void mtd_pci_attach(device_t, device_t, void *); -CFATTACH_DECL(mtd_pci, sizeof(struct mtd_softc), mtd_pci_match, mtd_pci_attach, +CFATTACH_DECL_NEW(mtd_pci, sizeof(struct mtd_softc), mtd_pci_match, mtd_pci_attach, NULL, NULL); static int @@ -98,6 +98,7 @@ mtd_pci_attach(device_t parent, device_t bus_space_handle_t ioh, memh; int io_valid, mem_valid; + sc->dev = self; pci_aprint_devinfo(pa, NULL); io_valid = (pci_mapreg_map(pa, PCI_IO_MAP_REG, PCI_MAPREG_TYPE_IO, @@ -113,7 +114,7 @@ mtd_pci_attach(device_t parent, device_t sc->bus_tag = iot; sc->bus_handle = ioh; } else { - aprint_error_dev(&sc->dev, "could not map memory or i/o space\n"); + aprint_error_dev(sc->dev, "could not map memory or i/o space\n"); return; } sc->dma_tag = pa->pa_dmat; @@ -122,19 +123,19 @@ mtd_pci_attach(device_t parent, device_t mtd_config(sc); if (pci_intr_map(pa, &ih)) { - aprint_error_dev(&sc->dev, "could not map interrupt\n"); + aprint_error_dev(sc->dev, "could not map interrupt\n"); return; } intrstring = pci_intr_string(pa->pa_pc, ih); if (pci_intr_establish(pa->pa_pc, ih, IPL_NET, mtd_irq_h, sc) == NULL) { - aprint_error_dev(&sc->dev, "could not establish interrupt"); + aprint_error_dev(sc->dev, "could not establish interrupt"); if (intrstring != NULL) aprint_error(" at %s", intrstring); aprint_error("\n"); return; } else { - aprint_normal_dev(&sc->dev, "using %s for interrupt\n", + aprint_normal_dev(sc->dev, "using %s for interrupt\n", intrstring ? intrstring : "unknown interrupt"); } } Index: sys/dev/pci/if_ntwoc_pci.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/pci/if_ntwoc_pci.c,v retrieving revision 1.27 diff -u -p -r1.27 if_ntwoc_pci.c --- sys/dev/pci/if_ntwoc_pci.c 26 Jul 2011 20:51:24 -0000 1.27 +++ sys/dev/pci/if_ntwoc_pci.c 26 Sep 2012 23:57:57 -0000 @@ -101,7 +101,7 @@ static void ntwoc_pci_config_interrupts( struct ntwoc_pci_softc { /* Generic device stuff */ - struct device sc_dev; /* Common to all devices */ + device_t sc_dev; /* Common to all devices */ /* PCI chipset glue */ pci_intr_handle_t *sc_ih; /* Interrupt handler */ @@ -125,7 +125,7 @@ static int ntwoc_pci_intr(void *); static void ntwoc_pci_setup_dma(struct sca_softc *); static void ntwoc_pci_shutdown(void *sc); -CFATTACH_DECL(ntwoc_pci, sizeof(struct ntwoc_pci_softc), +CFATTACH_DECL_NEW(ntwoc_pci, sizeof(struct ntwoc_pci_softc), ntwoc_pci_match, ntwoc_pci_attach, NULL, NULL); /* @@ -202,14 +202,14 @@ ntwoc_pci_attach(device_t parent, device u_int numports; printf(": N2 Serial Interface\n"); - flags = device_cfdata(&sc->sc_dev)->cf_flags; + flags = device_cfdata(self)->cf_flags; /* * Map in the ASIC configuration space */ if (pci_mapreg_map(pa, PCI_CBMA_ASIC, PCI_MAPREG_TYPE_MEM, 0, &sc->sc_asic_iot, &sc->sc_asic_ioh, NULL, NULL)) { - aprint_error_dev(&sc->sc_dev, "Can't map register space (ASIC)\n"); + aprint_error_dev(self, "Can't map register space (ASIC)\n"); return; } /* @@ -217,7 +217,7 @@ ntwoc_pci_attach(device_t parent, device */ if (pci_mapreg_map(pa, PCI_CBMA_SCA, PCI_MAPREG_TYPE_MEM, 0, &sca->sc_iot, &sca->sc_ioh, NULL, NULL)) { - aprint_error_dev(&sc->sc_dev, "Can't map register space (SCA)\n"); + aprint_error_dev(self, "Can't map register space (SCA)\n"); return; } @@ -231,20 +231,20 @@ ntwoc_pci_attach(device_t parent, device * Map and establish the interrupt */ if (pci_intr_map(pa, &ih)) { - aprint_error_dev(&sc->sc_dev, "couldn't map interrupt\n"); + aprint_error_dev(self, "couldn't map interrupt\n"); return; } intrstr = pci_intr_string(pa->pa_pc, ih); sc->sc_ih = pci_intr_establish(pa->pa_pc, ih, IPL_NET, ntwoc_pci_intr, sc); if (sc->sc_ih == NULL) { - aprint_error_dev(&sc->sc_dev, "couldn't establish interrupt"); + aprint_error_dev(self, "couldn't establish interrupt"); 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(self, "interrupting at %s\n", intrstr); /* * Perform total black magic. This is not only extremely @@ -290,7 +290,7 @@ ntwoc_pci_attach(device_t parent, device */ frontend_cr = bus_space_read_2(sca->sc_iot, sca->sc_ioh, NTWOC_FECR); NTWO_DPRINTF(("%s: frontend_cr = 0x%04x\n", - device_xname(&sc->sc_dev), frontend_cr)); + device_xname(self), frontend_cr)); db0 = (frontend_cr & NTWOC_FECR_ID0) >> NTWOC_FECR_ID0_SHIFT; db1 = (frontend_cr & NTWOC_FECR_ID1) >> NTWOC_FECR_ID1_SHIFT; @@ -299,7 +299,7 @@ ntwoc_pci_attach(device_t parent, device * Port 1 HAS to be present. If it isn't, don't attach anything. */ if (db0 == NTWOC_FE_ID_NONE) { - printf("%s: no ports available\n", device_xname(&sc->sc_dev)); + printf("%s: no ports available\n", device_xname(self)); return; } @@ -311,12 +311,12 @@ ntwoc_pci_attach(device_t parent, device if (db1 != NTWOC_FE_ID_NONE) numports++; - printf("%s: %d port%s\n", device_xname(&sc->sc_dev), numports, + printf("%s: %d port%s\n", device_xname(self), numports, (numports > 1 ? "s" : "")); - printf("%s: port 0 interface card: %s\n", device_xname(&sc->sc_dev), + printf("%s: port 0 interface card: %s\n", device_xname(self), ntwoc_pci_db_names[db0]); if (numports > 1) - printf("%s: port 1 interface card: %s\n", device_xname(&sc->sc_dev), + printf("%s: port 1 interface card: %s\n", device_xname(self), ntwoc_pci_db_names[db1]); /* @@ -333,7 +333,7 @@ ntwoc_pci_attach(device_t parent, device * on the number of ports we passed in, the size of each * buffer, and the number of buffers per port. */ - sca->sc_parent = &sc->sc_dev; + sca->sc_parent = self; sca->sc_read_1 = ntwoc_pci_sca_read_1; sca->sc_read_2 = ntwoc_pci_sca_read_2; sca->sc_write_1 = ntwoc_pci_sca_write_1; @@ -726,7 +726,7 @@ ntwoc_pci_config_interrupts(device_t sel { struct ntwoc_pci_softc *sc; - sc = (void *)self; + sc = device_private(self); sca_get_base_clock(&sc->sc_sca); sca_print_clock_info(&sc->sc_sca); } Index: sys/dev/pci/if_sf_pci.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/pci/if_sf_pci.c,v retrieving revision 1.18 diff -u -p -r1.18 if_sf_pci.c --- sys/dev/pci/if_sf_pci.c 26 Nov 2009 15:17:10 -0000 1.18 +++ sys/dev/pci/if_sf_pci.c 27 Sep 2012 00:00:51 -0000 @@ -74,7 +74,7 @@ struct sf_pci_softc { static int sf_pci_match(device_t, cfdata_t, void *); static void sf_pci_attach(device_t, device_t, void *); -CFATTACH_DECL(sf_pci, sizeof(struct sf_pci_softc), +CFATTACH_DECL_NEW(sf_pci, sizeof(struct sf_pci_softc), sf_pci_match, sf_pci_attach, NULL, NULL); struct sf_pci_product { @@ -177,6 +177,7 @@ sf_pci_attach(device_t parent, device_t pcireg_t reg; int error, ioh_valid, memh_valid; + sc->sc_dev = self; spp = sf_pci_lookup(pa); if (spp == NULL) { printf("\n"); @@ -188,7 +189,7 @@ sf_pci_attach(device_t parent, device_t /* power up chip */ if ((error = pci_activate(pa->pa_pc, pa->pa_tag, self, NULL)) && error != EOPNOTSUPP) { - aprint_error_dev(&sc->sc_dev, "cannot activate %d\n", + aprint_error_dev(self, "cannot activate %d\n", error); return; } @@ -222,7 +223,7 @@ sf_pci_attach(device_t parent, device_t sc->sc_sh = ioh; sc->sc_iomapped = 1; } else { - aprint_error_dev(&sc->sc_dev, "unable to map device registers\n"); + aprint_error_dev(self, "unable to map device registers\n"); return; } @@ -237,19 +238,19 @@ sf_pci_attach(device_t parent, device_t * Map and establish our interrupt. */ if (pci_intr_map(pa, &ih)) { - aprint_error_dev(&sc->sc_dev, "unable to map interrupt\n"); + aprint_error_dev(self, "unable to map interrupt\n"); return; } intrstr = pci_intr_string(pa->pa_pc, ih); psc->sc_ih = pci_intr_establish(pa->pa_pc, ih, IPL_NET, sf_intr, sc); if (psc->sc_ih == NULL) { - aprint_error_dev(&sc->sc_dev, "unable to establish interrupt"); + aprint_error_dev(self, "unable to establish interrupt"); 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(self, "interrupting at %s\n", intrstr); /* * Finish off the attach. Index: sys/dev/pci/if_ste.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/pci/if_ste.c,v retrieving revision 1.43 diff -u -p -r1.43 if_ste.c --- sys/dev/pci/if_ste.c 22 Jul 2012 14:33:03 -0000 1.43 +++ sys/dev/pci/if_ste.c 27 Sep 2012 00:02:34 -0000 @@ -117,7 +117,7 @@ struct ste_descsoft { * Software state per device. */ struct ste_softc { - struct device sc_dev; /* generic device information */ + device_t sc_dev; /* generic device information */ bus_space_tag_t sc_st; /* bus space tag */ bus_space_handle_t sc_sh; /* bus space handle */ bus_dma_tag_t sc_dmat; /* bus DMA tag */ @@ -224,7 +224,7 @@ static void ste_attach(device_t, device_ int ste_copy_small = 0; -CFATTACH_DECL(ste, sizeof(struct ste_softc), +CFATTACH_DECL_NEW(ste, sizeof(struct ste_softc), ste_match, ste_attach, NULL, NULL); static uint32_t ste_mii_bitbang_read(device_t); @@ -305,6 +305,8 @@ ste_attach(device_t parent, device_t sel uint8_t enaddr[ETHER_ADDR_LEN]; uint16_t myea[ETHER_ADDR_LEN / 2]; + sc->sc_dev = self; + callout_init(&sc->sc_tick_ch, 0); sp = ste_lookup(pa); @@ -332,7 +334,7 @@ ste_attach(device_t parent, device_t sel sc->sc_st = iot; sc->sc_sh = ioh; } else { - aprint_error_dev(&sc->sc_dev, "unable to map device registers\n"); + aprint_error_dev(self, "unable to map device registers\n"); return; } @@ -346,7 +348,7 @@ ste_attach(device_t parent, device_t sel /* power up chip */ if ((error = pci_activate(pa->pa_pc, pa->pa_tag, self, NULL)) && error != EOPNOTSUPP) { - aprint_error_dev(&sc->sc_dev, "cannot activate %d\n", + aprint_error_dev(sc->sc_dev, "cannot activate %d\n", error); return; } @@ -355,19 +357,19 @@ ste_attach(device_t parent, device_t sel * Map and establish our interrupt. */ if (pci_intr_map(pa, &ih)) { - aprint_error_dev(&sc->sc_dev, "unable to map interrupt\n"); + aprint_error_dev(sc->sc_dev, "unable to map interrupt\n"); return; } intrstr = pci_intr_string(pc, ih); sc->sc_ih = pci_intr_establish(pc, ih, IPL_NET, ste_intr, sc); if (sc->sc_ih == NULL) { - aprint_error_dev(&sc->sc_dev, "unable to establish interrupt"); + aprint_error_dev(sc->sc_dev, "unable to establish interrupt"); 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); /* * Allocate the control data structures, and create and load the @@ -376,7 +378,7 @@ ste_attach(device_t parent, device_t sel if ((error = bus_dmamem_alloc(sc->sc_dmat, sizeof(struct ste_control_data), PAGE_SIZE, 0, &seg, 1, &rseg, 0)) != 0) { - aprint_error_dev(&sc->sc_dev, "unable to allocate control data, error = %d\n", + aprint_error_dev(sc->sc_dev, "unable to allocate control data, error = %d\n", error); goto fail_0; } @@ -384,7 +386,7 @@ ste_attach(device_t parent, device_t sel if ((error = bus_dmamem_map(sc->sc_dmat, &seg, rseg, sizeof(struct ste_control_data), (void **)&sc->sc_control_data, BUS_DMA_COHERENT)) != 0) { - aprint_error_dev(&sc->sc_dev, "unable to map control data, error = %d\n", + aprint_error_dev(sc->sc_dev, "unable to map control data, error = %d\n", error); goto fail_1; } @@ -392,7 +394,7 @@ ste_attach(device_t parent, device_t sel if ((error = bus_dmamap_create(sc->sc_dmat, sizeof(struct ste_control_data), 1, sizeof(struct ste_control_data), 0, 0, &sc->sc_cddmamap)) != 0) { - aprint_error_dev(&sc->sc_dev, "unable to create control data DMA map, " + aprint_error_dev(sc->sc_dev, "unable to create control data DMA map, " "error = %d\n", error); goto fail_2; } @@ -400,7 +402,7 @@ ste_attach(device_t parent, device_t sel if ((error = bus_dmamap_load(sc->sc_dmat, sc->sc_cddmamap, sc->sc_control_data, sizeof(struct ste_control_data), NULL, 0)) != 0) { - aprint_error_dev(&sc->sc_dev, "unable to load control data DMA map, error = %d\n", + aprint_error_dev(sc->sc_dev, "unable to load control data DMA map, error = %d\n", error); goto fail_3; } @@ -412,7 +414,7 @@ ste_attach(device_t parent, device_t sel if ((error = bus_dmamap_create(sc->sc_dmat, MCLBYTES, STE_NTXFRAGS, MCLBYTES, 0, 0, &sc->sc_txsoft[i].ds_dmamap)) != 0) { - aprint_error_dev(&sc->sc_dev, "unable to create tx DMA map %d, " + aprint_error_dev(sc->sc_dev, "unable to create tx DMA map %d, " "error = %d\n", i, error); goto fail_4; } @@ -424,7 +426,7 @@ ste_attach(device_t parent, device_t sel for (i = 0; i < STE_NRXDESC; i++) { if ((error = bus_dmamap_create(sc->sc_dmat, MCLBYTES, 1, MCLBYTES, 0, 0, &sc->sc_rxsoft[i].ds_dmamap)) != 0) { - aprint_error_dev(&sc->sc_dev, "unable to create rx DMA map %d, " + aprint_error_dev(sc->sc_dev, "unable to create rx DMA map %d, " "error = %d\n", i, error); goto fail_5; } @@ -446,7 +448,7 @@ ste_attach(device_t parent, device_t sel } memcpy(enaddr, myea, sizeof(enaddr)); - printf("%s: Ethernet address %s\n", device_xname(&sc->sc_dev), + printf("%s: Ethernet address %s\n", device_xname(sc->sc_dev), ether_sprintf(enaddr)); /* @@ -459,7 +461,7 @@ ste_attach(device_t parent, device_t sel sc->sc_ethercom.ec_mii = &sc->sc_mii; ifmedia_init(&sc->sc_mii.mii_media, IFM_IMASK, ether_mediachange, ether_mediastatus); - mii_attach(&sc->sc_dev, &sc->sc_mii, 0xffffffff, MII_PHY_ANY, + mii_attach(sc->sc_dev, &sc->sc_mii, 0xffffffff, MII_PHY_ANY, MII_OFFSET_ANY, 0); if (LIST_FIRST(&sc->sc_mii.mii_phys) == NULL) { ifmedia_add(&sc->sc_mii.mii_media, IFM_ETHER|IFM_NONE, 0, NULL); @@ -468,7 +470,7 @@ ste_attach(device_t parent, device_t sel ifmedia_set(&sc->sc_mii.mii_media, IFM_ETHER|IFM_AUTO); 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_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; ifp->if_ioctl = ste_ioctl; @@ -568,7 +570,7 @@ ste_dmahalt_wait(struct ste_softc *sc) } if (i == STE_TIMEOUT) - printf("%s: DMA halt timed out\n", device_xname(&sc->sc_dev)); + printf("%s: DMA halt timed out\n", device_xname(sc->sc_dev)); } /* @@ -630,14 +632,14 @@ ste_start(struct ifnet *ifp) MGETHDR(m, M_DONTWAIT, MT_DATA); if (m == NULL) { printf("%s: unable to allocate Tx mbuf\n", - device_xname(&sc->sc_dev)); + device_xname(sc->sc_dev)); break; } if (m0->m_pkthdr.len > MHLEN) { MCLGET(m, M_DONTWAIT); if ((m->m_flags & M_EXT) == 0) { printf("%s: unable to allocate Tx " - "cluster\n", device_xname(&sc->sc_dev)); + "cluster\n", device_xname(sc->sc_dev)); m_freem(m); break; } @@ -648,7 +650,7 @@ ste_start(struct ifnet *ifp) m, BUS_DMA_WRITE|BUS_DMA_NOWAIT); if (error) { printf("%s: unable to load Tx buffer, " - "error = %d\n", device_xname(&sc->sc_dev), error); + "error = %d\n", device_xname(sc->sc_dev), error); break; } } @@ -768,7 +770,7 @@ ste_watchdog(struct ifnet *ifp) { struct ste_softc *sc = ifp->if_softc; - printf("%s: device timeout\n", device_xname(&sc->sc_dev)); + printf("%s: device timeout\n", device_xname(sc->sc_dev)); ifp->if_oerrors++; ste_txintr(sc); @@ -858,7 +860,7 @@ ste_intr(void *arg) sc->sc_txthresh = 0x1ffc; printf("%s: transmit underrun, new " "threshold: %d bytes\n", - device_xname(&sc->sc_dev), + device_xname(sc->sc_dev), sc->sc_txthresh); ste_reset(sc, AC_TxReset | AC_DMA | AC_FIFO | AC_Network); @@ -871,17 +873,17 @@ ste_intr(void *arg) } if (txstat & TS_TxReleaseError) { printf("%s: Tx FIFO release error\n", - device_xname(&sc->sc_dev)); + device_xname(sc->sc_dev)); wantinit = 1; } if (txstat & TS_MaxCollisions) { printf("%s: excessive collisions\n", - device_xname(&sc->sc_dev)); + device_xname(sc->sc_dev)); wantinit = 1; } if (txstat & TS_TxStatusOverflow) { printf("%s: status overflow\n", - device_xname(&sc->sc_dev)); + device_xname(sc->sc_dev)); wantinit = 1; } bus_space_write_2(sc->sc_st, sc->sc_sh, @@ -892,7 +894,7 @@ ste_intr(void *arg) /* Host interface errors. */ if (isr & IE_HostError) { printf("%s: Host interface error\n", - device_xname(&sc->sc_dev)); + device_xname(sc->sc_dev)); wantinit = 1; } } @@ -1142,7 +1144,7 @@ ste_reset(struct ste_softc *sc, u_int32_ } if (i == STE_TIMEOUT) - printf("%s: reset failed to complete\n", device_xname(&sc->sc_dev)); + printf("%s: reset failed to complete\n", device_xname(sc->sc_dev)); delay(1000); } @@ -1230,7 +1232,7 @@ ste_init(struct ifnet *ifp) if ((error = ste_add_rxbuf(sc, i)) != 0) { printf("%s: unable to allocate or map rx " "buffer %d, error = %d\n", - device_xname(&sc->sc_dev), i, error); + device_xname(sc->sc_dev), i, error); /* * XXX Should attempt to run with fewer receive * XXX buffers instead of just failing. @@ -1332,7 +1334,7 @@ ste_init(struct ifnet *ifp) out: if (error) - printf("%s: interface not running\n", device_xname(&sc->sc_dev)); + printf("%s: interface not running\n", device_xname(sc->sc_dev)); return (error); } @@ -1442,13 +1444,13 @@ ste_read_eeprom(struct ste_softc *sc, in if (ste_eeprom_wait(sc)) printf("%s: EEPROM failed to come ready\n", - device_xname(&sc->sc_dev)); + device_xname(sc->sc_dev)); bus_space_write_2(sc->sc_st, sc->sc_sh, STE_EepromCtrl, EC_EepromAddress(offset) | EC_EepromOpcode(EC_OP_R)); if (ste_eeprom_wait(sc)) printf("%s: EEPROM read timed out\n", - device_xname(&sc->sc_dev)); + device_xname(sc->sc_dev)); *data = bus_space_read_2(sc->sc_st, sc->sc_sh, STE_EepromData); } @@ -1484,7 +1486,7 @@ ste_add_rxbuf(struct ste_softc *sc, int BUS_DMA_READ|BUS_DMA_NOWAIT); if (error) { printf("%s: can't load rx DMA map %d, error = %d\n", - device_xname(&sc->sc_dev), idx, error); + device_xname(sc->sc_dev), idx, error); panic("ste_add_rxbuf"); /* XXX */ } Index: sys/dev/pci/if_ti.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/pci/if_ti.c,v retrieving revision 1.90 diff -u -p -r1.90 if_ti.c --- sys/dev/pci/if_ti.c 13 Nov 2010 13:52:07 -0000 1.90 +++ sys/dev/pci/if_ti.c 27 Sep 2012 00:03:45 -0000 @@ -199,7 +199,7 @@ static int ti_gibinit(struct ti_softc *) static int ti_ether_ioctl(struct ifnet *, u_long, void *); -CFATTACH_DECL(ti, sizeof(struct ti_softc), +CFATTACH_DECL_NEW(ti, sizeof(struct ti_softc), ti_probe, ti_attach, NULL, NULL); /* @@ -263,7 +263,7 @@ ti_eeprom_getbyte(struct ti_softc *sc, i */ if (ti_eeprom_putbyte(sc, EEPROM_CTL_WRITE)) { printf("%s: failed to send write command, status: %x\n", - device_xname(&sc->sc_dev), CSR_READ_4(sc, TI_MISC_LOCAL_CTL)); + device_xname(sc->sc_dev), CSR_READ_4(sc, TI_MISC_LOCAL_CTL)); return (1); } @@ -272,7 +272,7 @@ ti_eeprom_getbyte(struct ti_softc *sc, i */ if (ti_eeprom_putbyte(sc, (addr >> 8) & 0xFF)) { printf("%s: failed to send address, status: %x\n", - device_xname(&sc->sc_dev), CSR_READ_4(sc, TI_MISC_LOCAL_CTL)); + device_xname(sc->sc_dev), CSR_READ_4(sc, TI_MISC_LOCAL_CTL)); return (1); } /* @@ -280,7 +280,7 @@ ti_eeprom_getbyte(struct ti_softc *sc, i */ if (ti_eeprom_putbyte(sc, addr & 0xFF)) { printf("%s: failed to send address, status: %x\n", - device_xname(&sc->sc_dev), CSR_READ_4(sc, TI_MISC_LOCAL_CTL)); + device_xname(sc->sc_dev), CSR_READ_4(sc, TI_MISC_LOCAL_CTL)); return (1); } @@ -291,7 +291,7 @@ ti_eeprom_getbyte(struct ti_softc *sc, i */ if (ti_eeprom_putbyte(sc, EEPROM_CTL_READ)) { printf("%s: failed to send read command, status: %x\n", - device_xname(&sc->sc_dev), CSR_READ_4(sc, TI_MISC_LOCAL_CTL)); + device_xname(sc->sc_dev), CSR_READ_4(sc, TI_MISC_LOCAL_CTL)); return (1); } @@ -397,7 +397,7 @@ ti_loadfw(struct ti_softc *sc) tigonFwReleaseMinor != TI_FIRMWARE_MINOR || tigonFwReleaseFix != TI_FIRMWARE_FIX) { printf("%s: firmware revision mismatch; want " - "%d.%d.%d, got %d.%d.%d\n", device_xname(&sc->sc_dev), + "%d.%d.%d, got %d.%d.%d\n", device_xname(sc->sc_dev), TI_FIRMWARE_MAJOR, TI_FIRMWARE_MINOR, TI_FIRMWARE_FIX, tigonFwReleaseMajor, tigonFwReleaseMinor, tigonFwReleaseFix); @@ -415,7 +415,7 @@ ti_loadfw(struct ti_softc *sc) tigon2FwReleaseMinor != TI_FIRMWARE_MINOR || tigon2FwReleaseFix != TI_FIRMWARE_FIX) { printf("%s: firmware revision mismatch; want " - "%d.%d.%d, got %d.%d.%d\n", device_xname(&sc->sc_dev), + "%d.%d.%d, got %d.%d.%d\n", device_xname(sc->sc_dev), TI_FIRMWARE_MAJOR, TI_FIRMWARE_MINOR, TI_FIRMWARE_FIX, tigon2FwReleaseMajor, tigon2FwReleaseMinor, tigon2FwReleaseFix); @@ -431,7 +431,7 @@ ti_loadfw(struct ti_softc *sc) break; default: printf("%s: can't load firmware: unknown hardware rev\n", - device_xname(&sc->sc_dev)); + device_xname(sc->sc_dev)); break; } @@ -494,24 +494,24 @@ ti_handle_events(struct ti_softc *sc) sc->ti_linkstat = TI_EVENT_CODE(e); if (sc->ti_linkstat == TI_EV_CODE_LINK_UP) printf("%s: 10/100 link up\n", - device_xname(&sc->sc_dev)); + device_xname(sc->sc_dev)); else if (sc->ti_linkstat == TI_EV_CODE_GIG_LINK_UP) printf("%s: gigabit link up\n", - device_xname(&sc->sc_dev)); + device_xname(sc->sc_dev)); else if (sc->ti_linkstat == TI_EV_CODE_LINK_DOWN) printf("%s: link down\n", - device_xname(&sc->sc_dev)); + device_xname(sc->sc_dev)); break; case TI_EV_ERROR: if (TI_EVENT_CODE(e) == TI_EV_CODE_ERR_INVAL_CMD) printf("%s: invalid command\n", - device_xname(&sc->sc_dev)); + device_xname(sc->sc_dev)); else if (TI_EVENT_CODE(e) == TI_EV_CODE_ERR_UNIMP_CMD) printf("%s: unknown command\n", - device_xname(&sc->sc_dev)); + device_xname(sc->sc_dev)); else if (TI_EVENT_CODE(e) == TI_EV_CODE_ERR_BADCFG) printf("%s: bad config data\n", - device_xname(&sc->sc_dev)); + device_xname(sc->sc_dev)); break; case TI_EV_FIRMWARE_UP: ti_init2(sc); @@ -525,7 +525,7 @@ ti_handle_events(struct ti_softc *sc) break; default: printf("%s: unknown event: %d\n", - device_xname(&sc->sc_dev), TI_EVENT_EVENT(e)); + device_xname(sc->sc_dev), TI_EVENT_EVENT(e)); break; } /* Advance the consumer index. */ @@ -572,7 +572,7 @@ ti_alloc_jumbo_mem(struct ti_softc *sc) if ((error = bus_dmamem_alloc(sc->sc_dmat, TI_JMEM, PAGE_SIZE, 0, &dmaseg, 1, &dmanseg, BUS_DMA_NOWAIT)) != 0) { - aprint_error_dev(&sc->sc_dev, "can't allocate jumbo buffer, error = %d\n", + aprint_error_dev(sc->sc_dev, "can't allocate jumbo buffer, error = %d\n", error); return (error); } @@ -580,7 +580,7 @@ ti_alloc_jumbo_mem(struct ti_softc *sc) if ((error = bus_dmamem_map(sc->sc_dmat, &dmaseg, dmanseg, TI_JMEM, (void **)&sc->ti_cdata.ti_jumbo_buf, BUS_DMA_NOWAIT|BUS_DMA_COHERENT)) != 0) { - aprint_error_dev(&sc->sc_dev, "can't map jumbo buffer, error = %d\n", + aprint_error_dev(sc->sc_dev, "can't map jumbo buffer, error = %d\n", error); return (error); } @@ -589,7 +589,7 @@ ti_alloc_jumbo_mem(struct ti_softc *sc) TI_JMEM, 1, TI_JMEM, 0, BUS_DMA_NOWAIT, &sc->jumbo_dmamap)) != 0) { - aprint_error_dev(&sc->sc_dev, "can't create jumbo buffer DMA map, error = %d\n", + aprint_error_dev(sc->sc_dev, "can't create jumbo buffer DMA map, error = %d\n", error); return (error); } @@ -597,7 +597,7 @@ ti_alloc_jumbo_mem(struct ti_softc *sc) if ((error = bus_dmamap_load(sc->sc_dmat, sc->jumbo_dmamap, sc->ti_cdata.ti_jumbo_buf, TI_JMEM, NULL, BUS_DMA_NOWAIT)) != 0) { - aprint_error_dev(&sc->sc_dev, "can't load jumbo buffer DMA map, error = %d\n", + aprint_error_dev(sc->sc_dev, "can't load jumbo buffer DMA map, error = %d\n", error); return (error); } @@ -620,7 +620,7 @@ ti_alloc_jumbo_mem(struct ti_softc *sc) free(sc->ti_cdata.ti_jumbo_buf, M_DEVBUF); sc->ti_cdata.ti_jumbo_buf = NULL; printf("%s: no memory for jumbo " - "buffer queue!\n", device_xname(&sc->sc_dev)); + "buffer queue!\n", device_xname(sc->sc_dev)); return (ENOBUFS); } entry->slot = i; @@ -642,7 +642,7 @@ ti_jalloc(struct ti_softc *sc) entry = SIMPLEQ_FIRST(&sc->ti_jfree_listhead); if (entry == NULL) { - printf("%s: no free jumbo buffers\n", device_xname(&sc->sc_dev)); + printf("%s: no free jumbo buffers\n", device_xname(sc->sc_dev)); return (NULL); } @@ -706,7 +706,7 @@ ti_newbuf_std(struct ti_softc *sc, int i if ((error = bus_dmamap_create(sc->sc_dmat, MCLBYTES, 1, MCLBYTES, 0, BUS_DMA_NOWAIT, &dmamap)) != 0) { - aprint_error_dev(&sc->sc_dev, "can't create recv map, error = %d\n", + aprint_error_dev(sc->sc_dev, "can't create recv map, error = %d\n", error); return (ENOMEM); } @@ -716,14 +716,14 @@ ti_newbuf_std(struct ti_softc *sc, int i if (m == NULL) { MGETHDR(m_new, M_DONTWAIT, MT_DATA); if (m_new == NULL) { - aprint_error_dev(&sc->sc_dev, "mbuf allocation failed " + aprint_error_dev(sc->sc_dev, "mbuf allocation failed " "-- packet dropped!\n"); return (ENOBUFS); } MCLGET(m_new, M_DONTWAIT); if (!(m_new->m_flags & M_EXT)) { - aprint_error_dev(&sc->sc_dev, "cluster allocation failed " + aprint_error_dev(sc->sc_dev, "cluster allocation failed " "-- packet dropped!\n"); m_freem(m_new); return (ENOBUFS); @@ -734,7 +734,7 @@ ti_newbuf_std(struct ti_softc *sc, int i if ((error = bus_dmamap_load(sc->sc_dmat, dmamap, mtod(m_new, void *), m_new->m_len, NULL, BUS_DMA_READ|BUS_DMA_NOWAIT)) != 0) { - aprint_error_dev(&sc->sc_dev, "can't load recv map, error = %d\n", + aprint_error_dev(sc->sc_dev, "can't load recv map, error = %d\n", error); return (ENOMEM); } @@ -780,7 +780,7 @@ ti_newbuf_mini(struct ti_softc *sc, int if ((error = bus_dmamap_create(sc->sc_dmat, MHLEN, 1, MHLEN, 0, BUS_DMA_NOWAIT, &dmamap)) != 0) { - aprint_error_dev(&sc->sc_dev, "can't create recv map, error = %d\n", + aprint_error_dev(sc->sc_dev, "can't create recv map, error = %d\n", error); return (ENOMEM); } @@ -790,7 +790,7 @@ ti_newbuf_mini(struct ti_softc *sc, int if (m == NULL) { MGETHDR(m_new, M_DONTWAIT, MT_DATA); if (m_new == NULL) { - aprint_error_dev(&sc->sc_dev, "mbuf allocation failed " + aprint_error_dev(sc->sc_dev, "mbuf allocation failed " "-- packet dropped!\n"); return (ENOBUFS); } @@ -800,7 +800,7 @@ ti_newbuf_mini(struct ti_softc *sc, int if ((error = bus_dmamap_load(sc->sc_dmat, dmamap, mtod(m_new, void *), m_new->m_len, NULL, BUS_DMA_READ|BUS_DMA_NOWAIT)) != 0) { - aprint_error_dev(&sc->sc_dev, "can't load recv map, error = %d\n", + aprint_error_dev(sc->sc_dev, "can't load recv map, error = %d\n", error); return (ENOMEM); } @@ -845,7 +845,7 @@ ti_newbuf_jumbo(struct ti_softc *sc, int /* Allocate the mbuf. */ MGETHDR(m_new, M_DONTWAIT, MT_DATA); if (m_new == NULL) { - aprint_error_dev(&sc->sc_dev, "mbuf allocation failed " + aprint_error_dev(sc->sc_dev, "mbuf allocation failed " "-- packet dropped!\n"); return (ENOBUFS); } @@ -854,7 +854,7 @@ ti_newbuf_jumbo(struct ti_softc *sc, int tbuf = ti_jalloc(sc); if (tbuf == NULL) { m_freem(m_new); - aprint_error_dev(&sc->sc_dev, "jumbo allocation failed " + aprint_error_dev(sc->sc_dev, "jumbo allocation failed " "-- packet dropped!\n"); return (ENOBUFS); } @@ -1053,13 +1053,13 @@ ti_init_tx_ring(struct ti_softc *sc) if ((error = bus_dmamap_create(sc->sc_dmat, ETHER_MAX_LEN_JUMBO, 40, ETHER_MAX_LEN_JUMBO, 0, BUS_DMA_NOWAIT, &dmamap)) != 0) { - aprint_error_dev(&sc->sc_dev, "can't create tx map, error = %d\n", + aprint_error_dev(sc->sc_dev, "can't create tx map, error = %d\n", error); return (ENOMEM); } dma = malloc(sizeof(*dma), M_DEVBUF, M_NOWAIT); if (!dma) { - aprint_error_dev(&sc->sc_dev, "can't alloc txdmamap_pool_entry\n"); + aprint_error_dev(sc->sc_dev, "can't alloc txdmamap_pool_entry\n"); bus_dmamap_destroy(sc->sc_dmat, dmamap); return (ENOMEM); } @@ -1096,7 +1096,7 @@ ti_add_mcast(struct ti_softc *sc, struct TI_DO_CMD_EXT(TI_CMD_EXT_ADD_MCAST, 0, 0, (void *)&ext, 2); break; default: - printf("%s: unknown hwrev\n", device_xname(&sc->sc_dev)); + printf("%s: unknown hwrev\n", device_xname(sc->sc_dev)); break; } @@ -1124,7 +1124,7 @@ ti_del_mcast(struct ti_softc *sc, struct TI_DO_CMD_EXT(TI_CMD_EXT_DEL_MCAST, 0, 0, (void *)&ext, 2); break; default: - printf("%s: unknown hwrev\n", device_xname(&sc->sc_dev)); + printf("%s: unknown hwrev\n", device_xname(sc->sc_dev)); break; } @@ -1266,7 +1266,7 @@ ti_chipinit(struct ti_softc *sc) /* Check the ROM failed bit to see if self-tests passed. */ if (CSR_READ_4(sc, TI_CPU_STATE) & TI_CPUSTATE_ROMFAIL) { printf("%s: board self-diagnostics failed!\n", - device_xname(&sc->sc_dev)); + device_xname(sc->sc_dev)); return (ENODEV); } @@ -1284,7 +1284,7 @@ ti_chipinit(struct ti_softc *sc) break; default: printf("%s: unsupported chip revision 0x%x\n", - device_xname(&sc->sc_dev), rev); + device_xname(sc->sc_dev), rev); return (ENODEV); } @@ -1329,7 +1329,7 @@ ti_chipinit(struct ti_softc *sc) if (bootverbose) printf("%s: cache line size %d not " "supported; disabling PCI MWI\n", - device_xname(&sc->sc_dev), cacheline); + device_xname(sc->sc_dev), cacheline); CSR_WRITE_4(sc, PCI_COMMAND_STATUS_REG, CSR_READ_4(sc, PCI_COMMAND_STATUS_REG) & ~PCI_COMMAND_INVALIDATE_ENABLE); @@ -1384,7 +1384,7 @@ ti_chipinit(struct ti_softc *sc) if (ti_64bitslot_war(sc)) { printf("%s: bios thinks we're in a 64 bit slot, " - "but we aren't", device_xname(&sc->sc_dev)); + "but we aren't", device_xname(sc->sc_dev)); return (EINVAL); } @@ -1632,6 +1632,7 @@ ti_attach(device_t parent, device_t self printf(": %s (rev. 0x%02x)\n", t->ti_name, PCI_REVISION(pa->pa_class)); sc = device_private(self); + sc->sc_dev = self; /* * Map control/status registers. @@ -1660,19 +1661,19 @@ ti_attach(device_t parent, device_t self /* Allocate interrupt */ 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(pc, ih); sc->sc_ih = pci_intr_establish(pc, ih, IPL_NET, ti_intr, sc); if (sc->sc_ih == NULL) { - aprint_error_dev(&sc->sc_dev, "couldn't establish interrupt"); + aprint_error_dev(sc->sc_dev, "couldn't establish interrupt"); 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); if (ti_chipinit(sc)) { aprint_error_dev(self, "chip initialization failed\n"); @@ -1735,7 +1736,7 @@ ti_attach(device_t parent, device_t self if ((error = bus_dmamem_alloc(sc->sc_dmat, sizeof(struct ti_ring_data), PAGE_SIZE, 0, &dmaseg, 1, &dmanseg, BUS_DMA_NOWAIT)) != 0) { - aprint_error_dev(&sc->sc_dev, "can't allocate ring buffer, error = %d\n", + aprint_error_dev(sc->sc_dev, "can't allocate ring buffer, error = %d\n", error); goto fail2; } @@ -1743,7 +1744,7 @@ ti_attach(device_t parent, device_t self if ((error = bus_dmamem_map(sc->sc_dmat, &dmaseg, dmanseg, sizeof(struct ti_ring_data), (void **)&sc->ti_rdata, BUS_DMA_NOWAIT|BUS_DMA_COHERENT)) != 0) { - aprint_error_dev(&sc->sc_dev, "can't map ring buffer, error = %d\n", + aprint_error_dev(sc->sc_dev, "can't map ring buffer, error = %d\n", error); goto fail2; } @@ -1752,7 +1753,7 @@ ti_attach(device_t parent, device_t self sizeof(struct ti_ring_data), 1, sizeof(struct ti_ring_data), 0, BUS_DMA_NOWAIT, &sc->info_dmamap)) != 0) { - aprint_error_dev(&sc->sc_dev, "can't create ring buffer DMA map, error = %d\n", + aprint_error_dev(sc->sc_dev, "can't create ring buffer DMA map, error = %d\n", error); goto fail2; } @@ -1760,7 +1761,7 @@ ti_attach(device_t parent, device_t self if ((error = bus_dmamap_load(sc->sc_dmat, sc->info_dmamap, sc->ti_rdata, sizeof(struct ti_ring_data), NULL, BUS_DMA_NOWAIT)) != 0) { - aprint_error_dev(&sc->sc_dev, "can't load ring buffer DMA map, error = %d\n", + aprint_error_dev(sc->sc_dev, "can't load ring buffer DMA map, error = %d\n", error); goto fail2; } @@ -1803,7 +1804,7 @@ ti_attach(device_t parent, device_t self /* Set up ifnet structure */ ifp = &sc->ethercom.ec_if; ifp->if_softc = sc; - strlcpy(ifp->if_xname, device_xname(&sc->sc_dev), IFNAMSIZ); + strlcpy(ifp->if_xname, device_xname(sc->sc_dev), IFNAMSIZ); ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; ifp->if_ioctl = ti_ioctl; ifp->if_start = ti_start; @@ -2469,7 +2470,7 @@ ti_init(void *xsc) /* Init the gen info block, ring control blocks and firmware. */ if (ti_gibinit(sc)) { - aprint_error_dev(&sc->sc_dev, "initialization failure\n"); + aprint_error_dev(sc->sc_dev, "initialization failure\n"); splx(s); return; } @@ -2489,7 +2490,7 @@ ti_init2(struct ti_softc *sc) ifp = &sc->ethercom.ec_if; /* Specify MTU and interface index. */ - CSR_WRITE_4(sc, TI_GCR_IFINDEX, device_unit(&sc->sc_dev)); /* ??? */ + CSR_WRITE_4(sc, TI_GCR_IFINDEX, device_unit(sc->sc_dev)); /* ??? */ tmp = ifp->if_mtu + ETHER_HDR_LEN + ETHER_CRC_LEN; if (sc->ethercom.ec_capenable & ETHERCAP_VLAN_MTU) @@ -2804,7 +2805,7 @@ ti_watchdog(struct ifnet *ifp) sc = ifp->if_softc; - aprint_error_dev(&sc->sc_dev, "watchdog timeout -- resetting\n"); + aprint_error_dev(sc->sc_dev, "watchdog timeout -- resetting\n"); ti_stop(sc); ti_init(sc); Index: sys/dev/pci/if_tireg.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/pci/if_tireg.h,v retrieving revision 1.19 diff -u -p -r1.19 if_tireg.h --- sys/dev/pci/if_tireg.h 7 Sep 2007 23:05:27 -0000 1.19 +++ sys/dev/pci/if_tireg.h 27 Sep 2012 00:03:16 -0000 @@ -1085,7 +1085,7 @@ struct txdmamap_pool_entry { }; struct ti_softc { - struct device sc_dev; + device_t sc_dev; struct ethercom ethercom; /* interface info */ bus_space_handle_t ti_bhandle; char *ti_vhandle; Index: sys/dev/pci/if_txp.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/pci/if_txp.c,v retrieving revision 1.38 diff -u -p -r1.38 if_txp.c --- sys/dev/pci/if_txp.c 13 Nov 2010 13:52:07 -0000 1.38 +++ sys/dev/pci/if_txp.c 27 Sep 2012 00:04:44 -0000 @@ -126,7 +126,7 @@ void txp_rxbuf_reclaim(struct txp_softc void txp_rx_reclaim(struct txp_softc *, struct txp_rx_ring *, struct txp_dma_alloc *); -CFATTACH_DECL(txp, sizeof(struct txp_softc), txp_probe, txp_attach, +CFATTACH_DECL_NEW(txp, sizeof(struct txp_softc), txp_probe, txp_attach, NULL, NULL); const struct txp_pci_match { @@ -198,6 +198,7 @@ txp_attach(device_t parent, device_t sel int i, flags; char devinfo[256]; + sc->sc_dev = self; sc->sc_cold = 1; match = txp_pcilookup(pa->pa_id); @@ -217,7 +218,7 @@ txp_attach(device_t parent, device_t sel pci_devinfo(pa->pa_id, 0, 0, devinfo, sizeof(devinfo)); #define TXP_EXTRAINFO ((flags & (TXP_USESUBSYSTEM|TXP_SERVERVERSION)) == \ (TXP_USESUBSYSTEM|TXP_SERVERVERSION) ? " (SVR)" : "") - printf(": %s%s\n%s", devinfo, TXP_EXTRAINFO, device_xname(&sc->sc_dev)); + printf(": %s%s\n%s", devinfo, TXP_EXTRAINFO, device_xname(sc->sc_dev)); command = pci_conf_read(pa->pa_pc, pa->pa_tag, PCI_COMMAND_STATUS_REG); @@ -285,7 +286,7 @@ txp_attach(device_t parent, device_t sel enaddr[4] = ((u_int8_t *)&p2)[1]; enaddr[5] = ((u_int8_t *)&p2)[0]; - printf("%s: Ethernet address %s\n", device_xname(&sc->sc_dev), + printf("%s: Ethernet address %s\n", device_xname(sc->sc_dev), ether_sprintf(enaddr)); sc->sc_cold = 0; @@ -328,7 +329,7 @@ txp_attach(device_t parent, device_t sel IFQ_SET_MAXLEN(&ifp->if_snd, TX_ENTRIES); IFQ_SET_READY(&ifp->if_snd); ifp->if_capabilities = 0; - strlcpy(ifp->if_xname, device_xname(&sc->sc_dev), IFNAMSIZ); + strlcpy(ifp->if_xname, device_xname(sc->sc_dev), IFNAMSIZ); txp_capabilities(sc); @@ -457,7 +458,7 @@ txp_download_fw(struct txp_softc *sc) WRITE_REG(sc, TXP_H2A_0, TXP_BOOTCMD_RUNTIME_IMAGE); if (txp_download_fw_wait(sc)) { - printf("%s: fw wait failed, initial\n", device_xname(&sc->sc_dev)); + printf("%s: fw wait failed, initial\n", device_xname(sc->sc_dev)); return (-1); } @@ -586,7 +587,7 @@ txp_download_fw_section(struct txp_softc if (txp_download_fw_wait(sc)) { printf("%s: fw wait failed, section %d\n", - device_xname(&sc->sc_dev), sectnum); + device_xname(sc->sc_dev), sectnum); err = -1; } @@ -673,7 +674,7 @@ txp_rx_reclaim(struct txp_softc *sc, str BUS_DMASYNC_POSTREAD); if (rxd->rx_flags & RX_FLAGS_ERROR) { - printf("%s: error 0x%x\n", device_xname(&sc->sc_dev), + printf("%s: error 0x%x\n", device_xname(sc->sc_dev), le32toh(rxd->rx_stat)); ifp->if_ierrors++; goto next; Index: sys/dev/pci/if_txpreg.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/pci/if_txpreg.h,v retrieving revision 1.5 diff -u -p -r1.5 if_txpreg.h --- sys/dev/pci/if_txpreg.h 10 Apr 2008 19:13:37 -0000 1.5 +++ sys/dev/pci/if_txpreg.h 27 Sep 2012 00:08:42 -0000 @@ -565,7 +565,7 @@ struct txp_rx_ring { }; struct txp_softc { - struct device sc_dev; /* base device */ + device_t sc_dev; /* base device */ struct ethercom sc_arpcom; /* ethernet common */ struct txp_hostvar *sc_hostvar; struct txp_boot_record *sc_boot; @@ -596,7 +596,7 @@ struct txp_softc { #define TXP_FIBER 0x4 }; -#define TXP_DEVNAME(sc) ((sc)->sc_cold ? "" : device_xname(&(sc)->sc_dev)) +#define TXP_DEVNAME(sc) ((sc)->sc_cold ? "" : device_xname((sc)->sc_dev)) struct txp_fw_file_header { u_int8_t magicid[8]; /* TYPHOON\0 */ Index: sys/dev/pci/if_xge.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/pci/if_xge.c,v retrieving revision 1.16 diff -u -p -r1.16 if_xge.c --- sys/dev/pci/if_xge.c 2 Feb 2012 19:43:06 -0000 1.16 +++ sys/dev/pci/if_xge.c 27 Sep 2012 00:05:33 -0000 @@ -138,7 +138,7 @@ static uint64_t fix_mac[] = { struct xge_softc { - struct device sc_dev; + device_t sc_dev; struct ethercom sc_ethercom; #define sc_if sc_ethercom.ec_if bus_dma_tag_t sc_dmat; @@ -244,10 +244,10 @@ pif_wkey(struct xge_softc *sc, bus_size_ } -CFATTACH_DECL(xge, sizeof(struct xge_softc), +CFATTACH_DECL_NEW(xge, sizeof(struct xge_softc), xge_match, xge_attach, NULL, NULL); -#define XNAME device_xname(&sc->sc_dev) +#define XNAME device_xname(sc->sc_dev) #define XGE_RXSYNC(desc, what) \ bus_dmamap_sync(sc->sc_dmat, sc->sc_rxmap, \ @@ -289,7 +289,7 @@ xge_attach(device_t parent, device_t sel int i; sc = device_private(self); - + sc->sc_dev = self; sc->sc_dmat = pa->pa_dmat; /* Get BAR0 address */ @@ -517,7 +517,7 @@ xge_attach(device_t parent, device_t sel ether_sprintf(enaddr)); 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_baudrate = 10000000000LL; ifp->if_init = xge_init; ifp->if_stop = xge_stop; @@ -548,13 +548,13 @@ xge_attach(device_t parent, device_t sel * Setup interrupt vector before initializing. */ if (pci_intr_map(pa, &ih)) - return aprint_error_dev(&sc->sc_dev, "unable to map interrupt\n"); + return aprint_error_dev(sc->sc_dev, "unable to map interrupt\n"); intrstr = pci_intr_string(pc, ih); if ((sc->sc_ih = pci_intr_establish(pc, ih, IPL_NET, xge_intr, sc)) == NULL) - return aprint_error_dev(&sc->sc_dev, "unable to establish interrupt at %s\n", + return aprint_error_dev(sc->sc_dev, "unable to establish interrupt at %s\n", intrstr ? intrstr : ""); - aprint_normal_dev(&sc->sc_dev, "interrupting at %s\n", intrstr); + aprint_normal_dev(sc->sc_dev, "interrupting at %s\n", intrstr); #ifdef XGE_EVENT_COUNTERS evcnt_attach_dynamic(&sc->sc_intr, EVCNT_TYPE_MISC, Index: sys/dev/pci/ifpci.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/pci/ifpci.c,v retrieving revision 1.30 diff -u -p -r1.30 ifpci.c --- sys/dev/pci/ifpci.c 6 Dec 2009 23:14:05 -0000 1.30 +++ sys/dev/pci/ifpci.c 28 Sep 2012 20:51:46 -0000 @@ -139,7 +139,7 @@ static void ifpci_attach(device_t parent static int ifpci_detach(device_t self, int flags); static int ifpci_activate(device_t self, enum devact act); -CFATTACH_DECL(ifpci, sizeof(struct ifpci_softc), +CFATTACH_DECL_NEW(ifpci, sizeof(struct ifpci_softc), ifpci_match, ifpci_attach, ifpci_detach, ifpci_activate); /*---------------------------------------------------------------------------* @@ -281,6 +281,8 @@ ifpci_attach(device_t parent, device_t s struct isdn_l3_driver *drv; u_int v; + sc->sc_dev = self; + /* announce */ printf(": Fritz!PCI card\n"); @@ -297,7 +299,7 @@ ifpci_attach(device_t parent, device_t s &sc->sc_maps[0].t, &sc->sc_maps[0].h, &psc->sc_base, &psc->sc_size) != 0 && pci_mapreg_map(pa, FRITZPCI_PORT0_IO_MAPOFF, PCI_MAPREG_TYPE_IO, 0, &sc->sc_maps[0].t, &sc->sc_maps[0].h, &psc->sc_base, &psc->sc_size) != 0) { - aprint_error_dev(&sc->sc_dev, "can't map card\n"); + aprint_error_dev(self, "can't map card\n"); return; } @@ -352,7 +354,7 @@ ifpci_attach(device_t parent, device_t s /* setup i4b infrastructure (have to roll our own here) */ /* sc->sc_isac_version = ((ISAC_READ(I_RBCH)) >> 5) & 0x03; */ - printf("%s: ISAC %s (IOM-%c)\n", device_xname(&sc->sc_dev), + printf("%s: ISAC %s (IOM-%c)\n", device_xname(self), "2085 Version A1/A2 or 2086/2186 Version 1.1", sc->sc_bustyp == BUS_TYPE_IOM1 ? '1' : '2'); @@ -386,7 +388,7 @@ ifpci_attach(device_t parent, device_t s sc->sc_freeflag2 = 0; /* init higher protocol layers */ - drv = isdn_attach_isdnif(device_xname(&sc->sc_dev), + drv = isdn_attach_isdnif(device_xname(self), "AVM Fritz!PCI", &sc->sc_l2, &ifpci_l3_driver, NBCH_BRI); sc->sc_l3token = drv; sc->sc_l2.driver = &isic_std_driver; @@ -834,7 +836,7 @@ avma1pp_hscx_intr(int h_chan, u_int stat * a look at isic_bchannel_start() in i4b_bchan.c ! */ - NDBGL1(L1_H_IRQ, "%s: chan %d - XPR, Tx Fifo Empty!", device_xname(&sc->sc_dev), h_chan); + NDBGL1(L1_H_IRQ, "%s: chan %d - XPR, Tx Fifo Empty!", device_xname(sc->sc_dev), h_chan); if(chan->out_mbuf_cur == NULL) /* last frame is transmitted */ { @@ -956,7 +958,7 @@ avma1pp_map_int(struct ifpci_softc *psc, /* Map and establish the interrupt. */ 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"); avma1pp_disable(sc); return; } @@ -964,14 +966,14 @@ avma1pp_map_int(struct ifpci_softc *psc, intrstr = pci_intr_string(pc, ih); psc->sc_ih = pci_intr_establish(pc, ih, IPL_NET, avma1pp_intr, sc); if (psc->sc_ih == NULL) { - aprint_error_dev(&sc->sc_dev, "couldn't establish interrupt"); + aprint_error_dev(sc->sc_dev, "couldn't establish interrupt"); if (intrstr != NULL) aprint_error(" at %s", intrstr); aprint_error("\n"); avma1pp_disable(sc); return; } - aprint_normal_dev(&sc->sc_dev, "interrupting at %s\n", intrstr); + aprint_normal_dev(sc->sc_dev, "interrupting at %s\n", intrstr); } static void @@ -981,7 +983,7 @@ avma1pp_hscx_init(struct isic_softc *sc, u_int param = 0; NDBGL1(L1_BCHAN, "%s: channel=%d, %s", - device_xname(&sc->sc_dev), h_chan, activate ? "activate" : "deactivate"); + device_xname(sc->sc_dev), h_chan, activate ? "activate" : "deactivate"); if (activate == 0) { @@ -1043,7 +1045,7 @@ avma1pp_bchannel_setup(isdn_layer1token } NDBGL1(L1_BCHAN, "%s: channel=%d, %s", - device_xname(&sc->sc_dev), h_chan, activate ? "activate" : "deactivate"); + device_xname(sc->sc_dev), h_chan, activate ? "activate" : "deactivate"); /* general part */ Index: sys/dev/pci/ifpci2.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/pci/ifpci2.c,v retrieving revision 1.19 diff -u -p -r1.19 ifpci2.c --- sys/dev/pci/ifpci2.c 6 Dec 2009 23:14:05 -0000 1.19 +++ sys/dev/pci/ifpci2.c 28 Sep 2012 20:51:55 -0000 @@ -139,7 +139,7 @@ static void ifpci2_attach(device_t paren static int ifpci2_detach(device_t self, int flags); static int ifpci2_activate(device_t self, enum devact act); -CFATTACH_DECL(ifritz, sizeof(struct ifpci_softc), +CFATTACH_DECL_NEW(ifritz, sizeof(struct ifpci_softc), ifpci2_match, ifpci2_attach, ifpci2_detach, ifpci2_activate); /*---------------------------------------------------------------------------* @@ -251,6 +251,8 @@ ifpci2_attach(device_t parent, device_t struct isdn_l3_driver *drv; u_int v; + sc->sc_dev = self; + /* announce */ printf(": Fritz!PCI V2 card\n"); @@ -264,7 +266,7 @@ ifpci2_attach(device_t parent, device_t sc->sc_maps[0].size = 0; if (pci_mapreg_map(pa, FRITZPCI_PORT0_IO_MAPOFF, PCI_MAPREG_TYPE_IO, 0, &sc->sc_maps[0].t, &sc->sc_maps[0].h, &psc->sc_base, &psc->sc_size) != 0) { - aprint_error_dev(&sc->sc_dev, "can't map card\n"); + aprint_error_dev(sc->sc_dev, "can't map card\n"); return; } @@ -311,7 +313,7 @@ ifpci2_attach(device_t parent, device_t /* setup i4b infrastructure (have to roll our own here) */ /* sc->sc_isac_version = ((ISAC_READ(I_RBCH)) >> 5) & 0x03; */ - printf("%s: ISACSX %s\n", device_xname(&sc->sc_dev), "PSB3186"); + printf("%s: ISACSX %s\n", device_xname(sc->sc_dev), "PSB3186"); /* init the ISAC */ isic_isacsx_init(sc); @@ -345,7 +347,7 @@ ifpci2_attach(device_t parent, device_t sc->sc_freeflag2 = 0; /* init higher protocol layers */ - drv = isdn_attach_isdnif(device_xname(&sc->sc_dev), + drv = isdn_attach_isdnif(device_xname(sc->sc_dev), "AVM Fritz!PCI V2", &sc->sc_l2, &ifpci2_l3_driver, NBCH_BRI); sc->sc_l3token = drv; sc->sc_l2.driver = &isic_std_driver; @@ -800,7 +802,7 @@ avma1pp2_hscx_intr(int h_chan, u_int sta * a look at isic_bchannel_start() in i4b_bchan.c ! */ - NDBGL1(L1_H_IRQ, "%s: chan %d - XPR, Tx Fifo Empty!", device_xname(&sc->sc_dev), h_chan); + NDBGL1(L1_H_IRQ, "%s: chan %d - XPR, Tx Fifo Empty!", device_xname(sc->sc_dev), h_chan); if(chan->out_mbuf_cur == NULL) /* last frame is transmitted */ { @@ -946,7 +948,7 @@ avma1pp2_map_int(struct ifpci_softc *psc /* Map and establish the interrupt. */ 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"); avma1pp2_disable(sc); return; } @@ -954,14 +956,14 @@ avma1pp2_map_int(struct ifpci_softc *psc intrstr = pci_intr_string(pc, ih); psc->sc_ih = pci_intr_establish(pc, ih, IPL_NET, avma1pp2_intr, sc); if (psc->sc_ih == NULL) { - aprint_error_dev(&sc->sc_dev, "couldn't establish interrupt"); + aprint_error_dev(sc->sc_dev, "couldn't establish interrupt"); if (intrstr != NULL) aprint_error(" at %s", intrstr); aprint_error("\n"); avma1pp2_disable(sc); return; } - aprint_normal_dev(&sc->sc_dev, "interrupting at %s\n", intrstr); + aprint_normal_dev(sc->sc_dev, "interrupting at %s\n", intrstr); } static void @@ -971,7 +973,7 @@ avma1pp2_hscx_init(struct isic_softc *sc u_int param = 0; NDBGL1(L1_BCHAN, "%s: channel=%d, %s", - device_xname(&sc->sc_dev), h_chan, activate ? "activate" : "deactivate"); + device_xname(sc->sc_dev), h_chan, activate ? "activate" : "deactivate"); sc->avma1pp_cmd = sc->avma1pp_prot = sc->avma1pp_txl = 0; if (activate == 0) @@ -1034,7 +1036,7 @@ avma1pp2_bchannel_setup(isdn_layer1token } NDBGL1(L1_BCHAN, "%s: channel=%d, %s", - device_xname(&sc->sc_dev), h_chan, activate ? "activate" : "deactivate"); + device_xname(sc->sc_dev), h_chan, activate ? "activate" : "deactivate"); /* general part */ Index: sys/dev/pci/iop_pci.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/pci/iop_pci.c,v retrieving revision 1.26 diff -u -p -r1.26 iop_pci.c --- sys/dev/pci/iop_pci.c 12 May 2009 08:23:01 -0000 1.26 +++ sys/dev/pci/iop_pci.c 28 Sep 2012 20:53:21 -0000 @@ -60,7 +60,7 @@ __KERNEL_RCSID(0, "$NetBSD: iop_pci.c,v static void iop_pci_attach(device_t, device_t, void *); static int iop_pci_match(device_t, cfdata_t, void *); -CFATTACH_DECL(iop_pci, sizeof(struct iop_softc), +CFATTACH_DECL_NEW(iop_pci, sizeof(struct iop_softc), iop_pci_match, iop_pci_attach, NULL, NULL); static int @@ -116,7 +116,8 @@ iop_pci_attach(device_t parent, device_t int i; sc = device_private(self); - pa = (struct pci_attach_args *)aux; + sc->sc_dev = self; + pa = aux; pc = pa->pa_pc; printf(": "); @@ -139,7 +140,7 @@ iop_pci_attach(device_t parent, device_t /* Map the register window. */ if (pci_mapreg_map(pa, i, PCI_MAPREG_TYPE_MEM, 0, &sc->sc_iot, &sc->sc_ioh, NULL, NULL)) { - aprint_error_dev(&sc->sc_dv, "can't map register window\n"); + aprint_error_dev(self, "can't map register window\n"); return; } @@ -159,7 +160,7 @@ iop_pci_attach(device_t parent, device_t #endif if (pci_mapreg_map(pa, i, PCI_MAPREG_TYPE_MEM, 0, &sc->sc_msg_iot, &sc->sc_msg_ioh, NULL, NULL)) { - aprint_error_dev(&sc->sc_dv, "can't map 2nd register window\n"); + aprint_error_dev(self, "can't map 2nd register window\n"); return; } } else { Index: sys/dev/pci/isic_pci.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/pci/isic_pci.c,v retrieving revision 1.38 diff -u -p -r1.38 isic_pci.c --- sys/dev/pci/isic_pci.c 3 Feb 2012 23:39:59 -0000 1.38 +++ sys/dev/pci/isic_pci.c 28 Sep 2012 20:56:43 -0000 @@ -76,7 +76,7 @@ static void isic_pci_isdn_attach(struct static int isic_pci_detach(device_t self, int flags); static int isic_pci_activate(device_t self, enum devact act); -CFATTACH_DECL(isic_pci, sizeof(struct pci_isic_softc), +CFATTACH_DECL_NEW(isic_pci, sizeof(struct pci_isic_softc), isic_pci_match, isic_pci_attach, isic_pci_detach, isic_pci_activate); static const struct isic_pci_product { @@ -134,6 +134,8 @@ isic_pci_attach(device_t parent, device_ struct pci_attach_args *pa = aux; const struct isic_pci_product * prod; + sc->sc_dev = self; + /* Redo probe */ prod = find_matching_card(pa); if (prod == NULL) return; /* oops - not found?!? */ @@ -148,7 +150,8 @@ isic_pci_attach(device_t parent, device_ return; /* generic setup, if needed for this card */ - if (prod->pciattach) prod->pciattach(psc, pa, prod->name); + if (prod->pciattach) + prod->pciattach(psc, pa, prod->name); } /*---------------------------------------------------------------------------* @@ -190,16 +193,16 @@ isic_pci_isdn_attach(struct pci_isic_sof switch(ret) { case 0x01: - printf("%s: IPAC PSB2115 Version 1.1\n", device_xname(&sc->sc_dev)); + printf("%s: IPAC PSB2115 Version 1.1\n", device_xname(sc->sc_dev)); break; case 0x02: - printf("%s: IPAC PSB2115 Version 1.2\n", device_xname(&sc->sc_dev)); + printf("%s: IPAC PSB2115 Version 1.2\n", device_xname(sc->sc_dev)); break; default: printf("%s: Error, IPAC version %d unknown!\n", - device_xname(&sc->sc_dev), ret); + device_xname(sc->sc_dev), ret); return; } } @@ -214,14 +217,14 @@ isic_pci_isdn_attach(struct pci_isic_sof case ISAC_VB2: case ISAC_VB3: printf("%s: ISAC %s (IOM-%c)\n", - device_xname(&sc->sc_dev), + device_xname(sc->sc_dev), ISACversion[sc->sc_isac_version], sc->sc_bustyp == BUS_TYPE_IOM1 ? '1' : '2'); break; default: printf("%s: Error, ISAC version %d unknown!\n", - device_xname(&sc->sc_dev), sc->sc_isac_version); + device_xname(sc->sc_dev), sc->sc_isac_version); return; } @@ -234,33 +237,33 @@ isic_pci_isdn_attach(struct pci_isic_sof case HSCX_VA3: case HSCX_V21: printf("%s: HSCX %s\n", - device_xname(&sc->sc_dev), + device_xname(sc->sc_dev), HSCXversion[sc->sc_hscx_version]); break; default: printf("%s: Error, HSCX version %d unknown!\n", - device_xname(&sc->sc_dev), sc->sc_hscx_version); + device_xname(sc->sc_dev), sc->sc_hscx_version); return; } } /* Map and establish the interrupt. */ 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(pc, ih); psc->sc_ih = pci_intr_establish(pc, ih, IPL_NET, isic_intr_qs1p, psc); if (psc->sc_ih == NULL) { - aprint_error_dev(&sc->sc_dev, "couldn't establish interrupt"); + aprint_error_dev(sc->sc_dev, "couldn't establish interrupt"); if (intrstr != NULL) aprint_error(" at %s", intrstr); aprint_error("\n"); return; } psc->sc_pc = pc; - aprint_normal_dev(&sc->sc_dev, "interrupting at %s\n", intrstr); + aprint_normal_dev(sc->sc_dev, "interrupting at %s\n", intrstr); sc->sc_intr_valid = ISIC_INTR_DISABLED; Index: sys/dev/pci/isic_pci_elsa_qs1p.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/pci/isic_pci_elsa_qs1p.c,v retrieving revision 1.19 diff -u -p -r1.19 isic_pci_elsa_qs1p.c --- sys/dev/pci/isic_pci_elsa_qs1p.c 14 Mar 2009 15:36:19 -0000 1.19 +++ sys/dev/pci/isic_pci_elsa_qs1p.c 28 Sep 2012 21:14:41 -0000 @@ -218,14 +218,14 @@ isic_attach_Eqs1pp(struct pci_isic_softc &sc->sc_maps[0].t, &sc->sc_maps[0].h, &psc->sc_base, &psc->sc_size) != 0 && pci_mapreg_map(pa, ELSA_PORT0_IO_MAPOFF, PCI_MAPREG_TYPE_IO, 0, &sc->sc_maps[0].t, &sc->sc_maps[0].h, &psc->sc_base, &psc->sc_size) != 0) { - aprint_error_dev(&sc->sc_dev, "can't map card registers\n"); + aprint_error_dev(sc->sc_dev, "can't map card registers\n"); return (0); } /* PLX9050 Errata #1 */ if (PCI_REVISION(pa->pa_class) == 1 && psc->sc_base & 0x00000080) { #ifdef DEBUG - printf("%s: no LCR access\n", device_xname(&sc->sc_dev)); + printf("%s: no LCR access\n", device_xname(sc->sc_dev)); #endif } else psc->flags |= PCIISIC_LCROK; @@ -233,7 +233,7 @@ isic_attach_Eqs1pp(struct pci_isic_softc sc->sc_maps[1].size = 0; if (pci_mapreg_map(pa, ELSA_PORT1_MAPOFF, PCI_MAPREG_TYPE_IO, 0, &sc->sc_maps[1].t, &sc->sc_maps[1].h, NULL, NULL)) { - aprint_error_dev(&sc->sc_dev, "can't map i/o space\n"); + aprint_error_dev(sc->sc_dev, "can't map i/o space\n"); return (0); } Index: sys/dev/pci/iteide.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/pci/iteide.c,v retrieving revision 1.17 diff -u -p -r1.17 iteide.c --- sys/dev/pci/iteide.c 31 Jul 2012 15:50:36 -0000 1.17 +++ sys/dev/pci/iteide.c 29 Sep 2012 11:39:13 -0000 @@ -204,7 +204,7 @@ ite_setup_channel(struct ata_channel *ch (cfg & IT_CFG_CABLE(channel, drive)) == 0) { ATADEBUG_PRINT(("(%s:%d:%d): " "80-wire cable not detected\n", - device_xname(&sc->sc_wdcdev.sc_atac.atac_dev), + device_xname(sc->sc_wdcdev.sc_atac.atac_dev), channel, drive), DEBUG_PROBE); drvp->UDMA_mode = 2; } Index: sys/dev/pci/iwic_bchan.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/pci/iwic_bchan.c,v retrieving revision 1.7 diff -u -p -r1.7 iwic_bchan.c --- sys/dev/pci/iwic_bchan.c 10 Apr 2008 19:13:37 -0000 1.7 +++ sys/dev/pci/iwic_bchan.c 28 Sep 2012 21:19:45 -0000 @@ -94,12 +94,12 @@ iwic_bchan_xirq(struct iwic_softc *sc, i if (irq_stat & B_EXIR_RDOV) { - NDBGL1(L1_H_XFRERR, "%s: EXIR B-channel Receive Data Overflow", device_xname(&sc->sc_dev)); + NDBGL1(L1_H_XFRERR, "%s: EXIR B-channel Receive Data Overflow", device_xname(sc->sc_dev)); } if (irq_stat & B_EXIR_XDUN) { - NDBGL1(L1_H_XFRERR, "%s: EXIR B-channel Transmit Data Underrun", device_xname(&sc->sc_dev)); + NDBGL1(L1_H_XFRERR, "%s: EXIR B-channel Transmit Data Underrun", device_xname(sc->sc_dev)); cmd |= (B_CMDR_XRST); /*XXX must retransmit frame ! */ } @@ -117,11 +117,11 @@ iwic_bchan_xirq(struct iwic_softc *sc, i if(error) { if(error & B_STAR_RDOV) - NDBGL1(L1_H_XFRERR, "%s: B-channel Receive Data Overflow", device_xname(&sc->sc_dev)); + NDBGL1(L1_H_XFRERR, "%s: B-channel Receive Data Overflow", device_xname(sc->sc_dev)); if(error & B_STAR_CRCE) - NDBGL1(L1_H_XFRERR, "%s: B-channel CRC Error", device_xname(&sc->sc_dev)); + NDBGL1(L1_H_XFRERR, "%s: B-channel CRC Error", device_xname(sc->sc_dev)); if(error & B_STAR_RMB) - NDBGL1(L1_H_XFRERR, "%s: B-channel Receive Message Aborted", device_xname(&sc->sc_dev)); + NDBGL1(L1_H_XFRERR, "%s: B-channel Receive Message Aborted", device_xname(sc->sc_dev)); } /* all error conditions checked, now decide and take action */ @@ -417,7 +417,7 @@ iwic_bchannel_setup(isdn_layer1token t, int s = splnet(); NDBGL1(L1_BCHAN, "%s: chan %d, bprot %d, activate %d", - device_xname(&sc->sc_dev), chan_no, bprot, activate); + device_xname(sc->sc_dev), chan_no, bprot, activate); /* general part */ @@ -543,7 +543,7 @@ iwic_bchannel_start(isdn_layer1token t,i s = splnet(); /* enter critical section */ - NDBGL1(L1_BCHAN, "%s: channel %d", device_xname(&sc->sc_dev), h_chan); + NDBGL1(L1_BCHAN, "%s: channel %d", device_xname(sc->sc_dev), h_chan); if(chan->state & ST_TX_ACTIVE) /* already running ? */ { Index: sys/dev/pci/iwic_dchan.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/pci/iwic_dchan.c,v retrieving revision 1.6 diff -u -p -r1.6 iwic_dchan.c --- sys/dev/pci/iwic_dchan.c 10 Apr 2008 19:13:37 -0000 1.6 +++ sys/dev/pci/iwic_dchan.c 28 Sep 2012 21:19:59 -0000 @@ -342,11 +342,11 @@ dchan_receive(struct iwic_softc *sc, int if (status & (D_RSTA_RDOV | D_RSTA_CRCE | D_RSTA_RMB)) { if (status & D_RSTA_RDOV) - NDBGL1(L1_I_ERR, "%s: D-channel Receive Data Overflow", device_xname(&sc->sc_dev)); + NDBGL1(L1_I_ERR, "%s: D-channel Receive Data Overflow", device_xname(sc->sc_dev)); if (status & D_RSTA_CRCE) - NDBGL1(L1_I_ERR, "%s: D-channel CRC Error", device_xname(&sc->sc_dev)); + NDBGL1(L1_I_ERR, "%s: D-channel CRC Error", device_xname(sc->sc_dev)); if (status & D_RSTA_RMB) - NDBGL1(L1_I_ERR, "%s: D-channel Receive Message Aborted", device_xname(&sc->sc_dev)); + NDBGL1(L1_I_ERR, "%s: D-channel Receive Message Aborted", device_xname(sc->sc_dev)); command |= D_CMDR_RRST; } else Index: sys/dev/pci/iwic_pci.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/pci/iwic_pci.c,v retrieving revision 1.17 diff -u -p -r1.17 iwic_pci.c --- sys/dev/pci/iwic_pci.c 22 May 2011 08:13:17 -0000 1.17 +++ sys/dev/pci/iwic_pci.c 28 Sep 2012 21:18:59 -0000 @@ -63,7 +63,7 @@ static int iwic_pci_probe(device_t dev, static void iwic_pci_attach(device_t parent, device_t dev, void *aux); static int iwic_pci_activate(device_t dev, enum devact); -CFATTACH_DECL(iwic_pci, sizeof(struct iwic_softc), +CFATTACH_DECL_NEW(iwic_pci, sizeof(struct iwic_softc), iwic_pci_probe, iwic_pci_attach, NULL, iwic_pci_activate); static int iwic_attach_bri(struct iwic_softc * sc); @@ -235,6 +235,7 @@ iwic_pci_attach(device_t parent, device struct pci_attach_args *pa = aux; pci_chipset_tag_t pc = pa->pa_pc; + sc->sc_dev = dev; sc->sc_cardname = iwic_find_card(pa); if (!sc->sc_cardname) @@ -244,24 +245,24 @@ iwic_pci_attach(device_t parent, device if (pci_mapreg_map(pa, IWIC_PCI_IOBA, PCI_MAPREG_TYPE_IO, 0, &sc->sc_io_bt, &sc->sc_io_bh, &sc->sc_iobase, &sc->sc_iosize)) { - aprint_error_dev(&sc->sc_dev, "unable to map registers\n"); + aprint_error_dev(sc->sc_dev, "unable to map registers\n"); return; } 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(pc, ih); sc->sc_ih = pci_intr_establish(pc, ih, IPL_NET, iwic_pci_intr, sc); if (sc->sc_ih == NULL) { - aprint_error_dev(&sc->sc_dev, "couldn't establish interrupt"); + aprint_error_dev(sc->sc_dev, "couldn't establish interrupt"); if (intrstr != NULL) aprint_error(" at %s", intrstr); aprint_error("\n"); return; } sc->sc_pc = pc; - aprint_normal_dev(&sc->sc_dev, "interrupting at %s\n", intrstr); + aprint_normal_dev(sc->sc_dev, "interrupting at %s\n", intrstr); /* disable interrupts */ IWIC_WRITE(sc, IWIC_IMASK, 0xff); @@ -363,7 +364,7 @@ iwic_attach_bri(struct iwic_softc * sc) { struct isdn_l3_driver *drv; - drv = isdn_attach_isdnif(device_xname(&sc->sc_dev), sc->sc_cardname, + drv = isdn_attach_isdnif(device_xname(sc->sc_dev), sc->sc_cardname, &sc->sc_l2, &iwic_l3_driver, NBCH_BRI); sc->sc_l3token = drv; Index: sys/dev/pci/iwicvar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/pci/iwicvar.h,v retrieving revision 1.5 diff -u -p -r1.5 iwicvar.h --- sys/dev/pci/iwicvar.h 19 Oct 2007 12:00:51 -0000 1.5 +++ sys/dev/pci/iwicvar.h 28 Sep 2012 21:07:44 -0000 @@ -99,7 +99,7 @@ struct iwic_dchan { * state of one iwic unit *---------------------------------------------------------------------------*/ struct iwic_softc { - struct device sc_dev; + device_t sc_dev; const char *sc_cardname; Index: sys/dev/pci/mlx_pci.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/pci/mlx_pci.c,v retrieving revision 1.23 diff -u -p -r1.23 mlx_pci.c --- sys/dev/pci/mlx_pci.c 26 Nov 2009 15:17:10 -0000 1.23 +++ sys/dev/pci/mlx_pci.c 26 Sep 2012 22:45:49 -0000 @@ -141,7 +141,7 @@ static struct mlx_pci_ident { }, }; -CFATTACH_DECL(mlx_pci, sizeof(struct mlx_softc), +CFATTACH_DECL_NEW(mlx_pci, sizeof(struct mlx_softc), mlx_pci_match, mlx_pci_attach, NULL, NULL); /* @@ -206,6 +206,7 @@ mlx_pci_attach(device_t parent, device_t pc = pa->pa_pc; mpi = mlx_pci_findmpi(aux); + mlx->mlx_dv = self; mlx->mlx_dmat = pa->pa_dmat; mlx->mlx_ci.ci_iftype = mpi->mpi_iftype; Index: sys/dev/pci/mly.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/pci/mly.c,v retrieving revision 1.44 diff -u -p -r1.44 mly.c --- sys/dev/pci/mly.c 13 Nov 2010 13:52:07 -0000 1.44 +++ sys/dev/pci/mly.c 28 Sep 2012 20:59:06 -0000 @@ -154,7 +154,7 @@ static int mly_user_health(struct mly_so extern struct cfdriver mly_cd; -CFATTACH_DECL(mly, sizeof(struct mly_softc), +CFATTACH_DECL_NEW(mly, sizeof(struct mly_softc), mly_match, mly_attach, NULL, NULL); dev_type_open(mlyopen); @@ -282,6 +282,7 @@ mly_attach(device_t parent, device_t sel struct scsipi_channel *chan; mly = device_private(self); + mly->mly_dv = self; pa = aux; pc = pa->pa_pc; ident = mly_find_ident(pa); @@ -355,7 +356,7 @@ mly_attach(device_t parent, device_t sel } if (intrstr != NULL) - aprint_normal_dev(&mly->mly_dv, "interrupting at %s\n", + aprint_normal_dev(self, "interrupting at %s\n", intrstr); /* @@ -393,7 +394,7 @@ mly_attach(device_t parent, device_t sel &mly->mly_sg_busaddr, &mly->mly_sg_seg); if (rv) { printf("%s: unable to allocate S/G maps\n", - device_xname(&mly->mly_dv)); + device_xname(self)); goto bad; } state++; @@ -405,7 +406,7 @@ mly_attach(device_t parent, device_t sel &mly->mly_mmbox_dmamap, (void **)&mly->mly_mmbox, &mly->mly_mmbox_busaddr, &mly->mly_mmbox_seg); if (rv) { - aprint_error_dev(&mly->mly_dv, "unable to allocate mailboxes\n"); + aprint_error_dev(self, "unable to allocate mailboxes\n"); goto bad; } state++; @@ -427,7 +428,7 @@ mly_attach(device_t parent, device_t sel * platforms where the controller BIOS does not run. */ if (mly_fwhandshake(mly)) { - aprint_error_dev(&mly->mly_dv, "unable to bring controller online\n"); + aprint_error_dev(self, "unable to bring controller online\n"); goto bad; } @@ -437,17 +438,17 @@ mly_attach(device_t parent, device_t sel * know how many we want. */ if (mly_alloc_ccbs(mly)) { - aprint_error_dev(&mly->mly_dv, "unable to allocate CCBs\n"); + aprint_error_dev(self, "unable to allocate CCBs\n"); goto bad; } state++; if (mly_get_controllerinfo(mly)) { - aprint_error_dev(&mly->mly_dv, "unable to retrieve controller info\n"); + aprint_error_dev(self, "unable to retrieve controller info\n"); goto bad; } mly_release_ccbs(mly); if (mly_alloc_ccbs(mly)) { - aprint_error_dev(&mly->mly_dv, "unable to allocate CCBs\n"); + aprint_error_dev(self, "unable to allocate CCBs\n"); state--; goto bad; } @@ -457,7 +458,7 @@ mly_attach(device_t parent, device_t sel * initial health status buffer. */ if (mly_get_eventstatus(mly)) { - aprint_error_dev(&mly->mly_dv, "unable to retrieve event status\n"); + aprint_error_dev(self, "unable to retrieve event status\n"); goto bad; } @@ -465,7 +466,7 @@ mly_attach(device_t parent, device_t sel * Enable memory-mailbox mode. */ if (mly_enable_mmbox(mly)) { - aprint_error_dev(&mly->mly_dv, "unable to enable memory mailbox\n"); + aprint_error_dev(self, "unable to enable memory mailbox\n"); goto bad; } @@ -475,7 +476,7 @@ mly_attach(device_t parent, device_t sel mi = mly->mly_controllerinfo; printf("%s: %d physical channel%s, firmware %d.%02d-%d-%02d " - "(%02d%02d%02d%02d), %dMB RAM\n", device_xname(&mly->mly_dv), + "(%02d%02d%02d%02d), %dMB RAM\n", device_xname(self), mi->physical_channels_present, (mi->physical_channels_present) > 1 ? "s" : "", mi->fw_major, mi->fw_minor, mi->fw_turn, mi->fw_build, @@ -503,7 +504,7 @@ mly_attach(device_t parent, device_t sel */ adapt = &mly->mly_adapt; memset(adapt, 0, sizeof(*adapt)); - adapt->adapt_dev = &mly->mly_dv; + adapt->adapt_dev = self; adapt->adapt_nchannels = mly->mly_nchans; adapt->adapt_openings = mly->mly_ncmds - MLY_CCBS_RESV; adapt->adapt_max_periph = mly->mly_ncmds - MLY_CCBS_RESV; @@ -521,7 +522,7 @@ mly_attach(device_t parent, device_t sel chan->chan_nluns = MLY_MAX_LUNS; chan->chan_id = mly->mly_controllerparam->initiator_id; chan->chan_flags = SCSIPI_CHAN_NOSETTLE; - config_found(&mly->mly_dv, chan, scsiprint); + config_found(self, chan, scsiprint); } /* @@ -534,9 +535,9 @@ mly_attach(device_t parent, device_t sel */ mly->mly_state |= MLY_STATE_INITOK; rv = kthread_create(PRI_NONE, 0, NULL, mly_thread, mly, - &mly->mly_thread, "%s", device_xname(&mly->mly_dv)); + &mly->mly_thread, "%s", device_xname(self)); if (rv != 0) - aprint_error_dev(&mly->mly_dv, "unable to create thread (%d)\n", + aprint_error_dev(self, "unable to create thread (%d)\n", rv); return; @@ -585,7 +586,7 @@ mly_shutdown(void *cookie) continue; if (mly_flush(mly)) - aprint_error_dev(&mly->mly_dv, "unable to flush cache\n"); + aprint_error_dev(mly->mly_dv, "unable to flush cache\n"); } } @@ -738,7 +739,7 @@ mly_complete_rescan(struct mly_softc *ml #ifdef MLYDEBUG printf("%s: WARNING: BTL rescan (logical) for %d:%d " "returned data for %d:%d instead\n", - device_xname(&mly->mly_dv), bus, target, + device_xname(mly->mly_dv), bus, target, MLY_LOGDEV_BUS(mly, tmp), MLY_LOGDEV_TARGET(mly, tmp)); #endif @@ -755,7 +756,7 @@ mly_complete_rescan(struct mly_softc *ml #ifdef MLYDEBUG printf("%s: WARNING: BTL rescan (physical) for %d:%d " " returned data for %d:%d instead\n", - device_xname(&mly->mly_dv), + device_xname(mly->mly_dv), bus, target, pdi->channel, pdi->target); #endif goto out; @@ -772,7 +773,7 @@ mly_complete_rescan(struct mly_softc *ml if (pdi->command_tags != 0) btl.mb_flags |= MLY_BTL_TQING; } else { - printf("%s: BTL rescan result invalid\n", device_xname(&mly->mly_dv)); + printf("%s: BTL rescan result invalid\n", device_xname(mly->mly_dv)); goto out; } @@ -1081,7 +1082,7 @@ mly_fetch_event(struct mly_softc *mly) return; bad: - printf("%s: couldn't fetch event %u\n", device_xname(&mly->mly_dv), event); + printf("%s: couldn't fetch event %u\n", device_xname(mly->mly_dv), event); free(mc->mc_data, M_DEVBUF); mly_ccb_free(mly, mc); } @@ -1102,7 +1103,7 @@ mly_complete_event(struct mly_softc *mly if (mc->mc_status == SCSI_OK) mly_process_event(mly, me); else - aprint_error_dev(&mly->mly_dv, "unable to fetch event; status = 0x%x\n", + aprint_error_dev(mly->mly_dv, "unable to fetch event; status = 0x%x\n", mc->mc_status); free(me, M_DEVBUF); @@ -1165,7 +1166,7 @@ mly_process_event(struct mly_softc *mly, /* * Error on physical drive. */ - printf("%s: physical device %d:%d %s\n", device_xname(&mly->mly_dv), + printf("%s: physical device %d:%d %s\n", device_xname(mly->mly_dv), me->channel, me->target, tp); if (action == 'r') mly->mly_btl[me->channel][me->target].mb_flags |= @@ -1179,7 +1180,7 @@ mly_process_event(struct mly_softc *mly, */ bus = MLY_LOGDEV_BUS(mly, me->lun); target = MLY_LOGDEV_TARGET(mly, me->lun); - printf("%s: logical device %d:%d %s\n", device_xname(&mly->mly_dv), + printf("%s: logical device %d:%d %s\n", device_xname(mly->mly_dv), bus, target, tp); if (action == 'r') mly->mly_btl[bus][target].mb_flags |= MLY_BTL_RESCAN; @@ -1201,13 +1202,13 @@ mly_process_event(struct mly_softc *mly, /* * XXX Should translate this if SCSIVERBOSE. */ - printf("%s: physical device %d:%d %s\n", device_xname(&mly->mly_dv), + printf("%s: physical device %d:%d %s\n", device_xname(mly->mly_dv), me->channel, me->target, tp); printf("%s: sense key %d asc %02x ascq %02x\n", - device_xname(&mly->mly_dv), SSD_SENSE_KEY(ssd->flags), + device_xname(mly->mly_dv), SSD_SENSE_KEY(ssd->flags), ssd->asc, ssd->ascq); printf("%s: info %x%x%x%x csi %x%x%x%x\n", - device_xname(&mly->mly_dv), ssd->info[0], ssd->info[1], + device_xname(mly->mly_dv), ssd->info[0], ssd->info[1], ssd->info[2], ssd->info[3], ssd->csi[0], ssd->csi[1], ssd->csi[2], ssd->csi[3]); @@ -1217,16 +1218,16 @@ mly_process_event(struct mly_softc *mly, break; case 'e': - printf("%s: ", device_xname(&mly->mly_dv)); + printf("%s: ", device_xname(mly->mly_dv)); printf(tp, me->target, me->lun); break; case 'c': - printf("%s: controller %s\n", device_xname(&mly->mly_dv), tp); + printf("%s: controller %s\n", device_xname(mly->mly_dv), tp); break; case '?': - printf("%s: %s - %d\n", device_xname(&mly->mly_dv), tp, event); + printf("%s: %s - %d\n", device_xname(mly->mly_dv), tp, event); break; default: @@ -1449,7 +1450,7 @@ mly_intr(void *cookie) } else { /* Slot 0xffff may mean "extremely bogus command". */ printf("%s: got HM completion for illegal slot %u\n", - device_xname(&mly->mly_dv), slot); + device_xname(mly->mly_dv), slot); } /* Unconditionally acknowledge status. */ @@ -1488,7 +1489,7 @@ mly_intr(void *cookie) * command". */ printf("%s: got AM completion for illegal " - "slot %u at %d\n", device_xname(&mly->mly_dv), + "slot %u at %d\n", device_xname(mly->mly_dv), slot, mly->mly_mmbox_sts_idx); } @@ -1827,7 +1828,7 @@ mly_scsipi_request(struct scsipi_channel #ifdef DIAGNOSTIC /* XXX Increase if/when we support large SCSI commands. */ if (xs->cmdlen > MLY_CMD_SCSI_SMALL_CDB) { - printf("%s: cmd too large\n", device_xname(&mly->mly_dv)); + printf("%s: cmd too large\n", device_xname(mly->mly_dv)); xs->error = XS_DRIVER_STUFFUP; scsipi_done(xs); break; @@ -1991,7 +1992,7 @@ mly_scsipi_complete(struct mly_softc *ml default: printf("%s: unknown SCSI status 0x%x\n", - device_xname(&mly->mly_dv), xs->status); + device_xname(mly->mly_dv), xs->status); xs->error = XS_DRIVER_STUFFUP; break; } @@ -2094,7 +2095,7 @@ mly_fwhandshake(struct mly_softc *mly) return (0); printf("%s: controller initialization started\n", - device_xname(&mly->mly_dv)); + device_xname(mly->mly_dv)); /* * Spin waiting for initialization to finish, or for a message to be @@ -2113,36 +2114,36 @@ mly_fwhandshake(struct mly_softc *mly) case MLY_MSG_SPINUP: if (!spinup) { printf("%s: drive spinup in progress\n", - device_xname(&mly->mly_dv)); + device_xname(mly->mly_dv)); spinup = 1; } break; case MLY_MSG_RACE_RECOVERY_FAIL: printf("%s: mirror race recovery failed - \n", - device_xname(&mly->mly_dv)); + device_xname(mly->mly_dv)); printf("%s: one or more drives offline\n", - device_xname(&mly->mly_dv)); + device_xname(mly->mly_dv)); break; case MLY_MSG_RACE_IN_PROGRESS: printf("%s: mirror race recovery in progress\n", - device_xname(&mly->mly_dv)); + device_xname(mly->mly_dv)); break; case MLY_MSG_RACE_ON_CRITICAL: printf("%s: mirror race recovery on critical drive\n", - device_xname(&mly->mly_dv)); + device_xname(mly->mly_dv)); break; case MLY_MSG_PARITY_ERROR: printf("%s: FATAL MEMORY PARITY ERROR\n", - device_xname(&mly->mly_dv)); + device_xname(mly->mly_dv)); return (ENXIO); default: printf("%s: unknown initialization code 0x%x\n", - device_xname(&mly->mly_dv), error); + device_xname(mly->mly_dv), error); break; } } @@ -2178,7 +2179,7 @@ mly_dmamem_alloc(struct mly_softc *mly, if ((rv = bus_dmamem_alloc(mly->mly_dmat, size, PAGE_SIZE, 0, seg, 1, &rseg, BUS_DMA_NOWAIT)) != 0) { - aprint_error_dev(&mly->mly_dv, "dmamem_alloc = %d\n", rv); + aprint_error_dev(mly->mly_dv, "dmamem_alloc = %d\n", rv); goto bad; } @@ -2186,7 +2187,7 @@ mly_dmamem_alloc(struct mly_softc *mly, if ((rv = bus_dmamem_map(mly->mly_dmat, seg, 1, size, kva, BUS_DMA_NOWAIT | BUS_DMA_COHERENT)) != 0) { - aprint_error_dev(&mly->mly_dv, "dmamem_map = %d\n", rv); + aprint_error_dev(mly->mly_dv, "dmamem_map = %d\n", rv); goto bad; } @@ -2194,7 +2195,7 @@ mly_dmamem_alloc(struct mly_softc *mly, if ((rv = bus_dmamap_create(mly->mly_dmat, size, size, 1, 0, BUS_DMA_NOWAIT, dmamap)) != 0) { - aprint_error_dev(&mly->mly_dv, "dmamap_create = %d\n", rv); + aprint_error_dev(mly->mly_dv, "dmamap_create = %d\n", rv); goto bad; } @@ -2202,7 +2203,7 @@ mly_dmamem_alloc(struct mly_softc *mly, if ((rv = bus_dmamap_load(mly->mly_dmat, *dmamap, *kva, size, NULL, BUS_DMA_NOWAIT)) != 0) { - aprint_error_dev(&mly->mly_dv, "dmamap_load = %d\n", rv); + aprint_error_dev(mly->mly_dv, "dmamap_load = %d\n", rv); goto bad; } Index: sys/dev/pci/mlyvar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/pci/mlyvar.h,v retrieving revision 1.5 diff -u -p -r1.5 mlyvar.h --- sys/dev/pci/mlyvar.h 28 Apr 2008 20:23:55 -0000 1.5 +++ sys/dev/pci/mlyvar.h 28 Sep 2012 21:03:42 -0000 @@ -151,7 +151,7 @@ struct mly_ccb { */ struct mly_softc { /* Generic device info. */ - struct device mly_dv; + device_t mly_dv; bus_space_handle_t mly_ioh; bus_space_tag_t mly_iot; bus_dma_tag_t mly_dmat; Index: sys/dev/pci/neo.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/pci/neo.c,v retrieving revision 1.48 diff -u -p -r1.48 neo.c --- sys/dev/pci/neo.c 24 Aug 2012 09:01:23 -0000 1.48 +++ sys/dev/pci/neo.c 28 Sep 2012 21:00:45 -0000 @@ -116,7 +116,7 @@ __KERNEL_RCSID(0, "$NetBSD: neo.c,v 1.48 /* device private data */ struct neo_softc { - struct device dev; + device_t dev; kmutex_t lock; kmutex_t intr_lock; @@ -206,7 +206,7 @@ static paddr_t neo_mappage(void *, void static int neo_get_props(void *); static void neo_get_locks(void *, kmutex_t **, kmutex_t **); -CFATTACH_DECL(neo, sizeof(struct neo_softc), +CFATTACH_DECL_NEW(neo, sizeof(struct neo_softc), neo_match, neo_attach, NULL, NULL); static struct audio_device neo_device = { @@ -404,7 +404,7 @@ neo_intr(void *p) nm_ackint(sc, sc->misc1int); x = nm_rd_1(sc, 0x400); nm_wr_1(sc, 0x400, x | 2); - printf("%s: misc int 1\n", device_xname(&sc->dev)); + printf("%s: misc int 1\n", device_xname(sc->dev)); rv = 1; } if (status & sc->misc2int) { @@ -412,13 +412,13 @@ neo_intr(void *p) nm_ackint(sc, sc->misc2int); x = nm_rd_1(sc, 0x400); nm_wr_1(sc, 0x400, x & ~2); - printf("%s: misc int 2\n", device_xname(&sc->dev)); + printf("%s: misc int 2\n", device_xname(sc->dev)); rv = 1; } if (status) { status &= ~sc->misc2int; nm_ackint(sc, sc->misc2int); - printf("%s: unknown int\n", device_xname(&sc->dev)); + printf("%s: unknown int\n", device_xname(sc->dev)); rv = 1; } @@ -578,7 +578,7 @@ neo_attach(device_t parent, device_t sel int error; sc = device_private(self); - pa = (struct pci_attach_args *)aux; + pa = aux; pc = pa->pa_pc; sc->type = PCI_PRODUCT(pa->pa_id); @@ -589,19 +589,19 @@ neo_attach(device_t parent, device_t sel /* Map I/O register */ if (pci_mapreg_map(pa, PCI_MAPREG_START, PCI_MAPREG_TYPE_MEM, 0, &sc->bufiot, &sc->bufioh, &sc->buf_pciaddr, NULL)) { - aprint_error_dev(&sc->dev, "can't map buffer\n"); + aprint_error_dev(self, "can't map buffer\n"); return; } if (pci_mapreg_map(pa, PCI_MAPREG_START + 4, PCI_MAPREG_TYPE_MEM, BUS_SPACE_MAP_LINEAR, &sc->regiot, &sc->regioh, NULL, NULL)) { - aprint_error_dev(&sc->dev, "can't map registers\n"); + aprint_error_dev(self, "can't map registers\n"); return; } /* Map and establish the interrupt. */ if (pci_intr_map(pa, &ih)) { - aprint_error_dev(&sc->dev, "couldn't map interrupt\n"); + aprint_error_dev(self, "couldn't map interrupt\n"); return; } @@ -612,7 +612,7 @@ neo_attach(device_t parent, device_t sel sc->ih = pci_intr_establish(pc, ih, IPL_AUDIO, neo_intr, sc); if (sc->ih == NULL) { - aprint_error_dev(&sc->dev, "couldn't establish interrupt"); + aprint_error_dev(self, "couldn't establish interrupt"); if (intrstr != NULL) aprint_error(" at %s", intrstr); aprint_error("\n"); @@ -620,7 +620,7 @@ neo_attach(device_t parent, device_t sel mutex_destroy(&sc->intr_lock); return; } - aprint_normal_dev(&sc->dev, "interrupting at %s\n", intrstr); + aprint_normal_dev(self, "interrupting at %s\n", intrstr); mutex_spin_enter(&sc->intr_lock); error = nm_init(sc); @@ -652,7 +652,7 @@ neo_attach(device_t parent, device_t sel if (!pmf_device_register(self, NULL, neo_resume)) aprint_error_dev(self, "couldn't establish power handler\n"); - audio_attach_mi(&neo_hw_if, sc, &sc->dev); + audio_attach_mi(&neo_hw_if, sc, self); } static int Index: sys/dev/pci/oboe.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/pci/oboe.c,v retrieving revision 1.38 diff -u -p -r1.38 oboe.c --- sys/dev/pci/oboe.c 13 Nov 2010 13:52:07 -0000 1.38 +++ sys/dev/pci/oboe.c 28 Sep 2012 21:08:03 -0000 @@ -87,8 +87,7 @@ int oboedebug = 1; struct oboe_dma; struct oboe_softc { - struct device sc_dev; - struct device *sc_child; + device_t sc_child; struct pci_attach_args sc_pa; pci_intr_handle_t * sc_ih; unsigned int sc_revision; /* PCI Revision ID */ @@ -150,7 +149,7 @@ static void oboe_startchip(struct oboe_s static void oboe_stopchip(struct oboe_softc *); static int oboe_setbaud(struct oboe_softc *, int); -CFATTACH_DECL(oboe, sizeof(struct oboe_softc), +CFATTACH_DECL_NEW(oboe, sizeof(struct oboe_softc), oboe_match, oboe_attach, oboe_detach, NULL); static struct irframe_methods oboe_methods = { @@ -186,7 +185,7 @@ oboe_attach(device_t parent, device_t se /* Map I/O registers. */ if (pci_mapreg_map(pa, IO_BAR, PCI_MAPREG_TYPE_IO, 0, &sc->sc_iot, &sc->sc_ioh, NULL, NULL)) { - aprint_error_dev(&sc->sc_dev, "can't map I/O space\n"); + aprint_error_dev(self, "can't map I/O space\n"); return; } @@ -206,24 +205,24 @@ oboe_attach(device_t parent, device_t se /* Reset the device; bail out upon failure. */ if (oboe_reset(sc) != 0) { - aprint_error_dev(&sc->sc_dev, "can't reset\n"); + aprint_error_dev(self, "can't reset\n"); return; } /* Map and establish the interrupt. */ if (pci_intr_map(pa, &ih)) { - aprint_error_dev(&sc->sc_dev, "couldn't map interrupt\n"); + aprint_error_dev(self, "couldn't map interrupt\n"); return; } intrstring = pci_intr_string(pa->pa_pc, ih); sc->sc_ih = pci_intr_establish(pa->pa_pc, ih, IPL_IR, oboe_intr, sc); if (sc->sc_ih == NULL) { - aprint_error_dev(&sc->sc_dev, "couldn't establish interrupt"); + aprint_error_dev(self, "couldn't establish interrupt"); if (intrstring != NULL) aprint_error(" at %s", intrstring); aprint_error("\n"); return; } - aprint_normal_dev(&sc->sc_dev, "interrupting at %s\n", intrstring); + aprint_normal_dev(self, "interrupting at %s\n", intrstring); selinit(&sc->sc_rsel); selinit(&sc->sc_wsel); Index: sys/dev/pci/pci_subr.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/pci/pci_subr.c,v retrieving revision 1.93 diff -u -p -r1.93 pci_subr.c --- sys/dev/pci/pci_subr.c 23 Sep 2012 01:10:10 -0000 1.93 +++ sys/dev/pci/pci_subr.c 29 Sep 2012 11:39:04 -0000 @@ -453,7 +453,7 @@ pci_aprint_devinfo_fancy(const struct pc * in a device attach routine like this: * * #ifdef MYDEV_DEBUG - * printf("%s: ", device_xname(&sc->sc_dev)); + * printf("%s: ", device_xname(sc->sc_dev)); * pci_conf_print(pa->pa_pc, pa->pa_tag, NULL); * #endif */ Index: sys/dev/pci/satalink.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/pci/satalink.c,v retrieving revision 1.48 diff -u -p -r1.48 satalink.c --- sys/dev/pci/satalink.c 31 Jul 2012 15:50:36 -0000 1.48 +++ sys/dev/pci/satalink.c 29 Sep 2012 11:38:51 -0000 @@ -825,7 +825,7 @@ sii3112_drv_probe(struct ata_channel *ch sstatus = BA5_READ_4(sc, chp->ch_channel, ba5_SStatus); #if 0 - aprint_normal_dev(&sc->sc_wdcdev.sc_atac.atac_dev, + aprint_normal_dev(sc->sc_wdcdev.sc_atac.atac_dev, "port %d: SStatus=0x%08x, SControl=0x%08x\n", chp->ch_channel, sstatus, BA5_READ_4(sc, chp->ch_channel, ba5_SControl)); @@ -867,7 +867,7 @@ sii3112_drv_probe(struct ata_channel *ch wdr->cmd_iohs[wd_cyl_hi], 0); #if 0 printf("%s: port %d: scnt=0x%x sn=0x%x cl=0x%x ch=0x%x\n", - device_xname(&sc->sc_wdcdev.sc_atac.atac_dev), chp->ch_channel, + device_xname(sc->sc_wdcdev.sc_atac.atac_dev), chp->ch_channel, scnt, sn, cl, ch); #endif if (atabus_alloc_drives(chp, 1) != 0) Index: sys/dev/pci/sv.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/pci/sv.c,v retrieving revision 1.46 diff -u -p -r1.46 sv.c --- sys/dev/pci/sv.c 24 Nov 2011 03:35:58 -0000 1.46 +++ sys/dev/pci/sv.c 28 Sep 2012 21:02:57 -0000 @@ -126,7 +126,7 @@ struct sv_dma { #define DMAADDR(p) ((p)->map->dm_segs[0].ds_addr) #define KERNADDR(p) ((void *)((p)->addr)) -CFATTACH_DECL(sv, sizeof(struct sv_softc), +CFATTACH_DECL_NEW(sv, sizeof(struct sv_softc), sv_match, sv_attach, NULL, NULL); static struct audio_device sv_device = { @@ -358,19 +358,19 @@ sv_attach(device_t parent, device_t self if (pci_mapreg_map(pa, SV_ENHANCED_PORTBASE_SLOT, PCI_MAPREG_TYPE_IO, 0, &sc->sc_iot, &sc->sc_ioh, NULL, NULL)) { - aprint_error_dev(&sc->sc_dev, "can't map enhanced i/o space\n"); + aprint_error_dev(self, "can't map enhanced i/o space\n"); return; } if (pci_mapreg_map(pa, SV_FM_PORTBASE_SLOT, PCI_MAPREG_TYPE_IO, 0, &sc->sc_opliot, &sc->sc_oplioh, NULL, NULL)) { - aprint_error_dev(&sc->sc_dev, "can't map FM i/o space\n"); + aprint_error_dev(self, "can't map FM i/o space\n"); return; } if (pci_mapreg_map(pa, SV_MIDI_PORTBASE_SLOT, PCI_MAPREG_TYPE_IO, 0, &sc->sc_midiiot, &sc->sc_midiioh, NULL, NULL)) { - aprint_error_dev(&sc->sc_dev, "can't map MIDI i/o space\n"); + aprint_error_dev(self, "can't map MIDI i/o space\n"); return; } DPRINTF(("sv: IO ports: enhanced=0x%x, OPL=0x%x, MIDI=0x%x\n", @@ -422,7 +422,7 @@ sv_attach(device_t parent, device_t self /* Map and establish the interrupt. */ if (pci_intr_map(pa, &ih)) { - aprint_error_dev(&sc->sc_dev, "couldn't map interrupt\n"); + aprint_error_dev(self, "couldn't map interrupt\n"); return; } @@ -432,7 +432,7 @@ sv_attach(device_t parent, device_t self intrstr = pci_intr_string(pc, ih); sc->sc_ih = pci_intr_establish(pc, ih, IPL_AUDIO, sv_intr, sc); if (sc->sc_ih == NULL) { - aprint_error_dev(&sc->sc_dev, "couldn't establish interrupt"); + aprint_error_dev(self, "couldn't establish interrupt"); if (intrstr != NULL) aprint_error(" at %s", intrstr); aprint_error("\n"); @@ -440,8 +440,8 @@ sv_attach(device_t parent, device_t self mutex_destroy(&sc->sc_intr_lock); return; } - printf("%s: interrupting at %s\n", device_xname(&sc->sc_dev), intrstr); - printf("%s: rev %d", device_xname(&sc->sc_dev), + printf("%s: interrupting at %s\n", device_xname(self), intrstr); + printf("%s: rev %d", device_xname(self), sv_read_indirect(sc, SV_REVISION_LEVEL)); if (sv_read(sc, SV_CODEC_CONTROL) & SV_CTL_MD1) printf(", reverb SRAM present"); @@ -458,12 +458,12 @@ sv_attach(device_t parent, device_t self sv_init_mixer(sc); - audio_attach_mi(&sv_hw_if, sc, &sc->sc_dev); + audio_attach_mi(&sv_hw_if, sc, self); arg.type = AUDIODEV_TYPE_OPL; arg.hwif = 0; arg.hdl = 0; - (void)config_found(&sc->sc_dev, &arg, audioprint); + (void)config_found(self, &arg, audioprint); sc->sc_pa = *pa; /* for deferred setup */ config_defer(self, sv_defer); Index: sys/dev/pci/svvar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/pci/svvar.h,v retrieving revision 1.7 diff -u -p -r1.7 svvar.h --- sys/dev/pci/svvar.h 23 Nov 2011 23:07:36 -0000 1.7 +++ sys/dev/pci/svvar.h 28 Sep 2012 21:02:44 -0000 @@ -32,7 +32,6 @@ */ struct sv_softc { - struct device sc_dev; /* base device */ kmutex_t sc_lock; kmutex_t sc_intr_lock; void *sc_ih; /* interrupt vectoring */ Index: sys/dev/pci/twavar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/pci/twavar.h,v retrieving revision 1.11 diff -u -p -r1.11 twavar.h --- sys/dev/pci/twavar.h 27 Jul 2012 14:02:17 -0000 1.11 +++ sys/dev/pci/twavar.h 2 Oct 2012 02:27:01 -0000 @@ -49,7 +49,7 @@ struct twa_drive { uint32_t td_id; uint64_t td_size; int td_openings; - struct device *td_dev; + device_t td_dev; const struct twa_callbacks *td_callbacks; }; Index: sys/dev/pci/twe.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/pci/twe.c,v retrieving revision 1.96 diff -u -p -r1.96 twe.c --- sys/dev/pci/twe.c 27 Jan 2012 19:48:39 -0000 1.96 +++ sys/dev/pci/twe.c 28 Sep 2012 21:12:04 -0000 @@ -122,7 +122,7 @@ static inline void twe_outl(struct twe_s extern struct cfdriver twe_cd; -CFATTACH_DECL(twe, sizeof(struct twe_softc), +CFATTACH_DECL_NEW(twe, sizeof(struct twe_softc), twe_match, twe_attach, NULL, NULL); /* FreeBSD driver revision for sysctl expected by the 3ware cli */ @@ -332,7 +332,7 @@ twe_attach(device_t parent, device_t sel if (pci_mapreg_map(pa, PCI_CBIO, PCI_MAPREG_TYPE_IO, 0, &sc->sc_iot, &sc->sc_ioh, NULL, NULL)) { - aprint_error_dev(&sc->sc_dv, "can't map i/o space\n"); + aprint_error_dev(self, "can't map i/o space\n"); return; } @@ -343,21 +343,21 @@ twe_attach(device_t parent, device_t sel /* Map and establish the interrupt. */ if (pci_intr_map(pa, &ih)) { - aprint_error_dev(&sc->sc_dv, "can't map interrupt\n"); + aprint_error_dev(self, "can't map interrupt\n"); return; } intrstr = pci_intr_string(pc, ih); sc->sc_ih = pci_intr_establish(pc, ih, IPL_BIO, twe_intr, sc); if (sc->sc_ih == NULL) { - aprint_error_dev(&sc->sc_dv, "can't establish interrupt%s%s\n", + aprint_error_dev(self, "can't establish interrupt%s%s\n", (intrstr) ? " at " : "", (intrstr) ? intrstr : ""); return; } if (intrstr != NULL) - aprint_normal_dev(&sc->sc_dv, "interrupting at %s\n", + aprint_normal_dev(self, "interrupting at %s\n", intrstr); /* @@ -367,32 +367,32 @@ twe_attach(device_t parent, device_t sel if ((rv = bus_dmamem_alloc(sc->sc_dmat, size, PAGE_SIZE, 0, &seg, 1, &rseg, BUS_DMA_NOWAIT)) != 0) { - aprint_error_dev(&sc->sc_dv, "unable to allocate commands, rv = %d\n", rv); + aprint_error_dev(self, "unable to allocate commands, rv = %d\n", rv); return; } if ((rv = bus_dmamem_map(sc->sc_dmat, &seg, rseg, size, (void **)&sc->sc_cmds, BUS_DMA_NOWAIT | BUS_DMA_COHERENT)) != 0) { - aprint_error_dev(&sc->sc_dv, "unable to map commands, rv = %d\n", rv); + aprint_error_dev(self, "unable to map commands, rv = %d\n", rv); return; } if ((rv = bus_dmamap_create(sc->sc_dmat, size, size, 1, 0, BUS_DMA_NOWAIT, &sc->sc_dmamap)) != 0) { - aprint_error_dev(&sc->sc_dv, "unable to create command DMA map, rv = %d\n", rv); + aprint_error_dev(self, "unable to create command DMA map, rv = %d\n", rv); return; } if ((rv = bus_dmamap_load(sc->sc_dmat, sc->sc_dmamap, sc->sc_cmds, size, NULL, BUS_DMA_NOWAIT)) != 0) { - aprint_error_dev(&sc->sc_dv, "unable to load command DMA map, rv = %d\n", rv); + aprint_error_dev(self, "unable to load command DMA map, rv = %d\n", rv); return; } ccb = malloc(sizeof(*ccb) * TWE_MAX_QUEUECNT, M_DEVBUF, M_NOWAIT); if (ccb == NULL) { - aprint_error_dev(&sc->sc_dv, "unable to allocate memory for ccbs\n"); + aprint_error_dev(self, "unable to allocate memory for ccbs\n"); return; } @@ -413,7 +413,7 @@ twe_attach(device_t parent, device_t sel BUS_DMA_NOWAIT | BUS_DMA_ALLOCNOW, &ccb->ccb_dmamap_xfer); if (rv != 0) { - aprint_error_dev(&sc->sc_dv, "can't create dmamap, rv = %d\n", rv); + aprint_error_dev(self, "can't create dmamap, rv = %d\n", rv); return; } @@ -425,7 +425,7 @@ twe_attach(device_t parent, device_t sel /* Wait for the controller to become ready. */ if (twe_status_wait(sc, TWE_STS_MICROCONTROLLER_READY, 6)) { - aprint_error_dev(&sc->sc_dv, "microcontroller not ready\n"); + aprint_error_dev(self, "microcontroller not ready\n"); return; } @@ -436,7 +436,7 @@ twe_attach(device_t parent, device_t sel rv = twe_reset(sc); splx(s); if (rv) { - aprint_error_dev(&sc->sc_dv, "reset failed\n"); + aprint_error_dev(self, "reset failed\n"); return; } @@ -460,17 +460,17 @@ twe_attach(device_t parent, device_t sel CTLFLAG_PERMANENT, CTLTYPE_NODE, "hw", NULL, NULL, 0, NULL, 0, CTL_HW, CTL_EOL) != 0) { - aprint_error_dev(&sc->sc_dv, "could not create %s sysctl node\n", + aprint_error_dev(self, "could not create %s sysctl node\n", "hw"); return; } if (sysctl_createv(NULL, 0, NULL, &node, - 0, CTLTYPE_NODE, device_xname(&sc->sc_dv), + 0, CTLTYPE_NODE, device_xname(self), SYSCTL_DESCR("twe driver information"), NULL, 0, NULL, 0, CTL_HW, CTL_CREATE, CTL_EOL) != 0) { - aprint_error_dev(&sc->sc_dv, "could not create %s.%s sysctl node\n", - "hw", device_xname(&sc->sc_dv)); + aprint_error_dev(self, "could not create %s.%s sysctl node\n", + "hw", device_xname(self)); return; } if ((i = sysctl_createv(NULL, 0, NULL, NULL, @@ -479,8 +479,8 @@ twe_attach(device_t parent, device_t sel NULL, 0, __UNCONST(&twever), 0, CTL_HW, node->sysctl_num, CTL_CREATE, CTL_EOL)) != 0) { - aprint_error_dev(&sc->sc_dv, "could not create %s.%s.driver_version sysctl\n", - "hw", device_xname(&sc->sc_dv)); + aprint_error_dev(self, "could not create %s.%s.driver_version sysctl\n", + "hw", device_xname(self)); return; } } @@ -509,7 +509,7 @@ twe_recompute_openings(struct twe_softc #ifdef TWE_DEBUG printf("%s: %d array%s, %d openings per array\n", - device_xname(&sc->sc_dv), sc->sc_nunits, + device_xname(sc->sc_dev), sc->sc_nunits, sc->sc_nunits == 1 ? "" : "s", sc->sc_openings); #endif @@ -541,7 +541,7 @@ twe_add_unit(struct twe_softc *sc, int u rv = twe_param_get(sc, TWE_PARAM_UNITSUMMARY, TWE_PARAM_UNITSUMMARY_Status, TWE_MAX_UNITS, NULL, &dtp); if (rv != 0) { - aprint_error_dev(&sc->sc_dv, "error %d fetching unit summary\n", + aprint_error_dev(sc->sc_dev, "error %d fetching unit summary\n", rv); return (rv); } @@ -563,7 +563,7 @@ twe_add_unit(struct twe_softc *sc, int u rv = twe_param_get_2(sc, TWE_PARAM_UNITINFO + unit, TWE_PARAM_UNITINFO_DescriptorSize, &dsize); if (rv != 0) { - aprint_error_dev(&sc->sc_dv, "error %d fetching descriptor size " + aprint_error_dev(sc->sc_dev, "error %d fetching descriptor size " "for unit %d\n", rv, unit); goto out; } @@ -571,7 +571,7 @@ twe_add_unit(struct twe_softc *sc, int u rv = twe_param_get(sc, TWE_PARAM_UNITINFO + unit, TWE_PARAM_UNITINFO_Descriptor, dsize - 3, NULL, &atp); if (rv != 0) { - aprint_error_dev(&sc->sc_dv, "error %d fetching array descriptor " + aprint_error_dev(sc->sc_dev, "error %d fetching array descriptor " "for unit %d\n", rv, unit); goto out; } @@ -584,7 +584,7 @@ twe_add_unit(struct twe_softc *sc, int u rv = twe_param_get_4(sc, TWE_PARAM_UNITINFO + unit, TWE_PARAM_UNITINFO_Capacity, &newsize); if (rv != 0) { - aprint_error_dev(&sc->sc_dv, + aprint_error_dev(sc->sc_dev, "error %d fetching capacity for unit %d\n", rv, unit); goto out; @@ -622,7 +622,7 @@ twe_add_unit(struct twe_softc *sc, int u locs[TWECF_UNIT] = unit; - td->td_dev = config_found_sm_loc(&sc->sc_dv, "twe", locs, &twea, + td->td_dev = config_found_sm_loc(sc->sc_dev, "twe", locs, &twea, twe_print, config_stdsubmatch); rv = 0; @@ -676,7 +676,7 @@ twe_reset(struct twe_softc *sc) /* Wait for attention... */ if (twe_status_wait(sc, TWE_STS_ATTN_INTR, 30)) { - aprint_error_dev(&sc->sc_dv, "timeout waiting for attention interrupt\n"); + aprint_error_dev(sc->sc_dev, "timeout waiting for attention interrupt\n"); return (-1); } @@ -700,7 +700,7 @@ twe_reset(struct twe_softc *sc) rv = twe_aen_get(sc, &aen); if (rv != 0) printf("%s: error %d while draining event queue\n", - device_xname(&sc->sc_dv), rv); + device_xname(sc->sc_dev), rv); if (TWE_AEN_CODE(aen) == TWE_AEN_QUEUE_EMPTY) break; if (TWE_AEN_CODE(aen) == TWE_AEN_SOFT_RESET) @@ -709,7 +709,7 @@ twe_reset(struct twe_softc *sc) } if (!got) { - printf("%s: reset not reported\n", device_xname(&sc->sc_dv)); + printf("%s: reset not reported\n", device_xname(sc->sc_dev)); return (-1); } @@ -717,7 +717,7 @@ twe_reset(struct twe_softc *sc) status = twe_inl(sc, TWE_REG_STS); if (twe_status_check(sc, status)) { printf("%s: controller errors detected\n", - device_xname(&sc->sc_dv)); + device_xname(sc->sc_dev)); return (-1); } @@ -725,7 +725,7 @@ twe_reset(struct twe_softc *sc) for (;;) { status = twe_inl(sc, TWE_REG_STS); if (twe_status_check(sc, status) != 0) { - aprint_error_dev(&sc->sc_dv, "can't drain response queue\n"); + aprint_error_dev(sc->sc_dev, "can't drain response queue\n"); return (-1); } if ((status & TWE_STS_RESP_QUEUE_EMPTY) != 0) @@ -770,7 +770,7 @@ twe_intr(void *arg) /* Host interrupts - purpose unknown. */ if ((status & TWE_STS_HOST_INTR) != 0) { #ifdef DEBUG - printf("%s: host interrupt\n", device_xname(&sc->sc_dv)); + printf("%s: host interrupt\n", device_xname(sc->sc_dev)); #endif twe_outl(sc, TWE_REG_CTL, TWE_CTL_CLEAR_HOST_INTR); caught = 1; @@ -783,7 +783,7 @@ twe_intr(void *arg) if ((status & TWE_STS_ATTN_INTR) != 0) { rv = twe_aen_get(sc, NULL); if (rv != 0) - aprint_error_dev(&sc->sc_dv, "unable to retrieve AEN (%d)\n", rv); + aprint_error_dev(sc->sc_dev, "unable to retrieve AEN (%d)\n", rv); else twe_outl(sc, TWE_REG_CTL, TWE_CTL_CLEAR_ATTN_INTR); caught = 1; @@ -797,7 +797,7 @@ twe_intr(void *arg) */ if ((status & TWE_STS_CMD_INTR) != 0) { #ifdef DEBUG - printf("%s: command interrupt\n", device_xname(&sc->sc_dv)); + printf("%s: command interrupt\n", device_xname(sc->sc_dev)); #endif twe_outl(sc, TWE_REG_CTL, TWE_CTL_MASK_CMD_INTR); caught = 1; @@ -857,7 +857,7 @@ twe_aen_get(struct twe_softc *sc, uint16 ccb->ccb_datasize = TWE_SECTOR_SIZE; ccb->ccb_tx.tx_handler = (aenp == NULL) ? twe_aen_handler : NULL; ccb->ccb_tx.tx_context = tp; - ccb->ccb_tx.tx_dv = &sc->sc_dv; + ccb->ccb_tx.tx_dv = sc->sc_dev; tc = ccb->ccb_cmd; tc->tc_size = 2; @@ -913,7 +913,7 @@ twe_aen_handler(struct twe_ccb *ccb, int sc->sc_flags &= ~TWEF_AEN; if (error) { - aprint_error_dev(&sc->sc_dv, "error retrieving AEN\n"); + aprint_error_dev(sc->sc_dev, "error retrieving AEN\n"); aen = TWE_AEN_QUEUE_EMPTY; } else aen = le16toh(*(u_int16_t *)tp->tp_data); @@ -933,7 +933,7 @@ twe_aen_handler(struct twe_ccb *ccb, int */ rv = twe_aen_get(sc, NULL); if (rv != 0) - aprint_error_dev(&sc->sc_dv, "unable to retrieve AEN (%d)\n", rv); + aprint_error_dev(sc->sc_dev, "unable to retrieve AEN (%d)\n", rv); } static void @@ -948,7 +948,7 @@ twe_aen_enqueue(struct twe_softc *sc, ui if (! quiet) { str = twe_describe_code(twe_table_aen, TWE_AEN_CODE(aen)); if (str == NULL) { - aprint_error_dev(&sc->sc_dv, "unknown AEN 0x%04x\n", aen); + aprint_error_dev(sc->sc_dev, "unknown AEN 0x%04x\n", aen); } else { msg = str + 3; switch (str[1]) { @@ -970,28 +970,28 @@ twe_aen_enqueue(struct twe_softc *sc, ui case 'u': case 'p': printf("%s: %s %d: %s\n", - device_xname(&sc->sc_dv), + device_xname(sc->sc_dev), str[0] == 'u' ? "unit" : "port", TWE_AEN_UNIT(aen), msg); break; default: printf("%s: %s\n", - device_xname(&sc->sc_dv), msg); + device_xname(sc->sc_dev), msg); } } else { switch (str[0]) { case 'u': case 'p': log(level, "%s: %s %d: %s\n", - device_xname(&sc->sc_dv), + device_xname(sc->sc_dev), str[0] == 'u' ? "unit" : "port", TWE_AEN_UNIT(aen), msg); break; default: log(level, "%s: %s\n", - device_xname(&sc->sc_dv), msg); + device_xname(sc->sc_dev), msg); } } } @@ -1118,7 +1118,7 @@ twe_param_get(struct twe_softc *sc, int ccb->ccb_datasize = TWE_SECTOR_SIZE; ccb->ccb_tx.tx_handler = func; ccb->ccb_tx.tx_context = tp; - ccb->ccb_tx.tx_dv = &sc->sc_dv; + ccb->ccb_tx.tx_dv = sc->sc_dev; tc = ccb->ccb_cmd; tc->tc_size = 2; @@ -1186,7 +1186,7 @@ twe_param_set(struct twe_softc *sc, int ccb->ccb_datasize = TWE_SECTOR_SIZE; ccb->ccb_tx.tx_handler = 0; ccb->ccb_tx.tx_context = tp; - ccb->ccb_tx.tx_dv = &sc->sc_dv; + ccb->ccb_tx.tx_dv = sc->sc_dev; tc = ccb->ccb_cmd; tc->tc_size = 2; @@ -1269,14 +1269,14 @@ twe_poll(struct twe_softc *sc) cmdid = twe_inl(sc, TWE_REG_RESP_QUEUE); cmdid = (cmdid & TWE_RESP_MASK) >> TWE_RESP_SHIFT; if (cmdid >= TWE_MAX_QUEUECNT) { - aprint_error_dev(&sc->sc_dv, "bad cmdid %d\n", cmdid); + aprint_error_dev(sc->sc_dev, "bad cmdid %d\n", cmdid); continue; } ccb = sc->sc_ccbs + cmdid; if ((ccb->ccb_flags & TWE_CCB_ACTIVE) == 0) { printf("%s: CCB for cmdid %d not active\n", - device_xname(&sc->sc_dv), cmdid); + device_xname(sc->sc_dev), cmdid); continue; } ccb->ccb_flags ^= TWE_CCB_COMPLETE | TWE_CCB_ACTIVE; @@ -1348,22 +1348,22 @@ twe_status_check(struct twe_softc *sc, u rv = 0; if ((status & TWE_STS_EXPECTED_BITS) != TWE_STS_EXPECTED_BITS) { - aprint_error_dev(&sc->sc_dv, "missing status bits: 0x%08x\n", + aprint_error_dev(sc->sc_dev, "missing status bits: 0x%08x\n", status & ~TWE_STS_EXPECTED_BITS); rv = -1; } if ((status & TWE_STS_UNEXPECTED_BITS) != 0) { - aprint_error_dev(&sc->sc_dv, "unexpected status bits: 0x%08x\n", + aprint_error_dev(sc->sc_dev, "unexpected status bits: 0x%08x\n", status & TWE_STS_UNEXPECTED_BITS); rv = -1; if (status & TWE_STS_PCI_PARITY_ERROR) { - aprint_error_dev(&sc->sc_dv, "PCI parity error: Reseat card, move card " + aprint_error_dev(sc->sc_dev, "PCI parity error: Reseat card, move card " "or buggy device present.\n"); twe_clear_pci_parity_error(sc); } if (status & TWE_STS_PCI_ABORT) { - aprint_error_dev(&sc->sc_dv, "PCI abort, clearing.\n"); + aprint_error_dev(sc->sc_dev, "PCI abort, clearing.\n"); twe_clear_pci_abort(sc); } } @@ -1669,7 +1669,7 @@ twe_ccb_submit(struct twe_softc *sc, str #ifdef DIAGNOSTIC if ((ccb->ccb_flags & TWE_CCB_ALLOCED) == 0) panic("%s: CCB %ld not ALLOCED\n", - device_xname(&sc->sc_dv), (long)(ccb - sc->sc_ccbs)); + device_xname(sc->sc_dev), (long)(ccb - sc->sc_ccbs)); #endif ccb->ccb_flags |= TWE_CCB_ACTIVE; pa = sc->sc_cmds_paddr + @@ -1761,7 +1761,7 @@ tweioctl(dev_t dev, u_long cmd, void *da if (tu->tu_size > TWE_SECTOR_SIZE) { #ifdef TWE_DEBUG printf("%s: TWEIO_COMMAND: tu_size = %zu\n", - device_xname(&twe->sc_dv), tu->tu_size); + device_xname(twe->sc_dev), tu->tu_size); #endif return EINVAL; } @@ -1781,7 +1781,7 @@ tweioctl(dev_t dev, u_long cmd, void *da ccb->ccb_tx.tx_handler = twe_ccb_wait_handler; ccb->ccb_tx.tx_context = NULL; - ccb->ccb_tx.tx_dv = &twe->sc_dv; + ccb->ccb_tx.tx_dv = twe->sc_dev; cmdid = ccb->ccb_cmdid; memcpy(ccb->ccb_cmd, &tu->tu_cmd, sizeof(struct twe_cmd)); @@ -1807,7 +1807,7 @@ tweioctl(dev_t dev, u_long cmd, void *da memcpy(&tu->tu_cmd, ccb->ccb_cmd, sizeof(struct twe_cmd)); #ifdef TWE_DEBUG printf("%s: TWEIO_COMMAND: tc_opcode = 0x%02x, " - "tc_status = 0x%02x\n", device_xname(&twe->sc_dv), + "tc_status = 0x%02x\n", device_xname(twe->sc_dev), tu->tu_cmd.tc_opcode, tu->tu_cmd.tc_status); #endif @@ -1926,14 +1926,14 @@ twe_describe_controller(struct twe_softc if (rv) { /* some error occurred */ - aprint_error_dev(&sc->sc_dv, "failed to fetch version information\n"); + aprint_error_dev(sc->sc_dev, "failed to fetch version information\n"); return; } - aprint_normal_dev(&sc->sc_dv, "%d ports, Firmware %.16s, BIOS %.16s\n", + aprint_normal_dev(sc->sc_dev, "%d ports, Firmware %.16s, BIOS %.16s\n", ports, p[1]->tp_data, p[2]->tp_data); - aprint_verbose_dev(&sc->sc_dv, "Monitor %.16s, PCB %.8s, Achip %.8s, Pchip %.8s\n", + aprint_verbose_dev(sc->sc_dev, "Monitor %.16s, PCB %.8s, Achip %.8s, Pchip %.8s\n", p[0]->tp_data, p[3]->tp_data, p[4]->tp_data, p[5]->tp_data); @@ -1947,7 +1947,7 @@ twe_describe_controller(struct twe_softc rv = twe_param_get(sc, TWE_PARAM_DRIVESUMMARY, TWE_PARAM_DRIVESUMMARY_Status, 16, NULL, &p[0]); if (rv) { - aprint_error_dev(&sc->sc_dv, "failed to get drive status summary\n"); + aprint_error_dev(sc->sc_dev, "failed to get drive status summary\n"); return; } for (i = 0; i < ports; i++) { @@ -1956,18 +1956,18 @@ twe_describe_controller(struct twe_softc rv = twe_param_get_4(sc, TWE_PARAM_DRIVEINFO + i, TWE_PARAM_DRIVEINFO_Size, &dsize); if (rv) { - aprint_error_dev(&sc->sc_dv, + aprint_error_dev(sc->sc_dev, "unable to get drive size for port %d\n", i); continue; } rv = twe_param_get(sc, TWE_PARAM_DRIVEINFO + i, TWE_PARAM_DRIVEINFO_Model, 40, NULL, &p[1]); if (rv) { - aprint_error_dev(&sc->sc_dv, + aprint_error_dev(sc->sc_dev, "unable to get drive model for port %d\n", i); continue; } - aprint_verbose_dev(&sc->sc_dv, "port %d: %.40s %d MB\n", + aprint_verbose_dev(sc->sc_dev, "port %d: %.40s %d MB\n", i, p[1]->tp_data, dsize / 2048); free(p[1], M_DEVBUF); } Index: sys/dev/pci/twevar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/pci/twevar.h,v retrieving revision 1.29 diff -u -p -r1.29 twevar.h --- sys/dev/pci/twevar.h 7 May 2009 07:33:05 -0000 1.29 +++ sys/dev/pci/twevar.h 28 Sep 2012 21:03:51 -0000 @@ -51,7 +51,7 @@ struct twe_drive { /* Per-controller state. */ struct twe_softc { - struct device sc_dv; + device_t sc_dev; bus_space_tag_t sc_iot; bus_space_handle_t sc_ioh; bus_dma_tag_t sc_dmat; Index: sys/dev/pci/ubsec.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/pci/ubsec.c,v retrieving revision 1.27 diff -u -p -r1.27 ubsec.c --- sys/dev/pci/ubsec.c 30 Jan 2012 19:41:23 -0000 1.27 +++ sys/dev/pci/ubsec.c 28 Sep 2012 21:06:05 -0000 @@ -98,7 +98,7 @@ struct cfdriver ubsec_cd = { 0, "ubsec", DV_DULL }; #else -CFATTACH_DECL(ubsec, sizeof(struct ubsec_softc), ubsec_probe, ubsec_attach, +CFATTACH_DECL_NEW(ubsec, sizeof(struct ubsec_softc), ubsec_probe, ubsec_attach, NULL, NULL); extern struct cfdriver ubsec_cd; #endif @@ -307,6 +307,7 @@ ubsec_attach(device_t parent, device_t s struct ubsec_dma *dmap; u_int32_t cmd, i; + sc->sc_dev = self; up = ubsec_lookup(pa); if (up == NULL) { printf("\n"); @@ -330,30 +331,30 @@ ubsec_attach(device_t parent, device_t s if (pci_mapreg_map(pa, BS_BAR, PCI_MAPREG_TYPE_MEM, 0, &sc->sc_st, &sc->sc_sh, NULL, NULL)) { - aprint_error_dev(&sc->sc_dv, "can't find mem space"); + aprint_error_dev(self, "can't find mem space"); return; } sc->sc_dmat = pa->pa_dmat; if (pci_intr_map(pa, &ih)) { - aprint_error_dev(&sc->sc_dv, "couldn't map interrupt\n"); + aprint_error_dev(self, "couldn't map interrupt\n"); return; } intrstr = pci_intr_string(pc, ih); sc->sc_ih = pci_intr_establish(pc, ih, IPL_NET, ubsec_intr, sc); if (sc->sc_ih == NULL) { - aprint_error_dev(&sc->sc_dv, "couldn't establish interrupt"); + aprint_error_dev(self, "couldn't establish interrupt"); if (intrstr != NULL) aprint_error(" at %s", intrstr); aprint_error("\n"); return; } - aprint_normal_dev(&sc->sc_dv, "interrupting at %s\n", intrstr); + aprint_normal_dev(self, "interrupting at %s\n", intrstr); sc->sc_cid = crypto_get_driverid(0); if (sc->sc_cid < 0) { - aprint_error_dev(&sc->sc_dv, "couldn't get crypto driver id\n"); + aprint_error_dev(self, "couldn't get crypto driver id\n"); pci_intr_disestablish(pc, sc->sc_ih); return; } @@ -366,13 +367,13 @@ ubsec_attach(device_t parent, device_t s q = (struct ubsec_q *)malloc(sizeof(struct ubsec_q), M_DEVBUF, M_NOWAIT); if (q == NULL) { - aprint_error_dev(&sc->sc_dv, "can't allocate queue buffers\n"); + aprint_error_dev(self, "can't allocate queue buffers\n"); break; } if (ubsec_dma_malloc(sc, sizeof(struct ubsec_dmachunk), &dmap->d_alloc, 0)) { - aprint_error_dev(&sc->sc_dv, "can't allocate dma buffers\n"); + aprint_error_dev(self, "can't allocate dma buffers\n"); free(q, M_DEVBUF); break; } @@ -442,9 +443,9 @@ ubsec_attach(device_t parent, device_t s #endif skip_rng: if (sc->sc_rnghz) - aprint_normal_dev(&sc->sc_dv, "random number generator enabled\n"); + aprint_normal_dev(self, "random number generator enabled\n"); else - aprint_error_dev(&sc->sc_dv, "WARNING: random number generator " + aprint_error_dev(self, "WARNING: random number generator " "disabled\n"); } #endif /* UBSEC_NO_RNG */ @@ -562,7 +563,7 @@ ubsec_intr(void *arg) if (ubsec_debug) { volatile u_int32_t a = READ_REG(sc, BS_ERR); - printf("%s: dmaerr %s@%08x\n", device_xname(&sc->sc_dv), + printf("%s: dmaerr %s@%08x\n", device_xname(sc->sc_dev), (a & BS_ERR_READ) ? "read" : "write", a & BS_ERR_ADDR); } @@ -576,7 +577,7 @@ ubsec_intr(void *arg) int wkeup = sc->sc_needwakeup & (CRYPTO_SYMQ|CRYPTO_ASYMQ); #ifdef UBSEC_DEBUG if (ubsec_debug) - printf("%s: wakeup crypto (%x)\n", device_xname(&sc->sc_dv), + printf("%s: wakeup crypto (%x)\n", device_xname(sc->sc_dev), sc->sc_needwakeup); #endif /* UBSEC_DEBUG */ sc->sc_needwakeup &= ~wkeup; @@ -645,7 +646,7 @@ ubsec_feed(struct ubsec_softc *sc) /* XXX temporary aggregation statistics reporting code */ if (max < npkts) { max = npkts; - printf("%s: new max aggregate %d\n", device_xname(&sc->sc_dv), max); + printf("%s: new max aggregate %d\n", device_xname(sc->sc_dev), max); } #endif /* UBSEC_DEBUG */ @@ -874,7 +875,7 @@ ubsec_newsession(void *arg, u_int32_t *s macini->cri_key[i] ^= HMAC_OPAD_VAL; } - *sidp = UBSEC_SID(device_unit(&sc->sc_dv), sesn); + *sidp = UBSEC_SID(device_unit(sc->sc_dev), sesn); return (0); } @@ -1719,7 +1720,7 @@ ubsec_callback2(struct ubsec_softc *sc, break; } default: - printf("%s: unknown ctx op: %x\n", device_xname(&sc->sc_dv), + printf("%s: unknown ctx op: %x\n", device_xname(sc->sc_dev), letoh16(ctx->ctx_op)); break; } @@ -2035,7 +2036,7 @@ ubsec_kfree(struct ubsec_softc *sc, stru break; } default: - printf("%s: invalid kfree 0x%x\n", device_xname(&sc->sc_dv), + printf("%s: invalid kfree 0x%x\n", device_xname(sc->sc_dev), q->q_type); break; } @@ -2077,7 +2078,7 @@ ubsec_kprocess(void *arg, struct cryptko break; default: printf("%s: kprocess: invalid op 0x%x\n", - device_xname(&sc->sc_dv), krp->krp_op); + device_xname(sc->sc_dev), krp->krp_op); krp->krp_status = EOPNOTSUPP; crypto_kdone(krp); r = 0; @@ -2216,10 +2217,10 @@ ubsec_kprocess_modexp_sw(struct ubsec_so /* Misaligned output buffer will hang the chip. */ if ((letoh32(mcr->mcr_opktbuf.pb_addr) & 3) != 0) panic("%s: modexp invalid addr 0x%x", - device_xname(&sc->sc_dv), letoh32(mcr->mcr_opktbuf.pb_addr)); + device_xname(sc->sc_dev), letoh32(mcr->mcr_opktbuf.pb_addr)); if ((letoh32(mcr->mcr_opktbuf.pb_len) & 3) != 0) panic("%s: modexp invalid len 0x%x", - device_xname(&sc->sc_dv), letoh32(mcr->mcr_opktbuf.pb_len)); + device_xname(sc->sc_dev), letoh32(mcr->mcr_opktbuf.pb_len)); #endif ctx = (struct ubsec_ctx_modexp *)me->me_q.q_ctx.dma_vaddr; @@ -2422,10 +2423,10 @@ ubsec_kprocess_modexp_hw(struct ubsec_so /* Misaligned output buffer will hang the chip. */ if ((letoh32(mcr->mcr_opktbuf.pb_addr) & 3) != 0) panic("%s: modexp invalid addr 0x%x", - device_xname(&sc->sc_dv), letoh32(mcr->mcr_opktbuf.pb_addr)); + device_xname(sc->sc_dev), letoh32(mcr->mcr_opktbuf.pb_addr)); if ((letoh32(mcr->mcr_opktbuf.pb_len) & 3) != 0) panic("%s: modexp invalid len 0x%x", - device_xname(&sc->sc_dv), letoh32(mcr->mcr_opktbuf.pb_len)); + device_xname(sc->sc_dev), letoh32(mcr->mcr_opktbuf.pb_len)); #endif ctx = (struct ubsec_ctx_modexp *)me->me_q.q_ctx.dma_vaddr; @@ -2629,12 +2630,12 @@ ubsec_kprocess_rsapriv(struct ubsec_soft #ifdef DIAGNOSTIC if (rp->rpr_msgin.dma_paddr & 3 || rp->rpr_msgin.dma_size & 3) { panic("%s: rsapriv: invalid msgin 0x%lx(0x%lx)", - device_xname(&sc->sc_dv), (u_long) rp->rpr_msgin.dma_paddr, + device_xname(sc->sc_dev), (u_long) rp->rpr_msgin.dma_paddr, (u_long) rp->rpr_msgin.dma_size); } if (rp->rpr_msgout.dma_paddr & 3 || rp->rpr_msgout.dma_size & 3) { panic("%s: rsapriv: invalid msgout 0x%lx(0x%lx)", - device_xname(&sc->sc_dv), (u_long) rp->rpr_msgout.dma_paddr, + device_xname(sc->sc_dev), (u_long) rp->rpr_msgout.dma_paddr, (u_long) rp->rpr_msgout.dma_size); } #endif Index: sys/dev/pci/ubsecvar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/pci/ubsecvar.h,v retrieving revision 1.3 diff -u -p -r1.3 ubsecvar.h --- sys/dev/pci/ubsecvar.h 4 Mar 2007 06:02:26 -0000 1.3 +++ sys/dev/pci/ubsecvar.h 28 Sep 2012 21:06:56 -0000 @@ -147,7 +147,7 @@ struct ubsec_q { }; struct ubsec_softc { - struct device sc_dv; /* generic device */ + device_t sc_dev; /* generic device */ void *sc_ih; /* interrupt handler cookie */ bus_space_handle_t sc_sh; /* memory handle */ bus_space_tag_t sc_st; /* memory tag */ Index: sys/dev/pci/bktr/bktr_core.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/pci/bktr/bktr_core.c,v retrieving revision 1.52 diff -u -p -r1.52 bktr_core.c --- sys/dev/pci/bktr/bktr_core.c 30 Jun 2011 20:09:40 -0000 1.52 +++ sys/dev/pci/bktr/bktr_core.c 27 Sep 2012 00:14:52 -0000 @@ -217,7 +217,7 @@ static int bt848_format = -1; const char * bktr_name(bktr_ptr_t bktr) { - return device_xname(&bktr->bktr_dev); + return device_xname(bktr->bktr_dev); } #define PROC_LOCK(p) Index: sys/dev/pci/bktr/bktr_os.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/pci/bktr/bktr_os.c,v retrieving revision 1.60 diff -u -p -r1.60 bktr_os.c --- sys/dev/pci/bktr/bktr_os.c 30 Jun 2011 20:09:40 -0000 1.60 +++ sys/dev/pci/bktr/bktr_os.c 29 Sep 2012 11:39:32 -0000 @@ -1333,7 +1333,7 @@ static int bktr_probe(device_t, cfd #endif static void bktr_attach(device_t, device_t, void *); -CFATTACH_DECL(bktr, sizeof(struct bktr_softc), +CFATTACH_DECL_NEW(bktr, sizeof(struct bktr_softc), bktr_probe, bktr_attach, NULL, NULL); #if defined(__NetBSD__) @@ -1428,7 +1428,7 @@ bktr_attach(device_t parent, device_t se intrstr = pci_intr_string(pa->pa_pc, ih); bktr->ih = pci_intr_establish(pa->pa_pc, ih, IPL_VIDEO, - bktr_intr, bktr, device_xname(&bktr->bktr_dev)); + bktr_intr, bktr, device_xname(bktr->bktr_dev)); if (bktr->ih == NULL) { printf(": couldn't establish interrupt"); if (intrstr != NULL) @@ -1449,8 +1449,9 @@ bktr_attach(device_t parent, device_t se int retval; int unit; - bktr = (bktr_ptr_t)self; - unit = device_unit(&bktr->bktr_dev); + bktr = device_private(self); + bktr->bktr_dev = self; + unit = device_unit(bktr->bktr_dev); bktr->dmat = pa->pa_dmat; printf("\n"); @@ -1535,7 +1536,7 @@ bktr_attach(device_t parent, device_t se #if NRADIO > 0 /* attach to radio(4) */ if (bktr->card.tuner->pllControl[3] != 0x00) - radio_attach_mi(&bktr_hw_if, bktr, &bktr->bktr_dev); + radio_attach_mi(&bktr_hw_if, bktr, bktr->bktr_dev); #endif } Index: sys/dev/pci/bktr/bktr_reg.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/pci/bktr/bktr_reg.h,v retrieving revision 1.21 diff -u -p -r1.21 bktr_reg.h --- sys/dev/pci/bktr/bktr_reg.h 26 Jan 2011 00:54:35 -0000 1.21 +++ sys/dev/pci/bktr/bktr_reg.h 26 Sep 2012 23:24:57 -0000 @@ -436,7 +436,7 @@ typedef struct bktr_clip bktr_clip_t; struct bktr_softc { - struct device bktr_dev; /* base device */ + device_t bktr_dev; /* base device */ bus_dma_tag_t dmat; /* DMA tag */ bus_space_tag_t memt; bus_space_handle_t memh; Index: sys/dev/pci/cxgb/cxgb_adapter.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/pci/cxgb/cxgb_adapter.h,v retrieving revision 1.2 diff -u -p -r1.2 cxgb_adapter.h --- sys/dev/pci/cxgb/cxgb_adapter.h 18 May 2011 01:01:59 -0000 1.2 +++ sys/dev/pci/cxgb/cxgb_adapter.h 28 Sep 2012 20:43:28 -0000 @@ -93,7 +93,6 @@ extern int cxgb_debug; #endif struct port_device { - struct device original; device_t dev; struct adapter *parent; int port_number; @@ -310,7 +309,6 @@ struct sge { struct filter_info; struct adapter { - struct device original; device_t dev; // so we have a compatible pointer int flags; TAILQ_ENTRY(adapter) adapter_entry; Index: sys/dev/pci/cxgb/cxgb_main.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/pci/cxgb/cxgb_main.c,v retrieving revision 1.2 diff -u -p -r1.2 cxgb_main.c --- sys/dev/pci/cxgb/cxgb_main.c 18 May 2011 01:01:59 -0000 1.2 +++ sys/dev/pci/cxgb/cxgb_main.c 28 Sep 2012 20:44:10 -0000 @@ -108,7 +108,7 @@ static int offload_close(struct toedev * #endif -CFATTACH_DECL(cxgbc, sizeof(struct adapter), cxgb_controller_match, cxgb_controller_attach, cxgb_controller_detach, NULL); +CFATTACH_DECL_NEW(cxgbc, sizeof(struct adapter), cxgb_controller_match, cxgb_controller_attach, cxgb_controller_detach, NULL); /* * Attachment glue for the ports. Attachment is done directly to the @@ -118,7 +118,7 @@ static int cxgb_port_match(device_t dev, static void cxgb_port_attach(device_t dev, device_t self, void *context); static int cxgb_port_detach(device_t dev, int flags); -CFATTACH_DECL(cxgb, sizeof(struct port_device), cxgb_port_match, cxgb_port_attach, cxgb_port_detach, NULL); +CFATTACH_DECL_NEW(cxgb, sizeof(struct port_device), cxgb_port_match, cxgb_port_attach, cxgb_port_detach, NULL); #define SGE_MSIX_COUNT (SGE_QSETS + 1) @@ -684,7 +684,7 @@ static int cxgb_port_match(device_t dev, #endif static void -cxgb_port_attach(device_t dev, device_t self, void *context) +cxgb_port_attach(device_t parent, device_t self, void *context) { struct port_info *p; struct port_device *pd; @@ -692,9 +692,9 @@ cxgb_port_attach(device_t dev, device_t char buf[32]; struct ifnet *ifp; int media_flags; - pd = (struct port_device *)self; // device is first element in port_device + pd = device_private(self); pd->dev = self; - pd->parent = (struct adapter *)dev; + pd->parent = device_private(parent); pd->port_number = *port_number; p = &pd->parent->port[*port_number]; p->pd = pd; @@ -704,7 +704,7 @@ cxgb_port_attach(device_t dev, device_t /* Allocate an ifnet object and set it up */ ifp = p->ifp = (void *)malloc(sizeof (struct ifnet), M_IFADDR, M_WAITOK); if (ifp == NULL) { - device_printf(dev, "Cannot allocate ifnet\n"); + device_printf(self, "Cannot allocate ifnet\n"); return; } memset(ifp, 0, sizeof(struct ifnet)); @@ -787,11 +787,11 @@ cxgb_port_attach(device_t dev, device_t } static int -cxgb_port_detach(device_t dev, int flags) +cxgb_port_detach(device_t self, int flags) { struct port_info *p; - p = (struct port_info *)dev; // device is first thing in adapter + p = device_private(self); PORT_LOCK(p); if (p->ifp->if_drv_flags & IFF_DRV_RUNNING) Index: sys/dev/pci/ixgbe/ixv.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/pci/ixgbe/ixv.h,v retrieving revision 1.1 diff -u -p -r1.1 ixv.h --- sys/dev/pci/ixgbe/ixv.h 12 Aug 2011 21:55:29 -0000 1.1 +++ sys/dev/pci/ixgbe/ixv.h 2 Oct 2012 02:23:15 -0000 @@ -297,7 +297,7 @@ struct adapter { struct ixgbe_hw hw; struct ixgbe_osdep osdep; - struct device *dev; + device_t dev; struct resource *pci_mem; struct resource *msix_mem; Index: sys/dev/pci/n8/n8_memory_bsd.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/pci/n8/n8_memory_bsd.c,v retrieving revision 1.4 diff -u -p -r1.4 n8_memory_bsd.c --- sys/dev/pci/n8/n8_memory_bsd.c 12 May 2009 08:23:01 -0000 1.4 +++ sys/dev/pci/n8/n8_memory_bsd.c 28 Sep 2012 20:47:44 -0000 @@ -288,26 +288,26 @@ n8_GetLargeAllocation(N8_MemoryType_t ba if (bus_dmamem_alloc(sc->dma_tag, size, PAGE_SIZE, 0, &seg, 1, &rseg, BUS_DMA_NOWAIT)) { printf("%s: can't alloc DMA buffer\n", - device_xname(&sc->device)); + device_xname(sc->sc_dev)); return 0; } if (bus_dmamem_map(sc->dma_tag, &seg, rseg, size, &kva, BUS_DMA_NOWAIT)) { printf("%s: can't map DMA buffers (%lu bytes)\n", - device_xname(&sc->device), size); + device_xname(sc->sc_dev), size); bus_dmamem_free(sc->dma_tag, &seg, rseg); return 0; } if (bus_dmamap_create(sc->dma_tag, size, 1, size, 0, BUS_DMA_NOWAIT, &DmaMap_g[bankIndex])) { - printf("%s: can't create DMA map\n", device_xname(&sc->device)); + printf("%s: can't create DMA map\n", device_xname(sc->sc_dev)); bus_dmamem_unmap(sc->dma_tag, kva, size); bus_dmamem_free(sc->dma_tag, &seg, rseg); return 0; } if (bus_dmamap_load(sc->dma_tag, DmaMap_g[bankIndex], kva, size, NULL, BUS_DMA_NOWAIT)) { - printf("%s: can't load DMA map\n", device_xname(&sc->device)); + printf("%s: can't load DMA map\n", device_xname(sc->sc_dev)); bus_dmamap_destroy(sc->dma_tag, DmaMap_g[bankIndex]); bus_dmamem_unmap(sc->dma_tag, kva, size); bus_dmamem_free(sc->dma_tag, &seg, rseg); Index: sys/dev/pci/n8/nsp.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/pci/n8/nsp.c,v retrieving revision 1.9 diff -u -p -r1.9 nsp.c --- sys/dev/pci/n8/nsp.c 13 Nov 2010 13:52:09 -0000 1.9 +++ sys/dev/pci/n8/nsp.c 28 Sep 2012 20:47:21 -0000 @@ -109,10 +109,10 @@ static int nsp_detach(device_t dev, int #ifdef _MODULE -CFATTACH_DECL(nsp2000, sizeof(struct nsp_softc), nsp_probe, nsp_attach, nsp_detach, NULL); +CFATTACH_DECL_NEW(nsp2000, sizeof(struct nsp_softc), nsp_probe, nsp_attach, nsp_detach, NULL); int nsp2000_lkmentry(struct lkm_table *lkmtp, int cmd, int ver); -CFDRIVER_DECL(nsp2000, DV_DULL, NULL); +CFDRIVER_DEC(nsp2000, DV_DULL, NULL); extern struct cfdriver nsp2000_cd; extern struct cfattach nsp2000_ca; static int pciloc[] = { -1, -1 }; /* device, function */ @@ -147,7 +147,7 @@ nsp2000_lkmentry(struct lkm_table *lkmtp } #else /* _MODULE */ -CFATTACH_DECL(nsp, sizeof(struct nsp_softc), nsp_probe, nsp_attach, nsp_detach, NULL); +CFATTACH_DECL_NEW(nsp, sizeof(struct nsp_softc), nsp_probe, nsp_attach, nsp_detach, NULL); #endif static int nsp_intr(void *arg); @@ -325,6 +325,7 @@ nsp_attach(device_t parent, device_t sel int ind; sc = device_private(self); + sc->sc_dev = self; mutex_init(&sc->sc_intrlock, MUTEX_DEFAULT, IPL_NET); @@ -346,13 +347,13 @@ nsp_attach(device_t parent, device_t sel aprint_normal(": %s, rev. %d\n", nspp->nsp_name, PCI_REVISION(pa->pa_class)); - printf("NetOctave Encryption Processor - %s\n", device_xname(&sc->device)); + printf("NetOctave Encryption Processor - %s\n", device_xname(self)); n8_sessionInit(sc); NSPcount_g = 1; if (n8_driverInit(N8_EA_POOL_SIZE, N8_PK_POOL_SIZE)) { - DBG(("%s: Failed driver init\n", device_xname(&sc->device))); + DBG(("%s: Failed driver init\n", device_xname(self))); NSPcount_g = 0; return; } @@ -383,7 +384,7 @@ nsp_attach(device_t parent, device_t sel if (pci_mapreg_map(pa, NSP_BAR0, PCI_MAPREG_MEM_TYPE_64BIT, 0, &sc->mem_tag, &sc->mem_handle, NULL, &sc->mem_size)) { - aprint_error_dev(&sc->device, "can't map mem space %d\n", 0); + aprint_error_dev(self, "can't map mem space %d\n", 0); return; } Index: sys/dev/pci/n8/nsp.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/pci/n8/nsp.h,v retrieving revision 1.1 diff -u -p -r1.1 nsp.h --- sys/dev/pci/n8/nsp.h 30 Oct 2008 12:02:14 -0000 1.1 +++ sys/dev/pci/n8/nsp.h 28 Sep 2012 20:46:40 -0000 @@ -116,7 +116,7 @@ typedef struct nsp_session { } nsp_session_t; struct nsp_softc { - struct device device; + device_t sc_dev; pci_chipset_tag_t pa_pc; pcitag_t pa_tag; void *int_handle; Index: sys/dev/pcmcia/if_an_pcmcia.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/pcmcia/if_an_pcmcia.c,v retrieving revision 1.40 diff -u -p -r1.40 if_an_pcmcia.c --- sys/dev/pcmcia/if_an_pcmcia.c 5 Sep 2009 14:44:59 -0000 1.40 +++ sys/dev/pcmcia/if_an_pcmcia.c 2 Oct 2012 02:27:34 -0000 @@ -97,8 +97,7 @@ static const size_t an_pcmcia_nproducts sizeof(an_pcmcia_products) / sizeof(an_pcmcia_products[0]); static int -an_pcmcia_match(device_t parent, cfdata_t match, - void *aux) +an_pcmcia_match(device_t parent, cfdata_t match, void *aux) { struct pcmcia_attach_args *pa = aux; @@ -118,8 +117,7 @@ an_pcmcia_validate_config(struct pcmcia_ } static void -an_pcmcia_attach(struct device *parent, device_t self, - void *aux) +an_pcmcia_attach(device_t parent, device_t self, void *aux) { struct an_pcmcia_softc *psc = device_private(self); struct an_softc *sc = &psc->sc_an; Index: sys/dev/pcmcia/if_awi_pcmcia.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/pcmcia/if_awi_pcmcia.c,v retrieving revision 1.44 diff -u -p -r1.44 if_awi_pcmcia.c --- sys/dev/pcmcia/if_awi_pcmcia.c 15 Sep 2009 18:37:02 -0000 1.44 +++ sys/dev/pcmcia/if_awi_pcmcia.c 28 Sep 2012 20:03:35 -0000 @@ -89,7 +89,7 @@ struct awi_pcmcia_softc { #define AWI_PCMCIA_ATTACHED 3 }; -CFATTACH_DECL(awi_pcmcia, sizeof(struct awi_pcmcia_softc), +CFATTACH_DECL_NEW(awi_pcmcia, sizeof(struct awi_pcmcia_softc), awi_pcmcia_match, awi_pcmcia_attach, awi_pcmcia_detach, awi_activate); static const struct pcmcia_product awi_pcmcia_products[] = { @@ -187,6 +187,7 @@ awi_pcmcia_attach(device_t parent, devic struct pcmcia_config_entry *cfe; int error; + sc->sc_dev = self; psc->sc_pf = pa->pf; error = pcmcia_function_configure(pa->pf, awi_pcmcia_validate_config); Index: sys/dev/pcmcia/if_cnw.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/pcmcia/if_cnw.c,v retrieving revision 1.55 diff -u -p -r1.55 if_cnw.c --- sys/dev/pcmcia/if_cnw.c 5 Apr 2010 07:21:47 -0000 1.55 +++ sys/dev/pcmcia/if_cnw.c 2 Oct 2012 02:27:56 -0000 @@ -182,7 +182,7 @@ int cnw_detach(device_t, int); int cnw_activate(device_t, enum devact); struct cnw_softc { - struct device sc_dev; /* Device glue (must be first) */ + device_t sc_dev; /* Device glue (must be first) */ struct ethercom sc_ethercom; /* Ethernet common part */ int sc_domain; /* Netwave domain */ int sc_skey; /* Netwave scramble key */ @@ -212,7 +212,7 @@ struct cnw_softc { #define CNW_RES_NET 8 }; -CFATTACH_DECL(cnw, sizeof(struct cnw_softc), +CFATTACH_DECL_NEW(cnw, sizeof(struct cnw_softc), cnw_match, cnw_attach, cnw_detach, cnw_activate); void cnw_reset(struct cnw_softc *); @@ -258,7 +258,7 @@ wait_WOC(struct cnw_softc *sc, int line) DELAY(100); } if (line > 0) - printf("%s: wedged at line %d\n", device_xname(&sc->sc_dev), line); + printf("%s: wedged at line %d\n", device_xname(sc->sc_dev), line); return (1); } #define WAIT_WOC(sc) wait_WOC(sc, __LINE__) @@ -294,7 +294,7 @@ cnw_cmd(struct cnw_softc *sc, int cmd, i if (wait_WOC(sc, 0)) { printf("%s: wedged when issuing cmd 0x%x\n", - device_xname(&sc->sc_dev), cmd); + device_xname(sc->sc_dev), cmd); /* * We'll continue anyway, as that's probably the best * thing we can do; at least the user knows there's a @@ -331,7 +331,7 @@ cnw_reset(struct cnw_softc *sc) { #ifdef CNW_DEBUG if (sc->sc_ethercom.ec_if.if_flags & IFF_DEBUG) - printf("%s: resetting\n", device_xname(&sc->sc_dev)); + printf("%s: resetting\n", device_xname(sc->sc_dev)); #endif wait_WOC(sc, 0); #ifndef MEMORY_MAPPED @@ -420,11 +420,11 @@ cnw_enable(struct cnw_softc *sc) sc->sc_ih = pcmcia_intr_establish(sc->sc_pf, IPL_NET, cnw_intr, sc); if (sc->sc_ih == NULL) { - aprint_error_dev(&sc->sc_dev, "couldn't establish interrupt handler\n"); + aprint_error_dev(sc->sc_dev, "couldn't establish interrupt handler\n"); return (EIO); } if (pcmcia_function_enable(sc->sc_pf) != 0) { - aprint_error_dev(&sc->sc_dev, "couldn't enable card\n"); + aprint_error_dev(sc->sc_dev, "couldn't enable card\n"); return (EIO); } sc->sc_resource |= CNW_RES_PCIC; @@ -458,8 +458,7 @@ cnw_disable(struct cnw_softc *sc) * Match the hardware we handle. */ int -cnw_match(device_t parent, cfdata_t match, - void *aux) +cnw_match(device_t parent, cfdata_t match, void *aux) { struct pcmcia_attach_args *pa = aux; @@ -477,15 +476,16 @@ cnw_match(device_t parent, cfdata_t matc * Attach the card. */ void -cnw_attach(struct device *parent, device_t self, void *aux) +cnw_attach(device_t parent, device_t self, void *aux) { - struct cnw_softc *sc = (void *) self; + struct cnw_softc *sc = device_private(self); struct pcmcia_attach_args *pa = aux; struct ifnet *ifp = &sc->sc_ethercom.ec_if; u_int8_t macaddr[ETHER_ADDR_LEN]; int i; bus_size_t memsize; + sc->sc_dev = self; sc->sc_resource = 0; /* Enable the card */ @@ -543,11 +543,11 @@ cnw_attach(struct device *parent, devic for (i = 0; i < ETHER_ADDR_LEN; i++) macaddr[i] = bus_space_read_1(sc->sc_memt, sc->sc_memh, sc->sc_memoff + CNW_EREG_PA + i); - printf("%s: address %s\n", device_xname(&sc->sc_dev), + printf("%s: address %s\n", device_xname(sc->sc_dev), ether_sprintf(macaddr)); /* Set up ifnet structure */ - 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 = cnw_start; ifp->if_ioctl = cnw_ioctl; @@ -698,7 +698,7 @@ cnw_transmit(struct cnw_softc *sc, struc #ifdef CNW_DEBUG if (sc->sc_ethercom.ec_if.if_flags & IFF_DEBUG) printf("%s: cnw_transmit b=0x%x s=%d o=0x%x\n", - device_xname(&sc->sc_dev), buffer, bufsize, bufoffset); + device_xname(sc->sc_dev), buffer, bufsize, bufoffset); #endif /* Copy data from mbuf chain to card buffers */ @@ -717,7 +717,7 @@ cnw_transmit(struct cnw_softc *sc, struc #ifdef CNW_DEBUG if (sc->sc_ethercom.ec_if.if_flags & IFF_DEBUG) printf("%s: next buffer @0x%x\n", - device_xname(&sc->sc_dev), buffer); + device_xname(sc->sc_dev), buffer); #endif } n = mbytes <= bufspace ? mbytes : bufspace; @@ -751,7 +751,7 @@ cnw_read(struct cnw_softc *sc) totbytes = read16(sc, CNW_EREG_RDP); #ifdef CNW_DEBUG if (sc->sc_ethercom.ec_if.if_flags & IFF_DEBUG) - printf("%s: recv %d bytes\n", device_xname(&sc->sc_dev), totbytes); + printf("%s: recv %d bytes\n", device_xname(sc->sc_dev), totbytes); #endif buffer = CNW_EREG_RDP + 2; bufbytes = 0; @@ -802,7 +802,7 @@ cnw_read(struct cnw_softc *sc) #ifdef CNW_DEBUG if (sc->sc_ethercom.ec_if.if_flags & IFF_DEBUG) printf("%s: %d bytes @0x%x+0x%lx\n", - device_xname(&sc->sc_dev), bufbytes, + device_xname(sc->sc_dev), bufbytes, buffer, (u_long)(bufptr - buffer - sc->sc_memoff)); #endif @@ -872,7 +872,7 @@ cnw_intr(void *arg) int ret, status, rser, tser; if ((sc->sc_ethercom.ec_if.if_flags & IFF_RUNNING) == 0 || - !device_is_active(&sc->sc_dev)) + !device_is_active(sc->sc_dev)) return (0); ifp->if_timer = 0; /* stop watchdog timer */ @@ -1126,7 +1126,7 @@ cnw_watchdog(struct ifnet *ifp) { struct cnw_softc *sc = ifp->if_softc; - printf("%s: device timeout; card reset\n", device_xname(&sc->sc_dev)); + printf("%s: device timeout; card reset\n", device_xname(sc->sc_dev)); ++ifp->if_oerrors; cnw_init(sc); } @@ -1166,7 +1166,7 @@ cnw_setkey(struct cnw_softc *sc, int key int cnw_activate(device_t self, enum devact act) { - struct cnw_softc *sc = (struct cnw_softc *)self; + struct cnw_softc *sc = device_private(self); switch (act) { case DVACT_DEACTIVATE: @@ -1180,7 +1180,7 @@ cnw_activate(device_t self, enum devact int cnw_detach(device_t self, int flags) { - struct cnw_softc *sc = (struct cnw_softc *)self; + struct cnw_softc *sc = device_private(self); struct ifnet *ifp = &sc->sc_ethercom.ec_if; /* cnw_disable() checks IFF_RUNNING */ Index: sys/dev/pcmcia/if_cs_pcmcia.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/pcmcia/if_cs_pcmcia.c,v retrieving revision 1.19 diff -u -p -r1.19 if_cs_pcmcia.c --- sys/dev/pcmcia/if_cs_pcmcia.c 2 Feb 2012 19:43:06 -0000 1.19 +++ sys/dev/pcmcia/if_cs_pcmcia.c 1 Oct 2012 15:40:51 -0000 @@ -69,7 +69,7 @@ struct cs_pcmcia_softc { #define CS_PCMCIA_ATTACHED 3 }; -CFATTACH_DECL(cs_pcmcia, sizeof(struct cs_pcmcia_softc), +CFATTACH_DECL_NEW(cs_pcmcia, sizeof(struct cs_pcmcia_softc), cs_pcmcia_match, cs_pcmcia_attach, cs_pcmcia_detach, cs_activate); static int @@ -98,13 +98,14 @@ cs_pcmcia_validate_config(struct pcmcia_ static void cs_pcmcia_attach(device_t parent, device_t self, void *aux) { - struct cs_pcmcia_softc *psc = (void *)self; - struct cs_softc *sc = (void *)&psc->sc_cs; + struct cs_pcmcia_softc *psc = device_private(self); + struct cs_softc *sc = &psc->sc_cs; struct pcmcia_attach_args *pa = aux; struct pcmcia_config_entry *cfe; struct pcmcia_function *pf; int error; + sc->sc_dev = self; pf = psc->sc_pf = pa->pf; error = pcmcia_function_configure(pa->pf, cs_pcmcia_validate_config); @@ -151,7 +152,7 @@ fail: static int cs_pcmcia_detach(device_t self, int flags) { - struct cs_pcmcia_softc *psc = (void *)self; + struct cs_pcmcia_softc *psc = device_private(self); struct cs_softc *sc = &psc->sc_cs; int error; Index: sys/dev/pcmcia/if_ray.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/pcmcia/if_ray.c,v retrieving revision 1.79 diff -u -p -r1.79 if_ray.c --- sys/dev/pcmcia/if_ray.c 5 Apr 2010 07:21:47 -0000 1.79 +++ sys/dev/pcmcia/if_ray.c 28 Sep 2012 20:08:18 -0000 @@ -149,7 +149,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_ray.c,v 1 */ struct ray_softc { - struct device sc_dev; + device_t sc_dev; struct ethercom sc_ec; struct ifmedia sc_media; @@ -458,7 +458,7 @@ static ray_cmd_func_t ray_subcmdtab[] = static int ray_nsubcmdtab = sizeof(ray_subcmdtab) / sizeof(*ray_subcmdtab); /* autoconf information */ -CFATTACH_DECL(ray, sizeof(struct ray_softc), +CFATTACH_DECL_NEW(ray, sizeof(struct ray_softc), ray_match, ray_attach, ray_detach, ray_activate); /* @@ -497,13 +497,14 @@ ray_validate_config(struct pcmcia_config static void ray_attach(device_t parent, device_t self, void *aux) { - struct ray_softc *sc = (void *)self; + struct ray_softc *sc = device_private(self); struct pcmcia_attach_args *pa = aux; struct ifnet *ifp = &sc->sc_if; struct pcmcia_config_entry *cfe; struct ray_ecf_startup *ep; int error; + sc->sc_dev = self; sc->sc_pf = pa->pf; /*XXXmem8|common*/ @@ -640,7 +641,7 @@ ray_detach(device_t self, int flags) sc = device_private(self); ifp = &sc->sc_if; - RAY_DPRINTF(("%s: detach\n", device_xname(&sc->sc_dev))); + RAY_DPRINTF(("%s: detach\n", device_xname(sc->sc_dev))); if (!sc->sc_attached) return (0); @@ -667,7 +668,7 @@ ray_enable(struct ray_softc *sc) { int error; - RAY_DPRINTF(("%s: enable\n", device_xname(&sc->sc_dev))); + RAY_DPRINTF(("%s: enable\n", device_xname(sc->sc_dev))); sc->sc_ih = pcmcia_intr_establish(sc->sc_pf, IPL_NET, ray_intr, sc); @@ -689,7 +690,7 @@ ray_enable(struct ray_softc *sc) static void ray_disable(struct ray_softc *sc) { - RAY_DPRINTF(("%s: disable\n", device_xname(&sc->sc_dev))); + RAY_DPRINTF(("%s: disable\n", device_xname(sc->sc_dev))); ray_stop(sc); @@ -715,7 +716,7 @@ ray_init(struct ray_softc *sc) bus_size_t ccs; int i; - RAY_DPRINTF(("%s: init\n", device_xname(&sc->sc_dev))); + RAY_DPRINTF(("%s: init\n", device_xname(sc->sc_dev))); if ((sc->sc_if.if_flags & IFF_RUNNING)) ray_stop(sc); @@ -723,7 +724,7 @@ ray_init(struct ray_softc *sc) if (pcmcia_function_enable(sc->sc_pf)) return (EIO); - RAY_DPRINTF(("%s: init post-enable\n", device_xname(&sc->sc_dev))); + RAY_DPRINTF(("%s: init post-enable\n", device_xname(sc->sc_dev))); /* reset some values */ memset(sc->sc_ccsinuse, 0, sizeof(sc->sc_ccsinuse)); @@ -748,7 +749,7 @@ ray_init(struct ray_softc *sc) if (ep->e_status != RAY_ECFS_CARD_OK) { pcmcia_function_disable(sc->sc_pf); printf("%s: card failed self test: status %d\n", - device_xname(&sc->sc_dev), sc->sc_ecf_startup.e_status); + device_xname(sc->sc_dev), sc->sc_ecf_startup.e_status); return (EIO); } @@ -791,7 +792,7 @@ ray_init(struct ray_softc *sc) static void ray_stop(struct ray_softc *sc) { - RAY_DPRINTF(("%s: stop\n", device_xname(&sc->sc_dev))); + RAY_DPRINTF(("%s: stop\n", device_xname(sc->sc_dev))); callout_stop(&sc->sc_check_ccs_ch); sc->sc_timocheck = 0; @@ -820,13 +821,13 @@ ray_reset(struct ray_softc *sc) { if (++sc->sc_resetloop >= RAY_MAX_RESETS) { if (sc->sc_resetloop == RAY_MAX_RESETS) { - aprint_error_dev(&sc->sc_dev, "unable to correct, disabling\n"); + aprint_error_dev(sc->sc_dev, "unable to correct, disabling\n"); callout_stop(&sc->sc_reset_resetloop_ch); callout_reset(&sc->sc_disable_ch, 1, (void (*)(void *))ray_disable, sc); } } else { - aprint_error_dev(&sc->sc_dev, "unexpected failure resetting hw [%d more]\n", + aprint_error_dev(sc->sc_dev, "unexpected failure resetting hw [%d more]\n", RAY_MAX_RESETS - sc->sc_resetloop); callout_stop(&sc->sc_reset_resetloop_ch); ray_init(sc); @@ -1243,7 +1244,7 @@ ray_intr_start(struct ray_softc *sc) pcount++; m_freem(m0); - RAY_DPRINTF_XMIT(("%s: sent packet: len %ld\n", device_xname(&sc->sc_dev), + RAY_DPRINTF_XMIT(("%s: sent packet: len %ld\n", device_xname(sc->sc_dev), (u_long)pktlen)); } @@ -1257,14 +1258,14 @@ ray_intr_start(struct ray_softc *sc) * be a confused state though because we check above * and don't issue any commands between. */ - printf("%s: dropping tx packets device busy\n", device_xname(&sc->sc_dev)); + printf("%s: dropping tx packets device busy\n", device_xname(sc->sc_dev)); ray_free_ccs_chain(sc, firsti); ifp->if_oerrors += pcount; return; } /* send it off */ - RAY_DPRINTF(("%s: ray_start issuing %d \n", device_xname(&sc->sc_dev), firsti)); + RAY_DPRINTF(("%s: ray_start issuing %d \n", device_xname(sc->sc_dev), firsti)); SRAM_WRITE_1(sc, RAY_SCB_CCSI, firsti); RAY_ECF_START_CMD(sc); @@ -1319,19 +1320,19 @@ ray_recv(struct ray_softc *sc, bus_size_ siglev = SRAM_READ_FIELD_1(sc, ccs, ray_cmd_rx, c_siglev); #endif - RAY_DPRINTF(("%s: recv pktlen %ld frag %d\n", device_xname(&sc->sc_dev), + RAY_DPRINTF(("%s: recv pktlen %ld frag %d\n", device_xname(sc->sc_dev), (u_long)pktlen, frag)); - RAY_DPRINTF_XMIT(("%s: received packet: len %ld\n", device_xname(&sc->sc_dev), + RAY_DPRINTF_XMIT(("%s: received packet: len %ld\n", device_xname(sc->sc_dev), (u_long)pktlen)); if (pktlen > MCLBYTES || pktlen < sizeof(*frame)) { RAY_DPRINTF(("%s: PKTLEN TOO BIG OR TOO SMALL\n", - device_xname(&sc->sc_dev))); + device_xname(sc->sc_dev))); ifp->if_ierrors++; goto done; } MGETHDR(m, M_DONTWAIT, MT_DATA); if (!m) { - RAY_DPRINTF(("%s: MGETHDR FAILED\n", device_xname(&sc->sc_dev))); + RAY_DPRINTF(("%s: MGETHDR FAILED\n", device_xname(sc->sc_dev))); ifp->if_ierrors++; goto done; } @@ -1339,7 +1340,7 @@ ray_recv(struct ray_softc *sc, bus_size_ /* XXX should allow chaining? */ MCLGET(m, M_DONTWAIT); if ((m->m_flags & M_EXT) == 0) { - RAY_DPRINTF(("%s: MCLGET FAILED\n", device_xname(&sc->sc_dev))); + RAY_DPRINTF(("%s: MCLGET FAILED\n", device_xname(sc->sc_dev))); ifp->if_ierrors++; m_freem(m); m = 0; @@ -1352,7 +1353,7 @@ ray_recv(struct ray_softc *sc, bus_size_ m->m_data += fudge; d = mtod(m, u_int8_t *); - RAY_DPRINTF(("%s: recv ccs index %d\n", device_xname(&sc->sc_dev), first)); + RAY_DPRINTF(("%s: recv ccs index %d\n", device_xname(sc->sc_dev), first)); i = ni = first; while ((i = ni) && i != RAY_CCS_LINK_NULL) { ccs = RAY_GET_CCS(i); @@ -1367,11 +1368,11 @@ ray_recv(struct ray_softc *sc, bus_size_ ni = SRAM_READ_FIELD_1(sc, ccs, ray_cmd_rx, c_nextfrag); RAY_DPRINTF(( "%s: recv frag index %d len %ld bufp 0x%llx ni %d\n", - device_xname(&sc->sc_dev), i, (u_long)len, (unsigned long long)bufp, + device_xname(sc->sc_dev), i, (u_long)len, (unsigned long long)bufp, ni)); if (len + lenread > pktlen) { RAY_DPRINTF(("%s: BAD LEN current 0x%lx pktlen 0x%lx\n", - device_xname(&sc->sc_dev), (u_long)(len + lenread), + device_xname(sc->sc_dev), (u_long)(len + lenread), (u_long)pktlen)); ifp->if_ierrors++; m_freem(m); @@ -1398,7 +1399,7 @@ ray_recv(struct ray_softc *sc, bus_size_ } done: - RAY_DPRINTF(("%s: recv frag count %d\n", device_xname(&sc->sc_dev), frag)); + RAY_DPRINTF(("%s: recv frag count %d\n", device_xname(sc->sc_dev), frag)); /* free the rcss */ ni = first; @@ -1413,7 +1414,7 @@ done: return; RAY_DPRINTF(("%s: recv got packet pktlen %ld actual %ld\n", - device_xname(&sc->sc_dev), (u_long)pktlen, (u_long)lenread)); + device_xname(sc->sc_dev), (u_long)pktlen, (u_long)lenread)); #ifdef RAY_DEBUG if (ray_debug && ray_debug_dump_rx) ray_dump_mbuf(sc, m); @@ -1424,7 +1425,7 @@ done: & (IEEE80211_FC0_VERSION_MASK|IEEE80211_FC0_TYPE_MASK); if ((fc0 & IEEE80211_FC0_VERSION_MASK) != IEEE80211_FC0_VERSION_0) { RAY_DPRINTF(("%s: pkt not version 0 fc 0x%x\n", - device_xname(&sc->sc_dev), fc0)); + device_xname(sc->sc_dev), fc0)); m_freem(m); return; } @@ -1441,7 +1442,7 @@ done: break; default: RAY_DPRINTF(("%s: mgt packet not supported\n", - device_xname(&sc->sc_dev))); + device_xname(sc->sc_dev))); #ifdef RAY_DEBUG hexdump((const u_int8_t*)frame, pktlen, 16, 4, 0); #endif @@ -1452,14 +1453,14 @@ done: return; } else if ((fc0 & IEEE80211_FC0_TYPE_MASK) != IEEE80211_FC0_TYPE_DATA) { RAY_DPRINTF(("%s: pkt not type data fc0 0x%x\n", - device_xname(&sc->sc_dev), fc0)); + device_xname(sc->sc_dev), fc0)); m_freem(m); return; } if (pktlen < sizeof(*frame) + sizeof(struct llc)) { RAY_DPRINTF(("%s: pkt too small for llc (%ld)\n", - device_xname(&sc->sc_dev), (u_long)pktlen)); + device_xname(sc->sc_dev), (u_long)pktlen)); m_freem(m); return; } @@ -1472,7 +1473,7 @@ done: * Ethernet2 in 802.11 encapsulation produced by * the windows driver for the WebGear card */ - RAY_DPRINTF(("%s: pkt not snap 0\n", device_xname(&sc->sc_dev))); + RAY_DPRINTF(("%s: pkt not snap 0\n", device_xname(sc->sc_dev))); if ((ifp->if_flags & IFF_LINK0) == 0) { m_freem(m); return; @@ -1487,11 +1488,11 @@ done: src = frame->i_addr3; break; case IEEE80211_FC1_DIR_TODS: - RAY_DPRINTF(("%s: pkt ap2ap\n", device_xname(&sc->sc_dev))); + RAY_DPRINTF(("%s: pkt ap2ap\n", device_xname(sc->sc_dev))); m_freem(m); return; default: - RAY_DPRINTF(("%s: pkt type unknown\n", device_xname(&sc->sc_dev))); + RAY_DPRINTF(("%s: pkt type unknown\n", device_xname(sc->sc_dev))); m_freem(m); return; } @@ -1528,7 +1529,7 @@ ray_recv_auth(struct ray_softc *sc, stru u_int8_t *var = (u_int8_t *)(frame + 1); if (sc->sc_mode == SC_MODE_ADHOC) { - RAY_DPRINTF(("%s: recv auth packet:\n", device_xname(&sc->sc_dev))); + RAY_DPRINTF(("%s: recv auth packet:\n", device_xname(sc->sc_dev))); #ifdef RAY_DEBUG hexdump((const u_int8_t *)frame, sizeof(*frame) + 6, 16, 4, 0); #endif @@ -1536,7 +1537,7 @@ ray_recv_auth(struct ray_softc *sc, stru if (var[2] == OPEN_AUTH_REQUEST) { RAY_DPRINTF(("%s: Sending authentication response.\n", - device_xname(&sc->sc_dev))); + device_xname(sc->sc_dev))); if (ray_send_auth(sc, frame->i_addr2, OPEN_AUTH_RESPONSE) == 0) { sc->sc_authstate = RAY_AUTH_NEEDED; @@ -1545,7 +1546,7 @@ ray_recv_auth(struct ray_softc *sc, stru } } else if (var[2] == OPEN_AUTH_RESPONSE) { RAY_DPRINTF(("%s: Authenticated!\n", - device_xname(&sc->sc_dev))); + device_xname(sc->sc_dev))); sc->sc_authstate = RAY_AUTH_AUTH; } } @@ -1565,7 +1566,7 @@ ray_send_auth(struct ray_softc *sc, u_in ccsindex = ray_find_free_tx_ccs(sc, RAY_CCS_TX_FIRST); if (ccsindex == RAY_CCS_LINK_NULL) { RAY_DPRINTF(("%s: send auth failed -- no free tx slots\n", - device_xname(&sc->sc_dev))); + device_xname(sc->sc_dev))); return (ENOMEM); } @@ -1589,7 +1590,7 @@ ray_send_auth(struct ray_softc *sc, u_in RAY_ECF_START_CMD(sc); RAY_DPRINTF_XMIT(("%s: sent auth packet: len %lu\n", - device_xname(&sc->sc_dev), (u_long) sizeof(packet))); + device_xname(sc->sc_dev), (u_long) sizeof(packet))); return (0); } @@ -1651,7 +1652,7 @@ ray_fill_in_tx_ccs(struct ray_softc *sc, SRAM_WRITE_FIELD_1(sc, RAY_GET_CCS(pi), ray_cmd_tx, c_link, i); RAY_DPRINTF(("%s: ray_alloc_tx_ccs bufp 0x%llx idx %u pidx %u\n", - device_xname(&sc->sc_dev), (unsigned long long)bufp, i, pi)); + device_xname(sc->sc_dev), (unsigned long long)bufp, i, pi)); return (bufp + RAY_TX_PHY_SIZE); } @@ -1668,11 +1669,11 @@ ray_update_params_done(struct ray_softc rcmd = 0; RAY_DPRINTF(("%s: ray_update_params_done stat %d\n", - device_xname(&sc->sc_dev), stat)); + device_xname(sc->sc_dev), stat)); /* this will get more complex as we add commands */ if (stat == RAY_CCS_STATUS_FAIL) { - printf("%s: failed to update a promisc\n", device_xname(&sc->sc_dev)); + printf("%s: failed to update a promisc\n", device_xname(sc->sc_dev)); /* XXX should probably reset */ /* rcmd = ray_reset; */ } @@ -1680,7 +1681,7 @@ ray_update_params_done(struct ray_softc if (sc->sc_running & SCP_UPD_PROMISC) { ray_cmd_done(sc, SCP_UPD_PROMISC); sc->sc_promisc = SRAM_READ_1(sc, RAY_HOST_TO_ECF_BASE); - RAY_DPRINTF(("%s: new promisc value %d\n", device_xname(&sc->sc_dev), + RAY_DPRINTF(("%s: new promisc value %d\n", device_xname(sc->sc_dev), sc->sc_promisc)); } else if (sc->sc_updreq) { ray_cmd_done(sc, SCP_UPD_UPDATEPARAMS); @@ -1709,7 +1710,7 @@ ray_check_scheduled(void *arg) sc = arg; RAY_DPRINTF(( "%s: ray_check_scheduled enter schd 0x%x running 0x%x ready %d\n", - device_xname(&sc->sc_dev), sc->sc_scheduled, sc->sc_running, RAY_ECF_READY(sc))); + device_xname(sc->sc_dev), sc->sc_scheduled, sc->sc_running, RAY_ECF_READY(sc))); if (sc->sc_timoneed) { callout_stop(&sc->sc_check_scheduled_ch); @@ -1732,7 +1733,7 @@ ray_check_scheduled(void *arg) RAY_DPRINTF(( "%s: ray_check_scheduled exit sched 0x%x running 0x%x ready %d\n", - device_xname(&sc->sc_dev), sc->sc_scheduled, sc->sc_running, RAY_ECF_READY(sc))); + device_xname(sc->sc_dev), sc->sc_scheduled, sc->sc_running, RAY_ECF_READY(sc))); if (sc->sc_scheduled & ~SCP_UPD_MASK) ray_set_pending(sc, sc->sc_scheduled); @@ -1759,7 +1760,7 @@ ray_check_ccs(void *arg) s = splnet(); sc = arg; - RAY_DPRINTF(("%s: ray_check_ccs\n", device_xname(&sc->sc_dev))); + RAY_DPRINTF(("%s: ray_check_ccs\n", device_xname(sc->sc_dev))); sc->sc_timocheck = 0; for (i = RAY_CCS_CMD_FIRST; i <= RAY_CCS_CMD_LAST; i++) { @@ -1773,7 +1774,7 @@ ray_check_ccs(void *arg) case RAY_CMD_UPDATE_PARAMS: stat = SRAM_READ_FIELD_1(sc, ccs, ray_cmd, c_status); RAY_DPRINTF(("%s: check ccs idx %u ccs 0x%llx " - "cmd 0x%x stat %u\n", device_xname(&sc->sc_dev), i, + "cmd 0x%x stat %u\n", device_xname(sc->sc_dev), i, (unsigned long long)ccs, cmd, stat)); goto breakout; } @@ -1851,7 +1852,7 @@ ray_ccs_done(struct ray_softc *sc, bus_s stat = SRAM_READ_FIELD_1(sc, ccs, ray_cmd, c_status); RAY_DPRINTF(("%s: ray_ccs_done idx %llu cmd 0x%x stat %u\n", - device_xname(&sc->sc_dev), (unsigned long long)RAY_GET_INDEX(ccs), cmd, stat)); + device_xname(sc->sc_dev), (unsigned long long)RAY_GET_INDEX(ccs), cmd, stat)); rcmd = 0; switch (cmd) { @@ -1950,7 +1951,7 @@ ray_rccs_intr(struct ray_softc *sc, bus_ stat = SRAM_READ_FIELD_1(sc, ccs, ray_cmd, c_status); RAY_DPRINTF(("%s: ray_rccs_intr idx %llu cmd 0x%x stat %u\n", - device_xname(&sc->sc_dev), (unsigned long long)RAY_GET_INDEX(ccs), cmd, stat)); + device_xname(sc->sc_dev), (unsigned long long)RAY_GET_INDEX(ccs), cmd, stat)); rcmd = 0; switch (cmd) { @@ -2004,7 +2005,7 @@ ray_intr(void *arg) sc = arg; - RAY_DPRINTF(("%s: ray_intr\n", device_xname(&sc->sc_dev))); + RAY_DPRINTF(("%s: ray_intr\n", device_xname(sc->sc_dev))); if ((++sc->sc_checkcounters % 32) == 0) ray_update_error_counters(sc); @@ -2021,7 +2022,7 @@ ray_intr(void *arg) else if (i <= RAY_RCCS_LAST) rcmd = ray_rccs_intr(sc, RAY_GET_CCS(i)); else - printf("%s: intr: bad cmd index %d\n", device_xname(&sc->sc_dev), i); + printf("%s: intr: bad cmd index %d\n", device_xname(sc->sc_dev), i); } if (rcmd) @@ -2030,7 +2031,7 @@ ray_intr(void *arg) if (count) REG_WRITE(sc, RAY_HCSIR, 0); - RAY_DPRINTF(("%s: interrupt handled %d\n", device_xname(&sc->sc_dev), count)); + RAY_DPRINTF(("%s: interrupt handled %d\n", device_xname(sc->sc_dev), count)); return (count ? 1 : 0); } @@ -2064,7 +2065,7 @@ ray_free_ccs(struct ray_softc *sc, bus_s { u_int8_t stat; - RAY_DPRINTF(("%s: free_ccs idx %llu\n", device_xname(&sc->sc_dev), + RAY_DPRINTF(("%s: free_ccs idx %llu\n", device_xname(sc->sc_dev), (unsigned long long)RAY_GET_INDEX(ccs))); stat = SRAM_READ_FIELD_1(sc, ccs, ray_cmd, c_status); @@ -2091,7 +2092,7 @@ ray_alloc_ccs(struct ray_softc *sc, bus_ bus_size_t ccs; u_int i; - RAY_DPRINTF(("%s: alloc_ccs cmd %d\n", device_xname(&sc->sc_dev), cmd)); + RAY_DPRINTF(("%s: alloc_ccs cmd %d\n", device_xname(sc->sc_dev), cmd)); /* for tracked commands, if not ready just set pending */ if (track && !RAY_ECF_READY(sc)) { @@ -2130,11 +2131,11 @@ ray_alloc_ccs(struct ray_softc *sc, bus_ static void ray_set_pending(struct ray_softc *sc, u_int cmdf) { - RAY_DPRINTF(("%s: ray_set_pending 0x%x\n", device_xname(&sc->sc_dev), cmdf)); + RAY_DPRINTF(("%s: ray_set_pending 0x%x\n", device_xname(sc->sc_dev), cmdf)); sc->sc_scheduled |= cmdf; if (!sc->sc_timoneed) { - RAY_DPRINTF(("%s: ray_set_pending new timo\n", device_xname(&sc->sc_dev))); + RAY_DPRINTF(("%s: ray_set_pending new timo\n", device_xname(sc->sc_dev))); callout_reset(&sc->sc_check_scheduled_ch, RAY_CHECK_SCHED_TIMEOUT, ray_check_scheduled, sc); sc->sc_timoneed = 1; @@ -2149,7 +2150,7 @@ ray_cmd_schedule(struct ray_softc *sc, i { int track; - RAY_DPRINTF(("%s: ray_cmd_schedule 0x%x\n", device_xname(&sc->sc_dev), cmdf)); + RAY_DPRINTF(("%s: ray_cmd_schedule 0x%x\n", device_xname(sc->sc_dev), cmdf)); track = cmdf; if ((cmdf & SCP_UPD_MASK) == 0) @@ -2167,7 +2168,7 @@ ray_cmd_schedule(struct ray_softc *sc, i static int ray_cmd_is_scheduled(struct ray_softc *sc, int cmdf) { - RAY_DPRINTF(("%s: ray_cmd_is_scheduled 0x%x\n", device_xname(&sc->sc_dev), cmdf)); + RAY_DPRINTF(("%s: ray_cmd_is_scheduled 0x%x\n", device_xname(sc->sc_dev), cmdf)); return ((sc->sc_scheduled & cmdf) ? 1 : 0); } @@ -2178,7 +2179,7 @@ ray_cmd_is_scheduled(struct ray_softc *s static void ray_cmd_cancel(struct ray_softc *sc, int cmdf) { - RAY_DPRINTF(("%s: ray_cmd_cancel 0x%x\n", device_xname(&sc->sc_dev), cmdf)); + RAY_DPRINTF(("%s: ray_cmd_cancel 0x%x\n", device_xname(sc->sc_dev), cmdf)); sc->sc_scheduled &= ~cmdf; if ((cmdf & SCP_UPD_MASK) && (sc->sc_scheduled & SCP_UPD_MASK) == 0) @@ -2197,7 +2198,7 @@ ray_cmd_cancel(struct ray_softc *sc, int static void ray_cmd_ran(struct ray_softc *sc, int cmdf) { - RAY_DPRINTF(("%s: ray_cmd_ran 0x%x\n", device_xname(&sc->sc_dev), cmdf)); + RAY_DPRINTF(("%s: ray_cmd_ran 0x%x\n", device_xname(sc->sc_dev), cmdf)); if (cmdf & SCP_UPD_MASK) sc->sc_running |= cmdf | SCP_UPDATESUBCMD; @@ -2217,7 +2218,7 @@ ray_cmd_ran(struct ray_softc *sc, int cm static int ray_cmd_is_running(struct ray_softc *sc, int cmdf) { - RAY_DPRINTF(("%s: ray_cmd_is_running 0x%x\n", device_xname(&sc->sc_dev), cmdf)); + RAY_DPRINTF(("%s: ray_cmd_is_running 0x%x\n", device_xname(sc->sc_dev), cmdf)); return ((sc->sc_running & cmdf) ? 1 : 0); } @@ -2228,7 +2229,7 @@ ray_cmd_is_running(struct ray_softc *sc, static void ray_cmd_done(struct ray_softc *sc, int cmdf) { - RAY_DPRINTF(("%s: ray_cmd_done 0x%x\n", device_xname(&sc->sc_dev), cmdf)); + RAY_DPRINTF(("%s: ray_cmd_done 0x%x\n", device_xname(sc->sc_dev), cmdf)); sc->sc_running &= ~cmdf; if (cmdf & SCP_UPD_MASK) { @@ -2251,7 +2252,7 @@ ray_issue_cmd(struct ray_softc *sc, bus_ { u_int i; - RAY_DPRINTF(("%s: ray_cmd_issue 0x%x\n", device_xname(&sc->sc_dev), track)); + RAY_DPRINTF(("%s: ray_cmd_issue 0x%x\n", device_xname(sc->sc_dev), track)); /* * XXX other drivers did this, but I think @@ -2298,7 +2299,7 @@ ray_update_subcmd(struct ray_softc *sc) { int submask, i; - RAY_DPRINTF(("%s: ray_update_subcmd\n", device_xname(&sc->sc_dev))); + RAY_DPRINTF(("%s: ray_update_subcmd\n", device_xname(sc->sc_dev))); ray_cmd_cancel(sc, SCP_UPDATESUBCMD); if ((sc->sc_if.if_flags & IFF_RUNNING) == 0) @@ -2384,7 +2385,7 @@ ray_download_params(struct ray_softc *sc struct ray_startup_params_tail_4 *sp4; bus_size_t off; - RAY_DPRINTF(("%s: init_startup_params\n", device_xname(&sc->sc_dev))); + RAY_DPRINTF(("%s: init_startup_params\n", device_xname(sc->sc_dev))); ray_cmd_cancel(sc, SCP_UPD_STARTUP); @@ -2707,7 +2708,7 @@ ray_start_join_net_done(struct ray_softc return (ray_start_join_net); } RAY_DPRINTF(("%s: net start/join nwid %.32s bssid %s inited %d\n", - device_xname(&sc->sc_dev), sc->sc_cnwid.i_nwid, ether_sprintf(sc->sc_bssid), + device_xname(sc->sc_dev), sc->sc_cnwid.i_nwid, ether_sprintf(sc->sc_bssid), SRAM_READ_FIELD_1(sc, ccs, ray_cmd_net, c_inited))); /* network is now active */ @@ -3128,7 +3129,7 @@ ray_dump_mbuf(struct ray_softc *sc, stru u_int8_t *d, *ed; u_int i; - printf("%s: pkt dump:", device_xname(&sc->sc_dev)); + printf("%s: pkt dump:", device_xname(sc->sc_dev)); i = 0; for (; m; m = m->m_next) { d = mtod(m, u_int8_t *); Index: sys/dev/pcmcia/if_sm_pcmcia.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/pcmcia/if_sm_pcmcia.c,v retrieving revision 1.54 diff -u -p -r1.54 if_sm_pcmcia.c --- sys/dev/pcmcia/if_sm_pcmcia.c 12 May 2009 14:42:18 -0000 1.54 +++ sys/dev/pcmcia/if_sm_pcmcia.c 1 Oct 2012 15:48:28 -0000 @@ -76,7 +76,7 @@ struct sm_pcmcia_softc { #define SM_PCMCIA_ATTACHED 3 }; -CFATTACH_DECL(sm_pcmcia, sizeof(struct sm_pcmcia_softc), +CFATTACH_DECL_NEW(sm_pcmcia, sizeof(struct sm_pcmcia_softc), sm_pcmcia_match, sm_pcmcia_attach, sm_pcmcia_detach, smc91cxx_activate); int sm_pcmcia_enable(struct smc91cxx_softc *); @@ -134,13 +134,14 @@ sm_pcmcia_validate_config(struct pcmcia_ void sm_pcmcia_attach(device_t parent, device_t self, void *aux) { - struct sm_pcmcia_softc *psc = (struct sm_pcmcia_softc *)self; + struct sm_pcmcia_softc *psc = device_private(self); struct smc91cxx_softc *sc = &psc->sc_smc; struct pcmcia_attach_args *pa = aux; struct pcmcia_config_entry *cfe; u_int8_t enaddr[ETHER_ADDR_LEN]; int error; + sc->sc_dev = self; psc->sc_pf = pa->pf; error = pcmcia_function_configure(pa->pf, sm_pcmcia_validate_config); @@ -187,7 +188,7 @@ fail: int sm_pcmcia_detach(device_t self, int flags) { - struct sm_pcmcia_softc *psc = (struct sm_pcmcia_softc *)self; + struct sm_pcmcia_softc *psc = device_private(self); int error; if (psc->sc_state != SM_PCMCIA_ATTACHED) Index: sys/dev/pcmcia/if_tr_pcmcia.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/pcmcia/if_tr_pcmcia.c,v retrieving revision 1.24 diff -u -p -r1.24 if_tr_pcmcia.c --- sys/dev/pcmcia/if_tr_pcmcia.c 22 Oct 2009 18:47:56 -0000 1.24 +++ sys/dev/pcmcia/if_tr_pcmcia.c 1 Oct 2012 15:41:25 -0000 @@ -96,7 +96,7 @@ static void tr_pcmcia_mediastatus(struct static void tr_pcmcia_disable(struct tr_softc *); static void tr_pcmcia_setup(struct tr_softc *); -CFATTACH_DECL(tr_pcmcia, sizeof(struct tr_pcmcia_softc), +CFATTACH_DECL_NEW(tr_pcmcia, sizeof(struct tr_pcmcia_softc), tr_pcmcia_match, tr_pcmcia_attach, tr_pcmcia_detach, tr_activate); static int @@ -117,7 +117,7 @@ tr_pcmcia_match(device_t parent, cfdata_ static void tr_pcmcia_attach(device_t parent, device_t self, void *aux) { - struct tr_pcmcia_softc *psc = (void *)self; + struct tr_pcmcia_softc *psc = device_private(self); struct tr_softc *sc = &psc->sc_tr; struct pcmcia_attach_args *pa = aux; struct pcmcia_config_entry *cfe; @@ -212,7 +212,7 @@ tr_pcmcia_enable(struct tr_softc *sc) sc->sc_ih = pcmcia_intr_establish(psc->sc_pf, IPL_NET, tr_intr, psc); if (sc->sc_ih == NULL) { - aprint_error_dev(&psc->sc_tr.sc_dev, "couldn't establish interrupt\n"); + aprint_error_dev(psc->sc_tr.sc_dev, "couldn't establish interrupt\n"); return 1; } @@ -288,7 +288,7 @@ tr_pcmcia_mediastatus(struct tr_softc *s int tr_pcmcia_detach(device_t self, int flags) { - struct tr_pcmcia_softc *psc = (struct tr_pcmcia_softc *)self; + struct tr_pcmcia_softc *psc = device_private(self); int rv; rv = tr_detach(self, flags); Index: sys/dev/pcmcia/isic_pcmcia.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/pcmcia/isic_pcmcia.c,v retrieving revision 1.40 diff -u -p -r1.40 isic_pcmcia.c --- sys/dev/pcmcia/isic_pcmcia.c 6 Dec 2009 23:05:06 -0000 1.40 +++ sys/dev/pcmcia/isic_pcmcia.c 29 Sep 2012 12:52:34 -0000 @@ -83,7 +83,7 @@ static int isic_pcmcia_isdn_attach(struc static int isic_pcmcia_detach(device_t self, int flags); static int isic_pcmcia_activate(device_t self, enum devact act); -CFATTACH_DECL(isic_pcmcia, sizeof(struct pcmcia_isic_softc), +CFATTACH_DECL_NEW(isic_pcmcia, sizeof(struct pcmcia_isic_softc), isic_pcmcia_match, isic_pcmcia_attach, isic_pcmcia_detach, isic_pcmcia_activate); @@ -171,8 +171,7 @@ find_matching_card(struct pcmcia_attach_ * Match card */ static int -isic_pcmcia_match(device_t parent, - cfdata_t match, void *aux) +isic_pcmcia_match(device_t parent, cfdata_t match, void *aux) { struct pcmcia_attach_args *pa = aux; @@ -186,15 +185,15 @@ isic_pcmcia_match(device_t parent, * Attach the card */ static void -isic_pcmcia_attach(device_t parent, - device_t self, void *aux) +isic_pcmcia_attach(device_t parent, device_t self, void *aux) { - struct pcmcia_isic_softc *psc = (void*) self; + struct pcmcia_isic_softc *psc = device_private(self); struct isic_softc *sc = &psc->sc_isic; struct pcmcia_attach_args *pa = aux; struct pcmcia_config_entry *cfe; const struct isic_pcmcia_card_entry * cde; + sc->sc_dev = self; psc->sc_pf = pa->pf; cfe = SIMPLEQ_FIRST(&pa->pf->cfe_head); psc->sc_ih = NULL; @@ -202,7 +201,7 @@ isic_pcmcia_attach(device_t parent, /* Which card is it? */ cde = find_matching_card(pa); if (cde == NULL) { - aprint_error_dev(&psc->sc_isic.sc_dev, "attach failed, couldn't find matching card\n"); + aprint_error_dev(self, "attach failed, couldn't find matching card\n"); return; } printf("%s: %s\n", cde->name, device_xname(self)); @@ -213,14 +212,14 @@ isic_pcmcia_attach(device_t parent, pcmcia_function_enable(pa->pf); if (!cde->attach(psc, cfe, pa)) { - aprint_error_dev(&psc->sc_isic.sc_dev, "attach failed, card-specific attach unsuccesful\n"); + aprint_error_dev(self, "attach failed, card-specific attach unsuccesful\n"); goto fail; } /* MI initilization */ sc->sc_cardtyp = cde->card_type; if (isic_pcmcia_isdn_attach(sc, cde->name)) { - aprint_error_dev(&psc->sc_isic.sc_dev, "attach failed, generic attach unsuccesful\n"); + aprint_error_dev(self, "attach failed, generic attach unsuccesful\n"); goto fail; } @@ -234,7 +233,7 @@ fail: static int isic_pcmcia_detach(device_t self, int flags) { - struct pcmcia_isic_softc *psc = (struct pcmcia_isic_softc *)self; + struct pcmcia_isic_softc *psc = device_private(self); pcmcia_function_disable(psc->sc_pf); pcmcia_io_unmap(psc->sc_pf, psc->sc_io_window); @@ -273,7 +272,7 @@ isic_pcmcia_activate(device_t self, enum #define TERMFMT " " #else #define ISIC_FMT "%s: " -#define ISIC_PARM device_xname(&sc->sc_dev) +#define ISIC_PARM device_xname(sc->sc_dev) #define TERMFMT "\n" #endif Index: sys/dev/pcmcia/mhzc.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/pcmcia/mhzc.c,v retrieving revision 1.49 diff -u -p -r1.49 mhzc.c --- sys/dev/pcmcia/mhzc.c 19 Jan 2010 22:07:43 -0000 1.49 +++ sys/dev/pcmcia/mhzc.c 28 Sep 2012 20:10:15 -0000 @@ -666,7 +666,7 @@ int sm_mhzc_match(device_t, cfdata_t, vo void sm_mhzc_attach(device_t, device_t, void *); /* No mhzc-specific goo in the softc; it's all in the parent. */ -CFATTACH_DECL(sm_mhzc, sizeof(struct smc91cxx_softc), +CFATTACH_DECL_NEW(sm_mhzc, sizeof(struct smc91cxx_softc), sm_mhzc_match, sm_mhzc_attach, smc91cxx_detach, smc91cxx_activate); int sm_mhzc_enable(struct smc91cxx_softc *); @@ -694,6 +694,7 @@ sm_mhzc_attach(device_t parent, device_t aprint_normal("\n"); + sc->sc_dev = self; sc->sc_bst = msc->sc_ethernet_pcioh.iot; sc->sc_bsh = msc->sc_ethernet_pcioh.ioh; @@ -710,7 +711,7 @@ sm_mhzc_attach(device_t parent, device_t int sm_mhzc_enable(struct smc91cxx_softc *sc) { - struct mhzc_softc *xsc = device_private(device_parent(&sc->sc_dev)); + struct mhzc_softc *xsc = device_private(device_parent(sc->sc_dev)); return mhzc_enable(xsc, MHZC_ETHERNET_ENABLED); } @@ -718,7 +719,7 @@ sm_mhzc_enable(struct smc91cxx_softc *sc void sm_mhzc_disable(struct smc91cxx_softc *sc) { - struct mhzc_softc *xsc = device_private(device_parent(&sc->sc_dev)); + struct mhzc_softc *xsc = device_private(device_parent(sc->sc_dev)); mhzc_disable(xsc, MHZC_ETHERNET_ENABLED); } Index: sys/dev/pcmcia/pcmcom.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/pcmcia/pcmcom.c,v retrieving revision 1.39 diff -u -p -r1.39 pcmcom.c --- sys/dev/pcmcia/pcmcom.c 6 Dec 2009 23:05:39 -0000 1.39 +++ sys/dev/pcmcia/pcmcom.c 28 Sep 2012 20:11:05 -0000 @@ -94,7 +94,7 @@ void pcmcom_attach(device_t, device_t, v int pcmcom_detach(device_t, int); void pcmcom_childdet(device_t, device_t); -CFATTACH_DECL(pcmcom, sizeof(struct pcmcom_softc), +CFATTACH_DECL_NEW(pcmcom, sizeof(struct pcmcom_softc), pcmcom_match, pcmcom_attach, pcmcom_detach, NULL); const struct pcmcia_product pcmcom_products[] = { @@ -298,7 +298,7 @@ int com_pcmcom_match(device_t, cfdata_t void com_pcmcom_attach(device_t, device_t, void *); /* No pcmcom-specific goo in the softc; it's all in the parent. */ -CFATTACH_DECL(com_pcmcom, sizeof(struct com_softc), +CFATTACH_DECL_NEW(com_pcmcom, sizeof(struct com_softc), com_pcmcom_match, com_pcmcom_attach, com_detach, NULL); int com_pcmcom_enable(struct com_softc *); Index: sys/dev/podulebus/hcsc.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/podulebus/hcsc.c,v retrieving revision 1.20 diff -u -p -r1.20 hcsc.c --- sys/dev/podulebus/hcsc.c 18 Oct 2009 18:14:00 -0000 1.20 +++ sys/dev/podulebus/hcsc.c 9 Oct 2012 01:02:34 -0000 @@ -147,7 +147,7 @@ hcsc_attach(device_t parent, device_t se #ifndef NCR5380_USE_BUS_SPACE uint8_t *iobase; #endif - char hi_option[sizeof(self->dv_xname) + 8]; + char hi_option[sizeof(device_xname(self)) + 8]; ncr_sc->sc_dev = self; ncr_sc->sc_min_dma_len = 0; Index: sys/dev/podulebus/if_ea.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/podulebus/if_ea.c,v retrieving revision 1.16 diff -u -p -r1.16 if_ea.c --- sys/dev/podulebus/if_ea.c 12 May 2009 14:42:58 -0000 1.16 +++ sys/dev/podulebus/if_ea.c 28 Sep 2012 20:13:05 -0000 @@ -76,7 +76,7 @@ void eaattach(device_t, device_t, void * /* driver structure for autoconf */ -CFATTACH_DECL(ea, sizeof(struct ea_softc), +CFATTACH_DECL_NEW(ea, sizeof(struct ea_softc), eaprobe, eaattach, NULL, NULL); /* @@ -109,7 +109,9 @@ eaattach(device_t parent, device_t self, char *ptr; int i; -/* dprintf(("Attaching %s...\n", device_xname(&sc->sc_dev)));*/ + sc->sc_8005.sc_dev = self; + +/* dprintf(("Attaching %s...\n", device_xname(self)));*/ /* Set the address of the controller for easy access */ podulebus_shift_tag(pa->pa_mod_t, EA_8005_SHIFT, &sc->sc_8005.sc_iot); Index: sys/dev/podulebus/if_eb.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/podulebus/if_eb.c,v retrieving revision 1.14 diff -u -p -r1.14 if_eb.c --- sys/dev/podulebus/if_eb.c 12 May 2009 14:42:58 -0000 1.14 +++ sys/dev/podulebus/if_eb.c 28 Sep 2012 20:14:10 -0000 @@ -76,7 +76,7 @@ void ebattach(device_t, device_t, void * /* driver structure for autoconf */ -CFATTACH_DECL(eb, sizeof(struct eb_softc), +CFATTACH_DECL_NEW(eb, sizeof(struct eb_softc), ebprobe, ebattach, NULL, NULL); /* @@ -107,7 +107,9 @@ ebattach(device_t parent, device_t self, struct podulebus_attach_args *pa = aux; u_int8_t myaddr[ETHER_ADDR_LEN]; -/* dprintf(("Attaching %s...\n", device_xname(&sc->sc_dev)));*/ + sc->sc_8005.sc_dev = self; + +/* dprintf(("Attaching %s...\n", device_xname(self)));*/ /* Set the address of the controller for easy access */ podulebus_shift_tag(pa->pa_mod_t, EB_8004_SHIFT, &sc->sc_8005.sc_iot); Index: sys/dev/podulebus/oak.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/podulebus/oak.c,v retrieving revision 1.19 diff -u -p -r1.19 oak.c --- sys/dev/podulebus/oak.c 28 Apr 2008 20:23:56 -0000 1.19 +++ sys/dev/podulebus/oak.c 9 Oct 2012 01:02:34 -0000 @@ -142,7 +142,7 @@ oak_attach(device_t parent, device_t sel #ifndef NCR5380_USE_BUS_SPACE uint8_t *iobase; #endif - char hi_option[sizeof(self->dv_xname) + 8]; + char hi_option[sizeof(device_xname(self)) + 8]; ncr_sc->sc_dev = self; ncr_sc->sc_flags |= NCR5380_FORCE_POLLING; Index: sys/dev/ppbus/ppbus_conf.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/ppbus/ppbus_conf.c,v retrieving revision 1.19 diff -u -p -r1.19 ppbus_conf.c --- sys/dev/ppbus/ppbus_conf.c 13 May 2011 22:28:40 -0000 1.19 +++ sys/dev/ppbus/ppbus_conf.c 29 Sep 2012 12:54:51 -0000 @@ -235,19 +235,19 @@ ppbus_detach(device_t self, int flag) /* Search for children device and add to list */ static int -ppbus_search_children(device_t parent, cfdata_t cf, - const int *ldesc, void *aux) +ppbus_search_children(device_t parent, cfdata_t cf, const int *ldesc, void *aux) { struct ppbus_softc *ppbus = device_private(parent); struct ppbus_device_softc *child; + device_t dev; int rval = 0; if (config_match(parent, cf, aux) > 0) { - child = (struct ppbus_device_softc *) config_attach(parent, - cf, aux, NULL); - if (child) { - SLIST_INSERT_HEAD(&(ppbus->sc_childlist_head), child, - entries); + dev = config_attach(parent, cf, aux, NULL); + if (dev) { + child = device_private(dev); + SLIST_INSERT_HEAD(&(ppbus->sc_childlist_head), + child, entries); rval = 1; } } Index: sys/dev/qbus/dl.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/qbus/dl.c,v retrieving revision 1.46 diff -u -p -r1.46 dl.c --- sys/dev/qbus/dl.c 24 Apr 2011 16:27:00 -0000 1.46 +++ sys/dev/qbus/dl.c 28 Sep 2012 20:15:31 -0000 @@ -129,7 +129,7 @@ __KERNEL_RCSID(0, "$NetBSD: dl.c,v 1.46 #include "ioconf.h" struct dl_softc { - struct device sc_dev; + device_t sc_dev; struct evcnt sc_rintrcnt; struct evcnt sc_tintrcnt; bus_space_tag_t sc_iot; @@ -145,7 +145,7 @@ static void dlstart (struct tty *); static int dlparam (struct tty *, struct termios *); static void dlbrk (struct dl_softc *, int); -CFATTACH_DECL(dl, sizeof(struct dl_softc), +CFATTACH_DECL_NEW(dl, sizeof(struct dl_softc), dl_match, dl_attach, NULL, NULL); dev_type_open(dlopen); @@ -234,6 +234,7 @@ dl_attach (device_t parent, device_t sel struct dl_softc *sc = device_private(self); struct uba_attach_args *ua = aux; + sc->sc_dev = self; sc->sc_iot = ua->ua_iot; sc->sc_ioh = ua->ua_ioh; @@ -253,9 +254,9 @@ dl_attach (device_t parent, device_t sel uba_intr_establish(ua->ua_icookie, ua->ua_cvec - 4, dlrint, sc, &sc->sc_rintrcnt); evcnt_attach_dynamic(&sc->sc_rintrcnt, EVCNT_TYPE_INTR, ua->ua_evcnt, - device_xname(&sc->sc_dev), "rintr"); + device_xname(sc->sc_dev), "rintr"); evcnt_attach_dynamic(&sc->sc_tintrcnt, EVCNT_TYPE_INTR, ua->ua_evcnt, - device_xname(&sc->sc_dev), "tintr"); + device_xname(sc->sc_dev), "tintr"); printf("\n"); } @@ -286,7 +287,7 @@ dlrint(void *arg) * else where we can afford the time. */ log(LOG_WARNING, "%s: rx overrun\n", - device_xname(&sc->sc_dev)); + device_xname(sc->sc_dev)); } if (c & DL_RBUF_FRAMING_ERR) cc |= TTY_FE; @@ -297,7 +298,7 @@ dlrint(void *arg) #if defined(DIAGNOSTIC) } else { log(LOG_WARNING, "%s: stray rx interrupt\n", - device_xname(&sc->sc_dev)); + device_xname(sc->sc_dev)); #endif } } Index: sys/dev/qbus/if_dmc.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/qbus/if_dmc.c,v retrieving revision 1.20 diff -u -p -r1.20 if_dmc.c --- sys/dev/qbus/if_dmc.c 12 May 2009 14:43:33 -0000 1.20 +++ sys/dev/qbus/if_dmc.c 29 Sep 2012 12:56:05 -0000 @@ -134,7 +134,7 @@ struct dmcbufs { * efficiently. */ struct dmc_softc { - struct device sc_dev; /* Configuration common part */ + device_t sc_dev; /* Configuration common part */ struct ifnet sc_if; /* network-visible interface */ short sc_oused; /* output buffers currently in use */ short sc_iused; /* input buffers given to DMC */ @@ -183,7 +183,7 @@ static int dmcoutput(struct ifnet *, st struct rtentry *); static void dmcreset(device_t); -CFATTACH_DECL(dmc, sizeof(struct dmc_softc), +CFATTACH_DECL_NEW(dmc, sizeof(struct dmc_softc), dmcmatch, dmcattach, NULL, NULL); /* flags */ @@ -252,11 +252,12 @@ dmcattach(device_t parent, device_t self struct uba_attach_args *ua = aux; struct dmc_softc *sc = device_private(self); + sc->sc_dev = self; sc->sc_iot = ua->ua_iot; sc->sc_ioh = ua->ua_ioh; sc->sc_dmat = ua->ua_dmat; - strlcpy(sc->sc_if.if_xname, device_xname(&sc->sc_dev), IFNAMSIZ); + strlcpy(sc->sc_if.if_xname, device_xname(sc->sc_dev), IFNAMSIZ); sc->sc_if.if_mtu = DMCMTU; sc->sc_if.if_init = dmcinit; sc->sc_if.if_output = dmcoutput; @@ -270,11 +271,11 @@ dmcattach(device_t parent, device_t self &sc->sc_rintrcnt); uba_intr_establish(ua->ua_icookie, ua->ua_cvec+4, dmcxint, sc, &sc->sc_tintrcnt); - uba_reset_establish(dmcreset, &sc->sc_dev); + uba_reset_establish(dmcreset, sc->sc_dev); evcnt_attach_dynamic(&sc->sc_rintrcnt, EVCNT_TYPE_INTR, ua->ua_evcnt, - device_xname(&sc->sc_dev), "intr"); + device_xname(sc->sc_dev), "intr"); evcnt_attach_dynamic(&sc->sc_tintrcnt, EVCNT_TYPE_INTR, ua->ua_evcnt, - device_xname(&sc->sc_dev), "intr"); + device_xname(sc->sc_dev), "intr"); if_attach(&sc->sc_if); } @@ -286,7 +287,7 @@ dmcattach(device_t parent, device_t self void dmcreset(device_t dev) { - struct dmc_softc *sc = (struct dmc_softc *)dev; + struct dmc_softc *sc = device_private(dev); sc->sc_flag = 0; sc->sc_if.if_flags &= ~IFF_RUNNING; @@ -305,7 +306,7 @@ dmcinit(struct ifnet *ifp) struct dmcbufs *rp; struct dmc_command *qp; struct ifaddr *ifa; - cfdata_t ui = device_cfdata(&sc->sc_dev); + cfdata_t ui = device_cfdata(sc->sc_dev); int base; int s; @@ -328,17 +329,17 @@ dmcinit(struct ifnet *ifp) if ((sc->sc_flag & DMC_BMAPPED) == 0) { sc->sc_ui.ui_size = sizeof(struct dmc_base); sc->sc_ui.ui_vaddr = (void *)&sc->dmc_base; - uballoc((void *)device_parent(&sc->sc_dev), &sc->sc_ui, 0); + uballoc(device_private(device_parent(sc->sc_dev)), &sc->sc_ui, 0); sc->sc_flag |= DMC_BMAPPED; } /* initialize UNIBUS resources */ sc->sc_iused = sc->sc_oused = 0; if ((ifp->if_flags & IFF_RUNNING) == 0) { if (if_ubaminit(&sc->sc_ifuba, - (void *)device_parent(&sc->sc_dev), + device_private(device_parent(sc->sc_dev)), sizeof(struct dmc_header) + DMCMTU, sc->sc_ifr, NRCV, sc->sc_ifw, NXMT) == 0) { - aprint_error_dev(&sc->sc_dev, "can't allocate uba resources\n"); + aprint_error_dev(sc->sc_dev, "can't allocate uba resources\n"); ifp->if_flags &= ~IFF_UP; return 0; } @@ -502,7 +503,7 @@ dmcrint(void *arg) int n; if ((qp = sc->sc_qactive) == (struct dmc_command *) 0) { - printf("%s: dmcrint no command\n", device_xname(&sc->sc_dev)); + printf("%s: dmcrint no command\n", device_xname(sc->sc_dev)); return; } while (DMC_RBYTE(DMC_BSEL0) & DMC_RDYI) { @@ -589,14 +590,14 @@ dmcxint(void *a) if (rp >= &sc->sc_rbufs[NRCV]) panic("dmc rcv"); if ((rp->flags & DBUF_DMCS) == 0) - aprint_error_dev(&sc->sc_dev, "done unalloc rbuf\n"); + aprint_error_dev(sc->sc_dev, "done unalloc rbuf\n"); len = (arg & DMC_CCOUNT) - sizeof (struct dmc_header); if (len < 0 || len > DMCMTU) { ifp->if_ierrors++; #ifdef DMCDEBUG printd("%s: bad rcv pkt addr 0x%x len 0x%x\n", - device_xname(&sc->sc_dev), pkaddr, len); + device_xname(sc->sc_dev), pkaddr, len); #endif goto setup; } @@ -665,12 +666,12 @@ dmcxint(void *a) ifxp++; } if (rp >= &sc->sc_xbufs[NXMT]) { - aprint_error_dev(&sc->sc_dev, "bad packet address 0x%x\n", + aprint_error_dev(sc->sc_dev, "bad packet address 0x%x\n", pkaddr); break; } if ((rp->flags & DBUF_DMCS) == 0) - aprint_error_dev(&sc->sc_dev, "unallocated packet 0x%x\n", + aprint_error_dev(sc->sc_dev, "unallocated packet 0x%x\n", pkaddr); /* mark buffer free */ if_ubaend(&sc->sc_ifuba, ifxp); @@ -699,7 +700,7 @@ dmcxint(void *a) arg); log(LOG_ERR, "%s: fatal error, flags=%s\n", - device_xname(&sc->sc_dev), buf); + device_xname(sc->sc_dev), buf); } dmcrestart(sc); break; @@ -732,7 +733,7 @@ dmcxint(void *a) #ifdef DMCDEBUG snprintb(buf, sizeof(buf), CNTLO_BITS, arg); printd("%s: soft error, flags=%s\n", - device_xname(&sc->sc_dev), buf); + device_xname(sc->sc_dev), buf); #endif if ((sc->sc_flag & DMC_RESTART) == 0) { /* @@ -748,7 +749,7 @@ dmcxint(void *a) default: printf("%s: bad control %o\n", - device_xname(&sc->sc_dev), cmd); + device_xname(sc->sc_dev), cmd); break; } } @@ -881,7 +882,7 @@ dmcrestart(struct dmc_softc *sc) #ifdef DMCDEBUG /* dump base table */ - printf("%s base table:\n", device_xname(&sc->sc_dev)); + printf("%s base table:\n", device_xname(sc->sc_dev)); for (i = 0; i < sizeof (struct dmc_base); i++) printf("%o\n" ,dmc_base[unit].d_base[i]); #endif @@ -896,7 +897,7 @@ dmcrestart(struct dmc_softc *sc) ; /* Did the timer expire or did the DMR finish? */ if ((DMC_RBYTE(DMC_BSEL1) & DMC_RUN) == 0) { - log(LOG_ERR, "%s: M820 Test Failed\n", device_xname(&sc->sc_dev)); + log(LOG_ERR, "%s: M820 Test Failed\n", device_xname(sc->sc_dev)); return; } @@ -949,7 +950,7 @@ dmctimeout(struct ifnet *ifp) snprintb(buf2, sizeof(buf2), DMC2BITS, DMC_RBYTE(DMC_BSEL2) & 0xff); log(LOG_ERR, "%s: output timeout, bsel0=%s bsel2=%s\n", - device_xname(&sc->sc_dev), buf1, buf2); + device_xname(sc->sc_dev), buf1, buf2); dmcrestart(sc); } } Index: sys/dev/qbus/if_il.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/qbus/if_il.c,v retrieving revision 1.25 diff -u -p -r1.25 if_il.c --- sys/dev/qbus/if_il.c 2 Feb 2010 14:58:46 -0000 1.25 +++ sys/dev/qbus/if_il.c 28 Sep 2012 20:19:21 -0000 @@ -82,7 +82,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_il.c,v 1. */ struct il_softc { - struct device sc_dev; /* Configuration common part */ + device_t sc_dev; /* Configuration common part */ struct ethercom sc_ec; /* Ethernet common part */ #define sc_if sc_ec.ec_if /* network-visible interface */ struct evcnt sc_cintrcnt; /* Command interrupts */ @@ -123,7 +123,7 @@ static void ilwatch(struct ifnet *); static void iltotal(struct il_softc *); static void ilstop(struct ifnet *, int); -CFATTACH_DECL(il, sizeof(struct il_softc), +CFATTACH_DECL_NEW(il, sizeof(struct il_softc), ilmatch, ilattach, NULL, NULL); #define IL_WCSR(csr, val) \ @@ -160,6 +160,7 @@ ilattach(device_t parent, device_t self, struct ifnet *ifp = &sc->sc_if; int error; + sc->sc_dev = self; sc->sc_iot = ua->ua_iot; sc->sc_ioh = ua->ua_ioh; sc->sc_dmat = ua->ua_dmat; @@ -170,12 +171,12 @@ ilattach(device_t parent, device_t self, uba_intr_establish(ua->ua_icookie, ua->ua_cvec, ilcint, sc, &sc->sc_cintrcnt); evcnt_attach_dynamic(&sc->sc_cintrcnt, EVCNT_TYPE_INTR, ua->ua_evcnt, - device_xname(&sc->sc_dev), "intr"); + device_xname(sc->sc_dev), "intr"); uba_intr_establish(ua->ua_icookie, ua->ua_cvec-4, ilrint, sc, &sc->sc_rintrcnt); evcnt_attach_dynamic(&sc->sc_rintrcnt, EVCNT_TYPE_INTR, ua->ua_evcnt, - device_xname(&sc->sc_dev), "intr"); - uba_reset_establish(ilreset, &sc->sc_dev); + device_xname(sc->sc_dev), "intr"); + uba_reset_establish(ilreset, sc->sc_dev); /* * Reset the board and map the statistics @@ -185,20 +186,20 @@ ilattach(device_t parent, device_t self, (void)ilwait(sc, "reset"); sc->sc_ui.ui_size = sizeof(struct il_stats); sc->sc_ui.ui_vaddr = (void *)&sc->sc_stats; - if ((error = uballoc((struct uba_softc *)parent, &sc->sc_ui, 0))) + if ((error = uballoc(device_private(parent), &sc->sc_ui, 0))) return printf(": failed uballoc, error = %d\n", error); IL_WCSR(IL_BAR, LOWORD(sc->sc_ui.ui_baddr)); IL_WCSR(IL_BCR, sizeof(struct il_stats)); IL_WCSR(IL_CSR, ((sc->sc_ui.ui_baddr >> 2) & IL_EUA)|ILC_STAT); (void)ilwait(sc, "status"); - ubfree((struct uba_softc *)parent, &sc->sc_ui); - printf("%s: module=%s firmware=%s\n", device_xname(&sc->sc_dev), + ubfree(device_private(parent), &sc->sc_ui); + printf("%s: module=%s firmware=%s\n", device_xname(sc->sc_dev), sc->sc_stats.ils_module, sc->sc_stats.ils_firmware); - printf("%s: hardware address %s\n", device_xname(&sc->sc_dev), + printf("%s: hardware address %s\n", device_xname(sc->sc_dev), ether_sprintf(sc->sc_stats.ils_addr)); - 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_flags = IFF_BROADCAST; ifp->if_init = ilinit; @@ -231,7 +232,7 @@ ilwait(struct il_softc *sc, char *op) char bits[64]; snprintb(bits, sizeof(bits), IL_BITS, IL_RCSR(IL_CSR)); - aprint_error_dev(&sc->sc_dev, "%s failed, csr=%s\n", op, bits); + aprint_error_dev(sc->sc_dev, "%s failed, csr=%s\n", op, bits); return (-1); } return (0); @@ -246,7 +247,7 @@ ilreset(device_t dev) { struct il_softc *sc = (void *)dev; - printf(" %s", device_xname(&sc->sc_dev)); + printf(" %s", device_xname(sc->sc_dev)); sc->sc_if.if_flags &= ~IFF_RUNNING; sc->sc_flags &= ~ILF_RUNNING; ilinit(&sc->sc_if); @@ -267,15 +268,15 @@ ilinit(struct ifnet *ifp) if ((ifp->if_flags & IFF_RUNNING) == 0) { if (if_ubainit(&sc->sc_ifuba, - (void *)device_parent(&sc->sc_dev), + device_private(device_parent(sc->sc_dev)), ETHER_MAX_LEN)) { - aprint_error_dev(&sc->sc_dev, "can't initialize\n"); + aprint_error_dev(sc->sc_dev, "can't initialize\n"); sc->sc_if.if_flags &= ~IFF_UP; return 0; } sc->sc_ui.ui_size = sizeof(sc->sc_isu); sc->sc_ui.ui_vaddr = (void *)&sc->sc_isu; - uballoc((void *)device_parent(&sc->sc_dev), &sc->sc_ui, 0); + uballoc(device_private(device_parent(sc->sc_dev)), &sc->sc_ui, 0); } sc->sc_scaninterval = ILWATCHINTERVAL; ifp->if_timer = sc->sc_scaninterval; @@ -317,7 +318,7 @@ ilinit(struct ifnet *ifp) return 0; if (memcmp(sc->sc_stats.ils_addr, CLLADDR(ifp->if_sadl), ETHER_ADDR_LEN) != 0) { - aprint_error_dev(&sc->sc_dev, "setaddr didn't work\n"); + aprint_error_dev(sc->sc_dev, "setaddr didn't work\n"); return 0; } } @@ -444,7 +445,7 @@ ilcint(void *arg) char bits[64]; snprintb(bits, sizeof(bits), IL_BITS, IL_RCSR(IL_CSR)); - aprint_error_dev(&sc->sc_dev, + aprint_error_dev(sc->sc_dev, "stray xmit interrupt, csr=%s\n", bits); return; } @@ -591,7 +592,7 @@ iltotal(struct il_softc *sc) if ((sc->sc_flags & ILF_SETADDR) && (memcmp(sc->sc_stats.ils_addr, CLLADDR(ifp->if_sadl), ETHER_ADDR_LEN) != 0)) { - log(LOG_ERR, "%s: physaddr reverted\n", device_xname(&sc->sc_dev)); + log(LOG_ERR, "%s: physaddr reverted\n", device_xname(sc->sc_dev)); sc->sc_flags &= ~ILF_RUNNING; ilinit(&sc->sc_if); } Index: sys/dev/qbus/qd.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/qbus/qd.c,v retrieving revision 1.52 diff -u -p -r1.52 qd.c --- sys/dev/qbus/qd.c 24 Apr 2011 16:27:00 -0000 1.52 +++ sys/dev/qbus/qd.c 6 Oct 2012 00:47:41 -0000 @@ -114,7 +114,6 @@ struct qdflags { * Softc struct to keep track of all states in this driver. */ struct qd_softc { - struct device sc_dev; bus_space_tag_t sc_iot; bus_space_handle_t sc_ioh; bus_dma_tag_t sc_dmat; @@ -524,7 +523,7 @@ qdcninit(struct consdev *cndev) } /* qdcninit */ /* see */ -CFATTACH_DECL(qd, sizeof(struct qd_softc), +CFATTACH_DECL_NEW(qd, sizeof(struct qd_softc), qd_match, qd_attach, NULL, NULL); #define QD_RCSR(reg) \ @@ -549,7 +548,7 @@ qd_match(device_t parent, cfdata_t match struct qd_softc ssc; struct qd_softc *sc = &ssc; struct uba_attach_args *ua = aux; - struct uba_softc *uh = (void *)parent; + struct uba_softc *uh = device_private(parent); int unit; volatile struct dga *dga; /* pointer to gate array structure */ int vector; @@ -720,9 +719,8 @@ qd_match(device_t parent, cfdata_t match } /* qdprobe */ -void qd_attach(parent, self, aux) - device_t parent, *self; - void *aux; +void +qd_attach(device_t parent, device_t self, void *aux) { struct uba_attach_args *ua = aux; int unit; /* QDSS module # for this call */ Index: sys/dev/qbus/rf.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/qbus/rf.c,v retrieving revision 1.24 diff -u -p -r1.24 rf.c --- sys/dev/qbus/rf.c 22 Jan 2009 17:34:22 -0000 1.24 +++ sys/dev/qbus/rf.c 29 Sep 2012 11:33:58 -0000 @@ -410,13 +410,13 @@ rfc_attach(device_t parent, device_t sel */ if (rfcprobedens(rfc_sc, 0) >= 0) { rfc_aa.dnum = 0; - rfc_sc->sc_childs[0] = config_found(&rfc_sc->sc_dev, &rfc_aa, + rfc_sc->sc_childs[0] = config_found(rfc_sc->sc_dev, &rfc_aa, rf_print); } else rfc_sc->sc_childs[0] = NULL; if (rfcprobedens(rfc_sc, 1) >= 0) { rfc_aa.dnum = 1; - rfc_sc->sc_childs[1] = config_found(&rfc_sc->sc_dev, &rfc_aa, + rfc_sc->sc_childs[1] = config_found(rfc_sc->sc_dev, &rfc_aa, rf_print); } else rfc_sc->sc_childs[1] = NULL; @@ -1144,5 +1144,3 @@ rfioctl(dev_t dev, u_long cmd, void *dat return(ENOTTY); } - - Index: sys/dev/sbus/magma.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/sbus/magma.c,v retrieving revision 1.55 diff -u -p -r1.55 magma.c --- sys/dev/sbus/magma.c 24 Apr 2011 16:27:01 -0000 1.55 +++ sys/dev/sbus/magma.c 29 Sep 2012 13:57:11 -0000 @@ -169,13 +169,13 @@ static struct magma_board_info supported * Autoconfig Stuff */ -CFATTACH_DECL(magma, sizeof(struct magma_softc), +CFATTACH_DECL_NEW(magma, sizeof(struct magma_softc), magma_match, magma_attach, NULL, NULL); -CFATTACH_DECL(mtty, sizeof(struct mtty_softc), +CFATTACH_DECL_NEW(mtty, sizeof(struct mtty_softc), mtty_match, mtty_attach, NULL, NULL); -CFATTACH_DECL(mbpp, sizeof(struct mbpp_softc), +CFATTACH_DECL_NEW(mbpp, sizeof(struct mbpp_softc), mbpp_match, mbpp_attach, NULL, NULL); dev_type_open(mttyopen); @@ -339,6 +339,7 @@ magma_attach(device_t parent, device_t s int cd_clock; int node, chip; + sc->ms_dev = self; node = sa->sa_node; /* @@ -413,7 +414,7 @@ magma_attach(device_t parent, device_t s cd->cd_chiprev = cd1400_read_reg(cd, CD1400_GFRCR); dprintf(("%s attach CD1400 %d addr %p rev %x clock %dMHz\n", - device_xname(&sc->ms_dev), chip, + device_xname(sc->ms_dev), chip, cd->cd_reg, cd->cd_chiprev, cd->cd_clock)); /* clear GFRCR */ @@ -468,11 +469,11 @@ magma_attach(device_t parent, device_t s sc->ms_sicookie = softint_establish(SOFTINT_SERIAL, magma_soft, sc); if (sc->ms_sicookie == NULL) { aprint_normal("\n"); - aprint_error_dev(&sc->ms_dev, "cannot establish soft int handler\n"); + aprint_error_dev(sc->ms_dev, "cannot establish soft int handler\n"); return; } evcnt_attach_dynamic(&sc->ms_intrcnt, EVCNT_TYPE_INTR, NULL, - device_xname(&sc->ms_dev), "intr"); + device_xname(sc->ms_dev), "intr"); } /* @@ -743,7 +744,7 @@ magma_soft(void *arg) if( stat & CD1400_RDSR_OE ) log(LOG_WARNING, "%s%x: fifo overflow\n", - device_xname(&mtty->ms_dev), port); + device_xname(mtty->ms_dev), port); (*tp->t_linesw->l_rint)(data, tp); } @@ -754,14 +755,14 @@ magma_soft(void *arg) splx(s); /* ok */ if( ISSET(flags, MTTYF_CARRIER_CHANGED) ) { - dprintf(("%s%x: cd %s\n", device_xname(&mtty->ms_dev), + dprintf(("%s%x: cd %s\n", device_xname(mtty->ms_dev), port, mp->mp_carrier ? "on" : "off")); (*tp->t_linesw->l_modem)(tp, mp->mp_carrier); } if( ISSET(flags, MTTYF_RING_OVERFLOW) ) { log(LOG_WARNING, "%s%x: ring buffer overflow\n", - device_xname(&mtty->ms_dev), port); + device_xname(mtty->ms_dev), port); } if( ISSET(flags, MTTYF_DONE) ) { @@ -824,12 +825,13 @@ mtty_match(device_t parent, cfdata_t cf, } void -mtty_attach(device_t parent, device_t dev, void *args) +mtty_attach(device_t parent, device_t self, void *args) { struct magma_softc *sc = device_private(parent); - struct mtty_softc *ms = device_private(dev); + struct mtty_softc *ms = device_private(self); int port, chip, chan; + sc->ms_dev = self; sc->ms_mtty = ms; dprintf((" addr %p", ms)); Index: sys/dev/sbus/magmareg.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/sbus/magmareg.h,v retrieving revision 1.16 diff -u -p -r1.16 magmareg.h --- sys/dev/sbus/magmareg.h 17 Sep 2009 16:28:12 -0000 1.16 +++ sys/dev/sbus/magmareg.h 28 Sep 2012 20:24:08 -0000 @@ -97,7 +97,7 @@ struct cd1190 { /* software state for each card */ struct magma_softc { - struct device ms_dev; /* required. must be first in softc */ + device_t ms_dev; /* required. must be first in softc */ struct evcnt ms_intrcnt; /* statistics */ /* cd1400 chip info */ @@ -150,7 +150,7 @@ struct mtty_port { #define MTTYF_RING_OVERFLOW (1<<5) struct mtty_softc { - struct device ms_dev; /* device info */ + device_t ms_dev; /* device info */ int ms_nports; /* tty ports */ struct mtty_port ms_port[MAGMA_MAX_TTY]; }; @@ -182,7 +182,6 @@ struct mbpp_port { #define MBPPF_WAKEUP (1<<4) struct mbpp_softc { - struct device ms_dev; /* device info */ int ms_nports; /* parallel ports */ struct mbpp_port ms_port[MAGMA_MAX_BPP]; }; Index: sys/dev/sbus/p9100.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/sbus/p9100.c,v retrieving revision 1.58 diff -u -p -r1.58 p9100.c --- sys/dev/sbus/p9100.c 5 Oct 2012 01:19:03 -0000 1.58 +++ sys/dev/sbus/p9100.c 9 Oct 2012 01:02:34 -0000 @@ -336,7 +336,7 @@ p9100_sbus_attach(device_t parent, devic 0x8000, 0, &sc->sc_ctl_memh) != 0) { printf("%s: cannot map control registers\n", - self->dv_xname); + device_xname(self)); return; } @@ -357,7 +357,7 @@ p9100_sbus_attach(device_t parent, devic BUS_SPACE_MAP_LINEAR | BUS_SPACE_MAP_LARGE, &sc->sc_fb_memh) != 0) { printf("%s: cannot map framebuffer\n", - self->dv_xname); + device_xname(self)); return; } fb->fb_pixels = (char *)sc->sc_fb_memh; Index: sys/dev/sbus/stp4020.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/sbus/stp4020.c,v retrieving revision 1.66 diff -u -p -r1.66 stp4020.c --- sys/dev/sbus/stp4020.c 26 Jul 2011 22:22:41 -0000 1.66 +++ sys/dev/sbus/stp4020.c 2 Oct 2012 02:28:16 -0000 @@ -105,7 +105,7 @@ struct stp4020_socket { bus_space_tag_t tag; /* socket control io */ bus_space_handle_t regs; /* space */ bus_space_tag_t pcmciat; /* io space for pcmcia */ - struct device *pcmcia; /* Associated PCMCIA device */ + device_t pcmcia; /* Associated PCMCIA device */ int (*intrhandler) /* Card driver interrupt handler */ (void *); void *intrarg; /* Card interrupt handler argument */ Index: sys/dev/scsipi/ch.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/scsipi/ch.c,v retrieving revision 1.86 diff -u -p -r1.86 ch.c --- sys/dev/scsipi/ch.c 23 Nov 2009 02:13:47 -0000 1.86 +++ sys/dev/scsipi/ch.c 28 Sep 2012 20:26:12 -0000 @@ -59,7 +59,7 @@ __KERNEL_RCSID(0, "$NetBSD: ch.c,v 1.86 #define CHUNIT(x) (minor((x))) struct ch_softc { - struct device sc_dev; /* generic device info */ + device_t sc_dev; /* generic device info */ struct scsipi_periph *sc_periph;/* our periph data */ u_int sc_events; /* event bitmask */ @@ -101,7 +101,7 @@ struct ch_softc { static int chmatch(device_t, cfdata_t, void *); static void chattach(device_t, device_t, void *); -CFATTACH_DECL(ch, sizeof(struct ch_softc), +CFATTACH_DECL_NEW(ch, sizeof(struct ch_softc), chmatch, chattach, NULL, NULL); extern struct cfdriver ch_cd; @@ -192,11 +192,12 @@ chattach(device_t parent, device_t self, struct scsipibus_attach_args *sa = aux; struct scsipi_periph *periph = sa->sa_periph; + sc->sc_dev = self; selinit(&sc->sc_selq); /* Glue into the SCSI bus */ sc->sc_periph = periph; - periph->periph_dev = &sc->sc_dev; + periph->periph_dev = sc->sc_dev; periph->periph_switch = &ch_switch; printf("\n"); @@ -212,7 +213,7 @@ chattach(device_t parent, device_t self, */ if (sc->sc_settledelay) { printf("%s: waiting %d seconds for changer to settle...\n", - device_xname(&sc->sc_dev), sc->sc_settledelay); + device_xname(sc->sc_dev), sc->sc_settledelay); delay(1000000 * sc->sc_settledelay); } @@ -221,11 +222,11 @@ chattach(device_t parent, device_t self, * interrupts yet. */ if (ch_get_params(sc, XS_CTL_DISCOVERY|XS_CTL_IGNORE_MEDIA_CHANGE)) - printf("%s: offline\n", device_xname(&sc->sc_dev)); + printf("%s: offline\n", device_xname(sc->sc_dev)); else { #define PLURAL(c) (c) == 1 ? "" : "s" printf("%s: %d slot%s, %d drive%s, %d picker%s, %d portal%s\n", - device_xname(&sc->sc_dev), + device_xname(sc->sc_dev), sc->sc_counts[CHET_ST], PLURAL(sc->sc_counts[CHET_ST]), sc->sc_counts[CHET_DT], PLURAL(sc->sc_counts[CHET_DT]), sc->sc_counts[CHET_MT], PLURAL(sc->sc_counts[CHET_MT]), @@ -233,11 +234,11 @@ chattach(device_t parent, device_t self, #undef PLURAL #ifdef CHANGER_DEBUG printf("%s: move mask: 0x%x 0x%x 0x%x 0x%x\n", - device_xname(&sc->sc_dev), + device_xname(sc->sc_dev), sc->sc_movemask[CHET_MT], sc->sc_movemask[CHET_ST], sc->sc_movemask[CHET_IE], sc->sc_movemask[CHET_DT]); printf("%s: exchange mask: 0x%x 0x%x 0x%x 0x%x\n", - device_xname(&sc->sc_dev), + device_xname(sc->sc_dev), sc->sc_exchangemask[CHET_MT], sc->sc_exchangemask[CHET_ST], sc->sc_exchangemask[CHET_IE], sc->sc_exchangemask[CHET_DT]); #endif /* CHANGER_DEBUG */ @@ -513,7 +514,7 @@ ch_interpret_sense(struct scsipi_xfer *x { struct scsipi_periph *periph = xs->xs_periph; struct scsi_sense_data *sense = &xs->sense.scsi_sense; - struct ch_softc *sc = (void *)periph->periph_dev; + struct ch_softc *sc = device_private(periph->periph_dev); u_int16_t asc_ascq; /* @@ -770,7 +771,7 @@ ch_ousergetelemstatus(struct ch_softc *s if (avail != sc->sc_counts[chet]) printf("%s: warning, READ ELEMENT STATUS avail != count\n", - device_xname(&sc->sc_dev)); + device_xname(sc->sc_dev)); desc = (struct read_element_status_descriptor *)((u_long)data + sizeof(struct read_element_status_header) + @@ -1169,7 +1170,7 @@ ch_get_params(struct ch_softc *sc, int s &sense_data.header, sizeof(sense_data), scsiflags, CHRETRIES, 6000); if (error) { - aprint_error_dev(&sc->sc_dev, "could not sense element address page\n"); + aprint_error_dev(sc->sc_dev, "could not sense element address page\n"); return (error); } @@ -1195,7 +1196,7 @@ ch_get_params(struct ch_softc *sc, int s &sense_data.header, sizeof(sense_data), scsiflags, CHRETRIES, 6000); if (error) { - aprint_error_dev(&sc->sc_dev, "could not sense capabilities page\n"); + aprint_error_dev(sc->sc_dev, "could not sense capabilities page\n"); return (error); } Index: sys/dev/scsipi/if_se.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/scsipi/if_se.c,v retrieving revision 1.84 diff -u -p -r1.84 if_se.c --- sys/dev/scsipi/if_se.c 3 Feb 2012 23:39:59 -0000 1.84 +++ sys/dev/scsipi/if_se.c 28 Sep 2012 20:27:51 -0000 @@ -169,7 +169,7 @@ PROTOCMD_DECL_SPECIAL(ctron_ether_set_mo {CTRON_ETHER_SET_MODE, 0, {0,0}, 0}; struct se_softc { - struct device sc_dev; + device_t sc_dev; struct ethercom sc_ethercom; /* Ethernet common part */ struct scsipi_periph *sc_periph;/* contains our targ, lun, etc. */ @@ -227,7 +227,7 @@ static int se_set_mode(struct se_softc * int se_enable(struct se_softc *); void se_disable(struct se_softc *); -CFATTACH_DECL(se, sizeof(struct se_softc), +CFATTACH_DECL_NEW(se, sizeof(struct se_softc), sematch, seattach, NULL, NULL); extern struct cfdriver se_cd; @@ -299,6 +299,8 @@ seattach(device_t parent, device_t self, struct ifnet *ifp = &sc->sc_ethercom.ec_if; u_int8_t myaddr[ETHER_ADDR_LEN]; + sc->sc_dev = self; + printf("\n"); SC_DEBUG(periph, SCSIPI_DB2, ("seattach: ")); @@ -310,7 +312,7 @@ seattach(device_t parent, device_t self, * Store information needed to contact our base driver */ sc->sc_periph = periph; - periph->periph_dev = &sc->sc_dev; + periph->periph_dev = sc->sc_dev; periph->periph_switch = &se_switch; /* XXX increase openings? */ @@ -335,7 +337,7 @@ seattach(device_t parent, device_t self, se_get_addr(sc, myaddr); /* Initialize ifnet structure. */ - strlcpy(ifp->if_xname, device_xname(&sc->sc_dev), sizeof(ifp->if_xname)); + strlcpy(ifp->if_xname, device_xname(sc->sc_dev), sizeof(ifp->if_xname)); ifp->if_softc = sc; ifp->if_start = se_ifstart; ifp->if_ioctl = se_ioctl; @@ -368,7 +370,7 @@ se_scsipi_cmd(struct scsipi_periph *peri static void sestart(struct scsipi_periph *periph) { - struct se_softc *sc = (void *)periph->periph_dev; + struct se_softc *sc = device_private(periph->periph_dev); struct ifnet *ifp = &sc->sc_ethercom.ec_if; int s = splnet(); @@ -452,7 +454,7 @@ se_ifstart(struct ifnet *ifp) sc->sc_tbuf, len, SERETRIES, SETIMEOUT, NULL, XS_CTL_NOSLEEP|XS_CTL_ASYNC|XS_CTL_DATA_OUT); if (error) { - aprint_error_dev(&sc->sc_dev, "not queued, error %d\n", error); + aprint_error_dev(sc->sc_dev, "not queued, error %d\n", error); ifp->if_oerrors++; ifp->if_flags &= ~IFF_OACTIVE; } else @@ -470,7 +472,7 @@ se_ifstart(struct ifnet *ifp) static void sedone(struct scsipi_xfer *xs, int error) { - struct se_softc *sc = (void *)xs->xs_periph->periph_dev; + struct se_softc *sc = device_private(xs->xs_periph->periph_dev); struct scsipi_generic *cmd = xs->cmd; struct ifnet *ifp = &sc->sc_ethercom.ec_if; int s; @@ -632,7 +634,7 @@ se_read(struct se_softc *sc, char *data, len > MAX_SNAP) { #ifdef SEDEBUG printf("%s: invalid packet size %d; dropping\n", - device_xname(&sc->sc_dev), len); + device_xname(sc->sc_dev), len); #endif ifp->if_ierrors++; goto next_packet; @@ -676,7 +678,7 @@ sewatchdog(struct ifnet *ifp) { struct se_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; se_reset(sc); @@ -734,7 +736,7 @@ se_get_addr(struct se_softc *sc, u_int8_ (void *)&get_addr_cmd, sizeof(get_addr_cmd), myaddr, ETHER_ADDR_LEN, SERETRIES, SETIMEOUT, NULL, XS_CTL_DATA_IN); - printf("%s: ethernet address %s\n", device_xname(&sc->sc_dev), + printf("%s: ethernet address %s\n", device_xname(sc->sc_dev), ether_sprintf(myaddr)); return (error); } @@ -831,7 +833,7 @@ se_set_multi(struct se_softc *sc, u_int8 int error; if (sc->sc_debug) - printf("%s: set_set_multi: %s\n", device_xname(&sc->sc_dev), + printf("%s: set_set_multi: %s\n", device_xname(sc->sc_dev), ether_sprintf(addr)); PROTOCMD(ctron_ether_set_multi, set_multi_cmd); @@ -852,7 +854,7 @@ se_remove_multi(struct se_softc *sc, u_i int error; if (sc->sc_debug) - printf("%s: se_remove_multi: %s\n", device_xname(&sc->sc_dev), + printf("%s: se_remove_multi: %s\n", device_xname(sc->sc_dev), ether_sprintf(addr)); PROTOCMD(ctron_ether_remove_multi, remove_multi_cmd); @@ -1046,7 +1048,7 @@ se_enable(struct se_softc *sc) (error = scsipi_adapter_addref(adapt)) == 0) sc->sc_enabled = 1; else - aprint_error_dev(&sc->sc_dev, "device enable failed\n"); + aprint_error_dev(sc->sc_dev, "device enable failed\n"); return (error); } Index: sys/dev/scsipi/ses.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/scsipi/ses.c,v retrieving revision 1.43 diff -u -p -r1.43 ses.c --- sys/dev/scsipi/ses.c 17 Jul 2011 20:54:51 -0000 1.43 +++ sys/dev/scsipi/ses.c 28 Sep 2012 20:29:55 -0000 @@ -150,7 +150,7 @@ static void ses_log(struct ses_softc *, */ struct ses_softc { - struct device sc_device; + device_t sc_dev; struct scsipi_periph *sc_periph; enctyp ses_type; /* type of enclosure */ encvec ses_vec; /* vector to handlers */ @@ -170,7 +170,7 @@ static int ses_match(device_t, cfdata_t, static void ses_attach(device_t, device_t, void *); static enctyp ses_device_type(struct scsipibus_attach_args *); -CFATTACH_DECL(ses, sizeof (struct ses_softc), +CFATTACH_DECL_NEW(ses, sizeof (struct ses_softc), ses_match, ses_attach, NULL, NULL); extern struct cfdriver ses_cd; @@ -183,8 +183,7 @@ static const struct scsipi_periphsw ses_ }; static int -ses_match(device_t parent, cfdata_t match, - void *aux) +ses_match(device_t parent, cfdata_t match, void *aux) { struct scsipibus_attach_args *sa = aux; @@ -219,9 +218,10 @@ ses_attach(device_t parent, device_t sel struct scsipibus_attach_args *sa = aux; struct scsipi_periph *periph = sa->sa_periph; + softc->sc_dev = self; SC_DEBUG(periph, SCSIPI_DB2, ("ssattach: ")); softc->sc_periph = periph; - periph->periph_dev = &softc->sc_device; + periph->periph_dev = self; periph->periph_switch = &ses_switch; periph->periph_openings = 1; @@ -273,7 +273,7 @@ ses_attach(device_t parent, device_t sel tname = "SAF-TE Compliant Device"; break; } - printf("\n%s: %s\n", device_xname(&softc->sc_device), tname); + printf("\n%s: %s\n", device_xname(softc->sc_dev), tname); } @@ -524,7 +524,7 @@ ses_log(struct ses_softc *ssc, const cha { va_list ap; - printf("%s: ", device_xname(&ssc->sc_device)); + printf("%s: ", device_xname(ssc->sc_dev)); va_start(ap, fmt); vprintf(fmt, ap); va_end(ap); Index: sys/dev/sdmmc/sbt.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/sdmmc/sbt.c,v retrieving revision 1.2 diff -u -p -r1.2 sbt.c --- sys/dev/sdmmc/sbt.c 6 May 2009 08:20:49 -0000 1.2 +++ sys/dev/sdmmc/sbt.c 26 Sep 2012 22:19:47 -0000 @@ -208,7 +208,7 @@ sbt_attach(device_t parent, device_t sel static int sbt_detach(device_t self, int flags) { - struct sbt_softc *sc = (struct sbt_softc *)self; + struct sbt_softc *sc = device_private(self); sc->sc_dying = 1; Index: sys/dev/tc/ascvar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/tc/ascvar.h,v retrieving revision 1.11 diff -u -p -r1.11 ascvar.h --- sys/dev/tc/ascvar.h 4 Mar 2007 06:02:46 -0000 1.11 +++ sys/dev/tc/ascvar.h 1 Oct 2012 14:58:15 -0000 @@ -41,8 +41,6 @@ typedef struct scsi_state { */ struct asc_softc { - struct device sc_dev; /* us as a device */ - bus_space_tag_t sc_bst; bus_space_handle_t sc_bsh; bus_space_handle_t sc_scsi_bsh; @@ -93,3 +91,7 @@ int asc_intr(void *asc); */ #define ASCDMA_READ 1 #define ASCDMA_WRITE 2 + + +xxx this file is not used! + Index: sys/dev/tc/if_fta.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/tc/if_fta.c,v retrieving revision 1.27 diff -u -p -r1.27 if_fta.c --- sys/dev/tc/if_fta.c 12 May 2009 14:47:04 -0000 1.27 +++ sys/dev/tc/if_fta.c 28 Sep 2012 20:31:01 -0000 @@ -64,12 +64,9 @@ __KERNEL_RCSID(0, "$NetBSD: if_fta.c,v 1 #include static int -pdq_tc_match( - device_t parent, - cfdata_t match, - void *aux) +pdq_tc_match(device_t parent, cfdata_t match, void *aux) { - struct tc_attach_args *ta = (struct tc_attach_args *) aux; + struct tc_attach_args *ta = aux; if (strncmp("PMAF-F", ta->ta_modname, 6) == 0) return 1; @@ -78,28 +75,26 @@ pdq_tc_match( } static void -pdq_tc_attach( - device_t const parent, - device_t const self, - void *const aux) +pdq_tc_attach(device_t parent, device_t self, void *aux) { pdq_softc_t * const sc = device_private(self); - struct tc_attach_args * const ta = (struct tc_attach_args *) aux; + struct tc_attach_args * const ta = aux; /* * NOTE: sc_bc is an alias for sc_csrtag and sc_membase is an * alias for sc_csrhandle. sc_iobase is not used in this front-end. */ + sc->sc_dev = self; sc->sc_dmatag = ta->ta_dmat; sc->sc_csrtag = ta->ta_memt; - memcpy(sc->sc_if.if_xname, device_xname(&sc->sc_dev), IFNAMSIZ); + memcpy(sc->sc_if.if_xname, device_xname(sc->sc_dev), IFNAMSIZ); sc->sc_if.if_flags = 0; sc->sc_if.if_softc = sc; if (bus_space_map(sc->sc_csrtag, ta->ta_addr + PDQ_TC_CSR_OFFSET, PDQ_TC_CSR_SPACE, 0, &sc->sc_membase)) { aprint_normal("\n"); - aprint_error_dev(&sc->sc_dev, "can't map card memory!\n"); + aprint_error_dev(sc->sc_dev, "can't map card memory!\n"); return; } @@ -107,7 +102,7 @@ pdq_tc_attach( sc->sc_if.if_xname, 0, (void *) sc, PDQ_DEFTA); if (sc->sc_pdq == NULL) { - aprint_error_dev(&sc->sc_dev, "initialization failed\n"); + aprint_error_dev(sc->sc_dev, "initialization failed\n"); return; } @@ -121,5 +116,5 @@ pdq_tc_attach( aprint_error_dev(self, "warning: couldn't establish shutdown hook\n"); } -CFATTACH_DECL(fta, sizeof(pdq_softc_t), +CFATTACH_DECL_NEW(fta, sizeof(pdq_softc_t), pdq_tc_match, pdq_tc_attach, NULL, NULL); Index: sys/dev/tc/px.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/tc/px.c,v retrieving revision 1.38 diff -u -p -r1.38 px.c --- sys/dev/tc/px.c 6 Nov 2010 10:58:12 -0000 1.38 +++ sys/dev/tc/px.c 29 Sep 2012 12:57:58 -0000 @@ -131,7 +131,7 @@ px_attach(device_t parent, device_t self u_long v; px = device_private(self); - ta = (struct tc_attach_args *)aux; + ta = aux; px->px_dev = self; @@ -239,7 +239,7 @@ px_intr(void *cookie) int state; si = cookie; - px = (struct px_softc *)si->si_dv; + px = device_private(si->si_dv); sr = si->si_stic; state = sr->sr_ipdvint; sxc = si->si_sxc; Index: sys/dev/tc/sticvar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/tc/sticvar.h,v retrieving revision 1.18 diff -u -p -r1.18 sticvar.h --- sys/dev/tc/sticvar.h 9 Jul 2008 13:19:33 -0000 1.18 +++ sys/dev/tc/sticvar.h 29 Sep 2012 12:57:19 -0000 @@ -72,7 +72,7 @@ struct stic_screen { #define SS_CURENB 0x04 struct stic_info { - struct device *si_dv; + device_t si_dv; u_int32_t *si_stamp; u_int32_t *si_buf; Index: sys/dev/usb/if_otus.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/usb/if_otus.c,v retrieving revision 1.12 diff -u -p -r1.12 if_otus.c --- sys/dev/usb/if_otus.c 20 Aug 2012 07:32:49 -0000 1.12 +++ sys/dev/usb/if_otus.c 2 Oct 2012 02:28:41 -0000 @@ -82,7 +82,7 @@ int otus_debug = 0; Static int otus_match(device_t, cfdata_t, void *); Static void otus_attach(device_t, device_t, void *); -Static int otus_detach(struct device *, int); +Static int otus_detach(device_t, int); Static int otus_activate(device_t, devact_t); Static void otus_attachhook(device_t); Static void otus_get_chanlist(struct otus_softc *); Index: sys/dev/usb/uark.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/usb/uark.c,v retrieving revision 1.5 diff -u -p -r1.5 uark.c --- sys/dev/usb/uark.c 23 Dec 2011 00:51:44 -0000 1.5 +++ sys/dev/usb/uark.c 2 Oct 2012 02:29:32 -0000 @@ -60,15 +60,15 @@ int uarkebug = 0; #define UARK_REQUEST 0xfe struct uark_softc { - struct device *sc_dev; - usbd_device_handle sc_udev; - usbd_interface_handle sc_iface; - struct device *sc_subdev; + device_t sc_dev; + usbd_device_handle sc_udev; + usbd_interface_handle sc_iface; + device_t sc_subdev; - u_char sc_msr; - u_char sc_lsr; + u_char sc_msr; + u_char sc_lsr; - u_char sc_dying; + u_char sc_dying; }; void uark_get_status(void *, int portno, u_char *lsr, u_char *msr); @@ -193,7 +193,7 @@ uark_attach(device_t parent, device_t se } int -uark_detach(struct device *self, int flags) +uark_detach(device_t self, int flags) { struct uark_softc *sc = device_private(self); int rv = 0; @@ -211,7 +211,7 @@ uark_detach(struct device *self, int fla } int -uark_activate(struct device* self, enum devact act) +uark_activate(device_t self, enum devact act) { struct uark_softc *sc = device_private(self); int rv = 0; Index: sys/dev/vme/vme.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/vme/vme.c,v retrieving revision 1.25 diff -u -p -r1.25 vme.c --- sys/dev/vme/vme.c 27 Jan 2012 18:53:09 -0000 1.25 +++ sys/dev/vme/vme.c 2 Oct 2012 02:35:13 -0000 @@ -41,25 +41,19 @@ __KERNEL_RCSID(0, "$NetBSD: vme.c,v 1.25 #include #include -static void vme_extractlocators(int*, struct vme_attach_args*); -static int vmeprint(struct vme_attach_args*, char*); -static int vmesubmatch1(struct device*, struct cfdata*, - const int *, void*); -static int vmesubmatch(struct device*, struct cfdata*, - const int *, void*); +static void vme_extractlocators(int*, struct vme_attach_args *); +static int vmeprint(struct vme_attach_args *, char *); +static int vmesubmatch1(device_t, cfdata_t, const int *, void *); +static int vmesubmatch(device_t, cfdata_t, const int *, void *); int vmematch(device_t, cfdata_t, void *); -void vmeattach(struct device*, struct device*,void*); +void vmeattach(device_t, device_t, void *); static struct extent *vme_select_map(struct vmebus_softc*, vme_am_t); -#ifdef notyet -int vmedetach(struct device*); -#endif - #define VME_SLAVE_DUMMYDRV "vme_slv" #define VME_NUMCFRANGES 3 /* cf. "files.vme" */ -CFATTACH_DECL(vme, sizeof(struct vmebus_softc), +CFATTACH_DECL_NEW(vme, sizeof(struct vmebus_softc), vmematch, vmeattach, NULL, NULL); const struct cfattach vme_slv_ca = { @@ -169,10 +163,9 @@ vmematch(device_t parent, cfdata_t match void vmeattach(device_t parent, device_t self, void *aux) { - struct vmebus_softc *sc = (struct vmebus_softc *)self; + struct vmebus_softc *sc = device_private(self); - struct vmebus_attach_args *aa = - (struct vmebus_attach_args*)aux; + struct vmebus_attach_args *aa = aux; sc->sc_vct = aa->va_vct; sc->sc_bdt = aa->va_bdt; @@ -226,7 +219,7 @@ vmeattach(device_t parent, device_t self int vmedetach(device_t dev) { - struct vmebus_softc *sc = (struct vmebus_softc*)dev; + struct vmebus_softc *sc = device_private(dev); if (sc->slaveconfig) { /* allow bus master to free its bus ressources */ Index: sys/dev/vme/vmevar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/vme/vmevar.h,v retrieving revision 1.13 diff -u -p -r1.13 vmevar.h --- sys/dev/vme/vmevar.h 12 May 2009 14:47:27 -0000 1.13 +++ sys/dev/vme/vmevar.h 28 Sep 2012 20:32:18 -0000 @@ -167,8 +167,6 @@ struct vmebus_attach_args { struct extent; struct vmebus_softc { - struct device sc_dev; - vme_chipset_tag_t sc_vct; bus_dma_tag_t sc_bdt; Index: sys/dev/vme/xd.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/vme/xd.c,v retrieving revision 1.88 diff -u -p -r1.88 xd.c --- sys/dev/vme/xd.c 12 Feb 2012 16:34:12 -0000 1.88 +++ sys/dev/vme/xd.c 29 Sep 2012 13:00:04 -0000 @@ -274,10 +274,10 @@ void xdc_md_setup(void) * cfattach's: device driver interface to autoconfig */ -CFATTACH_DECL(xdc, sizeof(struct xdc_softc), +CFATTACH_DECL_NEW(xdc, sizeof(struct xdc_softc), xdcmatch, xdcattach, NULL, NULL); -CFATTACH_DECL(xd, sizeof(struct xd_softc), +CFATTACH_DECL_NEW(xd, sizeof(struct xd_softc), xdmatch, xdattach, NULL, NULL); extern struct cfdriver xd_cd; @@ -342,11 +342,11 @@ xdgetdisklabel(struct xd_softc *xd, void /* Required parameter for readdisklabel() */ xd->sc_dk.dk_label->d_secsize = XDFM_BPS; - err = readdisklabel(MAKEDISKDEV(0, device_unit(&xd->sc_dev), RAW_PART), + err = readdisklabel(MAKEDISKDEV(0, device_unit(xd->sc_dev), RAW_PART), xddummystrat, xd->sc_dk.dk_label, xd->sc_dk.dk_cpulabel); if (err) { - aprint_error_dev(&xd->sc_dev, "%s\n", err); + aprint_error_dev(xd->sc_dev, "%s\n", err); return(XD_ERR_FAIL); } @@ -359,11 +359,11 @@ xdgetdisklabel(struct xd_softc *xd, void #endif { printf("%s: WARNING: no `pcyl' in disk label.\n", - device_xname(&xd->sc_dev)); + device_xname(xd->sc_dev)); xd->pcyl = xd->sc_dk.dk_label->d_ncylinders + xd->sc_dk.dk_label->d_acylinders; printf("%s: WARNING: guessing pcyl=%d (ncyl+acyl)\n", - device_xname(&xd->sc_dev), xd->pcyl); + device_xname(xd->sc_dev), xd->pcyl); } xd->ncyl = xd->sc_dk.dk_label->d_ncylinders; @@ -484,6 +484,7 @@ xdcattach(device_t parent, device_t self vme_mapresc_t resc; bus_addr_t busaddr; + xdc->sc_dev = self; xdc_md_setup(); /* get addressing and intr level stuff from autoconfig and load it @@ -504,7 +505,7 @@ xdcattach(device_t parent, device_t self xdc->vector = va->ivector; for (lcv = 0; lcv < XDC_MAXDEV; lcv++) - xdc->sc_drives[lcv] = (struct xd_softc *) 0; + xdc->sc_drives[lcv] = NULL; /* * allocate and zero buffers @@ -527,7 +528,7 @@ xdcattach(device_t parent, device_t self BUS_DMA_NOWAIT, &xdc->auxmap)) != 0) { - aprint_error_dev(&xdc->sc_dev, "DMA buffer map create error %d\n", + aprint_error_dev(xdc->sc_dev, "DMA buffer map create error %d\n", error); return; } @@ -546,7 +547,7 @@ xdcattach(device_t parent, device_t self BUS_DMA_NOWAIT, &xdc->iopmap)) != 0) { - aprint_error_dev(&xdc->sc_dev, "DMA buffer map create error %d\n", + aprint_error_dev(xdc->sc_dev, "DMA buffer map create error %d\n", error); return; } @@ -556,7 +557,7 @@ xdcattach(device_t parent, device_t self XDC_MAXIOPB * sizeof(struct xd_iopb), (void **)&xdc->iopbase, &busaddr)) != 0) { - aprint_error_dev(&xdc->sc_dev, "DMA buffer alloc error %d\n", + aprint_error_dev(xdc->sc_dev, "DMA buffer alloc error %d\n", error); return; } @@ -593,7 +594,7 @@ xdcattach(device_t parent, device_t self BUS_DMA_NOWAIT, &xdc->reqs[lcv].dmamap)) != 0) { - aprint_error_dev(&xdc->sc_dev, "DMA buffer map create error %d\n", + aprint_error_dev(xdc->sc_dev, "DMA buffer map create error %d\n", error); return; } @@ -638,7 +639,7 @@ xdcattach(device_t parent, device_t self rqno = xdc_cmd(xdc, XDCMD_WRP, XDFUN_CTL, 0, 0, 0, 0, XD_SUB_POLL); XDC_DONE(xdc, rqno, error); if (error) { - aprint_error_dev(&xdc->sc_dev, "controller config error: %s\n", + aprint_error_dev(xdc->sc_dev, "controller config error: %s\n", xdc_e2str(error)); return; } @@ -647,7 +648,7 @@ xdcattach(device_t parent, device_t self vme_intr_map(ct, va->ilevel, va->ivector, &ih); vme_intr_establish(ct, ih, IPL_BIO, xdcintr, xdc); evcnt_attach_dynamic(&xdc->sc_intrcnt, EVCNT_TYPE_INTR, NULL, - device_xname(&xdc->sc_dev), "intr"); + device_xname(xdc->sc_dev), "intr"); /* now we must look for disks using autoconfig */ @@ -703,6 +704,8 @@ xdattach(device_t parent, device_t self, void * dmaddr; char * buf; + xd->sc_dev = self; + /* * Always re-initialize the disk structure. We want statistics * to start with a clean slate. @@ -732,7 +735,7 @@ xdattach(device_t parent, device_t self, } } printf("%s at %s", - device_xname(&xd->sc_dev), device_xname(&xd->parent->sc_dev)); + device_xname(xd->sc_dev), device_xname(xd->parent->sc_dev)); } /* we now have control */ @@ -744,7 +747,7 @@ xdattach(device_t parent, device_t self, XDFM_BPS, (void **)&buf, &busaddr)) != 0) { - aprint_error_dev(&xdc->sc_dev, "DMA buffer alloc error %d\n", + aprint_error_dev(xdc->sc_dev, "DMA buffer alloc error %d\n", error); return; } @@ -769,7 +772,7 @@ xdattach(device_t parent, device_t self, rqno = xdc_cmd(xdc, XDCMD_WRP, XDFUN_FMT, xd->xd_drive, 0, 0, 0, fmode); XDC_DONE(xdc, rqno, error); if (error) { - aprint_error_dev(&xd->sc_dev, "write format parameters failed: %s\n", + aprint_error_dev(xd->sc_dev, "write format parameters failed: %s\n", xdc_e2str(error)); goto done; } @@ -782,7 +785,7 @@ xdattach(device_t parent, device_t self, } XDC_DONE(xdc, rqno, error); if (error) { - aprint_error_dev(&xd->sc_dev, "read drive parameters failed: %s\n", + aprint_error_dev(xd->sc_dev, "read drive parameters failed: %s\n", xdc_e2str(error)); goto done; } @@ -801,7 +804,7 @@ xdattach(device_t parent, device_t self, rqno = xdc_cmd(xdc, XDCMD_WRP, XDFUN_DRV, xd->xd_drive, 0, 0, 0, fmode); XDC_DONE(xdc, rqno, error); if (error) { - aprint_error_dev(&xd->sc_dev, "write drive parameters failed: %s\n", + aprint_error_dev(xd->sc_dev, "write drive parameters failed: %s\n", xdc_e2str(error)); goto done; } @@ -810,7 +813,7 @@ xdattach(device_t parent, device_t self, rqno = xdc_cmd(xdc, XDCMD_RD, 0, xd->xd_drive, 0, 1, dmaddr, fmode); XDC_DONE(xdc, rqno, error); if (error) { - aprint_error_dev(&xd->sc_dev, "reading disk label failed: %s\n", + aprint_error_dev(xd->sc_dev, "reading disk label failed: %s\n", xdc_e2str(error)); goto done; } @@ -818,18 +821,18 @@ xdattach(device_t parent, device_t self, xd->hw_spt = spt; /* Attach the disk: must be before getdisklabel to malloc label */ - disk_init(&xd->sc_dk, device_xname(&xd->sc_dev), &xddkdriver); + disk_init(&xd->sc_dk, device_xname(xd->sc_dev), &xddkdriver); disk_attach(&xd->sc_dk); if (xdgetdisklabel(xd, buf) != XD_ERR_AOK) goto done; /* inform the user of what is up */ - printf("%s: <%s>, pcyl %d, hw_spt %d\n", device_xname(&xd->sc_dev), + printf("%s: <%s>, pcyl %d, hw_spt %d\n", device_xname(xd->sc_dev), buf, xd->pcyl, spt); mb = xd->ncyl * (xd->nhead * xd->nsect) / (1048576 / XDFM_BPS); printf("%s: %dMB, %d cyl, %d head, %d sec, %d bytes/sec\n", - device_xname(&xd->sc_dev), mb, xd->ncyl, xd->nhead, xd->nsect, + device_xname(xd->sc_dev), mb, xd->ncyl, xd->nhead, xd->nsect, XDFM_BPS); /* now set the real drive parameters! */ @@ -837,7 +840,7 @@ xdattach(device_t parent, device_t self, rqno = xdc_cmd(xdc, XDCMD_WRP, XDFUN_DRV, xd->xd_drive, 0, 0, 0, fmode); XDC_DONE(xdc, rqno, error); if (error) { - aprint_error_dev(&xd->sc_dev, "write real drive parameters failed: %s\n", + aprint_error_dev(xd->sc_dev, "write real drive parameters failed: %s\n", xdc_e2str(error)); goto done; } @@ -853,7 +856,7 @@ xdattach(device_t parent, device_t self, rqno = xdc_cmd(xdc, XDCMD_RD, 0, xd->xd_drive, blk, 1, dmaddr, fmode); XDC_DONE(xdc, rqno, error); if (error) { - aprint_error_dev(&xd->sc_dev, "reading bad144 failed: %s\n", + aprint_error_dev(xd->sc_dev, "reading bad144 failed: %s\n", xdc_e2str(error)); goto done; } @@ -873,7 +876,7 @@ xdattach(device_t parent, device_t self, break; } if (lcv != 126) { - aprint_error_dev(&xd->sc_dev, "warning: invalid bad144 sector!\n"); + aprint_error_dev(xd->sc_dev, "warning: invalid bad144 sector!\n"); } else { memcpy(&xd->dkb, buf, XDFM_BPS); } @@ -939,7 +942,7 @@ xddump(dev_t dev, daddr_t blkno, void *v if (!xd) return ENXIO; - printf("%s%c: crash dump not supported (yet)\n", device_xname(&xd->sc_dev), + printf("%s%c: crash dump not supported (yet)\n", device_xname(xd->sc_dev), 'a' + part); return ENXIO; @@ -1144,7 +1147,7 @@ xdopen(dev_t dev, int flag, int fmt, str xa.driveno = xd->xd_drive; xa.fullmode = XD_SUB_WAIT; xa.booting = 0; - xdattach((device_t) xd->parent, (device_t) xd, &xa); + xdattach(xd->parent->sc_dev, xd->sc_dev, &xa); if (xd->state == XD_DRIVE_UNKNOWN) { return (EIO); } @@ -1245,7 +1248,7 @@ xdstrategy(struct buf *bp) xa.driveno = xd->xd_drive; xa.fullmode = XD_SUB_WAIT; xa.booting = 0; - xdattach((device_t)xd->parent, (device_t)xd, &xa); + xdattach(xd->parent->sc_dev, xd->sc_dev, &xa); if (xd->state == XD_DRIVE_UNKNOWN) { bp->b_error = EIO; goto done; @@ -1566,7 +1569,7 @@ xdc_startbuf(struct xdc_softc *xdcsc, st } partno = DISKPART(bp->b_dev); #ifdef XDC_DEBUG - printf("xdc_startbuf: %s%c: %s block %d\n", device_xname(&xdsc->sc_dev), + printf("xdc_startbuf: %s%c: %s block %d\n", device_xname(xdsc->sc_dev), 'a' + partno, (bp->b_flags & B_READ) ? "read" : "write", bp->b_blkno); printf("xdc_startbuf: b_bcount %d, b_data 0x%x\n", bp->b_bcount, bp->b_data); @@ -1586,7 +1589,7 @@ xdc_startbuf(struct xdc_softc *xdcsc, st error = bus_dmamap_load(xdcsc->dmatag, iorq->dmamap, bp->b_data, bp->b_bcount, 0, BUS_DMA_NOWAIT); if (error != 0) { - aprint_error_dev(&xdcsc->sc_dev, "warning: cannot load DMA map\n"); + aprint_error_dev(xdcsc->sc_dev, "warning: cannot load DMA map\n"); XDC_FREE(xdcsc, rqno); bufq_put(xdcsc->sc_wq, bp); return (XD_ERR_FAIL); /* XXX: need some sort of @@ -1653,7 +1656,7 @@ xdc_submit_iorq(struct xdc_softc *xdcsc, struct xd_iorq *iorq = &xdcsc->reqs[iorqno]; #ifdef XDC_DEBUG - printf("xdc_submit_iorq(%s, no=%d, type=%d)\n", device_xname(&xdcsc->sc_dev), + printf("xdc_submit_iorq(%s, no=%d, type=%d)\n", device_xname(xdcsc->sc_dev), iorqno, type); #endif @@ -1684,7 +1687,7 @@ xdc_submit_iorq(struct xdc_softc *xdcsc, u_char *rio = (u_char *) iorq->iopb; int sz = sizeof(struct xd_iopb), lcv; printf("%s: aio #%d [", - device_xname(&xdcsc->sc_dev), iorq - xdcsc->reqs); + device_xname(xdcsc->sc_dev), iorq - xdcsc->reqs); for (lcv = 0; lcv < sz; lcv++) printf(" %02x", rio[lcv]); printf("]\n"); @@ -1731,7 +1734,7 @@ xdc_piodriver(struct xdc_softc *xdcsc, i u_long count; struct xdc *xdc = xdcsc->xdc; #ifdef XDC_DEBUG - printf("xdc_piodriver(%s, %d, freeone=%d)\n", device_xname(&xdcsc->sc_dev), + printf("xdc_piodriver(%s, %d, freeone=%d)\n", device_xname(xdcsc->sc_dev), iorqno, freeone); #endif @@ -1811,7 +1814,7 @@ xdc_xdreset(struct xdc_softc *xdcsc, str XDC_GO(xdcsc->xdc, addr); /* go! */ XDC_WAIT(xdcsc->xdc, del, XDC_RESETUSEC, XDC_REMIOPB); if (del <= 0 || xdcsc->iopbase->errs) { - printf("%s: off-line: %s\n", device_xname(&xdcsc->sc_dev), + printf("%s: off-line: %s\n", device_xname(xdcsc->sc_dev), xdc_e2str(xdcsc->iopbase->errnum)); xdcsc->xdc->xdc_csr = XDC_RESET; XDC_WAIT(xdcsc->xdc, del, XDC_RESETUSEC, XDC_RESET); @@ -1839,7 +1842,7 @@ xdc_reset(struct xdc_softc *xdcsc, int q /* soft reset hardware */ if (!quiet) - printf("%s: soft reset\n", device_xname(&xdcsc->sc_dev)); + printf("%s: soft reset\n", device_xname(xdcsc->sc_dev)); xdcsc->xdc->xdc_csr = XDC_RESET; XDC_WAIT(xdcsc->xdc, del, XDC_RESETUSEC, XDC_RESET); if (del <= 0) { @@ -1916,11 +1919,11 @@ xdc_reset(struct xdc_softc *xdcsc, int q del = xdcsc->nwait + xdcsc->nrun + xdcsc->nfree + xdcsc->ndone; if (del != XDC_MAXIOPB) printf("%s: diag: xdc_reset miscount (%d should be %d)!\n", - device_xname(&xdcsc->sc_dev), del, XDC_MAXIOPB); + device_xname(xdcsc->sc_dev), del, XDC_MAXIOPB); else if (xdcsc->ndone > XDC_MAXIOPB - XDC_SUBWAITLIM) printf("%s: diag: lots of done jobs (%d)\n", - device_xname(&xdcsc->sc_dev), xdcsc->ndone); + device_xname(xdcsc->sc_dev), xdcsc->ndone); #endif printf("RESET DONE\n"); return (retval); @@ -1963,10 +1966,10 @@ xdc_remove_iorq(struct xdc_softc *xdcsc) * we dump them all. */ errnum = xdc->xdc_f_err; - aprint_error_dev(&xdcsc->sc_dev, "fatal error 0x%02x: %s\n", + aprint_error_dev(xdcsc->sc_dev, "fatal error 0x%02x: %s\n", errnum, xdc_e2str(errnum)); if (xdc_reset(xdcsc, 0, XD_RSET_ALL, errnum, 0) != XD_ERR_AOK) { - aprint_error_dev(&xdcsc->sc_dev, "soft reset failed!\n"); + aprint_error_dev(xdcsc->sc_dev, "soft reset failed!\n"); panic("xdc_remove_iorq: controller DEAD"); } return (XD_ERR_AOK); @@ -2001,7 +2004,7 @@ xdc_remove_iorq(struct xdc_softc *xdcsc) { u_char *rio = (u_char *) iopb; int sz = sizeof(struct xd_iopb), lcv; - printf("%s: rio #%d [", device_xname(&xdcsc->sc_dev), rqno); + printf("%s: rio #%d [", device_xname(xdcsc->sc_dev), rqno); for (lcv = 0; lcv < sz; lcv++) printf(" %02x", rio[lcv]); printf("]\n"); @@ -2121,8 +2124,8 @@ xdc_perror(struct xd_iorq *iorq, struct int error = iorq->lasterror; - printf("%s", (iorq->xd) ? device_xname(&iorq->xd->sc_dev) - : device_xname(&iorq->xdc->sc_dev)); + printf("%s", (iorq->xd) ? device_xname(iorq->xd->sc_dev) + : device_xname(iorq->xdc->sc_dev)); if (iorq->buf) printf("%c: ", 'a' + (char)DISKPART(iorq->buf->b_dev)); if (iopb->comm == XDCMD_RD || iopb->comm == XDCMD_WR) @@ -2237,7 +2240,7 @@ xdc_tick(void *arg) splx(s); if (nwait + nrun + nfree + ndone != XDC_MAXIOPB) { printf("%s: diag: IOPB miscount (got w/f/r/d %d/%d/%d/%d, wanted %d)\n", - device_xname(&xdcsc->sc_dev), nwait, nfree, nrun, ndone, + device_xname(xdcsc->sc_dev), nwait, nfree, nrun, ndone, XDC_MAXIOPB); memset(mark, 0, sizeof(mark)); printf("FREE: "); @@ -2266,12 +2269,12 @@ xdc_tick(void *arg) } else if (ndone > XDC_MAXIOPB - XDC_SUBWAITLIM) printf("%s: diag: lots of done jobs (%d)\n", - device_xname(&xdcsc->sc_dev), ndone); + device_xname(xdcsc->sc_dev), ndone); #endif #ifdef XDC_DEBUG printf("%s: tick: csr 0x%x, w/f/r/d %d/%d/%d/%d\n", - device_xname(&xdcsc->sc_dev), + device_xname(xdcsc->sc_dev), xdcsc->xdc->xdc_csr, xdcsc->nwait, xdcsc->nfree, xdcsc->nrun, xdcsc->ndone); for (lcv = 0; lcv < XDC_MAXIOPB; lcv++) { @@ -2294,7 +2297,7 @@ xdc_tick(void *arg) reset = 1; } if (reset) { - printf("%s: watchdog timeout\n", device_xname(&xdcsc->sc_dev)); + printf("%s: watchdog timeout\n", device_xname(xdcsc->sc_dev)); xdc_reset(xdcsc, 0, XD_RSET_NONE, XD_ERR_FAIL, NULL); } splx(s); Index: sys/dev/vme/xdvar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/vme/xdvar.h,v retrieving revision 1.12 diff -u -p -r1.12 xdvar.h --- sys/dev/vme/xdvar.h 1 Feb 2011 19:36:24 -0000 1.12 +++ sys/dev/vme/xdvar.h 29 Sep 2012 12:21:24 -0000 @@ -97,7 +97,7 @@ struct xd_iorq { */ struct xd_softc { - struct device sc_dev; /* device struct, reqd by autoconf */ + device_t sc_dev; /* device struct, reqd by autoconf */ struct disk sc_dk; /* generic disk info */ struct xdc_softc *parent; /* parent */ u_short flags; /* flags */ @@ -131,7 +131,7 @@ struct xd_softc { */ struct xdc_softc { - struct device sc_dev; /* device struct, reqd by autoconf */ + device_t sc_dev; /* device struct, reqd by autoconf */ struct evcnt sc_intrcnt; /* event counter (for vmstat -i) */ struct callout sc_tick_ch; Index: sys/dev/vme/xy.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/vme/xy.c,v retrieving revision 1.92 diff -u -p -r1.92 xy.c --- sys/dev/vme/xy.c 12 Feb 2012 16:34:12 -0000 1.92 +++ sys/dev/vme/xy.c 29 Sep 2012 13:00:12 -0000 @@ -190,10 +190,10 @@ int xygetdisklabel(struct xy_softc *, vo * cfattach's: device driver interface to autoconfig */ -CFATTACH_DECL(xyc, sizeof(struct xyc_softc), +CFATTACH_DECL_NEW(xyc, sizeof(struct xyc_softc), xycmatch, xycattach, NULL, NULL); -CFATTACH_DECL(xy, sizeof(struct xy_softc), +CFATTACH_DECL_NEW(xy, sizeof(struct xy_softc), xymatch, xyattach, NULL, NULL); extern struct cfdriver xy_cd; @@ -258,11 +258,11 @@ xygetdisklabel(struct xy_softc *xy, void /* Required parameter for readdisklabel() */ xy->sc_dk.dk_label->d_secsize = XYFM_BPS; - err = readdisklabel(MAKEDISKDEV(0, device_unit(&xy->sc_dev), RAW_PART), + err = readdisklabel(MAKEDISKDEV(0, device_unit(xy->sc_dev), RAW_PART), xydummystrat, xy->sc_dk.dk_label, xy->sc_dk.dk_cpulabel); if (err) { - printf("%s: %s\n", device_xname(&xy->sc_dev), err); + printf("%s: %s\n", device_xname(xy->sc_dev), err); return(XY_ERR_FAIL); } @@ -275,11 +275,11 @@ xygetdisklabel(struct xy_softc *xy, void #endif { printf("%s: WARNING: no `pcyl' in disk label.\n", - device_xname(&xy->sc_dev)); + device_xname(xy->sc_dev)); xy->pcyl = xy->sc_dk.dk_label->d_ncylinders + xy->sc_dk.dk_label->d_acylinders; printf("%s: WARNING: guessing pcyl=%d (ncyl+acyl)\n", - device_xname(&xy->sc_dev), xy->pcyl); + device_xname(xy->sc_dev), xy->pcyl); } xy->ncyl = xy->sc_dk.dk_label->d_ncylinders; @@ -394,6 +394,8 @@ xycattach(device_t parent, device_t self vme_mapresc_t resc; bus_addr_t busaddr; + xyc->sc_dev = self; + /* get addressing and intr level stuff from autoconfig and load it * into our xyc_softc. */ @@ -412,7 +414,7 @@ xycattach(device_t parent, device_t self xyc->no_ols = 0; /* XXX should be from config */ for (lcv = 0; lcv < XYC_MAXDEV; lcv++) - xyc->sc_drives[lcv] = (struct xy_softc *) 0; + xyc->sc_drives[lcv] = NULL; /* * allocate and zero buffers @@ -433,7 +435,7 @@ xycattach(device_t parent, device_t self BUS_DMA_NOWAIT, &xyc->auxmap)) != 0) { - aprint_error_dev(&xyc->sc_dev, "DMA buffer map create error %d\n", + aprint_error_dev(xyc->sc_dev, "DMA buffer map create error %d\n", error); return; } @@ -451,7 +453,7 @@ xycattach(device_t parent, device_t self BUS_DMA_NOWAIT, &xyc->iopmap)) != 0) { - aprint_error_dev(&xyc->sc_dev, "DMA buffer map create error %d\n", + aprint_error_dev(xyc->sc_dev, "DMA buffer map create error %d\n", error); return; } @@ -461,7 +463,7 @@ xycattach(device_t parent, device_t self XYC_MAXIOPB * sizeof(struct xy_iopb), (void **)&xyc->iopbase, &busaddr)) != 0) { - aprint_error_dev(&xyc->sc_dev, "DMA buffer alloc error %d\n", + aprint_error_dev(xyc->sc_dev, "DMA buffer alloc error %d\n", error); return; } @@ -503,7 +505,7 @@ xycattach(device_t parent, device_t self BUS_DMA_NOWAIT, &xyc->reqs[lcv].dmamap)) != 0) { - aprint_error_dev(&xyc->sc_dev, "DMA buffer map create error %d\n", + aprint_error_dev(xyc->sc_dev, "DMA buffer map create error %d\n", error); return; } @@ -528,13 +530,13 @@ xycattach(device_t parent, device_t self printf(" [OLS disabled]"); /* 450 doesn't overlap seek right */ printf("\n"); if (error) { - aprint_error_dev(&xyc->sc_dev, "error: %s\n", + aprint_error_dev(xyc->sc_dev, "error: %s\n", xyc_e2str(error)); return; } if ((xyc->xyc->xyc_csr & XYC_ADRM) == 0) { printf("%s: 24 bit addressing turned off\n", - device_xname(&xyc->sc_dev)); + device_xname(xyc->sc_dev)); printf("please set hardware jumpers JM1-JM2=in, JM3-JM4=out\n"); printf("to enable 24 bit mode and this driver\n"); return; @@ -544,7 +546,7 @@ xycattach(device_t parent, device_t self vme_intr_map(ct, va->ilevel, va->ivector, &ih); vme_intr_establish(ct, ih, IPL_BIO, xycintr, xyc); evcnt_attach_dynamic(&xyc->sc_intrcnt, EVCNT_TYPE_INTR, NULL, - device_xname(&xyc->sc_dev), "intr"); + device_xname(xyc->sc_dev), "intr"); callout_init(&xyc->sc_tick_ch, 0); @@ -600,6 +602,8 @@ xyattach(device_t parent, device_t self, void * dmaddr; char * buf; + xy->sc_dev = self; + /* * Always re-initialize the disk structure. We want statistics * to start with a clean slate. @@ -636,7 +640,7 @@ xyattach(device_t parent, device_t self, } } printf("%s at %s", - device_xname(&xy->sc_dev), device_xname(&xy->parent->sc_dev)); + device_xname(xy->sc_dev), device_xname(xy->parent->sc_dev)); } /* we now have control */ @@ -648,7 +652,7 @@ xyattach(device_t parent, device_t self, XYFM_BPS, (void **)&buf, &busaddr)) != 0) { - aprint_error_dev(&xyc->sc_dev, "DMA buffer alloc error %d\n", + aprint_error_dev(xyc->sc_dev, "DMA buffer alloc error %d\n", error); return; } @@ -691,7 +695,7 @@ xyattach(device_t parent, device_t self, if (error != XY_ERR_AOK) { aprint_normal("\n"); - aprint_error_dev(&xy->sc_dev, "reading disk label failed: %s\n", + aprint_error_dev(xy->sc_dev, "reading disk label failed: %s\n", xyc_e2str(error)); goto done; } @@ -701,18 +705,18 @@ xyattach(device_t parent, device_t self, xy->hw_spt = spt = 0; /* XXX needed ? */ /* Attach the disk: must be before getdisklabel to malloc label */ - disk_init(&xy->sc_dk, device_xname(&xy->sc_dev), &xydkdriver); + disk_init(&xy->sc_dk, device_xname(xy->sc_dev), &xydkdriver); disk_attach(&xy->sc_dk); if (xygetdisklabel(xy, buf) != XY_ERR_AOK) goto done; /* inform the user of what is up */ - printf("%s: <%s>, pcyl %d\n", device_xname(&xy->sc_dev), + printf("%s: <%s>, pcyl %d\n", device_xname(xy->sc_dev), buf, xy->pcyl); mb = xy->ncyl * (xy->nhead * xy->nsect) / (1048576 / XYFM_BPS); printf("%s: %dMB, %d cyl, %d head, %d sec, %d bytes/sec\n", - device_xname(&xy->sc_dev), mb, xy->ncyl, xy->nhead, xy->nsect, + device_xname(xy->sc_dev), mb, xy->ncyl, xy->nhead, xy->nsect, XYFM_BPS); /* @@ -733,8 +737,8 @@ xyattach(device_t parent, device_t self, if (xy->nsect != oxy->nsect || xy->pcyl != oxy->pcyl || xy->nhead != oxy->nhead) { printf("%s: %s and %s must be the same size!\n", - device_xname(&xyc->sc_dev), device_xname(&xy->sc_dev), - device_xname(&oxy->sc_dev)); + device_xname(xyc->sc_dev), device_xname(xy->sc_dev), + device_xname(oxy->sc_dev)); panic("xy drive size mismatch"); } } @@ -748,7 +752,7 @@ xyattach(device_t parent, device_t self, error = xyc_cmd(xyc, XYCMD_SDS, 0, xy->xy_drive, blk, 0, 0, fmode); XYC_DONE(xyc, error); if (error) { - aprint_error_dev(&xy->sc_dev, "write drive size failed: %s\n", + aprint_error_dev(xy->sc_dev, "write drive size failed: %s\n", xyc_e2str(error)); goto done; } @@ -766,7 +770,7 @@ xyattach(device_t parent, device_t self, dmaddr, fmode); XYC_DONE(xyc, error); if (error) { - aprint_error_dev(&xy->sc_dev, "reading bad144 failed: %s\n", + aprint_error_dev(xy->sc_dev, "reading bad144 failed: %s\n", xyc_e2str(error)); goto done; } @@ -786,7 +790,7 @@ xyattach(device_t parent, device_t self, break; } if (lcv != 126) { - aprint_error_dev(&xy->sc_dev, "warning: invalid bad144 sector!\n"); + aprint_error_dev(xy->sc_dev, "warning: invalid bad144 sector!\n"); } else { memcpy(&xy->dkb, buf, XYFM_BPS); } @@ -852,7 +856,7 @@ xydump(dev_t dev, daddr_t blkno, void *v if (!xy) return ENXIO; - printf("%s%c: crash dump not supported (yet)\n", device_xname(&xy->sc_dev), + printf("%s%c: crash dump not supported (yet)\n", device_xname(xy->sc_dev), 'a' + part); return ENXIO; @@ -1062,8 +1066,7 @@ xyopen(dev_t dev, int flag, int fmt, str xa.driveno = xy->xy_drive; xa.fullmode = XY_SUB_WAIT; xa.booting = 0; - xyattach((device_t) xy->parent, - (device_t) xy, &xa); + xyattach(xy->parent->sc_dev, xy->sc_dev, &xa); if (xy->state == XY_DRIVE_UNKNOWN) { return (EIO); } @@ -1166,7 +1169,7 @@ xystrategy(struct buf *bp) xa.driveno = xy->xy_drive; xa.fullmode = XY_SUB_WAIT; xa.booting = 0; - xyattach((device_t)xy->parent, (device_t)xy, &xa); + xyattach(xy->parent->sc_dev, xy->sc_dev, &xa); if (xy->state == XY_DRIVE_UNKNOWN) { bp->b_error = EIO; goto done; @@ -1366,7 +1369,7 @@ start: if (XY_STATE(iorq->mode) != XY_SUB_FREE) { DELAY(1000000); /* XY_SUB_POLL: steal the iorq */ iorq->mode = XY_SUB_FREE; - printf("%s: stole control iopb\n", device_xname(&xycsc->sc_dev)); + printf("%s: stole control iopb\n", device_xname(xycsc->sc_dev)); } /* init iorq/iopb */ @@ -1409,7 +1412,7 @@ xyc_startbuf(struct xyc_softc *xycsc, st partno = DISKPART(bp->b_dev); #ifdef XYC_DEBUG - printf("xyc_startbuf: %s%c: %s block %d\n", device_xname(&xysc->sc_dev), + printf("xyc_startbuf: %s%c: %s block %d\n", device_xname(xysc->sc_dev), 'a' + partno, (bp->b_flags & B_READ) ? "read" : "write", bp->b_blkno); printf("xyc_startbuf: b_bcount %d, b_data 0x%x\n", bp->b_bcount, bp->b_data); @@ -1427,7 +1430,7 @@ xyc_startbuf(struct xyc_softc *xycsc, st error = bus_dmamap_load(xycsc->dmatag, iorq->dmamap, bp->b_data, bp->b_bcount, 0, BUS_DMA_NOWAIT); if (error != 0) { - aprint_error_dev(&xycsc->sc_dev, "warning: cannot load DMA map\n"); + aprint_error_dev(xycsc->sc_dev, "warning: cannot load DMA map\n"); return (XY_ERR_FAIL); /* XXX: need some sort of * call-back scheme here? */ } @@ -1493,7 +1496,7 @@ xyc_submit_iorq(struct xyc_softc *xycsc, #ifdef XYC_DEBUG printf("xyc_submit_iorq(%s, addr=0x%x, type=%d)\n", - device_xname(&xycsc->sc_dev), iorq, type); + device_xname(xycsc->sc_dev), iorq, type); #endif /* first check and see if controller is busy */ @@ -1516,7 +1519,7 @@ xyc_submit_iorq(struct xyc_softc *xycsc, if (xyc_unbusy(xycsc->xyc,XYC_RESETUSEC) == XY_ERR_FAIL) panic("xyc_submit_iorq: stuck xyc"); printf("%s: stole controller\n", - device_xname(&xycsc->sc_dev)); + device_xname(xycsc->sc_dev)); break; default: panic("xyc_submit_iorq adding"); @@ -1636,7 +1639,7 @@ xyc_piodriver(struct xyc_softc *xycsc, s int retval = 0; u_long res; #ifdef XYC_DEBUG - printf("xyc_piodriver(%s, 0x%x)\n", device_xname(&xycsc->sc_dev), iorq); + printf("xyc_piodriver(%s, 0x%x)\n", device_xname(xycsc->sc_dev), iorq); #endif while (iorq->iopb->done == 0) { @@ -1715,7 +1718,7 @@ xyc_xyreset(struct xyc_softc *xycsc, str } if (del <= 0 || iopb->errs) { - printf("%s: off-line: %s\n", device_xname(&xycsc->sc_dev), + printf("%s: off-line: %s\n", device_xname(xycsc->sc_dev), xyc_e2str(iopb->errnum)); del = xycsc->xyc->xyc_rsetup; if (xyc_unbusy(xycsc->xyc, XYC_RESETUSEC) == XY_ERR_FAIL) @@ -1742,7 +1745,7 @@ xyc_reset(struct xyc_softc *xycsc, int q /* soft reset hardware */ if (!quiet) - printf("%s: soft reset\n", device_xname(&xycsc->sc_dev)); + printf("%s: soft reset\n", device_xname(xycsc->sc_dev)); del = xycsc->xyc->xyc_rsetup; del = xyc_unbusy(xycsc->xyc, XYC_RESETUSEC); if (del == XY_ERR_FAIL) { @@ -1854,9 +1857,9 @@ xyc_remove_iorq(struct xyc_softc *xycsc) * we dump them all. */ errnum = XY_ERR_DERR; - aprint_error_dev(&xycsc->sc_dev, "DOUBLE ERROR!\n"); + aprint_error_dev(xycsc->sc_dev, "DOUBLE ERROR!\n"); if (xyc_reset(xycsc, 0, XY_RSET_ALL, errnum, 0) != XY_ERR_AOK) { - aprint_error_dev(&xycsc->sc_dev, "soft reset failed!\n"); + aprint_error_dev(xycsc->sc_dev, "soft reset failed!\n"); panic("xyc_remove_iorq: controller DEAD"); } return (XY_ERR_AOK); @@ -1993,8 +1996,8 @@ xyc_perror(struct xy_iorq *iorq, struct int error = iorq->lasterror; - printf("%s", (iorq->xy) ? device_xname(&iorq->xy->sc_dev) - : device_xname(&iorq->xyc->sc_dev)); + printf("%s", (iorq->xy) ? device_xname(iorq->xy->sc_dev) + : device_xname(iorq->xyc->sc_dev)); if (iorq->buf) printf("%c: ", 'a' + (char)DISKPART(iorq->buf->b_dev)); if (iopb->com == XYCMD_RD || iopb->com == XYCMD_WR) @@ -2102,7 +2105,7 @@ xyc_tick(void *arg) reset = 1; } if (reset) { - printf("%s: watchdog timeout\n", device_xname(&xycsc->sc_dev)); + printf("%s: watchdog timeout\n", device_xname(xycsc->sc_dev)); xyc_reset(xycsc, 0, XY_RSET_NONE, XY_ERR_FAIL, NULL); } splx(s); Index: sys/dev/vme/xyvar.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/dev/vme/xyvar.h,v retrieving revision 1.13 diff -u -p -r1.13 xyvar.h --- sys/dev/vme/xyvar.h 1 Feb 2011 19:36:24 -0000 1.13 +++ sys/dev/vme/xyvar.h 28 Sep 2012 20:36:53 -0000 @@ -92,7 +92,7 @@ struct xy_iorq { * a "xy_softc" structure contains per-disk state info. */ struct xy_softc { - struct device sc_dev; /* device struct, reqd by autoconf */ + device_t sc_dev; /* device struct, reqd by autoconf */ struct disk sc_dk; /* generic disk info */ struct xyc_softc *parent;/* parent */ u_short flags; /* flags */ @@ -131,7 +131,7 @@ struct xy_softc { */ struct xyc_softc { - struct device sc_dev; /* device struct, reqd by autoconf */ + device_t sc_dev; /* device struct, reqd by autoconf */ struct evcnt sc_intrcnt; /* event counter (for vmstat -i) */ struct callout sc_tick_ch; Index: sys/kern/init_sysctl.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/kern/init_sysctl.c,v retrieving revision 1.191 diff -u -p -r1.191 init_sysctl.c --- sys/kern/init_sysctl.c 3 Oct 2012 07:22:59 -0000 1.191 +++ sys/kern/init_sysctl.c 9 Oct 2012 02:22:36 -0000 @@ -1880,7 +1880,7 @@ sysctl_root_device(SYSCTLFN_ARGS) struct sysctlnode node; node = *rnode; - node.sysctl_data = root_device->dv_xname; + node.sysctl_data = __UNCONST(device_xname(root_device)); node.sysctl_size = strlen(device_xname(root_device)) + 1; return (sysctl_lookup(SYSCTLFN_CALL(&node))); } Index: sys/kern/kern_drvctl.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/kern/kern_drvctl.c,v retrieving revision 1.32 diff -u -p -r1.32 kern_drvctl.c --- sys/kern/kern_drvctl.c 31 Aug 2011 18:31:02 -0000 1.32 +++ sys/kern/kern_drvctl.c 2 Oct 2012 02:30:44 -0000 @@ -173,7 +173,7 @@ drvctlopen(dev_t dev, int flags, int mod static int pmdevbyname(u_long cmd, struct devpmargs *a) { - struct device *d; + device_t d; if ((d = device_find_by_xname(a->devname)) == NULL) return ENXIO; @@ -229,7 +229,7 @@ listdevbyname(struct devlistargs *l) static int detachdevbyname(const char *devname) { - struct device *d; + device_t d; if ((d = device_find_by_xname(devname)) == NULL) return ENXIO; @@ -252,7 +252,7 @@ rescanbus(const char *busname, const cha int numlocators, const int *locators) { int i, rc; - struct device *d; + device_t d; const struct cfiattrdata * const *ap; /* XXX there should be a way to get limits and defaults (per device) Index: sys/kern/kern_hook.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/kern/kern_hook.c,v retrieving revision 1.4 diff -u -p -r1.4 kern_hook.c --- sys/kern/kern_hook.c 11 Dec 2010 22:27:53 -0000 1.4 +++ sys/kern/kern_hook.c 2 Oct 2012 02:30:52 -0000 @@ -184,7 +184,7 @@ mountroothook_destroy(void) } void -domountroothook(struct device *therootdev) +domountroothook(device_t therootdev) { struct hook_desc *hd; Index: sys/kern/subr_autoconf.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/kern/subr_autoconf.c,v retrieving revision 1.223 diff -u -p -r1.223 subr_autoconf.c --- sys/kern/subr_autoconf.c 30 Aug 2012 02:24:20 -0000 1.223 +++ sys/kern/subr_autoconf.c 2 Oct 2012 02:31:20 -0000 @@ -146,7 +146,7 @@ static struct cftable initcftable; struct matchinfo { cfsubmatch_t fn; - struct device *parent; + device_t parent; const int *locs; void *aux; struct cfdata *match; @@ -856,7 +856,7 @@ config_cfdata_attach(cfdata_t cf, int sc * found through any attachment in the config data table. */ static int -dev_in_cfdata(const struct device *d, const struct cfdata *cf) +dev_in_cfdata(device_t d, cfdata_t cf) { const struct cfdata *cf1; Index: sys/kern/subr_disk_open.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/kern/subr_disk_open.c,v retrieving revision 1.10 diff -u -p -r1.10 subr_disk_open.c --- sys/kern/subr_disk_open.c 7 Jul 2012 16:15:20 -0000 1.10 +++ sys/kern/subr_disk_open.c 2 Oct 2012 02:31:40 -0000 @@ -40,7 +40,7 @@ __KERNEL_RCSID(0, "$NetBSD: subr_disk_op #include struct vnode * -opendisk(struct device *dv) +opendisk(device_t dv) { devmajor_t bmajor; int unit; Index: sys/kern/subr_tftproot.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/kern/subr_tftproot.c,v retrieving revision 1.10 diff -u -p -r1.10 subr_tftproot.c --- sys/kern/subr_tftproot.c 23 Aug 2009 12:10:50 -0000 1.10 +++ sys/kern/subr_tftproot.c 2 Oct 2012 02:32:06 -0000 @@ -114,19 +114,19 @@ struct tftproot_handle { #define TRH_FINISHED 1 -int tftproot_dhcpboot(struct device *); +int tftproot_dhcpboot(device_t); static int tftproot_getfile(struct tftproot_handle *, struct lwp *); -static int tftproot_recv(struct mbuf*, void*); +static int tftproot_recv(struct mbuf *, void *); int -tftproot_dhcpboot(struct device *bootdv) +tftproot_dhcpboot(device_t bootdv) { struct nfs_diskless *nd = NULL; struct ifnet *ifp = NULL; struct lwp *l; struct tftproot_handle trh; - struct device *dv; + device_t dv; int error = -1; if (rootspec != NULL) { @@ -213,7 +213,6 @@ tftproot_getfile(struct tftproot_handle const char octetstr[] = "octet"; size_t hdrlen = sizeof(*tftp) - sizeof(tftp->th_data); char *cp; - /* struct device *dv; */ if ((error = socreate(AF_INET, &so, SOCK_DGRAM, 0, l, NULL)) != 0) { DPRINTF(("%s():%d socreate returned %d\n", Index: sys/kern/vfs_mount.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/kern/vfs_mount.c,v retrieving revision 1.14 diff -u -p -r1.14 vfs_mount.c --- sys/kern/vfs_mount.c 8 May 2012 08:44:49 -0000 1.14 +++ sys/kern/vfs_mount.c 2 Oct 2012 02:32:17 -0000 @@ -96,7 +96,7 @@ __KERNEL_RCSID(0, "$NetBSD: vfs_mount.c, /* Root filesystem and device. */ vnode_t * rootvnode; -struct device * root_device; +device_t root_device; /* Mounted filesystem list. */ struct mntlist mountlist; Index: sys/netisdn/i4b_ctl.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/netisdn/i4b_ctl.c,v retrieving revision 1.21 diff -u -p -r1.21 i4b_ctl.c --- sys/netisdn/i4b_ctl.c 18 Mar 2009 10:22:43 -0000 1.21 +++ sys/netisdn/i4b_ctl.c 29 Sep 2012 10:18:26 -0000 @@ -179,7 +179,7 @@ SYSINIT(i4bctldev, SI_SUB_DRIVERS,SI_ORD #endif /* BSD > 199306 && defined(__FreeBSD__) */ #ifdef __bsdi__ -int i4bctlmatch(struct device *parent, struct cfdata *cf, void *aux); +int i4bctlmatch(device_t parent, cfdata_t cf, void *aux); void dummy_i4bctlattach(struct device*, struct device *, void *); #define CDEV_MAJOR 64 @@ -195,13 +195,13 @@ struct devsw i4bctlsw = }; int -i4bctlmatch(struct device *parent, struct cfdata *cf, void *aux) +i4bctlmatch(device_t parent, cfdata_t cf, void *aux) { printf("i4bctlmatch: aux=0x%x\n", aux); return 1; } void -dummy_i4bctlattach(struct device *parent, struct device *self, void *aux) +dummy_i4bctlattach(device_t parent, device_t self, void *aux) { printf("dummy_i4bctlattach: aux=0x%x\n", aux); } Index: sys/netisdn/i4b_debug.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/netisdn/i4b_debug.h,v retrieving revision 1.8 diff -u -p -r1.8 i4b_debug.h --- sys/netisdn/i4b_debug.h 5 Apr 2008 13:44:14 -0000 1.8 +++ sys/netisdn/i4b_debug.h 28 Sep 2012 21:14:10 -0000 @@ -56,7 +56,7 @@ extern unsigned int i4b_l4_debug; #define NDBGL1(bits, fmt, args...) \ if(bits & i4b_l1_debug) \ - { printf("%s (L1): %s: " fmt "\n", device_xname(&sc->sc_dev), __func__ , ##args ); } + { printf("%s (L1): %s: " fmt "\n", device_xname(sc->sc_dev), __func__ , ##args ); } #define NDBGL2(bits, fmt, args...) \ if(bits & i4b_l2_debug) \ Index: sys/netisdn/i4b_i4bdrv.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/netisdn/i4b_i4bdrv.c,v retrieving revision 1.36 diff -u -p -r1.36 i4b_i4bdrv.c --- sys/netisdn/i4b_i4bdrv.c 18 Mar 2009 10:22:43 -0000 1.36 +++ sys/netisdn/i4b_i4bdrv.c 29 Sep 2012 10:18:26 -0000 @@ -203,7 +203,7 @@ const struct cdevsw isdn_cdevsw = { #ifdef __bsdi__ #include -int i4bmatch(struct device *parent, struct cfdata *cf, void *aux); +int i4bmatch(device_t parent, cfdata_t cf, void *aux); void dummy_i4battach(struct device*, struct device *, void *); #define CDEV_MAJOR 65 @@ -219,13 +219,13 @@ struct devsw i4bsw = }; int -i4bmatch(struct device *parent, struct cfdata *cf, void *aux) +i4bmatch(device_t parent, cfdata_t cf, void *aux) { printf("i4bmatch: aux=0x%x\n", aux); return 1; } void -dummy_i4battach(struct device *parent, struct device *self, void *aux) +dummy_i4battach(device_t parent, device_t self, void *aux) { printf("dummy_i4battach: aux=0x%x\n", aux); } Index: sys/netisdn/i4b_rbch.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/netisdn/i4b_rbch.c,v retrieving revision 1.25 diff -u -p -r1.25 i4b_rbch.c --- sys/netisdn/i4b_rbch.c 18 Mar 2009 10:22:43 -0000 1.25 +++ sys/netisdn/i4b_rbch.c 29 Sep 2012 10:18:26 -0000 @@ -268,7 +268,7 @@ SYSINIT(isdnbchandev, SI_SUB_DRIVERS, #endif /* BSD > 199306 && defined(__FreeBSD__) */ #ifdef __bsdi__ -int isdnbchanmatch(struct device *parent, struct cfdata *cf, void *aux); +int isdnbchanmatch(device_t parent, cfdata_t cf, void *aux); void dummy_isdnbchanattach(struct device*, struct device *, void *); #define CDEV_MAJOR 61 @@ -284,13 +284,13 @@ struct devsw isdnbchansw = }; int -isdnbchanmatch(struct device *parent, struct cfdata *cf, void *aux) +isdnbchanmatch(device_t parent, cfdata_t cf, void *aux) { printf("isdnbchanmatch: aux=0x%x\n", aux); return 1; } void -dummy_isdnbchanattach(struct device *parent, struct device *self, void *aux) +dummy_isdnbchanattach(device_t parent, device_t self, void *aux) { printf("dummy_isdnbchanattach: aux=0x%x\n", aux); } Index: sys/netisdn/i4b_tel.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/netisdn/i4b_tel.c,v retrieving revision 1.24 diff -u -p -r1.24 i4b_tel.c --- sys/netisdn/i4b_tel.c 18 Mar 2009 10:22:43 -0000 1.24 +++ sys/netisdn/i4b_tel.c 29 Sep 2012 10:18:26 -0000 @@ -274,7 +274,7 @@ SYSINIT(i4bteldev, SI_SUB_DRIVERS, #ifdef __bsdi__ int i4btelsel(dev_t dev, int rw, struct lwp *l); -int i4btelmatch(struct device *parent, struct cfdata *cf, void *aux); +int i4btelmatch(device_t parent, cfdata_t cf, void *aux); void dummy_i4btelattach(struct device*, struct device *, void *); #define CDEV_MAJOR 62 @@ -290,14 +290,14 @@ struct devsw i4btelsw = }; int -i4btelmatch(struct device *parent, struct cfdata *cf, void *aux) +i4btelmatch(device_t parent, cfdata_t cf, void *aux) { NDBGL4(L4_TELDBG, "aux=0x%x", aux); return 1; } void -dummy_i4btelattach(struct device *parent, struct device *self, void *aux) +dummy_i4btelattach(device_t parent, device_t self, void *aux) { NDBGL4(L4_TELDBG, "aux=0x%x", aux); } Index: sys/rump/dev/lib/libscsitest/scsitest.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/rump/dev/lib/libscsitest/scsitest.c,v retrieving revision 1.4 diff -u -p -r1.4 scsitest.c --- sys/rump/dev/lib/libscsitest/scsitest.c 14 Sep 2012 16:29:21 -0000 1.4 +++ sys/rump/dev/lib/libscsitest/scsitest.c 26 Sep 2012 21:34:18 -0000 @@ -53,8 +53,8 @@ __KERNEL_RCSID(0, "$NetBSD: scsitest.c,v #include #include -int scsitest_match(struct device *, struct cfdata *, void *); -void scsitest_attach(struct device *, struct device *, void *); +int scsitest_match(device_t, cfdata_t, void *); +void scsitest_attach(device_t, device_t, void *); struct scsitest { struct scsipi_channel sc_channel; @@ -206,7 +206,7 @@ scsitest_request(struct scsipi_channel * } int -scsitest_match(struct device *parent, struct cfdata *match, void *aux) +scsitest_match(device_t parent, cfdata_t match, void *aux) { #ifdef USE_TOSI_ISO uint64_t fsize; @@ -231,7 +231,7 @@ scsitest_match(struct device *parent, st } void -scsitest_attach(struct device *parent, struct device *self, void *aux) +scsitest_attach(device_t parent, device_t self, void *aux) { struct scsitest *sc = device_private(self); Index: sys/rump/dev/lib/libugenhc/ugenhc.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/rump/dev/lib/libugenhc/ugenhc.c,v retrieving revision 1.11 diff -u -p -r1.11 ugenhc.c --- sys/rump/dev/lib/libugenhc/ugenhc.c 14 Sep 2012 16:29:21 -0000 1.11 +++ sys/rump/dev/lib/libugenhc/ugenhc.c 26 Sep 2012 21:34:18 -0000 @@ -103,8 +103,8 @@ struct ugenhc_softc { usbd_xfer_handle sc_intrxfer; }; -static int ugenhc_probe(struct device *, struct cfdata *, void *); -static void ugenhc_attach(struct device *, struct device *, void *); +static int ugenhc_probe(device_t, cfdata_t, void *); +static void ugenhc_attach(device_t, device_t, void *); CFATTACH_DECL_NEW(ugenhc, sizeof(struct ugenhc_softc), ugenhc_probe, ugenhc_attach, NULL, NULL); @@ -1054,7 +1054,7 @@ static const struct usbd_bus_methods uge }; static int -ugenhc_probe(struct device *parent, struct cfdata *match, void *aux) +ugenhc_probe(device_t parent, cfdata_t match, void *aux) { char buf[UGENDEV_BUFSIZE]; int error; @@ -1067,7 +1067,7 @@ ugenhc_probe(struct device *parent, stru } static void -ugenhc_attach(struct device *parent, struct device *self, void *aux) +ugenhc_attach(device_t parent, device_t self, void *aux) { struct mainbus_attach_args *maa = aux; struct ugenhc_softc *sc = device_private(self); Index: sys/rump/librump/rumpdev/autoconf.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/rump/librump/rumpdev/autoconf.c,v retrieving revision 1.6 diff -u -p -r1.6 autoconf.c --- sys/rump/librump/rumpdev/autoconf.c 8 Mar 2010 10:24:37 -0000 1.6 +++ sys/rump/librump/rumpdev/autoconf.c 2 Oct 2012 02:33:06 -0000 @@ -32,10 +32,9 @@ __KERNEL_RCSID(0, "$NetBSD: autoconf.c,v #include #include -static int mainbus_match(struct device *, struct cfdata *, void *); -static void mainbus_attach(struct device *, struct device *, void *); -static int mainbus_search(struct device *, struct cfdata *, - const int *, void *); +static int mainbus_match(device_t, cfdata_t, void *); +static void mainbus_attach(device_t, device_t, void *); +static int mainbus_search(device_t, cfdata_t, const int *, void *); struct mainbus_softc { int mb_nada; @@ -104,14 +103,14 @@ rump_pdev_finalize() } int -mainbus_match(struct device *parent, struct cfdata *match, void *aux) +mainbus_match(device_t parent, cfdata_t match, void *aux) { return 1; } void -mainbus_attach(struct device *parent, struct device *self, void *aux) +mainbus_attach(device_t parent, device_t self, void *aux) { aprint_normal("\n"); @@ -119,8 +118,7 @@ mainbus_attach(struct device *parent, st } static int -mainbus_search(struct device *parent, struct cfdata *cf, - const int *ldesc, void *aux) +mainbus_search(device_t parent, cfdata_t cf, const int *ldesc, void *aux) { struct mainbus_attach_args maa; Index: sys/rump/librump/rumpdev/rump_dev.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/rump/librump/rumpdev/rump_dev.c,v retrieving revision 1.19 diff -u -p -r1.19 rump_dev.c --- sys/rump/librump/rumpdev/rump_dev.c 28 Mar 2011 22:23:39 -0000 1.19 +++ sys/rump/librump/rumpdev/rump_dev.c 2 Oct 2012 02:33:17 -0000 @@ -83,14 +83,14 @@ cpu_rootconf(void) } void -device_register(struct device *dev, void *v) +device_register(device_t dev, void *v) { /* nada */ } void -device_register_post_config(struct device *dev, void *v) +device_register_post_config(device_t dev, void *v) { /* nada */ Index: sys/rump/librump/rumpkern/emul.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/rump/librump/rumpkern/emul.c,v retrieving revision 1.150 diff -u -p -r1.150 emul.c --- sys/rump/librump/rumpkern/emul.c 21 Mar 2011 16:41:08 -0000 1.150 +++ sys/rump/librump/rumpkern/emul.c 2 Oct 2012 02:35:35 -0000 @@ -95,8 +95,8 @@ int max_bdevsws = 255; int mem_no = 2; -struct device *booted_device; -struct device *booted_wedge; +device_t booted_device; +device_t booted_wedge; int booted_partition; /* XXX: unused */ Index: sys/sys/conf.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/sys/conf.h,v retrieving revision 1.143 diff -u -p -r1.143 conf.h --- sys/sys/conf.h 29 Jul 2012 18:05:48 -0000 1.143 +++ sys/sys/conf.h 2 Oct 2012 02:33:29 -0000 @@ -265,7 +265,7 @@ void mm_init(void); #ifdef _KERNEL struct device; -void setroot(struct device *, int); +void setroot(device_t, int); void rootconf(void); void swapconf(void); #endif /* _KERNEL */ Index: sys/sys/device.h =================================================================== RCS file: /home/chs/netbsd/cvs/src/sys/sys/device.h,v retrieving revision 1.142 diff -u -p -r1.142 device.h --- sys/sys/device.h 7 Jul 2012 16:15:21 -0000 1.142 +++ sys/sys/device.h 2 Oct 2012 02:33:48 -0000 @@ -321,19 +321,6 @@ struct cfattach { }; LIST_HEAD(cfattachlist, cfattach); -#define CFATTACH_DECL(name, ddsize, matfn, attfn, detfn, actfn) \ -struct cfattach __CONCAT(name,_ca) = { \ - .ca_name = ___STRING(name), \ - .ca_devsize = ddsize, \ - .ca_flags = 0, \ - .ca_match = matfn, \ - .ca_attach = attfn, \ - .ca_detach = detfn, \ - .ca_activate = actfn, \ - .ca_rescan = NULL, \ - .ca_childdetached = NULL, \ -} - #define CFATTACH_DECL3_NEW(name, ddsize, matfn, attfn, detfn, actfn, \ rescanfn, chdetfn, __flags) \ struct cfattach __CONCAT(name,_ca) = { \ @@ -427,7 +414,7 @@ extern int booted_partition; /* the par extern daddr_t booted_startblk; /* or the start of a wedge */ extern uint64_t booted_nblks; /* and the size of that wedge */ -struct vnode *opendisk(struct device *); +struct vnode *opendisk(device_t); int getdisksize(struct vnode *, uint64_t *, unsigned int *); struct dkwedge_info; int getdiskinfo(struct vnode *, struct dkwedge_info *);