Commit 77afcf78a2ded9a91838734234949c0ead5feb12

Authored by Pavel Machek
Committed by Linus Torvalds
1 parent 5a60d6235c

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>

Showing 7 changed files with 29 additions and 52 deletions Side-by-side Diff

arch/i386/kernel/acpi/sleep.c
... ... @@ -14,7 +14,7 @@
14 14  
15 15 /* address in low memory of the wakeup routine. */
16 16 unsigned long acpi_wakeup_address = 0;
17   -unsigned long acpi_video_flags;
  17 +unsigned long acpi_realmode_flags;
18 18 extern char wakeup_start, wakeup_end;
19 19  
20 20 extern unsigned long FASTCALL(acpi_copy_wakeup_routine(unsigned long));
21 21  
... ... @@ -68,9 +68,11 @@
68 68 {
69 69 while ((str != NULL) && (*str != '\0')) {
70 70 if (strncmp(str, "s3_bios", 7) == 0)
71   - acpi_video_flags = 1;
  71 + acpi_realmode_flags |= 1;
72 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 76 str = strchr(str, ',');
75 77 if (str != NULL)
76 78 str += strspn(str, ", \t");
77 79  
... ... @@ -80,9 +82,11 @@
80 82  
81 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 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 90 return 0;
87 91 }
88 92  
arch/i386/kernel/acpi/wakeup.S
... ... @@ -47,7 +47,7 @@
47 47 movw %ax, %ds # Make ds:0 point to wakeup_start
48 48 movw %ax, %ss
49 49  
50   - testl $1, beep_flags - wakeup_code
  50 + testl $4, realmode_flags - wakeup_code
51 51 jz 1f
52 52 BEEP
53 53 1:
... ... @@ -61,7 +61,7 @@
61 61 cmpl $0x12345678, %eax
62 62 jne bogus_real_magic
63 63  
64   - testl $1, video_flags - wakeup_code
  64 + testl $1, realmode_flags - wakeup_code
65 65 jz 1f
66 66 lcall $0xc000,$3
67 67 movw %cs, %ax
... ... @@ -69,7 +69,7 @@
69 69 movw %ax, %ss
70 70 1:
71 71  
72   - testl $2, video_flags - wakeup_code
  72 + testl $2, realmode_flags - wakeup_code
73 73 jz 1f
74 74 mov video_mode - wakeup_code, %ax
75 75 call mode_set
76 76  
... ... @@ -108,11 +108,11 @@
108 108 cmpl $0x12345678, %eax
109 109 jne bogus_real_magic
110 110  
111   - testl $2, beep_flags - wakeup_code
  111 + testl $8, realmode_flags - wakeup_code
112 112 jz 1f
113 113 BEEP
114 114 1:
115   - ljmpl $__KERNEL_CS,$wakeup_pmode_return
  115 + ljmpl $__KERNEL_CS, $wakeup_pmode_return
116 116  
117 117 real_save_gdt: .word 0
118 118 .long 0
... ... @@ -121,7 +121,7 @@
121 121 real_save_cr4: .long 0
122 122 real_magic: .long 0
123 123 video_mode: .long 0
124   -video_flags: .long 0
  124 +realmode_flags: .long 0
125 125 beep_flags: .long 0
126 126 real_efer_save_restore: .long 0
127 127 real_save_efer_edx: .long 0
... ... @@ -285,10 +285,8 @@
285 285  
286 286 movl saved_videomode, %edx
287 287 movl %edx, video_mode - wakeup_start (%eax)
288   - movl acpi_video_flags, %edx
289   - movl %edx, video_flags - wakeup_start (%eax)
290   - movl s2ram_beep, %edx
291   - movl %edx, beep_flags - wakeup_start (%eax)
  288 + movl acpi_realmode_flags, %edx
  289 + movl %edx, realmode_flags - wakeup_start (%eax)
292 290 movl $0x12345678, real_magic - wakeup_start (%eax)
293 291 movl $0x12345678, saved_magic
294 292 popl %ebx
arch/x86_64/kernel/acpi/sleep.c
... ... @@ -55,7 +55,7 @@
55 55  
56 56 /* address in low memory of the wakeup routine. */
57 57 unsigned long acpi_wakeup_address = 0;
58   -unsigned long acpi_video_flags;
  58 +unsigned long acpi_realmode_flags;
59 59 extern char wakeup_start, wakeup_end;
60 60  
61 61 extern unsigned long acpi_copy_wakeup_routine(unsigned long);
62 62  
... ... @@ -103,9 +103,11 @@
103 103 {
104 104 while ((str != NULL) && (*str != '\0')) {
105 105 if (strncmp(str, "s3_bios", 7) == 0)
106   - acpi_video_flags = 1;
  106 + acpi_realmode_flags |= 1;
107 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 111 str = strchr(str, ',');
110 112 if (str != NULL)
111 113 str += strspn(str, ", \t");
arch/x86_64/kernel/acpi/wakeup.S
... ... @@ -50,7 +50,7 @@
50 50 movw %ax, %ss
51 51  
52 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 54 jz 1f
55 55 BEEP
56 56 1:
... ... @@ -70,7 +70,7 @@
70 70 testl %eax, %eax
71 71 jnz no_longmode
72 72  
73   - testl $1, video_flags - wakeup_code
  73 + testl $1, realmode_flags - wakeup_code
74 74 jz 1f
75 75 lcall $0xc000,$3
76 76 movw %cs, %ax
... ... @@ -78,7 +78,7 @@
78 78 movw %ax, %ss
79 79 1:
80 80  
81   - testl $2, video_flags - wakeup_code
  81 + testl $2, realmode_flags - wakeup_code
82 82 jz 1f
83 83 mov video_mode - wakeup_code, %ax
84 84 call mode_seta
85 85  
... ... @@ -251,9 +251,8 @@
251 251 .long gdta - wakeup_code # gdt base (relocated in later)
252 252  
253 253 real_magic: .quad 0
254   -beep_flags: .quad 0
255 254 video_mode: .quad 0
256   -video_flags: .quad 0
  255 +realmode_flags: .quad 0
257 256  
258 257 .code16
259 258 bogus_real_magic:
260 259  
... ... @@ -367,12 +366,10 @@
367 366 pushq %rax
368 367 pushq %rdx
369 368  
370   - movl s2ram_beep, %edx
371   - movl %edx, beep_flags - wakeup_start (,%rdi)
372 369 movl saved_video_mode, %edx
373 370 movl %edx, video_mode - wakeup_start (,%rdi)
374   - movl acpi_video_flags, %edx
375   - movl %edx, video_flags - wakeup_start (,%rdi)
  371 + movl acpi_realmode_flags, %edx
  372 + movl %edx, realmode_flags - wakeup_start (,%rdi)
376 373 movq $0x12345678, real_magic - wakeup_start (,%rdi)
377 374 movq $0x123456789abcdef0, %rdx
378 375 movq %rdx, saved_magic
include/linux/acpi.h
... ... @@ -122,8 +122,7 @@
122 122 extern int pci_mmcfg_config_num;
123 123  
124 124 extern int sbf_port;
125   -extern unsigned long acpi_video_flags;
126   -extern unsigned long s2ram_beep;
  125 +extern unsigned long acpi_realmode_flags;
127 126  
128 127 #else /* !CONFIG_ACPI */
129 128  
... ... @@ -332,27 +332,6 @@
332 332  
333 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 335 #ifdef CONFIG_PM_TRACE
357 336 int pm_trace_enabled;
358 337  
359 338  
... ... @@ -378,13 +357,11 @@
378 357 static struct attribute * g[] = {
379 358 &state_attr.attr,
380 359 &pm_trace_attr.attr,
381   - &s2ram_beep_attr.attr,
382 360 NULL,
383 361 };
384 362 #else
385 363 static struct attribute * g[] = {
386 364 &state_attr.attr,
387   - &s2ram_beep_attr.attr,
388 365 NULL,
389 366 };
390 367 #endif /* CONFIG_PM_TRACE */
... ... @@ -660,7 +660,7 @@
660 660 {
661 661 .ctl_name = KERN_ACPI_VIDEO_FLAGS,
662 662 .procname = "acpi_video_flags",
663   - .data = &acpi_video_flags,
  663 + .data = &acpi_realmode_flags,
664 664 .maxlen = sizeof (unsigned long),
665 665 .mode = 0644,
666 666 .proc_handler = &proc_doulongvec_minmax,