xref: /rk3399_rockchip-uboot/include/fdt.h (revision 87c8431fe24d48121f053fe67cff4ccfe097d4d1)
1 #ifndef _FDT_H
2 #define _FDT_H
3 
4 #ifndef __ASSEMBLY__
5 
6 #ifdef USE_HOSTCC
7 #include <stdint.h>
8 #endif
9 
10 struct fdt_header {
11 	uint32_t magic;			 /* magic word FDT_MAGIC */
12 	uint32_t totalsize;		 /* total size of DT block */
13 	uint32_t off_dt_struct;		 /* offset to structure */
14 	uint32_t off_dt_strings;	 /* offset to strings */
15 	uint32_t off_mem_rsvmap;	 /* offset to memory reserve map */
16 	uint32_t version;		 /* format version */
17 	uint32_t last_comp_version;	 /* last compatible version */
18 
19 	/* version 2 fields below */
20 	uint32_t boot_cpuid_phys;	 /* Which physical CPU id we're
21 					    booting on */
22 	/* version 3 fields below */
23 	uint32_t size_dt_strings;	 /* size of the strings block */
24 
25 	/* version 17 fields below */
26 	uint32_t size_dt_struct;	 /* size of the structure block */
27 };
28 
29 struct fdt_reserve_entry {
30 	uint64_t address;
31 	uint64_t size;
32 };
33 
34 struct fdt_node_header {
35 	uint32_t tag;
36 	char name[0];
37 };
38 
39 struct fdt_property {
40 	uint32_t tag;
41 	uint32_t len;
42 	uint32_t nameoff;
43 	char data[0];
44 };
45 
46 #endif /* !__ASSEMBLY */
47 
48 #define FDT_MAGIC	0xd00dfeed	/* 4: version, 4: total size */
49 #define FDT_TAGSIZE	sizeof(uint32_t)
50 
51 #define FDT_BEGIN_NODE	0x1		/* Start node: full name */
52 #define FDT_END_NODE	0x2		/* End node */
53 #define FDT_PROP	0x3		/* Property: name off,
54 					   size, content */
55 #define FDT_NOP		0x4		/* nop */
56 #define FDT_END		0x9
57 
58 #define FDT_V1_SIZE	(7*sizeof(uint32_t))
59 #define FDT_V2_SIZE	(FDT_V1_SIZE + sizeof(uint32_t))
60 #define FDT_V3_SIZE	(FDT_V2_SIZE + sizeof(uint32_t))
61 #define FDT_V16_SIZE	FDT_V3_SIZE
62 #define FDT_V17_SIZE	(FDT_V16_SIZE + sizeof(uint32_t))
63 
64 #endif /* _FDT_H */
65