summaryrefslogtreecommitdiffstats
path: root/sys/i386/isa/sound/soundcard.c
diff options
context:
space:
mode:
authorjulian <julian@FreeBSD.org>1995-11-28 09:43:45 +0000
committerjulian <julian@FreeBSD.org>1995-11-28 09:43:45 +0000
commit5578ada6e924091dbf71e4a419c110d876286e00 (patch)
treee44b6611a469602042d90d598eabc27f5c376691 /sys/i386/isa/sound/soundcard.c
parent67727fc1c1ba60e0499be11f7f66fccf2d7844f6 (diff)
downloadFreeBSD-src-5578ada6e924091dbf71e4a419c110d876286e00.zip
FreeBSD-src-5578ada6e924091dbf71e4a419c110d876286e00.tar.gz
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 */
Diffstat (limited to 'sys/i386/isa/sound/soundcard.c')
-rw-r--r--sys/i386/isa/sound/soundcard.c35
1 files changed, 34 insertions, 1 deletions
diff --git a/sys/i386/isa/sound/soundcard.c b/sys/i386/isa/sound/soundcard.c
index 381ea31..8542e0a 100644
--- a/sys/i386/isa/sound/soundcard.c
+++ b/sys/i386/isa/sound/soundcard.c
@@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: soundcard.c,v 1.29 1995/09/08 19:57:13 bde Exp $
+ * $Id: soundcard.c,v 1.30 1995/11/04 13:24:48 bde Exp $
*/
#include "sound_config.h"
@@ -36,6 +36,13 @@
#include "dev_table.h"
#include <i386/isa/isa_device.h>
+#ifdef JREMOD
+#include <sys/conf.h>
+#define CDEV_MAJOR 30
+static void snd_devsw_install();
+#endif /*JREMOD*/
+
+
u_int snd1_imask;
u_int snd2_imask;
u_int snd3_imask;
@@ -342,6 +349,10 @@ sndattach (struct isa_device *dev)
}
#endif
+#ifdef JREMOD
+ snd_devsw_install();
+#endif /*JREMOD*/
+
return TRUE;
}
@@ -470,4 +481,26 @@ snd_release_irq(int vect)
{
}
+#ifdef JREMOD
+struct cdevsw snd_cdevsw =
+ { sndopen, sndclose, sndread, sndwrite, /*30*/
+ sndioctl, nostop, nullreset, nodevtotty,/* sound */
+ sndselect, nommap, NULL };
+
+static snd_devsw_installed = 0;
+
+static void snd_devsw_install()
+{
+ dev_t descript;
+ if( ! snd_devsw_installed ) {
+ descript = makedev(CDEV_MAJOR,0);
+ cdevsw_add(&descript,&snd_cdevsw,NULL);
+#if defined(BDEV_MAJOR)
+ descript = makedev(BDEV_MAJOR,0);
+ bdevsw_add(&descript,&snd_bdevsw,NULL);
+#endif /*BDEV_MAJOR*/
+ snd_devsw_installed = 1;
+ }
+}
+#endif /* JREMOD */
#endif
OpenPOWER on IntegriCloud