diff options
Diffstat (limited to 'arch/i386/kernel/acpi')
-rw-r--r-- | arch/i386/kernel/acpi/boot.c | 53 | ||||
-rw-r--r-- | arch/i386/kernel/acpi/sleep.c | 12 | ||||
-rw-r--r-- | arch/i386/kernel/acpi/wakeup.S | 39 |
3 files changed, 75 insertions, 29 deletions
diff --git a/arch/i386/kernel/acpi/boot.c b/arch/i386/kernel/acpi/boot.c index a2c8b9efd700..cacdd883bf2b 100644 --- a/arch/i386/kernel/acpi/boot.c +++ b/arch/i386/kernel/acpi/boot.c | |||
@@ -618,11 +618,11 @@ static int __init acpi_parse_sbf(struct acpi_table_header *table) | |||
618 | #ifdef CONFIG_HPET_TIMER | 618 | #ifdef CONFIG_HPET_TIMER |
619 | #include <asm/hpet.h> | 619 | #include <asm/hpet.h> |
620 | 620 | ||
621 | static struct __initdata resource *hpet_res; | ||
622 | |||
621 | static int __init acpi_parse_hpet(struct acpi_table_header *table) | 623 | static int __init acpi_parse_hpet(struct acpi_table_header *table) |
622 | { | 624 | { |
623 | struct acpi_table_hpet *hpet_tbl; | 625 | struct acpi_table_hpet *hpet_tbl; |
624 | struct resource *hpet_res; | ||
625 | resource_size_t res_start; | ||
626 | 626 | ||
627 | hpet_tbl = (struct acpi_table_hpet *)table; | 627 | hpet_tbl = (struct acpi_table_hpet *)table; |
628 | if (!hpet_tbl) { | 628 | if (!hpet_tbl) { |
@@ -636,31 +636,46 @@ static int __init acpi_parse_hpet(struct acpi_table_header *table) | |||
636 | return -1; | 636 | return -1; |
637 | } | 637 | } |
638 | 638 | ||
639 | #define HPET_RESOURCE_NAME_SIZE 9 | ||
640 | hpet_res = alloc_bootmem(sizeof(*hpet_res) + HPET_RESOURCE_NAME_SIZE); | ||
641 | if (hpet_res) { | ||
642 | memset(hpet_res, 0, sizeof(*hpet_res)); | ||
643 | hpet_res->name = (void *)&hpet_res[1]; | ||
644 | hpet_res->flags = IORESOURCE_MEM | IORESOURCE_BUSY; | ||
645 | snprintf((char *)hpet_res->name, HPET_RESOURCE_NAME_SIZE, | ||
646 | "HPET %u", hpet_tbl->sequence); | ||
647 | hpet_res->end = (1 * 1024) - 1; | ||
648 | } | ||
649 | |||
650 | hpet_address = hpet_tbl->address.address; | 639 | hpet_address = hpet_tbl->address.address; |
651 | printk(KERN_INFO PREFIX "HPET id: %#x base: %#lx\n", | 640 | printk(KERN_INFO PREFIX "HPET id: %#x base: %#lx\n", |
652 | hpet_tbl->id, hpet_address); | 641 | hpet_tbl->id, hpet_address); |
653 | 642 | ||
654 | res_start = hpet_address; | 643 | /* |
644 | * Allocate and initialize the HPET firmware resource for adding into | ||
645 | * the resource tree during the lateinit timeframe. | ||
646 | */ | ||
647 | #define HPET_RESOURCE_NAME_SIZE 9 | ||
648 | hpet_res = alloc_bootmem(sizeof(*hpet_res) + HPET_RESOURCE_NAME_SIZE); | ||
655 | 649 | ||
656 | if (hpet_res) { | 650 | if (!hpet_res) |
657 | hpet_res->start = res_start; | 651 | return 0; |
658 | hpet_res->end += res_start; | 652 | |
659 | insert_resource(&iomem_resource, hpet_res); | 653 | memset(hpet_res, 0, sizeof(*hpet_res)); |
660 | } | 654 | hpet_res->name = (void *)&hpet_res[1]; |
655 | hpet_res->flags = IORESOURCE_MEM; | ||
656 | snprintf((char *)hpet_res->name, HPET_RESOURCE_NAME_SIZE, "HPET %u", | ||
657 | hpet_tbl->sequence); | ||
658 | |||
659 | hpet_res->start = hpet_address; | ||
660 | hpet_res->end = hpet_address + (1 * 1024) - 1; | ||
661 | 661 | ||
662 | return 0; | 662 | return 0; |
663 | } | 663 | } |
664 | |||
665 | /* | ||
666 | * hpet_insert_resource inserts the HPET resources used into the resource | ||
667 | * tree. | ||
668 | */ | ||
669 | static __init int hpet_insert_resource(void) | ||
670 | { | ||
671 | if (!hpet_res) | ||
672 | return 1; | ||
673 | |||
674 | return insert_resource(&iomem_resource, hpet_res); | ||
675 | } | ||
676 | |||
677 | late_initcall(hpet_insert_resource); | ||
678 | |||
664 | #else | 679 | #else |
665 | #define acpi_parse_hpet NULL | 680 | #define acpi_parse_hpet NULL |
666 | #endif | 681 | #endif |
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 b781b38131c0..ed0a0f2c1597 100644 --- a/arch/i386/kernel/acpi/wakeup.S +++ b/arch/i386/kernel/acpi/wakeup.S | |||
@@ -13,6 +13,21 @@ | |||
13 | # cs = 0x1234, eip = 0x05 | 13 | # cs = 0x1234, eip = 0x05 |
14 | # | 14 | # |
15 | 15 | ||
16 | #define BEEP \ | ||
17 | inb $97, %al; \ | ||
18 | outb %al, $0x80; \ | ||
19 | movb $3, %al; \ | ||
20 | outb %al, $97; \ | ||
21 | outb %al, $0x80; \ | ||
22 | movb $-74, %al; \ | ||
23 | outb %al, $67; \ | ||
24 | outb %al, $0x80; \ | ||
25 | movb $-119, %al; \ | ||
26 | outb %al, $66; \ | ||
27 | outb %al, $0x80; \ | ||
28 | movb $15, %al; \ | ||
29 | outb %al, $66; | ||
30 | |||
16 | ALIGN | 31 | ALIGN |
17 | .align 4096 | 32 | .align 4096 |
18 | ENTRY(wakeup_start) | 33 | ENTRY(wakeup_start) |
@@ -31,6 +46,11 @@ wakeup_code: | |||
31 | movw %cs, %ax | 46 | movw %cs, %ax |
32 | movw %ax, %ds # Make ds:0 point to wakeup_start | 47 | movw %ax, %ds # Make ds:0 point to wakeup_start |
33 | movw %ax, %ss | 48 | movw %ax, %ss |
49 | |||
50 | testl $4, realmode_flags - wakeup_code | ||
51 | jz 1f | ||
52 | BEEP | ||
53 | 1: | ||
34 | mov $(wakeup_stack - wakeup_code), %sp # Private stack is needed for ASUS board | 54 | mov $(wakeup_stack - wakeup_code), %sp # Private stack is needed for ASUS board |
35 | movw $0x0e00 + 'S', %fs:(0x12) | 55 | movw $0x0e00 + 'S', %fs:(0x12) |
36 | 56 | ||
@@ -41,7 +61,7 @@ wakeup_code: | |||
41 | cmpl $0x12345678, %eax | 61 | cmpl $0x12345678, %eax |
42 | jne bogus_real_magic | 62 | jne bogus_real_magic |
43 | 63 | ||
44 | testl $1, video_flags - wakeup_code | 64 | testl $1, realmode_flags - wakeup_code |
45 | jz 1f | 65 | jz 1f |
46 | lcall $0xc000,$3 | 66 | lcall $0xc000,$3 |
47 | movw %cs, %ax | 67 | movw %cs, %ax |
@@ -49,7 +69,7 @@ wakeup_code: | |||
49 | movw %ax, %ss | 69 | movw %ax, %ss |
50 | 1: | 70 | 1: |
51 | 71 | ||
52 | testl $2, video_flags - wakeup_code | 72 | testl $2, realmode_flags - wakeup_code |
53 | jz 1f | 73 | jz 1f |
54 | mov video_mode - wakeup_code, %ax | 74 | mov video_mode - wakeup_code, %ax |
55 | call mode_set | 75 | call mode_set |
@@ -88,7 +108,11 @@ wakeup_code: | |||
88 | cmpl $0x12345678, %eax | 108 | cmpl $0x12345678, %eax |
89 | jne bogus_real_magic | 109 | jne bogus_real_magic |
90 | 110 | ||
91 | ljmpl $__KERNEL_CS,$wakeup_pmode_return | 111 | testl $8, realmode_flags - wakeup_code |
112 | jz 1f | ||
113 | BEEP | ||
114 | 1: | ||
115 | ljmpl $__KERNEL_CS, $wakeup_pmode_return | ||
92 | 116 | ||
93 | real_save_gdt: .word 0 | 117 | real_save_gdt: .word 0 |
94 | .long 0 | 118 | .long 0 |
@@ -97,7 +121,8 @@ real_save_cr3: .long 0 | |||
97 | real_save_cr4: .long 0 | 121 | real_save_cr4: .long 0 |
98 | real_magic: .long 0 | 122 | real_magic: .long 0 |
99 | video_mode: .long 0 | 123 | video_mode: .long 0 |
100 | video_flags: .long 0 | 124 | realmode_flags: .long 0 |
125 | beep_flags: .long 0 | ||
101 | real_efer_save_restore: .long 0 | 126 | real_efer_save_restore: .long 0 |
102 | real_save_efer_edx: .long 0 | 127 | real_save_efer_edx: .long 0 |
103 | real_save_efer_eax: .long 0 | 128 | real_save_efer_eax: .long 0 |
@@ -230,6 +255,7 @@ bogus_magic: | |||
230 | # | 255 | # |
231 | ENTRY(acpi_copy_wakeup_routine) | 256 | ENTRY(acpi_copy_wakeup_routine) |
232 | 257 | ||
258 | pushl %ebx | ||
233 | sgdt saved_gdt | 259 | sgdt saved_gdt |
234 | sidt saved_idt | 260 | sidt saved_idt |
235 | sldt saved_ldt | 261 | sldt saved_ldt |
@@ -259,10 +285,11 @@ ENTRY(acpi_copy_wakeup_routine) | |||
259 | 285 | ||
260 | movl saved_videomode, %edx | 286 | movl saved_videomode, %edx |
261 | movl %edx, video_mode - wakeup_start (%eax) | 287 | movl %edx, video_mode - wakeup_start (%eax) |
262 | movl acpi_video_flags, %edx | 288 | movl acpi_realmode_flags, %edx |
263 | movl %edx, video_flags - wakeup_start (%eax) | 289 | movl %edx, realmode_flags - wakeup_start (%eax) |
264 | movl $0x12345678, real_magic - wakeup_start (%eax) | 290 | movl $0x12345678, real_magic - wakeup_start (%eax) |
265 | movl $0x12345678, saved_magic | 291 | movl $0x12345678, saved_magic |
292 | popl %ebx | ||
266 | ret | 293 | ret |
267 | 294 | ||
268 | save_registers: | 295 | save_registers: |