Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 10 Jun 2011 13:24:56 +0000 (UTC)
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r222930 - head/sys/dev/pci
Message-ID:  <201106101324.p5ADOu5B028524@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jhb
Date: Fri Jun 10 13:24:56 2011
New Revision: 222930
URL: http://svn.freebsd.org/changeset/base/222930

Log:
  Fix some off-by-one errors with the ending address of candidate regions
  when attempting to grow a window.

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

Modified: head/sys/dev/pci/pci_pci.c
==============================================================================
--- head/sys/dev/pci/pci_pci.c	Fri Jun 10 12:30:16 2011	(r222929)
+++ head/sys/dev/pci/pci_pci.c	Fri Jun 10 13:24:56 2011	(r222930)
@@ -916,7 +916,8 @@ pcib_grow_window(struct pcib_softc *sc, 
 
 		/* Move end_free down until it is properly aligned. */
 		end_free &= ~(align - 1);
-		front = end_free - count;
+		end_free--;
+		front = end_free - (count - 1);
 
 		/*
 		 * The resource would now be allocated at (front,
@@ -944,7 +945,7 @@ pcib_grow_window(struct pcib_softc *sc, 
 
 		/* Move start_free up until it is properly aligned. */
 		start_free = roundup2(start_free, align);
-		back = start_free + count;
+		back = start_free + count - 1;
 
 		/*
 		 * The resource would now be allocated at (start_free,
@@ -957,7 +958,7 @@ pcib_grow_window(struct pcib_softc *sc, 
 			if (bootverbose)
 				printf("\tback candidate range: %#lx-%#lx\n",
 				    start_free, back);
-			back = roundup2(back, w->step) - 1;
+			back = roundup2(back + 1, w->step) - 1;
 			back -= rman_get_end(w->res);
 		} else
 			back = 0;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201106101324.p5ADOu5B028524>