1 | /* SPDX-License-Identifier: (GPL-2.0-or-later OR BSD-2-Clause) */ |
2 | #ifndef FDT_H |
3 | #define FDT_H |
4 | /* |
5 | * libfdt - Flat Device Tree manipulation |
6 | * Copyright (C) 2006 David Gibson, IBM Corporation. |
7 | * Copyright 2012 Kim Phillips, Freescale Semiconductor. |
8 | */ |
9 | |
10 | #ifndef __ASSEMBLY__ |
11 | |
12 | struct { |
13 | fdt32_t ; /* magic word FDT_MAGIC */ |
14 | fdt32_t ; /* total size of DT block */ |
15 | fdt32_t ; /* offset to structure */ |
16 | fdt32_t ; /* offset to strings */ |
17 | fdt32_t ; /* offset to memory reserve map */ |
18 | fdt32_t ; /* format version */ |
19 | fdt32_t ; /* last compatible version */ |
20 | |
21 | /* version 2 fields below */ |
22 | fdt32_t ; /* Which physical CPU id we're |
23 | booting on */ |
24 | /* version 3 fields below */ |
25 | fdt32_t ; /* size of the strings block */ |
26 | |
27 | /* version 17 fields below */ |
28 | fdt32_t ; /* size of the structure block */ |
29 | }; |
30 | |
31 | struct fdt_reserve_entry { |
32 | fdt64_t address; |
33 | fdt64_t size; |
34 | }; |
35 | |
36 | struct { |
37 | fdt32_t ; |
38 | char [0]; |
39 | }; |
40 | |
41 | struct fdt_property { |
42 | fdt32_t tag; |
43 | fdt32_t len; |
44 | fdt32_t nameoff; |
45 | char data[0]; |
46 | }; |
47 | |
48 | #endif /* !__ASSEMBLY */ |
49 | |
50 | #define FDT_MAGIC 0xd00dfeed /* 4: version, 4: total size */ |
51 | #define FDT_TAGSIZE sizeof(fdt32_t) |
52 | |
53 | #define FDT_BEGIN_NODE 0x1 /* Start node: full name */ |
54 | #define FDT_END_NODE 0x2 /* End node */ |
55 | #define FDT_PROP 0x3 /* Property: name off, |
56 | size, content */ |
57 | #define FDT_NOP 0x4 /* nop */ |
58 | #define FDT_END 0x9 |
59 | |
60 | #define FDT_V1_SIZE (7*sizeof(fdt32_t)) |
61 | #define FDT_V2_SIZE (FDT_V1_SIZE + sizeof(fdt32_t)) |
62 | #define FDT_V3_SIZE (FDT_V2_SIZE + sizeof(fdt32_t)) |
63 | #define FDT_V16_SIZE FDT_V3_SIZE |
64 | #define FDT_V17_SIZE (FDT_V16_SIZE + sizeof(fdt32_t)) |
65 | |
66 | #endif /* FDT_H */ |
67 | |