[PATCH 2.5] Make root PCI bus child of system_bus in device tree

From: Deepak Saxena (dsaxena@mvista.com)
Date: Tue Mar 25 2003 - 18:16:22 EST


All,

The following patch updates the PCI subsystem so that root PCI host
bridges appear as devices hanging off the system bus instead of root
level devices. To me, this makes more sense from a topology point of
view since most systems look as such:

  cpu0 <-- sys_bus --> Memory Controller/PCI Bridge <-- sys_bus --> cpu1
                                  |
                                  |
                                  |
  <---------------------------- Root Level PCI Bus -------------------->

Even on system on a chip designs, the PCI bridge unit and the CPU core are
physically connected over the system bus. A PCI host bridge always connects
the system/cpu/local bus to the PCI bus, so I think the device tree should
represent this.

I'm not sure if this is the best solution as we could have embedded systems
where the root PCI bus is hanging off from something like a Rapid I/O bus or
other non-CPU bus, so maybe we should just kill pci_scan_bus() and force all
platforms to use pci_scan_bus_parented() so developers can best determine how
to map their system's topology to the device tree?

Thanks,
~Deepak

diff -Nru a/drivers/base/sys.c b/drivers/base/sys.c
--- a/drivers/base/sys.c Tue Mar 25 16:07:06 2003
+++ b/drivers/base/sys.c Tue Mar 25 16:07:06 2003
@@ -21,7 +21,7 @@
 #include <linux/string.h>
 
 /* The default system device parent. */
-static struct device system_bus = {
+struct device system_bus = {
        .name = "System Bus",
        .bus_id = "sys",
 };
@@ -144,6 +144,7 @@
         return device_register(&system_bus);
 }
 
+EXPORT_SYMBOL(system_bus);
 EXPORT_SYMBOL(system_bus_type);
 EXPORT_SYMBOL(sys_device_register);
 EXPORT_SYMBOL(sys_device_unregister);
diff -Nru a/include/linux/device.h b/include/linux/device.h
--- a/include/linux/device.h Tue Mar 25 16:07:06 2003
+++ b/include/linux/device.h Tue Mar 25 16:07:06 2003
@@ -353,6 +353,7 @@
 extern void sys_device_unregister(struct sys_device *);
 
 extern struct bus_type system_bus_type;
+extern struct device system_bus;
 
 /* drivers/base/platform.c */
 
diff -Nru a/include/linux/pci.h b/include/linux/pci.h
--- a/include/linux/pci.h Tue Mar 25 16:07:06 2003
+++ b/include/linux/pci.h Tue Mar 25 16:07:06 2003
@@ -537,12 +537,12 @@
 struct pci_bus *pci_scan_bus_parented(struct device *parent, int bus, struct pci_ops *ops, void *sysdata);
 static inline struct pci_bus *pci_scan_bus(int bus, struct pci_ops *ops, void *sysdata)
 {
- return pci_scan_bus_parented(NULL, bus, ops, sysdata);
+ return pci_scan_bus_parented(&system_bus, bus, ops, sysdata);
 }
 struct pci_bus *pci_alloc_primary_bus_parented(struct device * parent, int bus);
 static inline struct pci_bus *pci_alloc_primary_bus(int bus)
 {
- return pci_alloc_primary_bus_parented(NULL, bus);
+ return pci_alloc_primary_bus_parented(&system_bus, bus);
 }
 int pci_scan_slot(struct pci_bus *bus, int devfn);
 void pci_bus_add_devices(struct pci_bus *bus);

-- 
Deepak Saxena
MontaVista Software - Powering the Embedded Revolution - www.mvista.com

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Mon Mar 31 2003 - 22:00:21 EST