diff options
Diffstat (limited to 'sys/gnu/i386/isa')
-rw-r--r-- | sys/gnu/i386/isa/dgb.c | 89 | ||||
-rw-r--r-- | sys/gnu/i386/isa/nic3008.c | 76 | ||||
-rw-r--r-- | sys/gnu/i386/isa/nic3009.c | 70 |
3 files changed, 134 insertions, 101 deletions
diff --git a/sys/gnu/i386/isa/dgb.c b/sys/gnu/i386/isa/dgb.c index 68499f8..8187b44 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.8 1995/12/06 23:52:08 bde Exp $ + * dgb.c $Id: dgb.c,v 1.9 1995/12/07 12:45:18 davidg Exp $ * * Digiboard driver. * @@ -40,6 +40,9 @@ #include <sys/malloc.h> #include <sys/syslog.h> #include <sys/devconf.h> +#ifdef DEVFS +#include <sys/devfsext.h> +#endif /*DEVFS*/ #include <machine/clock.h> @@ -54,12 +57,6 @@ #include <gnu/i386/isa/dgfep.h> #include <gnu/i386/isa/dgreg.h> -#ifdef JREMOD -#ifdef DEVFS -#include <sys/devfsext.h> -#endif /*DEVFS*/ -#define CDEV_MAJOR 58 -#endif /*JREMOD*/ #define CALLOUT_MASK 0x80 #define CONTROL_MASK 0x60 @@ -132,6 +129,14 @@ struct dgb_p { u_char draining; /* port is being drained now */ u_char used; /* port is being used now */ u_char mustdrain; /* data must be waited to drain in dgbparam() */ +#ifdef DEVFS + struct { + void *tty; + void *init; + void *lock; + void *cua; + } devfs_token; +#endif }; /* Digiboard per-board structure */ @@ -190,6 +195,20 @@ struct isa_driver dgbdriver = { dgbprobe, dgbattach, "dgb",0 }; +static d_open_t dgbopen; +static d_close_t dgbclose; +static d_read_t dgbread; +static d_write_t dgbwrite; +static d_ioctl_t dgbioctl; +static d_stop_t dgbstop; +static d_ttycv_t dgbdevtotty; + +#define CDEV_MAJOR 58 +struct cdevsw dgb_cdevsw = + { dgbopen, dgbclose, dgbread, dgbwrite, /*58*/ + dgbioctl, dgbstop, nxreset, dgbdevtotty, /* dgb */ + ttselect, nommap, NULL, "dgb", NULL, -1 }; + static speed_t dgbdefaultrate = TTYDEF_SPEED; static u_int dgb_events; /* input chars + weighted output completions */ static int dgbmajor; @@ -437,6 +456,7 @@ dgbattach(dev) ushort *pstat; int lowwater; int nports=0; + char name[32]; if(sc->status!=ENABLED) { DPRINT2("dbg%d: try to attach a disabled card\n",unit); @@ -832,6 +852,28 @@ load_fep: termioschars(&port->it_in); port->it_in.c_ispeed = port->it_in.c_ospeed = dgbdefaultrate; port->it_out = port->it_in; +#ifdef DEVFS +/*XXX*/ /* fix the minor numbers */ + sprintf(name,"dgb%d.%d",unit,i); + port->devfs_token.tty = devfs_add_devsw("/",name, + &dgb_cdevsw,(unit*32)+i, /*mytical number */ + DV_CHR, 0, 0, 0600); + + sprintf(name,"idgb%d.%d",unit,i); + port->devfs_token.tty = devfs_add_devsw("/",name, + &dgb_cdevsw,(unit*32)+i + 64, /*mytical number */ + DV_CHR, 0, 0, 0600); + + sprintf(name,"ldgb%d.%d",unit,i); + port->devfs_token.tty = devfs_add_devsw("/",name, + &dgb_cdevsw,(unit*32)+i + 128, /*mytical number */ + DV_CHR, 0, 0, 0600); + + sprintf(name,"dgbcua%d.%d",unit,i); + port->devfs_token.tty = devfs_add_devsw("/",name, + &dgb_cdevsw,(unit*32)+i + 192, /*mytical number */ + DV_CHR, 0, 0, 0600); +#endif } hidewin(sc); @@ -843,7 +885,7 @@ load_fep: } /* ARGSUSED */ -int +static int dgbopen(dev, flag, mode, p) dev_t dev; int flag; @@ -1011,7 +1053,7 @@ out: } /*ARGSUSED*/ -int +static int dgbclose(dev, flag, mode, p) dev_t dev; int flag; @@ -1087,7 +1129,7 @@ wakeup((caddr_t)chan); } -int +static int dgbread(dev, uio, flag) dev_t dev; struct uio *uio; @@ -1111,7 +1153,7 @@ dgbread(dev, uio, flag) return error; } -int +static int dgbwrite(dev, uio, flag) dev_t dev; struct uio *uio; @@ -1363,7 +1405,7 @@ dgbintr(unit) { } -int +static int dgbioctl(dev, cmd, data, flag, p) dev_t dev; int cmd; @@ -1989,36 +2031,21 @@ fepcmd(port, cmd, op1, op2, ncmds, bytecmd) port->unit, port->pnum); } -#ifdef JREMOD -struct cdevsw dgb_cdevsw = - { dgbopen, dgbclose, dgbread, dgbwrite, /*58*/ - dgbioctl, dgbstop, nxreset, dgbdevtotty, /* dgb */ - ttselect, nommap, NULL }; static dgb_devsw_installed = 0; -static void dgb_drvinit(void *unused) +static void +dgb_drvinit(void *unused) { dev_t dev; if( ! dgb_devsw_installed ) { - dev = makedev(CDEV_MAJOR,0); - cdevsw_add(&dev,&dgb_cdevsw,NULL); + dev = makedev(CDEV_MAJOR, 0); + cdevsw_add(&dev,&dgb_cdevsw, NULL); dgb_devsw_installed = 1; -#ifdef DEVFS - { - int x; -/* default for a simple device with no probe routine (usually delete this) */ - x=devfs_add_devsw( -/* path name major minor type uid gid perm*/ - "/", "dgb", major(dev), 0, DV_CHR, 0, 0, 0600); - } -#endif } } SYSINIT(dgbdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,dgb_drvinit,NULL) -#endif /* JREMOD */ - #endif /* NDGB > 0 */ diff --git a/sys/gnu/i386/isa/nic3008.c b/sys/gnu/i386/isa/nic3008.c index a685131..85a4081 100644 --- a/sys/gnu/i386/isa/nic3008.c +++ b/sys/gnu/i386/isa/nic3008.c @@ -1,6 +1,6 @@ -static char nic38_id[] = "@(#)$Id: nic3008.c,v 1.10 1995/11/29 10:47:04 julian Exp $"; +static char nic38_id[] = "@(#)$Id: nic3008.c,v 1.11 1995/11/29 14:39:07 julian Exp $"; /******************************************************************************* - * II - Version 0.1 $Revision: 1.10 $ $State: Exp $ + * II - Version 0.1 $Revision: 1.11 $ $State: Exp $ * * Copyright 1994 Dietmar Friede ******************************************************************************* @@ -10,6 +10,10 @@ static char nic38_id[] = "@(#)$Id: nic3008.c,v 1.10 1995/11/29 10:47:04 juli * ******************************************************************************* * $Log: nic3008.c,v $ + * Revision 1.11 1995/11/29 14:39:07 julian + * If you're going to mechanically replicate something in 50 files + * it's best to not have a (compiles cleanly) typo in it! (sigh) + * * Revision 1.10 1995/11/29 10:47:04 julian * OK, that's it.. * That's EVERY SINGLE driver that has an entry in conf.c.. @@ -69,24 +73,20 @@ static char nic38_id[] = "@(#)$Id: nic3008.c,v 1.10 1995/11/29 10:47:04 juli #include "nic.h" #if NNIC > 0 -#include "param.h" -#include "ioctl.h" -#include "kernel.h" -#include "systm.h" +#include <sys/param.h> +#include <sys/ioctl.h> +#include <sys/kernel.h> +#include <sys/systm.h> #include <sys/conf.h> #include <sys/proc.h> - -#include "i386/isa/isa_device.h" -#include "gnu/i386/isa/nic3008.h" -#include "gnu/i386/isa/niccyreg.h" -#include "gnu/isdn/isdn_ioctl.h" - -#ifdef JREMOD #ifdef DEVFS #include <sys/devfsext.h> #endif /*DEVFS*/ -#define CDEV_MAJOR 54 -#endif /*JREMOD*/ + +#include <i386/isa/isa_device.h> +#include <gnu/i386/isa/nic3008.h> +#include <gnu/i386/isa/niccyreg.h> +#include <gnu/isdn/isdn_ioctl.h> #define OPEN 1 @@ -131,6 +131,16 @@ static short bsintr; struct isa_driver nicdriver = {nicprobe, nicattach, "nic"}; +static d_open_t nicopen; +static d_close_t nicclose; +static d_ioctl_t nicioctl; + +#define CDEV_MAJOR 54 +struct cdevsw nic_cdevsw = + { nicopen, nicclose, noread, nowrite, /*54*/ + nicioctl, nostop, nullreset, nodevtotty,/* nic */ + seltrue, nommap, NULL, "nic", NULL, -1 }; + typedef enum { DISCON, ISDISCON, DIAL, CALLED, CONNECT, IDLE, ACTIVE @@ -160,6 +170,9 @@ struct nic_softc u_char sc_ctrl; short sc_stat; chan_t sc_chan[2]; +#ifdef DEVFS + void *devfs_token; +#endif } nic_sc[NNIC]; static void badstate __P((mbx_type *mbx, int n, int mb, dpr_type *dpr)); @@ -226,6 +239,7 @@ nicattach(struct isa_device * is) dpr_type *dpr; int cn; isdn_ctrl_t *ctrl0, *ctrl1; + char name[32]; sc = &nic_sc[is->id_unit]; dpr = sc->sc_dpr; @@ -257,6 +271,11 @@ nicattach(struct isa_device * is) dpr->card_number = is->id_unit; dpr->int_flg_pc = 0xff; reset_req(sc, MBX_MU, 4); +#ifdef DEVFS + sprintf(name,"nic%d",is->id_unit); + sc->devfs_token = devfs_add_devsw( "/isdn", name, + &nic_cdevsw,is->id_unit, DV_CHR, 0, 0, 0600 ); +#endif return (1); } @@ -605,7 +624,7 @@ reset_card(struct nic_softc * sc) * * We forbid all but first open */ -int +static int nicopen(dev_t dev, int flags, int fmt, struct proc *p) { struct nic_softc *sc; @@ -636,7 +655,7 @@ nicopen(dev_t dev, int flags, int fmt, struct proc *p) /* * nicclose() Close device */ -int +static int nicclose(dev_t dev, int flags, int fmt, struct proc *p) { struct nic_softc *sc = &nic_sc[minor(dev)]; @@ -645,7 +664,7 @@ nicclose(dev_t dev, int flags, int fmt, struct proc *p) return (0); } -int +static int nicioctl(dev_t dev, int cmd, caddr_t data, int flags, struct proc *p) { int error; @@ -1225,12 +1244,6 @@ nicintr(int unit) } -#ifdef JREMOD -struct cdevsw nic_cdevsw = - { nicopen, nicclose, noread, nowrite, /*54*/ - nicioctl, nostop, nullreset, nodevtotty,/* nic */ - seltrue, nommap, NULL }; - static nic_devsw_installed = 0; static void nic_drvinit(void *unused) @@ -1238,23 +1251,12 @@ static void nic_drvinit(void *unused) dev_t dev; if( ! nic_devsw_installed ) { - dev = makedev(CDEV_MAJOR,0); - cdevsw_add(&dev,&nic_cdevsw,NULL); + dev = makedev(CDEV_MAJOR ,0); + cdevsw_add(&dev,&nic_cdevsw, NULL); nic_devsw_installed = 1; -#ifdef DEVFS - { - int x; -/* default for a simple device with no probe routine (usually delete this) */ - x=devfs_add_devsw( -/* path name devsw minor type uid gid perm*/ - "/", "nic", major(dev), 0, DV_CHR, 0, 0, 0600); - } -#endif } } SYSINIT(nicdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,nic_drvinit,NULL) -#endif /* JREMOD */ - #endif /* NNIC > 0 */ diff --git a/sys/gnu/i386/isa/nic3009.c b/sys/gnu/i386/isa/nic3009.c index 0a6fe04..8359c9d 100644 --- a/sys/gnu/i386/isa/nic3009.c +++ b/sys/gnu/i386/isa/nic3009.c @@ -1,6 +1,6 @@ -static char nic39_id[] = "@(#)$Id: nic3009.c,v 1.10 1995/11/29 10:47:05 julian Exp $"; +static char nic39_id[] = "@(#)$Id: nic3009.c,v 1.11 1995/11/29 14:39:08 julian Exp $"; /******************************************************************************* - * II - Version 0.1 $Revision: 1.10 $ $State: Exp $ + * II - Version 0.1 $Revision: 1.11 $ $State: Exp $ * * Copyright 1994 Dietmar Friede ******************************************************************************* @@ -10,6 +10,10 @@ static char nic39_id[] = "@(#)$Id: nic3009.c,v 1.10 1995/11/29 10:47:05 juli * ******************************************************************************* * $Log: nic3009.c,v $ + * Revision 1.11 1995/11/29 14:39:08 julian + * If you're going to mechanically replicate something in 50 files + * it's best to not have a (compiles cleanly) typo in it! (sigh) + * * Revision 1.10 1995/11/29 10:47:05 julian * OK, that's it.. * That's EVERY SINGLE driver that has an entry in conf.c.. @@ -74,18 +78,15 @@ static char nic39_id[] = "@(#)$Id: nic3009.c,v 1.10 1995/11/29 10:47:05 juli #include <sys/systm.h> #include <sys/conf.h> #include <sys/proc.h> - -#include "i386/isa/isa_device.h" -#include "gnu/i386/isa/nic3009.h" -#include "gnu/i386/isa/niccyreg.h" -#include "gnu/isdn/isdn_ioctl.h" - -#ifdef JREMOD #ifdef DEVFS #include <sys/devfsext.h> #endif /*DEVFS*/ -#define CDEV_MAJOR 60 -#endif /*JREMOD*/ + +#include <i386/isa/isa_device.h> +#include <gnu/i386/isa/nic3009.h> +#include <gnu/i386/isa/niccyreg.h> +#include <gnu/isdn/isdn_ioctl.h> + #define OPEN 1 #define LOAD_HEAD 3 @@ -122,6 +123,17 @@ extern int nnic_listen __P((int cn, int ap, int inf_mask, extern int nnic_output __P((int cn)); extern int nnic_state __P((int cn)); +static d_open_t nnicopen; +static d_close_t nnicclose; +static d_ioctl_t nnicioctl; + +#define CDEV_MAJOR 60 +struct cdevsw nnic_cdevsw = + { nnicopen, nnicclose, noread, nowrite, /*60*/ + nnicioctl, nostop, nullreset, nodevtotty,/* nnic */ + seltrue, nommap, NULL, "nnic", NULL, -1 }; + + static short bsintr; struct isa_driver nnicdriver = {nnicprobe, nnicattach, "nnic"}; @@ -157,6 +169,9 @@ struct nnic_softc u_char sc_type; short sc_stat; chan_t sc_chan[2]; +#ifdef DEVFS + void *devfs_token; +#endif } nnic_sc[NNNIC]; static void badstate __P((mbx_type *mbx, int n, int mb, dpr_type *dpr)); @@ -230,6 +245,7 @@ nnicattach(struct isa_device * is) struct nnic_softc *sc; int cn; isdn_ctrl_t *ctrl0, *ctrl1; + char name[32]; sc = &nnic_sc[is->id_unit]; sc->sc_ctrl = -1; @@ -256,6 +272,11 @@ nnicattach(struct isa_device * is) ctrl0->appl = ctrl1->appl = -1; ctrl0->o_len = ctrl1->o_len = -1; sc->sc_flags= LOAD_ENTITY; +#ifdef DEVFS + sprintf(name,"nnic%d",is->id_unit); + sc->devfs_token = devfs_add_devsw("/isdn",name, + &nnic_cdevsw, is->id_unit, DV_CHR, 0, 0, 0600 ); +#endif return (1); } @@ -548,7 +569,7 @@ nnic_accept(int cn, int an, int rea) return(sel_b2_prot_req(ctrl->unit, C_CHAN(cn), chan->plci, &appl->dlpd)); } -int +static int nnicopen(dev_t dev, int flags, int fmt, struct proc *p) { struct nnic_softc *sc; @@ -578,7 +599,7 @@ nnicopen(dev_t dev, int flags, int fmt, struct proc *p) return (0); } -int +static int nnicclose(dev_t dev, int flags, int fmt, struct proc *p) { struct nnic_softc *sc = &nnic_sc[minor(dev)]; @@ -587,7 +608,7 @@ nnicclose(dev_t dev, int flags, int fmt, struct proc *p) return (0); } -int +static int nnicioctl(dev_t dev, int cmd, caddr_t data, int flags, struct proc *pr) { int error; @@ -1288,12 +1309,6 @@ nnicintr(int unit) } -#ifdef JREMOD -struct cdevsw nnic_cdevsw = - { nnicopen, nnicclose, noread, nowrite, /*60*/ - nnicioctl, nostop, nullreset, nodevtotty,/* nnic */ - seltrue, nommap, NULL }; - static nnic_devsw_installed = 0; static void nnic_drvinit(void *unused) @@ -1301,23 +1316,12 @@ static void nnic_drvinit(void *unused) dev_t dev; if( ! nnic_devsw_installed ) { - dev = makedev(CDEV_MAJOR,0); - cdevsw_add(&dev,&nnic_cdevsw,NULL); + dev = makedev(CDEV_MAJOR, 0); + cdevsw_add(&dev,&nnic_cdevsw, NULL); nnic_devsw_installed = 1; -#ifdef DEVFS - { - int x; -/* default for a simple device with no probe routine (usually delete this) */ - x=devfs_add_devsw( -/* path name devsw minor type uid gid perm*/ - "/", "nnic", major(dev), 0, DV_CHR, 0, 0, 0600); - } -#endif } } SYSINIT(nnicdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,nnic_drvinit,NULL) -#endif /* JREMOD */ - #endif /* NNNIC > 0 */ |