From 769b4ee4aa614bcfff8e87cc2832c7fb5bbd351d Mon Sep 17 00:00:00 2001 From: Augustin Cavalier Date: Wed, 24 May 2023 15:42:59 -0400 Subject: [PATCH] XHCI: Implement support for MSI-X. Works in QEMU, at least. --- src/add-ons/kernel/busses/usb/xhci.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/add-ons/kernel/busses/usb/xhci.cpp b/src/add-ons/kernel/busses/usb/xhci.cpp index fdfc274b27..c05af73810 100644 --- a/src/add-ons/kernel/busses/usb/xhci.cpp +++ b/src/add-ons/kernel/busses/usb/xhci.cpp @@ -501,7 +501,15 @@ XHCI::XHCI(pci_info *info, pci_device_module_info* pci, pci_device* device, Sta // Find the right interrupt vector, using MSIs if available. fIRQ = fPCIInfo->u.h0.interrupt_line; - if (fPci->get_msi_count(fDevice) >= 1) { + if (fPci->get_msix_count(fDevice) >= 1) { + uint8 msiVector = 0; + if (fPci->configure_msix(fDevice, 1, &msiVector) == B_OK + && fPci->enable_msix(fDevice) == B_OK) { + TRACE_ALWAYS("using MSI-X\n"); + fIRQ = msiVector; + fUseMSI = true; + } + } else if (fPci->get_msi_count(fDevice) >= 1) { uint8 msiVector = 0; if (fPci->configure_msi(fDevice, 1, &msiVector) == B_OK && fPci->enable_msi(fDevice) == B_OK) {