Skip to content

Commit

Permalink
Add methods to get the current MSI-X enable and function mask status
Browse files Browse the repository at this point in the history
  • Loading branch information
bjorn3 authored and IsaacWoods committed Jun 14, 2024
1 parent a696a4f commit 8c5a215
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/capability/msix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ impl MsixCapability {
}
}

pub fn enabled(&self, access: impl ConfigRegionAccess) -> bool {
let control = unsafe { access.read(self.address.address, self.address.offset) };
control.get_bit(31)
}

/// Enable/disable masking of all interrupts for this PCI function.
///
/// Individual interrupt sources can be masked using mask field of the corresponding entry in
Expand All @@ -51,6 +56,11 @@ impl MsixCapability {
}
}

pub fn function_mask(&self, access: impl ConfigRegionAccess) -> bool {
let control = unsafe { access.read(self.address.address, self.address.offset) };
control.get_bit(30)
}

/// 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 8c5a215

Please sign in to comment.