diff options
Diffstat (limited to 'arch/powerpc/platforms/pseries/setup.c')
-rw-r--r-- | arch/powerpc/platforms/pseries/setup.c | 65 |
1 files changed, 35 insertions, 30 deletions
diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c index ed8a90022a3d..e445b6701f50 100644 --- a/arch/powerpc/platforms/pseries/setup.c +++ b/arch/powerpc/platforms/pseries/setup.c | |||
@@ -500,7 +500,11 @@ static void __init pSeries_setup_arch(void) | |||
500 | 500 | ||
501 | if (firmware_has_feature(FW_FEATURE_SET_MODE)) { | 501 | if (firmware_has_feature(FW_FEATURE_SET_MODE)) { |
502 | long rc; | 502 | long rc; |
503 | if ((rc = pSeries_enable_reloc_on_exc()) != H_SUCCESS) { | 503 | |
504 | rc = pSeries_enable_reloc_on_exc(); | ||
505 | if (rc == H_P2) { | ||
506 | pr_info("Relocation on exceptions not supported\n"); | ||
507 | } else if (rc != H_SUCCESS) { | ||
504 | pr_warn("Unable to enable relocation on exceptions: " | 508 | pr_warn("Unable to enable relocation on exceptions: " |
505 | "%ld\n", rc); | 509 | "%ld\n", rc); |
506 | } | 510 | } |
@@ -660,6 +664,34 @@ static void __init pSeries_init_early(void) | |||
660 | pr_debug(" <- pSeries_init_early()\n"); | 664 | pr_debug(" <- pSeries_init_early()\n"); |
661 | } | 665 | } |
662 | 666 | ||
667 | /** | ||
668 | * pseries_power_off - tell firmware about how to power off the system. | ||
669 | * | ||
670 | * This function calls either the power-off rtas token in normal cases | ||
671 | * or the ibm,power-off-ups token (if present & requested) in case of | ||
672 | * a power failure. If power-off token is used, power on will only be | ||
673 | * possible with power button press. If ibm,power-off-ups token is used | ||
674 | * it will allow auto poweron after power is restored. | ||
675 | */ | ||
676 | static void pseries_power_off(void) | ||
677 | { | ||
678 | int rc; | ||
679 | int rtas_poweroff_ups_token = rtas_token("ibm,power-off-ups"); | ||
680 | |||
681 | if (rtas_flash_term_hook) | ||
682 | rtas_flash_term_hook(SYS_POWER_OFF); | ||
683 | |||
684 | if (rtas_poweron_auto == 0 || | ||
685 | rtas_poweroff_ups_token == RTAS_UNKNOWN_SERVICE) { | ||
686 | rc = rtas_call(rtas_token("power-off"), 2, 1, NULL, -1, -1); | ||
687 | printk(KERN_INFO "RTAS power-off returned %d\n", rc); | ||
688 | } else { | ||
689 | rc = rtas_call(rtas_poweroff_ups_token, 0, 1, NULL); | ||
690 | printk(KERN_INFO "RTAS ibm,power-off-ups returned %d\n", rc); | ||
691 | } | ||
692 | for (;;); | ||
693 | } | ||
694 | |||
663 | /* | 695 | /* |
664 | * Called very early, MMU is off, device-tree isn't unflattened | 696 | * Called very early, MMU is off, device-tree isn't unflattened |
665 | */ | 697 | */ |
@@ -742,6 +774,8 @@ static int __init pSeries_probe(void) | |||
742 | else | 774 | else |
743 | hpte_init_native(); | 775 | hpte_init_native(); |
744 | 776 | ||
777 | pm_power_off = pseries_power_off; | ||
778 | |||
745 | pr_debug("Machine is%s LPAR !\n", | 779 | pr_debug("Machine is%s LPAR !\n", |
746 | (powerpc_firmware_features & FW_FEATURE_LPAR) ? "" : " not"); | 780 | (powerpc_firmware_features & FW_FEATURE_LPAR) ? "" : " not"); |
747 | 781 | ||
@@ -755,34 +789,6 @@ static int pSeries_pci_probe_mode(struct pci_bus *bus) | |||
755 | return PCI_PROBE_NORMAL; | 789 | return PCI_PROBE_NORMAL; |
756 | } | 790 | } |
757 | 791 | ||
758 | /** | ||
759 | * pSeries_power_off - tell firmware about how to power off the system. | ||
760 | * | ||
761 | * This function calls either the power-off rtas token in normal cases | ||
762 | * or the ibm,power-off-ups token (if present & requested) in case of | ||
763 | * a power failure. If power-off token is used, power on will only be | ||
764 | * possible with power button press. If ibm,power-off-ups token is used | ||
765 | * it will allow auto poweron after power is restored. | ||
766 | */ | ||
767 | static void pSeries_power_off(void) | ||
768 | { | ||
769 | int rc; | ||
770 | int rtas_poweroff_ups_token = rtas_token("ibm,power-off-ups"); | ||
771 | |||
772 | if (rtas_flash_term_hook) | ||
773 | rtas_flash_term_hook(SYS_POWER_OFF); | ||
774 | |||
775 | if (rtas_poweron_auto == 0 || | ||
776 | rtas_poweroff_ups_token == RTAS_UNKNOWN_SERVICE) { | ||
777 | rc = rtas_call(rtas_token("power-off"), 2, 1, NULL, -1, -1); | ||
778 | printk(KERN_INFO "RTAS power-off returned %d\n", rc); | ||
779 | } else { | ||
780 | rc = rtas_call(rtas_poweroff_ups_token, 0, 1, NULL); | ||
781 | printk(KERN_INFO "RTAS ibm,power-off-ups returned %d\n", rc); | ||
782 | } | ||
783 | for (;;); | ||
784 | } | ||
785 | |||
786 | #ifndef CONFIG_PCI | 792 | #ifndef CONFIG_PCI |
787 | void pSeries_final_fixup(void) { } | 793 | void pSeries_final_fixup(void) { } |
788 | #endif | 794 | #endif |
@@ -797,7 +803,6 @@ define_machine(pseries) { | |||
797 | .pcibios_fixup = pSeries_final_fixup, | 803 | .pcibios_fixup = pSeries_final_fixup, |
798 | .pci_probe_mode = pSeries_pci_probe_mode, | 804 | .pci_probe_mode = pSeries_pci_probe_mode, |
799 | .restart = rtas_restart, | 805 | .restart = rtas_restart, |
800 | .power_off = pSeries_power_off, | ||
801 | .halt = rtas_halt, | 806 | .halt = rtas_halt, |
802 | .panic = rtas_os_term, | 807 | .panic = rtas_os_term, |
803 | .get_boot_time = rtas_get_boot_time, | 808 | .get_boot_time = rtas_get_boot_time, |