pci_64.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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. /* The PCI address space does equal the physical memory
  20. * address space. The networking and block device layers use
  21. * this boolean for bounce buffer decisions
  22. *
  23. * On AMD64 it mostly equals, but we set it to zero if a hardware
  24. * IOMMU (gart) of sotware IOMMU (swiotlb) is available.
  25. */
  26. #define PCI_DMA_BUS_IS_PHYS (dma_ops->is_phys)
  27. #if defined(CONFIG_GART_IOMMU) || defined(CONFIG_CALGARY_IOMMU)
  28. #define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME) \
  29. dma_addr_t ADDR_NAME;
  30. #define DECLARE_PCI_UNMAP_LEN(LEN_NAME) \
  31. __u32 LEN_NAME;
  32. #define pci_unmap_addr(PTR, ADDR_NAME) \
  33. ((PTR)->ADDR_NAME)
  34. #define pci_unmap_addr_set(PTR, ADDR_NAME, VAL) \
  35. (((PTR)->ADDR_NAME) = (VAL))
  36. #define pci_unmap_len(PTR, LEN_NAME) \
  37. ((PTR)->LEN_NAME)
  38. #define pci_unmap_len_set(PTR, LEN_NAME, VAL) \
  39. (((PTR)->LEN_NAME) = (VAL))
  40. #else
  41. /* No IOMMU */
  42. #define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME)
  43. #define DECLARE_PCI_UNMAP_LEN(LEN_NAME)
  44. #define pci_unmap_addr(PTR, ADDR_NAME) (0)
  45. #define pci_unmap_addr_set(PTR, ADDR_NAME, VAL) do { } while (0)
  46. #define pci_unmap_len(PTR, LEN_NAME) (0)
  47. #define pci_unmap_len_set(PTR, LEN_NAME, VAL) do { } while (0)
  48. #endif
  49. #endif /* __KERNEL__ */
  50. #endif /* __x8664_PCI_H */