irq: Add irq_tasks, move NVMe to it
This commit is contained in:
@@ -253,7 +253,6 @@ uacpi_status uacpi_kernel_install_interrupt_handler(
|
||||
if (!acpi_irq)
|
||||
return UACPI_STATUS_OUT_OF_MEMORY;
|
||||
acpi_irq->handler.raise = acpi_irq_raise;
|
||||
acpi_irq->handler.line = line;
|
||||
acpi_irq->func = handler;
|
||||
acpi_irq->ctx = ctx;
|
||||
|
||||
|
||||
+10
-4
@@ -23,12 +23,11 @@ struct nvme_irq_handler {
|
||||
struct nvme_ctrl* controller;
|
||||
};
|
||||
|
||||
static enum irq_status nvme_irq_raise(struct irq_handler* self) {
|
||||
static void nvme_irq_thread(struct irq_handler* self) {
|
||||
struct nvme_irq_handler* handler = containerof(self, struct nvme_irq_handler, handler);
|
||||
struct nvme_io_queue* queue = nvme_ctrl_io_queue(handler->controller);
|
||||
if (queue)
|
||||
nvme_io_queue_drain(queue);
|
||||
return IRQ_STATUS_HANDLED;
|
||||
}
|
||||
|
||||
static errno_t map_bar(struct pci_bar* bar, void** out) {
|
||||
@@ -84,9 +83,16 @@ static errno_t nvme_pci_probe(struct pci_device* dev, const struct pci_match* ma
|
||||
struct nvme_irq_handler* handler = mem_alloc(sizeof(*handler), 0);
|
||||
if (!handler)
|
||||
return ENOMEM;
|
||||
handler->handler.raise = nvme_irq_raise;
|
||||
handler->handler.thread = nvme_irq_thread;
|
||||
handler->controller = controller;
|
||||
irq_line_attach(irq_line, &handler->handler);
|
||||
|
||||
char name[32];
|
||||
ksnprintf(name, sizeof(name), "nvme-" PCI_ADDR_FMT, PCI_ADDR_ARGS(&dev->address));
|
||||
status = irq_line_attach_task(irq_line, &handler->handler, name);
|
||||
if (status) {
|
||||
mem_free(handler);
|
||||
return status;
|
||||
}
|
||||
if (irq_line->unmask)
|
||||
irq_line->unmask(irq_line);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user