aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/acpi
diff options
context:
space:
mode:
authorYinghai Lu <yinghai@kernel.org>2009-05-06 13:06:15 -0400
committerIngo Molnar <mingo@elte.hu>2009-05-11 04:35:08 -0400
commita31f82057ce6f7ced578d64c07a72ccbdc7336e4 (patch)
tree0dbe94d15a6a32640b0f86094d3ecf2b60b43f73 /arch/x86/kernel/acpi
parentee214558c2e959781a406e76c5b34364da638e1d (diff)
x86/acpi: call mp_config_acpi_gsi() in mp_register_gsi()
The patch to call mp_config_acpi_gsi() from the ACPI IRQ registration code never got mainline because there were open discussions about it. This call is needed to properly update the kernel's copy of the mptable, when the update_mptable boot parameter is needed. Now that the dust has settled with the APIC unification, and since there were no objections when the patch was re-submitted, try this again. [ Impact: fix the update_mptable boot parameter ] Signed-off-by: Yinghai Lu <yinghai@kernel.org> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Jesse Barnes <jbarnes@virtuousgeek.org> Cc: Len Brown <lenb@kernel.org> LKML-Reference: <4A01C387.7090103@kernel.org> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/kernel/acpi')
-rw-r--r--arch/x86/kernel/acpi/boot.c66
1 files changed, 40 insertions, 26 deletions
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
index fb5e88262d2..8019ecf66e9 100644
--- a/arch/x86/kernel/acpi/boot.c
+++ b/arch/x86/kernel/acpi/boot.c
@@ -33,6 +33,7 @@
33#include <linux/irq.h> 33#include <linux/irq.h>
34#include <linux/bootmem.h> 34#include <linux/bootmem.h>
35#include <linux/ioport.h> 35#include <linux/ioport.h>
36#include <linux/pci.h>
36 37
37#include <asm/pgtable.h> 38#include <asm/pgtable.h>
38#include <asm/io_apic.h> 39#include <asm/io_apic.h>
@@ -1158,6 +1159,44 @@ void __init mp_config_acpi_legacy_irqs(void)
1158 } 1159 }
1159} 1160}
1160 1161
1162static int mp_config_acpi_gsi(struct device *dev, u32 gsi, int triggering,
1163 int polarity)
1164{
1165#ifdef CONFIG_X86_MPPARSE
1166 struct mpc_intsrc mp_irq;
1167 struct pci_dev *pdev;
1168 unsigned char number;
1169 unsigned int devfn;
1170 int ioapic;
1171 u8 pin;
1172
1173 if (!acpi_ioapic)
1174 return 0;
1175 if (!dev)
1176 return 0;
1177 if (dev->bus != &pci_bus_type)
1178 return 0;
1179
1180 pdev = to_pci_dev(dev);
1181 number = pdev->bus->number;
1182 devfn = pdev->devfn;
1183 pin = pdev->pin;
1184 /* print the entry should happen on mptable identically */
1185 mp_irq.type = MP_INTSRC;
1186 mp_irq.irqtype = mp_INT;
1187 mp_irq.irqflag = (triggering == ACPI_EDGE_SENSITIVE ? 4 : 0x0c) |
1188 (polarity == ACPI_ACTIVE_HIGH ? 1 : 3);
1189 mp_irq.srcbus = number;
1190 mp_irq.srcbusirq = (((devfn >> 3) & 0x1f) << 2) | ((pin - 1) & 3);
1191 ioapic = mp_find_ioapic(gsi);
1192 mp_irq.dstapic = mp_ioapic_routing[ioapic].apic_id;
1193 mp_irq.dstirq = mp_find_ioapic_pin(ioapic, gsi);
1194
1195 save_mp_irq(&mp_irq);
1196#endif
1197 return 0;
1198}
1199
1161int mp_register_gsi(struct device *dev, u32 gsi, int triggering, int polarity) 1200int mp_register_gsi(struct device *dev, u32 gsi, int triggering, int polarity)
1162{ 1201{
1163 int ioapic; 1202 int ioapic;
@@ -1189,6 +1228,7 @@ int mp_register_gsi(struct device *dev, u32 gsi, int triggering, int polarity)
1189 ioapic_pin); 1228 ioapic_pin);
1190 return gsi; 1229 return gsi;
1191 } 1230 }
1231 mp_config_acpi_gsi(dev, gsi, triggering, polarity);
1192 1232
1193 /* 1233 /*
1194 * Avoid pin reprogramming. PRTs typically include entries 1234 * Avoid pin reprogramming. PRTs typically include entries
@@ -1208,32 +1248,6 @@ int mp_register_gsi(struct device *dev, u32 gsi, int triggering, int polarity)
1208 return gsi; 1248 return gsi;
1209} 1249}
1210 1250
1211int mp_config_acpi_gsi(unsigned char number, unsigned int devfn, u8 pin,
1212 u32 gsi, int triggering, int polarity)
1213{
1214#ifdef CONFIG_X86_MPPARSE
1215 struct mpc_intsrc mp_irq;
1216 int ioapic;
1217
1218 if (!acpi_ioapic)
1219 return 0;
1220
1221 /* print the entry should happen on mptable identically */
1222 mp_irq.type = MP_INTSRC;
1223 mp_irq.irqtype = mp_INT;
1224 mp_irq.irqflag = (triggering == ACPI_EDGE_SENSITIVE ? 4 : 0x0c) |
1225 (polarity == ACPI_ACTIVE_HIGH ? 1 : 3);
1226 mp_irq.srcbus = number;
1227 mp_irq.srcbusirq = (((devfn >> 3) & 0x1f) << 2) | ((pin - 1) & 3);
1228 ioapic = mp_find_ioapic(gsi);
1229 mp_irq.dstapic = mp_ioapic_routing[ioapic].apic_id;
1230 mp_irq.dstirq = mp_find_ioapic_pin(ioapic, gsi);
1231
1232 save_mp_irq(&mp_irq);
1233#endif
1234 return 0;
1235}
1236
1237/* 1251/*
1238 * Parse IOAPIC related entries in MADT 1252 * Parse IOAPIC related entries in MADT
1239 * returns 0 on success, < 0 on error 1253 * returns 0 on success, < 0 on error