Skip to content

Commit

Permalink
[POWERPC] Implement pci_set_dma_mask() in terms of the dma_ops
Browse files Browse the repository at this point in the history
PowerPC currently doesn't implement pci_set_dma_mask(), which means drivers
calling it will get the generic version in drivers/pci/pci.c.

The powerpc dma mapping ops include a dma_set_mask() hook, which luckily is
not implemented by anyone - so there is no bug in the fact that the hook
is currently never called.

However in future we'll add implementation(s) of dma_set_mask(), and so we
need pci_set_dma_mask() to call the hook.

To save adding a hook to the dma mapping ops, pci-set_consistent_dma_mask()
simply calls the dma_set_mask() hook and then copies the new mask into
dev.coherenet_dma_mask.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
  • Loading branch information
Michael Ellerman authored and Paul Mackerras committed Dec 20, 2007
1 parent 53024fe commit 84631f3
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
16 changes: 16 additions & 0 deletions arch/powerpc/kernel/pci_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,22 @@ struct dma_mapping_ops *get_pci_dma_ops(void)
}
EXPORT_SYMBOL(get_pci_dma_ops);


int pci_set_dma_mask(struct pci_dev *dev, u64 mask)
{
return dma_set_mask(&dev->dev, mask);
}

int pci_set_consistent_dma_mask(struct pci_dev *dev, u64 mask)
{
int rc;

rc = dma_set_mask(&dev->dev, mask);
dev->dev.coherent_dma_mask = dev->dma_mask;

return rc;
}

static void fixup_broken_pcnet32(struct pci_dev* dev)
{
if ((dev->class>>8 == PCI_CLASS_NETWORK_ETHERNET)) {
Expand Down
3 changes: 3 additions & 0 deletions include/asm-powerpc/dma-mapping.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ static inline int dma_supported(struct device *dev, u64 mask)
return dma_ops->dma_supported(dev, mask);
}

/* We have our own implementation of pci_set_dma_mask() */
#define HAVE_ARCH_PCI_SET_DMA_MASK

static inline int dma_set_mask(struct device *dev, u64 dma_mask)
{
struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
Expand Down

0 comments on commit 84631f3

Please sign in to comment.