ioapic_abi/x86_64: Record the max line based IRQ
authorSepherosa Ziehau <sephe@dragonflybsd.org>
Sun, 30 Oct 2011 12:27:39 +0000 (20:27 +0800)
committerSepherosa Ziehau <sephe@dragonflybsd.org>
Sun, 30 Oct 2011 12:27:39 +0000 (20:27 +0800)
sys/platform/pc64/apic/ioapic_abi.c

index bd01e5d..356d652 100644 (file)
@@ -510,6 +510,7 @@ struct machintr_abi MachIntrABI_IOAPIC = {
 };
 
 static int     ioapic_abi_extint_irq = -1;
+static int     ioapic_abi_line_irq_max;
 
 struct ioapic_irqinfo  ioapic_irqs[IOAPIC_HWI_VECTORS];
 
@@ -689,6 +690,9 @@ ioapic_abi_set_irqmap(int irq, int gsi, enum intr_trigger trig,
        KKASSERT(pola == INTR_POLARITY_HIGH || pola == INTR_POLARITY_LOW);
 
        KKASSERT(irq >= 0 && irq < IOAPIC_HWI_VECTORS);
+       if (irq > ioapic_abi_line_irq_max)
+               ioapic_abi_line_irq_max = irq;
+
        map = &ioapic_irqmaps[irq];
 
        KKASSERT(map->im_type == IOAPIC_IMT_UNUSED);
@@ -740,6 +744,9 @@ ioapic_abi_fixup_irqmap(void)
                                kprintf("IOAPIC: irq %d reserved\n", i);
                }
        }
+       ioapic_abi_line_irq_max += 1;
+       if (bootverbose)
+               kprintf("IOAPIC: line irq max %d\n", ioapic_abi_line_irq_max);
 }
 
 int