Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/pci/pci.c
Context not available. | |||||
if (bootverbose) { | if (bootverbose) { | ||||
rle = resource_list_find(&dinfo->resources, SYS_RES_IRQ, 1); | rle = resource_list_find(&dinfo->resources, SYS_RES_IRQ, 1); | ||||
if (actual == 1) | if (actual == 1) | ||||
device_printf(child, "using IRQ %lu for MSI-X\n", | device_printf(child, "using IRQ %ju for MSI-X\n", | ||||
rle->start); | rle->start); | ||||
else { | else { | ||||
int run; | int run; | ||||
Context not available. | |||||
* IRQ values as ranges. 'irq' is the previous IRQ. | * IRQ values as ranges. 'irq' is the previous IRQ. | ||||
* 'run' is true if we are in a range. | * 'run' is true if we are in a range. | ||||
*/ | */ | ||||
device_printf(child, "using IRQs %lu", rle->start); | device_printf(child, "using IRQs %ju", rle->start); | ||||
irq = rle->start; | irq = rle->start; | ||||
run = 0; | run = 0; | ||||
for (i = 1; i < actual; i++) { | for (i = 1; i < actual; i++) { | ||||
Context not available. | |||||
} | } | ||||
/* Start new range. */ | /* Start new range. */ | ||||
printf(",%lu", rle->start); | printf(",%ju", rle->start); | ||||
irq = rle->start; | irq = rle->start; | ||||
} | } | ||||
Context not available. | |||||
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; | ||||
Context not available. | |||||
*/ | */ | ||||
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 | ||||
Context not available. | |||||
* 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); | ||||
jhb: I thought we had some sort of code somewhere to special case firmware-assigned BAR values that… | |||||
Not Done Inline ActionsThis is still not done? jhb: This is still not done? | |||||
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) { | ||||
Context not available. | |||||
{ | { | ||||
struct resource *res; | struct resource *res; | ||||
char *cp; | char *cp; | ||||
u_long start, end, count; | rman_res_t start, end, count; | ||||
int rid, sec_bus, sec_reg, sub_bus, sub_reg, sup_bus; | int rid, sec_bus, sec_reg, sub_bus, sub_reg, sup_bus; | ||||
switch (cfg->hdrtype & PCIM_HDRTYPE) { | switch (cfg->hdrtype & PCIM_HDRTYPE) { | ||||
Context not available. | |||||
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 | ||||
Context not available. | |||||
} | } | ||||
static struct resource * | static struct resource * | ||||
pci_alloc_secbus(device_t dev, device_t child, int *rid, u_long start, | pci_alloc_secbus(device_t dev, device_t child, int *rid, __rman_res_t start, | ||||
u_long end, u_long count, u_int flags) | __rman_res_t end, __rman_res_t count, u_int flags) | ||||
{ | { | ||||
struct pci_devinfo *dinfo; | struct pci_devinfo *dinfo; | ||||
pcicfgregs *cfg; | pcicfgregs *cfg; | ||||
Context not available. | |||||
start, end, count, flags & ~RF_ACTIVE); | start, end, count, flags & ~RF_ACTIVE); | ||||
if (res == NULL) { | if (res == NULL) { | ||||
resource_list_delete(rl, PCI_RES_BUS, *rid); | resource_list_delete(rl, PCI_RES_BUS, *rid); | ||||
device_printf(child, "allocating %lu bus%s failed\n", | device_printf(child, "allocating %ju bus%s failed\n", | ||||
count, count == 1 ? "" : "es"); | count, count == 1 ? "" : "es"); | ||||
return (NULL); | return (NULL); | ||||
} | } | ||||
if (bootverbose) | if (bootverbose) | ||||
device_printf(child, | device_printf(child, | ||||
"Lazy allocation of %lu bus%s at %lu\n", count, | "Lazy allocation of %ju bus%s at %ju\n", count, | ||||
count == 1 ? "" : "es", rman_get_start(res)); | count == 1 ? "" : "es", rman_get_start(res)); | ||||
PCI_WRITE_CONFIG(dev, child, sec_reg, rman_get_start(res), 1); | PCI_WRITE_CONFIG(dev, child, sec_reg, rman_get_start(res), 1); | ||||
PCI_WRITE_CONFIG(dev, child, sub_reg, rman_get_end(res), 1); | PCI_WRITE_CONFIG(dev, child, sub_reg, rman_get_end(res), 1); | ||||
Context not available. | |||||
continue; | continue; | ||||
if (hdrtype & PCIM_MFDEV) | if (hdrtype & PCIM_MFDEV) | ||||
pcifunchigh = PCIB_MAXFUNCS(pcib); | pcifunchigh = PCIB_MAXFUNCS(pcib); | ||||
for (f = first_func; f <= pcifunchigh; f++) | for (f = first_func; f <= pcifunchigh; f++) { | ||||
pci_identify_function(pcib, dev, domain, busno, s, f, | pci_identify_function(pcib, dev, domain, busno, s, f, | ||||
dinfo_size); | dinfo_size); | ||||
} | |||||
} | } | ||||
#undef REG | #undef REG | ||||
} | } | ||||
Done Inline ActionsThe braces here seem to be a gratuitous change? jhb: The braces here seem to be a gratuitous change? | |||||
Not Done Inline ActionsLeftover from other debugging. jhibbits: Leftover from other debugging. | |||||
Context not available. | |||||
retval += bus_print_child_header(dev, child); | retval += bus_print_child_header(dev, child); | ||||
retval += resource_list_print_type(rl, "port", SYS_RES_IOPORT, "%#lx"); | retval += resource_list_print_type(rl, "port", SYS_RES_IOPORT, "%#jx"); | ||||
retval += resource_list_print_type(rl, "mem", SYS_RES_MEMORY, "%#lx"); | retval += resource_list_print_type(rl, "mem", SYS_RES_MEMORY, "%#jx"); | ||||
retval += resource_list_print_type(rl, "irq", SYS_RES_IRQ, "%ld"); | retval += resource_list_print_type(rl, "irq", SYS_RES_IRQ, "%jd"); | ||||
if (device_get_flags(dev)) | if (device_get_flags(dev)) | ||||
retval += printf(" flags %#x", device_get_flags(dev)); | retval += printf(" flags %#x", device_get_flags(dev)); | ||||
Context not available. | |||||
static struct resource * | static struct resource * | ||||
pci_reserve_map(device_t dev, device_t child, int type, int *rid, | pci_reserve_map(device_t dev, device_t child, int type, int *rid, | ||||
u_long start, u_long end, u_long count, u_int num, u_int flags) | __rman_res_t start, __rman_res_t end, __rman_res_t count, u_int num, | ||||
u_int flags) | |||||
{ | { | ||||
struct pci_devinfo *dinfo = device_get_ivars(child); | struct pci_devinfo *dinfo = device_get_ivars(child); | ||||
struct resource_list *rl = &dinfo->resources; | struct resource_list *rl = &dinfo->resources; | ||||
Context not available. | |||||
if (res == NULL) { | if (res == NULL) { | ||||
resource_list_delete(rl, type, *rid); | resource_list_delete(rl, type, *rid); | ||||
device_printf(child, | device_printf(child, | ||||
"%#lx bytes of rid %#x res %d failed (%#lx, %#lx).\n", | "%#jx bytes of rid %#x res %d failed (%#jx, %#jx).\n", | ||||
count, *rid, type, start, end); | count, *rid, type, start, end); | ||||
goto out; | goto out; | ||||
} | } | ||||
if (bootverbose) | if (bootverbose) | ||||
device_printf(child, | device_printf(child, | ||||
"Lazy allocation of %#lx bytes rid %#x type %d at %#lx\n", | "Lazy allocation of %#jx bytes rid %#x type %d at %#jx\n", | ||||
count, *rid, type, rman_get_start(res)); | count, *rid, type, rman_get_start(res)); | ||||
map = rman_get_start(res); | map = rman_get_start(res); | ||||
pci_write_bar(child, pm, map); | pci_write_bar(child, pm, map); | ||||
Context not available. | |||||
struct resource * | struct resource * | ||||
pci_alloc_multi_resource(device_t dev, device_t child, int type, int *rid, | pci_alloc_multi_resource(device_t dev, device_t child, int type, int *rid, | ||||
u_long start, u_long end, u_long count, u_long num, u_int flags) | __rman_res_t start, __rman_res_t end, __rman_res_t count, u_long num, | ||||
u_int flags) | |||||
{ | { | ||||
struct pci_devinfo *dinfo; | struct pci_devinfo *dinfo; | ||||
struct resource_list *rl; | struct resource_list *rl; | ||||
Context not available. | |||||
struct resource * | struct resource * | ||||
pci_alloc_resource(device_t dev, device_t child, int type, int *rid, | pci_alloc_resource(device_t dev, device_t child, int type, int *rid, | ||||
u_long start, u_long end, u_long count, u_int flags) | __rman_res_t start, __rman_res_t end, __rman_res_t count, u_int flags) | ||||
{ | { | ||||
#ifdef PCI_IOV | #ifdef PCI_IOV | ||||
struct pci_devinfo *dinfo; | struct pci_devinfo *dinfo; | ||||
Context not available. | |||||
resource_list_busy(rl, type, rid)) { | resource_list_busy(rl, type, rid)) { | ||||
device_printf(dev, "delete_resource: " | device_printf(dev, "delete_resource: " | ||||
"Resource still owned by child, oops. " | "Resource still owned by child, oops. " | ||||
"(type=%d, rid=%d, addr=%lx)\n", | "(type=%d, rid=%d, addr=%jx)\n", | ||||
type, rid, rman_get_start(rle->res)); | type, rid, rman_get_start(rle->res)); | ||||
return; | return; | ||||
} | } | ||||
Context not available. |
I thought we had some sort of code somewhere to special case firmware-assigned BAR values that were "out of range", but I can't find it now. Ah, it is this code in pci_add_map():
This check can be removed.