Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/x68k/x68k Add CPU/FPU information from Radek Kujawa



details:   https://anonhg.NetBSD.org/src/rev/604308a09eb0
branches:  trunk
changeset: 571234:604308a09eb0
user:      christos <christos%NetBSD.org@localhost>
date:      Sun Nov 14 18:58:22 2004 +0000

description:
Add CPU/FPU information from Radek Kujawa

diffstat:

 sys/arch/x68k/x68k/procfs_machdep.c |  68 +++++++++++++++++++++++++++++++++++-
 1 files changed, 66 insertions(+), 2 deletions(-)

diffs (91 lines):

diff -r a0b7fceac732 -r 604308a09eb0 sys/arch/x68k/x68k/procfs_machdep.c
--- a/sys/arch/x68k/x68k/procfs_machdep.c       Sun Nov 14 18:36:11 2004 +0000
+++ b/sys/arch/x68k/x68k/procfs_machdep.c       Sun Nov 14 18:58:22 2004 +0000
@@ -1,7 +1,7 @@
-/*     $NetBSD: procfs_machdep.c,v 1.3 2003/07/15 01:44:57 lukem Exp $ */
+/*     $NetBSD: procfs_machdep.c,v 1.4 2004/11/14 18:58:22 christos Exp $ */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: procfs_machdep.c,v 1.3 2003/07/15 01:44:57 lukem Exp $");
+__KERNEL_RCSID(0, "$NetBSD: procfs_machdep.c,v 1.4 2004/11/14 18:58:22 christos Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -9,6 +9,7 @@
 #include <sys/vnode.h>
 #include <miscfs/procfs/procfs.h>
 
+#include <m68k/m68k.h>
 
 /*
  * Linux-style /proc/cpuinfo.
@@ -18,6 +19,69 @@
 procfs_getcpuinfstr(char *buf, int *len)
 {
        *len = 0;
+       const char *cpu, *mmu, *fpu;
+
+       switch (cputype) {
+       case CPU_68020:
+               cpu = "68020";
+               break;
+       case CPU_68030:
+               cpu = "68030";
+               break;
+       case CPU_68040:
+               cpu = "68040";
+               break;
+       case CPU_68060:
+               cpu = "68060";
+               break;
+       default:
+               cpu = "680x0";
+               break;
+       }
+
+       switch (mmutype) {
+       case MMU_68851:
+               mmu = "68851";
+               break;
+       case MMU_68030:
+               mmu = "68030";
+               break;
+       case MMU_68040:
+               mmu = "68040";
+               break;
+       case MMU_68060:
+               mmu = "68060";
+               break;
+       default:
+               mmu = "unknown";
+               break;
+       }
+
+       switch (fputype) {
+       case FPU_NONE:
+               fpu = "none(soft float)";
+               break;
+       case FPU_68881:
+               fpu = "68881";
+               break;
+       case FPU_68882:
+               fpu = "68882";
+               break;
+       default:
+               fpu = "none";
+               break;
+       }
+
+       *len = snprintf(buf, sizeof(buf),
+           /* as seen in Linux 2.4.27 */
+           "CPU:\t\t%s\n"
+           "MMU:\t\t%s\n"
+           "FPU:\t\t%s\n",
+           /*
+            * in Linux m68k /proc/cpuinfo there are also "Clocking",
+            * "BogoMips" and "Calibration".
+            */
+           cpu, mmu, fpu);
 
        return 0;
 }



Home | Main Index | Thread Index | Old Index