pci_64.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. #ifndef __x8664_PCI_H
  2. #define __x8664_PCI_H
  3. #ifdef __KERNEL__
  4. #ifdef CONFIG_CALGARY_IOMMU
  5. static inline void* pci_iommu(struct pci_bus *bus)
  6. {
  7. struct pci_sysdata *sd = bus->sysdata;
  8. return sd->iommu;
  9. }
  10. static inline void set_pci_iommu(struct pci_bus *bus, void *val)
  11. {
  12. struct pci_sysdata *sd = bus->sysdata;
  13. sd->iommu = val;
  14. }
  15. #endif /* CONFIG_CALGARY_IOMMU */
  16. extern int (*pci_config_read)(int seg, int bus, int dev, int fn, int reg, int len, u32 *value);
  17. extern int (*pci_config_write)(int seg, int bus, int dev, int fn, int reg, int len, u32 value);
  18. extern void pci_iommu_alloc(void);
  19. extern int iommu_setup(char *opt);
  20. /* The PCI address space does equal the physical memory
  21. * address space. The networking and block device layers use
  22. * this boolean for bounce buffer decisions
  23. *
  24. * On AMD64 it mostly equals, but we set it to zero if a hardware
  25. * IOMMU (gart) of sotware IOMMU (swiotlb) is available.
  26. */
  27. #define PCI_DMA_BUS_IS_PHYS (dma_ops->is_phys)
  28. #if defined(CONFIG_IOMMU) || defined(CONFIG_CALGARY_IOMMU)
  29. #define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME) \
  30. dma_addr_t ADDR_NAME;
  31. #define DECLARE_PCI_UNMAP_LEN(LEN_NAME) \
  32. __u32 LEN_NAME;
  33. #define pci_unmap_addr(PTR, ADDR_NAME) \
  34. ((PTR)->ADDR_NAME)
  35. #define pci_unmap_addr_set(PTR, ADDR_NAME, VAL) \
  36. (((PTR)->ADDR_NAME) = (VAL))
  37. #define pci_unmap_len(PTR, LEN_NAME) \
  38. ((PTR)->LEN_NAME)
  39. #define pci_unmap_len_set(PTR, LEN_NAME, VAL) \
  40. (((PTR)->LEN_NAME) = (VAL))
  41. #else
  42. /* No IOMMU */
  43. #define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME)
  44. #define DECLARE_PCI_UNMAP_LEN(LEN_NAME)
  45. #define pci_unmap_addr(PTR, ADDR_NAME) (0)
  46. #define pci_unmap_addr_set(PTR, ADDR_NAME, VAL) do { } while (0)
  47. #define pci_unmap_len(PTR, LEN_NAME) (0)
  48. #define pci_unmap_len_set(PTR, LEN_NAME, VAL) do { } while (0)
  49. #endif
  50. #endif /* __KERNEL__ */
  51. #endif /* __x8664_PCI_H */