Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/x68k Detect emulators (and display it on dmesg).
details: https://anonhg.NetBSD.org/src/rev/4576f3aebf7a
branches: trunk
changeset: 784213:4576f3aebf7a
user: isaki <isaki%NetBSD.org@localhost>
date: Tue Jan 22 11:58:39 2013 +0000
description:
Detect emulators (and display it on dmesg).
diffstat:
sys/arch/x68k/dev/intiovar.h | 4 ++-
sys/arch/x68k/x68k/machdep.c | 61 +++++++++++++++++++++++++++++++++++++++++--
2 files changed, 60 insertions(+), 5 deletions(-)
diffs (125 lines):
diff -r 1604c00d5516 -r 4576f3aebf7a sys/arch/x68k/dev/intiovar.h
--- a/sys/arch/x68k/dev/intiovar.h Tue Jan 22 09:39:11 2013 +0000
+++ b/sys/arch/x68k/dev/intiovar.h Tue Jan 22 11:58:39 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: intiovar.h,v 1.13 2008/12/18 05:56:42 isaki Exp $ */
+/* $NetBSD: intiovar.h,v 1.14 2013/01/22 11:58:39 isaki Exp $ */
/*
*
@@ -126,6 +126,8 @@
#define INTIO_SYSPORT_KBEXIST 0x08
#define intio_get_sysport_waitctrl() \
(intio_sysport[sysport_waitctrl])
+#define intio_get_sysport_sramwp() \
+ (intio_sysport[sysport_sramwp])
#define intio_get_sysport_mpustat() \
(intio_sysport[sysport_mpustat])
diff -r 1604c00d5516 -r 4576f3aebf7a sys/arch/x68k/x68k/machdep.c
--- a/sys/arch/x68k/x68k/machdep.c Tue Jan 22 09:39:11 2013 +0000
+++ b/sys/arch/x68k/x68k/machdep.c Tue Jan 22 11:58:39 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.185 2012/07/30 17:19:59 christos Exp $ */
+/* $NetBSD: machdep.c,v 1.186 2013/01/22 11:58:39 isaki Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.185 2012/07/30 17:19:59 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.186 2013/01/22 11:58:39 isaki Exp $");
#include "opt_ddb.h"
#include "opt_kgdb.h"
@@ -125,6 +125,7 @@
/* prototypes for local functions */
void identifycpu(void);
+static int check_emulator(char *, int);
void initcpu(void);
int cpu_dumpsize(void);
int cpu_dump(int (*)(dev_t, daddr_t, void *, size_t), daddr_t *);
@@ -304,6 +305,7 @@
/* there's alot of XXX in here... */
const char *cpu_type, *mach, *mmu, *fpu;
char clock[16];
+ char emubuf[20];
/*
* check machine type constant
@@ -335,6 +337,9 @@
break;
}
+ emubuf[0] = '\0';
+ check_emulator(emubuf, sizeof(emubuf));
+
cpuspeed = 2048 / delay_divisor;
sprintf(clock, "%dMHz", cpuspeed);
switch (cputype) {
@@ -367,12 +372,60 @@
fpu = fpu_descr[fputype];
else
fpu = ", unknown FPU";
- sprintf(cpu_model, "X68%s (%s CPU%s%s, %s clock)",
- mach, cpu_type, mmu, fpu, clock);
+ sprintf(cpu_model, "X68%s (%s CPU%s%s, %s clock)%s%s",
+ mach, cpu_type, mmu, fpu, clock,
+ emubuf[0] ? " on " : "", emubuf);
printf("%s\n", cpu_model);
}
/*
+ * If it is an emulator, store the name in buf and return 1.
+ * Otherwise return 0.
+ */
+static int
+check_emulator(char *buf, int bufsize)
+{
+ int xm6major;
+ int xm6minor;
+ int xm6imark;
+ int xm6imajor;
+ int xm6iminor;
+
+ /* XM6 and its family */
+ intio_set_sysport_sramwp('X');
+ if (intio_get_sysport_sramwp() == '6') {
+ xm6major = intio_get_sysport_sramwp();
+ xm6minor = intio_get_sysport_sramwp();
+ xm6imark = intio_get_sysport_sramwp();
+ switch (xm6imark) {
+ case 0xff: /* Original XM6 or unknown compatibles */
+ snprintf(buf, bufsize, "XM6 v%d.%02d",
+ xm6major, xm6minor);
+ break;
+
+ case 'i': /* XM6i */
+ xm6imajor = intio_get_sysport_sramwp();
+ xm6iminor = intio_get_sysport_sramwp();
+ snprintf(buf, bufsize, "XM6i v%d.%02d",
+ xm6imajor, xm6iminor);
+ break;
+
+ case 'g': /* XM6 TypeG */
+ snprintf(buf, bufsize, "XM6 TypeG v%d.%02d",
+ xm6major, xm6minor);
+ break;
+
+ default: /* Other XM6 compatibles? */
+ /* XXX what should I do? */
+ return 0;
+ }
+ return 1;
+ }
+
+ return 0;
+}
+
+/*
* machine dependent system variables.
*/
SYSCTL_SETUP(sysctl_machdep_setup, "sysctl machdep subtree setup")
Home |
Main Index |
Thread Index |
Old Index