aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc64/kernel
diff options
context:
space:
mode:
authorDavid S. Miller <davem@sunset.davemloft.net>2007-03-09 01:28:17 -0500
committerDavid S. Miller <davem@sunset.davemloft.net>2007-04-26 04:55:13 -0400
commit3487a1f9e719d36c9b2d4d492994b2dd815a58b7 (patch)
tree34d5ef82a837ff61413a40fa9ce6d06a9bfbc65a /arch/sparc64/kernel
parent229177c7f38d6a2b1285b42da4b19d76346b4bac (diff)
[SPARC64]: Kill PBM ranges software state.
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>
Diffstat (limited to 'arch/sparc64/kernel')
-rw-r--r--arch/sparc64/kernel/pci_common.c19
-rw-r--r--arch/sparc64/kernel/pci_psycho.c10
-rw-r--r--arch/sparc64/kernel/pci_schizo.c5
-rw-r--r--arch/sparc64/kernel/pci_sun4v.c13
4 files changed, 15 insertions, 32 deletions
diff --git a/arch/sparc64/kernel/pci_common.c b/arch/sparc64/kernel/pci_common.c
index 4945d700a769..6b5c8e7a3eb0 100644
--- a/arch/sparc64/kernel/pci_common.c
+++ b/arch/sparc64/kernel/pci_common.c
@@ -73,17 +73,28 @@ static void pci_register_iommu_region(struct pci_pbm_info *pbm)
73 73
74void pci_determine_mem_io_space(struct pci_pbm_info *pbm) 74void pci_determine_mem_io_space(struct pci_pbm_info *pbm)
75{ 75{
76 struct linux_prom_pci_ranges *pbm_ranges;
76 int i, saw_mem, saw_io; 77 int i, saw_mem, saw_io;
78 int num_pbm_ranges;
77 79
78 saw_mem = saw_io = 0; 80 saw_mem = saw_io = 0;
79 for (i = 0; i < pbm->num_pbm_ranges; i++) { 81 pbm_ranges = of_get_property(pbm->prom_node, "ranges", &i);
80 struct linux_prom_pci_ranges *pr = &pbm->pbm_ranges[i]; 82 num_pbm_ranges = i / sizeof(*pbm_ranges);
83
84 for (i = 0; i < num_pbm_ranges; i++) {
85 struct linux_prom_pci_ranges *pr = &pbm_ranges[i];
81 unsigned long a; 86 unsigned long a;
87 u32 parent_phys_hi, parent_phys_lo;
82 int type; 88 int type;
83 89
90 parent_phys_hi = pr->parent_phys_hi;
91 parent_phys_lo = pr->parent_phys_lo;
92 if (tlb_type == hypervisor)
93 parent_phys_hi &= 0x0fffffff;
94
84 type = (pr->child_phys_hi >> 24) & 0x3; 95 type = (pr->child_phys_hi >> 24) & 0x3;
85 a = (((unsigned long)pr->parent_phys_hi << 32UL) | 96 a = (((unsigned long)parent_phys_hi << 32UL) |
86 ((unsigned long)pr->parent_phys_lo << 0UL)); 97 ((unsigned long)parent_phys_lo << 0UL));
87 98
88 switch (type) { 99 switch (type) {
89 case 0: 100 case 0:
diff --git a/arch/sparc64/kernel/pci_psycho.c b/arch/sparc64/kernel/pci_psycho.c
index 7b7010a1eb2f..1717df549488 100644
--- a/arch/sparc64/kernel/pci_psycho.c
+++ b/arch/sparc64/kernel/pci_psycho.c
@@ -1136,7 +1136,6 @@ static void psycho_pbm_init(struct pci_controller_info *p,
1136 unsigned int *busrange; 1136 unsigned int *busrange;
1137 struct property *prop; 1137 struct property *prop;
1138 struct pci_pbm_info *pbm; 1138 struct pci_pbm_info *pbm;
1139 int len;
1140 1139
1141 if (is_pbm_a) { 1140 if (is_pbm_a) {
1142 pbm = &p->pbm_A; 1141 pbm = &p->pbm_A;
@@ -1166,15 +1165,6 @@ static void psycho_pbm_init(struct pci_controller_info *p,
1166 pbm->name, 1165 pbm->name,
1167 pbm->chip_version, pbm->chip_revision); 1166 pbm->chip_version, pbm->chip_revision);
1168 1167
1169 prop = of_find_property(dp, "ranges", &len);
1170 if (prop) {
1171 pbm->pbm_ranges = prop->value;
1172 pbm->num_pbm_ranges =
1173 (len / sizeof(struct linux_prom_pci_ranges));
1174 } else {
1175 pbm->num_pbm_ranges = 0;
1176 }
1177
1178 prop = of_find_property(dp, "bus-range", NULL); 1168 prop = of_find_property(dp, "bus-range", NULL);
1179 busrange = prop->value; 1169 busrange = prop->value;
1180 pbm->pci_first_busno = busrange[0]; 1170 pbm->pci_first_busno = busrange[0];
diff --git a/arch/sparc64/kernel/pci_schizo.c b/arch/sparc64/kernel/pci_schizo.c
index 81daf903bdf4..dec8dc9499e0 100644
--- a/arch/sparc64/kernel/pci_schizo.c
+++ b/arch/sparc64/kernel/pci_schizo.c
@@ -1542,7 +1542,6 @@ static void schizo_pbm_init(struct pci_controller_info *p,
1542 const char *chipset_name; 1542 const char *chipset_name;
1543 u32 *ino_bitmap; 1543 u32 *ino_bitmap;
1544 int is_pbm_a; 1544 int is_pbm_a;
1545 int len;
1546 1545
1547 switch (chip_type) { 1546 switch (chip_type) {
1548 case PBM_CHIP_TYPE_TOMATILLO: 1547 case PBM_CHIP_TYPE_TOMATILLO:
@@ -1601,10 +1600,6 @@ static void schizo_pbm_init(struct pci_controller_info *p,
1601 1600
1602 schizo_pbm_hw_init(pbm); 1601 schizo_pbm_hw_init(pbm);
1603 1602
1604 pbm->pbm_ranges = of_get_property(dp, "ranges", &len);
1605 pbm->num_pbm_ranges =
1606 (len / sizeof(struct linux_prom_pci_ranges));
1607
1608 pci_determine_mem_io_space(pbm); 1603 pci_determine_mem_io_space(pbm);
1609 1604
1610 ino_bitmap = of_get_property(dp, "ino-bitmap", NULL); 1605 ino_bitmap = of_get_property(dp, "ino-bitmap", NULL);
diff --git a/arch/sparc64/kernel/pci_sun4v.c b/arch/sparc64/kernel/pci_sun4v.c
index 7bee6b19272e..9b57ba1cb947 100644
--- a/arch/sparc64/kernel/pci_sun4v.c
+++ b/arch/sparc64/kernel/pci_sun4v.c
@@ -1301,8 +1301,6 @@ static void pci_sun4v_msi_init(struct pci_pbm_info *pbm)
1301static void pci_sun4v_pbm_init(struct pci_controller_info *p, struct device_node *dp, u32 devhandle) 1301static void pci_sun4v_pbm_init(struct pci_controller_info *p, struct device_node *dp, u32 devhandle)
1302{ 1302{
1303 struct pci_pbm_info *pbm; 1303 struct pci_pbm_info *pbm;
1304 struct property *prop;
1305 int len, i;
1306 1304
1307 if (devhandle & 0x40) 1305 if (devhandle & 0x40)
1308 pbm = &p->pbm_B; 1306 pbm = &p->pbm_B;
@@ -1319,17 +1317,6 @@ static void pci_sun4v_pbm_init(struct pci_controller_info *p, struct device_node
1319 1317
1320 printk("%s: SUN4V PCI Bus Module\n", pbm->name); 1318 printk("%s: SUN4V PCI Bus Module\n", pbm->name);
1321 1319
1322 prop = of_find_property(dp, "ranges", &len);
1323 pbm->pbm_ranges = prop->value;
1324 pbm->num_pbm_ranges =
1325 (len / sizeof(struct linux_prom_pci_ranges));
1326
1327 /* Mask out the top 8 bits of the ranges, leaving the real
1328 * physical address.
1329 */
1330 for (i = 0; i < pbm->num_pbm_ranges; i++)
1331 pbm->pbm_ranges[i].parent_phys_hi &= 0x0fffffff;
1332
1333 pci_determine_mem_io_space(pbm); 1320 pci_determine_mem_io_space(pbm);
1334 1321
1335 pci_sun4v_get_bus_range(pbm); 1322 pci_sun4v_get_bus_range(pbm);