112869ecdSRob Herring /* SPDX-License-Identifier: (GPL-2.0-or-later OR BSD-2-Clause) */ 29130ba88SRob Herring #ifndef FDT_H 39130ba88SRob Herring #define FDT_H 447605971SRob Herring /* 547605971SRob Herring * libfdt - Flat Device Tree manipulation 647605971SRob Herring * Copyright (C) 2006 David Gibson, IBM Corporation. 747605971SRob Herring * Copyright 2012 Kim Phillips, Freescale Semiconductor. 847605971SRob Herring */ 99fffb55fSDavid Gibson 109fffb55fSDavid Gibson #ifndef __ASSEMBLY__ 119fffb55fSDavid Gibson 129fffb55fSDavid Gibson struct fdt_header { 1347605971SRob Herring fdt32_t magic; /* magic word FDT_MAGIC */ 1447605971SRob Herring fdt32_t totalsize; /* total size of DT block */ 1547605971SRob Herring fdt32_t off_dt_struct; /* offset to structure */ 1647605971SRob Herring fdt32_t off_dt_strings; /* offset to strings */ 1747605971SRob Herring fdt32_t off_mem_rsvmap; /* offset to memory reserve map */ 1847605971SRob Herring fdt32_t version; /* format version */ 1947605971SRob Herring fdt32_t last_comp_version; /* last compatible version */ 209fffb55fSDavid Gibson 219fffb55fSDavid Gibson /* version 2 fields below */ 2247605971SRob Herring fdt32_t boot_cpuid_phys; /* Which physical CPU id we're 239fffb55fSDavid Gibson booting on */ 249fffb55fSDavid Gibson /* version 3 fields below */ 2547605971SRob Herring fdt32_t size_dt_strings; /* size of the strings block */ 269fffb55fSDavid Gibson 279fffb55fSDavid Gibson /* version 17 fields below */ 2847605971SRob Herring fdt32_t size_dt_struct; /* size of the structure block */ 299fffb55fSDavid Gibson }; 309fffb55fSDavid Gibson 319fffb55fSDavid Gibson struct fdt_reserve_entry { 3247605971SRob Herring fdt64_t address; 3347605971SRob Herring fdt64_t size; 349fffb55fSDavid Gibson }; 359fffb55fSDavid Gibson 369fffb55fSDavid Gibson struct fdt_node_header { 3747605971SRob Herring fdt32_t tag; 38*ec340077SRob Herring char name[]; 399fffb55fSDavid Gibson }; 409fffb55fSDavid Gibson 419fffb55fSDavid Gibson struct fdt_property { 4247605971SRob Herring fdt32_t tag; 4347605971SRob Herring fdt32_t len; 4447605971SRob Herring fdt32_t nameoff; 45*ec340077SRob Herring char data[]; 469fffb55fSDavid Gibson }; 479fffb55fSDavid Gibson 489fffb55fSDavid Gibson #endif /* !__ASSEMBLY */ 499fffb55fSDavid Gibson 509fffb55fSDavid Gibson #define FDT_MAGIC 0xd00dfeed /* 4: version, 4: total size */ 5147605971SRob Herring #define FDT_TAGSIZE sizeof(fdt32_t) 529fffb55fSDavid Gibson 539fffb55fSDavid Gibson #define FDT_BEGIN_NODE 0x1 /* Start node: full name */ 549fffb55fSDavid Gibson #define FDT_END_NODE 0x2 /* End node */ 559fffb55fSDavid Gibson #define FDT_PROP 0x3 /* Property: name off, 569fffb55fSDavid Gibson size, content */ 579fffb55fSDavid Gibson #define FDT_NOP 0x4 /* nop */ 589fffb55fSDavid Gibson #define FDT_END 0x9 599fffb55fSDavid Gibson 6047605971SRob Herring #define FDT_V1_SIZE (7*sizeof(fdt32_t)) 6147605971SRob Herring #define FDT_V2_SIZE (FDT_V1_SIZE + sizeof(fdt32_t)) 6247605971SRob Herring #define FDT_V3_SIZE (FDT_V2_SIZE + sizeof(fdt32_t)) 639fffb55fSDavid Gibson #define FDT_V16_SIZE FDT_V3_SIZE 6447605971SRob Herring #define FDT_V17_SIZE (FDT_V16_SIZE + sizeof(fdt32_t)) 659fffb55fSDavid Gibson 669130ba88SRob Herring #endif /* FDT_H */ 67