PERFORCE change 230945 for review

John Baldwin jhb at FreeBSD.org
Wed Jul 10 01:30:37 UTC 2013


http://p4web.freebsd.org/@@230945?ac=10

Change 230945 by jhb at jhb_pippin on 2013/07/10 01:30:20

	Whack at this.

Affected files ...

.. //depot/projects/pci/sys/x86/x86/nexus.c#13 edit

Differences ...

==== //depot/projects/pci/sys/x86/x86/nexus.c#13 (text+ko) ====

@@ -372,13 +372,28 @@
 	struct	rman *rm;
 	int needactivate = flags & RF_ACTIVE;
 
+#ifdef PCI_RES_BUS
+	if (type == PCI_RES_BUS) {
+		/*
+		 * PCI bus number resources are allocated from a
+		 * specific PCI domain.  The child device must be a
+		 * 'pcib' device which implements the pcib ivars.  We
+		 * depend on that to determine which PCI domain to
+		 * allocate from.
+		 */
+		return (pci_domain_alloc_bus(pcib_get_domain(child), child, rid,
+		    start, end, count, flags));
+	}
+#endif
+
 	/*
-	 * If this is an allocation of the "default" range for a given RID, and
-	 * we know what the resources for this device are (ie. they aren't maintained
-	 * by a child bus), then work out the start/end values.
+	 * If this is an allocation of the "default" range for a given
+	 * RID, and we know what the resources for this device are
+	 * (ie. they aren't maintained by a child bus), then work out
+	 * the start/end values.
 	 */
 	if ((start == 0UL) && (end == ~0UL) && (count == 1)) {
-		if (ndev == NULL)
+		if (device_get_parent(child) != bus || ndev == NULL)
 			return(NULL);
 		rle = resource_list_find(&ndev->nx_resources, type, *rid);
 		if (rle == NULL)
@@ -388,23 +403,6 @@
 		count = rle->count;
 	}
 
-#ifdef PCI_RES_BUS
-	if (type == PCI_RES_BUS) {
-		/*
-		 * PCI bus number resources are allocated from a
-		 * specific PCI domain.  The child device must be a
-		 * 'pcib' device which implements the pcib ivars.  We
-		 * depend on that to determine which PCI domain to
-		 * allocate from.
-		 */
-		rv = pci_domain_alloc_bus(pcib_get_domain(child), child, rid,
-		    start, end, count, flags);
-		if (rv == NULL)
-			return (NULL);
-		rman_set_rid(rv, *rid);
-		return (rv);
-	}
-#endif
 	flags &= ~RF_ACTIVE;
 	rm = nexus_rman(type);
 	if (rm == NULL)


More information about the p4-projects mailing list