Commit ef8e826c authored by Pavel Machek's avatar Pavel Machek Committed by Linus Torvalds

[PATCH] suspend-to-{ram/disk} cleanups/fixes for 2.5.21

This kills Sysrq-D support (did not work anyway, and complicated
code).

Adds resume support to i8259A (otherwise interrupts will not work
after S3).

HAVE_NEW_DEVICE_MODEL is always true in 2.5, so we should define
it. S3 can't work properly without that. Also limit toshiba workaround
to S1. (This hide lack of i8259A support for me).

Fixes compilation, and kills <asm/suspend.h> being included
twice with ugly hacks around.
parent 3f52c652
......@@ -944,10 +944,12 @@ CONFIG_DEBUG_OBSOLETE
Software Suspend
CONFIG_SOFTWARE_SUSPEND
Enable the possibilty of suspendig machine. It doesn't need APM.
You may suspend your machine by either pressing Sysrq-d or with
'swsusp' or 'shutdown -z <time>' (patch for sysvinit needed). It
creates an image which is saved in your active swaps. By the next
booting the kernel detects the saved image, restores the memory from
You may suspend your machine by 'swsusp' or 'shutdown -z <time>'
(patch for sysvinit needed).
It creates an image which is saved in your active swaps. By the next
booting the, pass 'resume=/path/to/your/swap/file' and kernel will
detect the saved image, restore the memory from
it and then it continues to run as before you've suspended.
If you don't want the previous state to continue use the 'noresume'
kernel option. However note that your partitions will be fsck'd and
......
......@@ -238,9 +238,21 @@ void mask_and_ack_8259A(unsigned int irq)
}
}
static int i8259A_resume(struct device *dev, u32 level)
{
if (level == RESUME_POWER_ON)
init_8259A(0);
return 0;
}
static struct device_driver driver_i8259A = {
resume: i8259A_resume,
};
static struct device device_i8259A = {
name: "i8259A",
bus_id: "0020",
driver: &driver_i8259A,
};
static int __init init_8259A_devicefs(void)
......
......@@ -4,9 +4,9 @@
* Distribute under GPLv2
*
* Copyright (c) 2002 Pavel Machek <pavel@suse.cz>
* Copyright (c) 2001 Patrick Mochel <mochel@osdl.org>
*/
#define ACPI_C
#include <linux/config.h>
#include <linux/kernel.h>
#include <linux/module.h>
......@@ -26,7 +26,6 @@
#include <asm/acpi.h>
#include <asm/tlbflush.h>
static struct saved_context saved_context;
/*
......@@ -229,6 +228,7 @@ do_fpu_end(void)
kernel_fpu_end();
}
#ifdef CONFIG_SOFTWARE_SUSPEND
/* Local variables for do_magic */
static int loop __nosavedata = 0;
static int loop2 __nosavedata = 0;
......@@ -300,3 +300,4 @@ void do_magic(int resume)
do_magic_resume_2();
}
#endif
......@@ -24,6 +24,7 @@
*/
#define ACPI_C
#define HAVE_NEW_DEVICE_MODEL
#include <linux/config.h>
#include <linux/kernel.h>
......@@ -134,9 +135,11 @@ acpi_system_restore_state (
/* restore device context */
device_resume(RESUME_RESTORE_STATE);
#else
#error Resume cant work without driver model
#endif
if (dmi_broken & BROKEN_INIT_AFTER_S1) {
if ((state == ACPI_STATE_S1) && (dmi_broken & BROKEN_INIT_AFTER_S1)) {
printk("Broken toshiba laptop -> kicking interrupts\n");
init_8259A(0);
}
......
......@@ -317,22 +317,6 @@ static struct sysrq_key_op sysrq_kill_op = {
action_msg: "Kill All Tasks",
};
#ifdef CONFIG_SOFTWARE_SUSPEND
static void sysrq_handle_swsusp(int key, struct pt_regs *pt_regs,
struct kbd_struct *kbd, struct tty_struct *tty) {
if(!software_suspend_enabled) {
printk("Software Suspend is not possible now\n");
return;
}
software_suspend();
}
static struct sysrq_key_op sysrq_swsusp_op = {
handler: sysrq_handle_swsusp,
help_msg: "suspenD",
action_msg: "Software suspend\n",
};
#endif
/* END SIGNAL SYSRQ HANDLERS BLOCK */
......@@ -355,11 +339,7 @@ static struct sysrq_key_op *sysrq_key_table[SYSRQ_KEY_TABLE_LENGTH] = {
and will never arive */
/* b */ &sysrq_reboot_op,
/* c */ NULL,
#ifdef CONFIG_SOFTWARE_SUSPEND
/* d */ &sysrq_swsusp_op,
#else
/* d */ NULL,
#endif
/* e */ &sysrq_term_op,
/* f */ NULL,
/* g */ NULL,
......
#ifndef _LINUX_SWSUSP_H
#define _LINUX_SWSUSP_H
#if defined(SUSPEND_C) || defined(ACPI_C)
#ifdef CONFIG_X86
#include <asm/suspend.h>
#endif
#include <linux/swap.h>
......
......@@ -44,7 +44,6 @@
#include <linux/version.h>
#include <linux/delay.h>
#include <linux/reboot.h>
#include <linux/init.h>
#include <linux/vt_kern.h>
#include <linux/bitops.h>
#include <linux/interrupt.h>
......@@ -846,9 +845,6 @@ void do_magic_suspend_2(void)
printk(KERN_WARNING "%sLeaving do_magic_suspend_2...\n", name_suspend);
}
#define SUSPEND_C
#include <asm/suspend.h>
/*
* We try to swap out as much as we can then make a copy of the
* occupied pages in memory so we can make a copy of kernel state
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment