Module Name: src Committed By: tsutsui Date: Sun Nov 21 16:11:32 UTC 2010
Modified Files: src/sys/arch/dreamcast/dev/g2: aica.c g2bus.c g2busvar.h gapspci.c gapspci_pci.c gapspcivar.h Log Message: Split softc/device_t. To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/sys/arch/dreamcast/dev/g2/aica.c cvs rdiff -u -r1.13 -r1.14 src/sys/arch/dreamcast/dev/g2/g2bus.c cvs rdiff -u -r1.4 -r1.5 src/sys/arch/dreamcast/dev/g2/g2busvar.h cvs rdiff -u -r1.16 -r1.17 src/sys/arch/dreamcast/dev/g2/gapspci.c cvs rdiff -u -r1.11 -r1.12 src/sys/arch/dreamcast/dev/g2/gapspci_pci.c cvs rdiff -u -r1.2 -r1.3 src/sys/arch/dreamcast/dev/g2/gapspcivar.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/dreamcast/dev/g2/aica.c diff -u src/sys/arch/dreamcast/dev/g2/aica.c:1.19 src/sys/arch/dreamcast/dev/g2/aica.c:1.20 --- src/sys/arch/dreamcast/dev/g2/aica.c:1.19 Sat Nov 20 16:12:23 2010 +++ src/sys/arch/dreamcast/dev/g2/aica.c Sun Nov 21 16:11:32 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: aica.c,v 1.19 2010/11/20 16:12:23 tsutsui Exp $ */ +/* $NetBSD: aica.c,v 1.20 2010/11/21 16:11:32 tsutsui Exp $ */ /* * Copyright (c) 2003 SHIMIZU Ryo <r...@misakimix.org> @@ -29,7 +29,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: aica.c,v 1.19 2010/11/20 16:12:23 tsutsui Exp $"); +__KERNEL_RCSID(0, "$NetBSD: aica.c,v 1.20 2010/11/21 16:11:32 tsutsui Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -56,7 +56,7 @@ #define AICA_TIMEOUT 0x1800 struct aica_softc { - struct device sc_dev; /* base device */ + device_t sc_dev; /* base device */ bus_space_tag_t sc_memt; bus_space_handle_t sc_aica_regh; bus_space_handle_t sc_aica_memh; @@ -113,11 +113,11 @@ 2, AUFMT_STEREO, 0, {1, 65536}}, }; -int aica_match(struct device *, struct cfdata *, void *); -void aica_attach(struct device *, struct device *, void *); +int aica_match(device_t, cfdata_t, void *); +void aica_attach(device_t, device_t, void *); int aica_print(void *, const char *); -CFATTACH_DECL(aica, sizeof(struct aica_softc), aica_match, aica_attach, +CFATTACH_DECL_NEW(aica, sizeof(struct aica_softc), aica_match, aica_attach, NULL, NULL); const struct audio_device aica_device = { @@ -194,7 +194,7 @@ }; int -aica_match(struct device *parent, struct cfdata *cf, void *aux) +aica_match(device_t parent, cfdata_t cf, void *aux) { static int aica_matched = 0; @@ -206,29 +206,30 @@ } void -aica_attach(struct device *parent, struct device *self, void *aux) +aica_attach(device_t parent, device_t self, void *aux) { struct aica_softc *sc; struct g2bus_attach_args *ga; int i; - sc = (struct aica_softc *)self; + sc = device_private(self); ga = aux; + sc->sc_dev = self; sc->sc_memt = ga->ga_memt; if (bus_space_map(sc->sc_memt, AICA_REG_ADDR, 0x3000, 0, &sc->sc_aica_regh) != 0) { - printf(": can't map AICA register space\n"); + aprint_error(": can't map AICA register space\n"); return; } if (bus_space_map(sc->sc_memt, AICA_RAM_START, AICA_RAM_SIZE, 0, &sc->sc_aica_memh) != 0) { - printf(": can't map AICA memory space\n"); + aprint_error(": can't map AICA memory space\n"); return; } - printf(": ARM7 Sound Processing Unit\n"); + aprint_normal(": ARM7 Sound Processing Unit\n"); aica_disable(sc); @@ -245,12 +246,12 @@ aica_enable(sc); - printf("%s: interrupting at %s\n", sc->sc_dev.dv_xname, + aprint_normal_dev(self, "interrupting at %s\n", sysasic_intr_string(SYSASIC_IRL9)); sysasic_intr_establish(SYSASIC_EVENT_AICA, IPL_BIO, SYSASIC_IRL9, aica_intr, sc); - audio_attach_mi(&aica_hw_if, sc, &sc->sc_dev); + audio_attach_mi(&aica_hw_if, sc, self); /* init parameters */ sc->sc_output_master = 255; Index: src/sys/arch/dreamcast/dev/g2/g2bus.c diff -u src/sys/arch/dreamcast/dev/g2/g2bus.c:1.13 src/sys/arch/dreamcast/dev/g2/g2bus.c:1.14 --- src/sys/arch/dreamcast/dev/g2/g2bus.c:1.13 Mon Aug 7 17:36:53 2006 +++ src/sys/arch/dreamcast/dev/g2/g2bus.c Sun Nov 21 16:11:32 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: g2bus.c,v 1.13 2006/08/07 17:36:53 tsutsui Exp $ */ +/* $NetBSD: g2bus.c,v 1.14 2010/11/21 16:11:32 tsutsui Exp $ */ /*- * Copyright (c) 2001 Marcus Comstedt @@ -34,7 +34,7 @@ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: g2bus.c,v 1.13 2006/08/07 17:36:53 tsutsui Exp $"); +__KERNEL_RCSID(0, "$NetBSD: g2bus.c,v 1.14 2010/11/21 16:11:32 tsutsui Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -46,29 +46,29 @@ #include <dreamcast/dev/g2/g2busvar.h> -int g2busmatch(struct device *, struct cfdata *, void *); -void g2busattach(struct device *, struct device *, void *); +int g2busmatch(device_t, cfdata_t, void *); +void g2busattach(device_t, device_t, void *); int g2busprint(void *, const char *); -CFATTACH_DECL(g2bus, sizeof(struct g2bus_softc), +CFATTACH_DECL_NEW(g2bus, sizeof(struct g2bus_softc), g2busmatch, g2busattach, NULL, NULL); -int g2bussearch(struct device *, struct cfdata *, - const int *, void *); +int g2bussearch(device_t, cfdata_t, const int *, void *); int -g2busmatch(struct device *parent, struct cfdata *cf, void *aux) +g2busmatch(device_t parent, cfdata_t cf, void *aux) { return 1; } void -g2busattach(struct device *parent, struct device *self, void *aux) +g2busattach(device_t parent, device_t self, void *aux) { - struct g2bus_softc *sc = (void *) self; + struct g2bus_softc *sc = device_private(self); struct g2bus_attach_args ga; + sc->sc_dev = self; printf("\n"); TAILQ_INIT(&sc->sc_subdevs); @@ -88,8 +88,7 @@ } int -g2bussearch(struct device *parent, struct cfdata *cf, - const int *ldesc, void *aux) +g2bussearch(device_t parent, cfdata_t cf, const int *ldesc, void *aux) { if (config_match(parent, cf, aux) > 0) Index: src/sys/arch/dreamcast/dev/g2/g2busvar.h diff -u src/sys/arch/dreamcast/dev/g2/g2busvar.h:1.4 src/sys/arch/dreamcast/dev/g2/g2busvar.h:1.5 --- src/sys/arch/dreamcast/dev/g2/g2busvar.h:1.4 Fri Dec 27 11:34:05 2002 +++ src/sys/arch/dreamcast/dev/g2/g2busvar.h Sun Nov 21 16:11:32 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: g2busvar.h,v 1.4 2002/12/27 11:34:05 tsutsui Exp $ */ +/* $NetBSD: g2busvar.h,v 1.5 2010/11/21 16:11:32 tsutsui Exp $ */ /*- * Copyright (c) 2001 Marcus Comstedt @@ -57,7 +57,7 @@ * G2 master bus */ struct g2bus_softc { - struct device sc_dev; /* base device */ + device_t sc_dev; /* base device */ struct dreamcast_bus_space sc_memt; TAILQ_HEAD(, g2busdev) sc_subdevs; /* list of all children */ Index: src/sys/arch/dreamcast/dev/g2/gapspci.c diff -u src/sys/arch/dreamcast/dev/g2/gapspci.c:1.16 src/sys/arch/dreamcast/dev/g2/gapspci.c:1.17 --- src/sys/arch/dreamcast/dev/g2/gapspci.c:1.16 Fri Aug 1 11:33:06 2008 +++ src/sys/arch/dreamcast/dev/g2/gapspci.c Sun Nov 21 16:11:32 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: gapspci.c,v 1.16 2008/08/01 11:33:06 marcus Exp $ */ +/* $NetBSD: gapspci.c,v 1.17 2010/11/21 16:11:32 tsutsui Exp $ */ /*- * Copyright (c) 2001 Marcus Comstedt @@ -33,7 +33,7 @@ */ #include <sys/cdefs.h> /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: gapspci.c,v 1.16 2008/08/01 11:33:06 marcus Exp $"); +__KERNEL_RCSID(0, "$NetBSD: gapspci.c,v 1.17 2010/11/21 16:11:32 tsutsui Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -54,14 +54,14 @@ #include <dreamcast/dev/g2/g2busvar.h> #include <dreamcast/dev/g2/gapspcivar.h> -int gaps_match(struct device *, struct cfdata *, void *); -void gaps_attach(struct device *, struct device *, void *); +int gaps_match(device_t, cfdata_t, void *); +void gaps_attach(device_t, device_t, void *); -CFATTACH_DECL(gapspci, sizeof(struct gaps_softc), +CFATTACH_DECL_NEW(gapspci, sizeof(struct gaps_softc), gaps_match, gaps_attach, NULL, NULL); int -gaps_match(struct device *parent, struct cfdata *match, void *aux) +gaps_match(device_t parent, cfdata_t cf, void *aux) { struct g2bus_attach_args *ga = aux; uint8_t idbuf[16]; @@ -81,15 +81,16 @@ } void -gaps_attach(struct device *parent, struct device *self, void *aux) +gaps_attach(device_t parent, device_t self, void *aux) { struct g2bus_attach_args *ga = aux; - struct gaps_softc *sc = (void *) self; + struct gaps_softc *sc = device_private(self); struct pcibus_attach_args pba; int i; printf(": SEGA GAPS PCI Bridge\n"); + sc->sc_dev = self; sc->sc_memt = ga->ga_memt; sc->sc_dmabase = 0x1840000; Index: src/sys/arch/dreamcast/dev/g2/gapspci_pci.c diff -u src/sys/arch/dreamcast/dev/g2/gapspci_pci.c:1.11 src/sys/arch/dreamcast/dev/g2/gapspci_pci.c:1.12 --- src/sys/arch/dreamcast/dev/g2/gapspci_pci.c:1.11 Fri Aug 1 20:19:49 2008 +++ src/sys/arch/dreamcast/dev/g2/gapspci_pci.c Sun Nov 21 16:11:32 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: gapspci_pci.c,v 1.11 2008/08/01 20:19:49 marcus Exp $ */ +/* $NetBSD: gapspci_pci.c,v 1.12 2010/11/21 16:11:32 tsutsui Exp $ */ /*- * Copyright (c) 2001 Marcus Comstedt. @@ -38,7 +38,7 @@ */ #include <sys/cdefs.h> /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: gapspci_pci.c,v 1.11 2008/08/01 20:19:49 marcus Exp $"); +__KERNEL_RCSID(0, "$NetBSD: gapspci_pci.c,v 1.12 2010/11/21 16:11:32 tsutsui Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -54,7 +54,7 @@ #include <dreamcast/dev/g2/gapspcivar.h> -void gaps_attach_hook(struct device *, struct device *, +void gaps_attach_hook(device_t, device_t, struct pcibus_attach_args *); int gaps_bus_maxdevs(void *, int); pcitag_t gaps_make_tag(void *, int, int, int); @@ -96,10 +96,9 @@ #define GAPS_PCITAG_MAGIC 0x022473 void -gaps_attach_hook(struct device *bus, struct device *pci, - struct pcibus_attach_args *pba) +gaps_attach_hook(device_t parent, device_t pci, struct pcibus_attach_args *pba) { - struct gaps_softc *sc = (void *)bus; + struct gaps_softc *sc = device_private(parent); /* * Now that we know there's a bus configured, go ahead and Index: src/sys/arch/dreamcast/dev/g2/gapspcivar.h diff -u src/sys/arch/dreamcast/dev/g2/gapspcivar.h:1.2 src/sys/arch/dreamcast/dev/g2/gapspcivar.h:1.3 --- src/sys/arch/dreamcast/dev/g2/gapspcivar.h:1.2 Thu Feb 1 19:35:04 2001 +++ src/sys/arch/dreamcast/dev/g2/gapspcivar.h Sun Nov 21 16:11:32 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: gapspcivar.h,v 1.2 2001/02/01 19:35:04 marcus Exp $ */ +/* $NetBSD: gapspcivar.h,v 1.3 2010/11/21 16:11:32 tsutsui Exp $ */ /*- * Copyright (c) 2001 Marcus Comstedt @@ -36,7 +36,7 @@ #define _DREAMCAST_GAPSPCIVAR_H_ struct gaps_softc { - struct device sc_dev; + device_t sc_dev; bus_space_tag_t sc_memt; bus_space_handle_t sc_gaps_memh; bus_space_handle_t sc_pci_memh;