Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/sparc64/dev split auxio, ebus, psycho, sab.



details:   https://anonhg.NetBSD.org/src/rev/33dd8e4ee2f7
branches:  trunk
changeset: 765668:33dd8e4ee2f7
user:      christos <christos%NetBSD.org@localhost>
date:      Thu Jun 02 00:24:23 2011 +0000

description:
split auxio, ebus, psycho, sab.

diffstat:

 sys/arch/sparc64/dev/auxio.c        |  34 ++++++++++++++-------------
 sys/arch/sparc64/dev/ebus.c         |  18 ++++++++------
 sys/arch/sparc64/dev/ebus_mainbus.c |  13 +++++----
 sys/arch/sparc64/dev/ebusvar.h      |   4 +-
 sys/arch/sparc64/dev/psycho.c       |  37 +++++++++++++++--------------
 sys/arch/sparc64/dev/psychovar.h    |   4 +-
 sys/arch/sparc64/dev/sab.c          |  45 ++++++++++++++++++------------------
 7 files changed, 81 insertions(+), 74 deletions(-)

diffs (truncated from 549 to 300 lines):

diff -r 34b26c8d3ab4 -r 33dd8e4ee2f7 sys/arch/sparc64/dev/auxio.c
--- a/sys/arch/sparc64/dev/auxio.c      Thu Jun 02 00:23:28 2011 +0000
+++ b/sys/arch/sparc64/dev/auxio.c      Thu Jun 02 00:24:23 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: auxio.c,v 1.21 2011/03/12 11:43:38 nakayama Exp $      */
+/*     $NetBSD: auxio.c,v 1.22 2011/06/02 00:24:23 christos Exp $      */
 
 /*
  * Copyright (c) 2000, 2001 Matthew R. Green
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: auxio.c,v 1.21 2011/03/12 11:43:38 nakayama Exp $");
+__KERNEL_RCSID(0, "$NetBSD: auxio.c,v 1.22 2011/06/02 00:24:23 christos Exp $");
 
 #include "opt_auxio.h"
 
@@ -60,7 +60,7 @@
  */
 
 struct auxio_softc {
-       struct device           sc_dev;
+       device_t                sc_dev;
 
        /* parent's tag */
        bus_space_tag_t         sc_tag;
@@ -81,15 +81,15 @@
 #define        AUXIO_ROM_NAME          "auxio"
 
 void   auxio_attach_common(struct auxio_softc *);
-int    auxio_ebus_match(struct device *, struct cfdata *, void *);
-void   auxio_ebus_attach(struct device *, struct device *, void *);
-int    auxio_sbus_match(struct device *, struct cfdata *, void *);
-void   auxio_sbus_attach(struct device *, struct device *, void *);
+int    auxio_ebus_match(device_t, cfdata_t, void *);
+void   auxio_ebus_attach(device_t, device_t, void *);
+int    auxio_sbus_match(device_t, cfdata_t, void *);
+void   auxio_sbus_attach(device_t, device_t, void *);
 
-CFATTACH_DECL(auxio_ebus, sizeof(struct auxio_softc),
+CFATTACH_DECL_NEW(auxio_ebus, sizeof(struct auxio_softc),
     auxio_ebus_match, auxio_ebus_attach, NULL, NULL);
 
-CFATTACH_DECL(auxio_sbus, sizeof(struct auxio_softc),
+CFATTACH_DECL_NEW(auxio_sbus, sizeof(struct auxio_softc),
     auxio_sbus_match, auxio_sbus_attach, NULL, NULL);
 
 extern struct cfdriver auxio_cd;
@@ -153,7 +153,7 @@
 }
 
 int
-auxio_ebus_match(struct device *parent, struct cfdata *cf, void *aux)
+auxio_ebus_match(device_t parent, cfdata_t cf, void *aux)
 {
        struct ebus_attach_args *ea = aux;
 
@@ -161,11 +161,12 @@
 }
 
 void
-auxio_ebus_attach(struct device *parent, struct device *self, void *aux)
+auxio_ebus_attach(device_t parent, device_t self, void *aux)
 {
-       struct auxio_softc *sc = (struct auxio_softc *)self;
+       struct auxio_softc *sc = device_private(self);
        struct ebus_attach_args *ea = aux;
 
+       sc->sc_dev = self;
        sc->sc_tag = ea->ea_bustag;
 
        if (ea->ea_nreg < 1) {
@@ -212,19 +213,20 @@
 }
 
 int
-auxio_sbus_match(struct device *parent, struct cfdata *cf, void *aux)
+auxio_sbus_match(device_t parent, cfdata_t cf, void *aux)
 {
        struct sbus_attach_args *sa = aux;
 
-       return (strcmp(AUXIO_ROM_NAME, sa->sa_name) == 0);
+       return strcmp(AUXIO_ROM_NAME, sa->sa_name) == 0;
 }
 
 void
-auxio_sbus_attach(struct device *parent, struct device *self, void *aux)
+auxio_sbus_attach(device_t parent, device_t self, void *aux)
 {
-       struct auxio_softc *sc = (struct auxio_softc *)self;
+       struct auxio_softc *sc = device_private(self);
        struct sbus_attach_args *sa = aux;
 
+       sc->sc_dev = self;
        sc->sc_tag = sa->sa_bustag;
 
        if (sa->sa_nreg < 1) {
diff -r 34b26c8d3ab4 -r 33dd8e4ee2f7 sys/arch/sparc64/dev/ebus.c
--- a/sys/arch/sparc64/dev/ebus.c       Thu Jun 02 00:23:28 2011 +0000
+++ b/sys/arch/sparc64/dev/ebus.c       Thu Jun 02 00:24:23 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ebus.c,v 1.56 2011/03/18 09:52:54 mrg Exp $    */
+/*     $NetBSD: ebus.c,v 1.57 2011/06/02 00:24:23 christos Exp $       */
 
 /*
  * Copyright (c) 1999, 2000, 2001 Matthew R. Green
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ebus.c,v 1.56 2011/03/18 09:52:54 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ebus.c,v 1.57 2011/06/02 00:24:23 christos Exp $");
 
 #include "opt_ddb.h"
 
@@ -76,10 +76,10 @@
 #include <dev/ebus/ebusvar.h>
 #include <sparc64/dev/ebusvar.h>
 
-int    ebus_match(struct device *, struct cfdata *, void *);
-void   ebus_attach(struct device *, struct device *, void *);
+int    ebus_match(device_t, cfdata_t, void *);
+void   ebus_attach(device_t, device_t, void *);
 
-CFATTACH_DECL(ebus, sizeof(struct ebus_softc),
+CFATTACH_DECL_NEW(ebus, sizeof(struct ebus_softc),
     ebus_match, ebus_attach, NULL, NULL);
 
 /*
@@ -91,7 +91,7 @@
        void *, void(*)(void));
 
 int
-ebus_match(struct device *parent, struct cfdata *match, void *aux)
+ebus_match(device_t parent, cfdata_t match, void *aux)
 {
        struct pci_attach_args *pa = aux;
        char *name;
@@ -131,15 +131,17 @@
  * after the sbus code which does similar things.
  */
 void
-ebus_attach(struct device *parent, struct device *self, void *aux)
+ebus_attach(device_t parent, device_t self, void *aux)
 {
-       struct ebus_softc *sc = (struct ebus_softc *)self;
+       struct ebus_softc *sc = device_private(self);
        struct pci_attach_args *pa = aux;
        struct ebus_attach_args eba;
        struct ebus_interrupt_map_mask *immp;
        int node, nmapmask, error;
        char devinfo[256];
 
+       sc->sc_dev = self;
+
        aprint_normal("\n");
        aprint_naive("\n");
 
diff -r 34b26c8d3ab4 -r 33dd8e4ee2f7 sys/arch/sparc64/dev/ebus_mainbus.c
--- a/sys/arch/sparc64/dev/ebus_mainbus.c       Thu Jun 02 00:23:28 2011 +0000
+++ b/sys/arch/sparc64/dev/ebus_mainbus.c       Thu Jun 02 00:24:23 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ebus_mainbus.c,v 1.3 2011/03/16 04:00:42 mrg Exp $     */
+/*     $NetBSD: ebus_mainbus.c,v 1.4 2011/06/02 00:24:23 christos Exp $        */
 /*     $OpenBSD: ebus_mainbus.c,v 1.7 2010/11/11 17:58:23 miod Exp $   */
 
 /*
@@ -53,10 +53,10 @@
 #include <dev/ebus/ebusvar.h>
 #include <sparc64/dev/ebusvar.h>
 
-int    ebus_mainbus_match(struct device *, struct cfdata *, void *);
-void   ebus_mainbus_attach(struct device *, struct device *, void *);
+int    ebus_mainbus_match(device_t, cfdata_t, void *);
+void   ebus_mainbus_attach(device_t, device_t, void *);
 
-CFATTACH_DECL(ebus_mainbus, sizeof(struct ebus_softc),
+CFATTACH_DECL_NEW(ebus_mainbus, sizeof(struct ebus_softc),
     ebus_mainbus_match, ebus_mainbus_attach, NULL, NULL);
 
 int ebus_mainbus_bus_map(bus_space_tag_t, bus_addr_t, bus_size_t, int,
@@ -67,7 +67,7 @@
 void ebus_mainbus_intr_ack(struct intrhand *);
 
 int
-ebus_mainbus_match(struct device *parent, struct cfdata *match, void *aux)
+ebus_mainbus_match(struct device *parent, cfdata_t cf, void *aux)
 {
        struct mainbus_attach_args *ma = aux;
 
@@ -79,7 +79,7 @@
 void
 ebus_mainbus_attach(struct device *parent, struct device *self, void *aux)
 {
-       struct ebus_softc *sc = (struct ebus_softc *)self;
+       struct ebus_softc *sc = device_private(self);
        struct mainbus_attach_args *ma = aux;
        struct ebus_attach_args eba;
        struct ebus_interrupt_map_mask *immp;
@@ -87,6 +87,7 @@
        struct pyro_softc *psc;
        int i;
 
+       sc->sc_dev = self;
        sc->sc_node = node = ma->ma_node;
        sc->sc_ign = INTIGN((ma->ma_upaid) << INTMAP_IGN_SHIFT);
 
diff -r 34b26c8d3ab4 -r 33dd8e4ee2f7 sys/arch/sparc64/dev/ebusvar.h
--- a/sys/arch/sparc64/dev/ebusvar.h    Thu Jun 02 00:23:28 2011 +0000
+++ b/sys/arch/sparc64/dev/ebusvar.h    Thu Jun 02 00:24:23 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ebusvar.h,v 1.9 2011/03/18 09:52:54 mrg Exp $  */
+/*     $NetBSD: ebusvar.h,v 1.10 2011/06/02 00:24:23 christos Exp $    */
 
 /*
  * Copyright (c) 1999, 2000, 2001 Matthew R. Green
@@ -46,7 +46,7 @@
 #include <dev/ebus/ebusvar.h>
 
 struct ebus_softc {
-       struct device                   sc_dev;
+       device_t                        sc_dev;
 
        int                             sc_node;
 
diff -r 34b26c8d3ab4 -r 33dd8e4ee2f7 sys/arch/sparc64/dev/psycho.c
--- a/sys/arch/sparc64/dev/psycho.c     Thu Jun 02 00:23:28 2011 +0000
+++ b/sys/arch/sparc64/dev/psycho.c     Thu Jun 02 00:24:23 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: psycho.c,v 1.106 2011/05/17 17:34:53 dyoung Exp $      */
+/*     $NetBSD: psycho.c,v 1.107 2011/06/02 00:24:23 christos Exp $    */
 
 /*
  * Copyright (c) 1999, 2000 Matthew R. Green
@@ -55,7 +55,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: psycho.c,v 1.106 2011/05/17 17:34:53 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: psycho.c,v 1.107 2011/06/02 00:24:23 christos Exp $");
 
 #include "opt_ddb.h"
 
@@ -161,11 +161,11 @@
 /*
  * autoconfiguration
  */
-static int     psycho_match(struct device *, struct cfdata *, void *);
-static void    psycho_attach(struct device *, struct device *, void *);
+static int     psycho_match(device_t, cfdata_t, void *);
+static void    psycho_attach(device_t, device_t, void *);
 static int     psycho_print(void *aux, const char *p);
 
-CFATTACH_DECL(psycho, sizeof(struct psycho_softc),
+CFATTACH_DECL_NEW(psycho, sizeof(struct psycho_softc),
     psycho_match, psycho_attach, NULL, NULL);
 
 /*
@@ -221,7 +221,7 @@
 };
 
 static int
-psycho_match(struct device *parent, struct cfdata *match, void *aux)
+psycho_match(device_t parent, cfdata_t match, void *aux)
 {
        struct mainbus_attach_args *ma = aux;
        char *model = prom_getpropstring(ma->ma_node, "model");
@@ -285,9 +285,9 @@
  *       just copy it's tags and addresses.
  */
 static void
-psycho_attach(struct device *parent, struct device *self, void *aux)
+psycho_attach(device_t parent, device_t self, void *aux)
 {
-       struct psycho_softc *sc = (struct psycho_softc *)self;
+       struct psycho_softc *sc = device_private(self);
        struct psycho_softc *osc = NULL;
        struct psycho_pbm *pp;
        struct pcibus_attach_args pba;
@@ -303,6 +303,7 @@
 
        aprint_normal("\n");
 
+       sc->sc_dev = self;
        sc->sc_node = ma->ma_node;
        sc->sc_bustag = ma->ma_bustag;
        sc->sc_dmatag = ma->ma_dmatag;
@@ -718,14 +719,14 @@
        sc->sc_powerpressed = 0;
        sc->sc_smcontext = malloc(sizeof(struct sysmon_pswitch), M_DEVBUF, 0);
        if (!sc->sc_smcontext) {
-               aprint_error_dev(&sc->sc_dev, "could not allocate power button context\n");
+               aprint_error_dev(sc->sc_dev, "could not allocate power button context\n");
                return;
        }
        memset(sc->sc_smcontext, 0, sizeof(struct sysmon_pswitch));
-       sc->sc_smcontext->smpsw_name = device_xname(&sc->sc_dev);
+       sc->sc_smcontext->smpsw_name = device_xname(sc->sc_dev);
        sc->sc_smcontext->smpsw_type = PSWITCH_TYPE_POWER;



Home | Main Index | Thread Index | Old Index