pci.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  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. struct pci_dev;
  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 (1)
  41. #include <linux/types.h>
  42. #include <linux/slab.h>
  43. #include <asm/scatterlist.h>
  44. #include <linux/string.h>
  45. #include <asm/io.h>
  46. /* pci_unmap_{single,page} being a nop depends upon the
  47. * configuration.
  48. */
  49. #ifdef CONFIG_SH_PCIDMA_NONCOHERENT
  50. #define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME) \
  51. dma_addr_t ADDR_NAME;
  52. #define DECLARE_PCI_UNMAP_LEN(LEN_NAME) \
  53. __u32 LEN_NAME;
  54. #define pci_unmap_addr(PTR, ADDR_NAME) \
  55. ((PTR)->ADDR_NAME)
  56. #define pci_unmap_addr_set(PTR, ADDR_NAME, VAL) \
  57. (((PTR)->ADDR_NAME) = (VAL))
  58. #define pci_unmap_len(PTR, LEN_NAME) \
  59. ((PTR)->LEN_NAME)
  60. #define pci_unmap_len_set(PTR, LEN_NAME, VAL) \
  61. (((PTR)->LEN_NAME) = (VAL))
  62. #else
  63. #define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME)
  64. #define DECLARE_PCI_UNMAP_LEN(LEN_NAME)
  65. #define pci_unmap_addr(PTR, ADDR_NAME) (0)
  66. #define pci_unmap_addr_set(PTR, ADDR_NAME, VAL) do { } while (0)
  67. #define pci_unmap_len(PTR, LEN_NAME) (0)
  68. #define pci_unmap_len_set(PTR, LEN_NAME, VAL) do { } while (0)
  69. #endif
  70. /* Not supporting more than 32-bit PCI bus addresses now, but
  71. * must satisfy references to this function. Change if needed.
  72. */
  73. #define pci_dac_dma_supported(pci_dev, mask) (0)
  74. /* These macros should be used after a pci_map_sg call has been done
  75. * to get bus addresses of each of the SG entries and their lengths.
  76. * You should only work with the number of sg entries pci_map_sg
  77. * returns, or alternatively stop on the first sg_dma_len(sg) which
  78. * is 0.
  79. */
  80. #define sg_dma_address(sg) (virt_to_bus((sg)->dma_address))
  81. #define sg_dma_len(sg) ((sg)->length)
  82. #ifdef CONFIG_PCI
  83. static inline void pci_dma_burst_advice(struct pci_dev *pdev,
  84. enum pci_dma_burst_strategy *strat,
  85. unsigned long *strategy_parameter)
  86. {
  87. *strat = PCI_DMA_BURST_INFINITY;
  88. *strategy_parameter = ~0UL;
  89. }
  90. #endif
  91. /* Board-specific fixup routines. */
  92. extern void pcibios_fixup(void);
  93. extern void pcibios_fixup_irqs(void);
  94. #ifdef CONFIG_PCI_AUTO
  95. extern int pciauto_assign_resources(int busno, struct pci_channel *hose);
  96. #endif
  97. static inline void pcibios_add_platform_entries(struct pci_dev *dev)
  98. {
  99. }
  100. #endif /* __KERNEL__ */
  101. /* generic pci stuff */
  102. #include <asm-generic/pci.h>
  103. /* generic DMA-mapping stuff */
  104. #include <asm-generic/pci-dma-compat.h>
  105. #endif /* __ASM_SH_PCI_H */