diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2011-02-10 22:03:20 -0500 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2011-04-01 00:37:21 -0400 |
commit | 4c6130d9bba78e7ac44584378660a1204c5297d1 (patch) | |
tree | 5e42b54a505afa970c581a9edc89699280a09569 | |
parent | 45e07fd045153c0049c99b0cf6cf7254c164d37b (diff) |
powerpc/pmac/smp: Consolidate 32-bit and 64-bit PowerMac cpu_die in one file
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
-rw-r--r-- | arch/powerpc/platforms/powermac/pmac.h | 1 | ||||
-rw-r--r-- | arch/powerpc/platforms/powermac/setup.c | 56 | ||||
-rw-r--r-- | arch/powerpc/platforms/powermac/smp.c | 58 |
3 files changed, 55 insertions, 60 deletions
diff --git a/arch/powerpc/platforms/powermac/pmac.h b/arch/powerpc/platforms/powermac/pmac.h index f0bc08f6c1f0..20468f49aec0 100644 --- a/arch/powerpc/platforms/powermac/pmac.h +++ b/arch/powerpc/platforms/powermac/pmac.h | |||
@@ -33,7 +33,6 @@ extern void pmac_setup_pci_dma(void); | |||
33 | extern void pmac_check_ht_link(void); | 33 | extern void pmac_check_ht_link(void); |
34 | 34 | ||
35 | extern void pmac_setup_smp(void); | 35 | extern void pmac_setup_smp(void); |
36 | extern void pmac32_cpu_die(void); | ||
37 | extern void low_cpu_die(void) __attribute__((noreturn)); | 36 | extern void low_cpu_die(void) __attribute__((noreturn)); |
38 | 37 | ||
39 | extern int pmac_nvram_init(void); | 38 | extern int pmac_nvram_init(void); |
diff --git a/arch/powerpc/platforms/powermac/setup.c b/arch/powerpc/platforms/powermac/setup.c index d5aceb7fb125..aa45281bd296 100644 --- a/arch/powerpc/platforms/powermac/setup.c +++ b/arch/powerpc/platforms/powermac/setup.c | |||
@@ -650,51 +650,6 @@ static int pmac_pci_probe_mode(struct pci_bus *bus) | |||
650 | return PCI_PROBE_NORMAL; | 650 | return PCI_PROBE_NORMAL; |
651 | return PCI_PROBE_DEVTREE; | 651 | return PCI_PROBE_DEVTREE; |
652 | } | 652 | } |
653 | |||
654 | #ifdef CONFIG_HOTPLUG_CPU | ||
655 | /* access per cpu vars from generic smp.c */ | ||
656 | DECLARE_PER_CPU(int, cpu_state); | ||
657 | |||
658 | static void pmac64_cpu_die(void) | ||
659 | { | ||
660 | /* | ||
661 | * turn off as much as possible, we'll be | ||
662 | * kicked out as this will only be invoked | ||
663 | * on core99 platforms for now ... | ||
664 | */ | ||
665 | |||
666 | printk(KERN_INFO "CPU#%d offline\n", smp_processor_id()); | ||
667 | __get_cpu_var(cpu_state) = CPU_DEAD; | ||
668 | smp_wmb(); | ||
669 | |||
670 | /* | ||
671 | * during the path that leads here preemption is disabled, | ||
672 | * reenable it now so that when coming up preempt count is | ||
673 | * zero correctly | ||
674 | */ | ||
675 | preempt_enable(); | ||
676 | |||
677 | /* | ||
678 | * hard-disable interrupts for the non-NAP case, the NAP code | ||
679 | * needs to re-enable interrupts (but soft-disables them) | ||
680 | */ | ||
681 | hard_irq_disable(); | ||
682 | |||
683 | while (1) { | ||
684 | /* let's not take timer interrupts too often ... */ | ||
685 | set_dec(0x7fffffff); | ||
686 | |||
687 | /* should always be true at this point */ | ||
688 | if (cpu_has_feature(CPU_FTR_CAN_NAP)) | ||
689 | power4_cpu_offline_powersave(); | ||
690 | else { | ||
691 | HMT_low(); | ||
692 | HMT_very_low(); | ||
693 | } | ||
694 | } | ||
695 | } | ||
696 | #endif /* CONFIG_HOTPLUG_CPU */ | ||
697 | |||
698 | #endif /* CONFIG_PPC64 */ | 653 | #endif /* CONFIG_PPC64 */ |
699 | 654 | ||
700 | define_machine(powermac) { | 655 | define_machine(powermac) { |
@@ -726,15 +681,4 @@ define_machine(powermac) { | |||
726 | .pcibios_after_init = pmac_pcibios_after_init, | 681 | .pcibios_after_init = pmac_pcibios_after_init, |
727 | .phys_mem_access_prot = pci_phys_mem_access_prot, | 682 | .phys_mem_access_prot = pci_phys_mem_access_prot, |
728 | #endif | 683 | #endif |
729 | #ifdef CONFIG_HOTPLUG_CPU | ||
730 | #ifdef CONFIG_PPC64 | ||
731 | .cpu_die = pmac64_cpu_die, | ||
732 | #endif | ||
733 | #ifdef CONFIG_PPC32 | ||
734 | .cpu_die = pmac32_cpu_die, | ||
735 | #endif | ||
736 | #endif | ||
737 | #if defined(CONFIG_HOTPLUG_CPU) && defined(CONFIG_PPC32) | ||
738 | .cpu_die = generic_mach_cpu_die, | ||
739 | #endif | ||
740 | }; | 684 | }; |
diff --git a/arch/powerpc/platforms/powermac/smp.c b/arch/powerpc/platforms/powermac/smp.c index eda470913291..50e15b43ffad 100644 --- a/arch/powerpc/platforms/powermac/smp.c +++ b/arch/powerpc/platforms/powermac/smp.c | |||
@@ -865,7 +865,7 @@ static void __devinit smp_core99_setup_cpu(int cpu_nr) | |||
865 | } | 865 | } |
866 | 866 | ||
867 | 867 | ||
868 | #if defined(CONFIG_HOTPLUG_CPU) && defined(CONFIG_PPC32) | 868 | #ifdef CONFIG_HOTPLUG_CPU |
869 | 869 | ||
870 | static int smp_core99_cpu_disable(void) | 870 | static int smp_core99_cpu_disable(void) |
871 | { | 871 | { |
@@ -878,7 +878,9 @@ static int smp_core99_cpu_disable(void) | |||
878 | return 0; | 878 | return 0; |
879 | } | 879 | } |
880 | 880 | ||
881 | void pmac32_cpu_die(void) | 881 | #ifdef CONFIG_PPC32 |
882 | |||
883 | static void pmac_cpu_die(void) | ||
882 | { | 884 | { |
883 | local_irq_disable(); | 885 | local_irq_disable(); |
884 | idle_task_exit(); | 886 | idle_task_exit(); |
@@ -889,7 +891,52 @@ void pmac32_cpu_die(void) | |||
889 | low_cpu_die(); | 891 | low_cpu_die(); |
890 | } | 892 | } |
891 | 893 | ||
892 | #endif /* CONFIG_HOTPLUG_CPU && CONFIG_PP32 */ | 894 | #else /* CONFIG_PPC32 */ |
895 | |||
896 | static void pmac_cpu_die(void) | ||
897 | { | ||
898 | local_irq_disable(); | ||
899 | idle_task_exit(); | ||
900 | |||
901 | /* | ||
902 | * turn off as much as possible, we'll be | ||
903 | * kicked out as this will only be invoked | ||
904 | * on core99 platforms for now ... | ||
905 | */ | ||
906 | |||
907 | printk(KERN_INFO "CPU#%d offline\n", smp_processor_id()); | ||
908 | __get_cpu_var(cpu_state) = CPU_DEAD; | ||
909 | smp_wmb(); | ||
910 | |||
911 | /* | ||
912 | * during the path that leads here preemption is disabled, | ||
913 | * reenable it now so that when coming up preempt count is | ||
914 | * zero correctly | ||
915 | */ | ||
916 | preempt_enable(); | ||
917 | |||
918 | /* | ||
919 | * hard-disable interrupts for the non-NAP case, the NAP code | ||
920 | * needs to re-enable interrupts (but soft-disables them) | ||
921 | */ | ||
922 | hard_irq_disable(); | ||
923 | |||
924 | while (1) { | ||
925 | /* let's not take timer interrupts too often ... */ | ||
926 | set_dec(0x7fffffff); | ||
927 | |||
928 | /* should always be true at this point */ | ||
929 | if (cpu_has_feature(CPU_FTR_CAN_NAP)) | ||
930 | power4_cpu_offline_powersave(); | ||
931 | else { | ||
932 | HMT_low(); | ||
933 | HMT_very_low(); | ||
934 | } | ||
935 | } | ||
936 | } | ||
937 | |||
938 | #endif /* else CONFIG_PPC32 */ | ||
939 | #endif /* CONFIG_HOTPLUG_CPU */ | ||
893 | 940 | ||
894 | /* Core99 Macs (dual G4s and G5s) */ | 941 | /* Core99 Macs (dual G4s and G5s) */ |
895 | struct smp_ops_t core99_smp_ops = { | 942 | struct smp_ops_t core99_smp_ops = { |
@@ -933,5 +980,10 @@ void __init pmac_setup_smp(void) | |||
933 | smp_ops = &psurge_smp_ops; | 980 | smp_ops = &psurge_smp_ops; |
934 | } | 981 | } |
935 | #endif /* CONFIG_PPC32 */ | 982 | #endif /* CONFIG_PPC32 */ |
983 | |||
984 | #ifdef CONFIG_HOTPLUG_CPU | ||
985 | ppc_md.cpu_die = pmac_cpu_die; | ||
986 | #endif | ||
936 | } | 987 | } |
937 | 988 | ||
989 | |||