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