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

[POWERPC] Create and use set_pci_dma_ops

This will allow us to build without PCI easier.
Signed-off-by: default avatarStephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
parent 618d3adc
...@@ -70,6 +70,11 @@ int global_phb_number; /* Global phb counter */ ...@@ -70,6 +70,11 @@ int global_phb_number; /* Global phb counter */
struct pci_dev *ppc64_isabridge_dev = NULL; struct pci_dev *ppc64_isabridge_dev = NULL;
EXPORT_SYMBOL_GPL(ppc64_isabridge_dev); EXPORT_SYMBOL_GPL(ppc64_isabridge_dev);
void set_pci_dma_ops(struct dma_mapping_ops *dma_ops)
{
pci_dma_ops = 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)) {
......
...@@ -646,7 +646,7 @@ static int __init cell_iommu_init_disabled(void) ...@@ -646,7 +646,7 @@ static int __init cell_iommu_init_disabled(void)
unsigned long base = 0, size; unsigned long base = 0, size;
/* When no iommu is present, we use direct DMA ops */ /* When no iommu is present, we use direct DMA ops */
pci_dma_ops = &dma_direct_ops; set_pci_dma_ops(&dma_direct_ops);
/* First make sure all IOC translation is turned off */ /* First make sure all IOC translation is turned off */
cell_disable_iommus(); cell_disable_iommus();
...@@ -734,7 +734,7 @@ static int __init cell_iommu_init(void) ...@@ -734,7 +734,7 @@ static int __init cell_iommu_init(void)
} }
/* Setup default PCI iommu ops */ /* Setup default PCI iommu ops */
pci_dma_ops = &dma_iommu_ops; set_pci_dma_ops(&dma_iommu_ops);
bail: bail:
/* Register callbacks on OF platform device addition/removal /* Register callbacks on OF platform device addition/removal
......
...@@ -95,7 +95,7 @@ static int __init celleb_init_iommu(void) ...@@ -95,7 +95,7 @@ static int __init celleb_init_iommu(void)
return -ENODEV; return -ENODEV;
celleb_init_direct_mapping(); celleb_init_direct_mapping();
pci_dma_ops = &dma_direct_ops; set_pci_dma_ops(&dma_direct_ops);
bus_register_notifier(&of_platform_bus_type, &celleb_of_bus_notifier); bus_register_notifier(&of_platform_bus_type, &celleb_of_bus_notifier);
return 0; return 0;
......
...@@ -194,5 +194,5 @@ void iommu_init_early_iSeries(void) ...@@ -194,5 +194,5 @@ void iommu_init_early_iSeries(void)
ppc_md.tce_build = tce_build_iSeries; ppc_md.tce_build = tce_build_iSeries;
ppc_md.tce_free = tce_free_iSeries; ppc_md.tce_free = tce_free_iSeries;
pci_dma_ops = &dma_iommu_ops; set_pci_dma_ops(&dma_iommu_ops);
} }
...@@ -255,7 +255,7 @@ void iommu_init_early_pasemi(void) ...@@ -255,7 +255,7 @@ void iommu_init_early_pasemi(void)
/* Direct I/O, IOMMU off */ /* Direct I/O, IOMMU off */
ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_null; ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_null;
ppc_md.pci_dma_bus_setup = pci_dma_bus_setup_null; ppc_md.pci_dma_bus_setup = pci_dma_bus_setup_null;
pci_dma_ops = &dma_direct_ops; set_pci_dma_ops(&dma_direct_ops);
return; return;
} }
...@@ -266,7 +266,7 @@ void iommu_init_early_pasemi(void) ...@@ -266,7 +266,7 @@ void iommu_init_early_pasemi(void)
ppc_md.pci_dma_bus_setup = pci_dma_bus_setup_pasemi; ppc_md.pci_dma_bus_setup = pci_dma_bus_setup_pasemi;
ppc_md.tce_build = iobmap_build; ppc_md.tce_build = iobmap_build;
ppc_md.tce_free = iobmap_free; ppc_md.tce_free = iobmap_free;
pci_dma_ops = &dma_iommu_ops; set_pci_dma_ops(&dma_iommu_ops);
} }
void __init alloc_iobmap_l2(void) void __init alloc_iobmap_l2(void)
......
...@@ -562,7 +562,7 @@ void iommu_init_early_pSeries(void) ...@@ -562,7 +562,7 @@ void iommu_init_early_pSeries(void)
/* Direct I/O, IOMMU off */ /* Direct I/O, IOMMU off */
ppc_md.pci_dma_dev_setup = NULL; ppc_md.pci_dma_dev_setup = NULL;
ppc_md.pci_dma_bus_setup = NULL; ppc_md.pci_dma_bus_setup = NULL;
pci_dma_ops = &dma_direct_ops; set_pci_dma_ops(&dma_direct_ops);
return; return;
} }
...@@ -588,6 +588,6 @@ void iommu_init_early_pSeries(void) ...@@ -588,6 +588,6 @@ void iommu_init_early_pSeries(void)
pSeries_reconfig_notifier_register(&iommu_reconfig_nb); pSeries_reconfig_notifier_register(&iommu_reconfig_nb);
pci_dma_ops = &dma_iommu_ops; set_pci_dma_ops(&dma_iommu_ops);
} }
...@@ -333,7 +333,7 @@ void iommu_init_early_dart(void) ...@@ -333,7 +333,7 @@ void iommu_init_early_dart(void)
ppc_md.pci_dma_bus_setup = pci_dma_bus_setup_dart; ppc_md.pci_dma_bus_setup = pci_dma_bus_setup_dart;
/* Setup pci_dma ops */ /* Setup pci_dma ops */
pci_dma_ops = &dma_iommu_ops; set_pci_dma_ops(&dma_iommu_ops);
return; return;
} }
...@@ -343,7 +343,7 @@ void iommu_init_early_dart(void) ...@@ -343,7 +343,7 @@ void iommu_init_early_dart(void)
ppc_md.pci_dma_bus_setup = NULL; ppc_md.pci_dma_bus_setup = NULL;
/* Setup pci_dma ops */ /* Setup pci_dma ops */
pci_dma_ops = &dma_direct_ops; set_pci_dma_ops(&dma_direct_ops);
} }
......
...@@ -70,8 +70,11 @@ static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel) ...@@ -70,8 +70,11 @@ 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
extern struct dma_mapping_ops *pci_dma_ops; extern struct dma_mapping_ops *pci_dma_ops;
extern void set_pci_dma_ops(struct dma_mapping_ops *dma_ops);
/* 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.
*/ */
...@@ -82,7 +85,6 @@ static inline int pci_dac_dma_supported(struct pci_dev *hwdev,u64 mask) ...@@ -82,7 +85,6 @@ static inline int pci_dac_dma_supported(struct pci_dev *hwdev,u64 mask)
return 0; return 0;
} }
#ifdef CONFIG_PCI
static inline void pci_dma_burst_advice(struct pci_dev *pdev, static inline void pci_dma_burst_advice(struct pci_dev *pdev,
enum pci_dma_burst_strategy *strat, enum pci_dma_burst_strategy *strat,
unsigned long *strategy_parameter) unsigned long *strategy_parameter)
...@@ -99,6 +101,8 @@ static inline void pci_dma_burst_advice(struct pci_dev *pdev, ...@@ -99,6 +101,8 @@ static inline void pci_dma_burst_advice(struct pci_dev *pdev,
*strat = PCI_DMA_BURST_MULTIPLE; *strat = PCI_DMA_BURST_MULTIPLE;
*strategy_parameter = cacheline_size; *strategy_parameter = cacheline_size;
} }
#else /* CONFIG_PCI */
#define set_pci_dma_ops(d)
#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