xhcid: Remove unused InterruptSources methods and fields

This commit is contained in:
bjorn3
2025-08-30 20:12:20 +02:00
parent b9ce02ea90
commit 2c9be2e9b8
2 changed files with 7 additions and 38 deletions
+2 -5
View File
@@ -26,7 +26,7 @@
extern crate bitflags;
use std::fs::File;
use std::sync::{Arc, Mutex};
use std::sync::Arc;
use pcid_interface::irq_helpers::read_bsp_apic_id;
#[cfg(target_arch = "x86_64")]
@@ -78,10 +78,7 @@ fn get_int_method(pcid_handle: &mut PciFunctionHandle) -> (Option<File>, Interru
table_entry_pointer.write_addr_and_data(msg_addr_and_data);
table_entry_pointer.unmask();
(
Some(interrupt_handle),
InterruptMethod::MsiX(Mutex::new(info)),
)
(Some(interrupt_handle), InterruptMethod::Msi)
};
pcid_handle.enable_feature(PciFeature::MsiX);
+5 -33
View File
@@ -13,10 +13,9 @@ use std::collections::BTreeMap;
use std::convert::TryFrom;
use std::fs::File;
use std::sync::atomic::AtomicUsize;
use std::sync::{Arc, Mutex, MutexGuard};
use std::sync::{Arc, Mutex};
use std::{mem, process, slice, thread};
use pcid_interface::msi::MappedMsixRegs;
use syscall::error::{Error, Result, EBADF, EBADMSG, EIO, ENOENT};
use syscall::{EAGAIN, PAGE_SIZE};
@@ -70,11 +69,8 @@ pub enum InterruptMethod {
/// Legacy PCI INTx# interrupt pin.
Intx,
/// Message signaled interrupts.
/// (Extended) Message signaled interrupts.
Msi,
/// Extended message signaled interrupts.
MsiX(Mutex<MappedMsixRegs>),
}
impl Xhci {
@@ -1142,32 +1138,8 @@ impl Xhci {
Ok(ring)
}
pub fn uses_msi(&self) -> bool {
if let InterruptMethod::Msi = self.interrupt_method {
true
} else {
false
}
}
pub fn uses_msix(&self) -> bool {
if let InterruptMethod::MsiX(_) = self.interrupt_method {
true
} else {
false
}
}
// TODO: Perhaps use an rwlock?
pub fn msix_info(&self) -> Option<MutexGuard<'_, MappedMsixRegs>> {
match self.interrupt_method {
InterruptMethod::MsiX(ref info) => Some(info.lock().unwrap()),
_ => None,
}
}
pub fn msix_info_mut(&self) -> Option<MutexGuard<'_, MappedMsixRegs>> {
match self.interrupt_method {
InterruptMethod::MsiX(ref info) => Some(info.lock().unwrap()),
_ => None,
}
fn uses_msi_interrupts(&self) -> bool {
matches!(self.interrupt_method, InterruptMethod::Msi)
}
/// Checks whether an IRQ has been received from *this* device, in case of an interrupt. Always
@@ -1175,7 +1147,7 @@ impl Xhci {
pub fn received_irq(&self) -> bool {
let mut runtime_regs = self.run.lock().unwrap();
if self.uses_msi() || self.uses_msix() {
if self.uses_msi_interrupts() {
// Since using MSI and MSI-X implies having no IRQ sharing whatsoever, the IP bit
// doesn't have to be touched.
trace!(