Module Name:    src
Committed By:   macallan
Date:           Fri Mar  2 14:37:18 UTC 2018

Modified Files:
        src/sys/arch/powerpc/oea: ofw_rascons.c ofw_rasconsvar.h
            ofwoea_machdep.c

Log Message:
defer scribbling into video memory until after re-enabling the MMU if
we're in bridge mode.
With this NetBSD boots on PCI-X G5s


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/powerpc/oea/ofw_rascons.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/powerpc/oea/ofw_rasconsvar.h
cvs rdiff -u -r1.42 -r1.43 src/sys/arch/powerpc/oea/ofwoea_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/powerpc/oea/ofw_rascons.c
diff -u src/sys/arch/powerpc/oea/ofw_rascons.c:1.10 src/sys/arch/powerpc/oea/ofw_rascons.c:1.11
--- src/sys/arch/powerpc/oea/ofw_rascons.c:1.10	Fri Feb 23 02:54:56 2018
+++ src/sys/arch/powerpc/oea/ofw_rascons.c	Fri Mar  2 14:37:18 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ofw_rascons.c,v 1.10 2018/02/23 02:54:56 sevan Exp $	*/
+/*	$NetBSD: ofw_rascons.c,v 1.11 2018/03/02 14:37:18 macallan Exp $	*/
 
 /*
  * Copyright (c) 1995, 1996 Carnegie-Mellon University.
@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ofw_rascons.c,v 1.10 2018/02/23 02:54:56 sevan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ofw_rascons.c,v 1.11 2018/03/02 14:37:18 macallan Exp $");
 
 #include "wsdisplay.h"
 
@@ -53,6 +53,7 @@ __KERNEL_RCSID(0, "$NetBSD: ofw_rascons.
 #include <dev/wsfont/wsfont.h>
 
 #include <powerpc/oea/bat.h>
+#include <powerpc/oea/cpufeat.h>
 #include <powerpc/oea/ofw_rasconsvar.h>
 
 /* we need a wsdisplay to do anything halfway useful */
@@ -62,6 +63,7 @@ static int copy_rom_font(void);
 static struct wsdisplay_font openfirm6x11;
 static vaddr_t fbaddr;
 static int romfont_loaded = 0;
+static int needs_finalize = 0;
 
 struct vcons_screen rascons_console_screen;
 
@@ -115,10 +117,13 @@ rascons_cnattach(void)
 	rascons_stdscreen.textops = &ri->ri_ops;
 	rascons_stdscreen.capabilities = ri->ri_caps;
 
-	ri->ri_ops.allocattr(ri, 0, 0, 0, &defattr);
-	wsdisplay_preattach(&rascons_stdscreen, ri, 0, max(0,
-	    min(crow, ri->ri_rows - 1)), defattr);
-
+	if ((oeacpufeat & OEACPU_64_BRIDGE) != 0) {
+		needs_finalize = 1;
+	} else {
+		ri->ri_ops.allocattr(ri, 0, 0, 0, &defattr);
+		wsdisplay_preattach(&rascons_stdscreen, ri, 0, max(0,
+		    min(crow, ri->ri_rows - 1)), defattr);
+	}
 #if notyet
 	rascons_init_cmap(NULL);
 #endif
@@ -126,6 +131,18 @@ rascons_cnattach(void)
 	return 0;
 }
 
+void
+rascons_finalize(void)
+{
+	struct rasops_info *ri = &rascons_console_screen.scr_ri;
+	long defattr;
+
+	if (needs_finalize == 0) return;
+	
+	ri->ri_ops.allocattr(ri, 0, 0, 0, &defattr);
+	wsdisplay_preattach(&rascons_stdscreen, ri, 0, 0, defattr);
+}
+
 static int
 copy_rom_font(void)
 {

Index: src/sys/arch/powerpc/oea/ofw_rasconsvar.h
diff -u src/sys/arch/powerpc/oea/ofw_rasconsvar.h:1.1 src/sys/arch/powerpc/oea/ofw_rasconsvar.h:1.2
--- src/sys/arch/powerpc/oea/ofw_rasconsvar.h:1.1	Mon Nov 26 19:58:31 2007
+++ src/sys/arch/powerpc/oea/ofw_rasconsvar.h	Fri Mar  2 14:37:18 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ofw_rasconsvar.h,v 1.1 2007/11/26 19:58:31 garbled Exp $	*/
+/*	$NetBSD: ofw_rasconsvar.h,v 1.2 2018/03/02 14:37:18 macallan Exp $	*/
 
 /*
  * Copyright (c) 1995, 1996 Carnegie-Mellon University.
@@ -33,5 +33,6 @@
 extern struct vcons_screen rascons_console_screen;
 extern struct wsscreen_descr rascons_stdscreen;
 int rascons_init_rasops(int, struct rasops_info *);
+void rascons_finalize(void);
 
 #endif /* _OFW_RASCONSVAR_H_ */

Index: src/sys/arch/powerpc/oea/ofwoea_machdep.c
diff -u src/sys/arch/powerpc/oea/ofwoea_machdep.c:1.42 src/sys/arch/powerpc/oea/ofwoea_machdep.c:1.43
--- src/sys/arch/powerpc/oea/ofwoea_machdep.c:1.42	Sun Jan 21 08:46:48 2018
+++ src/sys/arch/powerpc/oea/ofwoea_machdep.c	Fri Mar  2 14:37:18 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: ofwoea_machdep.c,v 1.42 2018/01/21 08:46:48 mrg Exp $ */
+/* $NetBSD: ofwoea_machdep.c,v 1.43 2018/03/02 14:37:18 macallan Exp $ */
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ofwoea_machdep.c,v 1.42 2018/01/21 08:46:48 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ofwoea_machdep.c,v 1.43 2018/03/02 14:37:18 macallan Exp $");
 
 #include "opt_ppcarch.h"
 #include "opt_compat_netbsd.h"
@@ -180,8 +180,8 @@ ofwoea_initppc(u_int startkernel, u_int 
 		model_init();
 	}
 
-	if (strcmp(model_name, "PowerMac11,2") == 0 ||
-	    strcmp(model_name, "PowerMac11,1") == 0)
+	if (strncmp(model_name, "PowerMac11,", 11) == 0 ||
+	    strncmp(model_name, "PowerMac7,", 10) == 0) 
 		OF_quiesce();
 
 	/* Initialize bus_space */
@@ -293,6 +293,8 @@ ofwoea_initppc(u_int startkernel, u_int 
 
 	restore_ofmap(ofmap, ofmaplen);
 
+	rascons_finalize();
+
 #if NKSYMS || defined(DDB) || defined(MODULAR)
 	ksyms_addsyms_elf((int)((uintptr_t)endsym - (uintptr_t)startsym), startsym, endsym);
 #endif

Reply via email to