4 #include <linux/mm.h> /* for struct page */
5 #include <linux/types.h>
6 #include <linux/slab.h>
7 #include <linux/string.h>
8 #include <linux/scatterlist.h>
11 #include <asm/x86_init.h>
16 int domain; /* PCI domain */
17 int node; /* NUMA node */
19 struct acpi_device *companion; /* ACPI companion device */
22 void *iommu; /* IOMMU private data */
24 #ifdef CONFIG_PCI_MSI_IRQ_DOMAIN
25 void *fwnode; /* IRQ domain for MSI assignment */
27 #if IS_ENABLED(CONFIG_VMD)
28 bool vmd_domain; /* True if in Intel VMD domain */
32 extern int pci_routeirq;
33 extern int noioapicquirk;
34 extern int noioapicreroute;
38 #ifdef CONFIG_PCI_DOMAINS
39 static inline int pci_domain_nr(struct pci_bus *bus)
41 struct pci_sysdata *sd = bus->sysdata;
46 static inline int pci_proc_domain(struct pci_bus *bus)
48 return pci_domain_nr(bus);
52 #ifdef CONFIG_PCI_MSI_IRQ_DOMAIN
53 static inline void *_pci_root_bus_fwnode(struct pci_bus *bus)
55 struct pci_sysdata *sd = bus->sysdata;
60 #define pci_root_bus_fwnode _pci_root_bus_fwnode
63 static inline bool is_vmd(struct pci_bus *bus)
65 #if IS_ENABLED(CONFIG_VMD)
66 struct pci_sysdata *sd = bus->sysdata;
68 return sd->vmd_domain;
74 /* Can be used to override the logic in pci_scan_bus for skipping
75 already-configured bus numbers - to be used for buggy BIOSes
76 or architectures with incomplete PCI setup by the loader */
78 extern unsigned int pcibios_assign_all_busses(void);
79 extern int pci_legacy_init(void);
81 # define x86_default_pci_init pci_acpi_init
83 # define x86_default_pci_init pci_legacy_init
86 # define pcibios_assign_all_busses() 0
87 # define x86_default_pci_init NULL
90 extern unsigned long pci_mem_start;
91 #define PCIBIOS_MIN_IO 0x1000
92 #define PCIBIOS_MIN_MEM (pci_mem_start)
94 #define PCIBIOS_MIN_CARDBUS_IO 0x4000
96 extern int pcibios_enabled;
97 void pcibios_config_init(void);
98 void pcibios_scan_root(int bus);
100 void pcibios_set_master(struct pci_dev *dev);
101 struct irq_routing_table *pcibios_get_irq_routing_table(void);
102 int pcibios_set_irq_routing(struct pci_dev *dev, int pin, int irq);
105 #define HAVE_PCI_MMAP
106 #define arch_can_pci_mmap_wc() pat_enabled()
107 #define ARCH_GENERIC_PCI_MMAP_RESOURCE
110 extern void early_quirks(void);
112 static inline void early_quirks(void) { }
115 extern void pci_iommu_alloc(void);
117 #ifdef CONFIG_PCI_MSI
118 /* implemented in arch/x86/kernel/apic/io_apic. */
120 int native_setup_msi_irqs(struct pci_dev *dev, int nvec, int type);
121 void native_teardown_msi_irq(unsigned int irq);
122 void native_restore_msi_irqs(struct pci_dev *dev);
124 #define native_setup_msi_irqs NULL
125 #define native_teardown_msi_irq NULL
128 #define PCI_DMA_BUS_IS_PHYS (dma_ops->is_phys)
130 #endif /* __KERNEL__ */
133 #include <asm/pci_64.h>
136 /* generic pci stuff */
137 #include <asm-generic/pci.h>
140 /* Returns the node based on pci bus */
141 static inline int __pcibus_to_node(const struct pci_bus *bus)
143 const struct pci_sysdata *sd = bus->sysdata;
148 static inline const struct cpumask *
149 cpumask_of_pcibus(const struct pci_bus *bus)
153 node = __pcibus_to_node(bus);
154 return (node == -1) ? cpu_online_mask :
155 cpumask_of_node(node);
159 struct pci_setup_rom {
160 struct setup_data data;
164 unsigned long segment;
166 unsigned long device;
167 unsigned long function;
171 #endif /* _ASM_X86_PCI_H */