platform_external_dtc/tests/trees.S
David Gibson fe92f6bb75 libfdt: Introduce flat tree format v17
v17 of the blob format adds a field for the size of the structure
block, but is backwards compatible with v16.  This patch introduces
definitions for the new field, and uses it to improve the bounds
checking in the read-only code.  It also cleans up the sequential
write code using it: we no longer need to borrow the version field as
a write pointer.
2006-12-01 16:25:39 +11:00

85 lines
1.6 KiB
ArmAsm

#include <fdt.h>
#include "testdata.h"
#define TREE_HDR(tree) \
.globl _##tree ; \
_##tree: \
tree: \
.long FDT_MAGIC ; \
.long tree##_end - tree ; \
.long tree##_struct - tree ; \
.long tree##_strings - tree ; \
.long tree##_rsvmap - tree ; \
.long 0x11 ; \
.long 0x10 ; \
.long 0 ; \
.long tree##_end - tree##_strings ; \
.long tree##_strings - tree##_struct ;
#define RSVMAP_ENTRY(addr, len) \
.quad addr ; \
.quad len ;
#define PROPHDR(tree, name, len) \
.long FDT_PROP ; \
.long tree##_##name - tree##_strings ; \
.long len ;
#define PROP_INT(tree, name, val) \
PROPHDR(tree, name, 4) \
.long val
#define PROP_STR(tree, name, str) \
PROPHDR(tree, name, 55f - 54f) \
54: \
.string str ; \
55: \
.balign 4
#define BEGIN_NODE(name) \
.long FDT_BEGIN_NODE ; \
.string name ; \
.balign 4
#define END_NODE \
.long FDT_END_NODE ;
#define STRING(tree, name, str) \
tree##_##name: \
.string str
.data
TREE_HDR(test_tree1)
test_tree1_rsvmap:
RSVMAP_ENTRY(0, 0)
test_tree1_struct:
BEGIN_NODE("")
PROP_INT(test_tree1, prop_int, TEST_VALUE_1)
PROP_STR(test_tree1, prop_str, TEST_STRING_1)
BEGIN_NODE("subnode1")
PROP_INT(test_tree1, prop_int, TEST_VALUE_1)
BEGIN_NODE("subsubnode")
PROP_INT(test_tree1, prop_int, TEST_VALUE_1)
END_NODE
END_NODE
BEGIN_NODE("subnode2")
PROP_INT(test_tree1, prop_int, TEST_VALUE_2)
BEGIN_NODE("subsubnode")
PROP_INT(test_tree1, prop_int, TEST_VALUE_2)
END_NODE
END_NODE
END_NODE
.long FDT_END
test_tree1_strings:
STRING(test_tree1, prop_int, "prop-int")
STRING(test_tree1, prop_str, "prop-str")
test_tree1_end: