pci.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. #ifndef __ASM_SH64_PCI_H
  2. #define __ASM_SH64_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. * These are currently the correct values for the STM overdrive board
  11. * We need some way of setting this on a board specific way, it will
  12. * not be the same on other boards I think
  13. */
  14. #if defined(CONFIG_CPU_SUBTYPE_SH5_101) || defined(CONFIG_CPU_SUBTYPE_SH5_103)
  15. #define PCIBIOS_MIN_IO 0x2000
  16. #define PCIBIOS_MIN_MEM 0x40000000
  17. #endif
  18. extern void pcibios_set_master(struct pci_dev *dev);
  19. /*
  20. * Set penalize isa irq function
  21. */
  22. static inline void pcibios_penalize_isa_irq(int irq, int active)
  23. {
  24. /* We don't do dynamic PCI IRQ allocation */
  25. }
  26. /* Dynamic DMA mapping stuff.
  27. * SuperH has everything mapped statically like x86.
  28. */
  29. /* The PCI address space does equal the physical memory
  30. * address space. The networking and block device layers use
  31. * this boolean for bounce buffer decisions.
  32. */
  33. #define PCI_DMA_BUS_IS_PHYS (1)
  34. #include <linux/types.h>
  35. #include <linux/slab.h>
  36. #include <asm/scatterlist.h>
  37. #include <linux/string.h>
  38. #include <asm/io.h>
  39. /* pci_unmap_{single,page} being a nop depends upon the
  40. * configuration.
  41. */
  42. #ifdef CONFIG_SH_PCIDMA_NONCOHERENT
  43. #define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME) \
  44. dma_addr_t ADDR_NAME;
  45. #define DECLARE_PCI_UNMAP_LEN(LEN_NAME) \
  46. __u32 LEN_NAME;
  47. #define pci_unmap_addr(PTR, ADDR_NAME) \
  48. ((PTR)->ADDR_NAME)
  49. #define pci_unmap_addr_set(PTR, ADDR_NAME, VAL) \
  50. (((PTR)->ADDR_NAME) = (VAL))
  51. #define pci_unmap_len(PTR, LEN_NAME) \
  52. ((PTR)->LEN_NAME)
  53. #define pci_unmap_len_set(PTR, LEN_NAME, VAL) \
  54. (((PTR)->LEN_NAME) = (VAL))
  55. #else
  56. #define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME)
  57. #define DECLARE_PCI_UNMAP_LEN(LEN_NAME)
  58. #define pci_unmap_addr(PTR, ADDR_NAME) (0)
  59. #define pci_unmap_addr_set(PTR, ADDR_NAME, VAL) do { } while (0)
  60. #define pci_unmap_len(PTR, LEN_NAME) (0)
  61. #define pci_unmap_len_set(PTR, LEN_NAME, VAL) do { } while (0)
  62. #endif
  63. /* Not supporting more than 32-bit PCI bus addresses now, but
  64. * must satisfy references to this function. Change if needed.
  65. */
  66. #define pci_dac_dma_supported(pci_dev, mask) (0)
  67. /* These macros should be used after a pci_map_sg call has been done
  68. * to get bus addresses of each of the SG entries and their lengths.
  69. * You should only work with the number of sg entries pci_map_sg
  70. * returns, or alternatively stop on the first sg_dma_len(sg) which
  71. * is 0.
  72. */
  73. #define sg_dma_address(sg) ((sg)->dma_address)
  74. #define sg_dma_len(sg) ((sg)->length)
  75. #ifdef CONFIG_PCI
  76. static inline void pci_dma_burst_advice(struct pci_dev *pdev,
  77. enum pci_dma_burst_strategy *strat,
  78. unsigned long *strategy_parameter)
  79. {
  80. *strat = PCI_DMA_BURST_INFINITY;
  81. *strategy_parameter = ~0UL;
  82. }
  83. #endif
  84. /* Board-specific fixup routines. */
  85. extern void pcibios_fixup(void);
  86. extern void pcibios_fixup_irqs(void);
  87. #ifdef CONFIG_PCI_AUTO
  88. extern int pciauto_assign_resources(int busno, struct pci_channel *hose);
  89. #endif
  90. static inline void pcibios_add_platform_entries(struct pci_dev *dev)
  91. {
  92. }
  93. #endif /* __KERNEL__ */
  94. /* generic pci stuff */
  95. #include <asm-generic/pci.h>
  96. /* generic DMA-mapping stuff */
  97. #include <asm-generic/pci-dma-compat.h>
  98. #endif /* __ASM_SH64_PCI_H */