Module Name:    src
Committed By:   matt
Date:           Sun Feb 12 16:31:02 UTC 2012

Modified Files:
        src/sys/arch/arm/xscale: becc_button.c i80321.c i80321_aau.c
            i80321_icu.c i80321_pci.c i80321_wdog.c i80321var.h iopaau.c
            iopaauvar.h
        src/sys/arch/evbarm/hdl_g: i80321_mainbus.c
        src/sys/arch/evbarm/iq80321: i80321_mainbus.c
        src/sys/arch/evbarm/ixm1200: ixpcom_ixm.c
        src/sys/arch/iyonix/iyonix: i80321_mainbus.c

Log Message:
Change old-stlye-defintions to C89 prototypes.
Switch to CFATTACH_DECL_NEW/device_t/cfdata_t
Defer attaching interrupt evcnts.

Approved by releng.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/xscale/becc_button.c
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/arm/xscale/i80321.c \
    src/sys/arch/arm/xscale/i80321_icu.c
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/arm/xscale/i80321_aau.c
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/arm/xscale/i80321_pci.c
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/xscale/i80321_wdog.c
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/arm/xscale/i80321var.h
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/arm/xscale/iopaau.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/arm/xscale/iopaauvar.h
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/evbarm/hdl_g/i80321_mainbus.c
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/evbarm/iq80321/i80321_mainbus.c
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/evbarm/ixm1200/ixpcom_ixm.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/iyonix/iyonix/i80321_mainbus.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_button.c
diff -u src/sys/arch/arm/xscale/becc_button.c:1.3 src/sys/arch/arm/xscale/becc_button.c:1.4
--- src/sys/arch/arm/xscale/becc_button.c:1.3	Sun Dec 11 12:16:51 2005
+++ src/sys/arch/arm/xscale/becc_button.c	Sun Feb 12 16:31:01 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: becc_button.c,v 1.3 2005/12/11 12:16:51 christos Exp $	*/
+/*	$NetBSD: becc_button.c,v 1.4 2012/02/12 16:31:01 matt Exp $	*/
 
 /*
  * Copyright (c) 2003 Wasabi Systems, Inc.
@@ -45,7 +45,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: becc_button.c,v 1.3 2005/12/11 12:16:51 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: becc_button.c,v 1.4 2012/02/12 16:31:01 matt Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -60,7 +60,7 @@ __KERNEL_RCSID(0, "$NetBSD: becc_button.
 static int beccbut_attached;	/* there can be only one */
 
 struct beccbut_softc {
-	struct device sc_dev;
+	device_t sc_dev;
 	struct sysmon_pswitch sc_smpsw;
 	void *sc_ih;
 };
@@ -82,44 +82,46 @@ beccbut_intr(void *arg)
 	rv = sysmon_task_queue_sched(0, beccbut_pressed_event, sc);
 	if (rv != 0)
 		printf("%s: WARNING: unable to queue button pressed "
-		    "callback: %d\n", sc->sc_dev.dv_xname, rv);
+		    "callback: %d\n", device_xname(sc->sc_dev), rv);
 
 	return (1);
 }
 
 static int
-beccbut_match(struct device *parent, struct cfdata *match, void *aux)
+beccbut_match(device_t parent, cfdata_t match, void *aux)
 {
 
 	return (beccbut_attached == 0);
 }
 
 static void
-beccbut_attach(struct device *parent, struct device *self, void *aux)
+beccbut_attach(device_t parent, device_t self, void *aux)
 {
-	struct beccbut_softc *sc = (void *) self;
+	struct beccbut_softc *sc = device_private(self);
 
-	printf(": Reset button\n");
+	aprint_normal(": Reset button\n");
+	aprint_naive(": Reset button\n");
 
 	beccbut_attached = 1;
+	sc->sc_dev = self;
 
 	sysmon_task_queue_init();
 
-	sc->sc_smpsw.smpsw_name = sc->sc_dev.dv_xname;
+	sc->sc_smpsw.smpsw_name = device_xname(sc->sc_dev);
 	sc->sc_smpsw.smpsw_type = PSWITCH_TYPE_RESET;
 
 	if (sysmon_pswitch_register(&sc->sc_smpsw) != 0) {
-		printf("%s: unable to register with sysmon\n",
-		    sc->sc_dev.dv_xname);
+		aprint_error_dev(sc->sc_dev,
+		    "unable to register with sysmon\n");
 		return;
 	}
 
 	sc->sc_ih = becc_intr_establish(ICU_PUSHBUTTON, IPL_TTY,
 	    beccbut_intr, sc);
 	if (sc->sc_ih == NULL)
-		printf("%s: unable to establish interrupt handler\n",
-		    sc->sc_dev.dv_xname);
+		aprint_error_dev(sc->sc_dev,
+		    "unable to establish interrupt handler\n");
 }
 
