Skip to content

Commit

Permalink
Add method to enable/disable function masking for MSI-X
Browse files Browse the repository at this point in the history
Function masking needs to be disabled before any interrupts can be
received.
  • Loading branch information
bjorn3 authored and IsaacWoods committed Jun 14, 2024
1 parent bc53faa commit a696a4f
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/capability/msix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,18 @@ impl MsixCapability {
}
}

/// Enable/disable masking of all interrupts for this PCI function.
///
/// Individual interrupt sources can be masked using mask field of the corresponding entry in
/// the MSI-X table.
pub fn set_function_mask(&mut self, mask: bool, access: impl ConfigRegionAccess) {
let mut control = unsafe { access.read(self.address.address, self.address.offset) };
control.set_bit(30, mask);
unsafe {
access.write(self.address.address, self.address.offset, control);
}
}

/// The index of the BAR that contains the MSI-X table.
pub fn table_bar(&self) -> u8 {
self.table.get_bits(0..3) as u8
Expand Down

0 comments on commit a696a4f

Please sign in to comment.