1 /* SPDX-License-Identifier: BSD-3-Clause */
2 /*
3  * This is from the Android Project,
4  * Repository: https://android.googlesource.com/platform/system/libufdt
5  * File: utils/src/dt_table.h
6  * Commit: 2626d8b9e4d8e8c6cc67ceb1dc4e05a47779785c
7  * Copyright (C) 2017 The Android Open Source Project
8  */
9 
10 #ifndef DT_TABLE_H
11 #define DT_TABLE_H
12 
13 #include <linux/types.h>
14 
15 #define DT_TABLE_MAGIC			0xd7b7ab1e
16 #define DT_TABLE_DEFAULT_PAGE_SIZE	2048
17 #define DT_TABLE_DEFAULT_VERSION	0
18 
19 struct dt_table_header {
20 	u32 magic;		/* DT_TABLE_MAGIC */
21 	u32 total_size;		/* includes dt_table_header + all dt_table_entry
22 				 * and all dtb/dtbo
23 				 */
24 	u32 header_size;	/* sizeof(dt_table_header) */
25 
26 	u32 dt_entry_size;	/* sizeof(dt_table_entry) */
27 	u32 dt_entry_count;	/* number of dt_table_entry */
28 	u32 dt_entries_offset;	/* offset to the first dt_table_entry
29 				 * from head of dt_table_header.
30 				 * The value will be equal to header_size if
31 				 * no padding is appended
32 				 */
33 	u32 page_size;		/* flash page size we assume */
34 	u32 version;            /* DTBO image version, the current version is 0.
35 				 * The version will be incremented when the
36 				 * dt_table_header struct is updated.
37 				 */
38 };
39 
40 struct dt_table_entry {
41 	u32 dt_size;
42 	u32 dt_offset;		/* offset from head of dt_table_header */
43 
44 	u32 id;			/* optional, must be zero if unused */
45 	u32 rev;		/* optional, must be zero if unused */
46 	u32 custom[4];		/* optional, must be zero if unused */
47 };
48 
49 #endif
50