pci.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. #ifndef __ALPHA_PCI_H
  2. #define __ALPHA_PCI_H
  3. #ifdef __KERNEL__
  4. #include <linux/spinlock.h>
  5. #include <linux/dma-mapping.h>
  6. #include <asm/scatterlist.h>
  7. #include <asm/machvec.h>
  8. /*
  9. * The following structure is used to manage multiple PCI busses.
  10. */
  11. struct pci_dev;
  12. struct pci_bus;
  13. struct resource;
  14. struct pci_iommu_arena;
  15. struct page;
  16. /* A controller. Used to manage multiple PCI busses. */
  17. struct pci_controller {
  18. struct pci_controller *next;
  19. struct pci_bus *bus;
  20. struct resource *io_space;
  21. struct resource *mem_space;
  22. /* The following are for reporting to userland. The invariant is
  23. that if we report a BWX-capable dense memory, we do not report
  24. a sparse memory at all, even if it exists. */
  25. unsigned long sparse_mem_base;
  26. unsigned long dense_mem_base;
  27. unsigned long sparse_io_base;
  28. unsigned long dense_io_base;
  29. /* This one's for the kernel only. It's in KSEG somewhere. */
  30. unsigned long config_space_base;
  31. unsigned int index;
  32. /* For compatibility with current (as of July 2003) pciutils
  33. and XFree86. Eventually will be removed. */
  34. unsigned int need_domain_info;
  35. struct pci_iommu_arena *sg_pci;
  36. struct pci_iommu_arena *sg_isa;
  37. void *sysdata;
  38. };
  39. /* Override the logic in pci_scan_bus for skipping already-configured
  40. bus numbers. */
  41. #define pcibios_assign_all_busses() 1
  42. #define PCIBIOS_MIN_IO alpha_mv.min_io_address
  43. #define PCIBIOS_MIN_MEM alpha_mv.min_mem_address
  44. extern void pcibios_set_master(struct pci_dev *dev);
  45. extern inline void pcibios_penalize_isa_irq(int irq, int active)
  46. {
  47. /* We don't do dynamic PCI IRQ allocation */
  48. }
  49. /* IOMMU controls. */
  50. /* The PCI address space does not equal the physical memory address space.
  51. The networking and block device layers use this boolean for bounce buffer
  52. decisions. */
  53. #define PCI_DMA_BUS_IS_PHYS 0
  54. #ifdef CONFIG_PCI
  55. /* implement the pci_ DMA API in terms of the generic device dma_ one */
  56. #include <asm-generic/pci-dma-compat.h>
  57. static inline void pci_dma_burst_advice(struct pci_dev *pdev,
  58. enum pci_dma_burst_strategy *strat,
  59. unsigned long *strategy_parameter)
  60. {
  61. unsigned long cacheline_size;
  62. u8 byte;
  63. pci_read_config_byte(pdev, PCI_CACHE_LINE_SIZE, &byte);
  64. if (byte == 0)
  65. cacheline_size = 1024;
  66. else
  67. cacheline_size = (int) byte * 4;
  68. *strat = PCI_DMA_BURST_BOUNDARY;
  69. *strategy_parameter = cacheline_size;
  70. }
  71. #endif
  72. /* TODO: integrate with include/asm-generic/pci.h ? */
  73. static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)
  74. {
  75. return channel ? 15 : 14;
  76. }
  77. extern void pcibios_resource_to_bus(struct pci_dev *, struct pci_bus_region *,
  78. struct resource *);
  79. extern void pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
  80. struct pci_bus_region *region);
  81. #define pci_domain_nr(bus) ((struct pci_controller *)(bus)->sysdata)->index
  82. static inline int pci_proc_domain(struct pci_bus *bus)
  83. {
  84. struct pci_controller *hose = bus->sysdata;
  85. return hose->need_domain_info;
  86. }
  87. #endif /* __KERNEL__ */
  88. /* Values for the `which' argument to sys_pciconfig_iobase. */
  89. #define IOBASE_HOSE 0
  90. #define IOBASE_SPARSE_MEM 1
  91. #define IOBASE_DENSE_MEM 2
  92. #define IOBASE_SPARSE_IO 3
  93. #define IOBASE_DENSE_IO 4
  94. #define IOBASE_ROOT_BUS 5
  95. #define IOBASE_FROM_HOSE 0x10000
  96. extern struct pci_dev *isa_bridge;
  97. extern int pci_legacy_read(struct pci_bus *bus, loff_t port, u32 *val,
  98. size_t count);
  99. extern int pci_legacy_write(struct pci_bus *bus, loff_t port, u32 val,
  100. size_t count);
  101. extern int pci_mmap_legacy_page_range(struct pci_bus *bus,
  102. struct vm_area_struct *vma,
  103. enum pci_mmap_state mmap_state);
  104. extern void pci_adjust_legacy_attr(struct pci_bus *bus,
  105. enum pci_mmap_state mmap_type);
  106. #define HAVE_PCI_LEGACY 1
  107. extern int pci_create_resource_files(struct pci_dev *dev);
  108. extern void pci_remove_resource_files(struct pci_dev *dev);
  109. #endif /* __ALPHA_PCI_H */