Skip to content

Commit

Permalink
[POWERPC] Fix initialization and usage of dma_mask
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Benjamin Herrenschmidt authored and Paul Mackerras committed Aug 10, 2007
1 parent 939e60f commit 8f2ea1f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions arch/powerpc/kernel/pci_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
2 changes: 1 addition & 1 deletion include/asm-powerpc/dma-mapping.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 8f2ea1f

Please sign in to comment.