Module Name:    src
Committed By:   tsutsui
Date:           Sat Sep 19 04:52:44 UTC 2009

Modified Files:
        src/sys/arch/sparc/dev: bwtwo_obio.c
        src/sys/arch/sun2/dev: bwtwo_any.c
        src/sys/dev/sbus: bwtwo_sbus.c
        src/sys/dev/sun: bwtwo.c bwtwovar.h

Log Message:
Split device_t/softc.
Tested on TME emulating SS2.

XXX: bwtwo at obmem on TME emulating sun2 didn't match and cannot test


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/sparc/dev/bwtwo_obio.c
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/sun2/dev/bwtwo_any.c
cvs rdiff -u -r1.28 -r1.29 src/sys/dev/sbus/bwtwo_sbus.c
cvs rdiff -u -r1.26 -r1.27 src/sys/dev/sun/bwtwo.c
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/sun/bwtwovar.h

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/sparc/dev/bwtwo_obio.c
diff -u src/sys/arch/sparc/dev/bwtwo_obio.c:1.16 src/sys/arch/sparc/dev/bwtwo_obio.c:1.17
--- src/sys/arch/sparc/dev/bwtwo_obio.c:1.16	Mon Apr 28 20:23:35 2008
+++ src/sys/arch/sparc/dev/bwtwo_obio.c	Sat Sep 19 04:52:44 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: bwtwo_obio.c,v 1.16 2008/04/28 20:23:35 martin Exp $ */
+/*	$NetBSD: bwtwo_obio.c,v 1.17 2009/09/19 04:52:44 tsutsui Exp $ */
 
 /*-
  * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@@ -79,7 +79,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bwtwo_obio.c,v 1.16 2008/04/28 20:23:35 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bwtwo_obio.c,v 1.17 2009/09/19 04:52:44 tsutsui Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -103,11 +103,11 @@
 #include <dev/sun/pfourreg.h>
 
 /* autoconfiguration driver */
-static void	bwtwoattach_obio (struct device *, struct device *, void *);
-static int	bwtwomatch_obio (struct device *, struct cfdata *, void *);
+static int	bwtwomatch_obio(device_t, cfdata_t, void *);
+static void	bwtwoattach_obio(device_t, device_t, void *);
 
 
-CFATTACH_DECL(bwtwo_obio, sizeof(struct bwtwo_softc),
+CFATTACH_DECL_NEW(bwtwo_obio, sizeof(struct bwtwo_softc),
     bwtwomatch_obio, bwtwoattach_obio, NULL, NULL);
 
 static int	bwtwo_get_video_sun4(struct bwtwo_softc *);
@@ -116,7 +116,7 @@
 extern int fbnode;
 
 static int
-bwtwomatch_obio(struct device *parent, struct cfdata *cf, void *aux)
+bwtwomatch_obio(device_t parent, cfdata_t cf, void *aux)
 {
 	union obio_attach_args *uoba = aux;
 	struct obio4_attach_args *oba;
@@ -133,9 +133,9 @@
 }
 
 static void
-bwtwoattach_obio(struct device *parent, struct device *self, void *aux)
+bwtwoattach_obio(device_t parent, device_t self, void *aux)
 {
-	struct bwtwo_softc *sc = (struct bwtwo_softc *)self;
+	struct bwtwo_softc *sc = device_private(self);
 	union obio_attach_args *uoba = aux;
 	struct obio4_attach_args *oba;
 	struct fbdevice *fb = &sc->sc_fb;
@@ -144,13 +144,14 @@
 	int constype, isconsole;
 	const char *name;
 
+	sc->sc_dev = self;
 	oba = &uoba->uoba_oba4;
 
 	/* Remember cookies for bwtwo_mmap() */
 	sc->sc_bustag = oba->oba_bustag;
 	sc->sc_paddr = (bus_addr_t)oba->oba_paddr;
 
-	fb->fb_flags = device_cfdata(&sc->sc_dev)->cf_flags;
+	fb->fb_flags = device_cfdata(self)->cf_flags;
 	fb->fb_type.fb_depth = 1;
 	fb_setsize_eeprom(fb, fb->fb_type.fb_depth, 1152, 900);
 
@@ -173,7 +174,7 @@
 				  BUS_SPACE_MAP_LINEAR,
 				  &bh) != 0) {
 			printf("%s: cannot map pfour register\n",
-				self->dv_xname);
+			    device_xname(self));
 			return;
 		}
 		fb->fb_pfour = (uint32_t *)bh;
@@ -210,7 +211,7 @@
 				  BUS_SPACE_MAP_LINEAR,
 				  &bh) != 0) {
 			printf("%s: cannot map control registers\n",
-				self->dv_xname);
+			    device_xname(self));
 			return;
 		}
 		sc->sc_reg = (struct fbcontrol *)bh;
@@ -229,7 +230,7 @@
 				  ramsize,
 				  BUS_SPACE_MAP_LINEAR,
 				  &bh) != 0) {
-			printf("%s: cannot map pixels\n", self->dv_xname);
+			printf("%s: cannot map pixels\n", device_xname(self));
 			return;
 		}
 		sc->sc_fb.fb_pixels = (char *)bh;

Index: src/sys/arch/sun2/dev/bwtwo_any.c
diff -u src/sys/arch/sun2/dev/bwtwo_any.c:1.16 src/sys/arch/sun2/dev/bwtwo_any.c:1.17
--- src/sys/arch/sun2/dev/bwtwo_any.c:1.16	Mon Apr 28 20:23:37 2008
+++ src/sys/arch/sun2/dev/bwtwo_any.c	Sat Sep 19 04:52:44 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: bwtwo_any.c,v 1.16 2008/04/28 20:23:37 martin Exp $ */
+/*	$NetBSD: bwtwo_any.c,v 1.17 2009/09/19 04:52:44 tsutsui Exp $ */
 
 /*-
  * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@@ -79,7 +79,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bwtwo_any.c,v 1.16 2008/04/28 20:23:37 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bwtwo_any.c,v 1.17 2009/09/19 04:52:44 tsutsui Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -100,18 +100,18 @@
 #include <dev/sun/bwtwovar.h>
 
 /* autoconfiguration driver */
-static void	bwtwoattach_any (struct device *, struct device *, void *);
-static int	bwtwomatch_any (struct device *, struct cfdata *, void *);
+static int	bwtwomatch_any(device_t, cfdata_t, void *);
+static void	bwtwoattach_any(device_t, device_t, void *);
 
 struct bwtwosun2_softc {
 	struct bwtwo_softc sc;
 	bus_space_handle_t bh;
 };
 
