These patches add a new function qemu_devtree_setprop_sized_cells() to device_tree.c and use it in arm/boot.c.
We already have a qemu_devtree_setprop_cells() which sets a dtb property to an array of cells whose values are specified by varargs. However for the fairly common case of setting a property to a list of addresses or of address,size pairs the number of cells used by each element in the list depends on the parent's #address-cells and #size-cells properties. To make this easier we provide an analogous qemu_devtree_setprop_sized_cells() function which allows the number of cells used by each element to be specified. The arm/boot.c use is fairly straightforward; I also have some virtio related patches brewing which are going to need to use this to set their 'regs' property values. I figured it was probably better to send this out for review now rather than wait for those, though. The arm/boot bit of the patch depends (textually at least) on http://patchwork.ozlabs.org/patch/251377/ (arm/boot: Free dtb blob memory after use); it will apply cleanly to git://git.linaro.org/people/pmaydell/qemu-arm.git arm-devs.next. Peter Maydell (2): device_tree: Add qemu_devtree_setprop_sized_cells() utility function arm/boot: Use qemu_devtree_setprop_sized_cells() device_tree.c | 48 ++++++++++++++++++++++++++++++++++++++++++ hw/arm/boot.c | 28 ++++++------------------ include/sysemu/device_tree.h | 29 +++++++++++++++++++++++++ 3 files changed, 84 insertions(+), 21 deletions(-) -- 1.7.9.5