diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2004-05-14 20:38:33 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2004-05-14 20:38:33 +0000 |
commit | 40415f62a5f614d6d6b0b9a92882934895e42f1a (patch) | |
tree | f62ae144e85f5a31d99f62553c895dad2f92ce22 /sys/arch/mvmeppc/dev | |
parent | 0d614b6af11e9dadea6b33f9766b03b9f388342b (diff) |
Attach a working bugtty device - userland needs at least a console tty.
Diffstat (limited to 'sys/arch/mvmeppc/dev')
-rw-r--r-- | sys/arch/mvmeppc/dev/bugtty.c | 67 | ||||
-rw-r--r-- | sys/arch/mvmeppc/dev/clock.c | 10 | ||||
-rw-r--r-- | sys/arch/mvmeppc/dev/mainbus.c | 11 | ||||
-rw-r--r-- | sys/arch/mvmeppc/dev/raven.c | 6 |
4 files changed, 62 insertions, 32 deletions
diff --git a/sys/arch/mvmeppc/dev/bugtty.c b/sys/arch/mvmeppc/dev/bugtty.c index 93ce770a757..065c3aa782d 100644 --- a/sys/arch/mvmeppc/dev/bugtty.c +++ b/sys/arch/mvmeppc/dev/bugtty.c @@ -1,9 +1,9 @@ -/* $OpenBSD: bugtty.c,v 1.9 2004/01/14 20:50:48 miod Exp $ */ +/* $OpenBSD: bugtty.c,v 1.10 2004/05/14 20:38:32 miod Exp $ */ -/* Copyright (c) 1998 Steve Murphree, Jr. +/* Copyright (c) 1998 Steve Murphree, Jr. * Copyright (c) 1995 Dale Rahn. * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -25,7 +25,7 @@ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ + */ #include <sys/param.h> #include <sys/systm.h> @@ -33,12 +33,12 @@ #include <sys/device.h> #include <sys/tty.h> #include <sys/proc.h> -#include <sys/conf.h> #include <sys/uio.h> #include <sys/queue.h> #include <machine/autoconf.h> #include <machine/bugio.h> +#include <machine/conf.h> #include <machine/cpu.h> #include <dev/cons.h> @@ -50,7 +50,7 @@ void bugttyattach(struct device *parent, struct device *self, void *aux); struct cfattach bugtty_ca = { sizeof(struct device), bugttymatch, bugttyattach -}; +}; struct cfdriver bugtty_cd = { NULL, "bugtty", DV_TTY @@ -62,6 +62,7 @@ cdev_decl(bugtty); int bugttymctl(dev_t dev, int bits, int how); int bugttyparam(struct tty *tp, struct termios *tm); +void bugtty_chkinput(void); #define DIALOUT(x) ((x) & 0x80) #define SWFLAGS(dev) (bugttyswflags | (DIALOUT(dev) ? TIOCFLAG_SOFTCAR : 0)) @@ -71,19 +72,8 @@ char bugtty_ibuffer[BUGBUF+1]; volatile char *pinchar = bugtty_ibuffer; char bug_obuffer[BUGBUF+1]; -struct tty *bugtty_tty[NBUGTTY]; - -/* - int ca_bustype; - void *ca_vaddr; - void *ca_paddr; - int ca_offset; - int ca_len; - int ca_ipl; - int ca_vec; - char *ca_name; - void *ca_master; points to bus-dependent data -*/ +#define BUGTTYS 4 +struct tty *bugtty_tty[BUGTTYS]; int bugttymatch(parent, self, aux) @@ -91,6 +81,11 @@ bugttymatch(parent, self, aux) void *self; void *aux; { + struct confargs *ca = aux; + + if (strcmp(ca->ca_name, bugtty_cd.cd_name) != 0) + return (0); + return (1); } @@ -100,7 +95,7 @@ bugttyattach(parent, self, aux) struct device *self; void *aux; { - printf(": bugtty\n"); + printf(": fallback console\n"); } #define BUGTTYUNIT(x) ((x) & (0x7f)) @@ -109,13 +104,13 @@ void bugttyoutput(struct tty *tp); int bugttydefaultrate = TTYDEF_SPEED; int bugttyswflags; -struct tty * +struct tty * bugttytty(dev) dev_t dev; { int unit; unit = BUGTTYUNIT(dev); - if (unit >= 4) { + if (unit >= BUGTTYS) { return (NULL); } return bugtty_tty[unit]; @@ -246,7 +241,7 @@ void bugttyoutput(tp) struct tty *tp; { - int cc, s, cnt ; + int cc, s, cnt; /* only supports one unit */ @@ -291,10 +286,26 @@ bugttyread(dev, uio, flag) struct tty *tp; if ((tp = bugtty_tty[BUGTTYUNIT(dev)]) == NULL) - return (ENXIO); + return (ENXIO); return ((*linesw[tp->t_line].l_read)(tp, uio, flag)); } +/* only to be called at splclk() */ +void +bugtty_chkinput() +{ + struct tty *tp; + + tp = bugtty_tty[0]; /* assumes console on the first port... */ + if (tp == NULL) + return; + + while (mvmeprom_instat() != 0) { + u_char c = mvmeprom_getchar() & 0xff; + (*linesw[tp->t_line].l_rint)(c, tp); + } +} + int bugttywrite(dev, uio, flag) dev_t dev; @@ -340,7 +351,7 @@ bugttyioctl(dev, cmd, data, flag, p) return (ENXIO); error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag, p); - if (error >= 0) + if (error >= 0) return (error); error = ttioctl(tp, cmd, data, flag, p); @@ -383,9 +394,9 @@ bugttyioctl(dev, cmd, data, flag, p) *(int *)data = SWFLAGS(dev); break; case TIOCSFLAGS: - error = suser(p, 0); + error = suser(p, 0); if (error != 0) - return (EPERM); + return (EPERM); bugttyswflags = *(int *)data; bugttyswflags &= /* only allow valid flags */ @@ -422,7 +433,7 @@ bugttycnprobe(cp) struct consdev *cp; { int maj; - + /* locate the major number */ for (maj = 0; maj < nchrdev; maj++) if (cdevsw[maj].d_open == bugttyopen) diff --git a/sys/arch/mvmeppc/dev/clock.c b/sys/arch/mvmeppc/dev/clock.c index 8cc39d5bffa..61a7af3cd6e 100644 --- a/sys/arch/mvmeppc/dev/clock.c +++ b/sys/arch/mvmeppc/dev/clock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: clock.c,v 1.8 2004/01/28 23:50:16 miod Exp $ */ +/* $OpenBSD: clock.c,v 1.9 2004/05/14 20:38:32 miod Exp $ */ /* $NetBSD: clock.c,v 1.1 1996/09/30 16:34:40 ws Exp $ */ /* @@ -40,6 +40,8 @@ #include <machine/intr.h> #include <machine/powerpc.h> +#include "bugtty.h" + void resettodr(void); void decr_intr(struct clockframe *); void calc_delayconst(void); @@ -345,6 +347,12 @@ decr_intr(struct clockframe *frame) lasttb += ticks_per_intr; intrcnt[PPC_CLK_IRQ]++; hardclock(frame); +#if NBUGTTY > 0 + { + extern void bugtty_chkinput(void); + bugtty_chkinput(); + } +#endif } while (nstats-- > 0) diff --git a/sys/arch/mvmeppc/dev/mainbus.c b/sys/arch/mvmeppc/dev/mainbus.c index 8882258b435..a616cef8f0a 100644 --- a/sys/arch/mvmeppc/dev/mainbus.c +++ b/sys/arch/mvmeppc/dev/mainbus.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mainbus.c,v 1.8 2004/01/29 21:33:10 miod Exp $ */ +/* $OpenBSD: mainbus.c,v 1.9 2004/05/14 20:38:32 miod Exp $ */ /* * Copyright (c) 1994, 1995 Carnegie-Mellon University. @@ -109,10 +109,17 @@ mbattach(struct device *parent, struct device *self, void *aux) config_found(self, &nca, mbprint); /* + * Attach the BUG terminal services if necessary. + */ + nca.ca_name = "bugtty"; + nca.ca_bus = &sc->sc_bus; + config_found(self, &nca, mbprint); + + /* * Find and attach the PCI Northbridge. It will find and attach * everything. */ - nca.ca_name = "mpcpcibr"; + nca.ca_name = "raven"; nca.ca_bus = &sc->sc_bus; config_found(self, &nca, mbprint); } diff --git a/sys/arch/mvmeppc/dev/raven.c b/sys/arch/mvmeppc/dev/raven.c index 2dc6024e105..9bcda262db7 100644 --- a/sys/arch/mvmeppc/dev/raven.c +++ b/sys/arch/mvmeppc/dev/raven.c @@ -1,4 +1,4 @@ -/* $OpenBSD: raven.c,v 1.5 2004/01/29 10:58:06 miod Exp $ */ +/* $OpenBSD: raven.c,v 1.6 2004/05/14 20:38:32 miod Exp $ */ /* * Copyright (c) 2001 Steve Murphree, Jr. @@ -63,9 +63,13 @@ struct cfdriver raven_cd = { int raven_match(struct device *parent, void *match, void *aux) { + struct confargs *ca = aux; void *va; u_int32_t probe; + if (strcmp(ca->ca_name, raven_cd.cd_name) != 0) + return 0; + if ((va = mapiodev((paddr_t)RAVEN_BASE, RAVEN_SIZE)) == NULL) return 0; |