Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/pci/pci_iov.c
| Show First 20 Lines • Show All 772 Lines • ▼ Show 20 Lines | pci_iov_config(struct cdev *cdev, struct pci_iov_arg *arg) | ||||
| return (0); | return (0); | ||||
| out: | out: | ||||
| if (iov_inited) | if (iov_inited) | ||||
| PCI_IOV_UNINIT(dev); | PCI_IOV_UNINIT(dev); | ||||
| for (i = 0; i <= PCIR_MAX_BAR_0; i++) { | for (i = 0; i <= PCIR_MAX_BAR_0; i++) { | ||||
| if (iov->iov_bar[i].res != NULL) { | if (iov->iov_bar[i].res != NULL) { | ||||
| pci_release_resource(bus, dev, SYS_RES_MEMORY, | pci_release_resource(bus, dev, iov->iov_bar[i].res); | ||||
| iov->iov_pos + PCIR_SRIOV_BAR(i), | |||||
| iov->iov_bar[i].res); | |||||
| pci_delete_resource(bus, dev, SYS_RES_MEMORY, | pci_delete_resource(bus, dev, SYS_RES_MEMORY, | ||||
| iov->iov_pos + PCIR_SRIOV_BAR(i)); | iov->iov_pos + PCIR_SRIOV_BAR(i)); | ||||
| iov->iov_bar[i].res = NULL; | iov->iov_bar[i].res = NULL; | ||||
| } | } | ||||
| } | } | ||||
| if (iov->iov_flags & IOV_RMAN_INITED) { | if (iov->iov_flags & IOV_RMAN_INITED) { | ||||
| rman_fini(&iov->rman); | rman_fini(&iov->rman); | ||||
| ▲ Show 20 Lines • Show All 93 Lines • ▼ Show 20 Lines | pci_iov_delete_iov_children(struct pci_devinfo *dinfo) | ||||
| 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); | ||||
| IOV_WRITE(dinfo, PCIR_SRIOV_NUM_VFS, 0, 2); | IOV_WRITE(dinfo, PCIR_SRIOV_NUM_VFS, 0, 2); | ||||
| iov->iov_num_vfs = 0; | iov->iov_num_vfs = 0; | ||||
| for (i = 0; i <= PCIR_MAX_BAR_0; i++) { | for (i = 0; i <= PCIR_MAX_BAR_0; i++) { | ||||
| if (iov->iov_bar[i].res != NULL) { | if (iov->iov_bar[i].res != NULL) { | ||||
| pci_release_resource(bus, dev, SYS_RES_MEMORY, | pci_release_resource(bus, dev, iov->iov_bar[i].res); | ||||
| iov->iov_pos + PCIR_SRIOV_BAR(i), | |||||
| iov->iov_bar[i].res); | |||||
| pci_delete_resource(bus, dev, SYS_RES_MEMORY, | pci_delete_resource(bus, dev, SYS_RES_MEMORY, | ||||
| iov->iov_pos + PCIR_SRIOV_BAR(i)); | iov->iov_pos + PCIR_SRIOV_BAR(i)); | ||||
| iov->iov_bar[i].res = NULL; | iov->iov_bar[i].res = NULL; | ||||
| } | } | ||||
| } | } | ||||
| if (iov->iov_flags & IOV_RMAN_INITED) { | if (iov->iov_flags & IOV_RMAN_INITED) { | ||||
| rman_fini(&iov->rman); | rman_fini(&iov->rman); | ||||
| ▲ Show 20 Lines • Show All 157 Lines • ▼ Show 20 Lines | if (flags & RF_ACTIVE) { | ||||
| } | } | ||||
| } | } | ||||
| rle->res = res; | rle->res = res; | ||||
| return (res); | return (res); | ||||
| } | } | ||||
| int | int | ||||
| pci_vf_release_mem_resource(device_t dev, device_t child, int rid, | pci_vf_release_mem_resource(device_t dev, device_t child, struct resource *r) | ||||
| struct resource *r) | |||||
| { | { | ||||
| struct pci_devinfo *dinfo; | struct pci_devinfo *dinfo; | ||||
| struct resource_list_entry *rle; | struct resource_list_entry *rle; | ||||
| int error; | int error, rid; | ||||
| dinfo = device_get_ivars(child); | dinfo = device_get_ivars(child); | ||||
| if (rman_get_flags(r) & RF_ACTIVE) { | if (rman_get_flags(r) & RF_ACTIVE) { | ||||
| error = bus_deactivate_resource(child, SYS_RES_MEMORY, rid, r); | error = bus_deactivate_resource(child, r); | ||||
| if (error != 0) | if (error != 0) | ||||
| return (error); | return (error); | ||||
| } | } | ||||
| rid = rman_get_rid(r); | |||||
| rle = resource_list_find(&dinfo->resources, SYS_RES_MEMORY, rid); | rle = resource_list_find(&dinfo->resources, SYS_RES_MEMORY, rid); | ||||
| if (rle != NULL) { | if (rle != NULL) { | ||||
| rle->res = NULL; | rle->res = NULL; | ||||
| resource_list_delete(&dinfo->resources, SYS_RES_MEMORY, | resource_list_delete(&dinfo->resources, SYS_RES_MEMORY, | ||||
| rid); | rid); | ||||
| } | } | ||||
| return (rman_release_resource(r)); | return (rman_release_resource(r)); | ||||
| } | } | ||||