Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/pci/pci_iov.c
Show First 20 Lines • Show All 720 Lines • ▼ Show 20 Lines | pci_iov_config(struct cdev *cdev, struct pci_iov_arg *arg) | ||||
IOV_WRITE(dinfo, PCIR_SRIOV_NUM_VFS, num_vfs, 2); | IOV_WRITE(dinfo, PCIR_SRIOV_NUM_VFS, num_vfs, 2); | ||||
rid_off = IOV_READ(dinfo, PCIR_SRIOV_VF_OFF, 2); | rid_off = IOV_READ(dinfo, PCIR_SRIOV_VF_OFF, 2); | ||||
rid_stride = IOV_READ(dinfo, PCIR_SRIOV_VF_STRIDE, 2); | rid_stride = IOV_READ(dinfo, PCIR_SRIOV_VF_STRIDE, 2); | ||||
first_rid = pci_get_rid(dev) + rid_off; | first_rid = pci_get_rid(dev) + rid_off; | ||||
last_rid = first_rid + (num_vfs - 1) * rid_stride; | last_rid = first_rid + (num_vfs - 1) * rid_stride; | ||||
/* We don't yet support allocating extra bus numbers for VFs. */ | |||||
if (pci_get_bus(dev) != PCI_RID2BUS(last_rid)) { | |||||
error = ENOSPC; | |||||
goto out; | |||||
} | |||||
iov_ctl = IOV_READ(dinfo, PCIR_SRIOV_CTL, 2); | iov_ctl = IOV_READ(dinfo, PCIR_SRIOV_CTL, 2); | ||||
iov_ctl &= ~(PCIM_SRIOV_VF_EN | PCIM_SRIOV_VF_MSE); | iov_ctl &= ~(PCIM_SRIOV_VF_EN | PCIM_SRIOV_VF_MSE); | ||||
IOV_WRITE(dinfo, PCIR_SRIOV_CTL, iov_ctl, 2); | IOV_WRITE(dinfo, PCIR_SRIOV_CTL, iov_ctl, 2); | ||||
error = pci_iov_init_rman(dev, iov); | error = pci_iov_init_rman(dev, iov); | ||||
if (error != 0) | if (error != 0) | ||||
goto out; | goto out; | ||||
▲ Show 20 Lines • Show All 322 Lines • Show Last 20 Lines |