Commit 8c6b3424 authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] iomem annotations and fixes + isa_-ectomy in msnd

 * switched to ioremap() + normal operations
 * split msnd_fifo_write() (and msnd_fifo_read()) into iomem and normal
   versions (original was even worse - it used to do __user and __iomem
   versions in the same code and in atomic context; when that bogosity
   got fixed, the difference between these cases (now normal memory and
   iomem) had been lost).
Signed-off-by: default avatarAl Viro <viro@parcelfarce.linux.theplanet.co.uk>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent dbdc3bfe
...@@ -81,12 +81,12 @@ void msnd_unregister(multisound_dev_t *dev) ...@@ -81,12 +81,12 @@ void msnd_unregister(multisound_dev_t *dev)
--num_devs; --num_devs;
} }
void msnd_init_queue(unsigned long base, int start, int size) void msnd_init_queue(void __iomem *base, int start, int size)
{ {
isa_writew(PCTODSP_BASED(start), base + JQS_wStart); writew(PCTODSP_BASED(start), base + JQS_wStart);
isa_writew(PCTODSP_OFFSET(size) - 1, base + JQS_wSize); writew(PCTODSP_OFFSET(size) - 1, base + JQS_wSize);
isa_writew(0, base + JQS_wHead); writew(0, base + JQS_wHead);
isa_writew(0, base + JQS_wTail); writew(0, base + JQS_wTail);
} }
void msnd_fifo_init(msnd_fifo *f) void msnd_fifo_init(msnd_fifo *f)
...@@ -122,6 +122,37 @@ void msnd_fifo_make_empty(msnd_fifo *f) ...@@ -122,6 +122,37 @@ void msnd_fifo_make_empty(msnd_fifo *f)
f->len = f->tail = f->head = 0; f->len = f->tail = f->head = 0;
} }
int msnd_fifo_write_io(msnd_fifo *f, char __iomem *buf, size_t len)
{
int count = 0;
while ((count < len) && (f->len != f->n)) {
int nwritten;
if (f->head <= f->tail) {
nwritten = len - count;
if (nwritten > f->n - f->tail)
nwritten = f->n - f->tail;
}
else {
nwritten = f->head - f->tail;
if (nwritten > len - count)
nwritten = len - count;
}
memcpy_fromio(f->data + f->tail, buf, nwritten);
count += nwritten;
buf += nwritten;
f->len += nwritten;
f->tail += nwritten;
f->tail %= f->n;
}
return count;
}
int msnd_fifo_write(msnd_fifo *f, const char *buf, size_t len) int msnd_fifo_write(msnd_fifo *f, const char *buf, size_t len)
{ {
int count = 0; int count = 0;
...@@ -141,7 +172,7 @@ int msnd_fifo_write(msnd_fifo *f, const char *buf, size_t len) ...@@ -141,7 +172,7 @@ int msnd_fifo_write(msnd_fifo *f, const char *buf, size_t len)
nwritten = len - count; nwritten = len - count;
} }
isa_memcpy_fromio(f->data + f->tail, (unsigned long) buf, nwritten); memcpy(f->data + f->tail, buf, nwritten);
count += nwritten; count += nwritten;
buf += nwritten; buf += nwritten;
...@@ -153,6 +184,37 @@ int msnd_fifo_write(msnd_fifo *f, const char *buf, size_t len) ...@@ -153,6 +184,37 @@ int msnd_fifo_write(msnd_fifo *f, const char *buf, size_t len)
return count; return count;
} }
int msnd_fifo_read_io(msnd_fifo *f, char __iomem *buf, size_t len)
{
int count = 0;
while ((count < len) && (f->len > 0)) {
int nread;
if (f->tail <= f->head) {
nread = len - count;
if (nread > f->n - f->head)
nread = f->n - f->head;
}
else {
nread = f->tail - f->head;
if (nread > len - count)
nread = len - count;
}
memcpy_toio(buf, f->data + f->head, nread);
count += nread;
buf += nread;
f->len -= nread;
f->head += nread;
f->head %= f->n;
}
return count;
}
int msnd_fifo_read(msnd_fifo *f, char *buf, size_t len) int msnd_fifo_read(msnd_fifo *f, char *buf, size_t len)
{ {
int count = 0; int count = 0;
...@@ -172,7 +234,7 @@ int msnd_fifo_read(msnd_fifo *f, char *buf, size_t len) ...@@ -172,7 +234,7 @@ int msnd_fifo_read(msnd_fifo *f, char *buf, size_t len)
nread = len - count; nread = len - count;
} }
isa_memcpy_toio((unsigned long) buf, f->data + f->head, nread); memcpy(buf, f->data + f->head, nread);
count += nread; count += nread;
buf += nread; buf += nread;
...@@ -327,6 +389,8 @@ EXPORT_SYMBOL(msnd_fifo_init); ...@@ -327,6 +389,8 @@ EXPORT_SYMBOL(msnd_fifo_init);
EXPORT_SYMBOL(msnd_fifo_free); EXPORT_SYMBOL(msnd_fifo_free);
EXPORT_SYMBOL(msnd_fifo_alloc); EXPORT_SYMBOL(msnd_fifo_alloc);
EXPORT_SYMBOL(msnd_fifo_make_empty); EXPORT_SYMBOL(msnd_fifo_make_empty);
EXPORT_SYMBOL(msnd_fifo_write_io);
EXPORT_SYMBOL(msnd_fifo_read_io);
EXPORT_SYMBOL(msnd_fifo_write); EXPORT_SYMBOL(msnd_fifo_write);
EXPORT_SYMBOL(msnd_fifo_read); EXPORT_SYMBOL(msnd_fifo_read);
......
...@@ -183,7 +183,7 @@ typedef u8 BYTE; ...@@ -183,7 +183,7 @@ typedef u8 BYTE;
typedef u16 USHORT; typedef u16 USHORT;
typedef u16 WORD; typedef u16 WORD;
typedef u32 DWORD; typedef u32 DWORD;
typedef unsigned long LPDAQD; typedef void __iomem * LPDAQD;
/* Generic FIFO */ /* Generic FIFO */
typedef struct { typedef struct {
...@@ -203,12 +203,12 @@ typedef struct multisound_dev { ...@@ -203,12 +203,12 @@ typedef struct multisound_dev {
int memid, irqid; int memid, irqid;
int irq, irq_ref; int irq, irq_ref;
unsigned char info; unsigned char info;
unsigned long base; void __iomem *base;
/* Motorola 56k DSP SMA */ /* Motorola 56k DSP SMA */
unsigned long SMA; void __iomem *SMA;
unsigned long DAPQ, DARQ, MODQ, MIDQ, DSPQ; void __iomem *DAPQ, *DARQ, *MODQ, *MIDQ, *DSPQ;
unsigned long pwDSPQData, pwMIDQData, pwMODQData; void __iomem *pwDSPQData, *pwMIDQData, *pwMODQData;
int dspq_data_buff, dspq_buff_size; int dspq_data_buff, dspq_buff_size;
/* State variables */ /* State variables */
...@@ -259,12 +259,14 @@ typedef struct multisound_dev { ...@@ -259,12 +259,14 @@ typedef struct multisound_dev {
int msnd_register(multisound_dev_t *dev); int msnd_register(multisound_dev_t *dev);
void msnd_unregister(multisound_dev_t *dev); void msnd_unregister(multisound_dev_t *dev);
void msnd_init_queue(unsigned long, int start, int size); void msnd_init_queue(void __iomem *, int start, int size);
void msnd_fifo_init(msnd_fifo *f); void msnd_fifo_init(msnd_fifo *f);
void msnd_fifo_free(msnd_fifo *f); void msnd_fifo_free(msnd_fifo *f);
int msnd_fifo_alloc(msnd_fifo *f, size_t n); int msnd_fifo_alloc(msnd_fifo *f, size_t n);
void msnd_fifo_make_empty(msnd_fifo *f); void msnd_fifo_make_empty(msnd_fifo *f);
int msnd_fifo_write_io(msnd_fifo *f, char __iomem *buf, size_t len);
int msnd_fifo_read_io(msnd_fifo *f, char __iomem *buf, size_t len);
int msnd_fifo_write(msnd_fifo *f, const char *buf, size_t len); int msnd_fifo_write(msnd_fifo *f, const char *buf, size_t len);
int msnd_fifo_read(msnd_fifo *f, char *buf, size_t len); int msnd_fifo_read(msnd_fifo *f, char *buf, size_t len);
......
...@@ -109,18 +109,18 @@ static void reset_play_queue(void) ...@@ -109,18 +109,18 @@ static void reset_play_queue(void)
LPDAQD lpDAQ; LPDAQD lpDAQ;
dev.last_playbank = -1; dev.last_playbank = -1;
isa_writew(PCTODSP_OFFSET(0 * DAQDS__size), dev.DAPQ + JQS_wHead); writew(PCTODSP_OFFSET(0 * DAQDS__size), dev.DAPQ + JQS_wHead);
isa_writew(PCTODSP_OFFSET(0 * DAQDS__size), dev.DAPQ + JQS_wTail); writew(PCTODSP_OFFSET(0 * DAQDS__size), dev.DAPQ + JQS_wTail);
for (n = 0, lpDAQ = dev.base + DAPQ_DATA_BUFF; n < 3; ++n, lpDAQ += DAQDS__size) { for (n = 0, lpDAQ = dev.base + DAPQ_DATA_BUFF; n < 3; ++n, lpDAQ += DAQDS__size) {
isa_writew(PCTODSP_BASED((DWORD)(DAP_BUFF_SIZE * n)), lpDAQ + DAQDS_wStart); writew(PCTODSP_BASED((DWORD)(DAP_BUFF_SIZE * n)), lpDAQ + DAQDS_wStart);
isa_writew(0, lpDAQ + DAQDS_wSize); writew(0, lpDAQ + DAQDS_wSize);
isa_writew(1, lpDAQ + DAQDS_wFormat); writew(1, lpDAQ + DAQDS_wFormat);
isa_writew(dev.play_sample_size, lpDAQ + DAQDS_wSampleSize); writew(dev.play_sample_size, lpDAQ + DAQDS_wSampleSize);
isa_writew(dev.play_channels, lpDAQ + DAQDS_wChannels); writew(dev.play_channels, lpDAQ + DAQDS_wChannels);
isa_writew(dev.play_sample_rate, lpDAQ + DAQDS_wSampleRate); writew(dev.play_sample_rate, lpDAQ + DAQDS_wSampleRate);
isa_writew(HIMT_PLAY_DONE * 0x100 + n, lpDAQ + DAQDS_wIntMsg); writew(HIMT_PLAY_DONE * 0x100 + n, lpDAQ + DAQDS_wIntMsg);
isa_writew(n, lpDAQ + DAQDS_wFlags); writew(n, lpDAQ + DAQDS_wFlags);
} }
} }
...@@ -131,25 +131,25 @@ static void reset_record_queue(void) ...@@ -131,25 +131,25 @@ static void reset_record_queue(void)
unsigned long flags; unsigned long flags;
dev.last_recbank = 2; dev.last_recbank = 2;
isa_writew(PCTODSP_OFFSET(0 * DAQDS__size), dev.DARQ + JQS_wHead); writew(PCTODSP_OFFSET(0 * DAQDS__size), dev.DARQ + JQS_wHead);
isa_writew(PCTODSP_OFFSET(dev.last_recbank * DAQDS__size), dev.DARQ + JQS_wTail); writew(PCTODSP_OFFSET(dev.last_recbank * DAQDS__size), dev.DARQ + JQS_wTail);
/* Critical section: bank 1 access */ /* Critical section: bank 1 access */
spin_lock_irqsave(&dev.lock, flags); spin_lock_irqsave(&dev.lock, flags);
msnd_outb(HPBLKSEL_1, dev.io + HP_BLKS); msnd_outb(HPBLKSEL_1, dev.io + HP_BLKS);
isa_memset_io(dev.base, 0, DAR_BUFF_SIZE * 3); memset_io(dev.base, 0, DAR_BUFF_SIZE * 3);
msnd_outb(HPBLKSEL_0, dev.io + HP_BLKS); msnd_outb(HPBLKSEL_0, dev.io + HP_BLKS);
spin_unlock_irqrestore(&dev.lock, flags); spin_unlock_irqrestore(&dev.lock, flags);
for (n = 0, lpDAQ = dev.base + DARQ_DATA_BUFF; n < 3; ++n, lpDAQ += DAQDS__size) { for (n = 0, lpDAQ = dev.base + DARQ_DATA_BUFF; n < 3; ++n, lpDAQ += DAQDS__size) {
isa_writew(PCTODSP_BASED((DWORD)(DAR_BUFF_SIZE * n)) + 0x4000, lpDAQ + DAQDS_wStart); writew(PCTODSP_BASED((DWORD)(DAR_BUFF_SIZE * n)) + 0x4000, lpDAQ + DAQDS_wStart);
isa_writew(DAR_BUFF_SIZE, lpDAQ + DAQDS_wSize); writew(DAR_BUFF_SIZE, lpDAQ + DAQDS_wSize);
isa_writew(1, lpDAQ + DAQDS_wFormat); writew(1, lpDAQ + DAQDS_wFormat);
isa_writew(dev.rec_sample_size, lpDAQ + DAQDS_wSampleSize); writew(dev.rec_sample_size, lpDAQ + DAQDS_wSampleSize);
isa_writew(dev.rec_channels, lpDAQ + DAQDS_wChannels); writew(dev.rec_channels, lpDAQ + DAQDS_wChannels);
isa_writew(dev.rec_sample_rate, lpDAQ + DAQDS_wSampleRate); writew(dev.rec_sample_rate, lpDAQ + DAQDS_wSampleRate);
isa_writew(HIMT_RECORD_DONE * 0x100 + n, lpDAQ + DAQDS_wIntMsg); writew(HIMT_RECORD_DONE * 0x100 + n, lpDAQ + DAQDS_wIntMsg);
isa_writew(n, lpDAQ + DAQDS_wFlags); writew(n, lpDAQ + DAQDS_wFlags);
} }
} }
...@@ -185,9 +185,9 @@ static int dsp_set_format(struct file *file, int val) ...@@ -185,9 +185,9 @@ static int dsp_set_format(struct file *file, int val)
for (i = 0; i < 3; ++i, lpDAQ += DAQDS__size, lpDARQ += DAQDS__size) { for (i = 0; i < 3; ++i, lpDAQ += DAQDS__size, lpDARQ += DAQDS__size) {
if (file->f_mode & FMODE_WRITE) if (file->f_mode & FMODE_WRITE)
isa_writew(data, lpDAQ + DAQDS_wSampleSize); writew(data, lpDAQ + DAQDS_wSampleSize);
if (file->f_mode & FMODE_READ) if (file->f_mode & FMODE_READ)
isa_writew(data, lpDARQ + DAQDS_wSampleSize); writew(data, lpDARQ + DAQDS_wSampleSize);
} }
if (file->f_mode & FMODE_WRITE) if (file->f_mode & FMODE_WRITE)
dev.play_sample_size = data; dev.play_sample_size = data;
...@@ -318,9 +318,9 @@ static int dsp_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ...@@ -318,9 +318,9 @@ static int dsp_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
for (i = 0; i < 3; ++i, lpDAQ += DAQDS__size, lpDARQ += DAQDS__size) { for (i = 0; i < 3; ++i, lpDAQ += DAQDS__size, lpDARQ += DAQDS__size) {
if (file->f_mode & FMODE_WRITE) if (file->f_mode & FMODE_WRITE)
isa_writew(data, lpDAQ + DAQDS_wSampleRate); writew(data, lpDAQ + DAQDS_wSampleRate);
if (file->f_mode & FMODE_READ) if (file->f_mode & FMODE_READ)
isa_writew(data, lpDARQ + DAQDS_wSampleRate); writew(data, lpDARQ + DAQDS_wSampleRate);
} }
if (file->f_mode & FMODE_WRITE) if (file->f_mode & FMODE_WRITE)
dev.play_sample_rate = data; dev.play_sample_rate = data;
...@@ -361,9 +361,9 @@ static int dsp_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ...@@ -361,9 +361,9 @@ static int dsp_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
for (i = 0; i < 3; ++i, lpDAQ += DAQDS__size, lpDARQ += DAQDS__size) { for (i = 0; i < 3; ++i, lpDAQ += DAQDS__size, lpDARQ += DAQDS__size) {
if (file->f_mode & FMODE_WRITE) if (file->f_mode & FMODE_WRITE)
isa_writew(data, lpDAQ + DAQDS_wChannels); writew(data, lpDAQ + DAQDS_wChannels);
if (file->f_mode & FMODE_READ) if (file->f_mode & FMODE_READ)
isa_writew(data, lpDARQ + DAQDS_wChannels); writew(data, lpDARQ + DAQDS_wChannels);
} }
if (file->f_mode & FMODE_WRITE) if (file->f_mode & FMODE_WRITE)
dev.play_channels = data; dev.play_channels = data;
...@@ -401,27 +401,27 @@ static int mixer_get(int d) ...@@ -401,27 +401,27 @@ static int mixer_get(int d)
} }
#define update_volm(a,b) \ #define update_volm(a,b) \
isa_writew((dev.left_levels[a] >> 1) * \ writew((dev.left_levels[a] >> 1) * \
isa_readw(dev.SMA + SMA_wCurrMastVolLeft) / 0xffff, \ readw(dev.SMA + SMA_wCurrMastVolLeft) / 0xffff, \
dev.SMA + SMA_##b##Left); \ dev.SMA + SMA_##b##Left); \
isa_writew((dev.right_levels[a] >> 1) * \ writew((dev.right_levels[a] >> 1) * \
isa_readw(dev.SMA + SMA_wCurrMastVolRight) / 0xffff, \ readw(dev.SMA + SMA_wCurrMastVolRight) / 0xffff, \
dev.SMA + SMA_##b##Right); dev.SMA + SMA_##b##Right);
#define update_potm(d,s,ar) \ #define update_potm(d,s,ar) \
isa_writeb((dev.left_levels[d] >> 8) * \ writeb((dev.left_levels[d] >> 8) * \
isa_readw(dev.SMA + SMA_wCurrMastVolLeft) / 0xffff, \ readw(dev.SMA + SMA_wCurrMastVolLeft) / 0xffff, \
dev.SMA + SMA_##s##Left); \ dev.SMA + SMA_##s##Left); \
isa_writeb((dev.right_levels[d] >> 8) * \ writeb((dev.right_levels[d] >> 8) * \
isa_readw(dev.SMA + SMA_wCurrMastVolRight) / 0xffff, \ readw(dev.SMA + SMA_wCurrMastVolRight) / 0xffff, \
dev.SMA + SMA_##s##Right); \ dev.SMA + SMA_##s##Right); \
if (msnd_send_word(&dev, 0, 0, ar) == 0) \ if (msnd_send_word(&dev, 0, 0, ar) == 0) \
chk_send_dsp_cmd(&dev, HDEX_AUX_REQ); chk_send_dsp_cmd(&dev, HDEX_AUX_REQ);
#define update_pot(d,s,ar) \ #define update_pot(d,s,ar) \
isa_writeb(dev.left_levels[d] >> 8, \ writeb(dev.left_levels[d] >> 8, \
dev.SMA + SMA_##s##Left); \ dev.SMA + SMA_##s##Left); \
isa_writeb(dev.right_levels[d] >> 8, \ writeb(dev.right_levels[d] >> 8, \
dev.SMA + SMA_##s##Right); \ dev.SMA + SMA_##s##Right); \
if (msnd_send_word(&dev, 0, 0, ar) == 0) \ if (msnd_send_word(&dev, 0, 0, ar) == 0) \
chk_send_dsp_cmd(&dev, HDEX_AUX_REQ); chk_send_dsp_cmd(&dev, HDEX_AUX_REQ);
...@@ -450,23 +450,23 @@ static int mixer_set(int d, int value) ...@@ -450,23 +450,23 @@ static int mixer_set(int d, int value)
/* master volume unscaled controls */ /* master volume unscaled controls */
case SOUND_MIXER_LINE: /* line pot control */ case SOUND_MIXER_LINE: /* line pot control */
/* scaled by IMIX in digital mix */ /* scaled by IMIX in digital mix */
isa_writeb(bLeft, dev.SMA + SMA_bInPotPosLeft); writeb(bLeft, dev.SMA + SMA_bInPotPosLeft);
isa_writeb(bRight, dev.SMA + SMA_bInPotPosRight); writeb(bRight, dev.SMA + SMA_bInPotPosRight);
if (msnd_send_word(&dev, 0, 0, HDEXAR_IN_SET_POTS) == 0) if (msnd_send_word(&dev, 0, 0, HDEXAR_IN_SET_POTS) == 0)
chk_send_dsp_cmd(&dev, HDEX_AUX_REQ); chk_send_dsp_cmd(&dev, HDEX_AUX_REQ);
break; break;
#ifndef MSND_CLASSIC #ifndef MSND_CLASSIC
case SOUND_MIXER_MIC: /* mic pot control */ case SOUND_MIXER_MIC: /* mic pot control */
/* scaled by IMIX in digital mix */ /* scaled by IMIX in digital mix */
isa_writeb(bLeft, dev.SMA + SMA_bMicPotPosLeft); writeb(bLeft, dev.SMA + SMA_bMicPotPosLeft);
isa_writeb(bRight, dev.SMA + SMA_bMicPotPosRight); writeb(bRight, dev.SMA + SMA_bMicPotPosRight);
if (msnd_send_word(&dev, 0, 0, HDEXAR_MIC_SET_POTS) == 0) if (msnd_send_word(&dev, 0, 0, HDEXAR_MIC_SET_POTS) == 0)
chk_send_dsp_cmd(&dev, HDEX_AUX_REQ); chk_send_dsp_cmd(&dev, HDEX_AUX_REQ);
break; break;
#endif #endif
case SOUND_MIXER_VOLUME: /* master volume */ case SOUND_MIXER_VOLUME: /* master volume */
isa_writew(wLeft, dev.SMA + SMA_wCurrMastVolLeft); writew(wLeft, dev.SMA + SMA_wCurrMastVolLeft);
isa_writew(wRight, dev.SMA + SMA_wCurrMastVolRight); writew(wRight, dev.SMA + SMA_wCurrMastVolRight);
/* fall through */ /* fall through */
case SOUND_MIXER_LINE1: /* aux pot control */ case SOUND_MIXER_LINE1: /* aux pot control */
...@@ -815,25 +815,25 @@ static __inline__ int pack_DARQ_to_DARF(register int bank) ...@@ -815,25 +815,25 @@ static __inline__ int pack_DARQ_to_DARF(register int bank)
LPDAQD DAQD; LPDAQD DAQD;
/* Increment the tail and check for queue wrap */ /* Increment the tail and check for queue wrap */
wTmp = isa_readw(dev.DARQ + JQS_wTail) + PCTODSP_OFFSET(DAQDS__size); wTmp = readw(dev.DARQ + JQS_wTail) + PCTODSP_OFFSET(DAQDS__size);
if (wTmp > isa_readw(dev.DARQ + JQS_wSize)) if (wTmp > readw(dev.DARQ + JQS_wSize))
wTmp = 0; wTmp = 0;
while (wTmp == isa_readw(dev.DARQ + JQS_wHead) && timeout--) while (wTmp == readw(dev.DARQ + JQS_wHead) && timeout--)
udelay(1); udelay(1);
isa_writew(wTmp, dev.DARQ + JQS_wTail); writew(wTmp, dev.DARQ + JQS_wTail);
/* Get our digital audio queue struct */ /* Get our digital audio queue struct */
DAQD = bank * DAQDS__size + dev.base + DARQ_DATA_BUFF; DAQD = bank * DAQDS__size + dev.base + DARQ_DATA_BUFF;
/* Get length of data */ /* Get length of data */
size = isa_readw(DAQD + DAQDS_wSize); size = readw(DAQD + DAQDS_wSize);
/* Read data from the head (unprotected bank 1 access okay /* Read data from the head (unprotected bank 1 access okay
since this is only called inside an interrupt) */ since this is only called inside an interrupt) */
msnd_outb(HPBLKSEL_1, dev.io + HP_BLKS); msnd_outb(HPBLKSEL_1, dev.io + HP_BLKS);
msnd_fifo_write( msnd_fifo_write_io(
&dev.DARF, &dev.DARF,
(char *)(dev.base + bank * DAR_BUFF_SIZE), dev.base + bank * DAR_BUFF_SIZE,
size); size);
msnd_outb(HPBLKSEL_0, dev.io + HP_BLKS); msnd_outb(HPBLKSEL_0, dev.io + HP_BLKS);
...@@ -846,8 +846,8 @@ static __inline__ int pack_DAPF_to_DAPQ(register int start) ...@@ -846,8 +846,8 @@ static __inline__ int pack_DAPF_to_DAPQ(register int start)
register int protect = start, nbanks = 0; register int protect = start, nbanks = 0;
LPDAQD DAQD; LPDAQD DAQD;
DAPQ_tail = isa_readw(dev.DAPQ + JQS_wTail); DAPQ_tail = readw(dev.DAPQ + JQS_wTail);
while (DAPQ_tail != isa_readw(dev.DAPQ + JQS_wHead) || start) { while (DAPQ_tail != readw(dev.DAPQ + JQS_wHead) || start) {
register int bank_num = DAPQ_tail / PCTODSP_OFFSET(DAQDS__size); register int bank_num = DAPQ_tail / PCTODSP_OFFSET(DAQDS__size);
register int n; register int n;
unsigned long flags; unsigned long flags;
...@@ -856,15 +856,15 @@ static __inline__ int pack_DAPF_to_DAPQ(register int start) ...@@ -856,15 +856,15 @@ static __inline__ int pack_DAPF_to_DAPQ(register int start)
if (protect) { if (protect) {
/* Critical section: protect fifo in non-interrupt */ /* Critical section: protect fifo in non-interrupt */
spin_lock_irqsave(&dev.lock, flags); spin_lock_irqsave(&dev.lock, flags);
n = msnd_fifo_read( n = msnd_fifo_read_io(
&dev.DAPF, &dev.DAPF,
(char *)(dev.base + bank_num * DAP_BUFF_SIZE), dev.base + bank_num * DAP_BUFF_SIZE,
DAP_BUFF_SIZE); DAP_BUFF_SIZE);
spin_unlock_irqrestore(&dev.lock, flags); spin_unlock_irqrestore(&dev.lock, flags);
} else { } else {
n = msnd_fifo_read( n = msnd_fifo_read_io(
&dev.DAPF, &dev.DAPF,
(char *)(dev.base + bank_num * DAP_BUFF_SIZE), dev.base + bank_num * DAP_BUFF_SIZE,
DAP_BUFF_SIZE); DAP_BUFF_SIZE);
} }
if (!n) if (!n)
...@@ -877,12 +877,12 @@ static __inline__ int pack_DAPF_to_DAPQ(register int start) ...@@ -877,12 +877,12 @@ static __inline__ int pack_DAPF_to_DAPQ(register int start)
DAQD = bank_num * DAQDS__size + dev.base + DAPQ_DATA_BUFF; DAQD = bank_num * DAQDS__size + dev.base + DAPQ_DATA_BUFF;
/* Write size of this bank */ /* Write size of this bank */
isa_writew(n, DAQD + DAQDS_wSize); writew(n, DAQD + DAQDS_wSize);
++nbanks; ++nbanks;
/* Then advance the tail */ /* Then advance the tail */
DAPQ_tail = (++bank_num % 3) * PCTODSP_OFFSET(DAQDS__size); DAPQ_tail = (++bank_num % 3) * PCTODSP_OFFSET(DAQDS__size);
isa_writew(DAPQ_tail, dev.DAPQ + JQS_wTail); writew(DAPQ_tail, dev.DAPQ + JQS_wTail);
/* Tell the DSP to play the bank */ /* Tell the DSP to play the bank */
msnd_send_dsp_cmd(&dev, HDEX_PLAY_START); msnd_send_dsp_cmd(&dev, HDEX_PLAY_START);
} }
...@@ -1094,15 +1094,15 @@ static irqreturn_t intr(int irq, void *dev_id, struct pt_regs *regs) ...@@ -1094,15 +1094,15 @@ static irqreturn_t intr(int irq, void *dev_id, struct pt_regs *regs)
msnd_inb(dev.io + HP_RXL); msnd_inb(dev.io + HP_RXL);
/* Evaluate queued DSP messages */ /* Evaluate queued DSP messages */
while (isa_readw(dev.DSPQ + JQS_wTail) != isa_readw(dev.DSPQ + JQS_wHead)) { while (readw(dev.DSPQ + JQS_wTail) != readw(dev.DSPQ + JQS_wHead)) {
register WORD wTmp; register WORD wTmp;
eval_dsp_msg(isa_readw(dev.pwDSPQData + 2*isa_readw(dev.DSPQ + JQS_wHead))); eval_dsp_msg(readw(dev.pwDSPQData + 2*readw(dev.DSPQ + JQS_wHead)));
if ((wTmp = isa_readw(dev.DSPQ + JQS_wHead) + 1) > isa_readw(dev.DSPQ + JQS_wSize)) if ((wTmp = readw(dev.DSPQ + JQS_wHead) + 1) > readw(dev.DSPQ + JQS_wSize))
isa_writew(0, dev.DSPQ + JQS_wHead); writew(0, dev.DSPQ + JQS_wHead);
else else
isa_writew(wTmp, dev.DSPQ + JQS_wHead); writew(wTmp, dev.DSPQ + JQS_wHead);
} }
return IRQ_HANDLED; return IRQ_HANDLED;
} }
...@@ -1182,7 +1182,7 @@ static int __init probe_multisound(void) ...@@ -1182,7 +1182,7 @@ static int __init probe_multisound(void)
} }
printk(KERN_INFO LOGNAME ": %s revision %s, Xilinx version %s, " printk(KERN_INFO LOGNAME ": %s revision %s, Xilinx version %s, "
#endif /* MSND_CLASSIC */ #endif /* MSND_CLASSIC */
"I/O 0x%x-0x%x, IRQ %d, memory mapped to 0x%lX-0x%lX\n", "I/O 0x%x-0x%x, IRQ %d, memory mapped to %p-%p\n",
dev.name, dev.name,
#ifndef MSND_CLASSIC #ifndef MSND_CLASSIC
rev, xv, rev, xv,
...@@ -1206,16 +1206,16 @@ static int init_sma(void) ...@@ -1206,16 +1206,16 @@ static int init_sma(void)
#endif #endif
msnd_outb(HPBLKSEL_0, dev.io + HP_BLKS); msnd_outb(HPBLKSEL_0, dev.io + HP_BLKS);
if (initted) { if (initted) {
mastVolLeft = isa_readw(dev.SMA + SMA_wCurrMastVolLeft); mastVolLeft = readw(dev.SMA + SMA_wCurrMastVolLeft);
mastVolRight = isa_readw(dev.SMA + SMA_wCurrMastVolRight); mastVolRight = readw(dev.SMA + SMA_wCurrMastVolRight);
} else } else
mastVolLeft = mastVolRight = 0; mastVolLeft = mastVolRight = 0;
isa_memset_io(dev.base, 0, 0x8000); memset_io(dev.base, 0, 0x8000);
/* Critical section: bank 1 access */ /* Critical section: bank 1 access */
spin_lock_irqsave(&dev.lock, flags); spin_lock_irqsave(&dev.lock, flags);
msnd_outb(HPBLKSEL_1, dev.io + HP_BLKS); msnd_outb(HPBLKSEL_1, dev.io + HP_BLKS);
isa_memset_io(dev.base, 0, 0x8000); memset_io(dev.base, 0, 0x8000);
msnd_outb(HPBLKSEL_0, dev.io + HP_BLKS); msnd_outb(HPBLKSEL_0, dev.io + HP_BLKS);
spin_unlock_irqrestore(&dev.lock, flags); spin_unlock_irqrestore(&dev.lock, flags);
...@@ -1248,19 +1248,19 @@ static int init_sma(void) ...@@ -1248,19 +1248,19 @@ static int init_sma(void)
/* Setup some DSP values */ /* Setup some DSP values */
#ifndef MSND_CLASSIC #ifndef MSND_CLASSIC
isa_writew(1, dev.SMA + SMA_wCurrPlayFormat); writew(1, dev.SMA + SMA_wCurrPlayFormat);
isa_writew(dev.play_sample_size, dev.SMA + SMA_wCurrPlaySampleSize); writew(dev.play_sample_size, dev.SMA + SMA_wCurrPlaySampleSize);
isa_writew(dev.play_channels, dev.SMA + SMA_wCurrPlayChannels); writew(dev.play_channels, dev.SMA + SMA_wCurrPlayChannels);
isa_writew(dev.play_sample_rate, dev.SMA + SMA_wCurrPlaySampleRate); writew(dev.play_sample_rate, dev.SMA + SMA_wCurrPlaySampleRate);
#endif #endif
isa_writew(dev.play_sample_rate, dev.SMA + SMA_wCalFreqAtoD); writew(dev.play_sample_rate, dev.SMA + SMA_wCalFreqAtoD);
isa_writew(mastVolLeft, dev.SMA + SMA_wCurrMastVolLeft); writew(mastVolLeft, dev.SMA + SMA_wCurrMastVolLeft);
isa_writew(mastVolRight, dev.SMA + SMA_wCurrMastVolRight); writew(mastVolRight, dev.SMA + SMA_wCurrMastVolRight);
#ifndef MSND_CLASSIC #ifndef MSND_CLASSIC
isa_writel(0x00010000, dev.SMA + SMA_dwCurrPlayPitch); writel(0x00010000, dev.SMA + SMA_dwCurrPlayPitch);
isa_writel(0x00000001, dev.SMA + SMA_dwCurrPlayRate); writel(0x00000001, dev.SMA + SMA_dwCurrPlayRate);
#endif #endif
isa_writew(0x303, dev.SMA + SMA_wCurrInputTagBits); writew(0x303, dev.SMA + SMA_wCurrInputTagBits);
initted = 1; initted = 1;
...@@ -1269,12 +1269,12 @@ static int init_sma(void) ...@@ -1269,12 +1269,12 @@ static int init_sma(void)
static int __init calibrate_adc(WORD srate) static int __init calibrate_adc(WORD srate)
{ {
isa_writew(srate, dev.SMA + SMA_wCalFreqAtoD); writew(srate, dev.SMA + SMA_wCalFreqAtoD);
if (dev.calibrate_signal == 0) if (dev.calibrate_signal == 0)
isa_writew(isa_readw(dev.SMA + SMA_wCurrHostStatusFlags) writew(readw(dev.SMA + SMA_wCurrHostStatusFlags)
| 0x0001, dev.SMA + SMA_wCurrHostStatusFlags); | 0x0001, dev.SMA + SMA_wCurrHostStatusFlags);
else else
isa_writew(isa_readw(dev.SMA + SMA_wCurrHostStatusFlags) writew(readw(dev.SMA + SMA_wCurrHostStatusFlags)
& ~0x0001, dev.SMA + SMA_wCurrHostStatusFlags); & ~0x0001, dev.SMA + SMA_wCurrHostStatusFlags);
if (msnd_send_word(&dev, 0, 0, HDEXAR_CAL_A_TO_D) == 0 && if (msnd_send_word(&dev, 0, 0, HDEXAR_CAL_A_TO_D) == 0 &&
chk_send_dsp_cmd(&dev, HDEX_AUX_REQ) == 0) { chk_send_dsp_cmd(&dev, HDEX_AUX_REQ) == 0) {
...@@ -1304,7 +1304,7 @@ static int upload_dsp_code(void) ...@@ -1304,7 +1304,7 @@ static int upload_dsp_code(void)
return -EBUSY; return -EBUSY;
} }
#endif #endif
isa_memcpy_toio(dev.base, PERMCODE, PERMCODESIZE); memcpy_toio(dev.base, PERMCODE, PERMCODESIZE);
if (msnd_upload_host(&dev, INITCODE, INITCODESIZE) < 0) { if (msnd_upload_host(&dev, INITCODE, INITCODESIZE) < 0) {
printk(KERN_WARNING LOGNAME ": Error uploading to DSP\n"); printk(KERN_WARNING LOGNAME ": Error uploading to DSP\n");
return -ENODEV; return -ENODEV;
...@@ -1357,7 +1357,7 @@ static int initialize(void) ...@@ -1357,7 +1357,7 @@ static int initialize(void)
} }
timeout = 200; timeout = 200;
while (isa_readw(dev.base)) { while (readw(dev.base)) {
mdelay(1); mdelay(1);
if (!timeout--) { if (!timeout--) {
printk(KERN_DEBUG LOGNAME ": DSP reset timeout\n"); printk(KERN_DEBUG LOGNAME ": DSP reset timeout\n");
...@@ -1861,7 +1861,7 @@ static int __init msnd_init(void) ...@@ -1861,7 +1861,7 @@ static int __init msnd_init(void)
dev.io = io; dev.io = io;
dev.numio = DSP_NUMIO; dev.numio = DSP_NUMIO;
dev.irq = irq; dev.irq = irq;
dev.base = mem; dev.base = ioremap(mem, 0x8000);
dev.fifosize = fifosize * 1024; dev.fifosize = fifosize * 1024;
dev.calibrate_signal = calibrate_signal ? 1 : 0; dev.calibrate_signal = calibrate_signal ? 1 : 0;
dev.recsrc = 0; dev.recsrc = 0;
......
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