diff options
author | Stephen Rothwell <sfr@canb.auug.org.au> | 2007-03-04 00:58:39 -0500 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2007-03-08 23:03:25 -0500 |
commit | 9874777016e06ad2df420237963e81389776cb6d (patch) | |
tree | abd509f5d37da4f8e2cdef8e3e41ec498c4a10ca | |
parent | 618d3adc351a24c4c48437c767befb88ca2d199d (diff) |
[POWERPC] Create and use set_pci_dma_ops
This will allow us to build without PCI easier.
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
-rw-r--r-- | arch/powerpc/kernel/pci_64.c | 5 | ||||
-rw-r--r-- | arch/powerpc/platforms/cell/iommu.c | 4 | ||||
-rw-r--r-- | arch/powerpc/platforms/celleb/iommu.c | 2 | ||||
-rw-r--r-- | arch/powerpc/platforms/iseries/iommu.c | 2 | ||||
-rw-r--r-- | arch/powerpc/platforms/pasemi/iommu.c | 4 | ||||
-rw-r--r-- | arch/powerpc/platforms/pseries/iommu.c | 4 | ||||
-rw-r--r-- | arch/powerpc/sysdev/dart_iommu.c | 4 | ||||
-rw-r--r-- | include/asm-powerpc/pci.h | 6 |
8 files changed, 20 insertions, 11 deletions
diff --git a/arch/powerpc/kernel/pci_64.c b/arch/powerpc/kernel/pci_64.c index 7e97d71a5f8f..73d509343d5b 100644 --- a/arch/powerpc/kernel/pci_64.c +++ b/arch/powerpc/kernel/pci_64.c | |||
@@ -70,6 +70,11 @@ int global_phb_number; /* Global phb counter */ | |||
70 | struct pci_dev *ppc64_isabridge_dev = NULL; | 70 | struct pci_dev *ppc64_isabridge_dev = NULL; |
71 | EXPORT_SYMBOL_GPL(ppc64_isabridge_dev); | 71 | EXPORT_SYMBOL_GPL(ppc64_isabridge_dev); |
72 | 72 | ||
73 | void set_pci_dma_ops(struct dma_mapping_ops *dma_ops) | ||
74 | { | ||
75 | pci_dma_ops = dma_ops; | ||
76 | } | ||
77 | |||
73 | static void fixup_broken_pcnet32(struct pci_dev* dev) | 78 | static void fixup_broken_pcnet32(struct pci_dev* dev) |
74 | { | 79 | { |
75 | if ((dev->class>>8 == PCI_CLASS_NETWORK_ETHERNET)) { | 80 | if ((dev->class>>8 == PCI_CLASS_NETWORK_ETHERNET)) { |
diff --git a/arch/powerpc/platforms/cell/iommu.c b/arch/powerpc/platforms/cell/iommu.c index 67d617b60a23..d0e02ea1d538 100644 --- a/arch/powerpc/platforms/cell/iommu.c +++ b/arch/powerpc/platforms/cell/iommu.c | |||
@@ -646,7 +646,7 @@ static int __init cell_iommu_init_disabled(void) | |||
646 | unsigned long base = 0, size; | 646 | unsigned long base = 0, size; |
647 | 647 | ||
648 | /* When no iommu is present, we use direct DMA ops */ | 648 | /* When no iommu is present, we use direct DMA ops */ |
649 | pci_dma_ops = &dma_direct_ops; | 649 | set_pci_dma_ops(&dma_direct_ops); |
650 | 650 | ||
651 | /* First make sure all IOC translation is turned off */ | 651 | /* First make sure all IOC translation is turned off */ |
652 | cell_disable_iommus(); | 652 | cell_disable_iommus(); |
@@ -734,7 +734,7 @@ static int __init cell_iommu_init(void) | |||
734 | } | 734 | } |
735 | 735 | ||
736 | /* Setup default PCI iommu ops */ | 736 | /* Setup default PCI iommu ops */ |
737 | pci_dma_ops = &dma_iommu_ops; | 737 | set_pci_dma_ops(&dma_iommu_ops); |
738 | 738 | ||
739 | bail: | 739 | bail: |
740 | /* Register callbacks on OF platform device addition/removal | 740 | /* Register callbacks on OF platform device addition/removal |
diff --git a/arch/powerpc/platforms/celleb/iommu.c b/arch/powerpc/platforms/celleb/iommu.c index f63b94c65353..fecc4ffd475e 100644 --- a/arch/powerpc/platforms/celleb/iommu.c +++ b/arch/powerpc/platforms/celleb/iommu.c | |||
@@ -95,7 +95,7 @@ static int __init celleb_init_iommu(void) | |||
95 | return -ENODEV; | 95 | return -ENODEV; |
96 | 96 | ||
97 | celleb_init_direct_mapping(); | 97 | celleb_init_direct_mapping(); |
98 | pci_dma_ops = &dma_direct_ops; | 98 | set_pci_dma_ops(&dma_direct_ops); |
99 | bus_register_notifier(&of_platform_bus_type, &celleb_of_bus_notifier); | 99 | bus_register_notifier(&of_platform_bus_type, &celleb_of_bus_notifier); |
100 | 100 | ||
101 | return 0; | 101 | return 0; |
diff --git a/arch/powerpc/platforms/iseries/iommu.c b/arch/powerpc/platforms/iseries/iommu.c index d7a756d5135c..7df2902271d0 100644 --- a/arch/powerpc/platforms/iseries/iommu.c +++ b/arch/powerpc/platforms/iseries/iommu.c | |||
@@ -194,5 +194,5 @@ void iommu_init_early_iSeries(void) | |||
194 | ppc_md.tce_build = tce_build_iSeries; | 194 | ppc_md.tce_build = tce_build_iSeries; |
195 | ppc_md.tce_free = tce_free_iSeries; | 195 | ppc_md.tce_free = tce_free_iSeries; |
196 | 196 | ||
197 | pci_dma_ops = &dma_iommu_ops; | 197 | set_pci_dma_ops(&dma_iommu_ops); |
198 | } | 198 | } |
diff --git a/arch/powerpc/platforms/pasemi/iommu.c b/arch/powerpc/platforms/pasemi/iommu.c index 459a53b7d24d..4587c1dfeda5 100644 --- a/arch/powerpc/platforms/pasemi/iommu.c +++ b/arch/powerpc/platforms/pasemi/iommu.c | |||
@@ -255,7 +255,7 @@ void iommu_init_early_pasemi(void) | |||
255 | /* Direct I/O, IOMMU off */ | 255 | /* Direct I/O, IOMMU off */ |
256 | ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_null; | 256 | ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_null; |
257 | ppc_md.pci_dma_bus_setup = pci_dma_bus_setup_null; | 257 | ppc_md.pci_dma_bus_setup = pci_dma_bus_setup_null; |
258 | pci_dma_ops = &dma_direct_ops; | 258 | set_pci_dma_ops(&dma_direct_ops); |
259 | 259 | ||
260 | return; | 260 | return; |
261 | } | 261 | } |
@@ -266,7 +266,7 @@ void iommu_init_early_pasemi(void) | |||
266 | ppc_md.pci_dma_bus_setup = pci_dma_bus_setup_pasemi; | 266 | ppc_md.pci_dma_bus_setup = pci_dma_bus_setup_pasemi; |
267 | ppc_md.tce_build = iobmap_build; | 267 | ppc_md.tce_build = iobmap_build; |
268 | ppc_md.tce_free = iobmap_free; | 268 | ppc_md.tce_free = iobmap_free; |
269 | pci_dma_ops = &dma_iommu_ops; | 269 | set_pci_dma_ops(&dma_iommu_ops); |
270 | } | 270 | } |
271 | 271 | ||
272 | void __init alloc_iobmap_l2(void) | 272 | void __init alloc_iobmap_l2(void) |
diff --git a/arch/powerpc/platforms/pseries/iommu.c b/arch/powerpc/platforms/pseries/iommu.c index e6653a868b91..9322f74e1d8b 100644 --- a/arch/powerpc/platforms/pseries/iommu.c +++ b/arch/powerpc/platforms/pseries/iommu.c | |||
@@ -562,7 +562,7 @@ void iommu_init_early_pSeries(void) | |||
562 | /* Direct I/O, IOMMU off */ | 562 | /* Direct I/O, IOMMU off */ |
563 | ppc_md.pci_dma_dev_setup = NULL; | 563 | ppc_md.pci_dma_dev_setup = NULL; |
564 | ppc_md.pci_dma_bus_setup = NULL; | 564 | ppc_md.pci_dma_bus_setup = NULL; |
565 | pci_dma_ops = &dma_direct_ops; | 565 | set_pci_dma_ops(&dma_direct_ops); |
566 | return; | 566 | return; |
567 | } | 567 | } |
568 | 568 | ||
@@ -588,6 +588,6 @@ void iommu_init_early_pSeries(void) | |||
588 | 588 | ||
589 | pSeries_reconfig_notifier_register(&iommu_reconfig_nb); | 589 | pSeries_reconfig_notifier_register(&iommu_reconfig_nb); |
590 | 590 | ||
591 | pci_dma_ops = &dma_iommu_ops; | 591 | set_pci_dma_ops(&dma_iommu_ops); |
592 | } | 592 | } |
593 | 593 | ||
diff --git a/arch/powerpc/sysdev/dart_iommu.c b/arch/powerpc/sysdev/dart_iommu.c index 1488535b0e13..336186dd7f10 100644 --- a/arch/powerpc/sysdev/dart_iommu.c +++ b/arch/powerpc/sysdev/dart_iommu.c | |||
@@ -333,7 +333,7 @@ void iommu_init_early_dart(void) | |||
333 | ppc_md.pci_dma_bus_setup = pci_dma_bus_setup_dart; | 333 | ppc_md.pci_dma_bus_setup = pci_dma_bus_setup_dart; |
334 | 334 | ||
335 | /* Setup pci_dma ops */ | 335 | /* Setup pci_dma ops */ |
336 | pci_dma_ops = &dma_iommu_ops; | 336 | set_pci_dma_ops(&dma_iommu_ops); |
337 | return; | 337 | return; |
338 | } | 338 | } |
339 | 339 | ||
@@ -343,7 +343,7 @@ void iommu_init_early_dart(void) | |||
343 | ppc_md.pci_dma_bus_setup = NULL; | 343 | ppc_md.pci_dma_bus_setup = NULL; |
344 | 344 | ||
345 | /* Setup pci_dma ops */ | 345 | /* Setup pci_dma ops */ |
346 | pci_dma_ops = &dma_direct_ops; | 346 | set_pci_dma_ops(&dma_direct_ops); |
347 | } | 347 | } |
348 | 348 | ||
349 | 349 | ||
diff --git a/include/asm-powerpc/pci.h b/include/asm-powerpc/pci.h index ac656ee6bb19..ebf31f1c5915 100644 --- a/include/asm-powerpc/pci.h +++ b/include/asm-powerpc/pci.h | |||
@@ -70,8 +70,11 @@ static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel) | |||
70 | */ | 70 | */ |
71 | #define PCI_DISABLE_MWI | 71 | #define PCI_DISABLE_MWI |
72 | 72 | ||
73 | #ifdef CONFIG_PCI | ||
73 | extern struct dma_mapping_ops *pci_dma_ops; | 74 | extern struct dma_mapping_ops *pci_dma_ops; |
74 | 75 | ||
76 | extern void set_pci_dma_ops(struct dma_mapping_ops *dma_ops); | ||
77 | |||
75 | /* For DAC DMA, we currently don't support it by default, but | 78 | /* For DAC DMA, we currently don't support it by default, but |
76 | * we let 64-bit platforms override this. | 79 | * we let 64-bit platforms override this. |
77 | */ | 80 | */ |
@@ -82,7 +85,6 @@ static inline int pci_dac_dma_supported(struct pci_dev *hwdev,u64 mask) | |||
82 | return 0; | 85 | return 0; |
83 | } | 86 | } |
84 | 87 | ||
85 | #ifdef CONFIG_PCI | ||
86 | static inline void pci_dma_burst_advice(struct pci_dev *pdev, | 88 | static inline void pci_dma_burst_advice(struct pci_dev *pdev, |
87 | enum pci_dma_burst_strategy *strat, | 89 | enum pci_dma_burst_strategy *strat, |
88 | unsigned long *strategy_parameter) | 90 | unsigned long *strategy_parameter) |
@@ -99,6 +101,8 @@ static inline void pci_dma_burst_advice(struct pci_dev *pdev, | |||
99 | *strat = PCI_DMA_BURST_MULTIPLE; | 101 | *strat = PCI_DMA_BURST_MULTIPLE; |
100 | *strategy_parameter = cacheline_size; | 102 | *strategy_parameter = cacheline_size; |
101 | } | 103 | } |
104 | #else /* CONFIG_PCI */ | ||
105 | #define set_pci_dma_ops(d) | ||
102 | #endif | 106 | #endif |
103 | 107 | ||
104 | extern int pci_domain_nr(struct pci_bus *bus); | 108 | extern int pci_domain_nr(struct pci_bus *bus); |