blob: eae33e10b65fb4a1b8858872427ce16bbbf85634 [file] [log] [blame]
Johannes Bergbe9c94d2007-04-30 21:37:15 +10001/*
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>
Johannes Bergbe9c94d2007-04-30 21:37:15 +100013#include <asm/current.h>
14#include <asm/mmu_context.h>
David Howellsae3a1972012-03-28 18:30:02 +010015#include <asm/switch_to.h>
Johannes Bergbe9c94d2007-04-30 21:37:15 +100016
17void save_processor_state(void)
18{
19 /*
20 * flush out all the special registers so we don't need
21 * to save them in the snapshot
22 */
23 flush_fp_to_thread(current);
24 flush_altivec_to_thread(current);
25 flush_spe_to_thread(current);
Johannes Berg543b9fd2007-05-03 22:31:38 +100026
27#ifdef CONFIG_PPC64
28 hard_irq_disable();
29#endif
30
Johannes Bergbe9c94d2007-04-30 21:37:15 +100031}
32
33void restore_processor_state(void)
34{
35#ifdef CONFIG_PPC32
Tang Yuantian03305812011-08-16 19:51:33 +000036 switch_mmu_context(current->active_mm, current->active_mm);
Johannes Bergbe9c94d2007-04-30 21:37:15 +100037#endif
Johannes Bergbe9c94d2007-04-30 21:37:15 +100038}