blob: 0050b2d2ff7ad004f7192f782615eb1ef5678562 [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>
Tobin C. Harding1fc439c2017-03-06 19:25:31 +110013#include <linux/suspend.h>
Johannes Bergbe9c94d2007-04-30 21:37:15 +100014#include <asm/current.h>
15#include <asm/mmu_context.h>
David Howellsae3a1972012-03-28 18:30:02 +010016#include <asm/switch_to.h>
Johannes Bergbe9c94d2007-04-30 21:37:15 +100017
18void 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 */
Anton Blanchard579e6332015-10-29 11:44:09 +110024 flush_all_to_thread(current);
Johannes Berg543b9fd2007-05-03 22:31:38 +100025
26#ifdef CONFIG_PPC64
27 hard_irq_disable();
28#endif
29
Johannes Bergbe9c94d2007-04-30 21:37:15 +100030}
31
32void restore_processor_state(void)
33{
34#ifdef CONFIG_PPC32
Aneesh Kumar K.Vd2adba32016-04-29 23:26:01 +100035 switch_mmu_context(current->active_mm, current->active_mm, NULL);
Johannes Bergbe9c94d2007-04-30 21:37:15 +100036#endif
Johannes Bergbe9c94d2007-04-30 21:37:15 +100037}