Skip to content

Commit

Permalink
add prefectable
Browse files Browse the repository at this point in the history
  • Loading branch information
ZR233 committed Dec 5, 2024
1 parent 76e3588 commit 2486945
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion fdt-parser/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "fdt-parser"
version = "0.4.1"
version = "0.4.2"
authors = ["周睿 <zrufo747@outlook.com>"]
edition = "2021"
repository = "https://github.com/qclic/fdt-parser"
Expand Down
2 changes: 1 addition & 1 deletion fdt-parser/src/define.rs
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ impl<'a> FdtRange<'a> {
}
}

impl<'a> Debug for FdtRange<'a> {
impl Debug for FdtRange<'_> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
f.write_str("Range {{ child_bus_address: [ ")?;
for addr in self.child_bus_address() {
Expand Down
2 changes: 1 addition & 1 deletion fdt-parser/src/interrupt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pub struct InterruptController<'a> {
pub node: Node<'a>,
}

impl<'a> InterruptController<'a> {
impl InterruptController<'_> {
pub fn interrupt_cells(&self) -> usize {
self.node.find_property("#interrupt-cells").unwrap().u32() as _
}
Expand Down
2 changes: 1 addition & 1 deletion fdt-parser/src/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ struct RegIter<'a> {
prop: Property<'a>,
ranges: Option<FdtRangeSilce<'a>>,
}
impl<'a> Iterator for RegIter<'a> {
impl Iterator for RegIter<'_> {
type Item = FdtReg;

fn next(&mut self) -> Option<Self::Item> {
Expand Down
7 changes: 5 additions & 2 deletions fdt-parser/src/pci.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ impl Iterator for PciRangeIter<'_> {
let low = child.next().unwrap();

let ss = (hi >> 24) & 0b11;
let prefetchable = (hi & 1 << 30) > 0;

let space = match ss {
0b00 => PciSpace::Configuration,
Expand All @@ -62,6 +63,7 @@ impl Iterator for PciRangeIter<'_> {
bus_address: child_bus_address,
cpu_address,
size,
prefetchable,
})
}
}
Expand All @@ -80,11 +82,12 @@ pub struct PciRange {
pub bus_address: u64,
pub cpu_address: u64,
pub size: u64,
pub prefetchable: bool,
}

impl Debug for PciRange {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
write!(f, "PciRange {{ space: {:?}, child_bus_address: {:#x}, parent_bus_address: {:#x}, size: {:#x} }}",
self.space, self.bus_address, self.cpu_address, self.size)
write!(f, "PciRange {{ space: {:?}, child_bus_address: {:#x}, parent_bus_address: {:#x}, size: {:#x}, prefetchable: {}}}",
self.space, self.bus_address, self.cpu_address, self.size, self.prefetchable)
}
}
3 changes: 3 additions & 0 deletions fdt-parser/tests/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,18 +163,21 @@ mod test {
bus_address: 0x0,
cpu_address: 0x50000000,
size: 0xf00000,
prefetchable: false,
},
PciRange {
space: PciSpace::Memory32,
bus_address: 0x58000000,
cpu_address: 0x58000000,
size: 0x28000000,
prefetchable: false,
},
PciRange {
space: PciSpace::Memory64,
bus_address: 0x1000000000,
cpu_address: 0x1000000000,
size: 0x1000000000,
prefetchable: false,
},
];

Expand Down

0 comments on commit 2486945

Please sign in to comment.