MachIntr: Add two methods to find IRQ
[dragonfly.git] / sys / platform / pc32 / isa / clock.c
index 01d091a..838bf56 100644 (file)
@@ -1012,7 +1012,7 @@ i8254_ioapic_trial(int irq, struct cputimer_intr *cti)
        KKASSERT(sys_cputimer == &i8254_cputimer);
        KKASSERT(cti == &i8254_cputimer_intr);
 
-       lastcnt = get_interrupt_counter(irq);
+       lastcnt = get_interrupt_counter(irq, mycpuid);
 
        /*
         * Force an 8254 Timer0 interrupt and wait 1/100s for
@@ -1025,7 +1025,7 @@ i8254_ioapic_trial(int irq, struct cputimer_intr *cti)
        while (sys_cputimer->count() - base < sys_cputimer->freq / 100)
                ; /* nothing */
 
-       if (get_interrupt_counter(irq) - lastcnt == 0)
+       if (get_interrupt_counter(irq, mycpuid) - lastcnt == 0)
                return ENOENT;
        return 0;
 }
@@ -1041,6 +1041,7 @@ i8254_intr_initclock(struct cputimer_intr *cti, boolean_t selected)
        void *clkdesc = NULL;
        int irq = 0, mixed_mode = 0, error;
 
+       KKASSERT(mycpuid == 0);
        callout_init(&sysbeepstop_ch);
 
        if (!selected && i8254_intr_disable)
@@ -1056,14 +1057,14 @@ i8254_intr_initclock(struct cputimer_intr *cti, boolean_t selected)
 
        /* Finish initializing 8253 timer 0. */
        if (ioapic_enable) {
-               irq = ioapic_abi_find_irq(0, INTR_TRIGGER_EDGE,
+               irq = machintr_legacy_intr_find(0, INTR_TRIGGER_EDGE,
                        INTR_POLARITY_HIGH);
                if (irq < 0) {
 mixed_mode_setup:
-                       error = ioapic_abi_extint_irqmap(0);
+                       error = ioapic_conf_legacy_extint(0);
                        if (!error) {
-                               irq = ioapic_abi_find_irq(0, INTR_TRIGGER_EDGE,
-                                       INTR_POLARITY_HIGH);
+                               irq = machintr_legacy_intr_find(0,
+                                   INTR_TRIGGER_EDGE, INTR_POLARITY_HIGH);
                                if (irq < 0)
                                        error = ENOENT;
                        }
@@ -1084,14 +1085,12 @@ mixed_mode_setup:
                                       NULL,
                                       INTR_EXCL | INTR_CLOCK |
                                       INTR_NOPOLL | INTR_MPSAFE |
-                                      INTR_NOENTROPY);
-               machintr_intr_enable(irq);
+                                      INTR_NOENTROPY, 0);
        } else {
                register_int(0, clkintr, NULL, "clk", NULL,
                             INTR_EXCL | INTR_CLOCK |
                             INTR_NOPOLL | INTR_MPSAFE |
-                            INTR_NOENTROPY);
-               machintr_intr_enable(0);
+                            INTR_NOENTROPY, 0);
        }
 
        /* Initialize RTC. */
@@ -1114,8 +1113,7 @@ mixed_mode_setup:
                        } else {
                                kprintf("IOAPIC: warning 8254 is not connected "
                                        "to the correct pin, try mixed mode\n");
-                               machintr_intr_disable(irq);
-                               unregister_int(clkdesc);
+                               unregister_int(clkdesc, 0);
                                goto mixed_mode_setup;
                        }
                }