Re: [PATCH 2.5.5] Conversion of hp100 to new PCI interface

Jeff Garzik (jgarzik@mandrakesoft.com)
Tue, 26 Feb 2002 22:03:08 -0500


Jean Tourrilhes wrote:
>
> On Tue, Feb 26, 2002 at 09:11:15PM -0500, Jeff Garzik wrote:
> > >
> > > + /* Conversion to new PCI API :
> > > + * The memory block we use, lp->page_vaddr, was DMA allocated via
> > > + * pci_alloc_consistent(), so we just need to "retreive" the
> > > + * original mapping to bus/phys address - Jean II */
> > > ringptr->pdl = pdlptr + 1;
> > > - ringptr->pdl_paddr = virt_to_bus(pdlptr + 1);
> > > + ringptr->pdl_paddr = virt_to_phys(pdlptr + 1);
> >
> > Nope.. You need to use the mapping value obtained from
> > pci_alloc_consistent...
>
> I don't understand the objection. The memory has been declared
> as DMA and the system already manages it as such. What's the catch ?
> If I can't use virt_to_phys(), can I have a function that does
> exactly the same ? The new API is heavy enough, and if drivers can't
> have something like this it's just messy...

It's not portable, and there's no reason to keep recalculating the value
on those platforms where it does work. You need to store the mapping
value for later use.

Read the section "Optimizing Unmap State Space Consumption" in
Documentation/DMA-mapping.txt for some examples and information WRT
pci_map_xxx/pci_unmap_xxx too.

Jeff

-- 
Jeff Garzik      | "UNIX enhancements aren't."
Building 1024    |           -- says /usr/games/fortune
MandrakeSoft     |
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/