Subject: Re: configure() with valid context
To: None <eeh@netbsd.org>
From: Jason Thorpe <thorpej@nas.nasa.gov>
List: tech-kern
Date: 09/16/1999 11:02:34
On Thu, 16 Sep 1999 08:53:00 -0700 (PDT) 
 "Eduardo E. Horvath" <eeh@one-o.com> wrote:

 > Yes, I object (I'm surprised pk hasen't also).  initclocks() is supposed
 > to fire up the clock interrupt, which means it needs access to the clock
 > hardware.  In order to call initclocks() you need to have the clocks
 > probed and attached, which is done in configure().  

Hi, yes, I noticed this when I tried to boot on an alpha, and I have since
fixed the problem.  I suppose I should attach my current diff below...

        -- Jason R. Thorpe <thorpej@nas.nasa.gov>

Index: init_main.c
===================================================================
RCS file: /cvsroot/syssrc/sys/kern/init_main.c,v
retrieving revision 1.155
diff -u -r1.155 init_main.c
--- init_main.c	1999/09/15 18:10:34	1.155
+++ init_main.c	1999/09/16 18:01:55
@@ -209,12 +209,14 @@
 	/* Initialize sockets. */
 	soinit();
 
-	disk_init();		/* must come before autoconfiguration */
-	tty_init();		/* initialise tty list */
+	/*
+	 * The following 3 things must be done before autoconfiguration.
+	 */
+	disk_init();		/* initialize disk list */
+	tty_init();		/* initialize tty list */
 #if NRND > 0
-	rnd_init();
+	rnd_init();		/* initialize RNG */
 #endif
-	configure();		/* configure the hardware */
 
 	/*
 	 * Initialize process and pgrp structures.
@@ -318,8 +320,8 @@
 #endif
 	vfsinit();
 
-	/* Start real time and statistics clocks. */
-	initclocks();
+	/* Configure the system hardware.  This will enable interrupts. */
+	configure();
 
 #ifdef SYSVSHM
 	/* Initialize System V style shared memory. */
Index: subr_autoconf.c
===================================================================
RCS file: /cvsroot/syssrc/sys/kern/subr_autoconf.c,v
retrieving revision 1.42
diff -u -r1.42 subr_autoconf.c
--- subr_autoconf.c	1999/09/15 19:37:08	1.42
+++ subr_autoconf.c	1999/09/16 18:01:56
@@ -123,6 +123,12 @@
 	config_interrupts_enabled = 1;
 
 	/*
+	 * Now that we've found all the hardware, start the real time
+	 * and statistics clocks.
+	 */
+	initclocks();
+
+	/*
 	 * Now callback to finish configuration for devices which want
 	 * to do this once interrupts are enabled.
 	 */