Module Name:    src
Committed By:   macallan
Date:           Thu Jan 17 23:05:15 UTC 2019

Modified Files:
        src/sys/arch/sparc/dev: cgfourteen.c

Log Message:
don't crash when we're not the console


To generate a diff of this commit:
cvs rdiff -u -r1.86 -r1.87 src/sys/arch/sparc/dev/cgfourteen.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/sparc/dev/cgfourteen.c
diff -u src/sys/arch/sparc/dev/cgfourteen.c:1.86 src/sys/arch/sparc/dev/cgfourteen.c:1.87
--- src/sys/arch/sparc/dev/cgfourteen.c:1.86	Mon Sep  3 16:29:27 2018
+++ src/sys/arch/sparc/dev/cgfourteen.c	Thu Jan 17 23:05:15 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: cgfourteen.c,v 1.86 2018/09/03 16:29:27 riastradh Exp $ */
+/*	$NetBSD: cgfourteen.c,v 1.87 2019/01/17 23:05:15 macallan Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -284,7 +284,7 @@ cgfourteenattach(device_t parent, device
 	if (sbus_bus_map(sa->sa_bustag, sa->sa_slot,
 			 sa->sa_offset,
 			 sa->sa_size,
-			 0 /*BUS_SPACE_MAP_LINEAR*/,
+			 BUS_SPACE_MAP_LINEAR,
 			 &bh) != 0) {
 		printf("%s: cannot map control registers\n",
 		    device_xname(self));
@@ -744,7 +744,7 @@ cg14_setup_wsdisplay(struct cgfourteen_s
 	sc->sc_gc.gc_blitcookie = sc;
 	sc->sc_gc.gc_rectfill = cg14_rectfill_a;
 	sc->sc_gc.gc_rop = 0xc;
-	if (is_cons) {
+
 		vcons_init_screen(&sc->sc_vd, &sc->sc_console_screen, 1,
 		    &defattr);
 
@@ -770,21 +770,10 @@ cg14_setup_wsdisplay(struct cgfourteen_s
 			ri->ri_font->fontwidth,
 			ri->ri_font->fontheight,
 			defattr);
+	if (is_cons) {
 		wsdisplay_cnattach(&sc->sc_defaultscreen_descr, ri, 0, 0,
 		    defattr);
 		vcons_replay_msgbuf(&sc->sc_console_screen);
-	} else {
-		/*
-		 * since we're not the console we can postpone the rest
-		 * until someone actually allocates a screen for us
-		 */
-		glyphcache_init(&sc->sc_gc, sc->sc_fb.fb_type.fb_height + 5,
-			(sc->sc_vramsize / sc->sc_fb.fb_type.fb_width) -
-			 sc->sc_fb.fb_type.fb_height - 5,
-			sc->sc_fb.fb_type.fb_width,
-			ri->ri_font->fontwidth,
-			ri->ri_font->fontheight,
-			DEFATTR);
 	}
 
 	cg14_init_cmap(sc);

Reply via email to