pci.h 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  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. /*
  11. * Can be used to override the logic in pci_scan_bus for skipping already-configured bus
  12. * numbers - to be used for buggy BIOSes or architectures with incomplete PCI setup by the
  13. * loader.
  14. */
  15. #define pcibios_assign_all_busses() 0
  16. #define pcibios_scan_all_fns(a, b) 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 correspondence
  23. * between device bus addresses and CPU physical addresses. Platforms with a hardware I/O
  24. * MMU _must_ turn this off to suppress the bounce buffer handling code in the block and
  25. * network device layers. Platforms with separate bus address spaces _must_ turn this off
  26. * and provide a device DMA mapping implementation that takes care of the necessary
  27. * address translation.
  28. *
  29. * For now, the ia64 platforms which may have separate/multiple bus address spaces all
  30. * have I/O MMUs which support the merging of physically discontiguous buffers, so we can
  31. * use that as the sole factor to determine the setting of PCI_DMA_BUS_IS_PHYS.
  32. */
  33. extern unsigned long ia64_max_iommu_merge_mask;
  34. #define PCI_DMA_BUS_IS_PHYS (ia64_max_iommu_merge_mask == ~0UL)
  35. static inline void
  36. pcibios_set_master (struct pci_dev *dev)
  37. {
  38. /* No special bus mastering setup handling */
  39. }
  40. static inline void
  41. pcibios_penalize_isa_irq (int irq, int active)
  42. {
  43. /* We don't do dynamic PCI IRQ allocation */
  44. }
  45. #define HAVE_ARCH_PCI_MWI 1
  46. extern int pcibios_prep_mwi (struct pci_dev *);
  47. #include <asm-generic/pci-dma-compat.h>
  48. /* pci_unmap_{single,page} is not a nop, thus... */
  49. #define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME) \
  50. dma_addr_t ADDR_NAME;
  51. #define DECLARE_PCI_UNMAP_LEN(LEN_NAME) \
  52. __u32 LEN_NAME;
  53. #define pci_unmap_addr(PTR, ADDR_NAME) \
  54. ((PTR)->ADDR_NAME)
  55. #define pci_unmap_addr_set(PTR, ADDR_NAME, VAL) \
  56. (((PTR)->ADDR_NAME) = (VAL))
  57. #define pci_unmap_len(PTR, LEN_NAME) \
  58. ((PTR)->LEN_NAME)
  59. #define pci_unmap_len_set(PTR, LEN_NAME, VAL) \
  60. (((PTR)->LEN_NAME) = (VAL))
  61. /* The ia64 platform always supports 64-bit addressing. */
  62. #define pci_dac_dma_supported(pci_dev, mask) (1)
  63. #define pci_dac_page_to_dma(dev,pg,off,dir) ((dma_addr_t) page_to_bus(pg) + (off))
  64. #define pci_dac_dma_to_page(dev,dma_addr) (virt_to_page(bus_to_virt(dma_addr)))
  65. #define pci_dac_dma_to_offset(dev,dma_addr) offset_in_page(dma_addr)
  66. #define pci_dac_dma_sync_single_for_cpu(dev,dma_addr,len,dir) do { } while (0)
  67. #define pci_dac_dma_sync_single_for_device(dev,dma_addr,len,dir) do { mb(); } while (0)
  68. #define sg_dma_len(sg) ((sg)->dma_length)
  69. #define sg_dma_address(sg) ((sg)->dma_address)
  70. #ifdef CONFIG_PCI
  71. static inline void pci_dma_burst_advice(struct pci_dev *pdev,
  72. enum pci_dma_burst_strategy *strat,
  73. unsigned long *strategy_parameter)
  74. {
  75. unsigned long cacheline_size;
  76. u8 byte;
  77. pci_read_config_byte(pdev, PCI_CACHE_LINE_SIZE, &byte);
  78. if (byte == 0)
  79. cacheline_size = 1024;
  80. else
  81. cacheline_size = (int) byte * 4;
  82. *strat = PCI_DMA_BURST_MULTIPLE;
  83. *strategy_parameter = cacheline_size;
  84. }
  85. #endif
  86. #define HAVE_PCI_MMAP
  87. extern int pci_mmap_page_range (struct pci_dev *dev, struct vm_area_struct *vma,
  88. enum pci_mmap_state mmap_state, int write_combine);
  89. #define HAVE_PCI_LEGACY
  90. extern int pci_mmap_legacy_page_range(struct pci_bus *bus,
  91. struct vm_area_struct *vma);
  92. extern ssize_t pci_read_legacy_io(struct kobject *kobj, char *buf, loff_t off,
  93. size_t count);
  94. extern ssize_t pci_write_legacy_io(struct kobject *kobj, char *buf, loff_t off,
  95. size_t count);
  96. extern int pci_mmap_legacy_mem(struct kobject *kobj,
  97. struct bin_attribute *attr,
  98. struct vm_area_struct *vma);
  99. #define pci_get_legacy_mem platform_pci_get_legacy_mem
  100. #define pci_legacy_read platform_pci_legacy_read
  101. #define pci_legacy_write platform_pci_legacy_write
  102. struct pci_window {
  103. struct resource resource;
  104. u64 offset;
  105. };
  106. struct pci_controller {
  107. void *acpi_handle;
  108. void *iommu;
  109. int segment;
  110. int node; /* nearest node with memory or -1 for global allocation */
  111. unsigned int windows;
  112. struct pci_window *window;
  113. void *platform_data;
  114. };
  115. #define PCI_CONTROLLER(busdev) ((struct pci_controller *) busdev->sysdata)
  116. #define pci_domain_nr(busdev) (PCI_CONTROLLER(busdev)->segment)
  117. extern struct pci_ops pci_root_ops;
  118. static inline int pci_proc_domain(struct pci_bus *bus)
  119. {
  120. return (pci_domain_nr(bus) != 0);
  121. }
  122. static inline void pcibios_add_platform_entries(struct pci_dev *dev)
  123. {
  124. }
  125. extern void pcibios_resource_to_bus(struct pci_dev *dev,
  126. struct pci_bus_region *region, struct resource *res);
  127. extern void pcibios_bus_to_resource(struct pci_dev *dev,
  128. struct resource *res, struct pci_bus_region *region);
  129. static inline struct resource *
  130. pcibios_select_root(struct pci_dev *pdev, struct resource *res)
  131. {
  132. struct resource *root = NULL;
  133. if (res->flags & IORESOURCE_IO)
  134. root = &ioport_resource;
  135. if (res->flags & IORESOURCE_MEM)
  136. root = &iomem_resource;
  137. return root;
  138. }
  139. #define pcibios_scan_all_fns(a, b) 0
  140. #endif /* _ASM_IA64_PCI_H */