aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnton Blanchard <anton@samba.org>2006-06-10 09:04:39 -0400
committerPaul Mackerras <paulus@samba.org>2006-06-15 05:31:26 -0400
commitdf310656c7552ae7b8252e4b3d8e300cff164b16 (patch)
tree89644b8725237c755422853d749acfb0c7a49c57
parentca1588e71b70534e18368a46a3aad9b25dff941d (diff)
[POWERPC] cleanup dma_mapping_ops
For pseries IOMMU bypass I want to be able to fall back to the regular IOMMU ops. Do this by creating a dma_mapping_ops struct, and convert the others while at it. Signed-off-by: Anton Blanchard <anton@samba.org> Signed-off-by: Paul Mackerras <paulus@samba.org>
-rw-r--r--arch/powerpc/kernel/pci_direct_iommu.c18
-rw-r--r--arch/powerpc/kernel/pci_iommu.c18
-rw-r--r--arch/powerpc/platforms/cell/iommu.c18
3 files changed, 33 insertions, 21 deletions
diff --git a/arch/powerpc/kernel/pci_direct_iommu.c b/arch/powerpc/kernel/pci_direct_iommu.c
index e1a32f802c0b..72ce082ce738 100644
--- a/arch/powerpc/kernel/pci_direct_iommu.c
+++ b/arch/powerpc/kernel/pci_direct_iommu.c
@@ -82,13 +82,17 @@ static int pci_direct_dma_supported(struct device *dev, u64 mask)
82 return mask < 0x100000000ull; 82 return mask < 0x100000000ull;
83} 83}
84 84
85static struct dma_mapping_ops pci_direct_ops = {
86 .alloc_coherent = pci_direct_alloc_coherent,
87 .free_coherent = pci_direct_free_coherent,
88 .map_single = pci_direct_map_single,
89 .unmap_single = pci_direct_unmap_single,
90 .map_sg = pci_direct_map_sg,
91 .unmap_sg = pci_direct_unmap_sg,
92 .dma_supported = pci_direct_dma_supported,
93};
94
85void __init pci_direct_iommu_init(void) 95void __init pci_direct_iommu_init(void)
86{ 96{
87 pci_dma_ops.alloc_coherent = pci_direct_alloc_coherent; 97 pci_dma_ops = pci_direct_ops;
88 pci_dma_ops.free_coherent = pci_direct_free_coherent;
89 pci_dma_ops.map_single = pci_direct_map_single;
90 pci_dma_ops.unmap_single = pci_direct_unmap_single;
91 pci_dma_ops.map_sg = pci_direct_map_sg;
92 pci_dma_ops.unmap_sg = pci_direct_unmap_sg;
93 pci_dma_ops.dma_supported = pci_direct_dma_supported;
94} 98}
diff --git a/arch/powerpc/kernel/pci_iommu.c b/arch/powerpc/kernel/pci_iommu.c
index 7fb4cca021be..0688b2534acb 100644
--- a/arch/powerpc/kernel/pci_iommu.c
+++ b/arch/powerpc/kernel/pci_iommu.c
@@ -148,13 +148,17 @@ static int pci_iommu_dma_supported(struct device *dev, u64 mask)
148 return 1; 148 return 1;
149} 149}
150 150
151struct dma_mapping_ops pci_iommu_ops = {
152 .alloc_coherent = pci_iommu_alloc_coherent,
153 .free_coherent = pci_iommu_free_coherent,
154 .map_single = pci_iommu_map_single,
155 .unmap_single = pci_iommu_unmap_single,
156 .map_sg = pci_iommu_map_sg,
157 .unmap_sg = pci_iommu_unmap_sg,
158 .dma_supported = pci_iommu_dma_supported,
159};
160
151void pci_iommu_init(void) 161void pci_iommu_init(void)
152{ 162{
153 pci_dma_ops.alloc_coherent = pci_iommu_alloc_coherent; 163 pci_dma_ops = pci_iommu_ops;
154 pci_dma_ops.free_coherent = pci_iommu_free_coherent;
155 pci_dma_ops.map_single = pci_iommu_map_single;
156 pci_dma_ops.unmap_single = pci_iommu_unmap_single;
157 pci_dma_ops.map_sg = pci_iommu_map_sg;
158 pci_dma_ops.unmap_sg = pci_iommu_unmap_sg;
159 pci_dma_ops.dma_supported = pci_iommu_dma_supported;
160} 164}
diff --git a/arch/powerpc/platforms/cell/iommu.c b/arch/powerpc/platforms/cell/iommu.c
index a49ceb799a8e..a35004e14c69 100644
--- a/arch/powerpc/platforms/cell/iommu.c
+++ b/arch/powerpc/platforms/cell/iommu.c
@@ -473,6 +473,16 @@ static int cell_dma_supported(struct device *dev, u64 mask)
473 return mask < 0x100000000ull; 473 return mask < 0x100000000ull;
474} 474}
475 475
476static struct dma_mapping_ops cell_iommu_ops = {
477 .alloc_coherent = cell_alloc_coherent,
478 .free_coherent = cell_free_coherent,
479 .map_single = cell_map_single,
480 .unmap_single = cell_unmap_single,
481 .map_sg = cell_map_sg,
482 .unmap_sg = cell_unmap_sg,
483 .dma_supported = cell_dma_supported,
484};
485
476void cell_init_iommu(void) 486void cell_init_iommu(void)
477{ 487{
478 int setup_bus = 0; 488 int setup_bus = 0;
@@ -498,11 +508,5 @@ void cell_init_iommu(void)
498 } 508 }
499 } 509 }
500 510
501 pci_dma_ops.alloc_coherent = cell_alloc_coherent; 511 pci_dma_ops = cell_iommu_ops;
502 pci_dma_ops.free_coherent = cell_free_coherent;
503 pci_dma_ops.map_single = cell_map_single;
504 pci_dma_ops.unmap_single = cell_unmap_single;
505 pci_dma_ops.map_sg = cell_map_sg;
506 pci_dma_ops.unmap_sg = cell_unmap_sg;
507 pci_dma_ops.dma_supported = cell_dma_supported;
508} 512}