Subject: Re: Long delays during bootup in -current
To: None <port-macppc@NetBSD.org>
From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
List: port-macppc
Date: 10/18/2006 00:12:43
sanjayl@kymasys.com wrote:

> That fixed it!

Is it okay to commit the attached patch?

(though some other powerpc ports set PSL_EE in cpu_startup()
 after splraise(-1))
---
Izumi Tsutsui


Index: macppc/autoconf.c
===================================================================
RCS file: /cvsroot/src/sys/arch/macppc/macppc/autoconf.c,v
retrieving revision 1.48
diff -u -r1.48 autoconf.c
--- macppc/autoconf.c	29 Sep 2006 22:20:08 -0000	1.48
+++ macppc/autoconf.c	17 Oct 2006 15:06:14 -0000
@@ -69,7 +69,6 @@
 void
 cpu_configure()
 {
-	int msr;
 
 	init_interrupt();
 	canonicalize_bootpath();
@@ -78,12 +77,6 @@
 		panic("configure: mainbus not configured");
 
 	(void)spl0();
-
-	/*
-	 * Now allow hardware interrupts.
-	 */
-	__asm volatile ("mfmsr %0; ori %0,%0,%1; mtmsr %0"
-		      : "=r"(msr) : "K"(PSL_EE|PSL_RI));
 }
 
 void
Index: macppc/clock.c
===================================================================
RCS file: /cvsroot/src/sys/arch/macppc/macppc/clock.c,v
retrieving revision 1.32
diff -u -r1.32 clock.c
--- macppc/clock.c	13 Oct 2006 14:17:37 -0000	1.32
+++ macppc/clock.c	17 Oct 2006 15:06:14 -0000
@@ -70,6 +70,7 @@
 cpu_initclocks(void)
 {
 	struct cpu_info * const ci = curcpu();
+	uint32_t msr;
 
 	ticks_per_intr = ticks_per_sec / hz;
 	cpu_timebase = ticks_per_sec;
@@ -80,6 +81,12 @@
 		__asm volatile ("mftb %0" : "=r"(ci->ci_lasttb));
 	__asm volatile ("mtdec %0" :: "r"(ticks_per_intr));
 	init_macppc_tc();
+
+	/*
+	 * Now allow hardware interrupts.
+	 */
+	__asm volatile ("mfmsr %0; ori %0,%0,%1; mtmsr %0"
+	    : "=r"(msr) : "K"(PSL_EE|PSL_RI));
 }
 
 /*
@@ -105,12 +112,6 @@
 	int nticks;
 
 	/*
-	 * Check whether we are initialized.
-	 */
-	if (cold)
-		return;
-		
-	/*
 	 * Based on the actual time delay since the last decrementer reload,
 	 * we arrange for earlier interrupt next time.
 	 */