2009-04-09 08:52:26 +00:00
|
|
|
#include <linux/linkage.h>
|
2005-04-16 22:20:36 +00:00
|
|
|
#include <linux/errno.h>
|
|
|
|
#include <linux/signal.h>
|
|
|
|
#include <linux/sched.h>
|
|
|
|
#include <linux/ioport.h>
|
|
|
|
#include <linux/interrupt.h>
|
2009-04-09 08:52:26 +00:00
|
|
|
#include <linux/timex.h>
|
2005-04-16 22:20:36 +00:00
|
|
|
#include <linux/random.h>
|
2009-04-10 12:58:05 +00:00
|
|
|
#include <linux/kprobes.h>
|
2005-04-16 22:20:36 +00:00
|
|
|
#include <linux/init.h>
|
|
|
|
#include <linux/kernel_stat.h>
|
2011-12-22 00:26:03 +00:00
|
|
|
#include <linux/device.h>
|
2005-04-16 22:20:36 +00:00
|
|
|
#include <linux/bitops.h>
|
2009-04-09 08:52:26 +00:00
|
|
|
#include <linux/acpi.h>
|
2009-01-04 11:05:17 +00:00
|
|
|
#include <linux/io.h>
|
|
|
|
#include <linux/delay.h>
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2011-07-26 23:09:06 +00:00
|
|
|
#include <linux/atomic.h>
|
2005-04-16 22:20:36 +00:00
|
|
|
#include <asm/timer.h>
|
2009-04-09 08:52:26 +00:00
|
|
|
#include <asm/hw_irq.h>
|
2005-04-16 22:20:36 +00:00
|
|
|
#include <asm/pgtable.h>
|
|
|
|
#include <asm/desc.h>
|
|
|
|
#include <asm/apic.h>
|
2009-02-22 23:34:39 +00:00
|
|
|
#include <asm/setup.h>
|
2005-04-16 22:20:36 +00:00
|
|
|
#include <asm/i8259.h>
|
2009-01-04 11:05:17 +00:00
|
|
|
#include <asm/traps.h>
|
2011-02-22 20:07:40 +00:00
|
|
|
#include <asm/prom.h>
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2009-04-09 08:52:26 +00:00
|
|
|
/*
|
|
|
|
* ISA PIC or low IO-APIC triggered (INTA-cycle or APIC) interrupts:
|
|
|
|
* (these are usually mapped to vectors 0x30-0x3f)
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* The IO-APIC gives us many more interrupt sources. Most of these
|
|
|
|
* are unused but an SMP system is supposed to have enough memory ...
|
|
|
|
* sometimes (mostly wrt. hw bugs) we get corrupted vectors all
|
|
|
|
* across the spectrum, so we really want to be prepared to get all
|
|
|
|
* of these. Plus, more powerful systems might have more than 64
|
|
|
|
* IO-APIC registers.
|
|
|
|
*
|
|
|
|
* (these are usually mapped into the 0x30-0xff vector range)
|
|
|
|
*/
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2008-08-11 14:34:08 +00:00
|
|
|
/*
|
|
|
|
* IRQ2 is cascade interrupt to second interrupt controller
|
|
|
|
*/
|
|
|
|
static struct irqaction irq2 = {
|
|
|
|
.handler = no_action,
|
|
|
|
.name = "cascade",
|
2011-01-27 17:17:01 +00:00
|
|
|
.flags = IRQF_NO_THREAD,
|
2008-08-11 14:34:08 +00:00
|
|
|
};
|
|
|
|
|
2008-08-20 03:50:28 +00:00
|
|
|
DEFINE_PER_CPU(vector_irq_t, vector_irq) = {
|
2015-08-02 20:38:25 +00:00
|
|
|
[0 ... NR_VECTORS - 1] = VECTOR_UNUSED,
|
2008-08-20 03:50:28 +00:00
|
|
|
};
|
|
|
|
|
2009-08-20 07:41:38 +00:00
|
|
|
void __init init_ISA_irqs(void)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
2010-09-27 22:15:31 +00:00
|
|
|
struct irq_chip *chip = legacy_pic->chip;
|
2005-04-16 22:20:36 +00:00
|
|
|
int i;
|
|
|
|
|
2009-04-09 08:52:24 +00:00
|
|
|
#if defined(CONFIG_X86_64) || defined(CONFIG_X86_LOCAL_APIC)
|
2009-04-09 08:52:19 +00:00
|
|
|
init_bsp_APIC();
|
|
|
|
#endif
|
2009-11-09 19:27:04 +00:00
|
|
|
legacy_pic->init(0);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2014-06-09 08:19:48 +00:00
|
|
|
for (i = 0; i < nr_legacy_irqs(); i++)
|
2014-10-26 16:06:28 +00:00
|
|
|
irq_set_chip_and_handler(i, chip, handle_level_irq);
|
2009-04-09 08:52:19 +00:00
|
|
|
}
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2009-09-16 06:42:26 +00:00
|
|
|
void __init init_IRQ(void)
|
2009-08-20 07:59:09 +00:00
|
|
|
{
|
2010-01-19 20:20:54 +00:00
|
|
|
int i;
|
|
|
|
|
|
|
|
/*
|
2015-05-09 15:36:53 +00:00
|
|
|
* On cpu 0, Assign ISA_IRQ_VECTOR(irq) to IRQ 0..15.
|
2010-01-19 20:20:54 +00:00
|
|
|
* If these IRQ's are handled by legacy interrupt-controllers like PIC,
|
|
|
|
* then this configuration will likely be static after the boot. If
|
|
|
|
* these IRQ's are handled by more mordern controllers like IO-APIC,
|
|
|
|
* then this vector space can be freed and re-used dynamically as the
|
|
|
|
* irq's migrate etc.
|
|
|
|
*/
|
2014-06-09 08:19:48 +00:00
|
|
|
for (i = 0; i < nr_legacy_irqs(); i++)
|
2015-08-02 20:38:27 +00:00
|
|
|
per_cpu(vector_irq, 0)[ISA_IRQ_VECTOR(i)] = irq_to_desc(i);
|
2010-01-19 20:20:54 +00:00
|
|
|
|
2009-08-20 07:59:09 +00:00
|
|
|
x86_init.irqs.intr_init();
|
|
|
|
}
|
2008-08-11 14:34:08 +00:00
|
|
|
|
2009-04-09 08:52:21 +00:00
|
|
|
void __init native_init_IRQ(void)
|
|
|
|
{
|
|
|
|
/* Execute any quirks before the call gates are initialised: */
|
2009-08-20 07:41:38 +00:00
|
|
|
x86_init.irqs.pre_vector_init();
|
2009-04-09 08:52:21 +00:00
|
|
|
|
2017-08-28 06:47:54 +00:00
|
|
|
idt_setup_apic_and_irq_gates();
|
2009-04-15 18:57:01 +00:00
|
|
|
|
2014-07-21 08:38:40 +00:00
|
|
|
if (!acpi_ioapic && !of_ioapic && nr_legacy_irqs())
|
2008-08-11 14:34:08 +00:00
|
|
|
setup_irq(2, &irq2);
|
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
irq_ctx_init(smp_processor_id());
|
|
|
|
}
|