On Aug 20 2003, at 02:25, Pete Zaitcev was caught saying:
> > From: Deepak Saxena <[EMAIL PROTECTED]>
> > Date: Tue, 19 Aug 2003 22:17:14 -0700
> 
> > The ARM PCI DMA API implementation has an ugly hack in it to deal 
> > with the fact that ohci-sa1111.c uses it even though it is not a PCI 
> > device.  This patch cleans up ohci-sa1111.c to use the generic
> > DMA API so we can kill the hack...I think/hope.
> 
> Where is the "ugly hack" removal?

@@ -167,7 +167,6 @@
        hcd->description = driver->description;
        hcd->irq = dev->irq[1];
        hcd->regs = dev->mapbase;
-       hcd->pdev = SA1111_FAKE_PCIDEV;
        hcd->self.controller = &dev->dev;
        hcd->controller = hcd->self.controller;

That allows us to cleanup the following bit of code in the
ARM implementation:

/*
 * Keep the SA1111 DMA-mapping tricks until the USB layer gets
 * properly converted to the new DMA-mapping API, at which time
 * most of this file can die.
 */
#define SA1111_FAKE_PCIDEV ((struct pci_dev *) 1111)
#define pcidev_is_sa1111(dev) (dev == SA1111_FAKE_PCIDEV)
#else
#define pcidev_is_sa1111(dev) (0)
#endif
...
static inline void *
pci_alloc_consistent(struct pci_dev *hwdev, size_t size, dma_addr_t
*handle)
{
        int gfp = GFP_ATOMIC;

        if (hwdev == NULL || pcidev_is_sa1111(hwdev) ||
            hwdev->dma_mask != 0xffffffff)
                gfp |= GFP_DMA;

        return consistent_alloc(gfp, size, handle, 0);
}

I didn't post that b/c I didn't think that was of concern to this
list since it's down in the bowels of arm include files.

> > -   if (hcd->pdev) {
> > -           ohci->hcca = pci_alloc_consistent (hcd->pdev,
> > -                           sizeof *ohci->hcca, &ohci->hcca_dma);
> > +   if (hcd->controller) {
> > +
> > +           ohci->hcca = dma_alloc_coherent (hcd->controller,
> > +                           sizeof *ohci->hcca, &ohci->hcca_dma, GFP_DMA);
> >             if (!ohci->hcca)
> >                     return -ENOMEM;
> 
> What the heck is this GFP_DMA supposed to mean? It's ridiculous.
> Is it an ARM-specific kludge or what?

>From Documentation/DMA-API.txt:

The flag parameter (dma_alloc_coherent only) allows the caller to
specify the GFP_ flags (see kmalloc) for the allocation (the
implementation may chose to ignore flags that affect the location of
the returned memory, like GFP_DMA). 

The proper way to do this is to set controller->dma_mask appropriately
and let the ARM specific code set GFP_DMA for the low-level memory
allocation. I'll post an updated patch later today that does this.

~Deepak

-- 
Deepak Saxena - [EMAIL PROTECTED] - http://www.plexity.net/

"Waste equals food"
  - William McDonough & Michael Braungart, Cradle to Cradle


-------------------------------------------------------
This SF.net email is sponsored by Dice.com.
Did you know that Dice has over 25,000 tech jobs available today? From
careers in IT to Engineering to Tech Sales, Dice has tech jobs from the
best hiring companies. http://www.dice.com/index.epl?rel_code=104
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to