2000-12-15 18:26:28

by Anders Torger

[permalink] [raw]
Subject: mmap'ing IO memory on i386


I'm writing an ALSA sound card driver, for a card that does not support DMA,
thus the CPU need to do the copying to and from the onboard buffer. ALSA
allows for optional mmap'd access, that is accessing the in memory dma buffer
directly from user space. However, for this card that does not support DMA,
it would be best to mmap its IO memory directly, this way I get rid of a copy
in the interrupt handler to an intermediate kernel buffer. This should be
possible on the i386 as far as I know.

I use a 2.2.14 kernel, and ioremap (also tested ioremap_nocache) to relocate
the IO memory. In kernel space it works fine to access the ioremap'd area
just like any other kernel buffer. However, when the ioremap'd area is mmap'd
from user space, problems occur. In user space: when the memory is read, all
bytes are always 0xFF, and when written to, nothing happens (the memory being
on the sound card is unchanged).

I have two questions: (1) why is this happening? (2) is it possible to make
it work?

Please reply to my address directly, since I'm not on the mailing list.

/Anders Torger