1995-02-06 23:20:17 +00:00
|
|
|
/*
|
|
|
|
* Video spigot capture driver.
|
|
|
|
*
|
|
|
|
* Copyright (c) 1995, Jim Lowe. All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions are
|
|
|
|
* met: 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer. 2.
|
|
|
|
* Redistributions in binary form must reproduce the above copyright notice,
|
|
|
|
* this list of conditions and the following disclaimer in the documentation
|
|
|
|
* and/or other materials provided with the distribution.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY
|
|
|
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
|
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
|
|
* DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
|
|
|
|
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
|
|
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
|
|
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
* SUCH DAMAGE.
|
|
|
|
*
|
1995-05-30 08:16:23 +00:00
|
|
|
* This is the minimum driver code required to make a spigot work.
|
1995-02-06 23:20:17 +00:00
|
|
|
* Unfortunatly, I can't include a real driver since the information
|
|
|
|
* on the spigot is under non-disclosure. You can pick up a library
|
|
|
|
* that will work with this driver from ftp://ftp.cs.uwm.edu/pub/FreeBSD.
|
|
|
|
* The library contains the source that I can release as well as several
|
|
|
|
* object modules and functions that allows one to read spigot data.
|
|
|
|
* See the code for spigot_grab.c that is included with the library
|
|
|
|
* data.
|
|
|
|
*
|
1995-09-01 00:25:18 +00:00
|
|
|
* The vendor will not allow me to release the spigot library code.
|
|
|
|
* Please don't ask me for it.
|
1995-02-06 23:20:17 +00:00
|
|
|
*
|
1995-09-01 00:25:18 +00:00
|
|
|
* To use this driver you will need the spigot library. The library is
|
|
|
|
* available from:
|
|
|
|
*
|
|
|
|
* ftp.cs.uwm.edu://pub/FreeBSD/spigot/spigot.tar.gz
|
|
|
|
*
|
1995-11-29 01:07:59 +00:00
|
|
|
* Version 1.6, Novemeber 21, 1995.
|
1995-02-06 23:20:17 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "spigot.h"
|
|
|
|
#if NSPIGOT > 0
|
|
|
|
|
|
|
|
#if NSPIGOT > 1
|
|
|
|
error "Can only have 1 spigot configured."
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <sys/param.h>
|
|
|
|
#include <sys/systm.h>
|
1995-02-26 05:14:53 +00:00
|
|
|
#include <sys/kernel.h>
|
1995-12-06 23:52:35 +00:00
|
|
|
#include <sys/conf.h>
|
1995-02-06 23:20:17 +00:00
|
|
|
#include <sys/ioctl.h>
|
|
|
|
#include <sys/proc.h>
|
1995-12-06 23:52:35 +00:00
|
|
|
#include <sys/signalvar.h>
|
1995-02-06 23:20:17 +00:00
|
|
|
#include <sys/file.h>
|
|
|
|
#include <sys/uio.h>
|
|
|
|
#include <sys/malloc.h>
|
|
|
|
#include <sys/devconf.h>
|
|
|
|
#include <sys/errno.h>
|
|
|
|
#include <sys/mman.h>
|
1995-12-08 11:19:42 +00:00
|
|
|
#include <sys/conf.h>
|
|
|
|
#ifdef DEVFS
|
|
|
|
#include <sys/devfsext.h>
|
|
|
|
#endif /* DEVFS */
|
1995-02-06 23:20:17 +00:00
|
|
|
|
1995-12-06 23:52:35 +00:00
|
|
|
#include <machine/frame.h>
|
1995-02-26 05:14:53 +00:00
|
|
|
#include <machine/spigot.h>
|
|
|
|
#include <machine/psl.h>
|
|
|
|
|
1995-02-06 23:20:17 +00:00
|
|
|
#include <i386/isa/isa.h>
|
|
|
|
#include <i386/isa/isa_device.h>
|
|
|
|
|
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 */
1995-11-28 09:42:06 +00:00
|
|
|
|
1995-02-06 23:20:17 +00:00
|
|
|
struct spigot_softc {
|
1995-09-01 00:25:18 +00:00
|
|
|
u_long flags;
|
|
|
|
u_long maddr;
|
1995-02-06 23:20:17 +00:00
|
|
|
struct proc *p;
|
1995-09-01 00:25:18 +00:00
|
|
|
u_long signal_num;
|
|
|
|
u_short irq;
|
1995-12-08 11:19:42 +00:00
|
|
|
#ifdef DEVFS
|
|
|
|
void *devfs_token;
|
|
|
|
#endif
|
1995-02-06 23:20:17 +00:00
|
|
|
} spigot_softc[NSPIGOT];
|
|
|
|
|
|
|
|
/* flags in softc */
|
1995-05-30 08:16:23 +00:00
|
|
|
#define OPEN 0x01
|
1995-08-01 07:07:42 +00:00
|
|
|
#define ALIVE 0x02
|
1995-02-06 23:20:17 +00:00
|
|
|
|
|
|
|
#define UNIT(dev) minor(dev)
|
|
|
|
|
|
|
|
int spigot_probe(struct isa_device *id);
|
|
|
|
int spigot_attach(struct isa_device *id);
|
|
|
|
|
1995-02-16 08:06:28 +00:00
|
|
|
struct isa_driver spigotdriver = {spigot_probe, spigot_attach, "spigot"};
|
1995-02-06 23:20:17 +00:00
|
|
|
|
1995-12-08 11:19:42 +00:00
|
|
|
static d_open_t spigot_open;
|
|
|
|
static d_close_t spigot_close;
|
|
|
|
static d_rdwr_t spigot_rw;
|
|
|
|
static d_read_t spigot_read;
|
|
|
|
static d_write_t spigot_write;
|
|
|
|
static d_ioctl_t spigot_ioctl;
|
|
|
|
static d_select_t spigot_select;
|
|
|
|
static d_mmap_t spigot_mmap;
|
|
|
|
|
|
|
|
#define CDEV_MAJOR 11
|
1995-12-08 23:23:00 +00:00
|
|
|
static struct cdevsw spigot_cdevsw =
|
1995-12-08 11:19:42 +00:00
|
|
|
{ spigot_open, spigot_close, spigot_read, spigot_write, /*11*/
|
|
|
|
spigot_ioctl, nostop, nullreset, nodevtotty,/* Spigot */
|
|
|
|
spigot_select, spigot_mmap, NULL, "spigot", NULL, -1 };
|
|
|
|
|
1995-04-12 20:48:13 +00:00
|
|
|
static struct kern_devconf kdc_spigot[NSPIGOT] = { {
|
1995-02-06 23:20:17 +00:00
|
|
|
0, /* kdc_next -> filled in by dev_attach() */
|
|
|
|
0, /* kdc_rlink -> filled in by dev_attach() */
|
|
|
|
0, /* kdc_number -> filled in by dev_attach() */
|
|
|
|
"spigot", /* kdc_name */
|
|
|
|
0, /* kdc_unit */
|
|
|
|
{ /* kdc_md */
|
|
|
|
MDDT_ISA, /* mddc_devtype */
|
|
|
|
0 /* mddc_flags */
|
|
|
|
/* mddc_imask[4] */
|
|
|
|
},
|
|
|
|
isa_generic_externalize, /* kdc_externalize */
|
|
|
|
0, /* kdc_internalize */
|
|
|
|
0, /* kdc_goaway */
|
|
|
|
ISA_EXTERNALLEN, /* kdc_datalen */
|
|
|
|
&kdc_isa0, /* kdc_parent */
|
|
|
|
0, /* kdc_parentdata */
|
1995-04-12 20:48:13 +00:00
|
|
|
DC_UNCONFIGURED, /* kdc_state - not supported */
|
|
|
|
"Video Spigot frame grabber", /* kdc_description */
|
|
|
|
DC_CLS_MISC /* class */
|
|
|
|
} };
|
1995-02-06 23:20:17 +00:00
|
|
|
|
|
|
|
static inline void
|
|
|
|
spigot_registerdev(struct isa_device *id)
|
|
|
|
{
|
|
|
|
if(id->id_unit)
|
|
|
|
kdc_spigot[id->id_unit] = kdc_spigot[0];
|
|
|
|
kdc_spigot[id->id_unit].kdc_unit = id->id_unit;
|
|
|
|
kdc_spigot[id->id_unit].kdc_isa = id;
|
|
|
|
dev_attach(&kdc_spigot[id->id_unit]);
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
1995-05-30 08:16:23 +00:00
|
|
|
spigot_probe(struct isa_device *devp)
|
1995-02-06 23:20:17 +00:00
|
|
|
{
|
|
|
|
int status;
|
1995-08-01 07:07:42 +00:00
|
|
|
struct spigot_softc *ss=(struct spigot_softc *)&spigot_softc[devp->id_unit];
|
1995-02-06 23:20:17 +00:00
|
|
|
|
1995-08-01 07:07:42 +00:00
|
|
|
ss->flags = 0;
|
1995-09-01 00:25:18 +00:00
|
|
|
ss->maddr = 0;
|
|
|
|
ss->irq = 0;
|
1995-08-01 07:07:42 +00:00
|
|
|
|
|
|
|
if(devp->id_iobase != 0xad6 || inb(0xad9) == 0xff)
|
|
|
|
status = 0; /* not found */
|
|
|
|
else {
|
|
|
|
status = 1; /* found */
|
|
|
|
ss->flags |= ALIVE;
|
|
|
|
spigot_registerdev(devp);
|
|
|
|
}
|
1995-02-06 23:20:17 +00:00
|
|
|
|
|
|
|
return(status);
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
spigot_attach(struct isa_device *devp)
|
|
|
|
{
|
1995-12-08 11:19:42 +00:00
|
|
|
char name[32];
|
|
|
|
int unit;
|
|
|
|
struct spigot_softc *ss= &spigot_softc[unit = devp->id_unit];
|
1995-08-01 07:07:42 +00:00
|
|
|
|
1995-12-08 11:19:42 +00:00
|
|
|
kdc_spigot[unit].kdc_state = DC_UNKNOWN;
|
1995-02-06 23:20:17 +00:00
|
|
|
|
1995-09-01 00:25:18 +00:00
|
|
|
ss->maddr = kvtop(devp->id_maddr);
|
|
|
|
ss->irq = devp->id_irq;
|
1995-12-08 11:19:42 +00:00
|
|
|
#ifdef DEVFS
|
|
|
|
sprintf(name,"spigot%d",unit);
|
|
|
|
/* path name devsw minor type uid gid perm*/
|
|
|
|
ss->devfs_token = devfs_add_devsw( "/", name,
|
|
|
|
&spigot_cdevsw, unit,
|
|
|
|
DV_CHR, 0, 0, 0600);
|
|
|
|
#endif
|
1995-02-06 23:20:17 +00:00
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
1995-12-08 11:19:42 +00:00
|
|
|
static int
|
1995-09-08 11:09:15 +00:00
|
|
|
spigot_open(dev_t dev, int flags, int fmt, struct proc *p)
|
1995-02-06 23:20:17 +00:00
|
|
|
{
|
|
|
|
struct spigot_softc *ss = (struct spigot_softc *)&spigot_softc[UNIT(dev)];
|
|
|
|
|
1995-08-01 07:07:42 +00:00
|
|
|
if((ss->flags & ALIVE) == 0)
|
|
|
|
return ENXIO;
|
1995-02-06 23:20:17 +00:00
|
|
|
|
|
|
|
if(ss->flags & OPEN)
|
|
|
|
return EBUSY;
|
1995-08-01 07:07:42 +00:00
|
|
|
|
1995-02-06 23:20:17 +00:00
|
|
|
ss->flags |= OPEN;
|
|
|
|
ss->p = 0;
|
|
|
|
ss->signal_num = 0;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
1995-12-08 11:19:42 +00:00
|
|
|
static int
|
1995-09-08 11:09:15 +00:00
|
|
|
spigot_close(dev_t dev, int flags, int fmt, struct proc *p)
|
1995-02-06 23:20:17 +00:00
|
|
|
{
|
|
|
|
struct spigot_softc *ss = (struct spigot_softc *)&spigot_softc[UNIT(dev)];
|
|
|
|
|
|
|
|
ss->flags &= ~OPEN;
|
|
|
|
ss->p = 0;
|
|
|
|
ss->signal_num = 0;
|
|
|
|
|
|
|
|
outb(0xad6, 0);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
1995-12-08 11:19:42 +00:00
|
|
|
static int
|
1995-02-06 23:20:17 +00:00
|
|
|
spigot_write(dev_t dev, struct uio *uio, int ioflag)
|
|
|
|
{
|
|
|
|
return ENXIO;
|
|
|
|
}
|
|
|
|
|
1995-12-08 11:19:42 +00:00
|
|
|
static int
|
1995-02-06 23:20:17 +00:00
|
|
|
spigot_read(dev_t dev, struct uio *uio, int ioflag)
|
|
|
|
{
|
|
|
|
return ENXIO;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
1995-12-08 11:19:42 +00:00
|
|
|
static int
|
1995-02-06 23:20:17 +00:00
|
|
|
spigot_ioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p)
|
|
|
|
{
|
1995-10-14 07:09:58 +00:00
|
|
|
int error;
|
1995-02-06 23:20:17 +00:00
|
|
|
struct spigot_softc *ss = (struct spigot_softc *)&spigot_softc[UNIT(dev)];
|
|
|
|
struct trapframe *fp;
|
1995-09-01 00:25:18 +00:00
|
|
|
struct spigot_info *info;
|
1995-02-06 23:20:17 +00:00
|
|
|
|
1995-09-01 00:25:18 +00:00
|
|
|
if(!data) return(EINVAL);
|
1995-02-06 23:20:17 +00:00
|
|
|
switch(cmd){
|
|
|
|
case SPIGOT_SETINT:
|
|
|
|
ss->p = p;
|
|
|
|
ss->signal_num = *((int *)data);
|
|
|
|
break;
|
|
|
|
case SPIGOT_IOPL_ON: /* allow access to the IO PAGE */
|
1995-11-29 01:07:59 +00:00
|
|
|
#if !defined(SPIGOT_UNSECURE)
|
1995-10-14 07:09:58 +00:00
|
|
|
error = suser(p->p_ucred, &p->p_acflag);
|
|
|
|
if (error != 0)
|
|
|
|
return error;
|
1995-11-29 01:07:59 +00:00
|
|
|
#endif
|
1995-02-06 23:20:17 +00:00
|
|
|
fp=(struct trapframe *)p->p_md.md_regs;
|
|
|
|
fp->tf_eflags |= PSL_IOPL;
|
|
|
|
break;
|
|
|
|
case SPIGOT_IOPL_OFF: /* deny access to the IO PAGE */
|
|
|
|
fp=(struct trapframe *)p->p_md.md_regs;
|
|
|
|
fp->tf_eflags &= ~PSL_IOPL;
|
|
|
|
break;
|
1995-09-01 00:25:18 +00:00
|
|
|
case SPIGOT_GET_INFO:
|
|
|
|
info = (struct spigot_info *)data;
|
|
|
|
info->maddr = ss->maddr;
|
|
|
|
info->irq = ss->irq;
|
|
|
|
break;
|
1995-02-06 23:20:17 +00:00
|
|
|
default:
|
|
|
|
return ENOTTY;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
1995-12-08 11:19:42 +00:00
|
|
|
static int
|
1995-02-06 23:20:17 +00:00
|
|
|
spigot_select(dev_t dev, int rw, struct proc *p)
|
|
|
|
{
|
|
|
|
|
|
|
|
return ENXIO;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Interrupt procedure.
|
|
|
|
* Just call a user level interrupt routine.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
spigintr(int unit)
|
|
|
|
{
|
|
|
|
struct spigot_softc *ss = (struct spigot_softc *)&spigot_softc[unit];
|
|
|
|
|
|
|
|
if(ss->p && ss->signal_num)
|
|
|
|
psignal(ss->p, ss->signal_num);
|
|
|
|
}
|
|
|
|
|
1995-12-08 11:19:42 +00:00
|
|
|
static int
|
1995-02-06 23:20:17 +00:00
|
|
|
spigot_mmap(dev_t dev, int offset, int nprot)
|
|
|
|
{
|
|
|
|
struct spigot_softc *ss = (struct spigot_softc *)&spigot_softc[0];
|
|
|
|
|
1995-08-01 07:07:42 +00:00
|
|
|
if(offset != 0) {
|
1995-09-01 00:25:18 +00:00
|
|
|
printf("spigot mmap failed, offset = 0x%x != 0x0\n", offset);
|
1995-08-29 16:44:46 +00:00
|
|
|
return -1;
|
1995-08-01 07:07:42 +00:00
|
|
|
}
|
1995-02-06 23:20:17 +00:00
|
|
|
|
|
|
|
if(nprot & PROT_EXEC)
|
1995-08-29 16:44:46 +00:00
|
|
|
return -1;
|
1995-02-06 23:20:17 +00:00
|
|
|
|
|
|
|
return i386_btop(ss->maddr);
|
|
|
|
}
|
|
|
|
|
1995-11-29 10:49:16 +00:00
|
|
|
|
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 */
1995-11-28 09:42:06 +00:00
|
|
|
static spigot_devsw_installed = 0;
|
|
|
|
|
1995-11-29 10:49:16 +00:00
|
|
|
static void spigot_drvinit(void *unused)
|
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 */
1995-11-28 09:42:06 +00:00
|
|
|
{
|
1995-11-29 10:49:16 +00:00
|
|
|
dev_t dev;
|
|
|
|
|
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 */
1995-11-28 09:42:06 +00:00
|
|
|
if( ! spigot_devsw_installed ) {
|
1995-12-08 11:19:42 +00:00
|
|
|
dev = makedev(CDEV_MAJOR, 0);
|
|
|
|
cdevsw_add(&dev,&spigot_cdevsw, NULL);
|
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 */
1995-11-28 09:42:06 +00:00
|
|
|
spigot_devsw_installed = 1;
|
1995-11-29 14:41:20 +00:00
|
|
|
}
|
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 */
1995-11-28 09:42:06 +00:00
|
|
|
}
|
1995-11-29 10:49:16 +00:00
|
|
|
|
|
|
|
SYSINIT(spigotdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,spigot_drvinit,NULL)
|
|
|
|
|
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 */
1995-11-28 09:42:06 +00:00
|
|
|
|
1995-02-06 23:20:17 +00:00
|
|
|
#endif /* NSPIGOT */
|