Author: mmlr Date: 2011-05-22 14:06:17 +0200 (Sun, 22 May 2011) New Revision: 41652 Changeset: https://dev.haiku-os.org/changeset/41652 Modified: haiku/trunk/src/system/kernel/arch/x86/ioapic.cpp haiku/trunk/src/system/kernel/arch/x86/irq_routing_table.cpp Log: * When configuring a link device failed, fall back and keep the currently active config and update the info for the remaining shared link device entries. Seen on KVM for the (PCI) ACPI interrupt, but happens where there is no _SRS method for a device (as this one is optional). I find that a bit strange however as in such a case no _PRS (possible resources) should be present either, especially not one advertising a config different from the current one. * Print the routing table later, after enabling irq routing, so that possible changes due to such a fallback are included. * Fix a typo. Modified: haiku/trunk/src/system/kernel/arch/x86/ioapic.cpp =================================================================== --- haiku/trunk/src/system/kernel/arch/x86/ioapic.cpp 2011-05-22 08:49:31 UTC (rev 41651) +++ haiku/trunk/src/system/kernel/arch/x86/ioapic.cpp 2011-05-22 12:06:17 UTC (rev 41652) @@ -246,7 +246,7 @@ ioapic_enable_io_interrupt(int32 gsi) { // If enabling an overriden source is attempted, enable the override entry - // instead. An interrupt handler was installed at the override GSI to rely + // instead. An interrupt handler was installed at the override GSI to relay // interrupts to the overriden source. if (gsi < ISA_INTERRUPT_COUNT && sSourceOverrides[gsi] != 0) gsi = sSourceOverrides[gsi]; @@ -709,8 +709,6 @@ return; } - print_irq_routing_table(table); - // use the boot CPU as the target for all interrupts uint8 targetAPIC = args->arch_args.cpu_apic_id[0]; @@ -726,6 +724,11 @@ current = current->next; } +#ifdef TRACE_IOAPIC + dprintf("trying interrupt routing:\n"); + print_irq_routing_table(table); +#endif + status = enable_irq_routing(acpiModule, table); if (status != B_OK) { panic("failed to enable IRQ routing"); @@ -734,6 +737,8 @@ return; } + print_irq_routing_table(table); + // configure the source overrides, but let the PCI config below override it acpi_configure_source_overrides(madt); Modified: haiku/trunk/src/system/kernel/arch/x86/irq_routing_table.cpp =================================================================== --- haiku/trunk/src/system/kernel/arch/x86/irq_routing_table.cpp 2011-05-22 08:49:31 UTC (rev 41651) +++ haiku/trunk/src/system/kernel/arch/x86/irq_routing_table.cpp 2011-05-22 12:06:17 UTC (rev 41652) @@ -312,8 +312,19 @@ status_t status = set_current_irq(acpi, irqEntry.source, configuration); if (status != B_OK) { - panic("failed to set irq on link device"); - return status; + dprintf("failed to set irq on link device, keeping current\n"); + print_irq_descriptor(configuration); + + // we failed to set the resource, fall back to current + read_current_irq(acpi, irqEntry.source, configuration); + for (int j = i; j < routingTable.Count(); j++) { + irq_routing_entry& other = routingTable.ElementAt(j); + if (other.source == irqEntry.source) { + other.irq = configuration.irq; + other.polarity = configuration.polarity; + other.trigger_mode = configuration.trigger_mode; + } + } } irqEntry.needs_configuration = false;