linux/arch/x86/include/asm/pci.h
<<
>>
Prefs
   1#ifndef _ASM_X86_PCI_H
   2#define _ASM_X86_PCI_H
   3
   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 <asm/scatterlist.h>
   9#include <asm/io.h>
  10#include <asm/x86_init.h>
  11
  12#ifdef __KERNEL__
  13
  14struct pci_sysdata {
  15        int             domain;         /* PCI domain */
  16        int             node;           /* NUMA node */
  17#ifdef CONFIG_ACPI
  18        struct acpi_device *companion;  /* ACPI companion device */
  19#endif
  20#ifdef CONFIG_X86_64
  21        void            *iommu;         /* IOMMU private data */
  22#endif
  23#ifdef CONFIG_PCI_MSI
  24        struct x86_msi_ops *msi_ops;
  25#endif
  26#if IS_ENABLED(CONFIG_VMD)
  27        bool vmd_domain;                /* True if in Intel VMD domain */
  28#endif
  29};
  30
  31extern int pci_routeirq;
  32extern int noioapicquirk;
  33extern int noioapicreroute;
  34
  35#ifdef CONFIG_PCI
  36
  37#ifdef CONFIG_PCI_DOMAINS
  38static inline int pci_domain_nr(struct pci_bus *bus)
  39{
  40        struct pci_sysdata *sd = bus->sysdata;
  41        return sd->domain;
  42}
  43
  44static inline int pci_proc_domain(struct pci_bus *bus)
  45{
  46        return pci_domain_nr(bus);
  47}
  48#endif
  49
  50static inline bool is_vmd(struct pci_bus *bus)
  51{
  52#if IS_ENABLED(CONFIG_VMD)
  53        struct pci_sysdata *sd = bus->sysdata;
  54
  55        return sd->vmd_domain;
  56#else
  57        return false;
  58#endif
  59}
  60
  61/* Can be used to override the logic in pci_scan_bus for skipping
  62   already-configured bus numbers - to be used for buggy BIOSes
  63   or architectures with incomplete PCI setup by the loader */
  64
  65extern unsigned int pcibios_assign_all_busses(void);
  66extern int pci_legacy_init(void);
  67# ifdef CONFIG_ACPI
  68#  define x86_default_pci_init pci_acpi_init
  69# else
  70#  define x86_default_pci_init pci_legacy_init
  71# endif
  72#else
  73# define pcibios_assign_all_busses()    0
  74# define x86_default_pci_init           NULL
  75#endif
  76
  77extern unsigned long pci_mem_start;
  78#define PCIBIOS_MIN_IO          0x1000
  79#define PCIBIOS_MIN_MEM         (pci_mem_start)
  80
  81#define PCIBIOS_MIN_CARDBUS_IO  0x4000
  82
  83extern int pcibios_enabled;
  84void pcibios_config_init(void);
  85void pcibios_scan_root(int bus);
  86
  87void pcibios_set_master(struct pci_dev *dev);
  88struct irq_routing_table *pcibios_get_irq_routing_table(void);
  89int pcibios_set_irq_routing(struct pci_dev *dev, int pin, int irq);
  90
  91
  92#define HAVE_PCI_MMAP
  93extern int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
  94                               enum pci_mmap_state mmap_state,
  95                               int write_combine);
  96
  97
  98#ifdef CONFIG_PCI
  99extern void early_quirks(void);
 100#else
 101static inline void early_quirks(void) { }
 102#endif
 103
 104extern void pci_iommu_alloc(void);
 105
 106#ifdef CONFIG_PCI_MSI
 107/* implemented in arch/x86/kernel/apic/io_apic. */
 108struct msi_desc;
 109int native_setup_msi_irqs(struct pci_dev *dev, int nvec, int type);
 110void native_teardown_msi_irq(unsigned int irq);
 111void native_restore_msi_irqs(struct pci_dev *dev);
 112int setup_msi_irq(struct pci_dev *dev, struct msi_desc *msidesc,
 113                  unsigned int irq_base, unsigned int irq_offset);
 114#else
 115#define native_setup_msi_irqs           NULL
 116#define native_teardown_msi_irq         NULL
 117#endif
 118
 119#define PCI_DMA_BUS_IS_PHYS (dma_ops->is_phys)
 120
 121#endif  /* __KERNEL__ */
 122
 123#ifdef CONFIG_X86_64
 124#include <asm/pci_64.h>
 125#endif
 126
 127/* generic pci stuff */
 128#include <asm-generic/pci.h>
 129
 130#ifdef CONFIG_NUMA
 131/* Returns the node based on pci bus */
 132static inline int __pcibus_to_node(const struct pci_bus *bus)
 133{
 134        const struct pci_sysdata *sd = bus->sysdata;
 135
 136        return sd->node;
 137}
 138
 139static inline const struct cpumask *
 140cpumask_of_pcibus(const struct pci_bus *bus)
 141{
 142        int node;
 143
 144        node = __pcibus_to_node(bus);
 145        return (node == -1) ? cpu_online_mask :
 146                              cpumask_of_node(node);
 147}
 148#endif
 149
 150struct pci_setup_rom {
 151        struct setup_data data;
 152        uint16_t vendor;
 153        uint16_t devid;
 154        uint64_t pcilen;
 155        unsigned long segment;
 156        unsigned long bus;
 157        unsigned long device;
 158        unsigned long function;
 159        uint8_t romdata[0];
 160};
 161
 162#endif /* _ASM_X86_PCI_H */
 163