2009-04-09 11:52:26 +03:00
# 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>
2009-04-09 11:52:26 +03:00
# 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>
2009-04-09 11:52:26 +03:00
# 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>
2009-04-09 11:52:26 +03:00
# 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
2009-04-09 11:52:26 +03: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 15:20:36 -07:00
2008-08-11 18:34:08 +04:00
/*
* IRQ2 is cascade interrupt to second interrupt controller
*/
static struct irqaction irq2 = {
. handler = no_action ,
. name = " cascade " ,
2011-01-27 18:17:01 +01:00
. flags = IRQF_NO_THREAD ,
2008-08-11 18:34:08 +04:00
} ;
2008-08-19 20:50:28 -07: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-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
{
2010-09-28 00:15:31 +02:00
struct irq_chip * chip = legacy_pic - > chip ;
2005-04-16 15:20:36 -07:00
int i ;
2009-04-09 11:52:24 +03:00
# if defined(CONFIG_X86_64) || defined(CONFIG_X86_LOCAL_APIC)
2009-04-09 11:52:19 +03:00
init_bsp_APIC ( ) ;
# endif
2009-11-09 11:27:04 -08:00
legacy_pic - > init ( 0 ) ;
2005-04-16 15:20:36 -07:00
2014-06-09 16:19:48 +08: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 11:52:19 +03:00
}
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
{
2010-01-19 12:20:54 -08:00
int i ;
/*
2015-05-09 11:36:53 -04:00
* On cpu 0 , Assign ISA_IRQ_VECTOR ( irq ) to IRQ 0. .15 .
2010-01-19 12: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-02 20:38:27 +00:00
per_cpu ( vector_irq , 0 ) [ ISA_IRQ_VECTOR ( i ) ] = irq_to_desc ( i ) ;
2010-01-19 12:20:54 -08:00
2009-08-20 09:59:09 +02:00
x86_init . irqs . intr_init ( ) ;
}
2008-08-11 18:34:08 +04:00
2009-04-09 11:52:21 +03:00
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 ( ) ;
2009-04-09 11:52:21 +03:00
2017-08-28 08:47:54 +02:00
idt_setup_apic_and_irq_gates ( ) ;
2009-04-15 11:57:01 -07:00
2014-07-21 11:38:40 +03:00
if ( ! acpi_ioapic & & ! of_ioapic & & nr_legacy_irqs ( ) )
2008-08-11 18:34:08 +04:00
setup_irq ( 2 , & irq2 ) ;
2005-04-16 15:20:36 -07:00
irq_ctx_init ( smp_processor_id ( ) ) ;
}