From: Pavel Machek <pavel-+ZI9xUNit7I@public.gmane.org>
To: Andrew Grover
<andrew.grover-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
ACPI mailing list
<acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>,
kernel list
<linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: S4bios support for 2.5.63
Date: Wed, 26 Feb 2003 22:13:47 +0100 [thread overview]
Message-ID: <20030226211347.GA14903@elf.ucw.cz> (raw)
Hi!
This is S4bios support for 2.5.63. I'd like to see it in since it is
easier to understand and more foolproof. Please apply,
Pavel
--- clean/arch/i386/kernel/acpi/wakeup.S 2003-02-25 21:13:49.000000000 +0100
+++ linux/arch/i386/kernel/acpi/wakeup.S 2003-02-18 00:58:24.000000000 +0100
@@ -319,6 +319,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-25 21:17:31.000000000 +0100
+++ linux/drivers/acpi/acpi_ksyms.c 2003-02-15 18:52:15.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-02-25 21:17:34.000000000 +0100
+++ linux/drivers/acpi/hardware/hwsleep.c 2003-02-24 22:36:23.000000000 +0100
@@ -335,6 +335,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/main.c 2003-02-25 21:17:36.000000000 +0100
+++ linux/drivers/acpi/sleep/main.c 2003-02-18 22:36:39.000000000 +0100
@@ -183,14 +180,21 @@
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);
+ printk(KERN_CRIT "Back to C!\n");
return status;
}
@@ -211,10 +215,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);
@@ -268,6 +282,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/drivers/acpi/sleep/proc.c 2003-02-25 21:17:37.000000000 +0100
+++ linux/drivers/acpi/sleep/proc.c 2003-02-15 18:57:55.000000000 +0100
@@ -27,8 +27,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");
--- clean/include/acpi/acpixf.h 2003-02-25 21:20:49.000000000 +0100
+++ linux/include/acpi/acpixf.h 2003-02-24 22:36:42.000000000 +0100
@@ -399,6 +399,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-02-25 21:22:36.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?]
next reply other threads:[~2003-02-26 21:13 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-02-26 21:13 Pavel Machek [this message]
[not found] ` <20030226211347.GA14903-I/5MKhXcvmPrBKCeMvbIDA@public.gmane.org>
2003-02-27 14:13 ` [ACPI] S4bios support for 2.5.63 Ducrot Bruno
[not found] ` <20030227141322.GV13404-j6u/t2rXLliUoIHC/UFpr9i2O/JbrIOy@public.gmane.org>
2003-03-04 13:23 ` Pavel Machek
[not found] ` <20030304132329.GF618-VNkyu7EogrqGmfs5Z0+9fw@public.gmane.org>
2003-03-04 12:00 ` Ducrot Bruno
2003-03-02 13:31 ` bert hubert
[not found] ` <20030302133138.GA27031-Q4cIvbmc/GjIwqSPmO0L4w@public.gmane.org>
2003-03-02 18:44 ` Nigel Cunningham
[not found] ` <1046630641.3610.13.camel-udXHSmD1qAz9bBlWBkG5g4WQyAnV0byH@public.gmane.org>
2003-03-02 20:21 ` bert hubert
[not found] ` <20030302202118.GA2201-Q4cIvbmc/GjIwqSPmO0L4w@public.gmane.org>
2003-03-02 22:22 ` Alan Cox
[not found] ` <1046643757.3700.20.camel-MMxVpc8zpTQVh3rx8e9g/fyykp6/JSeS3vcXtXqGYxw@public.gmane.org>
2003-03-03 7:42 ` Chris Bennett
2003-03-03 0:39 ` Roger Luethi
[not found] ` <20030303003940.GA13036-NW/W/tFpkLjPJA67Yv3YjA@public.gmane.org>
2003-03-03 2:08 ` [ACPI] " Nigel Cunningham
[not found] ` <1046657290.8668.33.camel-udXHSmD1qAz9bBlWBkG5g4WQyAnV0byH@public.gmane.org>
2003-03-03 11:31 ` bert hubert
[not found] ` <20030303113153.GA18563-Q4cIvbmc/GjIwqSPmO0L4w@public.gmane.org>
2003-03-03 12:17 ` Roger Luethi
2003-03-03 12:23 ` Pavel Machek
[not found] ` <20030303122325.GA20929-jyMamyUUXNJG4ohzP4jBZS1Fcj925eT/@public.gmane.org>
2003-03-03 12:35 ` bert hubert
[not found] ` <20030303123551.GA19859-Q4cIvbmc/GjIwqSPmO0L4w@public.gmane.org>
2003-03-03 12:41 ` Pavel Machek
[not found] ` <20030303124133.GH20929-jyMamyUUXNJG4ohzP4jBZS1Fcj925eT/@public.gmane.org>
2003-03-03 14:07 ` Troels Haugboelle
2003-03-03 15:11 ` [ACPI] " bert hubert
[not found] ` <20030303151135.GA24815-Q4cIvbmc/GjIwqSPmO0L4w@public.gmane.org>
2003-03-03 16:40 ` Alan Cox
2003-03-03 16:23 ` P. Christeas
2003-03-03 16:28 ` bert hubert
2003-03-03 14:25 ` Alan Cox
2003-03-03 12:37 ` Roger Luethi
2003-03-03 14:09 ` Alan Cox
[not found] ` <1046700547.5890.24.camel-MMxVpc8zpTQVh3rx8e9g/fyykp6/JSeS3vcXtXqGYxw@public.gmane.org>
2003-03-03 14:37 ` [ACPI] " Ducrot Bruno
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=20030226211347.GA14903@elf.ucw.cz \
--to=pavel-+zi9xunit7i@public.gmane.org \
--cc=acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
--cc=andrew.grover-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
/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