pci.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  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 *resources;
  17. unsigned int nr_resources;
  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. /* Optional error handling */
  25. struct timer_list err_timer, serr_timer;
  26. unsigned int err_irq, serr_irq;
  27. };
  28. /* arch/sh/drivers/pci/pci.c */
  29. extern raw_spinlock_t pci_config_lock;
  30. extern int register_pci_controller(struct pci_channel *hose);
  31. extern void pcibios_report_status(unsigned int status_mask, int warn);
  32. /* arch/sh/drivers/pci/common.c */
  33. extern int early_read_config_byte(struct pci_channel *hose, int top_bus,
  34. int bus, int devfn, int offset, u8 *value);
  35. extern int early_read_config_word(struct pci_channel *hose, int top_bus,
  36. int bus, int devfn, int offset, u16 *value);
  37. extern int early_read_config_dword(struct pci_channel *hose, int top_bus,
  38. int bus, int devfn, int offset, u32 *value);
  39. extern int early_write_config_byte(struct pci_channel *hose, int top_bus,
  40. int bus, int devfn, int offset, u8 value);
  41. extern int early_write_config_word(struct pci_channel *hose, int top_bus,
  42. int bus, int devfn, int offset, u16 value);
  43. extern int early_write_config_dword(struct pci_channel *hose, int top_bus,
  44. int bus, int devfn, int offset, u32 value);
  45. extern void pcibios_enable_timers(struct pci_channel *hose);
  46. extern unsigned int pcibios_handle_status_errors(unsigned long addr,
  47. unsigned int status, struct pci_channel *hose);
  48. extern int pci_is_66mhz_capable(struct pci_channel *hose,
  49. int top_bus, int current_bus);
  50. extern unsigned long PCIBIOS_MIN_IO, PCIBIOS_MIN_MEM;
  51. struct pci_dev;
  52. #define HAVE_PCI_MMAP
  53. extern int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
  54. enum pci_mmap_state mmap_state, int write_combine);
  55. extern void pcibios_set_master(struct pci_dev *dev);
  56. static inline void pcibios_penalize_isa_irq(int irq, int active)
  57. {
  58. /* We don't do dynamic PCI IRQ allocation */
  59. }
  60. /* Dynamic DMA mapping stuff.
  61. * SuperH has everything mapped statically like x86.
  62. */
  63. /* The PCI address space does equal the physical memory
  64. * address space. The networking and block device layers use
  65. * this boolean for bounce buffer decisions.
  66. */
  67. #define PCI_DMA_BUS_IS_PHYS (dma_ops->is_phys)
  68. #ifdef CONFIG_PCI
  69. /*
  70. * None of the SH PCI controllers support MWI, it is always treated as a
  71. * direct memory write.
  72. */
  73. #define PCI_DISABLE_MWI
  74. static inline void pci_dma_burst_advice(struct pci_dev *pdev,
  75. enum pci_dma_burst_strategy *strat,
  76. unsigned long *strategy_parameter)
  77. {
  78. unsigned long cacheline_size;
  79. u8 byte;
  80. pci_read_config_byte(pdev, PCI_CACHE_LINE_SIZE, &byte);
  81. if (byte == 0)
  82. cacheline_size = L1_CACHE_BYTES;
  83. else
  84. cacheline_size = byte << 2;
  85. *strat = PCI_DMA_BURST_MULTIPLE;
  86. *strategy_parameter = cacheline_size;
  87. }
  88. #endif
  89. /* Board-specific fixup routines. */
  90. int pcibios_map_platform_irq(const struct pci_dev *dev, u8 slot, u8 pin);
  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 */