Changeset View
Changeset View
Standalone View
Standalone View
head/sys/dev/pci/pci.c
Show First 20 Lines • Show All 3,086 Lines • ▼ Show 20 Lines | #endif | ||||
} | } | ||||
count = (pci_addr_t)1 << mapsize; | count = (pci_addr_t)1 << mapsize; | ||||
flags = RF_ALIGNMENT_LOG2(mapsize); | flags = RF_ALIGNMENT_LOG2(mapsize); | ||||
if (prefetch) | if (prefetch) | ||||
flags |= RF_PREFETCHABLE; | flags |= RF_PREFETCHABLE; | ||||
if (basezero || base == pci_mapbase(testval) || pci_clear_bars) { | if (basezero || base == pci_mapbase(testval) || pci_clear_bars) { | ||||
start = 0; /* Let the parent decide. */ | start = 0; /* Let the parent decide. */ | ||||
end = ~0ul; | end = ~0; | ||||
} else { | } else { | ||||
start = base; | start = base; | ||||
end = base + count - 1; | end = base + count - 1; | ||||
} | } | ||||
resource_list_add(rl, type, reg, start, end, count); | resource_list_add(rl, type, reg, start, end, count); | ||||
/* | /* | ||||
* Try to allocate the resource for this BAR from our parent | * Try to allocate the resource for this BAR from our parent | ||||
* so that this resource range is already reserved. The | * so that this resource range is already reserved. The | ||||
* driver for this device will later inherit this resource in | * driver for this device will later inherit this resource in | ||||
* pci_alloc_resource(). | * pci_alloc_resource(). | ||||
*/ | */ | ||||
res = resource_list_reserve(rl, bus, dev, type, ®, start, end, count, | res = resource_list_reserve(rl, bus, dev, type, ®, start, end, count, | ||||
flags); | flags); | ||||
if (pci_do_realloc_bars && res == NULL && (start != 0 || end != ~0ul)) { | if (pci_do_realloc_bars && res == NULL && (start != 0 || end != ~0)) { | ||||
/* | /* | ||||
* If the allocation fails, try to allocate a resource for | * If the allocation fails, try to allocate a resource for | ||||
* this BAR using any available range. The firmware felt | * this BAR using any available range. The firmware felt | ||||
* it was important enough to assign a resource, so don't | * it was important enough to assign a resource, so don't | ||||
* disable decoding if we can help it. | * disable decoding if we can help it. | ||||
*/ | */ | ||||
resource_list_delete(rl, type, reg); | resource_list_delete(rl, type, reg); | ||||
resource_list_add(rl, type, reg, 0, ~0ul, count); | resource_list_add(rl, type, reg, 0, ~0, count); | ||||
res = resource_list_reserve(rl, bus, dev, type, ®, 0, ~0ul, | res = resource_list_reserve(rl, bus, dev, type, ®, 0, ~0, | ||||
count, flags); | count, flags); | ||||
} | } | ||||
if (res == NULL) { | if (res == NULL) { | ||||
/* | /* | ||||
* If the allocation fails, delete the resource list entry | * If the allocation fails, delete the resource list entry | ||||
* and disable decoding for this device. | * and disable decoding for this device. | ||||
* | * | ||||
* If the driver requests this resource in the future, | * If the driver requests this resource in the future, | ||||
▲ Show 20 Lines • Show All 374 Lines • ▼ Show 20 Lines | pci_reserve_secbus(device_t bus, device_t dev, pcicfgregs *cfg, | ||||
if (bootverbose) | if (bootverbose) | ||||
printf("\tsecbus=%d, subbus=%d\n", sec_bus, sub_bus); | printf("\tsecbus=%d, subbus=%d\n", sec_bus, sub_bus); | ||||
if (sec_bus > 0 && sub_bus >= sec_bus) { | if (sec_bus > 0 && sub_bus >= sec_bus) { | ||||
start = sec_bus; | start = sec_bus; | ||||
end = sub_bus; | end = sub_bus; | ||||
count = end - start + 1; | count = end - start + 1; | ||||
resource_list_add(rl, PCI_RES_BUS, 0, 0ul, ~0ul, count); | resource_list_add(rl, PCI_RES_BUS, 0, 0, ~0, count); | ||||
/* | /* | ||||
* If requested, clear secondary bus registers in | * If requested, clear secondary bus registers in | ||||
* bridge devices to force a complete renumbering | * bridge devices to force a complete renumbering | ||||
* rather than reserving the existing range. However, | * rather than reserving the existing range. However, | ||||
* preserve the existing size. | * preserve the existing size. | ||||
*/ | */ | ||||
if (pci_clear_buses) | if (pci_clear_buses) | ||||
▲ Show 20 Lines • Show All 2,252 Lines • Show Last 20 Lines |