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