summaryrefslogtreecommitdiffstats
path: root/qemu/dtc/tests/label01.dts
blob: a8958034f75ed4f7f47065aa81d580caccc5e1d5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/dts-v1/;

/memreserve/ 0x1000000000000000 0x0000000002000000;
memrsv2: /memreserve/ 0x2000000000000000 0x0100000000000000;
/memreserve/ 0x0000000000000000 0x0000000000000014;

/ {
	model = "MyBoardName";
	compatible = "MyBoardName", "MyBoardFamilyName";
	#address-cells = <2>;
	#size-cells = <2>;

	cpus {
		linux,phandle = <0x1>;
		#address-cells = <1>;
		#size-cells = <0>;
		PowerPC,970@0 {
			name = "PowerPC,970";
			device_type = "cpu";
			reg = <0x00000000>;
			clock-frequency = <1600000000>;
			timebase-frequency = <33333333>;
			linux,boot-cpu;
			i-cache-size = <65536>;
			d-cache-size = <32768>;
		};

		PowerPC,970@1 {
			name = "PowerPC,970";
			device_type = "cpu";
			reg = <0x00000001>;
			clock-frequency = <1600000000>;
			timebase-frequency = <33333333>;
			i-cache-size = <65536>;
			d-cache-size = <32768>;
		};

	};

	node: randomnode {
		prop: string = str: "foo", str_mid: "stuffstuff\t\t\t\n\n\n" str_end: ;
		blob = [byte: 0a 0b 0c 0d byte_mid: de ea ad be ef byte_end: ];
		ref = < cell: &{/memory@0} 0x0 cell_mid: 0xffffffff cell_end: >;
		mixed = "abc", pre: [1234] post: , gap: < aligned: 0xa 0xb 0xc>;
		tricky1 = [61 lt1: 62 63 00];
		subnode: child {
		};
		/* subnode_end: is auto-generated by node emit */
	};
	/* node_end: is auto-generated by node emit */

	memory@0 {
		device_type = "memory";
		memreg: reg = <0x00000000 0x00000000 0x00000000 0x20000000>;
	};

	chosen {
		bootargs = "root=/dev/sda2";
		linux,platform = <0x600>;
	};

};
00; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */ }
#include <fdt.h>
#include "testdata.h"

#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	;

#define TREE_HDR(tree) \
	.balign	8		; \
	.globl	_##tree		; \
_##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) ;

#define RSVMAP_ENTRY(addr, len) \
	FDTQUAD(addr)		; \
	FDTQUAD(len)		; \

#define EMPTY_RSVMAP(tree) \
	.balign	8		; \
tree##_rsvmap:			; \
	RSVMAP_ENTRY(0, 0) \
tree##_rsvmap_end:		;

#define PROPHDR(tree, name, len) \
	FDTLONG(FDT_PROP)	; \
	FDTLONG(len)		; \
	FDTLONG(tree##_##name - tree##_strings) ;

#define PROP_INT(tree, name, val) \
	PROPHDR(tree, name, 4) \
	FDTLONG(val)		;

#define PROP_INT64(tree, name, val) \
	PROPHDR(tree, name, 8) \
	FDTQUAD(val)		;

#define PROP_STR(tree, name, str) \
	PROPHDR(tree, name, 55f - 54f) \
54:	\
	.string	str		; \
55:	\
	.balign	4		;

#define BEGIN_NODE(name) \
	FDTLONG(FDT_BEGIN_NODE)	; \
	.string	name		; \
	.balign 4		;

#define END_NODE \
	FDTLONG(FDT_END_NODE)	;

#define STRING(tree, name, str) \
tree##_##name:			; \
	.string	str		;

	.data

	TREE_HDR(test_tree1)

	.balign	8
test_tree1_rsvmap:
	RSVMAP_ENTRY(TEST_ADDR_1, TEST_SIZE_1)
	RSVMAP_ENTRY(TEST_ADDR_2, TEST_SIZE_2)
	RSVMAP_ENTRY(0, 0)
test_tree1_rsvmap_end:

test_tree1_struct:
	BEGIN_NODE("")
	PROP_STR(test_tree1, compatible, "test_tree1")
	PROP_INT(test_tree1, prop_int, TEST_VALUE_1)
	PROP_INT64(test_tree1, prop_int64, TEST_VALUE64_1)
	PROP_STR(test_tree1, prop_str, TEST_STRING_1)

	BEGIN_NODE("subnode@1")
	PROP_STR(test_tree1, compatible, "subnode1")
	PROP_INT(test_tree1, prop_int, TEST_VALUE_1)

	BEGIN_NODE("subsubnode")
	PROP_STR(test_tree1, compatible, "subsubnode1\0subsubnode")
	PROP_INT(test_tree1, prop_int, TEST_VALUE_1)
	END_NODE

	BEGIN_NODE("ss1")
	END_NODE

	END_NODE

	BEGIN_NODE("subnode@2")
	PROP_INT(test_tree1, linux_phandle, PHANDLE_1)
	PROP_INT(test_tree1, prop_int, TEST_VALUE_2)

	BEGIN_NODE("subsubnode@0")
	PROP_INT(test_tree1, phandle, PHANDLE_2)
	PROP_STR(test_tree1, compatible, "subsubnode2\0subsubnode")
	PROP_INT(test_tree1, prop_int, TEST_VALUE_2)
	END_NODE

	BEGIN_NODE("ss2")
	END_NODE

	END_NODE

	END_NODE
	FDTLONG(FDT_END)
test_tree1_struct_end:

test_tree1_strings:
	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")
test_tree1_strings_end:
test_tree1_end:


	TREE_HDR(truncated_property)
	EMPTY_RSVMAP(truncated_property)

truncated_property_struct:
	BEGIN_NODE("")
	PROPHDR(truncated_property, prop_truncated, 4)
	/* Oops, no actual property data here */
truncated_property_struct_end:

truncated_property_strings:
	STRING(truncated_property, prop_truncated, "truncated")
truncated_property_strings_end:

truncated_property_end:


	TREE_HDR(bad_node_char)
	EMPTY_RSVMAP(bad_node_char)

bad_node_char_struct:
	BEGIN_NODE("")
	BEGIN_NODE("sub$node")
	END_NODE
	END_NODE
	FDTLONG(FDT_END)
bad_node_char_struct_end:

bad_node_char_strings:
bad_node_char_strings_end:
bad_node_char_end:


	TREE_HDR(bad_node_format)
	EMPTY_RSVMAP(bad_node_format)

bad_node_format_struct:
	BEGIN_NODE("")
	BEGIN_NODE("subnode@1@2")
	END_NODE
	END_NODE
	FDTLONG(FDT_END)
bad_node_format_struct_end:

bad_node_format_strings:
bad_node_format_strings_end:
bad_node_format_end:


	TREE_HDR(bad_prop_char)
	EMPTY_RSVMAP(bad_prop_char)

bad_prop_char_struct:
	BEGIN_NODE("")
	PROP_INT(bad_prop_char, prop, TEST_VALUE_1)
	END_NODE
	FDTLONG(FDT_END)
bad_prop_char_struct_end:

bad_prop_char_strings:
	STRING(bad_prop_char, prop, "prop$erty")
bad_prop_char_strings_end:
bad_prop_char_end: