diff options
author | phk <phk@FreeBSD.org> | 2003-02-20 20:54:45 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2003-02-20 20:54:45 +0000 |
commit | 72688ad7fe6ac65cbfc2c4d260ba7d901bf1bcc2 (patch) | |
tree | fe84e49e8fed83b0535fa5e72d7341488cc6b288 | |
parent | f5440b21c3c89d9d1d989bbed1147a6d7e678e41 (diff) | |
download | FreeBSD-src-72688ad7fe6ac65cbfc2c4d260ba7d901bf1bcc2.zip FreeBSD-src-72688ad7fe6ac65cbfc2c4d260ba7d901bf1bcc2.tar.gz |
Change the console interface to pass a "struct consdev *" instead of a
dev_t to the method functions.
The dev_t can still be found at struct consdev *->cn_dev.
Add a void *cn_arg element to struct consdev which the drivers can use
for retrieving their softc.
-rw-r--r-- | sys/alpha/alpha/machdep.c | 1 | ||||
-rw-r--r-- | sys/alpha/alpha/mp_machdep.c | 1 | ||||
-rw-r--r-- | sys/alpha/alpha/prom.c | 10 | ||||
-rw-r--r-- | sys/alpha/alpha/promcons.c | 4 | ||||
-rw-r--r-- | sys/alpha/alpha/vm_machdep.c | 1 | ||||
-rw-r--r-- | sys/alpha/include/prom.h | 6 | ||||
-rw-r--r-- | sys/alpha/mcbus/mcpcia.c | 1 | ||||
-rw-r--r-- | sys/alpha/osf1/osf1_signal.c | 1 | ||||
-rw-r--r-- | sys/alpha/tlsb/zs_tlsb.c | 18 | ||||
-rw-r--r-- | sys/dev/ofw/ofw_console.c | 10 | ||||
-rw-r--r-- | sys/dev/sab/sab.c | 8 | ||||
-rw-r--r-- | sys/dev/sio/sio.c | 29 | ||||
-rw-r--r-- | sys/dev/syscons/syscons.c | 8 | ||||
-rw-r--r-- | sys/dev/zs/zs.c | 8 | ||||
-rw-r--r-- | sys/i386/isa/pcvt/pcvt_drv.c | 6 | ||||
-rw-r--r-- | sys/ia64/ia64/ssc.c | 10 | ||||
-rw-r--r-- | sys/kern/tty_cons.c | 8 | ||||
-rw-r--r-- | sys/pc98/cbus/sio.c | 26 | ||||
-rw-r--r-- | sys/pc98/pc98/sio.c | 26 | ||||
-rw-r--r-- | sys/pc98/pc98/syscons.c | 8 | ||||
-rw-r--r-- | sys/sys/cons.h | 9 |
21 files changed, 110 insertions, 89 deletions
diff --git a/sys/alpha/alpha/machdep.c b/sys/alpha/alpha/machdep.c index 614f50b..3e7dcbb 100644 --- a/sys/alpha/alpha/machdep.c +++ b/sys/alpha/alpha/machdep.c @@ -111,6 +111,7 @@ #include <sys/bio.h> #include <sys/buf.h> #include <sys/bus.h> +#include <sys/cons.h> #include <sys/mbuf.h> #include <sys/vmmeter.h> #include <sys/msgbuf.h> diff --git a/sys/alpha/alpha/mp_machdep.c b/sys/alpha/alpha/mp_machdep.c index ed32a65..f709628 100644 --- a/sys/alpha/alpha/mp_machdep.c +++ b/sys/alpha/alpha/mp_machdep.c @@ -30,6 +30,7 @@ #include <sys/systm.h> #include <sys/ktr.h> #include <sys/proc.h> +#include <sys/cons.h> #include <sys/lock.h> #include <sys/malloc.h> #include <sys/mutex.h> diff --git a/sys/alpha/alpha/prom.c b/sys/alpha/alpha/prom.c index ba914c5..58c9cf9 100644 --- a/sys/alpha/alpha/prom.c +++ b/sys/alpha/alpha/prom.c @@ -129,9 +129,7 @@ static void leave_prom(critical_t); * of the console area. */ void -promcnputc(dev, c) - dev_t dev; - int c; +promcnputc(struct consdev *cp, int c) { prom_return_t ret; unsigned char *to = (unsigned char *)0x20000000; @@ -153,8 +151,7 @@ promcnputc(dev, c) * Wait for the prom to get a real char and pass it back. */ int -promcngetc(dev) - dev_t dev; +promcngetc(struct consdev *cp) { prom_return_t ret; register_t s; @@ -174,8 +171,7 @@ promcngetc(dev) * If a char is ready, return it, otherwise return -1. */ int -promcncheckc(dev) - dev_t dev; +promcncheckc(struct consdev *cp) { prom_return_t ret; register_t s; diff --git a/sys/alpha/alpha/promcons.c b/sys/alpha/alpha/promcons.c index 276de20..6445625 100644 --- a/sys/alpha/alpha/promcons.c +++ b/sys/alpha/alpha/promcons.c @@ -209,7 +209,7 @@ promstart(tp) tp->t_state |= TS_BUSY; while (tp->t_outq.c_cc != 0) - promcnputc(tp->t_dev, getc(&tp->t_outq)); + promcnputc(NULL, getc(&tp->t_outq)); tp->t_state &= ~TS_BUSY; ttwwakeup(tp); @@ -240,7 +240,7 @@ promtimeout(v) struct tty *tp = v; int c; - while ((c = promcncheckc(tp->t_dev)) != -1) { + while ((c = promcncheckc(NULL)) != -1) { if (tp->t_state & TS_ISOPEN) (*linesw[tp->t_line].l_rint)(c, tp); } diff --git a/sys/alpha/alpha/vm_machdep.c b/sys/alpha/alpha/vm_machdep.c index 73f2343..28bb44e 100644 --- a/sys/alpha/alpha/vm_machdep.c +++ b/sys/alpha/alpha/vm_machdep.c @@ -73,6 +73,7 @@ #include <sys/malloc.h> #include <sys/bio.h> #include <sys/buf.h> +#include <sys/cons.h> #include <sys/mutex.h> #include <sys/vnode.h> #include <sys/vmmeter.h> diff --git a/sys/alpha/include/prom.h b/sys/alpha/include/prom.h index b242f1d..05cb4fb 100644 --- a/sys/alpha/include/prom.h +++ b/sys/alpha/include/prom.h @@ -97,9 +97,9 @@ int prom_getenv(int, char *, int); #ifdef _KERNEL void promcnattach(int); void promcndetach(void); -void promcnputc(dev_t, int); -int promcngetc(dev_t); -int promcncheckc(dev_t); +cn_putc_t promcnputc; +cn_getc_t promcngetc; +cn_checkc_t promcncheckc; u_int64_t prom_dispatch(u_int64_t, u_int64_t, u_int64_t, u_int64_t, u_int64_t); diff --git a/sys/alpha/mcbus/mcpcia.c b/sys/alpha/mcbus/mcpcia.c index 615b32f..d1b5af5 100644 --- a/sys/alpha/mcbus/mcpcia.c +++ b/sys/alpha/mcbus/mcpcia.c @@ -34,6 +34,7 @@ #include <sys/module.h> #include <sys/mutex.h> #include <sys/bus.h> +#include <sys/cons.h> #include <machine/bus.h> #include <machine/md_var.h> #include <sys/proc.h> diff --git a/sys/alpha/osf1/osf1_signal.c b/sys/alpha/osf1/osf1_signal.c index c5be828..b1369ed 100644 --- a/sys/alpha/osf1/osf1_signal.c +++ b/sys/alpha/osf1/osf1_signal.c @@ -66,6 +66,7 @@ #include <vm/vm_pager.h> #include <sys/user.h> #include <sys/ptrace.h> +#include <sys/cons.h> #include <machine/clock.h> #include <machine/md_var.h> #include <machine/reg.h> diff --git a/sys/alpha/tlsb/zs_tlsb.c b/sys/alpha/tlsb/zs_tlsb.c index 5a72a74..c22e4fc 100644 --- a/sys/alpha/tlsb/zs_tlsb.c +++ b/sys/alpha/tlsb/zs_tlsb.c @@ -216,9 +216,9 @@ zs_putc(caddr_t base, int chan, int c) /* * Console support */ -int zs_cngetc(dev_t); -int zs_cncheckc(dev_t); -void zs_cnputc(dev_t, int); +cn_getc_t zs_cngetc; +cn_checkc_t zs_cncheckc; +cn_putc_t zs_cnputc; static caddr_t zs_console_addr; CONS_DRIVER(zs, NULL, NULL, NULL, zs_cngetc, zs_cncheckc, zs_cnputc, NULL); @@ -237,28 +237,28 @@ zs_cnattach(vm_offset_t base, vm_offset_t offset) } int -zs_cngetc(dev_t dev) +zs_cngetc(struct consdev *cp) { int s = spltty(); - int c = zs_getc(zs_console_addr, minor(dev)); + int c = zs_getc(zs_console_addr, minor(cp->cn_dev)); splx(s); return c; } int -zs_cncheckc(dev_t dev) +zs_cncheckc(struct consdev *cp) { int s = spltty(); - int c = zs_maygetc(zs_console_addr, minor(dev)); + int c = zs_maygetc(zs_console_addr, minor(cp->cn_dev)); splx(s); return c; } void -zs_cnputc(dev_t dev, int c) +zs_cnputc(struct consdev *cp, int c) { int s = spltty(); - zs_putc(zs_console_addr, minor(dev), c); + zs_putc(zs_console_addr, minor(cp->cn_dev), c); splx(s); } diff --git a/sys/dev/ofw/ofw_console.c b/sys/dev/ofw/ofw_console.c index 149739f..379a753 100644 --- a/sys/dev/ofw/ofw_console.c +++ b/sys/dev/ofw/ofw_console.c @@ -224,7 +224,7 @@ ofw_tty_start(struct tty *tp) tp->t_state |= TS_BUSY; while (tp->t_outq.c_cc != 0) { - ofw_cons_putc(tp->t_dev, getc(&tp->t_outq)); + ofw_cons_putc(NULL, getc(&tp->t_outq)); } tp->t_state &= ~TS_BUSY; @@ -250,7 +250,7 @@ ofw_timeout(void *v) tp = (struct tty *)v; - while ((c = ofw_cons_checkc(tp->t_dev)) != -1) { + while ((c = ofw_cons_checkc(NULL)) != -1) { if (tp->t_state & TS_ISOPEN) { (*linesw[tp->t_line].l_rint)(c, tp); } @@ -292,7 +292,7 @@ ofw_cons_init(struct consdev *cp) } static int -ofw_cons_getc(dev_t dev) +ofw_cons_getc(struct consdev *cp) { unsigned char ch; int l; @@ -314,7 +314,7 @@ ofw_cons_getc(dev_t dev) } static int -ofw_cons_checkc(dev_t dev) +ofw_cons_checkc(struct consdev *cp) { unsigned char ch; @@ -330,7 +330,7 @@ ofw_cons_checkc(dev_t dev) } static void -ofw_cons_putc(dev_t dev, int c) +ofw_cons_putc(struct consdev *cp, int c) { char cbuf; diff --git a/sys/dev/sab/sab.c b/sys/dev/sab/sab.c index 0540dcf..9218bee 100644 --- a/sys/dev/sab/sab.c +++ b/sys/dev/sab/sab.c @@ -1132,7 +1132,7 @@ sab_cnterm(struct consdev *cn) } static int -sab_cngetc(dev_t dev) +sab_cngetc(struct consdev *cn) { struct sabtty_softc *sc = sabtty_cons; @@ -1142,7 +1142,7 @@ sab_cngetc(dev_t dev) } static int -sab_cncheckc(dev_t dev) +sab_cncheckc(struct consdev *cn) { struct sabtty_softc *sc = sabtty_cons; @@ -1152,7 +1152,7 @@ sab_cncheckc(dev_t dev) } static void -sab_cnputc(dev_t dev, int c) +sab_cnputc(struct consdev *cn, int c) { struct sabtty_softc *sc = sabtty_cons; @@ -1162,7 +1162,7 @@ sab_cnputc(dev_t dev, int c) } static void -sab_cndbctl(dev_t dev, int c) +sab_cndbctl(struct consdev *cn, int c) { } diff --git a/sys/dev/sio/sio.c b/sys/dev/sio/sio.c index 7efb668..8d7f95a 100644 --- a/sys/dev/sio/sio.c +++ b/sys/dev/sio/sio.c @@ -2773,6 +2773,8 @@ CONS_DRIVER(sio, siocnprobe, siocninit, siocnterm, siocngetc, siocncheckc, /* To get the GDB related variables */ #if DDB > 0 #include <ddb/ddb.h> +static struct consdev gdbconsdev; + #endif static void @@ -2982,7 +2984,8 @@ siocnprobe(cp) siogdbiobase = iobase; siogdbunit = unit; #if DDB > 0 - gdb_arg = makedev(CDEV_MAJOR, unit); + gdbconsdev.cn_dev = makedev(CDEV_MAJOR, unit); + gdb_arg = &gdbconsdev; gdb_getc = siocngetc; gdb_putc = siocnputc; #endif @@ -3003,7 +3006,8 @@ siocnprobe(cp) printf("configuration file (currently sio only).\n"); siogdbiobase = siocniobase; siogdbunit = siocnunit; - gdb_arg = makedev(CDEV_MAJOR, siocnunit); + gdbconsdev.cn_dev = makedev(CDEV_MAJOR, siocnunit); + gdb_arg = &gdbconsdev; gdb_getc = siocngetc; gdb_putc = siocnputc; } @@ -3090,7 +3094,8 @@ siogdbattach(port, speed) printf("sio%d: gdb debugging port\n", unit); siogdbunit = unit; #if DDB > 0 - gdb_arg = makedev(CDEV_MAJOR, unit); + gdbconsdev.cn_dev = makedev(CDEV_MAJOR, unit); + gdb_arg = &gdbconsdev; gdb_getc = siocngetc; gdb_putc = siocnputc; #endif @@ -3122,15 +3127,16 @@ siogdbattach(port, speed) #endif static int -siocncheckc(dev) - dev_t dev; +siocncheckc(struct consdev *cd) { int c; + dev_t dev; Port_t iobase; int s; struct siocnstate sp; speed_t speed; - + + dev = cd->cn_dev; if (minor(dev) == siocnunit) { iobase = siocniobase; speed = comdefaultrate; @@ -3151,15 +3157,16 @@ siocncheckc(dev) static int -siocngetc(dev) - dev_t dev; +siocngetc(struct consdev *cd) { int c; + dev_t dev; Port_t iobase; int s; struct siocnstate sp; speed_t speed; + dev = cd->cn_dev; if (minor(dev) == siocnunit) { iobase = siocniobase; speed = comdefaultrate; @@ -3178,16 +3185,16 @@ siocngetc(dev) } static void -siocnputc(dev, c) - dev_t dev; - int c; +siocnputc(struct consdev *cd, int c) { int need_unlock; int s; + dev_t dev; struct siocnstate sp; Port_t iobase; speed_t speed; + dev = cd->cn_dev; if (minor(dev) == siocnunit) { iobase = siocniobase; speed = comdefaultrate; diff --git a/sys/dev/syscons/syscons.c b/sys/dev/syscons/syscons.c index aad98aa..aeb80fa 100644 --- a/sys/dev/syscons/syscons.c +++ b/sys/dev/syscons/syscons.c @@ -1468,7 +1468,7 @@ sccnattach(void) #endif /* __alpha__ */ static void -sccnputc(dev_t dev, int c) +sccnputc(struct consdev *cd, int c) { u_char buf[1]; scr_stat *scp = sc_console; @@ -1510,19 +1510,19 @@ sccnputc(dev_t dev, int c) } static int -sccngetc(dev_t dev) +sccngetc(struct consdev *cd) { return sccngetch(0); } static int -sccncheckc(dev_t dev) +sccncheckc(struct consdev *cd) { return sccngetch(SCGETC_NONBLOCK); } static void -sccndbctl(dev_t dev, int on) +sccndbctl(struct consdev *cd, int on) { /* assert(sc_console_unit >= 0) */ /* try to switch to the kernel console screen */ diff --git a/sys/dev/zs/zs.c b/sys/dev/zs/zs.c index 24e78d3..4f54b41 100644 --- a/sys/dev/zs/zs.c +++ b/sys/dev/zs/zs.c @@ -890,7 +890,7 @@ zs_cnterm(struct consdev *cn) } static int -zs_cngetc(dev_t dev) +zs_cngetc(struct consdev *cn) { struct zstty_softc *sc = zstty_cons; @@ -900,7 +900,7 @@ zs_cngetc(dev_t dev) } static int -zs_cncheckc(dev_t dev) +zs_cncheckc(struct consdev *cn) { struct zstty_softc *sc = zstty_cons; @@ -910,7 +910,7 @@ zs_cncheckc(dev_t dev) } static void -zs_cnputc(dev_t dev, int c) +zs_cnputc(struct consdev *cn, int c) { struct zstty_softc *sc = zstty_cons; @@ -920,7 +920,7 @@ zs_cnputc(dev_t dev, int c) } static void -zs_cndbctl(dev_t dev, int c) +zs_cndbctl(struct consdev *cn, int c) { } diff --git a/sys/i386/isa/pcvt/pcvt_drv.c b/sys/i386/isa/pcvt/pcvt_drv.c index 90fc98e..45b74b3 100644 --- a/sys/i386/isa/pcvt/pcvt_drv.c +++ b/sys/i386/isa/pcvt/pcvt_drv.c @@ -725,7 +725,7 @@ pcvt_cn_term(struct consdev *cp) * console put char *---------------------------------------------------------------------------*/ static void -pcvt_cn_putc(dev_t dev, int c) +pcvt_cn_putc(struct consdev *cd, int c) { if (c == '\n') sput("\r", 1, 1, 0); @@ -739,7 +739,7 @@ pcvt_cn_putc(dev_t dev, int c) * console get char *---------------------------------------------------------------------------*/ static int -pcvt_cn_getc(dev_t dev) +pcvt_cn_getc(struct consdev *cd) { register int s; static u_char *cp, cbuf[4]; /* Temp buf for multi-char key sequence. */ @@ -789,7 +789,7 @@ pcvt_cn_getc(dev_t dev) * console check for char *---------------------------------------------------------------------------*/ static int -pcvt_cn_checkc(dev_t dev) +pcvt_cn_checkc(struct consdev *cd) { char *cp; int x; diff --git a/sys/ia64/ia64/ssc.c b/sys/ia64/ia64/ssc.c index 6c3cb35..e552ffd 100644 --- a/sys/ia64/ia64/ssc.c +++ b/sys/ia64/ia64/ssc.c @@ -116,13 +116,13 @@ ssccnattach(void *arg) SYSINIT(ssccnattach, SI_SUB_DRIVERS, SI_ORDER_ANY, ssccnattach, 0); static void -ssccnputc(dev_t dev, int c) +ssccnputc(struct consdev *cp, int c) { ssc(c, 0, 0, 0, SSC_PUTCHAR); } static int -ssccngetc(dev_t dev) +ssccngetc(struct consdev *cp) { int c; do { @@ -133,7 +133,7 @@ ssccngetc(dev_t dev) } static int -ssccncheckc(dev_t dev) +ssccncheckc(struct consdev *cp) { int c; c = ssc(0, 0, 0, 0, SSC_GETCHAR); @@ -242,7 +242,7 @@ sscstart(struct tty *tp) tp->t_state |= TS_BUSY; while (tp->t_outq.c_cc != 0) - ssccnputc(tp->t_dev, getc(&tp->t_outq)); + ssccnputc(NULL, getc(&tp->t_outq)); tp->t_state &= ~TS_BUSY; ttwwakeup(tp); @@ -270,7 +270,7 @@ ssctimeout(void *v) struct tty *tp = v; int c; - while ((c = ssccncheckc(tp->t_dev)) != -1) { + while ((c = ssccncheckc(NULL)) != -1) { if (tp->t_state & TS_ISOPEN) (*linesw[tp->t_line].l_rint)(c, tp); } diff --git a/sys/kern/tty_cons.c b/sys/kern/tty_cons.c index 361a5dd..e672eac 100644 --- a/sys/kern/tty_cons.c +++ b/sys/kern/tty_cons.c @@ -529,7 +529,7 @@ cncheckc(void) return (-1); STAILQ_FOREACH(cnd, &cn_devlist, cnd_next) { cn = cnd->cnd_cn; - c = cn->cn_checkc(cn->cn_dev); + c = cn->cn_checkc(cn); if (c != -1) { return (c); } @@ -549,8 +549,8 @@ cnputc(int c) STAILQ_FOREACH(cnd, &cn_devlist, cnd_next) { cn = cnd->cnd_cn; if (c == '\n') - cn->cn_putc(cn->cn_dev, '\r'); - cn->cn_putc(cn->cn_dev, c); + cn->cn_putc(cn, '\r'); + cn->cn_putc(cn, c); } #ifdef DDB if (console_pausing && !db_active && (c == '\n')) { @@ -581,7 +581,7 @@ cndbctl(int on) STAILQ_FOREACH(cnd, &cn_devlist, cnd_next) { cn = cnd->cnd_cn; if (cn->cn_dbctl != NULL) - cn->cn_dbctl(cn->cn_dev, on); + cn->cn_dbctl(cn, on); } if (on) refcount++; diff --git a/sys/pc98/cbus/sio.c b/sys/pc98/cbus/sio.c index 7d497db..18f1483 100644 --- a/sys/pc98/cbus/sio.c +++ b/sys/pc98/cbus/sio.c @@ -4003,6 +4003,7 @@ CONS_DRIVER(sio, siocnprobe, siocninit, siocnterm, siocngetc, siocncheckc, /* To get the GDB related variables */ #if DDB > 0 #include <ddb/ddb.h> +struct consdev gdbconsdev; #endif static void @@ -4212,7 +4213,8 @@ siocnprobe(cp) siogdbiobase = iobase; siogdbunit = unit; #if DDB > 0 - gdb_arg = makedev(CDEV_MAJOR, unit); + gdbconsdev.cn_dev = makedev(CDEV_MAJOR, unit); + gdb_arg = &gdbconsdev; gdb_getc = siocngetc; gdb_putc = siocnputc; #endif @@ -4233,7 +4235,8 @@ siocnprobe(cp) printf("configuration file (currently sio only).\n"); siogdbiobase = siocniobase; siogdbunit = siocnunit; - gdb_arg = makedev(CDEV_MAJOR, siocnunit); + gdbconsdev.cn_dev = makedev(CDEV_MAJOR, siocnunit); + gdb_arg = &gdbconsdev; gdb_getc = siocngetc; gdb_putc = siocnputc; } @@ -4320,7 +4323,8 @@ siogdbattach(port, speed) printf("sio%d: gdb debugging port\n", unit); siogdbunit = unit; #if DDB > 0 - gdb_arg = makedev(CDEV_MAJOR, unit); + gdbconsdev.cn_dev = makedev(CDEV_MAJOR, unit); + gdb_arg = &gdbconsdev; gdb_getc = siocngetc; gdb_putc = siocnputc; #endif @@ -4352,15 +4356,16 @@ siogdbattach(port, speed) #endif static int -siocncheckc(dev) - dev_t dev; +siocncheckc(struct consdev *cd) { int c; + dev_t dev; Port_t iobase; int s; struct siocnstate sp; speed_t speed; + dev = cd->cn_dev; if (minor(dev) == siocnunit) { iobase = siocniobase; speed = comdefaultrate; @@ -4381,15 +4386,16 @@ siocncheckc(dev) static int -siocngetc(dev) - dev_t dev; +siocngetc(struct consdev *cd) { int c; + dev_t dev; Port_t iobase; int s; struct siocnstate sp; speed_t speed; + dev = cd->cn_dev; if (minor(dev) == siocnunit) { iobase = siocniobase; speed = comdefaultrate; @@ -4408,16 +4414,16 @@ siocngetc(dev) } static void -siocnputc(dev, c) - dev_t dev; - int c; +siocnputc(struct consdev *cd, int c) { int need_unlock; int s; + dev_t dev; struct siocnstate sp; Port_t iobase; speed_t speed; + dev = cd->cn_dev; if (minor(dev) == siocnunit) { iobase = siocniobase; speed = comdefaultrate; diff --git a/sys/pc98/pc98/sio.c b/sys/pc98/pc98/sio.c index 7d497db..18f1483 100644 --- a/sys/pc98/pc98/sio.c +++ b/sys/pc98/pc98/sio.c @@ -4003,6 +4003,7 @@ CONS_DRIVER(sio, siocnprobe, siocninit, siocnterm, siocngetc, siocncheckc, /* To get the GDB related variables */ #if DDB > 0 #include <ddb/ddb.h> +struct consdev gdbconsdev; #endif static void @@ -4212,7 +4213,8 @@ siocnprobe(cp) siogdbiobase = iobase; siogdbunit = unit; #if DDB > 0 - gdb_arg = makedev(CDEV_MAJOR, unit); + gdbconsdev.cn_dev = makedev(CDEV_MAJOR, unit); + gdb_arg = &gdbconsdev; gdb_getc = siocngetc; gdb_putc = siocnputc; #endif @@ -4233,7 +4235,8 @@ siocnprobe(cp) printf("configuration file (currently sio only).\n"); siogdbiobase = siocniobase; siogdbunit = siocnunit; - gdb_arg = makedev(CDEV_MAJOR, siocnunit); + gdbconsdev.cn_dev = makedev(CDEV_MAJOR, siocnunit); + gdb_arg = &gdbconsdev; gdb_getc = siocngetc; gdb_putc = siocnputc; } @@ -4320,7 +4323,8 @@ siogdbattach(port, speed) printf("sio%d: gdb debugging port\n", unit); siogdbunit = unit; #if DDB > 0 - gdb_arg = makedev(CDEV_MAJOR, unit); + gdbconsdev.cn_dev = makedev(CDEV_MAJOR, unit); + gdb_arg = &gdbconsdev; gdb_getc = siocngetc; gdb_putc = siocnputc; #endif @@ -4352,15 +4356,16 @@ siogdbattach(port, speed) #endif static int -siocncheckc(dev) - dev_t dev; +siocncheckc(struct consdev *cd) { int c; + dev_t dev; Port_t iobase; int s; struct siocnstate sp; speed_t speed; + dev = cd->cn_dev; if (minor(dev) == siocnunit) { iobase = siocniobase; speed = comdefaultrate; @@ -4381,15 +4386,16 @@ siocncheckc(dev) static int -siocngetc(dev) - dev_t dev; +siocngetc(struct consdev *cd) { int c; + dev_t dev; Port_t iobase; int s; struct siocnstate sp; speed_t speed; + dev = cd->cn_dev; if (minor(dev) == siocnunit) { iobase = siocniobase; speed = comdefaultrate; @@ -4408,16 +4414,16 @@ siocngetc(dev) } static void -siocnputc(dev, c) - dev_t dev; - int c; +siocnputc(struct consdev *cd, int c) { int need_unlock; int s; + dev_t dev; struct siocnstate sp; Port_t iobase; speed_t speed; + dev = cd->cn_dev; if (minor(dev) == siocnunit) { iobase = siocniobase; speed = comdefaultrate; diff --git a/sys/pc98/pc98/syscons.c b/sys/pc98/pc98/syscons.c index 55ce644..91d55a1 100644 --- a/sys/pc98/pc98/syscons.c +++ b/sys/pc98/pc98/syscons.c @@ -1469,7 +1469,7 @@ sccnattach(void) #endif /* __alpha__ */ static void -sccnputc(dev_t dev, int c) +sccnputc(struct consdev *cd, int c) { u_char buf[1]; scr_stat *scp = sc_console; @@ -1511,19 +1511,19 @@ sccnputc(dev_t dev, int c) } static int -sccngetc(dev_t dev) +sccngetc(struct consdev *cd) { return sccngetch(0); } static int -sccncheckc(dev_t dev) +sccncheckc(struct consdev *cd) { return sccngetch(SCGETC_NONBLOCK); } static void -sccndbctl(dev_t dev, int on) +sccndbctl(struct consdev *cd, int on) { /* try to switch to the kernel console screen */ if (on && debugger == 0) { diff --git a/sys/sys/cons.h b/sys/sys/cons.h index 6f64edc..ee4fed7 100644 --- a/sys/sys/cons.h +++ b/sys/sys/cons.h @@ -46,10 +46,10 @@ struct consdev; typedef void cn_probe_t(struct consdev *); typedef void cn_init_t(struct consdev *); typedef void cn_term_t(struct consdev *); -typedef int cn_getc_t(dev_t); -typedef int cn_checkc_t(dev_t); -typedef void cn_putc_t(dev_t, int); -typedef void cn_dbctl_t(dev_t, int); +typedef int cn_getc_t(struct consdev *); +typedef int cn_checkc_t(struct consdev *); +typedef void cn_putc_t(struct consdev *, int); +typedef void cn_dbctl_t(struct consdev *, int); struct consdev { cn_probe_t *cn_probe; @@ -69,6 +69,7 @@ struct consdev { struct tty *cn_tp; /* tty structure for console device */ dev_t cn_dev; /* major/minor of device */ short cn_pri; /* pecking order; the higher the better */ + void *cn_arg; /* drivers method argument */ }; /* values for cn_pri - reflect our policy for console selection */ |