pci-ats.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #ifndef LINUX_PCI_ATS_H
  2. #define LINUX_PCI_ATS_H
  3. /* Address Translation Service */
  4. struct pci_ats {
  5. int pos; /* capability position */
  6. int stu; /* Smallest Translation Unit */
  7. int qdep; /* Invalidate Queue Depth */
  8. int ref_cnt; /* Physical Function reference count */
  9. unsigned int is_enabled:1; /* Enable bit is set */
  10. };
  11. #ifdef CONFIG_PCI_IOV
  12. extern int pci_enable_ats(struct pci_dev *dev, int ps);
  13. extern void pci_disable_ats(struct pci_dev *dev);
  14. extern int pci_ats_queue_depth(struct pci_dev *dev);
  15. /**
  16. * pci_ats_enabled - query the ATS status
  17. * @dev: the PCI device
  18. *
  19. * Returns 1 if ATS capability is enabled, or 0 if not.
  20. */
  21. static inline int pci_ats_enabled(struct pci_dev *dev)
  22. {
  23. return dev->ats && dev->ats->is_enabled;
  24. }
  25. #else /* CONFIG_PCI_IOV */
  26. static inline int pci_enable_ats(struct pci_dev *dev, int ps)
  27. {
  28. return -ENODEV;
  29. }
  30. static inline void pci_disable_ats(struct pci_dev *dev)
  31. {
  32. }
  33. static inline int pci_ats_queue_depth(struct pci_dev *dev)
  34. {
  35. return -ENODEV;
  36. }
  37. static inline int pci_ats_enabled(struct pci_dev *dev)
  38. {
  39. return 0;
  40. }
  41. #endif /* CONFIG_PCI_IOV */
  42. #endif /* LINUX_PCI_ATS_H*/