]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
[POWERPC] Fix initialization and usage of dma_mask
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>
Mon, 6 Aug 2007 22:05:10 +0000 (08:05 +1000)
committerPaul Mackerras <paulus@samba.org>
Fri, 10 Aug 2007 11:04:42 +0000 (21:04 +1000)
powerpc has a couple of bugs in the usage of dma_masks that tend to
break when drivers explicitly try to set a 32-bit mask for example.

First, the code that generates the pci devices from the OF device-tree
doesn't initialize the mask properly, then our implementation of
set_dma_mask() was trying to validate the -previous- mask value, not the
one passed in as an argument.

This fixes these problems.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
arch/powerpc/kernel/pci_64.c
include/asm-powerpc/dma-mapping.h

index a97e23ac197639bd17eda467be127214f863af38..291ffbc360c9a023f30a6b40b4c77b9d272ebb31 100644 (file)
@@ -313,6 +313,7 @@ struct pci_dev *of_create_pci_dev(struct device_node *node,
 
        dev->current_state = 4;         /* unknown power state */
        dev->error_state = pci_channel_io_normal;
+       dev->dma_mask = 0xffffffff;
 
        if (!strcmp(type, "pci") || !strcmp(type, "pciex")) {
                /* a PCI-PCI bridge */
index f6bd804d9090e3d714393c284957e428f7a43567..744d6bb2411646ff89ace4b049fbc062ec6cce94 100644 (file)
@@ -95,7 +95,7 @@ static inline int dma_set_mask(struct device *dev, u64 dma_mask)
                return -EIO;
        if (dma_ops->set_dma_mask != NULL)
                return dma_ops->set_dma_mask(dev, dma_mask);
-       if (!dev->dma_mask || !dma_supported(dev, *dev->dma_mask))
+       if (!dev->dma_mask || !dma_supported(dev, dma_mask))
                return -EIO;
        *dev->dma_mask = dma_mask;
        return 0;