Lines Matching refs:vpd
187 if (!dev->vpd || !dev->vpd->ops) in pci_read_vpd()
189 return dev->vpd->ops->read(dev, pos, count, buf); in pci_read_vpd()
203 if (!dev->vpd || !dev->vpd->ops) in pci_write_vpd()
205 return dev->vpd->ops->write(dev, pos, count, buf); in pci_write_vpd()
300 struct pci_vpd_pci22 *vpd = in pci_vpd_pci22_wait() local
301 container_of(dev->vpd, struct pci_vpd_pci22, base); in pci_vpd_pci22_wait()
306 if (!vpd->busy) in pci_vpd_pci22_wait()
310 ret = pci_user_read_config_word(dev, vpd->cap + PCI_VPD_ADDR, in pci_vpd_pci22_wait()
315 if ((status & PCI_VPD_ADDR_F) == vpd->flag) { in pci_vpd_pci22_wait()
316 vpd->busy = false; in pci_vpd_pci22_wait()
334 struct pci_vpd_pci22 *vpd = in pci_vpd_pci22_read() local
335 container_of(dev->vpd, struct pci_vpd_pci22, base); in pci_vpd_pci22_read()
340 if (pos < 0 || pos > vpd->base.len || end > vpd->base.len) in pci_vpd_pci22_read()
343 if (mutex_lock_killable(&vpd->lock)) in pci_vpd_pci22_read()
354 ret = pci_user_write_config_word(dev, vpd->cap + PCI_VPD_ADDR, in pci_vpd_pci22_read()
358 vpd->busy = true; in pci_vpd_pci22_read()
359 vpd->flag = PCI_VPD_ADDR_F; in pci_vpd_pci22_read()
364 ret = pci_user_read_config_dword(dev, vpd->cap + PCI_VPD_DATA, &val); in pci_vpd_pci22_read()
379 mutex_unlock(&vpd->lock); in pci_vpd_pci22_read()
386 struct pci_vpd_pci22 *vpd = in pci_vpd_pci22_write() local
387 container_of(dev->vpd, struct pci_vpd_pci22, base); in pci_vpd_pci22_write()
392 if (pos < 0 || (pos & 3) || (count & 3) || end > vpd->base.len) in pci_vpd_pci22_write()
395 if (mutex_lock_killable(&vpd->lock)) in pci_vpd_pci22_write()
410 ret = pci_user_write_config_dword(dev, vpd->cap + PCI_VPD_DATA, val); in pci_vpd_pci22_write()
413 ret = pci_user_write_config_word(dev, vpd->cap + PCI_VPD_ADDR, in pci_vpd_pci22_write()
418 vpd->busy = true; in pci_vpd_pci22_write()
419 vpd->flag = 0; in pci_vpd_pci22_write()
427 mutex_unlock(&vpd->lock); in pci_vpd_pci22_write()
433 kfree(container_of(dev->vpd, struct pci_vpd_pci22, base)); in pci_vpd_pci22_release()
480 struct pci_vpd_pci22 *vpd; in pci_vpd_pci22_init() local
487 vpd = kzalloc(sizeof(*vpd), GFP_ATOMIC); in pci_vpd_pci22_init()
488 if (!vpd) in pci_vpd_pci22_init()
491 vpd->base.len = PCI_VPD_PCI22_SIZE; in pci_vpd_pci22_init()
493 vpd->base.ops = &pci_vpd_f0_ops; in pci_vpd_pci22_init()
495 vpd->base.ops = &pci_vpd_pci22_ops; in pci_vpd_pci22_init()
496 mutex_init(&vpd->lock); in pci_vpd_pci22_init()
497 vpd->cap = cap; in pci_vpd_pci22_init()
498 vpd->busy = false; in pci_vpd_pci22_init()
499 dev->vpd = &vpd->base; in pci_vpd_pci22_init()