PERFORCE change 1190648 for review
John Baldwin
jhb at FreeBSD.org
Wed Feb 5 14:54:34 UTC 2014
http://p4web.freebsd.org/@@1190648?ac=10
Change 1190648 by jhb at jhb_ralph on 2014/02/05 14:54:14
Properly align resources when allocating initial BAR ranges.
Affected files ...
.. //depot/projects/pci/sys/dev/pci/pci.c#53 edit
Differences ...
==== //depot/projects/pci/sys/dev/pci/pci.c#53 (text+ko) ====
@@ -2768,7 +2768,7 @@
struct pci_map *pm;
pci_addr_t base, map, testval;
pci_addr_t start, end, count;
- int barlen, basezero, maprange, mapsize, type;
+ int barlen, basezero, flags, maprange, mapsize, type;
uint16_t cmd;
struct resource *res;
@@ -2874,6 +2874,9 @@
}
count = (pci_addr_t)1 << mapsize;
+ flags = RF_ALIGNMENT_LOG2(mapsize);
+ if (prefetch)
+ flags |= RF_PREFETCHABLE;
if (basezero || base == pci_mapbase(testval) || pci_clear_bars) {
start = 0; /* Let the parent decide. */
end = ~0ul;
@@ -2890,7 +2893,7 @@
* pci_alloc_resource().
*/
res = resource_list_reserve(rl, bus, dev, type, ®, start, end, count,
- prefetch ? RF_PREFETCHABLE : 0);
+ flags);
if (pci_do_realloc_bars && res == NULL && (start != 0 || end != ~0ul)) {
/*
* If the allocation fails, try to allocate a resource for
@@ -2901,7 +2904,7 @@
resource_list_delete(rl, type, reg);
resource_list_add(rl, type, reg, 0, ~0ul, count);
res = resource_list_reserve(rl, bus, dev, type, ®, 0, ~0ul,
- count, prefetch ? RF_PREFETCHABLE : 0);
+ count, flags);
}
if (res == NULL) {
/*
More information about the p4-projects
mailing list