diff --git a/sys/arch/sparc/dev/bootbus.c b/sys/arch/sparc/dev/bootbus.c index 9aae4ae5888e..1a5168bb1c10 100644 --- a/sys/arch/sparc/dev/bootbus.c +++ b/sys/arch/sparc/dev/bootbus.c @@ -1,4 +1,4 @@ -/* $NetBSD: bootbus.c,v 1.16 2008/04/28 20:23:35 martin Exp $ */ +/* $NetBSD: bootbus.c,v 1.17 2009/09/20 16:18:21 tsutsui Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: bootbus.c,v 1.16 2008/04/28 20:23:35 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: bootbus.c,v 1.17 2009/09/20 16:18:21 tsutsui Exp $"); #include #include @@ -57,8 +57,8 @@ struct bootbus_softc { bus_space_tag_t sc_bustag; /* passed on to children */ }; -static int bootbus_match(struct device *, struct cfdata *, void *); -static void bootbus_attach(struct device *, struct device *, void *); +static int bootbus_match(device_t, cfdata_t, void *); +static void bootbus_attach(device_t, device_t, void *); CFATTACH_DECL(bootbus, sizeof(struct bootbus_softc), bootbus_match, bootbus_attach, NULL, NULL); @@ -72,7 +72,7 @@ static int bootbus_setup_attach_args(struct bootbus_softc *, bus_space_tag_t, static void bootbus_destroy_attach_args(struct bootbus_attach_args *); static int -bootbus_match(struct device *parent, struct cfdata *cf, void *aux) +bootbus_match(device_t parent, cfdata_t cf, void *aux) { struct cpuunit_attach_args *cpua = aux; @@ -83,9 +83,9 @@ bootbus_match(struct device *parent, struct cfdata *cf, void *aux) } static void -bootbus_attach(struct device *parent, struct device *self, void *aux) +bootbus_attach(device_t parent, device_t self, void *aux) { - struct bootbus_softc *sc = (void *) self; + struct bootbus_softc *sc = device_private(self); struct cpuunit_attach_args *cpua = aux; int node, error; @@ -112,7 +112,7 @@ bootbus_attach(struct device *parent, struct device *self, void *aux) &sc->sc_bustag->ranges); if (error) { printf("%s: error %d getting \"ranges\" property\n", - sc->sc_dev.dv_xname, error); + device_xname(self), error); panic("bootbus_attach"); } @@ -124,7 +124,7 @@ bootbus_attach(struct device *parent, struct device *self, void *aux) if (bootbus_setup_attach_args(sc, sc->sc_bustag, node, &baa)) panic("bootbus_attach: failed to set up attach args"); - (void) config_found_sm_loc(&sc->sc_dev, "bootbus", NULL, &baa, + (void) config_found_sm_loc(self, "bootbus", NULL, &baa, bootbus_print, bootbus_submatch); bootbus_destroy_attach_args(&baa); @@ -132,8 +132,7 @@ bootbus_attach(struct device *parent, struct device *self, void *aux) } static int -bootbus_submatch(struct device *parent, struct cfdata *cf, - const int *ldesc, void *aux) +bootbus_submatch(device_t parent, cfdata_t cf, const int *ldesc, void *aux) { struct bootbus_attach_args *baa = aux; diff --git a/sys/arch/sparc/dev/ebus.c b/sys/arch/sparc/dev/ebus.c index 0b144c5f650e..b6c941114489 100644 --- a/sys/arch/sparc/dev/ebus.c +++ b/sys/arch/sparc/dev/ebus.c @@ -1,4 +1,4 @@ -/* $NetBSD: ebus.c,v 1.30 2008/05/29 14:51:26 mrg Exp $ */ +/* $NetBSD: ebus.c,v 1.31 2009/09/20 16:18:21 tsutsui Exp $ */ /* * Copyright (c) 1999, 2000 Matthew R. Green @@ -32,7 +32,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ebus.c,v 1.30 2008/05/29 14:51:26 mrg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ebus.c,v 1.31 2009/09/20 16:18:21 tsutsui Exp $"); #if defined(DEBUG) && !defined(EBUS_DEBUG) #define EBUS_DEBUG @@ -83,7 +83,7 @@ static void ebus_blink(void *); struct ebus_softc { struct device sc_dev; - struct device *sc_parent; /* PCI bus */ + device_t sc_parent; /* PCI bus */ int sc_node; /* PROM node */ @@ -97,8 +97,8 @@ struct ebus_softc { int sc_nreg; }; -static int ebus_match(struct device *, struct cfdata *, void *); -static void ebus_attach(struct device *, struct device *, void *); +static int ebus_match(device_t, cfdata_t, void *); +static void ebus_attach(device_t, device_t, void *); CFATTACH_DECL(ebus, sizeof(struct ebus_softc), ebus_match, ebus_attach, NULL, NULL); @@ -181,7 +181,7 @@ static int ebus_init_wiring_table(struct ebus_softc *); static int -ebus_match(struct device *parent, struct cfdata *match, void *aux) +ebus_match(device_t parent, cfdata_t cf, void *aux) { struct pci_attach_args *pa = aux; char name[10]; @@ -212,7 +212,7 @@ ebus_init_wiring_table(struct ebus_softc *sc) if (wiring_map != NULL) { printf("%s: global ebus wiring map already initalized\n", - sc->sc_dev.dv_xname); + device_xname(&sc->sc_dev)); return (0); } @@ -238,9 +238,9 @@ ebus_init_wiring_table(struct ebus_softc *sc) * after the sbus code which does similar things. */ static void -ebus_attach(struct device *parent, struct device *self, void *aux) +ebus_attach(device_t parent, device_t self, void *aux) { - struct ebus_softc *sc = (struct ebus_softc *)self; + struct ebus_softc *sc = device_private(self); struct pci_attach_args *pa = aux; struct ebus_attach_args ea; bus_space_tag_t sbt; @@ -260,7 +260,7 @@ ebus_attach(struct device *parent, struct device *self, void *aux) node = PCITAG_NODE(pa->pa_tag); if (node == -1) - panic("%s: unable to find ebus node", self->dv_xname); + panic("%s: unable to find ebus node", device_xname(self)); if (ebus_init_wiring_table(sc) == 0) return; @@ -298,7 +298,7 @@ ebus_attach(struct device *parent, struct device *self, void *aux) &sc->sc_nreg, &sc->sc_reg); if (error) panic("%s: unable to read ebus registers (error %d)", - self->dv_xname, error); + device_xname(self), error); /* * now attach all our children diff --git a/sys/arch/sparc/dev/if_ie_obio.c b/sys/arch/sparc/dev/if_ie_obio.c index b7b0a84ba5bb..e8fa83ee054d 100644 --- a/sys/arch/sparc/dev/if_ie_obio.c +++ b/sys/arch/sparc/dev/if_ie_obio.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_ie_obio.c,v 1.36 2008/04/28 20:23:35 martin Exp $ */ +/* $NetBSD: if_ie_obio.c,v 1.37 2009/09/20 16:18:21 tsutsui Exp $ */ /*- * Copyright (c) 1997 The NetBSD Foundation, Inc. @@ -78,7 +78,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_ie_obio.c,v 1.36 2008/04/28 20:23:35 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_ie_obio.c,v 1.37 2009/09/20 16:18:21 tsutsui Exp $"); #include #include @@ -125,8 +125,8 @@ static void ie_obreset(struct ie_softc *, int); static void ie_obattend(struct ie_softc *, int); static void ie_obrun(struct ie_softc *); -int ie_obio_match(struct device *, struct cfdata *, void *); -void ie_obio_attach(struct device *, struct device *, void *); +int ie_obio_match(device_t, cfdata_t, void *); +void ie_obio_attach(device_t, device_t, void *); CFATTACH_DECL(ie_obio, sizeof(struct ie_softc), ie_obio_match, ie_obio_attach, NULL, NULL); @@ -231,7 +231,7 @@ ie_obio_write24(struct ie_softc *sc, int offset, int addr) } int -ie_obio_match(struct device *parent, struct cfdata *cf, void *aux) +ie_obio_match(device_t parent, cfdata_t cf, void *aux) { union obio_attach_args *uoba = aux; struct obio4_attach_args *oba; @@ -248,11 +248,11 @@ ie_obio_match(struct device *parent, struct cfdata *cf, void *aux) } void -ie_obio_attach(struct device *parent, struct device *self, void *aux) +ie_obio_attach(device_t parent, device_t self, void *aux) { union obio_attach_args *uoba = aux; struct obio4_attach_args *oba = &uoba->uoba_oba4; - struct ie_softc *sc = (void *) self; + struct ie_softc *sc = device_private(self); bus_dma_tag_t dmatag = oba->oba_dmatag; bus_space_handle_t bh; bus_dma_segment_t seg; @@ -282,7 +282,7 @@ ie_obio_attach(struct device *parent, struct device *self, void *aux) sizeof(struct ieob), BUS_SPACE_MAP_LINEAR, &bh) != 0) { - printf("%s: cannot map registers\n", self->dv_xname); + printf("%s: cannot map registers\n", device_xname(self)); return; } sc->sc_reg = (void *)bh; @@ -294,14 +294,14 @@ ie_obio_attach(struct device *parent, struct device *self, void *aux) BUS_DMA_NOWAIT|BUS_DMA_24BIT, &sc->sc_dmamap)) != 0) { printf("%s: DMA map create error %d\n", - sc->sc_dev.dv_xname, error); + device_xname(self), error); return; } if ((error = bus_dmamem_alloc(dmatag, memsize, 64*1024, 0, &seg, 1, &rseg, BUS_DMA_NOWAIT | BUS_DMA_24BIT)) != 0) { printf("%s: DMA memory allocation error %d\n", - self->dv_xname, error); + device_xname(self), error); return; } @@ -310,7 +310,7 @@ ie_obio_attach(struct device *parent, struct device *self, void *aux) (void **)&sc->sc_maddr, BUS_DMA_NOWAIT|BUS_DMA_COHERENT)) != 0) { printf("%s: DMA buffer map error %d\n", - sc->sc_dev.dv_xname, error); + device_xname(self), error); bus_dmamem_free(dmatag, &seg, rseg); return; } @@ -320,7 +320,7 @@ ie_obio_attach(struct device *parent, struct device *self, void *aux) sc->sc_maddr, memsize, NULL, BUS_DMA_NOWAIT)) != 0) { printf("%s: DMA buffer map load error %d\n", - sc->sc_dev.dv_xname, error); + device_xname(self), error); bus_dmamem_unmap(dmatag, sc->sc_maddr, memsize); bus_dmamem_free(dmatag, &seg, rseg); return; diff --git a/sys/arch/sparc/dev/rtc.c b/sys/arch/sparc/dev/rtc.c index 050b4fb95c58..3634af6ab0de 100644 --- a/sys/arch/sparc/dev/rtc.c +++ b/sys/arch/sparc/dev/rtc.c @@ -1,4 +1,4 @@ -/* $NetBSD: rtc.c,v 1.14 2006/09/04 23:45:30 gdamore Exp $ */ +/* $NetBSD: rtc.c,v 1.15 2009/09/20 16:18:21 tsutsui Exp $ */ /* * Copyright (c) 2001 Valeriy E. Ushakov @@ -34,7 +34,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rtc.c,v 1.14 2006/09/04 23:45:30 gdamore Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rtc.c,v 1.15 2009/09/20 16:18:21 tsutsui Exp $"); #include #include @@ -61,8 +61,8 @@ struct rtc_ebus_softc { bus_space_handle_t sc_bh; /* handle for registers */ }; -static int rtcmatch_ebus(struct device *, struct cfdata *, void *); -static void rtcattach_ebus(struct device *, struct device *, void *); +static int rtcmatch_ebus(device_t, cfdata_t, void *); +static void rtcattach_ebus(device_t, device_t, void *); CFATTACH_DECL(rtc_ebus, sizeof(struct rtc_ebus_softc), rtcmatch_ebus, rtcattach_ebus, NULL, NULL); @@ -103,7 +103,7 @@ mc146818_write(void *cookie, u_int reg, u_int datum) static int -rtcmatch_ebus(struct device *parent, struct cfdata *cf, void *aux) +rtcmatch_ebus(device_t parent, cfdata_t cf, void *aux) { struct ebus_attach_args *ea = aux; @@ -111,11 +111,10 @@ rtcmatch_ebus(struct device *parent, struct cfdata *cf, void *aux) } static void -rtcattach_ebus(struct device *parent, struct device *self, void *aux) +rtcattach_ebus(device_t parent, device_t self, void *aux) { - struct rtc_ebus_softc *sc = (void *)self; + struct rtc_ebus_softc *sc = device_private(self); struct ebus_attach_args *ea = aux; - todr_chip_handle_t handle; sc->sc_bt = ea->ea_bustag; diff --git a/sys/arch/sparc/dev/vme_machdep.c b/sys/arch/sparc/dev/vme_machdep.c index 9b9014da3f07..31848be73501 100644 --- a/sys/arch/sparc/dev/vme_machdep.c +++ b/sys/arch/sparc/dev/vme_machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: vme_machdep.c,v 1.59 2008/12/19 18:49:38 cegger Exp $ */ +/* $NetBSD: vme_machdep.c,v 1.60 2009/09/20 16:18:21 tsutsui Exp $ */ /*- * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vme_machdep.c,v 1.59 2008/12/19 18:49:38 cegger Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vme_machdep.c,v 1.60 2009/09/20 16:18:21 tsutsui Exp $"); #include #include @@ -76,10 +76,10 @@ struct sparcvme_softc { struct sparcvme_softc *sparcvme_sc;/*XXX*/ /* autoconfiguration driver */ -static int vmematch_iommu(struct device *, struct cfdata *, void *); -static void vmeattach_iommu(struct device *, struct device *, void *); -static int vmematch_mainbus(struct device *, struct cfdata *, void *); -static void vmeattach_mainbus(struct device *, struct device *, void *); +static int vmematch_iommu(device_t, cfdata_t, void *); +static void vmeattach_iommu(device_t, device_t, void *); +static int vmematch_mainbus(device_t, cfdata_t, void *); +static void vmeattach_mainbus(device_t, device_t, void *); #if defined(SUN4) int vmeintr4(void *); #endif @@ -263,7 +263,7 @@ struct sparc_bus_dma_tag sparc_vme_iommu_dma_tag = { static int -vmematch_mainbus(struct device *parent, struct cfdata *cf, void *aux) +vmematch_mainbus(device_t parent, cfdata_t cf, void *aux) { struct mainbus_attach_args *ma = aux; @@ -274,7 +274,7 @@ vmematch_mainbus(struct device *parent, struct cfdata *cf, void *aux) } static int -vmematch_iommu(struct device *parent, struct cfdata *cf, void *aux) +vmematch_iommu(device_t parent, cfdata_t cf, void *aux) { struct iommu_attach_args *ia = aux; @@ -286,11 +286,11 @@ vmematch_iommu(struct device *parent, struct cfdata *cf, void *aux) static void -vmeattach_mainbus(struct device *parent, struct device *self, void *aux) +vmeattach_mainbus(device_t parent, device_t self, void *aux) { #if defined(SUN4) struct mainbus_attach_args *ma = aux; - struct sparcvme_softc *sc = (struct sparcvme_softc *)self; + struct sparcvme_softc *sc = device_private(self); struct vmebus_attach_args vba; vme_attached = 1; @@ -301,10 +301,10 @@ vmeattach_mainbus(struct device *parent, struct device *self, void *aux) /* VME interrupt entry point */ sc->sc_vmeintr = vmeintr4; -/*XXX*/ sparc_vme_chipset_tag.cookie = self; +/*XXX*/ sparc_vme_chipset_tag.cookie = sc; /*XXX*/ sparc_vme_chipset_tag.vct_dmamap_create = sparc_vct4_dmamap_create; /*XXX*/ sparc_vme_chipset_tag.vct_dmamap_destroy = sparc_vct_dmamap_destroy; -/*XXX*/ sparc_vme4_dma_tag._cookie = self; +/*XXX*/ sparc_vme4_dma_tag._cookie = sc; vba.va_vct = &sparc_vme_chipset_tag; vba.va_bdt = &sparc_vme4_dma_tag; @@ -332,7 +332,7 @@ static void vmeattach_iommu(struct device *parent, struct device *self, void *aux) { #if defined(SUN4M) - struct sparcvme_softc *sc = (struct sparcvme_softc *)self; + struct sparcvme_softc *sc = device_private(self); struct iommu_attach_args *ia = aux; struct vmebus_attach_args vba; bus_space_handle_t bh; @@ -345,10 +345,10 @@ vmeattach_iommu(struct device *parent, struct device *self, void *aux) /* VME interrupt entry point */ sc->sc_vmeintr = vmeintr4m; -/*XXX*/ sparc_vme_chipset_tag.cookie = self; +/*XXX*/ sparc_vme_chipset_tag.cookie = sc; /*XXX*/ sparc_vme_chipset_tag.vct_dmamap_create = sparc_vct_iommu_dmamap_create; /*XXX*/ sparc_vme_chipset_tag.vct_dmamap_destroy = sparc_vct_dmamap_destroy; -/*XXX*/ sparc_vme_iommu_dma_tag._cookie = self; +/*XXX*/ sparc_vme_iommu_dma_tag._cookie = sc; vba.va_vct = &sparc_vme_chipset_tag; vba.va_bdt = &sparc_vme_iommu_dma_tag; @@ -360,7 +360,7 @@ vmeattach_iommu(struct device *parent, struct device *self, void *aux) * Map VME control space */ if (ia->iom_nreg < 2) { - printf("%s: only %d register sets\n", self->dv_xname, + printf("%s: only %d register sets\n", device_xname(self), ia->iom_nreg); return; } @@ -371,7 +371,7 @@ vmeattach_iommu(struct device *parent, struct device *self, void *aux) (bus_size_t)ia->iom_reg[0].oa_size, BUS_SPACE_MAP_LINEAR, &bh) != 0) { - panic("%s: can't map vmebusreg", self->dv_xname); + panic("%s: can't map vmebusreg", device_xname(self)); } sc->sc_reg = (struct vmebusreg *)bh; @@ -381,7 +381,7 @@ vmeattach_iommu(struct device *parent, struct device *self, void *aux) (bus_size_t)ia->iom_reg[1].oa_size, BUS_SPACE_MAP_LINEAR, &bh) != 0) { - panic("%s: can't map vmebusvec", self->dv_xname); + panic("%s: can't map vmebusvec", device_xname(self)); } sc->sc_vec = (struct vmebusvec *)bh; @@ -395,7 +395,7 @@ vmeattach_iommu(struct device *parent, struct device *self, void *aux) VME_IOC_SIZE, BUS_SPACE_MAP_LINEAR, &bh) != 0) { - panic("%s: can't map IOC tags", self->dv_xname); + panic("%s: can't map IOC tags", device_xname(self)); } sc->sc_ioctags = (uint32_t *)bh; @@ -406,7 +406,7 @@ vmeattach_iommu(struct device *parent, struct device *self, void *aux) VME_IOC_SIZE, BUS_SPACE_MAP_LINEAR, &bh) != 0) { - panic("%s: can't map IOC flush registers", self->dv_xname); + panic("%s: can't map IOC flush registers", device_xname(self)); } sc->sc_iocflush = (uint32_t *)bh; @@ -415,7 +415,7 @@ vmeattach_iommu(struct device *parent, struct device *self, void *aux) */ if (prom_getprop(node, "ranges", sizeof(struct rom_range), &sc->sc_nrange, &sc->sc_range) != 0) { - panic("%s: can't get ranges property", self->dv_xname); + panic("%s: can't get ranges property", device_xname(self)); } sparcvme_sc = sc; @@ -498,7 +498,7 @@ sparc_vme_probe(void *cookie, vme_addr_t addr, vme_size_t len, vme_am_t mod, int (*callback)(void *, bus_space_tag_t, bus_space_handle_t), void *arg) { - struct sparcvme_softc *sc = (struct sparcvme_softc *)cookie; + struct sparcvme_softc *sc = cookie; bus_addr_t paddr; bus_size_t size; struct vmeprobe_myarg myarg; @@ -535,7 +535,7 @@ sparc_vme_map(void *cookie, vme_addr_t addr, vme_size_t size, vme_am_t mod, vme_datasize_t datasize, vme_swap_t swap, bus_space_tag_t *tp, bus_space_handle_t *hp, vme_mapresc_t *rp) { - struct sparcvme_softc *sc = (struct sparcvme_softc *)cookie; + struct sparcvme_softc *sc = cookie; bus_addr_t paddr; int error; @@ -569,7 +569,7 @@ sparc_vme_iommu_barrier(bus_space_tag_t t, bus_space_handle_t h, bus_size_t offset, bus_size_t size. int flags) { - struct vmebusreg *vbp = (struct vmebusreg *)t->cookie; + struct vmebusreg *vbp = t->cookie; /* Read async fault status to flush write-buffers */ (*(volatile int *)&vbp->vmebus_afsr); @@ -741,7 +741,7 @@ static void * sparc_vme_intr_establish(void *cookie, vme_intr_handle_t vih, int level, int (*func)(void *), void *arg) { - struct sparcvme_softc *sc = (struct sparcvme_softc *)cookie; + struct sparcvme_softc *sc = cookie; struct sparc_vme_intr_handle *svih = (struct sparc_vme_intr_handle *)vih; struct intrhand *ih; @@ -805,7 +805,7 @@ sparc_vme_intr_disestablish(void *cookie, void *a) static void sparc_vct_dmamap_destroy(void *cookie, bus_dmamap_t map) { - struct sparcvme_softc *sc = (struct sparcvme_softc *)cookie; + struct sparcvme_softc *sc = cookie; bus_dmamap_destroy(sc->sc_dmatag, map); } @@ -819,7 +819,7 @@ sparc_vct4_dmamap_create(void *cookie, vme_size_t size, vme_am_t am, vme_addr_t boundary, int flags, bus_dmamap_t *dmamp) { - struct sparcvme_softc *sc = (struct sparcvme_softc *)cookie; + struct sparcvme_softc *sc = cookie; /* Allocate a base map through parent bus ops */ return (bus_dmamap_create(sc->sc_dmatag, size, nsegments, maxsegsz, @@ -956,7 +956,7 @@ sparc_vct_iommu_dmamap_create(void *cookie, vme_size_t size, vme_am_t am, vme_addr_t boundary, int flags, bus_dmamap_t *dmamp) { - struct sparcvme_softc *sc = (struct sparcvme_softc *)cookie; + struct sparcvme_softc *sc = cookie; bus_dmamap_t map; int error; @@ -996,7 +996,7 @@ sparc_vme_iommu_dmamap_load(bus_dma_tag_t t, bus_dmamap_t map, void *buf, bus_size_t buflen, struct proc *p, int flags) { - struct sparcvme_softc *sc = (struct sparcvme_softc *)t->_cookie; + struct sparcvme_softc *sc = t->_cookie; volatile uint32_t *ioctags; int error; @@ -1027,7 +1027,7 @@ sparc_vme_iommu_dmamap_load(bus_dma_tag_t t, bus_dmamap_t map, static void sparc_vme_iommu_dmamap_unload(bus_dma_tag_t t, bus_dmamap_t map) { - struct sparcvme_softc *sc = (struct sparcvme_softc *)t->_cookie; + struct sparcvme_softc *sc = t->_cookie; volatile uint32_t *flushregs; int len; @@ -1068,7 +1068,7 @@ static int sparc_vme_dmamem_map(bus_dma_tag_t t, bus_dma_segment_t *segs, int nsegs, size_t size, void **kvap, int flags) { - struct sparcvme_softc *sc = (struct sparcvme_softc *)t->_cookie; + struct sparcvme_softc *sc = t->_cookie; return (bus_dmamem_map(sc->sc_dmatag, segs, nsegs, size, kvap, flags)); }