Misc arm device tree fixes

This commit is contained in:
bjorn3
2024-03-17 19:28:58 +01:00
parent c583745ede
commit e1f4bf4356
3 changed files with 5 additions and 3 deletions
Generated
+1 -1
View File
@@ -77,7 +77,7 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5"
[[package]]
name = "fdt"
version = "0.1.0"
source = "git+https://gitlab.redox-os.org/thomhuds/fdt.git#7358607679114ccab5f97e14894ed3b59c5d42d6"
source = "git+https://gitlab.redox-os.org/rosehuds/fdt.git#7358607679114ccab5f97e14894ed3b59c5d42d6"
dependencies = [
"byteorder",
]
+1 -1
View File
@@ -34,7 +34,7 @@ default-features = false
[target.'cfg(target_arch = "aarch64")'.dependencies]
byteorder = { version = "1", default-features = false }
fdt = { git = "https://gitlab.redox-os.org/thomhuds/fdt.git", default-features = false }
fdt = { git = "https://gitlab.redox-os.org/rosehuds/fdt.git", default-features = false }
[target.'cfg(any(target_arch = "x86", target_arch = "x86_64"))'.dependencies]
raw-cpuid = "10.2.0"
+3 -1
View File
@@ -28,7 +28,7 @@ pub fn root_cell_sz(dt: &fdt::DeviceTree) -> Option<(u32, u32)> {
.unwrap();
Some((
BE::read_u32(&size_cells.data),
BE::read_u32(&address_cells.data),
BE::read_u32(&size_cells.data),
))
}
@@ -177,6 +177,7 @@ fn dev_memory_ranges(
};
let addr_size = {
// FIXME offsets incorrect if address_cells != size_cells
if address_cells == 1 {
BE::read_u32(&chunk[8..12]) as u64
} else if address_cells == 2 {
@@ -233,6 +234,7 @@ pub fn diag_uart_range(dtb_base: usize, dtb_size: usize) -> Option<(usize, usize
let chunk_sz = (address_cells + size_cells) * 4;
let (base, size) = reg.data.split_at((address_cells * 4) as usize);
let mut b = 0;
// FIXME likely needs shifting before addition
for base_chunk in base.rchunks(4) {
b += BE::read_u32(base_chunk);
}