diff options
author | julian <julian@FreeBSD.org> | 1995-11-28 09:42:06 +0000 |
---|---|---|
committer | julian <julian@FreeBSD.org> | 1995-11-28 09:42:06 +0000 |
commit | 67727fc1c1ba60e0499be11f7f66fccf2d7844f6 (patch) | |
tree | e174e9f0c9e876a67737e66592206a42258e33ef /sys/i386/isa/ctx.c | |
parent | 94df7c3a92e572fefe166ac28402d3b0d7e22200 (diff) | |
download | FreeBSD-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/i386/isa/ctx.c')
-rw-r--r-- | sys/i386/isa/ctx.c | 39 |
1 files changed, 36 insertions, 3 deletions
diff --git a/sys/i386/isa/ctx.c b/sys/i386/isa/ctx.c index 3cec50d..c1edbf1 100644 --- a/sys/i386/isa/ctx.c +++ b/sys/i386/isa/ctx.c @@ -8,7 +8,7 @@ * of this software, nor does the author assume any responsibility * for damages incurred with its use. * - * $Id: ctx.c,v 1.6 1995/05/30 08:01:27 rgrimes Exp $ + * $Id: ctx.c,v 1.7 1995/09/08 11:07:34 bde Exp $ */ /* @@ -126,6 +126,11 @@ #include <i386/isa/ctxreg.h> #include <machine/ioctl_ctx.h> +#ifdef JREMOD +#include <sys/conf.h> +#define CDEV_MAJOR 40 +static void ctx_devsw_install(); +#endif /*JREMOD*/ int waitvb(short); /* state flags */ @@ -184,8 +189,12 @@ ctxprobe(struct isa_device * devp) if (inb(devp->id_iobase) == 0xff) /* 0xff only if board absent */ status = 0; - else - status = 1; + else { + status = 1; /*XXX uses only one port? */ +#ifdef JREMOD + ctx_devsw_install(); +#endif /*JREMOD*/ + } return (status); } @@ -438,4 +447,28 @@ waitvb(short port) return (0); } + +#ifdef JREMOD +struct cdevsw ctx_cdevsw = + { ctxopen, ctxclose, ctxread, ctxwrite, /*40*/ + ctxioctl, nostop, nullreset, nodevtotty,/* cortex */ + seltrue, nommap, NULL }; + +static ctx_devsw_installed = 0; + +static void ctx_devsw_install() +{ + dev_t descript; + if( ! ctx_devsw_installed ) { + descript = makedev(CDEV_MAJOR,0); + cdevsw_add(&descript,&ctx_cdevsw,NULL); +#if defined(BDEV_MAJOR) + descript = makedev(BDEV_MAJOR,0); + bdevsw_add(&descript,&ctx_bdevsw,NULL); +#endif /*BDEV_MAJOR*/ + ctx_devsw_installed = 1; + } +} +#endif /* JREMOD */ + #endif /* NCTX > 0 */ |