aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/platforms
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc/platforms')
-rw-r--r--arch/powerpc/platforms/powernv/Kconfig7
-rw-r--r--arch/powerpc/platforms/powernv/pci.c98
-rw-r--r--arch/powerpc/platforms/powernv/setup.c19
-rw-r--r--arch/powerpc/platforms/powernv/smp.c13
4 files changed, 19 insertions, 118 deletions
diff --git a/arch/powerpc/platforms/powernv/Kconfig b/arch/powerpc/platforms/powernv/Kconfig
index 45a8ed0585cd..4b044d8cb49a 100644
--- a/arch/powerpc/platforms/powernv/Kconfig
+++ b/arch/powerpc/platforms/powernv/Kconfig
@@ -19,10 +19,3 @@ config PPC_POWERNV
19 select CPU_FREQ_GOV_CONSERVATIVE 19 select CPU_FREQ_GOV_CONSERVATIVE
20 select PPC_DOORBELL 20 select PPC_DOORBELL
21 default y 21 default y
22
23config PPC_POWERNV_RTAS
24 depends on PPC_POWERNV
25 bool "Support for RTAS based PowerNV platforms such as BML"
26 default y
27 select PPC_ICS_RTAS
28 select PPC_RTAS
diff --git a/arch/powerpc/platforms/powernv/pci.c b/arch/powerpc/platforms/powernv/pci.c
index 946aa3d62c3c..4aa2e74534e8 100644
--- a/arch/powerpc/platforms/powernv/pci.c
+++ b/arch/powerpc/platforms/powernv/pci.c
@@ -662,66 +662,13 @@ void pnv_pci_setup_iommu_table(struct iommu_table *tbl,
662 tbl->it_type = TCE_PCI; 662 tbl->it_type = TCE_PCI;
663} 663}
664 664
665static struct iommu_table *pnv_pci_setup_bml_iommu(struct pci_controller *hose)
666{
667 struct iommu_table *tbl;
668 const __be64 *basep, *swinvp;
669 const __be32 *sizep;
670
671 basep = of_get_property(hose->dn, "linux,tce-base", NULL);
672 sizep = of_get_property(hose->dn, "linux,tce-size", NULL);
673 if (basep == NULL || sizep == NULL) {
674 pr_err("PCI: %s has missing tce entries !\n",
675 hose->dn->full_name);
676 return NULL;
677 }
678 tbl = kzalloc_node(sizeof(struct iommu_table), GFP_KERNEL, hose->node);
679 if (WARN_ON(!tbl))
680 return NULL;
681 pnv_pci_setup_iommu_table(tbl, __va(be64_to_cpup(basep)),
682 be32_to_cpup(sizep), 0, IOMMU_PAGE_SHIFT_4K);
683 iommu_init_table(tbl, hose->node);
684 iommu_register_group(tbl, pci_domain_nr(hose->bus), 0);
685
686 /* Deal with SW invalidated TCEs when needed (BML way) */
687 swinvp = of_get_property(hose->dn, "linux,tce-sw-invalidate-info",
688 NULL);
689 if (swinvp) {
690 tbl->it_busno = be64_to_cpu(swinvp[1]);
691 tbl->it_index = (unsigned long)ioremap(be64_to_cpup(swinvp), 8);
692 tbl->it_type = TCE_PCI_SWINV_CREATE | TCE_PCI_SWINV_FREE;
693 }
694 return tbl;
695}
696
697static void pnv_pci_dma_fallback_setup(struct pci_controller *hose,
698 struct pci_dev *pdev)
699{
700 struct device_node *np = pci_bus_to_OF_node(hose->bus);
701 struct pci_dn *pdn;
702
703 if (np == NULL)
704 return;
705 pdn = PCI_DN(np);
706 if (!pdn->iommu_table)
707 pdn->iommu_table = pnv_pci_setup_bml_iommu(hose);
708 if (!pdn->iommu_table)
709 return;
710 set_iommu_table_base_and_group(&pdev->dev, pdn->iommu_table);
711}
712
713static void pnv_pci_dma_dev_setup(struct pci_dev *pdev) 665static void pnv_pci_dma_dev_setup(struct pci_dev *pdev)
714{ 666{
715 struct pci_controller *hose = pci_bus_to_host(pdev->bus); 667 struct pci_controller *hose = pci_bus_to_host(pdev->bus);
716 struct pnv_phb *phb = hose->private_data; 668 struct pnv_phb *phb = hose->private_data;
717 669
718 /* If we have no phb structure, try to setup a fallback based on
719 * the device-tree (RTAS PCI for example)
720 */
721 if (phb && phb->dma_dev_setup) 670 if (phb && phb->dma_dev_setup)
722 phb->dma_dev_setup(phb, pdev); 671 phb->dma_dev_setup(phb, pdev);
723 else
724 pnv_pci_dma_fallback_setup(hose, pdev);
725} 672}
726 673
727int pnv_pci_dma_set_mask(struct pci_dev *pdev, u64 dma_mask) 674int pnv_pci_dma_set_mask(struct pci_dev *pdev, u64 dma_mask)
@@ -767,38 +714,31 @@ DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_IBM, 0x3b9, pnv_p7ioc_rc_quirk);
767void __init pnv_pci_init(void) 714void __init pnv_pci_init(void)
768{ 715{
769 struct device_node *np; 716 struct device_node *np;
717 bool found_ioda = false;
770 718
771 pci_add_flags(PCI_CAN_SKIP_ISA_ALIGN); 719 pci_add_flags(PCI_CAN_SKIP_ISA_ALIGN);
772 720
773 /* OPAL absent, try POPAL first then RTAS detection of PHBs */ 721 /* If we don't have OPAL, eg. in sim, just skip PCI probe */
774 if (!firmware_has_feature(FW_FEATURE_OPAL)) { 722 if (!firmware_has_feature(FW_FEATURE_OPAL))
775#ifdef CONFIG_PPC_POWERNV_RTAS 723 return;
776 init_pci_config_tokens();
777 find_and_init_phbs();
778#endif /* CONFIG_PPC_POWERNV_RTAS */
779 }
780 /* OPAL is here, do our normal stuff */
781 else {
782 int found_ioda = 0;
783 724
784 /* Look for IODA IO-Hubs. We don't support mixing IODA 725 /* Look for IODA IO-Hubs. We don't support mixing IODA
785 * and p5ioc2 due to the need to change some global 726 * and p5ioc2 due to the need to change some global
786 * probing flags 727 * probing flags
787 */ 728 */
788 for_each_compatible_node(np, NULL, "ibm,ioda-hub") { 729 for_each_compatible_node(np, NULL, "ibm,ioda-hub") {
789 pnv_pci_init_ioda_hub(np); 730 pnv_pci_init_ioda_hub(np);
790 found_ioda = 1; 731 found_ioda = true;
791 } 732 }
792 733
793 /* Look for p5ioc2 IO-Hubs */ 734 /* Look for p5ioc2 IO-Hubs */
794 if (!found_ioda) 735 if (!found_ioda)
795 for_each_compatible_node(np, NULL, "ibm,p5ioc2") 736 for_each_compatible_node(np, NULL, "ibm,p5ioc2")
796 pnv_pci_init_p5ioc2_hub(np); 737 pnv_pci_init_p5ioc2_hub(np);
797 738
798 /* Look for ioda2 built-in PHB3's */ 739 /* Look for ioda2 built-in PHB3's */
799 for_each_compatible_node(np, NULL, "ibm,ioda2-phb") 740 for_each_compatible_node(np, NULL, "ibm,ioda2-phb")
800 pnv_pci_init_ioda2_phb(np); 741 pnv_pci_init_ioda2_phb(np);
801 }
802 742
803 /* Setup the linkage between OF nodes and PHBs */ 743 /* Setup the linkage between OF nodes and PHBs */
804 pci_devs_phb_init(); 744 pci_devs_phb_init();
diff --git a/arch/powerpc/platforms/powernv/setup.c b/arch/powerpc/platforms/powernv/setup.c
index 39d1971d77db..16fdcb23f4c3 100644
--- a/arch/powerpc/platforms/powernv/setup.c
+++ b/arch/powerpc/platforms/powernv/setup.c
@@ -32,7 +32,6 @@
32#include <asm/machdep.h> 32#include <asm/machdep.h>
33#include <asm/firmware.h> 33#include <asm/firmware.h>
34#include <asm/xics.h> 34#include <asm/xics.h>
35#include <asm/rtas.h>
36#include <asm/opal.h> 35#include <asm/opal.h>
37#include <asm/kexec.h> 36#include <asm/kexec.h>
38#include <asm/smp.h> 37#include <asm/smp.h>
@@ -278,20 +277,6 @@ static void __init pnv_setup_machdep_opal(void)
278 ppc_md.handle_hmi_exception = opal_handle_hmi_exception; 277 ppc_md.handle_hmi_exception = opal_handle_hmi_exception;
279} 278}
280 279
281#ifdef CONFIG_PPC_POWERNV_RTAS
282static void __init pnv_setup_machdep_rtas(void)
283{
284 if (rtas_token("get-time-of-day") != RTAS_UNKNOWN_SERVICE) {
285 ppc_md.get_boot_time = rtas_get_boot_time;
286 ppc_md.get_rtc_time = rtas_get_rtc_time;
287 ppc_md.set_rtc_time = rtas_set_rtc_time;
288 }
289 ppc_md.restart = rtas_restart;
290 pm_power_off = rtas_power_off;
291 ppc_md.halt = rtas_halt;
292}
293#endif /* CONFIG_PPC_POWERNV_RTAS */
294
295static u32 supported_cpuidle_states; 280static u32 supported_cpuidle_states;
296 281
297int pnv_save_sprs_for_winkle(void) 282int pnv_save_sprs_for_winkle(void)
@@ -470,10 +455,6 @@ static int __init pnv_probe(void)
470 455
471 if (firmware_has_feature(FW_FEATURE_OPAL)) 456 if (firmware_has_feature(FW_FEATURE_OPAL))
472 pnv_setup_machdep_opal(); 457 pnv_setup_machdep_opal();
473#ifdef CONFIG_PPC_POWERNV_RTAS
474 else if (rtas.base)
475 pnv_setup_machdep_rtas();
476#endif /* CONFIG_PPC_POWERNV_RTAS */
477 458
478 pr_debug("PowerNV detected !\n"); 459 pr_debug("PowerNV detected !\n");
479 460
diff --git a/arch/powerpc/platforms/powernv/smp.c b/arch/powerpc/platforms/powernv/smp.c
index fc34025ef822..273d7b46f72a 100644
--- a/arch/powerpc/platforms/powernv/smp.c
+++ b/arch/powerpc/platforms/powernv/smp.c
@@ -25,7 +25,6 @@
25#include <asm/machdep.h> 25#include <asm/machdep.h>
26#include <asm/cputable.h> 26#include <asm/cputable.h>
27#include <asm/firmware.h> 27#include <asm/firmware.h>
28#include <asm/rtas.h>
29#include <asm/vdso_datapage.h> 28#include <asm/vdso_datapage.h>
30#include <asm/cputhreads.h> 29#include <asm/cputhreads.h>
31#include <asm/xics.h> 30#include <asm/xics.h>
@@ -241,18 +240,6 @@ void __init pnv_smp_init(void)
241{ 240{
242 smp_ops = &pnv_smp_ops; 241 smp_ops = &pnv_smp_ops;
243 242
244 /* XXX We don't yet have a proper entry point from HAL, for
245 * now we rely on kexec-style entry from BML
246 */
247
248#ifdef CONFIG_PPC_RTAS
249 /* Non-lpar has additional take/give timebase */
250 if (rtas_token("freeze-time-base") != RTAS_UNKNOWN_SERVICE) {
251 smp_ops->give_timebase = rtas_give_timebase;
252 smp_ops->take_timebase = rtas_take_timebase;
253 }
254#endif /* CONFIG_PPC_RTAS */
255
256#ifdef CONFIG_HOTPLUG_CPU 243#ifdef CONFIG_HOTPLUG_CPU
257 ppc_md.cpu_die = pnv_smp_cpu_kill_self; 244 ppc_md.cpu_die = pnv_smp_cpu_kill_self;
258#endif 245#endif