pci.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. #ifndef _ASM_IA64_PCI_H
  2. #define _ASM_IA64_PCI_H
  3. #include <linux/mm.h>
  4. #include <linux/slab.h>
  5. #include <linux/spinlock.h>
  6. #include <linux/string.h>
  7. #include <linux/types.h>
  8. #include <asm/io.h>
  9. #include <asm/scatterlist.h>
  10. #include <asm/hw_irq.h>
  11. struct pci_vector_struct {
  12. __u16 segment; /* PCI Segment number */
  13. __u16 bus; /* PCI Bus number */
  14. __u32 pci_id; /* ACPI split 16 bits device, 16 bits function (see section 6.1.1) */
  15. __u8 pin; /* PCI PIN (0 = A, 1 = B, 2 = C, 3 = D) */
  16. __u32 irq; /* IRQ assigned */
  17. };
  18. /*
  19. * Can be used to override the logic in pci_scan_bus for skipping already-configured bus
  20. * numbers - to be used for buggy BIOSes or architectures with incomplete PCI setup by the
  21. * loader.
  22. */
  23. #define pcibios_assign_all_busses() 0
  24. #define PCIBIOS_MIN_IO 0x1000
  25. #define PCIBIOS_MIN_MEM 0x10000000
  26. void pcibios_config_init(void);
  27. struct pci_dev;
  28. /*
  29. * PCI_DMA_BUS_IS_PHYS should be set to 1 if there is _necessarily_ a direct
  30. * correspondence between device bus addresses and CPU physical addresses.
  31. * Platforms with a hardware I/O MMU _must_ turn this off to suppress the
  32. * bounce buffer handling code in the block and network device layers.
  33. * Platforms with separate bus address spaces _must_ turn this off and provide
  34. * a device DMA mapping implementation that takes care of the necessary
  35. * address translation.
  36. *
  37. * For now, the ia64 platforms which may have separate/multiple bus address
  38. * spaces all have I/O MMUs which support the merging of physically
  39. * discontiguous buffers, so we can use that as the sole factor to determine
  40. * the setting of PCI_DMA_BUS_IS_PHYS.
  41. */
  42. extern unsigned long ia64_max_iommu_merge_mask;
  43. #define PCI_DMA_BUS_IS_PHYS (ia64_max_iommu_merge_mask == ~0UL)
  44. static inline void
  45. pcibios_penalize_isa_irq (int irq, int active)
  46. {
  47. /* We don't do dynamic PCI IRQ allocation */
  48. }
  49. #include <asm-generic/pci-dma-compat.h>
  50. #ifdef CONFIG_PCI
  51. static inline void pci_dma_burst_advice(struct pci_dev *pdev,
  52. enum pci_dma_burst_strategy *strat,
  53. unsigned long *strategy_parameter)
  54. {
  55. unsigned long cacheline_size;
  56. u8 byte;
  57. pci_read_config_byte(pdev, PCI_CACHE_LINE_SIZE, &byte);
  58. if (byte == 0)
  59. cacheline_size = 1024;
  60. else
  61. cacheline_size = (int) byte * 4;
  62. *strat = PCI_DMA_BURST_MULTIPLE;
  63. *strategy_parameter = cacheline_size;
  64. }
  65. #endif
  66. #define HAVE_PCI_MMAP
  67. extern int pci_mmap_page_range (struct pci_dev *dev, struct vm_area_struct *vma,
  68. enum pci_mmap_state mmap_state, int write_combine);
  69. #define HAVE_PCI_LEGACY
  70. extern int pci_mmap_legacy_page_range(struct pci_bus *bus,
  71. struct vm_area_struct *vma,
  72. enum pci_mmap_state mmap_state);
  73. #define pci_get_legacy_mem platform_pci_get_legacy_mem
  74. #define pci_legacy_read platform_pci_legacy_read
  75. #define pci_legacy_write platform_pci_legacy_write
  76. struct pci_window {
  77. struct resource resource;
  78. u64 offset;
  79. };
  80. struct pci_controller {
  81. void *acpi_handle;
  82. void *iommu;
  83. int segment;
  84. int node; /* nearest node with memory or -1 for global allocation */
  85. unsigned int windows;
  86. struct pci_window *window;
  87. void *platform_data;
  88. };
  89. #define PCI_CONTROLLER(busdev) ((struct pci_controller *) busdev->sysdata)
  90. #define pci_domain_nr(busdev) (PCI_CONTROLLER(busdev)->segment)
  91. extern struct pci_ops pci_root_ops;
  92. static inline int pci_proc_domain(struct pci_bus *bus)
  93. {
  94. return (pci_domain_nr(bus) != 0);
  95. }
  96. static inline struct resource *
  97. pcibios_select_root(struct pci_dev *pdev, struct resource *res)
  98. {
  99. struct resource *root = NULL;
  100. if (res->flags & IORESOURCE_IO)
  101. root = &ioport_resource;
  102. if (res->flags & IORESOURCE_MEM)
  103. root = &iomem_resource;
  104. return root;
  105. }
  106. #define HAVE_ARCH_PCI_GET_LEGACY_IDE_IRQ
  107. static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)
  108. {
  109. return channel ? isa_irq_to_vector(15) : isa_irq_to_vector(14);
  110. }
  111. #ifdef CONFIG_INTEL_IOMMU
  112. extern void pci_iommu_alloc(void);
  113. #endif
  114. #endif /* _ASM_IA64_PCI_H */