27 #include <linux/kernel.h>
29 #include <linux/string.h>
30 #include <linux/types.h>
32 #include <linux/errno.h>
36 #define PREFIX "ACPI: "
38 #define ACPI_MAX_TABLES 128
40 static char *mps_inti_flags_polarity[] = {
"dfl",
"high",
"res",
"low" };
41 static char *mps_inti_flags_trigger[] = {
"dfl",
"edge",
"res",
"level" };
52 switch (header->
type) {
59 "LAPIC (acpi_id[0x%02x] lapic_id[0x%02x] %s)\n",
70 "X2APIC (apic_id[0x%02x] uid[0x%02x] %s)\n",
73 "enabled" :
"disabled");
82 "IOAPIC (id[0x%02x] address[0x%08x] gsi_base[%d])\n",
92 "INT_SRC_OVR (bus %d bus_irq %d global_irq %d %s %s)\n",
99 "INT_SRC_OVR unexpected reserved flags: 0x%x\n",
111 "NMI_SRC (%s %s global_irq %d)\n",
123 "LAPIC_NMI (acpi_id[0x%02x] %s %s lint[0x%x])\n",
141 "X2APIC_NMI (uid[0x%02x] %s %s lint[0x%x])\n",
143 mps_inti_flags_polarity[polarity],
144 mps_inti_flags_trigger[trigger],
154 "LAPIC_ADDR_OVR (address[%p])\n",
155 (
void *)(
unsigned long)p->
address);
164 "IOSAPIC (id[0x%x] address[%p] gsi_base[%d])\n",
165 p->
id, (
void *)(
unsigned long)p->
address,
175 "LSAPIC (acpi_id[0x%02x] lsapic_id[0x%02x] lsapic_eid[0x%02x] %s)\n",
186 "PLAT_INT_SRC (%s %s type[0x%x] id[0x%04x] eid[0x%x] iosapic_vector[0x%x] global_irq[0x%x]\n",
196 "Found unsupported MADT entry (type = 0x%x)\n",
205 unsigned long table_size,
207 acpi_table_entry_handler handler,
212 unsigned int count = 0;
213 unsigned long table_end;
232 table_end = (
unsigned long)table_header + table_header->
length;
237 ((
unsigned long)table_header + table_size);
241 if (entry->
type == entry_id
242 && (!max_entries || count++ < max_entries))
243 if (handler(entry, table_end))
251 pr_err(
PREFIX "[%4.4s:0x%02x] Invalid zero length\n",
id, entry_id);
256 ((
unsigned long)entry + entry->
length);
258 if (max_entries && count > max_entries) {
260 "%i found\n",
id, entry_id, count - max_entries, count);
272 acpi_table_entry_handler handler,
unsigned int max_entries)
276 handler, max_entries);
317 static void __init check_multiple_madt(
void)
325 "BIOS bug: multiple APIC/MADT found,"
326 " using %d\n", acpi_apic_instance);
328 "If \"acpi_apic_instance=%d\" works better, "
330 acpi_apic_instance ? 0 : 2);
334 acpi_apic_instance = 0;
356 check_multiple_madt();
360 static int __init acpi_parse_apic_instance(
char *
str)
373 early_param(
"acpi_apic_instance", acpi_parse_apic_instance);