diff options
Diffstat (limited to 'arch/i386/kernel/io_apic.c')
-rw-r--r-- | arch/i386/kernel/io_apic.c | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/arch/i386/kernel/io_apic.c b/arch/i386/kernel/io_apic.c index b3b01894ca69..fca689cfb0c9 100644 --- a/arch/i386/kernel/io_apic.c +++ b/arch/i386/kernel/io_apic.c | |||
@@ -2483,6 +2483,54 @@ static int __init ioapic_init_sysfs(void) | |||
2483 | 2483 | ||
2484 | device_initcall(ioapic_init_sysfs); | 2484 | device_initcall(ioapic_init_sysfs); |
2485 | 2485 | ||
2486 | #ifdef CONFIG_PCI_MSI | ||
2487 | /* | ||
2488 | * Dynamic irq allocate and deallocation for MSI | ||
2489 | */ | ||
2490 | int create_irq(void) | ||
2491 | { | ||
2492 | /* Hack of the day: irq == vector. | ||
2493 | * | ||
2494 | * Ultimately this will be be more general, | ||
2495 | * and not depend on the irq to vector identity mapping. | ||
2496 | * But this version is needed until msi.c can cope with | ||
2497 | * the more general form. | ||
2498 | */ | ||
2499 | int irq, vector; | ||
2500 | unsigned long flags; | ||
2501 | vector = assign_irq_vector(AUTO_ASSIGN); | ||
2502 | irq = vector; | ||
2503 | |||
2504 | if (vector >= 0) { | ||
2505 | struct irq_desc *desc; | ||
2506 | |||
2507 | spin_lock_irqsave(&vector_lock, flags); | ||
2508 | vector_irq[vector] = irq; | ||
2509 | irq_vector[irq] = vector; | ||
2510 | spin_unlock_irqrestore(&vector_lock, flags); | ||
2511 | |||
2512 | set_intr_gate(vector, interrupt[irq]); | ||
2513 | |||
2514 | dynamic_irq_init(irq); | ||
2515 | } | ||
2516 | return irq; | ||
2517 | } | ||
2518 | |||
2519 | void destroy_irq(unsigned int irq) | ||
2520 | { | ||
2521 | unsigned long flags; | ||
2522 | unsigned int vector; | ||
2523 | |||
2524 | dynamic_irq_cleanup(irq); | ||
2525 | |||
2526 | spin_lock_irqsave(&vector_lock, flags); | ||
2527 | vector = irq_vector[irq]; | ||
2528 | vector_irq[vector] = -1; | ||
2529 | irq_vector[irq] = 0; | ||
2530 | spin_unlock_irqrestore(&vector_lock, flags); | ||
2531 | } | ||
2532 | #endif /* CONFIG_PCI_MSI */ | ||
2533 | |||
2486 | /* -------------------------------------------------------------------------- | 2534 | /* -------------------------------------------------------------------------- |
2487 | ACPI-based IOAPIC Configuration | 2535 | ACPI-based IOAPIC Configuration |
2488 | -------------------------------------------------------------------------- */ | 2536 | -------------------------------------------------------------------------- */ |