Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/sparc/dev convert the remaining sparc drivers to CF...



details:   https://anonhg.NetBSD.org/src/rev/f4b7683937fe
branches:  trunk
changeset: 767406:f4b7683937fe
user:      mrg <mrg%NetBSD.org@localhost>
date:      Mon Jul 18 00:31:13 2011 +0000

description:
convert the remaining sparc drivers to CFATTACH_DECL_NEW/cfdata_t/device_t.
(cgsix_obio.c was only partially converted with the rest of the cgsix code
when it was changed some time ago.)

diffstat:

 sys/arch/sparc/dev/bootbus.c     |  10 ++---
 sys/arch/sparc/dev/cgsix_obio.c  |   6 +-
 sys/arch/sparc/dev/ebus.c        |  12 ++++---
 sys/arch/sparc/dev/rtc.c         |   8 +---
 sys/arch/sparc/dev/tctrl.c       |  63 ++++++++++++++++++++-------------------
 sys/arch/sparc/dev/vme_machdep.c |   9 ++---
 6 files changed, 53 insertions(+), 55 deletions(-)

diffs (truncated from 429 to 300 lines):

diff -r 09d087682c95 -r f4b7683937fe sys/arch/sparc/dev/bootbus.c
--- a/sys/arch/sparc/dev/bootbus.c      Mon Jul 18 00:05:35 2011 +0000
+++ b/sys/arch/sparc/dev/bootbus.c      Mon Jul 18 00:31:13 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bootbus.c,v 1.18 2011/07/01 18:50:41 dyoung Exp $      */
+/*     $NetBSD: bootbus.c,v 1.19 2011/07/18 00:31:13 mrg Exp $ */
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bootbus.c,v 1.18 2011/07/01 18:50:41 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bootbus.c,v 1.19 2011/07/18 00:31:13 mrg Exp $");
 
 #include <sys/param.h>
 #include <sys/malloc.h>
