Module Name:    src
Committed By:   christos
Date:           Fri Jun  3 03:20:39 UTC 2011

Modified Files:
        src/sys/arch/sparc64/dev: cons.h ffb.c ffb_mainbus.c ffbvar.h pcons.c
            pld_wdog.c power.c

Log Message:
CFATTACH_DECL_NEW


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/sparc64/dev/cons.h
cvs rdiff -u -r1.42 -r1.43 src/sys/arch/sparc64/dev/ffb.c
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/sparc64/dev/ffb_mainbus.c
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/sparc64/dev/ffbvar.h
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/sparc64/dev/pcons.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/sparc64/dev/pld_wdog.c
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/sparc64/dev/power.c

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/sparc64/dev/cons.h
diff -u src/sys/arch/sparc64/dev/cons.h:1.8 src/sys/arch/sparc64/dev/cons.h:1.9
--- src/sys/arch/sparc64/dev/cons.h:1.8	Mon Oct 16 18:07:11 2006
+++ src/sys/arch/sparc64/dev/cons.h	Thu Jun  2 23:20:39 2011
@@ -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;

Index: src/sys/arch/sparc64/dev/ffb.c
diff -u src/sys/arch/sparc64/dev/ffb.c:1.42 src/sys/arch/sparc64/dev/ffb.c:1.43
--- src/sys/arch/sparc64/dev/ffb.c:1.42	Thu May 19 00:43:45 2011
+++ src/sys/arch/sparc64/dev/ffb.c	Thu Jun  2 23:20:39 2011
@@ -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));

Index: src/sys/arch/sparc64/dev/ffb_mainbus.c
diff -u src/sys/arch/sparc64/dev/ffb_mainbus.c:1.9 src/sys/arch/sparc64/dev/ffb_mainbus.c:1.10
--- src/sys/arch/sparc64/dev/ffb_mainbus.c:1.9	Mon Sep 20 23:31:04 2010
+++ src/sys/arch/sparc64/dev/ffb_mainbus.c	Thu Jun  2 23:20:39 2011
@@ -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);

Index: src/sys/arch/sparc64/dev/ffbvar.h
diff -u src/sys/arch/sparc64/dev/ffbvar.h:1.10 src/sys/arch/sparc64/dev/ffbvar.h:1.11
--- src/sys/arch/sparc64/dev/ffbvar.h:1.10	Sat Apr  9 15:31:15 2011
+++ src/sys/arch/sparc64/dev/ffbvar.h	Thu Jun  2 23:20:39 2011
@@ -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;

Index: src/sys/arch/sparc64/dev/pcons.c
diff -u src/sys/arch/sparc64/dev/pcons.c:1.30 src/sys/arch/sparc64/dev/pcons.c:1.31
--- src/sys/arch/sparc64/dev/pcons.c:1.30	Sun Apr 24 12:26:57 2011
+++ src/sys/arch/sparc64/dev/pcons.c	Thu Jun  2 23:20:39 2011
@@ -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())

Index: src/sys/arch/sparc64/dev/pld_wdog.c
diff -u src/sys/arch/sparc64/dev/pld_wdog.c:1.7 src/sys/arch/sparc64/dev/pld_wdog.c:1.8
--- src/sys/arch/sparc64/dev/pld_wdog.c:1.7	Wed Mar 18 06:22:37 2009
+++ src/sys/arch/sparc64/dev/pld_wdog.c	Thu Jun  2 23:20:39 2011
@@ -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 *);
+int	pldwdog_match(device_t, cfdata_t, void *);
+void	pldwdog_attach(device_t, device_t, void *);
 
 CFATTACH_DECL(pldwdog, sizeof(struct pldwdog_softc),
     pldwdog_match, pldwdog_attach, NULL, NULL);
@@ -99,7 +99,8 @@
 	struct pldwdog_softc *sc = smw->smw_cookie;
 
 #ifdef PLD_WDOG_DEBUG
