Revert to old ROM console I/O code.

This commit is contained in:
nisimura 2000-01-15 10:06:21 +00:00
parent 0d39e62e79
commit 410a23c0a3
2 changed files with 48 additions and 56 deletions

View File

@ -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. * Copyright (c) 1988 University of Utah.
@ -1330,54 +1330,6 @@ Lbootcommon:
movl a0@(4),a0 | *((int (*)(void))base[1]) movl a0@(4),a0 | *((int (*)(void))base[1])
jmp a0@ | go cold boot! 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 .data
GLOBAL(cputype) GLOBAL(cputype)
.long CPU_68030 | default to 68030 .long CPU_68030 | default to 68030

View File

@ -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. * Copyright (c) 2000 The NetBSD Foundation, Inc.
@ -38,7 +38,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */ #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" #include "opt_ddb.h"
@ -224,8 +224,10 @@ consinit()
if (i++ >= sizeof(bootarg)) if (i++ >= sizeof(bootarg))
break; break;
} }
#if 0 /* overload 1:sw1, which now means 'go ROM monitor' after poweron */
if (boothowto == 0) if (boothowto == 0)
boothowto = (sw1 & 0x1) ? RB_SINGLE : 0; boothowto = (sw1 & 0x1) ? RB_SINGLE : 0;
#endif
if (sysconsole == 0) if (sysconsole == 0)
syscnattach(0); syscnattach(0);
@ -941,7 +943,7 @@ microtime(tvp)
splx(s); splx(s);
} }
#ifndef ROMCONS #if 1
struct consdev *cn_tab = &syscons; struct consdev *cn_tab = &syscons;
@ -964,27 +966,65 @@ struct consdev romcons = {
}; };
struct consdev *cn_tab = &romcons; 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) \
#define ROMPUTC(x) romcall(7, 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 void
romcnputc(dev, c) romcnputc(dev, c)
dev_t dev; dev_t dev;
int c; int c;
{ {
int s;
s = splhigh();
ROMPUTC(c); ROMPUTC(c);
splx(s);
} }
int int
romcngetc(dev) romcngetc(dev)
dev_t dev; dev_t dev;
{ {
int c; int s, c;
do { do {
s = splhigh();
c = ROMGETC(); c = ROMGETC();
splx(s);
} while (c == -1); } while (c == -1);
return c; return c;
} }