pci.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. #ifndef __ASM_SH_PCI_H
  2. #define __ASM_SH_PCI_H
  3. #ifdef __KERNEL__
  4. #include <linux/dma-mapping.h>
  5. /* Can be used to override the logic in pci_scan_bus for skipping
  6. already-configured bus numbers - to be used for buggy BIOSes
  7. or architectures with incomplete PCI setup by the loader */
  8. #define pcibios_assign_all_busses() 1
  9. #define pcibios_scan_all_fns(a, b) 0
  10. /*
  11. * A board can define one or more PCI channels that represent built-in (or
  12. * external) PCI controllers.
  13. */
  14. struct pci_channel {
  15. struct pci_channel *next;
  16. int (*init)(struct pci_channel *chan);
  17. struct pci_ops *pci_ops;
  18. struct resource *io_resource;
  19. struct resource *mem_resource;
  20. int first_devfn;
  21. int last_devfn;
  22. int enabled;
  23. unsigned long reg_base;
  24. unsigned long io_base;
  25. unsigned long io_map_base;
  26. };
  27. /*
  28. * Each board initializes this array and terminates it with a NULL entry.
  29. */
  30. extern struct pci_channel board_pci_channels[];
  31. extern void register_pci_controller(struct pci_channel *hose);
  32. extern unsigned long PCIBIOS_MIN_IO, PCIBIOS_MIN_MEM;
  33. struct pci_dev;
  34. #define HAVE_PCI_MMAP
  35. extern int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
  36. enum pci_mmap_state mmap_state, int write_combine);
  37. extern void pcibios_set_master(struct pci_dev *dev);
  38. static inline void pcibios_penalize_isa_irq(int irq, int active)
  39. {
  40. /* We don't do dynamic PCI IRQ allocation */
  41. }
  42. /* Dynamic DMA mapping stuff.
  43. * SuperH has everything mapped statically like x86.
  44. */
  45. /* The PCI address space does equal the physical memory
  46. * address space. The networking and block device layers use
  47. * this boolean for bounce buffer decisions.
  48. */
  49. #define PCI_DMA_BUS_IS_PHYS (1)
  50. #include <linux/types.h>
  51. #include <linux/slab.h>
  52. #include <asm/scatterlist.h>
  53. #include <linux/string.h>
  54. #include <asm/io.h>
  55. /* pci_unmap_{single,page} being a nop depends upon the
  56. * configuration.
  57. */
  58. #ifdef CONFIG_SH_PCIDMA_NONCOHERENT
  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. #define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME)
  73. #define DECLARE_PCI_UNMAP_LEN(LEN_NAME)
  74. #define pci_unmap_addr(PTR, ADDR_NAME) (0)
  75. #define pci_unmap_addr_set(PTR, ADDR_NAME, VAL) do { } while (0)
  76. #define pci_unmap_len(PTR, LEN_NAME) (0)
  77. #define pci_unmap_len_set(PTR, LEN_NAME, VAL) do { } while (0)
  78. #endif
  79. static inline void pci_dma_burst_advice(struct pci_dev *pdev,
  80. enum pci_dma_burst_strategy *strat,
  81. unsigned long *strategy_parameter)
  82. {
  83. *strat = PCI_DMA_BURST_INFINITY;
  84. *strategy_parameter = ~0UL;
  85. }
  86. #ifdef CONFIG_SUPERH32
  87. /*
  88. * If we're on an SH7751 or SH7780 PCI controller, PCI memory is mapped
  89. * at the end of the address space in a special non-translatable area.
  90. */
  91. #define PCI_MEM_FIXED_START 0xfd000000
  92. #define PCI_MEM_FIXED_END (PCI_MEM_FIXED_START + 0x01000000)
  93. #define is_pci_memory_fixed_range(s, e) \
  94. ((s) >= PCI_MEM_FIXED_START && (e) < PCI_MEM_FIXED_END)
  95. #else
  96. #define is_pci_memory_fixed_range(s, e) (0)
  97. #endif
  98. /* Board-specific fixup routines. */
  99. int pcibios_init_platform(void);
  100. int pcibios_map_platform_irq(struct pci_dev *dev, u8 slot, u8 pin);
  101. #ifdef CONFIG_PCI_AUTO
  102. int pciauto_assign_resources(int busno, struct pci_channel *hose);
  103. #endif
  104. extern void pcibios_resource_to_bus(struct pci_dev *dev,
  105. struct pci_bus_region *region, struct resource *res);
  106. extern void pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
  107. struct pci_bus_region *region);
  108. static inline struct resource *
  109. pcibios_select_root(struct pci_dev *pdev, struct resource *res)
  110. {
  111. struct resource *root = NULL;
  112. if (res->flags & IORESOURCE_IO)
  113. root = &ioport_resource;
  114. if (res->flags & IORESOURCE_MEM)
  115. root = &iomem_resource;
  116. return root;
  117. }
  118. /* Chances are this interrupt is wired PC-style ... */
  119. static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)
  120. {
  121. return channel ? 15 : 14;
  122. }
  123. /* generic DMA-mapping stuff */
  124. #include <asm-generic/pci-dma-compat.h>
  125. #endif /* __KERNEL__ */
  126. #endif /* __ASM_SH_PCI_H */