pci.h 3.9 KB

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