* S4bios support
@ 2003-02-11 18:54 Pavel Machek
[not found] ` <20030211185406.GA25167-I/5MKhXcvmPrBKCeMvbIDA@public.gmane.org>
0 siblings, 1 reply; 5+ messages in thread
From: Pavel Machek @ 2003-02-11 18:54 UTC (permalink / raw)
To: Andrew Grover, ACPI mailing list, kernel list
Hi!
S4bios is easier to use [no possibility to boot into wrong kernel;
machine actually indicates it is sleeping, not powered down], has
nicer progress bars, etc... I'd like to see it in. Please apply,
Pavel
--- clean/arch/i386/kernel/acpi_wakeup.S 2003-02-11 17:40:33.000000000 +0100
+++ linux/arch/i386/kernel/acpi_wakeup.S 2003-02-11 12:51:03.000000000 +0100
@@ -314,6 +316,31 @@
pushl saved_context_eflags ; popfl
ret
+ENTRY(do_suspend_lowlevel_s4bios)
+ cmpl $0,4(%esp)
+ jne ret_point
+ call save_processor_state
+
+ movl %esp, saved_context_esp
+ movl %eax, saved_context_eax
+ movl %ebx, saved_context_ebx
+ movl %ecx, saved_context_ecx
+ movl %edx, saved_context_edx
+ movl %ebp, saved_context_ebp
+ movl %esi, saved_context_esi
+ movl %edi, saved_context_edi
+ pushfl ; popl saved_context_eflags
+
+ movl $ret_point,saved_eip
+ movl %esp,saved_esp
+ movl %ebp,saved_ebp
+ movl %ebx,saved_ebx
+ movl %edi,saved_edi
+ movl %esi,saved_esi
+
+ call acpi_enter_sleep_state_s4bios
+ ret
+
ALIGN
# saved registers
saved_gdt: .long 0,0
--- clean/drivers/acpi/acpi_ksyms.c 2003-02-11 17:40:46.000000000 +0100
+++ linux/drivers/acpi/acpi_ksyms.c 2003-02-11 17:51:05.000000000 +0100
@@ -86,6 +86,7 @@
EXPORT_SYMBOL(acpi_get_register);
EXPORT_SYMBOL(acpi_set_register);
EXPORT_SYMBOL(acpi_enter_sleep_state);
+EXPORT_SYMBOL(acpi_enter_sleep_state_s4bios);
EXPORT_SYMBOL(acpi_get_system_info);
EXPORT_SYMBOL(acpi_get_devices);
--- clean/drivers/acpi/hardware/hwsleep.c 2003-01-17 23:09:33.000000000 +0100
+++ linux/drivers/acpi/hardware/hwsleep.c 2003-02-10 18:17:00.000000000 +0100
@@ -316,6 +316,51 @@
return_ACPI_STATUS (AE_OK);
}
+
+/******************************************************************************
+ *
+ * FUNCTION: acpi_enter_sleep_state_s4bios
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Perform a s4 bios request.
+ * THIS FUNCTION MUST BE CALLED WITH INTERRUPTS DISABLED
+ *
+ ******************************************************************************/
+
+acpi_status
+acpi_enter_sleep_state_s4bios (
+ void)
+{
+ u32 in_value;
+ acpi_status status;
+
+
+ ACPI_FUNCTION_TRACE ("Acpi_enter_sleep_state_s4bios");
+
+ acpi_set_register (ACPI_BITREG_WAKE_STATUS, 1, ACPI_MTX_LOCK);
+ acpi_hw_clear_acpi_status();
+
+ acpi_hw_disable_non_wakeup_gpes();
+
+ ACPI_FLUSH_CPU_CACHE();
+
+ status = acpi_os_write_port (acpi_gbl_FADT->smi_cmd, (acpi_integer) acpi_gbl_FADT->S4bios_req, 8);
+
+ do {
+ acpi_os_stall(1000);
+ status = acpi_get_register (ACPI_BITREG_WAKE_STATUS, &in_value, ACPI_MTX_LOCK);
+ if (ACPI_FAILURE (status)) {
+ return_ACPI_STATUS (status);
+ }
+ } while (!in_value);
+
+ return_ACPI_STATUS (AE_OK);
+ }
+
+
/******************************************************************************
*
* FUNCTION: acpi_leave_sleep_state
--- clean/drivers/acpi/sleep.c 2003-01-05 22:58:25.000000000 +0100
+++ linux/drivers/acpi/sleep.c 2003-02-10 18:17:00.000000000 +0100
@@ -223,14 +224,20 @@
status = acpi_enter_sleep_state(state);
break;
- case ACPI_STATE_S2:
#ifdef CONFIG_SOFTWARE_SUSPEND
+ case ACPI_STATE_S2:
case ACPI_STATE_S3:
do_suspend_lowlevel(0);
+ break;
#endif
+ case ACPI_STATE_S4:
+ do_suspend_lowlevel_s4bios(0);
+ break;
+ default:
+ printk(KERN_WARNING PREFIX "don't know how to handle %d state.\n", state);
break;
}
local_irq_restore(flags);
return status;
}
@@ -251,10 +259,20 @@
if (state < ACPI_STATE_S1 || state > ACPI_STATE_S5)
return AE_ERROR;
+ /* Since we handle S4OS via a different path (swsusp), give up if no s4bios. */
+ if (state == ACPI_STATE_S4 && !acpi_gbl_FACS->S4bios_f)
+ return AE_ERROR;
+
+ /*
+ * TBD: S1 can be done without device_suspend. Make a CONFIG_XX
+ * to handle however when S1 failed without device_suspend.
+ */
freeze_processes(); /* device_suspend needs processes to be stopped */
/* do we have a wakeup address for S2 and S3? */
- if (state == ACPI_STATE_S2 || state == ACPI_STATE_S3) {
+ /* Here, we support only S4BIOS, those we set the wakeup address */
+ /* S4OS is only supported for now via swsusp.. */
+ if (state == ACPI_STATE_S2 || state == ACPI_STATE_S3 || ACPI_STATE_S4) {
if (!acpi_wakeup_address)
return AE_ERROR;
acpi_set_firmware_waking_vector((acpi_physical_address) acpi_wakeup_address);
@@ -297,8 +315,11 @@
ACPI_FUNCTION_TRACE("acpi_system_sleep_seq_show");
for (i = 0; i <= ACPI_STATE_S5; i++) {
- if (sleep_states[i])
+ if (sleep_states[i]) {
seq_printf(seq,"S%d ", i);
+ if (i == ACPI_STATE_S4 && acpi_gbl_FACS->S4bios_f)
+ seq_printf(seq, "S4bios ");
+ }
}
seq_puts(seq, "\n");
@@ -337,12 +358,16 @@
if (!sleep_states[state])
return_VALUE(-ENODEV);
+ if (state == 4 && state_string[1] != 'b') {
#ifdef CONFIG_SOFTWARE_SUSPEND
- if (state == 4) {
software_suspend();
return_VALUE(count);
- }
+#else
+ printk(KERN_WARNING PREFIX "no swsusp support!?\n");
+ printk(KERN_WARNING PREFIX "Trying S4bios instead\n");
#endif
+ }
+
status = acpi_suspend(state);
if (ACPI_FAILURE(status))
@@ -662,6 +687,10 @@
sleep_states[i] = 1;
printk(" S%d", i);
}
+ if (i == ACPI_STATE_S4 && acpi_gbl_FACS->S4bios_f) {
+ sleep_states[i] = 1;
+ printk(" S4bios");
+ }
}
printk(")\n");
--- clean/include/acpi/acpixf.h 2003-02-11 17:41:27.000000000 +0100
+++ linux/include/acpi/acpixf.h 2003-02-11 19:02:51.000000000 +0100
@@ -380,6 +380,10 @@
u8 sleep_state);
acpi_status
+acpi_enter_sleep_state_s4bios (
+ void);
+
+acpi_status
acpi_leave_sleep_state (
u8 sleep_state);
--- clean/include/linux/suspend.h 2003-01-05 22:58:44.000000000 +0100
+++ linux/include/linux/suspend.h 2003-02-10 18:17:01.000000000 +0100
@@ -73,6 +73,7 @@
/* Communication between acpi and arch/i386/suspend.c */
extern void do_suspend_lowlevel(int resume);
+extern void do_suspend_lowlevel_s4bios(int resume);
#else
static inline void software_suspend(void)
--
When do you have a heart between your knees?
[Johanka's followup: and *two* hearts?]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: S4bios support
[not found] ` <20030211185406.GA25167-I/5MKhXcvmPrBKCeMvbIDA@public.gmane.org>
@ 2003-02-13 15:14 ` Bjorn Wesen
[not found] ` <Pine.LNX.4.33.0302131611020.7941-100000-Hi2dXqvvzfEtpH44vsTDoQ@public.gmane.org>
0 siblings, 1 reply; 5+ messages in thread
From: Bjorn Wesen @ 2003-02-13 15:14 UTC (permalink / raw)
To: Pavel Machek; +Cc: ACPI mailing list
On Tue, 11 Feb 2003, Pavel Machek wrote:
> S4bios is easier to use [no possibility to boot into wrong kernel;
> machine actually indicates it is sleeping, not powered down], has
> nicer progress bars, etc... I'd like to see it in. Please apply,
May I ask what s4bios does compared to "just s4" ? Does the kernel still
dump its core to swap or what happens ?
(There really are no ACPI documentations anywhere right ? :)
/Bjorn
-------------------------------------------------------
This SF.NET email is sponsored by: FREE SSL Guide from Thawte
are you planning your Web Server Security? Click here to get a FREE
Thawte SSL guide and find the answers to all your SSL security issues.
http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0026en
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: S4bios support
[not found] ` <Pine.LNX.4.33.0302131611020.7941-100000-Hi2dXqvvzfEtpH44vsTDoQ@public.gmane.org>
@ 2003-02-13 15:30 ` Nils Faerber
[not found] ` <20030213163007.6fc31e08.nils-t93Ne7XHvje5bSeCtf/tX7NAH6kLmebB@public.gmane.org>
0 siblings, 1 reply; 5+ messages in thread
From: Nils Faerber @ 2003-02-13 15:30 UTC (permalink / raw)
To: Bjorn Wesen
Cc: pavel-+ZI9xUNit7I, acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
On Thu, 13 Feb 2003 16:14:10 +0100 (CET)
Bjorn Wesen <bjorn.wesen-VrBV9hrLPhE@public.gmane.org> wrote:
> On Tue, 11 Feb 2003, Pavel Machek wrote:
> > S4bios is easier to use [no possibility to boot into wrong kernel;
> > machine actually indicates it is sleeping, not powered down], has
> > nicer progress bars, etc... I'd like to see it in. Please apply,
> May I ask what s4bios does compared to "just s4" ? Does the kernel
> still dump its core to swap or what happens ?
S4BIOS toggles the BIOS implementation of suspend-to-disk without OS
interaction.
> (There really are no ACPI documentations anywhere right ? :)
Little, I am afraid.
> /Bjorn
CU
nils faerber
--
kernel concepts Tel: +49-271-771091-12
Dreisbachstr. 24 Fax: +49-271-771091-19
D-57250 Netphen D1 : +49-170-2729106
--
-------------------------------------------------------
This SF.NET email is sponsored by: FREE SSL Guide from Thawte
are you planning your Web Server Security? Click here to get a FREE
Thawte SSL guide and find the answers to all your SSL security issues.
http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0026en
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: S4bios support
[not found] ` <20030213163007.6fc31e08.nils-t93Ne7XHvje5bSeCtf/tX7NAH6kLmebB@public.gmane.org>
@ 2003-02-13 15:31 ` Bjorn Wesen
[not found] ` <Pine.LNX.4.33.0302131630010.7941-100000-Hi2dXqvvzfEtpH44vsTDoQ@public.gmane.org>
0 siblings, 1 reply; 5+ messages in thread
From: Bjorn Wesen @ 2003-02-13 15:31 UTC (permalink / raw)
To: Nils Faerber; +Cc: ACPI mailing list
On Thu, 13 Feb 2003, Nils Faerber wrote:
> > May I ask what s4bios does compared to "just s4" ? Does the kernel
> > still dump its core to swap or what happens ?
>
> S4BIOS toggles the BIOS implementation of suspend-to-disk without OS
> interaction.
I guessed that but how does the BIOS know where to suspend on the disk ?
Does the kernel tell it by giving the block ranges for the swap partition or
do you need to repartition the harddisk to contain some magic partitions ?
/Bjorn
-------------------------------------------------------
This SF.NET email is sponsored by: FREE SSL Guide from Thawte
are you planning your Web Server Security? Click here to get a FREE
Thawte SSL guide and find the answers to all your SSL security issues.
http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0026en
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: S4bios support
[not found] ` <Pine.LNX.4.33.0302131630010.7941-100000-Hi2dXqvvzfEtpH44vsTDoQ@public.gmane.org>
@ 2003-02-13 15:57 ` Faye Pearson
0 siblings, 0 replies; 5+ messages in thread
From: Faye Pearson @ 2003-02-13 15:57 UTC (permalink / raw)
To: Bjorn Wesen; +Cc: Nils Faerber, ACPI mailing list
Bjorn Wesen [bjorn.wesen-VrBV9hrLPhE@public.gmane.org] wrote:
> I guessed that but how does the BIOS know where to suspend on the disk ?
> Does the kernel tell it by giving the block ranges for the swap partition or
> do you need to repartition the harddisk to contain some magic partitions ?
You need to repartition to create a magic partition. If your laptop has
a phoenix bios then you set the partition type for the new partition to
IBM Hibernate Partition (can't remember the number, but it's in the
lphdisk manpage), make sure it's big enough for the amount of RAM you
have, format it with lphdisk and bingo (or that's the theory)
Faye
--
Faye Pearson,
Covert Development
ClaraNET Ltd. Tel 020 7903 3000
BOFH excuse #396:
Mail server hit by UniSpammer.
-------------------------------------------------------
This SF.NET email is sponsored by: FREE SSL Guide from Thawte
are you planning your Web Server Security? Click here to get a FREE
Thawte SSL guide and find the answers to all your SSL security issues.
http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0026en
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2003-02-13 15:57 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-02-11 18:54 S4bios support Pavel Machek
[not found] ` <20030211185406.GA25167-I/5MKhXcvmPrBKCeMvbIDA@public.gmane.org>
2003-02-13 15:14 ` Bjorn Wesen
[not found] ` <Pine.LNX.4.33.0302131611020.7941-100000-Hi2dXqvvzfEtpH44vsTDoQ@public.gmane.org>
2003-02-13 15:30 ` Nils Faerber
[not found] ` <20030213163007.6fc31e08.nils-t93Ne7XHvje5bSeCtf/tX7NAH6kLmebB@public.gmane.org>
2003-02-13 15:31 ` Bjorn Wesen
[not found] ` <Pine.LNX.4.33.0302131630010.7941-100000-Hi2dXqvvzfEtpH44vsTDoQ@public.gmane.org>
2003-02-13 15:57 ` Faye Pearson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox