pci.h 3.0 KB

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