-CFATTACH_DECL(beccbut, sizeof(struct beccbut_softc),
+CFATTACH_DECL_NEW(beccbut, sizeof(struct beccbut_softc),
     beccbut_match, beccbut_attach, NULL, NULL);

Index: src/sys/arch/arm/xscale/i80321.c
diff -u src/sys/arch/arm/xscale/i80321.c:1.22 src/sys/arch/arm/xscale/i80321.c:1.23
--- src/sys/arch/arm/xscale/i80321.c:1.22	Fri Jul  1 20:32:51 2011
+++ src/sys/arch/arm/xscale/i80321.c	Sun Feb 12 16:31:01 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: i80321.c,v 1.22 2011/07/01 20:32:51 dyoung Exp $	*/
+/*	$NetBSD: i80321.c,v 1.23 2012/02/12 16:31:01 matt Exp $	*/
 
 /*
  * Copyright (c) 2002 Wasabi Systems, Inc.
@@ -40,7 +40,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: i80321.c,v 1.22 2011/07/01 20:32:51 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i80321.c,v 1.23 2012/02/12 16:31:01 matt Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -110,7 +110,7 @@ i80321_attach(struct i80321_softc *sc)
 	if (bus_space_subregion(sc->sc_st, sc->sc_sh, VERDE_ATU_BASE,
 	    VERDE_ATU_SIZE, &sc->sc_atu_sh))
 		panic("%s: unable to subregion ATU registers",
-		    sc->sc_dev.dv_xname);
+		    device_xname(sc->sc_dev));
 
 	/* We expect the Memory Controller to be already sliced off. */
 
@@ -266,7 +266,7 @@ i80321_attach(struct i80321_softc *sc)
 		ia.ia_offset = id->id_offset;
 		ia.ia_size = id->id_size;
 
-		(void) config_found_ia(&sc->sc_dev, "iopxs", &ia,
+		(void) config_found_ia(sc->sc_dev, "iopxs", &ia,
 				       i80321_iopxs_print);
 	}
 
@@ -288,7 +288,7 @@ i80321_attach(struct i80321_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);
 }
 
 /*
Index: src/sys/arch/arm/xscale/i80321_icu.c
diff -u src/sys/arch/arm/xscale/i80321_icu.c:1.22 src/sys/arch/arm/xscale/i80321_icu.c:1.23
--- src/sys/arch/arm/xscale/i80321_icu.c:1.22	Fri Jul  1 20:32:51 2011
+++ src/sys/arch/arm/xscale/i80321_icu.c	Sun Feb 12 16:31:01 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: i80321_icu.c,v 1.22 2011/07/01 20:32:51 dyoung Exp $	*/
+/*	$NetBSD: i80321_icu.c,v 1.23 2012/02/12 16:31:01 matt Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2006 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: i80321_icu.c,v 1.22 2011/07/01 20:32:51 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i80321_icu.c,v 1.23 2012/02/12 16:31:01 matt Exp $");
 
 #ifndef EVBARM_SPL_NOINLINE
 #define	EVBARM_SPL_NOINLINE
@@ -280,9 +280,6 @@ i80321_intr_init(void)
 	for (i = 0; i < NIRQ; i++) {
 		iq = &intrq[i];
 		TAILQ_INIT(&iq->iq_list);
-
-		evcnt_attach_dynamic(&iq->iq_ev, EVCNT_TYPE_INTR,
-		    NULL, "iop321", i80321_irqnames[i]);
 	}
 
 	i80321_intr_calculate_masks();
@@ -291,6 +288,17 @@ i80321_intr_init(void)
 	enable_interrupts(I32_bit);
 }
 
+void
+i80321_intr_evcnt_attach(void)
+{
+	for (u_int i = 0; i < NIRQ; i++) {
+		struct intrq *iq = &intrq[i];
+		evcnt_attach_dynamic(&iq->iq_ev, EVCNT_TYPE_INTR,
+		    NULL, "iop321", i80321_irqnames[i]);
+	}
+
+}
+
 void *
 i80321_intr_establish(int irq, int ipl, int (*func)(void *), void *arg)
 {

Index: src/sys/arch/arm/xscale/i80321_aau.c
diff -u src/sys/arch/arm/xscale/i80321_aau.c:1.14 src/sys/arch/arm/xscale/i80321_aau.c:1.15
--- src/sys/arch/arm/xscale/i80321_aau.c:1.14	Mon Jan  5 04:39:32 2009
+++ src/sys/arch/arm/xscale/i80321_aau.c	Sun Feb 12 16:31:01 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: i80321_aau.c,v 1.14 2009/01/05 04:39:32 briggs Exp $	*/
+/*	$NetBSD: i80321_aau.c,v 1.15 2012/02/12 16:31:01 matt Exp $	*/
 
 /*
  * Copyright (c) 2002 Wasabi Systems, Inc.
@@ -40,7 +40,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: i80321_aau.c,v 1.14 2009/01/05 04:39:32 briggs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i80321_aau.c,v 1.15 2012/02/12 16:31:01 matt Exp $");
 
 #include <sys/param.h>
 #include <sys/pool.h>
@@ -139,7 +139,7 @@ static const struct dmover_algdesc aau32
 #define	AAU321_ALGDESC_COUNT	__arraycount(aau321_algdescs)
 
 static int
-aau321_match(struct device *parent, struct cfdata *match, void *aux)
+aau321_match(device_t parent, cfdata_t match, void *aux)
 {
 	struct iopxs_attach_args *ia = aux;
 
@@ -150,22 +150,24 @@ aau321_match(struct device *parent, stru
 }
 
 static void
-aau321_attach(struct device *parent, struct device *self, void *aux)
+aau321_attach(device_t parent, device_t self, void *aux)
 {
-	struct aau321_softc *sc321 = (void *) self;
+	struct aau321_softc *sc321 = device_private(self);
 	struct iopaau_softc *sc = &sc321->sc_iopaau;
 	struct iopxs_attach_args *ia = aux;
+	const char *xname = device_xname(self);
 	int error;
 
 	aprint_naive("\n");
 	aprint_normal("\n");
 
+	sc->sc_dev = self;
 	sc->sc_st = ia->ia_st;
 	error = bus_space_subregion(sc->sc_st, ia->ia_sh,
 	    ia->ia_offset, ia->ia_size, &sc->sc_sh);
 	if (error) {
 		aprint_error("%s: unable to subregion registers, error = %d\n",
-		    sc->sc_dev.dv_xname, error);
+		    xname, error);
 		return;
 	}
 
@@ -175,7 +177,7 @@ aau321_attach(struct device *parent, str
 	    iopaau_intr, sc);
 	if (sc321->sc_error_ih == NULL) {
 		aprint_error("%s: unable to register error interrupt handler\n",
-		    sc->sc_dev.dv_xname);
+		    xname);
 		return;
 	}
 
@@ -183,7 +185,7 @@ aau321_attach(struct device *parent, str
 	    iopaau_intr, sc);
 	if (sc321->sc_eoc_ih == NULL) {
 		aprint_error("%s: unable to register EOC interrupt handler\n",
-		    sc->sc_dev.dv_xname);
+		    xname);
 		return;
 	}
 
@@ -191,11 +193,11 @@ aau321_attach(struct device *parent, str
 	    iopaau_intr, sc);
 	if (sc321->sc_eoc_ih == NULL) {
 		aprint_error("%s: unable to register EOT interrupt handler\n",
-		    sc->sc_dev.dv_xname);
+		    xname);
 		return;
 	}
 
-	sc->sc_dmb.dmb_name = sc->sc_dev.dv_xname;
+	sc->sc_dmb.dmb_name = xname;
 	sc->sc_dmb.dmb_speed = 1638400;			/* XXX */
 	sc->sc_dmb.dmb_cookie = sc;
 	sc->sc_dmb.dmb_algdescs = aau321_algdescs;
