Commit:     8f2ea1fd3f97ab7a809e939b5b9005a16f862439
Parent:     939e60f6808a9ffd3a4e5f145057379c138c89aa
Author:     Benjamin Herrenschmidt <[EMAIL PROTECTED]>
AuthorDate: Tue Aug 7 08:05:10 2007 +1000
Committer:  Paul Mackerras <[EMAIL PROTECTED]>
CommitDate: Fri Aug 10 21:04:42 2007 +1000

    [POWERPC] Fix initialization and usage of dma_mask
    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 <[EMAIL PROTECTED]>
    Signed-off-by: Paul Mackerras <[EMAIL PROTECTED]>
 arch/powerpc/kernel/pci_64.c      |    1 +
 include/asm-powerpc/dma-mapping.h |    2 +-
 2 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/arch/powerpc/kernel/pci_64.c b/arch/powerpc/kernel/pci_64.c
index a97e23a..291ffbc 100644
--- a/arch/powerpc/kernel/pci_64.c
+++ b/arch/powerpc/kernel/pci_64.c
@@ -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 */
diff --git a/include/asm-powerpc/dma-mapping.h 
index f6bd804..744d6bb 100644
--- a/include/asm-powerpc/dma-mapping.h
+++ b/include/asm-powerpc/dma-mapping.h
@@ -95,7 +95,7 @@ static inline int dma_set_mask(struct device *dev, u64 
                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;
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at

Reply via email to