diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2006-11-11 01:25:02 -0500 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2006-12-04 04:38:40 -0500 |
commit | 12d04eef927bf61328af2c7cbe756c96f98ac3bf (patch) | |
tree | 18865369100e9059c7e883dec93ea67f7b52a287 /arch/powerpc/platforms/cell | |
parent | 7c719871ff4d5f15b71f0138d08b758281b58631 (diff) |
[POWERPC] Refactor 64 bits DMA operations
This patch completely refactors DMA operations for 64 bits powerpc. 32 bits
is untouched for now.
We use the new dev_archdata structure to add the dma operations pointer
and associated data to struct device. While at it, we also add the OF node
pointer and numa node. In the future, we might want to look into merging
that with pci_dn as well.
The old vio, pci-iommu and pci-direct DMA ops are gone. They are now replaced
by a set of generic iommu and direct DMA ops (non PCI specific) that can be
used by bus types. The toplevel implementation is now inline.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc/platforms/cell')
-rw-r--r-- | arch/powerpc/platforms/cell/iommu.c | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/arch/powerpc/platforms/cell/iommu.c b/arch/powerpc/platforms/cell/iommu.c index aca4c3db0dde..0e6ab8a55ef7 100644 --- a/arch/powerpc/platforms/cell/iommu.c +++ b/arch/powerpc/platforms/cell/iommu.c | |||
@@ -255,9 +255,6 @@ static void enable_mapping(void __iomem *base, void __iomem *mmio_base) | |||
255 | set_iost_origin(mmio_base); | 255 | set_iost_origin(mmio_base); |
256 | } | 256 | } |
257 | 257 | ||
258 | static void iommu_dev_setup_null(struct pci_dev *d) { } | ||
259 | static void iommu_bus_setup_null(struct pci_bus *b) { } | ||
260 | |||
261 | struct cell_iommu { | 258 | struct cell_iommu { |
262 | unsigned long base; | 259 | unsigned long base; |
263 | unsigned long mmio_base; | 260 | unsigned long mmio_base; |
@@ -306,12 +303,15 @@ static void cell_do_map_iommu(struct cell_iommu *iommu, | |||
306 | } | 303 | } |
307 | } | 304 | } |
308 | 305 | ||
309 | static void iommu_devnode_setup(struct device_node *d) | 306 | static void pci_dma_cell_bus_setup(struct pci_bus *b) |
310 | { | 307 | { |
311 | const unsigned int *ioid; | 308 | const unsigned int *ioid; |
312 | unsigned long map_start, map_size, token; | 309 | unsigned long map_start, map_size, token; |
313 | const unsigned long *dma_window; | 310 | const unsigned long *dma_window; |
314 | struct cell_iommu *iommu; | 311 | struct cell_iommu *iommu; |
312 | struct device_node *d; | ||
313 | |||
314 | d = pci_bus_to_OF_node(b); | ||
315 | 315 | ||
316 | ioid = get_property(d, "ioid", NULL); | 316 | ioid = get_property(d, "ioid", NULL); |
317 | if (!ioid) | 317 | if (!ioid) |
@@ -330,12 +330,6 @@ static void iommu_devnode_setup(struct device_node *d) | |||
330 | cell_do_map_iommu(iommu, *ioid, map_start, map_size); | 330 | cell_do_map_iommu(iommu, *ioid, map_start, map_size); |
331 | } | 331 | } |
332 | 332 | ||
333 | static void iommu_bus_setup(struct pci_bus *b) | ||
334 | { | ||
335 | struct device_node *d = (struct device_node *)b->sysdata; | ||
336 | iommu_devnode_setup(d); | ||
337 | } | ||
338 | |||
339 | 333 | ||
340 | static int cell_map_iommu_hardcoded(int num_nodes) | 334 | static int cell_map_iommu_hardcoded(int num_nodes) |
341 | { | 335 | { |
@@ -499,16 +493,13 @@ void cell_init_iommu(void) | |||
499 | 493 | ||
500 | if (setup_bus) { | 494 | if (setup_bus) { |
501 | pr_debug("%s: IOMMU mapping activated\n", __FUNCTION__); | 495 | pr_debug("%s: IOMMU mapping activated\n", __FUNCTION__); |
502 | ppc_md.iommu_dev_setup = iommu_dev_setup_null; | 496 | ppc_md.pci_dma_bus_setup = pci_dma_cell_bus_setup; |
503 | ppc_md.iommu_bus_setup = iommu_bus_setup; | ||
504 | } else { | 497 | } else { |
505 | pr_debug("%s: IOMMU mapping activated, " | 498 | pr_debug("%s: IOMMU mapping activated, " |
506 | "no device action necessary\n", __FUNCTION__); | 499 | "no device action necessary\n", __FUNCTION__); |
507 | /* Direct I/O, IOMMU off */ | 500 | /* Direct I/O, IOMMU off */ |
508 | ppc_md.iommu_dev_setup = iommu_dev_setup_null; | ||
509 | ppc_md.iommu_bus_setup = iommu_bus_setup_null; | ||
510 | } | 501 | } |
511 | } | 502 | } |
512 | 503 | ||
513 | pci_dma_ops = cell_iommu_ops; | 504 | pci_dma_ops = &cell_iommu_ops; |
514 | } | 505 | } |