pci.h 3.4 KB

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