Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/luna68k/luna68k Revert to old ROM console I/O code.



details:   https://anonhg.NetBSD.org/src/rev/dbefe1310dcb
branches:  trunk
changeset: 480547:dbefe1310dcb
user:      nisimura <nisimura%NetBSD.org@localhost>
date:      Sat Jan 15 10:06:21 2000 +0000

description:
Revert to old ROM console I/O code.

diffstat:

 sys/arch/luna68k/luna68k/locore.s  |  50 +----------------------------------
 sys/arch/luna68k/luna68k/machdep.c |  54 +++++++++++++++++++++++++++++++++----
 2 files changed, 48 insertions(+), 56 deletions(-)

diffs (172 lines):

diff -r dd3455f1bc1e -r dbefe1310dcb sys/arch/luna68k/luna68k/locore.s
--- a/sys/arch/luna68k/luna68k/locore.s Sat Jan 15 06:21:40 2000 +0000
+++ b/sys/arch/luna68k/luna68k/locore.s Sat Jan 15 10:06:21 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: locore.s,v 1.2 2000/01/14 02:39:22 nisimura Exp $ */
+/* $NetBSD: locore.s,v 1.3 2000/01/15 10:06:21 nisimura Exp $ */
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -1330,54 +1330,6 @@
        movl    a0@(4),a0               | *((int (*)(void))base[1])
        jmp     a0@                     | go cold boot!
 
-#if 0
-/*
- * int romcngetc(dev_t)
- */
-ENTRY_NOPROFILE(romcngetc)
-       moveq   #0,d1
-       movw    sr,d1                   | get old SR for return
-       movel   d1,a6@(-4)
-       movw    #PSL_HIGHIPL,sr         | splhigh()
-       movc    vbr,d1
-       movel   d1,a6@(-8)
-       movl    #0,d1
-       movc    d1,vbr
-       movel   #0x41000000,a0          | base = (int **)0x41000000
-       movel   a0@(16),a0              | getc = (int (*)(void))base[4]
-       jbsr    a0@                     | d0 = (*getc)()
-       movl    a6@(-8),d1              | restore previous VBR
-       movc    d1,vbr
-       movel   a6@(-4),d1
-       movew   d1,sr                   | splx()
-       unlk    a6
-       rts
-
-/*
- * void romcnputc(dev_t, cc)
- */
-ENTRY_NOPROFILE(romcnputc)
-       moveq   #0,d1
-       movw    sr,d1                   | get old SR for return
-       movel   d1,a6@(-8)
-       movw    #PSL_HIGHIPL,sr         | splhigh()
-       movc    vbr,d1
-       movel   d1,a6@(-8)
-       movl    #0,d1
-       movc    d1,vbr                  | switch to monitor VBR
-       movel   a6@(12),sp@-
-       movel   #0x41000000,a0          | base = (int **)0x41000000
-       movl    a0@(20),a0              | putc = (void (*)(int))base[5]
-       jbsr    a0@                     | (*putc)(cc)
-       addql   #4,sp                   | pop args
-       movl    a6@(-8),d1              | restore previous VBR
-       movc    d1,vbr
-       movel   a6@(-4),d1
-       movew   d1,sr                   | splx()
-       unlk    a6
-       rts
-#endif
-
        .data
 GLOBAL(cputype)
        .long   CPU_68030       | default to 68030
diff -r dd3455f1bc1e -r dbefe1310dcb sys/arch/luna68k/luna68k/machdep.c
--- a/sys/arch/luna68k/luna68k/machdep.c        Sat Jan 15 06:21:40 2000 +0000
+++ b/sys/arch/luna68k/luna68k/machdep.c        Sat Jan 15 10:06:21 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.1 2000/01/05 08:49:03 nisimura Exp $ */
+/* $NetBSD: machdep.c,v 1.2 2000/01/15 10:06:21 nisimura Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
 
 #include <sys/cdefs.h>                 /* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.1 2000/01/05 08:49:03 nisimura Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.2 2000/01/15 10:06:21 nisimura Exp $");
 
 #include "opt_ddb.h"
 
@@ -224,8 +224,10 @@
                if (i++ >= sizeof(bootarg))
                        break;
        }
+#if 0 /* overload 1:sw1, which now means 'go ROM monitor' after poweron */
        if (boothowto == 0)
                boothowto = (sw1 & 0x1) ? RB_SINGLE : 0;
+#endif
 
        if (sysconsole == 0)
                syscnattach(0);
@@ -941,7 +943,7 @@
        splx(s);
 }
 
-#ifndef ROMCONS
+#if 1
 
 struct consdev *cn_tab = &syscons;
 
@@ -964,27 +966,65 @@
 };
 struct consdev *cn_tab = &romcons;
 
-extern int romcall __P((int, int));
+#define __             ((int **)0x41000000)
+#define GETC()         (*(int (*)())__[6])()
+#define PUTC(x)                (*(void (*)())__[7])(x)
 
-#define        ROMGETC()       romcall(6, 0)
-#define        ROMPUTC(x)      romcall(7, x)
+#define ROMPUTC(x) \
+({                                     \
+       register _r;                    \
+       asm volatile ("                 \
+               movc    vbr,%0          ; \
+               movel   %0,sp@-         ; \
+               clrl    %0              ; \
+               movc    %0,vbr"         \
+               : "=r" (_r));           \
+       PUTC(x);                        \
+       asm volatile ("                 \
+               movel   sp@+,%0         ; \
+               movc    %0,vbr"         \
+               : "=r" (_r));           \
+})
+
+#define ROMGETC() \
+({                                     \
+       register _r, _c;                \
+       asm volatile ("                 \
+               movc    vbr,%0          ; \
+               movel   %0,sp@-         ; \
+               clrl    %0              ; \
+               movc    %0,vbr"         \
+               : "=r" (_r));           \
+       _c = GETC();                    \
+       asm volatile ("                 \
+               movel   sp@+,%0         ; \
+               movc    %0,vbr"         \
+               : "=r" (_r));           \
+       _c;                             \
+})
 
 void
 romcnputc(dev, c)
        dev_t dev;
        int c;
 {
+       int s;
+
+       s = splhigh();
        ROMPUTC(c);
+       splx(s);
 }
 
 int
 romcngetc(dev)
        dev_t dev;
 {
-       int c;
+       int s, c;
 
        do {
+               s = splhigh();
                c = ROMGETC();
+               splx(s);
        } while (c == -1);
        return c;
 }



Home | Main Index | Thread Index | Old Index