diff --git a/pcid/src/pcie/fallback.rs b/pcid/src/pcie/fallback.rs index 63f70eeb7a..90023961f7 100644 --- a/pcid/src/pcie/fallback.rs +++ b/pcid/src/pcie/fallback.rs @@ -42,18 +42,14 @@ impl Pci { } fn address(address: PciAddress, offset: u8) -> u32 { - // TODO: Find the part of pcid that uses an unaligned offset! - // - // assert_eq!(offset & 0xFC, offset, "pci offset is not aligned"); - // - let offset = offset & 0xFC; - assert_eq!( address.segment(), 0, "usage of multiple segments requires PCIe extended configuration" ); + assert_eq!(offset & 0xFC, offset, "pci offset is not aligned"); + 0x80000000 | (u32::from(address.bus()) << 16) | (u32::from(address.device()) << 11) diff --git a/pcid/src/pcie/mod.rs b/pcid/src/pcie/mod.rs index 24dbee0d12..0925b21d03 100644 --- a/pcid/src/pcie/mod.rs +++ b/pcid/src/pcie/mod.rs @@ -205,6 +205,8 @@ impl Pcie { "multiple segments not yet implemented" ); + assert_eq!(offset & 0xFC, offset, "pci offset is not aligned"); + let bus_addr = match self.bus_maps.get(address.bus() as usize) { Some(Some(bus_addr)) => bus_addr, Some(None) | None => return f(None),