Module Name:    src
Committed By:   jmcneill
Date:           Wed Jan  9 23:58:41 UTC 2013

Modified Files:
        src/sys/arch/arm/broadcom: bcm2835_genfb.c
        src/sys/arch/evbarm/rpi: rpi_machdep.c

Log Message:
If genfb.type=<int> is passed on cmdline, override the wsdisplay type
returned by WSDISPLAYIO_GTYPE ioctl.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/broadcom/bcm2835_genfb.c
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/evbarm/rpi/rpi_machdep.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/arm/broadcom/bcm2835_genfb.c
diff -u src/sys/arch/arm/broadcom/bcm2835_genfb.c:1.1 src/sys/arch/arm/broadcom/bcm2835_genfb.c:1.2
--- src/sys/arch/arm/broadcom/bcm2835_genfb.c:1.1	Tue Jan  8 23:52:48 2013
+++ src/sys/arch/arm/broadcom/bcm2835_genfb.c	Wed Jan  9 23:58:40 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: bcm2835_genfb.c,v 1.1 2013/01/08 23:52:48 jmcneill Exp $ */
+/* $NetBSD: bcm2835_genfb.c,v 1.2 2013/01/09 23:58:40 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2013 Jared D. McNeill <[email protected]>
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bcm2835_genfb.c,v 1.1 2013/01/08 23:52:48 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bcm2835_genfb.c,v 1.2 2013/01/09 23:58:40 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/types.h>
@@ -49,6 +49,8 @@ struct bcmgenfb_softc {
 	struct genfb_softc	sc_gen;
 	bus_space_tag_t		sc_iot;
 	bus_space_handle_t	sc_ioh;
+
+	uint32_t		sc_wstype;
 };
 
 static int	bcmgenfb_match(device_t, cfdata_t, void *);
@@ -73,12 +75,16 @@ bcmgenfb_attach(device_t parent, device_
 {
 	struct bcmgenfb_softc *sc = device_private(self);
 	struct amba_attach_args *aaa = aux;
+	prop_dictionary_t dict = device_properties(self);
 	struct genfb_ops ops;
 	int error;
 
 	sc->sc_gen.sc_dev = self;
 	sc->sc_iot = aaa->aaa_iot;
 
+	sc->sc_wstype = WSDISPLAY_TYPE_VC4;
+	prop_dictionary_get_uint32(dict, "wsdisplay_type", &sc->sc_wstype);
+
 	genfb_init(&sc->sc_gen);
 
 	if (sc->sc_gen.sc_width == 0 ||
@@ -110,11 +116,12 @@ bcmgenfb_attach(device_t parent, device_
 static int
 bcmgenfb_ioctl(void *v, void *vs, u_long cmd, void *data, int flag, lwp_t *l)
 {
+	struct bcmgenfb_softc *sc = v;
 	struct wsdisplayio_bus_id *busid;
 
 	switch (cmd) {
 	case WSDISPLAYIO_GTYPE:
-		*(u_int *)data = WSDISPLAY_TYPE_VC4;
+		*(u_int *)data = sc->sc_wstype;
 		return 0;
 	case WSDISPLAYIO_GET_BUSID:
 		busid = data;

Index: src/sys/arch/evbarm/rpi/rpi_machdep.c
diff -u src/sys/arch/evbarm/rpi/rpi_machdep.c:1.25 src/sys/arch/evbarm/rpi/rpi_machdep.c:1.26
--- src/sys/arch/evbarm/rpi/rpi_machdep.c:1.25	Wed Jan  9 23:04:10 2013
+++ src/sys/arch/evbarm/rpi/rpi_machdep.c	Wed Jan  9 23:58:40 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: rpi_machdep.c,v 1.25 2013/01/09 23:04:10 skrll Exp $	*/
+/*	$NetBSD: rpi_machdep.c,v 1.26 2013/01/09 23:58:40 jmcneill Exp $	*/
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.25 2013/01/09 23:04:10 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.26 2013/01/09 23:58:40 jmcneill Exp $");
 
 #include "opt_evbarm_boardtype.h"
 
@@ -641,6 +641,7 @@ rpi_fb_init(prop_dictionary_t dict)
 	uint32_t width = 0, height = 0;
 	uint32_t res;
 	char *ptr;
+	int integer; 
 	int error;
 
 	if (get_bootconf_option(boot_args, "console",
@@ -722,6 +723,12 @@ rpi_fb_init(prop_dictionary_t dict)
 	if (vb_setfb.vbt_pixelorder.state == VCPROP_PIXEL_BGR)
 		prop_dictionary_set_bool(dict, "is_bgr", true);
 
+	/* if "genfb.type=<n>" is passed in cmdline, override wsdisplay type */
+	if (get_bootconf_option(boot_args, "genfb.type",
+				BOOTOPT_TYPE_INT, &integer)) {
+		prop_dictionary_set_uint32(dict, "wsdisplay_type", integer);
+	}
+
 	return true;
 }
 #endif

Reply via email to