Assert PCI config space accesses are aligned
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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),
|
||||
|
||||
Reference in New Issue
Block a user