Sorry if this has been answered somewhere but
I know that DMA is supposed to be within first 16MB right? I am now in the process of writing a mm and want to have an option to allocate memory suitable for DMA operations. But it's a bit gray area for me at the moment.
does DMA memory has to be allocated withing physical 16MB? or it doesn't matter as long as it mapped < 0x1000000 on the virtual address space?
question about DMA addressing
Re: question about DMA addressing
ISA DMA must be within the first 16M of physical memory. But there are other kinds of DMA. Most Busmastering DMA must be within the first 4G of physical memory. No DMA can use virtual memory -- only the CPU uses virtual memory.
- Combuster
- Member
- Posts: 9301
- Joined: Wed Oct 18, 2006 3:45 am
- Libera.chat IRC: [com]buster
- Location: On the balcony, where I can actually keep 1½m distance
- Contact:
Re: question about DMA addressing
From the DMA's point of view, there is no memory translation like paging or segmentation, so it sees 16MB of memory exactly the way it is: 640k of normal memory followed by video memory and bios, another 14M of memory, and the ISA hole should it be there. Whatever cheats you tell the processor to play on the applications do *not* apply for DMA.
Hence you need to allocate a stretch of *physical* memory as a DMA buffer. Then you can map portions of it anywhere into the address space if that is deemed necessary, but you don't need to do so.
Edit: beaten to the point
Hence you need to allocate a stretch of *physical* memory as a DMA buffer. Then you can map portions of it anywhere into the address space if that is deemed necessary, but you don't need to do so.
Edit: beaten to the point
Re: question about DMA addressing
Hi,
For the 8-bit channels, you can't cross a 64 KiB boundary (e.g. you can't do a DMA transfer of 512 bytes from 0x0000FF00 to 0x000100FF), and you can't transfer more than 64 KiB in one go.
For the 16-bit channels I'm not sure (it's been a while). In theory I think the DMA controller itself will handle 128 KiB transfers (or 65536 words), but the "DMA page" part of it (which was implemented as a separate chip originally) might mess it up and cause it to wrap around, so that the second 64 KiB overwrites the first 64 KiB.
[EDIT] Ok, I was wrong about 16-bit DMA transfers - they can transfer 128 KiB of data and can't cross 128 KiB boundaries. I also found a good source of information, um, here... [/EDIT]
Cheers,
Brendan
Yes, but there's a few more restrictions for ISA DMA.albeva wrote:does DMA memory has to be allocated withing physical 16MB?
For the 8-bit channels, you can't cross a 64 KiB boundary (e.g. you can't do a DMA transfer of 512 bytes from 0x0000FF00 to 0x000100FF), and you can't transfer more than 64 KiB in one go.
For the 16-bit channels I'm not sure (it's been a while). In theory I think the DMA controller itself will handle 128 KiB transfers (or 65536 words), but the "DMA page" part of it (which was implemented as a separate chip originally) might mess it up and cause it to wrap around, so that the second 64 KiB overwrites the first 64 KiB.
[EDIT] Ok, I was wrong about 16-bit DMA transfers - they can transfer 128 KiB of data and can't cross 128 KiB boundaries. I also found a good source of information, um, here... [/EDIT]
Cheers,
Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
Re: question about DMA addressing
thanks guys. I found wiki page about it too. DMA seems such a mess...