@@ -50,7 +50,6 @@
 #include "locators.h"
 
 struct bootbus_softc {
-       struct device sc_dev;
        int sc_node;                            /* our OBP node */
 
        bus_space_tag_t sc_st;                  /* ours */
@@ -60,11 +59,10 @@
 static int bootbus_match(device_t, cfdata_t, void *);
 static void bootbus_attach(device_t, device_t, void *);
 
-CFATTACH_DECL(bootbus, sizeof(struct bootbus_softc),
+CFATTACH_DECL_NEW(bootbus, sizeof(struct bootbus_softc),
     bootbus_match, bootbus_attach, NULL, NULL);
 
-static int bootbus_submatch(struct device *, struct cfdata *,
-                           const int *, void *);
+static int bootbus_submatch(device_t, cfdata_t, const int *, void *);
 static int bootbus_print(void *, const char *);
 
 static int bootbus_setup_attach_args(struct bootbus_softc *, bus_space_tag_t,
diff -r 09d087682c95 -r f4b7683937fe sys/arch/sparc/dev/cgsix_obio.c
--- a/sys/arch/sparc/dev/cgsix_obio.c   Mon Jul 18 00:05:35 2011 +0000
+++ b/sys/arch/sparc/dev/cgsix_obio.c   Mon Jul 18 00:31:13 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cgsix_obio.c,v 1.24 2011/07/01 18:50:41 dyoung Exp $ */
+/*     $NetBSD: cgsix_obio.c,v 1.25 2011/07/18 00:31:13 mrg Exp $ */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cgsix_obio.c,v 1.24 2011/07/01 18:50:41 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cgsix_obio.c,v 1.25 2011/07/18 00:31:13 mrg Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -68,7 +68,7 @@
 static void    cgsixattach(device_t, device_t, void *);
 static int     cg6_pfour_probe(void *, void *);
 
-CFATTACH_DECL(cgsix_obio, sizeof(struct cgsix_softc),
+CFATTACH_DECL_NEW(cgsix_obio, sizeof(struct cgsix_softc),
     cgsixmatch, cgsixattach, NULL, NULL);
 
 /*
diff -r 09d087682c95 -r f4b7683937fe sys/arch/sparc/dev/ebus.c
--- a/sys/arch/sparc/dev/ebus.c Mon Jul 18 00:05:35 2011 +0000
+++ b/sys/arch/sparc/dev/ebus.c Mon Jul 18 00:31:13 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ebus.c,v 1.32 2011/07/01 18:50:41 dyoung Exp $ */
+/*     $NetBSD: ebus.c,v 1.33 2011/07/18 00:31:13 mrg Exp $ */
 
 /*
  * Copyright (c) 1999, 2000 Matthew R. Green
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ebus.c,v 1.32 2011/07/01 18:50:41 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ebus.c,v 1.33 2011/07/18 00:31:13 mrg Exp $");
 
 #if defined(DEBUG) && !defined(EBUS_DEBUG)
 #define EBUS_DEBUG
@@ -82,7 +82,7 @@
 #endif
 
 struct ebus_softc {
-       struct device                   sc_dev;
+       device_t                        sc_dev;
        device_t                        sc_parent;      /* PCI bus */
 
        int                             sc_node;        /* PROM node */
@@ -100,7 +100,7 @@
 static int     ebus_match(device_t, cfdata_t, void *);
 static 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);
 
 static int     ebus_setup_attach_args(struct ebus_softc *, bus_space_tag_t,
@@ -212,7 +212,7 @@
 
        if (wiring_map != NULL) {
                printf("%s: global ebus wiring map already initalized\n",
-                   device_xname(&sc->sc_dev));
+                   device_xname(sc->sc_dev));
                return (0);
        }
 
@@ -250,6 +250,8 @@
        int node, error;
        char devinfo[256];
 
+       sc->sc_dev = self;
+
 #ifdef BLINK
        callout_init(&ebus_blink_ch, 0);
 #endif
diff -r 09d087682c95 -r f4b7683937fe sys/arch/sparc/dev/rtc.c
--- a/sys/arch/sparc/dev/rtc.c  Mon Jul 18 00:05:35 2011 +0000
+++ b/sys/arch/sparc/dev/rtc.c  Mon Jul 18 00:31:13 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rtc.c,v 1.17 2011/07/01 18:50:41 dyoung Exp $ */
+/*     $NetBSD: rtc.c,v 1.18 2011/07/18 00:31:13 mrg Exp $ */
 
 /*
  * Copyright (c) 2001 Valeriy E. Ushakov
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rtc.c,v 1.17 2011/07/01 18:50:41 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rtc.c,v 1.18 2011/07/18 00:31:13 mrg Exp $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -55,8 +55,6 @@
 #include <dev/ebus/ebusvar.h>
 
 struct rtc_ebus_softc {
-       struct device           sc_dev;
-
        bus_space_tag_t         sc_bt;  /* parent bus tag */
        bus_space_handle_t      sc_bh;  /* handle for registers */
 };
@@ -64,7 +62,7 @@
 static int     rtcmatch_ebus(device_t, cfdata_t, void *);
 static void    rtcattach_ebus(device_t, device_t, void *);
 
-CFATTACH_DECL(rtc_ebus, sizeof(struct rtc_ebus_softc),
+CFATTACH_DECL_NEW(rtc_ebus, sizeof(struct rtc_ebus_softc),
     rtcmatch_ebus, rtcattach_ebus, NULL, NULL);
 
 /* XXX: global TOD clock handle (sparc/clock.c) */
diff -r 09d087682c95 -r f4b7683937fe sys/arch/sparc/dev/tctrl.c
--- a/sys/arch/sparc/dev/tctrl.c        Mon Jul 18 00:05:35 2011 +0000
+++ b/sys/arch/sparc/dev/tctrl.c        Mon Jul 18 00:31:13 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tctrl.c,v 1.52 2011/07/01 18:50:41 dyoung Exp $        */
+/*     $NetBSD: tctrl.c,v 1.53 2011/07/18 00:31:13 mrg Exp $   */
 
 /*-
  * Copyright (c) 1998, 2005, 2006 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tctrl.c,v 1.52 2011/07/01 18:50:41 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tctrl.c,v 1.53 2011/07/18 00:31:13 mrg Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -107,7 +107,7 @@
 };
 
 struct tctrl_softc {
-       struct  device sc_dev;
+       device_t        sc_dev;
        bus_space_tag_t sc_memt;
        bus_space_handle_t      sc_memh;
        unsigned int    sc_junk;
@@ -170,8 +170,8 @@
 #define TCTRL_STD_DEV          0
 #define TCTRL_APMCTL_DEV       8
 
-static int tctrl_match(struct device *, struct cfdata *, void *);
-static void tctrl_attach(struct device *, struct device *, void *);
+static int tctrl_match(device_t, cfdata_t, void *);
+static void tctrl_attach(device_t, device_t, void *);
 static void tctrl_write(struct tctrl_softc *, bus_size_t, uint8_t);
 static uint8_t tctrl_read(struct tctrl_softc *, bus_size_t);
 static void tctrl_write_data(struct tctrl_softc *, uint8_t);
@@ -199,7 +199,7 @@
 static void tctrl_lock(struct tctrl_softc *);
 static void tctrl_unlock(struct tctrl_softc *);
 
-CFATTACH_DECL(tctrl, sizeof(struct tctrl_softc),
+CFATTACH_DECL_NEW(tctrl, sizeof(struct tctrl_softc),
     tctrl_match, tctrl_attach, NULL, NULL);
 
 static int tadpole_request(struct tctrl_req *, int, int);
@@ -208,7 +208,7 @@
 int tctrl_apm_evindex;
 
 static int
-tctrl_match(struct device *parent, struct cfdata *cf, void *aux)
+tctrl_match(device_t parent, cfdata_t cf, void *aux)
 {
        union obio_attach_args *uoba = aux;
        struct sbus_attach_args *sa = &uoba->uoba_sbus;
@@ -225,7 +225,7 @@
 }
 
 static void
-tctrl_attach(struct device *parent, struct device *self, void *aux)
+tctrl_attach(device_t parent, device_t self, void *aux)
 {
        struct tctrl_softc *sc = device_private(self);
        union obio_attach_args *uoba = aux;
@@ -235,6 +235,7 @@
        /* We're living on a sbus slot that looks like an obio that
         * looks like an sbus slot.
         */
+       sc->sc_dev = self;
        sc->sc_memt = sa->sa_bustag;
        if (sbus_bus_map(sc->sc_memt,
                         sa->sa_slot,
@@ -264,7 +265,7 @@
                (void)bus_intr_establish(sc->sc_memt, sa->sa_pri, IPL_NONE,
                                         tctrl_intr, sc);
                evcnt_attach_dynamic(&sc->sc_intrcnt, EVCNT_TYPE_INTR, NULL,
-                                    sc->sc_dev.dv_xname, "intr");
+                                    device_xname(sc->sc_dev), "intr");
        }
 
        /* See what the external status is */
@@ -273,7 +274,7 @@
        if (sc->sc_ext_status != 0) {
                const char *sep;
 
-               printf("%s: ", sc->sc_dev.dv_xname);
+               printf("%s: ", device_xname(sc->sc_dev));
                v = sc->sc_ext_status;
                for (i = 0, sep = ""; v != 0; i++, v >>= 1) {
                        if (v & 1) {
@@ -321,9 +322,9 @@
        sc->sc_events = 0;
 
        if (kthread_create(PRI_NONE, 0, NULL, tctrl_event_thread, sc,
-           &sc->sc_thread, "%s", sc->sc_dev.dv_xname) != 0) {
+           &sc->sc_thread, "%s", device_xname(sc->sc_dev)) != 0) {
                printf("%s: unable to create event kthread",
-                   sc->sc_dev.dv_xname);
+                   device_xname(sc->sc_dev));
        }
 }
 
@@ -369,13 +370,13 @@
                                sc->sc_ext_pending = 1;
                        } else {
                                printf("%s: (op=0x%02x): unexpected data (0x%02x)\n",
-                                       sc->sc_dev.dv_xname, sc->sc_op, d);
+                                       device_xname(sc->sc_dev), sc->sc_op, d);
                        }
                        goto again;
                case TCTRL_ACK:
                        if (d != 0xfe) {
                                printf("%s: (op=0x%02x): unexpected ack value (0x%02x)\n",
-                                       sc->sc_dev.dv_xname, sc->sc_op, d);
+                                       device_xname(sc->sc_dev), sc->sc_op, d);
                        }
 #ifdef TCTRLDEBUG
                        printf(" ack=0x%02x", d);
