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