-	printf("%s:pldwdog_setmode: mode %x\n", device_xname(&sc->sc_dev), smw->smw_mode);
+	printf("%s:pldwdog_setmode: mode %x\n", device_xname(sc->sc_dev),
+	    smw->smw_mode);
 #endif
 
 	if ((smw->smw_mode & WDOG_MODE_MASK) == WDOG_MODE_DISARMED) {
@@ -126,7 +127,7 @@
 #endif
 
 int
-pldwdog_match(struct device *parent, struct cfdata *cf, void *aux)
+pldwdog_match(device_t parent, cfdata_t cf, void *aux)
 {
 	struct ebus_attach_args *ea = aux;
 
@@ -139,24 +140,24 @@
 {
 
 	printf("%s: status 0x%02x, intr mask 0x%02x\n",
-	       device_xname(&sc->sc_dev),
+	       device_xname(sc->sc_dev),
 	       bus_space_read_1(sc->sc_btag, sc->sc_bh, PLD_WDOG_INTR_MASK),
 	       bus_space_read_1(sc->sc_btag, sc->sc_bh, PLD_WDOG_STATUS));
 
 	printf("%s: wdog1: count 0x%04x, limit 0x%04x, status 0x%02x\n",
-	       device_xname(&sc->sc_dev),
+	       device_xname(sc->sc_dev),
 	       bus_space_read_2(sc->sc_btag, sc->sc_bh, PLD_WDOG1_COUNTER),
 	       bus_space_read_2(sc->sc_btag, sc->sc_bh, PLD_WDOG1_LIMIT),
 	       bus_space_read_1(sc->sc_btag, sc->sc_bh, PLD_WDOG1_STATUS));
 
 	printf("%s: wdog2: count 0x%04x, limit 0x%04x, status 0x%02x\n",
-	       device_xname(&sc->sc_dev),
+	       device_xname(sc->sc_dev),
 	       bus_space_read_2(sc->sc_btag, sc->sc_bh, PLD_WDOG2_COUNTER),
 	       bus_space_read_2(sc->sc_btag, sc->sc_bh, PLD_WDOG2_LIMIT),
 	       bus_space_read_1(sc->sc_btag, sc->sc_bh, PLD_WDOG2_STATUS));
 
 	printf("%s: wdog3: count 0x%04x, limit 0x%04x, status 0x%02x\n",
-	       device_xname(&sc->sc_dev),
+	       device_xname(sc->sc_dev),
 	       bus_space_read_2(sc->sc_btag, sc->sc_bh, PLD_WDOG3_COUNTER),
 	       bus_space_read_2(sc->sc_btag, sc->sc_bh, PLD_WDOG3_LIMIT),
 	       bus_space_read_1(sc->sc_btag, sc->sc_bh, PLD_WDOG3_STATUS));
@@ -164,13 +165,14 @@
 #endif
 
 void
-pldwdog_attach(struct device *parent, struct device *self, void *aux)
+pldwdog_attach(device_t parent, device_t self, void *aux)
 {
-	struct pldwdog_softc *sc = (struct pldwdog_softc *)self;
+	struct pldwdog_softc *sc = device_private(self);
 	struct ebus_attach_args *ea = aux;
 
 	printf("\n");
 
+	sc->sc_dev = self;
 	sc->sc_btag = ea->ea_bustag;
 
 	if (ea->ea_nreg < 1) {
@@ -188,14 +190,14 @@
 
 	sc->sc_wdog_period = PLD_WDOG_PERIOD_DEFAULT;
 
-	sc->sc_smw.smw_name = device_xname(&sc->sc_dev);
+	sc->sc_smw.smw_name = device_xname(sc->sc_dev);
 	sc->sc_smw.smw_cookie = sc;
 	sc->sc_smw.smw_setmode = pldwdog_setmode;
 	sc->sc_smw.smw_tickle = pldwdog_tickle;
 	sc->sc_smw.smw_period = sc->sc_wdog_period;
 
 	if (sysmon_wdog_register(&sc->sc_smw) != 0)
-		aprint_error_dev(&sc->sc_dev, "unable to register with sysmon\n");
+		aprint_error_dev(sc->sc_dev, "unable to register with sysmon\n");
 
 /*	pldwdog_regs(sc); */
 

Index: src/sys/arch/sparc64/dev/power.c
diff -u src/sys/arch/sparc64/dev/power.c:1.11 src/sys/arch/sparc64/dev/power.c:1.12
--- src/sys/arch/sparc64/dev/power.c:1.11	Wed Mar 18 06:22:37 2009
+++ src/sys/arch/sparc64/dev/power.c	Thu Jun  2 23:20:39 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: power.c,v 1.11 2009/03/18 10:22:37 cegger Exp $ */
+/*	$NetBSD: power.c,v 1.12 2011/06/03 03:20:39 christos Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -40,7 +40,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: power.c,v 1.11 2009/03/18 10:22:37 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: power.c,v 1.12 2011/06/03 03:20:39 christos Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
@@ -51,10 +51,10 @@
 
 #include <sparc64/dev/power.h>
 
-static int powermatch(struct device *, struct cfdata *, void *);
-static void powerattach(struct device *, struct device *, void *);
+static int powermatch(device_t, cfdata_t, void *);
+static void powerattach(device_t, device_t, void *);
 
-CFATTACH_DECL(power, sizeof(struct device),
+CFATTACH_DECL_NEW(power, 0,
     powermatch, powerattach, NULL, NULL);
 
 extern struct cfdriver power_cd;
@@ -68,19 +68,19 @@
  */
 
 static int
-powermatch(struct device *parent, struct cfdata *cf, void *aux)
+powermatch(device_t parent, cfdata_t cf, void *aux)
 {
-	register struct confargs *ca = aux;
+	struct confargs *ca = aux;
 
 	if (CPU_ISSUN4M)
-		return (strcmp("power", ca->ca_ra.ra_name) == 0);
+		return strcmp("power", ca->ca_ra.ra_name) == 0;
 
-	return (0);
+	return 0;
 }
 
 /* ARGSUSED */
 static void
-powerattach(struct device *parent, struct device *self, void *aux)
+powerattach(device_t parent, device_t self, void *aux)
 {
 	struct confargs *ca = aux;
 	struct romaux *ra = &ca->ca_ra;

Reply via email to