2006-11-27 06:21:28 +01:00
|
|
|
#include <fdt.h>
|
|
|
|
#include "testdata.h"
|
|
|
|
|
2006-12-04 02:52:45 +01:00
|
|
|
#define FDTLONG(val) \
|
|
|
|
.byte ((val) >> 24) & 0xff ; \
|
|
|
|
.byte ((val) >> 16) & 0xff ; \
|
|
|
|
.byte ((val) >> 8) & 0xff ; \
|
|
|
|
.byte (val) & 0xff
|
|
|
|
|
|
|
|
#define FDTQUAD(val) \
|
|
|
|
.byte ((val) >> 56) & 0xff ; \
|
|
|
|
.byte ((val) >> 48) & 0xff ; \
|
|
|
|
.byte ((val) >> 40) & 0xff ; \
|
|
|
|
.byte ((val) >> 32) & 0xff ; \
|
|
|
|
.byte ((val) >> 24) & 0xff ; \
|
|
|
|
.byte ((val) >> 16) & 0xff ; \
|
|
|
|
.byte ((val) >> 8) & 0xff ; \
|
|
|
|
.byte (val) & 0xff
|
|
|
|
|
2006-11-27 06:21:28 +01:00
|
|
|
#define TREE_HDR(tree) \
|
2006-12-14 05:29:25 +01:00
|
|
|
.balign 4 ; \
|
2006-11-27 06:21:28 +01:00
|
|
|
.globl _##tree ; \
|
|
|
|
_##tree: \
|
|
|
|
tree: \
|
2006-12-04 02:52:45 +01:00
|
|
|
FDTLONG(FDT_MAGIC) ; \
|
|
|
|
FDTLONG(tree##_end - tree) ; \
|
|
|
|
FDTLONG(tree##_struct - tree) ; \
|
|
|
|
FDTLONG(tree##_strings - tree) ; \
|
|
|
|
FDTLONG(tree##_rsvmap - tree) ; \
|
|
|
|
FDTLONG(0x11) ; \
|
|
|
|
FDTLONG(0x10) ; \
|
|
|
|
FDTLONG(0) ; \
|
|
|
|
FDTLONG(tree##_end - tree##_strings) ; \
|
|
|
|
FDTLONG(tree##_strings - tree##_struct) ;
|
2006-11-27 06:21:28 +01:00
|
|
|
|
|
|
|
#define RSVMAP_ENTRY(addr, len) \
|
2006-12-04 02:52:45 +01:00
|
|
|
FDTQUAD(addr) ; \
|
|
|
|
FDTQUAD(len) ;
|
2006-11-27 06:21:28 +01:00
|
|
|
|
2007-10-10 09:12:12 +02:00
|
|
|
#define EMPTY_RSVMAP(tree) \
|
|
|
|
.balign 8 ; \
|
|
|
|
tree##_rsvmap: ; \
|
|
|
|
RSVMAP_ENTRY(0, 0)
|
|
|
|
|
2006-11-27 06:21:28 +01:00
|
|
|
#define PROPHDR(tree, name, len) \
|
2006-12-04 02:52:45 +01:00
|
|
|
FDTLONG(FDT_PROP) ; \
|
2007-02-23 04:40:14 +01:00
|
|
|
FDTLONG(len) ; \
|
|
|
|
FDTLONG(tree##_##name - tree##_strings) ;
|
2006-11-27 06:21:28 +01:00
|
|
|
|
|
|
|
#define PROP_INT(tree, name, val) \
|
|
|
|
PROPHDR(tree, name, 4) \
|
2006-12-04 02:52:45 +01:00
|
|
|
/* For ease of testing the property values go in native-endian */ \
|
2006-11-27 06:21:28 +01:00
|
|
|
.long val
|
|
|
|
|
|
|
|
#define PROP_STR(tree, name, str) \
|
|
|
|
PROPHDR(tree, name, 55f - 54f) \
|
|
|
|
54: \
|
|
|
|
.string str ; \
|
|
|
|
55: \
|
|
|
|
.balign 4
|
|
|
|
|
|
|
|
#define BEGIN_NODE(name) \
|
2006-12-04 02:52:45 +01:00
|
|
|
FDTLONG(FDT_BEGIN_NODE) ; \
|
2006-11-27 06:21:28 +01:00
|
|
|
.string name ; \
|
|
|
|
.balign 4
|
|
|
|
|
|
|
|
#define END_NODE \
|
2006-12-04 02:52:45 +01:00
|
|
|
FDTLONG(FDT_END_NODE) ;
|
2006-11-27 06:21:28 +01:00
|
|
|
|
|
|
|
#define STRING(tree, name, str) \
|
|
|
|
tree##_##name: \
|
|
|
|
.string str
|
2007-09-18 03:44:04 +02:00
|
|
|
|
2006-11-27 06:21:28 +01:00
|
|
|
.data
|
|
|
|
|
|
|
|
TREE_HDR(test_tree1)
|
|
|
|
|
2007-10-10 09:12:12 +02:00
|
|
|
.balign 8
|
2006-11-27 06:21:28 +01:00
|
|
|
test_tree1_rsvmap:
|
2007-10-10 09:12:12 +02:00
|
|
|
RSVMAP_ENTRY(TEST_ADDR_1, TEST_SIZE_1)
|
|
|
|
RSVMAP_ENTRY(TEST_ADDR_2, TEST_SIZE_2)
|
2006-11-27 06:21:28 +01:00
|
|
|
RSVMAP_ENTRY(0, 0)
|
|
|
|
|
|
|
|
test_tree1_struct:
|
|
|
|
BEGIN_NODE("")
|
2007-10-16 05:58:25 +02:00
|
|
|
PROP_STR(test_tree1, compatible, "test_tree1")
|
2006-11-27 06:21:28 +01:00
|
|
|
PROP_INT(test_tree1, prop_int, TEST_VALUE_1)
|
|
|
|
PROP_STR(test_tree1, prop_str, TEST_STRING_1)
|
2007-09-18 03:44:04 +02:00
|
|
|
|
2007-09-28 07:51:04 +02:00
|
|
|
BEGIN_NODE("subnode@1")
|
2007-10-16 05:58:25 +02:00
|
|
|
PROP_STR(test_tree1, compatible, "subnode1")
|
2006-11-27 06:21:28 +01:00
|
|
|
PROP_INT(test_tree1, prop_int, TEST_VALUE_1)
|
|
|
|
|
|
|
|
BEGIN_NODE("subsubnode")
|
2007-10-16 05:58:25 +02:00
|
|
|
PROP_STR(test_tree1, compatible, "subsubnode1\0subsubnode")
|
2006-11-27 06:21:28 +01:00
|
|
|
PROP_INT(test_tree1, prop_int, TEST_VALUE_1)
|
|
|
|
END_NODE
|
|
|
|
END_NODE
|
|
|
|
|
2007-09-28 07:51:04 +02:00
|
|
|
BEGIN_NODE("subnode@2")
|
2006-11-27 06:21:28 +01:00
|
|
|
PROP_INT(test_tree1, prop_int, TEST_VALUE_2)
|
|
|
|
|
2007-09-28 07:51:04 +02:00
|
|
|
BEGIN_NODE("subsubnode@0")
|
2007-10-16 05:58:25 +02:00
|
|
|
PROP_STR(test_tree1, compatible, "subsubnode2\0subsubnode")
|
2006-11-27 06:21:28 +01:00
|
|
|
PROP_INT(test_tree1, prop_int, TEST_VALUE_2)
|
|
|
|
END_NODE
|
|
|
|
END_NODE
|
|
|
|
|
|
|
|
END_NODE
|
2006-12-04 02:52:45 +01:00
|
|
|
FDTLONG(FDT_END)
|
2006-11-27 06:21:28 +01:00
|
|
|
|
|
|
|
test_tree1_strings:
|
2007-10-16 05:58:25 +02:00
|
|
|
STRING(test_tree1, compatible, "compatible")
|
2006-11-27 06:21:28 +01:00
|
|
|
STRING(test_tree1, prop_int, "prop-int")
|
|
|
|
STRING(test_tree1, prop_str, "prop-str")
|
|
|
|
test_tree1_end:
|
2006-12-14 05:29:25 +01:00
|
|
|
|
|
|
|
TREE_HDR(truncated_property)
|
2007-10-10 09:12:12 +02:00
|
|
|
EMPTY_RSVMAP(truncated_property)
|
2006-12-14 05:29:25 +01:00
|
|
|
|
|
|
|
truncated_property_struct:
|
|
|
|
BEGIN_NODE("")
|
|
|
|
PROPHDR(truncated_property, prop_truncated, 4)
|
|
|
|
/* Oops, no actual property data here */
|
2007-09-18 03:44:04 +02:00
|
|
|
|
2006-12-14 05:29:25 +01:00
|
|
|
truncated_property_strings:
|
|
|
|
STRING(truncated_property, prop_truncated, "truncated")
|
|
|
|
truncated_property_end:
|