Files

109 lines
2.8 KiB
C
Raw Permalink Normal View History

// SPDX-License-Identifier: GPL-2.0
#include <linux/linkage.h>
2005-04-16 15:20:36 -07:00
#include <linux/errno.h>
#include <linux/signal.h>
#include <linux/sched.h>
#include <linux/ioport.h>
#include <linux/interrupt.h>
#include <linux/irq.h>
#include <linux/timex.h>
2005-04-16 15:20:36 -07:00
#include <linux/random.h>
2009-04-10 14:58:05 +02:00
#include <linux/kprobes.h>
2005-04-16 15:20:36 -07:00
#include <linux/init.h>
#include <linux/kernel_stat.h>
2011-12-21 16:26:03 -08:00
#include <linux/device.h>
2005-04-16 15:20:36 -07:00
#include <linux/bitops.h>
#include <linux/acpi.h>
2009-01-04 16:35:17 +05:30
#include <linux/io.h>
#include <linux/delay.h>
2005-04-16 15:20:36 -07:00
2011-07-26 16:09:06 -07:00
#include <linux/atomic.h>
2005-04-16 15:20:36 -07:00
#include <asm/timer.h>
#include <asm/hw_irq.h>
2005-04-16 15:20:36 -07:00
#include <asm/pgtable.h>
#include <asm/desc.h>
#include <asm/apic.h>
2009-02-23 00:34:39 +01:00
#include <asm/setup.h>
2005-04-16 15:20:36 -07:00
#include <asm/i8259.h>
2009-01-04 16:35:17 +05:30
#include <asm/traps.h>
2011-02-22 21:07:40 +01:00
#include <asm/prom.h>
2005-04-16 15:20:36 -07:00
/*
* ISA PIC or low IO-APIC triggered (INTA-cycle or APIC) interrupts:
* (these are usually mapped to vectors 0x30-0x3f)
*/
2005-04-16 15:20:36 -07:00
/*
* 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)
*/
/*
* IRQ2 is cascade interrupt to second interrupt controller
*/
static struct irqaction irq2 = {
.handler = no_action,
.name = "cascade",
.flags = IRQF_NO_THREAD,
};
2008-08-19 20:50:28 -07:00
DEFINE_PER_CPU(vector_irq_t, vector_irq) = {
[0 ... NR_VECTORS - 1] = VECTOR_UNUSED,
2008-08-19 20:50:28 -07:00
};
2009-08-20 09:41:38 +02:00
void __init init_ISA_irqs(void)
2005-04-16 15:20:36 -07:00
{
struct irq_chip *chip = legacy_pic->chip;
2005-04-16 15:20:36 -07:00
int i;
2018-01-17 15:37:48 +08:00
/*
* Try to set up the through-local-APIC virtual wire mode earlier.
*
* On some 32-bit UP machines, whose APIC has been disabled by BIOS
* and then got re-enabled by "lapic", it hangs at boot time without this.
*/
2017-11-28 16:53:50 +02:00
init_bsp_APIC();
2018-01-17 15:37:48 +08:00
legacy_pic->init(0);
2005-04-16 15:20:36 -07:00
for (i = 0; i < nr_legacy_irqs(); i++)
irq_set_chip_and_handler(i, chip, handle_level_irq);
}
2005-04-16 15:20:36 -07:00
2009-09-16 08:42:26 +02:00
void __init init_IRQ(void)
2009-08-20 09:59:09 +02:00
{
int i;
/*
* On cpu 0, Assign ISA_IRQ_VECTOR(irq) to IRQ 0..15.
* 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.
*/
for (i = 0; i < nr_legacy_irqs(); i++)
per_cpu(vector_irq, 0)[ISA_IRQ_VECTOR(i)] = irq_to_desc(i);
2009-08-20 09:59:09 +02:00
x86_init.irqs.intr_init();
}
void __init native_init_IRQ(void)
{
/* Execute any quirks before the call gates are initialised: */
2009-08-20 09:41:38 +02:00
x86_init.irqs.pre_vector_init();
idt_setup_apic_and_irq_gates();
2017-09-13 23:29:38 +02:00
lapic_assign_system_vectors();
2009-04-15 11:57:01 -07:00
if (!acpi_ioapic && !of_ioapic && nr_legacy_irqs())
setup_irq(2, &irq2);
2005-04-16 15:20:36 -07:00
irq_ctx_init(smp_processor_id());
}