[SPARC64]: Move index info pci_pbm_info.
[powerpc.git] / arch / sparc64 / kernel / pci.c
index af2c7ff..b8a48db 100644 (file)
@@ -14,7 +14,6 @@
 #include <linux/sched.h>
 #include <linux/capability.h>
 #include <linux/errno.h>
-#include <linux/smp_lock.h>
 #include <linux/msi.h>
 #include <linux/irq.h>
 #include <linux/init.h>
@@ -49,10 +48,10 @@ asmlinkage int sys_pciconfig_write(unsigned long bus, unsigned long dfn,
 #else
 
 /* List of all PCI controllers found in the system. */
-struct pci_controller_info *pci_controller_root = NULL;
+struct pci_pbm_info *pci_pbm_root = NULL;
 
-/* Each PCI controller found gets a unique index. */
-int pci_num_controllers = 0;
+/* Each PBM found gets a unique index. */
+int pci_num_pbms = 0;
 
 volatile int pci_poke_in_progress;
 volatile int pci_poke_cpu = -1;
@@ -292,7 +291,7 @@ extern const struct pci_iommu_ops pci_sun4u_iommu_ops,
 
 /* Find each controller in the system, attach and initialize
  * software state structure for each and link into the
- * pci_controller_root.  Setup the controller enough such
+ * pci_pbm_root.  Setup the controller enough such
  * that bus scanning can be done.
  */
 static void __init pci_controller_probe(void)
@@ -744,7 +743,6 @@ int pci_host_bridge_write_pci_cfg(struct pci_bus *bus_dev,
 
 struct pci_bus * __devinit pci_scan_one_pbm(struct pci_pbm_info *pbm)
 {
-       struct pci_controller_info *p = pbm->parent;
        struct device_node *node = pbm->prom_node;
        struct pci_dev *host_pdev;
        struct pci_bus *bus;
@@ -752,7 +750,7 @@ struct pci_bus * __devinit pci_scan_one_pbm(struct pci_pbm_info *pbm)
        printk("PCI: Scanning PBM %s\n", node->full_name);
 
        /* XXX parent device? XXX */
-       bus = pci_create_bus(NULL, pbm->pci_first_busno, p->pci_ops, pbm);
+       bus = pci_create_bus(NULL, pbm->pci_first_busno, pbm->pci_ops, pbm);
        if (!bus) {
                printk(KERN_ERR "Failed to create bus for %s\n",
                       node->full_name);
@@ -777,10 +775,10 @@ struct pci_bus * __devinit pci_scan_one_pbm(struct pci_pbm_info *pbm)
 
 static void __init pci_scan_each_controller_bus(void)
 {
-       struct pci_controller_info *p;
+       struct pci_pbm_info *pbm;
 
-       for (p = pci_controller_root; p; p = p->next)
-               p->scan_bus(p);
+       for (pbm = pci_pbm_root; pbm; pbm = pbm->next)
+               pbm->scan_bus(pbm);
 }
 
 extern void power_init(void);
@@ -788,7 +786,7 @@ extern void power_init(void);
 static int __init pcibios_init(void)
 {
        pci_controller_probe();
-       if (pci_controller_root == NULL)
+       if (pci_pbm_root == NULL)
                return 0;
 
        pci_scan_each_controller_bus();
@@ -1079,11 +1077,7 @@ int pci_domain_nr(struct pci_bus *pbus)
        if (pbm == NULL || pbm->parent == NULL) {
                ret = -ENXIO;
        } else {
-               struct pci_controller_info *p = pbm->parent;
-
-               ret = p->index;
-               ret = ((ret << 1) +
-                      ((pbm == &pbm->parent->pbm_B) ? 1 : 0));
+               ret = pbm->index;
        }
 
        return ret;
@@ -1094,17 +1088,12 @@ EXPORT_SYMBOL(pci_domain_nr);
 int arch_setup_msi_irq(struct pci_dev *pdev, struct msi_desc *desc)
 {
        struct pci_pbm_info *pbm = pdev->dev.archdata.host_controller;
-       struct pci_controller_info *p = pbm->parent;
-       int virt_irq, err;
+       int virt_irq;
 
-       if (!pbm->msi_num || !p->setup_msi_irq)
+       if (!pbm->setup_msi_irq)
                return -EINVAL;
 
-       err = p->setup_msi_irq(&virt_irq, pdev, desc);
-       if (err)
-               return err;
-
-       return 0;
+       return pbm->setup_msi_irq(&virt_irq, pdev, desc);
 }
 
 void arch_teardown_msi_irq(unsigned int virt_irq)
@@ -1112,12 +1101,11 @@ void arch_teardown_msi_irq(unsigned int virt_irq)
        struct msi_desc *entry = get_irq_msi(virt_irq);
        struct pci_dev *pdev = entry->dev;
        struct pci_pbm_info *pbm = pdev->dev.archdata.host_controller;
-       struct pci_controller_info *p = pbm->parent;
 
-       if (!pbm->msi_num || !p->setup_msi_irq)
+       if (!pbm->teardown_msi_irq)
                return;
 
-       return p->teardown_msi_irq(virt_irq, pdev);
+       return pbm->teardown_msi_irq(virt_irq, pdev);
 }
 #endif /* !(CONFIG_PCI_MSI) */