From a86f32e67a0610ad86730875d22fa2827510683d Mon Sep 17 00:00:00 2001 From: Jeremy Soller Date: Wed, 15 Feb 2023 11:47:48 -0700 Subject: [PATCH] xhci: Workaround for missing interrupts --- xhcid/src/main.rs | 2 ++ xhcid/src/xhci/irq_reactor.rs | 2 +- xhcid/src/xhci/scheme.rs | 10 ++++++++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/xhcid/src/main.rs b/xhcid/src/main.rs index b9c96592bb..62aa36f4c8 100644 --- a/xhcid/src/main.rs +++ b/xhcid/src/main.rs @@ -209,6 +209,8 @@ fn get_int_method(pcid_handle: &mut PcidServerHandle, address: usize) -> (Option method } else if pci_config.func.legacy_interrupt_pin.is_some() { + info!("Legacy IRQ {}", irq); + // legacy INTx# interrupt pins. (Some(File::open(format!("irq:{}", irq)).expect("xhcid: failed to open legacy IRQ file")), InterruptMethod::Intx) } else { diff --git a/xhcid/src/xhci/irq_reactor.rs b/xhcid/src/xhci/irq_reactor.rs index 152a05bc9d..97f4585fd3 100644 --- a/xhcid/src/xhci/irq_reactor.rs +++ b/xhcid/src/xhci/irq_reactor.rs @@ -162,7 +162,7 @@ impl IrqReactor { return Ok(None); } - debug!("IRQ reactor received an IRQ"); + trace!("IRQ reactor received an IRQ"); let _ = self.irq_file.as_mut().unwrap().write(&buffer); diff --git a/xhcid/src/xhci/scheme.rs b/xhcid/src/xhci/scheme.rs index 1f39d6f82f..4ac7039375 100644 --- a/xhcid/src/xhci/scheme.rs +++ b/xhcid/src/xhci/scheme.rs @@ -253,6 +253,16 @@ impl Xhci { &self, f: F, ) -> (Trb, Trb) { + { + // If ERDP EHB bit is set, clear it before sending command + //TODO: find out why this bit is set earlier! + let mut run = self.run.lock().unwrap(); + let mut int = &mut run.ints[0]; + if int.erdp.readf(1 << 3) { + int.erdp.writef(1 << 3, true); + } + } + let next_event = { let mut command_ring = self.cmd.lock().unwrap(); let (cmd_index, cycle) = (command_ring.next_index(), command_ring.cycle);