Module Name:    src
Committed By:   jmcneill
Date:           Tue Jun  6 00:26:59 UTC 2017

Modified Files:
        src/sys/arch/arm/fdt: plfb_fdt.c

Log Message:
Allow plfb to be the console device


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/fdt/plfb_fdt.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/fdt/plfb_fdt.c
diff -u src/sys/arch/arm/fdt/plfb_fdt.c:1.1 src/sys/arch/arm/fdt/plfb_fdt.c:1.2
--- src/sys/arch/arm/fdt/plfb_fdt.c:1.1	Sat Jun  3 14:50:39 2017
+++ src/sys/arch/arm/fdt/plfb_fdt.c	Tue Jun  6 00:26:59 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: plfb_fdt.c,v 1.1 2017/06/03 14:50:39 jmcneill Exp $ */
+/* $NetBSD: plfb_fdt.c,v 1.2 2017/06/06 00:26:59 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill <jmcne...@invisible.ca>
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: plfb_fdt.c,v 1.1 2017/06/03 14:50:39 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: plfb_fdt.c,v 1.2 2017/06/06 00:26:59 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/types.h>
@@ -68,6 +68,8 @@ __KERNEL_RCSID(0, "$NetBSD: plfb_fdt.c,v
 
 #define	PLFB_BPP		32
 
+static int plfb_console_phandle = -1;
+
 struct plfb_softc {
 	struct genfb_softc	sc_gen;
 	bus_space_tag_t		sc_bst;
@@ -170,7 +172,8 @@ plfb_attach(device_t parent, device_t se
 	plfb_init(sc);
 
 	sc->sc_wstype = WSDISPLAY_TYPE_PLFB;
-	prop_dictionary_set_bool(dict, "is_console", false);
+	prop_dictionary_set_bool(dict, "is_console",
+	    phandle == plfb_console_phandle);
 
 	genfb_init(&sc->sc_gen);
 
@@ -294,3 +297,23 @@ plfb_init(struct plfb_softc *sc)
 	    LCDCONTROL_PWR | LCDCONTROL_EN | LCDCONTROL_BPP_24 |
 	    LCDCONTROL_BGR);
 }
+
+static int
+plfb_console_match(int phandle)
+{
+	return of_match_compatible(phandle, compatible);
+}
+
+static void
+plfb_console_consinit(struct fdt_attach_args *faa, u_int uart_freq)
+{
+	plfb_console_phandle = faa->faa_phandle;
+	genfb_cnattach();
+}
+
+static const struct fdt_console plfb_fdt_console = {
+	.match = plfb_console_match,
+	.consinit = plfb_console_consinit
+};
+
+FDT_CONSOLE(plfb, &plfb_fdt_console);

Reply via email to