@@ -217,5 +219,5 @@ aau321_attach(struct device *parent, str
 	aau321_func_xor_5_8.af_desc_cache = iopaau_desc_8_cache;
 }
 
-CFATTACH_DECL(iopaau, sizeof(struct aau321_softc),
+CFATTACH_DECL_NEW(iopaau, sizeof(struct aau321_softc),
     aau321_match, aau321_attach, NULL, NULL);

Index: src/sys/arch/arm/xscale/i80321_pci.c
diff -u src/sys/arch/arm/xscale/i80321_pci.c:1.11 src/sys/arch/arm/xscale/i80321_pci.c:1.12
--- src/sys/arch/arm/xscale/i80321_pci.c:1.11	Fri Jan 27 18:52:51 2012
+++ src/sys/arch/arm/xscale/i80321_pci.c	Sun Feb 12 16:31:01 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: i80321_pci.c,v 1.11 2012/01/27 18:52:51 para Exp $	*/
+/*	$NetBSD: i80321_pci.c,v 1.12 2012/02/12 16:31:01 matt 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.11 2012/01/27 18:52:51 para Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i80321_pci.c,v 1.12 2012/02/12 16:31:01 matt Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -122,7 +122,7 @@ i80321_pci_init(pci_chipset_tag_t pc, vo
 	    NULL, 0, EX_NOWAIT);
 #endif
 
-	aprint_normal("%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, busno, arm_dcache_align);
 
 	extent_destroy(ioext);

Index: src/sys/arch/arm/xscale/i80321_wdog.c
diff -u src/sys/arch/arm/xscale/i80321_wdog.c:1.9 src/sys/arch/arm/xscale/i80321_wdog.c:1.10
--- src/sys/arch/arm/xscale/i80321_wdog.c:1.9	Fri Jul  1 20:32:51 2011
+++ src/sys/arch/arm/xscale/i80321_wdog.c	Sun Feb 12 16:31:01 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: i80321_wdog.c,v 1.9 2011/07/01 20:32:51 dyoung Exp $	*/
+/*	$NetBSD: i80321_wdog.c,v 1.10 2012/02/12 16:31:01 matt Exp $	*/
 
 /*
  * Copyright (c) 2002 Wasabi Systems, Inc.
@@ -40,7 +40,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: i80321_wdog.c,v 1.9 2011/07/01 20:32:51 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i80321_wdog.c,v 1.10 2012/02/12 16:31:01 matt Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -56,7 +56,7 @@ __KERNEL_RCSID(0, "$NetBSD: i80321_wdog.
 #include <dev/sysmon/sysmonvar.h>
 
 struct iopwdog_softc {
-	struct device sc_dev;
+	device_t sc_dev;
 	struct sysmon_wdog sc_smw;
 	int sc_wdog_armed;
 	int sc_wdog_period;
@@ -104,7 +104,7 @@ iopwdog_setmode(struct sysmon_wdog *smw)
 }
 
 static int
-iopwdog_match(struct device *parent, struct cfdata *cf, void *aux)
+iopwdog_match(device_t parent, cfdata_t cf, void *aux)
 {
 	struct iopxs_attach_args *ia = aux;
 
@@ -115,10 +115,12 @@ iopwdog_match(struct device *parent, str
 }
 
 static void
-iopwdog_attach(struct device *parent, struct device *self, void *aux)
+iopwdog_attach(device_t parent, device_t self, void *aux)
 {
-	struct iopwdog_softc *sc = (void *) self;
+	struct iopwdog_softc *sc = device_private(self);
+	const char *xname = device_xname(self);
 
+	sc->sc_dev = self;
 	/*
 	 * XXX Should compute the period based on processor speed.
 	 * For a 600MHz XScale core, the wdog must be tickled approx.
@@ -129,16 +131,16 @@ iopwdog_attach(struct device *parent, st
 	aprint_naive(": Watchdog timer\n");
 	aprint_normal(": %d second period\n", sc->sc_wdog_period);
 
-	sc->sc_smw.smw_name = sc->sc_dev.dv_xname;
+	sc->sc_smw.smw_name = xname;
 	sc->sc_smw.smw_cookie = sc;
 	sc->sc_smw.smw_setmode = iopwdog_setmode;
 	sc->sc_smw.smw_tickle = iopwdog_tickle;
 	sc->sc_smw.smw_period = sc->sc_wdog_period;
 
 	if (sysmon_wdog_register(&sc->sc_smw) != 0)
-		aprint_error("%s: unable to register with sysmon\n",
-		    sc->sc_dev.dv_xname);
+		aprint_error_dev(sc->sc_dev,
+		    "unable to register with sysmon\n");
 }
 
-CFATTACH_DECL(iopwdog, sizeof(struct iopwdog_softc),
+CFATTACH_DECL_NEW(iopwdog, sizeof(struct iopwdog_softc),
     iopwdog_match, iopwdog_attach, NULL, NULL);

Index: src/sys/arch/arm/xscale/i80321var.h
diff -u src/sys/arch/arm/xscale/i80321var.h:1.12 src/sys/arch/arm/xscale/i80321var.h:1.13
--- src/sys/arch/arm/xscale/i80321var.h:1.12	Sun Apr 27 18:58:45 2008
+++ src/sys/arch/arm/xscale/i80321var.h	Sun Feb 12 16:31:01 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: i80321var.h,v 1.12 2008/04/27 18:58:45 matt Exp $	*/
+/*	$NetBSD: i80321var.h,v 1.13 2012/02/12 16:31:01 matt Exp $	*/
 
 /*
  * Copyright (c) 2002, 2003 Wasabi Systems, Inc.
@@ -65,7 +65,7 @@ struct intrq {
 };
 
 struct i80321_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 */
@@ -175,6 +175,7 @@ void	i80321_calibrate_delay(void);
 
 void	i80321_icu_init(void);
 void	i80321_intr_init(void);
+void	i80321_intr_evcnt_attach(void);
 void	*i80321_intr_establish(int, int, int (*)(void *), void *);
 void	i80321_intr_disestablish(void *);
 

Index: src/sys/arch/arm/xscale/iopaau.c
diff -u src/sys/arch/arm/xscale/iopaau.c:1.16 src/sys/arch/arm/xscale/iopaau.c:1.17
--- src/sys/arch/arm/xscale/iopaau.c:1.16	Sat Jan  5 00:31:55 2008
+++ src/sys/arch/arm/xscale/iopaau.c	Sun Feb 12 16:31:01 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: iopaau.c,v 1.16 2008/01/05 00:31:55 ad Exp $	*/
+/*	$NetBSD: iopaau.c,v 1.17 2012/02/12 16:31:01 matt Exp $	*/
 
 /*
  * Copyright (c) 2002 Wasabi Systems, Inc.
@@ -43,7 +43,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: iopaau.c,v 1.16 2008/01/05 00:31:55 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: iopaau.c,v 1.17 2012/02/12 16:31:01 matt Exp $");
 
 #include <sys/param.h>
 #include <sys/pool.h>
@@ -151,7 +151,7 @@ iopaau_start(struct iopaau_softc *sc)
 			panic("iopaau_start: AAU already active");
 #endif
 
-		DPRINTF(("%s: starting dreq %p\n", sc->sc_dev.dv_xname,
+		DPRINTF(("%s: starting dreq %p\n", device_xname(sc->sc_dev),
 		    dreq));
 
 		bus_space_write_4(sc->sc_st, sc->sc_sh, AAU_ANDAR,
@@ -588,7 +588,7 @@ iopaau_intr(void *arg)
 	/* XXX -- why does this happen? */
 	if (sc->sc_running == NULL) {
 		printf("%s: unexpected interrupt, ASR = 0x%08x\n",
-		    sc->sc_dev.dv_xname, asr);
+		    device_xname(sc->sc_dev), asr);
 		return (1);
 	}
 	dreq = sc->sc_running;
