Module Name: src
Committed By: tsutsui
Date: Sat Jan 12 07:12:00 UTC 2013
Modified Files:
src/sys/arch/luna68k/stand/boot: init_main.c locore.S samachdep.h
Log Message:
Check cputype and set machine type (LUNA-I or LUNA-II).
Tested on only LUNA-I for now.
To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/luna68k/stand/boot/init_main.c \
src/sys/arch/luna68k/stand/boot/samachdep.h
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/luna68k/stand/boot/locore.S
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/stand/boot/init_main.c
diff -u src/sys/arch/luna68k/stand/boot/init_main.c:1.1 src/sys/arch/luna68k/stand/boot/init_main.c:1.2
--- src/sys/arch/luna68k/stand/boot/init_main.c:1.1 Sat Jan 5 17:44:24 2013
+++ src/sys/arch/luna68k/stand/boot/init_main.c Sat Jan 12 07:11:59 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: init_main.c,v 1.1 2013/01/05 17:44:24 tsutsui Exp $ */
+/* $NetBSD: init_main.c,v 1.2 2013/01/12 07:11:59 tsutsui Exp $ */
/*
* Copyright (c) 1992 OMRON Corporation.
@@ -82,7 +82,8 @@
static int get_plane_numbers(void);
static int reorder_dipsw(int);
-int cpuspeed;
+int cpuspeed; /* for DELAY() macro */
+int machtype;
#define VERS_LOCAL "Phase-31"
@@ -109,11 +110,20 @@ void
main(void)
{
int i, status = 0;
+ const char *machstr;
/*
* Initialize the console before we print anything out.
*/
- cpuspeed = MHZ_25; /* for DELAY() macro */
+ if (cputype == CPU_68030) {
+ machtype = LUNA_I;
+ machstr = "LUNA-I";
+ cpuspeed = MHZ_25;
+ } else {
+ machtype = LUNA_II;
+ machstr = "LUNA-II";
+ cpuspeed = MHZ_25 * 2; /* XXX */
+ }
nplane = get_plane_numbers();
@@ -129,6 +139,7 @@ main(void)
kiff->plane = nplane;
i = (int) kiff->maxaddr + 1;
+ printf("Machine model = %s\n", machstr);
printf("Physical Memory = 0x%x ", i);
i >>= 20;
printf("(%d MB)\n", i);
Index: src/sys/arch/luna68k/stand/boot/samachdep.h
diff -u src/sys/arch/luna68k/stand/boot/samachdep.h:1.1 src/sys/arch/luna68k/stand/boot/samachdep.h:1.2
--- src/sys/arch/luna68k/stand/boot/samachdep.h:1.1 Sat Jan 5 17:44:24 2013
+++ src/sys/arch/luna68k/stand/boot/samachdep.h Sat Jan 12 07:11:59 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: samachdep.h,v 1.1 2013/01/05 17:44:24 tsutsui Exp $ */
+/* $NetBSD: samachdep.h,v 1.2 2013/01/12 07:11:59 tsutsui Exp $ */
/*
* Copyright (c) 1982, 1990, 1993
@@ -109,6 +109,7 @@ int getline(char *, char *);
/* init_main.c */
extern int nplane;
+extern int machtype;
/* kbd.c */
int kbd_decode(u_char);
@@ -116,6 +117,7 @@ int kbd_decode(u_char);
/* locore.S */
extern u_int bootdev;
extern int dipsw1, dipsw2;
+extern int cputype;
int setjmp(label_t *);
int splhigh(void);
void splx(int);
Index: src/sys/arch/luna68k/stand/boot/locore.S
diff -u src/sys/arch/luna68k/stand/boot/locore.S:1.2 src/sys/arch/luna68k/stand/boot/locore.S:1.3
--- src/sys/arch/luna68k/stand/boot/locore.S:1.2 Thu Jan 10 16:03:49 2013
+++ src/sys/arch/luna68k/stand/boot/locore.S Sat Jan 12 07:11:59 2013
@@ -242,6 +242,28 @@ Lbssclr:
andl #0xFF,%d0
movl %d0,_C_LABEL(dipsw2)
+/* determine our CPU */
+
+ /* XXX should be generated via assym.h */
+ CACHE_OFF = 0x0808
+ DC_FREEZE = 0x0200
+ CPU_68030 = 1
+ CPU_68040 = 2
+
+ movl #CACHE_OFF,%d0
+ movc %d0,%cacr | clear and disable on-chip cache(s)
+ movl #DC_FREEZE,%d0 | data freeze bit
+ movc %d0,%cacr | only exists on 68030
+ movc %cacr,%d0 | read it back
+ tstl %d0 | zero?
+ jeq Lnot68030 | yes, we have 68040
+ movl #CPU_68030,%d0
+ jra Lstart0
+Lnot68030:
+ movl #CPU_68040,%d0
+Lstart0:
+ movl %d0,_C_LABEL(cputype)
+
/* final setup for C code */
movw #PSL_LOWIPL,%sr | no interrupts
jsr _C_LABEL(main) | lets go
@@ -750,3 +772,6 @@ GLOBAL(dipsw1)
GLOBAL(dipsw2)
.long 0
+
+GLOBAL(cputype)
+ .long CPU_68030