From 07a12a08005f3b5cd9337900a6551e450c07b515 Mon Sep 17 00:00:00 2001 From: David Gibson Date: Fri, 23 Feb 2007 14:40:14 +1100 Subject: [PATCH] libfdt: Use correct property format Since its beginning, libfdt has used an incorrect definition of the format for a property, putting the name offset before length, rather than the other way around as described in booting-without-of.txt. This corrects the error, making libfdt actually produce and use trees which are compatible with the kernel and dtc. Signed-of-by: David Gibson --- fdt.c | 2 +- fdt.h | 2 +- tests/trees.S | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/fdt.c b/fdt.c index 45568b1..772da46 100644 --- a/fdt.c +++ b/fdt.c @@ -83,7 +83,7 @@ uint32_t _fdt_next_tag(const void *fdt, int offset, int *nextoffset) return FDT_END; break; case FDT_PROP: - lenp = fdt_offset_ptr(fdt, offset + FDT_TAGSIZE, sizeof(*lenp)); + lenp = fdt_offset_ptr(fdt, offset, sizeof(*lenp)); if (! lenp) return FDT_END; /* skip name offset, length and value */ diff --git a/fdt.h b/fdt.h index fff533e..4687a31 100644 --- a/fdt.h +++ b/fdt.h @@ -36,8 +36,8 @@ struct fdt_node_header { struct fdt_property { uint32_t tag; - uint32_t nameoff; uint32_t len; + uint32_t nameoff; char data[0]; }; diff --git a/tests/trees.S b/tests/trees.S index 397c151..6057668 100644 --- a/tests/trees.S +++ b/tests/trees.S @@ -39,8 +39,8 @@ tree: \ #define PROPHDR(tree, name, len) \ FDTLONG(FDT_PROP) ; \ - FDTLONG(tree##_##name - tree##_strings) ; \ - FDTLONG(len) ; + FDTLONG(len) ; \ + FDTLONG(tree##_##name - tree##_strings) ; #define PROP_INT(tree, name, val) \ PROPHDR(tree, name, 4) \