Author: jhb
Date: Wed Jun 13 15:04:50 2012
New Revision: 237008
URL: http://svn.freebsd.org/changeset/base/237008

Log:
  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

Modified:
  head/sys/dev/pci/pci_pci.c

Modified: head/sys/dev/pci/pci_pci.c
==============================================================================
--- head/sys/dev/pci/pci_pci.c  Wed Jun 13 14:47:03 2012        (r237007)
+++ head/sys/dev/pci/pci_pci.c  Wed Jun 13 15:04:50 2012        (r237008)
@@ -893,9 +893,9 @@ pcib_grow_window(struct pcib_softc *sc, 
        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, 
                        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;
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to