freebsd-dev/sys
Julian Elischer 376c314995 the second set of changes in a move towards getting devices to be
totally dynamic. (the first was about 7 weeeks ago)

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 */
1995-11-28 09:43:45 +00:00
..
alpha Completed function declarations and added prototypes. 1995-11-22 07:43:53 +00:00
amd64 After having put on my Asbestos suit, complete the MFS_ROOT part of Terry's 1995-11-28 03:15:58 +00:00
compat/linux Completed function declarations and added prototypes. 1995-11-22 07:43:53 +00:00
compile
conf Add and document the hooks for John Hay's Arnet sync driver... 1995-11-21 02:50:10 +00:00
ddb Completed function declarations and/or added prototypes and/or #includes 1995-11-24 14:13:42 +00:00
dev the second set of changes in a move towards getting devices to be 1995-11-28 09:42:06 +00:00
fs Completed function declarations and/or added prototypes. 1995-11-21 12:55:26 +00:00
gnu Completed function declarations, added prototypes and removed redundant 1995-11-21 14:56:02 +00:00
i386 the second set of changes in a move towards getting devices to be 1995-11-28 09:43:45 +00:00
isa the second set of changes in a move towards getting devices to be 1995-11-28 09:42:06 +00:00
isofs/cd9660 Completed function declarations and/or added prototypes. 1995-11-21 12:55:26 +00:00
kern Removed all #includes of the unused file <sys/device.h>. 1995-11-28 07:29:59 +00:00
libkern Add qsort() to libkern, taken from libc. 1995-11-08 08:40:11 +00:00
miscfs Completed function declarations and/or added prototypes. 1995-11-21 12:55:26 +00:00
modules Changed the first (name) arg of MOD_DEV(), MOD_EXEC() and MOD_MISC() 1995-11-14 07:35:57 +00:00
msdosfs Moved declarations for static functions to the correct place (not in a 1995-11-16 11:48:10 +00:00
net Implement some rudimentry IPX support... 1995-11-28 01:59:19 +00:00
netccitt Completed function declarations and/or added prototypes. 1995-11-21 12:55:26 +00:00
netinet fix #includes & warnings. 1995-11-20 12:28:21 +00:00
netipx Cleaned up prototypes: 1995-11-24 12:25:13 +00:00
netiso Completed function declarations and/or added prototypes. 1995-11-21 12:55:26 +00:00
netns Completed function declarations and/or added prototypes. 1995-11-21 12:55:26 +00:00
nfs Completed function declarations, added prototypes and removed redundant 1995-11-21 15:51:39 +00:00
nfsclient Completed function declarations, added prototypes and removed redundant 1995-11-21 15:51:39 +00:00
nfsserver Completed function declarations, added prototypes and removed redundant 1995-11-21 15:51:39 +00:00
pc98/pc98 Completed function declarations and/or added prototypes. 1995-11-21 12:55:26 +00:00
pccard Completed function declarations and/or added prototypes. 1995-11-21 12:55:26 +00:00
pci Made pci.c compile again. It unfortunately depends on the isa interrupt 1995-11-21 13:59:56 +00:00
powerpc/include Don't define CLK_TCK here. 1995-02-03 21:49:18 +00:00
rpc Remove trailing whitespace. 1995-05-30 05:05:38 +00:00
scsi Completed function declarations, added prototypes and removed redundant 1995-11-21 15:14:28 +00:00
sys Oops, the previous change was missing the declaration of `struct 1995-11-24 15:59:11 +00:00
tools Second batch of cleanup changes. 1995-10-29 15:33:36 +00:00
ufs Removed bogus __BEGIN_DECS/__END_DECLS. 1995-11-28 07:23:09 +00:00
vm Completed function declarations and/or added prototypes. 1995-11-21 12:55:26 +00:00
Makefile