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 CFATTACH_DECL_NEW



details:   https://anonhg.NetBSD.org/src/rev/a74e604b657d
branches:  trunk
changeset: 765695:a74e604b657d
user:      christos <christos%NetBSD.org@localhost>
date:      Fri Jun 03 03:20:39 2011 +0000

description:
CFATTACH_DECL_NEW

diffstat:

 sys/arch/sparc64/dev/cons.h        |   4 ++--
 sys/arch/sparc64/dev/ffb.c         |  33 ++++++++++++++++++---------------
 sys/arch/sparc64/dev/ffb_mainbus.c |  23 ++++++++++++-----------
 sys/arch/sparc64/dev/ffbvar.h      |   4 ++--
 sys/arch/sparc64/dev/pcons.c       |  17 +++++++++--------
 sys/arch/sparc64/dev/pld_wdog.c    |  30 ++++++++++++++++--------------
 sys/arch/sparc64/dev/power.c       |  20 ++++++++++----------
 7 files changed, 69 insertions(+), 62 deletions(-)

diffs (truncated from 444 to 300 lines):

diff -r fac274e7a8eb -r a74e604b657d sys/arch/sparc64/dev/cons.h
--- a/sys/arch/sparc64/dev/cons.h       Fri Jun 03 03:05:21 2011 +0000
+++ b/sys/arch/sparc64/dev/cons.h       Fri Jun 03 03:20:39 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cons.h,v 1.8 2006/10/16 22:07:11 martin Exp $  */
+/*     $NetBSD: cons.h,v 1.9 2011/06/03 03:20:39 christos Exp $        */
 
 /*-
  * Copyright (c) 2000 Eduardo E. Horvath
@@ -35,7 +35,7 @@
  */
 
 struct pconssoftc {
-       struct device of_dev;
+       device_t of_dev;
        struct tty *of_tty;
        struct callout sc_poll_ch;
        int of_flags;
diff -r fac274e7a8eb -r a74e604b657d sys/arch/sparc64/dev/ffb.c
--- a/sys/arch/sparc64/dev/ffb.c        Fri Jun 03 03:05:21 2011 +0000
+++ b/sys/arch/sparc64/dev/ffb.c        Fri Jun 03 03:20:39 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ffb.c,v 1.42 2011/05/19 04:43:45 macallan Exp $        */
+/*     $NetBSD: ffb.c,v 1.43 2011/06/03 03:20:39 christos Exp $        */
 /*     $OpenBSD: creator.c,v 1.20 2002/07/30 19:48:15 jason Exp $      */
 
 /*
@@ -33,7 +33,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ffb.c,v 1.42 2011/05/19 04:43:45 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ffb.c,v 1.43 2011/06/03 03:20:39 christos Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -137,7 +137,7 @@
 void   ffb_cursor(void *, int, int, int);
 
 /* frame buffer generic driver */   
-static void ffbfb_unblank(struct device*);
+static void ffbfb_unblank(device_t);
 dev_type_open(ffbfb_open);
 dev_type_close(ffbfb_close);
 dev_type_ioctl(ffbfb_ioctl);
@@ -255,7 +255,7 @@
        printf(", model %s, dac %u\n", model, sc->sc_dacrev);
        if (sc->sc_needredraw) 
                printf("%s: found old DAC, enabling redraw on unblank\n", 
-                   device_xname(&sc->sc_dv));
+                   device_xname(sc->sc_dev));
 
        /* Check if a console resolution "<device>:r<res>" is set. */
        if (sc->sc_console) {
@@ -289,7 +289,7 @@
                sort_modes(sc->sc_edid_info.edid_modes,
                    &sc->sc_edid_info.edid_preferred_mode,
                    sc->sc_edid_info.edid_nmodes);
-               DPRINTF(("%s: EDID data:\n  ", device_xname(&sc->sc_dv)));
+               DPRINTF(("%s: EDID data:\n  ", device_xname(sc->sc_dev)));
                for (i = 0; i < EDID_DATA_LEN; i++) {
                        if (i && !(i % 32))
                                DPRINTF(("\n "));
@@ -309,14 +309,14 @@
                                        break;
                        }
        } else {
-               DPRINTF(("%s: No EDID data.\n", device_xname(&sc->sc_dv)));
+               DPRINTF(("%s: No EDID data.\n", device_xname(sc->sc_dev)));
        }
                
        ffb_ras_init(sc);
 
        ffb_blank(sc, WSDISPLAYIO_SVIDEO, &blank);
 
