summaryrefslogtreecommitdiffstats
path: root/sys/i386/isa/tw.c
diff options
context:
space:
mode:
authorjulian <julian@FreeBSD.org>1995-12-08 11:19:42 +0000
committerjulian <julian@FreeBSD.org>1995-12-08 11:19:42 +0000
commit1900eea896e2aaeae8a9fa8affa5fded2068c9b4 (patch)
tree5150d199464d64c1021f91b2c2f112d48546a8bf /sys/i386/isa/tw.c
parentaaf9d7f10ecc63adae1dc4f55cfd31a2926c605a (diff)
downloadFreeBSD-src-1900eea896e2aaeae8a9fa8affa5fded2068c9b4.zip
FreeBSD-src-1900eea896e2aaeae8a9fa8affa5fded2068c9b4.tar.gz
Pass 3 of the great devsw changes
most devsw referenced functions are now static, as they are in the same file as their devsw structure. I've also added DEVFS support for nearly every device in the system, however many of the devices have 'incorrect' names under DEVFS because I couldn't quickly work out the correct naming conventions. (but devfs won't be coming on line for a month or so anyhow so that doesn't matter) If you "OWN" a device which would normally have an entry in /dev then search for the devfs_add_devsw() entries and munge to make them right.. check out similar devices to see what I might have done in them in you can't see what's going on.. for a laugh compare conf.c conf.h defore and after... :) I have not doen DEVFS entries for any DISKSLICE devices yet as that will be a much more complicated job.. (pass 5 :) pass 4 will be to make the devsw tables of type (cdevsw * ) rather than (cdevsw) seems to work here.. complaints to the usual places.. :)
Diffstat (limited to 'sys/i386/isa/tw.c')
-rw-r--r--sys/i386/isa/tw.c57
1 files changed, 30 insertions, 27 deletions
diff --git a/sys/i386/isa/tw.c b/sys/i386/isa/tw.c
index 7eb75e0..f8406f0 100644
--- a/sys/i386/isa/tw.c
+++ b/sys/i386/isa/tw.c
@@ -138,23 +138,18 @@
#include "uio.h"
#include "syslog.h"
#include "select.h"
+#ifdef DEVFS
+#include <sys/devfsext.h>
+#endif /*DEVFS*/
#define MIN(a,b) ((a)<(b)?(a):(b))
#ifdef HIRESTIME
-#include "time.h"
+#include <sys/time.h>
#endif /* HIRESTIME */
#include "i386/isa/isa_device.h"
-#ifdef JREMOD
-#include <sys/conf.h>
-#include <sys/kernel.h>
-#ifdef DEVFS
-#include <sys/devfsext.h>
-#endif /*DEVFS*/
-#define CDEV_MAJOR 19
-#endif /*JREMOD*/
/*
@@ -211,6 +206,17 @@ struct isa_driver twdriver = {
twprobe, twattach, "tw"
};
+static d_open_t twopen;
+static d_close_t twclose;
+static d_read_t twread;
+static d_write_t twwrite;
+static d_select_t twselect;
+
+#define CDEV_MAJOR 19
+struct cdevsw tw_cdevsw =
+ { twopen, twclose, twread, twwrite, /*19*/
+ noioc, nullstop, nullreset, nodevtotty, /* tw */
+ twselect, nommap, nostrat, "tw", NULL, -1 };
/*
* Software control structure for TW523
*/
@@ -240,6 +246,9 @@ struct tw_sc {
int sc_xtimes[22]; /* Times for bits in current xmit packet */
int sc_rtimes[22]; /* Times for bits in current rcv packet */
#endif /* HIRESTIME */
+#ifdef DEVFS
+ void *devfs_token; /* store the devfs handle */
+#endif
} tw_sc[NTW];
static void twdelay25();
@@ -348,11 +357,20 @@ int twattach(idp)
struct isa_device *idp;
{
struct tw_sc *sc;
+ char name[32];
+ int unit;
- sc = &tw_sc[idp->id_unit];
+ sc = &tw_sc[unit = idp->id_unit];
sc->sc_port = idp->id_iobase;
sc->sc_state = 0;
+#ifdef DEVFS
+/* path name devsw minor type uid gid perm*/
+ sprintf(name,"tw%d", unit);
+ sc->devfs_token = devfs_add_devsw( "/", name, &tw_cdevsw, unit,
+ DV_CHR, 0, 0, 0600);
+#endif
+
return (1);
}
@@ -992,11 +1010,6 @@ static int twchecktime(int target, int tol)
}
#endif /* HIRESTIME */
-#ifdef JREMOD
-struct cdevsw tw_cdevsw =
- { twopen, twclose, twread, twwrite, /*19*/
- noioc, nullstop, nullreset, nodevtotty,/* tw */
- twselect, nommap, nostrat };
static tw_devsw_installed = 0;
@@ -1005,23 +1018,13 @@ static void tw_drvinit(void *unused)
dev_t dev;
if( ! tw_devsw_installed ) {
- dev = makedev(CDEV_MAJOR,0);
- cdevsw_add(&dev,&tw_cdevsw,NULL);
+ dev = makedev(CDEV_MAJOR, 0);
+ cdevsw_add(&dev,&tw_cdevsw, NULL);
tw_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*/
- "/", "tw", major(dev), 0, DV_CHR, 0, 0, 0600);
- }
-#endif
}
}
SYSINIT(twdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,tw_drvinit,NULL)
-#endif /* JREMOD */
#endif NTW
OpenPOWER on IntegriCloud