summaryrefslogtreecommitdiffstats
path: root/sys/dev/cy
diff options
context:
space:
mode:
authorjulian <julian@FreeBSD.org>1995-11-28 09:42:06 +0000
committerjulian <julian@FreeBSD.org>1995-11-28 09:42:06 +0000
commit67727fc1c1ba60e0499be11f7f66fccf2d7844f6 (patch)
treee174e9f0c9e876a67737e66592206a42258e33ef /sys/dev/cy
parent94df7c3a92e572fefe166ac28402d3b0d7e22200 (diff)
downloadFreeBSD-src-67727fc1c1ba60e0499be11f7f66fccf2d7844f6.zip
FreeBSD-src-67727fc1c1ba60e0499be11f7f66fccf2d7844f6.tar.gz
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 */
Diffstat (limited to 'sys/dev/cy')
-rw-r--r--sys/dev/cy/cy.c34
-rw-r--r--sys/dev/cy/cy_isa.c34
2 files changed, 66 insertions, 2 deletions
diff --git a/sys/dev/cy/cy.c b/sys/dev/cy/cy.c
index ce0816c..c2f3725 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.18 1995/11/04 17:07:14 bde Exp $
+ * $Id: cy.c,v 1.19 1995/11/26 17:13:23 bde Exp $
*/
#include "cy.h"
@@ -397,6 +397,11 @@ static int cy_nr_cd1400s[NCY];
#undef RxFifoThreshold
static int volatile RxFifoThreshold = (CD1400_RX_FIFO_SIZE / 2);
+#ifdef JREMOD
+#define CDEV_MAJOR 48
+static void cy_devsw_install();
+#endif /*JREMOD*/
+
static struct kern_devconf kdc_sio[NCY] = { {
0, 0, 0, /* filled in by dev_attach */
"cyc", 0, { MDDT_ISA, 0, "tty" },
@@ -437,6 +442,10 @@ sioprobe(dev)
return (0);
cy_nr_cd1400s[unit] = 0;
sioregisterdev(dev);
+#ifdef JREMOD
+ cy_devsw_install();
+#endif /*JREMOD*/
+
/* Cyclom-16Y hardware reset (Cyclom-8Ys don't care) */
cy_inb(iobase, CY16_RESET); /* XXX? */
@@ -2511,4 +2520,27 @@ cystatus(unit)
}
#endif /* CyDebug */
+
+#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_devsw_install()
+{
+ dev_t descript;
+ if( ! cy_devsw_installed ) {
+ descript = makedev(CDEV_MAJOR,0);
+ cdevsw_add(&descript,&cy_cdevsw,NULL);
+#if defined(BDEV_MAJOR)
+ descript = makedev(BDEV_MAJOR,0);
+ bdevsw_add(&descript,&cy_bdevsw,NULL);
+#endif /*BDEV_MAJOR*/
+ cy_devsw_installed = 1;
+ }
+}
+#endif /* JREMOD */
#endif /* NCY > 0 */
diff --git a/sys/dev/cy/cy_isa.c b/sys/dev/cy/cy_isa.c
index ce0816c..c2f3725 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.18 1995/11/04 17:07:14 bde Exp $
+ * $Id: cy.c,v 1.19 1995/11/26 17:13:23 bde Exp $
*/
#include "cy.h"
@@ -397,6 +397,11 @@ static int cy_nr_cd1400s[NCY];
#undef RxFifoThreshold
static int volatile RxFifoThreshold = (CD1400_RX_FIFO_SIZE / 2);
+#ifdef JREMOD
+#define CDEV_MAJOR 48
+static void cy_devsw_install();
+#endif /*JREMOD*/
+
static struct kern_devconf kdc_sio[NCY] = { {
0, 0, 0, /* filled in by dev_attach */
"cyc", 0, { MDDT_ISA, 0, "tty" },
@@ -437,6 +442,10 @@ sioprobe(dev)
return (0);
cy_nr_cd1400s[unit] = 0;
sioregisterdev(dev);
+#ifdef JREMOD
+ cy_devsw_install();
+#endif /*JREMOD*/
+
/* Cyclom-16Y hardware reset (Cyclom-8Ys don't care) */
cy_inb(iobase, CY16_RESET); /* XXX? */
@@ -2511,4 +2520,27 @@ cystatus(unit)
}
#endif /* CyDebug */
+
+#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_devsw_install()
+{
+ dev_t descript;
+ if( ! cy_devsw_installed ) {
+ descript = makedev(CDEV_MAJOR,0);
+ cdevsw_add(&descript,&cy_cdevsw,NULL);
+#if defined(BDEV_MAJOR)
+ descript = makedev(BDEV_MAJOR,0);
+ bdevsw_add(&descript,&cy_bdevsw,NULL);
+#endif /*BDEV_MAJOR*/
+ cy_devsw_installed = 1;
+ }
+}
+#endif /* JREMOD */
#endif /* NCY > 0 */
OpenPOWER on IntegriCloud