aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2014-03-21 11:53:28 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2014-03-21 11:53:28 -0400
commit884411d9a580814910bc21dc08e2495efc4b1491 (patch)
tree2201bf0c3d2b14f7e6505001300604e6a0164b5c
parent5a2d853ffcf961d6b7d491858946878676aeae3e (diff)
parent38953d3945aedf8e198b75ff09b22e369f14566f (diff)
Merge branch 'acpi-processor'
* acpi-processor: ACPI: Move BAD_MADT_ENTRY() to linux/acpi.h ACPI / processor: Make it possible to get APIC ID via GIC ACPI / processor: Build idle_boot_override on x86 and ia64 ACPI / processor: Use ACPI_PROCESSOR_DEVICE_HID instead of "ACPI0007" ACPI / processor: Fix acpi_processor_eval_pdc() return value type
-rw-r--r--arch/ia64/kernel/acpi.c4
-rw-r--r--arch/x86/kernel/acpi/boot.c4
-rw-r--r--drivers/acpi/processor_core.c78
-rw-r--r--include/linux/acpi.h4
4 files changed, 61 insertions, 29 deletions
diff --git a/arch/ia64/kernel/acpi.c b/arch/ia64/kernel/acpi.c
index 07d209c9507f..467497ade45f 100644
--- a/arch/ia64/kernel/acpi.c
+++ b/arch/ia64/kernel/acpi.c
@@ -54,10 +54,6 @@
54#include <asm/sal.h> 54#include <asm/sal.h>
55#include <asm/cyclone.h> 55#include <asm/cyclone.h>
56 56
57#define BAD_MADT_ENTRY(entry, end) ( \
58 (!entry) || (unsigned long)entry + sizeof(*entry) > end || \
59 ((struct acpi_subtable_header *)entry)->length < sizeof(*entry))
60
61#define PREFIX "ACPI: " 57#define PREFIX "ACPI: "
62 58
63unsigned int acpi_cpei_override; 59unsigned int acpi_cpei_override;
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
index 1dac94265b59..123f9e37eee4 100644
--- a/arch/x86/kernel/acpi/boot.c
+++ b/arch/x86/kernel/acpi/boot.c
@@ -53,10 +53,6 @@ EXPORT_SYMBOL(acpi_disabled);
53# include <asm/proto.h> 53# include <asm/proto.h>
54#endif /* X86 */ 54#endif /* X86 */
55 55
56#define BAD_MADT_ENTRY(entry, end) ( \
57 (!entry) || (unsigned long)entry + sizeof(*entry) > end || \
58 ((struct acpi_subtable_header *)entry)->length < sizeof(*entry))
59
60#define PREFIX "ACPI: " 56#define PREFIX "ACPI: "
61 57
62int acpi_noirq; /* skip ACPI IRQ initialization */ 58int acpi_noirq; /* skip ACPI IRQ initialization */
diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c
index 57e0769656c6..86d73d5d503f 100644
--- a/drivers/acpi/processor_core.c
+++ b/drivers/acpi/processor_core.c
@@ -18,24 +18,6 @@
18#define _COMPONENT ACPI_PROCESSOR_COMPONENT 18#define _COMPONENT ACPI_PROCESSOR_COMPONENT
19ACPI_MODULE_NAME("processor_core"); 19ACPI_MODULE_NAME("processor_core");
20 20
21static int __init set_no_mwait(const struct dmi_system_id *id)
22{
23 printk(KERN_NOTICE PREFIX "%s detected - "
24 "disabling mwait for CPU C-states\n", id->ident);
25 boot_option_idle_override = IDLE_NOMWAIT;
26 return 0;
27}
28
29static struct dmi_system_id processor_idle_dmi_table[] __initdata = {
30 {
31 set_no_mwait, "Extensa 5220", {
32 DMI_MATCH(DMI_BIOS_VENDOR, "Phoenix Technologies LTD"),
33 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
34 DMI_MATCH(DMI_PRODUCT_VERSION, "0100"),
35 DMI_MATCH(DMI_BOARD_NAME, "Columbia") }, NULL},
36 {},
37};
38
39static int map_lapic_id(struct acpi_subtable_header *entry, 21static int map_lapic_id(struct acpi_subtable_header *entry,
40 u32 acpi_id, int *apic_id) 22 u32 acpi_id, int *apic_id)
41{ 23{
@@ -88,6 +70,28 @@ static int map_lsapic_id(struct acpi_subtable_header *entry,
88 return 0; 70 return 0;
89} 71}
90 72
73static int map_gic_id(struct acpi_subtable_header *entry,
74 int device_declaration, u32 acpi_id, int *apic_id)
75{
76 struct acpi_madt_generic_interrupt *gic =
77 (struct acpi_madt_generic_interrupt *)entry;
78
79 if (!(gic->flags & ACPI_MADT_ENABLED))
80 return -ENODEV;
81
82 /*
83 * In the GIC interrupt model, logical processors are
84 * required to have a Processor Device object in the DSDT,
85 * so we should check device_declaration here
86 */
87 if (device_declaration && (gic->uid == acpi_id)) {
88 *apic_id = gic->gic_id;
89 return 0;
90 }
91
92 return -EINVAL;
93}
94
91static int map_madt_entry(int type, u32 acpi_id) 95static int map_madt_entry(int type, u32 acpi_id)
92{ 96{
93 unsigned long madt_end, entry; 97 unsigned long madt_end, entry;
@@ -123,6 +127,9 @@ static int map_madt_entry(int type, u32 acpi_id)
123 } else if (header->type == ACPI_MADT_TYPE_LOCAL_SAPIC) { 127 } else if (header->type == ACPI_MADT_TYPE_LOCAL_SAPIC) {
124 if (!map_lsapic_id(header, type, acpi_id, &apic_id)) 128 if (!map_lsapic_id(header, type, acpi_id, &apic_id))
125 break; 129 break;
130 } else if (header->type == ACPI_MADT_TYPE_GENERIC_INTERRUPT) {
131 if (!map_gic_id(header, type, acpi_id, &apic_id))
132 break;
126 } 133 }
127 entry += header->length; 134 entry += header->length;
128 } 135 }
@@ -153,6 +160,8 @@ static int map_mat_entry(acpi_handle handle, int type, u32 acpi_id)
153 map_lapic_id(header, acpi_id, &apic_id); 160 map_lapic_id(header, acpi_id, &apic_id);
154 } else if (header->type == ACPI_MADT_TYPE_LOCAL_SAPIC) { 161 } else if (header->type == ACPI_MADT_TYPE_LOCAL_SAPIC) {
155 map_lsapic_id(header, type, acpi_id, &apic_id); 162 map_lsapic_id(header, type, acpi_id, &apic_id);
163 } else if (header->type == ACPI_MADT_TYPE_GENERIC_INTERRUPT) {
164 map_gic_id(header, type, acpi_id, &apic_id);
156 } 165 }
157 166
158exit: 167exit:
@@ -322,7 +331,7 @@ static struct acpi_object_list *acpi_processor_alloc_pdc(void)
322 * _PDC is required for a BIOS-OS handshake for most of the newer 331 * _PDC is required for a BIOS-OS handshake for most of the newer
323 * ACPI processor features. 332 * ACPI processor features.
324 */ 333 */
325static int 334static acpi_status
326acpi_processor_eval_pdc(acpi_handle handle, struct acpi_object_list *pdc_in) 335acpi_processor_eval_pdc(acpi_handle handle, struct acpi_object_list *pdc_in)
327{ 336{
328 acpi_status status = AE_OK; 337 acpi_status status = AE_OK;
@@ -378,16 +387,43 @@ early_init_pdc(acpi_handle handle, u32 lvl, void *context, void **rv)
378 return AE_OK; 387 return AE_OK;
379} 388}
380 389
381void __init acpi_early_processor_set_pdc(void) 390#if defined(CONFIG_X86) || defined(CONFIG_IA64)
391static int __init set_no_mwait(const struct dmi_system_id *id)
392{
393 pr_notice(PREFIX "%s detected - disabling mwait for CPU C-states\n",
394 id->ident);
395 boot_option_idle_override = IDLE_NOMWAIT;
396 return 0;
397}
398
399static struct dmi_system_id processor_idle_dmi_table[] __initdata = {
400 {
401 set_no_mwait, "Extensa 5220", {
402 DMI_MATCH(DMI_BIOS_VENDOR, "Phoenix Technologies LTD"),
403 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
404 DMI_MATCH(DMI_PRODUCT_VERSION, "0100"),
405 DMI_MATCH(DMI_BOARD_NAME, "Columbia") }, NULL},
406 {},
407};
408
409static void __init processor_dmi_check(void)
382{ 410{
383 /* 411 /*
384 * Check whether the system is DMI table. If yes, OSPM 412 * Check whether the system is DMI table. If yes, OSPM
385 * should not use mwait for CPU-states. 413 * should not use mwait for CPU-states.
386 */ 414 */
387 dmi_check_system(processor_idle_dmi_table); 415 dmi_check_system(processor_idle_dmi_table);
416}
417#else
418static inline void processor_dmi_check(void) {}
419#endif
420
421void __init acpi_early_processor_set_pdc(void)
422{
423 processor_dmi_check();
388 424
389 acpi_walk_namespace(ACPI_TYPE_PROCESSOR, ACPI_ROOT_OBJECT, 425 acpi_walk_namespace(ACPI_TYPE_PROCESSOR, ACPI_ROOT_OBJECT,
390 ACPI_UINT32_MAX, 426 ACPI_UINT32_MAX,
391 early_init_pdc, NULL, NULL, NULL); 427 early_init_pdc, NULL, NULL, NULL);
392 acpi_get_devices("ACPI0007", early_init_pdc, NULL, NULL); 428 acpi_get_devices(ACPI_PROCESSOR_DEVICE_HID, early_init_pdc, NULL, NULL);
393} 429}
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 1151a1dcfe41..6a15dddbaa09 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -108,6 +108,10 @@ static inline void acpi_initrd_override(void *data, size_t size)
108} 108}
109#endif 109#endif
110 110
111#define BAD_MADT_ENTRY(entry, end) ( \
112 (!entry) || (unsigned long)entry + sizeof(*entry) > end || \
113 ((struct acpi_subtable_header *)entry)->length < sizeof(*entry))
114
111char * __acpi_map_table (unsigned long phys_addr, unsigned long size); 115char * __acpi_map_table (unsigned long phys_addr, unsigned long size);
112void __acpi_unmap_table(char *map, unsigned long size); 116void __acpi_unmap_table(char *map, unsigned long size);
113int early_acpi_boot_init(void); 117int early_acpi_boot_init(void);