-       sc->sc_accel = ((device_cfdata(&sc->sc_dv)->cf_flags &
+       sc->sc_accel = ((device_cfdata(sc->sc_dev)->cf_flags &
            FFB_CFFLAG_NOACCEL) == 0);
                
        wsfont_init();
@@ -354,7 +354,7 @@
        sc->sc_fb.fb_type.fb_width = sc->sc_width;
        sc->sc_fb.fb_type.fb_depth = sc->sc_depth;
        sc->sc_fb.fb_type.fb_height = sc->sc_height;
-       sc->sc_fb.fb_device = &sc->sc_dv;
+       sc->sc_fb.fb_device = sc->sc_dev;
        fb_attach(&sc->sc_fb, sc->sc_console);
 
        ffb_clearscreen(sc);
@@ -368,7 +368,7 @@
        waa.scrdata = &ffb_screenlist;
        waa.accessops = &ffb_accessops;
        waa.accesscookie = &sc->vd;
-       config_found(&sc->sc_dv, &waa, wsemuldisplaydevprint);
+       config_found(sc->sc_dev, &waa, wsemuldisplaydevprint);
 }
 
 void
@@ -396,7 +396,7 @@
        struct vcons_screen *ms = vd->active;
 
        DPRINTF(("ffb_ioctl: %s cmd _IO%s%s('%c', %lu)\n",
-              device_xname(&sc->sc_dv),
+              device_xname(sc->sc_dev),
               (cmd & IOC_IN) ? "W" : "", (cmd & IOC_OUT) ? "R" : "",
               (char)IOCGROUP(cmd), cmd & 0xff));
 
@@ -432,13 +432,16 @@
                /* the console driver is not using the hardware cursor */
                break;
        case FBIOGCURPOS:
-               printf("%s: FBIOGCURPOS not implemented\n", device_xname(&sc->sc_dv));
+               printf("%s: FBIOGCURPOS not implemented\n",
+                   device_xname(sc->sc_dev));
                return EIO;
        case FBIOSCURPOS:
-               printf("%s: FBIOSCURPOS not implemented\n", device_xname(&sc->sc_dv));
+               printf("%s: FBIOSCURPOS not implemented\n",
+                   device_xname(sc->sc_dev));
                return EIO;
        case FBIOGCURMAX:
-               printf("%s: FBIOGCURMAX not implemented\n", device_xname(&sc->sc_dv));
+               printf("%s: FBIOGCURMAX not implemented\n",
+                   device_xname(sc->sc_dev));
                return EIO;
 
        case WSDISPLAYIO_GTYPE:
@@ -764,7 +767,7 @@
 
 /* frame buffer generic driver support functions */   
 static void
-ffbfb_unblank(struct device *dev)
+ffbfb_unblank(device_t dev)
 {
        struct ffb_softc *sc = device_private(dev);
        struct vcons_screen *ms = sc->vd.active;
@@ -1448,7 +1451,7 @@
        *vres = mode->vdisplay;
 
        printf("%s: video mode set to %d x %d @ %dHz\n",
-           device_xname(&sc->sc_dv),
+           device_xname(sc->sc_dev),
            mode->hdisplay, mode->vdisplay,
            DIVIDE(DIVIDE(mode->dot_clock * 1000,
            mode->htotal), mode->vtotal));
diff -r fac274e7a8eb -r a74e604b657d sys/arch/sparc64/dev/ffb_mainbus.c
--- a/sys/arch/sparc64/dev/ffb_mainbus.c        Fri Jun 03 03:05:21 2011 +0000
+++ b/sys/arch/sparc64/dev/ffb_mainbus.c        Fri Jun 03 03:20:39 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ffb_mainbus.c,v 1.9 2010/09/21 03:31:04 macallan Exp $ */
+/*     $NetBSD: ffb_mainbus.c,v 1.10 2011/06/03 03:20:39 christos Exp $        */
 /*     $OpenBSD: creator_mainbus.c,v 1.4 2002/07/26 16:39:04 jason Exp $       */
 
 /*
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ffb_mainbus.c,v 1.9 2010/09/21 03:31:04 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ffb_mainbus.c,v 1.10 2011/06/03 03:20:39 christos Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -55,30 +55,31 @@
 
 extern int prom_stdout_node;
 
-int    ffb_mainbus_match(struct device *, struct cfdata *, void *);
-void   ffb_mainbus_attach(struct device *, struct device *, void *);
+int    ffb_mainbus_match(device_t, cfdata_t, void *);
+void   ffb_mainbus_attach(device_t, device_t, void *);
 
-CFATTACH_DECL(ffb_mainbus, sizeof(struct ffb_softc),
-             ffb_mainbus_match, ffb_mainbus_attach, NULL, NULL);
+CFATTACH_DECL_NEW(ffb_mainbus, sizeof(struct ffb_softc),
+    ffb_mainbus_match, ffb_mainbus_attach, NULL, NULL);
 
 int
-ffb_mainbus_match(struct device *parent, struct cfdata *match, void *aux)
+ffb_mainbus_match(device_t parent, cfdata_t match, void *aux)
 {
        struct mainbus_attach_args *ma = aux;
 
        if (strcmp(ma->ma_name, "SUNW,ffb") == 0 ||
            strcmp(ma->ma_name, "SUNW,afb") == 0)
-               return (1);
-       return (0);
+               return 1;
+       return 0;
 }
 
 void
-ffb_mainbus_attach(struct device *parent, struct device *self, void *aux)
+ffb_mainbus_attach(device_t parent, device_t self, void *aux)
 {
-       struct ffb_softc *sc = (struct ffb_softc *)self;
+       struct ffb_softc *sc = device_private(self);
        struct mainbus_attach_args *ma = aux;
        int i, nregs;
 
+       sc->sc_dev = self;
        sc->sc_bt = ma->ma_bustag;
 
        nregs = min(ma->ma_nreg, FFB_NREGS);
diff -r fac274e7a8eb -r a74e604b657d sys/arch/sparc64/dev/ffbvar.h
--- a/sys/arch/sparc64/dev/ffbvar.h     Fri Jun 03 03:05:21 2011 +0000
+++ b/sys/arch/sparc64/dev/ffbvar.h     Fri Jun 03 03:20:39 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ffbvar.h,v 1.10 2011/04/09 19:31:15 jdc Exp $  */
+/*     $NetBSD: ffbvar.h,v 1.11 2011/06/03 03:20:39 christos Exp $     */
 /*     $OpenBSD: creatorvar.h,v 1.6 2002/07/30 19:48:15 jason Exp $    */
 
 /*
@@ -49,7 +49,7 @@
 #define EDID_DATA_LEN          128
 
 struct ffb_softc {
-       struct device sc_dv;
+       device_t sc_dev;
        struct fbdevice sc_fb;
        bus_space_tag_t sc_bt;
        bus_space_handle_t sc_dac_h;
diff -r fac274e7a8eb -r a74e604b657d sys/arch/sparc64/dev/pcons.c
--- a/sys/arch/sparc64/dev/pcons.c      Fri Jun 03 03:05:21 2011 +0000
+++ b/sys/arch/sparc64/dev/pcons.c      Fri Jun 03 03:20:39 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pcons.c,v 1.30 2011/04/24 16:26:57 rmind Exp $ */
+/*     $NetBSD: pcons.c,v 1.31 2011/06/03 03:20:39 christos Exp $      */
 
 /*-
  * Copyright (c) 2000 Eduardo E. Horvath
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pcons.c,v 1.30 2011/04/24 16:26:57 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pcons.c,v 1.31 2011/06/03 03:20:39 christos Exp $");
 
 #include "opt_ddb.h"
 
@@ -61,10 +61,10 @@
 
 #include <sparc64/dev/cons.h>
 
-static int pconsmatch(struct device *, struct cfdata *, void *);
-static void pconsattach(struct device *, struct device *, void *);
+static int pconsmatch(device_t, cfdata_t, void *);
+static void pconsattach(device_t, device_t, void *);
 
-CFATTACH_DECL(pcons, sizeof(struct pconssoftc),
+CFATTACH_DECL_NEW(pcons, sizeof(struct pconssoftc),
     pconsmatch, pconsattach, NULL, NULL);
 
 extern struct cfdriver pcons_cd;
@@ -88,7 +88,7 @@
 extern struct consdev *cn_tab;
 
 static int
-pconsmatch(struct device *parent, struct cfdata *match, void *aux)
+pconsmatch(device_t parent, cfdata_t match, void *aux)
 {
        struct mainbus_attach_args *ma = aux;
        extern int  prom_cngetc(dev_t);
@@ -100,9 +100,10 @@
 }
 
 static void
-pconsattach(struct device *parent, struct device *self, void *aux)
+pconsattach(device_t parent, device_t self, void *aux)
 {
-       struct pconssoftc *sc = (struct pconssoftc *) self;
+       struct pconssoftc *sc = device_private(self);
+       sc->of_dev = self;
 
        printf("\n");
        if (!pconsprobe())
diff -r fac274e7a8eb -r a74e604b657d sys/arch/sparc64/dev/pld_wdog.c
--- a/sys/arch/sparc64/dev/pld_wdog.c   Fri Jun 03 03:05:21 2011 +0000
+++ b/sys/arch/sparc64/dev/pld_wdog.c   Fri Jun 03 03:20:39 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pld_wdog.c,v 1.7 2009/03/18 10:22:37 cegger Exp $      */
+/*     $NetBSD: pld_wdog.c,v 1.8 2011/06/03 03:20:39 christos Exp $    */
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -56,7 +56,7 @@
 /* #define PLD_WDOG_DEBUG      1 */
 
 struct pldwdog_softc {
-       struct device           sc_dev;
+       device_t                sc_dev;
 
        bus_space_tag_t         sc_btag;
        bus_space_handle_t      sc_bh;
@@ -65,8 +65,8 @@
        int                     sc_wdog_period;
 };
 
-int    pldwdog_match(struct device *, struct cfdata *, void *);
-void   pldwdog_attach(struct device *, struct device *, void *);



Home | Main Index | Thread Index | Old Index