On 5 December 2016 at 15:11, Benjamin Fair <b-fair@xxxxxx> wrote: > This patch extends the capability of libfdt to parse the contents of device > trees in a similar manner to fdt_address_cells and fdt_size_cells. > > It adds helper functions which read the address and size of a device from > the reg property and performs basic sanity checks. Some functions also > parse the values into integers in the host endianness. > > The functions do not perform translation to a physical address using the > ranges properties of parents, but this enhancement may be added as a > separate function in the future. > > Signed-off-by: Benjamin Fair <b-fair@xxxxxx> > --- > > Changes since v1: > > * Split functions into smaller pieces > -> Also added wrapper functions to perform the full set of actions > * Changed types of addresses and sizes to uint64_t > * Removed unneeded constants > * Renamed and exported fdt_read_integer() > > libfdt/fdt_addresses.c | 118 ++++++++++++++++++++++++++++++++++++++++ > libfdt/libfdt.h | 145 +++++++++++++++++++++++++++++++++++++++++++++++++ > libfdt/version.lds | 5 ++ > tests/.gitignore | 1 + > tests/Makefile.tests | 2 +- > tests/addr_size.c | 130 ++++++++++++++++++++++++++++++++++++++++++++ > tests/addresses.dts | 11 ++++ > tests/run_tests.sh | 1 + > 8 files changed, 412 insertions(+), 1 deletion(-) > create mode 100644 tests/addr_size.c Reviewed-by: Simon Glass <sjg@xxxxxxxxxxxx> One point to note is that fdt_parent_offset() can be quite slow. It might be worth mentioning that in the function comments. Regards, Simon -- To unsubscribe from this list: send the line "unsubscribe devicetree-compiler" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html