diff options
author | bde <bde@FreeBSD.org> | 1995-10-12 23:28:41 +0000 |
---|---|---|
committer | bde <bde@FreeBSD.org> | 1995-10-12 23:28:41 +0000 |
commit | 25b151aca544fd11dbebfe7db87be93f51b59793 (patch) | |
tree | 8f3b63df8ef2bc0f976cc019ddb6e936bbaa7e04 /sys | |
parent | 6cbc65227cc7ad9c94c8b8e0d2cd945feaeee532 (diff) | |
download | FreeBSD-src-25b151aca544fd11dbebfe7db87be93f51b59793.zip FreeBSD-src-25b151aca544fd11dbebfe7db87be93f51b59793.tar.gz |
Fix select().
Remove some unused code and never-working backwards compatibility code.
Add prototypes.
Reviewed by: babkin@hq.icb.chel.su (Serge Babkin)
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/dgb/dgb.c | 84 | ||||
-rw-r--r-- | sys/gnu/i386/isa/dgb.c | 84 | ||||
-rw-r--r-- | sys/i386/i386/conf.c | 12 |
3 files changed, 56 insertions, 124 deletions
diff --git a/sys/dev/dgb/dgb.c b/sys/dev/dgb/dgb.c index e4ecfc0..2c5e2fe 100644 --- a/sys/dev/dgb/dgb.c +++ b/sys/dev/dgb/dgb.c @@ -1,5 +1,5 @@ /*- - * dgb.c $Id: dgb.c,v 1.2 1995/09/04 01:58:41 jkh Exp $ + * dgb.c $Id: dgb.c,v 1.3 1995/10/04 21:51:24 jkh Exp $ * * Digiboard driver. * @@ -30,9 +30,7 @@ #include <sys/systm.h> #include <sys/reboot.h> #include <sys/ioctl.h> -#define TTYDEFCHARS /* XXX TK2.0 */ #include <sys/tty.h> -#undef TTYDEFCHARS #include <sys/proc.h> #include <sys/user.h> #include <sys/conf.h> @@ -43,32 +41,15 @@ #include <sys/malloc.h> #include <sys/syslog.h> #include <sys/devconf.h> -#include <sys/types.h> #include <machine/clock.h> -#include <i386/isa/icu.h> /* XXX just to get at `imen' */ #include <i386/isa/isa.h> #include <i386/isa/isa_device.h> -#include <vm/vm.h> - -#include "dgreg.h" -#include "dgbios.h" -#include "dgfep.h" - -/* - * XXX temporary kludges for 2.0 (XXX TK2.0). - */ -#if defined (__FreeBSD__) && __FreeBSD__ < 2 -#define TS_RTS_IFLOW 0 -#define TSA_CARR_ON(tp) ((void *)&(tp)->t_rawq) -#define TSA_OCOMPLETE(tp) ((void *)&(tp)->t_outq) -#define TSA_OLOWAT(tp) ((void *)&(tp)->t_outq) - -#define TTY_BI TTY_FE /* XXX */ -#define TTY_OE TTY_PE /* XXX */ -#endif +#include <gnu/i386/isa/dgbios.h> +#include <gnu/i386/isa/dgfep.h> +#include <gnu/i386/isa/dgreg.h> #define CALLOUT_MASK 0x80 #define CONTROL_MASK 0x60 @@ -82,7 +63,6 @@ #define MINOR_TO_PORT(mynor) ((mynor) & PORT_MASK) /* types. XXX - should be elsewhere */ -typedef u_int Port_t; /* hardware port */ typedef u_char bool_t; /* boolean */ /* digiboard port structure */ @@ -127,18 +107,8 @@ struct dgb_p { struct tty *tty; bool_t active_out; /* nonzero if the callout device is open */ - int dtr_wait; /* time to hold DTR down on close (* 1/hz) */ u_int wopeners; /* # processes waiting for DCD in open() */ - /* - * The high level of the driver never reads status registers directly - * because there would be too many side effects to handle conveniently. - * Instead, it reads copies of the registers stored here by the - * interrupt handler. - */ - u_char last_modem_status; /* last MSR read by intr handler */ - u_char prev_modem_status; /* last MSR handled by high level */ - /* Initial state. */ struct termios it_in; /* should be in struct tty */ struct termios it_out; @@ -196,12 +166,13 @@ int dgbioctl __P((dev_t dev, int cmd, caddr_t data, int fflag, struct proc *p)); void dgbstop __P((struct tty *tp, int rw)); #define dgbreset noreset -int dgbselect __P((dev_t dev, int rw, struct proc *p)); +struct tty *dgbdevtotty __P((dev_t dev)); #define dgbmmap nommap #define dgbstrategy nostrategy static int dgbattach __P((struct isa_device *dev)); static int dgbprobe __P((struct isa_device *dev)); +static void dgbregisterdev __P((struct isa_device *id)); static void fepcmd(struct dgb_p *port, int cmd, int op1, int op2, int ncmds, int bytecmd); @@ -212,6 +183,7 @@ static void dgbhardclose __P((struct dgb_p *port)); static void dgb_drain_or_flush __P((struct dgb_p *port)); static int dgbdrain __P((struct dgb_p *port)); static void dgb_pause __P((void *chan)); +static void wakeflush __P((void *p)); struct isa_driver dgbdriver = { @@ -252,9 +224,10 @@ static struct speedtab dgbspeedtab[] = { static int polltimeout=0; -static int setwin(struct dgb_softc *sc, unsigned addr); -static int setinitwin(struct dgb_softc *sc, unsigned addr); -static void hidewin(struct dgb_softc *sc); +static int setwin __P((struct dgb_softc *sc, unsigned addr)); +static int setinitwin __P((struct dgb_softc *sc, unsigned addr)); +static void hidewin __P((struct dgb_softc *sc)); +static void towin __P((struct dgb_softc *sc, int win)); static inline int setwin(sc,addr) @@ -1944,31 +1917,24 @@ dgbstop(tp, rw) { } -int -dgbselect(dev, rw, p) - dev_t dev; - int rw; - struct proc *p; +struct tty * +dgbdevtotty(dev) + dev_t dev; { - int mynor; - int unit,port; + int mynor, pnum, unit; struct dgb_softc *sc; - int ti; - - mynor=minor(dev); + mynor = minor(dev); if (mynor & CONTROL_MASK) - return (ENODEV); - - unit=MINOR_TO_UNIT(mynor); - port=MINOR_TO_PORT(mynor); - - sc=&dgb_softc[unit]; - - /* get index in the tty table */ - ti= &sc->ttys[port]-dgb_tty; - - return (ttselect(ti, rw, p)); + return (NULL); + unit = MINOR_TO_UNIT(mynor); + if ((u_int) unit >= NDGB) + return (NULL); + pnum = MINOR_TO_PORT(mynor); + sc = &dgb_softc[unit]; + if (pnum >= sc->numports) + return (NULL); + return (&sc->ttys[pnum]); } static void diff --git a/sys/gnu/i386/isa/dgb.c b/sys/gnu/i386/isa/dgb.c index e4ecfc0..2c5e2fe 100644 --- a/sys/gnu/i386/isa/dgb.c +++ b/sys/gnu/i386/isa/dgb.c @@ -1,5 +1,5 @@ /*- - * dgb.c $Id: dgb.c,v 1.2 1995/09/04 01:58:41 jkh Exp $ + * dgb.c $Id: dgb.c,v 1.3 1995/10/04 21:51:24 jkh Exp $ * * Digiboard driver. * @@ -30,9 +30,7 @@ #include <sys/systm.h> #include <sys/reboot.h> #include <sys/ioctl.h> -#define TTYDEFCHARS /* XXX TK2.0 */ #include <sys/tty.h> -#undef TTYDEFCHARS #include <sys/proc.h> #include <sys/user.h> #include <sys/conf.h> @@ -43,32 +41,15 @@ #include <sys/malloc.h> #include <sys/syslog.h> #include <sys/devconf.h> -#include <sys/types.h> #include <machine/clock.h> -#include <i386/isa/icu.h> /* XXX just to get at `imen' */ #include <i386/isa/isa.h> #include <i386/isa/isa_device.h> -#include <vm/vm.h> - -#include "dgreg.h" -#include "dgbios.h" -#include "dgfep.h" - -/* - * XXX temporary kludges for 2.0 (XXX TK2.0). - */ -#if defined (__FreeBSD__) && __FreeBSD__ < 2 -#define TS_RTS_IFLOW 0 -#define TSA_CARR_ON(tp) ((void *)&(tp)->t_rawq) -#define TSA_OCOMPLETE(tp) ((void *)&(tp)->t_outq) -#define TSA_OLOWAT(tp) ((void *)&(tp)->t_outq) - -#define TTY_BI TTY_FE /* XXX */ -#define TTY_OE TTY_PE /* XXX */ -#endif +#include <gnu/i386/isa/dgbios.h> +#include <gnu/i386/isa/dgfep.h> +#include <gnu/i386/isa/dgreg.h> #define CALLOUT_MASK 0x80 #define CONTROL_MASK 0x60 @@ -82,7 +63,6 @@ #define MINOR_TO_PORT(mynor) ((mynor) & PORT_MASK) /* types. XXX - should be elsewhere */ -typedef u_int Port_t; /* hardware port */ typedef u_char bool_t; /* boolean */ /* digiboard port structure */ @@ -127,18 +107,8 @@ struct dgb_p { struct tty *tty; bool_t active_out; /* nonzero if the callout device is open */ - int dtr_wait; /* time to hold DTR down on close (* 1/hz) */ u_int wopeners; /* # processes waiting for DCD in open() */ - /* - * The high level of the driver never reads status registers directly - * because there would be too many side effects to handle conveniently. - * Instead, it reads copies of the registers stored here by the - * interrupt handler. - */ - u_char last_modem_status; /* last MSR read by intr handler */ - u_char prev_modem_status; /* last MSR handled by high level */ - /* Initial state. */ struct termios it_in; /* should be in struct tty */ struct termios it_out; @@ -196,12 +166,13 @@ int dgbioctl __P((dev_t dev, int cmd, caddr_t data, int fflag, struct proc *p)); void dgbstop __P((struct tty *tp, int rw)); #define dgbreset noreset -int dgbselect __P((dev_t dev, int rw, struct proc *p)); +struct tty *dgbdevtotty __P((dev_t dev)); #define dgbmmap nommap #define dgbstrategy nostrategy static int dgbattach __P((struct isa_device *dev)); static int dgbprobe __P((struct isa_device *dev)); +static void dgbregisterdev __P((struct isa_device *id)); static void fepcmd(struct dgb_p *port, int cmd, int op1, int op2, int ncmds, int bytecmd); @@ -212,6 +183,7 @@ static void dgbhardclose __P((struct dgb_p *port)); static void dgb_drain_or_flush __P((struct dgb_p *port)); static int dgbdrain __P((struct dgb_p *port)); static void dgb_pause __P((void *chan)); +static void wakeflush __P((void *p)); struct isa_driver dgbdriver = { @@ -252,9 +224,10 @@ static struct speedtab dgbspeedtab[] = { static int polltimeout=0; -static int setwin(struct dgb_softc *sc, unsigned addr); -static int setinitwin(struct dgb_softc *sc, unsigned addr); -static void hidewin(struct dgb_softc *sc); +static int setwin __P((struct dgb_softc *sc, unsigned addr)); +static int setinitwin __P((struct dgb_softc *sc, unsigned addr)); +static void hidewin __P((struct dgb_softc *sc)); +static void towin __P((struct dgb_softc *sc, int win)); static inline int setwin(sc,addr) @@ -1944,31 +1917,24 @@ dgbstop(tp, rw) { } -int -dgbselect(dev, rw, p) - dev_t dev; - int rw; - struct proc *p; +struct tty * +dgbdevtotty(dev) + dev_t dev; { - int mynor; - int unit,port; + int mynor, pnum, unit; struct dgb_softc *sc; - int ti; - - mynor=minor(dev); + mynor = minor(dev); if (mynor & CONTROL_MASK) - return (ENODEV); - - unit=MINOR_TO_UNIT(mynor); - port=MINOR_TO_PORT(mynor); - - sc=&dgb_softc[unit]; - - /* get index in the tty table */ - ti= &sc->ttys[port]-dgb_tty; - - return (ttselect(ti, rw, p)); + return (NULL); + unit = MINOR_TO_UNIT(mynor); + if ((u_int) unit >= NDGB) + return (NULL); + pnum = MINOR_TO_PORT(mynor); + sc = &dgb_softc[unit]; + if (pnum >= sc->numports) + return (NULL); + return (&sc->ttys[pnum]); } static void diff --git a/sys/i386/i386/conf.c b/sys/i386/i386/conf.c index 9b8395f..21df271 100644 --- a/sys/i386/i386/conf.c +++ b/sys/i386/i386/conf.c @@ -42,7 +42,7 @@ * SUCH DAMAGE. * * from: @(#)conf.c 5.8 (Berkeley) 5/12/91 - * $Id: conf.c,v 1.98 1995/09/10 21:34:46 bde Exp $ + * $Id: conf.c,v 1.99 1995/10/10 08:10:53 swallace Exp $ */ #include <sys/param.h> @@ -920,9 +920,9 @@ d_close_t dgbclose; d_rdwr_t dgbread; d_rdwr_t dgbwrite; d_ioctl_t dgbioctl; -d_select_t dgbselect; d_stop_t dgbstop; #define dgbreset nxreset +d_ttycv_t dgbdevtotty; #else #define dgbopen nxopen #define dgbclose nxclose @@ -931,7 +931,7 @@ d_stop_t dgbstop; #define dgbioctl nxioctl #define dgbstop nxstop #define dgbreset nxreset -#define dgbselect nxselect +#define dgbdevtotty nxdevtotty #endif /* Specialix serial driver */ @@ -1258,9 +1258,9 @@ struct cdevsw cdevsw[] = { itelopen, itelclose, itelread, itelwrite, /*57*/ itelioctl, nostop, nullreset, nodevtotty,/* itel */ seltrue, nommap, NULL }, - { dgbopen, dgbclose, dgbread, dgbwrite, /*58*/ - dgbioctl, dgbstop, dgbreset, nodevtotty, /* dgb */ - dgbselect, nommap, NULL }, + { dgbopen, dgbclose, dgbread, dgbwrite, /*58*/ + dgbioctl, dgbstop, dgbreset, dgbdevtotty, /* dgb */ + ttselect, nommap, NULL }, { ispyopen, ispyclose, ispyread, nowrite, /*59*/ ispyioctl, nostop, nullreset, nodevtotty,/* ispy */ seltrue, nommap, NULL }, |