blob: 3dd3aca3b6aaa53803b402be79f451313f18604e [file] [log] [blame]
Gerald Van Baren9f0f3582007-04-06 14:17:14 -04001/*
2 * libfdt - Flat Device Tree manipulation
3 * Copyright (C) 2006 David Gibson, IBM Corporation.
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public License
7 * as published by the Free Software Foundation; either version 2.1 of
8 * the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19
Gerald Van Barenc0577a62007-03-31 11:59:59 -040020#ifndef _FDT_H
21#define _FDT_H
22
23#ifndef __ASSEMBLY__
24
25struct fdt_header {
Wolfgang Denk39adcbb2007-04-04 01:49:15 +020026 uint32_t magic; /* magic word FDT_MAGIC */
27 uint32_t totalsize; /* total size of DT block */
28 uint32_t off_dt_struct; /* offset to structure */
29 uint32_t off_dt_strings; /* offset to strings */
30 uint32_t off_mem_rsvmap; /* offset to memory reserve map */
31 uint32_t version; /* format version */
32 uint32_t last_comp_version; /* last compatible version */
Gerald Van Barenc0577a62007-03-31 11:59:59 -040033
Wolfgang Denk39adcbb2007-04-04 01:49:15 +020034 /* version 2 fields below */
35 uint32_t boot_cpuid_phys; /* Which physical CPU id we're
Gerald Van Barenc0577a62007-03-31 11:59:59 -040036 booting on */
37 /* version 3 fields below */
Wolfgang Denk39adcbb2007-04-04 01:49:15 +020038 uint32_t size_dt_strings; /* size of the strings block */
Gerald Van Barenc0577a62007-03-31 11:59:59 -040039
40 /* version 17 fields below */
Wolfgang Denk39adcbb2007-04-04 01:49:15 +020041 uint32_t size_dt_struct; /* size of the structure block */
Gerald Van Barenc0577a62007-03-31 11:59:59 -040042};
43
44struct fdt_reserve_entry {
45 uint64_t address;
46 uint64_t size;
47};
48
49struct fdt_node_header {
50 uint32_t tag;
51 char name[0];
52};
53
54struct fdt_property {
55 uint32_t tag;
56 uint32_t len;
57 uint32_t nameoff;
58 char data[0];
59};
60
61#endif /* !__ASSEMBLY */
62
Wolfgang Denk39adcbb2007-04-04 01:49:15 +020063#define FDT_MAGIC 0xd00dfeed /* 4: version, 4: total size */
Gerald Van Barenc0577a62007-03-31 11:59:59 -040064#define FDT_TAGSIZE sizeof(uint32_t)
65
Wolfgang Denk39adcbb2007-04-04 01:49:15 +020066#define FDT_BEGIN_NODE 0x1 /* Start node: full name */
67#define FDT_END_NODE 0x2 /* End node */
68#define FDT_PROP 0x3 /* Property: name off,
Gerald Van Barenc0577a62007-03-31 11:59:59 -040069 size, content */
70#define FDT_NOP 0x4 /* nop */
71#define FDT_END 0x9
72
73#define FDT_V1_SIZE (7*sizeof(uint32_t))
74#define FDT_V2_SIZE (FDT_V1_SIZE + sizeof(uint32_t))
75#define FDT_V3_SIZE (FDT_V2_SIZE + sizeof(uint32_t))
76#define FDT_V16_SIZE FDT_V3_SIZE
77#define FDT_V17_SIZE (FDT_V16_SIZE + sizeof(uint32_t))
78
79#endif /* _FDT_H */