2019-05-27 13:55:01 +07:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2007-04-30 18:37:15 +07:00
|
|
|
/*
|
|
|
|
* Common powerpc suspend code for 32 and 64 bits
|
|
|
|
*
|
|
|
|
* Copyright 2007 Johannes Berg <johannes@sipsolutions.net>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/sched.h>
|
2017-03-06 15:25:31 +07:00
|
|
|
#include <linux/suspend.h>
|
2007-04-30 18:37:15 +07:00
|
|
|
#include <asm/current.h>
|
|
|
|
#include <asm/mmu_context.h>
|
2012-03-29 00:30:02 +07:00
|
|
|
#include <asm/switch_to.h>
|
2007-04-30 18:37:15 +07:00
|
|
|
|
|
|
|
void save_processor_state(void)
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* flush out all the special registers so we don't need
|
|
|
|
* to save them in the snapshot
|
|
|
|
*/
|
2015-10-29 07:44:09 +07:00
|
|
|
flush_all_to_thread(current);
|
2007-05-03 19:31:38 +07:00
|
|
|
|
|
|
|
#ifdef CONFIG_PPC64
|
|
|
|
hard_irq_disable();
|
|
|
|
#endif
|
|
|
|
|
2007-04-30 18:37:15 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
void restore_processor_state(void)
|
|
|
|
{
|
|
|
|
#ifdef CONFIG_PPC32
|
2016-04-29 20:26:01 +07:00
|
|
|
switch_mmu_context(current->active_mm, current->active_mm, NULL);
|
2007-04-30 18:37:15 +07:00
|
|
|
#endif
|
|
|
|
}
|