aboutsummaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorJulian Elischer <julian@FreeBSD.org>1995-12-08 11:19:42 +0000
committerJulian Elischer <julian@FreeBSD.org>1995-12-08 11:19:42 +0000
commit87f6c6625d5a4889540cb77c8296e456b7d1390b (patch)
tree5150d199464d64c1021f91b2c2f112d48546a8bf /sys/dev
parent0b7a315970685222e8ccbcdf3d645d35650cd03e (diff)
Notes
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/cy/cy.c68
-rw-r--r--sys/dev/cy/cy_isa.c68
-rw-r--r--sys/dev/dgb/dgb.c89
-rw-r--r--sys/dev/fdc/fdc.c75
-rw-r--r--sys/dev/joy/joy.c70
-rw-r--r--sys/dev/mcd/mcd.c95
-rw-r--r--sys/dev/mse/mse.c76
-rw-r--r--sys/dev/rc/rc.c76
-rw-r--r--sys/dev/scd/scd.c111
-rw-r--r--sys/dev/si/si.c113
-rw-r--r--sys/dev/sio/sio.c106
-rw-r--r--sys/dev/snp/snp.c60
-rw-r--r--sys/dev/speaker/spkr.c38
-rw-r--r--sys/dev/syscons/syscons.c21
-rw-r--r--sys/dev/vn/vn.c62
15 files changed, 666 insertions, 462 deletions
diff --git a/sys/dev/cy/cy.c b/sys/dev/cy/cy.c
index ae025c0e8f71c..acd4db65bf872 100644
--- a/sys/dev/cy/cy.c
+++ b/sys/dev/cy/cy.c
@@ -27,7 +27,7 @@
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $Id: cy.c,v 1.22 1995/11/29 14:39:37 julian Exp $
+ * $Id: cy.c,v 1.23 1995/12/06 23:42:34 bde Exp $
*/
#include "cy.h"
@@ -315,6 +315,10 @@ struct com_s {
u_char obuf1[256];
u_char obuf2[256];
+#ifdef DEVFS
+ void *devfs_token; /* one for now */
+#endif
+
struct kern_devconf kdc;
};
@@ -358,6 +362,21 @@ static struct com_s *p_com_addr[NSIO];
static struct timeval intr_timestamp;
+static d_open_t cyopen;
+static d_close_t cyclose;
+static d_read_t cyread;
+static d_write_t cywrite;
+static d_ioctl_t cyioctl;
+static d_stop_t cystop;
+static d_ttycv_t cydevtotty;
+
+#define CDEV_MAJOR 48
+struct cdevsw cy_cdevsw =
+ { cyopen, cyclose, cyread, cywrite, /*48*/
+ cyioctl, cystop, nxreset, cydevtotty,/*cyclades*/
+ ttselect, nxmmap, NULL, "cy", NULL, -1 };
+
+
struct isa_driver siodriver = {
sioprobe, sioattach, "cy"
};
@@ -396,12 +415,9 @@ static int cy_nr_cd1400s[NCY];
#undef RxFifoThreshold
static int volatile RxFifoThreshold = (CD1400_RX_FIFO_SIZE / 2);
-#ifdef JREMOD
#ifdef DEVFS
#include <sys/devfsext.h>
#endif /*DEVFS*/
-#define CDEV_MAJOR 48
-#endif /*JREMOD*/
static struct kern_devconf kdc_sio[NCY] = { {
0, 0, 0, /* filled in by dev_attach */
@@ -502,6 +518,7 @@ sioattach(isdp)
cy_addr iobase;
int ncyu;
int unit;
+ char name [32];
unit = isdp->id_unit;
if ((u_int)unit >= NCY)
@@ -575,6 +592,13 @@ sioattach(isdp)
s = spltty();
com_addr(unit) = com;
splx(s);
+#ifdef DEVFS
+/* XXX */ /* Fix this when you work out what the f*ck it looks like */
+ sprintf(name, "cy%d", unit);
+ com->devfs_token =
+ devfs_add_devsw( "/", name, &cy_cdevsw, unit,
+ DV_CHR, 0, 0, 0600);
+#endif
}
}
kdc_sio[isdp->id_unit].kdc_state = DC_BUSY; /* XXX */
@@ -585,7 +609,7 @@ sioattach(isdp)
return (1);
}
-int
+static int
sioopen(dev, flag, mode, p)
dev_t dev;
int flag;
@@ -786,7 +810,7 @@ out:
return (error);
}
-int
+static int
sioclose(dev, flag, mode, p)
dev_t dev;
int flag;
@@ -887,7 +911,7 @@ comhardclose(com)
splx(s);
}
-int
+static int
sioread(dev, uio, flag)
dev_t dev;
struct uio *uio;
@@ -903,7 +927,7 @@ sioread(dev, uio, flag)
return ((*linesw[tp->t_line].l_read)(tp, uio, flag));
}
-int
+static int
siowrite(dev, uio, flag)
dev_t dev;
struct uio *uio;
@@ -1320,7 +1344,7 @@ siointr1(com)
{
}
-int
+static int
sioioctl(dev, cmd, data, flag, p)
dev_t dev;
int cmd;
@@ -2105,7 +2129,7 @@ comstart(tp)
splx(s);
}
-void
+static void
siostop(tp, rw)
struct tty *tp;
int rw;
@@ -2520,36 +2544,20 @@ cystatus(unit)
-#ifdef JREMOD
-struct cdevsw cy_cdevsw =
- { cyopen, cyclose, cyread, cywrite, /*48*/
- cyioctl, cystop, nxreset, cydevtotty,/*cyclades*/
- ttselect, nxmmap, NULL };
-
static cy_devsw_installed = 0;
-static void cy_drvinit(void *unused)
+static void
+cy_drvinit(void *unused)
{
dev_t dev;
if( ! cy_devsw_installed ) {
- dev = makedev(CDEV_MAJOR,0);
- cdevsw_add(&dev,&cy_cdevsw,NULL);
+ dev = makedev(CDEV_MAJOR, 0);
+ cdevsw_add(&dev,&cy_cdevsw, NULL);
cy_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*/
- "/", "cy", major(dev), 0, DV_CHR, 0, 0, 0600);
- }
-#endif
}
}
SYSINIT(cydev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,cy_drvinit,NULL)
-#endif /* JREMOD */
-
#endif /* NCY > 0 */
diff --git a/sys/dev/cy/cy_isa.c b/sys/dev/cy/cy_isa.c
index ae025c0e8f71c..acd4db65bf872 100644
--- a/sys/dev/cy/cy_isa.c
+++ b/sys/dev/cy/cy_isa.c
@@ -27,7 +27,7 @@
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $Id: cy.c,v 1.22 1995/11/29 14:39:37 julian Exp $
+ * $Id: cy.c,v 1.23 1995/12/06 23:42:34 bde Exp $
*/
#include "cy.h"
@@ -315,6 +315,10 @@ struct com_s {
u_char obuf1[256];
u_char obuf2[256];
+#ifdef DEVFS
+ void *devfs_token; /* one for now */
+#endif
+
struct kern_devconf kdc;
};
@@ -358,6 +362,21 @@ static struct com_s *p_com_addr[NSIO];
static struct timeval intr_timestamp;
+static d_open_t cyopen;
+static d_close_t cyclose;
+static d_read_t cyread;
+static d_write_t cywrite;
+static d_ioctl_t cyioctl;
+static d_stop_t cystop;
+static d_ttycv_t cydevtotty;
+
+#define CDEV_MAJOR 48
+struct cdevsw cy_cdevsw =
+ { cyopen, cyclose, cyread, cywrite, /*48*/
+ cyioctl, cystop, nxreset, cydevtotty,/*cyclades*/
+ ttselect, nxmmap, NULL, "cy", NULL, -1 };
+
+
struct isa_driver siodriver = {
sioprobe, sioattach, "cy"
};
@@ -396,12 +415,9 @@ static int cy_nr_cd1400s[NCY];
#undef RxFifoThreshold
static int volatile RxFifoThreshold = (CD1400_RX_FIFO_SIZE / 2);
-#ifdef JREMOD
#ifdef DEVFS
#include <sys/devfsext.h>
#endif /*DEVFS*/
-#define CDEV_MAJOR 48
-#endif /*JREMOD*/
static struct kern_devconf kdc_sio[NCY] = { {
0, 0, 0, /* filled in by dev_attach */
@@ -502,6 +518,7 @@ sioattach(isdp)
cy_addr iobase;
int ncyu;
int unit;
+ char name [32];
unit = isdp->id_unit;
if ((u_int)unit >= NCY)
@@ -575,6 +592,13 @@ sioattach(isdp)
s = spltty();
com_addr(unit) = com;
splx(s);
+#ifdef DEVFS
+/* XXX */ /* Fix this when you work out what the f*ck it looks like */
+ sprintf(name, "cy%d", unit);
+ com->devfs_token =
+ devfs_add_devsw( "/", name, &cy_cdevsw, unit,
+ DV_CHR, 0, 0, 0600);
+#endif
}
}
kdc_sio[isdp->id_unit].kdc_state = DC_BUSY; /* XXX */
@@ -585,7 +609,7 @@ sioattach(isdp)
return (1);
}
-int
+static int
sioopen(dev, flag, mode, p)
dev_t dev;
int flag;
@@ -786,7 +810,7 @@ out:
return (error);
}
-int
+static int
sioclose(dev, flag, mode, p)
dev_t dev;
int flag;
@@ -887,7 +911,7 @@ comhardclose(com)
splx(s);
}
-int
+static int
sioread(dev, uio, flag)
dev_t dev;
struct uio *uio;
@@ -903,7 +927,7 @@ sioread(dev, uio, flag)
return ((*linesw[tp->t_line].l_read)(tp, uio, flag));
}
-int
+static int
siowrite(dev, uio, flag)
dev_t dev;
struct uio *uio;
@@ -1320,7 +1344,7 @@ siointr1(com)
{
}
-int
+static int
sioioctl(dev, cmd, data, flag, p)
dev_t dev;
int cmd;
@@ -2105,7 +2129,7 @@ comstart(tp)
splx(s);
}
-void
+static void
siostop(tp, rw)
struct tty *tp;
int rw;
@@ -2520,36 +2544,20 @@ cystatus(unit)
-#ifdef JREMOD
-struct cdevsw cy_cdevsw =
- { cyopen, cyclose, cyread, cywrite, /*48*/
- cyioctl, cystop, nxreset, cydevtotty,/*cyclades*/
- ttselect, nxmmap, NULL };
-
static cy_devsw_installed = 0;
-static void cy_drvinit(void *unused)
+static void
+cy_drvinit(void *unused)
{
dev_t dev;
if( ! cy_devsw_installed ) {
- dev = makedev(CDEV_MAJOR,0);
- cdevsw_add(&dev,&cy_cdevsw,NULL);
+ dev = makedev(CDEV_MAJOR, 0);
+ cdevsw_add(&dev,&cy_cdevsw, NULL);
cy_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*/
- "/", "cy", major(dev), 0, DV_CHR, 0, 0, 0600);
- }
-#endif
}
}
SYSINIT(cydev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,cy_drvinit,NULL)
-#endif /* JREMOD */
-
#endif /* NCY > 0 */
diff --git a/sys/dev/dgb/dgb.c b/sys/dev/dgb/dgb.c
index 68499f84a1825..8187b442913e5 100644
--- a/sys/dev/dgb/dgb.c
+++ b/sys/dev/dgb/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/dev/fdc/fdc.c b/sys/dev/fdc/fdc.c
index 1af2cbf0d48eb..e1b34366080a4 100644
--- a/sys/dev/fdc/fdc.c
+++ b/sys/dev/fdc/fdc.c
@@ -1,4 +1,4 @@
-/*-
+/*
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
@@ -43,7 +43,7 @@
* SUCH DAMAGE.
*
* from: @(#)fd.c 7.4 (Berkeley) 5/25/91
- * $Id: fd.c,v 1.71 1995/11/20 12:41:38 phk Exp $
+ * $Id: fd.c,v 1.72 1995/11/28 09:41:00 julian Exp $
*
*/
@@ -87,11 +87,7 @@
#include <sys/devfsext.h>
#endif
-#ifdef JREMOD
-#define CDEV_MAJOR 9
-#define BDEV_MAJOR 2
-static void fd_devsw_install();
-#endif /*JREMOD */
+
static int fd_goaway(struct kern_devconf *, int);
static int fdc_goaway(struct kern_devconf *, int);
static int fd_externalize(struct kern_devconf *, struct sysctl_req *);
@@ -250,6 +246,10 @@ struct fd_data {
int track; /* where we think the head is */
int options; /* user configurable options, see ioctl_fd.h */
int dkunit; /* disk stats unit number */
+#ifdef DEVFS
+ void *rfd_devfs_token;
+ void *fd_devfs_token;
+#endif
} fd_data[NFD];
/***********************************************************************\
@@ -342,6 +342,24 @@ struct isa_driver fdcdriver = {
fdprobe, fdattach, "fdc",
};
+static d_open_t Fdopen; /* NOTE, not fdopen */
+static d_close_t fdclose;
+static d_ioctl_t fdioctl;
+static d_strategy_t fdstrategy;
+
+#define CDEV_MAJOR 9
+#define BDEV_MAJOR 2
+extern struct cdevsw fd_cdevsw;
+struct bdevsw fd_bdevsw =
+ { Fdopen, fdclose, fdstrategy, fdioctl, /*2*/
+ nxdump, zerosize, 0, "fd", &fd_cdevsw, -1 };
+
+struct cdevsw fd_cdevsw =
+ { Fdopen, fdclose, rawread, rawwrite, /*9*/
+ fdioctl, nostop, nullreset, nodevtotty,
+ seltrue, nommap, fdstrategy, "fd",
+ &fd_bdevsw, -1 };
+
struct isa_device *fdcdevs[NFDC];
/*
@@ -518,9 +536,6 @@ fdprobe(struct isa_device *dev)
#ifndef DEV_LKM
fdc_registerdev(dev);
#endif
-#ifdef JREMOD
- fd_devsw_install();
-#endif /*JREMOD*/
/* First - lets reset the floppy controller */
outb(dev->id_iobase+FDOUT, 0);
@@ -554,7 +569,6 @@ fdattach(struct isa_device *dev)
int ic_type = 0;
#ifdef DEVFS
char name[64];
- void *key;
#endif /* DEVFS */
fdc->fdcu = fdcu;
@@ -750,10 +764,12 @@ fdattach(struct isa_device *dev)
}
kdc_fd[fdu].kdc_state = DC_IDLE;
#ifdef DEVFS
- key = dev_add("/disks/rfloppy",name,(caddr_t)Fdopen,fdu * 8,
- DV_CHR,0,0,0644);
- key = dev_add("/disks/floppy",name,(caddr_t)Fdopen,fdu * 8,
- DV_BLK,0,0,0644);
+ fd->rfd_devfs_token = devfs_add_devsw(
+ "/",name,&fd_cdevsw, fdu * 8,
+ DV_CHR,0,0,0644);
+ fd->fd_devfs_token = devfs_add_devsw(
+ "/",name, &fd_bdevsw, fdu * 8,
+ DV_BLK,0,0,0644);
#endif /* DEVFS */
if (dk_ndrive < DK_NDRIVE) {
sprintf(dk_names[dk_ndrive], "fd%d", fdu);
@@ -1893,32 +1909,23 @@ fdioctl(dev, cmd, addr, flag, p)
}
-#ifdef JREMOD
-struct bdevsw fd_bdevsw =
- { Fdopen, fdclose, fdstrategy, fdioctl, /*2*/
- nxdump, zerosize, 0 };
-
-struct cdevsw fd_cdevsw =
- { Fdopen, fdclose, rawread, rawwrite, /*9*/
- fdioctl, nostop, nullreset, nodevtotty,/* Fd (!=fd) */
- seltrue, nommap, fdstrategy };
-
static fd_devsw_installed = 0;
-static void fd_devsw_install()
+static void fd_drvinit(void *notused )
{
- dev_t descript;
+ dev_t dev;
+
if( ! fd_devsw_installed ) {
- descript = makedev(CDEV_MAJOR,0);
- cdevsw_add(&descript,&fd_cdevsw,NULL);
-#if defined(BDEV_MAJOR)
- descript = makedev(BDEV_MAJOR,0);
- bdevsw_add(&descript,&fd_bdevsw,NULL);
-#endif /*BDEV_MAJOR*/
+ dev = makedev(CDEV_MAJOR, 0);
+ cdevsw_add(&dev,&fd_cdevsw, NULL);
+ dev = makedev(BDEV_MAJOR, 0);
+ bdevsw_add(&dev,&fd_bdevsw, NULL);
fd_devsw_installed = 1;
}
}
-#endif /* JREMOD */
+
+SYSINIT(fddev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,fd_drvinit,NULL)
+
#endif
/*
* Hello emacs, these are the
diff --git a/sys/dev/joy/joy.c b/sys/dev/joy/joy.c
index 25d2311ffc045..2955d1c865faf 100644
--- a/sys/dev/joy/joy.c
+++ b/sys/dev/joy/joy.c
@@ -34,6 +34,11 @@
#include <sys/param.h>
#include <sys/systm.h>
+#include <sys/conf.h>
+#include <sys/kernel.h>
+#ifdef DEVFS
+#include <sys/devfsext.h>
+#endif /*DEVFS*/
#include <machine/joystick.h>
@@ -41,15 +46,6 @@
#include <i386/isa/isa_device.h>
#include <i386/isa/timerreg.h>
-#ifdef JREMOD
-#include <sys/conf.h>
-#include <sys/kernel.h>
-#ifdef DEVFS
-#include <sys/devfsext.h>
-#endif /*DEVFS*/
-#define CDEV_MAJOR 51
-#endif /*JREMOD*/
-
/* The game port can manage 4 buttons and 4 variable resistors (usually 2
* joysticks, each with 2 buttons and 2 pots.) via the port at address 0x201.
* Getting the state of the buttons is done by reading the game port:
@@ -77,6 +73,9 @@ static struct {
int port;
int x_off[2], y_off[2];
int timeout[2];
+#ifdef DEVFS
+ void *devfs_token;
+#endif
} joy[NJOY];
@@ -86,6 +85,17 @@ int joyprobe (struct isa_device *), joyattach (struct isa_device *);
struct isa_driver joydriver = {joyprobe, joyattach, "joy"};
+#define CDEV_MAJOR 51
+static d_open_t joyopen;
+static d_close_t joyclose;
+static d_read_t joyread;
+static d_ioctl_t joyioctl;
+
+struct cdevsw joy_cdevsw =
+ { joyopen, joyclose, joyread, nowrite, /*51*/
+ joyioctl, nostop, nullreset, nodevtotty,/*joystick */
+ seltrue, nommap, NULL, "joy", NULL, -1 };
+
static int get_tick ();
@@ -104,14 +114,22 @@ joyprobe (struct isa_device *dev)
int
joyattach (struct isa_device *dev)
{
- joy[dev->id_unit].port = dev->id_iobase;
- joy[dev->id_unit].timeout[0] = joy[dev->id_unit].timeout[1] = 0;
- printf("joy%d: joystick\n", dev->id_unit);
+ int unit = dev->id_unit;
+ char name[32];
+ joy[unit].port = dev->id_iobase;
+ joy[unit].timeout[0] = joy[unit].timeout[1] = 0;
+ printf("joy%d: joystick\n", unit);
+#ifdef DEVFS
+ sprintf(name, "joy%d", unit);
+ joy[dev->id_unit].devfs_token = devfs_add_devsw( "/", "joy",
+ &joy_cdevsw, 0,
+ DV_CHR, 0, 0, 0600);
+#endif
return 1;
}
-int
+static int
joyopen (dev_t dev, int flags, int fmt, struct proc *p)
{
int unit = UNIT (dev);
@@ -123,7 +141,7 @@ joyopen (dev_t dev, int flags, int fmt, struct proc *p)
joy[unit].timeout[i] = JOY_TIMEOUT;
return 0;
}
-int
+static int
joyclose (dev_t dev, int flags, int fmt, struct proc *p)
{
int unit = UNIT (dev);
@@ -133,7 +151,7 @@ joyclose (dev_t dev, int flags, int fmt, struct proc *p)
return 0;
}
-int
+static int
joyread (dev_t dev, struct uio *uio, int flag)
{
int unit = UNIT(dev);
@@ -169,7 +187,9 @@ joyread (dev_t dev, struct uio *uio, int flag)
c.b2 = ~(state >> 1) & 1;
return uiomove ((caddr_t)&c, sizeof(struct joystick), uio);
}
-int joyioctl (dev_t dev, int cmd, caddr_t data, int flag, struct proc *p)
+
+static int
+joyioctl (dev_t dev, int cmd, caddr_t data, int flag, struct proc *p)
{
int unit = UNIT (dev);
int i = joypart (dev);
@@ -202,6 +222,7 @@ int joyioctl (dev_t dev, int cmd, caddr_t data, int flag, struct proc *p)
}
return 0;
}
+
static int
get_tick ()
{
@@ -215,12 +236,6 @@ get_tick ()
}
-#ifdef JREMOD
-struct cdevsw joy_cdevsw =
- { joyopen, joyclose, joyread, nowrite, /*51*/
- joyioctl, nostop, nullreset, nodevtotty,/*joystick */
- seltrue, nommap, NULL};
-
static joy_devsw_installed = 0;
static void joy_drvinit(void *unused)
@@ -231,20 +246,9 @@ static void joy_drvinit(void *unused)
dev = makedev(CDEV_MAJOR,0);
cdevsw_add(&dev,&joy_cdevsw,NULL);
joy_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*/
- "/", "joy", major(dev), 0, DV_CHR, 0, 0, 0600);
- }
-#endif
}
}
SYSINIT(joydev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,joy_drvinit,NULL)
-#endif /* JREMOD */
-
#endif /* NJOY > 0 */
diff --git a/sys/dev/mcd/mcd.c b/sys/dev/mcd/mcd.c
index 5f7f68b0f61eb..ee2e03ad45f98 100644
--- a/sys/dev/mcd/mcd.c
+++ b/sys/dev/mcd/mcd.c
@@ -40,7 +40,7 @@
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $Id: mcd.c,v 1.50 1995/11/29 10:47:44 julian Exp $
+ * $Id: mcd.c,v 1.51 1995/11/29 14:39:46 julian Exp $
*/
static char COPYRIGHT[] = "mcd-driver (C)1993 by H.Veit & B.Moore";
@@ -61,6 +61,10 @@ static char COPYRIGHT[] = "mcd-driver (C)1993 by H.Veit & B.Moore";
#include <sys/dkbad.h>
#include <sys/disklabel.h>
#include <sys/devconf.h>
+#include <sys/kernel.h>
+#ifdef DEVFS
+#include <sys/devfsext.h>
+#endif /*DEVFS*/
#include <machine/clock.h>
@@ -70,15 +74,6 @@ static char COPYRIGHT[] = "mcd-driver (C)1993 by H.Veit & B.Moore";
#include <i386/isa/isa_device.h>
#include <i386/isa/mcdreg.h>
-#ifdef JREMOD
-#include <sys/conf.h>
-#include <sys/kernel.h>
-#ifdef DEVFS
-#include <sys/devfsext.h>
-#endif /*DEVFS*/
-#define CDEV_MAJOR 29
-#define BDEV_MAJOR 7
-#endif /*JREMOD */
#define MCD_TRACE(format, args...) \
{ \
@@ -164,6 +159,12 @@ struct mcd_data {
short debug;
struct buf head; /* head of buf queue */
struct mcd_mbx mbx;
+#ifdef DEVFS
+ void *ra_devfs_token; /* store the devfs handle here */
+ void *rc_devfs_token; /* store the devfs handle here */
+ void *a_devfs_token; /* store the devfs handle here */
+ void *c_devfs_token; /* store the devfs handle here */
+#endif
} mcd_data[NMCD];
/* reader state machine */
@@ -208,11 +209,29 @@ static int mcd_resume(int unit);
static int mcd_lock_door(int unit, int lock);
static int mcd_close_tray(int unit);
-extern int hz;
static int mcd_probe(struct isa_device *dev);
static int mcd_attach(struct isa_device *dev);
struct isa_driver mcddriver = { mcd_probe, mcd_attach, "mcd" };
+static d_open_t mcdopen;
+static d_close_t mcdclose;
+static d_ioctl_t mcdioctl;
+static d_psize_t mcdsize;
+static d_strategy_t mcdstrategy;
+
+#define CDEV_MAJOR 29
+#define BDEV_MAJOR 7
+extern struct cdevsw mcd_cdevsw;
+struct bdevsw mcd_bdevsw =
+ { mcdopen, mcdclose, mcdstrategy, mcdioctl, /*7*/
+ nxdump, mcdsize, 0, "mcd", &mcd_cdevsw, -1 };
+
+struct cdevsw mcd_cdevsw =
+ { mcdopen, mcdclose, rawread, nowrite, /*29*/
+ mcdioctl, nostop, nullreset, nodevtotty,
+ seltrue, nommap, mcdstrategy, "mcd",
+ &mcd_bdevsw, -1 };
+
#define mcd_put(port,byte) outb(port,byte)
#define MCD_RETRYS 5
@@ -253,20 +272,44 @@ mcd_registerdev(struct isa_device *id)
int mcd_attach(struct isa_device *dev)
{
- struct mcd_data *cd = mcd_data + dev->id_unit;
+ int unit = dev->id_unit;
+ struct mcd_data *cd = mcd_data + unit;
+ char name[32];
cd->iobase = dev->id_iobase;
cd->flags |= MCDINIT;
- mcd_soft_reset(dev->id_unit);
+ mcd_soft_reset(unit);
#ifdef NOTYET
/* wire controller for interrupts and dma */
mcd_configure(cd);
#endif
- kdc_mcd[dev->id_unit].kdc_state = DC_IDLE;
+ kdc_mcd[unit].kdc_state = DC_IDLE;
/* name filled in probe */
- kdc_mcd[dev->id_unit].kdc_description = mcd_data[dev->id_unit].name;
+ kdc_mcd[unit].kdc_description = mcd_data[unit].name;
+#ifdef DEVFS
+#define MCD_UID 0
+#define MCD_GID 13
+ sprintf(name, "rmcd%da",unit);
+ cd->ra_devfs_token = devfs_add_devsw(
+ "/", name, &mcd_cdevsw, (unit * 8 ) + 0,
+ DV_CHR, MCD_UID, MCD_GID, 0600);
+
+ sprintf(name, "rmcd%dc",unit);
+ cd->rc_devfs_token = devfs_add_devsw(
+ "/", name, &mcd_cdevsw, (unit * 8 ) + RAW_PART,
+ DV_CHR, MCD_UID, MCD_GID, 0600);
+ sprintf(name, "mcd%da",unit);
+ cd->a_devfs_token = devfs_add_devsw(
+ "/", name, &mcd_bdevsw, (unit * 8 ) + 0,
+ DV_BLK, MCD_UID, MCD_GID, 0600);
+
+ sprintf(name, "mcd%dc",unit);
+ cd->c_devfs_token = devfs_add_devsw(
+ "/", name, &mcd_bdevsw, (unit * 8 ) + RAW_PART,
+ DV_BLK, MCD_UID, MCD_GID, 0600);
+#endif
return 1;
}
@@ -1670,45 +1713,23 @@ mcd_resume(int unit)
return mcd_play(unit, &cd->lastpb);
}
-#ifdef JREMOD
-struct bdevsw mcd_bdevsw =
- { mcdopen, mcdclose, mcdstrategy, mcdioctl, /*7*/
- nxdump, mcdsize, 0 };
-
-struct cdevsw mcd_cdevsw =
- { mcdopen, mcdclose, rawread, nowrite, /*29*/
- mcdioctl, nostop, nullreset, nodevtotty,/* mitsumi cd */
- seltrue, nommap, mcdstrategy };
static mcd_devsw_installed = 0;
static void mcd_drvinit(void *unused)
{
dev_t dev;
- dev_t dev_chr;
if( ! mcd_devsw_installed ) {
dev = makedev(CDEV_MAJOR,0);
cdevsw_add(&dev,&mcd_cdevsw,NULL);
- dev_chr = dev;
dev = makedev(BDEV_MAJOR,0);
bdevsw_add(&dev,&mcd_bdevsw,NULL);
mcd_devsw_installed = 1;
-#ifdef DEVFS
- {
- int x;
-/* default for a simple device with no probe routine (usually delete this) */
-/* path name devsw minor type uid gid perm*/
- "/", "rmcd", major(dev_chr), 0, DV_CHR, 0, 0, 0600);
- x=devfs_add_devsw(
- "/", "mcd", major(dev), 0, DV_BLK, 0, 0, 0600);
- }
-#endif
}
}
SYSINIT(mcddev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,mcd_drvinit,NULL)
-#endif /* JREMOD */
#endif /* NMCD > 0 */
diff --git a/sys/dev/mse/mse.c b/sys/dev/mse/mse.c
index 8e9fa7bfd9970..96f62e5e58a64 100644
--- a/sys/dev/mse/mse.c
+++ b/sys/dev/mse/mse.c
@@ -11,7 +11,7 @@
* this software for any purpose. It is provided "as is"
* without express or implied warranty.
*
- * $Id: mse.c,v 1.18 1995/11/29 14:39:47 julian Exp $
+ * $Id: mse.c,v 1.19 1995/12/06 23:42:53 bde Exp $
*/
/*
* Driver for the Logitech and ATI Inport Bus mice for use with 386bsd and
@@ -55,20 +55,16 @@
#include <sys/ioctl.h>
#include <sys/uio.h>
#include <sys/devconf.h>
+#include <sys/conf.h>
+#ifdef DEVFS
+#include <sys/devfsext.h>
+#endif /*DEVFS*/
#include <machine/clock.h>
#include <i386/isa/isa_device.h>
#include <i386/isa/icu.h>
-#ifdef JREMOD
-#include <sys/conf.h>
-#include <sys/kernel.h>
-#ifdef DEVFS
-#include <sys/devfsext.h>
-#endif /*DEVFS*/
-#define CDEV_MAJOR 27
-#endif /*JREMOD*/
static int mseprobe(struct isa_device *);
static int mseattach(struct isa_device *);
@@ -77,6 +73,18 @@ struct isa_driver msedriver = {
mseprobe, mseattach, "mse"
};
+static d_open_t mseopen;
+static d_close_t mseclose;
+static d_read_t mseread;
+static d_select_t mseselect;
+
+#define CDEV_MAJOR 27
+struct cdevsw mse_cdevsw =
+ { mseopen, mseclose, mseread, nowrite, /*27*/
+ noioc, nostop, nullreset, nodevtotty,/* mse */
+ mseselect, nommap, NULL, "mse", NULL, -1 };
+
+
/*
* Software control structure for mouse. The sc_enablemouse(),
* sc_disablemouse() and sc_getmouse() routines must be called spl'd().
@@ -96,6 +104,10 @@ struct mse_softc {
int sc_buttons;
int sc_bytesread;
u_char sc_bytes[PROTOBYTES];
+#ifdef DEVFS
+ void *devfs_token;
+ void *n_devfs_token;
+#endif
} mse_sc[NMSE];
/* Flags */
@@ -238,17 +250,31 @@ int
mseattach(idp)
struct isa_device *idp;
{
- struct mse_softc *sc = &mse_sc[idp->id_unit];
+ char name[32];
+ int unit = idp->id_unit;
+ struct mse_softc *sc = &mse_sc[unit];
sc->sc_port = idp->id_iobase;
- kdc_mse[idp->id_unit].kdc_state = DC_IDLE;
+ kdc_mse[unit].kdc_state = DC_IDLE;
+#ifdef DEVFS
+ sprintf(name,"mse%d", unit);
+ /* path name devsw minor */
+ sc->devfs_token = devfs_add_devsw( "/", name, &mse_cdevsw, unit << 1,
+ /*type uid gid perm*/
+ DV_CHR, 0, 0, 0600);
+ sprintf(name,"nmse%d", unit);
+ /* path name devsw minor */
+ sc->n_devfs_token = devfs_add_devsw("/", name, &mse_cdevsw, (unit<<1)+1,
+ /*type uid gid perm*/
+ DV_CHR, 0, 0, 0600);
+#endif
return (1);
}
/*
* Exclusive open the mouse, initialize it and enable interrupts.
*/
-int
+static int
mseopen(dev, flags, fmt, p)
dev_t dev;
int flags;
@@ -281,7 +307,7 @@ mseopen(dev, flags, fmt, p)
/*
* mseclose: just turn off mouse innterrupts.
*/
-int
+static int
mseclose(dev, flags, fmt, p)
dev_t dev;
int flags;
@@ -304,7 +330,7 @@ mseclose(dev, flags, fmt, p)
* using bytes 4 and 5.
* (Yes this is cheesy, but it makes the X386 server happy, so...)
*/
-int
+static int
mseread(dev, uio, ioflag)
dev_t dev;
struct uio *uio;
@@ -366,7 +392,7 @@ mseread(dev, uio, ioflag)
/*
* mseselect: check for mouse input to be processed.
*/
-int
+static int
mseselect(dev, rw, p)
dev_t dev;
int rw;
@@ -575,12 +601,6 @@ mse_getati(port, dx, dy, but)
outb(port + MSE_PORTB, MSE_INPORT_INTREN);
}
-#ifdef JREMOD
-struct cdevsw mse_cdevsw =
- { mseopen, mseclose, mseread, nowrite, /*27*/
- noioc, nostop, nullreset, nodevtotty,/* mse */
- mseselect, nommap, NULL };
-
static mse_devsw_installed = 0;
static void mse_drvinit(void *unused)
@@ -588,23 +608,13 @@ static void mse_drvinit(void *unused)
dev_t dev;
if( ! mse_devsw_installed ) {
- dev = makedev(CDEV_MAJOR,0);
- cdevsw_add(&dev,&mse_cdevsw,NULL);
+ dev = makedev(CDEV_MAJOR, 0);
+ cdevsw_add(&dev,&mse_cdevsw, NULL);
mse_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*/
- "/", "mse", major(dev), 0, DV_CHR, 0, 0, 0600);
- }
-#endif
}
}
SYSINIT(msedev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,mse_drvinit,NULL)
-#endif /* JREMOD */
#endif /* NMSE */
diff --git a/sys/dev/rc/rc.c b/sys/dev/rc/rc.c
index e4e3325f65724..83db4c634a292 100644
--- a/sys/dev/rc/rc.c
+++ b/sys/dev/rc/rc.c
@@ -47,6 +47,9 @@
#include <sys/kernel.h>
#include <sys/syslog.h>
#include <sys/devconf.h>
+#ifdef DEVFS
+#include <sys/devfsext.h>
+#endif /*DEVFS*/
#include <machine/clock.h>
@@ -57,14 +60,6 @@
#include <i386/isa/ic/cd180.h>
#include <i386/isa/rcreg.h>
-#ifdef JREMOD
-#include <sys/conf.h>
-#include <sys/kernel.h>
-#ifdef DEVFS
-#include <sys/devfsext.h>
-#endif /*DEVFS*/
-#define CDEV_MAJOR 63
-#endif /*JREMOD*/
/* Prototypes */
int rcprobe __P((struct isa_device *));
@@ -105,6 +100,20 @@ struct isa_driver rcdriver = {
rcprobe, rcattach, "rc"
};
+static d_open_t rcopen;
+static d_close_t rcclose;
+static d_read_t rcread;
+static d_write_t rcwrite;
+static d_ioctl_t rcioctl;
+static d_stop_t rcstop;
+static d_ttycv_t rcdevtotty;
+
+#define CDEV_MAJOR 63
+struct cdevsw rc_cdevsw =
+ { rcopen, rcclose, rcread, rcwrite, /*63*/
+ rcioctl, rcstop, nxreset, rcdevtotty,/* rc */
+ ttselect, nommap, NULL, "rc", NULL, -1 };
+
/* Per-board structure */
static struct rc_softc {
u_int rcb_probed; /* 1 - probed, 2 - attached */
@@ -134,6 +143,9 @@ static struct rc_chans {
u_char *rc_obufend; /* end of output buf */
u_char rc_ibuf[4 * RC_IBUFSIZE]; /* input buffer */
u_char rc_obuf[RC_OBUFSIZE]; /* output buffer */
+#ifdef DEVFS
+ void *devfs_token;
+#endif
} rc_chans[NRC * CD180_NCHAN];
static int rc_scheduled_event = 0;
@@ -249,6 +261,7 @@ int rcattach(dvp)
struct rc_chans *rc = &rc_chans[dvp->id_unit * CD180_NCHAN];
static int rc_wakeup_started = 0;
struct tty *tp;
+ char name[32];
/* Thorooughly test the device */
if (rcb->rcb_probed != RC_PROBED)
@@ -279,6 +292,13 @@ int rcattach(dvp)
tp->t_lflag = tp->t_iflag = tp->t_oflag = 0;
tp->t_cflag = TTYDEF_CFLAG;
tp->t_ispeed = tp->t_ospeed = TTYDEF_SPEED;
+#ifdef DEVFS
+/* FIX THIS to reflect real devices */
+ sprintf(name,"rc%d.%d",dvp->id_unit,chan);
+ rc->devfs_token = devfs_add_devsw( "/", name,
+ &rc_cdevsw,(dvp->id_unit * CD180_NCHAN) + chan ,
+ DV_CHR, 0, 0, 0600);
+#endif
}
rcb->rcb_probed = RC_ATTACHED;
if (!rc_wakeup_started) {
@@ -693,7 +713,8 @@ done1:
goto repeat;
}
-void rcstop(tp, rw)
+static void
+rcstop(tp, rw)
register struct tty *tp;
int rw;
{
@@ -726,7 +747,8 @@ void rcstop(tp, rw)
enable_intr();
}
-int rcopen(dev, flag, mode, p)
+static int
+rcopen(dev, flag, mode, p)
dev_t dev;
int flag, mode;
struct proc *p;
@@ -817,7 +839,8 @@ out:
return error;
}
-int rcclose(dev, flag, mode, p)
+static int
+rcclose(dev, flag, mode, p)
dev_t dev;
int flag, mode;
struct proc *p;
@@ -874,7 +897,8 @@ register struct rc_chans *rc;
}
/* Read from line */
-int rcread(dev, uio, flag)
+static int
+rcread(dev, uio, flag)
dev_t dev;
struct uio *uio;
int flag;
@@ -885,7 +909,8 @@ int rcread(dev, uio, flag)
}
/* Write to line */
-int rcwrite(dev, uio, flag)
+static int
+rcwrite(dev, uio, flag)
dev_t dev;
struct uio *uio;
int flag;
@@ -1091,7 +1116,8 @@ struct rc_softc *rcb;
(void) rc_param(rc->rc_tp, &rc->rc_tp->t_termios);
}
-int rcioctl(dev, cmd, data, flag, p)
+static int
+rcioctl(dev, cmd, data, flag, p)
dev_t dev;
int cmd, flag;
caddr_t data;
@@ -1409,7 +1435,7 @@ char *comment;
}
#endif /* RCDEBUG */
-struct tty *
+static struct tty *
rcdevtotty(dev)
dev_t dev;
{
@@ -1501,12 +1527,6 @@ rc_wait0(nec, unit, chan, line)
unit, chan, line);
}
-#ifdef JREMOD
-struct cdevsw rc_cdevsw =
- { rcopen, rcclose, rcread, rcwrite, /*63*/
- rcioctl, rcstop, nxreset, rcdevtotty,/* rc */
- ttselect, nommap, NULL };
-
static rc_devsw_installed = 0;
static void rc_drvinit(void *unused)
@@ -1514,23 +1534,13 @@ static void rc_drvinit(void *unused)
dev_t dev;
if( ! rc_devsw_installed ) {
- dev = makedev(CDEV_MAJOR,0);
- cdevsw_add(&dev,&rc_cdevsw,NULL);
+ dev = makedev(CDEV_MAJOR, 0);
+ cdevsw_add(&dev,&rc_cdevsw, NULL);
rc_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*/
- "/", "rc", major(dev), 0, DV_CHR, 0, 0, 0600);
- }
-#endif
}
}
SYSINIT(rcdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,rc_drvinit,NULL)
-#endif /* JREMOD */
#endif /* NRC */
diff --git a/sys/dev/scd/scd.c b/sys/dev/scd/scd.c
index edffabf2111d7..a111bba9dbdf0 100644
--- a/sys/dev/scd/scd.c
+++ b/sys/dev/scd/scd.c
@@ -41,7 +41,7 @@
*/
-/* $Id: scd.c,v 1.11 1995/11/29 10:47:50 julian Exp $ */
+/* $Id: scd.c,v 1.12 1995/11/29 14:39:53 julian Exp $ */
/* Please send any comments to micke@dynas.se */
@@ -64,6 +64,10 @@
#include <sys/dkbad.h>
#include <sys/disklabel.h>
#include <sys/devconf.h>
+#include <sys/kernel.h>
+#ifdef DEVFS
+#include <sys/devfsext.h>
+#endif /*DEVFS*/
#include <machine/clock.h>
#include <machine/stdarg.h>
@@ -72,14 +76,6 @@
#include <i386/isa/isa_device.h>
#include <i386/isa/scdreg.h>
-#ifdef JREMOD
-#include <sys/kernel.h>
-#ifdef DEVFS
-#include <sys/devfsext.h>
-#endif /*DEVFS*/
-#define CDEV_MAJOR 45
-#define BDEV_MAJOR 16
-#endif /*JREMOD */
#define scd_part(dev) ((minor(dev)) & 7)
#define scd_unit(dev) (((minor(dev)) & 0x38) >> 3)
@@ -148,6 +144,12 @@ static struct scd_data {
short audio_status;
struct buf head; /* head of buf queue */
struct scd_mbx mbx;
+#ifdef DEVFS
+ void *ra_devfs_token;
+ void *rc_devfs_token;
+ void *a_devfs_token;
+ void *c_devfs_token;
+#endif
} scd_data[NSCD];
/* prototypes */
@@ -184,12 +186,30 @@ static int scd_toc_header(int unit, struct ioc_toc_header *th);
static int scd_toc_entrys(int unit, struct ioc_read_toc_entry *te);
#define SCD_LASTPLUS1 170 /* don't ask, xcdplayer passes this in */
-extern int hz;
-
static int scd_probe(struct isa_device *dev);
static int scd_attach(struct isa_device *dev);
struct isa_driver scddriver = { scd_probe, scd_attach, "scd" };
+static d_open_t scdopen;
+static d_close_t scdclose;
+static d_ioctl_t scdioctl;
+static d_psize_t scdsize;
+static d_strategy_t scdstrategy;
+
+#define CDEV_MAJOR 45
+#define BDEV_MAJOR 16
+extern struct cdevsw scd_cdevsw;
+struct bdevsw scd_bdevsw =
+ { scdopen, scdclose, scdstrategy, scdioctl, /*16*/
+ nxdump, scdsize, 0, "scd", &scd_cdevsw, -1 };
+
+struct cdevsw scd_cdevsw =
+ { scdopen, scdclose, rawread, nowrite, /*45*/
+ scdioctl, nostop, nullreset, nodevtotty,/* sony cd */
+ seltrue, nommap, scdstrategy, "scd",
+ &scd_bdevsw, -1 };
+
+
static struct kern_devconf kdc_scd[NSCD] = { {
0, 0, 0, /* filled in by dev_attach */
"scd", 0, { MDDT_ISA, 0, "bio" },
@@ -213,7 +233,9 @@ scd_registerdev(struct isa_device *id)
int scd_attach(struct isa_device *dev)
{
- struct scd_data *cd = scd_data + dev->id_unit;
+ int unit = dev->id_unit;
+ struct scd_data *cd = scd_data + unit;
+ char name[32];
cd->iobase = dev->id_iobase; /* Already set by probe, but ... */
@@ -227,10 +249,33 @@ int scd_attach(struct isa_device *dev)
cd->flags = SCDINIT;
cd->audio_status = CD_AS_AUDIO_INVALID;
+#ifdef DEVFS
+#define SCD_UID 0
+#define SCD_GID 13
+ sprintf(name, "rscd%da",unit);
+ cd->ra_devfs_token = devfs_add_devsw(
+ "/", name, &scd_cdevsw, (unit * 8 ) + 0,
+ DV_CHR, SCD_UID, SCD_GID, 0600);
+
+ sprintf(name, "rscd%dc",unit);
+ cd->rc_devfs_token = devfs_add_devsw(
+ "/", name, &scd_cdevsw, (unit * 8 ) + RAW_PART,
+ DV_CHR, SCD_UID, SCD_GID, 0600);
+
+ sprintf(name, "scd%da",unit);
+ cd->a_devfs_token = devfs_add_devsw(
+ "/", name, &scd_bdevsw, (unit * 8 ) + 0,
+ DV_BLK, SCD_UID, SCD_GID, 0600);
+
+ sprintf(name, "scd%dc",unit);
+ cd->c_devfs_token = devfs_add_devsw(
+ "/", name, &scd_bdevsw, (unit * 8 ) + RAW_PART,
+ DV_BLK, SCD_UID, SCD_GID, 0600);
+#endif
return 1;
}
-int
+static int
scdopen(dev_t dev, int flags, int fmt, struct proc *p)
{
int unit,part,phys;
@@ -283,7 +328,7 @@ scdopen(dev_t dev, int flags, int fmt, struct proc *p)
return 0;
}
-int
+static int
scdclose(dev_t dev, int flags, int fmt, struct proc *p)
{
int unit,part,phys;
@@ -313,7 +358,7 @@ scdclose(dev_t dev, int flags, int fmt, struct proc *p)
return 0;
}
-void
+static void
scdstrategy(struct buf *bp)
{
struct scd_data *cd;
@@ -416,7 +461,7 @@ scd_start(int unit)
return;
}
-int
+static int
scdioctl(dev_t dev, int cmd, caddr_t addr, int flags, struct proc *p)
{
struct scd_data *cd;
@@ -492,7 +537,7 @@ scdioctl(dev_t dev, int cmd, caddr_t addr, int flags, struct proc *p)
}
}
-int
+static int
scdsize(dev_t dev)
{
return -1;
@@ -1529,46 +1574,22 @@ scd_toc_entrys (int unit, struct ioc_read_toc_entry *te)
}
-#ifdef JREMOD
-struct bdevsw scd_bdevsw =
- { scdopen, scdclose, scdstrategy, scdioctl, /*16*/
- nxdump, scdsize, 0 };
-
-struct cdevsw scd_cdevsw =
- { scdopen, scdclose, rawread, nowrite, /*45*/
- scdioctl, nostop, nullreset, nodevtotty,/* sony cd */
- seltrue, nommap, scdstrategy };
-
static scd_devsw_installed = 0;
static void scd_drvinit(void *unused)
{
dev_t dev;
- dev_t dev_chr;
if( ! scd_devsw_installed ) {
- dev = makedev(CDEV_MAJOR,0);
- cdevsw_add(&dev,&scd_cdevsw,NULL);
- dev_chr = dev;
- dev = makedev(BDEV_MAJOR,0);
- bdevsw_add(&dev,&scd_bdevsw,NULL);
+ dev = makedev(CDEV_MAJOR, 0);
+ cdevsw_add(&dev,&scd_cdevsw, NULL);
+ dev = makedev(BDEV_MAJOR, 0);
+ bdevsw_add(&dev,&scd_bdevsw, NULL);
scd_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*/
- "/", "rscd", major(dev_chr), 0, DV_CHR, 0, 0, 0600);
- x=devfs_add_devsw(
- "/", "scd", major(dev), 0, DV_BLK, 0, 0, 0600);
- }
-#endif
}
}
SYSINIT(scddev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,scd_drvinit,NULL)
-#endif /* JREMOD */
#endif /* NSCD > 0 */
diff --git a/sys/dev/si/si.c b/sys/dev/si/si.c
index 1b732d90af058..cc1d6a7463379 100644
--- a/sys/dev/si/si.c
+++ b/sys/dev/si/si.c
@@ -30,7 +30,7 @@
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
* NO EVENT SHALL THE AUTHORS BE LIABLE.
*
- * $Id: si.c,v 1.21 1995/12/06 23:50:27 bde Exp $
+ * $Id: si.c,v 1.22 1995/12/07 12:46:06 davidg Exp $
*/
#ifndef lint
@@ -53,6 +53,9 @@ static char si_copyright1[] = "@(#) (C) Specialix International, 1990,1992",
#include <sys/syslog.h>
#include <sys/malloc.h>
#include <sys/devconf.h>
+#ifdef DEVFS
+#include <sys/devfsext.h>
+#endif /*DEVFS*/
#include <machine/clock.h>
@@ -84,12 +87,8 @@ static char si_copyright1[] = "@(#) (C) Specialix International, 1990,1992",
enum si_mctl { GET, SET, BIS, BIC };
-#ifdef JREMOD
-#ifdef DEVFS
-#include <sys/devfsext.h>
-#endif /*DEVFS*/
-#define CDEV_MAJOR 68
-#endif /*JREMOD*/
+static const char devchar[] = "ABCDEFGHIJK";
+static const char portchar[] = "0123456789abcdefghijklmnopqrstuvwxyz";
static void si_command __P((struct si_port *, int, int));
@@ -110,6 +109,25 @@ extern int siprobe __P((struct isa_device *id));
extern int siattach __P((struct isa_device *id));
static void si_modem_state __P((struct si_port *pp, struct tty *tp, int hi_ip));
+struct isa_driver sidriver =
+ { siprobe, siattach, "si" };
+
+
+static d_open_t siopen;
+static d_close_t siclose;
+static d_read_t siread;
+static d_write_t siwrite;
+static d_ioctl_t siioctl;
+static d_stop_t sistop;
+static d_ttycv_t sidevtotty;
+
+#define CDEV_MAJOR 68
+struct cdevsw si_cdevsw =
+ { siopen, siclose, siread, siwrite, /*68*/
+ siioctl, sistop, nxreset, sidevtotty,/* si */
+ ttselect, nxmmap, NULL, "si", NULL, -1 };
+
+
#ifdef SI_DEBUG /* use: ``options "SI_DEBUG"'' in your config file */
/* XXX: should be varargs, I know.. but where's vprintf()? */
static void si_dprintf __P((/* struct si_port *pp, int flags, char *str, int a1, int a2, int a3, int a4, int a5, int a6 */));
@@ -142,6 +160,16 @@ struct si_softc {
int sc_eisa_iobase; /* EISA io port address */
int sc_eisa_irqbits;
struct kern_devconf sc_kdc;
+#ifdef DEVFS
+ struct {
+ void *ttyd;
+ void *ttyl;
+ void *ttyi;
+ void *cuaa;
+ void *cual;
+ void *cuai;
+ } devfs_token[32]; /* what is the max per card? */
+#endif
};
struct si_softc si_softc[NSI]; /* up to 4 elements */
@@ -460,6 +488,7 @@ siattach(id)
struct speedtab *spt;
int nmodule, nport, x, y;
int uart_type;
+ char name[32];
DPRINT((0, DBG_AUTOBOOT, "si%d: siattach\n", id->id_unit));
@@ -663,14 +692,39 @@ mem_fail:
done_chartimes = 1;
}
+#ifdef DEVFS
+/* path name devsw minor type uid gid perm*/
+ for ( x = 0; x < nport; x++ ) {
+ sprintf(name,"tty%c%c",devchar[unit],portchar[x + 1]);
+ sc->devfs_token[x].ttyd = devfs_add_devsw(
+ "/", name, &si_cdevsw, unit,
+ DV_CHR, 0, 0, 0600);
+ sprintf(name,"ttyi%c%c",devchar[unit],portchar[x + 1]);
+ sc->devfs_token[x].ttyi = devfs_add_devsw(
+ "/", name, &si_cdevsw, unit + 32,
+ DV_CHR, 0, 0, 0600);
+ sprintf(name,"ttyl%c%c",devchar[unit],portchar[x + 1]);
+ sc->devfs_token[x].ttyl = devfs_add_devsw(
+ "/", name, &si_cdevsw, unit + 64,
+ DV_CHR, 0, 0, 0600);
+ sprintf(name,"cua%c%c",devchar[unit],portchar[x + 1]);
+ sc->devfs_token[x].cuaa = devfs_add_devsw(
+ "/", name, &si_cdevsw, unit + 128,
+ DV_CHR, 0, 0, 0600);
+ sprintf(name,"cuai%c%c",devchar[unit],portchar[x + 1]);
+ sc->devfs_token[x].cuai = devfs_add_devsw(
+ "/", name, &si_cdevsw, unit + 160,
+ DV_CHR, 0, 0, 0600);
+ sprintf(name,"cual%c%c",devchar[unit],portchar[x + 1]);
+ sc->devfs_token[x].cual = devfs_add_devsw(
+ "/", name, &si_cdevsw, unit + 192,
+ DV_CHR, 0, 0, 0600);
+ }
+#endif
return (1);
}
-struct isa_driver sidriver =
- { siprobe, siattach, "si" };
-
-
-int
+static int
siopen(dev, flag, mode, p)
dev_t dev;
int flag, mode;
@@ -841,7 +895,7 @@ out:
return(error);
}
-int
+static int
siclose(dev, flag, mode, p)
dev_t dev;
int flag, mode;
@@ -961,7 +1015,7 @@ sidtrwakeup(chan)
/*
* User level stuff - read and write
*/
-int
+static int
siread(dev, uio, flag)
register dev_t dev;
struct uio *uio;
@@ -981,7 +1035,7 @@ siread(dev, uio, flag)
}
-int
+static int
siwrite(dev, uio, flag)
dev_t dev;
struct uio *uio;
@@ -1020,7 +1074,7 @@ out:
}
-struct tty *
+static struct tty *
sidevtotty(dev_t dev)
{
struct si_port *pp;
@@ -1035,7 +1089,7 @@ sidevtotty(dev_t dev)
return (pp->sp_tty);
}
-int
+static int
siioctl(dev, cmd, data, flag, p)
dev_t dev;
int cmd;
@@ -2305,40 +2359,19 @@ si_mctl2str(cmd)
#endif /* DEBUG */
-#ifdef JREMOD
-struct cdevsw si_cdevsw =
- { siopen, siclose, siread, siwrite, /*68*/
- siioctl, sistop, nxreset, sidevtotty,/* si */
- ttselect, nxmmap, NULL };
static si_devsw_installed = 0;
static void si_drvinit(void *unused)
{
dev_t dev;
- dev_t dev_chr;
if( ! si_devsw_installed ) {
- dev = makedev(CDEV_MAJOR,0);
- cdevsw_add(&dev,&si_cdevsw,NULL);
- dev_chr = dev;
-#if defined(BDEV_MAJOR)
- dev = makedev(BDEV_MAJOR,0);
- bdevsw_add(&dev,&si_bdevsw,NULL);
-#endif /*BDEV_MAJOR*/
+ dev = makedev(CDEV_MAJOR, 0);
+ cdevsw_add(&dev,&si_cdevsw, NULL);
si_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*/
- "/", "si", major(dev_chr), 0, DV_CHR, 0, 0, 0600);
- }
-#endif
}
}
SYSINIT(sidev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,si_drvinit,NULL)
-#endif /* JREMOD */
diff --git a/sys/dev/sio/sio.c b/sys/dev/sio/sio.c
index b6b090fa87b2f..d44d7bcf12e8a 100644
--- a/sys/dev/sio/sio.c
+++ b/sys/dev/sio/sio.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* from: @(#)com.c 7.5 (Berkeley) 5/16/91
- * $Id: sio.c,v 1.123 1995/11/29 15:00:07 bde Exp $
+ * $Id: sio.c,v 1.124 1995/12/06 23:43:07 bde Exp $
*/
#include "sio.h"
@@ -59,6 +59,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>
@@ -95,12 +98,6 @@
#define com_scr 7 /* scratch register for 16450-16550 (R/W) */
-#ifdef JREMOD
-#ifdef DEVFS
-#include <sys/devfsext.h>
-#endif /*DEVFS*/
-#define CDEV_MAJOR 28
-#endif /*JREMOD*/
#include "crd.h"
@@ -251,6 +248,14 @@ struct com_s {
*/
u_char obuf1[256];
u_char obuf2[256];
+#ifdef DEVFS
+ void *devfs_token_ttyd;
+ void *devfs_token_ttyl;
+ void *devfs_token_ttyi;
+ void *devfs_token_cuaa;
+ void *devfs_token_cual;
+ void *devfs_token_cuai;
+#endif
};
/*
@@ -285,6 +290,8 @@ static void disc_optim __P((struct tty *tp, struct termios *t,
static int LoadSoftModem __P((int unit,int base_io, u_long size, u_char *ptr));
#endif /* DSI_SOFT_MODEM */
+static char driver_name[] = "sio";
+
/* table and macro for fast conversion from a unit number to its com struct */
static struct com_s *p_com_addr[NSIO];
#define com_addr(unit) (p_com_addr[unit])
@@ -292,9 +299,24 @@ static struct com_s *p_com_addr[NSIO];
static struct timeval intr_timestamp;
struct isa_driver siodriver = {
- sioprobe, sioattach, "sio"
+ sioprobe, sioattach, driver_name
};
+static d_open_t sioopen;
+static d_close_t sioclose;
+static d_read_t sioread;
+static d_write_t siowrite;
+static d_ioctl_t sioioctl;
+static d_stop_t siostop;
+static d_ttycv_t siodevtotty;
+
+#define CDEV_MAJOR 28
+struct cdevsw sio_cdevsw =
+ { sioopen, sioclose, sioread, siowrite, /*28*/
+ sioioctl, siostop, nxreset, siodevtotty,/* sio */
+ ttselect, nommap, NULL, driver_name, NULL, -1 };
+
+
static int comconsole = -1;
static speed_t comdefaultrate = TTYDEF_SPEED;
static u_int com_events; /* input chars + weighted output completions */
@@ -338,9 +360,10 @@ static struct speedtab comspeedtab[] = {
{ -1, -1 }
};
+static char chardev[] = "0123456789abcdefghijklmnopqrstuvwxyz";
static struct kern_devconf kdc_sio[NSIO] = { {
0, 0, 0, /* filled in by dev_attach */
- "sio", 0, { MDDT_ISA, 0, "tty" },
+ driver_name, 0, { MDDT_ISA, 0, "tty" },
isa_generic_externalize, 0, 0, ISA_EXTERNALLEN,
&kdc_isa0, /* parent */
0, /* parentdata */
@@ -359,7 +382,7 @@ static int sioinit(struct pccard_dev *, int); /* init device */
static struct pccard_drv sio_info =
{
- "sio",
+ driver_name,
card_intr,
siounload,
siosuspend,
@@ -696,6 +719,7 @@ sioattach(isdp)
Port_t iobase;
int s;
int unit;
+ char name[32];
isdp->id_ri_flags |= RI_FAST;
iobase = isdp->id_iobase;
@@ -880,10 +904,37 @@ determined_type: ;
com_addr(unit) = com;
splx(s);
+#ifdef DEVFS
+/* path name devsw minor type uid gid perm*/
+ sprintf(name,"ttyd%c",chardev[unit]);
+ com->devfs_token_ttyd = devfs_add_devsw(
+ "/", name, &sio_cdevsw, unit,
+ DV_CHR, 0, 0, 0600);
+ sprintf(name,"ttyid%c",chardev[unit]);
+ com->devfs_token_ttyi = devfs_add_devsw(
+ "/", name, &sio_cdevsw, unit+32,
+ DV_CHR, 0, 0, 0600);
+ sprintf(name,"ttyld%c",chardev[unit]);
+ com->devfs_token_ttyl = devfs_add_devsw(
+ "/", name, &sio_cdevsw, unit+64,
+ DV_CHR, 0, 0, 0600);
+ sprintf(name,"cuaa%c",chardev[unit]);
+ com->devfs_token_cuaa = devfs_add_devsw(
+ "/", name, &sio_cdevsw, unit+128,
+ DV_CHR, 0, 0, 0600);
+ sprintf(name,"cuaia%c",chardev[unit]);
+ com->devfs_token_cuai = devfs_add_devsw(
+ "/", name, &sio_cdevsw, unit+160,
+ DV_CHR, 0, 0, 0600);
+ sprintf(name,"cuala%c",chardev[unit]);
+ com->devfs_token_cual = devfs_add_devsw(
+ "/", name, &sio_cdevsw, unit+192,
+ DV_CHR, 0, 0, 0600);
+#endif
return (1);
}
-int
+static int
sioopen(dev, flag, mode, p)
dev_t dev;
int flag;
@@ -1055,7 +1106,7 @@ out:
return (error);
}
-int
+static int
sioclose(dev, flag, mode, p)
dev_t dev;
int flag;
@@ -1150,7 +1201,7 @@ comhardclose(com)
splx(s);
}
-int
+static int
sioread(dev, uio, flag)
dev_t dev;
struct uio *uio;
@@ -1170,7 +1221,7 @@ sioread(dev, uio, flag)
return ((*linesw[tp->t_line].l_read)(tp, uio, flag));
}
-int
+static int
siowrite(dev, uio, flag)
dev_t dev;
struct uio *uio;
@@ -1429,7 +1480,7 @@ cont:
}
}
-int
+static int
sioioctl(dev, cmd, data, flag, p)
dev_t dev;
int cmd;
@@ -2012,7 +2063,7 @@ comstart(tp)
splx(s);
}
-void
+static void
siostop(tp, rw)
struct tty *tp;
int rw;
@@ -2041,7 +2092,7 @@ siostop(tp, rw)
/* XXX should clear h/w fifos too. */
}
-struct tty *
+static struct tty *
siodevtotty(dev)
dev_t dev;
{
@@ -2559,12 +2610,6 @@ error:
}
#endif /* DSI_SOFT_MODEM */
-#ifdef JREMOD
-struct cdevsw sio_cdevsw =
- { sioopen, sioclose, sioread, siowrite, /*28*/
- sioioctl, siostop, nxreset, siodevtotty,/* sio */
- ttselect, nommap, NULL };
-
static sio_devsw_installed = 0;
static void sio_drvinit(void *unused)
@@ -2572,23 +2617,12 @@ static void sio_drvinit(void *unused)
dev_t dev;
if( ! sio_devsw_installed ) {
- dev = makedev(CDEV_MAJOR,0);
- cdevsw_add(&dev,&sio_cdevsw,NULL);
+ dev = makedev(CDEV_MAJOR, 0);
+ cdevsw_add(&dev,&sio_cdevsw, NULL);
sio_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*/
- "/", "sio", major(dev), 0, DV_CHR, 0, 0, 0600);
- }
-#endif
}
}
SYSINIT(siodev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,sio_drvinit,NULL)
-#endif /* JREMOD */
-
#endif /* NSIO > 0 */
diff --git a/sys/dev/snp/snp.c b/sys/dev/snp/snp.c
index 8e16b2f99a97a..27ffe9feaa62a 100644
--- a/sys/dev/snp/snp.c
+++ b/sys/dev/snp/snp.c
@@ -30,15 +30,25 @@
#include <sys/uio.h>
#include <sys/kernel.h>
#include <sys/malloc.h>
-
-#include <sys/snoop.h>
-
-#ifdef JREMOD
#ifdef DEVFS
#include <sys/devfsext.h>
#endif /*DEVFS*/
+
+#include <sys/snoop.h>
+
+static d_open_t snpopen;
+static d_close_t snpclose;
+static d_read_t snpread;
+static d_write_t snpwrite;
+static d_ioctl_t snpioctl;
+static d_select_t snpselect;
+
#define CDEV_MAJOR 53
-#endif /*JREMOD*/
+struct cdevsw snp_cdevsw =
+ { snpopen, snpclose, snpread, snpwrite, /*53*/
+ snpioctl, nostop, nullreset, nodevtotty,/* snoop */
+ snpselect, nommap, NULL, "snp", NULL, -1 };
+
#ifndef MIN
#define MIN(a,b) (((a)<(b))?(a):(b))
@@ -63,7 +73,7 @@ devtotty (dev)
* length for function keys...
*/
-int
+static int
snpwrite(dev, uio, flag)
dev_t dev;
struct uio *uio;
@@ -104,7 +114,7 @@ tty_input:
}
-int
+static int
snpread(dev, uio, flag)
dev_t dev;
struct uio *uio;
@@ -270,7 +280,7 @@ snpin(snp, buf, n)
return n;
}
-int
+static int
snpopen(dev, flag, mode, p)
dev_t dev;
int flag, mode;
@@ -346,7 +356,7 @@ detach_notty:
return (0);
}
-int
+static int
snpclose(dev, flags, fmt, p)
dev_t dev;
int flags;
@@ -376,7 +386,7 @@ snpdown(snp)
}
-int
+static int
snpioctl(dev, cmd, data, flags, p)
dev_t dev;
int cmd;
@@ -473,7 +483,7 @@ snpioctl(dev, cmd, data, flags, p)
}
-int
+static int
snpselect(dev, rw, p)
dev_t dev;
int rw;
@@ -500,29 +510,26 @@ snpselect(dev, rw, p)
return 0;
}
-#ifdef JREMOD
-struct cdevsw snp_cdevsw =
- { snpopen, snpclose, snpread, snpwrite, /*53*/
- snpioctl, nostop, nullreset, nodevtotty,/* snoop */
- snpselect, nommap, NULL };
-
+static void *snp_devfs_token[NSNP];
static snp_devsw_installed = 0;
-static void snp_drvinit(void *unused)
+static void
+snp_drvinit(void *unused)
{
dev_t dev;
+ char name[32];
+ int i;
if( ! snp_devsw_installed ) {
- dev = makedev(CDEV_MAJOR,0);
- cdevsw_add(&dev,&snp_cdevsw,NULL);
+ dev = makedev(CDEV_MAJOR, 0);
+ cdevsw_add(&dev,&snp_cdevsw, NULL);
snp_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*/
- "/", "snp", major(dev), 0, DV_CHR, 0, 0, 0600);
+ for ( i = 0 ; i < NSNP ; i++) {
+ sprintf(name,"snp%d",i);
+ snp_devfs_token[i] =
+ devfs_add_devsw( "/", name, &snp_cdevsw, i,
+ DV_CHR, 0, 0, 0600);
}
#endif
}
@@ -530,6 +537,5 @@ static void snp_drvinit(void *unused)
SYSINIT(snpdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,snp_drvinit,NULL)
-#endif /* JREMOD */
#endif
diff --git a/sys/dev/speaker/spkr.c b/sys/dev/speaker/spkr.c
index 9d45e3361ff01..160c18b08e192 100644
--- a/sys/dev/speaker/spkr.c
+++ b/sys/dev/speaker/spkr.c
@@ -4,7 +4,7 @@
* v1.4 by Eric S. Raymond (esr@snark.thyrsus.com) Aug 1993
* modified for FreeBSD by Andrew A. Chernov <ache@astral.msk.su>
*
- * $Id: spkr.c,v 1.19 1995/11/29 10:47:57 julian Exp $
+ * $Id: spkr.c,v 1.20 1995/11/29 14:39:59 julian Exp $
*/
#include "speaker.h"
@@ -18,21 +18,29 @@
#include <sys/buf.h>
#include <sys/proc.h>
#include <sys/uio.h>
+#include <sys/conf.h>
#include <i386/isa/isa.h>
#include <i386/isa/timerreg.h>
#include <machine/clock.h>
#include <machine/speaker.h>
-#ifdef JREMOD
-#include <sys/conf.h>
-#define CDEV_MAJOR 26
-#endif /*JREMOD*/
#ifdef DEVFS
#include <sys/devfsext.h>
+void *devfs_token;
#endif
+static d_open_t spkropen;
+static d_close_t spkrclose;
+static d_write_t spkrwrite;
+static d_ioctl_t spkrioctl;
+
+#define CDEV_MAJOR 26
+struct cdevsw spkr_cdevsw =
+ { spkropen, spkrclose, noread, spkrwrite, /*26*/
+ spkrioctl, nostop, nullreset, nodevtotty,/* spkr */
+ seltrue, nommap, NULL, "spkr", NULL, -1 };
/**************** MACHINE DEPENDENT PART STARTS HERE *************************
*
@@ -569,11 +577,6 @@ struct proc *p;
return(EINVAL);
}
-#ifdef JREMOD
-struct cdevsw spkr_cdevsw =
- { spkropen, spkrclose, noread, spkrwrite, /*26*/
- spkrioctl, nostop, nullreset, nodevtotty,/* spkr */
- seltrue, nommap, NULL };
static spkr_devsw_installed = 0;
@@ -582,24 +585,19 @@ static void spkr_drvinit(void *unused)
dev_t dev;
if( ! spkr_devsw_installed ) {
- dev = makedev(CDEV_MAJOR,0);
- cdevsw_add(&dev,&spkr_cdevsw,NULL);
+ dev = makedev(CDEV_MAJOR, 0);
+ cdevsw_add(&dev,&spkr_cdevsw, NULL);
spkr_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*/
- "/", "spkr", major(dev), 0, DV_CHR, 0, 0, 0600);
- }
+ devfs_token = devfs_add_devsw("/", "spkr",
+ &spkr_cdevsw, 0,
+ DV_CHR, 0, 0, 0600);
#endif
}
}
SYSINIT(spkrdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,spkr_drvinit,NULL)
-#endif /* JREMOD */
#endif /* NSPEAKER > 0 */
/* spkr.c ends here */
diff --git a/sys/dev/syscons/syscons.c b/sys/dev/syscons/syscons.c
index 6c736ca1c5de3..db7c92d498d02 100644
--- a/sys/dev/syscons/syscons.c
+++ b/sys/dev/syscons/syscons.c
@@ -25,7 +25,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $Id: syscons.c,v 1.133 1995/12/06 23:50:36 bde Exp $
+ * $Id: syscons.c,v 1.134 1995/12/07 12:46:08 davidg Exp $
*/
#include "sc.h"
@@ -45,6 +45,9 @@
#include <sys/errno.h>
#include <sys/malloc.h>
#include <sys/devconf.h>
+#ifdef DEVFS
+#include <sys/devfsext.h>
+#endif
#include <machine/clock.h>
#include <machine/cons.h>
@@ -69,6 +72,7 @@
#define MAXCONS 16
#endif
+
/* this may break on older VGA's but is usefull on real 32 bit systems */
#define bcopyw bcopy
@@ -84,6 +88,7 @@ static default_attr kernel_default = {
static scr_stat main_console;
static scr_stat *console[MAXCONS];
+static void *sc_devfs_token[MAXCONS];
scr_stat *cur_console;
static scr_stat *new_scp, *old_scp;
static term_stat kernel_console;
@@ -159,8 +164,7 @@ static d_mmap_t scmmap;
static struct cdevsw scdevsw = {
scopen, scclose, scread, scwrite,
scioctl, nullstop, noreset, scdevtotty,
- ttselect, scmmap, nostrategy,
-};
+ ttselect, scmmap, nostrategy, "sc", NULL, -1 };
/*
* Calculate hardware attributes word using logical attributes mask and
@@ -283,7 +287,9 @@ scresume(void *dummy)
int
scattach(struct isa_device *dev)
{
- scr_stat *scp;
+ scr_stat *scp;
+ int vc;
+ char name[32];
scinit();
configuration = dev->id_flags;
@@ -345,6 +351,13 @@ scattach(struct isa_device *dev)
apm_hook_establish(APM_HOOK_RESUME , &scp->r_hook);
#endif
+#ifdef DEVFS
+ for ( vc = 0 ; vc < MAXCONS; vc++) {
+ sprintf(name,"ttyv%x", vc);
+ sc_devfs_token[vc] = devfs_add_devsw("/" ,name, &scdevsw, vc,
+ DV_CHR, 0, 0, 0600 );
+ }
+#endif
register_cdev("sc", &scdevsw);
return 0;
diff --git a/sys/dev/vn/vn.c b/sys/dev/vn/vn.c
index 1a163641bda83..68ba76096abd2 100644
--- a/sys/dev/vn/vn.c
+++ b/sys/dev/vn/vn.c
@@ -83,19 +83,35 @@
#include <sys/disklabel.h>
#include <sys/diskslice.h>
#include <sys/stat.h>
+#include <sys/conf.h>
+#ifdef DEVFS
+#include <sys/devfsext.h>
+#endif /*DEVFS*/
#include <miscfs/specfs/specdev.h>
#include <sys/vnioctl.h>
-#ifdef JREMOD
-#include <sys/conf.h>
-#ifdef DEVFS
-#include <sys/devfsext.h>
-#endif /*DEVFS*/
+static d_open_t vnopen;
+static d_close_t vnclose;
+static d_ioctl_t vnioctl;
+static d_dump_t vndump;
+static d_psize_t vnsize;
+static d_strategy_t vnstrategy;
+
#define CDEV_MAJOR 43
#define BDEV_MAJOR 15
-#endif /*JREMOD */
+extern struct cdevsw vn_cdevsw;
+struct bdevsw vn_bdevsw =
+ { vnopen, vnclose, vnstrategy, vnioctl, /*15*/
+ vndump, vnsize, 0, "vn", &vn_cdevsw, -1 };
+
+struct cdevsw vn_cdevsw =
+ { vnopen, vnclose, rawread, rawwrite, /*43*/
+ vnioctl, nostop, nullreset, nodevtotty,/* vn */
+ seltrue, nommap, vnstrategy, "vn",
+ &vn_bdevsw, -1 };
+
#ifdef DEBUG
@@ -141,7 +157,7 @@ int vnsetcred __P((struct vn_softc *vn, struct ucred *cred));
void vnshutdown __P((void));
void vnclear __P((struct vn_softc *vn));
-int
+static int
vnclose(dev_t dev, int flags, int mode, struct proc *p)
{
struct vn_softc *vn = vn_softc[vnunit(dev)];
@@ -152,7 +168,7 @@ vnclose(dev_t dev, int flags, int mode, struct proc *p)
return (0);
}
-int
+static int
vnopen(dev_t dev, int flags, int mode, struct proc *p)
{
int unit = vnunit(dev);
@@ -212,7 +228,7 @@ vnopen(dev_t dev, int flags, int mode, struct proc *p)
* and the pageout daemon gets really unhappy (and so does the rest of the
* system) when it runs out of memory.
*/
-void
+static void
vnstrategy(struct buf *bp)
{
int unit = vnunit(bp->b_dev);
@@ -379,7 +395,7 @@ vniodone( struct buf *bp) {
}
/* ARGSUSED */
-int
+static int
vnioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p)
{
struct vn_softc *vn = vn_softc[vnunit(dev)];
@@ -580,7 +596,7 @@ vnclear(struct vn_softc *vn)
dsgone(&vn->sc_slices);
}
-int
+static int
vnsize(dev_t dev)
{
int unit = vnunit(dev);
@@ -591,44 +607,33 @@ vnsize(dev_t dev)
return(vn_softc[unit]->sc_size);
}
-int
+static int
vndump(dev_t dev)
{
return (ENODEV);
}
-#ifdef JREMOD
-struct bdevsw vn_bdevsw =
- { vnopen, vnclose, vnstrategy, vnioctl, /*15*/
- vndump, vnsize, 0 };
-
-struct cdevsw vn_cdevsw =
- { vnopen, vnclose, rawread, rawwrite, /*43*/
- vnioctl, nostop, nullreset, nodevtotty,/* vn */
- seltrue, nommap, vnstrategy };
-
static vn_devsw_installed = 0;
-static void vn_drvinit(void *unused)
+static void
+vn_drvinit(void *unused)
{
dev_t dev;
- dev_t dev_chr;
if( ! vn_devsw_installed ) {
dev = makedev(CDEV_MAJOR,0);
cdevsw_add(&dev,&vn_cdevsw,NULL);
- dev_chr = dev;
dev = makedev(BDEV_MAJOR,0);
bdevsw_add(&dev,&vn_bdevsw,NULL);
vn_devsw_installed = 1;
#ifdef DEVFS
{
- int x;
+ void *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*/
- "/", "rvn", major(dev_chr), 0, DV_CHR, 0, 0, 0600);
+ "/", "rvn", &vn_cdevsw, 0, DV_CHR, 0, 0, 0600);
x=devfs_add_devsw(
- "/", "vn", major(dev), 0, DV_BLK, 0, 0, 0600);
+ "/", "vn", &vn_bdevsw, 0, DV_BLK, 0, 0, 0600);
}
#endif
}
@@ -636,6 +641,5 @@ static void vn_drvinit(void *unused)
SYSINIT(vndev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,vn_drvinit,NULL)
-#endif /* JREMOD */
#endif