Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/luna68k/stand/boot Check cputype and set machine ty...



details:   https://anonhg.NetBSD.org/src/rev/461e7d5f753a
branches:  trunk
changeset: 783900:461e7d5f753a
user:      tsutsui <tsutsui%NetBSD.org@localhost>
date:      Sat Jan 12 07:11:59 2013 +0000

description:
Check cputype and set machine type (LUNA-I or LUNA-II).
Tested on only LUNA-I for now.

diffstat:

 sys/arch/luna68k/stand/boot/init_main.c |  17 ++++++++++++++---
 sys/arch/luna68k/stand/boot/locore.S    |  25 +++++++++++++++++++++++++
 sys/arch/luna68k/stand/boot/samachdep.h |   4 +++-
 3 files changed, 42 insertions(+), 4 deletions(-)

diffs (113 lines):

diff -r a6fc6266c1af -r 461e7d5f753a sys/arch/luna68k/stand/boot/init_main.c
--- a/sys/arch/luna68k/stand/boot/init_main.c   Sat Jan 12 07:04:57 2013 +0000
+++ b/sys/arch/luna68k/stand/boot/init_main.c   Sat Jan 12 07:11:59 2013 +0000
@@ -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 @@
 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 @@
        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);
diff -r a6fc6266c1af -r 461e7d5f753a sys/arch/luna68k/stand/boot/locore.S
--- a/sys/arch/luna68k/stand/boot/locore.S      Sat Jan 12 07:04:57 2013 +0000
+++ b/sys/arch/luna68k/stand/boot/locore.S      Sat Jan 12 07:11:59 2013 +0000
@@ -242,6 +242,28 @@
        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(dipsw2)
        .long   0
+
+GLOBAL(cputype)
+       .long   CPU_68030
diff -r a6fc6266c1af -r 461e7d5f753a sys/arch/luna68k/stand/boot/samachdep.h
--- a/sys/arch/luna68k/stand/boot/samachdep.h   Sat Jan 12 07:04:57 2013 +0000
+++ b/sys/arch/luna68k/stand/boot/samachdep.h   Sat Jan 12 07:11:59 2013 +0000
@@ -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 @@
 
 /* init_main.c */
 extern int nplane;
+extern int machtype;
 
 /* kbd.c */
 int kbd_decode(u_char);
@@ -116,6 +117,7 @@
 /* locore.S */
 extern u_int bootdev;
 extern int dipsw1, dipsw2;
+extern int cputype;
 int setjmp(label_t *);
 int splhigh(void);
 void splx(int);



Home | Main Index | Thread Index | Old Index