pci.h 4.0 KB

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