Module Name:    src
Committed By:   tsutsui
Date:           Tue Nov 15 13:25:44 UTC 2011

Modified Files:
        src/sys/arch/luna68k/conf: files.luna68k
        src/sys/arch/luna68k/luna68k: locore.s machdep.c

Log Message:
Use now common fpu_probe() and print FPU type per probe result since
it turns out that server and high-end LUNA models actually have MC68882,
not MC68881 as basic and standard models:
http://www.h2.dion.ne.jp/~dogs/collect/ds/luna.html

Also put LUNA model names into cpu_model[] for sysctl(3).
(maybe we don't have to consider sysctl backward compatibility on this port ;-)


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/luna68k/conf/files.luna68k
cvs rdiff -u -r1.44 -r1.45 src/sys/arch/luna68k/luna68k/locore.s
cvs rdiff -u -r1.85 -r1.86 src/sys/arch/luna68k/luna68k/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/luna68k/conf/files.luna68k
diff -u src/sys/arch/luna68k/conf/files.luna68k:1.22 src/sys/arch/luna68k/conf/files.luna68k:1.23
--- src/sys/arch/luna68k/conf/files.luna68k:1.22	Sun Jun 12 03:35:43 2011
+++ src/sys/arch/luna68k/conf/files.luna68k	Tue Nov 15 13:25:44 2011
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: files.luna68k,v 1.22 2011/06/12 03:35:43 rmind Exp $
+#	$NetBSD: files.luna68k,v 1.23 2011/11/15 13:25:44 tsutsui Exp $
 #
 maxpartitions 8
 maxusers 2 8 64
@@ -16,6 +16,7 @@ file arch/luna68k/luna68k/pmap_bootstrap
 file arch/luna68k/luna68k/trap.c
 file arch/m68k/m68k/cacheops.c
 file arch/m68k/m68k/db_memrw.c		ddb | kgdb
+file arch/m68k/m68k/fpu.c
 file arch/m68k/m68k/pmap_motorola.c
 file arch/m68k/m68k/procfs_machdep.c	procfs
 file arch/m68k/m68k/sys_machdep.c

Index: src/sys/arch/luna68k/luna68k/locore.s
diff -u src/sys/arch/luna68k/luna68k/locore.s:1.44 src/sys/arch/luna68k/luna68k/locore.s:1.45
--- src/sys/arch/luna68k/luna68k/locore.s:1.44	Tue Nov 15 10:57:02 2011
+++ src/sys/arch/luna68k/luna68k/locore.s	Tue Nov 15 13:25:44 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: locore.s,v 1.44 2011/11/15 10:57:02 tsutsui Exp $ */
+/* $NetBSD: locore.s,v 1.45 2011/11/15 13:25:44 tsutsui Exp $ */
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -281,6 +281,9 @@ Lenab1:
 	movl	#USRSTACK-4,%a2
 	movl	%a2,%usp		| init user SP
 
+/* detect FPU type */
+	jbsr	_C_LABEL(fpu_probe)
+	movl	%d0,_C_LABEL(fputype)
 	tstl	_C_LABEL(fputype)	| Have an FPU?
 	jeq	Lenab2			| No, skip.
 	clrl	%a1@(PCB_FPCTX)		| ensure null FP context

Index: src/sys/arch/luna68k/luna68k/machdep.c
diff -u src/sys/arch/luna68k/luna68k/machdep.c:1.85 src/sys/arch/luna68k/luna68k/machdep.c:1.86
--- src/sys/arch/luna68k/luna68k/machdep.c:1.85	Sat Nov 12 13:44:26 2011
+++ src/sys/arch/luna68k/luna68k/machdep.c	Tue Nov 15 13:25:44 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.85 2011/11/12 13:44:26 tsutsui Exp $ */
+/* $NetBSD: machdep.c,v 1.86 2011/11/15 13:25:44 tsutsui Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include <sys/cdefs.h>			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.85 2011/11/12 13:44:26 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.86 2011/11/15 13:25:44 tsutsui Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -95,7 +95,7 @@ __KERNEL_RCSID(0, "$NetBSD: machdep.c,v 
  * Info for CTL_HW
  */
 char	machine[] = MACHINE;
-char	cpu_model[60];
+char	cpu_model[120];
 
 /* Our exported CPU info; we can have only one. */  
 struct cpu_info cpu_info_store;
@@ -284,13 +284,28 @@ void
 identifycpu(void)
 {
 	extern int cputype;
-	const char *cpu, *model;
+	const char *model, *fpu;
 
 	memset(cpu_model, 0, sizeof(cpu_model));
 	switch (cputype) {
 	case CPU_68030:
 		model ="LUNA-I";
-		cpu = "MC68030 CPU+MMU, MC68881 FPU";
+		switch (fputype) {
+		case FPU_68881:
+			fpu = "MC68881";
+			break;
+		case FPU_68882:
+			fpu = "MC68882";
+			break;
+		case FPU_NONE:
+			fpu = "no";
+			break;
+		default:
+			fpu = "unknown";
+			break;
+		}
+		snprintf(cpu_model, sizeof(cpu_model),
+		    "%s (MC68030 CPU+MMU, %s FPU)", model, fpu);
 		machtype = LUNA_I;
 		/* 20MHz 68030 */
 		cpuspeed = 20;
@@ -300,7 +315,9 @@ identifycpu(void)
 #if defined(M68040)
 	case CPU_68040:
 		model ="LUNA-II";
-		cpu = "MC68040 CPU+MMU+FPU, 4k on-chip physical I/D caches";
+		snprintf(cpu_model, sizeof(cpu_model),
+		    "%s (MC68040 CPU+MMU+FPU, 4k on-chip physical I/D caches)",
+		    model);
 		machtype = LUNA_II;
 		/* 25MHz 68040 */
 		cpuspeed = 25;
@@ -311,8 +328,7 @@ identifycpu(void)
 	default:
 		panic("unknown CPU type");
 	}
-	strcpy(cpu_model, cpu);
-	printf("%s (%s)\n", model, cpu);
+	printf("%s\n", cpu_model);
 }
 
 /*

Reply via email to