Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: (GPL-2.0-or-later OR BSD-2-Clause) */
0002 #ifndef FDT_H
0003 #define FDT_H
0004 /*
0005  * libfdt - Flat Device Tree manipulation
0006  * Copyright (C) 2006 David Gibson, IBM Corporation.
0007  * Copyright 2012 Kim Phillips, Freescale Semiconductor.
0008  */
0009 
0010 #ifndef __ASSEMBLY__
0011 
0012 struct fdt_header {
0013     fdt32_t magic;           /* magic word FDT_MAGIC */
0014     fdt32_t totalsize;       /* total size of DT block */
0015     fdt32_t off_dt_struct;       /* offset to structure */
0016     fdt32_t off_dt_strings;      /* offset to strings */
0017     fdt32_t off_mem_rsvmap;      /* offset to memory reserve map */
0018     fdt32_t version;         /* format version */
0019     fdt32_t last_comp_version;   /* last compatible version */
0020 
0021     /* version 2 fields below */
0022     fdt32_t boot_cpuid_phys;     /* Which physical CPU id we're
0023                         booting on */
0024     /* version 3 fields below */
0025     fdt32_t size_dt_strings;     /* size of the strings block */
0026 
0027     /* version 17 fields below */
0028     fdt32_t size_dt_struct;      /* size of the structure block */
0029 };
0030 
0031 struct fdt_reserve_entry {
0032     fdt64_t address;
0033     fdt64_t size;
0034 };
0035 
0036 struct fdt_node_header {
0037     fdt32_t tag;
0038     char name[];
0039 };
0040 
0041 struct fdt_property {
0042     fdt32_t tag;
0043     fdt32_t len;
0044     fdt32_t nameoff;
0045     char data[];
0046 };
0047 
0048 #endif /* !__ASSEMBLY */
0049 
0050 #define FDT_MAGIC   0xd00dfeed  /* 4: version, 4: total size */
0051 #define FDT_TAGSIZE sizeof(fdt32_t)
0052 
0053 #define FDT_BEGIN_NODE  0x1     /* Start node: full name */
0054 #define FDT_END_NODE    0x2     /* End node */
0055 #define FDT_PROP    0x3     /* Property: name off,
0056                        size, content */
0057 #define FDT_NOP     0x4     /* nop */
0058 #define FDT_END     0x9
0059 
0060 #define FDT_V1_SIZE (7*sizeof(fdt32_t))
0061 #define FDT_V2_SIZE (FDT_V1_SIZE + sizeof(fdt32_t))
0062 #define FDT_V3_SIZE (FDT_V2_SIZE + sizeof(fdt32_t))
0063 #define FDT_V16_SIZE    FDT_V3_SIZE
0064 #define FDT_V17_SIZE    (FDT_V16_SIZE + sizeof(fdt32_t))
0065 
0066 #endif /* FDT_H */