* mips ide disk dma problem
@ 2001-08-13 13:07 Barry Wu
2001-08-13 19:38 ` Tommy S. Christensen
0 siblings, 1 reply; 5+ messages in thread
From: Barry Wu @ 2001-08-13 13:07 UTC (permalink / raw)
To: linux-mips
Hi, all,
I meet problems about mips ide disk. I find dma mode
is different from other platform. We have to use
dma_cache_wback_inv and vtonocache functions to work
under DMA mode, I read pcnet32 ethernet driver,
it works like that. I do not know if I have to support
ide disk dma, what I have to do?
I use Acerlab 1535D southbridge and M5229 IDE
controller. I patch 1535D driver to linux 2.2.12
kernel. Hard disk can work well using PIO mode.
But it is very slow on our mips evaluation board.
Therefore, if someone knows how and where to add
dma_cache_wback_inv, vtonocahce, something like these.
Please help me.
Thanks in advance!
Barry
__________________________________________________
Do You Yahoo!?
Send instant messages & get email alerts with Yahoo! Messenger.
http://im.yahoo.com/
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: mips ide disk dma problem
2001-08-13 13:07 mips ide disk dma problem Barry Wu
@ 2001-08-13 19:38 ` Tommy S. Christensen
2001-08-14 5:17 ` Ralf Baechle
0 siblings, 1 reply; 5+ messages in thread
From: Tommy S. Christensen @ 2001-08-13 19:38 UTC (permalink / raw)
To: Barry Wu; +Cc: linux-mips
Barry Wu wrote:
> I meet problems about mips ide disk. I find dma mode
> is different from other platform. We have to use
> dma_cache_wback_inv and vtonocache functions to work
> under DMA mode, I read pcnet32 ethernet driver,
> it works like that. I do not know if I have to support
> ide disk dma, what I have to do?
Some MIPS'ification is needed to handle the caches.
You can try the patch below to drivers/block/ide-dma.c.
I don't know about your IDE controller (our board have
a CMD PCI-648), but it may need some special handling also.
-Tommy
--- ide-dma.c.old Tue Aug 31 09:46:14 1999
+++ ide-dma.c Mon Aug 13 20:51:57 2001
@@ -176,6 +176,13 @@
#endif
unsigned int count = 0;
+#if defined(__mips__)
+ /* MIPS: We access the dmatable through uncached addresses, so that it
+ * will be read correctly by the controller. The alternative is to flush
+ * the appropriate range at the end of this procedure.
+ */
+ table = (unsigned int *)vtonocache(table);
+#endif
do {
/*
* Determine addr and size of next buffer area. We assume that
@@ -197,6 +204,10 @@
size += bh->b_size;
}
}
+#if defined(__mips__)
+ /* MIPS: We need to flush the cache */
+ dma_cache_wback_inv(bus_to_virt(addr), size);
+#endif
/*
* Fill in the dma table, without crossing any 64kB boundaries.
* Most hardware requires 16-bit alignment of all blocks,
@@ -401,6 +412,10 @@
dmatable += (PRD_ENTRIES * PRD_BYTES);
leftover -= (PRD_ENTRIES * PRD_BYTES);
hwif->dmaproc = &ide_dmaproc;
+#if defined(__mips__)
+ /* Make sure no part of the dmatable is in the cache */
+ dma_cache_wback_inv(hwif->dmatable, PRD_ENTRIES * PRD_BYTES);
+#endif
if (hwif->chipset != ide_trm290) {
byte dma_stat = inb(dma_base+2);
@@ -430,6 +445,9 @@
}
}
if (dma_base) {
+#if defined(__mips__)
+ dma_base = KSEG1ADDR(dma_base);
+#endif
if (extra) /* PDC20246 & HPT343 */
request_region(dma_base+16, extra, name);
dma_base += hwif->channel ? 8 : 0;
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: mips ide disk dma problem
2001-08-13 19:38 ` Tommy S. Christensen
@ 2001-08-14 5:17 ` Ralf Baechle
2001-08-14 8:12 ` Tommy S. Christensen
0 siblings, 1 reply; 5+ messages in thread
From: Ralf Baechle @ 2001-08-14 5:17 UTC (permalink / raw)
To: Tommy S. Christensen; +Cc: Barry Wu, linux-mips
On Mon, Aug 13, 2001 at 09:38:24PM +0200, Tommy S. Christensen wrote:
> Barry Wu wrote:
> > I meet problems about mips ide disk. I find dma mode
> > is different from other platform. We have to use
> > dma_cache_wback_inv and vtonocache functions to work
> > under DMA mode, I read pcnet32 ethernet driver,
> > it works like that. I do not know if I have to support
> > ide disk dma, what I have to do?
>
> Some MIPS'ification is needed to handle the caches.
> You can try the patch below to drivers/block/ide-dma.c.
>
> I don't know about your IDE controller (our board have
> a CMD PCI-648), but it may need some special handling also.
You're referencing a function that doesn't exist in the whole kernel.
Aside it's a crude hack anyway. If you have problems with caches use
the API defined in Documentation/DMA-mapping.txt.
Ralf
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: mips ide disk dma problem
2001-08-14 5:17 ` Ralf Baechle
@ 2001-08-14 8:12 ` Tommy S. Christensen
2001-08-14 9:03 ` Ralf Baechle
0 siblings, 1 reply; 5+ messages in thread
From: Tommy S. Christensen @ 2001-08-14 8:12 UTC (permalink / raw)
To: Ralf Baechle; +Cc: Barry Wu, linux-mips
Ralf Baechle wrote:
>
> On Mon, Aug 13, 2001 at 09:38:24PM +0200, Tommy S. Christensen wrote:
>
> > Barry Wu wrote:
> > > I meet problems about mips ide disk. I find dma mode
> > > is different from other platform. We have to use
> > > dma_cache_wback_inv and vtonocache functions to work
> > > under DMA mode, I read pcnet32 ethernet driver,
> > > it works like that. I do not know if I have to support
> > > ide disk dma, what I have to do?
> >
> > Some MIPS'ification is needed to handle the caches.
> > You can try the patch below to drivers/block/ide-dma.c.
> >
> > I don't know about your IDE controller (our board have
> > a CMD PCI-648), but it may need some special handling also.
>
> You're referencing a function that doesn't exist in the whole kernel.
vtonocache(p) is defined as KSEG1ADDR(virt_to_phys(p)).
This is for linux-2.2.12 from MIPS, remember.
> Aside it's a crude hack anyway. If you have problems with caches use
> the API defined in Documentation/DMA-mapping.txt.
I don't see why this is a hack. Sure, the Dynamic DMA
interface is a lot cleaner, but it ends up with more or
less the same.
-Tommy
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: mips ide disk dma problem
2001-08-14 8:12 ` Tommy S. Christensen
@ 2001-08-14 9:03 ` Ralf Baechle
0 siblings, 0 replies; 5+ messages in thread
From: Ralf Baechle @ 2001-08-14 9:03 UTC (permalink / raw)
To: Tommy S. Christensen; +Cc: Barry Wu, linux-mips
On Tue, Aug 14, 2001 at 10:12:49AM +0200, Tommy S. Christensen wrote:
> vtonocache(p) is defined as KSEG1ADDR(virt_to_phys(p)).
> This is for linux-2.2.12 from MIPS, remember.
>
> > Aside it's a crude hack anyway. If you have problems with caches use
> > the API defined in Documentation/DMA-mapping.txt.
>
> I don't see why this is a hack. Sure, the Dynamic DMA
> interface is a lot cleaner, but it ends up with more or
> less the same.
Less. It's a non-portable construct which for example will fail on any
machine that uses some sort of DMA address translation. And would you
expect the maintainers to accept such a bunch of #ifdefs?
Ralf
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2001-08-14 12:42 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-08-13 13:07 mips ide disk dma problem Barry Wu
2001-08-13 19:38 ` Tommy S. Christensen
2001-08-14 5:17 ` Ralf Baechle
2001-08-14 8:12 ` Tommy S. Christensen
2001-08-14 9:03 ` Ralf Baechle
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.