Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/luna68k Finally complete LUNA-II support, after alm...



details:   https://anonhg.NetBSD.org/src/rev/7953edd7adcb
branches:  trunk
changeset: 771148:7953edd7adcb
user:      tsutsui <tsutsui%NetBSD.org@localhost>
date:      Sat Nov 12 13:44:26 2011 +0000

description:
Finally complete LUNA-II support, after almost 12 years since
initial import of NetBSD/luna68k.

Note a working LUNA-II machine was found and provided by OMRON guys
after LUNA demonstration at Open Source Conference 2011 Kansai @ Kyoto:
http://mail-index.NetBSD.org/source-changes/2011/07/16/msg024675.html
and this resurrected LUNA-II which runs NetBSD/luna68k -current with Xserver
was also demonstrated on the NetBSD booth at Kansai Open Source 2011:
http://www.NetBSD.org/gallery/events.html#kansai-os-jp-2011

It's really pleasure to meet many OMRON LUNA developers and LUNA users
at the NetBSD booth.  Thank you everyone!


Changes details:

luna68k/luna68k/locore.s
 - don't use 68030 specific pflusha instruction in 68040 initialization path
 - use TBIA() to invalidate TLB instead of 68030's pflusha
   after MMU is turned on (as hp300 does)
   (these two bugs are fatal at early bootstrap)
 - pull loadustp() fixes from hp300/locore.s rev 1.82
   (more flush ops are required in it otherwise causes random coredumps)
 - specify correct %tt1 mask value
   (the mask value means actually bit mask, not transparent range)

luna68k/luna68k/machdep.c
 - use proper delay_divisor for 68040 25MHz LUNA-II

luna68k/luna68k/mainbus.c
 - prepare and use per-model mainbus device lists for mainbus_attach_args

luna68k/conf/GENERIC
luna68k/conf/INSTALL
 - enable options M68040 and FPSP
 - enable secondary spc(4) on LUNA-II

luna68k/conf/Makefile.luna68k
 - include arch/m68k/fpsp/Makefile.inc for FPSP

luna68k/dev/lcd.c
 - promote LUNA-II model on LCD

XXX: old and slow SCSI-1 drives like Hitachi DK312 seems to have
XXX: some problem with spc(4) driver, even on the original LUNA

diffstat:

 sys/arch/luna68k/conf/GENERIC          |  10 ++++----
 sys/arch/luna68k/conf/INSTALL          |   8 +++---
 sys/arch/luna68k/conf/Makefile.luna68k |   4 +-
 sys/arch/luna68k/dev/lcd.c             |   8 +++++-
 sys/arch/luna68k/luna68k/locore.s      |  20 +++++++++-------
 sys/arch/luna68k/luna68k/machdep.c     |   9 ++++---
 sys/arch/luna68k/luna68k/mainbus.c     |  39 +++++++++++++++++++++++----------
 7 files changed, 60 insertions(+), 38 deletions(-)

diffs (292 lines):

diff -r d67793d9161e -r 7953edd7adcb sys/arch/luna68k/conf/GENERIC
--- a/sys/arch/luna68k/conf/GENERIC     Sat Nov 12 11:11:07 2011 +0000
+++ b/sys/arch/luna68k/conf/GENERIC     Sat Nov 12 13:44:26 2011 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.93 2011/07/16 15:52:21 tsutsui Exp $
+# $NetBSD: GENERIC,v 1.94 2011/11/12 13:44:26 tsutsui Exp $
 #
 # GENERIC machine description file
 # 
@@ -22,13 +22,13 @@
 
 options        INCLUDE_CONFIG_FILE     # embed config file in kernel binary
 
-#ident                 "GENERIC-$Revision: 1.93 $"
+#ident                 "GENERIC-$Revision: 1.94 $"
 
 maxusers       8
 
 options        M68030
-#options       M68040
-#options       FPSP    # on m68040 to emulate some missing FP instructions
+options        M68040
+options        FPSP    # on m68040 to emulate some missing FP instructions
 
 # Needs to be set per system.  i.e change these as you see fit
 