@@ -596,7 +596,7 @@ iopaau_intr(void *arg)
 	/* Stop the AAU. */
 	bus_space_write_4(sc->sc_st, sc->sc_sh, AAU_ACR, 0);
 
-	DPRINTF(("%s: got interrupt for dreq %p\n", sc->sc_dev.dv_xname,
+	DPRINTF(("%s: got interrupt for dreq %p\n", device_xname(sc->sc_dev),
 	    dreq));
 
 	if (__predict_false((asr & AAU_ASR_ETIF) != 0)) {
@@ -609,7 +609,7 @@ iopaau_intr(void *arg)
 	}
 
 	if (__predict_false((asr & AAU_ASR_MA) != 0)) {
-		printf("%s: WARNING: got master abort\n", sc->sc_dev.dv_xname);
+		aprint_error_dev(sc->sc_dev, "WARNING: got master abort\n");
 		dreq->dreq_flags |= DMOVER_REQ_ERROR;
 		dreq->dreq_error = EFAULT;
 	}
@@ -628,9 +628,8 @@ iopaau_attach(struct iopaau_softc *sc)
 	error = bus_dmamap_create(sc->sc_dmat, AAU_MAX_XFER, AAU_MAX_SEGS,
 	    AAU_MAX_XFER, AAU_IO_BOUNDARY, 0, &sc->sc_map_out);
 	if (error) {
-		aprint_error(
-		    "%s: unable to create output DMA map, error = %d\n",
-		    sc->sc_dev.dv_xname, error);
+		aprint_error_dev(sc->sc_dev,
+		    "unable to create output DMA map, error = %d\n", error);
 		return;
 	}
 
@@ -639,8 +638,9 @@ iopaau_attach(struct iopaau_softc *sc)
 		    AAU_MAX_SEGS, AAU_MAX_XFER, AAU_IO_BOUNDARY, 0,
 		    &sc->sc_map_in[i]);
 		if (error) {
-			aprint_error("%s: unable to create input %d DMA map, "
-			    "error = %d\n", sc->sc_dev.dv_xname, i, error);
+			aprint_error_dev(sc->sc_dev,
+			    "unable to create input %d DMA map, error = %d\n",
+			    i, error);
 			return;
 		}
 	}

