742,9 → 742,26 |
.vendor = PCI_VENDOR_ID_##vend, .device = (dev), \ |
.subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID, 0, 0 |
|
enum { |
PCI_REASSIGN_ALL_RSRC = 0x00000001, /* ignore firmware setup */ |
PCI_REASSIGN_ALL_BUS = 0x00000002, /* reassign all bus numbers */ |
PCI_PROBE_ONLY = 0x00000004, /* use existing setup */ |
PCI_CAN_SKIP_ISA_ALIGN = 0x00000008, /* don't do ISA alignment */ |
PCI_ENABLE_PROC_DOMAINS = 0x00000010, /* enable domains in /proc */ |
PCI_COMPAT_DOMAIN_0 = 0x00000020, /* ... except domain 0 */ |
PCI_SCAN_ALL_PCIE_DEVS = 0x00000040, /* scan all, not just dev 0 */ |
}; |
|
/* these external functions are only available when PCI support is enabled */ |
#ifdef CONFIG_PCI |
|
extern unsigned int pci_flags; |
|
static inline void pci_set_flags(int flags) { pci_flags = flags; } |
static inline void pci_add_flags(int flags) { pci_flags |= flags; } |
static inline void pci_clear_flags(int flags) { pci_flags &= ~flags; } |
static inline int pci_has_flag(int flag) { return pci_flags & flag; } |
|
void pcie_bus_configure_settings(struct pci_bus *bus); |
|
enum pcie_bus_config_types { |
766,6 → 783,7 |
int no_pci_devices(void); |
|
void pcibios_resource_survey_bus(struct pci_bus *bus); |
void pcibios_bus_add_device(struct pci_dev *pdev); |
void pcibios_add_bus(struct pci_bus *bus); |
void pcibios_remove_bus(struct pci_bus *bus); |
void pcibios_fixup_bus(struct pci_bus *); |
1006,8 → 1024,6 |
bool pci_intx_mask_supported(struct pci_dev *dev); |
bool pci_check_and_mask_intx(struct pci_dev *dev); |
bool pci_check_and_unmask_intx(struct pci_dev *dev); |
int pci_set_dma_max_seg_size(struct pci_dev *dev, unsigned int size); |
int pci_set_dma_seg_boundary(struct pci_dev *dev, unsigned long mask); |
int pci_wait_for_pending(struct pci_dev *dev, int pos, u16 mask); |
int pci_wait_for_pending_transaction(struct pci_dev *dev); |
int pcix_get_max_mmrbc(struct pci_dev *dev); |
1100,6 → 1116,7 |
/* Vital product data routines */ |
ssize_t pci_read_vpd(struct pci_dev *dev, loff_t pos, size_t count, void *buf); |
ssize_t pci_write_vpd(struct pci_dev *dev, loff_t pos, size_t count, const void *buf); |
int pci_set_vpd_size(struct pci_dev *dev, size_t len); |
|
/* Helper functions for low-level code (drivers/pci/setup-[bus,res].c) */ |
resource_size_t pcibios_retrieve_fw_addr(struct pci_dev *dev, int idx); |
1231,6 → 1248,7 |
|
int pci_set_vga_state(struct pci_dev *pdev, bool decode, |
unsigned int command_bits, u32 flags); |
|
/* kmem_cache style wrapper around pci_alloc_consistent() */ |
|
#include <linux/pci-dma.h> |
1398,6 → 1416,11 |
|
#else /* CONFIG_PCI is not enabled */ |
|
static inline void pci_set_flags(int flags) { } |
static inline void pci_add_flags(int flags) { } |
static inline void pci_clear_flags(int flags) { } |
static inline int pci_has_flag(int flag) { return 0; } |
|
/* |
* If the system does not have PCI, clearly these return errors. Define |
* these as simple inline functions to avoid hair in drivers. |
1437,16 → 1460,6 |
static inline void pci_set_master(struct pci_dev *dev) { } |
static inline int pci_enable_device(struct pci_dev *dev) { return -EIO; } |
static inline void pci_disable_device(struct pci_dev *dev) { } |
static inline int pci_set_dma_mask(struct pci_dev *dev, u64 mask) |
{ return -EIO; } |
static inline int pci_set_consistent_dma_mask(struct pci_dev *dev, u64 mask) |
{ return -EIO; } |
static inline int pci_set_dma_max_seg_size(struct pci_dev *dev, |
unsigned int size) |
{ return -EIO; } |
static inline int pci_set_dma_seg_boundary(struct pci_dev *dev, |
unsigned long mask) |
{ return -EIO; } |
static inline int pci_assign_resource(struct pci_dev *dev, int i) |
{ return -EBUSY; } |
static inline int __pci_register_driver(struct pci_driver *drv, |
1508,6 → 1521,10 |
|
#include <asm/pci.h> |
|
#ifndef pci_root_bus_fwnode |
#define pci_root_bus_fwnode(bus) NULL |
#endif |
|
/* these helpers provide future and backwards compatibility |
* for accessing popular PCI BAR info */ |
#define pci_resource_start(dev, bar) ((dev)->resource[(bar)].start) |
1731,6 → 1748,8 |
|
int pci_enable_sriov(struct pci_dev *dev, int nr_virtfn); |
void pci_disable_sriov(struct pci_dev *dev); |
int pci_iov_add_virtfn(struct pci_dev *dev, int id, int reset); |
void pci_iov_remove_virtfn(struct pci_dev *dev, int id, int reset); |
int pci_num_vf(struct pci_dev *dev); |
int pci_vfs_assigned(struct pci_dev *dev); |
int pci_sriov_set_totalvfs(struct pci_dev *dev, u16 numvfs); |
1747,6 → 1766,12 |
} |
static inline int pci_enable_sriov(struct pci_dev *dev, int nr_virtfn) |
{ return -ENODEV; } |
static inline int pci_iov_add_virtfn(struct pci_dev *dev, int id, int reset) |
{ |
return -ENOSYS; |
} |
static inline void pci_iov_remove_virtfn(struct pci_dev *dev, |
int id, int reset) { } |
static inline void pci_disable_sriov(struct pci_dev *dev) { } |
static inline int pci_num_vf(struct pci_dev *dev) { return 0; } |
static inline int pci_vfs_assigned(struct pci_dev *dev) |
1827,12 → 1852,13 |
#define PCI_VPD_LRDT_RW_DATA PCI_VPD_LRDT_ID(PCI_VPD_LTIN_RW_DATA) |
|
/* Small Resource Data Type Tag Item Names */ |
#define PCI_VPD_STIN_END 0x78 /* End */ |
#define PCI_VPD_STIN_END 0x0f /* End */ |
|
#define PCI_VPD_SRDT_END PCI_VPD_STIN_END |
#define PCI_VPD_SRDT_END (PCI_VPD_STIN_END << 3) |
|
#define PCI_VPD_SRDT_TIN_MASK 0x78 |
#define PCI_VPD_SRDT_LEN_MASK 0x07 |
#define PCI_VPD_LRDT_TIN_MASK 0x7f |
|
#define PCI_VPD_LRDT_TAG_SIZE 3 |
#define PCI_VPD_SRDT_TAG_SIZE 1 |
1856,6 → 1882,17 |
} |
|
/** |
* pci_vpd_lrdt_tag - Extracts the Large Resource Data Type Tag Item |
* @lrdt: Pointer to the beginning of the Large Resource Data Type tag |
* |
* Returns the extracted Large Resource Data Type Tag item. |
*/ |
static inline u16 pci_vpd_lrdt_tag(const u8 *lrdt) |
{ |
return (u16)(lrdt[0] & PCI_VPD_LRDT_TIN_MASK); |
} |
|
/** |
* pci_vpd_srdt_size - Extracts the Small Resource Data Type length |
* @lrdt: Pointer to the beginning of the Small Resource Data Type tag |
* |
1867,6 → 1904,17 |
} |
|
/** |
* pci_vpd_srdt_tag - Extracts the Small Resource Data Type Tag Item |
* @lrdt: Pointer to the beginning of the Small Resource Data Type tag |
* |
* Returns the extracted Small Resource Data Type Tag Item. |
*/ |
static inline u8 pci_vpd_srdt_tag(const u8 *srdt) |
{ |
return ((*srdt) & PCI_VPD_SRDT_TIN_MASK) >> 3; |
} |
|
/** |
* pci_vpd_info_field_size - Extracts the information field length |
* @lrdt: Pointer to the beginning of an information field header |
* |
1983,6 → 2031,9 |
return bus->self && bus->self->ari_enabled; |
} |
|
/* provide the legacy pci_dma_* API */ |
#include <linux/pci-dma-compat.h> |
|
typedef struct |
{ |
struct list_head link; |