diff options
author | David S. Miller <davem@sunset.davemloft.net> | 2007-05-08 00:51:41 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-05-08 19:41:12 -0400 |
commit | cfa0652c4eb4ca37f88fcdd7d871cf98d9d98c0e (patch) | |
tree | 14a3278bd62870a1b0a8fb3ba709fd2f3f3257ee /arch/sparc64/kernel | |
parent | 36f021b579d195cdc5fa6f3e2bab198b4bf70643 (diff) |
[SPARC64] PCI: Use common routine to fetch PBM properties.
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>
Diffstat (limited to 'arch/sparc64/kernel')
-rw-r--r-- | arch/sparc64/kernel/pci_common.c | 14 | ||||
-rw-r--r-- | arch/sparc64/kernel/pci_fire.c | 10 | ||||
-rw-r--r-- | arch/sparc64/kernel/pci_impl.h | 1 | ||||
-rw-r--r-- | arch/sparc64/kernel/pci_psycho.c | 6 | ||||
-rw-r--r-- | arch/sparc64/kernel/pci_sabre.c | 8 | ||||
-rw-r--r-- | arch/sparc64/kernel/pci_schizo.c | 10 | ||||
-rw-r--r-- | arch/sparc64/kernel/pci_sun4v.c | 16 |
7 files changed, 20 insertions, 45 deletions
diff --git a/arch/sparc64/kernel/pci_common.c b/arch/sparc64/kernel/pci_common.c index 1e6aeedf43c4..b1168bfa16fb 100644 --- a/arch/sparc64/kernel/pci_common.c +++ b/arch/sparc64/kernel/pci_common.c | |||
@@ -15,6 +15,20 @@ | |||
15 | 15 | ||
16 | #include "pci_impl.h" | 16 | #include "pci_impl.h" |
17 | 17 | ||
18 | void pci_get_pbm_props(struct pci_pbm_info *pbm) | ||
19 | { | ||
20 | const u32 *val = of_get_property(pbm->prom_node, "bus-range", NULL); | ||
21 | |||
22 | pbm->pci_first_busno = val[0]; | ||
23 | pbm->pci_last_busno = val[1]; | ||
24 | |||
25 | val = of_get_property(pbm->prom_node, "ino-bitmap", NULL); | ||
26 | if (val) { | ||
27 | pbm->ino_bitmap = (((u64)val[1] << 32UL) | | ||
28 | ((u64)val[0] << 0UL)); | ||
29 | } | ||
30 | } | ||
31 | |||
18 | static void pci_register_legacy_regions(struct resource *io_res, | 32 | static void pci_register_legacy_regions(struct resource *io_res, |
19 | struct resource *mem_res) | 33 | struct resource *mem_res) |
20 | { | 34 | { |
diff --git a/arch/sparc64/kernel/pci_fire.c b/arch/sparc64/kernel/pci_fire.c index 0fe626631e12..79ee5be948eb 100644 --- a/arch/sparc64/kernel/pci_fire.c +++ b/arch/sparc64/kernel/pci_fire.c | |||
@@ -317,8 +317,6 @@ static void pci_fire_pbm_init(struct pci_controller_info *p, | |||
317 | { | 317 | { |
318 | const struct linux_prom64_registers *regs; | 318 | const struct linux_prom64_registers *regs; |
319 | struct pci_pbm_info *pbm; | 319 | struct pci_pbm_info *pbm; |
320 | const u32 *ino_bitmap; | ||
321 | const unsigned int *busrange; | ||
322 | 320 | ||
323 | if ((portid & 1) == 0) | 321 | if ((portid & 1) == 0) |
324 | pbm = &p->pbm_A; | 322 | pbm = &p->pbm_A; |
@@ -338,13 +336,7 @@ static void pci_fire_pbm_init(struct pci_controller_info *p, | |||
338 | 336 | ||
339 | pci_determine_mem_io_space(pbm); | 337 | pci_determine_mem_io_space(pbm); |
340 | 338 | ||
341 | ino_bitmap = of_get_property(dp, "ino-bitmap", NULL); | 339 | pci_get_pbm_props(pbm); |
342 | pbm->ino_bitmap = (((u64)ino_bitmap[1] << 32UL) | | ||
343 | ((u64)ino_bitmap[0] << 0UL)); | ||
344 | |||
345 | busrange = of_get_property(dp, "bus-range", NULL); | ||
346 | pbm->pci_first_busno = busrange[0]; | ||
347 | pbm->pci_last_busno = busrange[1]; | ||
348 | 340 | ||
349 | pci_fire_hw_init(pbm); | 341 | pci_fire_hw_init(pbm); |
350 | pci_fire_pbm_iommu_init(pbm); | 342 | pci_fire_pbm_iommu_init(pbm); |
diff --git a/arch/sparc64/kernel/pci_impl.h b/arch/sparc64/kernel/pci_impl.h index 1208583fcb83..41c3f5137306 100644 --- a/arch/sparc64/kernel/pci_impl.h +++ b/arch/sparc64/kernel/pci_impl.h | |||
@@ -17,6 +17,7 @@ extern unsigned long pci_memspace_mask; | |||
17 | extern int pci_num_controllers; | 17 | extern int pci_num_controllers; |
18 | 18 | ||
19 | /* PCI bus scanning and fixup support. */ | 19 | /* PCI bus scanning and fixup support. */ |
20 | extern void pci_get_pbm_props(struct pci_pbm_info *pbm); | ||
20 | extern struct pci_bus *pci_scan_one_pbm(struct pci_pbm_info *pbm); | 21 | extern struct pci_bus *pci_scan_one_pbm(struct pci_pbm_info *pbm); |
21 | extern void pci_determine_mem_io_space(struct pci_pbm_info *pbm); | 22 | extern void pci_determine_mem_io_space(struct pci_pbm_info *pbm); |
22 | 23 | ||
diff --git a/arch/sparc64/kernel/pci_psycho.c b/arch/sparc64/kernel/pci_psycho.c index 253d40ec2245..0f35135a40c5 100644 --- a/arch/sparc64/kernel/pci_psycho.c +++ b/arch/sparc64/kernel/pci_psycho.c | |||
@@ -1088,7 +1088,6 @@ static void psycho_pbm_strbuf_init(struct pci_controller_info *p, | |||
1088 | static void psycho_pbm_init(struct pci_controller_info *p, | 1088 | static void psycho_pbm_init(struct pci_controller_info *p, |
1089 | struct device_node *dp, int is_pbm_a) | 1089 | struct device_node *dp, int is_pbm_a) |
1090 | { | 1090 | { |
1091 | unsigned int *busrange; | ||
1092 | struct property *prop; | 1091 | struct property *prop; |
1093 | struct pci_pbm_info *pbm; | 1092 | struct pci_pbm_info *pbm; |
1094 | 1093 | ||
@@ -1117,10 +1116,7 @@ static void psycho_pbm_init(struct pci_controller_info *p, | |||
1117 | 1116 | ||
1118 | pci_determine_mem_io_space(pbm); | 1117 | pci_determine_mem_io_space(pbm); |
1119 | 1118 | ||
1120 | prop = of_find_property(dp, "bus-range", NULL); | 1119 | pci_get_pbm_props(pbm); |
1121 | busrange = prop->value; | ||
1122 | pbm->pci_first_busno = busrange[0]; | ||
1123 | pbm->pci_last_busno = busrange[1]; | ||
1124 | 1120 | ||
1125 | psycho_pbm_strbuf_init(p, pbm, is_pbm_a); | 1121 | psycho_pbm_strbuf_init(p, pbm, is_pbm_a); |
1126 | } | 1122 | } |
diff --git a/arch/sparc64/kernel/pci_sabre.c b/arch/sparc64/kernel/pci_sabre.c index 397862fbd9e1..9e706013d11a 100644 --- a/arch/sparc64/kernel/pci_sabre.c +++ b/arch/sparc64/kernel/pci_sabre.c | |||
@@ -1006,8 +1006,7 @@ static void sabre_pbm_init(struct pci_controller_info *p, struct device_node *dp | |||
1006 | pbm->chip_type = PBM_CHIP_TYPE_SABRE; | 1006 | pbm->chip_type = PBM_CHIP_TYPE_SABRE; |
1007 | pbm->parent = p; | 1007 | pbm->parent = p; |
1008 | pbm->prom_node = dp; | 1008 | pbm->prom_node = dp; |
1009 | pbm->pci_first_busno = p->pci_first_busno; | 1009 | pci_get_pbm_props(pbm); |
1010 | pbm->pci_last_busno = p->pci_last_busno; | ||
1011 | 1010 | ||
1012 | pci_determine_mem_io_space(pbm); | 1011 | pci_determine_mem_io_space(pbm); |
1013 | } | 1012 | } |
@@ -1018,7 +1017,6 @@ void sabre_init(struct device_node *dp, char *model_name) | |||
1018 | struct pci_controller_info *p; | 1017 | struct pci_controller_info *p; |
1019 | struct iommu *iommu; | 1018 | struct iommu *iommu; |
1020 | int tsbsize; | 1019 | int tsbsize; |
1021 | const u32 *busrange; | ||
1022 | const u32 *vdma; | 1020 | const u32 *vdma; |
1023 | u32 upa_portid, dma_mask; | 1021 | u32 upa_portid, dma_mask; |
1024 | u64 clear_irq; | 1022 | u64 clear_irq; |
@@ -1119,10 +1117,6 @@ void sabre_init(struct device_node *dp, char *model_name) | |||
1119 | 1117 | ||
1120 | sabre_iommu_init(p, tsbsize, vdma[0], dma_mask); | 1118 | sabre_iommu_init(p, tsbsize, vdma[0], dma_mask); |
1121 | 1119 | ||
1122 | busrange = of_get_property(dp, "bus-range", NULL); | ||
1123 | p->pci_first_busno = busrange[0]; | ||
1124 | p->pci_last_busno = busrange[1]; | ||
1125 | |||
1126 | /* | 1120 | /* |
1127 | * Look for APB underneath. | 1121 | * Look for APB underneath. |
1128 | */ | 1122 | */ |
diff --git a/arch/sparc64/kernel/pci_schizo.c b/arch/sparc64/kernel/pci_schizo.c index 91a7385e5d32..c0a6a3866e2f 100644 --- a/arch/sparc64/kernel/pci_schizo.c +++ b/arch/sparc64/kernel/pci_schizo.c | |||
@@ -1491,10 +1491,8 @@ static void schizo_pbm_init(struct pci_controller_info *p, | |||
1491 | int chip_type) | 1491 | int chip_type) |
1492 | { | 1492 | { |
1493 | const struct linux_prom64_registers *regs; | 1493 | const struct linux_prom64_registers *regs; |
1494 | const unsigned int *busrange; | ||
1495 | struct pci_pbm_info *pbm; | 1494 | struct pci_pbm_info *pbm; |
1496 | const char *chipset_name; | 1495 | const char *chipset_name; |
1497 | const u32 *ino_bitmap; | ||
1498 | int is_pbm_a; | 1496 | int is_pbm_a; |
1499 | 1497 | ||
1500 | switch (chip_type) { | 1498 | switch (chip_type) { |
@@ -1555,13 +1553,7 @@ static void schizo_pbm_init(struct pci_controller_info *p, | |||
1555 | 1553 | ||
1556 | pci_determine_mem_io_space(pbm); | 1554 | pci_determine_mem_io_space(pbm); |
1557 | 1555 | ||
1558 | ino_bitmap = of_get_property(dp, "ino-bitmap", NULL); | 1556 | pci_get_pbm_props(pbm); |
1559 | pbm->ino_bitmap = (((u64)ino_bitmap[1] << 32UL) | | ||
1560 | ((u64)ino_bitmap[0] << 0UL)); | ||
1561 | |||
1562 | busrange = of_get_property(dp, "bus-range", NULL); | ||
1563 | pbm->pci_first_busno = busrange[0]; | ||
1564 | pbm->pci_last_busno = busrange[1]; | ||
1565 | 1557 | ||
1566 | schizo_pbm_iommu_init(pbm); | 1558 | schizo_pbm_iommu_init(pbm); |
1567 | schizo_pbm_strbuf_init(pbm); | 1559 | schizo_pbm_strbuf_init(pbm); |
diff --git a/arch/sparc64/kernel/pci_sun4v.c b/arch/sparc64/kernel/pci_sun4v.c index 1ccf4c9a9a43..1491ba330583 100644 --- a/arch/sparc64/kernel/pci_sun4v.c +++ b/arch/sparc64/kernel/pci_sun4v.c | |||
@@ -802,20 +802,6 @@ static void pci_sun4v_iommu_init(struct pci_pbm_info *pbm) | |||
802 | pbm->name, sz); | 802 | pbm->name, sz); |
803 | } | 803 | } |
804 | 804 | ||
805 | static void pci_sun4v_get_bus_range(struct pci_pbm_info *pbm) | ||
806 | { | ||
807 | struct property *prop; | ||
808 | unsigned int *busrange; | ||
809 | |||
810 | prop = of_find_property(pbm->prom_node, "bus-range", NULL); | ||
811 | |||
812 | busrange = prop->value; | ||
813 | |||
814 | pbm->pci_first_busno = busrange[0]; | ||
815 | pbm->pci_last_busno = busrange[1]; | ||
816 | |||
817 | } | ||
818 | |||
819 | #ifdef CONFIG_PCI_MSI | 805 | #ifdef CONFIG_PCI_MSI |
820 | struct pci_sun4v_msiq_entry { | 806 | struct pci_sun4v_msiq_entry { |
821 | u64 version_type; | 807 | u64 version_type; |
@@ -1271,7 +1257,7 @@ static void pci_sun4v_pbm_init(struct pci_controller_info *p, struct device_node | |||
1271 | 1257 | ||
1272 | pci_determine_mem_io_space(pbm); | 1258 | pci_determine_mem_io_space(pbm); |
1273 | 1259 | ||
1274 | pci_sun4v_get_bus_range(pbm); | 1260 | pci_get_pbm_props(pbm); |
1275 | pci_sun4v_iommu_init(pbm); | 1261 | pci_sun4v_iommu_init(pbm); |
1276 | pci_sun4v_msi_init(pbm); | 1262 | pci_sun4v_msi_init(pbm); |
1277 | } | 1263 | } |