Skip to content

Commit 05a544e

Browse files
committed
Add method to enable/disable function masking for MSI-X
Function masking needs to be disabled before any interrupts can be received.
1 parent 07959ec commit 05a544e

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/capability/msix.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,18 @@ impl MsixCapability {
3939
}
4040
}
4141

42+
/// Enable/disable masking of all interrupts for this PCI function.
43+
///
44+
/// Individual interrupt sources can be masked using mask field of the corresponding entry in
45+
/// the MSI-X table.
46+
pub fn set_function_mask(&mut self, mask: bool, access: impl ConfigRegionAccess) {
47+
let mut control = unsafe { access.read(self.address.address, self.address.offset) };
48+
control.set_bit(30, mask);
49+
unsafe {
50+
access.write(self.address.address, self.address.offset, control);
51+
}
52+
}
53+
4254
/// The index of the BAR that contains the MSI-X table.
4355
pub fn table_bar(&self) -> u8 {
4456
self.table.get_bits(0..3) as u8

0 commit comments

Comments
 (0)