| Johannes Berg | be9c94d | 2007-04-30 21:37:15 +1000 | [diff] [blame] | 1 | /* | 
 | 2 |  * Common powerpc suspend code for 32 and 64 bits | 
 | 3 |  * | 
 | 4 |  * Copyright 2007	Johannes Berg <johannes@sipsolutions.net> | 
 | 5 |  * | 
 | 6 |  * This program is free software; you can redistribute it and/or | 
 | 7 |  * modify it under the terms of the GNU General Public License | 
 | 8 |  * as published by the Free Software Foundation; either version | 
 | 9 |  * 2 of the License, or (at your option) any later version. | 
 | 10 |  */ | 
 | 11 |  | 
 | 12 | #include <linux/sched.h> | 
 | 13 | #include <asm/suspend.h> | 
 | 14 | #include <asm/system.h> | 
 | 15 | #include <asm/current.h> | 
 | 16 | #include <asm/mmu_context.h> | 
 | 17 |  | 
 | 18 | void save_processor_state(void) | 
 | 19 | { | 
 | 20 | 	/* | 
 | 21 | 	 * flush out all the special registers so we don't need | 
 | 22 | 	 * to save them in the snapshot | 
 | 23 | 	 */ | 
 | 24 | 	flush_fp_to_thread(current); | 
 | 25 | 	flush_altivec_to_thread(current); | 
 | 26 | 	flush_spe_to_thread(current); | 
| Johannes Berg | 543b9fd | 2007-05-03 22:31:38 +1000 | [diff] [blame] | 27 |  | 
 | 28 | #ifdef CONFIG_PPC64 | 
 | 29 | 	hard_irq_disable(); | 
 | 30 | #endif | 
 | 31 |  | 
| Johannes Berg | be9c94d | 2007-04-30 21:37:15 +1000 | [diff] [blame] | 32 | } | 
 | 33 |  | 
 | 34 | void restore_processor_state(void) | 
 | 35 | { | 
 | 36 | #ifdef CONFIG_PPC32 | 
| Benjamin Herrenschmidt | 5e69661 | 2008-12-18 19:13:24 +0000 | [diff] [blame] | 37 | 	switch_mmu_context(NULL, current->active_mm); | 
| Johannes Berg | be9c94d | 2007-04-30 21:37:15 +1000 | [diff] [blame] | 38 | #endif | 
| Johannes Berg | be9c94d | 2007-04-30 21:37:15 +1000 | [diff] [blame] | 39 | } |