Skip to contentSkip to conversation

Doing DMA with the ide-driver

DISCUSSION Erik Niessen 2 participants 2 messages Jul 6, 2000 MIPS

lore
Share & tools
lore
#0 lore raw

Hello,

I am trying to get an external ide-pci controller (CMD 646) working on an embedded mips board. The kernel-source is based on a 2.2.12 source tree.

The problem is doing DMA. I receive address (0x80ff0000) for my dmatable in the function ide_setup_dma (__get_free_pages). Then in ide_buildtable it sets up the dmatable. Address 0x80376000 and a count of 0x400 (check_partition reads 2 sectors from the harddrive). These are all virtual addresses. For setting up the dmatable I use physical addresses. On the embedded board there is a 1:1 map of i/o bus to main memory so platform_mem_iobus_base is 0.

So after doing the DMA read, I read only zero's at address 0x80376000 and the kernel hangs. But the harddrive is ready and I can't find any errors. It seems that it writes the data to a different memory location. After searching the memory the data is written at address 0x80000000?? Is the memory manager somewhere in between???

The next thing I did was reserving a piece of physical memory for DMA and fill in the dmatable myself. So that it uses my piece of reserved memory. After I did this, the data was at the correct address and the kernel didn't crash. Is this the solution???

Anyone a clue?

Thanks,

Erik

________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com

#1 lore raw
Quoted 17 lines · Erik Niessen

I am trying to get an external ide-pci controller (CMD 646) working on an embedded mips board. The kernel-source is based on a 2.2.12 source tree.

The problem is doing DMA. I receive address (0x80ff0000) for my dmatable in the function ide_setup_dma (__get_free_pages). Then in ide_buildtable it sets up the dmatable. Address 0x80376000 and a count of 0x400 (check_partition reads 2 sectors from the harddrive). These are all virtual addresses. For setting up the dmatable I use physical addresses. On the embedded board there is a 1:1 map of i/o bus to main memory so platform_mem_iobus_base is 0.

So after doing the DMA read, I read only zero's at address 0x80376000 and the kernel hangs. But the harddrive is ready and I can't find any errors. It seems that it writes the data to a different memory location. After searching the memory the data is written at address 0x80000000?? Is the memory manager somewhere in between???

Quoted 4 lines

The next thing I did was reserving a piece of physical memory for DMA and fill in the dmatable myself. So that it uses my piece of reserved memory. After I did this, the data was at the correct address and the kernel didn't crash. Is this the solution???

What you're observing can be explained by caches not being flushed properly. What kernel versions are you using?

Ralf