busses/usb: Don't reject devices with "invalid" IRQs immediately.

We may be able to allocate an MSI for them. This was done for XHCI
already in hrev52742.

Probably fixes #15004.
This commit is contained in:
Augustin Cavalier 2019-04-12 16:14:26 -04:00
parent 5c6d92d72f
commit 67b05100d2
3 changed files with 21 additions and 26 deletions

View File

@ -143,14 +143,8 @@ EHCI::AddTo(Stack *stack)
for (int32 i = 0; sPCIModule->get_nth_pci_info(i, item) >= B_OK; i++) { for (int32 i = 0; sPCIModule->get_nth_pci_info(i, item) >= B_OK; i++) {
if (item->class_base == PCI_serial_bus && item->class_sub == PCI_usb if (item->class_base == PCI_serial_bus && item->class_sub == PCI_usb
&& item->class_api == PCI_usb_ehci) { && item->class_api == PCI_usb_ehci) {
if (item->u.h0.interrupt_line == 0 TRACE_MODULE("found device at PCI:%d:%d:%d\n",
|| item->u.h0.interrupt_line == 0xFF) { item->bus, item->device, item->function);
TRACE_MODULE_ERROR("found device with invalid IRQ - "
"check IRQ assignement\n");
continue;
}
TRACE_MODULE("found device at IRQ %u\n", item->u.h0.interrupt_line);
EHCI *bus = new(std::nothrow) EHCI(item, stack); EHCI *bus = new(std::nothrow) EHCI(item, stack);
if (!bus) { if (!bus) {
delete item; delete item;
@ -465,6 +459,11 @@ EHCI::EHCI(pci_info *info, Stack *stack)
} }
} }
if (fIRQ == 0 || fIRQ == 0xFF) {
TRACE_MODULE_ERROR("device was assigned an invalid IRQ\n");
return;
}
// install the interrupt handler and enable interrupts // install the interrupt handler and enable interrupts
install_io_interrupt_handler(fIRQ, InterruptHandler, install_io_interrupt_handler(fIRQ, InterruptHandler,
(void *)this, 0); (void *)this, 0);

View File

@ -94,15 +94,8 @@ OHCI::AddTo(Stack *stack)
for (uint32 i = 0 ; sPCIModule->get_nth_pci_info(i, item) >= B_OK; i++) { for (uint32 i = 0 ; sPCIModule->get_nth_pci_info(i, item) >= B_OK; i++) {
if (item->class_base == PCI_serial_bus && item->class_sub == PCI_usb if (item->class_base == PCI_serial_bus && item->class_sub == PCI_usb
&& item->class_api == PCI_usb_ohci) { && item->class_api == PCI_usb_ohci) {
if (item->u.h0.interrupt_line == 0 TRACE_MODULE("found device at PCI:%d:%d:%d\n",
|| item->u.h0.interrupt_line == 0xFF) { item->bus, item->device, item->function);
TRACE_MODULE_ERROR("found device with invalid IRQ -"
" check IRQ assignement\n");
continue;
}
TRACE_MODULE("found device at IRQ %u\n",
item->u.h0.interrupt_line);
OHCI *bus = new(std::nothrow) OHCI(item, stack); OHCI *bus = new(std::nothrow) OHCI(item, stack);
if (!bus) { if (!bus) {
delete item; delete item;
@ -444,6 +437,11 @@ OHCI::OHCI(pci_info *info, Stack *stack)
} }
} }
if (fIRQ == 0 || fIRQ == 0xFF) {
TRACE_MODULE_ERROR("device was assigned an invalid IRQ\n");
return;
}
// Install the interrupt handler // Install the interrupt handler
TRACE("installing interrupt handler\n"); TRACE("installing interrupt handler\n");
install_io_interrupt_handler(fIRQ, _InterruptHandler, (void *)this, 0); install_io_interrupt_handler(fIRQ, _InterruptHandler, (void *)this, 0);

View File

@ -329,17 +329,10 @@ UHCI::AddTo(Stack *stack)
} }
for (int32 i = 0; sPCIModule->get_nth_pci_info(i, item) >= B_OK; i++) { for (int32 i = 0; sPCIModule->get_nth_pci_info(i, item) >= B_OK; i++) {
if (item->class_base == PCI_serial_bus && item->class_sub == PCI_usb if (item->class_base == PCI_serial_bus && item->class_sub == PCI_usb
&& item->class_api == PCI_usb_uhci) { && item->class_api == PCI_usb_uhci) {
if (item->u.h0.interrupt_line == 0 TRACE_MODULE("found device at PCI:%d:%d:%d\n",
|| item->u.h0.interrupt_line == 0xFF) { item->bus, item->device, item->function);
TRACE_MODULE_ERROR("AddTo(): found with invalid IRQ - check IRQ assignement\n");
continue;
}
TRACE_MODULE("AddTo(): found at IRQ %u\n",
item->u.h0.interrupt_line);
UHCI *bus = new(std::nothrow) UHCI(item, stack); UHCI *bus = new(std::nothrow) UHCI(item, stack);
if (!bus) { if (!bus) {
delete item; delete item;
@ -577,6 +570,11 @@ UHCI::UHCI(pci_info *info, Stack *stack)
} }
} }
if (fIRQ == 0 || fIRQ == 0xFF) {
TRACE_MODULE_ERROR("device was assigned an invalid IRQ\n");
return;
}
// Install the interrupt handler // Install the interrupt handler
TRACE("installing interrupt handler\n"); TRACE("installing interrupt handler\n");
install_io_interrupt_handler(fIRQ, InterruptHandler, (void *)this, 0); install_io_interrupt_handler(fIRQ, InterruptHandler, (void *)this, 0);