From 8c5a21563a8ce9db0e34af2b399910c9cb507172 Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Sun, 9 Jun 2024 21:36:12 +0200 Subject: [PATCH] Add methods to get the current MSI-X enable and function mask status --- src/capability/msix.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/capability/msix.rs b/src/capability/msix.rs index 132b6f0..1fe85c3 100644 --- a/src/capability/msix.rs +++ b/src/capability/msix.rs @@ -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 @@ -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