2006-11-27 06:21:28 +01:00
|
|
|
#include <fdt.h>
|
|
|
|
#include "testdata.h"
|
|
|
|
|
2021-09-24 13:14:34 +02:00
|
|
|
.macro fdtlong val
|
|
|
|
.byte ((\val) >> 24) & 0xff
|
|
|
|
.byte ((\val) >> 16) & 0xff
|
|
|
|
.byte ((\val) >> 8) & 0xff
|
|
|
|
.byte (\val) & 0xff
|
|
|
|
.endm
|
|
|
|
|
|
|
|
.macro treehdr tree
|
|
|
|
.balign 8
|
|
|
|
.globl \tree
|
|
|
|
\tree :
|
|
|
|
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\()_strings_end - \tree\()_strings)
|
|
|
|
fdtlong (\tree\()_struct_end - \tree\()_struct)
|
|
|
|
.endm
|
|
|
|
|
|
|
|
.macro rsvmape addrh, addrl, lenh, lenl
|
|
|
|
fdtlong \addrh
|
|
|
|
fdtlong \addrl
|
|
|
|
fdtlong \lenh
|
|
|
|
fdtlong \lenl
|
|
|
|
.endm
|
|
|
|
|
|
|
|
.macro empty_rsvmap tree
|
|
|
|
.balign 8
|
|
|
|
\tree\()_rsvmap:
|
|
|
|
rsvmape 0, 0, 0, 0
|
|
|
|
\tree\()_rsvmap_end:
|
|
|
|
.endm
|
|
|
|
|
|
|
|
.macro prophdr tree, name, len
|
|
|
|
fdtlong FDT_PROP
|
|
|
|
fdtlong \len
|
|
|
|
fdtlong (\tree\()_\name - \tree\()_strings)
|
|
|
|
.endm
|
|
|
|
|
|
|
|
.macro propnil tree, name
|
|
|
|
prophdr \tree, \name, 0
|
|
|
|
.endm
|
|
|
|
|
|
|
|
.macro propu32 tree, name, val
|
|
|
|
prophdr \tree, \name, 4
|
|
|
|
fdtlong \val
|
|
|
|
.endm
|
|
|
|
|
|
|
|
.macro propu64 tree, name, valh, vall
|
|
|
|
prophdr \tree, \name, 8
|
|
|
|
fdtlong \valh
|
|
|
|
fdtlong \vall
|
|
|
|
.endm
|
|
|
|
|
|
|
|
.macro propstr tree, name, str:vararg
|
|
|
|
prophdr \tree, \name, (55f - 54f)
|
|
|
|
54:
|
|
|
|
.asciz \str
|
|
|
|
55:
|
|
|
|
.balign 4
|
|
|
|
.endm
|
|
|
|
|
|
|
|
.macro beginn name:vararg
|
|
|
|
fdtlong FDT_BEGIN_NODE
|
|
|
|
.asciz \name
|
|
|
|
.balign 4
|
|
|
|
.endm
|
|
|
|
|
|
|
|
.macro endn
|
|
|
|
fdtlong FDT_END_NODE
|
|
|
|
.endm
|
|
|
|
|
|
|
|
.macro string tree, name, str:vararg
|
|
|
|
\tree\()_\name :
|
|
|
|
.asciz \str
|
|
|
|
.endm
|
|
|
|
|
2007-09-18 03:44:04 +02:00
|
|
|
|
2006-11-27 06:21:28 +01:00
|
|
|
.data
|
|
|
|
|
2021-09-24 13:14:34 +02:00
|
|
|
treehdr test_tree1
|
2006-11-27 06:21:28 +01:00
|
|
|
|
2007-10-10 09:12:12 +02:00
|
|
|
.balign 8
|
2006-11-27 06:21:28 +01:00
|
|
|
test_tree1_rsvmap:
|
2021-09-24 13:14:34 +02:00
|
|
|
rsvmape TEST_ADDR_1H, TEST_ADDR_1L, TEST_SIZE_1H, TEST_SIZE_1L
|
|
|
|
rsvmape TEST_ADDR_2H, TEST_ADDR_2L, TEST_SIZE_2H, TEST_SIZE_2L
|
|
|
|
rsvmape 0, 0, 0, 0
|
2007-10-18 06:14:09 +02:00
|
|
|
test_tree1_rsvmap_end:
|
2006-11-27 06:21:28 +01:00
|
|
|
|
|
|
|
test_tree1_struct:
|
2021-09-24 13:14:34 +02:00
|
|
|
beginn ""
|
|
|
|
propstr test_tree1, compatible, "test_tree1"
|
|
|
|
propu32 test_tree1, prop_int, TEST_VALUE_1
|
|
|
|
propu64 test_tree1, prop_int64, TEST_VALUE64_1H, TEST_VALUE64_1L
|
|
|
|
propstr test_tree1, prop_str, TEST_STRING_1
|
|
|
|
propu32 test_tree1, address_cells, 1
|
|
|
|
propu32 test_tree1, size_cells, 0
|
|
|
|
|
|
|
|
beginn "subnode@1"
|
|
|
|
propstr test_tree1, compatible, "subnode1"
|
|
|
|
propu32 test_tree1, reg, 1
|
|
|
|
propu32 test_tree1, prop_int, TEST_VALUE_1
|
|
|
|
|
|
|
|
beginn "subsubnode"
|
|
|
|
propstr test_tree1, compatible, "subsubnode1\0subsubnode"
|
|
|
|
propstr test_tree1, placeholder, "this is a placeholder string\0string2"
|
|
|
|
propu32 test_tree1, prop_int, TEST_VALUE_1
|
|
|
|
endn
|
|
|
|
|
|
|
|
beginn "ss1"
|
|
|
|
endn
|
|
|
|
|
|
|
|
endn
|
|
|
|
|
|
|
|
beginn "subnode@2"
|
|
|
|
propu32 test_tree1, reg, 2
|
|
|
|
propu32 test_tree1, linux_phandle, PHANDLE_1
|
|
|
|
propu32 test_tree1, prop_int, TEST_VALUE_2
|
|
|
|
propu32 test_tree1, address_cells, 1
|
|
|
|
propu32 test_tree1, size_cells, 0
|
|
|
|
|
|
|
|
beginn "subsubnode@0"
|
|
|
|
propu32 test_tree1, reg, 0
|
|
|
|
propu32 test_tree1, phandle, PHANDLE_2
|
|
|
|
propstr test_tree1, compatible, "subsubnode2\0subsubnode"
|
|
|
|
propu32 test_tree1, prop_int, TEST_VALUE_2
|
|
|
|
endn
|
|
|
|
|
|
|
|
beginn "ss2"
|
|
|
|
endn
|
|
|
|
|
|
|
|
endn
|
|
|
|
|
|
|
|
endn
|
|
|
|
fdtlong FDT_END
|
2007-10-18 06:14:09 +02:00
|
|
|
test_tree1_struct_end:
|
2006-11-27 06:21:28 +01:00
|
|
|
|
|
|
|
test_tree1_strings:
|
2021-09-24 13:14:34 +02:00
|
|
|
string test_tree1, compatible, "compatible"
|
|
|
|
string test_tree1, prop_int, "prop-int"
|
|
|
|
string test_tree1, prop_int64, "prop-int64"
|
|
|
|
string test_tree1, prop_str, "prop-str"
|
|
|
|
string test_tree1, linux_phandle, "linux,phandle"
|
|
|
|
string test_tree1, phandle, "phandle"
|
|
|
|
string test_tree1, reg, "reg"
|
|
|
|
string test_tree1, placeholder, "placeholder"
|
|
|
|
string test_tree1, address_cells, "#address-cells"
|
|
|
|
string test_tree1, size_cells, "#size-cells"
|
2007-10-18 06:14:09 +02:00
|
|
|
test_tree1_strings_end:
|
2006-11-27 06:21:28 +01:00
|
|
|
test_tree1_end:
|
2006-12-14 05:29:25 +01:00
|
|
|
|
2007-10-18 06:14:09 +02:00
|
|
|
|
2021-09-24 13:14:34 +02:00
|
|
|
treehdr truncated_property
|
|
|
|
empty_rsvmap truncated_property
|
2006-12-14 05:29:25 +01:00
|
|
|
|
|
|
|
truncated_property_struct:
|
2021-09-24 13:14:34 +02:00
|
|
|
beginn ""
|
|
|
|
prophdr truncated_property, prop_truncated, 4
|
2006-12-14 05:29:25 +01:00
|
|
|
/* Oops, no actual property data here */
|
2007-10-18 06:14:09 +02:00
|
|
|
truncated_property_struct_end:
|
2007-09-18 03:44:04 +02:00
|
|
|
|
2006-12-14 05:29:25 +01:00
|
|
|
truncated_property_strings:
|
2021-09-24 13:14:34 +02:00
|
|
|
string truncated_property, prop_truncated, "truncated"
|
2007-10-18 06:14:09 +02:00
|
|
|
truncated_property_strings_end:
|
|
|
|
|
2006-12-14 05:29:25 +01:00
|
|
|
truncated_property_end:
|
2008-02-27 03:45:13 +01:00
|
|
|
|
|
|
|
|
2021-09-24 13:14:34 +02:00
|
|
|
treehdr bad_node_char
|
|
|
|
empty_rsvmap bad_node_char
|
2008-02-27 03:45:13 +01:00
|
|
|
|
|
|
|
bad_node_char_struct:
|
2021-09-24 13:14:34 +02:00
|
|
|
beginn ""
|
|
|
|
beginn "sub$node"
|
|
|
|
endn
|
|
|
|
endn
|
|
|
|
fdtlong FDT_END
|
2008-02-27 03:45:13 +01:00
|
|
|
bad_node_char_struct_end:
|
|
|
|
|
|
|
|
bad_node_char_strings:
|
|
|
|
bad_node_char_strings_end:
|
|
|
|
bad_node_char_end:
|
|
|
|
|
|
|
|
|
2021-09-24 13:14:34 +02:00
|
|
|
treehdr bad_node_format
|
|
|
|
empty_rsvmap bad_node_format
|
2008-02-27 03:45:13 +01:00
|
|
|
|
|
|
|
bad_node_format_struct:
|
2021-09-24 13:14:34 +02:00
|
|
|
beginn ""
|
|
|
|
beginn "subnode@1@2"
|
|
|
|
endn
|
|
|
|
endn
|
|
|
|
fdtlong FDT_END
|
2008-02-27 03:45:13 +01:00
|
|
|
bad_node_format_struct_end:
|
|
|
|
|
|
|
|
bad_node_format_strings:
|
|
|
|
bad_node_format_strings_end:
|
|
|
|
bad_node_format_end:
|
|
|
|
|
|
|
|
|
2021-09-24 13:14:34 +02:00
|
|
|
treehdr bad_prop_char
|
|
|
|
empty_rsvmap bad_prop_char
|
2008-02-27 03:45:13 +01:00
|
|
|
|
|
|
|
bad_prop_char_struct:
|
2021-09-24 13:14:34 +02:00
|
|
|
beginn ""
|
|
|
|
propu32 bad_prop_char, prop, TEST_VALUE_1
|
|
|
|
endn
|
|
|
|
fdtlong FDT_END
|
2008-02-27 03:45:13 +01:00
|
|
|
bad_prop_char_struct_end:
|
|
|
|
|
|
|
|
bad_prop_char_strings:
|
2021-09-24 13:14:34 +02:00
|
|
|
string bad_prop_char, prop, "prop$erty"
|
2008-02-27 03:45:13 +01:00
|
|
|
bad_prop_char_strings_end:
|
|
|
|
bad_prop_char_end:
|
2016-01-02 22:43:35 +01:00
|
|
|
|
|
|
|
|
|
|
|
/* overflow_size_strings */
|
|
|
|
.balign 8
|
2017-10-18 07:59:43 +02:00
|
|
|
.globl ovf_size_strings
|
2016-01-02 22:43:35 +01:00
|
|
|
ovf_size_strings:
|
2021-09-24 13:14:34 +02:00
|
|
|
fdtlong FDT_MAGIC
|
|
|
|
fdtlong (ovf_size_strings_end - ovf_size_strings)
|
|
|
|
fdtlong (ovf_size_strings_struct - ovf_size_strings)
|
|
|
|
fdtlong (ovf_size_strings_strings - ovf_size_strings)
|
|
|
|
fdtlong (ovf_size_strings_rsvmap - ovf_size_strings)
|
|
|
|
fdtlong 0x11
|
|
|
|
fdtlong 0x10
|
|
|
|
fdtlong 0
|
|
|
|
fdtlong 0xffffffff
|
|
|
|
fdtlong (ovf_size_strings_struct_end - ovf_size_strings_struct)
|
|
|
|
empty_rsvmap ovf_size_strings
|
2016-01-02 22:43:35 +01:00
|
|
|
|
|
|
|
ovf_size_strings_struct:
|
2021-09-24 13:14:34 +02:00
|
|
|
beginn ""
|
|
|
|
propu32 ovf_size_strings, bad_string, 0
|
|
|
|
endn
|
|
|
|
fdtlong FDT_END
|
2016-01-02 22:43:35 +01:00
|
|
|
ovf_size_strings_struct_end:
|
|
|
|
|
|
|
|
ovf_size_strings_strings:
|
2021-09-24 13:14:34 +02:00
|
|
|
string ovf_size_strings, x, "x"
|
2016-01-02 22:43:35 +01:00
|
|
|
ovf_size_strings_bad_string = ovf_size_strings_strings + 0x10000000
|
|
|
|
ovf_size_strings_strings_end:
|
|
|
|
ovf_size_strings_end:
|
2017-11-14 12:45:56 +01:00
|
|
|
|
|
|
|
|
|
|
|
/* truncated_string */
|
2021-09-24 13:14:34 +02:00
|
|
|
treehdr truncated_string
|
|
|
|
empty_rsvmap truncated_string
|
2017-11-14 12:45:56 +01:00
|
|
|
|
|
|
|
truncated_string_struct:
|
2021-09-24 13:14:34 +02:00
|
|
|
beginn ""
|
|
|
|
propnil truncated_string, good_string
|
|
|
|
propnil truncated_string, bad_string
|
|
|
|
endn
|
|
|
|
fdtlong FDT_END
|
2017-11-14 12:45:56 +01:00
|
|
|
truncated_string_struct_end:
|
|
|
|
|
|
|
|
truncated_string_strings:
|
2021-09-24 13:14:34 +02:00
|
|
|
string truncated_string, good_string, "good"
|
2017-11-14 12:45:56 +01:00
|
|
|
truncated_string_bad_string:
|
2021-07-27 20:30:19 +02:00
|
|
|
.ascii "bad"
|
2017-11-14 12:45:56 +01:00
|
|
|
/* NOTE: terminating \0 deliberately missing */
|
|
|
|
truncated_string_strings_end:
|
|
|
|
truncated_string_end:
|
2018-03-09 13:28:56 +01:00
|
|
|
|
|
|
|
|
|
|
|
/* truncated_memrsv */
|
2021-09-24 13:14:34 +02:00
|
|
|
treehdr truncated_memrsv
|
2018-03-09 13:28:56 +01:00
|
|
|
|
|
|
|
truncated_memrsv_struct:
|
2021-09-24 13:14:34 +02:00
|
|
|
beginn ""
|
|
|
|
endn
|
|
|
|
fdtlong FDT_END
|
2018-03-09 13:28:56 +01:00
|
|
|
truncated_memrsv_struct_end:
|
|
|
|
|
|
|
|
truncated_memrsv_strings:
|
|
|
|
truncated_memrsv_strings_end:
|
|
|
|
|
|
|
|
.balign 8
|
|
|
|
truncated_memrsv_rsvmap:
|
2021-09-24 13:14:34 +02:00
|
|
|
rsvmape TEST_ADDR_1H, TEST_ADDR_1L, TEST_SIZE_1H, TEST_SIZE_1L
|
2018-03-09 13:28:56 +01:00
|
|
|
truncated_memrsv_rsvmap_end:
|
|
|
|
|
|
|
|
truncated_memrsv_end:
|
2021-03-23 01:09:25 +01:00
|
|
|
|
|
|
|
|
|
|
|
/* two root nodes */
|
2021-09-24 13:14:34 +02:00
|
|
|
treehdr two_roots
|
|
|
|
empty_rsvmap two_roots
|
2021-03-23 01:09:25 +01:00
|
|
|
|
|
|
|
two_roots_struct:
|
2021-09-24 13:14:34 +02:00
|
|
|
beginn ""
|
|
|
|
endn
|
|
|
|
beginn ""
|
|
|
|
endn
|
|
|
|
fdtlong FDT_END
|
2021-03-23 01:09:25 +01:00
|
|
|
two_roots_struct_end:
|
|
|
|
|
|
|
|
two_roots_strings:
|
|
|
|
two_roots_strings_end:
|
|
|
|
|
|
|
|
two_roots_end:
|
|
|
|
|
2021-03-23 02:04:10 +01:00
|
|
|
|
|
|
|
/* root node with a non-empty name */
|
2021-09-24 13:14:34 +02:00
|
|
|
treehdr named_root
|
|
|
|
empty_rsvmap named_root
|
2021-03-23 02:04:10 +01:00
|
|
|
|
|
|
|
named_root_struct:
|
2021-09-24 13:14:34 +02:00
|
|
|
beginn "fake"
|
|
|
|
endn
|
|
|
|
fdtlong FDT_END
|
2021-03-23 02:04:10 +01:00
|
|
|
named_root_struct_end:
|
|
|
|
|
|
|
|
named_root_strings:
|
|
|
|
named_root_strings_end:
|
|
|
|
|
|
|
|
named_root_end:
|