pci.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef __ALPHA_PCI_H
  3. #define __ALPHA_PCI_H
  4. #ifdef __KERNEL__
  5. #include <linux/spinlock.h>
  6. #include <linux/dma-mapping.h>
  7. #include <linux/scatterlist.h>
  8. #include <asm/machvec.h>
  9. /*
  10. * The following structure is used to manage multiple PCI busses.
  11. */
  12. struct pci_iommu_arena;
  13. struct page;
  14. /* A controller. Used to manage multiple PCI busses. */
  15. struct pci_controller {
  16. struct pci_controller *next;
  17. struct pci_bus *bus;
  18. struct resource *io_space;
  19. struct resource *mem_space;
  20. /* The following are for reporting to userland. The invariant is
  21. that if we report a BWX-capable dense memory, we do not report
  22. a sparse memory at all, even if it exists. */
  23. unsigned long sparse_mem_base;
  24. unsigned long dense_mem_base;
  25. unsigned long sparse_io_base;
  26. unsigned long dense_io_base;
  27. /* This one's for the kernel only. It's in KSEG somewhere. */
  28. unsigned long config_space_base;
  29. unsigned int index;
  30. /* For compatibility with current (as of July 2003) pciutils
  31. and XFree86. Eventually will be removed. */
  32. unsigned int need_domain_info;
  33. struct pci_iommu_arena *sg_pci;
  34. struct pci_iommu_arena *sg_isa;
  35. void *sysdata;
  36. };
  37. /* Override the logic in pci_scan_bus for skipping already-configured
  38. bus numbers. */
  39. #define pcibios_assign_all_busses() 1
  40. #define PCIBIOS_MIN_IO alpha_mv.min_io_address
  41. #define PCIBIOS_MIN_MEM alpha_mv.min_mem_address
  42. /* IOMMU controls. */
  43. /* TODO: integrate with include/asm-generic/pci.h ? */
  44. static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)
  45. {
  46. return channel ? 15 : 14;
  47. }
  48. #define pci_domain_nr(bus) ((struct pci_controller *)(bus)->sysdata)->index
  49. static inline int pci_proc_domain(struct pci_bus *bus)
  50. {
  51. struct pci_controller *hose = bus->sysdata;
  52. return hose->need_domain_info;
  53. }
  54. #endif /* __KERNEL__ */
  55. /* Values for the `which' argument to sys_pciconfig_iobase. */
  56. #define IOBASE_HOSE 0
  57. #define IOBASE_SPARSE_MEM 1
  58. #define IOBASE_DENSE_MEM 2
  59. #define IOBASE_SPARSE_IO 3
  60. #define IOBASE_DENSE_IO 4
  61. #define IOBASE_ROOT_BUS 5
  62. #define IOBASE_FROM_HOSE 0x10000
  63. extern struct pci_dev *isa_bridge;
  64. extern int pci_legacy_read(struct pci_bus *bus, loff_t port, u32 *val,
  65. size_t count);
  66. extern int pci_legacy_write(struct pci_bus *bus, loff_t port, u32 val,
  67. size_t count);
  68. extern int pci_mmap_legacy_page_range(struct pci_bus *bus,
  69. struct vm_area_struct *vma,
  70. enum pci_mmap_state mmap_state);
  71. extern void pci_adjust_legacy_attr(struct pci_bus *bus,
  72. enum pci_mmap_state mmap_type);
  73. #define HAVE_PCI_LEGACY 1
  74. extern int pci_create_resource_files(struct pci_dev *dev);
  75. extern void pci_remove_resource_files(struct pci_dev *dev);
  76. #endif /* __ALPHA_PCI_H */