Module Name: src Committed By: msaitoh Date: Sun Oct 14 14:20:58 UTC 2012
Modified Files: src/sys/arch/arm/xscale: becc.c becc_pci.c beccvar.h i80312.c i80312_pci.c i80312var.h i80321_pci.c ixp425.c ixp425_ixme.c ixp425_npe.c ixp425_npevar.h ixp425_pci.c ixp425_sip.c ixp425_sipvar.h ixp425_timer.c ixp425_wdog.c ixp425var.h src/sys/arch/evbarm/ixdp425: ixdp425_led.c ixdp425_mainbus.c src/sys/arch/evbarm/nslu2: nslu2_buttons.c nslu2_iic.c nslu2_leds.c nslu2_mainbus.c Log Message: struct device * -> device_t for IXP4xx (and nslu2). Tested with my NSLU2. To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/sys/arch/arm/xscale/becc.c \ src/sys/arch/arm/xscale/ixp425.c cvs rdiff -u -r1.12 -r1.13 src/sys/arch/arm/xscale/becc_pci.c \ src/sys/arch/arm/xscale/i80312_pci.c src/sys/arch/arm/xscale/ixp425_sip.c cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/xscale/beccvar.h \ src/sys/arch/arm/xscale/ixp425_npevar.h \ src/sys/arch/arm/xscale/ixp425_wdog.c cvs rdiff -u -r1.22 -r1.23 src/sys/arch/arm/xscale/i80312.c cvs rdiff -u -r1.10 -r1.11 src/sys/arch/arm/xscale/i80312var.h cvs rdiff -u -r1.13 -r1.14 src/sys/arch/arm/xscale/i80321_pci.c cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/xscale/ixp425_ixme.c cvs rdiff -u -r1.8 -r1.9 src/sys/arch/arm/xscale/ixp425_npe.c cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/xscale/ixp425_pci.c cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/xscale/ixp425_sipvar.h cvs rdiff -u -r1.16 -r1.17 src/sys/arch/arm/xscale/ixp425_timer.c cvs rdiff -u -r1.14 -r1.15 src/sys/arch/arm/xscale/ixp425var.h cvs rdiff -u -r1.5 -r1.6 src/sys/arch/evbarm/ixdp425/ixdp425_led.c cvs rdiff -u -r1.8 -r1.9 src/sys/arch/evbarm/ixdp425/ixdp425_mainbus.c cvs rdiff -u -r1.3 -r1.4 src/sys/arch/evbarm/nslu2/nslu2_buttons.c \ src/sys/arch/evbarm/nslu2/nslu2_mainbus.c cvs rdiff -u -r1.7 -r1.8 src/sys/arch/evbarm/nslu2/nslu2_iic.c cvs rdiff -u -r1.8 -r1.9 src/sys/arch/evbarm/nslu2/nslu2_leds.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/arm/xscale/becc.c diff -u src/sys/arch/arm/xscale/becc.c:1.15 src/sys/arch/arm/xscale/becc.c:1.16 --- src/sys/arch/arm/xscale/becc.c:1.15 Tue Sep 18 05:47:28 2012 +++ src/sys/arch/arm/xscale/becc.c Sun Oct 14 14:20:57 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: becc.c,v 1.15 2012/09/18 05:47:28 matt Exp $ */ +/* $NetBSD: becc.c,v 1.16 2012/10/14 14:20:57 msaitoh Exp $ */ /* * Copyright (c) 2002, 2003 Wasabi Systems, Inc. @@ -41,7 +41,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: becc.c,v 1.15 2012/09/18 05:47:28 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: becc.c,v 1.16 2012/10/14 14:20:57 msaitoh Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -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: src/sys/arch/arm/xscale/ixp425.c diff -u src/sys/arch/arm/xscale/ixp425.c:1.15 src/sys/arch/arm/xscale/ixp425.c:1.16 --- src/sys/arch/arm/xscale/ixp425.c:1.15 Fri Jul 1 20:32:51 2011 +++ src/sys/arch/arm/xscale/ixp425.c Sun Oct 14 14:20:57 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: ixp425.c,v 1.15 2011/07/01 20:32:51 dyoung Exp $ */ +/* $NetBSD: ixp425.c,v 1.16 2012/10/14 14:20:57 msaitoh Exp $ */ /* * Copyright (c) 2003 @@ -30,7 +30,7 @@ #include "pci.h" #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ixp425.c,v 1.15 2011/07/01 20:32:51 dyoung Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ixp425.c,v 1.16 2012/10/14 14:20:57 msaitoh Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -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: src/sys/arch/arm/xscale/becc_pci.c diff -u src/sys/arch/arm/xscale/becc_pci.c:1.12 src/sys/arch/arm/xscale/becc_pci.c:1.13 --- src/sys/arch/arm/xscale/becc_pci.c:1.12 Fri Sep 7 02:11:32 2012 +++ src/sys/arch/arm/xscale/becc_pci.c Sun Oct 14 14:20:57 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: becc_pci.c,v 1.12 2012/09/07 02:11:32 matt Exp $ */ +/* $NetBSD: becc_pci.c,v 1.13 2012/10/14 14:20:57 msaitoh Exp $ */ /* * Copyright (c) 2001, 2002 Wasabi Systems, Inc. @@ -41,7 +41,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: becc_pci.c,v 1.12 2012/09/07 02:11:32 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: becc_pci.c,v 1.13 2012/10/14 14:20:57 msaitoh Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -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: src/sys/arch/arm/xscale/i80312_pci.c diff -u src/sys/arch/arm/xscale/i80312_pci.c:1.12 src/sys/arch/arm/xscale/i80312_pci.c:1.13 --- src/sys/arch/arm/xscale/i80312_pci.c:1.12 Fri Sep 7 03:05:12 2012 +++ src/sys/arch/arm/xscale/i80312_pci.c Sun Oct 14 14:20:57 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: i80312_pci.c,v 1.12 2012/09/07 03:05:12 matt Exp $ */ +/* $NetBSD: i80312_pci.c,v 1.13 2012/10/14 14:20:57 msaitoh Exp $ */ /* * Copyright (c) 2001 Wasabi Systems, Inc. @@ -40,7 +40,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: i80312_pci.c,v 1.12 2012/09/07 03:05:12 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: i80312_pci.c,v 1.13 2012/10/14 14:20:57 msaitoh Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -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: src/sys/arch/arm/xscale/ixp425_sip.c diff -u src/sys/arch/arm/xscale/ixp425_sip.c:1.12 src/sys/arch/arm/xscale/ixp425_sip.c:1.13 --- src/sys/arch/arm/xscale/ixp425_sip.c:1.12 Fri Jul 1 20:32:51 2011 +++ src/sys/arch/arm/xscale/ixp425_sip.c Sun Oct 14 14:20:58 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: ixp425_sip.c,v 1.12 2011/07/01 20:32:51 dyoung Exp $ */ +/* $NetBSD: ixp425_sip.c,v 1.13 2012/10/14 14:20:58 msaitoh Exp $ */ /* * Copyright (c) 2003 @@ -28,7 +28,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ixp425_sip.c,v 1.12 2011/07/01 20:32:51 dyoung Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ixp425_sip.c,v 1.13 2012/10/14 14:20:58 msaitoh Exp $"); /* * Slow peripheral bus of IXP425 Processor @@ -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: src/sys/arch/arm/xscale/beccvar.h diff -u src/sys/arch/arm/xscale/beccvar.h:1.3 src/sys/arch/arm/xscale/beccvar.h:1.4 --- src/sys/arch/arm/xscale/beccvar.h:1.3 Tue Mar 25 19:47:30 2003 +++ src/sys/arch/arm/xscale/beccvar.h Sun Oct 14 14:20:57 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: beccvar.h,v 1.3 2003/03/25 19:47:30 thorpej Exp $ */ +/* $NetBSD: beccvar.h,v 1.4 2012/10/14 14:20:57 msaitoh Exp $ */ /* * Copyright (c) 2002, 2003 Wasabi Systems, Inc. @@ -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: src/sys/arch/arm/xscale/ixp425_npevar.h diff -u src/sys/arch/arm/xscale/ixp425_npevar.h:1.3 src/sys/arch/arm/xscale/ixp425_npevar.h:1.4 --- src/sys/arch/arm/xscale/ixp425_npevar.h:1.3 Wed Mar 11 16:30:20 2009 +++ src/sys/arch/arm/xscale/ixp425_npevar.h Sun Oct 14 14:20:58 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: ixp425_npevar.h,v 1.3 2009/03/11 16:30:20 msaitoh Exp $ */ +/* $NetBSD: ixp425_npevar.h,v 1.4 2012/10/14 14:20:58 msaitoh Exp $ */ /*- * Copyright (c) 2006 Sam Leffler. All rights reserved. @@ -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: src/sys/arch/arm/xscale/ixp425_wdog.c diff -u src/sys/arch/arm/xscale/ixp425_wdog.c:1.3 src/sys/arch/arm/xscale/ixp425_wdog.c:1.4 --- src/sys/arch/arm/xscale/ixp425_wdog.c:1.3 Fri Jul 1 20:32:51 2011 +++ src/sys/arch/arm/xscale/ixp425_wdog.c Sun Oct 14 14:20:58 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: ixp425_wdog.c,v 1.3 2011/07/01 20:32:51 dyoung Exp $ */ +/* $NetBSD: ixp425_wdog.c,v 1.4 2012/10/14 14:20:58 msaitoh Exp $ */ /*- * Copyright (c) 2006 The NetBSD Foundation, Inc. @@ -32,7 +32,7 @@ #include "opt_ddb.h" #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ixp425_wdog.c,v 1.3 2011/07/01 20:32:51 dyoung Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ixp425_wdog.c,v 1.4 2012/10/14 14:20:58 msaitoh Exp $"); #include <sys/systm.h> #include <sys/param.h> @@ -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: src/sys/arch/arm/xscale/i80312.c diff -u src/sys/arch/arm/xscale/i80312.c:1.22 src/sys/arch/arm/xscale/i80312.c:1.23 --- src/sys/arch/arm/xscale/i80312.c:1.22 Tue Sep 18 05:47:28 2012 +++ src/sys/arch/arm/xscale/i80312.c Sun Oct 14 14:20:57 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: i80312.c,v 1.22 2012/09/18 05:47:28 matt Exp $ */ +/* $NetBSD: i80312.c,v 1.23 2012/10/14 14:20:57 msaitoh Exp $ */ /* * Copyright (c) 2001, 2002 Wasabi Systems, Inc. @@ -40,7 +40,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: i80312.c,v 1.22 2012/09/18 05:47:28 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: i80312.c,v 1.23 2012/10/14 14:20:57 msaitoh Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -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: src/sys/arch/arm/xscale/i80312var.h diff -u src/sys/arch/arm/xscale/i80312var.h:1.10 src/sys/arch/arm/xscale/i80312var.h:1.11 --- src/sys/arch/arm/xscale/i80312var.h:1.10 Fri Jul 1 20:32:51 2011 +++ src/sys/arch/arm/xscale/i80312var.h Sun Oct 14 14:20:57 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: i80312var.h,v 1.10 2011/07/01 20:32:51 dyoung Exp $ */ +/* $NetBSD: i80312var.h,v 1.11 2012/10/14 14:20:57 msaitoh Exp $ */ /* * Copyright (c) 2001, 2002 Wasabi Systems, Inc. @@ -43,7 +43,7 @@ #include <dev/pci/pcivar.h> 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: src/sys/arch/arm/xscale/i80321_pci.c diff -u src/sys/arch/arm/xscale/i80321_pci.c:1.13 src/sys/arch/arm/xscale/i80321_pci.c:1.14 --- src/sys/arch/arm/xscale/i80321_pci.c:1.13 Fri Sep 7 03:05:12 2012 +++ src/sys/arch/arm/xscale/i80321_pci.c Sun Oct 14 14:20:57 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: i80321_pci.c,v 1.13 2012/09/07 03:05:12 matt Exp $ */ +/* $NetBSD: i80321_pci.c,v 1.14 2012/10/14 14:20:57 msaitoh Exp $ */ /* * Copyright (c) 2001, 2002 Wasabi Systems, Inc. @@ -40,7 +40,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: i80321_pci.c,v 1.13 2012/09/07 03:05:12 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: i80321_pci.c,v 1.14 2012/10/14 14:20:57 msaitoh Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -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: src/sys/arch/arm/xscale/ixp425_ixme.c diff -u src/sys/arch/arm/xscale/ixp425_ixme.c:1.4 src/sys/arch/arm/xscale/ixp425_ixme.c:1.5 --- src/sys/arch/arm/xscale/ixp425_ixme.c:1.4 Tue Sep 18 05:47:28 2012 +++ src/sys/arch/arm/xscale/ixp425_ixme.c Sun Oct 14 14:20:57 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: ixp425_ixme.c,v 1.4 2012/09/18 05:47:28 matt Exp $ */ +/* $NetBSD: ixp425_ixme.c,v 1.5 2012/10/14 14:20:57 msaitoh Exp $ */ /*- * Copyright (c) 2006 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ixp425_ixme.c,v 1.4 2012/09/18 05:47:28 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ixp425_ixme.c,v 1.5 2012/10/14 14:20:57 msaitoh Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -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: src/sys/arch/arm/xscale/ixp425_npe.c diff -u src/sys/arch/arm/xscale/ixp425_npe.c:1.8 src/sys/arch/arm/xscale/ixp425_npe.c:1.9 --- src/sys/arch/arm/xscale/ixp425_npe.c:1.8 Fri Jul 1 20:32:51 2011 +++ src/sys/arch/arm/xscale/ixp425_npe.c Sun Oct 14 14:20:58 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: ixp425_npe.c,v 1.8 2011/07/01 20:32:51 dyoung Exp $ */ +/* $NetBSD: ixp425_npe.c,v 1.9 2012/10/14 14:20:58 msaitoh Exp $ */ /*- * Copyright (c) 2006 Sam Leffler, Errno Consulting @@ -62,7 +62,7 @@ #if 0 __FBSDID("$FreeBSD: src/sys/arm/xscale/ixp425/ixp425_npe.c,v 1.1 2006/11/19 23:55:23 sam Exp $"); #endif -__KERNEL_RCSID(0, "$NetBSD: ixp425_npe.c,v 1.8 2011/07/01 20:32:51 dyoung Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ixp425_npe.c,v 1.9 2012/10/14 14:20:58 msaitoh Exp $"); /* * Intel XScale Network Processing Engine (NPE) support. @@ -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: src/sys/arch/arm/xscale/ixp425_pci.c diff -u src/sys/arch/arm/xscale/ixp425_pci.c:1.9 src/sys/arch/arm/xscale/ixp425_pci.c:1.10 --- src/sys/arch/arm/xscale/ixp425_pci.c:1.9 Fri Sep 7 03:05:12 2012 +++ src/sys/arch/arm/xscale/ixp425_pci.c Sun Oct 14 14:20:58 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: ixp425_pci.c,v 1.9 2012/09/07 03:05:12 matt Exp $ */ +/* $NetBSD: ixp425_pci.c,v 1.10 2012/10/14 14:20:58 msaitoh Exp $ */ /* * Copyright (c) 2003 @@ -28,7 +28,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ixp425_pci.c,v 1.9 2012/09/07 03:05:12 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ixp425_pci.c,v 1.10 2012/10/14 14:20:58 msaitoh Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -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: src/sys/arch/arm/xscale/ixp425_sipvar.h diff -u src/sys/arch/arm/xscale/ixp425_sipvar.h:1.6 src/sys/arch/arm/xscale/ixp425_sipvar.h:1.7 --- src/sys/arch/arm/xscale/ixp425_sipvar.h:1.6 Fri Jul 1 20:32:51 2011 +++ src/sys/arch/arm/xscale/ixp425_sipvar.h Sun Oct 14 14:20:58 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: ixp425_sipvar.h,v 1.6 2011/07/01 20:32:51 dyoung Exp $ */ +/* $NetBSD: ixp425_sipvar.h,v 1.7 2012/10/14 14:20:58 msaitoh Exp $ */ /* * Copyright (c) 2003 * Ichiro FUKUHARA <ich...@ichiro.org>. @@ -36,7 +36,6 @@ #include <sys/bus.h> struct ixpsip_softc { - struct device sc_dev; bus_space_tag_t sc_iot; bus_space_handle_t sc_ioh; }; Index: src/sys/arch/arm/xscale/ixp425_timer.c diff -u src/sys/arch/arm/xscale/ixp425_timer.c:1.16 src/sys/arch/arm/xscale/ixp425_timer.c:1.17 --- src/sys/arch/arm/xscale/ixp425_timer.c:1.16 Fri Jul 1 20:32:51 2011 +++ src/sys/arch/arm/xscale/ixp425_timer.c Sun Oct 14 14:20:58 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: ixp425_timer.c,v 1.16 2011/07/01 20:32:51 dyoung Exp $ */ +/* $NetBSD: ixp425_timer.c,v 1.17 2012/10/14 14:20:58 msaitoh Exp $ */ /* * Copyright (c) 2003 @@ -28,7 +28,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ixp425_timer.c,v 1.16 2011/07/01 20:32:51 dyoung Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ixp425_timer.c,v 1.17 2012/10/14 14:20:58 msaitoh Exp $"); #include "opt_ixp425.h" #include "opt_perfctrs.h" @@ -53,8 +53,8 @@ __KERNEL_RCSID(0, "$NetBSD: ixp425_timer #include <arm/xscale/ixp425var.h> #include <arm/xscale/ixp425_sipvar.h> -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: src/sys/arch/arm/xscale/ixp425var.h diff -u src/sys/arch/arm/xscale/ixp425var.h:1.14 src/sys/arch/arm/xscale/ixp425var.h:1.15 --- src/sys/arch/arm/xscale/ixp425var.h:1.14 Fri Sep 28 20:08:13 2012 +++ src/sys/arch/arm/xscale/ixp425var.h Sun Oct 14 14:20:58 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: ixp425var.h,v 1.14 2012/09/28 20:08:13 ryo Exp $ */ +/* $NetBSD: ixp425var.h,v 1.15 2012/10/14 14:20:58 msaitoh Exp $ */ /* * Copyright (c) 2003 @@ -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: src/sys/arch/evbarm/ixdp425/ixdp425_led.c diff -u src/sys/arch/evbarm/ixdp425/ixdp425_led.c:1.5 src/sys/arch/evbarm/ixdp425/ixdp425_led.c:1.6 --- src/sys/arch/evbarm/ixdp425/ixdp425_led.c:1.5 Fri Jul 1 20:42:36 2011 +++ src/sys/arch/evbarm/ixdp425/ixdp425_led.c Sun Oct 14 14:20:58 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: ixdp425_led.c,v 1.5 2011/07/01 20:42:36 dyoung Exp $ */ +/* $NetBSD: ixdp425_led.c,v 1.6 2012/10/14 14:20:58 msaitoh Exp $ */ /* * Copyright (c) 2003 * Ichiro FUKUHARA <ich...@ichiro.org>. @@ -26,7 +26,7 @@ * SUCH DAMAGE. */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ixdp425_led.c,v 1.5 2011/07/01 20:42:36 dyoung Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ixdp425_led.c,v 1.6 2012/10/14 14:20:58 msaitoh Exp $"); /* * LED support for IXDP425 @@ -44,14 +44,13 @@ __KERNEL_RCSID(0, "$NetBSD: ixdp425_led. #include <arm/xscale/ixp425_sipvar.h> #include <arm/xscale/ixp425var.h> -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: src/sys/arch/evbarm/ixdp425/ixdp425_mainbus.c diff -u src/sys/arch/evbarm/ixdp425/ixdp425_mainbus.c:1.8 src/sys/arch/evbarm/ixdp425/ixdp425_mainbus.c:1.9 --- src/sys/arch/evbarm/ixdp425/ixdp425_mainbus.c:1.8 Fri Sep 28 20:08:13 2012 +++ src/sys/arch/evbarm/ixdp425/ixdp425_mainbus.c Sun Oct 14 14:20:58 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: ixdp425_mainbus.c,v 1.8 2012/09/28 20:08:13 ryo Exp $ */ +/* $NetBSD: ixdp425_mainbus.c,v 1.9 2012/10/14 14:20:58 msaitoh Exp $ */ /* * Copyright (c) 2003 @@ -28,7 +28,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ixdp425_mainbus.c,v 1.8 2012/09/28 20:08:13 ryo Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ixdp425_mainbus.c,v 1.9 2012/10/14 14:20:58 msaitoh Exp $"); /* * front-end for the ixp425 NetworkProcessor. @@ -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: src/sys/arch/evbarm/nslu2/nslu2_buttons.c diff -u src/sys/arch/evbarm/nslu2/nslu2_buttons.c:1.3 src/sys/arch/evbarm/nslu2/nslu2_buttons.c:1.4 --- src/sys/arch/evbarm/nslu2/nslu2_buttons.c:1.3 Mon Apr 28 20:23:17 2008 +++ src/sys/arch/evbarm/nslu2/nslu2_buttons.c Sun Oct 14 14:20:58 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: nslu2_buttons.c,v 1.3 2008/04/28 20:23:17 martin Exp $ */ +/* $NetBSD: nslu2_buttons.c,v 1.4 2012/10/14 14:20:58 msaitoh Exp $ */ /*- * Copyright (c) 2006 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: nslu2_buttons.c,v 1.3 2008/04/28 20:23:17 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: nslu2_buttons.c,v 1.4 2012/10/14 14:20:58 msaitoh Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -45,7 +45,7 @@ __KERNEL_RCSID(0, "$NetBSD: nslu2_button #include <evbarm/nslu2/nslu2reg.h> 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: src/sys/arch/evbarm/nslu2/nslu2_mainbus.c diff -u src/sys/arch/evbarm/nslu2/nslu2_mainbus.c:1.3 src/sys/arch/evbarm/nslu2/nslu2_mainbus.c:1.4 --- src/sys/arch/evbarm/nslu2/nslu2_mainbus.c:1.3 Fri Sep 28 20:08:13 2012 +++ src/sys/arch/evbarm/nslu2/nslu2_mainbus.c Sun Oct 14 14:20:58 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: nslu2_mainbus.c,v 1.3 2012/09/28 20:08:13 ryo Exp $ */ +/* $NetBSD: nslu2_mainbus.c,v 1.4 2012/10/14 14:20:58 msaitoh Exp $ */ /*- * Copyright (c) 2006 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: nslu2_mainbus.c,v 1.3 2012/09/28 20:08:13 ryo Exp $"); +__KERNEL_RCSID(0, "$NetBSD: nslu2_mainbus.c,v 1.4 2012/10/14 14:20:58 msaitoh Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -42,19 +42,19 @@ __KERNEL_RCSID(0, "$NetBSD: nslu2_mainbu #include <arm/xscale/ixp425var.h> static int -ixp425_mainbus_match(struct device *parent, struct cfdata *cf, void *arg) +ixp425_mainbus_match(device_t parent, struct cfdata *cf, void *arg) { return (1); } static void -ixp425_mainbus_attach(struct device *parent, struct device *self, void *arg) +ixp425_mainbus_attach(device_t parent, struct device *self, void *arg) { 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: src/sys/arch/evbarm/nslu2/nslu2_iic.c diff -u src/sys/arch/evbarm/nslu2/nslu2_iic.c:1.7 src/sys/arch/evbarm/nslu2/nslu2_iic.c:1.8 --- src/sys/arch/evbarm/nslu2/nslu2_iic.c:1.7 Sat Jun 28 15:00:13 2008 +++ src/sys/arch/evbarm/nslu2/nslu2_iic.c Sun Oct 14 14:20:58 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: nslu2_iic.c,v 1.7 2008/06/28 15:00:13 tsutsui Exp $ */ +/* $NetBSD: nslu2_iic.c,v 1.8 2012/10/14 14:20:58 msaitoh Exp $ */ /*- * Copyright (c) 2006 The NetBSD Foundation, Inc. @@ -45,7 +45,6 @@ #include <evbarm/nslu2/nslu2reg.h> 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: src/sys/arch/evbarm/nslu2/nslu2_leds.c diff -u src/sys/arch/evbarm/nslu2/nslu2_leds.c:1.8 src/sys/arch/evbarm/nslu2/nslu2_leds.c:1.9 --- src/sys/arch/evbarm/nslu2/nslu2_leds.c:1.8 Mon Apr 28 20:23:17 2008 +++ src/sys/arch/evbarm/nslu2/nslu2_leds.c Sun Oct 14 14:20:58 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: nslu2_leds.c,v 1.8 2008/04/28 20:23:17 martin Exp $ */ +/* $NetBSD: nslu2_leds.c,v 1.9 2012/10/14 14:20:58 msaitoh Exp $ */ /*- * Copyright (c) 2006 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: nslu2_leds.c,v 1.8 2008/04/28 20:23:17 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: nslu2_leds.c,v 1.9 2012/10/14 14:20:58 msaitoh Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -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);