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/libs/libfdt/Android.bp b/libs/libfdt/Android.bp
index 72399b0..5a729f1 100644
--- a/libs/libfdt/Android.bp
+++ b/libs/libfdt/Android.bp
@@ -37,6 +37,7 @@
],
rustlibs: [
"liblibfdt_bindgen",
+ "libzerocopy_nostd",
],
whole_static_libs: [
"libfdt",
diff --git a/libs/libfdt/src/lib.rs b/libs/libfdt/src/lib.rs
index 17cafd5..df1058e 100644
--- a/libs/libfdt/src/lib.rs
+++ b/libs/libfdt/src/lib.rs
@@ -26,6 +26,7 @@
use core::fmt;
use core::mem;
use core::result;
+use zerocopy::AsBytes as _;
/// Error type corresponding to libfdt error codes.
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
@@ -441,6 +442,13 @@
fdt_err_expect_zero(ret)
}
+ /// Replace the value of the given (address, size) pair property with the given value, and
+ /// ensure that the given value has the same length as the current value length
+ pub fn setprop_addrrange_inplace(&mut self, name: &CStr, addr: u64, size: u64) -> Result<()> {
+ let pair = [addr.to_be(), size.to_be()];
+ self.setprop_inplace(name, pair.as_bytes())
+ }
+
/// Create or change a flag-like empty property.
pub fn setprop_empty(&mut self, name: &CStr) -> Result<()> {
self.setprop(name, &[])