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 ...@@ -944,10 +944,12 @@ CONFIG_DEBUG_OBSOLETE
Software Suspend Software Suspend
CONFIG_SOFTWARE_SUSPEND CONFIG_SOFTWARE_SUSPEND
Enable the possibilty of suspendig machine. It doesn't need APM. Enable the possibilty of suspendig machine. It doesn't need APM.
You may suspend your machine by either pressing Sysrq-d or with You may suspend your machine by 'swsusp' or 'shutdown -z <time>'
'swsusp' or 'shutdown -z <time>' (patch for sysvinit needed). It (patch for sysvinit needed).
creates an image which is saved in your active swaps. By the next
booting the kernel detects the saved image, restores the memory from 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. 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' 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 kernel option. However note that your partitions will be fsck'd and
......
...@@ -238,9 +238,21 @@ void mask_and_ack_8259A(unsigned int irq) ...@@ -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 = { static struct device device_i8259A = {
name: "i8259A", name: "i8259A",
bus_id: "0020", bus_id: "0020",
driver: &driver_i8259A,
}; };
static int __init init_8259A_devicefs(void) static int __init init_8259A_devicefs(void)
......
...@@ -4,9 +4,9 @@ ...@@ -4,9 +4,9 @@
* Distribute under GPLv2 * Distribute under GPLv2
* *
* Copyright (c) 2002 Pavel Machek <pavel@suse.cz> * 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/config.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/module.h> #include <linux/module.h>
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
#include <asm/acpi.h> #include <asm/acpi.h>
#include <asm/tlbflush.h> #include <asm/tlbflush.h>
static struct saved_context saved_context; static struct saved_context saved_context;
/* /*
...@@ -229,6 +228,7 @@ do_fpu_end(void) ...@@ -229,6 +228,7 @@ do_fpu_end(void)
kernel_fpu_end(); kernel_fpu_end();
} }
#ifdef CONFIG_SOFTWARE_SUSPEND
/* Local variables for do_magic */ /* Local variables for do_magic */
static int loop __nosavedata = 0; static int loop __nosavedata = 0;
static int loop2 __nosavedata = 0; static int loop2 __nosavedata = 0;
...@@ -300,3 +300,4 @@ void do_magic(int resume) ...@@ -300,3 +300,4 @@ void do_magic(int resume)
do_magic_resume_2(); do_magic_resume_2();
} }
#endif
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
*/ */
#define ACPI_C #define ACPI_C
#define HAVE_NEW_DEVICE_MODEL
#include <linux/config.h> #include <linux/config.h>
#include <linux/kernel.h> #include <linux/kernel.h>
...@@ -134,9 +135,11 @@ acpi_system_restore_state ( ...@@ -134,9 +135,11 @@ acpi_system_restore_state (
/* restore device context */ /* restore device context */
device_resume(RESUME_RESTORE_STATE); device_resume(RESUME_RESTORE_STATE);
#else
#error Resume cant work without driver model
#endif #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"); printk("Broken toshiba laptop -> kicking interrupts\n");
init_8259A(0); init_8259A(0);
} }
......
...@@ -317,22 +317,6 @@ static struct sysrq_key_op sysrq_kill_op = { ...@@ -317,22 +317,6 @@ static struct sysrq_key_op sysrq_kill_op = {
action_msg: "Kill All Tasks", 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 */ /* END SIGNAL SYSRQ HANDLERS BLOCK */
...@@ -355,11 +339,7 @@ static struct sysrq_key_op *sysrq_key_table[SYSRQ_KEY_TABLE_LENGTH] = { ...@@ -355,11 +339,7 @@ static struct sysrq_key_op *sysrq_key_table[SYSRQ_KEY_TABLE_LENGTH] = {
and will never arive */ and will never arive */
/* b */ &sysrq_reboot_op, /* b */ &sysrq_reboot_op,
/* c */ NULL, /* c */ NULL,
#ifdef CONFIG_SOFTWARE_SUSPEND
/* d */ &sysrq_swsusp_op,
#else
/* d */ NULL, /* d */ NULL,
#endif
/* e */ &sysrq_term_op, /* e */ &sysrq_term_op,
/* f */ NULL, /* f */ NULL,
/* g */ NULL, /* g */ NULL,
......
#ifndef _LINUX_SWSUSP_H #ifndef _LINUX_SWSUSP_H
#define _LINUX_SWSUSP_H #define _LINUX_SWSUSP_H
#if defined(SUSPEND_C) || defined(ACPI_C) #ifdef CONFIG_X86
#include <asm/suspend.h> #include <asm/suspend.h>
#endif #endif
#include <linux/swap.h> #include <linux/swap.h>
......
...@@ -44,7 +44,6 @@ ...@@ -44,7 +44,6 @@
#include <linux/version.h> #include <linux/version.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/reboot.h> #include <linux/reboot.h>
#include <linux/init.h>
#include <linux/vt_kern.h> #include <linux/vt_kern.h>
#include <linux/bitops.h> #include <linux/bitops.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
...@@ -846,9 +845,6 @@ void do_magic_suspend_2(void) ...@@ -846,9 +845,6 @@ void do_magic_suspend_2(void)
printk(KERN_WARNING "%sLeaving do_magic_suspend_2...\n", name_suspend); 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 * 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 * 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