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.



details:   https://anonhg.NetBSD.org/src/rev/07af350150f1
branches:  trunk
changeset: 765728:07af350150f1
user:      tsutsui <tsutsui%NetBSD.org@localhost>
date:      Sat Jun 04 01:57:34 2011 +0000

description:
Split device_t/softc.  pmax is tested on GXemul.
Compile test only for alpha and vax.

XXX: alpha/tc/tcasic.c calls tcattach() via config_found(9), but
XXX: pmax/tc/tcbus.c and vax/vsa/tc_vsbus.c calls tcattach() directly.
XXX: It looks horrible...

diffstat:

 sys/arch/alpha/tc/tcasic.c  |  14 +++++++-------
 sys/arch/pmax/tc/tcbus.c    |  22 ++++++++++++----------
 sys/arch/vax/vsa/tc_vsbus.c |   6 ++++--
 sys/dev/tc/tc.c             |   8 +++++---
 sys/dev/tc/tcvar.h          |   4 ++--
 5 files changed, 30 insertions(+), 24 deletions(-)

diffs (220 lines):

diff -r 553901817b68 -r 07af350150f1 sys/arch/alpha/tc/tcasic.c
--- a/sys/arch/alpha/tc/tcasic.c        Sat Jun 04 01:49:43 2011 +0000
+++ b/sys/arch/alpha/tc/tcasic.c        Sat Jun 04 01:57:34 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tcasic.c,v 1.42 2009/03/14 15:36:00 dsl Exp $ */
+/* $NetBSD: tcasic.c,v 1.43 2011/06/04 01:57:35 tsutsui Exp $ */
 
 /*
  * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
@@ -32,7 +32,7 @@
 
 #include <sys/cdefs.h>                 /* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: tcasic.c,v 1.42 2009/03/14 15:36:00 dsl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tcasic.c,v 1.43 2011/06/04 01:57:35 tsutsui Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -46,10 +46,10 @@
 #include <alpha/tc/tc_conf.h>
 
 /* Definition of the driver for autoconfig. */
-int    tcasicmatch(struct device *, struct cfdata *, void *);
-void   tcasicattach(struct device *, struct device *, void *);
+int    tcasicmatch(device_t, cfdata_t, void *);
+void   tcasicattach(device_t, device_t, void *);
 
-CFATTACH_DECL(tcasic, sizeof (struct device),
+CFATTACH_DECL_NEW(tcasic, 0,
     tcasicmatch, tcasicattach, NULL, NULL);
 
 extern struct cfdriver tcasic_cd;
@@ -60,7 +60,7 @@
 int    tcasicfound;
 
 int
-tcasicmatch(struct device *parent, struct cfdata *cfdata, void *aux)
+tcasicmatch(device_t parent, cfdata_t cf, void *aux)
 {
        struct mainbus_attach_args *ma = aux;
 
@@ -79,7 +79,7 @@
 }
 
 void
-tcasicattach(struct device *parent, struct device *self, void *aux)
+tcasicattach(device_t parent, device_t self, void *aux)
 {
        struct tcbus_attach_args tba;
        void (*intr_setup)(void);
diff -r 553901817b68 -r 07af350150f1 sys/arch/pmax/tc/tcbus.c
--- a/sys/arch/pmax/tc/tcbus.c  Sat Jun 04 01:49:43 2011 +0000
+++ b/sys/arch/pmax/tc/tcbus.c  Sat Jun 04 01:57:34 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tcbus.c,v 1.26 2011/02/20 07:50:25 matt Exp $  */
+/*     $NetBSD: tcbus.c,v 1.27 2011/06/04 01:57:35 tsutsui Exp $       */
 
 /*-
  * Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tcbus.c,v 1.26 2011/02/20 07:50:25 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tcbus.c,v 1.27 2011/06/04 01:57:35 tsutsui Exp $");
 
 /*
  * Which system models were configured?
@@ -64,16 +64,16 @@
 extern struct tcbus_attach_args xine_tc_desc[];        /* XXX */
 extern struct tcbus_attach_args kn03_tc_desc[];        /* XXX */
 
-static int     tcbus_match(struct device *, struct cfdata *, void *);
-static void    tcbus_attach(struct device *, struct device *, void *);
+static int     tcbus_match(device_t, cfdata_t, void *);
+static void    tcbus_attach(device_t, device_t, void *);
 
-CFATTACH_DECL(tcbus, sizeof(struct tc_softc),
+CFATTACH_DECL_NEW(tcbus, sizeof(struct tc_softc),
     tcbus_match, tcbus_attach, NULL, NULL);
 
 static int tcbus_found;
 
 static int
-tcbus_match(struct device *parent, struct cfdata *cfdata, void *aux)
+tcbus_match(device_t parent, cfdata_t cf, void *aux)
 {
        struct mainbus_attach_args *ma = aux;
 
@@ -84,7 +84,7 @@
 }
 
 static void
-tcbus_attach(struct device *parent, struct device *self, void *aux)
+tcbus_attach(device_t parent, device_t self, void *aux)
 {
        struct tcbus_attach_args *tba;
 
@@ -118,6 +118,7 @@
        tba->tba_intr_disestablish = tc_ds_intr_disestablish;
        tba->tba_get_dma_tag = tc_ds_get_dma_tag;
 
+       /* XXX why not config_found(9)? */
        tcattach(parent, self, tba);
 }
 
@@ -125,7 +126,7 @@
  * Dispatch to model specific interrupt line evcnt fetch rontine
  */
 static const struct evcnt *
-tc_ds_intr_evcnt(struct device *dev, void *cookie)
+tc_ds_intr_evcnt(device_t dev, void *cookie)
 {
 
        /* XXX for now, no evcnt parent reported */
@@ -136,14 +137,15 @@
  * Dispatch to model specific interrupt establishing routine
  */
 static void
-tc_ds_intr_establish(struct device *dev, void *cookie, int level, int (*handler)(void *), void *val)
+tc_ds_intr_establish(device_t dev, void *cookie, int level,
+    int (*handler)(void *), void *val)
 {
 
        (*platform.intr_establish)(dev, cookie, level, handler, val);
 }
 
 static void
-tc_ds_intr_disestablish(struct device *dev, void *arg)
+tc_ds_intr_disestablish(device_t dev, void *arg)
 {
 
        printf("cannot disestablish TC interrupts\n");
diff -r 553901817b68 -r 07af350150f1 sys/arch/vax/vsa/tc_vsbus.c
--- a/sys/arch/vax/vsa/tc_vsbus.c       Sat Jun 04 01:49:43 2011 +0000
+++ b/sys/arch/vax/vsa/tc_vsbus.c       Sat Jun 04 01:57:34 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tc_vsbus.c,v 1.5 2010/12/14 23:31:17 matt Exp $        */
+/*     $NetBSD: tc_vsbus.c,v 1.6 2011/06/04 01:57:35 tsutsui Exp $     */
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -52,7 +52,7 @@
 
 static bus_dma_tag_t tcbus_dmat;
 
-CFATTACH_DECL(tcbus, sizeof(struct tcbus_softc),
+CFATTACH_DECL_NEW(tcbus, sizeof(struct tcbus_softc),
     tcbus_match, tcbus_attach, 0, 0);
 
 static bus_dma_tag_t
@@ -110,6 +110,7 @@
                return;
        }
 
+       sc->sc_dev = self;
        sc->sc_slots[0].tcs_addr = sc->sc_memh;
        sc->sc_slots[0].tcs_cookie = sc;
 
@@ -142,5 +143,6 @@
 
        tcbus_dmat = &sc->sc_dmatag;
 
+       /* XXX: why not config_found(9)?? */
        tcattach(parent, self, &tba);
 }
diff -r 553901817b68 -r 07af350150f1 sys/dev/tc/tc.c
--- a/sys/dev/tc/tc.c   Sat Jun 04 01:49:43 2011 +0000
+++ b/sys/dev/tc/tc.c   Sat Jun 04 01:57:34 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tc.c,v 1.50 2009/05/12 14:47:04 cegger Exp $   */
+/*     $NetBSD: tc.c,v 1.51 2011/06/04 01:57:34 tsutsui Exp $  */
 
 /*
  * Copyright (c) 1994, 1995 Carnegie-Mellon University.
@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tc.c,v 1.50 2009/05/12 14:47:04 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tc.c,v 1.51 2011/06/04 01:57:34 tsutsui Exp $");
 
 #include "opt_tcverbose.h"
 
@@ -47,7 +47,7 @@
 /* Definition of the driver for autoconfig. */
 static int     tcmatch(device_t, cfdata_t, void *);
 
-CFATTACH_DECL(tc, sizeof(struct tc_softc),
+CFATTACH_DECL_NEW(tc, sizeof(struct tc_softc),
     tcmatch, tcattach, NULL, NULL);
 
 extern struct cfdriver tc_cd;
@@ -78,6 +78,8 @@
        int i;
        int locs[TCCF_NLOCS];
 
+       sc->sc_dev = self;
+
        printf(": %s MHz clock\n",
            tba->tba_speed == TC_SPEED_25_MHZ ? "25" : "12.5");
 
diff -r 553901817b68 -r 07af350150f1 sys/dev/tc/tcvar.h
--- a/sys/dev/tc/tcvar.h        Sat Jun 04 01:49:43 2011 +0000
+++ b/sys/dev/tc/tcvar.h        Sat Jun 04 01:57:34 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tcvar.h,v 1.25 2011/02/20 08:03:22 matt Exp $ */
+/* $NetBSD: tcvar.h,v 1.26 2011/06/04 01:57:34 tsutsui Exp $ */
 
 /*
  * Copyright (c) 1995 Carnegie-Mellon University.
@@ -64,7 +64,7 @@
 #endif /* 1 */
 
 struct tc_softc {
-       struct  device sc_dv;
+       device_t sc_dev;
 
        int     sc_speed;
        int     sc_nslots;



Home | Main Index | Thread Index | Old Index