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 c