CVS commit: src/sys/arch/powerpc/oea

2019-01-06 Thread Frank Wille
Module Name:src
Committed By:   phx
Date:   Sun Jan  6 11:20:53 UTC 2019

Modified Files:
src/sys/arch/powerpc/oea: cpu_subr.c

Log Message:
Only execute dssall when the CPU has the Altivec instruction set extension.


To generate a diff of this commit:
cvs rdiff -u -r1.97 -r1.98 src/sys/arch/powerpc/oea/cpu_subr.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/cpu_subr.c
diff -u src/sys/arch/powerpc/oea/cpu_subr.c:1.97 src/sys/arch/powerpc/oea/cpu_subr.c:1.98
--- src/sys/arch/powerpc/oea/cpu_subr.c:1.97	Fri Jun 15 23:11:39 2018
+++ src/sys/arch/powerpc/oea/cpu_subr.c	Sun Jan  6 11:20:53 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu_subr.c,v 1.97 2018/06/15 23:11:39 uwe Exp $	*/
+/*	$NetBSD: cpu_subr.c,v 1.98 2019/01/06 11:20:53 phx Exp $	*/
 
 /*-
  * Copyright (c) 2001 Matt Thomas.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu_subr.c,v 1.97 2018/06/15 23:11:39 uwe Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu_subr.c,v 1.98 2019/01/06 11:20:53 phx Exp $");
 
 #include "opt_ppcparam.h"
 #include "opt_ppccache.h"
@@ -329,10 +329,12 @@ cpu_idlespin(void)
 	if (powersave <= 0)
 		return;
 
-	__asm volatile(
 #if defined(_ARCH_PPC64) || defined (PPC_OEA64_BRIDGE)
-		"dssall;"
+	if (cpu_altivec)
+		__asm volatile("dssall");
 #endif
+
+	__asm volatile(
 		"sync;"
 		"mfmsr	%0;"
 		"oris	%0,%0,%1@h;"	/* enter power saving mode */



CVS commit: src/sys/arch/powerpc/oea

2018-11-21 Thread Sean Cole
Module Name:src
Committed By:   scole
Date:   Wed Nov 21 17:54:43 UTC 2018

Modified Files:
src/sys/arch/powerpc/oea: ofw_autoconf.c

Log Message:
don't bother reading ofw properties for platinumfb


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/powerpc/oea/ofw_autoconf.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_autoconf.c
diff -u src/sys/arch/powerpc/oea/ofw_autoconf.c:1.22 src/sys/arch/powerpc/oea/ofw_autoconf.c:1.23
--- src/sys/arch/powerpc/oea/ofw_autoconf.c:1.22	Fri Aug 17 15:54:35 2018
+++ src/sys/arch/powerpc/oea/ofw_autoconf.c	Wed Nov 21 17:54:42 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: ofw_autoconf.c,v 1.22 2018/08/17 15:54:35 macallan Exp $ */
+/* $NetBSD: ofw_autoconf.c,v 1.23 2018/11/21 17:54:42 scole Exp $ */
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
  * Copyright (C) 1995, 1996 TooLs GmbH.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ofw_autoconf.c,v 1.22 2018/08/17 15:54:35 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ofw_autoconf.c,v 1.23 2018/11/21 17:54:42 scole Exp $");
 
 #ifdef ofppc
 #include "gtpci.h"
@@ -244,6 +244,11 @@ device_register(device_t dev, void *aux)
 		copy_disp_props(dev, ca->ca_node, dict);
 	}
 
+	/* cannot read useful display properties for platinum */
+	if (device_is_a(dev, "platinumfb")) {
+		return;
+	}
+
 #if NGTPCI > 0
 	if (device_is_a(dev, "gtpci")) {
 		extern struct gtpci_prot gtpci0_prot, gtpci1_prot;



CVS commit: src/sys/arch/powerpc/oea

2018-08-17 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Aug 17 15:54:35 UTC 2018

Modified Files:
src/sys/arch/powerpc/oea: ofw_autoconf.c

Log Message:
parse G5 device paths


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/powerpc/oea/ofw_autoconf.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_autoconf.c
diff -u src/sys/arch/powerpc/oea/ofw_autoconf.c:1.21 src/sys/arch/powerpc/oea/ofw_autoconf.c:1.22
--- src/sys/arch/powerpc/oea/ofw_autoconf.c:1.21	Sun Mar  4 00:21:20 2018
+++ src/sys/arch/powerpc/oea/ofw_autoconf.c	Fri Aug 17 15:54:35 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: ofw_autoconf.c,v 1.21 2018/03/04 00:21:20 macallan Exp $ */
+/* $NetBSD: ofw_autoconf.c,v 1.22 2018/08/17 15:54:35 macallan Exp $ */
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
  * Copyright (C) 1995, 1996 TooLs GmbH.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ofw_autoconf.c,v 1.21 2018/03/04 00:21:20 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ofw_autoconf.c,v 1.22 2018/08/17 15:54:35 macallan Exp $");
 
 #ifdef ofppc
 #include "gtpci.h"
@@ -231,6 +231,11 @@ device_register(device_t dev, void *aux)
 		return;
 	}
 
+	/* skip over CPUs */
+	if (device_is_a(dev, "cpu")) {
+		return;
+	}
+
 	if (device_is_a(dev, "valkyriefb")) {
 		struct confargs *ca = aux;
 		prop_dictionary_t dict;
@@ -306,7 +311,10 @@ device_register(device_t dev, void *aux)
 		CACHELINESIZE);
 	}
 #endif
