0001
0002 #ifndef _ASM_X86_PCI_H
0003 #define _ASM_X86_PCI_H
0004
0005 #include <linux/mm.h> /* for struct page */
0006 #include <linux/types.h>
0007 #include <linux/slab.h>
0008 #include <linux/string.h>
0009 #include <linux/scatterlist.h>
0010 #include <linux/numa.h>
0011 #include <asm/io.h>
0012 #include <asm/memtype.h>
0013 #include <asm/x86_init.h>
0014
0015 struct pci_sysdata {
0016 int domain;
0017 int node;
0018 #ifdef CONFIG_ACPI
0019 struct acpi_device *companion;
0020 #endif
0021 #ifdef CONFIG_X86_64
0022 void *iommu;
0023 #endif
0024 #ifdef CONFIG_PCI_MSI_IRQ_DOMAIN
0025 void *fwnode;
0026 #endif
0027 #if IS_ENABLED(CONFIG_VMD)
0028 struct pci_dev *vmd_dev;
0029 #endif
0030 };
0031
0032 extern int pci_routeirq;
0033 extern int noioapicquirk;
0034 extern int noioapicreroute;
0035
0036 static inline struct pci_sysdata *to_pci_sysdata(const struct pci_bus *bus)
0037 {
0038 return bus->sysdata;
0039 }
0040
0041 #ifdef CONFIG_PCI
0042
0043 #ifdef CONFIG_PCI_DOMAINS
0044 static inline int pci_domain_nr(struct pci_bus *bus)
0045 {
0046 return to_pci_sysdata(bus)->domain;
0047 }
0048
0049 static inline int pci_proc_domain(struct pci_bus *bus)
0050 {
0051 return pci_domain_nr(bus);
0052 }
0053 #endif
0054
0055 #ifdef CONFIG_PCI_MSI_IRQ_DOMAIN
0056 static inline void *_pci_root_bus_fwnode(struct pci_bus *bus)
0057 {
0058 return to_pci_sysdata(bus)->fwnode;
0059 }
0060
0061 #define pci_root_bus_fwnode _pci_root_bus_fwnode
0062 #endif
0063
0064 #if IS_ENABLED(CONFIG_VMD)
0065 static inline bool is_vmd(struct pci_bus *bus)
0066 {
0067 return to_pci_sysdata(bus)->vmd_dev != NULL;
0068 }
0069 #else
0070 #define is_vmd(bus) false
0071 #endif
0072
0073
0074
0075
0076
0077 extern unsigned int pcibios_assign_all_busses(void);
0078 extern int pci_legacy_init(void);
0079 #else
0080 static inline int pcibios_assign_all_busses(void) { return 0; }
0081 #endif
0082
0083 extern unsigned long pci_mem_start;
0084 #define PCIBIOS_MIN_IO 0x1000
0085 #define PCIBIOS_MIN_MEM (pci_mem_start)
0086
0087 #define PCIBIOS_MIN_CARDBUS_IO 0x4000
0088
0089 extern int pcibios_enabled;
0090 void pcibios_scan_root(int bus);
0091
0092 struct irq_routing_table *pcibios_get_irq_routing_table(void);
0093 int pcibios_set_irq_routing(struct pci_dev *dev, int pin, int irq);
0094
0095
0096 #define HAVE_PCI_MMAP
0097 #define arch_can_pci_mmap_wc() pat_enabled()
0098 #define ARCH_GENERIC_PCI_MMAP_RESOURCE
0099
0100 #ifdef CONFIG_PCI
0101 extern void early_quirks(void);
0102 #else
0103 static inline void early_quirks(void) { }
0104 #endif
0105
0106 extern void pci_iommu_alloc(void);
0107
0108 #ifdef CONFIG_NUMA
0109
0110 static inline int __pcibus_to_node(const struct pci_bus *bus)
0111 {
0112 return to_pci_sysdata(bus)->node;
0113 }
0114
0115 static inline const struct cpumask *
0116 cpumask_of_pcibus(const struct pci_bus *bus)
0117 {
0118 int node;
0119
0120 node = __pcibus_to_node(bus);
0121 return (node == NUMA_NO_NODE) ? cpu_online_mask :
0122 cpumask_of_node(node);
0123 }
0124 #endif
0125
0126 struct pci_setup_rom {
0127 struct setup_data data;
0128 uint16_t vendor;
0129 uint16_t devid;
0130 uint64_t pcilen;
0131 unsigned long segment;
0132 unsigned long bus;
0133 unsigned long device;
0134 unsigned long function;
0135 uint8_t romdata[];
0136 };
0137
0138 #endif