aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/si
diff options
context:
space:
mode:
authorJulian Elischer <julian@FreeBSD.org>1995-11-28 09:42:06 +0000
committerJulian Elischer <julian@FreeBSD.org>1995-11-28 09:42:06 +0000
commit7146c13e4371ca3a01d2c829771c3e6edb171adb (patch)
treee174e9f0c9e876a67737e66592206a42258e33ef /sys/dev/si
parent43cbfcb3576ceb560a3d33061b51cafa0b604ad7 (diff)
downloadsrc-7146c13e4371ca3a01d2c829771c3e6edb171adb.tar.gz
src-7146c13e4371ca3a01d2c829771c3e6edb171adb.zip
the second set of changes in a move towards getting devices to be
totally dynamic. this is only the devices in i386/isa I'll do more tomorrow. they're completely masked by #ifdef JREMOD at this stage... the eventual aim is that every driver will do a SYSINIT at startup BEFORE the probes, which will effectively link it into the devsw tables etc. If I'd thought about it more I'd have put that in in this set (damn) The ioconf lines generated by config will also end up in the device's own scope as well, so ioconf.c will eventually be gutted the SYSINIT call to the driver will include a phase where the driver links it's ioconf line into a chain of such. when this phase is done then the user can modify them with the boot: -c config menu if he wants, just like now.. config will put the config lines out in the .h file (e.g. in aha.h will be the addresses for the aha driver to look.) as I said this is a very small first step.. the aim of THIS set of edits is to not have to edit conf.c at all when adding a new device.. the tabe will be a simple skeleton.. when this is done, it will allow other changes to be made, all teh time still having a fully working kernel tree, but the logical outcome is the complete REMOVAL of the devsw tables. By the end of this, linked in drivers will be exactly the same as run-time loaded drivers, except they JUST HAPPEN to already be linked and present at startup.. the SYSINIT calls will be the equivalent of the "init" call made to a newly loaded driver in every respect. For this edit, each of the files has the following code inserted into it: obviously, tailored to suit.. ----------------------somewhere at the top: #ifdef JREMOD #include <sys/conf.h> #define CDEV_MAJOR 13 #define BDEV_MAJOR 4 static void sd_devsw_install(); #endif /*JREMOD */ ---------------------somewhere that's run during bootup: EVENTUALLY a SYSINIT #ifdef JREMOD sd_devsw_install(); #endif /*JREMOD*/ -----------------------at the bottom: #ifdef JREMOD struct bdevsw sd_bdevsw = { sdopen, sdclose, sdstrategy, sdioctl, /*4*/ sddump, sdsize, 0 }; struct cdevsw sd_cdevsw = { sdopen, sdclose, rawread, rawwrite, /*13*/ sdioctl, nostop, nullreset, nodevtotty,/* sd */ seltrue, nommap, sdstrategy }; static sd_devsw_installed = 0; static void sd_devsw_install() { dev_t descript; if( ! sd_devsw_installed ) { descript = makedev(CDEV_MAJOR,0); cdevsw_add(&descript,&sd_cdevsw,NULL); #if defined(BDEV_MAJOR) descript = makedev(BDEV_MAJOR,0); bdevsw_add(&descript,&sd_bdevsw,NULL); #endif /*BDEV_MAJOR*/ sd_devsw_installed = 1; } } #endif /* JREMOD */
Notes
Notes: svn path=/head/; revision=12502
Diffstat (limited to 'sys/dev/si')
-rw-r--r--sys/dev/si/si.c36
1 files changed, 35 insertions, 1 deletions
diff --git a/sys/dev/si/si.c b/sys/dev/si/si.c
index c022248eaa0e..93accc2f835f 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.15 1995/11/28 02:07:34 peter Exp $
+ * $Id: si.c,v 1.16 1995/11/28 07:29:29 bde Exp $
*/
#ifndef lint
@@ -81,6 +81,12 @@ static char si_copyright1[] = "@(#) (C) Specialix International, 1990,1992",
enum si_mctl { GET, SET, BIS, BIC };
+#ifdef JREMOD
+#define CDEV_MAJOR 68
+static void si_devsw_install();
+#endif /*JREMOD*/
+
+
static void si_command __P((struct si_port *, int, int));
static int si_modem __P((struct si_port *, enum si_mctl, int));
static void si_write_enable __P((struct si_port *, int));
@@ -651,6 +657,10 @@ mem_fail:
}
done_chartimes = 1;
}
+#ifdef JREMOD
+ si_devsw_install();
+#endif /*JREMOD*/
+
return (1);
}
@@ -2289,4 +2299,28 @@ si_mctl2str(cmd)
}
return("BAD");
}
+
+
+#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_devsw_install()
+{
+ dev_t descript;
+ if( ! si_devsw_installed ) {
+ descript = makedev(CDEV_MAJOR,0);
+ cdevsw_add(&descript,&si_cdevsw,NULL);
+#if defined(BDEV_MAJOR)
+ descript = makedev(BDEV_MAJOR,0);
+ bdevsw_add(&descript,&si_bdevsw,NULL);
+#endif /*BDEV_MAJOR*/
+ si_devsw_installed = 1;
+ }
+}
+#endif /* JREMOD */
#endif