pci.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  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. #include <asm/x86_init.h>
  10. #ifdef __KERNEL__
  11. struct pci_sysdata {
  12. int domain; /* PCI domain */
  13. int node; /* NUMA node */
  14. #ifdef CONFIG_ACPI
  15. struct acpi_device *companion; /* ACPI companion device */
  16. #endif
  17. #ifdef CONFIG_X86_64
  18. void *iommu; /* IOMMU private data */
  19. #endif
  20. };
  21. extern int pci_routeirq;
  22. extern int noioapicquirk;
  23. extern int noioapicreroute;
  24. #ifdef CONFIG_PCI
  25. #ifdef CONFIG_PCI_DOMAINS
  26. static inline int pci_domain_nr(struct pci_bus *bus)
  27. {
  28. struct pci_sysdata *sd = bus->sysdata;
  29. return sd->domain;
  30. }
  31. static inline int pci_proc_domain(struct pci_bus *bus)
  32. {
  33. return pci_domain_nr(bus);
  34. }
  35. #endif
  36. /* Can be used to override the logic in pci_scan_bus for skipping
  37. already-configured bus numbers - to be used for buggy BIOSes
  38. or architectures with incomplete PCI setup by the loader */
  39. extern unsigned int pcibios_assign_all_busses(void);
  40. extern int pci_legacy_init(void);
  41. # ifdef CONFIG_ACPI
  42. # define x86_default_pci_init pci_acpi_init
  43. # else
  44. # define x86_default_pci_init pci_legacy_init
  45. # endif
  46. #else
  47. # define pcibios_assign_all_busses() 0
  48. # define x86_default_pci_init NULL
  49. #endif
  50. extern unsigned long pci_mem_start;
  51. #define PCIBIOS_MIN_IO 0x1000
  52. #define PCIBIOS_MIN_MEM (pci_mem_start)
  53. #define PCIBIOS_MIN_CARDBUS_IO 0x4000
  54. extern int pcibios_enabled;
  55. void pcibios_config_init(void);
  56. void pcibios_scan_root(int bus);
  57. void pcibios_set_master(struct pci_dev *dev);
  58. struct irq_routing_table *pcibios_get_irq_routing_table(void);
  59. int pcibios_set_irq_routing(struct pci_dev *dev, int pin, int irq);
  60. #define HAVE_PCI_MMAP
  61. extern int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
  62. enum pci_mmap_state mmap_state,
  63. int write_combine);
  64. #ifdef CONFIG_PCI
  65. extern void early_quirks(void);
  66. #else
  67. static inline void early_quirks(void) { }
  68. #endif
  69. extern void pci_iommu_alloc(void);
  70. #ifdef CONFIG_PCI_MSI
  71. /* implemented in arch/x86/kernel/apic/io_apic. */
  72. struct msi_desc;
  73. void native_compose_msi_msg(struct pci_dev *pdev, unsigned int irq,
  74. unsigned int dest, struct msi_msg *msg, u8 hpet_id);
  75. int native_setup_msi_irqs(struct pci_dev *dev, int nvec, int type);
  76. void native_teardown_msi_irq(unsigned int irq);
  77. void native_restore_msi_irqs(struct pci_dev *dev);
  78. int setup_msi_irq(struct pci_dev *dev, struct msi_desc *msidesc,
  79. unsigned int irq_base, unsigned int irq_offset);
  80. #else
  81. #define native_compose_msi_msg NULL
  82. #define native_setup_msi_irqs NULL
  83. #define native_teardown_msi_irq NULL
  84. #endif
  85. #define PCI_DMA_BUS_IS_PHYS (dma_ops->is_phys)
  86. #endif /* __KERNEL__ */
  87. #ifdef CONFIG_X86_64
  88. #include <asm/pci_64.h>
  89. #endif
  90. /* implement the pci_ DMA API in terms of the generic device dma_ one */
  91. #include <asm-generic/pci-dma-compat.h>
  92. /* generic pci stuff */
  93. #include <asm-generic/pci.h>
  94. #ifdef CONFIG_NUMA
  95. /* Returns the node based on pci bus */
  96. static inline int __pcibus_to_node(const struct pci_bus *bus)
  97. {
  98. const struct pci_sysdata *sd = bus->sysdata;
  99. return sd->node;
  100. }
  101. static inline const struct cpumask *
  102. cpumask_of_pcibus(const struct pci_bus *bus)
  103. {
  104. int node;
  105. node = __pcibus_to_node(bus);
  106. return (node == -1) ? cpu_online_mask :
  107. cpumask_of_node(node);
  108. }
  109. #endif
  110. struct pci_setup_rom {
  111. struct setup_data data;
  112. uint16_t vendor;
  113. uint16_t devid;
  114. uint64_t pcilen;
  115. unsigned long segment;
  116. unsigned long bus;
  117. unsigned long device;
  118. unsigned long function;
  119. uint8_t romdata[0];
  120. };
  121. #endif /* _ASM_X86_PCI_H */