Fix a couple of bugs that prevented windows in PCI-PCI bridges from

growing "downward" (moving the start address down).  First, an off by
one error caused the end address to be moved down an extra alignment
chunk unnecessarily.  Second, when aligning the new candidate starting
address, the wrong bits were masked off.

Tested by:	Andrey Zonov  andrey zonov org
MFC after:	3 days
This commit is contained in:
jhb 2012-06-13 15:04:50 +00:00
parent 96f59e4998
commit ca52e4f3c2

View File

@ -893,9 +893,9 @@ pcib_grow_window(struct pcib_softc *sc, struct pcib_window *w, int type,
if (start < rman_get_start(w->res)) {
if (rman_first_free_region(&w->rman, &start_free, &end_free) !=
0 || start_free != rman_get_start(w->res))
end_free = rman_get_start(w->res) - 1;
end_free = rman_get_start(w->res);
if (end_free > end)
end_free = end;
end_free = end + 1;
/* Move end_free down until it is properly aligned. */
end_free &= ~(align - 1);
@ -913,7 +913,7 @@ pcib_grow_window(struct pcib_softc *sc, struct pcib_window *w, int type,
if (bootverbose)
printf("\tfront candidate range: %#lx-%#lx\n",
front, end_free);
front &= (1ul << w->step) - 1;
front &= ~(1ul << w->step) - 1;
front = rman_get_start(w->res) - front;
} else
front = 0;