Skip to contentSkip to conversation

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

PATCH Pavel Machek 1 participant 1 message Jan 20, 2003

lore
Share & tools
lore
#0 lore raw

Hi!

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

arch/i386/kernel/acpi.c +17 -0
@@ -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*/
arch/i386/kernel/acpi_wakeup.S +10 -8
@@ -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
Signature · 2 lines
Worst form of spam? Adding advertisment signatures ala sourceforge.net.
What goes next? Inserting advertisment *into* email?