CVS commit: src/sys/arch/evbppc/mpc85xx

2019-04-11 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Thu Apr 11 14:47:06 UTC 2019

Modified Files:
src/sys/arch/evbppc/mpc85xx: machdep.c

Log Message:
Fix incorrect CVS Id


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/sys/arch/evbppc/mpc85xx/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/evbppc/mpc85xx/machdep.c
diff -u src/sys/arch/evbppc/mpc85xx/machdep.c:1.43 src/sys/arch/evbppc/mpc85xx/machdep.c:1.44
--- src/sys/arch/evbppc/mpc85xx/machdep.c:1.43	Sat Jan 27 10:07:41 2018
+++ src/sys/arch/evbppc/mpc85xx/machdep.c	Thu Apr 11 14:47:06 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.43 2018/01/27 10:07:41 flxd Exp $	*/
+/*	$NetBSD: machdep.c,v 1.44 2019/04/11 14:47:06 kamil Exp $	*/
 /*-
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -36,7 +36,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetSBD$");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.44 2019/04/11 14:47:06 kamil Exp $");
 
 #include "opt_altivec.h"
 #include "opt_ddb.h"



CVS commit: src/sys/arch/evbppc/mpc85xx

2015-01-05 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Tue Jan  6 01:23:24 UTC 2015

Modified Files:
src/sys/arch/evbppc/mpc85xx: machdep.c

Log Message:
No need to call e500_tlb1_sync() at e500_cpu_hatch(). It has already
been called at e500_spinup_trampoline().
Pointed by mrg@.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/arch/evbppc/mpc85xx/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/evbppc/mpc85xx/machdep.c
diff -u src/sys/arch/evbppc/mpc85xx/machdep.c:1.38 src/sys/arch/evbppc/mpc85xx/machdep.c:1.39
--- src/sys/arch/evbppc/mpc85xx/machdep.c:1.38	Mon Jan  5 08:40:56 2015
+++ src/sys/arch/evbppc/mpc85xx/machdep.c	Tue Jan  6 01:23:24 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.38 2015/01/05 08:40:56 nonaka Exp $	*/
+/*	$NetBSD: machdep.c,v 1.39 2015/01/06 01:23:24 nonaka Exp $	*/
 /*-
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -997,8 +997,7 @@ e500_cpu_hatch(struct cpu_info *ci)
 	 */
 	cpu_write_4(OPENPIC_BASE + OPENPIC_CTPR, 15);	/* IPL_HIGH */
 
-	/* Initialize TLB */
-	e500_tlb1_sync();
+	/* Set the MAS4 defaults */
 	mtspr(SPR_MAS4, MAS4_TSIZED_4KB | MAS4_MD);
 	tlb_invalidate_all();
 



CVS commit: src/sys/arch/evbppc/mpc85xx

2015-01-05 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Mon Jan  5 08:40:56 UTC 2015

Modified Files:
src/sys/arch/evbppc/mpc85xx: machdep.c

Log Message:
Initialize TLB for non cpu0.


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/arch/evbppc/mpc85xx/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/evbppc/mpc85xx/machdep.c
diff -u src/sys/arch/evbppc/mpc85xx/machdep.c:1.37 src/sys/arch/evbppc/mpc85xx/machdep.c:1.38
--- src/sys/arch/evbppc/mpc85xx/machdep.c:1.37	Sat Dec 27 16:19:33 2014
+++ src/sys/arch/evbppc/mpc85xx/machdep.c	Mon Jan  5 08:40:56 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.37 2014/12/27 16:19:33 nonaka Exp $	*/
+/*	$NetBSD: machdep.c,v 1.38 2015/01/05 08:40:56 nonaka Exp $	*/
 /*-
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -997,6 +997,11 @@ e500_cpu_hatch(struct cpu_info *ci)
 	 */
 	cpu_write_4(OPENPIC_BASE + OPENPIC_CTPR, 15);	/* IPL_HIGH */
 
+	/* Initialize TLB */
+	e500_tlb1_sync();
+	mtspr(SPR_MAS4, MAS4_TSIZED_4KB | MAS4_MD);
+	tlb_invalidate_all();
+
 	intr_cpu_hatch(ci);
 
 	cpu_probe_cache();



CVS commit: src/sys/arch/evbppc/mpc85xx

2014-12-18 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Fri Dec 19 04:31:41 UTC 2014

Modified Files:
src/sys/arch/evbppc/mpc85xx: machdep.c

Log Message:
do page recolor.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/evbppc/mpc85xx/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/evbppc/mpc85xx/machdep.c
diff -u src/sys/arch/evbppc/mpc85xx/machdep.c:1.35 src/sys/arch/evbppc/mpc85xx/machdep.c:1.36
--- src/sys/arch/evbppc/mpc85xx/machdep.c:1.35	Fri Dec 19 04:15:36 2014
+++ src/sys/arch/evbppc/mpc85xx/machdep.c	Fri Dec 19 04:31:41 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.35 2014/12/19 04:15:36 nonaka Exp $	*/
+/*	$NetBSD: machdep.c,v 1.36 2014/12/19 04:31:41 nonaka Exp $	*/
 /*-
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -639,6 +639,7 @@ cpu_probe_cache(void)
 {
 	struct cpu_info * const ci = curcpu();
 	const uint32_t l1cfg0 = mfspr(SPR_L1CFG0);
+	const int dcache_assoc = L1CFG_CNWAY_GET(l1cfg0);
 
 	ci->ci_ci.dcache_size = L1CFG_CSIZE_GET(l1cfg0);
 	ci->ci_ci.dcache_line_size = 32 << L1CFG_CBSIZE_GET(l1cfg0);
@@ -653,6 +654,11 @@ cpu_probe_cache(void)
 		ci->ci_ci.icache_line_size = ci->ci_ci.dcache_line_size;
 	}
 
+	/*
+	 * Possibly recolor.
+	 */
+	uvm_page_recolor(atop(curcpu()->ci_ci.dcache_size / dcache_assoc));
+
 #ifdef DEBUG
 	uint32_t l1csr0 = mfspr(SPR_L1CSR0);
 	if ((L1CSR_CE & l1csr0) == 0)



CVS commit: src/sys/arch/evbppc/mpc85xx

2014-12-18 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Fri Dec 19 04:15:37 UTC 2014

Modified Files:
src/sys/arch/evbppc/mpc85xx: machdep.c

Log Message:
Do probe cpu cache on !cpu0.
Avoid "panic: kernel diagnostic assertion "line_size > 0" failed: file 
"/usr/src/sys/arch/powerpc/booke/booke_cache.c", line 90".


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/evbppc/mpc85xx/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/evbppc/mpc85xx/machdep.c
diff -u src/sys/arch/evbppc/mpc85xx/machdep.c:1.34 src/sys/arch/evbppc/mpc85xx/machdep.c:1.35
--- src/sys/arch/evbppc/mpc85xx/machdep.c:1.34	Fri Dec 19 04:07:13 2014
+++ src/sys/arch/evbppc/mpc85xx/machdep.c	Fri Dec 19 04:15:36 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.34 2014/12/19 04:07:13 nonaka Exp $	*/
+/*	$NetBSD: machdep.c,v 1.35 2014/12/19 04:15:36 nonaka Exp $	*/
 /*-
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -983,6 +983,7 @@ e500_cpu_hatch(struct cpu_info *ci)
 
 	intr_cpu_hatch(ci);
 
+	cpu_probe_cache();
 	cpu_print_info(ci);
 
 /*



CVS commit: src/sys/arch/evbppc/mpc85xx

2014-12-18 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Fri Dec 19 04:07:13 UTC 2014

Modified Files:
src/sys/arch/evbppc/mpc85xx: machdep.c

Log Message:
Increase timeout for the hatching to complete.

> cpu1: hatch successful (24321 spins, timebase adjusted by -940718014)


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/evbppc/mpc85xx/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/evbppc/mpc85xx/machdep.c
diff -u src/sys/arch/evbppc/mpc85xx/machdep.c:1.33 src/sys/arch/evbppc/mpc85xx/machdep.c:1.34
--- src/sys/arch/evbppc/mpc85xx/machdep.c:1.33	Mon Aug  4 23:31:36 2014
+++ src/sys/arch/evbppc/mpc85xx/machdep.c	Fri Dec 19 04:07:13 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.33 2014/08/04 23:31:36 joerg Exp $	*/
+/*	$NetBSD: machdep.c,v 1.34 2014/12/19 04:07:13 nonaka Exp $	*/
 /*-
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -939,15 +939,15 @@ e500_cpu_spinup(device_t self, struct cp
 + (uint64_t)h->hatch_tbl),
 			h->hatch_running);
 			/*
-			 * Now we wait for the hatching to complete.  10ms
+			 * Now we wait for the hatching to complete.  30ms
 			 * should be long enough.
 			 */
