aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorDavid S. Miller <davem@sunset.davemloft.net>2007-03-09 01:42:19 -0500
committerDavid S. Miller <davem@sunset.davemloft.net>2007-04-26 04:55:14 -0400
commit0bae5f81b6f8130f5197e59b0e2ad6820c766b2b (patch)
treee0a7f1e0018941ed6f76ea7ff97ec2506c14b899 /arch
parent3487a1f9e719d36c9b2d4d492994b2dd815a58b7 (diff)
[SPARC64]: Kill pci_controller->resource_adjust()
All the implementations can be identical and generic, so no need for controller specific methods. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch')
-rw-r--r--arch/sparc64/kernel/pci.c17
-rw-r--r--arch/sparc64/kernel/pci_psycho.c9
-rw-r--r--arch/sparc64/kernel/pci_sabre.c17
-rw-r--r--arch/sparc64/kernel/pci_schizo.c9
-rw-r--r--arch/sparc64/kernel/pci_sun4v.c9
5 files changed, 12 insertions, 49 deletions
diff --git a/arch/sparc64/kernel/pci.c b/arch/sparc64/kernel/pci.c
index b63341c2a334..6b94d97e56ad 100644
--- a/arch/sparc64/kernel/pci.c
+++ b/arch/sparc64/kernel/pci.c
@@ -469,6 +469,13 @@ static void __init apb_calc_first_last(u8 map, u32 *first_p, u32 *last_p)
469 *last_p = last; 469 *last_p = last;
470} 470}
471 471
472static void __init pci_resource_adjust(struct resource *res,
473 struct resource *root)
474{
475 res->start += root->start;
476 res->end += root->start;
477}
478
472/* Cook up fake bus resources for SUNW,simba PCI bridges which lack 479/* Cook up fake bus resources for SUNW,simba PCI bridges which lack
473 * a proper 'ranges' property. 480 * a proper 'ranges' property.
474 */ 481 */
@@ -486,7 +493,7 @@ static void __init apb_fake_ranges(struct pci_dev *dev,
486 res->start = (first << 21); 493 res->start = (first << 21);
487 res->end = (last << 21) + ((1 << 21) - 1); 494 res->end = (last << 21) + ((1 << 21) - 1);
488 res->flags = IORESOURCE_IO; 495 res->flags = IORESOURCE_IO;
489 pbm->parent->resource_adjust(dev, res, &pbm->io_space); 496 pci_resource_adjust(res, &pbm->io_space);
490 497
491 pci_read_config_byte(dev, APB_MEM_ADDRESS_MAP, &map); 498 pci_read_config_byte(dev, APB_MEM_ADDRESS_MAP, &map);
492 apb_calc_first_last(map, &first, &last); 499 apb_calc_first_last(map, &first, &last);
@@ -494,7 +501,7 @@ static void __init apb_fake_ranges(struct pci_dev *dev,
494 res->start = (first << 21); 501 res->start = (first << 21);
495 res->end = (last << 21) + ((1 << 21) - 1); 502 res->end = (last << 21) + ((1 << 21) - 1);
496 res->flags = IORESOURCE_MEM; 503 res->flags = IORESOURCE_MEM;
497 pbm->parent->resource_adjust(dev, res, &pbm->mem_space); 504 pci_resource_adjust(res, &pbm->mem_space);
498} 505}
499 506
500static void __init pci_of_scan_bus(struct pci_pbm_info *pbm, 507static void __init pci_of_scan_bus(struct pci_pbm_info *pbm,
@@ -594,7 +601,7 @@ void __devinit of_scan_pci_bridge(struct pci_pbm_info *pbm,
594 * layer routine that can calculate a resource for a given 601 * layer routine that can calculate a resource for a given
595 * range property value in a PCI device. 602 * range property value in a PCI device.
596 */ 603 */
597 pbm->parent->resource_adjust(dev, res, root); 604 pci_resource_adjust(res, root);
598 } 605 }
599simba_cont: 606simba_cont:
600 sprintf(bus->name, "PCI Bus %04x:%02x", pci_domain_nr(bus), 607 sprintf(bus->name, "PCI Bus %04x:%02x", pci_domain_nr(bus),
@@ -803,7 +810,7 @@ void pcibios_resource_to_bus(struct pci_dev *pdev, struct pci_bus_region *region
803 else 810 else
804 root = &pbm->mem_space; 811 root = &pbm->mem_space;
805 812
806 pbm->parent->resource_adjust(pdev, &zero_res, root); 813 pci_resource_adjust(&zero_res, root);
807 814
808 region->start = res->start - zero_res.start; 815 region->start = res->start - zero_res.start;
809 region->end = res->end - zero_res.start; 816 region->end = res->end - zero_res.start;
@@ -824,7 +831,7 @@ void pcibios_bus_to_resource(struct pci_dev *pdev, struct resource *res,
824 else 831 else
825 root = &pbm->mem_space; 832 root = &pbm->mem_space;
826 833
827 pbm->parent->resource_adjust(pdev, res, root); 834 pci_resource_adjust(res, root);
828} 835}
829EXPORT_SYMBOL(pcibios_bus_to_resource); 836EXPORT_SYMBOL(pcibios_bus_to_resource);
830 837
diff --git a/arch/sparc64/kernel/pci_psycho.c b/arch/sparc64/kernel/pci_psycho.c
index 1717df549488..c3f212725b04 100644
--- a/arch/sparc64/kernel/pci_psycho.c
+++ b/arch/sparc64/kernel/pci_psycho.c
@@ -894,14 +894,6 @@ static void psycho_register_error_handlers(struct pci_controller_info *p)
894} 894}
895 895
896/* PSYCHO boot time probing and initialization. */ 896/* PSYCHO boot time probing and initialization. */
897static void psycho_resource_adjust(struct pci_dev *pdev,
898 struct resource *res,
899 struct resource *root)
900{
901 res->start += root->start;
902 res->end += root->start;
903}
904
905static void psycho_base_address_update(struct pci_dev *pdev, int resource) 897static void psycho_base_address_update(struct pci_dev *pdev, int resource)
906{ 898{
907 struct pci_pbm_info *pbm = pdev->dev.archdata.host_controller; 899 struct pci_pbm_info *pbm = pdev->dev.archdata.host_controller;
@@ -1218,7 +1210,6 @@ void psycho_init(struct device_node *dp, char *model_name)
1218 p->pbms_same_domain = 0; 1210 p->pbms_same_domain = 0;
1219 p->scan_bus = psycho_scan_bus; 1211 p->scan_bus = psycho_scan_bus;
1220 p->base_address_update = psycho_base_address_update; 1212 p->base_address_update = psycho_base_address_update;
1221 p->resource_adjust = psycho_resource_adjust;
1222 p->pci_ops = &psycho_ops; 1213 p->pci_ops = &psycho_ops;
1223 1214
1224 prop = of_find_property(dp, "reg", NULL); 1215 prop = of_find_property(dp, "reg", NULL);
diff --git a/arch/sparc64/kernel/pci_sabre.c b/arch/sparc64/kernel/pci_sabre.c
index 2dad171b54e2..64cdce81d86a 100644
--- a/arch/sparc64/kernel/pci_sabre.c
+++ b/arch/sparc64/kernel/pci_sabre.c
@@ -862,22 +862,6 @@ static void sabre_register_error_handlers(struct pci_controller_info *p)
862 sabre_write(base + SABRE_PCICTRL, tmp); 862 sabre_write(base + SABRE_PCICTRL, tmp);
863} 863}
864 864
865static void sabre_resource_adjust(struct pci_dev *pdev,
866 struct resource *res,
867 struct resource *root)
868{
869 struct pci_pbm_info *pbm = pdev->bus->sysdata;
870 unsigned long base;
871
872 if (res->flags & IORESOURCE_IO)
873 base = pbm->controller_regs + SABRE_IOSPACE;
874 else
875 base = pbm->controller_regs + SABRE_MEMSPACE;
876
877 res->start += base;
878 res->end += base;
879}
880
881static void sabre_base_address_update(struct pci_dev *pdev, int resource) 865static void sabre_base_address_update(struct pci_dev *pdev, int resource)
882{ 866{
883 struct pci_pbm_info *pbm = pdev->dev.archdata.host_controller; 867 struct pci_pbm_info *pbm = pdev->dev.archdata.host_controller;
@@ -1116,7 +1100,6 @@ void sabre_init(struct device_node *dp, char *model_name)
1116 p->pbms_same_domain = 1; 1100 p->pbms_same_domain = 1;
1117 p->scan_bus = sabre_scan_bus; 1101 p->scan_bus = sabre_scan_bus;
1118 p->base_address_update = sabre_base_address_update; 1102 p->base_address_update = sabre_base_address_update;
1119 p->resource_adjust = sabre_resource_adjust;
1120 p->pci_ops = &sabre_ops; 1103 p->pci_ops = &sabre_ops;
1121 1104
1122 /* 1105 /*
diff --git a/arch/sparc64/kernel/pci_schizo.c b/arch/sparc64/kernel/pci_schizo.c
index dec8dc9499e0..ba9206eb9516 100644
--- a/arch/sparc64/kernel/pci_schizo.c
+++ b/arch/sparc64/kernel/pci_schizo.c
@@ -1295,14 +1295,6 @@ static void schizo_base_address_update(struct pci_dev *pdev, int resource)
1295 pci_write_config_dword(pdev, where + 4, 0); 1295 pci_write_config_dword(pdev, where + 4, 0);
1296} 1296}
1297 1297
1298static void schizo_resource_adjust(struct pci_dev *pdev,
1299 struct resource *res,
1300 struct resource *root)
1301{
1302 res->start += root->start;
1303 res->end += root->start;
1304}
1305
1306#define SCHIZO_STRBUF_CONTROL (0x02800UL) 1298#define SCHIZO_STRBUF_CONTROL (0x02800UL)
1307#define SCHIZO_STRBUF_FLUSH (0x02808UL) 1299#define SCHIZO_STRBUF_FLUSH (0x02808UL)
1308#define SCHIZO_STRBUF_FSYNC (0x02810UL) 1300#define SCHIZO_STRBUF_FSYNC (0x02810UL)
@@ -1670,7 +1662,6 @@ static void __schizo_init(struct device_node *dp, char *model_name, int chip_typ
1670 p->index = pci_num_controllers++; 1662 p->index = pci_num_controllers++;
1671 p->scan_bus = schizo_scan_bus; 1663 p->scan_bus = schizo_scan_bus;
1672 p->base_address_update = schizo_base_address_update; 1664 p->base_address_update = schizo_base_address_update;
1673 p->resource_adjust = schizo_resource_adjust;
1674 p->pci_ops = &schizo_ops; 1665 p->pci_ops = &schizo_ops;
1675 1666
1676 /* Like PSYCHO we have a 2GB aligned area for memory space. */ 1667 /* Like PSYCHO we have a 2GB aligned area for memory space. */
diff --git a/arch/sparc64/kernel/pci_sun4v.c b/arch/sparc64/kernel/pci_sun4v.c
index 9b57ba1cb947..ce0417e776a1 100644
--- a/arch/sparc64/kernel/pci_sun4v.c
+++ b/arch/sparc64/kernel/pci_sun4v.c
@@ -743,14 +743,6 @@ static void pci_sun4v_base_address_update(struct pci_dev *pdev, int resource)
743 pci_write_config_dword(pdev, where + 4, 0); 743 pci_write_config_dword(pdev, where + 4, 0);
744} 744}
745 745
746static void pci_sun4v_resource_adjust(struct pci_dev *pdev,
747 struct resource *res,
748 struct resource *root)
749{
750 res->start += root->start;
751 res->end += root->start;
752}
753
754static unsigned long probe_existing_entries(struct pci_pbm_info *pbm, 746static unsigned long probe_existing_entries(struct pci_pbm_info *pbm,
755 struct pci_iommu *iommu) 747 struct pci_iommu *iommu)
756{ 748{
@@ -1387,7 +1379,6 @@ void sun4v_pci_init(struct device_node *dp, char *model_name)
1387 1379
1388 p->scan_bus = pci_sun4v_scan_bus; 1380 p->scan_bus = pci_sun4v_scan_bus;
1389 p->base_address_update = pci_sun4v_base_address_update; 1381 p->base_address_update = pci_sun4v_base_address_update;
1390 p->resource_adjust = pci_sun4v_resource_adjust;
1391#ifdef CONFIG_PCI_MSI 1382#ifdef CONFIG_PCI_MSI
1392 p->setup_msi_irq = pci_sun4v_setup_msi_irq; 1383 p->setup_msi_irq = pci_sun4v_setup_msi_irq;
1393 p->teardown_msi_irq = pci_sun4v_teardown_msi_irq; 1384 p->teardown_msi_irq = pci_sun4v_teardown_msi_irq;