Index: src/sys/arch/arm/xscale/iopaauvar.h
diff -u src/sys/arch/arm/xscale/iopaauvar.h:1.7 src/sys/arch/arm/xscale/iopaauvar.h:1.8
--- src/sys/arch/arm/xscale/iopaauvar.h:1.7	Sun Apr 27 18:58:45 2008
+++ src/sys/arch/arm/xscale/iopaauvar.h	Sun Feb 12 16:31:01 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: iopaauvar.h,v 1.7 2008/04/27 18:58:45 matt Exp $	*/
+/*	$NetBSD: iopaauvar.h,v 1.8 2012/02/12 16:31:01 matt Exp $	*/
 
 /*
  * Copyright (c) 2002 Wasabi Systems, Inc.
@@ -54,7 +54,7 @@
 #define	AAU_IO_BOUNDARY		4096
 
 struct iopaau_softc {
-	struct device sc_dev;
+	device_t sc_dev;
 	struct dmover_backend sc_dmb;
 
 	struct dmover_request *sc_running;

Index: src/sys/arch/evbarm/hdl_g/i80321_mainbus.c
diff -u src/sys/arch/evbarm/hdl_g/i80321_mainbus.c:1.2 src/sys/arch/evbarm/hdl_g/i80321_mainbus.c:1.3
--- src/sys/arch/evbarm/hdl_g/i80321_mainbus.c:1.2	Fri Jul  1 20:39:34 2011
+++ src/sys/arch/evbarm/hdl_g/i80321_mainbus.c	Sun Feb 12 16:31:01 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: i80321_mainbus.c,v 1.2 2011/07/01 20:39:34 dyoung Exp $	*/
+/*	$NetBSD: i80321_mainbus.c,v 1.3 2012/02/12 16:31:01 matt Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: i80321_mainbus.c,v 1.2 2011/07/01 20:39:34 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i80321_mainbus.c,v 1.3 2012/02/12 16:31:01 matt Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -54,17 +54,17 @@ __KERNEL_RCSID(0, "$NetBSD: i80321_mainb
 #include <dev/pci/pcireg.h>
 #include <dev/pci/pcidevs.h>
 
-int	hdlg_mainbus_match(struct device *, struct cfdata *, void *);
-void	hdlg_mainbus_attach(struct device *, struct device *, void *);
+int	hdlg_mainbus_match(device_t, cfdata_t, void *);
+void	hdlg_mainbus_attach(device_t, device_t, void *);
 
-CFATTACH_DECL(iopxs_mainbus, sizeof(struct i80321_softc),
+CFATTACH_DECL_NEW(iopxs_mainbus, sizeof(struct i80321_softc),
     hdlg_mainbus_match, hdlg_mainbus_attach, NULL, NULL);
 
 /* There can be only one. */
 int	hdlg_mainbus_found;
 
 int
