2019-12-02 10:34:21 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
#define FDT_MAGIC_STR "\xd0\x0d\xfe\xed"
|
|
|
|
#define DT_TABLE_MAGIC "\xd7\xb7\xab\x1e"
|
|
|
|
#define QCDT_MAGIC "QCDT"
|
|
|
|
#define DTBH_MAGIC "DTBH"
|
|
|
|
#define PXADT_MAGIC "PXA-DT"
|
|
|
|
#define PXA19xx_MAGIC "PXA-19xx"
|
|
|
|
#define SPRD_MAGIC "SPRD"
|
|
|
|
|
|
|
|
struct qcdt_hdr {
|
2020-12-31 07:11:24 +01:00
|
|
|
char magic[4]; /* "QCDT" */
|
|
|
|
uint32_t version; /* QCDT version */
|
|
|
|
uint32_t num_dtbs; /* Number of DTBs */
|
2019-12-02 10:34:21 +01:00
|
|
|
} __attribute__((packed));
|
|
|
|
|
|
|
|
struct qctable_v1 {
|
2020-12-31 07:11:24 +01:00
|
|
|
uint32_t cpu_info[3]; /* Some CPU info */
|
|
|
|
uint32_t offset; /* DTB offset in QCDT */
|
|
|
|
uint32_t len; /* DTB size */
|
2019-12-02 10:34:21 +01:00
|
|
|
} __attribute__((packed));
|
|
|
|
|
|
|
|
struct qctable_v2 {
|
2020-12-31 07:11:24 +01:00
|
|
|
uint32_t cpu_info[4]; /* Some CPU info */
|
|
|
|
uint32_t offset; /* DTB offset in QCDT */
|
|
|
|
uint32_t len; /* DTB size */
|
2019-12-02 10:34:21 +01:00
|
|
|
} __attribute__((packed));
|
|
|
|
|
|
|
|
struct qctable_v3 {
|
2020-12-31 07:11:24 +01:00
|
|
|
uint32_t cpu_info[8]; /* Some CPU info */
|
|
|
|
uint32_t offset; /* DTB offset in QCDT */
|
|
|
|
uint32_t len; /* DTB size */
|
2019-12-02 10:34:21 +01:00
|
|
|
} __attribute__((packed));
|
|
|
|
|
|
|
|
struct dtbh_hdr {
|
2020-12-31 07:11:24 +01:00
|
|
|
char magic[4]; /* "DTBH" */
|
|
|
|
uint32_t version; /* DTBH version */
|
|
|
|
uint32_t num_dtbs; /* Number of DTBs */
|
2019-12-02 10:34:21 +01:00
|
|
|
} __attribute__((packed));
|
|
|
|
|
|
|
|
struct bhtable_v2 {
|
2020-12-31 07:11:24 +01:00
|
|
|
uint32_t cpu_info[5]; /* Some CPU info */
|
|
|
|
uint32_t offset; /* DTB offset in DTBH */
|
|
|
|
uint32_t len; /* DTB size */
|
|
|
|
uint32_t space; /* 0x00000020 */
|
2019-12-02 10:34:21 +01:00
|
|
|
} __attribute__((packed));
|
|
|
|
|
|
|
|
struct pxadt_hdr {
|
2020-12-31 07:11:24 +01:00
|
|
|
char magic[6]; /* "PXA-DT" */
|
|
|
|
uint32_t version; /* PXA-* version */
|
|
|
|
uint32_t num_dtbs; /* Number of DTBs */
|
2019-12-02 10:34:21 +01:00
|
|
|
} __attribute__((packed));
|
|
|
|
|
|
|
|
struct pxa19xx_hdr {
|
2020-12-31 07:11:24 +01:00
|
|
|
char magic[8]; /* "PXA-19xx" */
|
|
|
|
uint32_t version; /* PXA-* version */
|
|
|
|
uint32_t num_dtbs; /* Number of DTBs */
|
2019-12-02 10:34:21 +01:00
|
|
|
} __attribute__((packed));
|
|
|
|
|
|
|
|
struct pxatable_v1 {
|
2020-12-31 07:11:24 +01:00
|
|
|
uint32_t cpu_info[2]; /* Some CPU info */
|
|
|
|
uint32_t offset; /* DTB offset in PXA-* */
|
|
|
|
uint32_t len; /* DTB size */
|
2019-12-02 10:34:21 +01:00
|
|
|
} __attribute__((packed));
|
|
|
|
|
|
|
|
struct sprd_hdr {
|
2020-12-31 07:11:24 +01:00
|
|
|
char magic[4]; /* "SPRD" */
|
|
|
|
uint32_t version; /* SPRD version */
|
|
|
|
uint32_t num_dtbs; /* Number of DTBs */
|
2019-12-02 10:34:21 +01:00
|
|
|
} __attribute__((packed));
|
|
|
|
|
|
|
|
struct sprdtable_v1 {
|
2020-12-31 07:11:24 +01:00
|
|
|
uint32_t cpu_info[3]; /* Some CPU info */
|
|
|
|
uint32_t offset; /* DTB offset in SPRD */
|
|
|
|
uint32_t len; /* DTB size */
|
2019-12-02 10:34:21 +01:00
|
|
|
} __attribute__((packed));
|
|
|
|
|
|
|
|
/* AOSP DTB/DTBO partition layout */
|
|
|
|
|
|
|
|
struct dt_table_header {
|
2020-12-31 07:11:24 +01:00
|
|
|
uint32_t magic; /* DT_TABLE_MAGIC */
|
|
|
|
uint32_t total_size; /* includes dt_table_header + all dt_table_entry */
|
|
|
|
uint32_t header_size; /* sizeof(dt_table_header) */
|
2019-12-02 10:34:21 +01:00
|
|
|
|
2020-12-31 07:11:24 +01:00
|
|
|
uint32_t dt_entry_size; /* sizeof(dt_table_entry) */
|
|
|
|
uint32_t num_dtbs; /* number of dt_table_entry */
|
|
|
|
uint32_t dt_entries_offset; /* offset to the first dt_table_entry */
|
2019-12-02 10:34:21 +01:00
|
|
|
|
2020-12-31 07:11:24 +01:00
|
|
|
uint32_t page_size; /* flash page size we assume */
|
|
|
|
uint32_t version; /* DTBO image version */
|
2019-12-02 10:34:21 +01:00
|
|
|
} __attribute__((packed));
|
|
|
|
|
|
|
|
struct dt_table_entry {
|
2020-12-31 07:11:24 +01:00
|
|
|
uint32_t len; /* DTB size */
|
|
|
|
uint32_t offset;
|
2019-12-02 10:34:21 +01:00
|
|
|
|
2020-12-31 07:11:24 +01:00
|
|
|
uint32_t id;
|
|
|
|
uint32_t rev;
|
|
|
|
uint32_t flags;
|
2019-12-02 10:34:21 +01:00
|
|
|
|
2020-12-31 07:11:24 +01:00
|
|
|
uint32_t custom[3];
|
2019-12-02 10:34:21 +01:00
|
|
|
} __attribute__((packed));
|