A batch of Jim Lowe's patches:
o Add signed/unsigned functionality to the matrox meteor device driver. o Apply a few fixes to the sound driver. o Add a ``SPIGOT_UNSECURE'' compile time definition so, if one defines SPIGOT_UNSECURE in their conf file, then they can use the spigot w/o root. There is a warning that this allows users access to the IO page which is probably not secure. Submitted by: james
This commit is contained in:
parent
a17c678ed2
commit
d01b66804a
@ -2,7 +2,7 @@
|
||||
# LINT -- config file for checking all the sources, tries to pull in
|
||||
# as much of the source tree as it can.
|
||||
#
|
||||
# $Id: LINT,v 1.213 1995/11/09 22:47:05 gibbs Exp $
|
||||
# $Id: LINT,v 1.214 1995/11/21 02:50:08 peter Exp $
|
||||
#
|
||||
# NB: You probably don't want to try running a kernel built from this
|
||||
# file. Instead, you should start from GENERIC, and add options from
|
||||
@ -710,7 +710,12 @@ device pca0 at isa? port IO_TIMER1 tty
|
||||
# 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
|
||||
# Note that the start address must be on an even boundary.
|
||||
# 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 Digiboard driver:
|
||||
#
|
||||
|
@ -113,8 +113,9 @@ struct meteor_counts {
|
||||
/* internally stored in 32 bits */
|
||||
#define METEOR_GEO_YUV_PACKED 0x40000 /* 4-2-2 YUV 16 bits packed */
|
||||
#define METEOR_GEO_YUV_PLANER 0x80000 /* 4-2-2 YUV 16 bits planer */
|
||||
#define METEOR_GEO_UNSIGNED 0x400000 /* unsigned uv outputs */
|
||||
|
||||
/* following structure is used to coordinate the syncronous */
|
||||
/* following structure is used to coordinate the synchronous */
|
||||
|
||||
struct meteor_mem {
|
||||
/* kernel write only */
|
||||
|
@ -2,7 +2,7 @@
|
||||
# LINT -- config file for checking all the sources, tries to pull in
|
||||
# as much of the source tree as it can.
|
||||
#
|
||||
# $Id: LINT,v 1.213 1995/11/09 22:47:05 gibbs Exp $
|
||||
# $Id: LINT,v 1.214 1995/11/21 02:50:08 peter Exp $
|
||||
#
|
||||
# NB: You probably don't want to try running a kernel built from this
|
||||
# file. Instead, you should start from GENERIC, and add options from
|
||||
@ -710,7 +710,12 @@ device pca0 at isa? port IO_TIMER1 tty
|
||||
# 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
|
||||
# Note that the start address must be on an even boundary.
|
||||
# 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 Digiboard driver:
|
||||
#
|
||||
|
@ -2,7 +2,7 @@
|
||||
# LINT -- config file for checking all the sources, tries to pull in
|
||||
# as much of the source tree as it can.
|
||||
#
|
||||
# $Id: LINT,v 1.213 1995/11/09 22:47:05 gibbs Exp $
|
||||
# $Id: LINT,v 1.214 1995/11/21 02:50:08 peter Exp $
|
||||
#
|
||||
# NB: You probably don't want to try running a kernel built from this
|
||||
# file. Instead, you should start from GENERIC, and add options from
|
||||
@ -710,7 +710,12 @@ device pca0 at isa? port IO_TIMER1 tty
|
||||
# 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
|
||||
# Note that the start address must be on an even boundary.
|
||||
# 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 Digiboard driver:
|
||||
#
|
||||
|
@ -113,8 +113,9 @@ struct meteor_counts {
|
||||
/* internally stored in 32 bits */
|
||||
#define METEOR_GEO_YUV_PACKED 0x40000 /* 4-2-2 YUV 16 bits packed */
|
||||
#define METEOR_GEO_YUV_PLANER 0x80000 /* 4-2-2 YUV 16 bits planer */
|
||||
#define METEOR_GEO_UNSIGNED 0x400000 /* unsigned uv outputs */
|
||||
|
||||
/* following structure is used to coordinate the syncronous */
|
||||
/* following structure is used to coordinate the synchronous */
|
||||
|
||||
struct meteor_mem {
|
||||
/* kernel write only */
|
||||
|
@ -227,10 +227,16 @@ audio_write (int dev, struct fileinfo *file, snd_rw_buf * buf, int count)
|
||||
/* Handle nonblocking mode */
|
||||
#if defined(__FreeBSD__)
|
||||
if (dev_nblock[dev] && wr_buff_no[dev] == RET_ERROR (EWOULDBLOCK))
|
||||
return wr_buff_no[dev]; /*
|
||||
* XXX Return error, write() will
|
||||
* supply # of accepted bytes.
|
||||
* In fact, in FreeBSD the check
|
||||
* above should not be needed
|
||||
*/
|
||||
#else
|
||||
if (dev_nblock[dev] && wr_buff_no[dev] == RET_ERROR (EAGAIN))
|
||||
#endif
|
||||
return p; /* No more space. Return # of accepted bytes */
|
||||
#endif
|
||||
return wr_buff_no[dev];
|
||||
}
|
||||
wr_buff_ptr[dev] = 0;
|
||||
@ -317,10 +323,16 @@ audio_read (int dev, struct fileinfo *file, snd_rw_buf * buf, int count)
|
||||
|
||||
#if defined(__FreeBSD__)
|
||||
if (dev_nblock[dev] && buff_no == RET_ERROR (EWOULDBLOCK))
|
||||
return buff_no; /*
|
||||
* XXX Return error, read() will supply
|
||||
* # of bytes actually read. In fact,
|
||||
* in FreeBSD the check above should not
|
||||
* be needed
|
||||
*/
|
||||
#else
|
||||
if (dev_nblock[dev] && buff_no == RET_ERROR (EAGAIN))
|
||||
#endif
|
||||
return p;
|
||||
#endif
|
||||
|
||||
return buff_no;
|
||||
}
|
||||
@ -449,6 +461,20 @@ audio_ioctl (int dev, struct fileinfo *file,
|
||||
return 0;
|
||||
break;
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
case FIONBIO: /* XXX Is this the same in Linux? */
|
||||
if (*(int *)arg)
|
||||
dev_nblock[dev] = 1;
|
||||
else
|
||||
dev_nblock[dev] = 0;
|
||||
return 0;
|
||||
break;
|
||||
|
||||
case FIOASYNC:
|
||||
return 0; /* XXX Useful for ampling input notification? */
|
||||
break;
|
||||
#endif
|
||||
|
||||
default:
|
||||
return DMAbuf_ioctl (dev, cmd, arg, 0);
|
||||
}
|
||||
|
@ -527,7 +527,7 @@ space_in_queue (int dev)
|
||||
int len, max, tmp;
|
||||
struct dma_buffparms *dmap = audio_devs[dev]->dmap;
|
||||
|
||||
if (dmap->qlen == dmap->nbufs) /* No space at all */
|
||||
if (dmap->qlen >= dmap->nbufs) /* No space at all */
|
||||
return 0;
|
||||
|
||||
/*
|
||||
@ -587,7 +587,7 @@ DMAbuf_getwrbuffer (int dev, char **buf, int *size, int dontblock)
|
||||
}
|
||||
|
||||
|
||||
if (dontblock)
|
||||
if (dontblock && !space_in_queue (dev)) /* XXX */
|
||||
#if defined(__FreeBSD__)
|
||||
return RET_ERROR (EWOULDBLOCK);
|
||||
#else
|
||||
@ -961,9 +961,9 @@ DMAbuf_select (int dev, struct fileinfo *file, int sel_type, select_table * wait
|
||||
if (dmap->dma_mode != DMODE_INPUT)
|
||||
return 0;
|
||||
|
||||
DISABLE_INTR (flags);
|
||||
if (!dmap->qlen)
|
||||
{
|
||||
DISABLE_INTR (flags);
|
||||
#if defined(__FreeBSD__)
|
||||
selrecord(wait, &selinfo[dev]);
|
||||
#else
|
||||
@ -973,6 +973,7 @@ DMAbuf_select (int dev, struct fileinfo *file, int sel_type, select_table * wait
|
||||
RESTORE_INTR (flags);
|
||||
return 0;
|
||||
}
|
||||
RESTORE_INTR (flags);
|
||||
return 1;
|
||||
break;
|
||||
|
||||
@ -983,9 +984,9 @@ DMAbuf_select (int dev, struct fileinfo *file, int sel_type, select_table * wait
|
||||
if (dmap->dma_mode == DMODE_NONE)
|
||||
return 1;
|
||||
|
||||
DISABLE_INTR (flags);
|
||||
if (!space_in_queue (dev))
|
||||
{
|
||||
DISABLE_INTR (flags);
|
||||
#if defined(__FreeBSD__)
|
||||
selrecord(wait, &selinfo[dev]);
|
||||
#else
|
||||
@ -995,6 +996,7 @@ DMAbuf_select (int dev, struct fileinfo *file, int sel_type, select_table * wait
|
||||
RESTORE_INTR (flags);
|
||||
return 0;
|
||||
}
|
||||
RESTORE_INTR (flags);
|
||||
return 1;
|
||||
break;
|
||||
|
||||
|
@ -131,6 +131,10 @@ static unsigned long pcm_current_buf;
|
||||
static int pcm_current_count;
|
||||
static int pcm_current_intrflag;
|
||||
|
||||
#if defined(__FreeBSD__)
|
||||
static char *gus_copy_buf;
|
||||
#endif
|
||||
|
||||
struct voice_info voices[32];
|
||||
|
||||
static int freq_div_table[] =
|
||||
@ -2003,11 +2007,13 @@ static int
|
||||
gus_sampling_open (int dev, int mode)
|
||||
{
|
||||
int dev_flag;
|
||||
int init_flag;
|
||||
#ifdef GUS_NO_DMA
|
||||
printk ("GUS: DMA mode not enabled. Device not supported\n");
|
||||
return RET_ERROR (ENXIO);
|
||||
#endif
|
||||
dev_flag = 0;
|
||||
init_flag = (gus_busy[gus_devnum] == 0 && gus_busy[gus_dspnum] == 0);
|
||||
if(mode & OPEN_WRITE)
|
||||
{
|
||||
if (gus_busy[gus_devnum])
|
||||
@ -2029,18 +2035,20 @@ gus_sampling_open (int dev, int mode)
|
||||
}
|
||||
}
|
||||
|
||||
if(gus_busy[gus_devnum] == 0 && gus_busy[gus_dspnum] == 0)
|
||||
gus_initialize ();
|
||||
if(init_flag)
|
||||
{
|
||||
gus_initialize ();
|
||||
|
||||
active_device = 0;
|
||||
active_device = 0;
|
||||
|
||||
gus_reset ();
|
||||
reset_sample_memory ();
|
||||
gus_select_max_voices (14);
|
||||
gus_reset ();
|
||||
reset_sample_memory ();
|
||||
gus_select_max_voices (14);
|
||||
|
||||
pcm_active = 0;
|
||||
dma_active = 0;
|
||||
pcm_opened = 1;
|
||||
pcm_active = 0;
|
||||
dma_active = 0;
|
||||
pcm_opened = 1;
|
||||
}
|
||||
if (mode & OPEN_READ)
|
||||
{
|
||||
recording_active = 1;
|
||||
@ -2055,7 +2063,7 @@ static void
|
||||
gus_sampling_close (int dev)
|
||||
{
|
||||
gus_busy[dev] = 0;
|
||||
if (gus_busy[gus_devnum] == 0 && gus_busy[gus_dspnum]) {
|
||||
if (gus_busy[gus_devnum] == 0 && gus_busy[gus_dspnum] == 0) {
|
||||
active_device = 0;
|
||||
gus_reset();
|
||||
pcm_opened = 0;
|
||||
@ -2392,6 +2400,47 @@ gus_copy_from_user (int dev, char *localbuf, int localoffs,
|
||||
COPY_FROM_USER (&localbuf[localoffs], userbuf, useroffs, len);
|
||||
}
|
||||
else if (gus_sampling_bits == 8)
|
||||
#if defined(__FreeBSD__)
|
||||
{
|
||||
char *in_left = gus_copy_buf;
|
||||
char *in_right = in_left + 1;
|
||||
char *out_left = localbuf + (localoffs / 2);
|
||||
char *out_right = out_left + pcm_bsize;
|
||||
int i;
|
||||
|
||||
COPY_FROM_USER (gus_copy_buf, userbuf, useroffs, len);
|
||||
|
||||
len /= 2;
|
||||
|
||||
for (i = 0; i < len; i++)
|
||||
{
|
||||
*out_left++ = *in_left++;
|
||||
in_left++;
|
||||
*out_right++ = *in_right++;
|
||||
in_right++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
short *in_left = (short *)gus_copy_buf;
|
||||
short *in_right = in_left + 1;
|
||||
short *out_left = (short *)localbuf + (localoffs / 4);
|
||||
short *out_right = out_left + (pcm_bsize / 2);
|
||||
int i;
|
||||
|
||||
COPY_FROM_USER (gus_copy_buf, userbuf, useroffs, len);
|
||||
|
||||
len /= 4;
|
||||
|
||||
for (i = 0; i < len; i++)
|
||||
{
|
||||
*out_left++ = *in_left++;
|
||||
in_left++;
|
||||
*out_right++ = *in_right++;
|
||||
in_right++;
|
||||
}
|
||||
}
|
||||
#else
|
||||
{
|
||||
int in_left = useroffs;
|
||||
int in_right = useroffs + 1;
|
||||
@ -2439,6 +2488,7 @@ gus_copy_from_user (int dev, char *localbuf, int localoffs,
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static struct audio_operations gus_sampling_operations =
|
||||
@ -3055,6 +3105,10 @@ gus_wave_init (long mem_start, int irq, int dma, int dma_read)
|
||||
synth_devs[num_synths++] = &guswave_operations;
|
||||
}
|
||||
|
||||
#if defined(__FreeBSD__)
|
||||
PERMANENT_MALLOC (char *, gus_copy_buf, DSP_BUFFSIZE, mem_start);
|
||||
#endif
|
||||
|
||||
PERMANENT_MALLOC (struct patch_info *, samples,
|
||||
(MAX_SAMPLE + 1) * sizeof (*samples), mem_start);
|
||||
|
||||
|
@ -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.30 1995/11/04 13:24:48 bde Exp $
|
||||
* $Id: soundcard.c,v 1.31 1995/11/28 09:43:45 julian Exp $
|
||||
*/
|
||||
|
||||
#include "sound_config.h"
|
||||
@ -53,7 +53,10 @@ u_int snd7_imask;
|
||||
u_int snd8_imask;
|
||||
u_int snd9_imask;
|
||||
|
||||
#define FIX_RETURN(ret) {if ((ret)<0) return -(ret); else return 0;}
|
||||
#define FIX_RETURN(ret) { \
|
||||
int tmp_ret = (ret); \
|
||||
if (tmp_ret<0) return -tmp_ret; else return 0; \
|
||||
}
|
||||
|
||||
static int timer_running = 0;
|
||||
|
||||
|
@ -40,7 +40,7 @@
|
||||
*
|
||||
* ftp.cs.uwm.edu://pub/FreeBSD/spigot/spigot.tar.gz
|
||||
*
|
||||
* Version 1.5, August 30, 1995.
|
||||
* Version 1.6, Novemeber 21, 1995.
|
||||
*
|
||||
*/
|
||||
|
||||
@ -225,9 +225,11 @@ struct spigot_info *info;
|
||||
ss->signal_num = *((int *)data);
|
||||
break;
|
||||
case SPIGOT_IOPL_ON: /* allow access to the IO PAGE */
|
||||
#if !defined(SPIGOT_UNSECURE)
|
||||
error = suser(p->p_ucred, &p->p_acflag);
|
||||
if (error != 0)
|
||||
return error;
|
||||
#endif
|
||||
fp=(struct trapframe *)p->p_md.md_regs;
|
||||
fp->tf_eflags |= PSL_IOPL;
|
||||
break;
|
||||
|
@ -36,6 +36,10 @@
|
||||
8/29/95 Fixes suggested by Bruce Evans.
|
||||
meteor_mmap should return -1 on error rather than 0.
|
||||
unit # > NMETEOR should be unit # >= NMETEOR.
|
||||
10/24/95 Turn 50 Hz processing for SECAM and 60 Hz processing
|
||||
off for AUTOMODE.
|
||||
11/11/95 Change UV from always begin signed to ioctl selected
|
||||
to either signed or unsigned.
|
||||
*/
|
||||
|
||||
#include "meteor.h"
|
||||
@ -630,7 +634,7 @@ meteor_reset(meteor_reg_t * const sc)
|
||||
#define UNIT(x) ((x) & 0x07)
|
||||
|
||||
int
|
||||
meteor_open(dev_t dev, int flags, int fmt, struct proc *p)
|
||||
meteor_open(dev_t dev, int flag)
|
||||
{
|
||||
meteor_reg_t *mtr;
|
||||
int unit;
|
||||
@ -664,7 +668,7 @@ meteor_open(dev_t dev, int flags, int fmt, struct proc *p)
|
||||
}
|
||||
|
||||
int
|
||||
meteor_close(dev_t dev, int flags, int fmt, struct proc *p)
|
||||
meteor_close(dev_t dev, int flag)
|
||||
{
|
||||
meteor_reg_t *mtr;
|
||||
int unit;
|
||||
@ -730,7 +734,7 @@ meteor_close(dev_t dev, int flags, int fmt, struct proc *p)
|
||||
}
|
||||
|
||||
int
|
||||
meteor_read(dev_t dev, struct uio *uio, int ioflag)
|
||||
meteor_read(dev_t dev, struct uio *uio)
|
||||
{
|
||||
meteor_reg_t *mtr;
|
||||
int unit;
|
||||
@ -768,7 +772,7 @@ meteor_read(dev_t dev, struct uio *uio, int ioflag)
|
||||
}
|
||||
|
||||
int
|
||||
meteor_write(dev_t dev, struct uio *uio, int ioflag)
|
||||
meteor_write()
|
||||
{
|
||||
return(0);
|
||||
}
|
||||
@ -891,7 +895,7 @@ meteor_ioctl(dev_t dev, int cmd, caddr_t arg, int flag, struct proc *pr)
|
||||
SAA7196_WRITE(mtr, 0x0d,
|
||||
(SAA7196_REG(mtr, 0x0d) & ~0x01) | 0x1);
|
||||
SAA7196_WRITE(mtr, 0x0f,
|
||||
(SAA7196_REG(mtr, 0x0f) & ~0xe0) | 0xe0);
|
||||
(SAA7196_REG(mtr, 0x0f) & ~0xe0) | 0x20);
|
||||
SAA7196_WRITE(mtr, 0x22, 0x00);
|
||||
SAA7196_WRITE(mtr, 0x24,
|
||||
(SAA7196_REG(mtr, 0x24) | 0x0c));
|
||||
@ -905,7 +909,7 @@ meteor_ioctl(dev_t dev, int cmd, caddr_t arg, int flag, struct proc *pr)
|
||||
SAA7196_WRITE(mtr, 0x0d,
|
||||
(SAA7196_REG(mtr, 0x0d) & ~0x01));
|
||||
SAA7196_WRITE(mtr, 0x0f,
|
||||
(SAA7196_REG(mtr, 0x0f) & ~0xc0) | 0xc0);
|
||||
(SAA7196_REG(mtr, 0x0f) & ~0xc0) | 0x80);
|
||||
break;
|
||||
default:
|
||||
return EINVAL;
|
||||
@ -1190,6 +1194,10 @@ meteor_ioctl(dev_t dev, int cmd, caddr_t arg, int flag, struct proc *pr)
|
||||
SAA7196_WRITE(mtr, 0x28,
|
||||
((SAA7196_REG(mtr, 0x28) & ~0x03) |
|
||||
((mtr->rows >> 9) & 0x03)));
|
||||
/* set signed/unsigned */
|
||||
SAA7196_WRITE(mtr, 0x30,
|
||||
(SAA7196_REG(mtr, 0x30) & ~0x10) |
|
||||
((geo->oformat&METEOR_GEO_UNSIGNED)?0:0x10));
|
||||
}
|
||||
break;
|
||||
case METEORGETGEO:
|
||||
@ -1227,7 +1235,7 @@ meteor_mmap(dev_t dev, int offset, int nprot)
|
||||
meteor_reg_t *mtr;
|
||||
|
||||
unit = UNIT(minor(dev));
|
||||
if (unit >= NMETEOR)
|
||||
if (unit >= NMETEOR) /* at this point could this happen? */
|
||||
return(-1);
|
||||
|
||||
mtr = &(meteor[unit]);
|
||||
|
@ -113,8 +113,9 @@ struct meteor_counts {
|
||||
/* internally stored in 32 bits */
|
||||
#define METEOR_GEO_YUV_PACKED 0x40000 /* 4-2-2 YUV 16 bits packed */
|
||||
#define METEOR_GEO_YUV_PLANER 0x80000 /* 4-2-2 YUV 16 bits planer */
|
||||
#define METEOR_GEO_UNSIGNED 0x400000 /* unsigned uv outputs */
|
||||
|
||||
/* following structure is used to coordinate the syncronous */
|
||||
/* following structure is used to coordinate the synchronous */
|
||||
|
||||
struct meteor_mem {
|
||||
/* kernel write only */
|
||||
|
Loading…
Reference in New Issue
Block a user