Page 1 of 1

DMA ...

Posted: Sat Aug 30, 2008 8:46 am
by kmtdk
Hello
I have startede to make a dma driver.
but i got one 1 question:
how to map the device to a dma chanel, do i have a "list" to go forward, or how do i do that ?
( by saying "list" i mean the defaults, an exempel : soundblaster is normaly located at chanel 1, floppy 2. )

KMT dk

Re: DMA ...

Posted: Sat Aug 30, 2008 12:55 pm
by Brendan
Hi,
kmtdk wrote:how to map the device to a dma chanel, do i have a "list" to go forward, or how do i do that ?
( by saying "list" i mean the defaults, an exempel : soundblaster is normaly located at chanel 1, floppy 2. )
How do you solve the same problem for I/O ports and IRQs?

I was going to write a lot of stuff about resource detection (using ACPI, PCI, ISA Plug & Play, manual probing, configuration files, etc to determine I/O ports, IRQs, memory mapped I/O areas in the physical address space, DMA channels), but then I thought about it and started wondering why you care if all you're doing is writing a driver for the ISA DMA controller...

Basically there's only 2 ways of doing it:
  • a) the kernel trusts the drivers and the drivers figure out what they need access to. In this case any driver can ask for access to any DMA channel (as long as the DMA channel isn't already in use by something else).
    b) the kernel doesn't trust the drivers. In this case the kernel (or something acting on behalf of the kernel that the kernel does trust) needs to find out which DMA channels a driver is allowed to access; and the DMA driver just asks the kernel if someone is allowed to access the DMA channel or not.
In both of these cases, the DMA driver itself doesn't need to determine who can access which DMA channels. Or to put it another way: the OS's security policies are implemented at a higher level, and it's these security policies (or the lack of security policies in some cases) that determine who can and can't use each DMA channel (and potentially, which physical address ranges they can access via. DMA transfers if they do have permission to use DMA channels).


Cheers,

Brendan

Re: DMA ...

Posted: Sat Aug 30, 2008 3:24 pm
by Combuster
...now if the IOMMU was standard issue... :wink:

Re: DMA ...

Posted: Sun Aug 31, 2008 12:39 am
by bewing
In the very olden days, some boards had to be specifically jumpered for a particular DMA channel -- but even then, it only took 2 jumpers to select any 8 bit, or alternatively any 16 bit DMA channel (depending on the card type).