{
pci_aer_exit(dev);
pci_rcec_exit(dev);
{
pci_aer_exit(dev);
pci_rcec_exit(dev);
pci_iov_release(dev);
pci_free_cap_save_buffers(dev);
}
pci_iov_release(dev);
pci_free_cap_save_buffers(dev);
}
/* VPD access through PCI 2.2+ VPD capability */
/* VPD access through PCI 2.2+ VPD capability */
-struct pci_vpd {
- struct mutex lock;
- unsigned int len;
- u8 cap;
-};
-
static struct pci_dev *pci_get_func0_dev(struct pci_dev *dev)
{
return pci_get_slot(dev->bus, PCI_DEVFN(PCI_SLOT(dev->devfn), 0));
static struct pci_dev *pci_get_func0_dev(struct pci_dev *dev)
{
return pci_get_slot(dev->bus, PCI_DEVFN(PCI_SLOT(dev->devfn), 0));
unsigned char tag, header[1+2]; /* 1 byte tag, 2 bytes length */
/* Otherwise the following reads would fail. */
unsigned char tag, header[1+2]; /* 1 byte tag, 2 bytes length */
/* Otherwise the following reads would fail. */
- dev->vpd->len = PCI_VPD_MAX_SIZE;
+ dev->vpd.len = PCI_VPD_MAX_SIZE;
while (pci_read_vpd(dev, off, 1, header) == 1) {
size = 0;
while (pci_read_vpd(dev, off, 1, header) == 1) {
size = 0;
*/
static int pci_vpd_wait(struct pci_dev *dev, bool set)
{
*/
static int pci_vpd_wait(struct pci_dev *dev, bool set)
{
- struct pci_vpd *vpd = dev->vpd;
+ struct pci_vpd *vpd = &dev->vpd;
unsigned long timeout = jiffies + msecs_to_jiffies(125);
unsigned long max_sleep = 16;
u16 status;
unsigned long timeout = jiffies + msecs_to_jiffies(125);
unsigned long max_sleep = 16;
u16 status;
static ssize_t pci_vpd_read(struct pci_dev *dev, loff_t pos, size_t count,
void *arg)
{
static ssize_t pci_vpd_read(struct pci_dev *dev, loff_t pos, size_t count,
void *arg)
{
- struct pci_vpd *vpd = dev->vpd;
+ struct pci_vpd *vpd = &dev->vpd;
int ret = 0;
loff_t end = pos + count;
u8 *buf = arg;
int ret = 0;
loff_t end = pos + count;
u8 *buf = arg;
return -ENODEV;
if (pos < 0)
return -ENODEV;
if (pos < 0)
static ssize_t pci_vpd_write(struct pci_dev *dev, loff_t pos, size_t count,
const void *arg)
{
static ssize_t pci_vpd_write(struct pci_dev *dev, loff_t pos, size_t count,
const void *arg)
{
- struct pci_vpd *vpd = dev->vpd;
+ struct pci_vpd *vpd = &dev->vpd;
const u8 *buf = arg;
loff_t end = pos + count;
int ret = 0;
const u8 *buf = arg;
loff_t end = pos + count;
int ret = 0;
return -ENODEV;
if (pos < 0 || (pos & 3) || (count & 3))
return -ENODEV;
if (pos < 0 || (pos & 3) || (count & 3))
void pci_vpd_init(struct pci_dev *dev)
{
void pci_vpd_init(struct pci_dev *dev)
{
- struct pci_vpd *vpd;
- u8 cap;
-
- cap = pci_find_capability(dev, PCI_CAP_ID_VPD);
- if (!cap)
- return;
-
- vpd = kzalloc(sizeof(*vpd), GFP_ATOMIC);
- if (!vpd)
- return;
-
- mutex_init(&vpd->lock);
- vpd->cap = cap;
- dev->vpd = vpd;
-}
-
-void pci_vpd_release(struct pci_dev *dev)
-{
- kfree(dev->vpd);
+ dev->vpd.cap = pci_find_capability(dev, PCI_CAP_ID_VPD);
+ mutex_init(&dev->vpd.lock);
}
static ssize_t vpd_read(struct file *filp, struct kobject *kobj,
}
static ssize_t vpd_read(struct file *filp, struct kobject *kobj,
{
struct pci_dev *pdev = to_pci_dev(kobj_to_dev(kobj));
{
struct pci_dev *pdev = to_pci_dev(kobj_to_dev(kobj));
return 0;
return a->attr.mode;
return 0;
return a->attr.mode;
- if (f0->vpd && dev->class == f0->class &&
+ if (f0->vpd.cap && dev->class == f0->class &&
dev->vendor == f0->vendor && dev->device == f0->device)
dev->dev_flags |= PCI_DEV_FLAGS_VPD_REF_F0;
dev->vendor == f0->vendor && dev->device == f0->device)
dev->dev_flags |= PCI_DEV_FLAGS_VPD_REF_F0;
*/
static void quirk_blacklist_vpd(struct pci_dev *dev)
{
*/
static void quirk_blacklist_vpd(struct pci_dev *dev)
{
- if (dev->vpd) {
- dev->vpd->len = PCI_VPD_SZ_INVALID;
- pci_warn(dev, FW_BUG "disabling VPD access (can't determine size of non-standard VPD format)\n");
- }
+ dev->vpd.len = PCI_VPD_SZ_INVALID;
+ pci_warn(dev, FW_BUG "disabling VPD access (can't determine size of non-standard VPD format)\n");
}
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_LSI_LOGIC, 0x0060, quirk_blacklist_vpd);
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_LSI_LOGIC, 0x007c, quirk_blacklist_vpd);
}
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_LSI_LOGIC, 0x0060, quirk_blacklist_vpd);
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_LSI_LOGIC, 0x007c, quirk_blacklist_vpd);
DECLARE_PCI_FIXUP_CLASS_FINAL(PCI_VENDOR_ID_AMAZON_ANNAPURNA_LABS, 0x0031,
PCI_CLASS_BRIDGE_PCI, 8, quirk_blacklist_vpd);
DECLARE_PCI_FIXUP_CLASS_FINAL(PCI_VENDOR_ID_AMAZON_ANNAPURNA_LABS, 0x0031,
PCI_CLASS_BRIDGE_PCI, 8, quirk_blacklist_vpd);
-static void pci_vpd_set_size(struct pci_dev *dev, size_t len)
-{
- struct pci_vpd *vpd = dev->vpd;
-
- if (!vpd || len == 0 || len > PCI_VPD_MAX_SIZE)
- return;
-
- vpd->len = len;
-}
-
static void quirk_chelsio_extend_vpd(struct pci_dev *dev)
{
int chip = (dev->device & 0xf000) >> 12;
static void quirk_chelsio_extend_vpd(struct pci_dev *dev)
{
int chip = (dev->device & 0xf000) >> 12;
* limits.
*/
if (chip == 0x0 && prod >= 0x20)
* limits.
*/
if (chip == 0x0 && prod >= 0x20)
- pci_vpd_set_size(dev, 8192);
else if (chip >= 0x4 && func < 0x8)
else if (chip >= 0x4 && func < 0x8)
- pci_vpd_set_size(dev, 2048);
}
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CHELSIO, PCI_ANY_ID,
}
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CHELSIO, PCI_ANY_ID,
struct pci_cap_saved_data cap;
};
struct pci_cap_saved_data cap;
};
+struct pci_vpd {
+ struct mutex lock;
+ unsigned int len;
+ u8 cap;
+};
+
struct irq_affinity;
struct pcie_link_state;
struct irq_affinity;
struct pcie_link_state;
struct pci_sriov;
struct pci_p2pdma;
struct rcec_ea;
struct pci_sriov;
struct pci_p2pdma;
struct rcec_ea;
#ifdef CONFIG_PCI_MSI
const struct attribute_group **msi_irq_groups;
#endif
#ifdef CONFIG_PCI_MSI
const struct attribute_group **msi_irq_groups;
#endif
#ifdef CONFIG_PCIE_DPC
u16 dpc_cap;
unsigned int dpc_rp_extensions:1;
#ifdef CONFIG_PCIE_DPC
u16 dpc_cap;
unsigned int dpc_rp_extensions:1;