mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-09 05:16:47 +00:00
Fix pci config errors caused by expression precedence
This commit is contained in:
parent
2c6cbee92f
commit
b3d30f7ac3
@ -237,7 +237,7 @@ impl MemoryBar {
|
||||
}
|
||||
};
|
||||
// length
|
||||
let size = !(len_encoded & !0xF).wrapping_add(1);
|
||||
let size = (!(len_encoded & !0xF)).wrapping_add(1);
|
||||
let prefetchable = raw & 0b1000 != 0;
|
||||
// The BAR is located in I/O memory region
|
||||
Ok(MemoryBar {
|
||||
|
@ -137,7 +137,7 @@ impl PciDeviceLocation {
|
||||
|
||||
pub(super) fn write8(&self, offset: u16, val: u8) {
|
||||
let old = self.read32(offset & Self::BIT32_ALIGN_MASK);
|
||||
let dest = offset as usize & 0b11 << 3;
|
||||
let dest = (offset as usize & 0b11) << 3;
|
||||
let mask = (0xFF << dest) as u32;
|
||||
self.write32(
|
||||
offset & Self::BIT32_ALIGN_MASK,
|
||||
@ -147,7 +147,7 @@ impl PciDeviceLocation {
|
||||
|
||||
pub(super) fn write16(&self, offset: u16, val: u16) {
|
||||
let old = self.read32(offset & Self::BIT32_ALIGN_MASK);
|
||||
let dest = offset as usize & 0b10 << 3;
|
||||
let dest = (offset as usize & 0b10) << 3;
|
||||
let mask = (0xFFFF << dest) as u32;
|
||||
self.write32(
|
||||
offset & Self::BIT32_ALIGN_MASK,
|
||||
|
Loading…
x
Reference in New Issue
Block a user