Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/pci/pci.c
| Show First 20 Lines • Show All 5,630 Lines • ▼ Show 20 Lines | #ifdef PCI_IOV | ||||
| } | } | ||||
| #endif | #endif | ||||
| return (pci_alloc_multi_resource(dev, child, type, rid, start, end, | return (pci_alloc_multi_resource(dev, child, type, rid, start, end, | ||||
| count, 1, flags)); | count, 1, flags)); | ||||
| } | } | ||||
| int | int | ||||
| pci_release_resource(device_t dev, device_t child, int type, int rid, | pci_release_resource(device_t dev, device_t child, struct resource *r) | ||||
| struct resource *r) | |||||
| { | { | ||||
| struct pci_devinfo *dinfo; | struct pci_devinfo *dinfo; | ||||
| struct resource_list *rl; | struct resource_list *rl; | ||||
| pcicfgregs *cfg __unused; | pcicfgregs *cfg __unused; | ||||
| if (device_get_parent(child) != dev) | if (device_get_parent(child) != dev) | ||||
| return (BUS_RELEASE_RESOURCE(device_get_parent(dev), child, | return (bus_generic_release_resource(dev, child, r)); | ||||
| type, rid, r)); | |||||
| dinfo = device_get_ivars(child); | dinfo = device_get_ivars(child); | ||||
| cfg = &dinfo->cfg; | cfg = &dinfo->cfg; | ||||
| #ifdef PCI_IOV | #ifdef PCI_IOV | ||||
| if (cfg->flags & PCICFG_VF) { | if (cfg->flags & PCICFG_VF) { | ||||
| switch (type) { | switch (rman_get_type(r)) { | ||||
| /* VFs can't have I/O BARs. */ | /* VFs can't have I/O BARs. */ | ||||
| case SYS_RES_IOPORT: | case SYS_RES_IOPORT: | ||||
| return (EDOOFUS); | return (EDOOFUS); | ||||
| case SYS_RES_MEMORY: | case SYS_RES_MEMORY: | ||||
| return (pci_vf_release_mem_resource(dev, child, rid, | return (pci_vf_release_mem_resource(dev, child, r)); | ||||
| r)); | |||||
| } | } | ||||
| /* Fall through for other types of resource allocations. */ | /* Fall through for other types of resource allocations. */ | ||||
| } | } | ||||
| #endif | #endif | ||||
| #ifdef NEW_PCIB | #ifdef NEW_PCIB | ||||
| /* | /* | ||||
| * PCI-PCI bridge I/O window resources are not BARs. For | * PCI-PCI bridge I/O window resources are not BARs. For | ||||
| * those allocations just pass the request up the tree. | * those allocations just pass the request up the tree. | ||||
| */ | */ | ||||
| if (cfg->hdrtype == PCIM_HDRTYPE_BRIDGE && | if (cfg->hdrtype == PCIM_HDRTYPE_BRIDGE && | ||||
| (type == SYS_RES_IOPORT || type == SYS_RES_MEMORY)) { | (rman_get_type(r) == SYS_RES_IOPORT || | ||||
| switch (rid) { | rman_get_type(r) == SYS_RES_MEMORY)) { | ||||
| switch (rman_get_rid(r)) { | |||||
| case PCIR_IOBASEL_1: | case PCIR_IOBASEL_1: | ||||
| case PCIR_MEMBASE_1: | case PCIR_MEMBASE_1: | ||||
| case PCIR_PMBASEL_1: | case PCIR_PMBASEL_1: | ||||
| return (bus_generic_release_resource(dev, child, type, | return (bus_generic_release_resource(dev, child, r)); | ||||
| rid, r)); | |||||
| } | } | ||||
| } | } | ||||
| #endif | #endif | ||||
| rl = &dinfo->resources; | rl = &dinfo->resources; | ||||
| return (resource_list_release(rl, dev, child, type, rid, r)); | return (resource_list_release(rl, dev, child, r)); | ||||
| } | } | ||||
| int | int | ||||
| pci_activate_resource(device_t dev, device_t child, struct resource *r) | pci_activate_resource(device_t dev, device_t child, struct resource *r) | ||||
| { | { | ||||
| struct pci_devinfo *dinfo; | struct pci_devinfo *dinfo; | ||||
| int error, rid, type; | int error, rid, type; | ||||
| ▲ Show 20 Lines • Show All 1,144 Lines • Show Last 20 Lines | |||||