summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/acpi/uacpi.c17
-rw-r--r--sys/dev/phy/rt8139.c27
-rw-r--r--sys/dev/usb/xhci.c9
3 files changed, 24 insertions, 29 deletions
diff --git a/sys/dev/acpi/uacpi.c b/sys/dev/acpi/uacpi.c
index 7dbcb35..03d0ecf 100644
--- a/sys/dev/acpi/uacpi.c
+++ b/sys/dev/acpi/uacpi.c
@@ -259,17 +259,16 @@ uacpi_status
uacpi_kernel_install_interrupt_handler(uacpi_u32 irq, uacpi_interrupt_handler fn,
uacpi_handle ctx, uacpi_handle *out_irq_handle)
{
- int vec;
+ struct intr_hand ih;
+
+ ih.func = (void *)fn;
+ ih.priority = IPL_HIGH;
+ ih.irq = irq;
+ if (intr_register("acpi", &ih) == NULL) {
+ return UACPI_STATUS_INTERNAL_ERROR;
+ }
-#if defined(__x86_64__)
- vec = intr_alloc_vector("acpi", IPL_HIGH);
- idt_set_desc(vec, IDT_INT_GATE, ISR(fn), IST_HW_IRQ);
- ioapic_set_vec(irq, vec);
- ioapic_irq_unmask(irq);
return UACPI_STATUS_OK;
-#else
- return UACPI_STATUS_UNIMPLEMENTED;
-#endif /* __x86_64__ */
}
uacpi_status
diff --git a/sys/dev/phy/rt8139.c b/sys/dev/phy/rt8139.c
index ab8a6c0..bf71463 100644
--- a/sys/dev/phy/rt8139.c
+++ b/sys/dev/phy/rt8139.c
@@ -159,9 +159,8 @@ rt_poll(uint8_t reg, uint8_t size, uint32_t bits, bool pollset)
return val;
}
-#if defined(__x86_64__)
-__isr static void
-rt8139_pin_irq(void *sp)
+static int
+rt8139_intr(void *sp)
{
static uint32_t packet_ptr = 0;
uint16_t len;
@@ -174,7 +173,7 @@ rt8139_pin_irq(void *sp)
p += 2; /* Points to data now */
if (status & RT_TOK) {
- return;
+ return -EIO;
}
/* Update rxbuf offset in CAPR */
@@ -184,28 +183,22 @@ rt8139_pin_irq(void *sp)
}
rt_write(RT_RXBUFTAIL, 2, packet_ptr - 0x10);
rt_write(RT_INTRSTATUS, 2, RT_ACKW);
- lapic_eoi();
+ return 1; /* handled */
}
static int
rtl8139_irq_init(void)
{
- int vec;
+ struct intr_hand ih;
- vec = intr_alloc_vector("rt8139", IPL_BIO);
- if (vec < 0) {
- return vec;
+ ih.func = rt8139_intr;
+ ih.priority = IPL_BIO;
+ ih.irq = dev->irq_line;
+ if (intr_register("rt8139", &ih) == NULL) {
+ return -EIO;
}
-
- /* Map interrupt vector to IRQ */
- idt_set_desc(vec, IDT_INT_GATE, ISR(rt8139_pin_irq), 0);
- ioapic_set_vec(dev->irq_line, vec);
- ioapic_irq_unmask(dev->irq_line);
return 0;
}
-#else
-#define rtl8139_irq_init(...) -ENOTSUP
-#endif
static void
rt_init_pci(void)
diff --git a/sys/dev/usb/xhci.c b/sys/dev/usb/xhci.c
index d68f98e..1355485 100644
--- a/sys/dev/usb/xhci.c
+++ b/sys/dev/usb/xhci.c
@@ -43,6 +43,8 @@
#include <assert.h>
#include <string.h>
+#include <machine/lapic.h>
+
#define pr_trace(fmt, ...) kprintf("xhci: " fmt, ##__VA_ARGS__)
#define pr_error(...) pr_trace(__VA_ARGS__)
@@ -56,10 +58,11 @@
static struct pci_device *hci_dev;
static struct timer tmr;
-__attribute__((__interrupt__)) static void
-xhci_common_isr(void *sf)
+static int
+xhci_intr(void *sf)
{
pr_trace("received xHCI interrupt (via PCI MSI-X)\n");
+ return 1; /* handled */
}
/*
@@ -232,7 +235,7 @@ xhci_init_msix(struct xhci_hc *hc)
struct msi_intr intr;
intr.name = "xHCI MSI-X";
- intr.handler = xhci_common_isr;
+ intr.handler = xhci_intr;
return pci_enable_msix(hci_dev, &intr);
}