Skip to content

Commit a7930f5

Browse files
authored
Merge pull request #8 from Gelbpunkt/more-pci-endianess
fix(pci): actually convert MMIO access to little endian
2 parents a7d7294 + 0de9bcc commit a7930f5

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/pci.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use volatile_macro::VolatileFieldAccess;
1111

1212
pub use crate::driver_notifications::NotificationData;
1313
use crate::volatile::WideVolatilePtr;
14-
use crate::{le16, le32, le64, DeviceConfigSpace, DeviceStatus, Le};
14+
use crate::{le16, le32, le64, DeviceConfigSpace, DeviceStatus};
1515

1616
/// PCI Capability
1717
///
@@ -234,11 +234,11 @@ impl CapData {
234234
}
235235

236236
let offset_hi = unsafe { access.read(addr.address, addr.offset + 16) };
237-
let offset_hi = Le(offset_hi);
237+
let offset_hi = le32::from_ne(offset_hi);
238238
let offset = le64::from([cap.offset, offset_hi]);
239239

240240
let length_hi = unsafe { access.read(addr.address, addr.offset + 20) };
241-
let length_hi = Le(length_hi);
241+
let length_hi = le32::from_ne(length_hi);
242242
let length = le64::from([cap.length, length_hi]);
243243

244244
(offset, length)
@@ -253,7 +253,7 @@ impl CapData {
253253
}
254254

255255
let notify_off_multiplier = unsafe { access.read(addr.address, addr.offset + 16) };
256-
let notify_off_multiplier = Le(notify_off_multiplier);
256+
let notify_off_multiplier = le32::from_ne(notify_off_multiplier);
257257

258258
Some(notify_off_multiplier)
259259
}

0 commit comments

Comments
 (0)