-	if (device_is_a(dev, "atapibus") || device_is_a(dev, "pci") ||
+	if (device_is_a(dev, "atapibus") ||
+#ifndef PMAC_G5
+	device_is_a(dev, "pci") ||
+#endif
 	device_is_a(dev, "scsibus") || device_is_a(dev, "atabus"))
 		return;
 
@@ -379,13 +387,17 @@ device_register(device_t dev, void *aux)
 	 * Skip over devices that are really just layers of NetBSD
 	 * autoconf(9) we should just skip as they do not have any
 	 * OFW devices.
+	 * XXX except on G5, where we have /ht/pci* instead of /pci*
 	 */
 	if (device_is_a(device_parent(dev), "atapibus") ||
 	device_is_a(device_parent(dev), "atabus") ||
+#ifndef PMAC_G5
 	device_is_a(device_parent(dev), "pci") ||
+#endif
 	device_is_a(device_parent(dev), "scsibus")) {
-		if (device_parent(device_parent(dev)) != parent)
+		if (device_parent(device_parent(dev)) != parent) {
 			return;
+		}
 	} else {
 		if (device_parent(dev) != parent)
 			return;
@@ -416,13 +428,14 @@ device_register(device_t dev, void *aux)
 
 	if (device_is_a(device_parent(dev), "mainbus")) {
 		struct confargs *ca = aux;
-
 		if (strcmp(ca->ca_name, "ofw") == 0)		/* XXX */
 			return;
 		if (strcmp(ca->ca_name, "gt") == 0)
 			parent = dev;
 		if (addr != ca->ca_reg[0])
 			return;
+		if (addr2 != 0 && addr2 != ca->ca_reg[1])
+			return;
 	} else if (device_is_a(device_parent(dev), "gt")) {
 		/*
 		 * Special handle for MV64361 on PegasosII(ofppc).
@@ -477,13 +490,27 @@ device_register(device_t dev, void *aux)
 
 		if (addr != adev->adev_drv_data->drive)
 			return;
+	} else if (device_is_a(dev, "pci")) {
+		if (addr != device_unit(dev))
+			return;
+	} else if (device_is_a(device_parent(dev), "atabus")) {
+		/*
+		 * XXX
+		 * on svwsata this is the channel number and we ignore the
+		 * drive number which is always 0 anyway
+		 * needs to be revisited for other (S)ATA cards
+		 */
+		struct ata_device *adev = aux;
+		if (addr != adev->adev_channel)
+			return;
+		/* we have our match, cut off the rest */
+		if (p) *p = 0;
 	} else
 		return;
 
 	/* If we reach this point, then dev is a match for the current
 	 * path component.
 	 */
-
 	if (p && *p) {
 		parent = dev;
 		cp = p;



CVS commit: src/sys/arch/powerpc/oea

2018-06-15 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Fri Jun 15 23:11:39 UTC 2018

Modified Files:
src/sys/arch/powerpc/oea: cpu_subr.c

Log Message:
Fix fmttab value for L2CR_L2PE (parity enabled) so that we don't print
self-contradictory "no parity parity enabled".


To generate a diff of this commit:
cvs rdiff -u -r1.96 -r1.97 src/sys/arch/powerpc/oea/cpu_subr.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/cpu_subr.c
diff -u src/sys/arch/powerpc/oea/cpu_subr.c:1.96 src/sys/arch/powerpc/oea/cpu_subr.c:1.97
--- src/sys/arch/powerpc/oea/cpu_subr.c:1.96	Fri Jun  8 23:40:44 2018
+++ src/sys/arch/powerpc/oea/cpu_subr.c	Fri Jun 15 23:11:39 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu_subr.c,v 1.96 2018/06/08 23:40:44 macallan Exp $	*/
+/*	$NetBSD: cpu_subr.c,v 1.97 2018/06/15 23:11:39 uwe Exp $	*/
 
 /*-
  * Copyright (c) 2001 Matt Thomas.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu_subr.c,v 1.96 2018/06/08 23:40:44 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu_subr.c,v 1.97 2018/06/15 23:11:39 uwe Exp $");
 
 #include "opt_ppcparam.h"
 #include "opt_ppccache.h"
@@ -97,7 +97,7 @@ static const struct fmttab cpu_7450_l2cr
 	{ L2CR_L2DO|L2CR_L2IO, L2CR_L2DO|L2CR_L2IO, " locked" },
 	{ L2CR_L2E, ~0, " 256KB L2 cache" },
 	{ L2CR_L2PE, 0, " no parity" },
-	{ L2CR_L2PE, ~0, " parity enabled" },
+	{ L2CR_L2PE, L2CR_L2PE, " parity enabled" },
 	{ 0, 0, NULL }
 };
 
@@ -108,7 +108,7 @@ static const struct fmttab cpu_7448_l2cr
 	{ L2CR_L2DO|L2CR_L2IO, L2CR_L2DO|L2CR_L2IO, " locked" },
 	{ L2CR_L2E, ~0, " 1MB L2 cache" },
 	{ L2CR_L2PE, 0, " no parity" },
-	{ L2CR_L2PE, ~0, " parity enabled" },
+	{ L2CR_L2PE, L2CR_L2PE, " parity enabled" },
 	{ 0, 0, NULL }
 };
 
@@ -119,7 +119,7 @@ static const struct fmttab cpu_7457_l2cr
 	{ L2CR_L2DO|L2CR_L2IO, L2CR_L2DO|L2CR_L2IO, " locked" },
 	{ L2CR_L2E, ~0, " 512KB L2 cache" },
 	{ L2CR_L2PE, 0, " no parity" },
-	{ L2CR_L2PE, ~0, " parity enabled" },
+	{ L2CR_L2PE, L2CR_L2PE, " parity enabled" },
 	{ 0, 0, NULL }
 };
 



CVS commit: src/sys/arch/powerpc/oea

2018-06-08 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Jun  8 23:40:44 UTC 2018

Modified Files:
src/sys/arch/powerpc/oea: cpu_subr.c

Log Message:
when switching CPU speed using DFS, only use xcalls on MULTIPROCESSOR kernels


To generate a diff of this commit:
cvs rdiff -u -r1.95 -r1.96 src/sys/arch/powerpc/oea/cpu_subr.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/cpu_subr.c
diff -u src/sys/arch/powerpc/oea/cpu_subr.c:1.95 src/sys/arch/powerpc/oea/cpu_subr.c:1.96
--- src/sys/arch/powerpc/oea/cpu_subr.c:1.95	Fri Jun  1 18:06:58 2018
+++ src/sys/arch/powerpc/oea/cpu_subr.c	Fri Jun  8 23:40:44 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu_subr.c,v 1.95 2018/06/01 18:06:58 macallan Exp $	*/
+/*	$NetBSD: cpu_subr.c,v 1.96 2018/06/08 23:40:44 macallan Exp $	*/
 
 /*-
  * Copyright (c) 2001 Matt Thomas.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu_subr.c,v 1.95 2018/06/01 18:06:58 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu_subr.c,v 1.96 2018/06/08 23:40:44 macallan Exp $");
 
 #include "opt_ppcparam.h"
 #include "opt_ppccache.h"
@@ -1144,7 +1144,6 @@ cpu_get_dfs(void)
 void
 cpu_set_dfs(int div)
 {
-	uint64_t where;
 	u_int dfs_mask, pvr, vers;
 
 	pvr = mfpvr();
@@ -1162,9 +1161,13 @@ cpu_set_dfs(int div)
 		return;
 
 	}
-
+#ifdef MULTIPROCESSOR
+	uint64_t where;
 	where = xc_broadcast(0, (xcfunc_t)cpu_set_dfs_xcall, , _mask);
 	xc_wait(where);
+#else
+	cpu_set_dfs_xcall(, _mask);
+#endif
 }
 
 static void



CVS commit: src/sys/arch/powerpc/oea

2018-03-04 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sun Mar  4 21:51:44 UTC 2018

Modified Files:
src/sys/arch/powerpc/oea: cpu_subr.c

Log Message:
avoid 32 bit only code in 64 bit mode.


To generate a diff of this commit:
cvs rdiff -u -r1.89 -r1.90 src/sys/arch/powerpc/oea/cpu_subr.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/cpu_subr.c
diff -u src/sys/arch/powerpc/oea/cpu_subr.c:1.89 src/sys/arch/powerpc/oea/cpu_subr.c:1.90
--- src/sys/arch/powerpc/oea/cpu_subr.c:1.89	Fri Feb 16 18:02:10 2018
+++ src/sys/arch/powerpc/oea/cpu_subr.c	Sun Mar  4 21:51:44 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu_subr.c,v 1.89 2018/02/16 18:02:10 macallan Exp $	*/
+/*	$NetBSD: cpu_subr.c,v 1.90 2018/03/04 21:51:44 mrg Exp $	*/
 
 /*-
  * Copyright (c) 2001 Matt Thomas.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu_subr.c,v 1.89 2018/02/16 18:02:10 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu_subr.c,v 1.90 2018/03/04 21:51:44 mrg Exp $");
 
 #include "opt_ppcparam.h"
 #include "opt_ppccache.h"
@@ -533,6 +533,7 @@ cpu_setup(device_t self, struct cpu_info
 	 * Configure power-saving mode.
 	 */
 	switch (vers) {
+#if !defined(_ARCH_PPC64)
 	case MPC604:
 	case MPC604e:
 	case MPC604ev:
@@ -582,6 +583,7 @@ cpu_setup(device_t self, struct cpu_info
 		hid0 |= HID0_NAP | HID0_DPM;
 		powersave = 1;
 		break;
+#endif
 
 	case IBM970:
 	case IBM970FX:



CVS commit: src/sys/arch/powerpc/oea

2018-03-03 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Sun Mar  4 00:21:20 UTC 2018

Modified Files:
src/sys/arch/powerpc/oea: ofw_autoconf.c

Log Message:
detect if we netboot and set booted_device accordingly


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/powerpc/oea/ofw_autoconf.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_autoconf.c
diff -u src/sys/arch/powerpc/oea/ofw_autoconf.c:1.20 src/sys/arch/powerpc/oea/ofw_autoconf.c:1.21
--- src/sys/arch/powerpc/oea/ofw_autoconf.c:1.20	Tue Feb 18 12:27:15 2014
+++ src/sys/arch/powerpc/oea/ofw_autoconf.c	Sun Mar  4 00:21:20 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: ofw_autoconf.c,v 1.20 2014/02/18 12:27:15 macallan Exp $ */
+/* $NetBSD: ofw_autoconf.c,v 1.21 2018/03/04 00:21:20 macallan Exp $ */
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
  * Copyright (C) 1995, 1996 TooLs GmbH.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ofw_autoconf.c,v 1.20 2014/02/18 12:27:15 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ofw_autoconf.c,v 1.21 2018/03/04 00:21:20 macallan Exp $");
 
 #ifdef ofppc
 #include "gtpci.h"
@@ -67,6 +67,7 @@ __KERNEL_RCSID(0, "$NetBSD: ofw_autoconf
 
 extern char bootpath[256];
 char cbootpath[256];
+static int boot_node = 0;	/* points at boot device if we netboot */
 
 static void canonicalize_bootpath(void);
 
@@ -88,9 +89,9 @@ cpu_configure(void)
 static void
 canonicalize_bootpath(void)
 {
-	int node;
+	int node, len;
 	char *p, *lastp;
-	char last[32];
+	char last[32], type[32];
 
 	/*
 	 * If the bootpath doesn't start with a / then it isn't
@@ -104,7 +105,6 @@ canonicalize_bootpath(void)
 		if (aliases != 0) {
 			char *cp1, *cp2, *cp;
 			char saved_ch = '\0';
-			int len;
 			cp1 = strchr(bootpath, ':');
 			cp2 = strchr(bootpath, ',');
 			cp = cp1;
@@ -151,6 +151,15 @@ canonicalize_bootpath(void)
 		return;
 	}
 
+	/* see if we netbooted */
+	len = OF_getprop(node, "device_type", type, sizeof(type) - 1);
+	if (len > -1) {
+		type[len] = 0;
+		if (strcmp(type, "network") == 0) {
+			boot_node = node;
+		}
+	}
+
 	/*
 	 * cbootpath is a valid OF path.  Use package-to-path to
 	 * canonicalize pathname.
@@ -326,6 +335,10 @@ device_register(device_t dev, void *aux)
 
 			prop_dictionary_set_uint32(dict, "device_node", node);
 
+			if (node == boot_node) {
+/* we netbooted from whatever this is */
+booted_device = dev;
+			}
 			/* see if this is going to be console */
 			memset(name, 0, sizeof(name));
 			OF_getprop(node, "device_type", name, sizeof(name));



CVS commit: src/sys/arch/powerpc/oea

2018-03-03 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Sat Mar  3 22:50:17 UTC 2018

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

Log Message:
get bootpath from OF if we don't get it as an argument


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 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/ofwoea_machdep.c
diff -u src/sys/arch/powerpc/oea/ofwoea_machdep.c:1.43 src/sys/arch/powerpc/oea/ofwoea_machdep.c:1.44
--- src/sys/arch/powerpc/oea/ofwoea_machdep.c:1.43	Fri Mar  2 14:37:18 2018
+++ src/sys/arch/powerpc/oea/ofwoea_machdep.c	Sat Mar  3 22:50:17 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: ofwoea_machdep.c,v 1.43 2018/03/02 14:37:18 macallan Exp $ */
+/* $NetBSD: ofwoea_machdep.c,v 1.44 2018/03/03 22:50:17 macallan Exp $ */
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ofwoea_machdep.c,v 1.43 2018/03/02 14:37:18 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ofwoea_machdep.c,v 1.44 2018/03/03 22:50:17 macallan Exp $");
 
 #include "opt_ppcarch.h"
 #include "opt_compat_netbsd.h"
@@ -230,6 +230,13 @@ ofwoea_initppc(u_int startkernel, u_int 
 			while (*args)
 BOOT_FLAG(*args++, boothowto);
 		}
+	} else {
+		int chs = OF_finddevice("/chosen");
+		int len;
+
+		len = OF_getprop(chs, "bootpath", bootpath, sizeof(bootpath) - 1);
+		if (len > -1)
+			bootpath[len] = 0;
 	}
 
 	uvm_md_init();



CVS commit: src/sys/arch/powerpc/oea

2018-03-02 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Mar  2 14:45:23 UTC 2018

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

Log Message:
add a comment to explain why we defer wsdisplay_preattach() in bridge mode


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/powerpc/oea/ofw_rascons.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.11 src/sys/arch/powerpc/oea/ofw_rascons.c:1.12
--- src/sys/arch/powerpc/oea/ofw_rascons.c:1.11	Fri Mar  2 14:37:18 2018
+++ src/sys/arch/powerpc/oea/ofw_rascons.c	Fri Mar  2 14:45:23 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ofw_rascons.c,v 1.11 2018/03/02 14:37:18 macallan Exp $	*/
+/*	$NetBSD: ofw_rascons.c,v 1.12 2018/03/02 14:45:23 macallan Exp $	*/
 
 /*
  * Copyright (c) 1995, 1996 Carnegie-Mellon University.
@@ -28,7 +28,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ofw_rascons.c,v 1.11 2018/03/02 14:37:18 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ofw_rascons.c,v 1.12 2018/03/02 14:45:23 macallan Exp $");
 
 #include "wsdisplay.h"
 
@@ -117,6 +117,16 @@ rascons_cnattach(void)
 	rascons_stdscreen.textops = >ri_ops;
 	rascons_stdscreen.capabilities = ri->ri_caps;
 
+	/*
+	 * XXX
+	 * On some G5 models ( so far, 970FX but not 970MP ) we can't seem to
+	 * access video memory in real mode, but a lot of code relies on rasops
+	 * data structures being set up early so we can't just push the whole
+	 * thing further down. Instead set things up but don't actually attach
+	 * the console until later.
+	 * This needs a better trigger but for now I can't reliably tell which
+	 * exact models / CPUs / other hardware actually need it.
+	 */
 	if ((oeacpufeat & OEACPU_64_BRIDGE) != 0) {
 		needs_finalize = 1;
 	} else {



CVS commit: src/sys/arch/powerpc/oea

2018-03-02 Thread Michael Lorenz
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 
-__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 
 
 #include 
+#include 
 #include 
 
 /* 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_ops;
 	rascons_stdscreen.capabilities = ri->ri_caps;
 
-	ri->ri_ops.allocattr(ri, 0, 0, 0, );
-	wsdisplay_preattach(_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, );
+		wsdisplay_preattach(_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 = _console_screen.scr_ri;
+	long defattr;
+
+	if (needs_finalize == 0) return;
+	
+	ri->ri_ops.allocattr(ri, 0, 0, 0, );
+	wsdisplay_preattach(_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 
-__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



CVS commit: src/sys/arch/powerpc/oea

2018-02-16 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Feb 16 18:02:10 UTC 2018

Modified Files:
src/sys/arch/powerpc/oea: cpu_subr.c

Log Message:
use mtspr64() in bridge mode


To generate a diff of this commit:
cvs rdiff -u -r1.88 -r1.89 src/sys/arch/powerpc/oea/cpu_subr.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/cpu_subr.c
diff -u src/sys/arch/powerpc/oea/cpu_subr.c:1.88 src/sys/arch/powerpc/oea/cpu_subr.c:1.89
--- src/sys/arch/powerpc/oea/cpu_subr.c:1.88	Sun Jan 21 08:46:48 2018
+++ src/sys/arch/powerpc/oea/cpu_subr.c	Fri Feb 16 18:02:10 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu_subr.c,v 1.88 2018/01/21 08:46:48 mrg Exp $	*/
+/*	$NetBSD: cpu_subr.c,v 1.89 2018/02/16 18:02:10 macallan Exp $	*/
 
 /*-
  * Copyright (c) 2001 Matt Thomas.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu_subr.c,v 1.88 2018/01/21 08:46:48 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu_subr.c,v 1.89 2018/02/16 18:02:10 macallan Exp $");
 
 #include "opt_ppcparam.h"
 #include "opt_ppccache.h"
@@ -644,17 +644,7 @@ cpu_setup(device_t self, struct cpu_info
 	if ((oeacpufeat & OEACPU_64_BRIDGE) != 0) {
 #endif
 		if (hid64_0 != hid64_0_save) {
-			/* ppc970 needs extra goop around writes to HID0 */
-			__asm volatile( "sync;" \
-	"mtspr %0,%1;" \
-	"mfspr %1,%0;" \
-	"mfspr %1,%0;" \
-	"mfspr %1,%0;" \
-	"mfspr %1,%0;" \
-	"mfspr %1,%0;" \
-	"mfspr %1,%0;" \
-	 : : "K"(SPR_HID0), "r"(hid64_0));
-			__asm volatile("sync;isync");
+			mtspr64(SPR_HID0, hid64_0);
 		}
 #if defined(PPC_OEA64_BRIDGE)
 	} else {



CVS commit: src/sys/arch/powerpc/oea

2018-02-10 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sun Feb 11 00:01:12 UTC 2018

Modified Files:
src/sys/arch/powerpc/oea: oea_machdep.c

Log Message:
introduce a inline function to set a value to zero while
hiding this fact from GCC.  this allows the PPC code that
writes to address zero to actually work rather than cause
GCC to emit an explicit "trap" instruction, which in early
boot means hang on my pegasosII.  use this in oae_init()
for both rfid->rfi and also setting the jump-to-zero trap.

found with a lot of debugging, but GCC 6's new warning
-Wnull-dereference found it when i was informed of its
existence.  unfortunately, there are dozens of other
violations in our kernel today so simply enabling that
option for everything is not a good idea, but is a goal.


To generate a diff of this commit:
cvs rdiff -u -r1.73 -r1.74 src/sys/arch/powerpc/oea/oea_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/oea_machdep.c
diff -u src/sys/arch/powerpc/oea/oea_machdep.c:1.73 src/sys/arch/powerpc/oea/oea_machdep.c:1.74
--- src/sys/arch/powerpc/oea/oea_machdep.c:1.73	Mon May 30 13:04:24 2016
+++ src/sys/arch/powerpc/oea/oea_machdep.c	Sun Feb 11 00:01:12 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: oea_machdep.c,v 1.73 2016/05/30 13:04:24 chs Exp $	*/
+/*	$NetBSD: oea_machdep.c,v 1.74 2018/02/11 00:01:12 mrg Exp $	*/
 
 /*
  * Copyright (C) 2002 Matt Thomas
@@ -33,7 +33,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: oea_machdep.c,v 1.73 2016/05/30 13:04:24 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: oea_machdep.c,v 1.74 2018/02/11 00:01:12 mrg Exp $");
 
 #include "opt_ppcarch.h"
 #include "opt_compat_netbsd.h"
@@ -109,6 +109,19 @@ extern int dsitrap_fix_dbat5[];
 extern int dsitrap_fix_dbat6[];
 extern int dsitrap_fix_dbat7[];
 
+/*
+ * Load pointer with 0 behind GCC's back, otherwise it will
+ * emit a "trap" instead.
+ */
+static __inline__ uintptr_t
+zero_value(void)
+{
+	uintptr_t dont_tell_gcc;
+
+	__asm volatile ("li %0, 0" : "=r"(dont_tell_gcc) :);
+	return dont_tell_gcc;
+}
+
 void
 oea_init(void (*handler)(void))
 {
@@ -144,7 +157,7 @@ oea_init(void (*handler)(void))
 #ifdef PPC_HIGH_VEC
 	exc_base = EXC_HIGHVEC;
 #else
-	exc_base = 0;
+	exc_base = zero_value();
 #endif
 	KASSERT(mfspr(SPR_SPRG0) == (uintptr_t)ci);
 
@@ -289,8 +302,10 @@ oea_init(void (*handler)(void))
 	 * Install a branch absolute to trap0 to force a panic.
 	 */
 	if ((uintptr_t)trap0 < 0x200) {
-		*(volatile uint32_t *) 0 = 0x7c6802a6;
-		*(volatile uint32_t *) 4 = 0x4802 | (uintptr_t) trap0;
+		uint32_t *p = (uint32_t *)zero_value();
+
+		p[0] = 0x7c6802a6;
+		p[1] = 0x4802 | (uintptr_t) trap0;
 	}
 
 	/*



CVS commit: src/sys/arch/powerpc/oea

2018-01-06 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Jan  6 09:46:22 UTC 2018

Modified Files:
src/sys/arch/powerpc/oea: cpu_subr.c

Log Message:
fix a few typos in comments


To generate a diff of this commit:
cvs rdiff -u -r1.86 -r1.87 src/sys/arch/powerpc/oea/cpu_subr.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/cpu_subr.c
diff -u src/sys/arch/powerpc/oea/cpu_subr.c:1.86 src/sys/arch/powerpc/oea/cpu_subr.c:1.87
--- src/sys/arch/powerpc/oea/cpu_subr.c:1.86	Sat Sep 30 03:34:04 2017
+++ src/sys/arch/powerpc/oea/cpu_subr.c	Sat Jan  6 09:46:22 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu_subr.c,v 1.86 2017/09/30 03:34:04 macallan Exp $	*/
+/*	$NetBSD: cpu_subr.c,v 1.87 2018/01/06 09:46:22 snj Exp $	*/
 
 /*-
  * Copyright (c) 2001 Matt Thomas.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu_subr.c,v 1.86 2017/09/30 03:34:04 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu_subr.c,v 1.87 2018/01/06 09:46:22 snj Exp $");
 
 #include "opt_ppcparam.h"
 #include "opt_ppccache.h"
@@ -84,7 +84,7 @@ struct fmttab {
 
 /*
  * This should be one per CPU but since we only support it on 750 variants it
- * doesn't realy matter since none of them supports SMP
+ * doesn't really matter since none of them support SMP
  */
 envsys_data_t sensor;
 
@@ -631,7 +631,7 @@ cpu_setup(device_t self, struct cpu_info
 	}
 
 #if defined(_ARCH_PPC64)
-	/* ppc970 needs extre goop around writes to HID0 */
+	/* ppc970 needs extra goop around writes to HID0 */
 	__asm volatile( "sync;" \
 			"mtspr %0,%1;" \
 			"mfspr %1,%0;" \



CVS commit: src/sys/arch/powerpc/oea

2017-09-29 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Sat Sep 30 03:34:04 UTC 2017

Modified Files:
src/sys/arch/powerpc/oea: cpu_subr.c

Log Message:
use 7450 HID0 bitmask on 7447A and 7448 as well


To generate a diff of this commit:
cvs rdiff -u -r1.85 -r1.86 src/sys/arch/powerpc/oea/cpu_subr.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/cpu_subr.c
diff -u src/sys/arch/powerpc/oea/cpu_subr.c:1.85 src/sys/arch/powerpc/oea/cpu_subr.c:1.86
--- src/sys/arch/powerpc/oea/cpu_subr.c:1.85	Tue Jul 11 03:07:22 2017
+++ src/sys/arch/powerpc/oea/cpu_subr.c	Sat Sep 30 03:34:04 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu_subr.c,v 1.85 2017/07/11 03:07:22 maya Exp $	*/
+/*	$NetBSD: cpu_subr.c,v 1.86 2017/09/30 03:34:04 macallan Exp $	*/
 
 /*-
  * Copyright (c) 2001 Matt Thomas.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu_subr.c,v 1.85 2017/07/11 03:07:22 maya Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu_subr.c,v 1.86 2017/09/30 03:34:04 macallan Exp $");
 
 #include "opt_ppcparam.h"
 #include "opt_ppccache.h"
@@ -652,6 +652,8 @@ cpu_setup(device_t self, struct cpu_info
 	case MPC601:
 		bitmask = HID0_601_BITMASK;
 		break;
+	case MPC7447A:
+	case MPC7448:
 	case MPC7450:
 	case MPC7455:
 	case MPC7457:



CVS commit: src/sys/arch/powerpc/oea

2017-09-21 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Sep 22 04:45:56 UTC 2017

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

Log Message:
add quick path for timebase-frequency detection
deal with differences in /u4 reg property encoding vs. /uni-n, so this works
on my G5 now


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 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/ofwoea_machdep.c
diff -u src/sys/arch/powerpc/oea/ofwoea_machdep.c:1.40 src/sys/arch/powerpc/oea/ofwoea_machdep.c:1.41
--- src/sys/arch/powerpc/oea/ofwoea_machdep.c:1.40	Fri Sep 15 21:27:46 2017
+++ src/sys/arch/powerpc/oea/ofwoea_machdep.c	Fri Sep 22 04:45:56 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: ofwoea_machdep.c,v 1.40 2017/09/15 21:27:46 macallan Exp $ */
+/* $NetBSD: ofwoea_machdep.c,v 1.41 2017/09/22 04:45:56 macallan Exp $ */
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ofwoea_machdep.c,v 1.40 2017/09/15 21:27:46 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ofwoea_machdep.c,v 1.41 2017/09/22 04:45:56 macallan Exp $");
 
 #include "opt_ppcarch.h"
 #include "opt_compat_netbsd.h"
@@ -309,7 +309,7 @@ ofwoea_initppc(u_int startkernel, u_int 
 void
 set_timebase(void)
 {
-	int qhandle, phandle, msr, scratch;
+	int qhandle, phandle, msr, scratch, node;
 	char type[32];
 
 	if (timebase_freq != 0) {
@@ -317,7 +317,14 @@ set_timebase(void)
 		goto found;
 	}
 
-	for (qhandle = OF_peer(0); qhandle; qhandle = phandle) {
+	node = OF_finddevice("/cpus/@0");
+	if (OF_getprop(node, "timebase-frequency",
+			_per_sec, sizeof ticks_per_sec) > 0) {
+		goto found;
+	}
+
+	node = OF_finddevice("/");
+	for (qhandle = node; qhandle; qhandle = phandle) {
 		if (OF_getprop(qhandle, "device_type", type, sizeof type) > 0
 		&& strcmp(type, "cpu") == 0
 		&& OF_getprop(qhandle, "timebase-frequency",
@@ -621,8 +628,13 @@ find_ranges(int base, rangemap_t *region
 			break;
 		case RANGE_TYPE_MACIO:
 			regions[*cur].type = RANGE_MEM;
-			regions[*cur].size = map[1];
-			regions[*cur].addr = map[0];
+			if (len == 8) {
+regions[*cur].size = map[1];
+regions[*cur].addr = map[0];
+			} else {
+regions[*cur].size = map[2];
+regions[*cur].addr = map[1];
+			}
 			(*cur)++;		
 			break;
 	}



CVS commit: src/sys/arch/powerpc/oea

2017-09-15 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Sep 15 21:27:46 UTC 2017

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

Log Message:
flesh out RANGE_TYPE_MACIO


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 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/ofwoea_machdep.c
diff -u src/sys/arch/powerpc/oea/ofwoea_machdep.c:1.39 src/sys/arch/powerpc/oea/ofwoea_machdep.c:1.40
--- src/sys/arch/powerpc/oea/ofwoea_machdep.c:1.39	Thu Dec 22 14:47:58 2016
+++ src/sys/arch/powerpc/oea/ofwoea_machdep.c	Fri Sep 15 21:27:46 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: ofwoea_machdep.c,v 1.39 2016/12/22 14:47:58 cherry Exp $ */
+/* $NetBSD: ofwoea_machdep.c,v 1.40 2017/09/15 21:27:46 macallan Exp $ */
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ofwoea_machdep.c,v 1.39 2016/12/22 14:47:58 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ofwoea_machdep.c,v 1.40 2017/09/15 21:27:46 macallan Exp $");
 
 #include "opt_ppcarch.h"
 #include "opt_compat_netbsd.h"
@@ -551,7 +551,13 @@ find_ranges(int base, rangemap_t *region
 		goto rec;
 	if (type == RANGE_TYPE_ISA && strcmp("isa", tmp) != 0)
 		goto rec;
-	len = OF_getprop(node, "ranges", map, sizeof(map));
+	if (type == RANGE_TYPE_MACIO && strcmp("memory-controller", tmp) == 0) {
+		len = OF_getprop(node, "reg", map, sizeof(map));
+		acells = 1;
+		scells = 1;
+	} else {
+		len = OF_getprop(node, "ranges", map, sizeof(map));
+	}
 	if (len == -1)
 		goto rec;
 	if (OF_getprop(OF_parent(node), "#address-cells", _acells,
@@ -613,6 +619,12 @@ find_ranges(int base, rangemap_t *region
 (*cur)++;
 			}
 			break;
+		case RANGE_TYPE_MACIO:
+			regions[*cur].type = RANGE_MEM;
+			regions[*cur].size = map[1];
+			regions[*cur].addr = map[0];
+			(*cur)++;		
+			break;
 	}
 	DPRINTF("returning with CUR=%d\n", *cur);
 	return;
@@ -764,7 +776,7 @@ ofwoea_map_space(int rangetype, int iome
 		holes[i].size, holes[i].type);
 	/* AT THIS POINT WE MAP IT */
 
-	if (rangetype == RANGE_TYPE_PCI) {
+	if ((rangetype == RANGE_TYPE_PCI) || (rangetype == RANGE_TYPE_MACIO)) {
 		if (exmap == EXSTORAGE_MAX)
 			panic("Not enough ex_storage space. "
 			"Increase EXSTORAGE_MAX");



CVS commit: src/sys/arch/powerpc/oea

2017-07-10 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Tue Jul 11 03:07:22 UTC 2017

Modified Files:
src/sys/arch/powerpc/oea: cpu_subr.c

Log Message:
inline HAVE_64BIT_HID0 and remove macro definition.

Fixes llvm INSTALL kernel build, which failed with:
error: macro expansion producing 'defined' has undefined behavior


To generate a diff of this commit:
cvs rdiff -u -r1.84 -r1.85 src/sys/arch/powerpc/oea/cpu_subr.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/cpu_subr.c
diff -u src/sys/arch/powerpc/oea/cpu_subr.c:1.84 src/sys/arch/powerpc/oea/cpu_subr.c:1.85
--- src/sys/arch/powerpc/oea/cpu_subr.c:1.84	Fri Jul  7 23:45:53 2017
+++ src/sys/arch/powerpc/oea/cpu_subr.c	Tue Jul 11 03:07:22 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu_subr.c,v 1.84 2017/07/07 23:45:53 macallan Exp $	*/
+/*	$NetBSD: cpu_subr.c,v 1.85 2017/07/11 03:07:22 maya Exp $	*/
 
 /*-
  * Copyright (c) 2001 Matt Thomas.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu_subr.c,v 1.84 2017/07/07 23:45:53 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu_subr.c,v 1.85 2017/07/11 03:07:22 maya Exp $");
 
 #include "opt_ppcparam.h"
 #include "opt_ppccache.h"
@@ -487,8 +487,6 @@ cpu_attach_common(device_t self, int id)
 	return (ci);
 }
 
-#define HAVE_64BIT_HID0 (defined(PPC_OEA64_BRIDGE) || defined(_ARCH_PPC64))
-
 void
 cpu_setup(device_t self, struct cpu_info *ci)
 {
@@ -497,7 +495,7 @@ cpu_setup(device_t self, struct cpu_info
 	const char *bitmask;
 	char hidbuf[128];
 	char model[80];
-#if HAVE_64BIT_HID0
+#if defined(PPC_OEA64_BRIDGE) || defined(_ARCH_PPC64)
 	char hidbuf_u[128];
 	const char *bitmasku = NULL;
 #endif
@@ -663,7 +661,7 @@ cpu_setup(device_t self, struct cpu_info
 	case IBM970FX:
 	case IBM970MP:
 		bitmask = HID0_970_BITMASK;
-#if HAVE_64BIT_HID0
+#if defined(PPC_OEA64_BRIDGE) || defined(_ARCH_PPC64)
 		bitmasku = HID0_970_BITMASK_U;
 #endif
 		break;
@@ -672,7 +670,7 @@ cpu_setup(device_t self, struct cpu_info
 		break;
 	}
 	
-#if HAVE_64BIT_HID0
+#if defined(PPC_OEA64_BRIDGE) || defined(_ARCH_PPC64)
 	if (bitmasku != NULL) {
 		snprintb(hidbuf, sizeof hidbuf, bitmask, hid0 & 0x);
 		snprintb(hidbuf_u, sizeof hidbuf_u, bitmasku, hid0 >> 32);



CVS commit: src/sys/arch/powerpc/oea

2017-07-07 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Jul  7 23:45:53 UTC 2017

Modified Files:
src/sys/arch/powerpc/oea: cpu_subr.c

Log Message:
remove accidential debug printf()


To generate a diff of this commit:
cvs rdiff -u -r1.83 -r1.84 src/sys/arch/powerpc/oea/cpu_subr.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/cpu_subr.c
diff -u src/sys/arch/powerpc/oea/cpu_subr.c:1.83 src/sys/arch/powerpc/oea/cpu_subr.c:1.84
--- src/sys/arch/powerpc/oea/cpu_subr.c:1.83	Fri Jul  7 22:30:28 2017
+++ src/sys/arch/powerpc/oea/cpu_subr.c	Fri Jul  7 23:45:53 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu_subr.c,v 1.83 2017/07/07 22:30:28 macallan Exp $	*/
+/*	$NetBSD: cpu_subr.c,v 1.84 2017/07/07 23:45:53 macallan Exp $	*/
 
 /*-
  * Copyright (c) 2001 Matt Thomas.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu_subr.c,v 1.83 2017/07/07 22:30:28 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu_subr.c,v 1.84 2017/07/07 23:45:53 macallan Exp $");
 
 #include "opt_ppcparam.h"
 #include "opt_ppccache.h"
@@ -674,7 +674,6 @@ cpu_setup(device_t self, struct cpu_info
 	
 #if HAVE_64BIT_HID0
 	if (bitmasku != NULL) {
-		printf("HID0 %llx\n", hid0);
 		snprintb(hidbuf, sizeof hidbuf, bitmask, hid0 & 0x);
 		snprintb(hidbuf_u, sizeof hidbuf_u, bitmasku, hid0 >> 32);
 		aprint_normal_dev(self, "HID0 %s %s, powersave: %d\n",



CVS commit: src/sys/arch/powerpc/oea

2017-07-07 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Jul  7 22:30:28 UTC 2017

Modified Files:
src/sys/arch/powerpc/oea: cpu_subr.c

Log Message:
deal with ppc970's HID0


To generate a diff of this commit:
cvs rdiff -u -r1.82 -r1.83 src/sys/arch/powerpc/oea/cpu_subr.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/cpu_subr.c
diff -u src/sys/arch/powerpc/oea/cpu_subr.c:1.82 src/sys/arch/powerpc/oea/cpu_subr.c:1.83
--- src/sys/arch/powerpc/oea/cpu_subr.c:1.82	Mon Mar 24 19:29:59 2014
+++ src/sys/arch/powerpc/oea/cpu_subr.c	Fri Jul  7 22:30:28 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu_subr.c,v 1.82 2014/03/24 19:29:59 christos Exp $	*/
+/*	$NetBSD: cpu_subr.c,v 1.83 2017/07/07 22:30:28 macallan Exp $	*/
 
 /*-
  * Copyright (c) 2001 Matt Thomas.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu_subr.c,v 1.82 2014/03/24 19:29:59 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu_subr.c,v 1.83 2017/07/07 22:30:28 macallan Exp $");
 
 #include "opt_ppcparam.h"
 #include "opt_ppccache.h"
@@ -328,6 +328,9 @@ cpu_idlespin(void)
 		return;
 
 	__asm volatile(
+#if defined(_ARCH_PPC64) || defined (PPC_OEA64_BRIDGE)
+		"dssall;"
+#endif
 		"sync;"
 		"mfmsr	%0;"
 		"oris	%0,%0,%1@h;"	/* enter power saving mode */
@@ -484,14 +487,25 @@ cpu_attach_common(device_t self, int id)
 	return (ci);
 }
 
+#define HAVE_64BIT_HID0 (defined(PPC_OEA64_BRIDGE) || defined(_ARCH_PPC64))
+
 void
 cpu_setup(device_t self, struct cpu_info *ci)
 {
-	u_int hid0, hid0_save, pvr, vers;
+	u_int pvr, vers;
 	const char * const xname = device_xname(self);
 	const char *bitmask;
 	char hidbuf[128];
 	char model[80];
+#if HAVE_64BIT_HID0
+	char hidbuf_u[128];
+	const char *bitmasku = NULL;
+#endif
+#if defined(PPC_OEA64_BRIDGE)
+	volatile uint64_t hid0;
+#else
+	register_t hid0;
+#endif
 
 	pvr = mfpvr();
 	vers = (pvr >> 16) & 0x;
@@ -503,7 +517,11 @@ cpu_setup(device_t self, struct cpu_info
 
 	/* set the cpu number */
 	ci->ci_cpuid = cpu_number();
-	hid0_save = hid0 = mfspr(SPR_HID0);
+#if defined(_ARCH_PPC64)
+	__asm volatile("mfspr %0,%1" : "=r"(hid0) : "K"(SPR_HID0));
+#else
+	hid0 = mfspr(SPR_HID0);
+#endif
 
 	cpu_probe_cache();
 
@@ -564,6 +582,13 @@ cpu_setup(device_t self, struct cpu_info
 	case IBM970:
 	case IBM970FX:
 	case IBM970MP:
+#if defined(_ARCH_PPC64) || defined (PPC_OEA64_BRIDGE)
+		hid0 &= ~(HID0_64_DOZE | HID0_64_NAP | HID0_64_DEEPNAP);
+		hid0 |= HID0_64_DOZE | HID0_64_DPM | HID0_64_EX_TBEN |
+			HID0_64_TB_CTRL | HID0_64_EN_MCHK;
+		powersave = 1;
+		break;
+#endif
 	case IBMPOWER3II:
 	default:
 		/* No power-saving mode is available. */ ;
@@ -598,17 +623,31 @@ cpu_setup(device_t self, struct cpu_info
 		break;
 	}
 
-#ifdef MULTIPROCESSOR
+	/*
+	 * according to the 603e manual this is necessary for an external L2
+	 * cache to work properly
+	 */
 	switch (vers) {
 	case MPC603e:
 		hid0 |= HID0_ABE;
 	}
-#endif
 
-	if (hid0 != hid0_save) {
-		mtspr(SPR_HID0, hid0);
-		__asm volatile("sync;isync");
-	}
+#if defined(_ARCH_PPC64)
+	/* ppc970 needs extre goop around writes to HID0 */
+	__asm volatile( "sync;" \
+			"mtspr %0,%1;" \
+			"mfspr %1,%0;" \
+			"mfspr %1,%0;" \
+			"mfspr %1,%0;" \
+			"mfspr %1,%0;" \
+			"mfspr %1,%0;" \
+			"mfspr %1,%0;" \
+			 : : "K"(SPR_HID0), "r"(hid0));
+#else
+	mtspr(SPR_HID0, hid0);
+#endif
+	__asm volatile("sync;isync");
+	
 
 
 	switch (vers) {
@@ -623,14 +662,30 @@ cpu_setup(device_t self, struct cpu_info
 	case IBM970:
 	case IBM970FX:
 	case IBM970MP:
-		bitmask = 0;
+		bitmask = HID0_970_BITMASK;
+#if HAVE_64BIT_HID0
+		bitmasku = HID0_970_BITMASK_U;
+#endif
 		break;
 	default:
 		bitmask = HID0_BITMASK;
 		break;
 	}
-	snprintb(hidbuf, sizeof hidbuf, bitmask, hid0);
-	aprint_normal_dev(self, "HID0 %s, powersave: %d\n", hidbuf, powersave);
+	
+#if HAVE_64BIT_HID0
+	if (bitmasku != NULL) {
+		printf("HID0 %llx\n", hid0);
+		snprintb(hidbuf, sizeof hidbuf, bitmask, hid0 & 0x);
+		snprintb(hidbuf_u, sizeof hidbuf_u, bitmasku, hid0 >> 32);
+		aprint_normal_dev(self, "HID0 %s %s, powersave: %d\n",
+		hidbuf_u, hidbuf, powersave);
+	} else
+#endif
+	{
+		snprintb(hidbuf, sizeof hidbuf, bitmask, hid0);
+		aprint_normal_dev(self, "HID0 %s, powersave: %d\n",
+		hidbuf, powersave);
+	}
 
 	ci->ci_khz = 0;
 
@@ -1166,7 +1221,6 @@ cpu_tau_setup(struct cpu_info *ci)
 	}
 }
 
-
 /* Find the temperature of the CPU. */
 void
 cpu_tau_refresh(struct sysmon_envsys *sme, envsys_data_t *edata)



CVS commit: src/sys/arch/powerpc/oea

2016-05-30 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Mon May 30 13:04:24 UTC 2016

Modified Files:
src/sys/arch/powerpc/oea: oea_machdep.c

Log Message:
allocate cpuset structures needed by MP DDB.


To generate a diff of this commit:
cvs rdiff -u -r1.72 -r1.73 src/sys/arch/powerpc/oea/oea_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/oea_machdep.c
diff -u src/sys/arch/powerpc/oea/oea_machdep.c:1.72 src/sys/arch/powerpc/oea/oea_machdep.c:1.73
--- src/sys/arch/powerpc/oea/oea_machdep.c:1.72	Mon Jul  6 05:20:50 2015
+++ src/sys/arch/powerpc/oea/oea_machdep.c	Mon May 30 13:04:24 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: oea_machdep.c,v 1.72 2015/07/06 05:20:50 matt Exp $	*/
+/*	$NetBSD: oea_machdep.c,v 1.73 2016/05/30 13:04:24 chs Exp $	*/
 
 /*
  * Copyright (C) 2002 Matt Thomas
@@ -33,7 +33,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: oea_machdep.c,v 1.72 2015/07/06 05:20:50 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: oea_machdep.c,v 1.73 2016/05/30 13:04:24 chs Exp $");
 
 #include "opt_ppcarch.h"
 #include "opt_compat_netbsd.h"
@@ -1004,6 +1004,16 @@ oea_startup(const char *model)
 
 	format_bytes(pbuf, sizeof(pbuf), ptoa(uvmexp.free));
 	printf("avail memory = %s\n", pbuf);
+
+#ifdef MULTIPROCESSOR
+	kcpuset_create(_info.cpus_running, true);
+	kcpuset_create(_info.cpus_hatched, true);
+	kcpuset_create(_info.cpus_paused, true);
+	kcpuset_create(_info.cpus_resumed, true);
+	kcpuset_create(_info.cpus_halted, true);
+
+	kcpuset_set(cpuset_info.cpus_running, cpu_number());
+#endif
 }
 
 /*



CVS commit: src/sys/arch/powerpc/oea

2016-02-14 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Feb 14 18:12:31 UTC 2016

Modified Files:
src/sys/arch/powerpc/oea: ofw_consinit.c

Log Message:
Add missing va_end, from David Binderman in PR 50798.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/powerpc/oea/ofw_consinit.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_consinit.c
diff -u src/sys/arch/powerpc/oea/ofw_consinit.c:1.16 src/sys/arch/powerpc/oea/ofw_consinit.c:1.17
--- src/sys/arch/powerpc/oea/ofw_consinit.c:1.16	Sun May 12 13:23:08 2013
+++ src/sys/arch/powerpc/oea/ofw_consinit.c	Sun Feb 14 18:12:30 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: ofw_consinit.c,v 1.16 2013/05/12 13:23:08 macallan Exp $ */
+/* $NetBSD: ofw_consinit.c,v 1.17 2016/02/14 18:12:30 dholland Exp $ */
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ofw_consinit.c,v 1.16 2013/05/12 13:23:08 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ofw_consinit.c,v 1.17 2016/02/14 18:12:30 dholland Exp $");
 
 #include 
 #include 
@@ -119,6 +119,7 @@ void ofprint(const char *blah, ...)
 
 	va_start(va, blah);
 	len = vsnprintf(buf, sizeof(buf), blah, va);
+	va_end(va);
 	OF_write(console_instance, buf, len);
 }
 



CVS commit: src/sys/arch/powerpc/oea

2016-02-14 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Feb 14 18:07:49 UTC 2016

Modified Files:
src/sys/arch/powerpc/oea: pmap.c

Log Message:
Add missing va_end; PR 50795 from David Binderman.


To generate a diff of this commit:
cvs rdiff -u -r1.92 -r1.93 src/sys/arch/powerpc/oea/pmap.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/pmap.c
diff -u src/sys/arch/powerpc/oea/pmap.c:1.92 src/sys/arch/powerpc/oea/pmap.c:1.93
--- src/sys/arch/powerpc/oea/pmap.c:1.92	Sun Aug 10 17:49:04 2014
+++ src/sys/arch/powerpc/oea/pmap.c	Sun Feb 14 18:07:49 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.92 2014/08/10 17:49:04 joerg Exp $	*/
+/*	$NetBSD: pmap.c,v 1.93 2016/02/14 18:07:49 dholland Exp $	*/
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -63,7 +63,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.92 2014/08/10 17:49:04 joerg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.93 2016/02/14 18:07:49 dholland Exp $");
 
 #define	PMAP_NOOPNAMES
 
@@ -3133,6 +3133,7 @@ pmap_setup_segment0_map(int use_large_pa
 (void)pmap_pte_insert(ptegidx, );
 }
 }
+va_end(ap);
 
 TLBSYNC();
 SYNC();



CVS commit: src/sys/arch/powerpc/oea

2015-07-05 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Jul  6 05:20:50 UTC 2015

Modified Files:
src/sys/arch/powerpc/oea: oea_machdep.c

Log Message:
Don't preserve PSL_FP/PSL_VEC in cpu_setmcontext.


To generate a diff of this commit:
cvs rdiff -u -r1.71 -r1.72 src/sys/arch/powerpc/oea/oea_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/oea_machdep.c
diff -u src/sys/arch/powerpc/oea/oea_machdep.c:1.71 src/sys/arch/powerpc/oea/oea_machdep.c:1.72
--- src/sys/arch/powerpc/oea/oea_machdep.c:1.71	Mon Mar 24 19:29:59 2014
+++ src/sys/arch/powerpc/oea/oea_machdep.c	Mon Jul  6 05:20:50 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: oea_machdep.c,v 1.71 2014/03/24 19:29:59 christos Exp $	*/
+/*	$NetBSD: oea_machdep.c,v 1.72 2015/07/06 05:20:50 matt Exp $	*/
 
 /*
  * Copyright (C) 2002 Matt Thomas
@@ -33,7 +33,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: oea_machdep.c,v 1.71 2014/03/24 19:29:59 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: oea_machdep.c,v 1.72 2015/07/06 05:20:50 matt Exp $);
 
 #include opt_ppcarch.h
 #include opt_compat_netbsd.h
@@ -440,19 +440,16 @@ oea_init(void (*handler)(void))
 
 /*
 	 * Configure a PSL user mask matching this processor.
+	 * Don't allow to set PSL_FP/PSL_VEC, since that will affect PCU.
  	 */
 	cpu_psluserset = PSL_EE | PSL_PR | PSL_ME | PSL_IR | PSL_DR | PSL_RI;
-	cpu_pslusermod = PSL_FP | PSL_FE0 | PSL_FE1 | PSL_LE | PSL_SE | PSL_BE;
+	cpu_pslusermod = PSL_FE0 | PSL_FE1 | PSL_LE | PSL_SE | PSL_BE;
 #ifdef PPC_OEA601
 	if (cpuvers == MPC601) {
 		cpu_psluserset = PSL_601_MASK;
 		cpu_pslusermod = PSL_601_MASK;
 	}
 #endif
-#ifdef ALTIVEC
-	if (cpu_altivec)
-		cpu_pslusermod |= PSL_VEC;
-#endif
 #ifdef PPC_HIGH_VEC
 	cpu_psluserset |= PSL_IP;	/* XXX ok? */
 #endif



CVS commit: src/sys/arch/powerpc/oea

2015-07-05 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Jul  6 02:43:26 UTC 2015

Modified Files:
src/sys/arch/powerpc/oea: altivec.c

Log Message:
Don't reload if just re-enabling


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/powerpc/oea/altivec.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/altivec.c
diff -u src/sys/arch/powerpc/oea/altivec.c:1.29 src/sys/arch/powerpc/oea/altivec.c:1.30
--- src/sys/arch/powerpc/oea/altivec.c:1.29	Fri May 16 00:48:41 2014
+++ src/sys/arch/powerpc/oea/altivec.c	Mon Jul  6 02:43:26 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: altivec.c,v 1.29 2014/05/16 00:48:41 rmind Exp $	*/
+/*	$NetBSD: altivec.c,v 1.30 2015/07/06 02:43:26 matt Exp $	*/
 
 /*
  * Copyright (C) 1996 Wolfgang Solfrank.
@@ -32,7 +32,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: altivec.c,v 1.29 2014/05/16 00:48:41 rmind Exp $);
+__KERNEL_RCSID(0, $NetBSD: altivec.c,v 1.30 2015/07/06 02:43:26 matt Exp $);
 
 #include opt_multiprocessor.h
 
@@ -82,18 +82,26 @@ vec_state_load(lwp_t *l, u_int flags)
 		vec_mark_used(l);
 	}
 
-	/*
-	 * Enable AltiVec temporarily (and disable interrupts).
-	 */
-	const register_t msr = mfmsr();
-	mtmsr((msr  ~PSL_EE) | PSL_VEC);
-	__asm volatile (isync);
-
-	/*
-	 * Load the vector unit from vreg which is best done in
-	 * assembly.
-	 */
-	vec_load_from_vreg(pcb-pcb_vr);
+	if ((flags  PCU_REENABLE) == 0) {
+		/*
+		 * Enable AltiVec temporarily (and disable interrupts).
+		 */
+		const register_t msr = mfmsr();
+		mtmsr((msr  ~PSL_EE) | PSL_VEC);
+		__asm volatile (isync);
+
+		/*
+		 * Load the vector unit from vreg which is best done in
+		 * assembly.
+		 */
+		vec_load_from_vreg(pcb-pcb_vr);
+
+		/*
+		 * Restore MSR (turn off AltiVec)
+		 */
+		mtmsr(msr);
+		__asm volatile (isync);
+	}
 
 	/*
 	 * VRSAVE will be restored when trap frame returns
@@ -101,12 +109,6 @@ vec_state_load(lwp_t *l, u_int flags)
 	l-l_md.md_utf-tf_vrsave = pcb-pcb_vr.vrsave;
 
 	/*
-	 * Restore MSR (turn off AltiVec)
-	 */
-	mtmsr(msr);
-	__asm volatile (isync);
-
-	/*
 	 * Mark vector registers as modified.
 	 */
 	l-l_md.md_flags |= PSL_VEC;



CVS commit: src/sys/arch/powerpc/oea

2014-08-10 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Sun Aug 10 17:49:04 UTC 2014

Modified Files:
src/sys/arch/powerpc/oea: pmap.c

Log Message:
Update conditions on mfsrin definition to match use.


To generate a diff of this commit:
cvs rdiff -u -r1.91 -r1.92 src/sys/arch/powerpc/oea/pmap.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/pmap.c
diff -u src/sys/arch/powerpc/oea/pmap.c:1.91 src/sys/arch/powerpc/oea/pmap.c:1.92
--- src/sys/arch/powerpc/oea/pmap.c:1.91	Mon Mar  3 15:36:36 2014
+++ src/sys/arch/powerpc/oea/pmap.c	Sun Aug 10 17:49:04 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.91 2014/03/03 15:36:36 macallan Exp $	*/
+/*	$NetBSD: pmap.c,v 1.92 2014/08/10 17:49:04 joerg Exp $	*/
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -63,7 +63,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.91 2014/03/03 15:36:36 macallan Exp $);
+__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.92 2014/08/10 17:49:04 joerg Exp $);
 
 #define	PMAP_NOOPNAMES
 
@@ -504,7 +504,7 @@ extern struct evcnt pmap_evcnt_idlezeroe
 #define	MFSRIN(va)	mfsrin(va)
 #define	MFTB()		mfrtcltbl()
 
-#if defined (PMAP_OEA) || defined (PMAP_OEA64_BRIDGE)
+#if defined(DDB)  !defined(PMAP_OEA64)
 static inline register_t
 mfsrin(vaddr_t va)
 {
@@ -512,7 +512,7 @@ mfsrin(vaddr_t va)
 	__asm volatile (mfsrin %0,%1 : =r(sr) : r(va));
 	return sr;
 }
-#endif	/* PMAP_OEA*/
+#endif	/* DDB  !PMAP_OEA64 */
 
 #if defined (PMAP_OEA64_BRIDGE)
 extern void mfmsr64 (register64_t *result);



CVS commit: src/sys/arch/powerpc/oea

2014-03-25 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Mar 25 16:41:37 UTC 2014

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

Log Message:
sprintf - snprintf


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 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/ofwoea_machdep.c
diff -u src/sys/arch/powerpc/oea/ofwoea_machdep.c:1.37 src/sys/arch/powerpc/oea/ofwoea_machdep.c:1.38
--- src/sys/arch/powerpc/oea/ofwoea_machdep.c:1.37	Mon Mar  3 15:36:36 2014
+++ src/sys/arch/powerpc/oea/ofwoea_machdep.c	Tue Mar 25 16:41:37 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: ofwoea_machdep.c,v 1.37 2014/03/03 15:36:36 macallan Exp $ */
+/* $NetBSD: ofwoea_machdep.c,v 1.38 2014/03/25 16:41:37 matt 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.37 2014/03/03 15:36:36 macallan Exp $);
+__KERNEL_RCSID(0, $NetBSD: ofwoea_machdep.c,v 1.38 2014/03/25 16:41:37 matt Exp $);
 
 #include opt_ppcarch.h
 #include opt_compat_netbsd.h
@@ -191,7 +191,7 @@ ofwoea_initppc(u_int startkernel, u_int 
 
 #if defined(MULTIPROCESSOR)  defined(ofppc)
 	for (i=1; i  CPU_MAXNUM; i++) {
-		sprintf(cpupath, /cpus/@%x, i);
+		snprintf(cpupath, sizeof(cpupath), /cpus/@%x, i);
 		node = OF_finddevice(cpupath);
 		if (node = 0)
 			continue;



CVS commit: src/sys/arch/powerpc/oea

2014-02-27 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Feb 28 05:34:39 UTC 2014

Modified Files:
src/sys/arch/powerpc/oea: oea_machdep.c

Log Message:
Use more appropriate type.


To generate a diff of this commit:
cvs rdiff -u -r1.68 -r1.69 src/sys/arch/powerpc/oea/oea_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/oea_machdep.c
diff -u src/sys/arch/powerpc/oea/oea_machdep.c:1.68 src/sys/arch/powerpc/oea/oea_machdep.c:1.69
--- src/sys/arch/powerpc/oea/oea_machdep.c:1.68	Sun Nov  3 22:27:27 2013
+++ src/sys/arch/powerpc/oea/oea_machdep.c	Fri Feb 28 05:34:39 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: oea_machdep.c,v 1.68 2013/11/03 22:27:27 mrg Exp $	*/
+/*	$NetBSD: oea_machdep.c,v 1.69 2014/02/28 05:34:39 matt Exp $	*/
 
 /*
  * Copyright (C) 2002 Matt Thomas
@@ -33,7 +33,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: oea_machdep.c,v 1.68 2013/11/03 22:27:27 mrg Exp $);
+__KERNEL_RCSID(0, $NetBSD: oea_machdep.c,v 1.69 2014/02/28 05:34:39 matt Exp $);
 
 #include opt_ppcarch.h
 #include opt_compat_netbsd.h
@@ -915,7 +915,7 @@ oea_install_extint(void (*handler)(void)
 		}
 	}
 #endif
-	__syncicache((void *)exc_exi_base, (int)extsize);
+	__syncicache((void *)exc_exi_base, (size_t)extsize);
 
 	__asm volatile (mtmsr %0 :: r(omsr));
 }



CVS commit: src/sys/arch/powerpc/oea

2014-02-27 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Feb 28 05:35:49 UTC 2014

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

Log Message:
Use uintptr_t instead of int.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 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/ofwoea_machdep.c
diff -u src/sys/arch/powerpc/oea/ofwoea_machdep.c:1.35 src/sys/arch/powerpc/oea/ofwoea_machdep.c:1.36
--- src/sys/arch/powerpc/oea/ofwoea_machdep.c:1.35	Sun Nov  3 22:27:27 2013
+++ src/sys/arch/powerpc/oea/ofwoea_machdep.c	Fri Feb 28 05:35:49 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: ofwoea_machdep.c,v 1.35 2013/11/03 22:27:27 mrg Exp $ */
+/* $NetBSD: ofwoea_machdep.c,v 1.36 2014/02/28 05:35:49 matt 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.35 2013/11/03 22:27:27 mrg Exp $);
+__KERNEL_RCSID(0, $NetBSD: ofwoea_machdep.c,v 1.36 2014/02/28 05:35:49 matt Exp $);
 
 #include opt_ppcarch.h
 #include opt_compat_netbsd.h
@@ -288,7 +288,7 @@ ofwoea_initppc(u_int startkernel, u_int 
 	restore_ofmap(ofmap, ofmaplen);
 
 #if NKSYMS || defined(DDB) || defined(MODULAR)
-	ksyms_addsyms_elf((int)((u_int)endsym - (u_int)startsym), startsym, endsym);
+	ksyms_addsyms_elf((int)((uintptr_t)endsym - (uintptr_t)startsym), startsym, endsym);
 #endif
 
 	/* CPU clock stuff */
@@ -370,12 +370,14 @@ restore_ofmap(struct ofw_translations *m
 
 	pmap_pinit(ofw_pmap);
 
+#ifndef _LP64
 	ofw_pmap.pm_sr[0] = KERNELN_SEGMENT(0)|SR_PRKEY;
 	ofw_pmap.pm_sr[KERNEL_SR] = KERNEL_SEGMENT|SR_SUKEY|SR_PRKEY;
 
 #ifdef KERNEL2_SR
 	ofw_pmap.pm_sr[KERNEL2_SR] = KERNEL2_SEGMENT|SR_SUKEY|SR_PRKEY;
 #endif
+#endif
 
 	for (i = 0; i  n; i++) {
 #if defined (PMAC_G5)
@@ -405,7 +407,7 @@ restore_ofmap(struct ofw_translations *m
 /*
  * Scan the device tree for ranges, and return them as bitmap 0..15
  */
-#ifndef macppc
+#if !defined(macppc)  defined(PPC_OEA)
 static u_int16_t
 ranges_bitmap(int node, u_int16_t bitmap)
 {
@@ -446,7 +448,7 @@ noranges:
 	}
 	return bitmap;
 }
-#endif /* !macppc */
+#endif /* !macppc  PPC_OEA */
 
 void
 ofwoea_batinit(void)



CVS commit: src/sys/arch/powerpc/oea

2014-02-18 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue Feb 18 12:27:15 UTC 2014

Modified Files:
src/sys/arch/powerpc/oea: ofw_autoconf.c

Log Message:
when looking for SCSI disks in canonicalize_bootpath() also match 'disk@'
since that's what at least some Adaptec firmware uses


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/powerpc/oea/ofw_autoconf.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_autoconf.c
diff -u src/sys/arch/powerpc/oea/ofw_autoconf.c:1.19 src/sys/arch/powerpc/oea/ofw_autoconf.c:1.20
--- src/sys/arch/powerpc/oea/ofw_autoconf.c:1.19	Sun May 12 13:23:08 2013
+++ src/sys/arch/powerpc/oea/ofw_autoconf.c	Tue Feb 18 12:27:15 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: ofw_autoconf.c,v 1.19 2013/05/12 13:23:08 macallan Exp $ */
+/* $NetBSD: ofw_autoconf.c,v 1.20 2014/02/18 12:27:15 macallan Exp $ */
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
  * Copyright (C) 1995, 1996 TooLs GmbH.
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ofw_autoconf.c,v 1.19 2013/05/12 13:23:08 macallan Exp $);
+__KERNEL_RCSID(0, $NetBSD: ofw_autoconf.c,v 1.20 2014/02/18 12:27:15 macallan Exp $);
 
 #ifdef ofppc
 #include gtpci.h
@@ -168,12 +168,15 @@ canonicalize_bootpath(void)
 	/*
 	 * OF_1.x (at least) always returns addr == 0 for
 	 * SCSI disks (i.e. /bandit@.../.../sd@0,0).
+	 * also check for .../disk@ which some Adaptec firmware uses
 	 */
 	lastp = strrchr(cbootpath, '/');
 	if (lastp != NULL) {
 		lastp++;
-		if (strncmp(lastp, sd@, 3) == 0
-		 strncmp(last, sd@, 3) == 0)
+		if ((strncmp(lastp, sd@, 3) == 0
+		  strncmp(last, sd@, 3) == 0) ||
+		(strncmp(lastp, disk@, 5) == 0
+		  strncmp(last, disk@, 5) == 0))
 			strcpy(lastp, last);
 	} else {
 		lastp = cbootpath;



CVS commit: src/sys/arch/powerpc/oea

2013-11-03 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sun Nov  3 22:15:58 UTC 2013

Modified Files:
src/sys/arch/powerpc/oea: pmap.c

Log Message:
gcc 4.8.1 wants:
- remove some set but unused variables
- move some variables inside their usage #ifdef's
- cast to (void) instead of using a dummy return variable

(there are more to come, but this one is now tested with gcc 4.5)


To generate a diff of this commit:
cvs rdiff -u -r1.89 -r1.90 src/sys/arch/powerpc/oea/pmap.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/pmap.c
diff -u src/sys/arch/powerpc/oea/pmap.c:1.89 src/sys/arch/powerpc/oea/pmap.c:1.90
--- src/sys/arch/powerpc/oea/pmap.c:1.89	Thu Apr 11 17:13:15 2013
+++ src/sys/arch/powerpc/oea/pmap.c	Sun Nov  3 22:15:57 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.89 2013/04/11 17:13:15 macallan Exp $	*/
+/*	$NetBSD: pmap.c,v 1.90 2013/11/03 22:15:57 mrg Exp $	*/
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -63,7 +63,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.89 2013/04/11 17:13:15 macallan Exp $);
+__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.90 2013/11/03 22:15:57 mrg Exp $);
 
 #define	PMAP_NOOPNAMES
 
@@ -1896,7 +1896,6 @@ pmap_enter(pmap_t pm, vaddr_t va, paddr_
 	struct pool *pl;
 	register_t pte_lo;
 	int error;
-	u_int pvo_flags;
 	u_int was_exec = 0;
 
 	PMAP_LOCK();
@@ -1904,13 +1903,11 @@ pmap_enter(pmap_t pm, vaddr_t va, paddr_
 	if (__predict_false(!pmap_initialized)) {
 		pvo_head = pmap_pvo_kunmanaged;
 		pl = pmap_upvo_pool;
-		pvo_flags = 0;
 		pg = NULL;
 		was_exec = PTE_EXEC;
 	} else {
 		pvo_head = pa_to_pvoh(pa, pg);
 		pl = pmap_mpvo_pool;
-		pvo_flags = PVO_MANAGED;
 	}
 
 	DPRINTFN(ENTER,
@@ -2647,7 +2644,9 @@ void
 pmap_print_mmuregs(void)
 {
 	int i;
+#if defined (PMAP_OEA) || defined (PMAP_OEA_BRIDGE)
 	u_int cpuvers;
+#endif
 #ifndef PMAP_OEA64
 	vaddr_t addr;
 	register_t soft_sr[16];
@@ -2658,7 +2657,9 @@ pmap_print_mmuregs(void)
 #endif
 	paddr_t sdr1;
 	
+#if defined (PMAP_OEA) || defined (PMAP_OEA_BRIDGE)
 	cpuvers = MFPVR()  16;
+#endif
 	__asm volatile (mfsdr1 %0 : =r(sdr1));
 #ifndef PMAP_OEA64
 	addr = 0;
@@ -3093,7 +3094,7 @@ pmap_setup_segment0_map(int use_large_pa
 vaddr_t va, va_end;
 
 register_t pte_lo = 0x0;
-int ptegidx = 0, i = 0;
+int ptegidx = 0;
 struct pte pte;
 va_list ap;
 
@@ -3107,7 +3108,7 @@ pmap_setup_segment0_map(int use_large_pa
 for (va = 0x0; va  SEGMENT_LENGTH; va += 0x1000) {
 ptegidx = va_to_pteg(pmap_kernel(), va);
 pmap_pte_create(pte, pmap_kernel(), va, va | pte_lo);
-i = pmap_pte_insert(ptegidx, pte);
+(void)pmap_pte_insert(ptegidx, pte);
 }
 
 va_start(ap, use_large_pages);
@@ -3129,7 +3130,7 @@ pmap_setup_segment0_map(int use_large_pa
 #endif
 ptegidx = va_to_pteg(pmap_kernel(), va);
 pmap_pte_create(pte, pmap_kernel(), va, pa | pte_lo);
-i = pmap_pte_insert(ptegidx, pte);
+(void)pmap_pte_insert(ptegidx, pte);
 }
 }
 



CVS commit: src/sys/arch/powerpc/oea

2013-11-03 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sun Nov  3 22:27:27 UTC 2013

Modified Files:
src/sys/arch/powerpc/oea: cpu_subr.c oea_machdep.c ofwoea_machdep.c

Log Message:
- remove set but unused variables
- move some variables inside their relevant use #ifdef


To generate a diff of this commit:
cvs rdiff -u -r1.79 -r1.80 src/sys/arch/powerpc/oea/cpu_subr.c
cvs rdiff -u -r1.67 -r1.68 src/sys/arch/powerpc/oea/oea_machdep.c
cvs rdiff -u -r1.34 -r1.35 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/cpu_subr.c
diff -u src/sys/arch/powerpc/oea/cpu_subr.c:1.79 src/sys/arch/powerpc/oea/cpu_subr.c:1.80
--- src/sys/arch/powerpc/oea/cpu_subr.c:1.79	Sun Sep 22 18:56:11 2013
+++ src/sys/arch/powerpc/oea/cpu_subr.c	Sun Nov  3 22:27:27 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu_subr.c,v 1.79 2013/09/22 18:56:11 matt Exp $	*/
+/*	$NetBSD: cpu_subr.c,v 1.80 2013/11/03 22:27:27 mrg Exp $	*/
 
 /*-
  * Copyright (c) 2001 Matt Thomas.
@@ -34,7 +34,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: cpu_subr.c,v 1.79 2013/09/22 18:56:11 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: cpu_subr.c,v 1.80 2013/11/03 22:27:27 mrg Exp $);
 
 #include opt_ppcparam.h
 #include opt_ppccache.h
@@ -747,7 +747,6 @@ cpu_identify(char *str, size_t len)
 	u_int pvr, major, minor;
 	uint16_t vers, rev, revfmt;
 	const struct cputab *cp;
-	const char *name;
 	size_t n;
 
 	pvr = mfpvr();
@@ -780,9 +779,7 @@ cpu_identify(char *str, size_t len)
 	}
 
 	revfmt = cp-revfmt;
-	name = cp-name;
 	if (rev == MPC750  pvr == 15) {
-		name = 755;
 		revfmt = REVFMT_HEX;
 	}
 

Index: src/sys/arch/powerpc/oea/oea_machdep.c
diff -u src/sys/arch/powerpc/oea/oea_machdep.c:1.67 src/sys/arch/powerpc/oea/oea_machdep.c:1.68
--- src/sys/arch/powerpc/oea/oea_machdep.c:1.67	Sat Aug 31 15:01:08 2013
+++ src/sys/arch/powerpc/oea/oea_machdep.c	Sun Nov  3 22:27:27 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: oea_machdep.c,v 1.67 2013/08/31 15:01:08 matt Exp $	*/
+/*	$NetBSD: oea_machdep.c,v 1.68 2013/11/03 22:27:27 mrg Exp $	*/
 
 /*
  * Copyright (C) 2002 Matt Thomas
@@ -33,7 +33,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: oea_machdep.c,v 1.67 2013/08/31 15:01:08 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: oea_machdep.c,v 1.68 2013/11/03 22:27:27 mrg Exp $);
 
 #include opt_ppcarch.h
 #include opt_compat_netbsd.h
@@ -656,11 +656,13 @@ void
 oea_batinit(paddr_t pa, ...)
 {
 	struct mem_region *allmem, *availmem, *mp;
-	unsigned int cpuvers;
 	register_t msr = mfmsr();
 	va_list ap;
+#ifdef PPC_OEA601
+	unsigned int cpuvers;
 
 	cpuvers = mfpvr()  16;
+#endif /* PPC_OEA601 */
 
 	/*
 	 * we need to call this before zapping BATs so OF calls work

Index: src/sys/arch/powerpc/oea/ofwoea_machdep.c
diff -u src/sys/arch/powerpc/oea/ofwoea_machdep.c:1.34 src/sys/arch/powerpc/oea/ofwoea_machdep.c:1.35
--- src/sys/arch/powerpc/oea/ofwoea_machdep.c:1.34	Sat Aug 31 07:33:15 2013
+++ src/sys/arch/powerpc/oea/ofwoea_machdep.c	Sun Nov  3 22:27:27 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: ofwoea_machdep.c,v 1.34 2013/08/31 07:33:15 matt Exp $ */
+/* $NetBSD: ofwoea_machdep.c,v 1.35 2013/11/03 22:27:27 mrg 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.34 2013/08/31 07:33:15 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: ofwoea_machdep.c,v 1.35 2013/11/03 22:27:27 mrg Exp $);
 
 #include opt_ppcarch.h
 #include opt_compat_netbsd.h
@@ -623,7 +623,6 @@ ofwoea_map_space(int rangetype, int iome
 {
 	int i, cur, range, nrofholes, error;
 	static int exmap=0;
-	u_int32_t addr;
 	rangemap_t region, holes[32], list[32];
 
 	memset(list, 0, sizeof(list));
@@ -697,7 +696,6 @@ ofwoea_map_space(int rangetype, int iome
 		DPRINTF(addr=0x%x size=0x%x type=%d\n, list[i].addr,
 		list[i].size, list[i].type);
 
-	addr=0;
 	range = find_lowest_range(list, cur, iomem);
 	i = 0;
 	nrofholes = 0;



CVS commit: src/sys/arch/powerpc/oea

2013-09-22 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sun Sep 22 18:05:16 UTC 2013

Modified Files:
src/sys/arch/powerpc/oea: cpu_subr.c

Log Message:
Make sure ABE/SYNCBE are enabled in HID1 for the 7450 CPUs
Enable XBSEN for the 7450.


To generate a diff of this commit:
cvs rdiff -u -r1.76 -r1.77 src/sys/arch/powerpc/oea/cpu_subr.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/cpu_subr.c
diff -u src/sys/arch/powerpc/oea/cpu_subr.c:1.76 src/sys/arch/powerpc/oea/cpu_subr.c:1.77
--- src/sys/arch/powerpc/oea/cpu_subr.c:1.76	Sat Oct 20 14:42:15 2012
+++ src/sys/arch/powerpc/oea/cpu_subr.c	Sun Sep 22 18:05:16 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu_subr.c,v 1.76 2012/10/20 14:42:15 kiyohara Exp $	*/
+/*	$NetBSD: cpu_subr.c,v 1.77 2013/09/22 18:05:16 matt Exp $	*/
 
 /*-
  * Copyright (c) 2001 Matt Thomas.
@@ -34,7 +34,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: cpu_subr.c,v 1.76 2012/10/20 14:42:15 kiyohara Exp $);
+__KERNEL_RCSID(0, $NetBSD: cpu_subr.c,v 1.77 2013/09/22 18:05:16 matt Exp $);
 
 #include opt_ppcparam.h
 #include opt_ppccache.h
@@ -278,15 +278,31 @@ cpu_model_init(void)
 	} else if (vers == MPC601) {
 		oeacpufeat |= OEACPU_601;
 
-	} else if (MPC745X_P(vers)  vers != MPC7450) {
-		oeacpufeat |= OEACPU_HIGHSPRG;
-		oeacpufeat |= OEACPU_XBSEN;
-		oeacpufeat |= OEACPU_HIGHBAT;
-		/* Enable more and larger BAT registers */
+	} else if (MPC745X_P(vers)) {
 		register_t hid0 = mfspr(SPR_HID0);
+		register_t hid1 = mfspr(SPR_HID1);
+
+		if (vers != MPC7450) {
+			/* Enable more SPRG registers */
+			oeacpufeat |= OEACPU_HIGHSPRG;
+
+			/* Enable more BAT registers */
+			oeacpufeat |= OEACPU_HIGHBAT;
+			hid0 |= HID0_HIGH_BAT_EN;
+		}
+
+		/* Enable larger BAT registers */
+		oeacpufeat |= OEACPU_XBSEN;
 		hid0 |= HID0_XBSEN;
-		hid0 |= HID0_HIGH_BAT_EN;
+
+		/* Enable address broadcasting for MP systems */
+		hid1 |= HID1_SYNCBE | HID1_ABE;
+
 		mtspr(SPR_HID0, hid0);
+		__asm volatile(sync;isync);
+
+		mtspr(SPR_HID0, hid1);
+		__asm volatile(sync;isync);
 
 	} else if (vers == IBM750FX || vers == IBM750GX) {
 		oeacpufeat |= OEACPU_HIGHBAT;



CVS commit: src/sys/arch/powerpc/oea

2013-09-22 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sun Sep 22 18:49:10 UTC 2013

Modified Files:
src/sys/arch/powerpc/oea: cpu_subr.c

Log Message:
Disable XBSEN for the 7450.


To generate a diff of this commit:
cvs rdiff -u -r1.77 -r1.78 src/sys/arch/powerpc/oea/cpu_subr.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/cpu_subr.c
diff -u src/sys/arch/powerpc/oea/cpu_subr.c:1.77 src/sys/arch/powerpc/oea/cpu_subr.c:1.78
--- src/sys/arch/powerpc/oea/cpu_subr.c:1.77	Sun Sep 22 18:05:16 2013
+++ src/sys/arch/powerpc/oea/cpu_subr.c	Sun Sep 22 18:49:10 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu_subr.c,v 1.77 2013/09/22 18:05:16 matt Exp $	*/
+/*	$NetBSD: cpu_subr.c,v 1.78 2013/09/22 18:49:10 matt Exp $	*/
 
 /*-
  * Copyright (c) 2001 Matt Thomas.
@@ -34,7 +34,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: cpu_subr.c,v 1.77 2013/09/22 18:05:16 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: cpu_subr.c,v 1.78 2013/09/22 18:49:10 matt Exp $);
 
 #include opt_ppcparam.h
 #include opt_ppccache.h
@@ -279,28 +279,29 @@ cpu_model_init(void)
 		oeacpufeat |= OEACPU_601;
 
 	} else if (MPC745X_P(vers)) {
-		register_t hid0 = mfspr(SPR_HID0);
 		register_t hid1 = mfspr(SPR_HID1);
 
 		if (vers != MPC7450) {
+			register_t hid0 = mfspr(SPR_HID0);
+
 			/* Enable more SPRG registers */
 			oeacpufeat |= OEACPU_HIGHSPRG;
 
 			/* Enable more BAT registers */
 			oeacpufeat |= OEACPU_HIGHBAT;
 			hid0 |= HID0_HIGH_BAT_EN;
-		}
 
-		/* Enable larger BAT registers */
-		oeacpufeat |= OEACPU_XBSEN;
-		hid0 |= HID0_XBSEN;
+			/* Enable larger BAT registers */
+			oeacpufeat |= OEACPU_XBSEN;
+			hid0 |= HID0_XBSEN;
+
+			mtspr(SPR_HID0, hid0);
+			__asm volatile(sync;isync);
+		}
 
 		/* Enable address broadcasting for MP systems */
 		hid1 |= HID1_SYNCBE | HID1_ABE;
 
-		mtspr(SPR_HID0, hid0);
-		__asm volatile(sync;isync);
-
 		mtspr(SPR_HID0, hid1);
 		__asm volatile(sync;isync);
 



CVS commit: src/sys/arch/powerpc/oea

2013-09-22 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sun Sep 22 18:56:11 UTC 2013

Modified Files:
src/sys/arch/powerpc/oea: cpu_subr.c

Log Message:
Fix cp bug.


To generate a diff of this commit:
cvs rdiff -u -r1.78 -r1.79 src/sys/arch/powerpc/oea/cpu_subr.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/cpu_subr.c
diff -u src/sys/arch/powerpc/oea/cpu_subr.c:1.78 src/sys/arch/powerpc/oea/cpu_subr.c:1.79
--- src/sys/arch/powerpc/oea/cpu_subr.c:1.78	Sun Sep 22 18:49:10 2013
+++ src/sys/arch/powerpc/oea/cpu_subr.c	Sun Sep 22 18:56:11 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu_subr.c,v 1.78 2013/09/22 18:49:10 matt Exp $	*/
+/*	$NetBSD: cpu_subr.c,v 1.79 2013/09/22 18:56:11 matt Exp $	*/
 
 /*-
  * Copyright (c) 2001 Matt Thomas.
@@ -34,7 +34,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: cpu_subr.c,v 1.78 2013/09/22 18:49:10 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: cpu_subr.c,v 1.79 2013/09/22 18:56:11 matt Exp $);
 
 #include opt_ppcparam.h
 #include opt_ppccache.h
@@ -302,7 +302,7 @@ cpu_model_init(void)
 		/* Enable address broadcasting for MP systems */
 		hid1 |= HID1_SYNCBE | HID1_ABE;
 
-		mtspr(SPR_HID0, hid1);
+		mtspr(SPR_HID1, hid1);
 		__asm volatile(sync;isync);
 
 	} else if (vers == IBM750FX || vers == IBM750GX) {



CVS commit: src/sys/arch/powerpc/oea

2013-08-31 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat Aug 31 07:33:15 UTC 2013

Modified Files:
src/sys/arch/powerpc/oea: oea_machdep.c ofwoea_machdep.c

Log Message:
Move the pmap_setup to the start oea_init (no non-OFW ports can use it).
If PPC_OEA64_BRIDGE is defined, add code so that when OEACPU_64_BRIDGE is not
present, it replaces the rfid with rfi and mfmsr/rldicl/mtmsrd sequence
with NOPs.  This allows plain OEA kernels to work.  (tested on PMPPC with
PPC_OEA64_BRIDGE option added).


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 src/sys/arch/powerpc/oea/oea_machdep.c
cvs rdiff -u -r1.33 -r1.34 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/oea_machdep.c
diff -u src/sys/arch/powerpc/oea/oea_machdep.c:1.65 src/sys/arch/powerpc/oea/oea_machdep.c:1.66
--- src/sys/arch/powerpc/oea/oea_machdep.c:1.65	Thu Jul  4 22:59:27 2013
+++ src/sys/arch/powerpc/oea/oea_machdep.c	Sat Aug 31 07:33:15 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: oea_machdep.c,v 1.65 2013/07/04 22:59:27 joerg Exp $	*/
+/*	$NetBSD: oea_machdep.c,v 1.66 2013/08/31 07:33:15 matt Exp $	*/
 
 /*
  * Copyright (C) 2002 Matt Thomas
@@ -33,7 +33,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: oea_machdep.c,v 1.65 2013/07/04 22:59:27 joerg Exp $);
+__KERNEL_RCSID(0, $NetBSD: oea_machdep.c,v 1.66 2013/08/31 07:33:15 matt Exp $);
 
 #include opt_ppcarch.h
 #include opt_compat_netbsd.h
@@ -147,6 +147,14 @@ oea_init(void (*handler)(void))
 #endif
 	KASSERT(mfspr(SPR_SPRG0) == (uintptr_t)ci);
 
+#if defined (PPC_OEA64_BRIDGE)  defined (PPC_OEA)
+	if (oeacpufeat  OEACPU_64_BRIDGE)
+		pmap_setup64bridge();
+	else
+		pmap_setup32();
+#endif
+
+
 	cpuvers = mfpvr()  16;
 
 	/*
@@ -298,6 +306,16 @@ oea_init(void (*handler)(void))
 #define	B		0x4800
 #define	TLBSYNC		0x7c00046c
 #define	SYNC		0x7c0004ac
+#ifdef PPC_OEA64_BRIDGE
+#define	MFMSR_MASK	0xfc1f
+#define	MFMSR		0x7ca6
+#define	MTMSRD_MASK	0xfc1e
+#define	MTMSRD		0x7c000164
+#define RLDICL_MASK	0xfc1c
+#define RLDICL		0x7800
+#define	RFID		0x4c24
+#define	RFI		0x4c64
+#endif
 
 #ifdef ALTIVEC
 #define	MFSPR_VRSAVE	0x7c0042a6
@@ -320,9 +338,7 @@ oea_init(void (*handler)(void))
 	if (scratch  PSL_VEC) {
 		cpu_altivec = 1;
 	} else {
-		int *ip = trapstart;
-		
-		for (; ip  trapend; ip++) {
+		for (int *ip = trapstart; ip  trapend; ip++) {
 			if ((ip[0]  MxSPR_MASK) == MFSPR_VRSAVE) {
 ip[0] = NOP;	/* mfspr */
 ip[1] = NOP;	/* stw */
@@ -343,9 +359,7 @@ oea_init(void (*handler)(void))
 	 * sequences where we zap/restore BAT registers on kernel exit/entry.
 	 */
 	if (cpuvers != MPC601) {
-		int *ip = trapstart;
-		
-		for (; ip  trapend; ip++) {
+		for (int *ip = trapstart; ip  trapend; ip++) {
 			if ((ip[0]  MxSPR_MASK) == MFSPR_MQ) {
 ip[0] = NOP;	/* mfspr */
 ip[1] = NOP;	/* stw */
@@ -361,6 +375,37 @@ oea_init(void (*handler)(void))
 		}
 	}
 
+#ifdef PPC_OEA64_BRIDGE
+	if ((oeacpufeat  OEACPU_64_BRIDGE) == 0) {
+		for (int *ip = (int *)exc_base;
+		 (uintptr_t)ip = exc_base + EXC_LAST;
+		 ip++) {
+			if ((ip[0]  MFMSR_MASK) == MFMSR
+			 (ip[1]  RLDICL_MASK) == RLDICL
+			 (ip[2]  MTMSRD_MASK) == MTMSRD) {
+*ip++ = NOP;
+*ip++ = NOP;
+ip[0] = NOP;
+			}
+		}
+
+		/*
+		 * Now replace each rfid instruction with a rfi instruction.
+		 */
+		for (int *ip = trapstart; ip  trapend; ip++) {
+			if ((ip[0]  MFMSR_MASK) == MFMSR
+			 (ip[1]  RLDICL_MASK) == RLDICL
+			 (ip[2]  MTMSRD_MASK) == MTMSRD) {
+*ip++ = NOP;
+*ip++ = NOP;
+ip[0] = NOP;
+			} else if (*ip == RFID) {
+*ip = RFI;
+			}
+		}
+	}
+#endif /* PPC_OEA64_BRIDGE */
+
 	/*
 	 * Sync the changed instructions.
 	 */
@@ -381,10 +426,11 @@ oea_init(void (*handler)(void))
 		extern int kernel_text[], etext[];
 		int *ip;
 
-		for (ip = kernel_text; ip  etext; ip++)
+		for (ip = kernel_text; ip  etext; ip++) {
 			if (*ip == TLBSYNC) {
 *ip = SYNC;
 __syncicache(ip, sizeof(*ip));
+			}
 		}
 	}
 #endif /* PPC_OEA601 */
@@ -830,6 +876,11 @@ oea_install_extint(void (*handler)(void)
 	extern int extint[], extsize[];
 	extern int extint_call[];
 	uintptr_t offset = (uintptr_t)handler - (uintptr_t)extint_call;
+#ifdef PPC_HIGH_VEC
+	const uintptr_t exc_exi_base = EXC_HIGHVEC + EXC_EXI;
+#else
+	const uintptr_t exc_exi_base = EXC_EXI;
+#endif
 	int omsr, msr;
 
 #ifdef	DIAGNOSTIC
@@ -842,13 +893,24 @@ oea_install_extint(void (*handler)(void)
 	:	K ((u_short)~PSL_EE));
 	extint_call[0] = (extint_call[0]  0xfc03) | offset;
 	__syncicache((void *)extint_call, sizeof extint_call[0]);
-#ifdef PPC_HIGH_VEC
-	memcpy((void *)(EXC_HIGHVEC + EXC_EXI), extint, (size_t)extsize);
-	__syncicache((void *)(EXC_HIGHVEC + EXC_EXI), (int)extsize);
-#else
-	memcpy((void *)EXC_EXI, extint, (size_t)extsize);
-	__syncicache((void *)EXC_EXI, (int)extsize);
+	

CVS commit: src/sys/arch/powerpc/oea

2013-08-31 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat Aug 31 15:01:08 UTC 2013

Modified Files:
src/sys/arch/powerpc/oea: oea_machdep.c

Log Message:
convert rfid to rfi in exception handlers.


To generate a diff of this commit:
cvs rdiff -u -r1.66 -r1.67 src/sys/arch/powerpc/oea/oea_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/oea_machdep.c
diff -u src/sys/arch/powerpc/oea/oea_machdep.c:1.66 src/sys/arch/powerpc/oea/oea_machdep.c:1.67
--- src/sys/arch/powerpc/oea/oea_machdep.c:1.66	Sat Aug 31 07:33:15 2013
+++ src/sys/arch/powerpc/oea/oea_machdep.c	Sat Aug 31 15:01:08 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: oea_machdep.c,v 1.66 2013/08/31 07:33:15 matt Exp $	*/
+/*	$NetBSD: oea_machdep.c,v 1.67 2013/08/31 15:01:08 matt Exp $	*/
 
 /*
  * Copyright (C) 2002 Matt Thomas
@@ -33,7 +33,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: oea_machdep.c,v 1.66 2013/08/31 07:33:15 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: oea_machdep.c,v 1.67 2013/08/31 15:01:08 matt Exp $);
 
 #include opt_ppcarch.h
 #include opt_compat_netbsd.h
@@ -386,6 +386,8 @@ oea_init(void (*handler)(void))
 *ip++ = NOP;
 *ip++ = NOP;
 ip[0] = NOP;
+			} else if (*ip == RFID) {
+*ip = RFI;
 			}
 		}
 
@@ -905,6 +907,8 @@ oea_install_extint(void (*handler)(void)
 *ip++ = NOP;
 *ip++ = NOP;
 ip[0] = NOP;
+			} else if (*ip == RFID) {
+*ip = RFI;
 			}
 		}
 	}



CVS commit: src/sys/arch/powerpc/oea

2013-08-23 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Aug 23 06:21:33 UTC 2013

Modified Files:
src/sys/arch/powerpc/oea: altivec.c

Log Message:
Get rid of MDLWP_USED{FPU,VEC}


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/powerpc/oea/altivec.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/altivec.c
diff -u src/sys/arch/powerpc/oea/altivec.c:1.27 src/sys/arch/powerpc/oea/altivec.c:1.28
--- src/sys/arch/powerpc/oea/altivec.c:1.27	Thu Aug 22 19:50:54 2013
+++ src/sys/arch/powerpc/oea/altivec.c	Fri Aug 23 06:21:33 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: altivec.c,v 1.27 2013/08/22 19:50:54 drochner Exp $	*/
+/*	$NetBSD: altivec.c,v 1.28 2013/08/23 06:21:33 matt Exp $	*/
 
 /*
  * Copyright (C) 1996 Wolfgang Solfrank.
@@ -32,7 +32,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: altivec.c,v 1.27 2013/08/22 19:50:54 drochner Exp $);
+__KERNEL_RCSID(0, $NetBSD: altivec.c,v 1.28 2013/08/23 06:21:33 matt Exp $);
 
 #include opt_multiprocessor.h
 
@@ -63,13 +63,13 @@ const pcu_ops_t vec_ops = {
 bool
 vec_used_p(lwp_t *l)
 {
-	return (l-l_md.md_flags  MDLWP_USEDVEC) != 0;
+	return pcu_used_p(vec_ops);
 }
 
 void
 vec_mark_used(lwp_t *l)
 {
-	l-l_md.md_flags |= MDLWP_USEDVEC;
+	return pcu_discard(vec_ops, true);
 }
 
 void
@@ -109,7 +109,7 @@ vec_state_load(lwp_t *l, u_int flags)
 	/*
 	 * Mark vector registers as modified.
 	 */
-	l-l_md.md_flags |= MDLWP_USEDVEC|PSL_VEC;
+	l-l_md.md_flags |= PSL_VEC;
 	l-l_md.md_utf-tf_srr1 |= PSL_VEC;
 }
 



CVS commit: src/sys/arch/powerpc/oea

2013-07-04 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Thu Jul  4 22:59:28 UTC 2013

Modified Files:
src/sys/arch/powerpc/oea: oea_machdep.c

Log Message:
When trying to write into page 0, use volatile to force the compiler to
actually create this access.


To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.65 src/sys/arch/powerpc/oea/oea_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/oea_machdep.c
diff -u src/sys/arch/powerpc/oea/oea_machdep.c:1.64 src/sys/arch/powerpc/oea/oea_machdep.c:1.65
--- src/sys/arch/powerpc/oea/oea_machdep.c:1.64	Thu Feb 16 07:59:46 2012
+++ src/sys/arch/powerpc/oea/oea_machdep.c	Thu Jul  4 22:59:27 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: oea_machdep.c,v 1.64 2012/02/16 07:59:46 matt Exp $	*/
+/*	$NetBSD: oea_machdep.c,v 1.65 2013/07/04 22:59:27 joerg Exp $	*/
 
 /*
  * Copyright (C) 2002 Matt Thomas
@@ -33,7 +33,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: oea_machdep.c,v 1.64 2012/02/16 07:59:46 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: oea_machdep.c,v 1.65 2013/07/04 22:59:27 joerg Exp $);
 
 #include opt_ppcarch.h
 #include opt_compat_netbsd.h
@@ -280,8 +280,8 @@ oea_init(void (*handler)(void))
 	 * Install a branch absolute to trap0 to force a panic.
 	 */
 	if ((uintptr_t)trap0  0x200) {
-		*(uint32_t *) 0 = 0x7c6802a6;
-		*(uint32_t *) 4 = 0x4802 | (uintptr_t) trap0;
+		*(volatile uint32_t *) 0 = 0x7c6802a6;
+		*(volatile uint32_t *) 4 = 0x4802 | (uintptr_t) trap0;
 	}
 
 	/*



CVS commit: src/sys/arch/powerpc/oea

2013-05-12 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Sun May 12 13:23:08 UTC 2013

Modified Files:
src/sys/arch/powerpc/oea: ofw_autoconf.c ofw_consinit.c

Log Message:
move console_node and console_instance to ofw_consinit.c where they're
actually used


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/powerpc/oea/ofw_autoconf.c
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/powerpc/oea/ofw_consinit.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_autoconf.c
diff -u src/sys/arch/powerpc/oea/ofw_autoconf.c:1.18 src/sys/arch/powerpc/oea/ofw_autoconf.c:1.19
--- src/sys/arch/powerpc/oea/ofw_autoconf.c:1.18	Sun Apr 28 00:44:27 2013
+++ src/sys/arch/powerpc/oea/ofw_autoconf.c	Sun May 12 13:23:08 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: ofw_autoconf.c,v 1.18 2013/04/28 00:44:27 macallan Exp $ */
+/* $NetBSD: ofw_autoconf.c,v 1.19 2013/05/12 13:23:08 macallan Exp $ */
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
  * Copyright (C) 1995, 1996 TooLs GmbH.
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ofw_autoconf.c,v 1.18 2013/04/28 00:44:27 macallan Exp $);
+__KERNEL_RCSID(0, $NetBSD: ofw_autoconf.c,v 1.19 2013/05/12 13:23:08 macallan Exp $);
 
 #ifdef ofppc
 #include gtpci.h
@@ -67,7 +67,6 @@ __KERNEL_RCSID(0, $NetBSD: ofw_autoconf
 
 extern char bootpath[256];
 char cbootpath[256];
-int console_node = 0, console_instance = 0;
 
 static void canonicalize_bootpath(void);
 

Index: src/sys/arch/powerpc/oea/ofw_consinit.c
diff -u src/sys/arch/powerpc/oea/ofw_consinit.c:1.15 src/sys/arch/powerpc/oea/ofw_consinit.c:1.16
--- src/sys/arch/powerpc/oea/ofw_consinit.c:1.15	Mon Oct 29 12:52:43 2012
+++ src/sys/arch/powerpc/oea/ofw_consinit.c	Sun May 12 13:23:08 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: ofw_consinit.c,v 1.15 2012/10/29 12:52:43 chs Exp $ */
+/* $NetBSD: ofw_consinit.c,v 1.16 2013/05/12 13:23:08 macallan Exp $ */
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ofw_consinit.c,v 1.15 2012/10/29 12:52:43 chs Exp $);
+__KERNEL_RCSID(0, $NetBSD: ofw_consinit.c,v 1.16 2013/05/12 13:23:08 macallan Exp $);
 
 #include sys/param.h
 #include sys/buf.h
@@ -88,7 +88,7 @@ extern struct consdev consdev_zs;
 #include dev/ic/pckbcvar.h
 #endif
 
-extern int console_node, console_instance;
+int console_node = 0, console_instance = 0;
 
 int chosen, stdin, stdout;
 int ofkbd_ihandle;



CVS commit: src/sys/arch/powerpc/oea

2013-05-12 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Mon May 13 00:12:01 UTC 2013

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

Log Message:
more G5 stuff:
- call OF_quiesce()
- properly map the message buffer


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 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/ofwoea_machdep.c
diff -u src/sys/arch/powerpc/oea/ofwoea_machdep.c:1.32 src/sys/arch/powerpc/oea/ofwoea_machdep.c:1.33
--- src/sys/arch/powerpc/oea/ofwoea_machdep.c:1.32	Thu Apr 11 17:13:15 2013
+++ src/sys/arch/powerpc/oea/ofwoea_machdep.c	Mon May 13 00:12:01 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: ofwoea_machdep.c,v 1.32 2013/04/11 17:13:15 macallan Exp $ */
+/* $NetBSD: ofwoea_machdep.c,v 1.33 2013/05/13 00:12:01 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.32 2013/04/11 17:13:15 macallan Exp $);
+__KERNEL_RCSID(0, $NetBSD: ofwoea_machdep.c,v 1.33 2013/05/13 00:12:01 macallan Exp $);
 
 #include opt_ppcarch.h
 #include opt_compat_netbsd.h
@@ -174,6 +174,10 @@ ofwoea_initppc(u_int startkernel, u_int 
 		model_init();
 	}
 
+	if (strcmp(model_name, PowerMac11,2) == 0 ||
+	strcmp(model_name, PowerMac11,1) == 0)
+		OF_quiesce();
+
 	/* Initialize bus_space */
 	ofwoea_bus_space_init();
 
@@ -242,7 +246,8 @@ ofwoea_initppc(u_int startkernel, u_int 
 		paddr_t pa;
 		int i;
 
-		pmap_setup_segment0_map(0, 0x0);
+		pmap_setup_segment0_map(0, msgbuf_paddr, msgbuf_paddr,
+		round_page(MSGBUFSIZE), 0x0);
 
 		/* Map OFW code+data */
 



CVS commit: src/sys/arch/powerpc/oea

2013-04-27 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Sun Apr 28 00:44:27 UTC 2013

Modified Files:
src/sys/arch/powerpc/oea: ofw_autoconf.c

Log Message:
some macppc boxes have onboard devices where parts or the whole PCI interrupt
register is hardwired to zero - fix this up here


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/powerpc/oea/ofw_autoconf.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_autoconf.c
diff -u src/sys/arch/powerpc/oea/ofw_autoconf.c:1.17 src/sys/arch/powerpc/oea/ofw_autoconf.c:1.18
--- src/sys/arch/powerpc/oea/ofw_autoconf.c:1.17	Sun Jul 29 18:05:45 2012
+++ src/sys/arch/powerpc/oea/ofw_autoconf.c	Sun Apr 28 00:44:27 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: ofw_autoconf.c,v 1.17 2012/07/29 18:05:45 mlelstv Exp $ */
+/* $NetBSD: ofw_autoconf.c,v 1.18 2013/04/28 00:44:27 macallan Exp $ */
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
  * Copyright (C) 1995, 1996 TooLs GmbH.
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ofw_autoconf.c,v 1.17 2012/07/29 18:05:45 mlelstv Exp $);
+__KERNEL_RCSID(0, $NetBSD: ofw_autoconf.c,v 1.18 2013/04/28 00:44:27 macallan Exp $);
 
 #ifdef ofppc
 #include gtpci.h
@@ -346,6 +346,15 @@ device_register(device_t dev, void *aux)
 shared-pins);
 			}
 		}
+#ifdef macppc
+		/*
+		 * XXX
+		 * some macppc boxes have onboard devices where parts or all of
+		 * the PCI_INTERRUPT register are hardwired to 0
+		 */
+		if (pa-pa_intrpin == 0)
+			pa-pa_intrpin = 1;
+#endif
 	}
 
 	if (booted_device)



CVS commit: src/sys/arch/powerpc/oea

2013-04-11 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Apr 11 18:04:20 UTC 2013

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

Log Message:
for some reason we can't use the ROM font on G5, so disable it with
options OFWOEA_WSCONS_NO_ROM_FONT
from Phileas Fogg


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/powerpc/oea/ofw_rascons.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.8 src/sys/arch/powerpc/oea/ofw_rascons.c:1.9
--- src/sys/arch/powerpc/oea/ofw_rascons.c:1.8	Wed Feb  1 09:54:03 2012
+++ src/sys/arch/powerpc/oea/ofw_rascons.c	Thu Apr 11 18:04:20 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: ofw_rascons.c,v 1.8 2012/02/01 09:54:03 matt Exp $	*/
+/*	$NetBSD: ofw_rascons.c,v 1.9 2013/04/11 18:04:20 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.8 2012/02/01 09:54:03 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: ofw_rascons.c,v 1.9 2013/04/11 18:04:20 macallan Exp $);
 
 #include wsdisplay.h
 
@@ -98,7 +98,9 @@ rascons_cnattach(void)
 
 	wsfont_init();
 	if (copy_rom_font() == 0) {
+#if !defined(OFWOEA_WSCONS_NO_ROM_FONT)
 		romfont_loaded = 1;
+#endif /* !OFWOEA_WSCONS_NO_ROM_FONT */
 	}
 
 	/* set up rasops */



CVS commit: src/sys/arch/powerpc/oea

2013-03-27 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Mar 28 00:22:22 UTC 2013

Modified Files:
src/sys/arch/powerpc/oea: pmap.c

Log Message:
Fix loop bug (Phileas Fogg)


To generate a diff of this commit:
cvs rdiff -u -r1.87 -r1.88 src/sys/arch/powerpc/oea/pmap.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/pmap.c
diff -u src/sys/arch/powerpc/oea/pmap.c:1.87 src/sys/arch/powerpc/oea/pmap.c:1.88
--- src/sys/arch/powerpc/oea/pmap.c:1.87	Sat Oct 20 10:42:15 2012
+++ src/sys/arch/powerpc/oea/pmap.c	Wed Mar 27 20:22:21 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.87 2012/10/20 14:42:15 kiyohara Exp $	*/
+/*	$NetBSD: pmap.c,v 1.88 2013/03/28 00:22:21 christos Exp $	*/
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -63,7 +63,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.87 2012/10/20 14:42:15 kiyohara Exp $);
+__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.88 2013/03/28 00:22:21 christos Exp $);
 
 #define	PMAP_NOOPNAMES
 
@@ -3090,7 +3090,7 @@ pmap_boot_find_memory(psize_t size, psiz
 int
 pmap_setup_segment0_map(int use_large_pages, ...)
 {
-vaddr_t va;
+vaddr_t va, va_end;
 
 register_t pte_lo = 0x0;
 int ptegidx = 0, i = 0;
@@ -3123,7 +3123,7 @@ pmap_setup_segment0_map(int use_large_pa
 pa = va_arg(ap, paddr_t);
 size = va_arg(ap, size_t);
 
-for (; va  (va + size); va += 0x1000, pa += 0x1000) {
+for (va_end = va + size; va  va_end; va += 0x1000, pa += 0x1000) {
 #if 0
 	printf(%s: Inserting: va: %# _PRIxva , pa: %# _PRIxpa \n, __func__,  va, pa);
 #endif



CVS commit: src/sys/arch/powerpc/oea

2012-10-20 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Sat Oct 20 13:10:44 UTC 2012

Modified Files:
src/sys/arch/powerpc/oea: cpu_subr.c

Log Message:
Remove white-spaces.  And remove unused 'extern void tlbia()'.


To generate a diff of this commit:
cvs rdiff -u -r1.73 -r1.74 src/sys/arch/powerpc/oea/cpu_subr.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/cpu_subr.c
diff -u src/sys/arch/powerpc/oea/cpu_subr.c:1.73 src/sys/arch/powerpc/oea/cpu_subr.c:1.74
--- src/sys/arch/powerpc/oea/cpu_subr.c:1.73	Wed Feb  1 09:54:03 2012
+++ src/sys/arch/powerpc/oea/cpu_subr.c	Sat Oct 20 13:10:44 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu_subr.c,v 1.73 2012/02/01 09:54:03 matt Exp $	*/
+/*	$NetBSD: cpu_subr.c,v 1.74 2012/10/20 13:10:44 kiyohara Exp $	*/
 
 /*-
  * Copyright (c) 2001 Matt Thomas.
@@ -34,7 +34,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: cpu_subr.c,v 1.73 2012/02/01 09:54:03 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: cpu_subr.c,v 1.74 2012/10/20 13:10:44 kiyohara Exp $);
 
 #include opt_ppcparam.h
 #include opt_multiprocessor.h
@@ -266,13 +266,13 @@ cpu_model_init(void)
 	vers = pvr  16;
 
 	oeacpufeat = 0;
-	
+
 	if ((vers = IBMRS64II  vers = IBM970GX) || vers == MPC620 ||
 		vers == IBMCELL || vers == IBMPOWER6P5) {
 		oeacpufeat |= OEACPU_64;
 		oeacpufeat |= OEACPU_64_BRIDGE;
 		oeacpufeat |= OEACPU_NOBAT;
-	
+
 	} else if (vers == MPC601) {
 		oeacpufeat |= OEACPU_601;
 
@@ -656,7 +656,7 @@ cpu_setup(device_t self, struct cpu_info
 	/*
 	 * Attach MPC750 temperature sensor to the envsys subsystem.
 	 * XXX the 74xx series also has this sensor, but it is not
-	 * XXX supported by Motorola and may return values that are off by 
+	 * XXX supported by Motorola and may return values that are off by
 	 * XXX 35-55 degrees C.
 	 */
 	if (vers == MPC750 || vers == IBM750FX || vers == IBM750GX)
@@ -799,7 +799,7 @@ cpu_enable_l2cr(register_t l2cr)
 	uint16_t vers;
 
 	vers = mfpvr()  16;
-	
+
 	/* Disable interrupts and set the cache config bits. */
 	msr = mfmsr();
 	mtmsr(msr  ~PSL_EE);
@@ -838,7 +838,7 @@ cpu_enable_l3cr(register_t l3cr)
 	register_t x;
 
 	/* By The Book (numbered steps from section 3.7.1.3 of MPC7450UM) */
-
+
 	/*
 	 * 1: Set all L3CR bits for final config except L3E, L3I, L3PE, and
 	 *L3CLKEN.  (also mask off reserved bits in case they were included
@@ -862,7 +862,7 @@ cpu_enable_l3cr(register_t l3cr)
 	do {
 		x = mfspr(SPR_L3CR);
 	} while (x  L3CR_L3I);
-	
+
 	/* 6: Clear L3CLKEN to 0 */
 	l3cr = ~L3CR_L3CLKEN;
 	mtspr(SPR_L3CR, l3cr);
@@ -964,7 +964,7 @@ cpu_config_l3cr(int vers)
 		cpu_enable_l2cr(l2cr_config);
 		l2cr = mfspr(SPR_L2CR);
 	}
-	
+
 	aprint_normal(,);
 	switch (vers) {
 	case MPC7447A:
@@ -997,7 +997,7 @@ cpu_config_l3cr(int vers)
 		cpu_enable_l3cr(l3cr_config);
 		l3cr = mfspr(SPR_L3CR);
 	}
-	
+
 	if (l3cr  L3CR_L3E) {
 		aprint_normal(,);
 		cpu_fmttab_print(cpu_7450_l3cr_formats, l3cr);
@@ -1123,8 +1123,8 @@ cpu_tau_setup(struct cpu_info *ci)
 	 */
 
 	therm_delay = ci-ci_khz / 40;		/* 25us just to be safe */
-	
-mtspr(SPR_THRM3, SPR_THRM_TIMER(therm_delay) | SPR_THRM_ENABLE); 
+
+mtspr(SPR_THRM3, SPR_THRM_TIMER(therm_delay) | SPR_THRM_ENABLE);
 
 	sme = sysmon_envsys_create();
 
@@ -1136,7 +1136,7 @@ cpu_tau_setup(struct cpu_info *ci)
 		return;
 	}
 
-	sme-sme_name = device_xname(ci-ci_dev);	
+	sme-sme_name = device_xname(ci-ci_dev);
 	sme-sme_cookie = ci;
 	sme-sme_refresh = cpu_tau_refresh;
 
@@ -1161,24 +1161,23 @@ cpu_tau_refresh(struct sysmon_envsys *sm
 	 * Unit in the MPC750 Microprocessor.
 	 */
 	for (i = 5; i = 0 ; i--) {
-		mtspr(SPR_THRM1, 
+		mtspr(SPR_THRM1,
 		SPR_THRM_THRESHOLD(threshold) | SPR_THRM_VALID);
 		count = 0;
-		while ((count  10)  
+		while ((count  10) 
 		((mfspr(SPR_THRM1)  SPR_THRM_TIV) == 0)) {
 			count++;
 			delay(1);
 		}
 		if (mfspr(SPR_THRM1)  SPR_THRM_TIN) {
-			/* The interrupt bit was set, meaning the 
-			 * temperature was above the threshold 
+			/* The interrupt bit was set, meaning the
+			 * temperature was above the threshold
 			 */
 			threshold += 1  i;
 		} else {
 			/* Temperature was below the threshold */
 			threshold -= 1  i;
 		}
-		
 	}
 	threshold += 2;
 
@@ -1231,7 +1230,7 @@ cpu_spinup(device_t self, struct cpu_inf
 	/* copy special registers */
 
 	h-hatch_hid0 = mfspr(SPR_HID0);
-	
+
 	__asm volatile (mfsdr1 %0 : =r(h-hatch_sdr1));
 	for (i = 0; i  16; i++) {
 		__asm (mfsrin %0,%1 : =r(h-hatch_sr[i]) :
@@ -1277,7 +1276,6 @@ cpu_spinup(device_t self, struct cpu_inf
 }
 
 static volatile int start_secondary_cpu;
-extern void tlbia(void);
 
 register_t
 cpu_hatch(void)
@@ -1300,7 +1298,7 @@ cpu_hatch(void)
 	msr = mfspr(SPR_PIR);
 	if (msr != h-hatch_pir)
 		mtspr(SPR_PIR, h-hatch_pir);
-	
+
 	__asm volatile (mtsprg0 %0 :: r(ci));
 	curlwp = ci-ci_curlwp;
 	cpu_spinstart_ack = 0;



CVS commit: src/sys/arch/powerpc/oea

2012-10-20 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Sat Oct 20 13:18:45 UTC 2012

Modified Files:
src/sys/arch/powerpc/oea: cpu_subr.c

Log Message:
Fix broken cpu_hatch_stack.
And define macro HATCH_STACK_SIZE.


To generate a diff of this commit:
cvs rdiff -u -r1.74 -r1.75 src/sys/arch/powerpc/oea/cpu_subr.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/cpu_subr.c
diff -u src/sys/arch/powerpc/oea/cpu_subr.c:1.74 src/sys/arch/powerpc/oea/cpu_subr.c:1.75
--- src/sys/arch/powerpc/oea/cpu_subr.c:1.74	Sat Oct 20 13:10:44 2012
+++ src/sys/arch/powerpc/oea/cpu_subr.c	Sat Oct 20 13:18:45 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu_subr.c,v 1.74 2012/10/20 13:10:44 kiyohara Exp $	*/
+/*	$NetBSD: cpu_subr.c,v 1.75 2012/10/20 13:18:45 kiyohara Exp $	*/
 
 /*-
  * Copyright (c) 2001 Matt Thomas.
@@ -34,7 +34,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: cpu_subr.c,v 1.74 2012/10/20 13:10:44 kiyohara Exp $);
+__KERNEL_RCSID(0, $NetBSD: cpu_subr.c,v 1.75 2012/10/20 13:18:45 kiyohara Exp $);
 
 #include opt_ppcparam.h
 #include opt_multiprocessor.h
@@ -236,6 +236,7 @@ struct cpu_info cpu_info[CPU_MAXNUM] = {
 };
 volatile struct cpu_hatch_data *cpu_hatch_data;
 volatile int cpu_hatch_stack;
+#define HATCH_STACK_SIZE 0x1000
 extern int ticks_per_intr;
 #include powerpc/oea/bat.h
 #include powerpc/pic/picvar.h
@@ -1203,7 +1204,7 @@ cpu_spinup(device_t self, struct cpu_inf
 	KASSERT(ci != curcpu());
 
 	/* Now allocate a hatch stack */
-	error = uvm_pglistalloc(0x1000, 0x1, 0x1000, 16, 0,
+	error = uvm_pglistalloc(HATCH_STACK_SIZE, 0x1, 0x1000, 16, 0,
 	mlist, 1, 1);
 	if (error) {
 		aprint_error(: unable to allocate hatch stack\n);
@@ -1211,7 +1212,7 @@ cpu_spinup(device_t self, struct cpu_inf
 	}
 
 	hp = (void *)VM_PAGE_TO_PHYS(TAILQ_FIRST(mlist));
-	memset(hp, 0, 0x1000);
+	memset(hp, 0, HATCH_STACK_SIZE);
 
 	/* Initialize secondary cpu's initial lwp to its idlelwp. */
 	ci-ci_curlwp = ci-ci_data.cpu_idlelwp;
@@ -1224,7 +1225,7 @@ cpu_spinup(device_t self, struct cpu_inf
 	h-hatch_ci = ci;
 	h-hatch_pir = ci-ci_cpuid;
 
-	cpu_hatch_stack = (uint32_t)hp;
+	cpu_hatch_stack = (uint32_t)hp + HATCH_STACK_SIZE - CALLFRAMELEN;
 	ci-ci_lasttb = cpu_info[0].ci_lasttb;
 
 	/* copy special registers */



CVS commit: src/sys/arch/powerpc/oea

2012-07-16 Thread Julio Merino
Module Name:src
Committed By:   jmmv
Date:   Tue Jul 17 03:13:31 UTC 2012

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

Log Message:
OF_finddevice returns -1 on error, not an arbitrary negative number.  Make
conditional explicit so that model_name gets a chance to be initialized when
the handle for the device is actually negative (which appears to be the case
in my Mac Mini G4).


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 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/ofwoea_machdep.c
diff -u src/sys/arch/powerpc/oea/ofwoea_machdep.c:1.29 src/sys/arch/powerpc/oea/ofwoea_machdep.c:1.30
--- src/sys/arch/powerpc/oea/ofwoea_machdep.c:1.29	Tue May  8 05:15:45 2012
+++ src/sys/arch/powerpc/oea/ofwoea_machdep.c	Tue Jul 17 03:13:31 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: ofwoea_machdep.c,v 1.29 2012/05/08 05:15:45 macallan Exp $ */
+/* $NetBSD: ofwoea_machdep.c,v 1.30 2012/07/17 03:13:31 jmmv 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.29 2012/05/08 05:15:45 macallan Exp $);
+__KERNEL_RCSID(0, $NetBSD: ofwoea_machdep.c,v 1.30 2012/07/17 03:13:31 jmmv Exp $);
 
 #include opt_ppcarch.h
 #include opt_compat_netbsd.h
@@ -159,7 +159,7 @@ ofwoea_initppc(u_int startkernel, u_int 
 	/* get model name and perform model-specific actions */
 	memset(model_name, 0, sizeof(model_name));
 	node = OF_finddevice(/);
-	if (node = 0) {
+	if (node != -1) {
 		l = OF_getprop(node, model, model_name, sizeof(model_name));
 		if (l == -1)
 			OF_getprop(node, name, model_name,



CVS commit: src/sys/arch/powerpc/oea

2012-05-23 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu May 24 00:40:12 UTC 2012

Modified Files:
src/sys/arch/powerpc/oea: ofw_autoconf.c

Log Message:
copy properties for valkyriefb as well


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/powerpc/oea/ofw_autoconf.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_autoconf.c
diff -u src/sys/arch/powerpc/oea/ofw_autoconf.c:1.15 src/sys/arch/powerpc/oea/ofw_autoconf.c:1.16
--- src/sys/arch/powerpc/oea/ofw_autoconf.c:1.15	Sun Jul 17 20:54:46 2011
+++ src/sys/arch/powerpc/oea/ofw_autoconf.c	Thu May 24 00:40:11 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: ofw_autoconf.c,v 1.15 2011/07/17 20:54:46 joerg Exp $ */
+/* $NetBSD: ofw_autoconf.c,v 1.16 2012/05/24 00:40:11 macallan Exp $ */
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
  * Copyright (C) 1995, 1996 TooLs GmbH.
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ofw_autoconf.c,v 1.15 2011/07/17 20:54:46 joerg Exp $);
+__KERNEL_RCSID(0, $NetBSD: ofw_autoconf.c,v 1.16 2012/05/24 00:40:11 macallan Exp $);
 
 #ifdef ofppc
 #include gtpci.h
@@ -219,6 +219,15 @@ device_register(device_t dev, void *aux)
 		parent = dev;
 		return;
 	}
+
+	if (device_is_a(dev, valkyriefb)) {
+		struct confargs *ca = aux;
+		prop_dictionary_t dict;
+
+		dict = device_properties(dev);
+		copy_disp_props(dev, ca-ca_node, dict);
+	}
+
 #if NGTPCI  0
 	if (device_is_a(dev, gtpci)) {
 		extern struct gtpci_prot gtpci0_prot, gtpci1_prot;



CVS commit: src/sys/arch/powerpc/oea

2012-05-07 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue May  8 05:15:45 UTC 2012

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

Log Message:
provide a BAT mapping for the PCI IO range on Grackle/Heathrow based macs
now drivers that need PCI IO access work again


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 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/ofwoea_machdep.c
diff -u src/sys/arch/powerpc/oea/ofwoea_machdep.c:1.28 src/sys/arch/powerpc/oea/ofwoea_machdep.c:1.29
--- src/sys/arch/powerpc/oea/ofwoea_machdep.c:1.28	Thu Feb 16 07:59:46 2012
+++ src/sys/arch/powerpc/oea/ofwoea_machdep.c	Tue May  8 05:15:45 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: ofwoea_machdep.c,v 1.28 2012/02/16 07:59:46 matt Exp $ */
+/* $NetBSD: ofwoea_machdep.c,v 1.29 2012/05/08 05:15:45 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.28 2012/02/16 07:59:46 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: ofwoea_machdep.c,v 1.29 2012/05/08 05:15:45 macallan Exp $);
 
 #include opt_ppcarch.h
 #include opt_compat_netbsd.h
@@ -419,6 +419,7 @@ ofwoea_batinit(void)
 	oea_batinit(0x8000, BAT_BL_1G,
 		0xf000, BAT_BL_128M,
 		0xf800, BAT_BL_64M,
+		0xfe00, BAT_BL_8M,	/* Grackle IO */
 		0);
 #else
 	uint16_t bitmap;



CVS commit: src/sys/arch/powerpc/oea

2012-02-15 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Feb 16 07:59:46 UTC 2012

Modified Files:
src/sys/arch/powerpc/oea: oea_machdep.c ofwoea_machdep.c

Log Message:
Allow use of large (256MB) bats for iobats.  If XBSEN isn't present, they
will be downsized into multiple 256MB bats.  Tested by riz.


To generate a diff of this commit:
cvs rdiff -u -r1.63 -r1.64 src/sys/arch/powerpc/oea/oea_machdep.c
cvs rdiff -u -r1.27 -r1.28 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/oea_machdep.c
diff -u src/sys/arch/powerpc/oea/oea_machdep.c:1.63 src/sys/arch/powerpc/oea/oea_machdep.c:1.64
--- src/sys/arch/powerpc/oea/oea_machdep.c:1.63	Wed Feb 15 01:56:57 2012
+++ src/sys/arch/powerpc/oea/oea_machdep.c	Thu Feb 16 07:59:46 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: oea_machdep.c,v 1.63 2012/02/15 01:56:57 macallan Exp $	*/
+/*	$NetBSD: oea_machdep.c,v 1.64 2012/02/16 07:59:46 matt Exp $	*/
 
 /*
  * Copyright (C) 2002 Matt Thomas
@@ -33,7 +33,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: oea_machdep.c,v 1.63 2012/02/15 01:56:57 macallan Exp $);
+__KERNEL_RCSID(0, $NetBSD: oea_machdep.c,v 1.64 2012/02/16 07:59:46 matt Exp $);
 
 #include opt_ppcarch.h
 #include opt_compat_netbsd.h
@@ -473,12 +473,25 @@ void
 oea_iobat_add(paddr_t pa, register_t len)
 {
 	static int z = 1;
-	const u_int n = __SHIFTOUT(len, (BAT_XBL|BAT_BL)  ~BAT_BL_8M);
+	const u_int n = BAT_BL_TO_SIZE(len) / BAT_BL_TO_SIZE(BAT_BL_8M);
 	const u_int i = BAT_VA2IDX(pa)  -n; /* in case pa was in the middle */
 	const int after_bat3 = (oeacpufeat  OEACPU_HIGHBAT) ? 4 : 8;
 
 	KASSERT(len = BAT_BL_8M);
 
+	/*
+	 * If the caller wanted a bigger BAT than the hardware supports,
+	 * split it into smaller BATs.
+	 */
+	if (len  BAT_BL_256M  (oeacpufeat  OEACPU_XBSEN) == 0) {
+		u_int xn = BAT_BL_TO_SIZE(len)  28;
+		while (xn--  0) {
+			oea_iobat_add(pa, BAT_BL_256M);
+			pa += 0x1000;
+		}
+		return;
+	} 
+
 	const register_t batl = BATL(pa, BAT_I|BAT_G, BAT_PP_RW);
 	const register_t batu = BATU(pa, len, BAT_Vs);
 
@@ -600,6 +613,7 @@ oea_batinit(paddr_t pa, ...)
 	va_list ap;
 
 	cpuvers = mfpvr()  16;
+
 	/*
 	 * we need to call this before zapping BATs so OF calls work
 	 */

Index: src/sys/arch/powerpc/oea/ofwoea_machdep.c
diff -u src/sys/arch/powerpc/oea/ofwoea_machdep.c:1.27 src/sys/arch/powerpc/oea/ofwoea_machdep.c:1.28
--- src/sys/arch/powerpc/oea/ofwoea_machdep.c:1.27	Wed Feb 15 01:56:58 2012
+++ src/sys/arch/powerpc/oea/ofwoea_machdep.c	Thu Feb 16 07:59:46 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: ofwoea_machdep.c,v 1.27 2012/02/15 01:56:58 macallan Exp $ */
+/* $NetBSD: ofwoea_machdep.c,v 1.28 2012/02/16 07:59:46 matt 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.27 2012/02/15 01:56:58 macallan Exp $);
+__KERNEL_RCSID(0, $NetBSD: ofwoea_machdep.c,v 1.28 2012/02/16 07:59:46 matt Exp $);
 
 #include opt_ppcarch.h
 #include opt_compat_netbsd.h
@@ -416,15 +416,12 @@ ofwoea_batinit(void)
 	/*
 	 * cover PCI and register space but not the firmware ROM
 	 */
-	oea_batinit(0x8000, BAT_BL_256M,
-		0x9000, BAT_BL_256M,
-		0xa000, BAT_BL_256M,
-		0xb000, BAT_BL_256M,
+	oea_batinit(0x8000, BAT_BL_1G,
 		0xf000, BAT_BL_128M,
 		0xf800, BAT_BL_64M,
 		0);
 #else
-u_int16_t bitmap;
+	uint16_t bitmap;
 	int node, i;
 
 	node = OF_finddevice(/);



CVS commit: src/sys/arch/powerpc/oea

2012-02-14 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Feb 15 01:56:58 UTC 2012

Modified Files:
src/sys/arch/powerpc/oea: oea_machdep.c ofwoea_machdep.c

Log Message:
fix crash during early startup - we can't call OpenFirmware between zapping
the BATs and complete setting them up again
ok releng


To generate a diff of this commit:
cvs rdiff -u -r1.62 -r1.63 src/sys/arch/powerpc/oea/oea_machdep.c
cvs rdiff -u -r1.26 -r1.27 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/oea_machdep.c
diff -u src/sys/arch/powerpc/oea/oea_machdep.c:1.62 src/sys/arch/powerpc/oea/oea_machdep.c:1.63
--- src/sys/arch/powerpc/oea/oea_machdep.c:1.62	Wed Feb  1 09:54:03 2012
+++ src/sys/arch/powerpc/oea/oea_machdep.c	Wed Feb 15 01:56:57 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: oea_machdep.c,v 1.62 2012/02/01 09:54:03 matt Exp $	*/
+/*	$NetBSD: oea_machdep.c,v 1.63 2012/02/15 01:56:57 macallan Exp $	*/
 
 /*
  * Copyright (C) 2002 Matt Thomas
@@ -33,7 +33,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: oea_machdep.c,v 1.62 2012/02/01 09:54:03 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: oea_machdep.c,v 1.63 2012/02/15 01:56:57 macallan Exp $);
 
 #include opt_ppcarch.h
 #include opt_compat_netbsd.h
@@ -600,6 +600,10 @@ oea_batinit(paddr_t pa, ...)
 	va_list ap;
 
 	cpuvers = mfpvr()  16;
+	/*
+	 * we need to call this before zapping BATs so OF calls work
+	 */
+	mem_regions(allmem, availmem);
 
 	/*
 	 * Initialize BAT registers to unmapped to not generate
@@ -698,7 +702,7 @@ oea_batinit(paddr_t pa, ...)
 		   r(battable[0x0180  23].batu));
 	}
 #endif /* PPC_OEA601 */
-
+	
 	/*
 	 * Now setup other fixed bat registers
 	 *
@@ -733,9 +737,7 @@ oea_batinit(paddr_t pa, ...)
 
 	/*
 	 * Set up battable to map all RAM regions.
-	 * This is here because mem_regions() call needs bat0 set up.
 	 */
-	mem_regions(allmem, availmem);
 #ifdef PPC_OEA601
 	if (cpuvers == MPC601) {
 		for (mp = allmem; mp-size; mp++) {

Index: src/sys/arch/powerpc/oea/ofwoea_machdep.c
diff -u src/sys/arch/powerpc/oea/ofwoea_machdep.c:1.26 src/sys/arch/powerpc/oea/ofwoea_machdep.c:1.27
--- src/sys/arch/powerpc/oea/ofwoea_machdep.c:1.26	Thu Aug  4 20:02:48 2011
+++ src/sys/arch/powerpc/oea/ofwoea_machdep.c	Wed Feb 15 01:56:58 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: ofwoea_machdep.c,v 1.26 2011/08/04 20:02:48 phx Exp $ */
+/* $NetBSD: ofwoea_machdep.c,v 1.27 2012/02/15 01:56:58 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.26 2011/08/04 20:02:48 phx Exp $);
+__KERNEL_RCSID(0, $NetBSD: ofwoea_machdep.c,v 1.27 2012/02/15 01:56:58 macallan Exp $);
 
 #include opt_ppcarch.h
 #include opt_compat_netbsd.h
@@ -166,6 +166,7 @@ ofwoea_initppc(u_int startkernel, u_int 
 			sizeof(model_name));
 		model_init();
 	}
+
 	/* Initialize bus_space */
 	ofwoea_bus_space_init();
 
@@ -363,7 +364,7 @@ restore_ofmap(struct ofw_translations *m
 /*
  * Scan the device tree for ranges, and return them as bitmap 0..15
  */
-
+#ifndef macppc
 static u_int16_t
 ranges_bitmap(int node, u_int16_t bitmap)
 {
@@ -404,22 +405,33 @@ noranges:
 	}
 	return bitmap;
 }
+#endif /* !macppc */
 
 void
 ofwoea_batinit(void)
 {
 #if defined (PPC_OEA)
+
+#ifdef macppc
+	/*
+	 * cover PCI and register space but not the firmware ROM
+	 */
+	oea_batinit(0x8000, BAT_BL_256M,
+		0x9000, BAT_BL_256M,
+		0xa000, BAT_BL_256M,
+		0xb000, BAT_BL_256M,
+		0xf000, BAT_BL_128M,
+		0xf800, BAT_BL_64M,
+		0);
+#else
 u_int16_t bitmap;
 	int node, i;
 
 	node = OF_finddevice(/);
+
 	bitmap = ranges_bitmap(node, 0);
 	oea_batinit(0);
 
-#ifdef macppc
-	/* XXX this is a macppc-specific hack */
-	bitmap = 0x8f00;
-#endif
 	for (i=1; i  0x10; i++) {
 		/* skip the three vital SR regions */
 		if (i == USER_SR || i == KERNEL_SR || i == KERNEL2_SR)
@@ -429,6 +441,7 @@ ofwoea_batinit(void)
 			DPRINTF(Batmapped 256M at 0x%x\n, 0x1000 * i);
 		}
 	}
+#endif
 #endif /* OEA */
 }
 



CVS commit: src/sys/arch/powerpc/oea

2012-02-11 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Sat Feb 11 13:53:59 UTC 2012

Modified Files:
src/sys/arch/powerpc/oea: prep_machdep.c

Log Message:
Fix panic() on KASSERT(len = BAT_BL_8M) in oea_iobat_add().  Thanks phx@.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/powerpc/oea/prep_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/prep_machdep.c
diff -u src/sys/arch/powerpc/oea/prep_machdep.c:1.9 src/sys/arch/powerpc/oea/prep_machdep.c:1.10
--- src/sys/arch/powerpc/oea/prep_machdep.c:1.9	Wed Feb  1 09:54:03 2012
+++ src/sys/arch/powerpc/oea/prep_machdep.c	Sat Feb 11 13:53:59 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: prep_machdep.c,v 1.9 2012/02/01 09:54:03 matt Exp $ */
+/* $NetBSD: prep_machdep.c,v 1.10 2012/02/11 13:53:59 kiyohara Exp $ */
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: prep_machdep.c,v 1.9 2012/02/01 09:54:03 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: prep_machdep.c,v 1.10 2012/02/11 13:53:59 kiyohara Exp $);
 
 #include opt_modular.h
 
@@ -147,7 +147,7 @@ prep_initppc(u_long startkernel, u_long 
 	PREP_BUS_SPACE_MEM, BAT_BL_256M,
 	PREP_BUS_SPACE_IO,  BAT_BL_256M,
 #if defined(bebox)
-	0x7000, BAT_BL_128K,	/* BeBox Mainboard Registers (4KB) */
+	0x7000, BAT_BL_8M,	/* BeBox Mainboard Registers (4KB) */
 #elif defined(prep)
 	0xbf80, BAT_BL_8M,
 #endif



CVS commit: src/sys/arch/powerpc/oea

2012-02-03 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Feb  3 19:29:59 UTC 2012

Modified Files:
src/sys/arch/powerpc/oea: pmap.c

Log Message:
Use CPP __VA_ARGS__ for DPRINTF*


To generate a diff of this commit:
cvs rdiff -u -r1.84 -r1.85 src/sys/arch/powerpc/oea/pmap.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/pmap.c
diff -u src/sys/arch/powerpc/oea/pmap.c:1.84 src/sys/arch/powerpc/oea/pmap.c:1.85
--- src/sys/arch/powerpc/oea/pmap.c:1.84	Wed Feb  1 09:54:03 2012
+++ src/sys/arch/powerpc/oea/pmap.c	Fri Feb  3 19:29:59 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.84 2012/02/01 09:54:03 matt Exp $	*/
+/*	$NetBSD: pmap.c,v 1.85 2012/02/03 19:29:59 matt Exp $	*/
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -63,7 +63,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.84 2012/02/01 09:54:03 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.85 2012/02/03 19:29:59 matt Exp $);
 
 #define	PMAP_NOOPNAMES
 
@@ -425,11 +425,11 @@ static int pmap_initialized;
 
 unsigned int pmapdebug = 0;
 
-# define DPRINTF(x)		printf x
-# define DPRINTFN(n, x)		if (pmapdebug  PMAPDEBUG_ ## n) printf x
+# define DPRINTF(x, ...)	printf(x, __VA_ARGS__)
+# define DPRINTFN(n, x, ...)	do if (pmapdebug  PMAPDEBUG_ ## n) printf(x, __VA_ARGS__); while (0)
 #else
-# define DPRINTF(x)
-# define DPRINTFN(n, x)
+# define DPRINTF(x, ...)	do { } while (0)
+# define DPRINTFN(n, x, ...)	do { } while (0)
 #endif
 
 
@@ -855,8 +855,8 @@ pmap_pte_insert(int ptegidx, struct pte 
 	int i;
 	
 #if defined(DEBUG)
-	DPRINTFN(PTE, (pmap_pte_insert: idx %#x, pte %# _PRIxpte  %# _PRIxpte \n,
-		ptegidx, pvo_pt-pte_hi, pvo_pt-pte_lo));
+	DPRINTFN(PTE, pmap_pte_insert: idx %#x, pte %# _PRIxpte  %# _PRIxpte \n,
+		ptegidx, pvo_pt-pte_hi, pvo_pt-pte_lo);
 #endif
 	/*
 	 * First try primary hash.
@@ -1151,7 +1151,7 @@ pmap_create(void)
 	memset((void *)pm, 0, sizeof *pm);
 	pmap_pinit(pm);
 	
-	DPRINTFN(CREATE,(pmap_create: pm %p:\n
+	DPRINTFN(CREATE, pmap_create: pm %p:\n
 	\t%# _PRIsr  %# _PRIsr  %# _PRIsr  %# _PRIsr
 	%# _PRIsr  %# _PRIsr  %# _PRIsr  %# _PRIsr \n
 	\t%# _PRIsr  %# _PRIsr  %# _PRIsr  %# _PRIsr
@@ -1164,7 +1164,7 @@ pmap_create(void)
 	pm-pm_sr[8], pm-pm_sr[9],
 	pm-pm_sr[10], pm-pm_sr[11], 
 	pm-pm_sr[12], pm-pm_sr[13],
-	pm-pm_sr[14], pm-pm_sr[15]));
+	pm-pm_sr[14], pm-pm_sr[15]);
 	return pm;
 }
 
@@ -1669,8 +1669,8 @@ pmap_pvo_enter(pmap_t pm, struct pool *p
 #if defined(DEBUG)
 /*	if (pm != pmap_kernel()  va  VM_MIN_KERNEL_ADDRESS) */
 		DPRINTFN(PVOENTER,
-		(pmap_pvo_enter: pvo %p: pm %p va %# _PRIxva  pa %# _PRIxpa \n,
-		pvo, pm, va, pa));
+		pmap_pvo_enter: pvo %p: pm %p va %# _PRIxva  pa %# _PRIxpa \n,
+		pvo, pm, va, pa);
 #endif
 
 	/*
@@ -1777,15 +1777,15 @@ pmap_pvo_remove(struct pvo_entry *pvo, i
 			(pmap_attr_fetch(pg)  PTE_EXEC)) {
 struct pvo_head *pvoh = vm_page_to_pvoh(pg);
 if (LIST_EMPTY(pvoh)) {
-	DPRINTFN(EXEC, ([pmap_pvo_remove: 
+	DPRINTFN(EXEC, [pmap_pvo_remove: 
 	%# _PRIxpa : clear-exec]\n,
-	VM_PAGE_TO_PHYS(pg)));
+	VM_PAGE_TO_PHYS(pg));
 	pmap_attr_clear(pg, PTE_EXEC);
 	PMAPCOUNT(exec_uncached_pvo_remove);
 } else {
-	DPRINTFN(EXEC, ([pmap_pvo_remove: 
+	DPRINTFN(EXEC, [pmap_pvo_remove: 
 	%# _PRIxpa : syncicache]\n,
-	VM_PAGE_TO_PHYS(pg)));
+	VM_PAGE_TO_PHYS(pg));
 	pmap_syncicache(VM_PAGE_TO_PHYS(pg),
 	PAGE_SIZE);
 	PMAPCOUNT(exec_synced_pvo_remove);
@@ -1909,8 +1909,8 @@ pmap_enter(pmap_t pm, vaddr_t va, paddr_
 	}
 
 	DPRINTFN(ENTER,
-	(pmap_enter(%p, %# _PRIxva , %# _PRIxpa , 0x%x, 0x%x):,
-	pm, va, pa, prot, flags));
+	pmap_enter(%p, %# _PRIxva , %# _PRIxpa , 0x%x, 0x%x):,
+	pm, va, pa, prot, flags);
 
 	/*
 	 * If this is a managed page, and it's the first reference to the
@@ -1919,7 +1919,7 @@ pmap_enter(pmap_t pm, vaddr_t va, paddr_
 	if (pg != NULL)
 		was_exec = pmap_attr_fetch(pg)  PTE_EXEC;
 
-	DPRINTFN(ENTER, ( was_exec=%d, was_exec));
+	DPRINTFN(ENTER,  was_exec=%d, was_exec);
 
 	/*
 	 * Assume the page is cache inhibited and access is guarded unless
@@ -1976,7 +1976,7 @@ pmap_enter(pmap_t pm, vaddr_t va, paddr_
 (flags  VM_PROT_EXECUTE) 
 (pte_lo  PTE_I) == 0 
 	was_exec == 0) {
-		DPRINTFN(ENTER, ( syncicache));
+		DPRINTFN(ENTER,  %s, syncicache);
 		PMAPCOUNT(exec_synced);
 		pmap_syncicache(pa, PAGE_SIZE);
 		if (pg != NULL) {
@@ -1993,7 +1993,7 @@ pmap_enter(pmap_t pm, vaddr_t va, paddr_
 		}
 	}
 
-	DPRINTFN(ENTER, (: error=%d\n, error));
+	DPRINTFN(ENTER, : error=%d\n, error);
 
 	PMAP_UNLOCK();
 
@@ -2007,14 +2007,14 @@ pmap_kenter_pa(vaddr_t va, paddr_t pa, v
 	register_t pte_lo;
 	int error;
 
-#if defined (PMAP_OEA64_BRIDGE)
+#if defined (PMAP_OEA64_BRIDGE) || defined (PMAP_OEA)
 	if (va  

CVS commit: src/sys/arch/powerpc/oea

2011-08-07 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Sun Aug  7 14:47:05 UTC 2011

Modified Files:
src/sys/arch/powerpc/oea: prep_machdep.c

Log Message:
Set BeBox Mainboard Registers space to BAT register.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/powerpc/oea/prep_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/prep_machdep.c
diff -u src/sys/arch/powerpc/oea/prep_machdep.c:1.7 src/sys/arch/powerpc/oea/prep_machdep.c:1.8
--- src/sys/arch/powerpc/oea/prep_machdep.c:1.7	Fri Jul  1 18:59:19 2011
+++ src/sys/arch/powerpc/oea/prep_machdep.c	Sun Aug  7 14:47:05 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: prep_machdep.c,v 1.7 2011/07/01 18:59:19 dyoung Exp $ */
+/* $NetBSD: prep_machdep.c,v 1.8 2011/08/07 14:47:05 kiyohara Exp $ */
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: prep_machdep.c,v 1.7 2011/07/01 18:59:19 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: prep_machdep.c,v 1.8 2011/08/07 14:47:05 kiyohara Exp $);
 
 #include opt_modular.h
 
@@ -147,7 +147,9 @@
 	oea_batinit(
 	PREP_BUS_SPACE_MEM, BAT_BL_256M,
 	PREP_BUS_SPACE_IO,  BAT_BL_256M,
-#ifdef prep
+#if defined(bebox)
+	0x7000, BAT_BL_128K,	/* BeBox Mainboard Registers (4KB) */
+#elif defined(prep)
 	0xbf80, BAT_BL_8M,
 #endif
 	0);



CVS commit: src/sys/arch/powerpc/oea

2011-08-04 Thread Frank Wille
Module Name:src
Committed By:   phx
Date:   Thu Aug  4 20:02:48 UTC 2011

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

Log Message:
Drop into ddb, when requested by ofwboot (-d option).


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 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/ofwoea_machdep.c
diff -u src/sys/arch/powerpc/oea/ofwoea_machdep.c:1.25 src/sys/arch/powerpc/oea/ofwoea_machdep.c:1.26
--- src/sys/arch/powerpc/oea/ofwoea_machdep.c:1.25	Wed Jul 27 22:04:23 2011
+++ src/sys/arch/powerpc/oea/ofwoea_machdep.c	Thu Aug  4 20:02:48 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: ofwoea_machdep.c,v 1.25 2011/07/27 22:04:23 macallan Exp $ */
+/* $NetBSD: ofwoea_machdep.c,v 1.26 2011/08/04 20:02:48 phx 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.25 2011/07/27 22:04:23 macallan Exp $);
+__KERNEL_RCSID(0, $NetBSD: ofwoea_machdep.c,v 1.26 2011/08/04 20:02:48 phx Exp $);
 
 #include opt_ppcarch.h
 #include opt_compat_netbsd.h
@@ -252,6 +252,11 @@
 
 	/* CPU clock stuff */
 	set_timebase();
+
+#ifdef DDB
+	if (boothowto  RB_KDB)
+		Debugger();
+#endif
 }
 
 void



CVS commit: src/sys/arch/powerpc/oea

2011-07-27 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Jul 27 22:04:23 UTC 2011

Modified Files:
src/sys/arch/powerpc/oea: ofw_subr.S ofwoea_machdep.c

Log Message:
move clearing PSL_IP in ofwmsr back where it was - if we do it too early my
PowerBook 3400c hangs on startup.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/powerpc/oea/ofw_subr.S
cvs rdiff -u -r1.24 -r1.25 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_subr.S
diff -u src/sys/arch/powerpc/oea/ofw_subr.S:1.9 src/sys/arch/powerpc/oea/ofw_subr.S:1.10
--- src/sys/arch/powerpc/oea/ofw_subr.S:1.9	Sun Jun 12 16:35:10 2011
+++ src/sys/arch/powerpc/oea/ofw_subr.S	Wed Jul 27 22:04:23 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: ofw_subr.S,v 1.9 2011/06/12 16:35:10 matt Exp $	*/
+/*	$NetBSD: ofw_subr.S,v 1.10 2011/07/27 22:04:23 macallan Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -34,6 +34,7 @@
 
 	.local	firmstk
 	.globl	openfirmware_entry
+	.globl	ofwmsr
 	.local	ofwsrsave
 	.local	OF_buffer
 
@@ -41,7 +42,7 @@
 	.lcomm	OF_buffer,NBPG,4
 	.comm	openfirmware_entry,4,4	/* openfirmware entry point */
 	.lcomm	ofwsrsave,64,4		/* openfirmware SR savearea */
-	.lcomm	ofwmsr,20,4		/* msr  sprg[0-3] used in OF */
+	.comm	ofwmsr,20,4		/* msr  sprg[0-3] used in OF */
 	.comm	ofwreal_incharge,4,4
 
 /*
@@ -67,8 +68,14 @@
 	stw	%r5,openfirmware_entry@l(%r8) /* save client interface handler*/
 
 	mfmsr	%r0
-	li	%r8,PSL_IP
-	andc	%r0,%r0,%r8			/* make sure PSL_IP is off */
+/*
+ * XXX
+ * doing this here instead of later on in ofwoea_initppc() after setting
+ * up the console and such makes my PowerBook 3400c hang.
+ * Probably just another OF 2.0 weirdness
+ */
+	/*li	%r8,PSL_IP*/
+	/*andc	%r0,%r0,%r8*/			/* make sure PSL_IP is off */
 	lis	%r9,ofwmsr@ha
 	stwu	%r0,ofwmsr@l(%r9)		/* save initial MSR value */
 

Index: src/sys/arch/powerpc/oea/ofwoea_machdep.c
diff -u src/sys/arch/powerpc/oea/ofwoea_machdep.c:1.24 src/sys/arch/powerpc/oea/ofwoea_machdep.c:1.25
--- src/sys/arch/powerpc/oea/ofwoea_machdep.c:1.24	Sun Jul 17 23:23:54 2011
+++ src/sys/arch/powerpc/oea/ofwoea_machdep.c	Wed Jul 27 22:04:23 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: ofwoea_machdep.c,v 1.24 2011/07/17 23:23:54 dyoung Exp $ */
+/* $NetBSD: ofwoea_machdep.c,v 1.25 2011/07/27 22:04:23 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.24 2011/07/17 23:23:54 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: ofwoea_machdep.c,v 1.25 2011/07/27 22:04:23 macallan Exp $);
 
 #include opt_ppcarch.h
 #include opt_compat_netbsd.h
@@ -119,6 +119,7 @@
 u_int timebase_freq = 0;
 #endif
 
+extern int ofwmsr;
 extern int chosen;
 extern uint32_t ticks_per_sec;
 extern uint32_t ns_per_tick;
@@ -201,6 +202,13 @@
 	if (ofmaplen  0)
 		save_ofmap(ofmap, ofmaplen);
 
+/*
+ * XXX
+ * we need to do this here instead of earlier on in ofwinit() for some reason
+ * At least some versions of Apple OF 2.0.1 hang if we do this earlier
+ */ 
+	ofwmsr = ~PSL_IP;
+
 	/* Parse the args string */
 	if (args) {
 		strcpy(bootpath, args);



CVS commit: src/sys/arch/powerpc/oea

2011-07-01 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat Jul  2 00:22:06 UTC 2011

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

Log Message:
Select pmap style before calling oea_init.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 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/ofwoea_machdep.c
diff -u src/sys/arch/powerpc/oea/ofwoea_machdep.c:1.22 src/sys/arch/powerpc/oea/ofwoea_machdep.c:1.23
--- src/sys/arch/powerpc/oea/ofwoea_machdep.c:1.22	Mon Jun 20 06:21:45 2011
+++ src/sys/arch/powerpc/oea/ofwoea_machdep.c	Sat Jul  2 00:22:06 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: ofwoea_machdep.c,v 1.22 2011/06/20 06:21:45 matt Exp $ */
+/* $NetBSD: ofwoea_machdep.c,v 1.23 2011/07/02 00:22:06 matt 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.22 2011/06/20 06:21:45 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: ofwoea_machdep.c,v 1.23 2011/07/02 00:22:06 matt Exp $);
 
 #include opt_ppcarch.h
 #include opt_compat_netbsd.h
@@ -189,6 +189,13 @@
 	}
 #endif
 
+#if defined (PPC_OEA64_BRIDGE)  defined (PPC_OEA)
+	if (oeacpufeat  OEACPU_64_BRIDGE)
+		pmap_setup64bridge();
+	else
+		pmap_setup32();
+#endif
+
 	oea_init(pic_ext_intr);
 
 	ofmaplen = save_ofmap(NULL, 0);
@@ -209,12 +216,6 @@
 
 	uvm_setpagesize();
 
-#if defined (PPC_OEA64_BRIDGE)  defined (PPC_OEA)
-	if (oeacpufeat  OEACPU_64_BRIDGE)
-		pmap_setup64bridge();
-	else
-		pmap_setup32();
-#endif
 	pmap_bootstrap(startkernel, endkernel);
 
 /* as far as I can tell, the pmap_setup_seg0 stuff is horribly broken */



CVS commit: src/sys/arch/powerpc/oea

2011-06-20 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Mon Jun 20 16:31:28 UTC 2011

Modified Files:
src/sys/arch/powerpc/oea: cpu_subr.c

Log Message:
Initialize sensor state before registering.


To generate a diff of this commit:
cvs rdiff -u -r1.67 -r1.68 src/sys/arch/powerpc/oea/cpu_subr.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/cpu_subr.c
diff -u src/sys/arch/powerpc/oea/cpu_subr.c:1.67 src/sys/arch/powerpc/oea/cpu_subr.c:1.68
--- src/sys/arch/powerpc/oea/cpu_subr.c:1.67	Mon Jun 20 06:21:45 2011
+++ src/sys/arch/powerpc/oea/cpu_subr.c	Mon Jun 20 16:31:28 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu_subr.c,v 1.67 2011/06/20 06:21:45 matt Exp $	*/
+/*	$NetBSD: cpu_subr.c,v 1.68 2011/06/20 16:31:28 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2001 Matt Thomas.
@@ -34,7 +34,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: cpu_subr.c,v 1.67 2011/06/20 06:21:45 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: cpu_subr.c,v 1.68 2011/06/20 16:31:28 pgoyette Exp $);
 
 #include opt_ppcparam.h
 #include opt_multiprocessor.h
@@ -1128,6 +1128,7 @@
 	sme = sysmon_envsys_create();
 
 	sensor.units = ENVSYS_STEMP;
+	sensor.state = ENVSYS_SINVALID;
 	(void)strlcpy(sensor.desc, CPU Temp, sizeof(sensor.desc));
 	if (sysmon_envsys_sensor_attach(sme, sensor)) {
 		sysmon_envsys_destroy(sme);



CVS commit: src/sys/arch/powerpc/oea

2011-06-18 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat Jun 18 20:34:39 UTC 2011

Modified Files:
src/sys/arch/powerpc/oea: oea_machdep.c

Log Message:
Call cpu_fixup_stubs at the end of oea_machdep


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/sys/arch/powerpc/oea/oea_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/oea_machdep.c
diff -u src/sys/arch/powerpc/oea/oea_machdep.c:1.56 src/sys/arch/powerpc/oea/oea_machdep.c:1.57
--- src/sys/arch/powerpc/oea/oea_machdep.c:1.56	Tue Jan 18 02:25:42 2011
+++ src/sys/arch/powerpc/oea/oea_machdep.c	Sat Jun 18 20:34:39 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: oea_machdep.c,v 1.56 2011/01/18 02:25:42 matt Exp $	*/
+/*	$NetBSD: oea_machdep.c,v 1.57 2011/06/18 20:34:39 matt Exp $	*/
 
 /*
  * Copyright (C) 2002 Matt Thomas
@@ -33,7 +33,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: oea_machdep.c,v 1.56 2011/01/18 02:25:42 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: oea_machdep.c,v 1.57 2011/06/18 20:34:39 matt Exp $);
 
 #include opt_ppcarch.h
 #include opt_compat_netbsd.h
@@ -421,6 +421,12 @@
 	: K(PSL_IR|PSL_DR|PSL_ME|PSL_RI));
 #endif
 
+	/*
+	 * Let's take all the indirect calls via our stubs and patch 
+	 * them to be direct calls.
+	 */
+	cpu_fixup_stubs();
+
 	KASSERT(curcpu() == ci);
 }
 



CVS commit: src/sys/arch/powerpc/oea

2011-06-17 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Jun 17 23:15:09 UTC 2011

Modified Files:
src/sys/arch/powerpc/oea: genassym.cf

Log Message:
Add IPL_HIGH and IPL_SCHED so locore.S can use them.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/powerpc/oea/genassym.cf

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/genassym.cf
diff -u src/sys/arch/powerpc/oea/genassym.cf:1.21 src/sys/arch/powerpc/oea/genassym.cf:1.22
--- src/sys/arch/powerpc/oea/genassym.cf:1.21	Thu Jun 16 04:38:21 2011
+++ src/sys/arch/powerpc/oea/genassym.cf	Fri Jun 17 23:15:09 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: genassym.cf,v 1.21 2011/06/16 04:38:21 matt Exp $
+#	$NetBSD: genassym.cf,v 1.22 2011/06/17 23:15:09 matt Exp $
 
 #
 # Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -51,6 +51,9 @@
 include powerpc/cpu.h
 include powerpc/oea/cpufeat.h
 
+define	IPL_HIGH	IPL_HIGH
+define	IPL_SCHED	IPL_SCHED
+
 define	FRAMELEN	FRAMELEN
 define	FRAME_TF	offsetof(struct ktrapframe, ktf_tf)
 define	FRAME_R0	offsetof(struct ktrapframe, ktf_tf.tf_fixreg[0])



CVS commit: src/sys/arch/powerpc/oea

2011-06-15 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Jun 16 04:25:13 UTC 2011

Modified Files:
src/sys/arch/powerpc/oea: cpu_subr.c

Log Message:
Make sure to set curlwp (aka r13) in cpu_hatch


To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.65 src/sys/arch/powerpc/oea/cpu_subr.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/cpu_subr.c
diff -u src/sys/arch/powerpc/oea/cpu_subr.c:1.64 src/sys/arch/powerpc/oea/cpu_subr.c:1.65
--- src/sys/arch/powerpc/oea/cpu_subr.c:1.64	Sun Jun 12 16:27:52 2011
+++ src/sys/arch/powerpc/oea/cpu_subr.c	Thu Jun 16 04:25:13 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu_subr.c,v 1.64 2011/06/12 16:27:52 matt Exp $	*/
+/*	$NetBSD: cpu_subr.c,v 1.65 2011/06/16 04:25:13 matt Exp $	*/
 
 /*-
  * Copyright (c) 2001 Matt Thomas.
@@ -34,7 +34,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: cpu_subr.c,v 1.64 2011/06/12 16:27:52 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: cpu_subr.c,v 1.65 2011/06/16 04:25:13 matt Exp $);
 
 #include opt_ppcparam.h
 #include opt_multiprocessor.h
@@ -1296,6 +1296,7 @@
 		mtspr(SPR_PIR, h-pir);
 	
 	__asm volatile (mtsprg0 %0 :: r(ci));
+	curlwp = ci-ci_curlwp;
 	cpu_spinstart_ack = 0;
 
 	/* Initialize MMU. */



CVS commit: src/sys/arch/powerpc/oea

2011-06-15 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Jun 16 04:38:21 UTC 2011

Modified Files:
src/sys/arch/powerpc/oea: genassym.cf

Log Message:
ifdef / define / endif can't be the first thing.  So move that block down.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/powerpc/oea/genassym.cf

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/genassym.cf
diff -u src/sys/arch/powerpc/oea/genassym.cf:1.20 src/sys/arch/powerpc/oea/genassym.cf:1.21
--- src/sys/arch/powerpc/oea/genassym.cf:1.20	Thu Jun 16 03:54:40 2011
+++ src/sys/arch/powerpc/oea/genassym.cf	Thu Jun 16 04:38:21 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: genassym.cf,v 1.20 2011/06/16 03:54:40 matt Exp $
+#	$NetBSD: genassym.cf,v 1.21 2011/06/16 04:38:21 matt Exp $
 
 #
 # Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -51,10 +51,6 @@
 include powerpc/cpu.h
 include powerpc/oea/cpufeat.h
 
-ifdef	__HAVE_FAST_SOFTINTS
-define	__HAVE_FAST_SOFTINTS	__HAVE_FAST_SOFTINTS
-endif
-
 define	FRAMELEN	FRAMELEN
 define	FRAME_TF	offsetof(struct ktrapframe, ktf_tf)
 define	FRAME_R0	offsetof(struct ktrapframe, ktf_tf.tf_fixreg[0])
@@ -216,6 +212,10 @@
 define	VREG_VRSAVE	offsetof(struct vreg, vrsave)
 define	VREG_VSCR	offsetof(struct vreg, vscr)
 
+ifdef	__HAVE_FAST_SOFTINTS
+define	__HAVE_FAST_SOFTINTS	__HAVE_FAST_SOFTINTS
+endif
+
 define	L_PCB		offsetof(struct lwp, l_addr)
 define	L_CPU		offsetof(struct lwp, l_cpu)
 define	L_MD_ASTPENDING	offsetof(struct lwp, l_md.md_astpending)



CVS commit: src/sys/arch/powerpc/oea

2011-06-12 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sun Jun 12 16:27:52 UTC 2011

Modified Files:
src/sys/arch/powerpc/oea: cpu_subr.c

Log Message:
Use mtsprg0 instead of mtsprg 0,r


To generate a diff of this commit:
cvs rdiff -u -r1.63 -r1.64 src/sys/arch/powerpc/oea/cpu_subr.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/cpu_subr.c
diff -u src/sys/arch/powerpc/oea/cpu_subr.c:1.63 src/sys/arch/powerpc/oea/cpu_subr.c:1.64
--- src/sys/arch/powerpc/oea/cpu_subr.c:1.63	Sun Jun  5 16:52:25 2011
+++ src/sys/arch/powerpc/oea/cpu_subr.c	Sun Jun 12 16:27:52 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu_subr.c,v 1.63 2011/06/05 16:52:25 matt Exp $	*/
+/*	$NetBSD: cpu_subr.c,v 1.64 2011/06/12 16:27:52 matt Exp $	*/
 
 /*-
  * Copyright (c) 2001 Matt Thomas.
@@ -34,7 +34,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: cpu_subr.c,v 1.63 2011/06/05 16:52:25 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: cpu_subr.c,v 1.64 2011/06/12 16:27:52 matt Exp $);
 
 #include opt_ppcparam.h
 #include opt_multiprocessor.h
@@ -1295,7 +1295,7 @@
 	if (msr != h-pir)
 		mtspr(SPR_PIR, h-pir);
 	
-	__asm volatile (mtsprg 0,%0 :: r(ci));
+	__asm volatile (mtsprg0 %0 :: r(ci));
 	cpu_spinstart_ack = 0;
 
 	/* Initialize MMU. */



CVS commit: src/sys/arch/powerpc/oea

2011-06-12 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sun Jun 12 16:35:10 UTC 2011

Modified Files:
src/sys/arch/powerpc/oea: ofw_subr.S ofwoea_machdep.c

Log Message:
Save/restore all sprgs when calling OFW.
Move all-zero variables from .data to .bss
Use .lcomm for local variables.
Cleanup a bit of assembly.
Clear PSL_IP in the saved ofmsr (was previously done in ofwoea_machdep.c)


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/powerpc/oea/ofw_subr.S
cvs rdiff -u -r1.20 -r1.21 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_subr.S
diff -u src/sys/arch/powerpc/oea/ofw_subr.S:1.8 src/sys/arch/powerpc/oea/ofw_subr.S:1.9
--- src/sys/arch/powerpc/oea/ofw_subr.S:1.8	Tue Apr  8 02:33:03 2008
+++ src/sys/arch/powerpc/oea/ofw_subr.S	Sun Jun 12 16:35:10 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: ofw_subr.S,v 1.8 2008/04/08 02:33:03 garbled Exp $	*/
+/*	$NetBSD: ofw_subr.S,v 1.9 2011/06/12 16:35:10 matt Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -37,20 +37,12 @@
 	.local	ofwsrsave
 	.local	OF_buffer
 
-	.data
-GLOBAL(ofmsr)
-	.long	0,0,0,0,0		/* msr  sprg[0-3] used in OF */
-
-GLOBAL(ofwsprg0save)
-	.long	0
-
-GLOBAL(ofwreal_incharge)
-	.long	0
-
-	.comm	firmstk,NBPG,8
-	.comm	OF_buffer,NBPG,4
+	.lcomm	firmstk,NBPG,16
+	.lcomm	OF_buffer,NBPG,4
 	.comm	openfirmware_entry,4,4	/* openfirmware entry point */
-	.comm	ofwsrsave,64,4		/* openfirmware SR savearea */
+	.lcomm	ofwsrsave,64,4		/* openfirmware SR savearea */
+	.lcomm	ofwmsr,20,4		/* msr  sprg[0-3] used in OF */
+	.comm	ofwreal_incharge,4,4
 
 /*
  * Called by start to save the initial OFW state so we can restore it
@@ -64,7 +56,7 @@
 
 	li	%r8,1
 	lis	%r9,ofwreal_incharge@ha
-	stw	%r8,ofwreal_incharge@l(9)
+	stw	%r8,ofwreal_incharge@l(%r9)
 
 	mflr	%r30
 	bl	_C_LABEL(ofwr_init)
@@ -75,17 +67,19 @@
 	stw	%r5,openfirmware_entry@l(%r8) /* save client interface handler*/
 
 	mfmsr	%r0
-	lis	%r9,ofmsr@ha
-	stwu	%r0,ofmsr@l(%r9)		/* save initial MSR value */
-
-mfsprg  %r0,0			/* save SPRGs */
-   	stwu	%r0,4(%r9)
-mfsprg  %r0,1
-   	stwu	%r0,4(%r9)
-mfsprg  %r0,2
-   	stwu	%r0,4(%r9)
-mfsprg  %r0,3
-   	stw	%r0,4(%r9)
+	li	%r8,PSL_IP
+	andc	%r0,%r0,%r8			/* make sure PSL_IP is off */
+	lis	%r9,ofwmsr@ha
+	stwu	%r0,ofwmsr@l(%r9)		/* save initial MSR value */
+
+	mfsprg0	%r0/* save SPRGs */
+	stw	%r0,4(%r9)
+	mfsprg1	%r0
+	stw	%r0,8(%r9)
+	mfsprg2	%r0
+	stw	%r0,12(%r9)
+	mfsprg3	%r0
+	stw	%r0,16(%r9)
 
 	lis	%r8,OF_buffer@ha
 	addi	%r8,%r8,OF_buffer@l
@@ -101,16 +95,20 @@
 ENTRY(openfirmware)
 	mflr	%r0			/* save return address */
 	stw	%r0,4(%r1)
-	stwu	%r1,-16(%r1)		/* setup stack frame */
+	stwu	%r1,-32(%r1)		/* setup stack frame */
 
 	lis	%r4,openfirmware_entry@ha	/* get firmware entry point */
 	lwz	%r4,openfirmware_entry@l(%r4)
 	mtlr	%r4
 
-	mfsprg	%r5,0			/* save current sprg0 (curcpu) */
-	lis	%r4,ofwsprg0save@ha
-	addi	%r4,%r4,ofwsprg0save@l
-	stw	%r5,0(%r4)
+	mfsprg0	%r5			/* save current sprg0 (curcpu) */
+	stw	%r5,16(%r1)
+	mfsprg1	%r5			/* save current sprg1 */
+	stw	%r5,20(%r1)
+	mfsprg2	%r5			/* save current sprg1 */
+	stw	%r5,24(%r1)
+	mfsprg3	%r5			/* save current sprg3 */
+	stw	%r5,28(%r1)
 
 #ifdef FIRMWORKSBUGS
 	lis	%r4,ofwreal_incharge@ha
@@ -156,16 +154,16 @@
 	cmpwi	%r5,0
 	bne	1b
 2:
-	lis	%r4,ofmsr@ha		/* Open Firmware msr + sprg[0-3] */
-	lwzu	%r5,ofmsr+16@l(%r4)
-	mtsprg	3,%r5
-	lwzu	%r5,-4(%r4)
-	mtsprg	2,%r5
-	lwzu	%r5,-4(%r4)
-	mtsprg	1,%r5
-	lwzu	%r5,-4(%r4)
-	mtsprg	0,%r5
+	lis	%r4,ofwmsr+16@ha	/* Open Firmware msr + sprg[0-3] */
+	lwzu	%r5,ofwmsr+16@l(%r4)
+	mtsprg3	%r5
 	lwz	%r5,-4(%r4)
+	mtsprg2	%r5
+	lwz	%r5,-8(%r4)
+	mtsprg1	%r5
+	lwz	%r5,-12(%r4)
+	mtsprg0	%r5
+	lwz	%r5,-16(%r4)
 	mtmsr	%r5
 	isync
 
@@ -185,10 +183,14 @@
 	mtmsr	%r4
 	isync
 4:	
-	lis	%r4,ofwsprg0save@ha	/* restore saved sprg0 (curcpu) */
-	addi	%r4,%r4,ofwsprg0save@l
-	lwz	%r5,0(%r4)
-	mtsprg	0,%r5
+	lwz	%r5,16(%r1)		/* restore saved sprgs (curcpu) */
+	mtsprg0	%r5
+	lwz	%r5,20(%r1)
+	mtsprg1	%r5
+	lwz	%r5,24(%r1)
+	mtsprg2	%r5
+	lwz	%r5,28(%r1)
+	mtsprg3	%r5
 
 	lwz	%r1,0(%r1)		/* and return */
 	lwz	%r0,4(%r1)

Index: src/sys/arch/powerpc/oea/ofwoea_machdep.c
diff -u src/sys/arch/powerpc/oea/ofwoea_machdep.c:1.20 src/sys/arch/powerpc/oea/ofwoea_machdep.c:1.21
--- src/sys/arch/powerpc/oea/ofwoea_machdep.c:1.20	Sun Mar 14 10:03:49 2010
+++ src/sys/arch/powerpc/oea/ofwoea_machdep.c	Sun Jun 12 16:35:10 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: ofwoea_machdep.c,v 1.20 2010/03/14 10:03:49 kiyohara Exp $ */
+/* $NetBSD: ofwoea_machdep.c,v 1.21 2011/06/12 16:35:10 matt 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.20 2010/03/14 10:03:49 kiyohara Exp $);
+__KERNEL_RCSID(0, $NetBSD: 

CVS commit: src/sys/arch/powerpc/oea

2011-05-24 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed May 25 05:42:37 UTC 2011

Modified Files:
src/sys/arch/powerpc/oea: altivec.c

Log Message:
Set PSL_VEC in the right place.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/powerpc/oea/altivec.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/altivec.c
diff -u src/sys/arch/powerpc/oea/altivec.c:1.23 src/sys/arch/powerpc/oea/altivec.c:1.24
--- src/sys/arch/powerpc/oea/altivec.c:1.23	Mon May  2 06:43:16 2011
+++ src/sys/arch/powerpc/oea/altivec.c	Wed May 25 05:42:37 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: altivec.c,v 1.23 2011/05/02 06:43:16 matt Exp $	*/
+/*	$NetBSD: altivec.c,v 1.24 2011/05/25 05:42:37 matt Exp $	*/
 
 /*
  * Copyright (C) 1996 Wolfgang Solfrank.
@@ -32,7 +32,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: altivec.c,v 1.23 2011/05/02 06:43:16 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: altivec.c,v 1.24 2011/05/25 05:42:37 matt Exp $);
 
 #include opt_multiprocessor.h
 
@@ -104,7 +104,7 @@
 	/*
 	 * Mark vector registers as modified.
 	 */
-	l-l_md.md_flags |= MDLWP_USEDVEC;
+	l-l_md.md_flags |= MDLWP_USEDVEC|PSL_VEC;
 	l-l_md.md_utf-tf_srr1 |= PSL_VEC;
 }
 



CVS commit: src/sys/arch/powerpc/oea

2011-05-01 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon May  2 01:49:23 UTC 2011

Modified Files:
src/sys/arch/powerpc/oea: pmap.c

Log Message:
A little PMAP_OEA64 pmap support.


To generate a diff of this commit:
cvs rdiff -u -r1.78 -r1.79 src/sys/arch/powerpc/oea/pmap.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/pmap.c
diff -u src/sys/arch/powerpc/oea/pmap.c:1.78 src/sys/arch/powerpc/oea/pmap.c:1.79
--- src/sys/arch/powerpc/oea/pmap.c:1.78	Fri Feb 18 16:40:50 2011
+++ src/sys/arch/powerpc/oea/pmap.c	Mon May  2 01:49:23 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.78 2011/02/18 16:40:50 matt Exp $	*/
+/*	$NetBSD: pmap.c,v 1.79 2011/05/02 01:49:23 matt Exp $	*/
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -63,7 +63,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.78 2011/02/18 16:40:50 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.79 2011/05/02 01:49:23 matt Exp $);
 
 #define	PMAP_NOOPNAMES
 
@@ -745,12 +745,10 @@
 	pt-pte_hi = (va_to_vsid(pm, va)  PTE_VSID_SHFT)
 	| (((va  ADDR_PIDX)  (ADDR_API_SHFT - PTE_API_SHFT))  PTE_API);
 	pt-pte_lo = pte_lo;
-#elif defined (PMAP_OEA64_BRIDGE)
+#elif defined (PMAP_OEA64_BRIDGE) || defined (PMAP_OEA64)
 	pt-pte_hi = ((u_int64_t)va_to_vsid(pm, va)  PTE_VSID_SHFT)
 	| (((va  ADDR_PIDX)  (ADDR_API_SHFT - PTE_API_SHFT))  PTE_API);
 	pt-pte_lo = (u_int64_t) pte_lo;
-#elif defined (PMAP_OEA64)
-#error PMAP_OEA64 not supported
 #endif /* PMAP_OEA */
 }
 



CVS commit: src/sys/arch/powerpc/oea

2011-02-27 Thread Robert Swindells
Module Name:src
Committed By:   rjs
Date:   Sun Feb 27 09:01:57 UTC 2011

Modified Files:
src/sys/arch/powerpc/oea: pmap_kernel.c

Log Message:
Missing semicolon.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/powerpc/oea/pmap_kernel.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/pmap_kernel.c
diff -u src/sys/arch/powerpc/oea/pmap_kernel.c:1.6 src/sys/arch/powerpc/oea/pmap_kernel.c:1.7
--- src/sys/arch/powerpc/oea/pmap_kernel.c:1.6	Sat Feb 26 22:33:45 2011
+++ src/sys/arch/powerpc/oea/pmap_kernel.c	Sun Feb 27 09:01:56 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap_kernel.c,v 1.6 2011/02/26 22:33:45 matt Exp $	*/
+/*	$NetBSD: pmap_kernel.c,v 1.7 2011/02/27 09:01:56 rjs Exp $	*/
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -30,7 +30,7 @@
 
 #include sys/cdefs.h
 
-__KERNEL_RCSID(1, $NetBSD: pmap_kernel.c,v 1.6 2011/02/26 22:33:45 matt Exp $);
+__KERNEL_RCSID(1, $NetBSD: pmap_kernel.c,v 1.7 2011/02/27 09:01:56 rjs Exp $);
 
 #include opt_ddb.h
 #include opt_pmap.h
@@ -286,7 +286,7 @@
 void
 pmap_pvo_verify(void)
 {
-	(*pmapops-pmapop_pvo_verify)()
+	(*pmapops-pmapop_pvo_verify)();
 }
 #endif
 



CVS commit: src/sys/arch/powerpc/oea

2011-02-18 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Feb 18 16:40:51 UTC 2011

Modified Files:
src/sys/arch/powerpc/oea: pmap.c pmap_kernel.c

Log Message:
Move powerpc_mmap_flags since pmap.c can get compiled multiple time resulting
in multiple defintions of powerpc_mmap_flags.


To generate a diff of this commit:
cvs rdiff -u -r1.77 -r1.78 src/sys/arch/powerpc/oea/pmap.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/powerpc/oea/pmap_kernel.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/pmap.c
diff -u src/sys/arch/powerpc/oea/pmap.c:1.77 src/sys/arch/powerpc/oea/pmap.c:1.78
--- src/sys/arch/powerpc/oea/pmap.c:1.77	Tue Feb 15 19:39:12 2011
+++ src/sys/arch/powerpc/oea/pmap.c	Fri Feb 18 16:40:50 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.77 2011/02/15 19:39:12 macallan Exp $	*/
+/*	$NetBSD: pmap.c,v 1.78 2011/02/18 16:40:50 matt Exp $	*/
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -63,7 +63,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.77 2011/02/15 19:39:12 macallan Exp $);
+__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.78 2011/02/18 16:40:50 matt Exp $);
 
 #define	PMAP_NOOPNAMES
 
@@ -3520,16 +3520,3 @@
 	}
 #endif
 }
-
-u_int
-powerpc_mmap_flags(paddr_t pa)
-{
-	u_int flags = PMAP_MD_NOCACHE;
-
-	if (pa  POWERPC_MMAP_FLAG_PREFETCHABLE)
-		flags |= PMAP_MD_PREFETCHABLE;
-	if (pa  POWERPC_MMAP_FLAG_CACHEABLE)
-		flags = ~PMAP_MD_NOCACHE;
-	return flags;
-}
-

Index: src/sys/arch/powerpc/oea/pmap_kernel.c
diff -u src/sys/arch/powerpc/oea/pmap_kernel.c:1.3 src/sys/arch/powerpc/oea/pmap_kernel.c:1.4
--- src/sys/arch/powerpc/oea/pmap_kernel.c:1.3	Sat Feb 12 18:23:10 2011
+++ src/sys/arch/powerpc/oea/pmap_kernel.c	Fri Feb 18 16:40:50 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap_kernel.c,v 1.3 2011/02/12 18:23:10 matt Exp $	*/
+/*	$NetBSD: pmap_kernel.c,v 1.4 2011/02/18 16:40:50 matt Exp $	*/
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -30,7 +30,7 @@
 
 #include sys/cdefs.h
 
-__KERNEL_RCSID(1, $NetBSD: pmap_kernel.c,v 1.3 2011/02/12 18:23:10 matt Exp $);
+__KERNEL_RCSID(1, $NetBSD: pmap_kernel.c,v 1.4 2011/02/18 16:40:50 matt Exp $);
 
 #include opt_ddb.h
 #include opt_pmap.h
@@ -41,6 +41,18 @@
 extern struct pmap kernel_pmap_;
 struct pmap *const kernel_pmap_ptr = kernel_pmap_;
 
+u_int
+powerpc_mmap_flags(paddr_t pa)
+{
+	u_int flags = PMAP_MD_NOCACHE;
+
+	if (pa  POWERPC_MMAP_FLAG_PREFETCHABLE)
+		flags |= PMAP_MD_PREFETCHABLE;
+	if (pa  POWERPC_MMAP_FLAG_CACHEABLE)
+		flags = ~PMAP_MD_NOCACHE;
+	return flags;
+}
+
 #ifdef PMAP_NEEDS_FIXUP
 #include powerpc/instr.h
 



CVS commit: src/sys/arch/powerpc/oea

2011-02-11 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat Feb 12 01:02:12 UTC 2011

Modified Files:
src/sys/arch/powerpc/oea: cpu_subr.c

Log Message:
Add support for the IBM750GX (from Bob Lee).


To generate a diff of this commit:
cvs rdiff -u -r1.61 -r1.62 src/sys/arch/powerpc/oea/cpu_subr.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/cpu_subr.c
diff -u src/sys/arch/powerpc/oea/cpu_subr.c:1.61 src/sys/arch/powerpc/oea/cpu_subr.c:1.62
--- src/sys/arch/powerpc/oea/cpu_subr.c:1.61	Tue Jan 18 02:25:42 2011
+++ src/sys/arch/powerpc/oea/cpu_subr.c	Sat Feb 12 01:02:12 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu_subr.c,v 1.61 2011/01/18 02:25:42 matt Exp $	*/
+/*	$NetBSD: cpu_subr.c,v 1.62 2011/02/12 01:02:12 matt Exp $	*/
 
 /*-
  * Copyright (c) 2001 Matt Thomas.
@@ -34,7 +34,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: cpu_subr.c,v 1.61 2011/01/18 02:25:42 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: cpu_subr.c,v 1.62 2011/02/12 01:02:12 matt Exp $);
 
 #include opt_ppcparam.h
 #include opt_multiprocessor.h
@@ -211,6 +211,7 @@
 	{ 620,	MPC620,  	REVFMT_HEX },
 	{ 750,	MPC750,		REVFMT_MAJMIN },
 	{ 750FX,	IBM750FX,	REVFMT_MAJMIN },
+	{ 750GX,	IBM750GX,	REVFMT_MAJMIN },
 	{ 7400,	MPC7400,	REVFMT_MAJMIN },
 	{ 7410,	MPC7410,	REVFMT_MAJMIN },
 	{ 7450,	MPC7450,	REVFMT_MAJMIN },
@@ -277,6 +278,9 @@
 
 	else if (MPC745X_P(vers)  vers != MPC7450)
 		oeacpufeat |= OEACPU_XBSEN | OEACPU_HIGHBAT | OEACPU_HIGHSPRG;
+
+	else if (vers == IBM750FX || vers == IBM750GX)
+		oeacpufeat |= OEACPU_HIGHBAT;
 }
 
 void
@@ -324,6 +328,7 @@
 	switch (vers) {
 #define	K	*1024
 	case IBM750FX:
+	case IBM750GX:
 	case MPC601:
 	case MPC750:
 	case MPC7400:
@@ -501,6 +506,7 @@
 
 	case MPC750:
 	case IBM750FX:
+	case IBM750GX:
 		/* Select NAP mode. */
 		hid0 = ~(HID0_DOZE | HID0_NAP | HID0_SLEEP);
 		hid0 |= HID0_NAP | HID0_DPM;
@@ -540,6 +546,7 @@
 #ifdef NAPMODE
 	switch (vers) {
 	case IBM750FX:
+	case IBM750GX:
 	case MPC750:
 	case MPC7400:
 		/* Select NAP mode. */
@@ -551,6 +558,7 @@
 
 	switch (vers) {
 	case IBM750FX:
+	case IBM750GX:
 	case MPC750:
 		hid0 = ~HID0_DBP;		/* XXX correct? */
 		hid0 |= HID0_EMCP | HID0_BTIC | HID0_SGE | HID0_BHT;
@@ -603,6 +611,7 @@
 	case MPC604ev:
 	case MPC750:
 	case IBM750FX:
+	case IBM750GX:
 	case MPC7400:
 	case MPC7410:
 	case MPC7447A:
@@ -621,6 +630,7 @@
 			cpu_config_l3cr(vers);
 			break;
 		case IBM750FX:
+		case IBM750GX:
 		case MPC750:
 		case MPC7400:
 		case MPC7410:
@@ -642,7 +652,7 @@
 	 * XXX supported by Motorola and may return values that are off by 
 	 * XXX 35-55 degrees C.
 	 */
-	if (vers == MPC750 || vers == IBM750FX)
+	if (vers == MPC750 || vers == IBM750FX || vers == IBM750GX)
 		cpu_tau_setup(ci);
 #endif
 
@@ -902,6 +912,7 @@
 
 	switch (vers) {
 	case IBM750FX:
+	case IBM750GX:
 		cpu_fmttab_print(cpu_ibm750_l2cr_formats, l2cr);
 		break;
 	case MPC750:



CVS commit: src/sys/arch/powerpc/oea

2010-11-13 Thread Masao Uebayashi
Module Name:src
Committed By:   uebayasi
Date:   Sun Nov 14 03:32:44 UTC 2010

Modified Files:
src/sys/arch/powerpc/oea: ofw_consinit.c

Log Message:
prop/proplib.h is indirectly used here, include it.

XXX What is the conclusion about direct vs. indirect #include from headers?


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/powerpc/oea/ofw_consinit.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_consinit.c
diff -u src/sys/arch/powerpc/oea/ofw_consinit.c:1.10 src/sys/arch/powerpc/oea/ofw_consinit.c:1.11
--- src/sys/arch/powerpc/oea/ofw_consinit.c:1.10	Sun Mar 14 10:03:49 2010
+++ src/sys/arch/powerpc/oea/ofw_consinit.c	Sun Nov 14 03:32:44 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: ofw_consinit.c,v 1.10 2010/03/14 10:03:49 kiyohara Exp $ */
+/* $NetBSD: ofw_consinit.c,v 1.11 2010/11/14 03:32:44 uebayasi Exp $ */
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -30,12 +30,14 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ofw_consinit.c,v 1.10 2010/03/14 10:03:49 kiyohara Exp $);
+__KERNEL_RCSID(0, $NetBSD: ofw_consinit.c,v 1.11 2010/11/14 03:32:44 uebayasi Exp $);
 
 #include sys/param.h
 #include sys/buf.h
 #include sys/tty.h
 
+#include prop/proplib.h
+
 #include machine/autoconf.h
 #include machine/trap.h
 #include machine/bus.h



CVS commit: src/sys/arch/powerpc/oea

2010-11-05 Thread Frank Wille
Module Name:src
Committed By:   phx
Date:   Fri Nov  5 08:34:36 UTC 2010

Modified Files:
src/sys/arch/powerpc/oea: cpu_subr.c

Log Message:
Only read from HID1 when a G3 CPU was detected in cpu_get_dfs(), otherwise
the access might cause a PGM trap.


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.58 src/sys/arch/powerpc/oea/cpu_subr.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/cpu_subr.c
diff -u src/sys/arch/powerpc/oea/cpu_subr.c:1.57 src/sys/arch/powerpc/oea/cpu_subr.c:1.58
--- src/sys/arch/powerpc/oea/cpu_subr.c:1.57	Thu Oct 28 13:58:03 2010
+++ src/sys/arch/powerpc/oea/cpu_subr.c	Fri Nov  5 08:34:35 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu_subr.c,v 1.57 2010/10/28 13:58:03 macallan Exp $	*/
+/*	$NetBSD: cpu_subr.c,v 1.58 2010/11/05 08:34:35 phx Exp $	*/
 
 /*-
  * Copyright (c) 2001 Matt Thomas.
@@ -34,7 +34,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: cpu_subr.c,v 1.57 2010/10/28 13:58:03 macallan Exp $);
+__KERNEL_RCSID(0, $NetBSD: cpu_subr.c,v 1.58 2010/11/05 08:34:35 phx Exp $);
 
 #include opt_ppcparam.h
 #include opt_multiprocessor.h
@@ -1002,18 +1002,17 @@
 int
 cpu_get_dfs(void)
 {
-	u_int hid1, pvr, vers;
+	u_int pvr, vers;
 
 	pvr = mfpvr();
 	vers = pvr  16;
-	hid1 = mfspr(SPR_HID1);
 
 	switch (vers) {
 	case MPC7448:
-		if (hid1  HID1_DFS4)
+		if (mfspr(SPR_HID1)  HID1_DFS4)
 			return 4;
 	case MPC7447A:
-		if (hid1  HID1_DFS2)
+		if (mfspr(SPR_HID1)  HID1_DFS2)
 			return 2;
 	}
 	return 1;



CVS commit: src/sys/arch/powerpc/oea

2010-10-28 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Oct 28 13:58:04 UTC 2010

Modified Files:
src/sys/arch/powerpc/oea: cpu_subr.c

Log Message:
Use nap mode on 750-ish CPUs


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/sys/arch/powerpc/oea/cpu_subr.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/cpu_subr.c
diff -u src/sys/arch/powerpc/oea/cpu_subr.c:1.56 src/sys/arch/powerpc/oea/cpu_subr.c:1.57
--- src/sys/arch/powerpc/oea/cpu_subr.c:1.56	Wed Oct 20 18:52:33 2010
+++ src/sys/arch/powerpc/oea/cpu_subr.c	Thu Oct 28 13:58:03 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu_subr.c,v 1.56 2010/10/20 18:52:33 phx Exp $	*/
+/*	$NetBSD: cpu_subr.c,v 1.57 2010/10/28 13:58:03 macallan Exp $	*/
 
 /*-
  * Copyright (c) 2001 Matt Thomas.
@@ -34,7 +34,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: cpu_subr.c,v 1.56 2010/10/20 18:52:33 phx Exp $);
+__KERNEL_RCSID(0, $NetBSD: cpu_subr.c,v 1.57 2010/10/28 13:58:03 macallan Exp $);
 
 #include opt_ppcparam.h
 #include opt_multiprocessor.h
@@ -475,8 +475,6 @@
 	case MPC603:
 	case MPC603e:
 	case MPC603ev:
-	case MPC750:
-	case IBM750FX:
 	case MPC7400:
 	case MPC7410:
 	case MPC8240:
@@ -488,6 +486,14 @@
 		powersave = 1;
 		break;
 
+	case MPC750:
+	case IBM750FX:
+		/* Select NAP mode. */
+		hid0 = ~(HID0_DOZE | HID0_NAP | HID0_SLEEP);
+		hid0 |= HID0_NAP | HID0_DPM;
+		powersave = 1;
+		break;
+
 	case MPC7447A:
 	case MPC7448:
 	case MPC7457:



CVS commit: src/sys/arch/powerpc/oea

2010-03-14 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Sun Mar 14 10:03:49 UTC 2010

Modified Files:
src/sys/arch/powerpc/oea: ofw_consinit.c ofwoea_machdep.c

Log Message:
Fix isa(4) support for ofw.
  ofw not initialized bus_space for isa(4).
  It tested on ofppc(PegasosII).


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/powerpc/oea/ofw_consinit.c
cvs rdiff -u -r1.19 -r1.20 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_consinit.c
diff -u src/sys/arch/powerpc/oea/ofw_consinit.c:1.9 src/sys/arch/powerpc/oea/ofw_consinit.c:1.10
--- src/sys/arch/powerpc/oea/ofw_consinit.c:1.9	Wed Mar 10 18:36:05 2010
+++ src/sys/arch/powerpc/oea/ofw_consinit.c	Sun Mar 14 10:03:49 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: ofw_consinit.c,v 1.9 2010/03/10 18:36:05 kiyohara Exp $ */
+/* $NetBSD: ofw_consinit.c,v 1.10 2010/03/14 10:03:49 kiyohara Exp $ */
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ofw_consinit.c,v 1.9 2010/03/10 18:36:05 kiyohara Exp $);
+__KERNEL_RCSID(0, $NetBSD: ofw_consinit.c,v 1.10 2010/03/14 10:03:49 kiyohara Exp $);
 
 #include sys/param.h
 #include sys/buf.h
@@ -219,9 +219,9 @@
 		return;
 	}
 
-#if NAKBD  0
 	memset(name, 0, sizeof(name));
 	OF_getprop(OF_parent(node), name, name, sizeof(name));
+#if NAKBD  0
 	if (strcmp(name, adb) == 0) {
 		printf(console keyboard type: ADB\n);
 		akbd_cnattach();
@@ -229,8 +229,6 @@
 	}
 #endif
 #if NADBKBD  0
-	memset(name, 0, sizeof(name));
-	OF_getprop(OF_parent(node), name, name, sizeof(name));
 	if (strcmp(name, adb) == 0) {
 		printf(console keyboard type: ADB\n);
 		adbkbd_cnattach();
@@ -238,9 +236,7 @@
 	}
 #endif
 #if NPCKBC  0
-	memset(name, 0, sizeof(name));
-	OF_getprop(OF_parent(node), name, name, sizeof(name));
-	if (strcmp(name, keyboard) == 0) {
+	if (strcmp(name, isa) == 0) {
 		printf(console keyboard type: PC Keyboard\n);
 		pckbc_cnattach(genppc_isa_io_space_tag, IO_KBD, KBCMDP,
 		PCKBC_KBD_SLOT);

Index: src/sys/arch/powerpc/oea/ofwoea_machdep.c
diff -u src/sys/arch/powerpc/oea/ofwoea_machdep.c:1.19 src/sys/arch/powerpc/oea/ofwoea_machdep.c:1.20
--- src/sys/arch/powerpc/oea/ofwoea_machdep.c:1.19	Wed Mar 10 18:36:05 2010
+++ src/sys/arch/powerpc/oea/ofwoea_machdep.c	Sun Mar 14 10:03:49 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: ofwoea_machdep.c,v 1.19 2010/03/10 18:36:05 kiyohara Exp $ */
+/* $NetBSD: ofwoea_machdep.c,v 1.20 2010/03/14 10:03:49 kiyohara 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.19 2010/03/10 18:36:05 kiyohara Exp $);
+__KERNEL_RCSID(0, $NetBSD: ofwoea_machdep.c,v 1.20 2010/03/14 10:03:49 kiyohara Exp $);
 
 #include opt_ppcarch.h
 #include opt_compat_netbsd.h
@@ -167,6 +167,8 @@
 			sizeof(model_name));
 		model_init();
 	}
+	/* Initialize bus_space */
+	ofwoea_bus_space_init();
 
 	ofwoea_consinit();
 
@@ -583,6 +585,10 @@
 		 */
 		if (range == -1) {
 			/* we found a rangeless isa bus */
+			if (iomem == RANGE_IO)
+size = 0x1;
+			else
+size = 0x100;
 		}
 		DPRINTF(found isa stuff\n);
 		for (i=0; i  range; i++)
@@ -595,7 +601,10 @@
 	DPRINTF(found IO\n);
 	tag-pbs_offset = list[i].addr;
 	tag-pbs_limit = size;
-	error = bus_space_init(tag, name, NULL, 0);
+	error = bus_space_init(tag, name,
+	ex_storage[exmap],
+	sizeof(ex_storage[exmap]));
+	exmap++;
 	return error;
 }
 		} else {
@@ -605,7 +614,10 @@
 	DPRINTF(found mem\n);
 	tag-pbs_offset = list[i].addr;
 	tag-pbs_limit = size;
-	error = bus_space_init(tag, name, NULL, 0);
+	error = bus_space_init(tag, name,
+	ex_storage[exmap],
+	sizeof(ex_storage[exmap]));
+	exmap++;
 	return error;
 }
 		}



CVS commit: src/sys/arch/powerpc/oea

2010-01-20 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Jan 20 16:36:55 UTC 2010

Modified Files:
src/sys/arch/powerpc/oea: ofw_autoconf.c

Log Message:
pass some OF properties as device properties for network devices
namely local-mac-address and shared-pins needed by gem


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/powerpc/oea/ofw_autoconf.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_autoconf.c
diff -u src/sys/arch/powerpc/oea/ofw_autoconf.c:1.10 src/sys/arch/powerpc/oea/ofw_autoconf.c:1.11
--- src/sys/arch/powerpc/oea/ofw_autoconf.c:1.10	Wed Mar 18 10:22:34 2009
+++ src/sys/arch/powerpc/oea/ofw_autoconf.c	Wed Jan 20 16:36:55 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: ofw_autoconf.c,v 1.10 2009/03/18 10:22:34 cegger Exp $ */
+/* $NetBSD: ofw_autoconf.c,v 1.11 2010/01/20 16:36:55 macallan Exp $ */
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
  * Copyright (C) 1995, 1996 TooLs GmbH.
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ofw_autoconf.c,v 1.10 2009/03/18 10:22:34 cegger Exp $);
+__KERNEL_RCSID(0, $NetBSD: ofw_autoconf.c,v 1.11 2010/01/20 16:36:55 macallan Exp $);
 
 #include sys/param.h
 #include sys/conf.h
@@ -249,6 +249,12 @@
 prop_dictionary_set_bool(dict, is_console, 0);
 copy_disp_props(dev, node, dict);
 			}
+			if (pci_class == PCI_CLASS_NETWORK) {
+of_to_dataprop(dict, node, local-mac-address,
+mac-address);
+of_to_dataprop(dict, node, shared-pins,
+shared-pins);
+			}
 		}
 	}
 



CVS commit: src/sys/arch/powerpc/oea

2009-06-07 Thread Frank Wille
Module Name:src
Committed By:   phx
Date:   Sun Jun  7 13:37:30 UTC 2009

Modified Files:
src/sys/arch/powerpc/oea: oea_machdep.c

Log Message:
MSGBUFADDR creates a msgbuf at a fixed address, usually defined by the port's
config file.
The use of MSGBUGADDR was already prepared in powerpc/oea/pmap.c years ago,
but was never used and missing powerpc/oea/oea_machdep.c. The option will
be used by port amigappc.


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/sys/arch/powerpc/oea/oea_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/oea_machdep.c
diff -u src/sys/arch/powerpc/oea/oea_machdep.c:1.46 src/sys/arch/powerpc/oea/oea_machdep.c:1.47
--- src/sys/arch/powerpc/oea/oea_machdep.c:1.46	Wed Jul  2 17:28:56 2008
+++ src/sys/arch/powerpc/oea/oea_machdep.c	Sun Jun  7 13:37:29 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: oea_machdep.c,v 1.46 2008/07/02 17:28:56 ad Exp $	*/
+/*	$NetBSD: oea_machdep.c,v 1.47 2009/06/07 13:37:29 phx Exp $	*/
 
 /*
  * Copyright (C) 2002 Matt Thomas
@@ -33,7 +33,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: oea_machdep.c,v 1.46 2008/07/02 17:28:56 ad Exp $);
+__KERNEL_RCSID(0, $NetBSD: oea_machdep.c,v 1.47 2009/06/07 13:37:29 phx Exp $);
 
 #include opt_ppcarch.h
 #include opt_compat_netbsd.h
@@ -103,7 +103,9 @@
 struct bat battable[512];
 
 register_t iosrtable[16];	/* I/O segments, for kernel_pmap setup */
+#ifndef MSGBUFADDR
 paddr_t msgbuf_paddr;
+#endif
 
 void
 oea_init(void (*handler)(void))
@@ -722,20 +724,24 @@
 	void *v;
 	vaddr_t minaddr, maxaddr;
 	char pbuf[9];
-	u_int i;
 
 	KASSERT(curcpu() != NULL);
 	KASSERT(lwp0.l_cpu != NULL);
 	KASSERT(curcpu()-ci_intstk != 0);
 	KASSERT(curcpu()-ci_intrdepth == -1);
 
+	sz = round_page(MSGBUFSIZE);
+#ifdef MSGBUFADDR
+	v = (void *) MSGBUFADDR;
+#else
 	/*
 	 * If the msgbuf is not in segment 0, allocate KVA for it and access
 	 * it via mapped pages.  [This prevents unneeded BAT switches.]
 	 */
-sz = round_page(MSGBUFSIZE);
 	v = (void *) msgbuf_paddr;
 	if (msgbuf_paddr + sz  SEGMENT_LENGTH) {
+		u_int i;
+
 		minaddr = 0;
 		if (uvm_map(kernel_map, minaddr, sz,
 NULL, UVM_UNKNOWN_OFFSET, 0,
@@ -749,6 +755,7 @@
 		}
 		pmap_update(pmap_kernel());
 	}
+#endif
 	initmsgbuf(v, sz);
 
 	printf(%s%s, copyright, version);