@@ -153,7 +153,7 @@
 le0    at mainbus0
 # MB89532 SPC
 spc0   at mainbus0
-#spc1  at mainbus0             # 2nd SCSI on LUNA-II
+spc1   at mainbus0             # 2nd SCSI on LUNA-II
 # framebuffer
 fb0    at mainbus0             # 16 or 256 pseudo color
 
diff -r d67793d9161e -r 7953edd7adcb sys/arch/luna68k/conf/INSTALL
--- a/sys/arch/luna68k/conf/INSTALL     Sat Nov 12 11:11:07 2011 +0000
+++ b/sys/arch/luna68k/conf/INSTALL     Sat Nov 12 13:44:26 2011 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: INSTALL,v 1.1 2011/07/16 15:52:21 tsutsui Exp $
+# $NetBSD: INSTALL,v 1.2 2011/11/12 13:44:26 tsutsui Exp $
 #
 # config for installation ramdisk kernel
 # 
@@ -9,8 +9,8 @@
 maxusers       4
 
 options        M68030
-#options       M68040
-#options       FPSP    # on m68040 to emulate some missing FP instructions
+options        M68040
+options        FPSP    # on m68040 to emulate some missing FP instructions
 
 options        MEMORY_DISK_HOOKS
 options        MEMORY_DISK_IS_ROOT             # Force root on ram-disk
@@ -139,7 +139,7 @@
 le0    at mainbus0
 # MB89532 SPC
 spc0   at mainbus0
-#spc1  at mainbus0             # 2nd SCSI on LUNA-II
+spc1   at mainbus0             # 2nd SCSI on LUNA-II
 # framebuffer
 fb0    at mainbus0             # 16 or 256 pseudo color
 
diff -r d67793d9161e -r 7953edd7adcb sys/arch/luna68k/conf/Makefile.luna68k
--- a/sys/arch/luna68k/conf/Makefile.luna68k    Sat Nov 12 11:11:07 2011 +0000
+++ b/sys/arch/luna68k/conf/Makefile.luna68k    Sat Nov 12 13:44:26 2011 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile.luna68k,v 1.22 2011/07/20 12:00:04 tsutsui Exp $
+#      $NetBSD: Makefile.luna68k,v 1.23 2011/11/12 13:44:26 tsutsui Exp $
 
 # Makefile for NetBSD
 #
@@ -42,7 +42,7 @@
 ## (4) local objects, compile rules, and dependencies
 ##
 # for the Motorola 68040 Floating Point Software Product
-# .include "$S/arch/m68k/fpsp/Makefile.inc"
+.include "$S/arch/m68k/fpsp/Makefile.inc"
 
 MD_OBJS=       locore.o ${FPSP}
 MD_CFILES=
diff -r d67793d9161e -r 7953edd7adcb sys/arch/luna68k/dev/lcd.c
--- a/sys/arch/luna68k/dev/lcd.c        Sat Nov 12 11:11:07 2011 +0000
+++ b/sys/arch/luna68k/dev/lcd.c        Sat Nov 12 13:44:26 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lcd.c,v 1.6 2009/03/18 10:22:31 cegger Exp $ */
+/* $NetBSD: lcd.c,v 1.7 2011/11/12 13:44:26 tsutsui Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include <sys/cdefs.h>         /* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: lcd.c,v 1.6 2009/03/18 10:22:31 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lcd.c,v 1.7 2011/11/12 13:44:26 tsutsui Exp $");
 
 /*
  * XXX
@@ -43,6 +43,8 @@
 #include <sys/systm.h>
 #include <sys/device.h>
 
+#include <machine/cpu.h>
+
 #define PIO1_MODE_OUTPUT       0x84
 #define PIO1_MODE_INPUT                0x94
 
@@ -156,5 +158,7 @@
        lcdctrl(LCD_LOCATE(0, 0));
        lcdshow(lcd_boot_message1);
        lcdctrl(LCD_LOCATE(0, 1));
+       if (machtype == LUNA_II)
+               lcd_boot_message2[13] = '2';
        lcdshow(lcd_boot_message2);
 }
diff -r d67793d9161e -r 7953edd7adcb sys/arch/luna68k/luna68k/locore.s
--- a/sys/arch/luna68k/luna68k/locore.s Sat Nov 12 11:11:07 2011 +0000
+++ b/sys/arch/luna68k/luna68k/locore.s Sat Nov 12 13:44:26 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: locore.s,v 1.42 2011/11/05 15:37:17 tsutsui Exp $ */
+/* $NetBSD: locore.s,v 1.43 2011/11/12 13:44:26 tsutsui Exp $ */
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -244,11 +244,11 @@
        .long   0x4e7b0004              | movc %d0,%itt0
        .long   0x4e7b0006              | movc %d0,%dtt0
        RELOC(proto040tt1,%a0)
