]>
Commit | Line | Data |
---|---|---|
1e57a462 | 1 | #ifndef _FDT_H\r |
2 | #define _FDT_H\r | |
e7108d0e | 3 | \r |
3e8576dd OM |
4 | /*\r |
5 | * libfdt - Flat Device Tree manipulation\r | |
6 | * Copyright (C) 2006 David Gibson, IBM Corporation.\r | |
7 | * Copyright 2012 Kim Phillips, Freescale Semiconductor.\r | |
8 | *\r | |
9 | * libfdt is dual licensed: you can use it either under the terms of\r | |
10 | * the GPL, or the BSD license, at your option.\r | |
11 | *\r | |
12 | * a) This library is free software; you can redistribute it and/or\r | |
13 | * modify it under the terms of the GNU General Public License as\r | |
14 | * published by the Free Software Foundation; either version 2 of the\r | |
15 | * License, or (at your option) any later version.\r | |
16 | *\r | |
17 | * This library is distributed in the hope that it will be useful,\r | |
18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of\r | |
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r | |
20 | * GNU General Public License for more details.\r | |
21 | *\r | |
22 | * You should have received a copy of the GNU General Public\r | |
23 | * License along with this library; if not, write to the Free\r | |
24 | * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,\r | |
25 | * MA 02110-1301 USA\r | |
26 | *\r | |
27 | * Alternatively,\r | |
28 | *\r | |
29 | * b) Redistribution and use in source and binary forms, with or\r | |
30 | * without modification, are permitted provided that the following\r | |
31 | * conditions are met:\r | |
32 | *\r | |
33 | * 1. Redistributions of source code must retain the above\r | |
34 | * copyright notice, this list of conditions and the following\r | |
35 | * disclaimer.\r | |
36 | * 2. Redistributions in binary form must reproduce the above\r | |
37 | * copyright notice, this list of conditions and the following\r | |
38 | * disclaimer in the documentation and/or other materials\r | |
39 | * provided with the distribution.\r | |
40 | *\r | |
41 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND\r | |
42 | * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,\r | |
43 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF\r | |
44 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\r | |
45 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR\r | |
46 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\r | |
47 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\r | |
48 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\r | |
49 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r | |
50 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\r | |
51 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR\r | |
52 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,\r | |
53 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r | |
54 | */\r | |
1e57a462 | 55 | \r |
56 | #ifndef __ASSEMBLY__\r | |
57 | \r | |
58 | struct fdt_header {\r | |
e7108d0e MK |
59 | fdt32_t magic; /* magic word FDT_MAGIC */\r |
60 | fdt32_t totalsize; /* total size of DT block */\r | |
61 | fdt32_t off_dt_struct; /* offset to structure */\r | |
62 | fdt32_t off_dt_strings; /* offset to strings */\r | |
63 | fdt32_t off_mem_rsvmap; /* offset to memory reserve map */\r | |
64 | fdt32_t version; /* format version */\r | |
65 | fdt32_t last_comp_version; /* last compatible version */\r | |
1e57a462 | 66 | \r |
e7108d0e MK |
67 | /* version 2 fields below */\r |
68 | fdt32_t boot_cpuid_phys; /* Which physical CPU id we're\r | |
69 | booting on */\r | |
70 | /* version 3 fields below */\r | |
71 | fdt32_t size_dt_strings; /* size of the strings block */\r | |
1e57a462 | 72 | \r |
e7108d0e MK |
73 | /* version 17 fields below */\r |
74 | fdt32_t size_dt_struct; /* size of the structure block */\r | |
1e57a462 | 75 | };\r |
76 | \r | |
77 | struct fdt_reserve_entry {\r | |
e7108d0e MK |
78 | fdt64_t address;\r |
79 | fdt64_t size;\r | |
1e57a462 | 80 | };\r |
81 | \r | |
82 | struct fdt_node_header {\r | |
e7108d0e MK |
83 | fdt32_t tag;\r |
84 | char name[0];\r | |
1e57a462 | 85 | };\r |
86 | \r | |
87 | struct fdt_property {\r | |
e7108d0e MK |
88 | fdt32_t tag;\r |
89 | fdt32_t len;\r | |
90 | fdt32_t nameoff;\r | |
91 | char data[0];\r | |
1e57a462 | 92 | };\r |
93 | \r | |
94 | #endif /* !__ASSEMBLY */\r | |
95 | \r | |
e7108d0e MK |
96 | #define FDT_MAGIC 0xd00dfeed /* 4: version, 4: total size */\r |
97 | #define FDT_TAGSIZE sizeof(fdt32_t)\r | |
1e57a462 | 98 | \r |
e7108d0e MK |
99 | #define FDT_BEGIN_NODE 0x1 /* Start node: full name */\r |
100 | #define FDT_END_NODE 0x2 /* End node */\r | |
101 | #define FDT_PROP 0x3 /* Property: name off,\r | |
102 | size, content */\r | |
103 | #define FDT_NOP 0x4 /* nop */\r | |
104 | #define FDT_END 0x9\r | |
1e57a462 | 105 | \r |
e7108d0e MK |
106 | #define FDT_V1_SIZE (7*sizeof(fdt32_t))\r |
107 | #define FDT_V2_SIZE (FDT_V1_SIZE + sizeof(fdt32_t))\r | |
108 | #define FDT_V3_SIZE (FDT_V2_SIZE + sizeof(fdt32_t))\r | |
109 | #define FDT_V16_SIZE FDT_V3_SIZE\r | |
110 | #define FDT_V17_SIZE (FDT_V16_SIZE + sizeof(fdt32_t))\r | |
1e57a462 | 111 | \r |
112 | #endif /* _FDT_H */\r |