diff options
author | Pavel Machek <pavel@suse.cz> | 2007-07-19 04:47:41 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-07-19 13:04:43 -0400 |
commit | 77afcf78a2ded9a91838734234949c0ead5feb12 (patch) | |
tree | 76922017855c70d550b40241f8a144f6c098cd04 | |
parent | 5a60d6235c8352ade8f2699e72fcdfe853730456 (diff) |
PM: Integrate beeping flag with existing acpi_sleep flags
Move "debug during resume from s2ram" into the variable we already use
for real-mode flags to simplify code. It also closes nasty trap for
the user in acpi_sleep_setup; order of parameters actually mattered there,
acpi_sleep=s3_bios,s3_mode doing something different from
acpi_sleep=s3_mode,s3_bios.
Signed-off-by: Pavel Machek <pavel@suse.cz>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | arch/i386/kernel/acpi/sleep.c | 12 | ||||
-rw-r--r-- | arch/i386/kernel/acpi/wakeup.S | 18 | ||||
-rw-r--r-- | arch/x86_64/kernel/acpi/sleep.c | 8 | ||||
-rw-r--r-- | arch/x86_64/kernel/acpi/wakeup.S | 15 | ||||
-rw-r--r-- | include/linux/acpi.h | 3 | ||||
-rw-r--r-- | kernel/power/main.c | 23 | ||||
-rw-r--r-- | kernel/sysctl.c | 2 |
7 files changed, 29 insertions, 52 deletions
diff --git a/arch/i386/kernel/acpi/sleep.c b/arch/i386/kernel/acpi/sleep.c index 4ee83577bf61..c42b5ab49deb 100644 --- a/arch/i386/kernel/acpi/sleep.c +++ b/arch/i386/kernel/acpi/sleep.c | |||
@@ -14,7 +14,7 @@ | |||
14 | 14 | ||
15 | /* address in low memory of the wakeup routine. */ | 15 | /* address in low memory of the wakeup routine. */ |
16 | unsigned long acpi_wakeup_address = 0; | 16 | unsigned long acpi_wakeup_address = 0; |
17 | unsigned long acpi_video_flags; | 17 | unsigned long acpi_realmode_flags; |
18 | extern char wakeup_start, wakeup_end; | 18 | extern char wakeup_start, wakeup_end; |
19 | 19 | ||
20 | extern unsigned long FASTCALL(acpi_copy_wakeup_routine(unsigned long)); | 20 | extern unsigned long FASTCALL(acpi_copy_wakeup_routine(unsigned long)); |
@@ -68,9 +68,11 @@ static int __init acpi_sleep_setup(char *str) | |||
68 | { | 68 | { |
69 | while ((str != NULL) && (*str != '\0')) { | 69 | while ((str != NULL) && (*str != '\0')) { |
70 | if (strncmp(str, "s3_bios", 7) == 0) | 70 | if (strncmp(str, "s3_bios", 7) == 0) |
71 | acpi_video_flags = 1; | 71 | acpi_realmode_flags |= 1; |
72 | if (strncmp(str, "s3_mode", 7) == 0) | 72 | if (strncmp(str, "s3_mode", 7) == 0) |
73 | acpi_video_flags |= 2; | 73 | acpi_realmode_flags |= 2; |
74 | if (strncmp(str, "s3_beep", 7) == 0) | ||
75 | acpi_realmode_flags |= 4; | ||
74 | str = strchr(str, ','); | 76 | str = strchr(str, ','); |
75 | if (str != NULL) | 77 | if (str != NULL) |
76 | str += strspn(str, ", \t"); | 78 | str += strspn(str, ", \t"); |
@@ -80,9 +82,11 @@ static int __init acpi_sleep_setup(char *str) | |||
80 | 82 | ||
81 | __setup("acpi_sleep=", acpi_sleep_setup); | 83 | __setup("acpi_sleep=", acpi_sleep_setup); |
82 | 84 | ||
85 | /* Ouch, we want to delete this. We already have better version in userspace, in | ||
86 | s2ram from suspend.sf.net project */ | ||
83 | static __init int reset_videomode_after_s3(struct dmi_system_id *d) | 87 | static __init int reset_videomode_after_s3(struct dmi_system_id *d) |
84 | { | 88 | { |
85 | acpi_video_flags |= 2; | 89 | acpi_realmode_flags |= 2; |
86 | return 0; | 90 | return 0; |
87 | } | 91 | } |
88 | 92 | ||
diff --git a/arch/i386/kernel/acpi/wakeup.S b/arch/i386/kernel/acpi/wakeup.S index b4e2ec3c3928..ed0a0f2c1597 100644 --- a/arch/i386/kernel/acpi/wakeup.S +++ b/arch/i386/kernel/acpi/wakeup.S | |||
@@ -47,7 +47,7 @@ wakeup_code: | |||
47 | movw %ax, %ds # Make ds:0 point to wakeup_start | 47 | movw %ax, %ds # Make ds:0 point to wakeup_start |
48 | movw %ax, %ss | 48 | movw %ax, %ss |
49 | 49 | ||
50 | testl $1, beep_flags - wakeup_code | 50 | testl $4, realmode_flags - wakeup_code |
51 | jz 1f | 51 | jz 1f |
52 | BEEP | 52 | BEEP |
53 | 1: | 53 | 1: |
@@ -61,7 +61,7 @@ wakeup_code: | |||
61 | cmpl $0x12345678, %eax | 61 | cmpl $0x12345678, %eax |
62 | jne bogus_real_magic | 62 | jne bogus_real_magic |
63 | 63 | ||
64 | testl $1, video_flags - wakeup_code | 64 | testl $1, realmode_flags - wakeup_code |
65 | jz 1f | 65 | jz 1f |
66 | lcall $0xc000,$3 | 66 | lcall $0xc000,$3 |
67 | movw %cs, %ax | 67 | movw %cs, %ax |
@@ -69,7 +69,7 @@ wakeup_code: | |||
69 | movw %ax, %ss | 69 | movw %ax, %ss |
70 | 1: | 70 | 1: |
71 | 71 | ||
72 | testl $2, video_flags - wakeup_code | 72 | testl $2, realmode_flags - wakeup_code |
73 | jz 1f | 73 | jz 1f |
74 | mov video_mode - wakeup_code, %ax | 74 | mov video_mode - wakeup_code, %ax |
75 | call mode_set | 75 | call mode_set |
@@ -108,11 +108,11 @@ wakeup_code: | |||
108 | cmpl $0x12345678, %eax | 108 | cmpl $0x12345678, %eax |
109 | jne bogus_real_magic | 109 | jne bogus_real_magic |
110 | 110 | ||
111 | testl $2, beep_flags - wakeup_code | 111 | testl $8, realmode_flags - wakeup_code |
112 | jz 1f | 112 | jz 1f |
113 | BEEP | 113 | BEEP |
114 | 1: | 114 | 1: |
115 | ljmpl $__KERNEL_CS,$wakeup_pmode_return | 115 | ljmpl $__KERNEL_CS, $wakeup_pmode_return |
116 | 116 | ||
117 | real_save_gdt: .word 0 | 117 | real_save_gdt: .word 0 |
118 | .long 0 | 118 | .long 0 |
@@ -121,7 +121,7 @@ real_save_cr3: .long 0 | |||
121 | real_save_cr4: .long 0 | 121 | real_save_cr4: .long 0 |
122 | real_magic: .long 0 | 122 | real_magic: .long 0 |
123 | video_mode: .long 0 | 123 | video_mode: .long 0 |
124 | video_flags: .long 0 | 124 | realmode_flags: .long 0 |
125 | beep_flags: .long 0 | 125 | beep_flags: .long 0 |
126 | real_efer_save_restore: .long 0 | 126 | real_efer_save_restore: .long 0 |
127 | real_save_efer_edx: .long 0 | 127 | real_save_efer_edx: .long 0 |
@@ -285,10 +285,8 @@ ENTRY(acpi_copy_wakeup_routine) | |||
285 | 285 | ||
286 | movl saved_videomode, %edx | 286 | movl saved_videomode, %edx |
287 | movl %edx, video_mode - wakeup_start (%eax) | 287 | movl %edx, video_mode - wakeup_start (%eax) |
288 | movl acpi_video_flags, %edx | 288 | movl acpi_realmode_flags, %edx |
289 | movl %edx, video_flags - wakeup_start (%eax) | 289 | movl %edx, realmode_flags - wakeup_start (%eax) |
290 | movl s2ram_beep, %edx | ||
291 | movl %edx, beep_flags - wakeup_start (%eax) | ||
292 | movl $0x12345678, real_magic - wakeup_start (%eax) | 290 | movl $0x12345678, real_magic - wakeup_start (%eax) |
293 | movl $0x12345678, saved_magic | 291 | movl $0x12345678, saved_magic |
294 | popl %ebx | 292 | popl %ebx |
diff --git a/arch/x86_64/kernel/acpi/sleep.c b/arch/x86_64/kernel/acpi/sleep.c index 195b7034a148..4277f2b27e6d 100644 --- a/arch/x86_64/kernel/acpi/sleep.c +++ b/arch/x86_64/kernel/acpi/sleep.c | |||
@@ -55,7 +55,7 @@ | |||
55 | 55 | ||
56 | /* address in low memory of the wakeup routine. */ | 56 | /* address in low memory of the wakeup routine. */ |
57 | unsigned long acpi_wakeup_address = 0; | 57 | unsigned long acpi_wakeup_address = 0; |
58 | unsigned long acpi_video_flags; | 58 | unsigned long acpi_realmode_flags; |
59 | extern char wakeup_start, wakeup_end; | 59 | extern char wakeup_start, wakeup_end; |
60 | 60 | ||
61 | extern unsigned long acpi_copy_wakeup_routine(unsigned long); | 61 | extern unsigned long acpi_copy_wakeup_routine(unsigned long); |
@@ -103,9 +103,11 @@ static int __init acpi_sleep_setup(char *str) | |||
103 | { | 103 | { |
104 | while ((str != NULL) && (*str != '\0')) { | 104 | while ((str != NULL) && (*str != '\0')) { |
105 | if (strncmp(str, "s3_bios", 7) == 0) | 105 | if (strncmp(str, "s3_bios", 7) == 0) |
106 | acpi_video_flags = 1; | 106 | acpi_realmode_flags |= 1; |
107 | if (strncmp(str, "s3_mode", 7) == 0) | 107 | if (strncmp(str, "s3_mode", 7) == 0) |
108 | acpi_video_flags |= 2; | 108 | acpi_realmode_flags |= 2; |
109 | if (strncmp(str, "s3_beep", 7) == 0) | ||
110 | acpi_realmode_flags |= 4; | ||
109 | str = strchr(str, ','); | 111 | str = strchr(str, ','); |
110 | if (str != NULL) | 112 | if (str != NULL) |
111 | str += strspn(str, ", \t"); | 113 | str += strspn(str, ", \t"); |
diff --git a/arch/x86_64/kernel/acpi/wakeup.S b/arch/x86_64/kernel/acpi/wakeup.S index ed63d1845792..13f1480cbec9 100644 --- a/arch/x86_64/kernel/acpi/wakeup.S +++ b/arch/x86_64/kernel/acpi/wakeup.S | |||
@@ -50,7 +50,7 @@ wakeup_code: | |||
50 | movw %ax, %ss | 50 | movw %ax, %ss |
51 | 51 | ||
52 | # Data segment must be set up before we can see whether to beep. | 52 | # Data segment must be set up before we can see whether to beep. |
53 | testl $1, beep_flags - wakeup_code | 53 | testl $4, realmode_flags - wakeup_code |
54 | jz 1f | 54 | jz 1f |
55 | BEEP | 55 | BEEP |
56 | 1: | 56 | 1: |
@@ -70,7 +70,7 @@ wakeup_code: | |||
70 | testl %eax, %eax | 70 | testl %eax, %eax |
71 | jnz no_longmode | 71 | jnz no_longmode |
72 | 72 | ||
73 | testl $1, video_flags - wakeup_code | 73 | testl $1, realmode_flags - wakeup_code |
74 | jz 1f | 74 | jz 1f |
75 | lcall $0xc000,$3 | 75 | lcall $0xc000,$3 |
76 | movw %cs, %ax | 76 | movw %cs, %ax |
@@ -78,7 +78,7 @@ wakeup_code: | |||
78 | movw %ax, %ss | 78 | movw %ax, %ss |
79 | 1: | 79 | 1: |
80 | 80 | ||
81 | testl $2, video_flags - wakeup_code | 81 | testl $2, realmode_flags - wakeup_code |
82 | jz 1f | 82 | jz 1f |
83 | mov video_mode - wakeup_code, %ax | 83 | mov video_mode - wakeup_code, %ax |
84 | call mode_seta | 84 | call mode_seta |
@@ -251,9 +251,8 @@ gdt_48a: | |||
251 | .long gdta - wakeup_code # gdt base (relocated in later) | 251 | .long gdta - wakeup_code # gdt base (relocated in later) |
252 | 252 | ||
253 | real_magic: .quad 0 | 253 | real_magic: .quad 0 |
254 | beep_flags: .quad 0 | ||
255 | video_mode: .quad 0 | 254 | video_mode: .quad 0 |
256 | video_flags: .quad 0 | 255 | realmode_flags: .quad 0 |
257 | 256 | ||
258 | .code16 | 257 | .code16 |
259 | bogus_real_magic: | 258 | bogus_real_magic: |
@@ -367,12 +366,10 @@ ENTRY(acpi_copy_wakeup_routine) | |||
367 | pushq %rax | 366 | pushq %rax |
368 | pushq %rdx | 367 | pushq %rdx |
369 | 368 | ||
370 | movl s2ram_beep, %edx | ||
371 | movl %edx, beep_flags - wakeup_start (,%rdi) | ||
372 | movl saved_video_mode, %edx | 369 | movl saved_video_mode, %edx |
373 | movl %edx, video_mode - wakeup_start (,%rdi) | 370 | movl %edx, video_mode - wakeup_start (,%rdi) |
374 | movl acpi_video_flags, %edx | 371 | movl acpi_realmode_flags, %edx |
375 | movl %edx, video_flags - wakeup_start (,%rdi) | 372 | movl %edx, realmode_flags - wakeup_start (,%rdi) |
376 | movq $0x12345678, real_magic - wakeup_start (,%rdi) | 373 | movq $0x12345678, real_magic - wakeup_start (,%rdi) |
377 | movq $0x123456789abcdef0, %rdx | 374 | movq $0x123456789abcdef0, %rdx |
378 | movq %rdx, saved_magic | 375 | movq %rdx, saved_magic |
diff --git a/include/linux/acpi.h b/include/linux/acpi.h index c0ccdd720363..dc234c508a6f 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h | |||
@@ -122,8 +122,7 @@ extern struct acpi_mcfg_allocation *pci_mmcfg_config; | |||
122 | extern int pci_mmcfg_config_num; | 122 | extern int pci_mmcfg_config_num; |
123 | 123 | ||
124 | extern int sbf_port; | 124 | extern int sbf_port; |
125 | extern unsigned long acpi_video_flags; | 125 | extern unsigned long acpi_realmode_flags; |
126 | extern unsigned long s2ram_beep; | ||
127 | 126 | ||
128 | #else /* !CONFIG_ACPI */ | 127 | #else /* !CONFIG_ACPI */ |
129 | 128 | ||
diff --git a/kernel/power/main.c b/kernel/power/main.c index c74a56436d8b..32147b57c3bf 100644 --- a/kernel/power/main.c +++ b/kernel/power/main.c | |||
@@ -332,27 +332,6 @@ static ssize_t state_store(struct kset *kset, const char *buf, size_t n) | |||
332 | 332 | ||
333 | power_attr(state); | 333 | power_attr(state); |
334 | 334 | ||
335 | unsigned long s2ram_beep = 0; | ||
336 | |||
337 | static ssize_t s2ram_beep_show(struct kset *kset, char *buf) | ||
338 | { | ||
339 | return sprintf(buf, "%d\n", s2ram_beep); | ||
340 | } | ||
341 | |||
342 | static ssize_t | ||
343 | s2ram_beep_store(struct kset *kset, const char *buf, size_t n) | ||
344 | { | ||
345 | int val; | ||
346 | |||
347 | if (sscanf(buf, "%d", &val) > 0) { | ||
348 | s2ram_beep = val; | ||
349 | return n; | ||
350 | } | ||
351 | return -EINVAL; | ||
352 | } | ||
353 | |||
354 | power_attr(s2ram_beep); | ||
355 | |||
356 | #ifdef CONFIG_PM_TRACE | 335 | #ifdef CONFIG_PM_TRACE |
357 | int pm_trace_enabled; | 336 | int pm_trace_enabled; |
358 | 337 | ||
@@ -378,13 +357,11 @@ power_attr(pm_trace); | |||
378 | static struct attribute * g[] = { | 357 | static struct attribute * g[] = { |
379 | &state_attr.attr, | 358 | &state_attr.attr, |
380 | &pm_trace_attr.attr, | 359 | &pm_trace_attr.attr, |
381 | &s2ram_beep_attr.attr, | ||
382 | NULL, | 360 | NULL, |
383 | }; | 361 | }; |
384 | #else | 362 | #else |
385 | static struct attribute * g[] = { | 363 | static struct attribute * g[] = { |
386 | &state_attr.attr, | 364 | &state_attr.attr, |
387 | &s2ram_beep_attr.attr, | ||
388 | NULL, | 365 | NULL, |
389 | }; | 366 | }; |
390 | #endif /* CONFIG_PM_TRACE */ | 367 | #endif /* CONFIG_PM_TRACE */ |
diff --git a/kernel/sysctl.c b/kernel/sysctl.c index 44a1d699aad7..3ed4912bf183 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c | |||
@@ -660,7 +660,7 @@ static ctl_table kern_table[] = { | |||
660 | { | 660 | { |
661 | .ctl_name = KERN_ACPI_VIDEO_FLAGS, | 661 | .ctl_name = KERN_ACPI_VIDEO_FLAGS, |
662 | .procname = "acpi_video_flags", | 662 | .procname = "acpi_video_flags", |
663 | .data = &acpi_video_flags, | 663 | .data = &acpi_realmode_flags, |
664 | .maxlen = sizeof (unsigned long), | 664 | .maxlen = sizeof (unsigned long), |
665 | .mode = 0644, | 665 | .mode = 0644, |
666 | .proc_handler = &proc_doulongvec_minmax, | 666 | .proc_handler = &proc_doulongvec_minmax, |