-       movl    %a0@,%d0                | tt1 range 8000.0000-feff.ffff
+       movl    %a0@,%d0                | tt1 range 8000.0000-ffff.ffff
        .long   0x4e7b0005              | movc %d0,%itt1
        .long   0x4e7b0007              | movc %d0,%dtt1
        .word   0xf4d8                  | cinva bc
-       pflusha                         | flush entire ATC
+       .word   0xf518                  | pflusha
        RELOC(proto040tc,%a0)
        movl    %a0@,%d0
        .long   0x4e7b0003              | movc %d0,%tc
@@ -288,7 +288,7 @@
        jbsr    _C_LABEL(m68881_restore) | restore it (does not kill %a1)
        addql   #4,%sp
 Lenab2:
-       pflusha                         | flush entire ATC 
+       jbsr    _C_LABEL(_TBIA)         | invalidate TLB
        cmpl    #MMU_68040,_C_LABEL(mmutype) | 68040?
        jeq     Lenab3                  | yes, cache already on
        tstl    _C_LABEL(mmutype)
@@ -974,16 +974,18 @@
 #if defined(M68040)
        cmpl    #MMU_68040,_C_LABEL(mmutype) | 68040?
        jne     LmotommuC               | no, skip
+       .word   0xf518                  | yes, pflusha
        .long   0x4e7b0806              | movc %d0,%urp
        rts
 LmotommuC:
 #endif
+       pflusha                         | flush entire TLB
        lea     _C_LABEL(protocrp),%a0  | %crp prototype
        movl    %d0,%a0@(4)             | stash USTP
        pmove   %a0@,%crp               | load root pointer
-       movl    #DC_CLEAR,%d0
-       movc    %d0,%cacr               | invalidate on-chip d-cache
-       rts                             |   since pmove flushes ATC
+       movl    #CACHE_CLR,%d0
+       movc    %d0,%cacr               | invalidate cache(s)
+       rts
 
 ENTRY(ploadw)
 #if defined(M68040)
@@ -1153,8 +1155,8 @@
        .long   0x8000          | %tc (4KB page)
 GLOBAL(proto040tt0)            | tt0 0x4000.0000-0x7fff.ffff
        .long   0x403fa040      | kernel only, cache inhebit, serialized
-GLOBAL(proto040tt1)            | tt1 0x8000.0000-0xfeff.ffff
-       .long   0x807ea040      | kernel only, cache inhebit, serialized
+GLOBAL(proto040tt1)            | tt1 0x8000.0000-0xffff.ffff
+       .long   0x807fa040      | kernel only, cache inhebit, serialized
 nullrp:
        .long   0x7fff0001      | do-nothing MMU root pointer
 
