Make restoring of graphics state on S3 resume run-time settable

Pavel Machek (pavel@ucw.cz)
Sun, 19 Jan 2003 22:40:48 +0100


Hi!

This makes it possible to select method of bios restoring after S3
resume. [=> no more ugly ifdefs]. Please apply,
Pavel

--- clean/arch/i386/kernel/acpi.c 2003-01-17 23:13:33.000000000 +0100
+++ linux-swsusp/arch/i386/kernel/acpi.c 2003-01-19 19:10:48.000000000 +0100
@@ -454,6 +454,7 @@

/* address in low memory of the wakeup routine. */
unsigned long acpi_wakeup_address = 0;
+unsigned long acpi_video_flags;
extern char wakeup_start, wakeup_end;

extern unsigned long FASTCALL(acpi_copy_wakeup_routine(unsigned long));
@@ -520,4 +547,20 @@
printk(KERN_DEBUG "ACPI: have wakeup address 0x%8.8lx\n", acpi_wakeup_address);
}

+static int __init acpi_sleep_setup(char *str)
+{
+ while ((str != NULL) && (*str != '\0')) {
+ if (strncmp(str, "s3_bios", 7) == 0)
+ acpi_video_flags = 1;
+ if (strncmp(str, "s3_mode", 7) == 0)
+ acpi_video_flags |= 2;
+ str = strchr(str, ',');
+ if (str != NULL)
+ str += strspn(str, ", \t");
+ }
+ return 1;
+}
+
+
+__setup("acpi_sleep=", acpi_sleep_setup);
#endif /*CONFIG_ACPI_SLEEP*/
--- clean/arch/i386/kernel/acpi_wakeup.S 2002-12-18 22:20:47.000000000 +0100
+++ linux-swsusp/arch/i386/kernel/acpi_wakeup.S 2003-01-19 17:39:21.000000000 +0100
@@ -41,20 +41,19 @@
cmpl $0x12345678, %eax
jne bogus_real_magic

-#if 1
+ testl $1, video_flags - wakeup_code
+ jz 1f
lcall $0xc000,$3
-#endif
-#if 0
+1:
+
+ testl $2, video_flags - wakeup_code
+ jz 1f
mov video_mode - wakeup_code, %ax
call mode_set
-#endif
+1:

# set up page table
-#if 1
movl $swapper_pg_dir-__PAGE_OFFSET, %eax
-#else
- movl (real_save_cr3 - wakeup_data), %eax
-#endif
movl %eax, %cr3

# make sure %cr4 is set correctly (features, etc)
@@ -86,6 +85,7 @@
real_save_cr4: .long 0
real_magic: .long 0
video_mode: .long 0
+video_flags: .long 0

bogus_real_magic:
movw $0x0e00 + 'B', %fs:(0x12)
@@ -254,6 +254,8 @@

movl saved_videomode, %edx
movl %edx, video_mode - wakeup_start (%eax)
+ movl acpi_video_flags, %edx
+ movl %edx, video_flags - wakeup_start (%eax)
movl $0x12345678, real_magic - wakeup_start (%eax)
movl $0x12345678, saved_magic
ret

-- 
Worst form of spam? Adding advertisment signatures ala sourceforge.net.
What goes next? Inserting advertisment *into* email?
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/