Module Name: src Committed By: tsutsui Date: Sat Jun 4 01:57:35 UTC 2011
Modified Files: src/sys/arch/alpha/tc: tcasic.c src/sys/arch/pmax/tc: tcbus.c src/sys/arch/vax/vsa: tc_vsbus.c src/sys/dev/tc: tc.c tcvar.h Log Message: 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... To generate a diff of this commit: cvs rdiff -u -r1.42 -r1.43 src/sys/arch/alpha/tc/tcasic.c cvs rdiff -u -r1.26 -r1.27 src/sys/arch/pmax/tc/tcbus.c cvs rdiff -u -r1.5 -r1.6 src/sys/arch/vax/vsa/tc_vsbus.c cvs rdiff -u -r1.50 -r1.51 src/sys/dev/tc/tc.c cvs rdiff -u -r1.25 -r1.26 src/sys/dev/tc/tcvar.h 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/alpha/tc/tcasic.c diff -u src/sys/arch/alpha/tc/tcasic.c:1.42 src/sys/arch/alpha/tc/tcasic.c:1.43 --- src/sys/arch/alpha/tc/tcasic.c:1.42 Sat Mar 14 15:36:00 2009 +++ src/sys/arch/alpha/tc/tcasic.c Sat Jun 4 01:57:35 2011 @@ -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); Index: src/sys/arch/pmax/tc/tcbus.c diff -u src/sys/arch/pmax/tc/tcbus.c:1.26 src/sys/arch/pmax/tc/tcbus.c:1.27 --- src/sys/arch/pmax/tc/tcbus.c:1.26 Sun Feb 20 07:50:25 2011 +++ src/sys/arch/pmax/tc/tcbus.c Sat Jun 4 01:57:35 2011 @@ -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"); Index: src/sys/arch/vax/vsa/tc_vsbus.c diff -u src/sys/arch/vax/vsa/tc_vsbus.c:1.5 src/sys/arch/vax/vsa/tc_vsbus.c:1.6 --- src/sys/arch/vax/vsa/tc_vsbus.c:1.5 Tue Dec 14 23:31:17 2010 +++ src/sys/arch/vax/vsa/tc_vsbus.c Sat Jun 4 01:57:35 2011 @@ -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); } Index: src/sys/dev/tc/tc.c diff -u src/sys/dev/tc/tc.c:1.50 src/sys/dev/tc/tc.c:1.51 --- src/sys/dev/tc/tc.c:1.50 Tue May 12 14:47:04 2009 +++ src/sys/dev/tc/tc.c Sat Jun 4 01:57:34 2011 @@ -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"); Index: src/sys/dev/tc/tcvar.h diff -u src/sys/dev/tc/tcvar.h:1.25 src/sys/dev/tc/tcvar.h:1.26 --- src/sys/dev/tc/tcvar.h:1.25 Sun Feb 20 08:03:22 2011 +++ src/sys/dev/tc/tcvar.h Sat Jun 4 01:57:34 2011 @@ -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;