pci.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  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_ops *pci_ops;
  16. struct resource *io_resource;
  17. struct resource *mem_resource;
  18. int first_devfn;
  19. int last_devfn;
  20. };
  21. /*
  22. * Each board initializes this array and terminates it with a NULL entry.
  23. */
  24. extern struct pci_channel board_pci_channels[];
  25. #define PCIBIOS_MIN_IO board_pci_channels->io_resource->start
  26. #define PCIBIOS_MIN_MEM board_pci_channels->mem_resource->start
  27. /*
  28. * I/O routine helpers
  29. */
  30. #if defined(CONFIG_CPU_SUBTYPE_SH7780) || defined(CONFIG_CPU_SUBTYPE_SH7785)
  31. #define PCI_IO_AREA 0xFE400000
  32. #define PCI_IO_SIZE 0x00400000
  33. #else
  34. #define PCI_IO_AREA 0xFE240000
  35. #define PCI_IO_SIZE 0X00040000
  36. #endif
  37. #define PCI_MEM_SIZE 0x01000000
  38. #define SH4_PCIIOBR_MASK 0xFFFC0000
  39. #define pci_ioaddr(addr) (PCI_IO_AREA + (addr & ~SH4_PCIIOBR_MASK))
  40. #if defined(CONFIG_PCI)
  41. #define is_pci_ioaddr(port) \
  42. (((port) >= PCIBIOS_MIN_IO) && \
  43. ((port) < (PCIBIOS_MIN_IO + PCI_IO_SIZE)))
  44. #define is_pci_memaddr(port) \
  45. (((port) >= PCIBIOS_MIN_MEM) && \
  46. ((port) < (PCIBIOS_MIN_MEM + PCI_MEM_SIZE)))
  47. #else
  48. #define is_pci_ioaddr(port) (0)
  49. #define is_pci_memaddr(port) (0)
  50. #endif
  51. struct pci_dev;
  52. extern void pcibios_set_master(struct pci_dev *dev);
  53. static inline void pcibios_penalize_isa_irq(int irq, int active)
  54. {
  55. /* We don't do dynamic PCI IRQ allocation */
  56. }
  57. /* Dynamic DMA mapping stuff.
  58. * SuperH has everything mapped statically like x86.
  59. */
  60. /* The PCI address space does equal the physical memory
  61. * address space. The networking and block device layers use
  62. * this boolean for bounce buffer decisions.
  63. */
  64. #define PCI_DMA_BUS_IS_PHYS (1)
  65. #include <linux/types.h>
  66. #include <linux/slab.h>
  67. #include <asm/scatterlist.h>
  68. #include <linux/string.h>
  69. #include <asm/io.h>
  70. /* pci_unmap_{single,page} being a nop depends upon the
  71. * configuration.
  72. */
  73. #ifdef CONFIG_SH_PCIDMA_NONCOHERENT
  74. #define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME) \
  75. dma_addr_t ADDR_NAME;
  76. #define DECLARE_PCI_UNMAP_LEN(LEN_NAME) \
  77. __u32 LEN_NAME;
  78. #define pci_unmap_addr(PTR, ADDR_NAME) \
  79. ((PTR)->ADDR_NAME)
  80. #define pci_unmap_addr_set(PTR, ADDR_NAME, VAL) \
  81. (((PTR)->ADDR_NAME) = (VAL))
  82. #define pci_unmap_len(PTR, LEN_NAME) \
  83. ((PTR)->LEN_NAME)
  84. #define pci_unmap_len_set(PTR, LEN_NAME, VAL) \
  85. (((PTR)->LEN_NAME) = (VAL))
  86. #else
  87. #define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME)
  88. #define DECLARE_PCI_UNMAP_LEN(LEN_NAME)
  89. #define pci_unmap_addr(PTR, ADDR_NAME) (0)
  90. #define pci_unmap_addr_set(PTR, ADDR_NAME, VAL) do { } while (0)
  91. #define pci_unmap_len(PTR, LEN_NAME) (0)
  92. #define pci_unmap_len_set(PTR, LEN_NAME, VAL) do { } while (0)
  93. #endif
  94. #ifdef CONFIG_PCI
  95. static inline void pci_dma_burst_advice(struct pci_dev *pdev,
  96. enum pci_dma_burst_strategy *strat,
  97. unsigned long *strategy_parameter)
  98. {
  99. *strat = PCI_DMA_BURST_INFINITY;
  100. *strategy_parameter = ~0UL;
  101. }
  102. #endif
  103. /* Board-specific fixup routines. */
  104. void pcibios_fixup(void);
  105. int pcibios_init_platform(void);
  106. int pcibios_map_platform_irq(struct pci_dev *dev, u8 slot, u8 pin);
  107. #ifdef CONFIG_PCI_AUTO
  108. int pciauto_assign_resources(int busno, struct pci_channel *hose);
  109. #endif
  110. #endif /* __KERNEL__ */
  111. /* generic pci stuff */
  112. #include <asm-generic/pci.h>
  113. /* generic DMA-mapping stuff */
  114. #include <asm-generic/pci-dma-compat.h>
  115. #endif /* __ASM_SH_PCI_H */