From: Pavel Machek <pavel@ucw.cz>
To: Patrick Mochel <mochel@osdl.org>,
torvalds@transmeta.com,
kernel list <linux-kernel@vger.kernel.org>,
ACPI mailing list <acpi-devel@lists.sourceforge.net>
Subject: Fixes to suspend-to-RAM
Date: Tue, 18 Feb 2003 22:17:41 +0100 [thread overview]
Message-ID: <20030218211741.GA1039@elf.ucw.cz> (raw)
Hi!
Clean up comments in sleep.c and make code robust against
out-of-memory. In wakeup.S, reload segment registers: bios might have
changed them. In main.c -- we really need to disable devices before
going to sleep -- its critical for APIC (driver model for that will be
supplied later). Please apply,
Pavel
--- clean/arch/i386/kernel/acpi/sleep.c 2003-02-15 18:51:10.000000000 +0100
+++ linux/arch/i386/kernel/acpi/sleep.c 2003-02-15 19:00:15.000000000 +0100
@@ -2,6 +2,7 @@
* sleep.c - x86-specific ACPI sleep support.
*
* Copyright (C) 2001-2003 Patrick Mochel
+ * Copyright (C) 2001-2003 Pavel Machek <pavel@suse.cz>
*/
#include <linux/acpi.h>
@@ -38,6 +39,8 @@
panic("S3 and PAE do not like each other for now.");
return 1;
#endif
+ if (!acpi_wakeup_address)
+ return 1;
init_low_mapping(swapper_pg_dir, USER_PTRS_PER_PGD);
memcpy((void *) acpi_wakeup_address, &wakeup_start, &wakeup_end - &wakeup_start);
acpi_copy_wakeup_routine(acpi_wakeup_address);
@@ -65,17 +68,18 @@
/**
* acpi_reserve_bootmem - do _very_ early ACPI initialisation
*
- * We allocate a page in low memory for the wakeup
+ * We allocate a page from the first 1MB of memory for the wakeup
* routine for when we come back from a sleep state. The
- * runtime allocator allows specification of <16M pages, but not
- * <1M pages.
+ * runtime allocator allows specification of <16MB pages, but not
+ * <1MB pages.
*/
void __init acpi_reserve_bootmem(void)
{
acpi_wakeup_address = (unsigned long)alloc_bootmem_low(PAGE_SIZE);
+ if (!acpi_wakeup_address)
+ printk(KERN_ERR "ACPI: Cannot allocate lowmem. S3 disabled.\n");
if ((&wakeup_end - &wakeup_start) > PAGE_SIZE)
printk(KERN_CRIT "ACPI: Wakeup code way too big, will crash on attempt to suspend\n");
- printk(KERN_DEBUG "ACPI: have wakeup address 0x%8.8lx\n", acpi_wakeup_address);
}
static int __init acpi_sleep_setup(char *str)
--- clean/arch/i386/kernel/acpi/wakeup.S 2003-02-15 18:51:10.000000000 +0100
+++ linux/arch/i386/kernel/acpi/wakeup.S 2003-02-18 00:58:24.000000000 +0100
@@ -44,6 +44,9 @@
testl $1, video_flags - wakeup_code
jz 1f
lcall $0xc000,$3
+ movw %cs, %ax
+ movw %ax, %ds # Bios might have played with that
+ movw %ax, %ss
1:
testl $2, video_flags - wakeup_code
--- clean/drivers/acpi/sleep/main.c 2003-02-15 18:51:17.000000000 +0100
+++ linux/drivers/acpi/sleep/main.c 2003-02-15 18:57:27.000000000 +0100
@@ -103,6 +103,10 @@
return error;
}
+ error = device_suspend(state, SUSPEND_DISABLE);
+ if (error)
+ panic("Sorry, devices really should know how to disable\n");
+
/* flush caches */
ACPI_FLUSH_CPU_CACHE();
--
When do you have a heart between your knees?
[Johanka's followup: and *two* hearts?]
next reply other threads:[~2003-02-18 21:08 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-02-18 21:17 Pavel Machek [this message]
2003-02-18 21:14 ` Patrick Mochel
2003-02-18 21:43 ` Pavel Machek
2003-02-18 21:41 ` Patrick Mochel
2003-02-18 22:07 ` Pavel Machek
2003-02-18 22:00 ` Patrick Mochel
2003-02-18 22:31 ` Pavel Machek
2003-02-18 23:08 ` [ACPI] " Benjamin Herrenschmidt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20030218211741.GA1039@elf.ucw.cz \
--to=pavel@ucw.cz \
--cc=acpi-devel@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
--cc=mochel@osdl.org \
--cc=torvalds@transmeta.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®