pci.h 4.1 KB

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