Subject: order of initialization in machdep.c
To: None <port-powerpc@NetBSD.org>
From: Klaus Heinz <k.heinz.okt.vier@onlinehome.de>
List: port-powerpc
Date: 10/17/2004 11:02:01
--mYCpIKhGyMATD0i+
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Hi,

NetBSD/bebox has been broken for me for quite some time. Although
the machine started from the boot floppy I created, it always stopped
after decompressing the kernel and printing the start adress of the
kernel:

  Boot: Loading in()
  2295896+284064 [124704+113718]=0x2b0404
  start=0x3100

Tonight I discovered that it always crashed/hung somewhere in
machdep.c:consinit(). Because I had no clue about what I was doing I
compared machdep.c for the BeBox with the corresponding file for port
PReP since they are very similar.

With revision 1.50 of prep/machdep.c the calling order of
prep_bus_space_init(), consinit(), oea_batinit(), oea_init() was
changed. Bebox/machdep.c did not follow that and after I applied this
change I could see the configuration output from the kernel again, up
until the error messages for the IDE drive, but that's a different
problem.

Is it ok to the change to bebox/machdep.c so that bebox_bus_space_init()
and consinit() are now called after oea_batinit() and oea_init()?

The order of the arguments of oea_batinit() is different between
NetBSD/prep and NetBSD/bebox. Is this difference significant? If not I
would like to change it for the BeBox to be the same as PReP.

Port PReP installs the interrupt handler after prep_bus_space_init() and
consinit(), port BeBox did it directly in oea_init() and thus it is now
done before bebox_bus_space_init()/consinit(). Does this matter in any
way?


ciao
     Klaus

--mYCpIKhGyMATD0i+
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="bebox_machdep.c.diff"

--- machdep.c.orig	Sat Mar 13 18:31:33 2004
+++ machdep.c	Sun Oct 17 10:36:20 2004
@@ -187,18 +187,6 @@
 	boothowto = args;
 
 	/*
-	 * Init the I/O stuff before the console
-	 */
-	bebox_bus_space_init();
-
-	/*
-	 * i386 port says, that this shouldn't be here,
-	 * but I really think the console should be initialized
-	 * as early as possible.
-	 */
-	consinit();
-
-	/*
 	 * Set up initial BAT table
 	 */
 	oea_batinit(
@@ -210,6 +198,18 @@
 	 * Initialize the vector table and interrupt routine.
 	 */
 	oea_init(ext_intr);
+
+	/*
+	 * Init the I/O stuff before the console
+	 */
+	bebox_bus_space_init();
+
+	/*
+	 * i386 port says, that this shouldn't be here,
+	 * but I really think the console should be initialized
+	 * as early as possible.
+	 */
+	consinit();
 
         /*
 	 * Set the page size.

--mYCpIKhGyMATD0i+--