diff -r d67793d9161e -r 7953edd7adcb sys/arch/luna68k/luna68k/machdep.c
--- a/sys/arch/luna68k/luna68k/machdep.c        Sat Nov 12 11:11:07 2011 +0000
+++ b/sys/arch/luna68k/luna68k/machdep.c        Sat Nov 12 13:44:26 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.84 2011/10/17 14:19:28 tsutsui Exp $ */
+/* $NetBSD: machdep.c,v 1.85 2011/11/12 13:44:26 tsutsui Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include <sys/cdefs.h>                 /* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.84 2011/10/17 14:19:28 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.85 2011/11/12 13:44:26 tsutsui Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -145,7 +145,7 @@
  * XXX -- is the above formula correct?
  */
 int    cpuspeed = 25;          /* only used for printing later */
-int    delay_divisor = 300;    /* for delay() loop count */
+int    delay_divisor = 30;     /* for delay() loop count */
 
 /*
  * Early initialization, before main() is called.
@@ -304,7 +304,8 @@
                machtype = LUNA_II;
                /* 25MHz 68040 */
                cpuspeed = 25;
-               delay_divisor = 300;
+               delay_divisor = 30;
+               /* hz = 100 on LUNA-II */
                break;
 #endif
        default:
diff -r d67793d9161e -r 7953edd7adcb sys/arch/luna68k/luna68k/mainbus.c
--- a/sys/arch/luna68k/luna68k/mainbus.c        Sat Nov 12 11:11:07 2011 +0000
+++ b/sys/arch/luna68k/luna68k/mainbus.c        Sat Nov 12 13:44:26 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mainbus.c,v 1.9 2011/06/05 17:03:18 matt Exp $ */
+/* $NetBSD: mainbus.c,v 1.10 2011/11/12 13:44:26 tsutsui Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include <sys/cdefs.h>
 
-__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.9 2011/06/05 17:03:18 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.10 2011/11/12 13:44:26 tsutsui Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -40,15 +40,21 @@
 #include <machine/cpu.h>
 #include <machine/autoconf.h>
 
-static struct mainbus_attach_args devs[] = {
-       { "clock",  0x45000000, -1 },   /* Mostek/Dallas TimeKeeper */
+static const struct mainbus_attach_args luna_devs[] = {
+       { "clock",  0x45000000, -1 },   /* Mostek TimeKeeper */
        { "le",     0xf1000000, 3 },    /* Am7990 */
        { "sio",    0x51000000, 6 },    /* uPD7201A */
        { "fb",     0xc1100000, -1 },   /* BrookTree RAMDAC */
        { "spc",    0xe1000000, 2 },    /* MB89352 */
-#if 0
-       { "spc",    0xe1000040, 2 },    /* ditto */
-#endif
+};
+
+static const struct mainbus_attach_args luna2_devs[] = {
+       { "clock",  0x45000000, -1 },   /* Dallas TimeKeeper */
+       { "le",     0xf0000000, 3 },    /* Am7990 */
+       { "sio",    0x51000000, 6 },    /* uPD7201A */
+       { "fb",     0xc1100000, -1 },   /* BrookTree RAMDAC */
+       { "spc",    0xe1000000, 2 },    /* internal MB89352 */
+       { "spc",    0xe1000040, 2 },    /* external MB89352 */
 };
 
 static void mainbus_attach(device_t, device_t, void *);
@@ -72,13 +78,22 @@
 static void
 mainbus_attach(device_t parent, device_t self, void *args)
 {
-       int i;
+       int i, ndevs;
+       const struct mainbus_attach_args *devs;
+       struct mainbus_attach_args ma;
        
-       if (machtype == LUNA_II)
-               devs[1].ma_addr = 0xf0000000;
+       if (machtype == LUNA_II) {
+               devs = luna2_devs;
+               ndevs = __arraycount(luna2_devs);
+       } else {
+               devs = luna_devs;
+               ndevs = __arraycount(luna_devs);
+       }
        printf("\n");
-       for (i = 0; i < sizeof(devs)/sizeof(devs[0]); i++)
-               config_found(self, (void *)&devs[i], mainbus_print);
+       for (i = 0; i < ndevs; i++) {
+               ma = devs[i];
+               config_found(self, &ma, mainbus_print);
+       }
 }
 
 static int



Home | Main Index | Thread Index | Old Index