-CFATTACH_DECL(bwtwo_obio, sizeof(struct bwtwosun2_softc),
+CFATTACH_DECL_NEW(bwtwo_obio, sizeof(struct bwtwosun2_softc),
     bwtwomatch_any, bwtwoattach_any, NULL, NULL);
 
-CFATTACH_DECL(bwtwo_obmem, sizeof(struct bwtwosun2_softc),
+CFATTACH_DECL_NEW(bwtwo_obmem, sizeof(struct bwtwosun2_softc),
     bwtwomatch_any, bwtwoattach_any, NULL, NULL);
 
 static int	bwtwo_get_video_sun2(struct bwtwo_softc *);
@@ -120,7 +120,7 @@
 extern int fbnode;
 
 static int 
-bwtwomatch_any(struct device *parent, struct cfdata *cf, void *aux)
+bwtwomatch_any(device_t parent, cfdata_t cf, void *aux)
 {
 	struct mainbus_attach_args *ma = aux;
 	bus_space_handle_t bh;
@@ -136,9 +136,9 @@
 }
 
 static void 
-bwtwoattach_any(struct device *parent, struct device *self, void *aux)
+bwtwoattach_any(device_t parent, device_t self, void *aux)
 {
-	struct bwtwosun2_softc *scsun2 = (struct bwtwosun2_softc *)self;
+	struct bwtwosun2_softc *scsun2 = device_private(self);
 	struct bwtwo_softc *sc = &scsun2->sc;
 	struct mainbus_attach_args *ma = aux;
 	struct fbdevice *fb = &sc->sc_fb;
@@ -146,11 +146,13 @@
 	int isconsole;
 	const char *name;
 
+	sc->sc_dev = self;
+
 	/* Remember cookies for bwtwo_mmap() */
 	sc->sc_bustag = ma->ma_bustag;
 	sc->sc_paddr = ma->ma_paddr;
 
-	fb->fb_flags = device_cfdata(&sc->sc_dev)->cf_flags;
+	fb->fb_flags = device_cfdata(self)->cf_flags;
 	fb->fb_type.fb_depth = 1;
 	fb_setsize_eeprom(fb, fb->fb_type.fb_depth, 1152, 900);
 
@@ -167,7 +169,7 @@
 	/* Map the registers. */
 	if (bus_space_map(ma->ma_bustag, ma->ma_paddr + BWREG_REG,
 			  sizeof(struct bwtworeg), 0, &scsun2->bh)) {
-		printf("%s: cannot map regs\n", self->dv_xname);
+		printf("%s: cannot map regs\n", device_xname(self));
 		return;
 	}
 
@@ -177,7 +179,7 @@
 				  ma->ma_paddr + sc->sc_pixeloffset,
 				  ramsize,
 				  BUS_SPACE_MAP_LINEAR, &bh) != 0) {
-			printf("%s: cannot map pixels\n", self->dv_xname);
+			printf("%s: cannot map pixels\n", device_xname(self));
 			return;
 		}
 		sc->sc_fb.fb_pixels = (char *)bh;

Index: src/sys/dev/sbus/bwtwo_sbus.c
diff -u src/sys/dev/sbus/bwtwo_sbus.c:1.28 src/sys/dev/sbus/bwtwo_sbus.c:1.29
--- src/sys/dev/sbus/bwtwo_sbus.c:1.28	Sat Sep 19 03:49:22 2009
+++ src/sys/dev/sbus/bwtwo_sbus.c	Sat Sep 19 04:52:44 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: bwtwo_sbus.c,v 1.28 2009/09/19 03:49:22 tsutsui Exp $ */
+/*	$NetBSD: bwtwo_sbus.c,v 1.29 2009/09/19 04:52:44 tsutsui Exp $ */
 
 /*-
  * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@@ -79,7 +79,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bwtwo_sbus.c,v 1.28 2009/09/19 03:49:22 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bwtwo_sbus.c,v 1.29 2009/09/19 04:52:44 tsutsui Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -106,7 +106,7 @@
 static void	bwtwoattach_sbus (device_t, device_t, void *);
 static int	bwtwomatch_sbus (device_t, cfdata_t, void *);
 
-CFATTACH_DECL(bwtwo_sbus, sizeof(struct bwtwo_softc),
+CFATTACH_DECL_NEW(bwtwo_sbus, sizeof(struct bwtwo_softc),
     bwtwomatch_sbus, bwtwoattach_sbus, NULL, NULL);
 
 static int	bwtwo_get_video (struct bwtwo_softc *);
@@ -140,6 +140,7 @@
 	int isconsole, node;
 	const char *name;
 
+	sc->sc_dev = self;
 	node = sa->sa_node;
 
 	/* Remember cookies for bwtwo_mmap() */

Index: src/sys/dev/sun/bwtwo.c
diff -u src/sys/dev/sun/bwtwo.c:1.26 src/sys/dev/sun/bwtwo.c:1.27
--- src/sys/dev/sun/bwtwo.c:1.26	Tue May 12 14:46:39 2009
+++ src/sys/dev/sun/bwtwo.c	Sat Sep 19 04:52:44 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: bwtwo.c,v 1.26 2009/05/12 14:46:39 cegger Exp $ */
+/*	$NetBSD: bwtwo.c,v 1.27 2009/09/19 04:52:44 tsutsui Exp $ */
 
 /*-
  * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@@ -79,7 +79,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bwtwo.c,v 1.26 2009/05/12 14:46:39 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bwtwo.c,v 1.27 2009/09/19 04:52:44 tsutsui Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -202,7 +202,7 @@
 
 	/* Fill in the remaining fbdevice values */
 	fb->fb_driver = &bwtwofbdriver;
-	fb->fb_device = &sc->sc_dev;
+	fb->fb_device = sc->sc_dev;
 	fb->fb_type.fb_type = FBTYPE_SUN2BW;
 	fb->fb_type.fb_cmsize = 0;
 	fb->fb_type.fb_size = fb->fb_type.fb_height * fb->fb_linebytes;
@@ -248,7 +248,8 @@
 			ovnam = "unknown";
 			break;
 		}
-		printf("%s: %s overlay plane\n", device_xname(&sc->sc_dev), ovnam);
+		printf("%s: %s overlay plane\n",
+		    device_xname(sc->sc_dev), ovnam);
 	}
 
 	/*
@@ -314,7 +315,7 @@
 		aa.console = isconsole;
 	aa.accessops = &bwtwo_accessops;
 	aa.accesscookie = &sc->vd;
-	config_found(&sc->sc_dev, &aa, wsemuldisplaydevprint);
+	config_found(sc->sc_dev, &aa, wsemuldisplaydevprint);
 #endif
 
 }

Index: src/sys/dev/sun/bwtwovar.h
diff -u src/sys/dev/sun/bwtwovar.h:1.8 src/sys/dev/sun/bwtwovar.h:1.9
--- src/sys/dev/sun/bwtwovar.h:1.8	Mon Feb 23 22:44:27 2009
+++ src/sys/dev/sun/bwtwovar.h	Sat Sep 19 04:52:44 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: bwtwovar.h,v 1.8 2009/02/23 22:44:27 jdc Exp $ */
+/*	$NetBSD: bwtwovar.h,v 1.9 2009/09/19 04:52:44 tsutsui Exp $ */
 
 /*-
  * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@@ -74,7 +74,7 @@
 
 /* per-display variables */
 struct bwtwo_softc {
-	struct device	sc_dev;		/* base device */
+	device_t	sc_dev;		/* base device */
 	struct fbdevice	sc_fb;		/* frame buffer device */
 	bus_space_tag_t	sc_bustag;
 	bus_addr_t	sc_paddr;	/* phys address for device mmap() */

Reply via email to