@@ -91,6 +91,11 @@ struct mpc_intsrc mp_irqs[MAX_IRQ_SOURCES];
91
91
/* # of MP IRQ source entries */
92
92
int mp_irq_entries ;
93
93
94
+ /* Number of legacy interrupts */
95
+ static int nr_legacy_irqs __read_mostly = NR_IRQS_LEGACY ;
96
+ /* GSI interrupts */
97
+ static int nr_irqs_gsi = NR_IRQS_LEGACY ;
98
+
94
99
#if defined (CONFIG_MCA ) || defined (CONFIG_EISA )
95
100
int mp_bus_id_to_type [MAX_MP_BUSSES ];
96
101
#endif
@@ -172,6 +177,12 @@ static struct irq_cfg irq_cfgx[NR_IRQS] = {
172
177
[15 ] = { .vector = IRQ15_VECTOR , },
173
178
};
174
179
180
+ void __init io_apic_disable_legacy (void )
181
+ {
182
+ nr_legacy_irqs = 0 ;
183
+ nr_irqs_gsi = 0 ;
184
+ }
185
+
175
186
int __init arch_early_irq_init (void )
176
187
{
177
188
struct irq_cfg * cfg ;
@@ -189,7 +200,7 @@ int __init arch_early_irq_init(void)
189
200
desc -> chip_data = & cfg [i ];
190
201
zalloc_cpumask_var_node (& cfg [i ].domain , GFP_NOWAIT , node );
191
202
zalloc_cpumask_var_node (& cfg [i ].old_domain , GFP_NOWAIT , node );
192
- if (i < NR_IRQS_LEGACY )
203
+ if (i < nr_legacy_irqs )
193
204
cpumask_setall (cfg [i ].domain );
194
205
}
195
206
@@ -883,7 +894,7 @@ static int __init find_isa_irq_apic(int irq, int type)
883
894
*/
884
895
static int EISA_ELCR (unsigned int irq )
885
896
{
886
- if (irq < NR_IRQS_LEGACY ) {
897
+ if (irq < nr_legacy_irqs ) {
887
898
unsigned int port = 0x4d0 + (irq >> 3 );
888
899
return (inb (port ) >> (irq & 7 )) & 1 ;
889
900
}
@@ -1480,7 +1491,7 @@ static void setup_IO_APIC_irq(int apic_id, int pin, unsigned int irq, struct irq
1480
1491
}
1481
1492
1482
1493
ioapic_register_intr (irq , desc , trigger );
1483
- if (irq < NR_IRQS_LEGACY )
1494
+ if (irq < nr_legacy_irqs )
1484
1495
disable_8259A_irq (irq );
1485
1496
1486
1497
ioapic_write_entry (apic_id , pin , entry );
@@ -1851,7 +1862,7 @@ __apicdebuginit(void) print_PIC(void)
1851
1862
unsigned int v ;
1852
1863
unsigned long flags ;
1853
1864
1854
- if (apic_verbosity == APIC_QUIET )
1865
+ if (apic_verbosity == APIC_QUIET || ! nr_legacy_irqs )
1855
1866
return ;
1856
1867
1857
1868
printk (KERN_DEBUG "\nprinting PIC contents\n" );
@@ -1914,6 +1925,10 @@ void __init enable_IO_APIC(void)
1914
1925
spin_unlock_irqrestore (& ioapic_lock , flags );
1915
1926
nr_ioapic_registers [apic ] = reg_01 .bits .entries + 1 ;
1916
1927
}
1928
+
1929
+ if (!nr_legacy_irqs )
1930
+ return ;
1931
+
1917
1932
for (apic = 0 ; apic < nr_ioapics ; apic ++ ) {
1918
1933
int pin ;
1919
1934
/* See if any of the pins is in ExtINT mode */
@@ -1968,6 +1983,9 @@ void disable_IO_APIC(void)
1968
1983
*/
1969
1984
clear_IO_APIC ();
1970
1985
1986
+ if (!nr_legacy_irqs )
1987
+ return ;
1988
+
1971
1989
/*
1972
1990
* If the i8259 is routed through an IOAPIC
1973
1991
* Put that IOAPIC in virtual wire mode
@@ -2198,7 +2216,7 @@ static unsigned int startup_ioapic_irq(unsigned int irq)
2198
2216
struct irq_cfg * cfg ;
2199
2217
2200
2218
spin_lock_irqsave (& ioapic_lock , flags );
2201
- if (irq < NR_IRQS_LEGACY ) {
2219
+ if (irq < nr_legacy_irqs ) {
2202
2220
disable_8259A_irq (irq );
2203
2221
if (i8259A_irq_pending (irq ))
2204
2222
was_pending = 1 ;
@@ -2709,7 +2727,7 @@ static inline void init_IO_APIC_traps(void)
2709
2727
* so default to an old-fashioned 8259
2710
2728
* interrupt if we can..
2711
2729
*/
2712
- if (irq < NR_IRQS_LEGACY )
2730
+ if (irq < nr_legacy_irqs )
2713
2731
make_8259A_irq (irq );
2714
2732
else
2715
2733
/* Strange. Oh, well.. */
@@ -3045,16 +3063,15 @@ static inline void __init check_timer(void)
3045
3063
* the I/O APIC in all cases now. No actual device should request
3046
3064
* it anyway. --macro
3047
3065
*/
3048
- #define PIC_IRQS (1 << PIC_CASCADE_IR)
3066
+ #define PIC_IRQS (1UL << PIC_CASCADE_IR)
3049
3067
3050
3068
void __init setup_IO_APIC (void )
3051
3069
{
3052
3070
3053
3071
/*
3054
3072
* calling enable_IO_APIC() is moved to setup_local_APIC for BP
3055
3073
*/
3056
-
3057
- io_apic_irqs = ~PIC_IRQS ;
3074
+ io_apic_irqs = nr_legacy_irqs ? ~PIC_IRQS : ~0UL ;
3058
3075
3059
3076
apic_printk (APIC_VERBOSE , "ENABLING IO-APIC IRQs\n" );
3060
3077
/*
@@ -3065,7 +3082,8 @@ void __init setup_IO_APIC(void)
3065
3082
sync_Arb_IDs ();
3066
3083
setup_IO_APIC_irqs ();
3067
3084
init_IO_APIC_traps ();
3068
- check_timer ();
3085
+ if (nr_legacy_irqs )
3086
+ check_timer ();
3069
3087
}
3070
3088
3071
3089
/*
@@ -3166,7 +3184,6 @@ static int __init ioapic_init_sysfs(void)
3166
3184
3167
3185
device_initcall (ioapic_init_sysfs );
3168
3186
3169
- static int nr_irqs_gsi = NR_IRQS_LEGACY ;
3170
3187
/*
3171
3188
* Dynamic irq allocate and deallocation
3172
3189
*/
@@ -3907,7 +3924,7 @@ static int __io_apic_set_pci_routing(struct device *dev, int irq,
3907
3924
/*
3908
3925
* IRQs < 16 are already in the irq_2_pin[] map
3909
3926
*/
3910
- if (irq >= NR_IRQS_LEGACY ) {
3927
+ if (irq >= nr_legacy_irqs ) {
3911
3928
cfg = desc -> chip_data ;
3912
3929
add_pin_to_irq_node (cfg , node , ioapic , pin );
3913
3930
}
0 commit comments