void __init xen_init_IRQ(void) { int i; init_evtchn_cpu_bindings(); /* No event channels are 'live' right now. */ for (i = 0; i < NR_EVENT_CHANNELS; i++) mask_evtchn(i); /* No IRQ -> event-channel mappings. */ for (i = 0; i < NR_IRQS; i++) irq_info[i] = IRQ_UNBOUND; /* Dynamic IRQ space is currently unbound. Zero the refcnts. */ for (i = 0; i < NR_DYNIRQS; i++) { irq_bindcount[dynirq_to_irq(i)] = 0; irq_desc[dynirq_to_irq(i)].status = IRQ_DISABLED; irq_desc[dynirq_to_irq(i)].action = NULL; irq_desc[dynirq_to_irq(i)].depth = 1; irq_desc[dynirq_to_irq(i)].handler = &dynirq_type; } /* Phys IRQ space is statically bound (1:1 mapping). Nail refcnts. */ for (i = 0; i < NR_PIRQS; i++) { irq_bindcount[pirq_to_irq(i)] = 1; #ifdef RTC_IRQ /* If not domain 0, force our RTC driver to fail its probe. */ if ((i == RTC_IRQ) && !is_initial_xendomain()) continue; #endif irq_desc[pirq_to_irq(i)].status = IRQ_DISABLED; irq_desc[pirq_to_irq(i)].action = NULL; irq_desc[pirq_to_irq(i)].depth = 1; irq_desc[pirq_to_irq(i)].handler = &pirq_type; } }
static int find_unbound_irq(void) { int dynirq, irq; for (dynirq = 0; dynirq < NR_IRQS; dynirq++) { irq = dynirq_to_irq(dynirq); if (irq_bindcount[irq] == 0) break; } if (irq == NR_IRQS) panic("No available IRQ to bind to: increase NR_IRQS!\n"); return (irq); }