Lines Matching refs:iov
86 struct pci_sriov *iov = dev->sriov; in pci_iov_set_numvfs() local
88 pci_write_config_word(dev, iov->pos + PCI_SRIOV_NUM_VF, nr_virtfn); in pci_iov_set_numvfs()
89 pci_read_config_word(dev, iov->pos + PCI_SRIOV_VF_OFFSET, &iov->offset); in pci_iov_set_numvfs()
90 pci_read_config_word(dev, iov->pos + PCI_SRIOV_VF_STRIDE, &iov->stride); in pci_iov_set_numvfs()
102 struct pci_sriov *iov = dev->sriov; in compute_max_vf_buses() local
105 for (nr_virtfn = iov->total_VFs; nr_virtfn; nr_virtfn--) { in compute_max_vf_buses()
107 if (!iov->offset || (nr_virtfn > 1 && !iov->stride)) { in compute_max_vf_buses()
113 if (busnr > iov->max_VF_buses) in compute_max_vf_buses()
114 iov->max_VF_buses = busnr; in compute_max_vf_buses()
295 struct pci_sriov *iov = dev->sriov; in pci_iov_add_virtfn() local
308 virtfn->device = iov->vf_device; in pci_iov_add_virtfn()
605 struct pci_sriov *iov = dev->sriov; in sriov_enable() local
612 if (iov->num_VFs) in sriov_enable()
615 pci_read_config_word(dev, iov->pos + PCI_SRIOV_INITIAL_VF, &initial); in sriov_enable()
616 if (initial > iov->total_VFs || in sriov_enable()
617 (!(iov->cap & PCI_SRIOV_CAP_VFM) && (initial != iov->total_VFs))) in sriov_enable()
620 if (nr_virtfn < 0 || nr_virtfn > iov->total_VFs || in sriov_enable()
621 (!(iov->cap & PCI_SRIOV_CAP_VFM) && (nr_virtfn > initial))) in sriov_enable()
631 if (nres != iov->nres) { in sriov_enable()
648 if (iov->link != dev->devfn) { in sriov_enable()
649 pdev = pci_get_slot(dev->bus, iov->link); in sriov_enable()
665 iov->initial_VFs = initial; in sriov_enable()
676 iov->ctrl |= PCI_SRIOV_CTRL_VFE | PCI_SRIOV_CTRL_MSE; in sriov_enable()
678 pci_write_config_word(dev, iov->pos + PCI_SRIOV_CTRL, iov->ctrl); in sriov_enable()
687 iov->num_VFs = nr_virtfn; in sriov_enable()
692 iov->ctrl &= ~(PCI_SRIOV_CTRL_VFE | PCI_SRIOV_CTRL_MSE); in sriov_enable()
694 pci_write_config_word(dev, iov->pos + PCI_SRIOV_CTRL, iov->ctrl); in sriov_enable()
700 if (iov->link != dev->devfn) in sriov_enable()
709 struct pci_sriov *iov = dev->sriov; in sriov_del_vfs() local
712 for (i = 0; i < iov->num_VFs; i++) in sriov_del_vfs()
718 struct pci_sriov *iov = dev->sriov; in sriov_disable() local
720 if (!iov->num_VFs) in sriov_disable()
724 iov->ctrl &= ~(PCI_SRIOV_CTRL_VFE | PCI_SRIOV_CTRL_MSE); in sriov_disable()
726 pci_write_config_word(dev, iov->pos + PCI_SRIOV_CTRL, iov->ctrl); in sriov_disable()
732 if (iov->link != dev->devfn) in sriov_disable()
735 iov->num_VFs = 0; in sriov_disable()
746 struct pci_sriov *iov; in sriov_init() local
781 iov = kzalloc(sizeof(*iov), GFP_KERNEL); in sriov_init()
782 if (!iov) in sriov_init()
803 iov->barsz[i] = resource_size(res); in sriov_init()
811 iov->pos = pos; in sriov_init()
812 iov->nres = nres; in sriov_init()
813 iov->ctrl = ctrl; in sriov_init()
814 iov->total_VFs = total; in sriov_init()
815 iov->driver_max_VFs = total; in sriov_init()
816 pci_read_config_word(dev, pos + PCI_SRIOV_VF_DID, &iov->vf_device); in sriov_init()
817 iov->pgsz = pgsz; in sriov_init()
818 iov->self = dev; in sriov_init()
819 iov->drivers_autoprobe = true; in sriov_init()
820 pci_read_config_dword(dev, pos + PCI_SRIOV_CAP, &iov->cap); in sriov_init()
821 pci_read_config_byte(dev, pos + PCI_SRIOV_FUNC_LINK, &iov->link); in sriov_init()
823 iov->link = PCI_DEVFN(PCI_SLOT(dev->devfn), iov->link); in sriov_init()
826 iov->dev = pci_dev_get(pdev); in sriov_init()
828 iov->dev = dev; in sriov_init()
830 dev->sriov = iov; in sriov_init()
847 kfree(iov); in sriov_init()
866 struct pci_sriov *iov = dev->sriov; in sriov_restore_state() local
868 pci_read_config_word(dev, iov->pos + PCI_SRIOV_CTRL, &ctrl); in sriov_restore_state()
877 ctrl |= iov->ctrl & PCI_SRIOV_CTRL_ARI; in sriov_restore_state()
878 pci_write_config_word(dev, iov->pos + PCI_SRIOV_CTRL, ctrl); in sriov_restore_state()
883 pci_write_config_dword(dev, iov->pos + PCI_SRIOV_SYS_PGSIZE, iov->pgsz); in sriov_restore_state()
884 pci_iov_set_numvfs(dev, iov->num_VFs); in sriov_restore_state()
885 pci_write_config_word(dev, iov->pos + PCI_SRIOV_CTRL, iov->ctrl); in sriov_restore_state()
886 if (iov->ctrl & PCI_SRIOV_CTRL_VFE) in sriov_restore_state()
926 struct pci_sriov *iov = dev->sriov; in pci_iov_remove() local
931 iov->driver_max_VFs = iov->total_VFs; in pci_iov_remove()
932 if (iov->num_VFs) in pci_iov_remove()
945 struct pci_sriov *iov = dev->is_physfn ? dev->sriov : NULL; in pci_iov_update_resource() local
958 if (!iov) in pci_iov_update_resource()
961 pci_read_config_word(dev, iov->pos + PCI_SRIOV_CTRL, &cmd); in pci_iov_update_resource()
986 reg = iov->pos + PCI_SRIOV_BAR + 4 * vf_bar; in pci_iov_update_resource()