Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 55002
b: refs/heads/master
c: be9c94d
h: refs/heads/master
v: v3
  • Loading branch information
Johannes Berg authored and Paul Mackerras committed May 2, 2007
1 parent 195d00d commit ed9ece3
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 66 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: f88df14b1f15cdeffa060580a40c1ce3e13bb79e
refs/heads/master: be9c94dd7776467813419f49fabe8017bc2d4c81
1 change: 1 addition & 0 deletions trunk/arch/powerpc/kernel/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ obj-$(CONFIG_GENERIC_TBSYNC) += smp-tbsync.o
obj-$(CONFIG_CRASH_DUMP) += crash_dump.o
obj-$(CONFIG_6xx) += idle_6xx.o l2cr_6xx.o cpu_setup_6xx.o
obj-$(CONFIG_TAU) += tau_6xx.o
obj-$(CONFIG_SOFTWARE_SUSPEND) += swsusp.o
obj32-$(CONFIG_SOFTWARE_SUSPEND) += swsusp_32.o
obj32-$(CONFIG_MODULES) += module_32.o

Expand Down
34 changes: 34 additions & 0 deletions trunk/arch/powerpc/kernel/swsusp.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* Common powerpc suspend code for 32 and 64 bits
*
* Copyright 2007 Johannes Berg <johannes@sipsolutions.net>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*/

#include <linux/sched.h>
#include <asm/suspend.h>
#include <asm/system.h>
#include <asm/current.h>
#include <asm/mmu_context.h>

void save_processor_state(void)
{
/*
* flush out all the special registers so we don't need
* to save them in the snapshot
*/
flush_fp_to_thread(current);
flush_altivec_to_thread(current);
flush_spe_to_thread(current);
}

void restore_processor_state(void)
{
#ifdef CONFIG_PPC32
set_context(current->active_mm->context.id, current->active_mm->pgd);
#endif
}
65 changes: 0 additions & 65 deletions trunk/arch/powerpc/platforms/powermac/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -439,76 +439,11 @@ static void __init find_boot_device(void)
#endif
}

/* TODO: Merge the suspend-to-ram with the common code !!!
* currently, this is a stub implementation for suspend-to-disk
* only
*/

#ifdef CONFIG_SOFTWARE_SUSPEND

static int pmac_pm_prepare(suspend_state_t state)
{
printk(KERN_DEBUG "%s(%d)\n", __FUNCTION__, state);

return 0;
}

static int pmac_pm_enter(suspend_state_t state)
{
printk(KERN_DEBUG "%s(%d)\n", __FUNCTION__, state);

/* Giveup the lazy FPU & vec so we don't have to back them
* up from the low level code
*/
enable_kernel_fp();

#ifdef CONFIG_ALTIVEC
if (cur_cpu_spec->cpu_features & CPU_FTR_ALTIVEC)
enable_kernel_altivec();
#endif /* CONFIG_ALTIVEC */

return 0;
}

static int pmac_pm_finish(suspend_state_t state)
{
printk(KERN_DEBUG "%s(%d)\n", __FUNCTION__, state);

/* Restore userland MMU context */
set_context(current->active_mm->context.id, current->active_mm->pgd);

return 0;
}

static int pmac_pm_valid(suspend_state_t state)
{
switch (state) {
case PM_SUSPEND_DISK:
return 1;
/* can't do any other states via generic mechanism yet */
default:
return 0;
}
}

static struct pm_ops pmac_pm_ops = {
.pm_disk_mode = PM_DISK_SHUTDOWN,
.prepare = pmac_pm_prepare,
.enter = pmac_pm_enter,
.finish = pmac_pm_finish,
.valid = pmac_pm_valid,
};

#endif /* CONFIG_SOFTWARE_SUSPEND */

static int initializing = 1;

static int pmac_late_init(void)
{
initializing = 0;
#ifdef CONFIG_SOFTWARE_SUSPEND
pm_set_ops(&pmac_pm_ops);
#endif /* CONFIG_SOFTWARE_SUSPEND */
return 0;
}

Expand Down
9 changes: 9 additions & 0 deletions trunk/include/asm-powerpc/suspend.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#ifndef __ASM_POWERPC_SUSPEND_H
#define __ASM_POWERPC_SUSPEND_H

static inline int arch_prepare_suspend(void) { return 0; }

void save_processor_state(void);
void restore_processor_state(void);

#endif /* __ASM_POWERPC_SUSPEND_H */

0 comments on commit ed9ece3

Please sign in to comment.