2009-04-09 16:52:26 +08:00
|
|
|
#include <linux/linkage.h>
|
2005-04-17 06:20:36 +08:00
|
|
|
#include <linux/errno.h>
|
|
|
|
#include <linux/signal.h>
|
|
|
|
#include <linux/sched.h>
|
|
|
|
#include <linux/ioport.h>
|
|
|
|
#include <linux/interrupt.h>
|
2009-04-09 16:52:26 +08:00
|
|
|
#include <linux/timex.h>
|
2005-04-17 06:20:36 +08:00
|
|
|
#include <linux/random.h>
|
2009-04-10 20:58:05 +08:00
|
|
|
#include <linux/kprobes.h>
|
2005-04-17 06:20:36 +08:00
|
|
|
#include <linux/init.h>
|
|
|
|
#include <linux/kernel_stat.h>
|
2011-12-22 08:26:03 +08:00
|
|
|
#include <linux/device.h>
|
2005-04-17 06:20:36 +08:00
|
|
|
#include <linux/bitops.h>
|
2009-04-09 16:52:26 +08:00
|
|
|
#include <linux/acpi.h>
|
2009-01-04 19:05:17 +08:00
|
|
|
#include <linux/io.h>
|
|
|
|
#include <linux/delay.h>
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2011-07-27 07:09:06 +08:00
|
|
|
#include <linux/atomic.h>
|
2005-04-17 06:20:36 +08:00
|
|
|
#include <asm/timer.h>
|
2009-04-09 16:52:26 +08:00
|
|
|
#include <asm/hw_irq.h>
|
2005-04-17 06:20:36 +08:00
|
|
|
#include <asm/pgtable.h>
|
|
|
|
#include <asm/desc.h>
|
|
|
|
#include <asm/apic.h>
|
2009-02-23 07:34:39 +08:00
|
|
|
#include <asm/setup.h>
|
2005-04-17 06:20:36 +08:00
|
|
|
#include <asm/i8259.h>
|
2009-01-04 19:05:17 +08:00
|
|
|
#include <asm/traps.h>
|
2011-02-23 04:07:40 +08:00
|
|
|
#include <asm/prom.h>
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2009-04-09 16:52:26 +08: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-17 06:20:36 +08:00
|
|
|
|
2008-08-11 22:34:08 +08:00
|
|
|
/*
|
|
|
|
* IRQ2 is cascade interrupt to second interrupt controller
|
|
|
|
*/
|
|
|
|
static struct irqaction irq2 = {
|
|
|
|
.handler = no_action,
|
|
|
|
.name = "cascade",
|
2011-01-28 01:17:01 +08:00
|
|
|
.flags = IRQF_NO_THREAD,
|
2008-08-11 22:34:08 +08:00
|
|
|
};
|
|
|
|
|
2008-08-20 11:50:28 +08:00
|
|
|
DEFINE_PER_CPU(vector_irq_t, vector_irq) = {
|
2015-08-03 04:38:25 +08:00
|
|
|
[0 ... NR_VECTORS - 1] = VECTOR_UNUSED,
|
2008-08-20 11:50:28 +08:00
|
|
|
};
|
|
|
|
|
2009-08-20 15:41:38 +08:00
|
|
|
void __init init_ISA_irqs(void)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2010-09-28 06:15:31 +08:00
|
|
|
struct irq_chip *chip = legacy_pic->chip;
|
2005-04-17 06:20:36 +08:00
|
|
|
int i;
|
|
|
|
|
2009-04-09 16:52:24 +08:00
|
|
|
#if defined(CONFIG_X86_64) || defined(CONFIG_X86_LOCAL_APIC)
|
2009-04-09 16:52:19 +08:00
|
|
|
init_bsp_APIC();
|
|
|
|
#endif
|
2009-11-10 03:27:04 +08:00
|
|
|
legacy_pic->init(0);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2014-06-09 16:19:48 +08:00
|
|
|
for (i = 0; i < nr_legacy_irqs(); i++)
|
2014-10-27 00:06:28 +08:00
|
|
|
irq_set_chip_and_handler(i, chip, handle_level_irq);
|
2009-04-09 16:52:19 +08:00
|
|
|
}
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2009-09-16 14:42:26 +08:00
|
|
|
void __init init_IRQ(void)
|
2009-08-20 15:59:09 +08:00
|
|
|
{
|
2010-01-20 04:20:54 +08:00
|
|
|
int i;
|
|
|
|
|
|
|
|
/*
|
2015-05-09 23:36:53 +08:00
|
|
|
* On cpu 0, Assign ISA_IRQ_VECTOR(irq) to IRQ 0..15.
|
2010-01-20 04:20:54 +08: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 16:19:48 +08:00
|
|
|
for (i = 0; i < nr_legacy_irqs(); i++)
|
2015-08-03 04:38:27 +08:00
|
|
|
per_cpu(vector_irq, 0)[ISA_IRQ_VECTOR(i)] = irq_to_desc(i);
|
2010-01-20 04:20:54 +08:00
|
|
|
|
2009-08-20 15:59:09 +08:00
|
|
|
x86_init.irqs.intr_init();
|
|
|
|
}
|
2008-08-11 22:34:08 +08:00
|
|
|
|
2009-04-09 16:52:21 +08:00
|
|
|
void __init native_init_IRQ(void)
|
|
|
|
{
|
|
|
|
/* Execute any quirks before the call gates are initialised: */
|
2009-08-20 15:41:38 +08:00
|
|
|
x86_init.irqs.pre_vector_init();
|
2009-04-09 16:52:21 +08:00
|
|
|
|
2017-08-28 14:47:54 +08:00
|
|
|
idt_setup_apic_and_irq_gates();
|
2009-04-16 02:57:01 +08:00
|
|
|
|
2014-07-21 16:38:40 +08:00
|
|
|
if (!acpi_ioapic && !of_ioapic && nr_legacy_irqs())
|
2008-08-11 22:34:08 +08:00
|
|
|
setup_irq(2, &irq2);
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
irq_ctx_init(smp_processor_id());
|
|
|
|
}
|