Add CPU/FPU information from Radek Kujawa

This commit is contained in:
christos 2004-11-14 18:58:22 +00:00
parent 8c170ab578
commit f19f4f121f
1 changed files with 66 additions and 2 deletions

View File

@ -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 @@ __KERNEL_RCSID(0, "$NetBSD: procfs_machdep.c,v 1.3 2003/07/15 01:44:57 lukem Exp
#include <sys/vnode.h>
#include <miscfs/procfs/procfs.h>
#include <m68k/m68k.h>
/*
* Linux-style /proc/cpuinfo.
@ -18,6 +19,69 @@ int
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;
}