Sound Support diffs for Alpha under 1.3.36

Jay Estabrook - Alpha Migration Tools - LINUX Project (jestabro@brillig.amt.tay1.dec.com)
Fri, 27 Oct 95 15:46:09 -0400


OK, here they are. With these in place, the SoundBlaster 16 support built
fine (a few warnings... :-), and works *GREAT* with Maelstrom!!! Thanks for
building that with the sound activated... :-)

And *MANY* kudos to Hannu for the 3.5 set of drivers! I had started with the
3.0 version (in 1.3.30), and it looked like a *lot* of work, especially in
the "ioctl" area, would be needed. Not so in 3.5, that was *all* fixed! As
you all can see, my actual changes are *trivial* in comparison to what was
changed between 3.0 and 3.5...

I'm pretty sure these won't break anything else, and are either generic or
involve *only* Alpha code, but please check them out.

Two concerns:

1. I put the IOC_IN/OUT/INOUT/etc stuff into the system's ioctl.h file;
this might be over-reacting, but other packages may need/expect the
same macros as the sound driver/apps do, so... ???

2. MAX_DMA_ADDRESS for the Alpha is set to KSEG 16Mb (0xfffffc0001000000UL),
even though some/most/all of the platforms seem to allow 32-bit DMA
addresses. This was simply a precautionary measure... :-)

Anyway, any and all feedback appreciated.

David, *please* don't neglect your other work when you get the SB16 this
weekend... :-) :-)

--Jay++

-------------------------------------------------------------------------------
American Non Sequitur Society: we don't make sense, but we do like pizza...

Jay A Estabrook Alpha Migration Tools
Mailstop: TAY1-2 (DTN) 227-4202
Digital Equipment Corp. (external) (508) 952-4202
151 Taylor Street enet: jestabro@amt.tay1.dec.com
Littleton, MA 01460-1407 decnet: tallis::jestabro
-------------------------------------------------------------------------------

diff -u --recursive master/arch/alpha/mm/init.c sound/arch/alpha/mm/init.c
--- master/arch/alpha/mm/init.c Tue Sep 19 09:15:27 1995
+++ sound/arch/alpha/mm/init.c Thu Oct 26 23:44:39 1995
@@ -22,7 +22,6 @@
#include <asm/hwrpb.h>

extern void scsi_mem_init(unsigned long);
-extern void sound_mem_init(void);
extern void die_if_kernel(char *,struct pt_regs *,long);
extern void show_net_buffers(void);

@@ -165,9 +164,6 @@

#ifdef CONFIG_SCSI
scsi_mem_init(high_memory);
-#endif
-#ifdef CONFIG_SOUND
- sound_mem_init();
#endif

for (tmp = PAGE_OFFSET ; tmp < high_memory ; tmp += PAGE_SIZE) {
diff -u --recursive master/drivers/sound/audio.c sound/drivers/sound/audio.c
--- master/drivers/sound/audio.c Wed Oct 18 03:33:24 1995
+++ sound/drivers/sound/audio.c Thu Oct 26 23:48:34 1995
@@ -154,6 +154,20 @@
DMAbuf_release (dev, mode);
}

+#if !defined(i386)
+static void
+translate_bytes (const unsigned char *table, unsigned char *buff, int n)
+{
+ unsigned long i;
+
+ if (n <= 0)
+ return;
+
+ for (i = 0; i < n; ++i)
+ buff[i] = table[buff[i]];
+}
+
+#else
extern inline void
translate_bytes (const void *table, void *buff, int n)
{
@@ -168,7 +182,7 @@
: "bx", "cx", "di", "si", "ax");
}
}
-
+#endif

int
audio_write (int dev, struct fileinfo *file, const snd_rw_buf * buf, int count)
@@ -248,7 +262,7 @@
/*
* This just allows interrupts while the conversion is running
*/
- __asm__ ("sti");
+ sti();
translate_bytes (ulaw_dsp, (unsigned char *) &wr_dma_buf[dev][wr_buff_ptr[dev]], l);
}

