Commit c1fabdad authored by Jaroslav Kysela's avatar Jaroslav Kysela

ALSA CVS update

D:2003/09/25 19:55:42
C:RME HDSP driver,Sound Scape driver,ALSA Version
A:Jaroslav Kysela <perex@suse.cz>
F:include/hdsp.h:1.2->1.3 
F:include/sscape_ioctl.h:1.1->1.2 
F:include/version.h:1.23->1.24 
F:isa/sscape.c:1.4->1.5 
F:pci/rme9652/hdsp.c:1.43->1.44 
L:- fixed firmware ioctls for sscape and hdsp drivers (ioctl out of range)
L:- updated ALSA version to 0.9.7
parent df8dbda8
......@@ -68,11 +68,10 @@ struct _snd_hdsp_config_info {
typedef struct _snd_hdsp_firmware hdsp_firmware_t;
struct _snd_hdsp_firmware {
unsigned long firmware_data[24413];
unsigned long *firmware_data; /* 24413 long words */
};
/* This ioctl is marked bad because the type is bigger than the IOCTL description */
#define SNDRV_HDSP_IOCTL_UPLOAD_FIRMWARE _IOW_BAD('H', 0x42, hdsp_firmware_t)
#define SNDRV_HDSP_IOCTL_UPLOAD_FIRMWARE _IOW('H', 0x42, hdsp_firmware_t)
typedef struct _snd_hdsp_version hdsp_version_t;
......
......@@ -10,12 +10,10 @@ struct sscape_bootblock
struct sscape_microcode
{
unsigned char code[65536];
unsigned char *code; /* 65536 chars */
};
#define SND_SSCAPE_LOAD_BOOTB _IOWR('P', 100, struct sscape_bootblock)
/* This ioctl is marked bad because the type is bigger than the IOCTL description */
#define SND_SSCAPE_LOAD_MCODE _IOW_BAD('P', 101, struct sscape_microcode)
#define SND_SSCAPE_LOAD_MCODE _IOW ('P', 101, struct sscape_microcode)
#endif
/* include/version.h. Generated by configure. */
#define CONFIG_SND_VERSION "0.9.6"
#define CONFIG_SND_DATE " (Wed Aug 20 20:27:13 2003 UTC)"
/* include/version.h. Generated automatically by configure. */
#define CONFIG_SND_VERSION "0.9.7"
#define CONFIG_SND_DATE " (Thu Sep 25 19:16:36 2003 UTC)"
......@@ -5,10 +5,6 @@
* This driver was written in part using information obtained from
* the OSS/Free SoundScape driver, written by Hannu Savolainen.
*
* FIXME (deadlock for alsa-kernel):
* - use ISA PnP scheme used by all ALSA ISA drivers
* - add non-MODULE build option
*
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -455,14 +451,14 @@ static int host_startup_ack(struct soundscape *s, unsigned timeout)
* Upload a byte-stream into the SoundScape using DMA channel A.
*/
static int upload_dma_data(struct soundscape *s,
const unsigned char *data, size_t size,
size_t dmasize)
const unsigned char *data,
size_t size)
{
unsigned long flags;
struct dmabuf dma;
int ret;
if (!get_dmabuf(&dma, dmasize))
if (!get_dmabuf(&dma, PAGE_ALIGN(size)))
return -ENOMEM;
spin_lock_irqsave(&s->lock, flags);
......@@ -575,7 +571,7 @@ static int sscape_upload_bootblock(struct soundscape *sscape, struct sscape_boot
int data = 0;
int ret;
ret = upload_dma_data(sscape, bb->code, sizeof(bb->code), PAGE_SIZE);
ret = upload_dma_data(sscape, bb->code, sizeof(bb->code));
spin_lock_irqsave(&sscape->lock, flags);
if (ret == 0) {
......@@ -602,17 +598,28 @@ static int sscape_upload_bootblock(struct soundscape *sscape, struct sscape_boot
* it into a local variable then we will SMASH THE
* KERNEL'S STACK! We therefore leave it in USER
* SPACE, and save ourselves from copying it at all.
*
* We assume that the caller has already verified the
* userspace memory addresses.
*/
static int sscape_upload_microcode(struct soundscape *sscape,
const struct sscape_microcode *mc)
{
unsigned long flags;
int ret;
char *code;
int err, ret;
/*
* We are going to have to copy this data into a special
* DMA-able buffer before we can upload it. We shall therefore
* just check that the data pointer is valid for now.
*
* NOTE: This buffer is 64K long! That's WAY too big to
* copy into a stack-temporary anyway.
*/
if (get_user(code, &mc->code))
return -EFAULT;
if ((err = verify_area(VERIFY_READ, code, 65536)) != 0)
return err;
if ((ret = upload_dma_data(sscape, mc->code, sizeof(mc->code), PAGE_SIZE * 16)) == 0) {
if ((ret = upload_dma_data(sscape, code, 65536)) == 0) {
snd_printk(KERN_INFO "sscape: MIDI firmware loaded\n");
}
......@@ -696,17 +703,6 @@ static int sscape_hw_ioctl(snd_hwdep_t * hw, struct file *file,
{
register const struct sscape_microcode *mc = (const struct sscape_microcode *) arg;
/*
* We are going to have to copy this data into a special
* DMA-able buffer before we can upload it. We shall therefore
* just check that the data pointer is valid for now.
*
* NOTE: This buffer is 64K long! That's WAY too big to
* copy into a stack-temporary anyway.
*/
if ((err = verify_area(VERIFY_READ, mc->code, sizeof(mc->code))) != 0)
return err;
err = sscape_upload_microcode(sscape, mc);
}
break;
......
......@@ -3788,17 +3788,11 @@ static int snd_hdsp_hwdep_dummy_op(snd_hwdep_t *hw, struct file *file)
static int snd_hdsp_hwdep_ioctl(snd_hwdep_t *hw, struct file *file, unsigned int cmd, unsigned long arg)
{
hdsp_t *hdsp = (hdsp_t *)hw->private_data;
hdsp_peak_rms_t *peak_rms;
hdsp_firmware_t *firmware;
hdsp_mixer_t *mixer;
hdsp_config_info_t info;
hdsp_version_t hdsp_version;
int i;
int err;
unsigned long flags;
switch (cmd) {
case SNDRV_HDSP_IOCTL_GET_PEAK_RMS:
case SNDRV_HDSP_IOCTL_GET_PEAK_RMS: {
hdsp_peak_rms_t *peak_rms;
if (hdsp->io_type == H9652) {
snd_printk("hardware metering isn't supported yet for hdsp9652 cards\n");
return -EINVAL;
......@@ -3824,7 +3818,12 @@ static int snd_hdsp_hwdep_ioctl(snd_hwdep_t *hw, struct file *file, unsigned int
return -EFAULT;
}
break;
case SNDRV_HDSP_IOCTL_GET_CONFIG_INFO:
}
case SNDRV_HDSP_IOCTL_GET_CONFIG_INFO: {
hdsp_config_info_t info;
unsigned long flags;
int i;
if (!(hdsp->state & HDSP_FirmwareLoaded)) {
snd_printk("Firmware needs to be uploaded to the card.\n");
return -EINVAL;
......@@ -3854,7 +3853,11 @@ static int snd_hdsp_hwdep_ioctl(snd_hwdep_t *hw, struct file *file, unsigned int
if (copy_to_user((void *)arg, &info, sizeof(info)))
return -EFAULT;
break;
case SNDRV_HDSP_IOCTL_GET_VERSION:
}
case SNDRV_HDSP_IOCTL_GET_VERSION: {
hdsp_version_t hdsp_version;
int err;
if (hdsp->io_type == H9652) return -EINVAL;
if (hdsp->io_type == Undefined) {
if ((err = hdsp_get_iobox_version(hdsp)) < 0) {
......@@ -3867,19 +3870,27 @@ static int snd_hdsp_hwdep_ioctl(snd_hwdep_t *hw, struct file *file, unsigned int
return -EFAULT;
}
break;
case SNDRV_HDSP_IOCTL_UPLOAD_FIRMWARE:
}
case SNDRV_HDSP_IOCTL_UPLOAD_FIRMWARE: {
hdsp_firmware_t *firmware;
unsigned long *firmware_data;
int err;
if (hdsp->io_type == H9652) return -EINVAL;
/* SNDRV_HDSP_IOCTL_GET_VERSION must have been called */
if (hdsp->io_type == Undefined) return -EINVAL;
snd_printk("initializing firmware upload\n");
firmware = (hdsp_firmware_t *)arg;
if (get_user(firmware_data, &firmware->firmware_data)) {
return -EFAULT;
}
if (hdsp_check_for_iobox (hdsp)) {
return -EIO;
}
if (copy_from_user(hdsp->firmware_cache, firmware->firmware_data, sizeof(unsigned long)*24413) != 0) {
if (copy_from_user(hdsp->firmware_cache, firmware_data, sizeof(unsigned long)*24413) != 0) {
return -EFAULT;
}
......@@ -3901,11 +3912,15 @@ static int snd_hdsp_hwdep_ioctl(snd_hwdep_t *hw, struct file *file, unsigned int
}
}
break;
case SNDRV_HDSP_IOCTL_GET_MIXER:
}
case SNDRV_HDSP_IOCTL_GET_MIXER: {
hdsp_mixer_t *mixer;
mixer = (hdsp_mixer_t *)arg;
if (copy_to_user(mixer->matrix, hdsp->mixer_matrix, sizeof(unsigned short)*HDSP_MATRIX_MIXER_SIZE))
return -EFAULT;
break;
}
default:
return -EINVAL;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment