Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys Split device_t/softc. pmax is tested on GXemul, compile ...



details:   https://anonhg.NetBSD.org/src/rev/553901817b68
branches:  trunk
changeset: 765727:553901817b68
user:      tsutsui <tsutsui%NetBSD.org@localhost>
date:      Sat Jun 04 01:49:43 2011 +0000

description:
Split device_t/softc. pmax is tested on GXemul, compile test only for alpha.

diffstat:

 sys/arch/alpha/tc/ioasic.c |  21 +++++++++++----------
 sys/arch/pmax/tc/ioasic.c  |  24 +++++++++++++-----------
 sys/dev/tc/ioasic_subr.c   |   6 +++---
 sys/dev/tc/ioasicvar.h     |   4 ++--
 4 files changed, 29 insertions(+), 26 deletions(-)

diffs (204 lines):

diff -r 670656aa90ad -r 553901817b68 sys/arch/alpha/tc/ioasic.c
--- a/sys/arch/alpha/tc/ioasic.c        Sat Jun 04 01:43:56 2011 +0000
+++ b/sys/arch/alpha/tc/ioasic.c        Sat Jun 04 01:49:43 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ioasic.c,v 1.42 2009/03/14 21:04:03 dsl Exp $ */
+/* $NetBSD: ioasic.c,v 1.43 2011/06/04 01:49:43 tsutsui Exp $ */
 
 /*-
  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
 
 #include <sys/cdefs.h>                 /* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: ioasic.c,v 1.42 2009/03/14 21:04:03 dsl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ioasic.c,v 1.43 2011/06/04 01:49:43 tsutsui Exp $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -79,10 +79,10 @@
 #include <dev/tc/ioasicvar.h>
 
 /* Definition of the driver for autoconfig. */
-int    ioasicmatch(struct device *, struct cfdata *, void *);
-void   ioasicattach(struct device *, struct device *, void *);
+int    ioasicmatch(device_t, cfdata_t, void *);
+void   ioasicattach(device_t, device_t, void *);
 
-CFATTACH_DECL(ioasic, sizeof(struct ioasic_softc),
+CFATTACH_DECL_NEW(ioasic, sizeof(struct ioasic_softc),
     ioasicmatch, ioasicattach, NULL, NULL);
 
 int    ioasic_intr(void *);
@@ -125,7 +125,7 @@
 int ioasicfound;
 
 int
-ioasicmatch(struct device *parent, struct cfdata *cfdata, void *aux)
+ioasicmatch(device_t parent, cfdata_t cf, void *aux)
 {
        struct tc_attach_args *ta = aux;
 
@@ -144,9 +144,9 @@
 }
 
 void
-ioasicattach(struct device *parent, struct device *self, void *aux)
+ioasicattach(device_t parent, device_t self, void *aux)
 {
-       struct ioasic_softc *sc = (struct ioasic_softc *)self;
+       struct ioasic_softc *sc = device_private(self);
        struct tc_attach_args *ta = aux;
 #ifdef DEC_3000_300
        u_long ssr;
@@ -157,10 +157,11 @@
 
        ioasicfound = 1;
 
+       sc->sc_dev = self;
        sc->sc_bst = ta->ta_memt; 
        if (bus_space_map(ta->ta_memt, ta->ta_addr,
                        0x400000, 0, &sc->sc_bsh)) {
-               printf("%s: unable to map device\n", sc->sc_dv.dv_xname);
+               printf("%s: unable to map device\n", device_xname(self));
                return;
        }
        sc->sc_dmat = ta->ta_dmat;
@@ -199,7 +200,7 @@
                        panic("ioasicattach");
                sprintf(cp, "slot %lu", i);
                evcnt_attach_dynamic(&ioasicintrs[i].iai_evcnt,
-                   EVCNT_TYPE_INTR, pevcnt, self->dv_xname, cp);
+                   EVCNT_TYPE_INTR, pevcnt, device_xname(self), cp);
        }
        tc_intr_establish(parent, ta->ta_cookie, TC_IPL_NONE, ioasic_intr, sc);
 
diff -r 670656aa90ad -r 553901817b68 sys/arch/pmax/tc/ioasic.c
--- a/sys/arch/pmax/tc/ioasic.c Sat Jun 04 01:43:56 2011 +0000
+++ b/sys/arch/pmax/tc/ioasic.c Sat Jun 04 01:49:43 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ioasic.c,v 1.19 2009/03/16 23:11:14 dsl Exp $  */
+/*     $NetBSD: ioasic.c,v 1.20 2011/06/04 01:49:43 tsutsui Exp $      */
 
 /*
  * Copyright (c) 1994, 1995 Carnegie-Mellon University.
@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>                 /* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: ioasic.c,v 1.19 2009/03/16 23:11:14 dsl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ioasic.c,v 1.20 2011/06/04 01:49:43 tsutsui Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -95,10 +95,10 @@
 static int kn03_ioasic_ndevs = ARRAY_SIZEOF(kn03_ioasic_devs);
 #endif
 
-static int     ioasicmatch(struct device *, struct cfdata *, void *);
-static void    ioasicattach(struct device *, struct device *, void *);
+static int     ioasicmatch(device_t, cfdata_t, void *);
+static void    ioasicattach(device_t, device_t, void *);
 
-CFATTACH_DECL(ioasic, sizeof(struct ioasic_softc),
+CFATTACH_DECL_NEW(ioasic, sizeof(struct ioasic_softc),
     ioasicmatch, ioasicattach, NULL, NULL);
 
 tc_addr_t ioasic_base; /* XXX XXX XXX */
