pci.h 3.8 KB

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