diff --git a/sys/conf/files.i386 b/sys/conf/files.i386 index 99ce05851d7f..aa24a0c1df6f 100644 --- a/sys/conf/files.i386 +++ b/sys/conf/files.i386 @@ -284,7 +284,6 @@ i386/isa/pcvt/pcvt_vtf.c optional vt i386/isa/pmtimer.c optional pmtimer i386/isa/prof_machdep.c optional profiling-routine i386/isa/spic.c optional spic -i386/isa/spigot.c count spigot i386/isa/spkr.c optional speaker i386/isa/vesa.c optional vga vesa i386/linux/imgact_linux.c optional compat_linux diff --git a/sys/i386/conf/NOTES b/sys/i386/conf/NOTES index b09a532cf009..a876312532fa 100644 --- a/sys/i386/conf/NOTES +++ b/sys/i386/conf/NOTES @@ -625,7 +625,6 @@ options SAFE_RNDTEST # enable rndtest support # # apm: Laptop Advanced Power Management (experimental) # pmtimer: Timer device driver for power management events (APM or ACPI) -# spigot: The Creative Labs Video Spigot video-acquisition board # cy: Cyclades serial driver # digi: Digiboard driver # gsc: Genius GS-4500 hand scanner. @@ -635,17 +634,6 @@ options SAFE_RNDTEST # enable rndtest support # The flags takes the following meaning for apm0: # 0x0020 Statclock is broken. -# Notes on the spigot: -# The video spigot is at 0xad6. This port address can not be changed. -# The irq values may only be 10, 11, or 15 -# I/O memory is an 8kb region. Possible values are: -# 0a0000, 0a2000, ..., 0fffff, f00000, f02000, ..., ffffff -# The start address must be on an even boundary. -# Add the following option if you want to allow non-root users to be able -# to access the spigot. This option is not secure because it allows users -# direct access to the I/O page. -# options SPIGOT_UNSECURE - # Notes on the Specialix SI/XIO driver: # The host card is memory, not IO mapped. # The Rev 1 host cards use a 64K chunk, on a 32K boundary. @@ -664,11 +652,6 @@ options SAFE_RNDTEST # enable rndtest support # is the only thing truly supported, but apparently a fair percentage # of the Vaio extra features are controlled by this device. -device spigot 1 -hint.spigot.0.at="isa" -hint.spigot.0.port="0xad6" -hint.spigot.0.irq="15" -hint.spigot.0.maddr="0xee000" device apm hint.apm.0.flags="0x20" device pmtimer # Adjust system timer at wakeup time diff --git a/sys/i386/include/spigot.h b/sys/i386/include/spigot.h deleted file mode 100644 index bf01e0a707ad..000000000000 --- a/sys/i386/include/spigot.h +++ /dev/null @@ -1,97 +0,0 @@ -/* - * 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. - * - * Version 1.2, Aug 30, 1995. - * $FreeBSD$ - */ - -#ifndef _MACHINE_SPIGOT_H_ -#define _MACHINE_SPIGOT_H_ - -#include - -struct spigot_info { - unsigned long maddr; - unsigned short irq; -}; - -/* - * Get memory address. - */ -#define SPIGOT_GET_INFO _IOR('s', 4, struct spigot_info) -/* - * Set up a user interrupt. - */ -#define SPIGOT_SETINT _IOW('s', 5, int) -/* - * Allow/disallow access to the I/O Page. - */ -#define SPIGOT_IOPL_ON _IO ('s', 6) -#define SPIGOT_IOPL_OFF _IO ('s', 7) - -#ifndef _KERNEL -/* - * Defines for spigot library. - */ -unsigned short * spigot_open(char *dev); -void spigot_close(void); -void spigot_set_capture_size(int width, int vtof); -unsigned char spigot_start_xfer(int num_frames); -void spigot_stop_xfer(void); -unsigned char spigot_status(void); - -/* - * Define the status bits. - */ -#define SPIGOT_COLOR 0x01 /* Color present (No color) */ -#define SPIGOT_60HZ 0x02 /* 60 hz input signal (50hz) */ -#define SPIGOT_NO_HORIZONTAL_LOCK 0x04 /* Horizontal lock present */ -#define SPIGOT_HPLL_LOCKED 0x08 /* HPLL locked (HPLL unlocked)*/ -#define SPIGOT_VCR_MODE 0x10 /* VCR mode (TV mode) */ -#define SPIGOT_VSYNC_PRESENT 0x20 /* Vsync present */ - -/* - * spigot_open() returns a data address pointing to the spigot data. - * Each read from this address returns the next word. The ``dev'' passed - * is usually "/dev/spigot". Data is described in the phillips desktop - * video data handbook under the 7191 chip. Formats may be either - * YUV 4:2:2 or YUV 4:1:1. A sample device driver for ``nv'' is included - * with this code. - * - * spigot_close() cleans up and closes the device. - * - * spigot_set_capture_size() will set the capture window size. Width should be - * one of: 80, 160, 240, 320, or 640 for NTSC or - * 96, 192, 288, 384 for PAL. - * vtof is the Vertical top of frame offset and must be between 0 and 15 lines. - * - * spigot_start_xfer() will start a transfer from the 7191 to the data fifo. - * spigot_stop_xfer() will clear the data fifo and abort any transfers. - * - * spigot_status() will return the above status bits. - */ -#endif /* !_KERNEL */ - -#endif /* !_MACHINE_SPIGOT_H_ */ diff --git a/sys/i386/isa/spigot.c b/sys/i386/isa/spigot.c deleted file mode 100644 index b94233a92a2a..000000000000 --- a/sys/i386/isa/spigot.c +++ /dev/null @@ -1,287 +0,0 @@ -/* - * 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. - * - * This is the minimum driver code required to make a spigot work. - * 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-UWM. 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. - * - * The vendor will not allow me to release the spigot library code. - * Please don't ask me for it. - * - * To use this driver you will need the spigot library. The library is - * available from: - * - * ftp.cs.uwm.edu://pub/FreeBSD-UWM/spigot/spigot.tar.gz - * - * Version 1.7, December 1995. - */ - -#include -__FBSDID("$FreeBSD$"); - -#include "spigot.h" - -#if NSPIGOT > 1 -error "Can only have 1 spigot configured." -#endif - -#include "opt_spigot.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#include - -static struct spigot_softc { - u_long flags; - u_long maddr; - struct proc *p; - u_long signal_num; - u_short irq; -} spigot_softc[NSPIGOT]; - -/* flags in softc */ -#define OPEN 0x01 -#define ALIVE 0x02 - -#define UNIT(dev) minor(dev) - -static int spigot_probe(struct isa_device *id); -static int spigot_attach(struct isa_device *id); - -struct isa_driver spigotdriver = { - INTR_TYPE_MISC, - spigot_probe, - spigot_attach, - "spigot" -}; -COMPAT_ISA_DRIVER(spigot, spigotdriver); - -static d_open_t spigot_open; -static d_close_t spigot_close; -static d_read_t spigot_read; -static d_write_t spigot_write; -static d_ioctl_t spigot_ioctl; -static d_mmap_t spigot_mmap; - -static struct cdevsw spigot_cdevsw = { - .d_version = D_VERSION, - .d_flags = D_NEEDGIANT, - .d_open = spigot_open, - .d_close = spigot_close, - .d_read = spigot_read, - .d_write = spigot_write, - .d_ioctl = spigot_ioctl, - .d_mmap = spigot_mmap, - .d_name = "spigot", -}; - -static ointhand2_t spigintr; - -static int -spigot_probe(struct isa_device *devp) -{ -int status; -struct spigot_softc *ss=(struct spigot_softc *)&spigot_softc[devp->id_unit]; - - ss->flags = 0; - ss->maddr = 0; - ss->irq = 0; - - if(devp->id_iobase != 0xad6 || inb(0xad9) == 0xff) - status = 0; /* not found */ - else { - status = 1; /* found */ - ss->flags |= ALIVE; - } - - return(status); -} - -static int -spigot_attach(struct isa_device *devp) -{ - int unit; - struct spigot_softc *ss= &spigot_softc[unit = devp->id_unit]; - - devp->id_ointr = spigintr; - ss->maddr = kvtop(devp->id_maddr); - ss->irq = devp->id_irq; - make_dev(&spigot_cdevsw, unit, 0, 0, 0644, "spigot%d", unit); - return 1; -} - -static int -spigot_open(dev_t dev, int flags, int fmt, struct thread *td) -{ -int error; -struct spigot_softc *ss = (struct spigot_softc *)&spigot_softc[UNIT(dev)]; - - if((ss->flags & ALIVE) == 0) - return ENXIO; - - if(ss->flags & OPEN) - return EBUSY; - -#if !defined(SPIGOT_UNSECURE) - /* - * Don't allow open() unless the process has sufficient privileges, - * since mapping the i/o page and granting i/o privilege would - * require sufficient privilege soon and nothing much can be done - * without them. - */ - error = suser(td); - if (error != 0) - return error; - error = securelevel_gt(td->td_ucred, 0); - if (error != 0) - return error; -#endif - - ss->flags |= OPEN; - ss->p = 0; - ss->signal_num = 0; - - return 0; -} - -static int -spigot_close(dev_t dev, int flags, int fmt, struct thread *td) -{ -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; -} - -static int -spigot_write(dev_t dev, struct uio *uio, int ioflag) -{ - return ENXIO; -} - -static int -spigot_read(dev_t dev, struct uio *uio, int ioflag) -{ - return ENXIO; -} - - -static int -spigot_ioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td) -{ -int error; -struct spigot_softc *ss = (struct spigot_softc *)&spigot_softc[UNIT(dev)]; -struct spigot_info *info; - - if(!data) return(EINVAL); - switch(cmd){ - case SPIGOT_SETINT: - if (*(int *)data < 0 || *(int *)data > _SIG_MAXSIG) - return EINVAL; - ss->p = td->td_proc; - ss->signal_num = *((int *)data); - break; - case SPIGOT_IOPL_ON: /* allow access to the IO PAGE */ -#if !defined(SPIGOT_UNSECURE) - error = suser(td); - if (error != 0) - return error; - error = securelevel_gt(td->td_ucred, 0); - if (error) - return error; -#endif - td->td_frame->tf_eflags |= PSL_IOPL; - break; - case SPIGOT_IOPL_OFF: /* deny access to the IO PAGE */ - td->td_frame->tf_eflags &= ~PSL_IOPL; - break; - case SPIGOT_GET_INFO: - info = (struct spigot_info *)data; - info->maddr = ss->maddr; - info->irq = ss->irq; - break; - default: - return ENOTTY; - } - - return 0; -} - -/* - * Interrupt procedure. - * Just call a user level interrupt routine. - */ -static void -spigintr(int unit) -{ -struct spigot_softc *ss = (struct spigot_softc *)&spigot_softc[unit]; - - if(ss->p && ss->signal_num) { - PROC_LOCK(ss->p); - psignal(ss->p, ss->signal_num); - PROC_UNLOCK(ss->p); - } -} - -static int -spigot_mmap(dev_t dev, vm_offset_t offset, vm_paddr_t *paddr, int nprot) -{ -struct spigot_softc *ss = (struct spigot_softc *)&spigot_softc[0]; - - if(offset != 0) { - printf("spigot mmap failed, offset = 0x%x != 0x0\n", offset); - return -1; - } - - if(nprot & PROT_EXEC) - return -1; - - *paddr = ss->maddr; - return 0; -}