Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 4 May 2011 17:23:05 GMT
From:      John Baldwin <jhb@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 192602 for review
Message-ID:  <201105041723.p44HN5mI066812@skunkworks.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://p4web.freebsd.org/@@192602?ac=10

Change 192602 by jhb@jhb_jhbbsd on 2011/05/04 17:22:09

	Fix an off-by-one, trim debugging.

Affected files ...

.. //depot/projects/pci/sys/dev/pci/pci_domain.c#6 edit

Differences ...

==== //depot/projects/pci/sys/dev/pci/pci_domain.c#6 (text+ko) ====

@@ -350,6 +350,9 @@
     u_long end)
 {
 
+	if (bootverbose)
+		device_printf(hr->hr_pcib, "decoding %d range %#lx-%#lx\n",
+		    type, start, end);
 	resource_list_add_next(&hr->hr_rl, type, start, end, end - start + 1);
 	return (0);
 }
@@ -373,26 +376,25 @@
 	}
 		   
 	/* Try to allocate from each decoded range. */
-	device_printf(hr->hr_pcib,
-	    "trying to allocate %#lx-%#lx for rid %x type %d\n", start, end,
-	    *rid, type);
 	for (; rle != NULL; rle = STAILQ_NEXT(rle, link)) {
 		if (rle->type != type)
 			continue;
 		new_start = ulmax(start, rle->start);
 		new_end = ulmin(end, rle->end);
 		if (new_start > new_end ||
-		    new_start + count > new_end ||
-		    new_start + count < new_start) {
-			printf("\tskipping range %#lx-%#lx\n", new_start,
-			    new_end);
+		    new_start + count - 1 > new_end ||
+		    new_start + count < new_start)
 			continue;
-		}
-		printf("\ttrying range %#lx-%#lx\n", new_start, new_end);
 		r = bus_generic_alloc_resource(hr->hr_pcib, dev, type, rid,
 		    new_start, new_end, count, flags);
-		if (r != NULL)
+		if (r != NULL) {
+			if (bootverbose)
+				device_printf(hr->hr_pcib,
+			    "allocated type %d (%#lx-%#lx) for rid %x of %s\n",
+				    type, rman_get_start(r), rman_get_end(r),
+				    *rid, pcib_child_name(dev));
 			return (r);
+		}
 	}
 
 	return (NULL);



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