[SPARC64] PCI: Use common routine to fetch PBM properties.
authorDavid S. Miller <davem@sunset.davemloft.net>
Tue, 8 May 2007 04:51:41 +0000 (21:51 -0700)
committerDavid S. Miller <davem@sunset.davemloft.net>
Tue, 8 May 2007 23:41:12 +0000 (16:41 -0700)
Namely bus-range and ino-bitmap.

This allows us also to eliminate pci_controller_info's
pci_{first,last}_busno fields as only the pbm ones are
used now.

Signed-off-by: David S. Miller <davem@davemloft.net>
arch/sparc64/kernel/pci_common.c
arch/sparc64/kernel/pci_fire.c
arch/sparc64/kernel/pci_impl.h
arch/sparc64/kernel/pci_psycho.c
arch/sparc64/kernel/pci_sabre.c
arch/sparc64/kernel/pci_schizo.c
arch/sparc64/kernel/pci_sun4v.c
include/asm-sparc64/pbm.h

index 1e6aeedf43c4201672e1f6ea61275f44f3dcd687..b1168bfa16fb10a144af700cc1d09e17a77fc7c0 100644 (file)
 
 #include "pci_impl.h"
 
+void pci_get_pbm_props(struct pci_pbm_info *pbm)
+{
+       const u32 *val = of_get_property(pbm->prom_node, "bus-range", NULL);
+
+       pbm->pci_first_busno = val[0];
+       pbm->pci_last_busno = val[1];
+
+       val = of_get_property(pbm->prom_node, "ino-bitmap", NULL);
+       if (val) {
+               pbm->ino_bitmap = (((u64)val[1] << 32UL) |
+                                  ((u64)val[0] <<  0UL));
+       }
+}
+
 static void pci_register_legacy_regions(struct resource *io_res,
                                        struct resource *mem_res)
 {
index 0fe626631e12543bae2bd710d63bd885e63e3dc0..79ee5be948eb2b7da53d7de9720605a19cfaf6d9 100644 (file)
@@ -317,8 +317,6 @@ static void pci_fire_pbm_init(struct pci_controller_info *p,
 {
        const struct linux_prom64_registers *regs;
        struct pci_pbm_info *pbm;
-       const u32 *ino_bitmap;
-       const unsigned int *busrange;
 
        if ((portid & 1) == 0)
                pbm = &p->pbm_A;
@@ -338,13 +336,7 @@ static void pci_fire_pbm_init(struct pci_controller_info *p,
 
        pci_determine_mem_io_space(pbm);
 
-       ino_bitmap = of_get_property(dp, "ino-bitmap", NULL);
-       pbm->ino_bitmap = (((u64)ino_bitmap[1] << 32UL) |
-                          ((u64)ino_bitmap[0] <<  0UL));
-
-       busrange = of_get_property(dp, "bus-range", NULL);
-       pbm->pci_first_busno = busrange[0];
-       pbm->pci_last_busno = busrange[1];
+       pci_get_pbm_props(pbm);
 
        pci_fire_hw_init(pbm);
        pci_fire_pbm_iommu_init(pbm);
index 1208583fcb83b433c2abc7b3a3a60a528f0c1fde..41c3f5137306e4f2dc93f767430f802b16dba025 100644 (file)
@@ -17,6 +17,7 @@ extern unsigned long pci_memspace_mask;
 extern int pci_num_controllers;
 
 /* PCI bus scanning and fixup support. */
+extern void pci_get_pbm_props(struct pci_pbm_info *pbm);
 extern struct pci_bus *pci_scan_one_pbm(struct pci_pbm_info *pbm);
 extern void pci_determine_mem_io_space(struct pci_pbm_info *pbm);
 
index 253d40ec2245209063ee16a971c0d02a7366a70f..0f35135a40c5a315fbd42e8ee26d7d8bea198076 100644 (file)
@@ -1088,7 +1088,6 @@ static void psycho_pbm_strbuf_init(struct pci_controller_info *p,
 static void psycho_pbm_init(struct pci_controller_info *p,
                            struct device_node *dp, int is_pbm_a)
 {
-       unsigned int *busrange;
        struct property *prop;
        struct pci_pbm_info *pbm;
 
@@ -1117,10 +1116,7 @@ static void psycho_pbm_init(struct pci_controller_info *p,
 
        pci_determine_mem_io_space(pbm);
 
-       prop = of_find_property(dp, "bus-range", NULL);
-       busrange = prop->value;
-       pbm->pci_first_busno = busrange[0];
-       pbm->pci_last_busno = busrange[1];
+       pci_get_pbm_props(pbm);
 
        psycho_pbm_strbuf_init(p, pbm, is_pbm_a);
 }
index 397862fbd9e1d0f46b7129471ace28ea58ae1a25..9e706013d11ac8653a378d73a11255779d61f5cc 100644 (file)
@@ -1006,8 +1006,7 @@ static void sabre_pbm_init(struct pci_controller_info *p, struct device_node *dp
        pbm->chip_type = PBM_CHIP_TYPE_SABRE;
        pbm->parent = p;
        pbm->prom_node = dp;
-       pbm->pci_first_busno = p->pci_first_busno;
-       pbm->pci_last_busno = p->pci_last_busno;
+       pci_get_pbm_props(pbm);
 
        pci_determine_mem_io_space(pbm);
 }
@@ -1018,7 +1017,6 @@ void sabre_init(struct device_node *dp, char *model_name)
        struct pci_controller_info *p;
        struct iommu *iommu;
        int tsbsize;
-       const u32 *busrange;
        const u32 *vdma;
        u32 upa_portid, dma_mask;
        u64 clear_irq;
@@ -1119,10 +1117,6 @@ void sabre_init(struct device_node *dp, char *model_name)
 
        sabre_iommu_init(p, tsbsize, vdma[0], dma_mask);
 
-       busrange = of_get_property(dp, "bus-range", NULL);
-       p->pci_first_busno = busrange[0];
-       p->pci_last_busno = busrange[1];
-
        /*
         * Look for APB underneath.
         */
index 91a7385e5d32798652fc8c9f74727275909a8fc8..c0a6a3866e2f9f2cad70a4fe6204d46c9d22cd4b 100644 (file)
@@ -1491,10 +1491,8 @@ static void schizo_pbm_init(struct pci_controller_info *p,
                            int chip_type)
 {
        const struct linux_prom64_registers *regs;
-       const unsigned int *busrange;
        struct pci_pbm_info *pbm;
        const char *chipset_name;
-       const u32 *ino_bitmap;
        int is_pbm_a;
 
        switch (chip_type) {
@@ -1555,13 +1553,7 @@ static void schizo_pbm_init(struct pci_controller_info *p,
 
        pci_determine_mem_io_space(pbm);
 
-       ino_bitmap = of_get_property(dp, "ino-bitmap", NULL);
-       pbm->ino_bitmap = (((u64)ino_bitmap[1] << 32UL) |
-                          ((u64)ino_bitmap[0] <<  0UL));
-
-       busrange = of_get_property(dp, "bus-range", NULL);
-       pbm->pci_first_busno = busrange[0];
-       pbm->pci_last_busno = busrange[1];
+       pci_get_pbm_props(pbm);
 
        schizo_pbm_iommu_init(pbm);
        schizo_pbm_strbuf_init(pbm);
index 1ccf4c9a9a4330b4b40cfd21bb50e116ebf744af..1491ba33058320b993b4586657325adf114a6efb 100644 (file)
@@ -802,20 +802,6 @@ static void pci_sun4v_iommu_init(struct pci_pbm_info *pbm)
                       pbm->name, sz);
 }
 
-static void pci_sun4v_get_bus_range(struct pci_pbm_info *pbm)
-{
-       struct property *prop;
-       unsigned int *busrange;
-
-       prop = of_find_property(pbm->prom_node, "bus-range", NULL);
-
-       busrange = prop->value;
-
-       pbm->pci_first_busno = busrange[0];
-       pbm->pci_last_busno = busrange[1];
-
-}
-
 #ifdef CONFIG_PCI_MSI
 struct pci_sun4v_msiq_entry {
        u64             version_type;
@@ -1271,7 +1257,7 @@ static void pci_sun4v_pbm_init(struct pci_controller_info *p, struct device_node
 
        pci_determine_mem_io_space(pbm);
 
-       pci_sun4v_get_bus_range(pbm);
+       pci_get_pbm_props(pbm);
        pci_sun4v_iommu_init(pbm);
        pci_sun4v_msi_init(pbm);
 }
index c008cecca1491819527eebc8cfad1dd735713a9f..43b7270ec02e87c8c67ff945023a4efb5189ddbf 100644 (file)
@@ -145,8 +145,6 @@ struct pci_controller_info {
 
        /* Now things for the actual PCI bus probes. */
        struct pci_ops                  *pci_ops;
-       unsigned int                    pci_first_busno;
-       unsigned int                    pci_last_busno;
 };
 
 #endif /* !(__SPARC64_PBM_H) */