ipq40xx: Add ipq-aux-loader
[openwrt/staging/lynxis.git] / target / linux / ipq40xx / image / ipq-aux-loader / src / src / include / uimage / fdt.h
1 /*
2 * Auxiliary kernel loader for Qualcom IPQ-4XXX/806X based boards
3 *
4 * Copyright (C) 2019 Sergey Sergeev <adron@mstnt.com>
5 *
6 * Some structures and code has been taken from the U-Boot project.
7 * (C) Copyright 2008 Semihalf
8 * (C) Copyright 2000-2005
9 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
10 *
11 * This program is free software; you can redistribute it and/or modify it
12 * under the terms of the GNU General Public License version 2 as published
13 * by the Free Software Foundation.
14 */
15
16 #ifndef _FDT_H
17 #define _FDT_H
18
19 #ifndef __ASSEMBLY__
20
21 struct fdt_header {
22 uint32_t magic; /* magic word FDT_MAGIC */
23 uint32_t totalsize; /* total size of DT block */
24 uint32_t off_dt_struct; /* offset to structure */
25 uint32_t off_dt_strings; /* offset to strings */
26 uint32_t off_mem_rsvmap; /* offset to memory reserve map */
27 uint32_t version; /* format version */
28 uint32_t last_comp_version; /* last compatible version */
29
30 /* version 2 fields below */
31 uint32_t boot_cpuid_phys; /* Which physical CPU id we're
32 booting on */
33 /* version 3 fields below */
34 uint32_t size_dt_strings; /* size of the strings block */
35
36 /* version 17 fields below */
37 uint32_t size_dt_struct; /* size of the structure block */
38 };
39
40 struct fdt_reserve_entry {
41 uint64_t address;
42 uint64_t size;
43 };
44
45 struct fdt_node_header {
46 uint32_t tag;
47 char name[0];
48 };
49
50 struct fdt_property {
51 uint32_t tag;
52 uint32_t len;
53 uint32_t nameoff;
54 char data[0];
55 };
56
57 #endif /* !__ASSEMBLY */
58
59 #define FDT_MAGIC 0xd00dfeed /* 4: version, 4: total size */
60 #define FDT_TAGSIZE sizeof(uint32_t)
61
62 #define FDT_BEGIN_NODE 0x1 /* Start node: full name */
63 #define FDT_END_NODE 0x2 /* End node */
64 #define FDT_PROP 0x3 /* Property: name off,
65 size, content */
66 #define FDT_NOP 0x4 /* nop */
67 #define FDT_END 0x9
68
69 #define FDT_V1_SIZE (7*sizeof(uint32_t))
70 #define FDT_V2_SIZE (FDT_V1_SIZE + sizeof(uint32_t))
71 #define FDT_V3_SIZE (FDT_V2_SIZE + sizeof(uint32_t))
72 #define FDT_V16_SIZE FDT_V3_SIZE
73 #define FDT_V17_SIZE (FDT_V16_SIZE + sizeof(uint32_t))
74
75 /* adding a ramdisk needs 0x44 bytes in version 2008.10 */
76 #define FDT_RAMDISK_OVERHEAD 0x80
77 #endif /* _FDT_H */