@@ -407,7 +408,7 @@
                        goto again;
                default:
                        printf("%s: (op=0x%02x): unexpected data (0x%02x) in state %d\n",
-                              sc->sc_dev.dv_xname, sc->sc_op, d, sc->sc_state);
+                              device_xname(sc->sc_dev), sc->sc_op, d, sc->sc_state);
                        goto again;
                }
        }
@@ -429,7 +430,7 @@
                tctrl_write_data(sc, sc->sc_cmdbuf[sc->sc_cmdoff++]);
 #ifdef TCTRLDEBUG
                if (sc->sc_cmdoff == 1) {
-                       printf("%s: op=0x%02x(l=%u)", sc->sc_dev.dv_xname,
+                       printf("%s: op=0x%02x(l=%u)", device_xname(sc->sc_dev),
                                sc->sc_cmdbuf[0], sc->sc_rsplen);
                } else {
                        printf(" [%d]=0x%02x", sc->sc_cmdoff-1,
@@ -759,24 +760,24 @@
        printf("event: %x\n",v);
 #endif
        if (v & TS102_EVENT_STATUS_POWERON_BTN_PRESSED) {
-               printf("%s: Power button pressed\n",sc->sc_dev.dv_xname);
+               printf("%s: Power button pressed\n",device_xname(sc->sc_dev));



Home | Main Index | Thread Index | Old Index