[SPARC64]: Handle PCI bridges without 'ranges' property.
[sfrench/cifs-2.6.git] / arch / sparc64 / kernel / ebus.c
index 8a9b470e1b651883ca6023313295a94775d78566..ad55a9bb50ddedfe6febf63c54e7836b43c18b16 100644 (file)
 #include <linux/string.h>
 #include <linux/interrupt.h>
 #include <linux/delay.h>
+#include <linux/pci.h>
 
 #include <asm/system.h>
 #include <asm/page.h>
-#include <asm/pbm.h>
 #include <asm/ebus.h>
 #include <asm/oplib.h>
 #include <asm/prom.h>
 #include <asm/of_device.h>
 #include <asm/bpp.h>
 #include <asm/irq.h>
+#include <asm/io.h>
 
 /* EBUS dma library. */
 
@@ -79,7 +80,7 @@ static void __ebus_dma_reset(struct ebus_dma_info *p, int no_drain)
        }
 }
 
-static irqreturn_t ebus_dma_irq(int irq, void *dev_id, struct pt_regs *regs)
+static irqreturn_t ebus_dma_irq(int irq, void *dev_id)
 {
        struct ebus_dma_info *p = dev_id;
        unsigned long flags;
@@ -285,7 +286,7 @@ static void __init fill_ebus_child(struct device_node *dp,
                                   int non_standard_regs)
 {
        struct of_device *op;
-       int *regs;
+       const int *regs;
        int i, len;
 
        dev->prom_node = dp;
@@ -389,12 +390,12 @@ static void __init fill_ebus_device(struct device_node *dp, struct linux_ebus_de
        dev->ofdev.node = dp;
        dev->ofdev.dev.parent = &dev->bus->ofdev.dev;
        dev->ofdev.dev.bus = &ebus_bus_type;
-       strcpy(dev->ofdev.dev.bus_id, dp->path_component_name);
+       sprintf(dev->ofdev.dev.bus_id, "ebus[%08x]", dp->node);
 
        /* Register with core */
        if (of_device_register(&dev->ofdev) != 0)
                printk(KERN_DEBUG "ebus: device registration error for %s!\n",
-                      dev->ofdev.dev.bus_id);
+                      dp->path_component_name);
 
        dp = dp->child;
        if (dp) {
@@ -438,11 +439,9 @@ static struct pci_dev *find_next_ebus(struct pci_dev *start, int *is_rio_p)
 
 void __init ebus_init(void)
 {
-       struct pci_pbm_info *pbm;
        struct linux_ebus_device *dev;
        struct linux_ebus *ebus;
        struct pci_dev *pdev;
-       struct pcidev_cookie *cookie;
        struct device_node *dp;
        int is_rio;
        int num_ebus = 0;
@@ -453,8 +452,7 @@ void __init ebus_init(void)
                return;
        }
 
-       cookie = pdev->sysdata;
-       dp = cookie->prom_node;
+       dp = pci_device_to_OF_node(pdev);
 
        ebus_chain = ebus = ebus_alloc(sizeof(struct linux_ebus));
        ebus->next = NULL;
@@ -480,8 +478,7 @@ void __init ebus_init(void)
                                break;
                        }
                        ebus->is_rio = is_rio;
-                       cookie = pdev->sysdata;
-                       dp = cookie->prom_node;
+                       dp = pci_device_to_OF_node(pdev);
                        continue;
                }
                printk("ebus%d:", num_ebus);
@@ -489,17 +486,16 @@ void __init ebus_init(void)
                ebus->index = num_ebus;
                ebus->prom_node = dp;
                ebus->self = pdev;
-               ebus->parent = pbm = cookie->pbm;
 
                ebus->ofdev.node = dp;
                ebus->ofdev.dev.parent = &pdev->dev;
                ebus->ofdev.dev.bus = &ebus_bus_type;
-               strcpy(ebus->ofdev.dev.bus_id, dp->path_component_name);
+               sprintf(ebus->ofdev.dev.bus_id, "ebus%d", num_ebus);
 
                /* Register with core */
                if (of_device_register(&ebus->ofdev) != 0)
                        printk(KERN_DEBUG "ebus: device registration error for %s!\n",
-                              ebus->ofdev.dev.bus_id);
+                              dp->path_component_name);
 
 
                child = dp->child;
@@ -531,8 +527,7 @@ void __init ebus_init(void)
                if (!pdev)
                        break;
 
-               cookie = pdev->sysdata;
-               dp = cookie->prom_node;
+               dp = pci_device_to_OF_node(pdev);
 
                ebus->next = ebus_alloc(sizeof(struct linux_ebus));
                ebus = ebus->next;