pci.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef __ASM_SH_PCI_H
  3. #define __ASM_SH_PCI_H
  4. #ifdef __KERNEL__
  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. * A board can define one or more PCI channels that represent built-in (or
  11. * external) PCI controllers.
  12. */
  13. struct pci_channel {
  14. struct pci_channel *next;
  15. struct pci_bus *bus;
  16. struct pci_ops *pci_ops;
  17. struct resource *resources;
  18. unsigned int nr_resources;
  19. unsigned long io_offset;
  20. unsigned long mem_offset;
  21. unsigned long reg_base;
  22. unsigned long io_map_base;
  23. unsigned int index;
  24. unsigned int need_domain_info;
  25. /* Optional error handling */
  26. struct timer_list err_timer, serr_timer;
  27. unsigned int err_irq, serr_irq;
  28. };
  29. /* arch/sh/drivers/pci/pci.c */
  30. extern raw_spinlock_t pci_config_lock;
  31. extern int register_pci_controller(struct pci_channel *hose);
  32. extern void pcibios_report_status(unsigned int status_mask, int warn);
  33. /* arch/sh/drivers/pci/common.c */
  34. extern int early_read_config_byte(struct pci_channel *hose, int top_bus,
  35. int bus, int devfn, int offset, u8 *value);
  36. extern int early_read_config_word(struct pci_channel *hose, int top_bus,
  37. int bus, int devfn, int offset, u16 *value);
  38. extern int early_read_config_dword(struct pci_channel *hose, int top_bus,
  39. int bus, int devfn, int offset, u32 *value);
  40. extern int early_write_config_byte(struct pci_channel *hose, int top_bus,
  41. int bus, int devfn, int offset, u8 value);
  42. extern int early_write_config_word(struct pci_channel *hose, int top_bus,
  43. int bus, int devfn, int offset, u16 value);
  44. extern int early_write_config_dword(struct pci_channel *hose, int top_bus,
  45. int bus, int devfn, int offset, u32 value);
  46. extern void pcibios_enable_timers(struct pci_channel *hose);
  47. extern unsigned int pcibios_handle_status_errors(unsigned long addr,
  48. unsigned int status, struct pci_channel *hose);
  49. extern int pci_is_66mhz_capable(struct pci_channel *hose,
  50. int top_bus, int current_bus);
  51. extern unsigned long PCIBIOS_MIN_IO, PCIBIOS_MIN_MEM;
  52. #define HAVE_PCI_MMAP
  53. #define ARCH_GENERIC_PCI_MMAP_RESOURCE
  54. /* Dynamic DMA mapping stuff.
  55. * SuperH has everything mapped statically like x86.
  56. */
  57. #ifdef CONFIG_PCI
  58. /*
  59. * None of the SH PCI controllers support MWI, it is always treated as a
  60. * direct memory write.
  61. */
  62. #define PCI_DISABLE_MWI
  63. #endif
  64. /* Board-specific fixup routines. */
  65. int pcibios_map_platform_irq(const struct pci_dev *dev, u8 slot, u8 pin);
  66. #define pci_domain_nr(bus) ((struct pci_channel *)(bus)->sysdata)->index
  67. static inline int pci_proc_domain(struct pci_bus *bus)
  68. {
  69. struct pci_channel *hose = bus->sysdata;
  70. return hose->need_domain_info;
  71. }
  72. /* Chances are this interrupt is wired PC-style ... */
  73. static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)
  74. {
  75. return channel ? 15 : 14;
  76. }
  77. #endif /* __KERNEL__ */
  78. #endif /* __ASM_SH_PCI_H */