aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2007-08-06 18:05:10 -0400
committerPaul Mackerras <paulus@samba.org>2007-08-10 07:04:42 -0400
commit8f2ea1fd3f97ab7a809e939b5b9005a16f862439 (patch)
tree032d1fff16d11eac353a1174febd70bbdbf2c991
parent939e60f6808a9ffd3a4e5f145057379c138c89aa (diff)
[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 <benh@kernel.crashing.org> Signed-off-by: Paul Mackerras <paulus@samba.org>
-rw-r--r--arch/powerpc/kernel/pci_64.c1
-rw-r--r--include/asm-powerpc/dma-mapping.h2
2 files changed, 2 insertions, 1 deletions
diff --git a/arch/powerpc/kernel/pci_64.c b/arch/powerpc/kernel/pci_64.c
index a97e23ac1976..291ffbc360c9 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,
313 313
314 dev->current_state = 4; /* unknown power state */ 314 dev->current_state = 4; /* unknown power state */
315 dev->error_state = pci_channel_io_normal; 315 dev->error_state = pci_channel_io_normal;
316 dev->dma_mask = 0xffffffff;
316 317
317 if (!strcmp(type, "pci") || !strcmp(type, "pciex")) { 318 if (!strcmp(type, "pci") || !strcmp(type, "pciex")) {
318 /* a PCI-PCI bridge */ 319 /* a PCI-PCI bridge */
diff --git a/include/asm-powerpc/dma-mapping.h b/include/asm-powerpc/dma-mapping.h
index f6bd804d9090..744d6bb24116 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 dma_mask)
95 return -EIO; 95 return -EIO;
96 if (dma_ops->set_dma_mask != NULL) 96 if (dma_ops->set_dma_mask != NULL)
97 return dma_ops->set_dma_mask(dev, dma_mask); 97 return dma_ops->set_dma_mask(dev, dma_mask);
98 if (!dev->dma_mask || !dma_supported(dev, *dev->dma_mask)) 98 if (!dev->dma_mask || !dma_supported(dev, dma_mask))
99 return -EIO; 99 return -EIO;
100 *dev->dma_mask = dma_mask; 100 *dev->dma_mask = dma_mask;
101 return 0; 101 return 0;