dma.c 934 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /* dma.c: PCI and SBUS DMA accessors for 32-bit sparc.
  2. *
  3. * Copyright (C) 2008 David S. Miller <davem@davemloft.net>
  4. */
  5. #include <linux/kernel.h>
  6. #include <linux/module.h>
  7. #include <linux/dma-mapping.h>
  8. #include <linux/scatterlist.h>
  9. #include <linux/mm.h>
  10. #ifdef CONFIG_PCI
  11. #include <linux/pci.h>
  12. #endif
  13. /*
  14. * Return whether the given PCI device DMA address mask can be
  15. * supported properly. For example, if your device can only drive the
  16. * low 24-bits during PCI bus mastering, then you would pass
  17. * 0x00ffffff as the mask to this function.
  18. */
  19. int dma_supported(struct device *dev, u64 mask)
  20. {
  21. #ifdef CONFIG_PCI
  22. if (dev->bus == &pci_bus_type)
  23. return 1;
  24. #endif
  25. return 0;
  26. }
  27. EXPORT_SYMBOL(dma_supported);
  28. int dma_set_mask(struct device *dev, u64 dma_mask)
  29. {
  30. #ifdef CONFIG_PCI
  31. if (dev->bus == &pci_bus_type)
  32. return pci_set_dma_mask(to_pci_dev(dev), dma_mask);
  33. #endif
  34. return -EOPNOTSUPP;
  35. }
  36. EXPORT_SYMBOL(dma_set_mask);