summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2004-07-31 22:27:35 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2004-07-31 22:27:35 +0000
commit0b92d138ef22d8a48ecff714425edfa0fd68161f (patch)
tree303c29cadea830dd6d621dc45e6a96760cb0024f /sys
parent1c1b00acf055c1402e3d19a43a3f5a5e5071d140 (diff)
Use cons_decl() instead of homemade wrong prototypes.
While there, fix a mismatch between the zs device number and the associated dev_t nodes.
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/mvme68k/dev/bugtty.c33
-rw-r--r--sys/arch/mvme68k/dev/zs.c51
2 files changed, 29 insertions, 55 deletions
diff --git a/sys/arch/mvme68k/dev/bugtty.c b/sys/arch/mvme68k/dev/bugtty.c
index 1b68fa30c59..fb70eef3791 100644
--- a/sys/arch/mvme68k/dev/bugtty.c
+++ b/sys/arch/mvme68k/dev/bugtty.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bugtty.c,v 1.12 2004/01/14 20:50:48 miod Exp $ */
+/* $OpenBSD: bugtty.c,v 1.13 2004/07/31 22:27:34 miod Exp $ */
/*
* Copyright (c) 1995 Dale Rahn.
@@ -55,10 +55,7 @@ struct cfdriver bugtty_cd = {
};
/* prototypes */
-int bugttycnprobe(struct consdev *cp);
-int bugttycninit(struct consdev *cp);
-int bugttycngetc(dev_t dev);
-void bugttycnputc(dev_t dev, char c);
+cons_decl(bugtty);
struct tty *bugttytty(dev_t);
int bugttymctl(dev_t, int, int);
@@ -74,7 +71,8 @@ char bugtty_ibuffer[BUGBUF+1];
volatile char *pinchar = bugtty_ibuffer;
char bug_obuffer[BUGBUF+1];
-struct tty *bugtty_tty[NBUGTTY];
+#define BUGTTYS 4
+struct tty *bugtty_tty[BUGTTYS];
struct tty *
bugttytty(dev)
@@ -83,7 +81,7 @@ bugttytty(dev)
int unit;
unit = BUGTTYUNIT(dev);
- if (unit >= NBUGTTY)
+ if (unit >= BUGTTYS)
return (NULL);
return (bugtty_tty[unit]);
}
@@ -107,7 +105,7 @@ bugttyattach(parent, self, aux)
struct device *self;
void *aux;
{
- printf("\n");
+ printf(": fallback console\n");
}
void bugttyoutput(struct tty *tp);
@@ -440,7 +438,7 @@ bugttystop(tp, flag)
/*
* bugtty is the last possible choice for a console device.
*/
-int
+void
bugttycnprobe(cp)
struct consdev *cp;
{
@@ -449,18 +447,9 @@ bugttycnprobe(cp)
if (needprom == 0) {
cp->cn_pri = CN_DEAD;
- return (0);
+ return;
}
- switch (cputyp) {
- case CPU_147:
- case CPU_162:
- cp->cn_pri = CN_NORMAL;
- return (0);
- default:
- break;
- }
-
/* locate the major number */
for (maj = 0; maj < nchrdev; maj++)
if (cdevsw[maj].d_open == bugttyopen)
@@ -468,15 +457,13 @@ bugttycnprobe(cp)
cp->cn_dev = makedev(maj, 0);
cp->cn_pri = CN_NORMAL;
-
- return (1);
}
-int
+void
bugttycninit(cp)
struct consdev *cp;
{
- return (0);
+ /* Nothing to do */
}
int
diff --git a/sys/arch/mvme68k/dev/zs.c b/sys/arch/mvme68k/dev/zs.c
index a8e0562529c..f0e4ca51bea 100644
--- a/sys/arch/mvme68k/dev/zs.c
+++ b/sys/arch/mvme68k/dev/zs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: zs.c,v 1.18 2004/07/30 22:29:45 miod Exp $ */
+/* $OpenBSD: zs.c,v 1.19 2004/07/31 22:27:34 miod Exp $ */
/*
* Copyright (c) 2000 Steve Murphree, Jr.
@@ -59,7 +59,6 @@
#include <mvme68k/dev/mcreg.h>
#endif
-
#include "zs.h"
#define NZSLINE (NZS*2)
@@ -160,11 +159,7 @@ void zs_unblock(struct tty *);
void zs_txint(struct zs *);
void zs_rxint(struct zs *);
void zs_extint(struct zs *);
-int zscnprobe(struct consdev *);
-void zscninit(void);
-int zscngetc(dev_t);
-void zscnputc(dev_t, int);
-void zs_cnsetup(int, struct termios *);
+cons_decl(zs);
int
zsmatch(parent, vcf, args)
@@ -203,9 +198,9 @@ zsattach(parent, self, args)
int size;
static int initirq = 0;
- /* connect the interrupt */
sc = (struct zssoftc *) self;
+ /* connect the interrupt */
sc->sc_ih.ih_fn = zsirq;
sc->sc_ih.ih_arg = (void *)self->dv_unit;
sc->sc_ih.ih_ipl = zs_level;
@@ -241,7 +236,7 @@ zsattach(parent, self, args)
*/
size = zsregs(ca->ca_vaddr, 0, &scc_cr, &scc_dr);
- if (zs_is_console && self->dv_unit == zsunit(zs_cons_unit)) {
+ if (zs_is_console && self->dv_unit == zs_cons_unit) {
/* SCC is the console - it's already reset */
zc = zp + zsside(zs_cons_unit);
zc->scc = *zs_cons_scc;
@@ -983,20 +978,20 @@ zs_softint(arg)
*/
/* probe for the SCC; should check hardware */
-int
+void
zscnprobe(cp)
struct consdev *cp;
{
int maj;
switch (cputyp) {
- case CPU_147:
- case CPU_162:
- case CPU_172:
- break;
- default:
- cp->cn_pri = CN_DEAD;
- return (0);
+ case CPU_147:
+ case CPU_162:
+ case CPU_172:
+ break;
+ default:
+ cp->cn_pri = CN_DEAD;
+ return;
}
/* locate the major number */
@@ -1004,11 +999,8 @@ zscnprobe(cp)
if (cdevsw[maj].d_open == zsopen)
break;
- /* initialize required fields */
cp->cn_dev = makedev(maj, 0);
- cp->cn_pri = CN_INTERNAL; /* better than PROM console */
-
- return (1);
+ cp->cn_pri = CN_NORMAL;
}
/* initialize the keyboard for use as the console */
@@ -1025,12 +1017,6 @@ struct termios zscn_termios = {
struct sccregs zs_cons_sccregs;
int zs_cons_imask;
-void
-zscninit()
-{
- zs_cnsetup(0, &zscn_termios);
-}
-
/* Polling routine for console input from a serial port. */
int
zscngetc(dev)
@@ -1070,10 +1056,11 @@ zscnputc(dev, c)
}
void
-zs_cnsetup(unit, tiop)
- int unit;
- struct termios *tiop;
+zscninit(cp)
+ struct consdev *cp;
{
+ int unit = 0;
+ struct termios *tiop = &zscn_termios;
volatile u_char *scc_cr, *scc_dr;
struct sccregs *scc;
int size;
@@ -1145,7 +1132,7 @@ zsregs(va, unit, crp, drp)
#ifdef MVME147
case CPU_147:
if (!va)
- va = (void *)IIOV(zs_cons_addrs_147[zsunit(unit)]);
+ va = (void *)IIOV(zs_cons_addrs_147[unit]);
scc_adr_147 = (volatile struct scc_147 *)va;
scc_cr = &scc_adr_147->cr;
scc_dr = &scc_adr_147->dr;
@@ -1156,7 +1143,7 @@ zsregs(va, unit, crp, drp)
case CPU_162:
case CPU_172:
if (!va)
- va = (void *)IIOV(zs_cons_addrs_162[zsunit(unit)]);
+ va = (void *)IIOV(zs_cons_addrs_162[unit]);
scc_adr_162 = (volatile struct scc_162 *)va;
scc_cr = &scc_adr_162->cr;
scc_dr = &scc_adr_162->dr;