Lines Matching +full:iommu +full:- +full:base
1 // SPDX-License-Identifier: GPL-2.0-or-later
13 * Dynamic DMA mapping support, Apple U3, U4 & IBM CPC925 "DART" iommu.
22 #include <linux/dma-mapping.h>
29 #include <asm/iommu.h>
30 #include <asm/pci-bridge.h>
33 #include <asm/ppc-pci.h>
41 /* Mapped base address for the dart */
134 static void dart_cache_sync(unsigned int *base, unsigned int count) in dart_cache_sync() argument
141 unsigned long start = (unsigned long)base; in dart_cache_sync()
182 orig_dp = dp = ((unsigned int*)tbl->it_base) + index; in dart_build()
188 while (l--) { in dart_build()
199 while (npages--) in dart_build()
215 * bad DMAs, but then no 32-bit architecture ever does either. in dart_free()
220 orig_dp = dp = ((unsigned int *)tbl->it_base) + index; in dart_free()
222 while (npages--) in dart_free()
262 unsigned long base, size; in dart_init() local
265 /* IOMMU disabled by the user ? bail out */ in dart_init()
267 return -ENODEV; in dart_init()
271 * or if requested with iommu=on on cmdline. in dart_init()
278 return -ENODEV; in dart_init()
282 panic("DART: can't get register base ! "); in dart_init()
299 /* Initialize DART with table base and enable it. */ in dart_init()
300 base = ((unsigned long)dart_tablebase) >> DART_PAGE_SHIFT; in dart_init()
304 DART_OUT(DART_BASE_U4, base); in dart_init()
311 (base << DART_CNTL_U3_BASE_SHIFT) | in dart_init()
318 printk(KERN_INFO "DART IOMMU initialized for %s type chipset\n", in dart_init()
338 /* Initialize the common IOMMU code */ in iommu_table_dart_setup()
343 if (!iommu_init_table(&iommu_table_dart, -1, 0, 0)) in iommu_table_dart_setup()
344 panic("Failed to initialize iommu table"); in iommu_table_dart_setup()
349 set_bit(iommu_table_dart.it_size - 1, iommu_table_dart.it_map); in iommu_table_dart_setup()
362 struct device_node *np = of_node_get(dev->of_node); in dart_device_on_pcie()
365 if (of_device_is_compatible(np, "U4-pcie") || in dart_device_on_pcie()
366 of_device_is_compatible(np, "u4-pcie")) { in dart_device_on_pcie()
377 if (dart_is_u4 && dart_device_on_pcie(&dev->dev)) in pci_dma_dev_setup_dart()
378 dev->dev.archdata.dma_offset = DART_U4_BYPASS_BASE; in pci_dma_dev_setup_dart()
379 set_iommu_table_base(&dev->dev, &iommu_table_dart); in pci_dma_dev_setup_dart()
385 dart_device_on_pcie(&dev->dev) && in iommu_bypass_supported_dart()
393 /* Find the DART in the device-tree */ in iommu_init_early_dart()
394 dn = of_find_compatible_node(NULL, "dart", "u3-dart"); in iommu_init_early_dart()
396 dn = of_find_compatible_node(NULL, "dart", "u4-dart"); in iommu_init_early_dart()
408 * U4 supports a DART bypass, we use it for 64-bit capable devices to in iommu_init_early_dart()
413 controller_ops->dma_dev_setup = pci_dma_dev_setup_dart; in iommu_init_early_dart()
414 controller_ops->dma_bus_setup = pci_dma_bus_setup_dart; in iommu_init_early_dart()
415 controller_ops->iommu_bypass_supported = iommu_bypass_supported_dart; in iommu_init_early_dart()