|
12 | 12 | #include <linux/init.h>
|
13 | 13 | #include <linux/ioport.h>
|
14 | 14 | #include <linux/interrupt.h>
|
| 15 | +#include <linux/irqdomain.h> |
15 | 16 | #include <linux/kernel.h>
|
16 | 17 | #include <linux/spinlock.h>
|
17 | 18 | #include <linux/syscore_ops.h>
|
@@ -308,24 +309,37 @@ static struct resource pic2_io_resource = {
|
308 | 309 | .flags = IORESOURCE_BUSY
|
309 | 310 | };
|
310 | 311 |
|
| 312 | +static int i8259A_irq_domain_map(struct irq_domain *d, unsigned int virq, |
| 313 | + irq_hw_number_t hw) |
| 314 | +{ |
| 315 | + irq_set_chip_and_handler(virq, &i8259A_chip, handle_level_irq); |
| 316 | + irq_set_probe(virq); |
| 317 | + return 0; |
| 318 | +} |
| 319 | + |
| 320 | +static struct irq_domain_ops i8259A_ops = { |
| 321 | + .map = i8259A_irq_domain_map, |
| 322 | + .xlate = irq_domain_xlate_onecell, |
| 323 | +}; |
| 324 | + |
311 | 325 | /*
|
312 | 326 | * On systems with i8259-style interrupt controllers we assume for
|
313 | 327 | * driver compatibility reasons interrupts 0 - 15 to be the i8259
|
314 | 328 | * interrupts even if the hardware uses a different interrupt numbering.
|
315 | 329 | */
|
316 | 330 | void __init init_i8259_irqs(void)
|
317 | 331 | {
|
318 |
| - int i; |
| 332 | + struct irq_domain *domain; |
319 | 333 |
|
320 | 334 | insert_resource(&ioport_resource, &pic1_io_resource);
|
321 | 335 | insert_resource(&ioport_resource, &pic2_io_resource);
|
322 | 336 |
|
323 | 337 | init_8259A(0);
|
324 | 338 |
|
325 |
| - for (i = I8259A_IRQ_BASE; i < I8259A_IRQ_BASE + 16; i++) { |
326 |
| - irq_set_chip_and_handler(i, &i8259A_chip, handle_level_irq); |
327 |
| - irq_set_probe(i); |
328 |
| - } |
| 339 | + domain = irq_domain_add_legacy(NULL, 16, I8259A_IRQ_BASE, 0, |
| 340 | + &i8259A_ops, NULL); |
| 341 | + if (!domain) |
| 342 | + panic("Failed to add i8259 IRQ domain"); |
329 | 343 |
|
330 | 344 | setup_irq(I8259A_IRQ_BASE + PIC_CASCADE_IR, &irq2);
|
331 | 345 | }
|
0 commit comments