aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/acpi
diff options
context:
space:
mode:
authorJonathan Herman <hermanjl@cs.unc.edu>2013-01-17 16:15:55 -0500
committerJonathan Herman <hermanjl@cs.unc.edu>2013-01-17 16:15:55 -0500
commit8dea78da5cee153b8af9c07a2745f6c55057fe12 (patch)
treea8f4d49d63b1ecc92f2fddceba0655b2472c5bd9 /arch/x86/kernel/acpi
parent406089d01562f1e2bf9f089fd7637009ebaad589 (diff)
Patched in Tegra support.
Diffstat (limited to 'arch/x86/kernel/acpi')
-rw-r--r--arch/x86/kernel/acpi/Makefile9
-rw-r--r--arch/x86/kernel/acpi/boot.c58
-rw-r--r--arch/x86/kernel/acpi/cstate.c1
-rw-r--r--arch/x86/kernel/acpi/sleep.c48
-rw-r--r--arch/x86/kernel/acpi/sleep.h4
5 files changed, 59 insertions, 61 deletions
diff --git a/arch/x86/kernel/acpi/Makefile b/arch/x86/kernel/acpi/Makefile
index 163b2258147..6f35260bb3e 100644
--- a/arch/x86/kernel/acpi/Makefile
+++ b/arch/x86/kernel/acpi/Makefile
@@ -1,7 +1,14 @@
1subdir- := realmode
2
1obj-$(CONFIG_ACPI) += boot.o 3obj-$(CONFIG_ACPI) += boot.o
2obj-$(CONFIG_ACPI_SLEEP) += sleep.o wakeup_$(BITS).o 4obj-$(CONFIG_ACPI_SLEEP) += sleep.o wakeup_rm.o wakeup_$(BITS).o
3 5
4ifneq ($(CONFIG_ACPI_PROCESSOR),) 6ifneq ($(CONFIG_ACPI_PROCESSOR),)
5obj-y += cstate.o 7obj-y += cstate.o
6endif 8endif
7 9
10$(obj)/wakeup_rm.o: $(obj)/realmode/wakeup.bin
11
12$(obj)/realmode/wakeup.bin: FORCE
13 $(Q)$(MAKE) $(build)=$(obj)/realmode
14
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
index bacf4b0d91f..4558f0d0822 100644
--- a/arch/x86/kernel/acpi/boot.c
+++ b/arch/x86/kernel/acpi/boot.c
@@ -219,8 +219,6 @@ static int __init
219acpi_parse_x2apic(struct acpi_subtable_header *header, const unsigned long end) 219acpi_parse_x2apic(struct acpi_subtable_header *header, const unsigned long end)
220{ 220{
221 struct acpi_madt_local_x2apic *processor = NULL; 221 struct acpi_madt_local_x2apic *processor = NULL;
222 int apic_id;
223 u8 enabled;
224 222
225 processor = (struct acpi_madt_local_x2apic *)header; 223 processor = (struct acpi_madt_local_x2apic *)header;
226 224
@@ -229,8 +227,6 @@ acpi_parse_x2apic(struct acpi_subtable_header *header, const unsigned long end)
229 227
230 acpi_table_print_madt_entry(header); 228 acpi_table_print_madt_entry(header);
231 229
232 apic_id = processor->local_apic_id;
233 enabled = processor->lapic_flags & ACPI_MADT_ENABLED;
234#ifdef CONFIG_X86_X2APIC 230#ifdef CONFIG_X86_X2APIC
235 /* 231 /*
236 * We need to register disabled CPU as well to permit 232 * We need to register disabled CPU as well to permit
@@ -239,10 +235,8 @@ acpi_parse_x2apic(struct acpi_subtable_header *header, const unsigned long end)
239 * to not preallocating memory for all NR_CPUS 235 * to not preallocating memory for all NR_CPUS
240 * when we use CPU hotplug. 236 * when we use CPU hotplug.
241 */ 237 */
242 if (!apic->apic_id_valid(apic_id) && enabled) 238 acpi_register_lapic(processor->local_apic_id, /* APIC ID */
243 printk(KERN_WARNING PREFIX "x2apic entry ignored\n"); 239 processor->lapic_flags & ACPI_MADT_ENABLED);
244 else
245 acpi_register_lapic(apic_id, enabled);
246#else 240#else
247 printk(KERN_WARNING PREFIX "x2apic entry ignored\n"); 241 printk(KERN_WARNING PREFIX "x2apic entry ignored\n");
248#endif 242#endif
@@ -422,14 +416,12 @@ acpi_parse_int_src_ovr(struct acpi_subtable_header * header,
422 return 0; 416 return 0;
423 } 417 }
424 418
425 if (intsrc->source_irq == 0) { 419 if (intsrc->source_irq == 0 && intsrc->global_irq == 2) {
426 if (acpi_skip_timer_override) { 420 if (acpi_skip_timer_override) {
427 printk(PREFIX "BIOS IRQ0 override ignored.\n"); 421 printk(PREFIX "BIOS IRQ0 pin2 override ignored.\n");
428 return 0; 422 return 0;
429 } 423 }
430 424 if (acpi_fix_pin2_polarity && (intsrc->inti_flags & ACPI_MADT_POLARITY_MASK)) {
431 if ((intsrc->global_irq == 2) && acpi_fix_pin2_polarity
432 && (intsrc->inti_flags & ACPI_MADT_POLARITY_MASK)) {
433 intsrc->inti_flags &= ~ACPI_MADT_POLARITY_MASK; 425 intsrc->inti_flags &= ~ACPI_MADT_POLARITY_MASK;
434 printk(PREFIX "BIOS IRQ0 pin2 override: forcing polarity to high active.\n"); 426 printk(PREFIX "BIOS IRQ0 pin2 override: forcing polarity to high active.\n");
435 } 427 }
@@ -574,12 +566,6 @@ int acpi_register_gsi(struct device *dev, u32 gsi, int trigger, int polarity)
574 566
575 return irq; 567 return irq;
576} 568}
577EXPORT_SYMBOL_GPL(acpi_register_gsi);
578
579void acpi_unregister_gsi(u32 gsi)
580{
581}
582EXPORT_SYMBOL_GPL(acpi_unregister_gsi);
583 569
584void __init acpi_set_irq_model_pic(void) 570void __init acpi_set_irq_model_pic(void)
585{ 571{
@@ -601,7 +587,7 @@ void __init acpi_set_irq_model_ioapic(void)
601#ifdef CONFIG_ACPI_HOTPLUG_CPU 587#ifdef CONFIG_ACPI_HOTPLUG_CPU
602#include <acpi/processor.h> 588#include <acpi/processor.h>
603 589
604static void __cpuinit acpi_map_cpu2node(acpi_handle handle, int cpu, int physid) 590static void acpi_map_cpu2node(acpi_handle handle, int cpu, int physid)
605{ 591{
606#ifdef CONFIG_ACPI_NUMA 592#ifdef CONFIG_ACPI_NUMA
607 int nid; 593 int nid;
@@ -650,7 +636,6 @@ static int __cpuinit _acpi_map_lsapic(acpi_handle handle, int *pcpu)
650 kfree(buffer.pointer); 636 kfree(buffer.pointer);
651 buffer.length = ACPI_ALLOCATE_BUFFER; 637 buffer.length = ACPI_ALLOCATE_BUFFER;
652 buffer.pointer = NULL; 638 buffer.pointer = NULL;
653 lapic = NULL;
654 639
655 if (!alloc_cpumask_var(&tmp_map, GFP_KERNEL)) 640 if (!alloc_cpumask_var(&tmp_map, GFP_KERNEL))
656 goto out; 641 goto out;
@@ -659,10 +644,10 @@ static int __cpuinit _acpi_map_lsapic(acpi_handle handle, int *pcpu)
659 goto free_tmp_map; 644 goto free_tmp_map;
660 645
661 cpumask_copy(tmp_map, cpu_present_mask); 646 cpumask_copy(tmp_map, cpu_present_mask);
662 acpi_register_lapic(physid, ACPI_MADT_ENABLED); 647 acpi_register_lapic(physid, lapic->lapic_flags & ACPI_MADT_ENABLED);
663 648
664 /* 649 /*
665 * If acpi_register_lapic successfully generates a new logical cpu 650 * If mp_register_lapic successfully generates a new logical cpu
666 * number, then the following will get us exactly what was mapped 651 * number, then the following will get us exactly what was mapped
667 */ 652 */
668 cpumask_andnot(new_map, cpu_present_mask, tmp_map); 653 cpumask_andnot(new_map, cpu_present_mask, tmp_map);
@@ -998,7 +983,7 @@ void __init mp_config_acpi_legacy_irqs(void)
998 int i; 983 int i;
999 struct mpc_intsrc mp_irq; 984 struct mpc_intsrc mp_irq;
1000 985
1001#ifdef CONFIG_EISA 986#if defined (CONFIG_MCA) || defined (CONFIG_EISA)
1002 /* 987 /*
1003 * Fabricate the legacy ISA bus (bus #31). 988 * Fabricate the legacy ISA bus (bus #31).
1004 */ 989 */
@@ -1342,12 +1327,17 @@ static int __init dmi_disable_acpi(const struct dmi_system_id *d)
1342} 1327}
1343 1328
1344/* 1329/*
1345 * Force ignoring BIOS IRQ0 override 1330 * Force ignoring BIOS IRQ0 pin2 override
1346 */ 1331 */
1347static int __init dmi_ignore_irq0_timer_override(const struct dmi_system_id *d) 1332static int __init dmi_ignore_irq0_timer_override(const struct dmi_system_id *d)
1348{ 1333{
1334 /*
1335 * The ati_ixp4x0_rev() early PCI quirk should have set
1336 * the acpi_skip_timer_override flag already:
1337 */
1349 if (!acpi_skip_timer_override) { 1338 if (!acpi_skip_timer_override) {
1350 pr_notice("%s detected: Ignoring BIOS IRQ0 override\n", 1339 WARN(1, KERN_ERR "ati_ixp4x0 quirk not complete.\n");
1340 pr_notice("%s detected: Ignoring BIOS IRQ0 pin2 override\n",
1351 d->ident); 1341 d->ident);
1352 acpi_skip_timer_override = 1; 1342 acpi_skip_timer_override = 1;
1353 } 1343 }
@@ -1441,7 +1431,7 @@ static struct dmi_system_id __initdata acpi_dmi_table_late[] = {
1441 * is enabled. This input is incorrectly designated the 1431 * is enabled. This input is incorrectly designated the
1442 * ISA IRQ 0 via an interrupt source override even though 1432 * ISA IRQ 0 via an interrupt source override even though
1443 * it is wired to the output of the master 8259A and INTIN0 1433 * it is wired to the output of the master 8259A and INTIN0
1444 * is not connected at all. Force ignoring BIOS IRQ0 1434 * is not connected at all. Force ignoring BIOS IRQ0 pin2
1445 * override in that cases. 1435 * override in that cases.
1446 */ 1436 */
1447 { 1437 {
@@ -1476,14 +1466,6 @@ static struct dmi_system_id __initdata acpi_dmi_table_late[] = {
1476 DMI_MATCH(DMI_PRODUCT_NAME, "HP Compaq 6715b"), 1466 DMI_MATCH(DMI_PRODUCT_NAME, "HP Compaq 6715b"),
1477 }, 1467 },
1478 }, 1468 },
1479 {
1480 .callback = dmi_ignore_irq0_timer_override,
1481 .ident = "FUJITSU SIEMENS",
1482 .matches = {
1483 DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
1484 DMI_MATCH(DMI_PRODUCT_NAME, "AMILO PRO V2030"),
1485 },
1486 },
1487 {} 1469 {}
1488}; 1470};
1489 1471
@@ -1706,9 +1688,3 @@ int __acpi_release_global_lock(unsigned int *lock)
1706 } while (unlikely (val != old)); 1688 } while (unlikely (val != old));
1707 return old & 0x1; 1689 return old & 0x1;
1708} 1690}
1709
1710void __init arch_reserve_mem_area(acpi_physical_address addr, size_t size)
1711{
1712 e820_add_region(addr, size, E820_ACPI);
1713 update_e820();
1714}
diff --git a/arch/x86/kernel/acpi/cstate.c b/arch/x86/kernel/acpi/cstate.c
index d2b7f27781b..f50e7fb2a20 100644
--- a/arch/x86/kernel/acpi/cstate.c
+++ b/arch/x86/kernel/acpi/cstate.c
@@ -14,7 +14,6 @@
14#include <acpi/processor.h> 14#include <acpi/processor.h>
15#include <asm/acpi.h> 15#include <asm/acpi.h>
16#include <asm/mwait.h> 16#include <asm/mwait.h>
17#include <asm/special_insns.h>
18 17
19/* 18/*
20 * Initialize bm_flags based on the CPU cache properties 19 * Initialize bm_flags based on the CPU cache properties
diff --git a/arch/x86/kernel/acpi/sleep.c b/arch/x86/kernel/acpi/sleep.c
index d5e0d717005..103b6ab368d 100644
--- a/arch/x86/kernel/acpi/sleep.c
+++ b/arch/x86/kernel/acpi/sleep.c
@@ -14,9 +14,8 @@
14#include <asm/desc.h> 14#include <asm/desc.h>
15#include <asm/pgtable.h> 15#include <asm/pgtable.h>
16#include <asm/cacheflush.h> 16#include <asm/cacheflush.h>
17#include <asm/realmode.h>
18 17
19#include "../../realmode/rm/wakeup.h" 18#include "realmode/wakeup.h"
20#include "sleep.h" 19#include "sleep.h"
21 20
22unsigned long acpi_realmode_flags; 21unsigned long acpi_realmode_flags;
@@ -33,9 +32,13 @@ static char temp_stack[4096];
33 */ 32 */
34int acpi_suspend_lowlevel(void) 33int acpi_suspend_lowlevel(void)
35{ 34{
36 struct wakeup_header *header = 35 struct wakeup_header *header;
37 (struct wakeup_header *) __va(real_mode_header->wakeup_header); 36 /* address in low memory of the wakeup routine. */
37 char *acpi_realmode;
38 38
39 acpi_realmode = TRAMPOLINE_SYM(acpi_wakeup_code);
40
41 header = (struct wakeup_header *)(acpi_realmode + WAKEUP_HEADER_OFFSET);
39 if (header->signature != WAKEUP_HEADER_SIGNATURE) { 42 if (header->signature != WAKEUP_HEADER_SIGNATURE) {
40 printk(KERN_ERR "wakeup header does not match\n"); 43 printk(KERN_ERR "wakeup header does not match\n");
41 return -EINVAL; 44 return -EINVAL;
@@ -43,22 +46,38 @@ int acpi_suspend_lowlevel(void)
43 46
44 header->video_mode = saved_video_mode; 47 header->video_mode = saved_video_mode;
45 48
46 header->pmode_behavior = 0; 49 header->wakeup_jmp_seg = acpi_wakeup_address >> 4;
50
51 /*
52 * Set up the wakeup GDT. We set these up as Big Real Mode,
53 * that is, with limits set to 4 GB. At least the Lenovo
54 * Thinkpad X61 is known to need this for the video BIOS
55 * initialization quirk to work; this is likely to also
56 * be the case for other laptops or integrated video devices.
57 */
58
59 /* GDT[0]: GDT self-pointer */
60 header->wakeup_gdt[0] =
61 (u64)(sizeof(header->wakeup_gdt) - 1) +
62 ((u64)__pa(&header->wakeup_gdt) << 16);
63 /* GDT[1]: big real mode-like code segment */
64 header->wakeup_gdt[1] =
65 GDT_ENTRY(0x809b, acpi_wakeup_address, 0xfffff);
66 /* GDT[2]: big real mode-like data segment */
67 header->wakeup_gdt[2] =
68 GDT_ENTRY(0x8093, acpi_wakeup_address, 0xfffff);
47 69
48#ifndef CONFIG_64BIT 70#ifndef CONFIG_64BIT
49 store_gdt((struct desc_ptr *)&header->pmode_gdt); 71 store_gdt((struct desc_ptr *)&header->pmode_gdt);
50 72
51 if (!rdmsr_safe(MSR_EFER, 73 if (rdmsr_safe(MSR_EFER, &header->pmode_efer_low,
52 &header->pmode_efer_low, 74 &header->pmode_efer_high))
53 &header->pmode_efer_high)) 75 header->pmode_efer_low = header->pmode_efer_high = 0;
54 header->pmode_behavior |= (1 << WAKEUP_BEHAVIOR_RESTORE_EFER);
55#endif /* !CONFIG_64BIT */ 76#endif /* !CONFIG_64BIT */
56 77
57 header->pmode_cr0 = read_cr0(); 78 header->pmode_cr0 = read_cr0();
58 if (__this_cpu_read(cpu_info.cpuid_level) >= 0) { 79 header->pmode_cr4 = read_cr4_safe();
59 header->pmode_cr4 = read_cr4(); 80 header->pmode_behavior = 0;
60 header->pmode_behavior |= (1 << WAKEUP_BEHAVIOR_RESTORE_CR4);
61 }
62 if (!rdmsr_safe(MSR_IA32_MISC_ENABLE, 81 if (!rdmsr_safe(MSR_IA32_MISC_ENABLE,
63 &header->pmode_misc_en_low, 82 &header->pmode_misc_en_low,
64 &header->pmode_misc_en_high)) 83 &header->pmode_misc_en_high))
@@ -72,6 +91,7 @@ int acpi_suspend_lowlevel(void)
72 header->pmode_cr3 = (u32)__pa(&initial_page_table); 91 header->pmode_cr3 = (u32)__pa(&initial_page_table);
73 saved_magic = 0x12345678; 92 saved_magic = 0x12345678;
74#else /* CONFIG_64BIT */ 93#else /* CONFIG_64BIT */
94 header->trampoline_segment = trampoline_address() >> 4;
75#ifdef CONFIG_SMP 95#ifdef CONFIG_SMP
76 stack_start = (unsigned long)temp_stack + sizeof(temp_stack); 96 stack_start = (unsigned long)temp_stack + sizeof(temp_stack);
77 early_gdt_descr.address = 97 early_gdt_descr.address =
@@ -101,8 +121,6 @@ static int __init acpi_sleep_setup(char *str)
101#endif 121#endif
102 if (strncmp(str, "nonvs", 5) == 0) 122 if (strncmp(str, "nonvs", 5) == 0)
103 acpi_nvs_nosave(); 123 acpi_nvs_nosave();
104 if (strncmp(str, "nonvs_s3", 8) == 0)
105 acpi_nvs_nosave_s3();
106 if (strncmp(str, "old_ordering", 12) == 0) 124 if (strncmp(str, "old_ordering", 12) == 0)
107 acpi_old_suspend_ordering(); 125 acpi_old_suspend_ordering();
108 str = strchr(str, ','); 126 str = strchr(str, ',');
diff --git a/arch/x86/kernel/acpi/sleep.h b/arch/x86/kernel/acpi/sleep.h
index 67f59f8c695..416d4be13fe 100644
--- a/arch/x86/kernel/acpi/sleep.h
+++ b/arch/x86/kernel/acpi/sleep.h
@@ -2,15 +2,13 @@
2 * Variables and functions used by the code in sleep.c 2 * Variables and functions used by the code in sleep.c
3 */ 3 */
4 4
5#include <asm/realmode.h> 5#include <asm/trampoline.h>
6 6
7extern unsigned long saved_video_mode; 7extern unsigned long saved_video_mode;
8extern long saved_magic; 8extern long saved_magic;
9 9
10extern int wakeup_pmode_return; 10extern int wakeup_pmode_return;
11 11
12extern u8 wake_sleep_flags;
13
14extern unsigned long acpi_copy_wakeup_routine(unsigned long); 12extern unsigned long acpi_copy_wakeup_routine(unsigned long);
15extern void wakeup_long64(void); 13extern void wakeup_long64(void);
16 14