pci-dma.c 876 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #include <linux/dma-mapping.h>
  2. #include <linux/dmar.h>
  3. #include <asm/gart.h>
  4. #include <asm/calgary.h>
  5. const struct dma_mapping_ops *dma_ops;
  6. EXPORT_SYMBOL(dma_ops);
  7. #ifdef CONFIG_IOMMU_DEBUG
  8. int panic_on_overflow __read_mostly = 1;
  9. int force_iommu __read_mostly = 1;
  10. #else
  11. int panic_on_overflow __read_mostly = 0;
  12. int force_iommu __read_mostly = 0;
  13. #endif
  14. int dma_set_mask(struct device *dev, u64 mask)
  15. {
  16. if (!dev->dma_mask || !dma_supported(dev, mask))
  17. return -EIO;
  18. *dev->dma_mask = mask;
  19. return 0;
  20. }
  21. EXPORT_SYMBOL(dma_set_mask);
  22. static int __init pci_iommu_init(void)
  23. {
  24. #ifdef CONFIG_CALGARY_IOMMU
  25. calgary_iommu_init();
  26. #endif
  27. intel_iommu_init();
  28. #ifdef CONFIG_GART_IOMMU
  29. gart_iommu_init();
  30. #endif
  31. no_iommu_init();
  32. return 0;
  33. }
  34. void pci_iommu_shutdown(void)
  35. {
  36. gart_iommu_shutdown();
  37. }
  38. /* Must execute after PCI subsystem */
  39. fs_initcall(pci_iommu_init);