@@ -107,7 +107,7 @@
 int ioasicfound;
 
 static int
-ioasicmatch(struct device *parent, struct cfdata *cfdata, void *aux)
+ioasicmatch(device_t parent, cfdata_t cfdata, void *aux)
 {
        struct tc_attach_args *ta = aux;
 
@@ -122,19 +122,20 @@
 }
 
 static void
-ioasicattach(struct device *parent, struct device *self, void *aux)
+ioasicattach(device_t parent, device_t self, void *aux)
 {
-       struct ioasic_softc *sc = (struct ioasic_softc *)self;
+       struct ioasic_softc *sc = device_private(self);
        struct tc_attach_args *ta = aux;
        struct ioasic_dev *ioasic_devs;
        int ioasic_ndevs, builtin_ndevs;
 
        ioasicfound = 1;
 
+       sc->sc_dev = self;
        sc->sc_bst = ta->ta_memt;
        if (bus_space_map(ta->ta_memt, ta->ta_addr,
                        0x400000, 0, &sc->sc_bsh)) {
-               printf("%s: unable to map device\n", sc->sc_dv.dv_xname);
+               printf("%s: unable to map device\n", device_xname(self));
                return;
        }
        sc->sc_dmat = ta->ta_dmat;
@@ -187,7 +188,7 @@
 }
 
 const struct evcnt *
-ioasic_intr_evcnt(struct device *dev, void *cookie)
+ioasic_intr_evcnt(device_t dev, void *cookie)
 {
 
        /* XXX for now, no evcnt parent reported */
@@ -195,7 +196,8 @@
 }
 
 void
-ioasic_intr_establish(struct device *dev, void *cookie, int level, int (*handler)(void *), void *val)
+ioasic_intr_establish(device_t dev, void *cookie, int level,
+    int (*handler)(void *), void *val)
 {
        (*platform.intr_establish)(dev, cookie, level, handler, val);
 }
diff -r 670656aa90ad -r 553901817b68 sys/dev/tc/ioasic_subr.c
--- a/sys/dev/tc/ioasic_subr.c  Sat Jun 04 01:43:56 2011 +0000
+++ b/sys/dev/tc/ioasic_subr.c  Sat Jun 04 01:49:43 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ioasic_subr.c,v 1.12 2006/03/31 17:39:33 thorpej Exp $ */
+/*     $NetBSD: ioasic_subr.c,v 1.13 2011/06/04 01:49:44 tsutsui Exp $ */
 
 /*
  * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
@@ -29,7 +29,7 @@
 
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ioasic_subr.c,v 1.12 2006/03/31 17:39:33 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ioasic_subr.c,v 1.13 2011/06/04 01:49:44 tsutsui Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -72,7 +72,7 @@
 
                 /* Tell the autoconfig machinery we've found the hardware. */
                locs[IOASICCF_OFFSET] = ioasic_devs[i].iad_offset;
-               config_found_sm_loc(&sc->sc_dv, "ioasic", locs, &idev,
+               config_found_sm_loc(sc->sc_dev, "ioasic", locs, &idev,
                                    ioasicprint, config_stdsubmatch);
         }
 }
diff -r 670656aa90ad -r 553901817b68 sys/dev/tc/ioasicvar.h
--- a/sys/dev/tc/ioasicvar.h    Sat Jun 04 01:43:56 2011 +0000
+++ b/sys/dev/tc/ioasicvar.h    Sat Jun 04 01:49:43 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ioasicvar.h,v 1.21 2011/02/20 08:03:22 matt Exp $      */
+/*     $NetBSD: ioasicvar.h,v 1.22 2011/06/04 01:49:44 tsutsui Exp $   */
 
 /*
  * Copyright (c) 1995 Carnegie-Mellon University.
@@ -47,7 +47,7 @@
 };
 
 struct ioasic_softc {
-       struct  device sc_dv;
+       device_t sc_dev;
        bus_space_tag_t sc_bst;
        bus_space_handle_t sc_bsh;
        bus_dma_tag_t sc_dmat;



Home | Main Index | Thread Index | Old Index