-hdlg_mainbus_match(struct device *parent, struct cfdata *cf, void *aux)
+hdlg_mainbus_match(device_t parent, cfdata_t cf, void *aux)
 {
 
 	if (hdlg_mainbus_found)
@@ -73,14 +73,15 @@ hdlg_mainbus_match(struct device *parent
 }
 
 void
-hdlg_mainbus_attach(struct device *parent, struct device *self, void *aux)
+hdlg_mainbus_attach(device_t parent, device_t self, void *aux)
 {
-	struct i80321_softc *sc = (void *) self;
+	struct i80321_softc *sc = device_private(self);
 	pcireg_t b0u, b0l, b1u, b1l;
 	paddr_t memstart;
 	psize_t memsize;
 
 	hdlg_mainbus_found = 1;
+	sc->sc_dev = self;
 
 	/*
 	 * Fill in the space tag for the i80321's own devices,
@@ -98,12 +99,12 @@ hdlg_mainbus_attach(struct device *paren
 	if (bus_space_subregion(sc->sc_st, sc->sc_sh, VERDE_MCU_BASE,
 	    VERDE_MCU_SIZE, &sc->sc_mcu_sh))
 		panic("%s: unable to subregion MCU registers",
-		    device_xname(&sc->sc_dev));
+		    device_xname(sc->sc_dev));
 
 	if (bus_space_subregion(sc->sc_st, sc->sc_sh, VERDE_ATU_BASE,
 	    VERDE_ATU_SIZE, &sc->sc_atu_sh))
 		panic("%s: unable to subregion ATU registers",
-		    device_xname(&sc->sc_dev));
+		    device_xname(sc->sc_dev));
 
 	/*
 	 * We have mapped the PCI I/O windows in the early bootstrap phase.
@@ -137,6 +138,8 @@ hdlg_mainbus_attach(struct device *paren
 	aprint_normal(": i80219 I/O Processor, acting as PCI %s\n",
 	    sc->sc_is_host ? "host" : "slave");
 
+	i80321_intr_evcnt_attach();
+
 	i80321_sdram_bounds(sc->sc_st, sc->sc_mcu_sh, &memstart, &memsize);
 
 	/*

Index: src/sys/arch/evbarm/iq80321/i80321_mainbus.c
diff -u src/sys/arch/evbarm/iq80321/i80321_mainbus.c:1.17 src/sys/arch/evbarm/iq80321/i80321_mainbus.c:1.18
--- src/sys/arch/evbarm/iq80321/i80321_mainbus.c:1.17	Fri Jul  1 20:41:16 2011
+++ src/sys/arch/evbarm/iq80321/i80321_mainbus.c	Sun Feb 12 16:31:01 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: i80321_mainbus.c,v 1.17 2011/07/01 20:41:16 dyoung Exp $	*/
+/*	$NetBSD: i80321_mainbus.c,v 1.18 2012/02/12 16:31:01 matt Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002 Wasabi Systems, Inc.
@@ -42,7 +42,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: i80321_mainbus.c,v 1.17 2011/07/01 20:41:16 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i80321_mainbus.c,v 1.18 2012/02/12 16:31:01 matt Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -60,17 +60,17 @@ __KERNEL_RCSID(0, "$NetBSD: i80321_mainb
 #include <dev/pci/pcireg.h>
 #include <dev/pci/pcidevs.h>
 
-int	i80321_mainbus_match(struct device *, struct cfdata *, void *);
-void	i80321_mainbus_attach(struct device *, struct device *, void *);
+int	i80321_mainbus_match(device_t, cfdata_t, void *);
+void	i80321_mainbus_attach(device_t, device_t, void *);
 
-CFATTACH_DECL(iopxs_mainbus, sizeof(struct i80321_softc),
+CFATTACH_DECL_NEW(iopxs_mainbus, sizeof(struct i80321_softc),
     i80321_mainbus_match, i80321_mainbus_attach, NULL, NULL);
 
 /* There can be only one. */
 int	i80321_mainbus_found;
 
 int
-i80321_mainbus_match(struct device *parent, struct cfdata *cf, void *aux)
+i80321_mainbus_match(device_t parent, cfdata_t cf, void *aux)
 {
 #if 0
 	struct mainbus_attach_args *ma = aux;
@@ -91,13 +91,15 @@ i80321_mainbus_match(struct device *pare
 }
 
 void
-i80321_mainbus_attach(struct device *parent, struct device *self, void *aux)
+i80321_mainbus_attach(device_t parent, device_t self, void *aux)
 {
-	struct i80321_softc *sc = (void *) self;
+	struct i80321_softc *sc = device_private(self);
+	const char *xname = device_xname(self);
 	pcireg_t b0u, b0l, b1u, b1l;
 	paddr_t memstart;
 	psize_t memsize;
 
+	sc->sc_dev = self;
 	i80321_mainbus_found = 1;
 
 	/*
@@ -115,13 +117,11 @@ i80321_mainbus_attach(struct device *par
 	 */
 	if (bus_space_subregion(sc->sc_st, sc->sc_sh, VERDE_MCU_BASE,
 	    VERDE_MCU_SIZE, &sc->sc_mcu_sh))
-		panic("%s: unable to subregion MCU registers",
-		    sc->sc_dev.dv_xname);
+		panic("%s: unable to subregion MCU registers", xname);
 
 	if (bus_space_subregion(sc->sc_st, sc->sc_sh, VERDE_ATU_BASE,
 	    VERDE_ATU_SIZE, &sc->sc_atu_sh))
-		panic("%s: unable to subregion ATU registers",
-		    sc->sc_dev.dv_xname);
+		panic("%s: unable to subregion ATU registers", xname);
 
 	/*
 	 * We have mapped the PCI I/O windows in the early bootstrap phase.
@@ -155,6 +155,8 @@ i80321_mainbus_attach(struct device *par
 	aprint_normal(": i80321 I/O Processor, acting as PCI %s\n",
 	    sc->sc_is_host ? "host" : "slave");
 
+	i80321_intr_evcnt_attach();
+
 	i80321_sdram_bounds(sc->sc_st, sc->sc_mcu_sh, &memstart, &memsize);
 
 	/*

Index: src/sys/arch/evbarm/ixm1200/ixpcom_ixm.c
diff -u src/sys/arch/evbarm/ixm1200/ixpcom_ixm.c:1.9 src/sys/arch/evbarm/ixm1200/ixpcom_ixm.c:1.10
--- src/sys/arch/evbarm/ixm1200/ixpcom_ixm.c:1.9	Fri Jul  1 20:42:37 2011
+++ src/sys/arch/evbarm/ixm1200/ixpcom_ixm.c	Sun Feb 12 16:31:01 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: ixpcom_ixm.c,v 1.9 2011/07/01 20:42:37 dyoung Exp $ */
+/*	$NetBSD: ixpcom_ixm.c,v 1.10 2012/02/12 16:31:01 matt Exp $ */
 /*
  * Copyright (c) 2002
  *	Ichiro FUKUHARA <ich...@ichiro.org>.
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ixpcom_ixm.c,v 1.9 2011/07/01 20:42:37 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixpcom_ixm.c,v 1.10 2012/02/12 16:31:01 matt Exp $");
 
 /* Front-end of ixpcom */
 
@@ -50,14 +50,14 @@ __KERNEL_RCSID(0, "$NetBSD: ixpcom_ixm.c
 
 #include <evbarm/ixm1200/ixpcom_ixmvar.h>
 
-static int	ixpcom_ixm_match(struct device *, struct cfdata *, void *);
-static void	ixpcom_ixm_attach(struct device *, struct device *, void *);
+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),
     ixpcom_ixm_match, ixpcom_ixm_attach, NULL, NULL);
 
 static int
-ixpcom_ixm_match(struct device *parent, struct cfdata *match, void *aux)
+ixpcom_ixm_match(device_t parent, cfdata_t match, void *aux)
 {
 	if (strcmp(match->cf_name, "ixpcom") == 0)
 		return 1;
@@ -65,12 +65,9 @@ ixpcom_ixm_match(struct device *parent, 
 }
 
 static void
-ixpcom_ixm_attach(parent, self, aux)
-	struct device *parent;
-	struct device *self;  
-	void *aux;
+ixpcom_ixm_attach(device_t parent, device_t self, void *aux)
 {
-	struct ixpcom_ixm_softc *isc = (struct ixpcom_ixm_softc *)self;
+	struct ixpcom_ixm_softc *isc = device_private(self);
 	struct ixpcom_softc *sc = &isc->sc_ixpcom;
 	struct ixpsip_attach_args *sa = aux;
 
@@ -78,15 +75,13 @@ ixpcom_ixm_attach(parent, self, aux)
 	sc->sc_iot = sa->sa_iot;
 	sc->sc_baseaddr = sa->sa_addr;
 
-	printf("\n");
-
 	if (bus_space_map(sa->sa_iot, sa->sa_addr, sa->sa_size, 0,
 			 &sc->sc_ioh)) {
-		printf("%s: unable to map device\n", sc->sc_dev.dv_xname);
+		aprint_error(": unable to map device\n");
 		return;
 	}
 
-	printf("%s: IXP12x0 UART\n", sc->sc_dev.dv_xname);
+	aprint_normal(": IXP12x0 UART\n");
 
 	ixpcom_attach_subr(sc);
 

Index: src/sys/arch/iyonix/iyonix/i80321_mainbus.c
diff -u src/sys/arch/iyonix/iyonix/i80321_mainbus.c:1.5 src/sys/arch/iyonix/iyonix/i80321_mainbus.c:1.6
--- src/sys/arch/iyonix/iyonix/i80321_mainbus.c:1.5	Fri Jul  1 20:48:23 2011
+++ src/sys/arch/iyonix/iyonix/i80321_mainbus.c	Sun Feb 12 16:31:01 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: i80321_mainbus.c,v 1.5 2011/07/01 20:48:23 dyoung Exp $	*/
+/*	$NetBSD: i80321_mainbus.c,v 1.6 2012/02/12 16:31:01 matt Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002 Wasabi Systems, Inc.
@@ -42,7 +42,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: i80321_mainbus.c,v 1.5 2011/07/01 20:48:23 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i80321_mainbus.c,v 1.6 2012/02/12 16:31:01 matt Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -60,17 +60,17 @@ __KERNEL_RCSID(0, "$NetBSD: i80321_mainb
 #include <dev/pci/pcireg.h>
 #include <dev/pci/pcidevs.h>
 
-int	i80321_mainbus_match(struct device *, struct cfdata *, void *);
-void	i80321_mainbus_attach(struct device *, struct device *, void *);
+int	i80321_mainbus_match(device_t, cfdata_t, void *);
+void	i80321_mainbus_attach(device_t, device_t, void *);
 
-CFATTACH_DECL(iopxs_mainbus, sizeof(struct i80321_softc),
+CFATTACH_DECL_NEW(iopxs_mainbus, sizeof(struct i80321_softc),
     i80321_mainbus_match, i80321_mainbus_attach, NULL, NULL);
 
 /* There can be only one. */
 int	i80321_mainbus_found;
 
 int
-i80321_mainbus_match(struct device *parent, struct cfdata *cf, void *aux)
+i80321_mainbus_match(device_t parent, cfdata_t cf, void *aux)
 {
 #if 0
 	struct mainbus_attach_args *ma = aux;
@@ -91,14 +91,15 @@ i80321_mainbus_match(struct device *pare
 }
 
 void
-i80321_mainbus_attach(struct device *parent, struct device *self, void *aux)
+i80321_mainbus_attach(device_t parent, device_t self, void *aux)
 {
-	struct i80321_softc *sc = (void *) self;
+	struct i80321_softc *sc = device_private(self);
 	pcireg_t b0u, b0l, b1u, b1l;
 	paddr_t memstart;
 	psize_t memsize;
 
 	i80321_mainbus_found = 1;
+	sc->sc_dev = self;
 
 	/*
 	 * Fill in the space tag for the i80321's own devices,
@@ -116,12 +117,12 @@ i80321_mainbus_attach(struct device *par
 	if (bus_space_subregion(sc->sc_st, sc->sc_sh, VERDE_MCU_BASE,
 	    VERDE_MCU_SIZE, &sc->sc_mcu_sh))
 		panic("%s: unable to subregion MCU registers",
-		    sc->sc_dev.dv_xname);
+		    device_xname(self));
 
 	if (bus_space_subregion(sc->sc_st, sc->sc_sh, VERDE_ATU_BASE,
 	    VERDE_ATU_SIZE, &sc->sc_atu_sh))
 		panic("%s: unable to subregion ATU registers",
-		    sc->sc_dev.dv_xname);
+		    device_xname(self));
 
 	/*
 	 * We have mapped the PCI I/O windows in the early bootstrap phase.
@@ -151,6 +152,8 @@ i80321_mainbus_attach(struct device *par
 	aprint_normal(": i80321 I/O Processor, acting as PCI %s\n",
 	    sc->sc_is_host ? "host" : "slave");
 
+	i80321_intr_evcnt_attach();
+
 	i80321_sdram_bounds(sc->sc_st, sc->sc_mcu_sh, &memstart, &memsize);
 
 	/*

Reply via email to