Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/dreamcast/dev/g2 Split softc/device_t.



details:   https://anonhg.NetBSD.org/src/rev/83718b15d055
branches:  trunk
changeset: 758918:83718b15d055
user:      tsutsui <tsutsui%NetBSD.org@localhost>
date:      Sun Nov 21 16:11:32 2010 +0000

description:
Split softc/device_t.

diffstat:

 sys/arch/dreamcast/dev/g2/aica.c        |  29 +++++++++++++++--------------
 sys/arch/dreamcast/dev/g2/g2bus.c       |  23 +++++++++++------------
 sys/arch/dreamcast/dev/g2/g2busvar.h    |   4 ++--
 sys/arch/dreamcast/dev/g2/gapspci.c     |  17 +++++++++--------
 sys/arch/dreamcast/dev/g2/gapspci_pci.c |  11 +++++------
 sys/arch/dreamcast/dev/g2/gapspcivar.h  |   4 ++--
 6 files changed, 44 insertions(+), 44 deletions(-)

diffs (300 lines):

diff -r f164b411079d -r 83718b15d055 sys/arch/dreamcast/dev/g2/aica.c
--- a/sys/arch/dreamcast/dev/g2/aica.c  Sun Nov 21 09:01:35 2010 +0000
+++ b/sys/arch/dreamcast/dev/g2/aica.c  Sun Nov 21 16:11:32 2010 +0000
@@ -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 <ryo%misakimix.org@localhost>
@@ -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;
diff -r f164b411079d -r 83718b15d055 sys/arch/dreamcast/dev/g2/g2bus.c
--- a/sys/arch/dreamcast/dev/g2/g2bus.c Sun Nov 21 09:01:35 2010 +0000
+++ b/sys/arch/dreamcast/dev/g2/g2bus.c Sun Nov 21 16:11:32 2010 +0000
@@ -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)
diff -r f164b411079d -r 83718b15d055 sys/arch/dreamcast/dev/g2/g2busvar.h
--- a/sys/arch/dreamcast/dev/g2/g2busvar.h      Sun Nov 21 09:01:35 2010 +0000
+++ b/sys/arch/dreamcast/dev/g2/g2busvar.h      Sun Nov 21 16:11:32 2010 +0000
@@ -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 */
diff -r f164b411079d -r 83718b15d055 sys/arch/dreamcast/dev/g2/gapspci.c
--- a/sys/arch/dreamcast/dev/g2/gapspci.c       Sun Nov 21 09:01:35 2010 +0000
+++ b/sys/arch/dreamcast/dev/g2/gapspci.c       Sun Nov 21 16:11:32 2010 +0000
@@ -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;
diff -r f164b411079d -r 83718b15d055 sys/arch/dreamcast/dev/g2/gapspci_pci.c
--- a/sys/arch/dreamcast/dev/g2/gapspci_pci.c   Sun Nov 21 09:01:35 2010 +0000
+++ b/sys/arch/dreamcast/dev/g2/gapspci_pci.c   Sun Nov 21 16:11:32 2010 +0000
@@ -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
diff -r f164b411079d -r 83718b15d055 sys/arch/dreamcast/dev/g2/gapspcivar.h
--- a/sys/arch/dreamcast/dev/g2/gapspcivar.h    Sun Nov 21 09:01:35 2010 +0000
+++ b/sys/arch/dreamcast/dev/g2/gapspcivar.h    Sun Nov 21 16:11:32 2010 +0000
@@ -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;



Home | Main Index | Thread Index | Old Index