-			for (u_int timo = 1; timo-- > 0; ) {
+			for (u_int timo = 3; timo-- > 0; ) {
 if (kcpuset_isset(hatchlings, id)) {
 	aprint_normal_dev(self,
 	"hatch successful (%u spins, "
 	"timebase adjusted by %"PRId64")\n",
-	1 - timo,
+	3 - timo,
 	(int64_t)
 		(((uint64_t)h->hatch_tbu << 32)
 		+ (uint64_t)h->hatch_tbl));



CVS commit: src/sys/arch/evbppc/mpc85xx

2014-08-10 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Sun Aug 10 18:01:29 UTC 2014

Modified Files:
src/sys/arch/evbppc/mpc85xx: mpc85xx_start.S

Log Message:
Drop .machine, Makefile.mpc85xx provides -me500 already.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/evbppc/mpc85xx/mpc85xx_start.S

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/evbppc/mpc85xx/mpc85xx_start.S
diff -u src/sys/arch/evbppc/mpc85xx/mpc85xx_start.S:1.8 src/sys/arch/evbppc/mpc85xx/mpc85xx_start.S:1.9
--- src/sys/arch/evbppc/mpc85xx/mpc85xx_start.S:1.8	Wed Jul 30 23:15:23 2014
+++ src/sys/arch/evbppc/mpc85xx/mpc85xx_start.S	Sun Aug 10 18:01:29 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: mpc85xx_start.S,v 1.8 2014/07/30 23:15:23 joerg Exp $	*/
+/*	$NetBSD: mpc85xx_start.S,v 1.9 2014/08/10 18:01:29 joerg Exp $	*/
 /*-
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -37,7 +37,7 @@
 #include 
 #include 
 
-RCSID("$NetBSD: mpc85xx_start.S,v 1.8 2014/07/30 23:15:23 joerg Exp $")
+RCSID("$NetBSD: mpc85xx_start.S,v 1.9 2014/08/10 18:01:29 joerg Exp $")
 
 #include "opt_altivec.h"
 #include "opt_ddb.h"
@@ -64,7 +64,6 @@ RCSID("$NetBSD: mpc85xx_start.S,v 1.8 20
 
 #define	INTSTK	0
 
-	.machine e500
 /*
  * This symbol is here for the benefit of kvm_mkdb, and is supposed to
  * mark the start of kernel text.



CVS commit: src/sys/arch/evbppc/mpc85xx

2014-08-04 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Mon Aug  4 23:31:36 UTC 2014

Modified Files:
src/sys/arch/evbppc/mpc85xx: machdep.c

Log Message:
mpc85xx_extirq_names is not used for the MPC8548 branch.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/evbppc/mpc85xx/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/evbppc/mpc85xx/machdep.c
diff -u src/sys/arch/evbppc/mpc85xx/machdep.c:1.32 src/sys/arch/evbppc/mpc85xx/machdep.c:1.33
--- src/sys/arch/evbppc/mpc85xx/machdep.c:1.32	Thu Jul 24 23:30:38 2014
+++ src/sys/arch/evbppc/mpc85xx/machdep.c	Mon Aug  4 23:31:36 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.32 2014/07/24 23:30:38 joerg Exp $	*/
+/*	$NetBSD: machdep.c,v 1.33 2014/08/04 23:31:36 joerg Exp $	*/
 /*-
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -1293,6 +1293,7 @@ static const char * const mpc8548cds_ext
 };
 #endif
 
+#ifndef MPC8548
 static const char * const mpc85xx_extirq_names[] = {
 	[0] = "extirq 0",
 	[1] = "extirq 1",
@@ -1307,6 +1308,7 @@ static const char * const mpc85xx_extirq
 	[10] = "extirq 10",
 	[11] = "extirq 11",
 };
+#endif
 
 static void
 mpc85xx_extirq_setup(void)



CVS commit: src/sys/arch/evbppc/mpc85xx

2014-07-24 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Thu Jul 24 23:30:38 UTC 2014

Modified Files:
src/sys/arch/evbppc/mpc85xx: machdep.c

Log Message:
Use volatile when writing to NULL.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/evbppc/mpc85xx/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/evbppc/mpc85xx/machdep.c
diff -u src/sys/arch/evbppc/mpc85xx/machdep.c:1.31 src/sys/arch/evbppc/mpc85xx/machdep.c:1.32
--- src/sys/arch/evbppc/mpc85xx/machdep.c:1.31	Tue Mar 18 18:20:41 2014
+++ src/sys/arch/evbppc/mpc85xx/machdep.c	Thu Jul 24 23:30:38 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.31 2014/03/18 18:20:41 riastradh Exp $	*/
+/*	$NetBSD: machdep.c,v 1.32 2014/07/24 23:30:38 joerg Exp $	*/
 /*-
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -1183,7 +1183,7 @@ initppc(vaddr_t startkernel, vaddr_t end
 	/*
 	 * fill in with an absolute branch to a routine that will panic.
 	 */
-	*(int *)0 = 0x4802 | (int) calltozero;
+	*(volatile int *)0 = 0x4802 | (int) calltozero;
 
 	/*
 	 * Get the cache sizes.



CVS commit: src/sys/arch/evbppc/mpc85xx

2013-07-17 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Jul 17 23:25:12 UTC 2013

Modified Files:
src/sys/arch/evbppc/mpc85xx: autoconf.c

Log Message:
Wait it actually wait.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/evbppc/mpc85xx/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/evbppc/mpc85xx/autoconf.c
diff -u src/sys/arch/evbppc/mpc85xx/autoconf.c:1.7 src/sys/arch/evbppc/mpc85xx/autoconf.c:1.8
--- src/sys/arch/evbppc/mpc85xx/autoconf.c:1.7	Sun Jul 29 21:39:43 2012
+++ src/sys/arch/evbppc/mpc85xx/autoconf.c	Wed Jul 17 23:25:12 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: autoconf.c,v 1.7 2012/07/29 21:39:43 matt Exp $	*/
+/*	$NetBSD: autoconf.c,v 1.8 2013/07/17 23:25:12 matt Exp $	*/
 /*-
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.7 2012/07/29 21:39:43 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.8 2013/07/17 23:25:12 matt Exp $");
 
 #define __INTR_PRIVATE
 
@@ -80,7 +80,7 @@ cpu_rootconf(void)
 	/*
 	 * We wait up to 10 seconds for a bootable device to be found.
 	 */
-	while (rootconf_timo-- > 0) {
+	while (rootconf_timo > 0) {
 		if (booted_device != NULL) {
 			aprint_normal_dev(booted_device, "boot device\n");
 			break;
@@ -92,7 +92,9 @@ cpu_rootconf(void)
 			break;
 		}
 
-		kpause("autoconf", true, 1, NULL);
+		if (EWOULDBLOCK == kpause("autoconf", true, 1, NULL)) {
+			rootconf_timo--;
+		}
 	}
 
 	rootconf();



CVS commit: src/sys/arch/evbppc/mpc85xx

2013-07-17 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Jul 17 23:25:25 UTC 2013

Modified Files:
src/sys/arch/evbppc/mpc85xx: machdep.c

Log Message:
kcpuset_t changes


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/evbppc/mpc85xx/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/evbppc/mpc85xx/machdep.c
diff -u src/sys/arch/evbppc/mpc85xx/machdep.c:1.29 src/sys/arch/evbppc/mpc85xx/machdep.c:1.30
--- src/sys/arch/evbppc/mpc85xx/machdep.c:1.29	Sun Jul 29 21:39:43 2012
+++ src/sys/arch/evbppc/mpc85xx/machdep.c	Wed Jul 17 23:25:25 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.29 2012/07/29 21:39:43 matt Exp $	*/
+/*	$NetBSD: machdep.c,v 1.30 2013/07/17 23:25:25 matt Exp $	*/
 /*-
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -75,7 +75,6 @@ __KERNEL_RCSID(0, "$NetSBD$");
 #include 
 #include 
 
-#include 
 #include 
 #include 
 #include 
@@ -807,7 +806,7 @@ e500_cpu_spinup(device_t self, struct cp
 	struct uboot_spinup_entry * const e = (void *)spinup_table_addr;
 	volatile struct cpu_hatch_data * const h = &cpu_hatch_data;
 	const size_t id = cpu_index(ci);
-	volatile __cpuset_t * const hatchlings = &cpuset_info.cpus_hatched;
+	kcpuset_t * const hatchlings = cpuset_info.cpus_hatched;
 
 	if (h->hatch_sp == 0) {
 		int error = uvm_pglistalloc(PAGE_SIZE, PAGE_SIZE,
@@ -839,6 +838,9 @@ e500_cpu_spinup(device_t self, struct cp
 			h->hatch_running = -1;
 			h->hatch_pir = e[i].entry_pir;
 			h->hatch_hid0 = mfspr(SPR_HID0);
+			u_int tlbidx;
+		e500_tlb_lookup_xtlb(0, &tlbidx);
+		h->hatch_tlbidx = tlbidx;
 			KASSERT(h->hatch_sp != 0);
 			/*
 			 * Get new timebase.  We don't want to deal with
@@ -859,7 +861,6 @@ e500_cpu_spinup(device_t self, struct cp
 			__asm("sync;isync");
 			dcache_wbinv((vaddr_t)h, sizeof(*h));
 
-#if 1
 			/*
 			 * And here we go...
 			 */
@@ -872,19 +873,23 @@ e500_cpu_spinup(device_t self, struct cp
 			for (u_int timo = 0; timo++ < 1; ) {
 dcache_inv((vaddr_t)&e[i], sizeof(e[i]));
 if (e[i].entry_addr_lower == 3) {
+#if 0
 	printf(
 	"%s: cpu%u started in %u spins\n",
 	__func__, cpu_index(ci), timo);
+#endif
 	break;
 }
 			}
 			for (u_int timo = 0; timo++ < 1; ) {
 dcache_inv((vaddr_t)h, sizeof(*h));
 if (h->hatch_running == 0) {
+#if 0
 	printf(
 	"%s: cpu%u cracked in %u spins: (running=%d)\n",
 	__func__, cpu_index(ci),
 	timo, h->hatch_running);
+#endif
 	break;
 }
 			}
@@ -895,7 +900,6 @@ e500_cpu_spinup(device_t self, struct cp
 h->hatch_running, e[i].entry_addr_lower);
 goto out;
 			}
-#endif
 
 			/*
 			 * First then we do is to synchronize timebases.
@@ -908,6 +912,8 @@ e500_cpu_spinup(device_t self, struct cp
 			dcache_wbinv((vaddr_t)h, sizeof(*h));
 			__asm("sync;isync");
 			__insn_barrier();
+			printf("%s: cpu%u set to running\n",
+			__func__, cpu_index(ci));
 
 			for (u_int timo = 1; timo-- > 0; ) {
 dcache_inv((vaddr_t)h, sizeof(*h));
@@ -937,7 +943,7 @@ e500_cpu_spinup(device_t self, struct cp
 			 * should be long enough.
 			 */
 			for (u_int timo = 1; timo-- > 0; ) {
-if (CPUSET_HAS_P(*hatchlings, id)) {
+if (kcpuset_isset(hatchlings, id)) {
 	aprint_normal_dev(self,
 	"hatch successful (%u spins, "
 	"timebase adjusted by %"PRId64")\n",



CVS commit: src/sys/arch/evbppc/mpc85xx

2012-07-29 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sun Jul 29 21:36:27 UTC 2012

Modified Files:
src/sys/arch/evbppc/mpc85xx: mpc85xx_start.S

Log Message:
Make sure r8 isn't used.
Document args passed by uboot


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/evbppc/mpc85xx/mpc85xx_start.S

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/evbppc/mpc85xx/mpc85xx_start.S
diff -u src/sys/arch/evbppc/mpc85xx/mpc85xx_start.S:1.5 src/sys/arch/evbppc/mpc85xx/mpc85xx_start.S:1.6
--- src/sys/arch/evbppc/mpc85xx/mpc85xx_start.S:1.5	Sat Jun 18 06:37:38 2011
+++ src/sys/arch/evbppc/mpc85xx/mpc85xx_start.S	Sun Jul 29 21:36:27 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: mpc85xx_start.S,v 1.5 2011/06/18 06:37:38 matt Exp $	*/
+/*	$NetBSD: mpc85xx_start.S,v 1.6 2012/07/29 21:36:27 matt Exp $	*/
 /*-
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -37,7 +37,7 @@
 #include 
 #include 
 
-RCSID("$NetBSD: mpc85xx_start.S,v 1.5 2011/06/18 06:37:38 matt Exp $")
+RCSID("$NetBSD: mpc85xx_start.S,v 1.6 2012/07/29 21:36:27 matt Exp $")
 
 #include "opt_altivec.h"
 #include "opt_ddb.h"
@@ -78,10 +78,10 @@ __start:
 /*
  * Startup entry.  Note, this must be the first thing in the text segment!
  */
-	mr	%r8,%r6
-	mr	%r7,%r5
-	mr	%r6,%r4
-	mr	%r5,%r3
+	mr	%r8,%r6		/* cmdline (char *) */
+	mr	%r7,%r5		/* consdev (char *) */
+	mr	%r6,%r4		/* os_hdr * */
+	mr	%r5,%r3		/* board info * */
 #ifdef DEBUG
 	/*
 	 * Set all the registers we don't care about to a known junk value.
@@ -231,11 +231,11 @@ __start:
 	/*
 	 * Force all dirty lines in the kernel area to memory.
 	 */
-	lis	%r8,kernel_text@ha
-	addi	%r8,%r8,kernel_text@l
-4:	dcbst	%r0,%r8
-	addi	%r8,%r8,32
-	cmplw	%r8,%r4
+	lis	%r9,kernel_text@ha
+	addi	%r9,%r9,kernel_text@l
+4:	dcbst	%r0,%r9
+	addi	%r9,%r9,32
+	cmplw	%r9,%r4
 	blt	%cr0,4b
 	mbar	1
 	msync



CVS commit: src/sys/arch/evbppc/mpc85xx

2012-07-07 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Jul  7 08:06:51 UTC 2012

Modified Files:
src/sys/arch/evbppc/mpc85xx: machdep.c

Log Message:
Whitespace.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/evbppc/mpc85xx/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/evbppc/mpc85xx/machdep.c
diff -u src/sys/arch/evbppc/mpc85xx/machdep.c:1.23 src/sys/arch/evbppc/mpc85xx/machdep.c:1.24
--- src/sys/arch/evbppc/mpc85xx/machdep.c:1.23	Thu Mar 29 15:49:08 2012
+++ src/sys/arch/evbppc/mpc85xx/machdep.c	Sat Jul  7 08:06:51 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.23 2012/03/29 15:49:08 matt Exp $	*/
+/*	$NetBSD: machdep.c,v 1.24 2012/07/07 08:06:51 skrll Exp $	*/
 /*-
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -1152,7 +1152,7 @@ initppc(vaddr_t startkernel, vaddr_t end
 	cpu_md_ops.md_cpunode_attach = pq3gpio_attach;
 #endif
 
-		printf(" initppc done!\n");
+	printf(" initppc done!\n");
 
 	/*
 	 * Look for the Book-E modules in the right place.



CVS commit: src/sys/arch/evbppc/mpc85xx

2012-03-29 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Mar 29 15:49:08 UTC 2012

Modified Files:
src/sys/arch/evbppc/mpc85xx: machdep.c

Log Message:
Add support for PMAP_MINIMALTLB.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/evbppc/mpc85xx/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/evbppc/mpc85xx/machdep.c
diff -u src/sys/arch/evbppc/mpc85xx/machdep.c:1.22 src/sys/arch/evbppc/mpc85xx/machdep.c:1.23
--- src/sys/arch/evbppc/mpc85xx/machdep.c:1.22	Fri Jan 27 18:52:54 2012
+++ src/sys/arch/evbppc/mpc85xx/machdep.c	Thu Mar 29 15:49:08 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.22 2012/01/27 18:52:54 para Exp $	*/
+/*	$NetBSD: machdep.c,v 1.23 2012/03/29 15:49:08 matt Exp $	*/
 /*-
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -1126,44 +1126,20 @@ initppc(vaddr_t startkernel, vaddr_t end
 	/*
 	 * Initialize the pmap.
 	 */
-	pmap_bootstrap(startkernel, endkernel, availmemr, nmemr);
+	endkernel = pmap_bootstrap(startkernel, endkernel, availmemr, nmemr);
 
 	/*
 	 * Let's take all the indirect calls via our stubs and patch 
 	 * them to be direct calls.
 	 */
 	cpu_fixup_stubs();
-#if 0
+
 	/*
 	 * As a debug measure we can change the TLB entry that maps all of
 	 * memory to one that encompasses the 64KB with the kernel vectors.
 	 * All other pages will be soft faulted into the TLB as needed.
 	 */
-	const uint32_t saved_mas0 = mfspr(SPR_MAS0);
-	mtspr(SPR_MAS6, 0);
-	__asm volatile("tlbsx\t0, %0" :: "b"(startkernel));
-	uint32_t mas0 = mfspr(SPR_MAS0);
-	uint32_t mas1 = mfspr(SPR_MAS1);
-	uint32_t mas2 = mfspr(SPR_MAS2);
-	uint32_t mas3 = mfspr(SPR_MAS3);
-	KASSERT(mas3 & MAS3_SW);
-	KASSERT(mas3 & MAS3_SR);
-	KASSERT(mas3 & MAS3_SX);
-	mas1 = (mas1 & ~MAS1_TSIZE) | MASX_TSIZE_64KB;
-	pt_entry_t xpn_mask = ~0 << (10 + 2 * MASX_TSIZE_GET(mas1));
-	mas2 = (mas2 & ~(MAS2_EPN)) | (startkernel & xpn_mask);
-	mas3 = (mas3 & ~(MAS3_RPN|MAS3_SW)) | (startkernel & xpn_mask);
-	printf(" %#lx=<%#x,%#x,%#x,%#x>", startkernel, mas0, mas1, mas2, mas3);
-#if 1
-	mtspr(SPR_MAS1, mas1);
-	mtspr(SPR_MAS2, mas2);
-	mtspr(SPR_MAS3, mas3);
-	extern void tlbwe(void);
-	tlbwe();
-	mtspr(SPR_MAS0, saved_mas0);
-	printf("(ok)");
-#endif
-#endif
+	e500_tlb_minimize(endkernel);
 
 	/*
 	 * Set some more MD helpers



CVS commit: src/sys/arch/evbppc/mpc85xx

2011-08-01 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Aug  2 00:25:39 UTC 2011

Modified Files:
src/sys/arch/evbppc/mpc85xx: machdep.c

Log Message:
Fix tpyo.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/evbppc/mpc85xx/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/evbppc/mpc85xx/machdep.c
diff -u src/sys/arch/evbppc/mpc85xx/machdep.c:1.20 src/sys/arch/evbppc/mpc85xx/machdep.c:1.21
--- src/sys/arch/evbppc/mpc85xx/machdep.c:1.20	Mon Jul 25 05:46:12 2011
+++ src/sys/arch/evbppc/mpc85xx/machdep.c	Tue Aug  2 00:25:38 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.20 2011/07/25 05:46:12 matt Exp $	*/
+/*	$NetBSD: machdep.c,v 1.21 2011/08/02 00:25:38 matt Exp $	*/
 /*-
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -268,7 +268,7 @@
 		1, { ISOURCE_DDR },
 		1 + ilog2(DEVDISR_DDR_15),
 		{ SVR_MPC8572v1 >> 16 } },
-	{ "ddrc", DDRC1_BASE, DDRC_SIZE, 2,
+	{ "ddrc", DDRC2_BASE, DDRC_SIZE, 2,
 		1, { ISOURCE_DDR },
 		1 + ilog2(DEVDISR_DDR2_14),
 		{ SVR_MPC8572v1 >> 16 } },



CVS commit: src/sys/arch/evbppc/mpc85xx

2011-07-24 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Jul 25 05:46:13 UTC 2011

Modified Files:
src/sys/arch/evbppc/mpc85xx: machdep.c

Log Message:
Add support for MEMSIZE to limit the amount of memory detected.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/evbppc/mpc85xx/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/evbppc/mpc85xx/machdep.c
diff -u src/sys/arch/evbppc/mpc85xx/machdep.c:1.19 src/sys/arch/evbppc/mpc85xx/machdep.c:1.20
--- src/sys/arch/evbppc/mpc85xx/machdep.c:1.19	Wed Jul 20 13:21:12 2011
+++ src/sys/arch/evbppc/mpc85xx/machdep.c	Mon Jul 25 05:46:12 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.19 2011/07/20 13:21:12 matt Exp $	*/
+/*	$NetBSD: machdep.c,v 1.20 2011/07/25 05:46:12 matt Exp $	*/
 /*-
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -38,10 +38,10 @@
 
 __KERNEL_RCSID(0, "$NetSBD$");
 
-#include "opt_mpc85xx.h"
 #include "opt_altivec.h"
-#include "opt_pci.h"
 #include "opt_ddb.h"
+#include "opt_mpc85xx.h"
+#include "opt_pci.h"
 #include "gpio.h"
 #include "pci.h"
 
@@ -438,7 +438,6 @@
 	 * to ask the DDR memory controller.
 	 */
 	mr = physmemr;
-#if 1
 	for (u_int i = 0; i < 4; i++) {
 		uint32_t v = cpu_read_4(DDRC1_BASE + CS_CONFIG(i));
 		if (v & CS_CONFIG_EN) {
@@ -447,6 +446,12 @@
 continue;
 			mr->start = BNDS_SA_GET(v);
 			mr->size  = BNDS_SIZE_GET(v);
+#ifdef MEMSIZE
+			if (mr->start >= MEMSIZE)
+continue;
+			if (mr->start + mr->size > MEMSIZE)
+mr->size = MEMSIZE - mr->start;
+#endif
 #if 0
 			printf(" [%zd]={%#"PRIx64"@%#"PRIx64"}",
 			mr - physmemr, mr->size, mr->start);
@@ -457,11 +462,6 @@
 
 	if (mr == physmemr)
 		panic("no memory configured!");
-#else
-	mr->start = 0;
-	mr->size = 32 << 20;
-	mr++;
-#endif
 
 	/*
 	 * Sort memory regions from low to high and coalesce adjacent regions



CVS commit: src/sys/arch/evbppc/mpc85xx

2011-07-20 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Jul 20 13:21:12 UTC 2011

Modified Files:
src/sys/arch/evbppc/mpc85xx: machdep.c

Log Message:
Suppress a GCC 4.5 warning.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/evbppc/mpc85xx/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/evbppc/mpc85xx/machdep.c
diff -u src/sys/arch/evbppc/mpc85xx/machdep.c:1.18 src/sys/arch/evbppc/mpc85xx/machdep.c:1.19
--- src/sys/arch/evbppc/mpc85xx/machdep.c:1.18	Sun Jul 17 20:54:39 2011
+++ src/sys/arch/evbppc/mpc85xx/machdep.c	Wed Jul 20 13:21:12 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.18 2011/07/17 20:54:39 joerg Exp $	*/
+/*	$NetBSD: machdep.c,v 1.19 2011/07/20 13:21:12 matt Exp $	*/
 /*-
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -122,8 +122,8 @@
 void	initppc(vaddr_t, vaddr_t, void *, void *, void *, void *);
 
 #define	MEMREGIONS	4
-phys_ram_seg_t physmemr[MEMREGIONS]; /* All memory */
-phys_ram_seg_t availmemr[MEMREGIONS];/* Available memory */
+phys_ram_seg_t physmemr[MEMREGIONS];		/* All memory */
+phys_ram_seg_t availmemr[2*MEMREGIONS];		/* Available memory */
 static u_int nmemr;
 
 #ifndef CONSFREQ
@@ -536,9 +536,10 @@
 	/*
 	 * Steal pages at the end of memory for the kernel message buffer.
 	 */
-	availmemr[cnt-1].size -= round_page(MSGBUFSIZE);
-	msgbuf_paddr =
-	(uintptr_t)(availmemr[cnt-1].start + availmemr[cnt-1].size);
+	mr = availmemr + cnt - 1;
+	KASSERT(mr->size >= round_page(MSGBUFSIZE));
+	mr->size -= round_page(MSGBUFSIZE);
+	msgbuf_paddr = (uintptr_t)(mr->start + mr->size);
 
 	/*
 	 * Calculate physmem.



CVS commit: src/sys/arch/evbppc/mpc85xx

2011-07-16 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat Jul 16 21:36:19 UTC 2011

Modified Files:
src/sys/arch/evbppc/mpc85xx: machdep.c

Log Message:
Fix off-by-one.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/evbppc/mpc85xx/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/evbppc/mpc85xx/machdep.c
diff -u src/sys/arch/evbppc/mpc85xx/machdep.c:1.16 src/sys/arch/evbppc/mpc85xx/machdep.c:1.17
--- src/sys/arch/evbppc/mpc85xx/machdep.c:1.16	Fri Jul  1 07:44:33 2011
+++ src/sys/arch/evbppc/mpc85xx/machdep.c	Sat Jul 16 21:36:18 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.16 2011/07/01 07:44:33 matt Exp $	*/
+/*	$NetBSD: machdep.c,v 1.17 2011/07/16 21:36:18 matt Exp $	*/
 /*-
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -488,7 +488,7 @@
 cnt--;
 			}
 		}
-	} else {
+	} else if (cnt == 0) {
 		panic("%s: no memory found", __func__);
 	}
 



CVS commit: src/sys/arch/evbppc/mpc85xx

2011-07-01 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Jul  1 07:44:34 UTC 2011

Modified Files:
src/sys/arch/evbppc/mpc85xx: machdep.c

Log Message:
Fix some array bounds errors found by gcc 4.5


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/evbppc/mpc85xx/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/evbppc/mpc85xx/machdep.c
diff -u src/sys/arch/evbppc/mpc85xx/machdep.c:1.15 src/sys/arch/evbppc/mpc85xx/machdep.c:1.16
--- src/sys/arch/evbppc/mpc85xx/machdep.c:1.15	Thu Jun 30 00:52:56 2011
+++ src/sys/arch/evbppc/mpc85xx/machdep.c	Fri Jul  1 07:44:33 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.15 2011/06/30 00:52:56 matt Exp $	*/
+/*	$NetBSD: machdep.c,v 1.16 2011/07/01 07:44:33 matt Exp $	*/
 /*-
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -480,14 +480,16 @@
 			}
 		}
 		mr = physmemr;
-		for (u_int i = 0; i < cnt; i++, mr++) {
+		for (u_int i = 0; i + 1 < cnt; i++, mr++) {
 			if (mr->start + mr->size == mr[1].start) {
 mr->size += mr[1].size;
-for (u_int j = 1; j < cnt - i; j++)
+for (u_int j = 1; i + j + 1 < cnt; j++)
 	mr[j] = mr[j+1];
 cnt--;
 			}
 		}
+	} else {
+		panic("%s: no memory found", __func__);
 	}
 
 	/*



CVS commit: src/sys/arch/evbppc/mpc85xx

2011-06-28 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Jun 29 05:53:05 UTC 2011

Modified Files:
src/sys/arch/evbppc/mpc85xx: machdep.c

Log Message:
Some initial MULTIPROCESSOR spin code.  Doesn't work yet.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/evbppc/mpc85xx/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/evbppc/mpc85xx/machdep.c
diff -u src/sys/arch/evbppc/mpc85xx/machdep.c:1.13 src/sys/arch/evbppc/mpc85xx/machdep.c:1.14
--- src/sys/arch/evbppc/mpc85xx/machdep.c:1.13	Sat Jun 25 00:07:10 2011
+++ src/sys/arch/evbppc/mpc85xx/machdep.c	Wed Jun 29 05:53:05 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.13 2011/06/25 00:07:10 matt Exp $	*/
+/*	$NetBSD: machdep.c,v 1.14 2011/06/29 05:53:05 matt Exp $	*/
 /*-
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -66,7 +66,7 @@
 
 #include 
 
-#include 
+#include 
 
 #include 
 
@@ -77,6 +77,7 @@
 #include 
 #include 
 
+#include 
 #include 
 #include 
 #include 
@@ -663,27 +664,10 @@
 }
 
 static void
-e500_cpu_attach(device_t self, u_int instance)
+cpu_print_info(struct cpu_info *ci)
 {
-	struct cpu_info * const ci = &cpu_info[instance - (instance > 0)];
-
-	if (instance > 1) {
-#ifdef MULTIPROCESSOR
-#error		still needs to be written
-		ci->ci_idepth = -1;
-		cpu_probe_cache();
-#else
-		aprint_error_dev(self, "disabled (uniprocessor kernel)\n");
-		return;
-#endif
-	}
-
-	self->dv_private = ci;
-
-	ci->ci_cpuid = instance - (instance > 0);
-	ci->ci_dev = self;
-//ci->ci_idlespin = cpu_idlespin;
 	uint64_t freq = board_info_get_number("processor-frequency");
+	device_t self = ci->ci_dev;
 
 	char freqbuf[10];
 	if (freq >= 99950) {
@@ -736,12 +720,238 @@
 
 	e500_tlb_print(self, "tlb0", mfspr(SPR_TLB0CFG));
 	e500_tlb_print(self, "tlb1", mfspr(SPR_TLB1CFG));
+}
+
+#ifdef MULTIPROCESSOR
+static void
+e500_cpu_spinup(device_t self, struct cpu_info *ci)
+{
+	uintptr_t spinup_table_addr = board_info_get_number("mp-spin-up-table");
+	struct pglist splist;
+
+	if (spinup_table_addr == 0) {
+		aprint_error_dev(self, "hatch failed (no spin-up table)");
+		return;
+	}
+
+	struct uboot_spinup_entry * const e = (void *)spinup_table_addr;
+	volatile struct cpu_hatch_data * const h = &cpu_hatch_data;
+	const size_t id = cpu_index(ci);
+	volatile __cpuset_t * const hatchlings = &cpuset_info.cpus_hatched;
+
+	if (h->hatch_sp == 0) {
+		int error = uvm_pglistalloc(PAGE_SIZE, PAGE_SIZE,
+		64*1024*1024, PAGE_SIZE, 0, &splist, 1, 1);
+		if (error) {
+			aprint_error_dev(self,
+			"unable to allocate hatch stack\n");
+			return;
+		}
+		h->hatch_sp = VM_PAGE_TO_PHYS(TAILQ_FIRST(&splist))
+		+ PAGE_SIZE - CALLFRAMELEN;
+}
+
+
+	for (size_t i = 1; e[i].entry_pir != 0; i++) {
+		printf("%s: cpu%u: entry#%zu(%p): pir=%u\n",
+		__func__, ci->ci_cpuid, i, &e[i], e[i].entry_pir);
+		if (e[i].entry_pir == ci->ci_cpuid) {
+
+			ci->ci_curlwp = ci->ci_data.cpu_idlelwp;
+			ci->ci_curpcb = lwp_getpcb(ci->ci_curlwp);
+			ci->ci_curpm = pmap_kernel();
+			ci->ci_lasttb = cpu_info[0].ci_lasttb;
+			ci->ci_data.cpu_cc_freq =
+			cpu_info[0].ci_data.cpu_cc_freq;
+
+			h->hatch_self = self;
+			h->hatch_ci = ci;
+			h->hatch_running = -1;
+			h->hatch_pir = e[i].entry_pir;
+			h->hatch_hid0 = mfspr(SPR_HID0);
+			KASSERT(h->hatch_sp != 0);
+			/*
+			 * Get new timebase.  We don't want to deal with
+			 * timebase crossing a 32-bit boundary so make sure
+			 * that we have enough headroom to do the timebase
+			 * synchronization. 
+			 */
+#define	TBSYNC_SLOP	2000
+			uint32_t tbl;
+			uint32_t tbu;
+			do {
+tbu = mfspr(SPR_RTBU);
+tbl = mfspr(SPR_RTBL) + TBSYNC_SLOP;
+			} while (tbl < TBSYNC_SLOP);
+			
+			h->hatch_tbu = tbu;
+			h->hatch_tbl = tbl;
+			__asm("sync;isync");
+			dcache_wbinv((vaddr_t)h, sizeof(*h));
+
+#if 1
+			/*
+			 * And here we go...
+			 */
+			e[i].entry_addr_lower =
+			(uint32_t)e500_spinup_trampoline;
+			dcache_wbinv((vaddr_t)&e[i], sizeof(e[i]));
+			__asm __volatile("sync;isync");
+			__insn_barrier();
+
+			for (u_int timo = 0; timo++ < 1; ) {
+dcache_inv((vaddr_t)&e[i], sizeof(e[i]));
+if (e[i].entry_addr_lower == 3) {
+	printf(
+	"%s: cpu%u started in %u spins\n",
+	__func__, cpu_index(ci), timo);
+	break;
+}
+			}
+			for (u_int timo = 0; timo++ < 1; ) {
+dcache_inv((vaddr_t)h, sizeof(*h));
+if (h->hatch_running == 0) {
+	printf(
+	"%s: cpu%u cracked in %u spins: (running=%d)\n",
+	__func__, cpu_index(ci),
+	timo, h->hatch_running);
+	break;
+}
+			}
+			if (h->hatch_running == -1) {
+aprint_error_dev(self,
+"hatch failed (timeout): running=%d"
+", entry=%#x\n",
+h->hatch_running, e[i].entry_addr_lower);
+goto out;
+			}
+#endif
+
+			/*
+			 * First then we do is to synchronize timebases.
+		

CVS commit: src/sys/arch/evbppc/mpc85xx

2011-06-24 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Jun 24 23:54:37 UTC 2011

Modified Files:
src/sys/arch/evbppc/mpc85xx: autoconf.c

Log Message:
Use intr_init since we have it.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/evbppc/mpc85xx/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/evbppc/mpc85xx/autoconf.c
diff -u src/sys/arch/evbppc/mpc85xx/autoconf.c:1.4 src/sys/arch/evbppc/mpc85xx/autoconf.c:1.5
--- src/sys/arch/evbppc/mpc85xx/autoconf.c:1.4	Sat Jun 18 06:36:25 2011
+++ src/sys/arch/evbppc/mpc85xx/autoconf.c	Fri Jun 24 23:54:37 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: autoconf.c,v 1.4 2011/06/18 06:36:25 matt Exp $	*/
+/*	$NetBSD: autoconf.c,v 1.5 2011/06/24 23:54:37 matt Exp $	*/
 /*-
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.4 2011/06/18 06:36:25 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.5 2011/06/24 23:54:37 matt Exp $");
 
 #define __INTR_PRIVATE
 
@@ -58,7 +58,7 @@
 cpu_configure(void)
 {
 
-	(*powerpc_intrsw->intrsw_init)();
+	intr_init();
 	calc_delayconst();
 
 	if (config_rootfound("mainbus", NULL) == NULL)



CVS commit: src/sys/arch/evbppc/mpc85xx

2011-06-17 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat Jun 18 06:36:25 UTC 2011

Modified Files:
src/sys/arch/evbppc/mpc85xx: autoconf.c

Log Message:
Whitespace cleanup


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/evbppc/mpc85xx/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/evbppc/mpc85xx/autoconf.c
diff -u src/sys/arch/evbppc/mpc85xx/autoconf.c:1.3 src/sys/arch/evbppc/mpc85xx/autoconf.c:1.4
--- src/sys/arch/evbppc/mpc85xx/autoconf.c:1.3	Thu Feb 17 13:57:12 2011
+++ src/sys/arch/evbppc/mpc85xx/autoconf.c	Sat Jun 18 06:36:25 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: autoconf.c,v 1.3 2011/02/17 13:57:12 matt Exp $	*/
+/*	$NetBSD: autoconf.c,v 1.4 2011/06/18 06:36:25 matt Exp $	*/
 /*-
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.3 2011/02/17 13:57:12 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.4 2011/06/18 06:36:25 matt Exp $");
 
 #define __INTR_PRIVATE
 
@@ -47,8 +47,8 @@
 #include 
 #include 
 #include 
-
 #include 
+
 #include 
 
 /*



CVS commit: src/sys/arch/evbppc/mpc85xx

2011-06-13 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Jun 14 05:32:59 UTC 2011

Modified Files:
src/sys/arch/evbppc/mpc85xx: machdep.c

Log Message:
print out the first 4 arguments to the kernel from the bootloader.
Add a definition of the uboot bootinfo structure.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/evbppc/mpc85xx/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/evbppc/mpc85xx/machdep.c
diff -u src/sys/arch/evbppc/mpc85xx/machdep.c:1.9 src/sys/arch/evbppc/mpc85xx/machdep.c:1.10
--- src/sys/arch/evbppc/mpc85xx/machdep.c:1.9	Sun Jun 12 04:20:18 2011
+++ src/sys/arch/evbppc/mpc85xx/machdep.c	Tue Jun 14 05:32:59 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.9 2011/06/12 04:20:18 mrg Exp $	*/
+/*	$NetBSD: machdep.c,v 1.10 2011/06/14 05:32:59 matt Exp $	*/
 /*-
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -93,12 +93,34 @@
 #include 
 #endif
 
+struct uboot_bdinfo {
+	uint32_t bd_memstart;
+	uint32_t bd_memsize;
+	uint32_t bd_flashstart;
+	uint32_t bd_flashsize;
+/*10*/	uint32_t bd_flashoffset;
+	uint32_t bd_sramstart;
+	uint32_t bd_sramsize;
+	uint32_t bd_immrbase;
+/*20*/	uint32_t bd_bootflags;
+	uint32_t bd_ipaddr;
+	uint8_t bd_etheraddr[6];
+	uint16_t bd_ethspeed;
+/*30*/	uint32_t bd_intfreq;
+	uint32_t bd_cpufreq;
+	uint32_t bd_baudrate;
+/*3c*/	uint8_t bd_etheraddr1[6];
+/*42*/	uint8_t bd_etheraddr2[6];
+/*48*/	uint8_t bd_etheraddr3[6];
+/*4e*/	uint16_t bd_pad;
+};
+
 /*
  * booke kernels need to set module_machine to this for modules to work.
  */
 char module_machine_booke[] = "powerpc-booke";
 
-void	initppc(vaddr_t, vaddr_t);
+void	initppc(vaddr_t, vaddr_t, void *, void *, void *, void *);
 
 #define	MEMREGIONS	4
 phys_ram_seg_t physmemr[MEMREGIONS]; /* All memory */
@@ -746,13 +768,15 @@
 }
 
 void
-initppc(vaddr_t startkernel, vaddr_t endkernel)
+initppc(vaddr_t startkernel, vaddr_t endkernel,
+	void *a0, void *a1, void *a2, void *a3)
 {
 	struct cpu_info * const ci = curcpu();
 	struct cpu_softc * const cpu = ci->ci_softc;
 
 	cn_tab = &e500_earlycons;
-	printf(" initppc");
+	printf(" initppc(%#"PRIxVADDR", %#"PRIxVADDR", %p, %p, %p, %p)",
+	startkernel, endkernel, a0, a1, a2, a3);
 
 	const register_t hid0 = mfspr(SPR_HID0);
 	mtspr(SPR_HID0, hid0 | HID0_TBEN | HID0_EMCP);



CVS commit: src/sys/arch/evbppc/mpc85xx

2011-06-07 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Jun  8 05:09:21 UTC 2011

Modified Files:
src/sys/arch/evbppc/mpc85xx: mpc85xx_start.S

Log Message:
Cleanup register use so that r5-r8 are preserved.  Take advantage of
changes to INIT_CPUINFO (it now saves curcpu to L_CPU(%r13)).


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/evbppc/mpc85xx/mpc85xx_start.S

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/evbppc/mpc85xx/mpc85xx_start.S
diff -u src/sys/arch/evbppc/mpc85xx/mpc85xx_start.S:1.3 src/sys/arch/evbppc/mpc85xx/mpc85xx_start.S:1.4
--- src/sys/arch/evbppc/mpc85xx/mpc85xx_start.S:1.3	Sun Jun  5 16:52:23 2011
+++ src/sys/arch/evbppc/mpc85xx/mpc85xx_start.S	Wed Jun  8 05:09:21 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: mpc85xx_start.S,v 1.3 2011/06/05 16:52:23 matt Exp $	*/
+/*	$NetBSD: mpc85xx_start.S,v 1.4 2011/06/08 05:09:21 matt Exp $	*/
 /*-
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -37,7 +37,7 @@
 #include 
 #include 
 
-RCSID("$NetBSD: mpc85xx_start.S,v 1.3 2011/06/05 16:52:23 matt Exp $")
+RCSID("$NetBSD: mpc85xx_start.S,v 1.4 2011/06/08 05:09:21 matt Exp $")
 
 #include "opt_altivec.h"
 #include "opt_ddb.h"
@@ -125,7 +125,7 @@
 /* zero bss */
 	sub	%r17,%r16,%r15
 	addi	%r17,%r17,3+USPACE
-	rlwinm	%r3,%r17,32-2,2,31	/* srwl	%r0,%r0,2 */
+	rlwinm	%r3,%r17,32-2,2,31	/* srwl	%r3,%r17,2 */
 	mtctr	%r3
 	li	%r0,0
 2:	stwu	%r0,4(%r15)
@@ -133,12 +133,10 @@
 
 #if NKSYMS || defined(DDB) || defined(MODULAR)
 	/* If we had symbol table location we'd store it here and would've adjusted r8 here */
-	lis	%r7,_C_LABEL(startsym)@ha
-	addi	%r7,%r7,_C_LABEL(startsym)@l
-	stw	%r8,0(%r7)
-	lis	%r7,_C_LABEL(endsym)@ha
-	addi	%r7,%r7,_C_LABEL(endsym)@l
-	stw	%r8,0(%r7)
+	lis	%r17,_C_LABEL(startsym)@ha
+	stw	%r18,_C_LABEL(startsym)@l(%r17)
+	lis	%r17,_C_LABEL(endsym)@ha
+	stw	%r18,_C_LABEL(endsym)@l(%r17)
 #endif
 
 	/* Set kernel MMU context. */
@@ -146,16 +144,16 @@
 	mtpid	%r0
 	isync
 
-	INIT_CPUINFO(16,1,9,20)
-	mr	%r4,%r16
-	mfsprg0	%r21
-	lwz	%r20,CI_CURLWP(%r21)
-	mtsprg2	%r20
-	stw	%r21,L_CPU(%r20)
-	addi	%r21,%r21,CI_SAVELIFO
-	mtsprg3 %r21
-	mr	%r20,%r31		/* make deadbeef again */
-	mr	%r21,%r31		/* make deadbeef again */
+	INIT_CPUINFO(16,1,18,17)	/* r16 has &_end */
+	mr	%r4,%r16		/* remember kernelend */
+	mtsprg2	%r13			/* r13 has &lwp0, put into sprg2 */
+	GET_CPUINFO(%r17)
+	addi	%r17,%r17,CI_SAVELIFO
+	mtsprg3 %r17
+	mr	%r18,%r31		/* make deadbeef again */
+	mr	%r17,%r31		/* make deadbeef again */
+	mr	%r16,%r31		/* make deadbeef again */
+	mr	%r15,%r31		/* make deadbeef again */
 
 #if defined(GXEMUL)
 	/*



CVS commit: src/sys/arch/evbppc/mpc85xx

2011-05-27 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat May 28 05:21:40 UTC 2011

Modified Files:
src/sys/arch/evbppc/mpc85xx: machdep.c

Log Message:
allow configuring multiple CPUs (still needs work).
Detect boot page on MP e500 CPUs (P2020, MPC8572, etc) and prevent use of
that page in NetBSD.  This page is used to communicate with u-boot to spin
up secondary CPUs.
Probe LBC before PCI so that LBC attached devices can be configured before
probing the PCI.  This gives a chance to download/setup PCI Express switches
before probing/configuring PCI.
Fix PIXIS speed entry bug/typo.
Rework SYS_CLK logic so that the SYS_CLK config option has the highest priority.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/evbppc/mpc85xx/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/evbppc/mpc85xx/machdep.c
diff -u src/sys/arch/evbppc/mpc85xx/machdep.c:1.5 src/sys/arch/evbppc/mpc85xx/machdep.c:1.6
--- src/sys/arch/evbppc/mpc85xx/machdep.c:1.5	Thu Feb 17 13:57:12 2011
+++ src/sys/arch/evbppc/mpc85xx/machdep.c	Sat May 28 05:21:40 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.5 2011/02/17 13:57:12 matt Exp $	*/
+/*	$NetBSD: machdep.c,v 1.6 2011/05/28 05:21:40 matt Exp $	*/
 /*-
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -136,10 +136,15 @@
 
 const bus_space_handle_t gur_bsh = (bus_space_handle_t)(uintptr_t)(GUR_BASE);
 
+#if defined(SYS_CLK)
+static uint64_t e500_sys_clk = SYS_CLK;
+#endif
 #ifdef CADMUS
 static uint8_t cadmus_pci;
 static uint8_t cadmus_csr;
+#ifndef SYS_CLK
 static uint64_t e500_sys_clk = ; /* 33.33Mhz */
+#endif
 #elif defined(PIXIS)
 static const uint32_t pixis_spd_map[8] = {
 [PX_SPD_33MHZ] = ,
@@ -147,15 +152,15 @@
 [PX_SPD_50MHZ] = 5000,
 [PX_SPD_66MHZ] = ,
 [PX_SPD_83MHZ] = 8333,
-[PX_SPD_133MHZ] = 1,
+[PX_SPD_100MHZ] = 1,
 [PX_SPD_133MHZ] = 1,
 [PX_SPD_166MHZ] = 16667,
 };
 static uint8_t pixis_spd;
+#ifndef SYS_CLK
 static uint64_t e500_sys_clk;
-#elif defined(SYS_CLK)
-static uint64_t e500_sys_clk = SYS_CLK;
-#else
+#endif
+#elif !defined(SYS_CLK)
 static uint64_t e500_sys_clk = 6667; /* 66.67Mhz */
 #endif
 
@@ -172,7 +177,14 @@
  * List of port-specific devices to attach to the processor local bus.
  */
 static const struct cpunode_locators mpc8548_cpunode_locs[] = {
-	{ "cpu" },	/* not a real device */
+	{ "cpu", 0, 0, 0, 0, { 0 }, 0,	/* not a real device */
+		{ 0x, SVR_MPC8572v1 >> 16, SVR_P2020v2 >> 16 } },
+#if defined(MPC8572) || defined(P2020)
+	{ "cpu", 0, 0, 1, 0, { 0 }, 0,	/* not a real device */
+		{ SVR_MPC8572v1 >> 16, SVR_P2020v2 >> 16 } },
+	{ "cpu", 0, 0, 2, 0, { 0 }, 0,	/* not a real device */
+		{ SVR_MPC8572v1 >> 16, SVR_P2020v2 >> 16 } },
+#endif
 	{ "wdog" },	/* not a real device */
 	{ "duart", DUART1_BASE, 2*DUART_SIZE, 0,
 		1, { ISOURCE_DUART },
@@ -234,6 +246,9 @@
 		1 + ilog2(DEVDISR_DDR2_14),
 		{ SVR_MPC8572v1 >> 16 } },
 #endif
+	{ "lbc", LBC_BASE, LBC_SIZE, 0,
+		1, { ISOURCE_LBC },
+		1 + ilog2(DEVDISR_LBC) },
 #if defined(MPC8544) || defined(MPC8536)
 	{ "pcie", PCIE1_BASE, PCI_SIZE, 1,
 		1, { ISOURCE_PCIEX },
@@ -322,9 +337,6 @@
 		1 + ilog2(DEVDISR_ESDHC_10),
 		{ SVR_P2020v2 >> 16 }, },
 #endif
-	{ "lbc", LBC_BASE, LBC_SIZE, 0,
-		1, { ISOURCE_LBC },
-		1 + ilog2(DEVDISR_LBC) },
 	//{ "sec", RNG_BASE, RNG_SIZE, 0, 0, },
 	{ NULL }
 };
@@ -380,6 +392,16 @@
 memprobe(vaddr_t endkernel)
 {
 	phys_ram_seg_t *mr;
+	paddr_t boot_page = cpu_read_4(GUR_BPTR);
+	printf(" bptr=%"PRIxPADDR, boot_page);
+	if (boot_page & BPTR_EN) {
+		/*
+		 * shift it to an address
+		 */
+		boot_page = (boot_page & BPTR_BOOT_PAGE) << PAGE_SHIFT;
+	} else {
+		boot_page = ~(paddr_t)0;
+	}
 
 	/*
 	 * First we need to find out how much physical memory we have.
@@ -392,8 +414,14 @@
 		uint32_t v = cpu_read_4(DDRC1_BASE + CS_CONFIG(i));
 		if (v & CS_CONFIG_EN) {
 			v = cpu_read_4(DDRC1_BASE + CS_BNDS(i));
+			if (v == 0)
+continue;
 			mr->start = BNDS_SA_GET(v);
 			mr->size  = BNDS_SIZE_GET(v);
+#if 0
+			printf(" [%zd]={%#"PRIx64"@%#"PRIx64"}",
+			mr - physmemr, mr->size, mr->start);
+#endif
 			mr++;
 		}
 	}
@@ -442,6 +470,38 @@
 	availmemr[0].size -= endkernel - availmemr[0].start;
 	availmemr[0].start = endkernel;
 
+	mr = availmemr;
+	for (u_int i = 0; i < cnt; i++, mr++) {
+		/*
+		 * U-boot reserves a boot-page on multi-core chips.
+		 * We need to make sure that we never disturb it.
+		 */
+		const paddr_t mr_end = mr->start + mr->size;
+		if (mr_end > boot_page && boot_page >= mr->start) {
+			/*
+			 * Normally u-boot will put in at the end
+			 * of memory.  But in case it doesn't, deal
+			 * with all possibilities.
+			 */
+			if (boot_page + PAGE_SIZE == mr_end) {
+mr->size -= PAGE_SIZE;
+			} else if (boot_page == mr->start) {
+mr->start += PAGE_SIZE;
+	

CVS commit: src/sys/arch/evbppc/mpc85xx

2011-02-17 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Feb 17 13:57:12 UTC 2011

Modified Files:
src/sys/arch/evbppc/mpc85xx: autoconf.c machdep.c

Log Message:
Support a little bus_space for mapping the GUR registers since some
devices use little endian registers.  Add MPC8533 support.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/evbppc/mpc85xx/autoconf.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/evbppc/mpc85xx/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/evbppc/mpc85xx/autoconf.c
diff -u src/sys/arch/evbppc/mpc85xx/autoconf.c:1.2 src/sys/arch/evbppc/mpc85xx/autoconf.c:1.3
--- src/sys/arch/evbppc/mpc85xx/autoconf.c:1.2	Tue Jan 18 01:10:25 2011
+++ src/sys/arch/evbppc/mpc85xx/autoconf.c	Thu Feb 17 13:57:12 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: autoconf.c,v 1.2 2011/01/18 01:10:25 matt Exp $	*/
+/*	$NetBSD: autoconf.c,v 1.3 2011/02/17 13:57:12 matt Exp $	*/
 /*-
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.2 2011/01/18 01:10:25 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.3 2011/02/17 13:57:12 matt Exp $");
 
 #define __INTR_PRIVATE
 
@@ -121,6 +121,7 @@
 	ma.ma_name = "cpunode";
 	ma.ma_node = 0;
 	ma.ma_memt = curcpu()->ci_softc->cpu_bst;
+	ma.ma_le_memt = curcpu()->ci_softc->cpu_le_bst;
 	ma.ma_dmat = &booke_bus_dma_tag;
 
 	config_found_sm_loc(self, "mainbus", NULL, &ma, mainbus_print, NULL);

Index: src/sys/arch/evbppc/mpc85xx/machdep.c
diff -u src/sys/arch/evbppc/mpc85xx/machdep.c:1.4 src/sys/arch/evbppc/mpc85xx/machdep.c:1.5
--- src/sys/arch/evbppc/mpc85xx/machdep.c:1.4	Sun Feb 13 05:03:27 2011
+++ src/sys/arch/evbppc/mpc85xx/machdep.c	Thu Feb 17 13:57:12 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.4 2011/02/13 05:03:27 matt Exp $	*/
+/*	$NetBSD: machdep.c,v 1.5 2011/02/17 13:57:12 matt Exp $	*/
 /*-
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -128,6 +128,12 @@
 	.pbs_limit = GUR_SIZE,
 };
 
+struct powerpc_bus_space gur_le_bst = {
+	.pbs_flags = _BUS_SPACE_LITTLE_ENDIAN|_BUS_SPACE_MEM_TYPE,
+	.pbs_offset = GUR_BASE,
+	.pbs_limit = GUR_SIZE,
+};
+
 const bus_space_handle_t gur_bsh = (bus_space_handle_t)(uintptr_t)(GUR_BASE);
 
 #ifdef CADMUS
@@ -522,6 +528,7 @@
 {
 	svr &= ~0x8;	/* clear security bit */
 	switch (svr >> 8) {
+	case SVR_MPC8533 >> 8: return "MPC8533";
 	case SVR_MPC8536v1 >> 8: return "MPC8536";
 	case SVR_MPC8541v1 >> 8: return "MPC8541";
 	case SVR_MPC8543v2 >> 8: return "MPC8543";
@@ -696,7 +703,9 @@
 	CTASSERT(offsetof(struct tlb_md_ops, md_tlb_mapiodev) == 0);
 	cpu_md_ops.md_tlb_ops = (const void *)&early_tlb_mapiodev;
 	bus_space_init(&gur_bst, NULL, NULL, 0);
+	bus_space_init(&gur_le_bst, NULL, NULL, 0);
 	cpu->cpu_bst = &gur_bst;
+	cpu->cpu_le_bst = &gur_le_bst;
 	cpu->cpu_bsh = gur_bsh;
 
 	/*
@@ -735,6 +744,7 @@
 	 * Now find out how much memory is attached
 	 */
 	pmemsize = memprobe(endkernel);
+	cpu->cpu_highmem = pmemsize;
 		printf(" memprobe=%zuMB", (size_t) (pmemsize >> 20));
 
 	/*
@@ -1020,13 +1030,13 @@
 	switch (svr) {
 #if defined(MPC8536)
 	case SVR_MPC8536v1 >> 16:
-		mpc85xx_pci_setup("pci1-interrupt-map", 0x001800, IST_LEVEL,
+		mpc85xx_pci_setup("pci0-interrupt-map", 0x001800, IST_LEVEL,
 		1, 2, 3, 4);
 		break;
 #endif
 #if defined(MPC8544)
 	case SVR_MPC8544v1 >> 16:
-		mpc85xx_pci_setup("pci1-interrupt-map", 0x001800, IST_LEVEL,
+		mpc85xx_pci_setup("pci0-interrupt-map", 0x001800, IST_LEVEL,
 		0, 1, 2, 3);
 		break;
 #endif



CVS commit: src/sys/arch/evbppc/mpc85xx

2011-02-12 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sun Feb 13 05:03:27 UTC 2011

Modified Files:
src/sys/arch/evbppc/mpc85xx: machdep.c

Log Message:
Fix some typos.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/evbppc/mpc85xx/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/evbppc/mpc85xx/machdep.c
diff -u src/sys/arch/evbppc/mpc85xx/machdep.c:1.3 src/sys/arch/evbppc/mpc85xx/machdep.c:1.4
--- src/sys/arch/evbppc/mpc85xx/machdep.c:1.3	Tue Feb  8 06:22:29 2011
+++ src/sys/arch/evbppc/mpc85xx/machdep.c	Sun Feb 13 05:03:27 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.3 2011/02/08 06:22:29 matt Exp $	*/
+/*	$NetBSD: machdep.c,v 1.4 2011/02/13 05:03:27 matt Exp $	*/
 /*-
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -250,15 +250,15 @@
 	{ "pcie", PCIE1_BASE, PCI_SIZE, 0,
 		1, { ISOURCE_PCIEX },
 		1 + ilog2(DEVDISR_PCIE),
-		{ SVR_MPC8538v1 >> 16 }, },
+		{ SVR_MPC8548v1 >> 16 }, },
 	{ "pci", PCIX1_MPC8548_BASE, PCI_SIZE, 1,
 		1, { ISOURCE_PCI1 },
 		1 + ilog2(DEVDISR_PCI1),
-		{ SVR_MPC8538v1 >> 16 }, },
+		{ SVR_MPC8548v1 >> 16 }, },
 	{ "pci", PCIX2_MPC8548_BASE, PCI_SIZE, 2,
 		1, { ISOURCE_PCI2 },
 		1 + ilog2(DEVDISR_PCI2),
-		{ SVR_MPC8538v1 >> 16 }, },
+		{ SVR_MPC8548v1 >> 16 }, },
 #endif
 #if defined(MPC8572) || defined(P2020)
 	{ "pcie", PCIE1_BASE, PCI_SIZE, 1,