From 6949a9cd53db4ebca7c3ffcc032ec1460f1438a7 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 b79c22b..93651ad 100644 --- a/src/capability/msix.rs +++ b/src/capability/msix.rs @@ -39,6 +39,11 @@ impl MsixCapability { } } + pub fn get_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 get_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