aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLen Brown <len.brown@intel.com>2007-03-11 03:26:14 -0400
committerLen Brown <len.brown@intel.com>2007-03-11 03:30:13 -0400
commita1fdcc0d2714b6622e3fd5c00db1635213d6c41a (patch)
treebf1176f07ff83eebb41d1a292a62124680b81949
parentbe521466feb3bb1cd89de82a2b1d080e9ebd3cb6 (diff)
ACPI: Add support to parse 2nd MADT
When a BIOS bug presents multiple APIC/MADTs, Linux currently uses the 1st and ignores the 2nd. But some machines work better if we use the 2nd. http://bugzilla.kernel.org/show_bug.cgi?id=7465 Add a warning and boot parameter "acpi_apic_instance=2" to allow parsing the 2nd. No change to default behaviour in this patch. Signed-off-by: Len Brown <len.brown@intel.com>
-rw-r--r--Documentation/kernel-parameters.txt6
-rw-r--r--drivers/acpi/tables.c57
2 files changed, 58 insertions, 5 deletions
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index 856c8b114e71..22c6b8ccaea5 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -138,6 +138,12 @@ and is between 256 and 4096 characters. It is defined in the file
138 138
139 See also Documentation/pm.txt, pci=noacpi 139 See also Documentation/pm.txt, pci=noacpi
140 140
141 acpi_apic_instance= [ACPI, IOAPIC]
142 Format: <int>
143 2: use 2nd APIC table, if available
144 1,0: use 1st APIC table
145 default: 0
146
141 acpi_sleep= [HW,ACPI] Sleep options 147 acpi_sleep= [HW,ACPI] Sleep options
142 Format: { s3_bios, s3_mode } 148 Format: { s3_bios, s3_mode }
143 See Documentation/power/video.txt 149 See Documentation/power/video.txt
diff --git a/drivers/acpi/tables.c b/drivers/acpi/tables.c
index 849e2c361804..c3419182c9a7 100644
--- a/drivers/acpi/tables.c
+++ b/drivers/acpi/tables.c
@@ -42,7 +42,9 @@ static char *mps_inti_flags_trigger[] = { "dfl", "edge", "res", "level" };
42 42
43static struct acpi_table_desc initial_tables[ACPI_MAX_TABLES] __initdata; 43static struct acpi_table_desc initial_tables[ACPI_MAX_TABLES] __initdata;
44 44
45void acpi_table_print_madt_entry(struct acpi_subtable_header * header) 45static int acpi_apic_instance __initdata;
46
47void acpi_table_print_madt_entry(struct acpi_subtable_header *header)
46{ 48{
47 if (!header) 49 if (!header)
48 return; 50 return;
@@ -183,8 +185,10 @@ acpi_table_parse_entries(char *id,
183 if (!handler) 185 if (!handler)
184 return -EINVAL; 186 return -EINVAL;
185 187
186 /* Locate the table (if exists). There should only be one. */ 188 if (strncmp(id, ACPI_SIG_MADT, 4) == 0)
187 acpi_get_table(id, 0, &table_header); 189 acpi_get_table(id, acpi_apic_instance, &table_header);
190 else
191 acpi_get_table(id, 0, &table_header);
188 192
189 if (!table_header) { 193 if (!table_header) {
190 printk(KERN_WARNING PREFIX "%4.4s not present\n", id); 194 printk(KERN_WARNING PREFIX "%4.4s not present\n", id);
@@ -237,10 +241,15 @@ acpi_table_parse_madt(enum acpi_madt_type id,
237int __init acpi_table_parse(char *id, acpi_table_handler handler) 241int __init acpi_table_parse(char *id, acpi_table_handler handler)
238{ 242{
239 struct acpi_table_header *table = NULL; 243 struct acpi_table_header *table = NULL;
244
240 if (!handler) 245 if (!handler)
241 return -EINVAL; 246 return -EINVAL;
242 247
243 acpi_get_table(id, 0, &table); 248 if (strncmp(id, ACPI_SIG_MADT, 4) == 0)
249 acpi_get_table(id, acpi_apic_instance, &table);
250 else
251 acpi_get_table(id, 0, &table);
252
244 if (table) { 253 if (table) {
245 handler(table); 254 handler(table);
246 return 0; 255 return 0;
@@ -248,6 +257,31 @@ int __init acpi_table_parse(char *id, acpi_table_handler handler)
248 return 1; 257 return 1;
249} 258}
250 259
260/*
261 * The BIOS is supposed to supply a single APIC/MADT,
262 * but some report two. Provide a knob to use either.
263 * (don't you wish instance 0 and 1 were not the same?)
264 */
265static void __init check_multiple_madt(void)
266{
267 struct acpi_table_header *table = NULL;
268
269 acpi_get_table(ACPI_SIG_MADT, 2, &table);
270 if (table) {
271 printk(KERN_WARNING PREFIX
272 "BIOS bug: multiple APIC/MADT found,"
273 " using %d\n", acpi_apic_instance);
274 printk(KERN_WARNING PREFIX
275 "If \"acpi_apic_instance=%d\" works better, "
276 "notify linux-acpi@vger.kernel.org\n",
277 acpi_apic_instance ? 0 : 2);
278
279 } else
280 acpi_apic_instance = 0;
281
282 return;
283}
284
251/* 285/*
252 * acpi_table_init() 286 * acpi_table_init()
253 * 287 *
@@ -257,9 +291,22 @@ int __init acpi_table_parse(char *id, acpi_table_handler handler)
257 * result: sdt_entry[] is initialized 291 * result: sdt_entry[] is initialized
258 */ 292 */
259 293
260
261int __init acpi_table_init(void) 294int __init acpi_table_init(void)
262{ 295{
263 acpi_initialize_tables(initial_tables, ACPI_MAX_TABLES, 0); 296 acpi_initialize_tables(initial_tables, ACPI_MAX_TABLES, 0);
297 check_multiple_madt();
298 return 0;
299}
300
301static int __init acpi_parse_apic_instance(char *str)
302{
303
304 acpi_apic_instance = simple_strtoul(str, NULL, 0);
305
306 printk(KERN_NOTICE PREFIX "Shall use APIC/MADT table %d\n",
307 acpi_apic_instance);
308
264 return 0; 309 return 0;
265} 310}
311
312early_param("acpi_apic_instance", acpi_parse_apic_instance);