Module Name:    src
Committed By:   rin
Date:           Sat Jun  5 02:27:08 UTC 2021

Modified Files:
        src/sys/dev/hpc: hpcfb.c

Log Message:
hpcfb_cnattach(): If fbconf == NULL, this is for early console output
(used for hpcmips/VR41xx machines), and wsdisplay_preattach() should be
used instead of wsdisplay_cnattach().

Fix KASSERT failure for double attach of wsdisplay, reported in port-mips.


To generate a diff of this commit:
cvs rdiff -u -r1.61 -r1.62 src/sys/dev/hpc/hpcfb.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/dev/hpc/hpcfb.c
diff -u src/sys/dev/hpc/hpcfb.c:1.61 src/sys/dev/hpc/hpcfb.c:1.62
--- src/sys/dev/hpc/hpcfb.c:1.61	Sat Apr 24 23:36:54 2021
+++ src/sys/dev/hpc/hpcfb.c	Sat Jun  5 02:27:08 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: hpcfb.c,v 1.61 2021/04/24 23:36:54 thorpej Exp $	*/
+/*	$NetBSD: hpcfb.c,v 1.62 2021/06/05 02:27:08 rin Exp $	*/
 
 /*-
  * Copyright (c) 1999
@@ -43,7 +43,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hpcfb.c,v 1.61 2021/04/24 23:36:54 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hpcfb.c,v 1.62 2021/06/05 02:27:08 rin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_hpcfb.h"
@@ -410,8 +410,17 @@ hpcfb_cnattach(struct hpcfb_fbconf *fbco
 	hpcfb_console_wsscreen.capabilities = hpcfb_console_dc.dc_rinfo.ri_caps;
 	hpcfb_allocattr(&hpcfb_console_dc,
 			WSCOL_WHITE, WSCOL_BLACK, 0, &defattr);
-	wsdisplay_cnattach(&hpcfb_console_wsscreen, &hpcfb_console_dc,
-	    0, 0, defattr);
+#if NBIVIDEO > 0
+	/*
+	 * This is early console. Do not really attach wsdisplay.
+	 */
+	if (fbconf == &__fbconf)
+		wsdisplay_preattach(&hpcfb_console_wsscreen, &hpcfb_console_dc,
+		    0, 0, defattr);
+	else
+#endif
+		wsdisplay_cnattach(&hpcfb_console_wsscreen, &hpcfb_console_dc,
+		    0, 0, defattr);
 	hpcfbconsole = 1;
 
 	return (0);

Reply via email to