Lines Matching full:vpd
3 * PCI VPD support
14 /* VPD access through PCI 2.2+ VPD capability */
24 struct bin_attribute *attr; /* Descriptor for sysfs VPD entry */
36 * @pos: offset in vpd space
42 if (!dev->vpd || !dev->vpd->ops) in pci_read_vpd()
44 return dev->vpd->ops->read(dev, pos, count, buf); in pci_read_vpd()
51 * @pos: offset in vpd space
57 if (!dev->vpd || !dev->vpd->ops) in pci_write_vpd()
59 return dev->vpd->ops->write(dev, pos, count, buf); in pci_write_vpd()
66 * @len: size of vpd space
70 if (!dev->vpd || !dev->vpd->ops) in pci_set_vpd_size()
72 return dev->vpd->ops->set_size(dev, len); in pci_set_vpd_size()
101 pci_warn(dev, "invalid large VPD tag %02x size at offset %zu", in pci_vpd_size()
121 pci_warn(dev, "invalid %s VPD tag %02x at offset %zu", in pci_vpd_size()
133 * hardware. Since the VPD is often implemented by serial attachment to an
140 struct pci_vpd *vpd = dev->vpd; in pci_vpd_wait() local
146 if (!vpd->busy) in pci_vpd_wait()
150 ret = pci_user_read_config_word(dev, vpd->cap + PCI_VPD_ADDR, in pci_vpd_wait()
155 if ((status & PCI_VPD_ADDR_F) == vpd->flag) { in pci_vpd_wait()
156 vpd->busy = 0; in pci_vpd_wait()
171 …pci_warn(dev, "VPD access failed. This is likely a firmware bug on this device. Contact the card… in pci_vpd_wait()
178 struct pci_vpd *vpd = dev->vpd; in pci_vpd_read() local
186 if (!vpd->valid) { in pci_vpd_read()
187 vpd->valid = 1; in pci_vpd_read()
188 vpd->len = pci_vpd_size(dev, vpd->len); in pci_vpd_read()
191 if (vpd->len == 0) in pci_vpd_read()
194 if (pos > vpd->len) in pci_vpd_read()
197 if (end > vpd->len) { in pci_vpd_read()
198 end = vpd->len; in pci_vpd_read()
202 if (mutex_lock_killable(&vpd->lock)) in pci_vpd_read()
213 ret = pci_user_write_config_word(dev, vpd->cap + PCI_VPD_ADDR, in pci_vpd_read()
217 vpd->busy = 1; in pci_vpd_read()
218 vpd->flag = PCI_VPD_ADDR_F; in pci_vpd_read()
223 ret = pci_user_read_config_dword(dev, vpd->cap + PCI_VPD_DATA, &val); in pci_vpd_read()
238 mutex_unlock(&vpd->lock); in pci_vpd_read()
245 struct pci_vpd *vpd = dev->vpd; in pci_vpd_write() local
253 if (!vpd->valid) { in pci_vpd_write()
254 vpd->valid = 1; in pci_vpd_write()
255 vpd->len = pci_vpd_size(dev, vpd->len); in pci_vpd_write()
258 if (vpd->len == 0) in pci_vpd_write()
261 if (end > vpd->len) in pci_vpd_write()
264 if (mutex_lock_killable(&vpd->lock)) in pci_vpd_write()
279 ret = pci_user_write_config_dword(dev, vpd->cap + PCI_VPD_DATA, val); in pci_vpd_write()
282 ret = pci_user_write_config_word(dev, vpd->cap + PCI_VPD_ADDR, in pci_vpd_write()
287 vpd->busy = 1; in pci_vpd_write()
288 vpd->flag = 0; in pci_vpd_write()
296 mutex_unlock(&vpd->lock); in pci_vpd_write()
302 struct pci_vpd *vpd = dev->vpd; in pci_vpd_set_size() local
307 vpd->valid = 1; in pci_vpd_set_size()
308 vpd->len = len; in pci_vpd_set_size()
371 struct pci_vpd *vpd; in pci_vpd_init() local
378 vpd = kzalloc(sizeof(*vpd), GFP_ATOMIC); in pci_vpd_init()
379 if (!vpd) in pci_vpd_init()
382 vpd->len = PCI_VPD_MAX_SIZE; in pci_vpd_init()
384 vpd->ops = &pci_vpd_f0_ops; in pci_vpd_init()
386 vpd->ops = &pci_vpd_ops; in pci_vpd_init()
387 mutex_init(&vpd->lock); in pci_vpd_init()
388 vpd->cap = cap; in pci_vpd_init()
389 vpd->busy = 0; in pci_vpd_init()
390 vpd->valid = 0; in pci_vpd_init()
391 dev->vpd = vpd; in pci_vpd_init()
397 kfree(dev->vpd); in pci_vpd_release()
437 if (!dev->vpd) in pcie_vpd_create_sysfs_dev_files()
446 attr->attr.name = "vpd"; in pcie_vpd_create_sysfs_dev_files()
456 dev->vpd->attr = attr; in pcie_vpd_create_sysfs_dev_files()
461 if (dev->vpd && dev->vpd->attr) { in pcie_vpd_remove_sysfs_dev_files()
462 sysfs_remove_bin_file(&dev->dev.kobj, dev->vpd->attr); in pcie_vpd_remove_sysfs_dev_files()
463 kfree(dev->vpd->attr); in pcie_vpd_remove_sysfs_dev_files()
522 * Quirk non-zero PCI functions to route VPD access through function 0 for
523 * devices that share VPD resources between functions. The functions are
537 if (f0->vpd && dev->class == f0->class && in quirk_f0_vpd_link()
547 * If a device follows the VPD format spec, the PCI core will not read or
548 * write past the VPD End Tag. But some vendors do not follow the VPD
551 * so we don't touch VPD at all.
555 if (dev->vpd) { in quirk_blacklist_vpd()
556 dev->vpd->len = 0; in quirk_blacklist_vpd()
557 pci_warn(dev, FW_BUG "disabling VPD access (can't determine size of non-standard VPD format)\n"); in quirk_blacklist_vpd()
582 * VPD end tag will hang the device. This problem was initially
583 * observed when a vpd entry was created in sysfs
584 * ('/sys/bus/pci/devices/<id>/vpd'). A read to this sysfs entry
586 * beyond the VPD end tag causing the device to hang. Once the device
594 * Only disable the VPD capability for 5706, 5706S, 5708, in quirk_brcm_570x_limit_vpd()
603 if (dev->vpd) in quirk_brcm_570x_limit_vpd()
604 dev->vpd->len = 0x80; in quirk_brcm_570x_limit_vpd()
633 * If this is a T3-based adapter, there's a 1KB VPD area at offset in quirk_chelsio_extend_vpd()
634 * 0xc00 which contains the preferred VPD values. If this is a T4 or in quirk_chelsio_extend_vpd()
635 * later based adapter, the special VPD is at offset 0x400 for the in quirk_chelsio_extend_vpd()
636 * Physical Functions (the SR-IOV Virtual Functions have no VPD in quirk_chelsio_extend_vpd()
637 * Capabilities). The PCI VPD Access core routines will normally in quirk_chelsio_extend_vpd()
638 * compute the size of the VPD by parsing the VPD Data Structure at in quirk_chelsio_extend_vpd()
640 * to accesses these other VPD areas which are beyond those computed in quirk_chelsio_extend_vpd()