Merge branch 'of-pci' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc
[pandora-kernel.git] / arch / x86 / kernel / devicetree.c
index 690bc84..a621f34 100644 (file)
@@ -13,6 +13,7 @@
 #include <linux/slab.h>
 #include <linux/pci.h>
 #include <linux/of_pci.h>
+#include <linux/initrd.h>
 
 #include <asm/hpet.h>
 #include <asm/irq_controller.h>
@@ -98,6 +99,16 @@ void * __init early_init_dt_alloc_memory_arch(u64 size, u64 align)
        return __alloc_bootmem(size, align, __pa(MAX_DMA_ADDRESS));
 }
 
+#ifdef CONFIG_BLK_DEV_INITRD
+void __init early_init_dt_setup_initrd_arch(unsigned long start,
+                                           unsigned long end)
+{
+       initrd_start = (unsigned long)__va(start);
+       initrd_end = (unsigned long)__va(end);
+       initrd_below_start_ok = 1;
+}
+#endif
+
 void __init add_dtb(u64 data)
 {
        initial_dtb = data + offsetof(struct setup_data, data);
@@ -123,6 +134,24 @@ static int __init add_bus_probe(void)
 module_init(add_bus_probe);
 
 #ifdef CONFIG_PCI
+struct device_node *pcibios_get_phb_of_node(struct pci_bus *bus)
+{
+       struct device_node *np;
+
+       for_each_node_by_type(np, "pci") {
+               const void *prop;
+               unsigned int bus_min;
+
+               prop = of_get_property(np, "bus-range", NULL);
+               if (!prop)
+                       continue;
+               bus_min = be32_to_cpup(prop);
+               if (bus->number == bus_min)
+                       return np;
+       }
+       return NULL;
+}
+
 static int x86_of_pci_irq_enable(struct pci_dev *dev)
 {
        struct of_irq oirq;
@@ -154,50 +183,8 @@ static void x86_of_pci_irq_disable(struct pci_dev *dev)
 
 void __cpuinit x86_of_pci_init(void)
 {
-       struct device_node *np;
-
        pcibios_enable_irq = x86_of_pci_irq_enable;
        pcibios_disable_irq = x86_of_pci_irq_disable;
-
-       for_each_node_by_type(np, "pci") {
-               const void *prop;
-               struct pci_bus *bus;
-               unsigned int bus_min;
-               struct device_node *child;
-
-               prop = of_get_property(np, "bus-range", NULL);
-               if (!prop)
-                       continue;
-               bus_min = be32_to_cpup(prop);
-
-               bus = pci_find_bus(0, bus_min);
-               if (!bus) {
-                       printk(KERN_ERR "Can't find a node for bus %s.\n",
-                                       np->full_name);
-                       continue;
-               }
-
-               if (bus->self)
-                       bus->self->dev.of_node = np;
-               else
-                       bus->dev.of_node = np;
-
-               for_each_child_of_node(np, child) {
-                       struct pci_dev *dev;
-                       u32 devfn;
-
-                       prop = of_get_property(child, "reg", NULL);
-                       if (!prop)
-                               continue;
-
-                       devfn = (be32_to_cpup(prop) >> 8) & 0xff;
-                       dev = pci_get_slot(bus, devfn);
-                       if (!dev)
-                               continue;
-                       dev->dev.of_node = child;
-                       pci_dev_put(dev);
-               }
-       }
 }
 #endif