Subject: fpu attachment change (Re: NetBSD 3.1 on a Powerbook 180)
To: None <port-mac68k@NetBSD.org>
From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
List: port-mac68k
Date: 05/27/2007 18:12:32
I wrote:

> BTW, after yamt-idlelwp merge a FPU_EMULATE kernel panics before
> cpu_configure(9) is called because savectx() (which refers fpu_type)
> is now called before fpu is attached in configure.

I've just changes fpu initialized in mac68k/machdep.c:identifycpu()
rather than to attach fpu as usual devices. Any comments?
---
Izumi Tsutsui


Index: conf/GENERIC
===================================================================
RCS file: /cvsroot/src/sys/arch/mac68k/conf/GENERIC,v
retrieving revision 1.179
diff -u -r1.179 GENERIC
--- conf/GENERIC	6 Mar 2007 11:28:47 -0000	1.179
+++ conf/GENERIC	27 May 2007 09:08:03 -0000
@@ -201,8 +201,6 @@
 
 mainbus0 at root
 
-fpu0 at mainbus?			# Floating-Point Coprocessor support
-
 
 # Basic Bus Support
 
Index: conf/INSTALL
===================================================================
RCS file: /cvsroot/src/sys/arch/mac68k/conf/INSTALL,v
retrieving revision 1.40
diff -u -r1.40 INSTALL
--- conf/INSTALL	29 Dec 2006 21:49:03 -0000	1.40
+++ conf/INSTALL	27 May 2007 09:08:03 -0000
@@ -95,8 +95,6 @@
 
 mainbus0 at root
 
-fpu0 at mainbus?			# Floating-Point Coprocessor support
-
 
 # Basic Bus Support
 
Index: conf/SMALLRAM
===================================================================
RCS file: /cvsroot/src/sys/arch/mac68k/conf/SMALLRAM,v
retrieving revision 1.27
diff -u -r1.27 SMALLRAM
--- conf/SMALLRAM	26 Aug 2006 20:26:55 -0000	1.27
+++ conf/SMALLRAM	27 May 2007 09:08:03 -0000
@@ -169,8 +169,6 @@
 
 mainbus0 at root
 
-fpu0 at mainbus?			# Floating-Point Coprocessor support
-
 
 # Basic Bus Support
 
Index: conf/files.mac68k
===================================================================
RCS file: /cvsroot/src/sys/arch/mac68k/conf/files.mac68k,v
retrieving revision 1.116
diff -u -r1.116 files.mac68k
--- conf/files.mac68k	8 Mar 2007 02:24:39 -0000	1.116
+++ conf/files.mac68k	27 May 2007 09:08:03 -0000
@@ -143,22 +143,18 @@
 file	dev/ic/z8530tty.c		zstty needs-flag
 file	arch/mac68k/dev/zs_kgdb.c	kgdb
 
-# This one is out of alphabetical order
-device	fpu
-attach	fpu at mainbus
-file	arch/mac68k/mac68k/fpu.c	fpu
-
-include "arch/m68k/fpe/files.fpe"
-
 # legitimate pseudo-devices
 defpseudo grf
 defpseudo ite
 
+include "arch/m68k/fpe/files.fpe"
+
 file	arch/mac68k/mac68k/autoconf.c
 file	arch/mac68k/mac68k/bus_space.c
 file	arch/mac68k/mac68k/clock.c
 file	arch/mac68k/mac68k/conf.c
 file	arch/mac68k/mac68k/disksubr.c		disk
+file	arch/mac68k/mac68k/fpu.c
 file	arch/mac68k/mac68k/intr.c
 file	arch/mac68k/mac68k/iop.c
 file	arch/mac68k/mac68k/machdep.c
Index: include/cpu.h
===================================================================
RCS file: /cvsroot/src/sys/arch/mac68k/include/cpu.h,v
retrieving revision 1.86
diff -u -r1.86 cpu.h
--- include/cpu.h	21 May 2007 16:37:03 -0000	1.86
+++ include/cpu.h	27 May 2007 09:08:04 -0000
@@ -358,6 +358,9 @@
 int	suline(void *, void *);
 void	loadustp(int);
 
+/* fpu.c */
+void	initfpu(void);
+
 #endif
 
 #endif	/* _CPU_MACHINE_ */
Index: mac68k/fpu.c
===================================================================
RCS file: /cvsroot/src/sys/arch/mac68k/mac68k/fpu.c,v
retrieving revision 1.35
diff -u -r1.35 fpu.c
--- mac68k/fpu.c	24 Dec 2005 22:45:35 -0000	1.35
+++ mac68k/fpu.c	27 May 2007 09:08:04 -0000
@@ -50,7 +50,6 @@
 #include <sys/systm.h>
 #include <sys/time.h>
 #include <sys/kernel.h>
-#include <sys/device.h>
 
 #include <machine/psl.h>
 #include <machine/cpu.h>
@@ -62,19 +61,8 @@
 
 extern label_t *nofault;
 
-static int  fpu_match(struct device *, struct cfdata *, void *);
-static void fpu_attach(struct device *, struct device *, void *);
 static int  fpu_probe(void);
 
-CFATTACH_DECL(fpu, sizeof(struct device),
-    fpu_match, fpu_attach, NULL, NULL);
-
-static int
-fpu_match(struct device *parent, struct cfdata *cf, void *aux)
-{
-	return 1;
-}
-
 static const char *fpu_descr[] = {
 #ifdef	FPU_EMULATE
 	"emulator", 		/* 0 */
@@ -87,8 +75,8 @@
 	"mc68060",			/* 4 */
 	"unknown" };
 
-static void
-fpu_attach(struct device *parent, struct device *self, void *args)
+void
+initfpu(void)
 {
 	const char *descr;
 
@@ -103,7 +91,7 @@
 	else
 		descr = "unknown type";
 
-	printf(" (%s)\n", descr);
+	printf("fpu: %s\n", descr);
 }
 
 static int
Index: mac68k/machdep.c
===================================================================
RCS file: /cvsroot/src/sys/arch/mac68k/mac68k/machdep.c,v
retrieving revision 1.315
diff -u -r1.315 machdep.c
--- mac68k/machdep.c	21 May 2007 15:22:22 -0000	1.315
+++ mac68k/machdep.c	27 May 2007 09:08:04 -0000
@@ -2010,6 +2010,7 @@
 	    mpu);
 	printf("%s\n", cpu_model);
 	printf("cpu: delay factor %d\n", delay_factor);
+	initfpu();
 }
 
 static void	get_machine_info(void);