summaryrefslogtreecommitdiffstats
path: root/sys/dev/pci/pci_pci.c
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2012-06-13 15:04:50 +0000
committerjhb <jhb@FreeBSD.org>2012-06-13 15:04:50 +0000
commitca52e4f3c2dbc92e1d0fd4a74ecfa6b070dc8c7b (patch)
tree05e210f3d6f3ede41d0c641e21dabd496df7d72c /sys/dev/pci/pci_pci.c
parent96f59e499833bca96522b7b4a0c61e3b380bcc30 (diff)
downloadFreeBSD-src-ca52e4f3c2dbc92e1d0fd4a74ecfa6b070dc8c7b.zip
FreeBSD-src-ca52e4f3c2dbc92e1d0fd4a74ecfa6b070dc8c7b.tar.gz
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
Diffstat (limited to 'sys/dev/pci/pci_pci.c')
-rw-r--r--sys/dev/pci/pci_pci.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/dev/pci/pci_pci.c b/sys/dev/pci/pci_pci.c
index d624104..d47b299 100644
--- a/sys/dev/pci/pci_pci.c
+++ b/sys/dev/pci/pci_pci.c
@@ -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;
OpenPOWER on IntegriCloud