Re: [RFC] generic device DMA implementation

Miles Bader (miles@lsi.nec.co.jp)
05 Dec 2002 14:44:39 +0900


James Bottomley <James.Bottomley@steeleye.com> writes:
> > Keep in mind that sometimes the actual _implementation_ is also highly
> > PCI-specific -- that is, what works for PCI devices may not work for
> > other devices and vice-versa.
>
> that can all be taken care of in the platform implementation.
>
> In general, the generic device already has enough information that the
> platform implementation can be highly bus specific---and, of course,
> once you know exactly what bus it's on, you can cast it to the bus
> device if you want.

I presume you mean something like (in an arch-specific file somewhere):

void *dma_alloc_consistent (struct device *dev, size_t size,
dma_addr_t *dma_handle,
enum dma_conformance_level level)
{
if (dev->SOME_FIELD == SOME_CONSTANT)
return my_wierd_ass_pci_alloc_consistent ((struct pci_dev *)dev, ...);
else
return 0; /* or kmalloc(...); */
}

?

I did a bit of grovelling, but I'm still not quite sure what test I
can do (i.e., what SOME_FIELD and SOME_CONSTANT should be, if it's
really that simple).

Ah well, as long as it's possible I guess I'll figure it out when the
source hits the fan...

-Miles

-- 
I have seen the enemy, and he is us.  -- Pogo
-
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/