pci.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  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_bus *bus;
  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. unsigned int index;
  23. unsigned int need_domain_info;
  24. };
  25. extern void register_pci_controller(struct pci_channel *hose);
  26. extern int pci_is_66mhz_capable(struct pci_channel *hose,
  27. int top_bus, int current_bus);
  28. extern unsigned long PCIBIOS_MIN_IO, PCIBIOS_MIN_MEM;
  29. struct pci_dev;
  30. #define HAVE_PCI_MMAP
  31. extern int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
  32. enum pci_mmap_state mmap_state, int write_combine);
  33. extern void pcibios_set_master(struct pci_dev *dev);
  34. static inline void pcibios_penalize_isa_irq(int irq, int active)
  35. {
  36. /* We don't do dynamic PCI IRQ allocation */
  37. }
  38. /* Dynamic DMA mapping stuff.
  39. * SuperH has everything mapped statically like x86.
  40. */
  41. /* The PCI address space does equal the physical memory
  42. * address space. The networking and block device layers use
  43. * this boolean for bounce buffer decisions.
  44. */
  45. #define PCI_DMA_BUS_IS_PHYS (dma_ops->is_phys)
  46. /* pci_unmap_{single,page} being a nop depends upon the
  47. * configuration.
  48. */
  49. #ifdef CONFIG_DMA_NONCOHERENT
  50. #define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME) dma_addr_t ADDR_NAME;
  51. #define DECLARE_PCI_UNMAP_LEN(LEN_NAME) __u32 LEN_NAME;
  52. #define pci_unmap_addr(PTR, ADDR_NAME) ((PTR)->ADDR_NAME)
  53. #define pci_unmap_addr_set(PTR, ADDR_NAME, VAL) (((PTR)->ADDR_NAME) = (VAL))
  54. #define pci_unmap_len(PTR, LEN_NAME) ((PTR)->LEN_NAME)
  55. #define pci_unmap_len_set(PTR, LEN_NAME, VAL) (((PTR)->LEN_NAME) = (VAL))
  56. #else
  57. #define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME)
  58. #define DECLARE_PCI_UNMAP_LEN(LEN_NAME)
  59. #define pci_unmap_addr(PTR, ADDR_NAME) (0)
  60. #define pci_unmap_addr_set(PTR, ADDR_NAME, VAL) do { } while (0)
  61. #define pci_unmap_len(PTR, LEN_NAME) (0)
  62. #define pci_unmap_len_set(PTR, LEN_NAME, VAL) do { } while (0)
  63. #endif
  64. #ifdef CONFIG_PCI
  65. /*
  66. * None of the SH PCI controllers support MWI, it is always treated as a
  67. * direct memory write.
  68. */
  69. #define PCI_DISABLE_MWI
  70. static inline void pci_dma_burst_advice(struct pci_dev *pdev,
  71. enum pci_dma_burst_strategy *strat,
  72. unsigned long *strategy_parameter)
  73. {
  74. unsigned long cacheline_size;
  75. u8 byte;
  76. pci_read_config_byte(pdev, PCI_CACHE_LINE_SIZE, &byte);
  77. if (byte == 0)
  78. cacheline_size = L1_CACHE_BYTES;
  79. else
  80. cacheline_size = byte << 2;
  81. *strat = PCI_DMA_BURST_MULTIPLE;
  82. *strategy_parameter = cacheline_size;
  83. }
  84. #endif
  85. /* Board-specific fixup routines. */
  86. int pcibios_map_platform_irq(struct pci_dev *dev, u8 slot, u8 pin);
  87. extern void pcibios_resource_to_bus(struct pci_dev *dev,
  88. struct pci_bus_region *region, struct resource *res);
  89. extern void pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
  90. struct pci_bus_region *region);
  91. #define pci_domain_nr(bus) ((struct pci_channel *)(bus)->sysdata)->index
  92. static inline int pci_proc_domain(struct pci_bus *bus)
  93. {
  94. struct pci_channel *hose = bus->sysdata;
  95. return hose->need_domain_info;
  96. }
  97. /* Chances are this interrupt is wired PC-style ... */
  98. static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)
  99. {
  100. return channel ? 15 : 14;
  101. }
  102. /* generic DMA-mapping stuff */
  103. #include <asm-generic/pci-dma-compat.h>
  104. #endif /* __KERNEL__ */
  105. #endif /* __ASM_SH_PCI_H */