[RFC/PATCH] Set up PCI tree from OF on ppc64

John Rose johnrose at austin.ibm.com
Fri Aug 26 05:36:53 EST 2005


Hi Paul-

(Sorry for the resend, forgot cc's)

Looks nice.  A few comments:

+static int pSeries_pci_probe_mode(struct pci_bus *bus)
+{
+	if (systemcfg->platform & PLATFORM_LPAR)
+		return PCI_PROBE_DEVTREE;
+	return PCI_PROBE_NORMAL;
+}
+

Would we not want to use PROBE_DEVTREE for non-partitioned and legacy
pSeries?

+static void __devinit of_scan_bus(struct device_node *node,
+				  struct pci_bus *bus)
...
+static void __devinit of_scan_pci_bridge(struct device_node *node,
+					 struct pci_dev *dev)

We should probably expose these for use by the PCI Hotplug/DLPAR
drivers, along w/ scan_phb().

+	/* parse ranges property */
+	/* PCI #address-cells == 3 and #size-cells == 2 always */
+	res = &dev->resource[PCI_BRIDGE_RESOURCES];
+	for (i = 0; i < PCI_NUM_RESOURCES - PCI_BRIDGE_RESOURCES; ++i) {
+		res->flags = 0;
+		bus->resource[i] = res;
+		++res;
+	}
+	i = 1;
+	for (; len >= 32; len -= 32, ranges += 8) {
+		flags = pci_parse_of_flags(ranges[0]);
+		size = GET_64BIT(ranges, 6);
+		if (flags == 0 || size == 0)
+			continue;
+		if (flags & IORESOURCE_IO) {
+			res = bus->resource[0];
+			if (res->flags) {
+				printk(KERN_ERR "PCI: ignoring extra I/O range"
+				       " for bridge %s\n", node->full_name);
+				continue;
+			}
+		} else {
+			if (i >= PCI_NUM_RESOURCES - PCI_BRIDGE_RESOURCES) {
+				printk(KERN_ERR "PCI: too many memory ranges"
+				       " for bridge %s\n", node->full_name);
+				continue;
+			}
+			res = bus->resource[i];
+			++i;
+		}
+		res->start = GET_64BIT(ranges, 1);
+		res->end = res->start + size - 1;
+		res->flags = flags;
+		fixup_resource(res, dev);
+	}

Could pci_process_bridge_OF_ranges() and of_scan_pci_bridge() use
common "ranges" parsing logic?  We're parsing the same property
in two different ways in the same file.  This could be a "todo" I
guess.

Thanks-
John




More information about the Linuxppc64-dev mailing list