Lines Matching +full:iommu +full:- +full:map +full:- +full:mask
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>
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()
245 /* Allocate a spare page to map all invalid DART pages. We need to do in allocate_dart()
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()
284 /* Map in DART registers */ in dart_init()
287 panic("DART: Cannot map registers!"); 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()
382 static bool iommu_bypass_supported_dart(struct pci_dev *dev, u64 mask) in iommu_bypass_supported_dart() argument
385 dart_device_on_pcie(&dev->dev) && in iommu_bypass_supported_dart()
386 mask >= DMA_BIT_MASK(40); 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()