@@ -323,7 +337,7 @@
/*
* This just allows interrupts while the conversion is running
*/
- __asm__ ("sti");
+ sti();

translate_bytes (dsp_ulaw, (unsigned char *) dmabuf, l);
}
diff -u --recursive master/drivers/sound/sequencer.c sound/drivers/sound/sequencer.c
--- master/drivers/sound/sequencer.c Wed Oct 18 03:33:27 1995
+++ sound/drivers/sound/sequencer.c Thu Oct 26 23:51:18 1995
@@ -2101,7 +2101,7 @@
}

int
-sequencer_write (int dev, struct fileinfo *file, snd_rw_buf * buf, int count)
+sequencer_write (int dev, struct fileinfo *file, const snd_rw_buf * buf, int count)
{
return -EIO;
}
@@ -2118,7 +2118,7 @@
}
int
sequencer_ioctl (int dev, struct fileinfo *file,
- unsigned int cmd, unsigned int arg)
+ unsigned int cmd, ioctl_arg arg)
{
return -EIO;
}
diff -u --recursive master/drivers/sound/soundcard.c sound/drivers/sound/soundcard.c
--- master/drivers/sound/soundcard.c Wed Oct 18 03:36:05 1995
+++ sound/drivers/sound/soundcard.c Thu Oct 26 23:53:25 1995
@@ -667,7 +667,7 @@

if (((long) start_addr & ~(dma_pagesize - 1))
!= ((long) end_addr & ~(dma_pagesize - 1))
- || end_addr >= (char *) (16 * 1024 * 1024))
+ || end_addr >= (char *) MAX_DMA_ADDRESS)
{
printk (
"sound: kmalloc returned invalid address 0x%lx for %ld Bytes DMA-buffer\n",
@@ -677,7 +677,7 @@
}
}
dmap->raw_buf = start_addr;
- dmap->raw_buf_phys = (unsigned long) start_addr;
+ dmap->raw_buf_phys = virt_to_bus((unsigned long) start_addr);

for (i = MAP_NR (start_addr); i <= MAP_NR (end_addr); i++)
{
diff -u --recursive master/include/asm-alpha/dma.h sound/include/asm-alpha/dma.h
--- master/include/asm-alpha/dma.h Tue Aug 1 07:02:44 1995
+++ sound/include/asm-alpha/dma.h Thu Oct 26 23:44:07 1995
@@ -74,7 +74,8 @@
#define MAX_DMA_CHANNELS 8

/* The maximum address that we can perform a DMA transfer to on this platform */
-#define MAX_DMA_ADDRESS (~0UL)
+/* for now, assume the worst, and set to KSEG (physical) 16Mb */
+#define MAX_DMA_ADDRESS (0xfffffc0001000000UL)

/* 8237 DMA controllers */
#define IO_DMA1_BASE 0x00 /* 8 bit slave DMA, channels 0..3 */
diff -u --recursive master/include/asm-alpha/ioctl.h sound/include/asm-alpha/ioctl.h
--- master/include/asm-alpha/ioctl.h Fri Jun 2 10:51:16 1995
+++ sound/include/asm-alpha/ioctl.h Thu Oct 26 23:44:07 1995
@@ -54,4 +54,12 @@
#define _IOC_NR(nr) (((nr) >> _IOC_NRSHIFT) & _IOC_NRMASK)
#define _IOC_SIZE(nr) (((nr) >> _IOC_SIZESHIFT) & _IOC_SIZEMASK)

+/* ...and for the drivers/sound files... */
+
+#define IOC_IN (_IOC_WRITE << _IOC_DIRSHIFT)
+#define IOC_OUT (_IOC_READ << _IOC_DIRSHIFT)
+#define IOC_INOUT ((_IOC_WRITE|_IOC_READ) << _IOC_DIRSHIFT)
+#define IOCSIZE_MASK (_IOC_SIZEMASK << _IOC_SIZESHIFT)
+#define IOCSIZE_SHIFT (_IOC_SIZESHIFT)
+
#endif