pci.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. #ifndef __x8664_PCI_H
  2. #define __x8664_PCI_H
  3. #include <asm/io.h>
  4. #ifdef __KERNEL__
  5. struct pci_sysdata {
  6. int node; /* NUMA node */
  7. void* iommu; /* IOMMU private data */
  8. };
  9. extern struct pci_bus *pci_scan_bus_with_sysdata(int busno);
  10. #ifdef CONFIG_CALGARY_IOMMU
  11. static inline void* pci_iommu(struct pci_bus *bus)
  12. {
  13. struct pci_sysdata *sd = bus->sysdata;
  14. return sd->iommu;
  15. }
  16. static inline void set_pci_iommu(struct pci_bus *bus, void *val)
  17. {
  18. struct pci_sysdata *sd = bus->sysdata;
  19. sd->iommu = val;
  20. }
  21. #endif /* CONFIG_CALGARY_IOMMU */
  22. #include <linux/mm.h> /* for struct page */
  23. /* Can be used to override the logic in pci_scan_bus for skipping
  24. already-configured bus numbers - to be used for buggy BIOSes
  25. or architectures with incomplete PCI setup by the loader */
  26. #ifdef CONFIG_PCI
  27. extern unsigned int pcibios_assign_all_busses(void);
  28. #else
  29. #define pcibios_assign_all_busses() 0
  30. #endif
  31. #define pcibios_scan_all_fns(a, b) 0
  32. extern unsigned long pci_mem_start;
  33. #define PCIBIOS_MIN_IO 0x1000
  34. #define PCIBIOS_MIN_MEM (pci_mem_start)
  35. #define PCIBIOS_MIN_CARDBUS_IO 0x4000
  36. void pcibios_config_init(void);
  37. struct pci_bus * pcibios_scan_root(int bus);
  38. extern int (*pci_config_read)(int seg, int bus, int dev, int fn, int reg, int len, u32 *value);
  39. extern int (*pci_config_write)(int seg, int bus, int dev, int fn, int reg, int len, u32 value);
  40. void pcibios_set_master(struct pci_dev *dev);
  41. void pcibios_penalize_isa_irq(int irq, int active);
  42. struct irq_routing_table *pcibios_get_irq_routing_table(void);
  43. int pcibios_set_irq_routing(struct pci_dev *dev, int pin, int irq);
  44. #include <linux/types.h>
  45. #include <linux/slab.h>
  46. #include <asm/scatterlist.h>
  47. #include <linux/string.h>
  48. #include <asm/page.h>
  49. extern void pci_iommu_alloc(void);
  50. extern int iommu_setup(char *opt);
  51. /* The PCI address space does equal the physical memory
  52. * address space. The networking and block device layers use
  53. * this boolean for bounce buffer decisions
  54. *
  55. * On AMD64 it mostly equals, but we set it to zero if a hardware
  56. * IOMMU (gart) of sotware IOMMU (swiotlb) is available.
  57. */
  58. #define PCI_DMA_BUS_IS_PHYS (dma_ops->is_phys)
  59. #if defined(CONFIG_IOMMU) || defined(CONFIG_CALGARY_IOMMU)
  60. #define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME) \
  61. dma_addr_t ADDR_NAME;
  62. #define DECLARE_PCI_UNMAP_LEN(LEN_NAME) \
  63. __u32 LEN_NAME;
  64. #define pci_unmap_addr(PTR, ADDR_NAME) \
  65. ((PTR)->ADDR_NAME)
  66. #define pci_unmap_addr_set(PTR, ADDR_NAME, VAL) \
  67. (((PTR)->ADDR_NAME) = (VAL))
  68. #define pci_unmap_len(PTR, LEN_NAME) \
  69. ((PTR)->LEN_NAME)
  70. #define pci_unmap_len_set(PTR, LEN_NAME, VAL) \
  71. (((PTR)->LEN_NAME) = (VAL))
  72. #else
  73. /* No IOMMU */
  74. #define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME)
  75. #define DECLARE_PCI_UNMAP_LEN(LEN_NAME)
  76. #define pci_unmap_addr(PTR, ADDR_NAME) (0)
  77. #define pci_unmap_addr_set(PTR, ADDR_NAME, VAL) do { } while (0)
  78. #define pci_unmap_len(PTR, LEN_NAME) (0)
  79. #define pci_unmap_len_set(PTR, LEN_NAME, VAL) do { } while (0)
  80. #endif
  81. #include <asm-generic/pci-dma-compat.h>
  82. #ifdef CONFIG_PCI
  83. static inline void pci_dma_burst_advice(struct pci_dev *pdev,
  84. enum pci_dma_burst_strategy *strat,
  85. unsigned long *strategy_parameter)
  86. {
  87. *strat = PCI_DMA_BURST_INFINITY;
  88. *strategy_parameter = ~0UL;
  89. }
  90. #endif
  91. #define HAVE_PCI_MMAP
  92. extern int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
  93. enum pci_mmap_state mmap_state, int write_combine);
  94. #endif /* __KERNEL__ */
  95. /* generic pci stuff */
  96. #ifdef CONFIG_PCI
  97. #include <asm-generic/pci.h>
  98. #endif
  99. #endif /* __x8664_PCI_H */