aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPavel Machek <pavel@suse.cz>2007-07-19 04:47:41 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-07-19 13:04:43 -0400
commit77afcf78a2ded9a91838734234949c0ead5feb12 (patch)
tree76922017855c70d550b40241f8a144f6c098cd04
parent5a60d6235c8352ade8f2699e72fcdfe853730456 (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.c12
-rw-r--r--arch/i386/kernel/acpi/wakeup.S18
-rw-r--r--arch/x86_64/kernel/acpi/sleep.c8
-rw-r--r--arch/x86_64/kernel/acpi/wakeup.S15
-rw-r--r--include/linux/acpi.h3
-rw-r--r--kernel/power/main.c23
-rw-r--r--kernel/sysctl.c2
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. */
16unsigned long acpi_wakeup_address = 0; 16unsigned long acpi_wakeup_address = 0;
17unsigned long acpi_video_flags; 17unsigned long acpi_realmode_flags;
18extern char wakeup_start, wakeup_end; 18extern char wakeup_start, wakeup_end;
19 19
20extern unsigned long FASTCALL(acpi_copy_wakeup_routine(unsigned long)); 20extern 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 */
83static __init int reset_videomode_after_s3(struct dmi_system_id *d) 87static __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
531: 531:
@@ -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
701: 701:
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
1141: 1141:
115 ljmpl $__KERNEL_CS,$wakeup_pmode_return 115 ljmpl $__KERNEL_CS, $wakeup_pmode_return
116 116
117real_save_gdt: .word 0 117real_save_gdt: .word 0
118 .long 0 118 .long 0
@@ -121,7 +121,7 @@ real_save_cr3: .long 0
121real_save_cr4: .long 0 121real_save_cr4: .long 0
122real_magic: .long 0 122real_magic: .long 0
123video_mode: .long 0 123video_mode: .long 0
124video_flags: .long 0 124realmode_flags: .long 0
125beep_flags: .long 0 125beep_flags: .long 0
126real_efer_save_restore: .long 0 126real_efer_save_restore: .long 0
127real_save_efer_edx: .long 0 127real_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. */
57unsigned long acpi_wakeup_address = 0; 57unsigned long acpi_wakeup_address = 0;
58unsigned long acpi_video_flags; 58unsigned long acpi_realmode_flags;
59extern char wakeup_start, wakeup_end; 59extern char wakeup_start, wakeup_end;
60 60
61extern unsigned long acpi_copy_wakeup_routine(unsigned long); 61extern 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
561: 561:
@@ -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
791: 791:
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
253real_magic: .quad 0 253real_magic: .quad 0
254beep_flags: .quad 0
255video_mode: .quad 0 254video_mode: .quad 0
256video_flags: .quad 0 255realmode_flags: .quad 0
257 256
258.code16 257.code16
259bogus_real_magic: 258bogus_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;
122extern int pci_mmcfg_config_num; 122extern int pci_mmcfg_config_num;
123 123
124extern int sbf_port; 124extern int sbf_port;
125extern unsigned long acpi_video_flags; 125extern unsigned long acpi_realmode_flags;
126extern 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
333power_attr(state); 333power_attr(state);
334 334
335unsigned long s2ram_beep = 0;
336
337static ssize_t s2ram_beep_show(struct kset *kset, char *buf)
338{
339 return sprintf(buf, "%d\n", s2ram_beep);
340}
341
342static ssize_t
343s2ram_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
354power_attr(s2ram_beep);
355
356#ifdef CONFIG_PM_TRACE 335#ifdef CONFIG_PM_TRACE
357int pm_trace_enabled; 336int pm_trace_enabled;
358 337
@@ -378,13 +357,11 @@ power_attr(pm_trace);
378static struct attribute * g[] = { 357static 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
385static struct attribute * g[] = { 363static 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,