Commit 57190708 authored by Stephen Rothwell's avatar Stephen Rothwell Committed by Paul Mackerras

[POWERPC] Create and use get_pci_dma_ops()

This allows us to hide pci_dma_ops.
Signed-off-by: default avatarStephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
parent 98747770
...@@ -61,8 +61,7 @@ void iSeries_pcibios_init(void); ...@@ -61,8 +61,7 @@ void iSeries_pcibios_init(void);
LIST_HEAD(hose_list); LIST_HEAD(hose_list);
struct dma_mapping_ops *pci_dma_ops; static struct dma_mapping_ops *pci_dma_ops;
EXPORT_SYMBOL(pci_dma_ops);
int global_phb_number; /* Global phb counter */ int global_phb_number; /* Global phb counter */
...@@ -75,6 +74,12 @@ void set_pci_dma_ops(struct dma_mapping_ops *dma_ops) ...@@ -75,6 +74,12 @@ void set_pci_dma_ops(struct dma_mapping_ops *dma_ops)
pci_dma_ops = dma_ops; pci_dma_ops = dma_ops;
} }
struct dma_mapping_ops *get_pci_dma_ops(void)
{
return pci_dma_ops;
}
EXPORT_SYMBOL(get_pci_dma_ops);
static void fixup_broken_pcnet32(struct pci_dev* dev) static void fixup_broken_pcnet32(struct pci_dev* dev)
{ {
if ((dev->class>>8 == PCI_CLASS_NETWORK_ETHERNET)) { if ((dev->class>>8 == PCI_CLASS_NETWORK_ETHERNET)) {
......
...@@ -496,7 +496,7 @@ static void cell_dma_dev_setup(struct device *dev) ...@@ -496,7 +496,7 @@ static void cell_dma_dev_setup(struct device *dev)
struct dev_archdata *archdata = &dev->archdata; struct dev_archdata *archdata = &dev->archdata;
/* If we run without iommu, no need to do anything */ /* If we run without iommu, no need to do anything */
if (pci_dma_ops == &dma_direct_ops) if (get_pci_dma_ops() == &dma_direct_ops)
return; return;
/* Current implementation uses the first window available in that /* Current implementation uses the first window available in that
...@@ -530,7 +530,7 @@ static int cell_of_bus_notify(struct notifier_block *nb, unsigned long action, ...@@ -530,7 +530,7 @@ static int cell_of_bus_notify(struct notifier_block *nb, unsigned long action,
return 0; return 0;
/* We use the PCI DMA ops */ /* We use the PCI DMA ops */
dev->archdata.dma_ops = pci_dma_ops; dev->archdata.dma_ops = get_pci_dma_ops();
cell_dma_dev_setup(dev); cell_dma_dev_setup(dev);
......
...@@ -80,7 +80,7 @@ static int celleb_of_bus_notify(struct notifier_block *nb, ...@@ -80,7 +80,7 @@ static int celleb_of_bus_notify(struct notifier_block *nb,
if (action != BUS_NOTIFY_ADD_DEVICE) if (action != BUS_NOTIFY_ADD_DEVICE)
return 0; return 0;
dev->archdata.dma_ops = pci_dma_ops; dev->archdata.dma_ops = get_pci_dma_ops();
return 0; return 0;
} }
......
...@@ -71,17 +71,18 @@ static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel) ...@@ -71,17 +71,18 @@ static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)
#define PCI_DISABLE_MWI #define PCI_DISABLE_MWI
#ifdef CONFIG_PCI #ifdef CONFIG_PCI
extern struct dma_mapping_ops *pci_dma_ops;
extern void set_pci_dma_ops(struct dma_mapping_ops *dma_ops); extern void set_pci_dma_ops(struct dma_mapping_ops *dma_ops);
extern struct dma_mapping_ops *get_pci_dma_ops(void);
/* For DAC DMA, we currently don't support it by default, but /* For DAC DMA, we currently don't support it by default, but
* we let 64-bit platforms override this. * we let 64-bit platforms override this.
*/ */
static inline int pci_dac_dma_supported(struct pci_dev *hwdev,u64 mask) static inline int pci_dac_dma_supported(struct pci_dev *hwdev,u64 mask)
{ {
if (pci_dma_ops && pci_dma_ops->dac_dma_supported) struct dma_mapping_ops *d = get_pci_dma_ops();
return pci_dma_ops->dac_dma_supported(&hwdev->dev, mask);
if (d && d->dac_dma_supported)
return d->dac_dma_supported(&hwdev->dev, mask);
return 0; return 0;
} }
...@@ -103,6 +104,7 @@ static inline void pci_dma_burst_advice(struct pci_dev *pdev, ...@@ -103,6 +104,7 @@ static inline void pci_dma_burst_advice(struct pci_dev *pdev,
} }
#else /* CONFIG_PCI */ #else /* CONFIG_PCI */
#define set_pci_dma_ops(d) #define set_pci_dma_ops(d)
#define get_pci_dma_ops() NULL
#endif #endif
extern int pci_domain_nr(struct pci_bus *bus); extern int pci_domain_nr(struct pci_bus *bus);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment