pci.h 3.5 KB

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