1 /* 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 20 #ifndef _FDT_H 21 #define _FDT_H 22 23 #ifndef __ASSEMBLY__ 24 25 struct fdt_header { 26 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 */ 33 34 /* version 2 fields below */ 35 uint32_t boot_cpuid_phys; /* Which physical CPU id we're 36 booting on */ 37 /* version 3 fields below */ 38 uint32_t size_dt_strings; /* size of the strings block */ 39 40 /* version 17 fields below */ 41 uint32_t size_dt_struct; /* size of the structure block */ 42 }; 43 44 struct fdt_reserve_entry { 45 uint64_t address; 46 uint64_t size; 47 }; 48 49 struct fdt_node_header { 50 uint32_t tag; 51 char name[0]; 52 }; 53 54 struct fdt_property { 55 uint32_t tag; 56 uint32_t len; 57 uint32_t nameoff; 58 char data[0]; 59 }; 60 61 #endif /* !__ASSEMBLY */ 62 63 #define FDT_MAGIC 0xd00dfeed /* 4: version, 4: total size */ 64 #define FDT_TAGSIZE sizeof(uint32_t) 65 66 #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, 69 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 */ 80