summaryrefslogtreecommitdiffstats
path: root/sys/isa
diff options
context:
space:
mode:
Diffstat (limited to 'sys/isa')
-rw-r--r--sys/isa/fd.c75
-rw-r--r--sys/isa/joy.c72
-rw-r--r--sys/isa/sio.c106
-rw-r--r--sys/isa/syscons.c21
4 files changed, 166 insertions, 108 deletions
diff --git a/sys/isa/fd.c b/sys/isa/fd.c
index 1af2cbf..e1b3436 100644
--- a/sys/isa/fd.c
+++ b/sys/isa/fd.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/isa/joy.c b/sys/isa/joy.c
index 25d2311..2955d1c 100644
--- a/sys/isa/joy.c
+++ b/sys/isa/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/isa/sio.c b/sys/isa/sio.c
index b6b090f..d44d7bc 100644
--- a/sys/isa/sio.c
+++ b/sys/isa/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/isa/syscons.c b/sys/isa/syscons.c
index 6c736ca..db7c92d 100644
--- a/sys/isa/syscons.c
+++ b/sys/isa/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;
OpenPOWER on IntegriCloud