swsusp.c 650 B

123456789101112131415161718192021222324252627282930313233
  1. // SPDX-License-Identifier: GPL-2.0-or-later
  2. /*
  3. * Common powerpc suspend code for 32 and 64 bits
  4. *
  5. * Copyright 2007 Johannes Berg <johannes@sipsolutions.net>
  6. */
  7. #include <linux/sched.h>
  8. #include <linux/suspend.h>
  9. #include <asm/current.h>
  10. #include <asm/mmu_context.h>
  11. #include <asm/switch_to.h>
  12. void save_processor_state(void)
  13. {
  14. /*
  15. * flush out all the special registers so we don't need
  16. * to save them in the snapshot
  17. */
  18. flush_all_to_thread(current);
  19. #ifdef CONFIG_PPC64
  20. hard_irq_disable();
  21. #endif
  22. }
  23. void restore_processor_state(void)
  24. {
  25. #ifdef CONFIG_PPC32
  26. switch_mmu_context(current->active_mm, current->active_mm, NULL);
  27. #endif
  28. }