Does memory for DMA transfer have to be uncacheable?

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
Sam Palmer

Does memory for DMA transfer have to be uncacheable?

Post by Sam Palmer »

I try to make an ide driver for my os (so far very unsuccefull)... Now I have questions about caching, does the Physical Region Descriptor Table have to be uncachable (I guess so?...) And furthermore - can it be nescessary to make the data for transfer uncachable too?? I have made a memory cache for disk blocks so the blocks in the memory cache have not been touched for a while when I do the transfer...

Please HELP!!!
Tim

Re:Does memory for DMA transfer have to be uncacheable?

Post by Tim »

The x86 chipset guarantees cache coherency between the CPU and external devices. So you don't need to worry about cacheing when you're using DMA. Where cacheing does matter is with memory-mapped devices, such as the video card.

It's easier to use PIO when writing your own IDE driver. It may slower, but at least every controller supports PIO the same way. IDE DMA is implemented different ways on different controllers.
mystran

Re:Does memory for DMA transfer have to be uncacheable?

Post by mystran »

Futher, I'd say that build a PIO driver first, then add a DMA driver when/if you need more speed, so you can use that with device that support it. That way you'll always have the PIO driver too, and you'll be able to fall back to it when your DMA driver doesn't work with some chipset. You won't need that speed anyway, before you have some applications to run that benefit from it..
Post Reply