[SPARC64]: Kill PBM ranges software state.
authorDavid S. Miller <davem@sunset.davemloft.net>
Fri, 9 Mar 2007 06:28:17 +0000 (22:28 -0800)
committerDavid S. Miller <davem@sunset.davemloft.net>
Thu, 26 Apr 2007 08:55:13 +0000 (01:55 -0700)
It is only used in one spot and we can just fetch the
OF property right there.

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

index 4945d700a7690b399d5cbe22587b463b1cfda591..6b5c8e7a3eb0d0fc0056427bd8b5365f0f2e0007 100644 (file)
@@ -73,17 +73,28 @@ static void pci_register_iommu_region(struct pci_pbm_info *pbm)
 
 void pci_determine_mem_io_space(struct pci_pbm_info *pbm)
 {
+       struct linux_prom_pci_ranges *pbm_ranges;
        int i, saw_mem, saw_io;
+       int num_pbm_ranges;
 
        saw_mem = saw_io = 0;
-       for (i = 0; i < pbm->num_pbm_ranges; i++) {
-               struct linux_prom_pci_ranges *pr = &pbm->pbm_ranges[i];
+       pbm_ranges = of_get_property(pbm->prom_node, "ranges", &i);
+       num_pbm_ranges = i / sizeof(*pbm_ranges);
+
+       for (i = 0; i < num_pbm_ranges; i++) {
+               struct linux_prom_pci_ranges *pr = &pbm_ranges[i];
                unsigned long a;
+               u32 parent_phys_hi, parent_phys_lo;
                int type;
 
+               parent_phys_hi = pr->parent_phys_hi;
+               parent_phys_lo = pr->parent_phys_lo;
+               if (tlb_type == hypervisor)
+                       parent_phys_hi &= 0x0fffffff;
+
                type = (pr->child_phys_hi >> 24) & 0x3;
-               a = (((unsigned long)pr->parent_phys_hi << 32UL) |
-                    ((unsigned long)pr->parent_phys_lo  <<  0UL));
+               a = (((unsigned long)parent_phys_hi << 32UL) |
+                    ((unsigned long)parent_phys_lo  <<  0UL));
 
                switch (type) {
                case 0:
index 7b7010a1eb2fe204d124278b241aabc31027d1f9..1717df549488822b45030fb7133d5c95e985ebe0 100644 (file)
@@ -1136,7 +1136,6 @@ static void psycho_pbm_init(struct pci_controller_info *p,
        unsigned int *busrange;
        struct property *prop;
        struct pci_pbm_info *pbm;
-       int len;
 
        if (is_pbm_a) {
                pbm = &p->pbm_A;
@@ -1166,15 +1165,6 @@ static void psycho_pbm_init(struct pci_controller_info *p,
               pbm->name,
               pbm->chip_version, pbm->chip_revision);
 
-       prop = of_find_property(dp, "ranges", &len);
-       if (prop) {
-               pbm->pbm_ranges = prop->value;
-               pbm->num_pbm_ranges =
-                       (len / sizeof(struct linux_prom_pci_ranges));
-       } else {
-               pbm->num_pbm_ranges = 0;
-       }
-
        prop = of_find_property(dp, "bus-range", NULL);
        busrange = prop->value;
        pbm->pci_first_busno = busrange[0];
index 81daf903bdf48c9c250c46d45aeae7e4c6948f74..dec8dc9499e05290c80e5981e74ddb698df8bd4e 100644 (file)
@@ -1542,7 +1542,6 @@ static void schizo_pbm_init(struct pci_controller_info *p,
        const char *chipset_name;
        u32 *ino_bitmap;
        int is_pbm_a;
-       int len;
 
        switch (chip_type) {
        case PBM_CHIP_TYPE_TOMATILLO:
@@ -1601,10 +1600,6 @@ static void schizo_pbm_init(struct pci_controller_info *p,
 
        schizo_pbm_hw_init(pbm);
 
-       pbm->pbm_ranges = of_get_property(dp, "ranges", &len);
-       pbm->num_pbm_ranges =
-               (len / sizeof(struct linux_prom_pci_ranges));
-
        pci_determine_mem_io_space(pbm);
 
        ino_bitmap = of_get_property(dp, "ino-bitmap", NULL);
index 7bee6b19272ebf8e733518efecf71dd60979c125..9b57ba1cb94793be3e644e604359cf4542d8bf0b 100644 (file)
@@ -1301,8 +1301,6 @@ static void pci_sun4v_msi_init(struct pci_pbm_info *pbm)
 static void pci_sun4v_pbm_init(struct pci_controller_info *p, struct device_node *dp, u32 devhandle)
 {
        struct pci_pbm_info *pbm;
-       struct property *prop;
-       int len, i;
 
        if (devhandle & 0x40)
                pbm = &p->pbm_B;
@@ -1319,17 +1317,6 @@ static void pci_sun4v_pbm_init(struct pci_controller_info *p, struct device_node
 
        printk("%s: SUN4V PCI Bus Module\n", pbm->name);
 
-       prop = of_find_property(dp, "ranges", &len);
-       pbm->pbm_ranges = prop->value;
-       pbm->num_pbm_ranges =
-               (len / sizeof(struct linux_prom_pci_ranges));
-
-       /* Mask out the top 8 bits of the ranges, leaving the real
-        * physical address.
-        */
-       for (i = 0; i < pbm->num_pbm_ranges; i++)
-               pbm->pbm_ranges[i].parent_phys_hi &= 0x0fffffff;
-
        pci_determine_mem_io_space(pbm);
 
        pci_sun4v_get_bus_range(pbm);
index f31de45f48733fba3b25084ae5b0216553df4834..629290987429b94a5a3c0cb9e0e5a947f023b4d2 100644 (file)
@@ -160,8 +160,6 @@ struct pci_pbm_info {
 
        /* OBP specific information. */
        struct device_node              *prom_node;
-       struct linux_prom_pci_ranges    *pbm_ranges;
-       int                             num_pbm_ranges;
        u64                             ino_bitmap;
 
        /* PBM I/O and Memory space resources. */