2 * Dynamic IRQ management
4 * Copyright (C) 2010 Paul Mundt
6 * Modelled after arch/x86/kernel/apic/io_apic.c
8 * This file is subject to the terms and conditions of the GNU General Public
9 * License. See the file "COPYING" in the main directory of this archive
12 #define pr_fmt(fmt) "intc: " fmt
14 #include <linux/irq.h>
15 #include <linux/bitmap.h>
16 #include <linux/spinlock.h>
17 #include <linux/module.h>
18 #include "internals.h" /* only for activate_irq() damage.. */
21 * The IRQ bitmap provides a global map of bound IRQ vectors for a
22 * given platform. Allocation of IRQs are either static through the CPU
23 * vector map, or dynamic in the case of board mux vectors or MSI.
25 * As this is a central point for all IRQ controllers on the system,
26 * each of the available sources are mapped out here. This combined with
27 * sparseirq makes it quite trivial to keep the vector map tightly packed
28 * when dynamically creating IRQs, as well as tying in to otherwise
29 * unused irq_desc positions in the sparse array.
33 * Dynamic IRQ allocation and deallocation
35 unsigned int create_irq_nr(unsigned int irq_want
, int node
)
37 int irq
= irq_alloc_desc_at(irq_want
, node
);
47 int irq
= irq_alloc_desc(numa_node_id());
54 void destroy_irq(unsigned int irq
)
59 void reserve_intc_vectors(struct intc_vect
*vectors
, unsigned int nr_vecs
)
63 for (i
= 0; i
< nr_vecs
; i
++)
64 irq_reserve_irq(evt2irq(vectors
[i
].vect
));