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/sysdev/dart_iommu.c | |
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/sysdev/dart_iommu.c')
-rw-r--r-- | arch/powerpc/sysdev/dart_iommu.c | 31 |
1 files changed, 9 insertions, 22 deletions
diff --git a/arch/powerpc/sysdev/dart_iommu.c b/arch/powerpc/sysdev/dart_iommu.c index 572b7846cc77..ac784bb57289 100644 --- a/arch/powerpc/sysdev/dart_iommu.c +++ b/arch/powerpc/sysdev/dart_iommu.c | |||
@@ -289,24 +289,15 @@ static void iommu_table_dart_setup(void) | |||
289 | set_bit(iommu_table_dart.it_size - 1, iommu_table_dart.it_map); | 289 | set_bit(iommu_table_dart.it_size - 1, iommu_table_dart.it_map); |
290 | } | 290 | } |
291 | 291 | ||
292 | static void iommu_dev_setup_dart(struct pci_dev *dev) | 292 | static void pci_dma_dev_setup_dart(struct pci_dev *dev) |
293 | { | 293 | { |
294 | struct device_node *dn; | ||
295 | |||
296 | /* We only have one iommu table on the mac for now, which makes | 294 | /* We only have one iommu table on the mac for now, which makes |
297 | * things simple. Setup all PCI devices to point to this table | 295 | * things simple. Setup all PCI devices to point to this table |
298 | * | ||
299 | * We must use pci_device_to_OF_node() to make sure that | ||
300 | * we get the real "final" pointer to the device in the | ||
301 | * pci_dev sysdata and not the temporary PHB one | ||
302 | */ | 296 | */ |
303 | dn = pci_device_to_OF_node(dev); | 297 | dev->dev.archdata.dma_data = &iommu_table_dart; |
304 | |||
305 | if (dn) | ||
306 | PCI_DN(dn)->iommu_table = &iommu_table_dart; | ||
307 | } | 298 | } |
308 | 299 | ||
309 | static void iommu_bus_setup_dart(struct pci_bus *bus) | 300 | static void pci_dma_bus_setup_dart(struct pci_bus *bus) |
310 | { | 301 | { |
311 | struct device_node *dn; | 302 | struct device_node *dn; |
312 | 303 | ||
@@ -321,9 +312,6 @@ static void iommu_bus_setup_dart(struct pci_bus *bus) | |||
321 | PCI_DN(dn)->iommu_table = &iommu_table_dart; | 312 | PCI_DN(dn)->iommu_table = &iommu_table_dart; |
322 | } | 313 | } |
323 | 314 | ||
324 | static void iommu_dev_setup_null(struct pci_dev *dev) { } | ||
325 | static void iommu_bus_setup_null(struct pci_bus *bus) { } | ||
326 | |||
327 | void iommu_init_early_dart(void) | 315 | void iommu_init_early_dart(void) |
328 | { | 316 | { |
329 | struct device_node *dn; | 317 | struct device_node *dn; |
@@ -344,22 +332,21 @@ void iommu_init_early_dart(void) | |||
344 | 332 | ||
345 | /* Initialize the DART HW */ | 333 | /* Initialize the DART HW */ |
346 | if (dart_init(dn) == 0) { | 334 | if (dart_init(dn) == 0) { |
347 | ppc_md.iommu_dev_setup = iommu_dev_setup_dart; | 335 | ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_dart; |
348 | ppc_md.iommu_bus_setup = iommu_bus_setup_dart; | 336 | ppc_md.pci_dma_bus_setup = pci_dma_bus_setup_dart; |
349 | 337 | ||
350 | /* Setup pci_dma ops */ | 338 | /* Setup pci_dma ops */ |
351 | pci_iommu_init(); | 339 | pci_dma_ops = &dma_iommu_ops; |
352 | |||
353 | return; | 340 | return; |
354 | } | 341 | } |
355 | 342 | ||
356 | bail: | 343 | bail: |
357 | /* If init failed, use direct iommu and null setup functions */ | 344 | /* If init failed, use direct iommu and null setup functions */ |
358 | ppc_md.iommu_dev_setup = iommu_dev_setup_null; | 345 | ppc_md.pci_dma_dev_setup = NULL; |
359 | ppc_md.iommu_bus_setup = iommu_bus_setup_null; | 346 | ppc_md.pci_dma_bus_setup = NULL; |
360 | 347 | ||
361 | /* Setup pci_dma ops */ | 348 | /* Setup pci_dma ops */ |
362 | pci_direct_iommu_init(); | 349 | pci_dma_ops = &dma_direct_ops; |
363 | } | 350 | } |
364 | 351 | ||
365 | 352 | ||