pci.h 3.9 KB

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