pci.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. #ifndef ASM_X86__PCI_H
  2. #define ASM_X86__PCI_H
  3. #include <linux/mm.h> /* for struct page */
  4. #include <linux/types.h>
  5. #include <linux/slab.h>
  6. #include <linux/string.h>
  7. #include <asm/scatterlist.h>
  8. #include <asm/io.h>
  9. #ifdef __KERNEL__
  10. struct pci_sysdata {
  11. int domain; /* PCI domain */
  12. int node; /* NUMA node */
  13. #ifdef CONFIG_X86_64
  14. void *iommu; /* IOMMU private data */
  15. #endif
  16. };
  17. extern int pci_routeirq;
  18. /* scan a bus after allocating a pci_sysdata for it */
  19. extern struct pci_bus *pci_scan_bus_on_node(int busno, struct pci_ops *ops,
  20. int node);
  21. extern struct pci_bus *pci_scan_bus_with_sysdata(int busno);
  22. static inline int pci_domain_nr(struct pci_bus *bus)
  23. {
  24. struct pci_sysdata *sd = bus->sysdata;
  25. return sd->domain;
  26. }
  27. static inline int pci_proc_domain(struct pci_bus *bus)
  28. {
  29. return pci_domain_nr(bus);
  30. }
  31. /* Can be used to override the logic in pci_scan_bus for skipping
  32. already-configured bus numbers - to be used for buggy BIOSes
  33. or architectures with incomplete PCI setup by the loader */
  34. #ifdef CONFIG_PCI
  35. extern unsigned int pcibios_assign_all_busses(void);
  36. #else
  37. #define pcibios_assign_all_busses() 0
  38. #endif
  39. #define pcibios_scan_all_fns(a, b) 0
  40. extern unsigned long pci_mem_start;
  41. #define PCIBIOS_MIN_IO 0x1000
  42. #define PCIBIOS_MIN_MEM (pci_mem_start)
  43. #define PCIBIOS_MIN_CARDBUS_IO 0x4000
  44. void pcibios_config_init(void);
  45. struct pci_bus *pcibios_scan_root(int bus);
  46. void pcibios_set_master(struct pci_dev *dev);
  47. void pcibios_penalize_isa_irq(int irq, int active);
  48. struct irq_routing_table *pcibios_get_irq_routing_table(void);
  49. int pcibios_set_irq_routing(struct pci_dev *dev, int pin, int irq);
  50. #define HAVE_PCI_MMAP
  51. extern int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
  52. enum pci_mmap_state mmap_state,
  53. int write_combine);
  54. #ifdef CONFIG_PCI
  55. extern void early_quirks(void);
  56. static inline void pci_dma_burst_advice(struct pci_dev *pdev,
  57. enum pci_dma_burst_strategy *strat,
  58. unsigned long *strategy_parameter)
  59. {
  60. *strat = PCI_DMA_BURST_INFINITY;
  61. *strategy_parameter = ~0UL;
  62. }
  63. #else
  64. static inline void early_quirks(void) { }
  65. #endif
  66. #endif /* __KERNEL__ */
  67. #ifdef CONFIG_X86_32
  68. # include "pci_32.h"
  69. #else
  70. # include "pci_64.h"
  71. #endif
  72. /* implement the pci_ DMA API in terms of the generic device dma_ one */
  73. #include <asm-generic/pci-dma-compat.h>
  74. /* generic pci stuff */
  75. #include <asm-generic/pci.h>
  76. #ifdef CONFIG_NUMA
  77. /* Returns the node based on pci bus */
  78. static inline int __pcibus_to_node(struct pci_bus *bus)
  79. {
  80. struct pci_sysdata *sd = bus->sysdata;
  81. return sd->node;
  82. }
  83. static inline cpumask_t __pcibus_to_cpumask(struct pci_bus *bus)
  84. {
  85. return node_to_cpumask(__pcibus_to_node(bus));
  86. }
  87. #endif
  88. #endif /* ASM_X86__PCI_H */