diff options
author | Yinghai Lu <yinghai@kernel.org> | 2009-05-06 13:07:41 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-05-11 04:35:08 -0400 |
commit | bdfe8ac153546537ed24de69610ea781a734f785 (patch) | |
tree | cad38765f6c27fe26408a536f2bcb596641e8c0c /arch | |
parent | a31f82057ce6f7ced578d64c07a72ccbdc7336e4 (diff) |
x86/acpi: move pin_programmed bit map to io_apic.c
Prepare to call setup_io_apic_routing() in pcibios_irq_enable()
also remove not needed member apic_id.
[ Impact: clean up, prepare for future change ]
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: <4A01C3DD.3050104@kernel.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/x86/kernel/acpi/boot.c | 18 | ||||
-rw-r--r-- | arch/x86/kernel/apic/io_apic.c | 25 |
2 files changed, 26 insertions, 17 deletions
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c index 8019ecf66e95..dcfbc3ab9e46 100644 --- a/arch/x86/kernel/acpi/boot.c +++ b/arch/x86/kernel/acpi/boot.c | |||
@@ -904,10 +904,8 @@ extern int es7000_plat; | |||
904 | #endif | 904 | #endif |
905 | 905 | ||
906 | static struct { | 906 | static struct { |
907 | int apic_id; | ||
908 | int gsi_base; | 907 | int gsi_base; |
909 | int gsi_end; | 908 | int gsi_end; |
910 | DECLARE_BITMAP(pin_programmed, MP_MAX_IOAPIC_PIN + 1); | ||
911 | } mp_ioapic_routing[MAX_IO_APICS]; | 909 | } mp_ioapic_routing[MAX_IO_APICS]; |
912 | 910 | ||
913 | int mp_find_ioapic(int gsi) | 911 | int mp_find_ioapic(int gsi) |
@@ -996,7 +994,6 @@ void __init mp_register_ioapic(int id, u32 address, u32 gsi_base) | |||
996 | * Build basic GSI lookup table to facilitate gsi->io_apic lookups | 994 | * Build basic GSI lookup table to facilitate gsi->io_apic lookups |
997 | * and to prevent reprogramming of IOAPIC pins (PCI GSIs). | 995 | * and to prevent reprogramming of IOAPIC pins (PCI GSIs). |
998 | */ | 996 | */ |
999 | mp_ioapic_routing[idx].apic_id = mp_ioapics[idx].apicid; | ||
1000 | mp_ioapic_routing[idx].gsi_base = gsi_base; | 997 | mp_ioapic_routing[idx].gsi_base = gsi_base; |
1001 | mp_ioapic_routing[idx].gsi_end = gsi_base + | 998 | mp_ioapic_routing[idx].gsi_end = gsi_base + |
1002 | io_apic_get_redir_entries(idx); | 999 | io_apic_get_redir_entries(idx); |
@@ -1189,7 +1186,7 @@ static int mp_config_acpi_gsi(struct device *dev, u32 gsi, int triggering, | |||
1189 | mp_irq.srcbus = number; | 1186 | mp_irq.srcbus = number; |
1190 | mp_irq.srcbusirq = (((devfn >> 3) & 0x1f) << 2) | ((pin - 1) & 3); | 1187 | mp_irq.srcbusirq = (((devfn >> 3) & 0x1f) << 2) | ((pin - 1) & 3); |
1191 | ioapic = mp_find_ioapic(gsi); | 1188 | ioapic = mp_find_ioapic(gsi); |
1192 | mp_irq.dstapic = mp_ioapic_routing[ioapic].apic_id; | 1189 | mp_irq.dstapic = mp_ioapics[ioapic].apicid; |
1193 | mp_irq.dstirq = mp_find_ioapic_pin(ioapic, gsi); | 1190 | mp_irq.dstirq = mp_find_ioapic_pin(ioapic, gsi); |
1194 | 1191 | ||
1195 | save_mp_irq(&mp_irq); | 1192 | save_mp_irq(&mp_irq); |
@@ -1224,23 +1221,12 @@ int mp_register_gsi(struct device *dev, u32 gsi, int triggering, int polarity) | |||
1224 | 1221 | ||
1225 | if (ioapic_pin > MP_MAX_IOAPIC_PIN) { | 1222 | if (ioapic_pin > MP_MAX_IOAPIC_PIN) { |
1226 | printk(KERN_ERR "Invalid reference to IOAPIC pin " | 1223 | printk(KERN_ERR "Invalid reference to IOAPIC pin " |
1227 | "%d-%d\n", mp_ioapic_routing[ioapic].apic_id, | 1224 | "%d-%d\n", mp_ioapics[ioapic].apicid, |
1228 | ioapic_pin); | 1225 | ioapic_pin); |
1229 | return gsi; | 1226 | return gsi; |
1230 | } | 1227 | } |
1231 | mp_config_acpi_gsi(dev, gsi, triggering, polarity); | 1228 | mp_config_acpi_gsi(dev, gsi, triggering, polarity); |
1232 | 1229 | ||
1233 | /* | ||
1234 | * Avoid pin reprogramming. PRTs typically include entries | ||
1235 | * with redundant pin->gsi mappings (but unique PCI devices); | ||
1236 | * we only program the IOAPIC on the first. | ||
1237 | */ | ||
1238 | if (test_bit(ioapic_pin, mp_ioapic_routing[ioapic].pin_programmed)) { | ||
1239 | pr_debug("Pin %d-%d already programmed\n", | ||
1240 | mp_ioapic_routing[ioapic].apic_id, ioapic_pin); | ||
1241 | return gsi; | ||
1242 | } | ||
1243 | set_bit(ioapic_pin, mp_ioapic_routing[ioapic].pin_programmed); | ||
1244 | io_apic_set_pci_routing(dev, ioapic, ioapic_pin, gsi, | 1230 | io_apic_set_pci_routing(dev, ioapic, ioapic_pin, gsi, |
1245 | triggering == ACPI_EDGE_SENSITIVE ? 0 : 1, | 1231 | triggering == ACPI_EDGE_SENSITIVE ? 0 : 1, |
1246 | polarity == ACPI_ACTIVE_HIGH ? 0 : 1); | 1232 | polarity == ACPI_ACTIVE_HIGH ? 0 : 1); |
diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c index 21c30e1121ee..e279ae339285 100644 --- a/arch/x86/kernel/apic/io_apic.c +++ b/arch/x86/kernel/apic/io_apic.c | |||
@@ -3922,7 +3922,7 @@ int __init io_apic_get_version(int ioapic) | |||
3922 | } | 3922 | } |
3923 | #endif | 3923 | #endif |
3924 | 3924 | ||
3925 | int io_apic_set_pci_routing(struct device *dev, int ioapic, int pin, int irq, | 3925 | static int __io_apic_set_pci_routing(struct device *dev, int ioapic, int pin, int irq, |
3926 | int triggering, int polarity) | 3926 | int triggering, int polarity) |
3927 | { | 3927 | { |
3928 | struct irq_desc *desc; | 3928 | struct irq_desc *desc; |
@@ -3959,6 +3959,29 @@ int io_apic_set_pci_routing(struct device *dev, int ioapic, int pin, int irq, | |||
3959 | return 0; | 3959 | return 0; |
3960 | } | 3960 | } |
3961 | 3961 | ||
3962 | static struct { | ||
3963 | DECLARE_BITMAP(pin_programmed, MP_MAX_IOAPIC_PIN + 1); | ||
3964 | } mp_ioapic_routing[MAX_IO_APICS]; | ||
3965 | |||
3966 | int io_apic_set_pci_routing(struct device *dev, int ioapic, int pin, int irq, | ||
3967 | int triggering, int polarity) | ||
3968 | { | ||
3969 | |||
3970 | /* | ||
3971 | * Avoid pin reprogramming. PRTs typically include entries | ||
3972 | * with redundant pin->gsi mappings (but unique PCI devices); | ||
3973 | * we only program the IOAPIC on the first. | ||
3974 | */ | ||
3975 | if (test_bit(pin, mp_ioapic_routing[ioapic].pin_programmed)) { | ||
3976 | pr_debug("Pin %d-%d already programmed\n", | ||
3977 | mp_ioapics[ioapic].apicid, pin); | ||
3978 | return 0; | ||
3979 | } | ||
3980 | set_bit(pin, mp_ioapic_routing[ioapic].pin_programmed); | ||
3981 | |||
3982 | return __io_apic_set_pci_routing(dev, ioapic, pin, irq, | ||
3983 | triggering, polarity); | ||
3984 | } | ||
3962 | 3985 | ||
3963 | int acpi_get_override_irq(int bus_irq, int *trigger, int *polarity) | 3986 | int acpi_get_override_irq(int bus_irq, int *trigger, int *polarity) |
3964 | { | 3987 | { |