pvmfw: Add swiotlb <reg> to platform.dts
Instead of inserting the property into the template DT (which requires
shifting all following nodes), have a placeholder property that can be
overwritten in place.
Ensure that it is removed (NOP-ed) when not required.
Test: m pvmfw_img
Change-Id: Ife13eb84e23c43655513dfedffdedb1ea7fd2e78
diff --git a/pvmfw/platform.dts b/pvmfw/platform.dts
index a7b1de7..74439d9 100644
--- a/pvmfw/platform.dts
+++ b/pvmfw/platform.dts
@@ -37,6 +37,7 @@
ranges;
swiotlb: restricted_dma_reserved {
compatible = "restricted-dma-pool";
+ reg = <PLACEHOLDER4>;
size = <PLACEHOLDER2>;
alignment = <PLACEHOLDER2>;
};
diff --git a/pvmfw/src/fdt.rs b/pvmfw/src/fdt.rs
index 97db601..63a59a1 100644
--- a/pvmfw/src/fdt.rs
+++ b/pvmfw/src/fdt.rs
@@ -499,7 +499,7 @@
fdt.root_mut()?.next_compatible(cstr!("restricted-dma-pool"))?.ok_or(FdtError::NotFound)?;
if let Some(range) = swiotlb_info.fixed_range() {
- node.appendprop_addrrange(
+ node.setprop_addrrange_inplace(
cstr!("reg"),
range.start.try_into().unwrap(),
range.len().try_into().unwrap(),
@@ -507,6 +507,7 @@
node.nop_property(cstr!("size"))?;
node.nop_property(cstr!("alignment"))?;
} else {
+ node.nop_property(cstr!("reg"))?;
node.setprop_inplace(cstr!("size"), &swiotlb_info.size.to_be_bytes())?;
node.setprop_inplace(cstr!("alignment"), &swiotlb_info.align.unwrap().to_be_bytes())?;
}