From 00cdbbc673ecde8cf3a79aee2b00d0a1a62d4766 Mon Sep 17 00:00:00 2001 From: Sebastien Boeuf Date: Thu, 6 Jun 2019 08:52:11 -0700 Subject: [PATCH] pci: Make MSI-X PBA read only Relying on the PCI specification, the Pending Bit Array is read only. Signed-off-by: Sebastien Boeuf --- pci/src/msix.rs | 32 ++------------------------------ 1 file changed, 2 insertions(+), 30 deletions(-) diff --git a/pci/src/msix.rs b/pci/src/msix.rs index 80a3b9593..9d59a570d 100644 --- a/pci/src/msix.rs +++ b/pci/src/msix.rs @@ -130,36 +130,8 @@ impl MsixConfig { } } - pub fn write_pba(&mut self, offset: u64, data: &[u8]) { - assert!((data.len() == 4 || data.len() == 8)); - - let index: usize = (offset / MSIX_PBA_ENTRIES_MODULO) as usize; - let modulo_offset = offset % MSIX_PBA_ENTRIES_MODULO; - - match data.len() { - 4 => { - let value = LittleEndian::read_u32(data); - match modulo_offset { - 0x0 => self.pba_entries[index] = u64::from(value), - 0x4 => self.pba_entries[index] = u64::from(value) << 32, - _ => error!("invalid offset"), - } - - debug!("MSI_W PBA offset 0x{:x} data 0x{:x}", offset, value); - } - 8 => { - let value = LittleEndian::read_u64(data); - match modulo_offset { - 0x0 => self.pba_entries[index] = value, - _ => error!("invalid offset"), - } - - debug!("MSI_W PBA offset 0x{:x} data 0x{:x}", offset, value); - } - _ => { - error!("invalid data length"); - } - } + pub fn write_pba(&mut self, _offset: u64, _data: &[u8]) { + error!("Pending Bit Array is read only"); } }