aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/apic
diff options
context:
space:
mode:
authorYinghai Lu <yinghai@kernel.org>2009-05-06 13:08:50 -0400
committerIngo Molnar <mingo@elte.hu>2009-05-11 04:35:09 -0400
commit5ef2183768bb7d64b85eccbfa1537a61cbefa97c (patch)
treeb2fc0ccee203c8690660eab9ee5f45d7857a93d5 /arch/x86/kernel/apic
parente20c06fd6950265a899edd96a02dc2e6ae2d1ce5 (diff)
x86/acpi: move setup io apic routing out of CONFIG_ACPI scope
So we could set io apic routing when ACPI is not enabled. [ Impact: prepare for new functionality ] 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: <4A01C422.5070400@kernel.org> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/kernel/apic')
-rw-r--r--arch/x86/kernel/apic/io_apic.c122
1 files changed, 61 insertions, 61 deletions
diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
index caf9dbdde050..3a68daee0d99 100644
--- a/arch/x86/kernel/apic/io_apic.c
+++ b/arch/x86/kernel/apic/io_apic.c
@@ -3839,6 +3839,67 @@ int __init arch_probe_nr_irqs(void)
3839} 3839}
3840#endif 3840#endif
3841 3841
3842static int __io_apic_set_pci_routing(struct device *dev, int ioapic, int pin, int irq,
3843 int triggering, int polarity)
3844{
3845 struct irq_desc *desc;
3846 struct irq_cfg *cfg;
3847 int node;
3848
3849 if (!IO_APIC_IRQ(irq)) {
3850 apic_printk(APIC_QUIET,KERN_ERR "IOAPIC[%d]: Invalid reference to IRQ 0\n",
3851 ioapic);
3852 return -EINVAL;
3853 }
3854
3855 if (dev)
3856 node = dev_to_node(dev);
3857 else
3858 node = cpu_to_node(boot_cpu_id);
3859
3860 desc = irq_to_desc_alloc_node(irq, node);
3861 if (!desc) {
3862 printk(KERN_INFO "can not get irq_desc %d\n", irq);
3863 return 0;
3864 }
3865
3866 /*
3867 * IRQs < 16 are already in the irq_2_pin[] map
3868 */
3869 if (irq >= NR_IRQS_LEGACY) {
3870 cfg = desc->chip_data;
3871 add_pin_to_irq_node(cfg, node, ioapic, pin);
3872 }
3873
3874 setup_IO_APIC_irq(ioapic, pin, irq, desc, triggering, polarity);
3875
3876 return 0;
3877}
3878
3879static struct {
3880 DECLARE_BITMAP(pin_programmed, MP_MAX_IOAPIC_PIN + 1);
3881} mp_ioapic_routing[MAX_IO_APICS];
3882
3883int io_apic_set_pci_routing(struct device *dev, int ioapic, int pin, int irq,
3884 int triggering, int polarity)
3885{
3886
3887 /*
3888 * Avoid pin reprogramming. PRTs typically include entries
3889 * with redundant pin->gsi mappings (but unique PCI devices);
3890 * we only program the IOAPIC on the first.
3891 */
3892 if (test_bit(pin, mp_ioapic_routing[ioapic].pin_programmed)) {
3893 pr_debug("Pin %d-%d already programmed\n",
3894 mp_ioapics[ioapic].apicid, pin);
3895 return 0;
3896 }
3897 set_bit(pin, mp_ioapic_routing[ioapic].pin_programmed);
3898
3899 return __io_apic_set_pci_routing(dev, ioapic, pin, irq,
3900 triggering, polarity);
3901}
3902
3842/* -------------------------------------------------------------------------- 3903/* --------------------------------------------------------------------------
3843 ACPI-based IOAPIC Configuration 3904 ACPI-based IOAPIC Configuration
3844 -------------------------------------------------------------------------- */ 3905 -------------------------------------------------------------------------- */
@@ -3933,67 +3994,6 @@ int __init io_apic_get_version(int ioapic)
3933} 3994}
3934#endif 3995#endif
3935 3996
3936static int __io_apic_set_pci_routing(struct device *dev, int ioapic, int pin, int irq,
3937 int triggering, int polarity)
3938{
3939 struct irq_desc *desc;
3940 struct irq_cfg *cfg;
3941 int node;
3942
3943 if (!IO_APIC_IRQ(irq)) {
3944 apic_printk(APIC_QUIET,KERN_ERR "IOAPIC[%d]: Invalid reference to IRQ 0\n",
3945 ioapic);
3946 return -EINVAL;
3947 }
3948
3949 if (dev)
3950 node = dev_to_node(dev);
3951 else
3952 node = cpu_to_node(boot_cpu_id);
3953
3954 desc = irq_to_desc_alloc_node(irq, node);
3955 if (!desc) {
3956 printk(KERN_INFO "can not get irq_desc %d\n", irq);
3957 return 0;
3958 }
3959
3960 /*
3961 * IRQs < 16 are already in the irq_2_pin[] map
3962 */
3963 if (irq >= NR_IRQS_LEGACY) {
3964 cfg = desc->chip_data;
3965 add_pin_to_irq_node(cfg, node, ioapic, pin);
3966 }
3967
3968 setup_IO_APIC_irq(ioapic, pin, irq, desc, triggering, polarity);
3969
3970 return 0;
3971}
3972
3973static struct {
3974 DECLARE_BITMAP(pin_programmed, MP_MAX_IOAPIC_PIN + 1);
3975} mp_ioapic_routing[MAX_IO_APICS];
3976
3977int io_apic_set_pci_routing(struct device *dev, int ioapic, int pin, int irq,
3978 int triggering, int polarity)
3979{
3980
3981 /*
3982 * Avoid pin reprogramming. PRTs typically include entries
3983 * with redundant pin->gsi mappings (but unique PCI devices);
3984 * we only program the IOAPIC on the first.
3985 */
3986 if (test_bit(pin, mp_ioapic_routing[ioapic].pin_programmed)) {
3987 pr_debug("Pin %d-%d already programmed\n",
3988 mp_ioapics[ioapic].apicid, pin);
3989 return 0;
3990 }
3991 set_bit(pin, mp_ioapic_routing[ioapic].pin_programmed);
3992
3993 return __io_apic_set_pci_routing(dev, ioapic, pin, irq,
3994 triggering, polarity);
3995}
3996
3997int acpi_get_override_irq(int bus_irq, int *trigger, int *polarity) 3997int acpi_get_override_irq(int bus_irq, int *trigger, int *polarity)
3998{ 3998{
3999 int i; 3999 int i;